{"version":3,"sources":["webpack:///../node_modules/@cfc/audiences/dist/index.esm.js","webpack:///../node_modules/@cfc/clifford/dist/enums.js","webpack:///../node_modules/@cfc/common-types/dist/common-types.esm.js","webpack:///../node_modules/@cfc/content-service-common/dist/index.js","webpack:///../node_modules/@cfc/content-service-common/dist/types.js","webpack:///../node_modules/@cfc/content-service-sdk/dist/client.js","webpack:///../node_modules/@cfc/content-service-sdk/dist/index.js","webpack:///../node_modules/@cfc/elmo/dist/current.js","webpack:///../node_modules/@cfc/exponential-backoff/dist/index.esm.js","webpack:///../node_modules/@cfc/secondstep-audio/dist/Audio.js","webpack:///../node_modules/@cfc/secondstep-audio/dist/index.js"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4BAA4B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,wBAAwB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,sBAAsB;AACvB;AACA;AACA;AACA;AACA,CAAC,gCAAgC;AACjC;AACA;AACA;AACA;AACA,CAAC,gCAAgC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,wBAAwB;AAC1E,8CAA8C,sBAAsB;AACpE,4CAA4C,qBAAqB;AACjE;AACA,gCAAgC,oCAAoC;AACpE;AACA,yDAAyD,cAAc;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC,8BAA8B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA,2EAA2E;AAC3E;AACA;AACA;AACA,6EAA6E;AAC7E;AACA;AACA;AACA,yGAAyG;AACzG;AACA;AACA,qFAAqF;AACrF;AACA;AACA,oFAAoF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,kBAAkB;AAClB,iBAAiB;AACjB,gCAAgC;AAChC;AACA,sBAAsB;AACtB,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB,sBAAsB;AACtB,qBAAqB;AACrB,oCAAoC;AACpC;AACA,0BAA0B;AAC1B,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEqL;AACrL;;;;;;;;;;;;;;;AC/mBa;;AAEb;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2B;;;;;;;;;;;;;;AClLA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,wCAAwC;;AAEf;AAC1B;;;;;;;;;;;;;;;ACXa;AACb,8CAA8C,cAAc;AAC5D;AACA,gBAAgB,mBAAO,CAAC,0EAAS;AACjC,6CAA6C,qCAAqC,0BAA0B,EAAE,EAAE;;;;;;;;;;;;;;;ACJnG;AACb,8CAA8C,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,kDAAkD;;;;;;;;;;;;;;;ACpDtC;AACb;AACA,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;AACA,8CAA8C,cAAc;AAC5D,oBAAoB,mBAAO,CAAC,wEAAgB;AAC5C,uBAAuB,mBAAO,CAAC,qFAAmB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,wBAAwB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB,kBAAkB,eAAe,GAAG,mDAAmD;AACtJ;AACA,0DAA0D,oBAAoB;AAC9E;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB,6BAA6B,eAAe,GAAG,6DAA6D;AAC3K;AACA,0DAA0D,oBAAoB;AAC9E;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA,4DAA4D,oBAAoB;AAChF;AACA;AACA,SAAS;AACT;AACA;AACA;;;;;;;;;;;;;;;AClGa;AACb;AACA,4CAA4C;AAC5C;AACA,8CAA8C,cAAc;AAC5D,iCAAiC,mBAAO,CAAC,yEAAU;AACnD;;;;;;;;;;;;;;ACNA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,gCAAgC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,kBAAkB;AAClF;AACA,yDAAyD,cAAc;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,iCAAiC;AAClF,wHAAwH,mBAAmB,EAAE;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,0BAA0B,EAAE;AAC/D,yCAAyC,eAAe;AACxD;AACA;AACA;AACA;AACA;AACA,8DAA8D,+DAA+D;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,UAAU,cAAc,8FAA8F;AACtH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,cAAc;;AAE9D;AACA,iDAAiD;AACjD;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA,OAAO,cAAc;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA,GAAG;AACH,CAAC;;AAED,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iGAAiG,eAAe,EAAE;AAClH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iGAAiG,cAAc,EAAE;AACjH;AACA;AACA;AACA;AACA;;AAEA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iGAAiG,cAAc,EAAE;AACjH;AACA;AACA;AACA;AACA;;AAEA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iGAAiG,cAAc,EAAE;AACjH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;AAGA;AACA,WAAW,cAAc,6CAA6C,0BAA0B,wBAAwB,EAAE;;AAE1H;AACA,gFAAgF,gBAAgB;AAChG;;AAEA;AACA;AACA;AACA;;AAEA,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iGAAiG,oBAAoB,EAAE;AACvH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,OAAO;;AAEP,UAAU;AACV,mC;;;;;;;;;;;;;ACteA;AAAA;AAAA;AAA+C;;AAE/C;AACA,2CAA2C,gCAAgC,sBAAsB,EAAE,MAAM,EAAE;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,gCAAgC;AAChE,6BAA6B,eAAe;AAC5C,WAAW,+DAAS;AACpB;AACA,mBAAmB,+DAAS;AAC5B;AACA,uBAAuB,iEAAW;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,iCAAiC,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA,eAAe,iEAAW;AAC1B;AACA,SAAS;AACT,KAAK;AACL;;AAE0C;AAC1C;;;;;;;;;;;;;;;AC7Da;AACb;AACA,4CAA4C;AAC5C;AACA,8CAA8C,cAAc;AAC5D,sBAAsB,mBAAO,CAAC,+DAAmB;AACjD,gDAAgD,mBAAO,CAAC,gFAAuB;AAC/E,mBAAO,CAAC,kGAAsC;AAC9C;AACA,WAAW,MAAM;AACjB,qEAAqE,4BAA4B;AACjG;AACA;;;;;;;;;;;;;;;ACZa;AACb;AACA,4CAA4C;AAC5C;AACA,8CAA8C,cAAc;AAC5D;AACA,cAAc,mBAAO,CAAC,oEAAS;AAC/B,2CAA2C,qCAAqC,yCAAyC,EAAE,EAAE","file":"vendor.cfc.f8ca5ae716dc3b3e471b.js","sourcesContent":["const DEFAULT_KEY = 'default';\r\n// invalidCombination rules\r\nconst SELA_EXCLUSIVE_ROLES = 'SELAExclusiveRoles';\n\nvar Programs;\r\n(function (Programs) {\r\n Programs[\"Elementary\"] = \"k5SelDigital\";\r\n Programs[\"OutOfSchool\"] = \"ostKit\";\r\n Programs[\"MiddleSchool\"] = \"mspDigital\";\r\n Programs[\"HighSchool\"] = \"highSchool\";\r\n Programs[\"SELA\"] = \"sela\";\r\n Programs[\"EarlyLearning\"] = \"elSelKit\";\r\n Programs[\"K5Kit\"] = \"k5SelKit\";\r\n Programs[\"MiddleSchoolKit\"] = \"mspKit\";\r\n Programs[\"AccessSSPKit\"] = \"sspKit\";\r\n Programs[\"BPUKit\"] = \"bpuKit\";\r\n Programs[\"AccessBPUTraining\"] = \"bpuDigital\";\r\n Programs[\"CPUKit\"] = \"cpuKit\";\r\n Programs[\"AccessCPUTraining\"] = \"cpuDigital\";\r\n Programs[\"FieldTestSELA\"] = \"fTsela\";\r\n})(Programs || (Programs = {}));\r\nvar Grades;\r\n(function (Grades) {\r\n Grades[\"EarlyLearning\"] = \"E\";\r\n Grades[\"GradeK\"] = \"K\";\r\n Grades[\"Grade1\"] = \"1\";\r\n Grades[\"Grade2\"] = \"2\";\r\n Grades[\"Grade3\"] = \"3\";\r\n Grades[\"Grade4\"] = \"4\";\r\n Grades[\"Grade5\"] = \"5\";\r\n Grades[\"Grade6\"] = \"6\";\r\n Grades[\"Grade7\"] = \"7\";\r\n Grades[\"Grade8\"] = \"8\";\r\n Grades[\"HighSchool\"] = \"highschool\";\r\n Grades[\"Adult\"] = \"adult\";\r\n})(Grades || (Grades = {}));\r\nvar Roles;\r\n(function (Roles) {\r\n Roles[\"Administrator\"] = \"admin\";\r\n Roles[\"Coordinator\"] = \"coordinator\";\r\n Roles[\"Teacher\"] = \"teacher\";\r\n Roles[\"Family\"] = \"family\";\r\n Roles[\"LeaderTeam\"] = \"leader\";\r\n Roles[\"Staff\"] = \"staff\";\r\n Roles[\"Public\"] = \"public\";\r\n})(Roles || (Roles = {}));\r\nvar OptInUnits;\r\n(function (OptInUnits) {\r\n OptInUnits[\"BullyingHarassment\"] = \"MS: Bullying Unit on\";\r\n OptInUnits[\"BullyingHarassmentOff\"] = \"MS: Bullying Unit off\";\r\n})(OptInUnits || (OptInUnits = {}));\r\nvar Activities;\r\n(function (Activities) {\r\n Activities[\"HighSchoolStudentActivitiesOn\"] = \"HS student activities on\";\r\n Activities[\"HighSchoolStudentActivitiesOff\"] = \"HS student activities off\";\r\n})(Activities || (Activities = {}));\r\nclass Audiences {\r\n constructor(isDefault, programs, grades, roles, implementationLevels, mindYeti, optInUnits, activities) {\r\n this.isDefault = isDefault;\r\n this.programs = programs;\r\n this.grades = grades;\r\n this.roles = roles;\r\n this.implementationLevels = implementationLevels;\r\n this.mindYeti = mindYeti;\r\n this.optInUnits = optInUnits;\r\n this.activities = activities;\r\n }\r\n toKey() {\r\n var _a, _b, _c, _d, _e;\r\n if (this.isDefault) {\r\n return DEFAULT_KEY;\r\n }\r\n let key = '';\r\n key += this.programs.length ? `programs:${this.programs.join(',')}-` : '';\r\n key += this.grades.length ? `grades:${this.grades.join(',')}-` : '';\r\n key += this.roles.length ? `roles:${this.roles.join(',')}-` : '';\r\n key += ((_a = this.implementationLevels) === null || _a === void 0 ? void 0 : _a.length)\r\n ? `implementation:${this.implementationLevels.join(',')}-`\r\n : '';\r\n key += this.mindYeti !== undefined ? `mindYeti:${this.mindYeti}-` : '';\r\n // TODO: add other optInUnits values as they are defined\r\n key +=\r\n ((_b = this.optInUnits) === null || _b === void 0 ? void 0 : _b.length) &&\r\n this.optInUnits.includes(OptInUnits.BullyingHarassment)\r\n ? `bullyingHarassment:true-`\r\n : '';\r\n key +=\r\n ((_c = this.optInUnits) === null || _c === void 0 ? void 0 : _c.length) &&\r\n this.optInUnits.includes(OptInUnits.BullyingHarassmentOff)\r\n ? `bullyingHarassment:false-`\r\n : '';\r\n // TODO: add other activities values as they are defined\r\n key +=\r\n ((_d = this.activities) === null || _d === void 0 ? void 0 : _d.length) &&\r\n this.activities.includes(Activities.HighSchoolStudentActivitiesOn)\r\n ? `highSchoolActivities:true-`\r\n : '';\r\n key +=\r\n ((_e = this.activities) === null || _e === void 0 ? void 0 : _e.length) &&\r\n this.activities.includes(Activities.HighSchoolStudentActivitiesOff)\r\n ? `highSchoolActivities:false-`\r\n : '';\r\n // slice of the last '-' character:\r\n return key.substring(0, key.length - 1);\r\n }\r\n static create(plainObject) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;\r\n if (plainObject.isDefault) {\r\n return Audiences.DEFAULT;\r\n }\r\n return new Audiences(false, (_b = (_a = plainObject.programs) === null || _a === void 0 ? void 0 : _a.sort()) !== null && _b !== void 0 ? _b : [], (_d = (_c = plainObject.grades) === null || _c === void 0 ? void 0 : _c.sort()) !== null && _d !== void 0 ? _d : [], (_f = (_e = plainObject.roles) === null || _e === void 0 ? void 0 : _e.sort()) !== null && _f !== void 0 ? _f : [], (_k = (_h = (_g = plainObject.implementationLevel) === null || _g === void 0 ? void 0 : _g.sort()) !== null && _h !== void 0 ? _h : (_j = plainObject.implementationLevels) === null || _j === void 0 ? void 0 : _j.sort()) !== null && _k !== void 0 ? _k : undefined, (_l = plainObject.mindYeti) !== null && _l !== void 0 ? _l : undefined, (_o = (_m = plainObject.optInUnits) === null || _m === void 0 ? void 0 : _m.sort()) !== null && _o !== void 0 ? _o : undefined, (_q = (_p = plainObject.activities) === null || _p === void 0 ? void 0 : _p.sort()) !== null && _q !== void 0 ? _q : undefined);\r\n }\r\n static restoreFromDatabase(serializedAudience) {\r\n const coercedAudience = serializedAudience;\r\n try {\r\n return Audiences.create(coercedAudience);\r\n }\r\n catch (_a) {\r\n return undefined;\r\n }\r\n }\r\n}\r\nAudiences.DEFAULT = new Audiences(true, [], [], []);\n\nconst WEIGHTS = {\r\n programs: {\r\n [Programs.K5Kit]: 1,\r\n [Programs.MiddleSchool]: 1,\r\n [Programs.Elementary]: 1,\r\n [Programs.OutOfSchool]: 1,\r\n [Programs.HighSchool]: 1,\r\n [Programs.SELA]: 1,\r\n [Programs.EarlyLearning]: 1,\r\n [Programs.MiddleSchoolKit]: 1,\r\n [Programs.AccessSSPKit]: 1,\r\n [Programs.BPUKit]: 1,\r\n [Programs.AccessBPUTraining]: 1,\r\n [Programs.CPUKit]: 1,\r\n [Programs.AccessCPUTraining]: 1,\r\n [Programs.FieldTestSELA]: 1,\r\n },\r\n roles: {\r\n [Roles.Teacher]: 3,\r\n [Roles.Administrator]: 5,\r\n [Roles.Coordinator]: 5,\r\n [Roles.Family]: 2,\r\n [Roles.LeaderTeam]: 4,\r\n [Roles.Staff]: 3,\r\n [Roles.Public]: 1,\r\n },\r\n grades: {\r\n [Grades.EarlyLearning]: 1,\r\n [Grades.GradeK]: 1,\r\n [Grades.Grade1]: 1,\r\n [Grades.Grade2]: 1,\r\n [Grades.Grade3]: 1,\r\n [Grades.Grade4]: 1,\r\n [Grades.Grade5]: 1,\r\n [Grades.Grade6]: 1,\r\n [Grades.Grade7]: 1,\r\n [Grades.Grade8]: 1,\r\n [Grades.HighSchool]: 1,\r\n [Grades.Adult]: 1,\r\n },\r\n mindYeti: 1,\r\n isDefault: 0,\r\n implementationLevels: {\r\n [1]: 1,\r\n [2]: 1,\r\n [3]: 1,\r\n },\r\n optInUnits: {\r\n [OptInUnits.BullyingHarassment]: 1,\r\n [OptInUnits.BullyingHarassmentOff]: 1,\r\n },\r\n activities: {\r\n [Activities.HighSchoolStudentActivitiesOn]: 1,\r\n [Activities.HighSchoolStudentActivitiesOff]: 1,\r\n },\r\n};\r\n/**\r\n * Returns the weight for a given audience.\r\n *\r\n * @remarks\r\n * This currently supports only object and boolean fields.\r\n * We may need to update this function if we add other singular values to the audience.\r\n *\r\n * @param audience - audience to check the weight\r\n * @returns The weight of audience\r\n *\r\n */\r\nfunction getWeight(audience) {\r\n let totalWeight = 0;\r\n for (const key in audience) {\r\n if (isIterable(audience[key])) {\r\n for (const val of audience[key]) {\r\n totalWeight += WEIGHTS[key][val];\r\n }\r\n }\r\n else {\r\n if (audience[key] === true) {\r\n totalWeight += WEIGHTS[key];\r\n }\r\n }\r\n }\r\n return totalWeight;\r\n}\r\nconst isIterable = (x) => !!(x === null || x === void 0 ? void 0 : x[Symbol.iterator]);\n\nconst invalidCombinations = [\r\n {\r\n ruleName: SELA_EXCLUSIVE_ROLES,\r\n programs: [Programs.SELA],\r\n roles: [Roles.Staff, Roles.LeaderTeam],\r\n },\r\n];\r\nvar MatchMode;\r\n(function (MatchMode) {\r\n MatchMode[MatchMode[\"All\"] = 0] = \"All\";\r\n MatchMode[MatchMode[\"Any\"] = 1] = \"Any\";\r\n})(MatchMode || (MatchMode = {}));\r\nconst matchPermissionsField = (dataPermissions, userPermissions, mode = MatchMode.All) => {\r\n // if data field is not set, it's a non-constraint, always match\r\n if (!dataPermissions) {\r\n return true;\r\n }\r\n // if all of the entries on data permissions are false, treat as though there is no requirement for this field:\r\n if (dataPermissions.length === 0) {\r\n return true;\r\n }\r\n // if a user constraint is not set, don't match\r\n if (userPermissions === undefined) {\r\n return false;\r\n }\r\n if (mode === MatchMode.All) {\r\n // all data permissions must be matched:\r\n const matchedPermissions = dataPermissions.filter((dataPermission) => userPermissions.includes(dataPermission));\r\n return matchedPermissions.length === dataPermissions.length;\r\n }\r\n else {\r\n // any data permission may be matched:\r\n for (const dataPerm of dataPermissions) {\r\n if (userPermissions.includes(dataPerm)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n};\r\nconst matchValueField = (dataValue, userValue) => {\r\n // if data field is not set, it's a non-constraint, always match\r\n if (!dataValue) {\r\n return true;\r\n }\r\n // if a user constraint is not set, don't match\r\n if (!userValue) {\r\n return false;\r\n }\r\n return dataValue === userValue;\r\n};\r\n// export for testability\r\nconst audiencesMatch = (dataAudience, userAudience, matchMode = MatchMode.All) => {\r\n var _a;\r\n // if audiences field doesn't exist on data, assume this data is for all audiences\r\n if (!dataAudience || ((dataAudience === null || dataAudience === void 0 ? void 0 : dataAudience.isDefault) && (userAudience === null || userAudience === void 0 ? void 0 : userAudience.isDefault))) {\r\n return true;\r\n }\r\n if (!userAudience) {\r\n return false;\r\n }\r\n // equivalent to exclusive or (dataAudience.isDefault XOR userAudience.isDefault)\r\n if (((dataAudience === null || dataAudience === void 0 ? void 0 : dataAudience.isDefault) && !(userAudience === null || userAudience === void 0 ? void 0 : userAudience.isDefault)) ||\r\n (!(dataAudience === null || dataAudience === void 0 ? void 0 : dataAudience.isDefault) && (userAudience === null || userAudience === void 0 ? void 0 : userAudience.isDefault))) {\r\n return false;\r\n }\r\n const programMatch = matchPermissionsField(dataAudience.programs, userAudience.programs, matchMode);\r\n const rolesMatch = matchPermissionsField(dataAudience.roles, userAudience.roles, matchMode);\r\n const gradesMatch = matchPermissionsField(dataAudience.grades, userAudience.grades, matchMode);\r\n const implementationLevelMatch = matchPermissionsField(\r\n // @ts-ignore: add this hack to address a bug in the data where implementationLevel is singular in Contentful\r\n (_a = (dataAudience.implementationLevels || dataAudience.implementationLevel)) === null || _a === void 0 ? void 0 : _a.map(lvl => parseInt(lvl)), userAudience.implementationLevels, matchMode);\r\n const mindYetiMatch = matchValueField(dataAudience.mindYeti, userAudience.mindYeti);\r\n const bullyingHarassmentMatch = matchPermissionsField(dataAudience.optInUnits, userAudience.optInUnits, matchMode);\r\n const activitiesMatch = matchPermissionsField(dataAudience.activities, userAudience.activities, matchMode);\r\n return (programMatch &&\r\n rolesMatch &&\r\n gradesMatch &&\r\n implementationLevelMatch &&\r\n mindYetiMatch &&\r\n bullyingHarassmentMatch &&\r\n activitiesMatch);\r\n};\r\nconst filterForAudience = (contentfulData, userAudiences) => {\r\n if (!contentfulData) {\r\n return undefined;\r\n }\r\n if (!audiencesMatch(contentfulData.audiences, userAudiences, MatchMode.Any)) {\r\n return undefined;\r\n }\r\n // make a copy of the data so we're not mutating the original object\r\n const mutatedData = structuredClone(contentfulData);\r\n for (const key in mutatedData) {\r\n if (key === 'audiences' || typeof mutatedData[key] !== 'object') {\r\n continue;\r\n }\r\n mutatedData[key] = filterForAudience(mutatedData[key], userAudiences);\r\n // handle cases where the return payload is undefined\r\n if (!mutatedData[key]) {\r\n delete mutatedData[key];\r\n }\r\n // filter out unmatched items in array entries:\r\n if (Array.isArray(mutatedData[key])) {\r\n mutatedData[key] = mutatedData[key].filter((item) => !!item);\r\n }\r\n }\r\n return mutatedData;\r\n};\r\nconst matchesInvalidCombination = (aud) => {\r\n var _a, _b;\r\n for (const invalid of invalidCombinations) {\r\n // hacky, kind of hardcoded way to enforce that for SELA, only one role can be selected:\r\n if (invalid.ruleName === SELA_EXCLUSIVE_ROLES) {\r\n const containsRoles = (_a = invalid.roles) === null || _a === void 0 ? void 0 : _a.map((role) => aud.roles.includes(role)).every((x) => x);\r\n const containsPrograms = (_b = invalid.programs) === null || _b === void 0 ? void 0 : _b.map((program) => aud.programs.includes(program)).every((x) => x);\r\n if (containsRoles && containsPrograms) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n};\r\n// export for testability\r\nconst generatePermutations = (aud) => {\r\n var _a, _b, _c, _d, _e, _f;\r\n let programRequired = false;\r\n let gradeRequired = false;\r\n let roleRequired = false;\r\n const keyValuePairs = [];\r\n for (const program in (_a = aud.programs) !== null && _a !== void 0 ? _a : {}) {\r\n keyValuePairs.push(['programs', program]);\r\n programRequired = true;\r\n }\r\n for (const role in (_b = aud.roles) !== null && _b !== void 0 ? _b : {}) {\r\n keyValuePairs.push(['roles', role]);\r\n roleRequired = true;\r\n }\r\n for (const grade in (_c = aud.grades) !== null && _c !== void 0 ? _c : {}) {\r\n keyValuePairs.push(['grades', grade]);\r\n gradeRequired = true;\r\n }\r\n for (const implementationLevel in (_d = aud.implementationLevels) !== null && _d !== void 0 ? _d : {}) {\r\n keyValuePairs.push(['implementationLevels', parseInt(implementationLevel)]);\r\n }\r\n for (const optInUnit in (_e = aud.optInUnits) !== null && _e !== void 0 ? _e : {}) {\r\n keyValuePairs.push(['optInUnits', optInUnit]);\r\n }\r\n for (const activity in (_f = aud.activities) !== null && _f !== void 0 ? _f : {}) {\r\n keyValuePairs.push(['activities', activity]);\r\n }\r\n if (aud.mindYeti === true) {\r\n keyValuePairs.push(['mindYeti', true]);\r\n }\r\n const results = [];\r\n function permute(index, current) {\r\n if (index === keyValuePairs.length) {\r\n if (Object.keys(current).length > 0) {\r\n results.push(Audiences.create(current));\r\n }\r\n return;\r\n }\r\n const [key, value] = keyValuePairs[index];\r\n // Include the field\r\n const includePermutation = structuredClone(current);\r\n if ([\r\n 'programs',\r\n 'grades',\r\n 'roles',\r\n 'implementationLevels',\r\n 'optInUnits',\r\n 'activities',\r\n ].includes(key)) {\r\n // @ts-expect-error: allow this hack because we know the type should be an array\r\n includePermutation[key] = (current[key] || []).concat(value);\r\n }\r\n else {\r\n includePermutation[key] = value;\r\n }\r\n permute(index + 1, includePermutation);\r\n // Exclude the field\r\n const excludePermutation = structuredClone(current);\r\n permute(index + 1, excludePermutation);\r\n }\r\n permute(0, {});\r\n const validResults = results.filter((aud) => !matchesInvalidCombination(aud));\r\n return validResults.filter((aud) => {\r\n if (programRequired && aud.programs.length === 0) {\r\n return false;\r\n }\r\n if (gradeRequired && aud.grades.length === 0) {\r\n return false;\r\n }\r\n if (roleRequired && aud.roles.length === 0) {\r\n return false;\r\n }\r\n return true;\r\n });\r\n};\r\nconst isKnownListKey = (key) => {\r\n return (key === 'programs' ||\r\n key === 'grades' ||\r\n key === 'roles' ||\r\n key === 'implementationLevels' ||\r\n key === 'optInUnits' ||\r\n key === 'activities');\r\n};\r\nconst mergeAudiencePermutations = (perm1, perm2) => {\r\n const merged = {\r\n programs: {},\r\n grades: {},\r\n roles: {},\r\n implementationLevels: {},\r\n mindYeti: false,\r\n optInUnits: {},\r\n activities: {},\r\n };\r\n if (perm1.mindYeti || perm2.mindYeti) {\r\n merged.mindYeti = true;\r\n }\r\n for (const key in perm1) {\r\n if (isKnownListKey(key)) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n for (const subKey in perm1[key]) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n merged[key][subKey] = true;\r\n }\r\n }\r\n }\r\n for (const key in perm2) {\r\n if (isKnownListKey(key)) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n for (const subKey in perm2[key]) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n merged[key][subKey] = true;\r\n }\r\n }\r\n }\r\n return merged;\r\n};\r\n// navigates a tree of Contentful data and generates a list of all potential audiences\r\nconst getAvailableAudiences = (contentfulData) => {\r\n if (!contentfulData) {\r\n return [];\r\n }\r\n // recursive function to generate all possible permutations of audiences in a tree\r\n function getAudiencePermutations(contentfulData) {\r\n var _a, _b, _c, _d, _e, _f;\r\n let permutations = {\r\n programs: {},\r\n grades: {},\r\n roles: {},\r\n implementationLevels: {},\r\n mindYeti: false,\r\n optInUnits: {},\r\n activities: {},\r\n };\r\n for (const key in contentfulData) {\r\n if (key === 'audiences' ||\r\n typeof contentfulData[key] !== 'object' ||\r\n !contentfulData[key]) {\r\n continue;\r\n }\r\n permutations = mergeAudiencePermutations(permutations, getAudiencePermutations(contentfulData[key]));\r\n }\r\n if (contentfulData === null || contentfulData === void 0 ? void 0 : contentfulData.audiences) {\r\n if (contentfulData.audiences.mindYeti) {\r\n permutations.mindYeti = true;\r\n }\r\n for (const program of (_a = contentfulData.audiences.programs) !== null && _a !== void 0 ? _a : []) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n permutations.programs[program] = true;\r\n }\r\n for (const grade of (_b = contentfulData.audiences.grades) !== null && _b !== void 0 ? _b : []) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n permutations.grades[grade] = true;\r\n }\r\n for (const role of (_c = contentfulData.audiences.roles) !== null && _c !== void 0 ? _c : []) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n permutations.roles[role] = true;\r\n }\r\n for (const implementationLevel of (_d = contentfulData.audiences // NOTE: this is purposefully singular to match how it is in Contentful:\r\n .implementationLevel) !== null && _d !== void 0 ? _d : []) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n permutations.implementationLevels[implementationLevel] = true;\r\n }\r\n for (const optInUnit of (_e = contentfulData.audiences.optInUnits) !== null && _e !== void 0 ? _e : []) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n permutations.optInUnits[optInUnit] = true;\r\n }\r\n for (const activity of (_f = contentfulData.audiences.activities) !== null && _f !== void 0 ? _f : []) {\r\n // @ts-expect-error: allow this hack because we know keys are valid\r\n permutations.activities[activity] = true;\r\n }\r\n }\r\n return permutations;\r\n }\r\n const permutations = getAudiencePermutations(contentfulData);\r\n return [Audiences.DEFAULT, ...generatePermutations(permutations)];\r\n};\r\n// this function will use a set of rules to determine if the user has multiple permissions for a field which one takes precendence\r\n// for example, roles: ['admin', 'teacher'] => 'admin'\r\n// returns undefined if no matching audience is found\r\nconst getSignificantAudience = (userAudience, availableAudiences) => {\r\n if (userAudience === null || userAudience === void 0 ? void 0 : userAudience.isDefault) {\r\n return Audiences.DEFAULT;\r\n }\r\n // return the default audience if there is no other match:\r\n let significantAudience = Audiences.DEFAULT;\r\n let maxWeight = -1;\r\n if (availableAudiences.length) {\r\n for (const available of availableAudiences) {\r\n if (audiencesMatch(available, userAudience)) {\r\n const weight = getWeight(available);\r\n if (weight > maxWeight) {\r\n significantAudience = available;\r\n maxWeight = weight;\r\n }\r\n }\r\n }\r\n }\r\n return significantAudience;\r\n};\n\nconst encodeUserContext = (userContext) => {\r\n return btoa(JSON.stringify(userContext));\r\n};\r\nconst decodeUserContext = (base64EncodedUserContext) => {\r\n return JSON.parse(atob(base64EncodedUserContext));\r\n};\r\nconst convertUserContextToAudiences = (userContext, activeSiteId) => {\r\n // TODO: actually validate the userContext is in a valid shape\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\r\n // TODO: when location and preferences are added to anonymous user context, we should NOT just return default audience\r\n if (!userContext.sites || userContext.sites.length === 0) {\r\n return Audiences.DEFAULT;\r\n }\r\n // if activeSiteId is not specified, assume sites[0] is the active site\r\n const activeSite = userContext.sites.find((site) => site.siteId === activeSiteId) ||\r\n userContext.sites[0];\r\n const programs = Object.keys((_a = activeSite.programs) !== null && _a !== void 0 ? _a : {});\r\n const roles = ((_b = activeSite.claims) !== null && _b !== void 0 ? _b : []).filter((role) => Object.values(Roles).includes(role));\r\n const grades = [];\r\n const implementationLevels = new Set();\r\n for (const program in activeSite.programs) {\r\n const programData = activeSite.programs[program];\r\n if (!programData) {\r\n continue;\r\n }\r\n if ((_c = programData.preferences) === null || _c === void 0 ? void 0 : _c.implementationLevel) {\r\n implementationLevels.add(programData.preferences.implementationLevel);\r\n }\r\n for (const course of (_d = programData.courses) !== null && _d !== void 0 ? _d : []) {\r\n grades.push(course.name);\r\n }\r\n }\r\n for (const pak in (_e = userContext.paks) !== null && _e !== void 0 ? _e : {}) {\r\n const pakData = (_f = userContext === null || userContext === void 0 ? void 0 : userContext.paks) === null || _f === void 0 ? void 0 : _f[pak];\r\n if (!pakData) {\r\n continue;\r\n }\r\n for (const grade in pakData.grades) {\r\n // @ts-expect-error this is a valid indexing of the grades object but TypeScript won't recognize it\r\n const rolesData = pakData.grades[grade];\r\n if (!rolesData) {\r\n continue;\r\n }\r\n for (const role of rolesData.claims) {\r\n if (!roles.includes(role) && Object.values(Roles).includes(role)) {\r\n roles.push(role);\r\n }\r\n }\r\n }\r\n }\r\n let mindYeti = undefined;\r\n if ((_j = (_h = (_g = activeSite.programs) === null || _g === void 0 ? void 0 : _g.k5SelDigital) === null || _h === void 0 ? void 0 : _h.preferences) === null || _j === void 0 ? void 0 : _j.mindYeti) {\r\n mindYeti = activeSite.programs.k5SelDigital.preferences.mindYeti === true;\r\n }\r\n const optInUnits = [];\r\n if ((_l = (_k = activeSite.programs) === null || _k === void 0 ? void 0 : _k.mspDigital) === null || _l === void 0 ? void 0 : _l.preferences) {\r\n const preferences = activeSite.programs.mspDigital.preferences;\r\n if (preferences.bullyingHarassmentUnitEnabled === true) {\r\n optInUnits.push(OptInUnits.BullyingHarassment);\r\n }\r\n // explicitly check for the false value, if this setting is undefined or missing, don't add it to the optInUnits array:\r\n else if (preferences.bullyingHarassmentUnitEnabled === false) {\r\n optInUnits.push(OptInUnits.BullyingHarassmentOff);\r\n }\r\n }\r\n const activities = [];\r\n if ((_o = (_m = activeSite.programs) === null || _m === void 0 ? void 0 : _m.highSchool) === null || _o === void 0 ? void 0 : _o.preferences) {\r\n const preferences = activeSite.programs.highSchool.preferences;\r\n if (preferences.studentActivities === true) {\r\n activities.push(Activities.HighSchoolStudentActivitiesOn);\r\n }\r\n // explicitly check for the false value, if this setting is undefined or missing, don't add it to the activities array:\r\n else if (preferences.studentActivities === false) {\r\n activities.push(Activities.HighSchoolStudentActivitiesOff);\r\n }\r\n }\r\n return Audiences.create({\r\n isDefault: false,\r\n programs,\r\n grades,\r\n roles,\r\n implementationLevels: implementationLevels.size\r\n ? Array.from(implementationLevels)\r\n : undefined,\r\n mindYeti,\r\n optInUnits,\r\n activities,\r\n });\r\n};\n\nexport { Audiences, Grades, Programs, Roles, convertUserContextToAudiences, decodeUserContext, encodeUserContext, filterForAudience, getAvailableAudiences, getSignificantAudience };\n//# sourceMappingURL=index.esm.js.map\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = exports.RW = exports.GS = exports.TEST_CMI_FLAGS = exports.DIAGNOSTIC_CODES = exports.ERROR_CODES = exports.TIME_LIMIT_ACTION = exports.SCO_MODE = exports.AUDIO_CAPTIONING = exports.INTERACTION_RESULT = exports.INTERACTION_TYPE = exports.EXIT = exports.ENTRY = exports.CREDIT = exports.SUCCESS_STATUS = exports.COMPLETION_STATUS = exports.DATA_TYPES = exports.SESSION_STATE = void 0;\nconst SESSION_STATE = {\n NotInitialized: 'Not Initialized',\n Running: 'Running',\n Terminated: 'Terminated'\n};\nexports.SESSION_STATE = SESSION_STATE;\nconst DATA_TYPES = {\n String: 'characterstring',\n LocalizedString: 'localized_string_type',\n Collection: 'collection',\n State: 'state',\n Real: 'real',\n Integer: 'integer',\n Time: 'time',\n Interval: 'timeinterval',\n ShortIdentifier: 'short_identifier_type',\n LongIdentifier: 'long_identifier_type',\n Complex: 'cfc_complex',\n SubSchema: 'cfc_subschema'\n};\nexports.DATA_TYPES = DATA_TYPES;\nconst COMPLETION_STATUS = {\n Completed: 'completed',\n Incomplete: 'incomplete',\n NotAttempted: 'not_attempted',\n Unknown: 'unknown'\n};\nexports.COMPLETION_STATUS = COMPLETION_STATUS;\nconst SUCCESS_STATUS = {\n Passed: 'passed',\n Failed: 'failed',\n Unknown: 'unknown'\n};\nexports.SUCCESS_STATUS = SUCCESS_STATUS;\nconst CREDIT = {\n Credit: 'credit',\n NoCredit: 'no_credit'\n};\nexports.CREDIT = CREDIT;\nconst ENTRY = {\n AbInitio: 'ab_initio',\n Resume: 'resume',\n Nil: ''\n};\nexports.ENTRY = ENTRY;\nconst EXIT = {\n Timeout: 'time_out',\n Suspend: 'suspend',\n Logout: 'logout',\n Normal: 'normal',\n Nil: ''\n};\nexports.EXIT = EXIT;\nconst INTERACTION_TYPE = {\n TrueFalse: 'true_false',\n Choice: 'multiple_choice',\n FillIn: 'fill_in',\n LongFillIn: 'long_fill_in',\n Likert: 'likert',\n Matching: 'matching',\n Performance: 'performance',\n Sequencing: 'sequencing',\n Numeric: 'numeric',\n Other: 'other'\n};\nexports.INTERACTION_TYPE = INTERACTION_TYPE;\nconst INTERACTION_RESULT = {\n Correct: 'correct',\n Incorrect: 'incorrect',\n Unanticipated: 'unanticipated',\n Neutral: 'neutral'\n};\nexports.INTERACTION_RESULT = INTERACTION_RESULT;\nconst AUDIO_CAPTIONING = {\n Off: 'off',\n NoChange: 'no_change',\n On: 'on'\n};\nexports.AUDIO_CAPTIONING = AUDIO_CAPTIONING;\nconst SCO_MODE = {\n Browse: 'browse',\n Normal: 'normal',\n Review: 'review'\n};\nexports.SCO_MODE = SCO_MODE;\nconst TIME_LIMIT_ACTION = {\n ExitMessage: 'exit,message',\n ContinueMessage: 'continue,message',\n ExitNoMessage: 'exit,no message',\n ContinueNoMessage: 'continue,no message'\n};\nexports.TIME_LIMIT_ACTION = TIME_LIMIT_ACTION;\nconst ERROR_CODES = {\n None: ['0', ''],\n // general error codes\n GeneralException: ['101', 'General exception occurred; no more specific code exists'],\n GeneralInitializationFalure: ['102', 'Exception while attempting to initialize SCO'],\n AlreadyInitialized: ['103', 'Attempted to initialize a SCO that is already running'],\n ContentInstanceTerminated: ['104', 'Attempted to initialize a SCO that has already been terminated'],\n GeneralTerminationFailure: ['111', 'Exception while attempting to terminate SCO'],\n TerminationBeforeInitialization: ['112', 'Attepted to terminate a SCO that has not been initialized'],\n TerminationAfterTermination: ['113', 'Attempted to terminate a SCO that has already been terminated'],\n RetrieveDataBeforeInitialization: ['122', 'Called GetValue() on a SCO that has not been initialized'],\n RetrieveDataAfterTermination: ['123', 'Called GetValue() on a SCO that has already been terminated'],\n StoreDataBeforeInitialization: ['132', 'Called SetValue() on a SCO that has not been initialized'],\n StoreDataAfterTermination: ['133', 'Called SetValue() on a SCO that has already been terminated'],\n CommitBeforeInitialization: ['142', 'Called Commit() on a SCO that has not been initialized'],\n CommitAfterTermination: ['143', 'Called Commit() on a SCO that has already been terminated'],\n // syntax error codes\n GeneralArgumentError: ['201', 'Invalid argument passed to an API method'],\n // RTS error codes\n GeneralGetFailure: ['301', 'Unable to get value of the data model element'],\n GeneralSetFailure: ['351', 'Unable to set value of the data model element'],\n GeneralCommitFailure: ['391', 'Unable to commit the data model to the LMS'],\n // data model error codes\n UndefinedDataModelElement: ['401', 'Data model element passed as the first parameter is not recognized'],\n UnimplementedDataModelElement: ['402', 'Data model element passed as the first parameter is recognized but not implemented in this LMS'],\n DataModelElementValueNotInitialized: ['403', 'Attempted to get the value of a data model element that has not been set'],\n DataModelElementIsReadOnly: ['404', 'Attempted to set the value of a data model element that is read-only'],\n DataModelElementIsWriteOnly: ['405', 'Attempted to get the value of a data model element that is write-only'],\n DataModelElementTypeMismatch: ['406', 'Attempted to set the value of a data model element with a value of an incorrect type'],\n DataModelElementValueOutOfRange: ['407', 'Attempted to set the value of a data model element with a value that is out of range'],\n DataModelDependencyNotEstablished: ['408', 'Attempted to set the value of a data model element that requires dependencies on prior elements']\n};\nexports.ERROR_CODES = ERROR_CODES;\nconst DIAGNOSTIC_CODES = {\n None: ['', '', ''],\n DataModelElementDoesNotHaveChildren: ['301', '', 'Attempted to get the children of a data model element that does not have children'],\n DataModelElementCannotHaveCount: ['301', '', 'Attempted to get the count of a data model element that is not a collection'],\n DataModelElementCollectionSetOutOfOrder: ['', '351', 'Attempted to set the value of an element in a collection out of order'],\n DataModelElementCollectionRequestOutOfRange: ['301', '', 'Attempted to get the value of an element outside of the range of the collection'],\n DataModelElementNotSpecified: ['301', '351', 'Call to GetValue() or SetValue() is missing the first parameter (data model element)'],\n UniqueIdentifierConstraintViolated: ['', '351', 'Attempted to set the value of a data model element to a non-unique value where a unique one is required'],\n SmallestPermittedMaximumExceeded: ['', '0', 'Value being set exceeds SCORM SPM requirements; value may have been truncated'],\n DataModelElementDoesNotHaveVersion: ['301', '', 'Attempted to get the version of a data model element that does not have a version'],\n IdentifierValueCanOnlyBeSetOnce: ['', '351', 'Attempted to set an identifier that has already been set']\n};\nexports.DIAGNOSTIC_CODES = DIAGNOSTIC_CODES;\nconst TEST_CMI_FLAGS = {\n OVERRIDE_READ_ONLY: 1,\n OVERRIDE_WRITE_ONLY: 2\n};\nexports.TEST_CMI_FLAGS = TEST_CMI_FLAGS;\nconst GS = {\n Get: 0,\n Set: 1\n};\nexports.GS = GS;\nconst RW = {\n R: 1,\n W: 2\n};\nexports.RW = RW;\nvar _default = {\n SESSION_STATE,\n DATA_TYPES,\n COMPLETION_STATUS,\n SUCCESS_STATUS,\n CREDIT,\n ENTRY,\n EXIT,\n INTERACTION_TYPE,\n INTERACTION_RESULT,\n AUDIO_CAPTIONING,\n SCO_MODE,\n TIME_LIMIT_ACTION,\n ERROR_CODES,\n DIAGNOSTIC_CODES,\n TEST_CMI_FLAGS,\n GS,\n RW\n};\nexports.default = _default;","var CfcEnvironment;\n(function (CfcEnvironment) {\n CfcEnvironment[\"CI\"] = \"np-ci\";\n CfcEnvironment[\"DEV\"] = \"np-dev\";\n CfcEnvironment[\"QA\"] = \"np-qa\";\n CfcEnvironment[\"STAGING\"] = \"np-staging\";\n CfcEnvironment[\"CONSTG\"] = \"np-constg\";\n CfcEnvironment[\"PROD\"] = \"p-prod\";\n})(CfcEnvironment || (CfcEnvironment = {}));\n\nexport { CfcEnvironment };\n//# sourceMappingURL=common-types.esm.js.map\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.QueryType = void 0;\nconst types_1 = require(\"./types\");\nObject.defineProperty(exports, \"QueryType\", { enumerable: true, get: function () { return types_1.QueryType; } });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.QueryType = void 0;\nvar QueryType;\n(function (QueryType) {\n QueryType[\"activityList\"] = \"activityList\";\n QueryType[\"advisoryActivity\"] = \"advisoryActivity\";\n QueryType[\"anchor\"] = \"anchor\";\n QueryType[\"article\"] = \"article\";\n QueryType[\"courseNode\"] = \"courseNode\";\n QueryType[\"courseNodeConnector\"] = \"courseNodeConnector\";\n QueryType[\"groupedContent\"] = \"groupedContent\";\n QueryType[\"headerBodyCopy\"] = \"headerBodyCopy\";\n QueryType[\"kitTeachSection\"] = \"kitTeachSection\";\n QueryType[\"learningExperience\"] = \"learningExperience\";\n QueryType[\"microlearning\"] = \"microlearning\";\n QueryType[\"navigationPage\"] = \"navigationPage\";\n QueryType[\"pageGeneralInfo\"] = \"pageGeneralInfo\";\n QueryType[\"platformRouteTreeNode\"] = \"platformRouteTreeNode\";\n QueryType[\"platformRouteTreeRoot\"] = \"platformRouteTreeRoot\";\n QueryType[\"programSectionArticleTree\"] = \"programSectionArticleTree\";\n QueryType[\"publicRouteTreeNode\"] = \"publicRouteTreeNode\";\n QueryType[\"publicRouteTreeRoot\"] = \"publicRouteTreeRoot\";\n // uses the Contentful JS SDK, not GraphQL:\n QueryType[\"rawEntry\"] = \"rawEntry\";\n QueryType[\"resourceLibraryPage\"] = \"resourceLibraryPage\";\n QueryType[\"routeData\"] = \"routeData\";\n QueryType[\"subsectionLanding\"] = \"subsectionLanding\";\n QueryType[\"unit\"] = \"unit\";\n QueryType[\"unitHs\"] = \"unitHs\";\n QueryType[\"week\"] = \"week\";\n QueryType[\"mediaBodyCopy\"] = \"mediaBodyCopy\";\n QueryType[\"imageBodyCopy\"] = \"imageBodyCopy\";\n QueryType[\"category\"] = \"category\";\n QueryType[\"book\"] = \"book\";\n QueryType[\"assetDescription\"] = \"assetDescription\";\n QueryType[\"image\"] = \"image\";\n QueryType[\"inlineTranslation\"] = \"inlineTranslation\";\n QueryType[\"langMulti\"] = \"langMulti\";\n QueryType[\"langPdf\"] = \"langPdf\";\n QueryType[\"textLinkIcon\"] = \"textLinkIcon\";\n QueryType[\"video\"] = \"video\";\n QueryType[\"audio\"] = \"audio\";\n QueryType[\"lang\"] = \"lang\";\n QueryType[\"dashboardProgram\"] = \"dashboardProgram\";\n QueryType[\"resourceListing\"] = \"resourceListing\";\n QueryType[\"multimediaGrouping\"] = \"multimediaGrouping\";\n QueryType[\"courseLevelContent\"] = \"courseLevelContent\";\n QueryType[\"extensionLanding\"] = \"extensionLanding\";\n QueryType[\"redirectRule\"] = \"redirectRule\";\n QueryType[\"presentation\"] = \"presentation\";\n QueryType[\"layout\"] = \"layout\";\n})(QueryType || (exports.QueryType = QueryType = {}));\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst audiences_1 = require(\"@cfc/audiences\");\nconst common_types_1 = require(\"@cfc/common-types\");\nclass ContentServiceClient {\n constructor(config) {\n this.config = config;\n if (!config.environment && !config.customEndpoint) {\n throw new Error('ContentServiceClientConfig must have either contain an environment or a customEndpoint');\n }\n }\n getEndpoint() {\n if (this.config.customEndpoint) {\n return this.config.customEndpoint;\n }\n switch (this.config.environment) {\n case common_types_1.CfcEnvironment.PROD:\n return 'https://content.secondstep.org';\n default:\n return `https://content-${this.config.environment}.cfctest.org`;\n }\n }\n static getBaseQueryParams(params) {\n var _a;\n // default to true if not specified\n let isPreview = 'true';\n if (params.isPreview !== undefined) {\n isPreview = params.isPreview ? 'true' : 'false';\n }\n const queryParams = new URLSearchParams({\n queryType: params.queryType,\n isPreview,\n locale: (_a = params.locale) !== null && _a !== void 0 ? _a : 'en-US',\n });\n return queryParams;\n }\n static getContentQueryParams(params) {\n const queryParams = ContentServiceClient.getBaseQueryParams(params);\n if (params.userContext) {\n // base64 encode the user context:\n queryParams.append('userContext', (0, audiences_1.encodeUserContext)(params.userContext));\n }\n return queryParams;\n }\n getContent(params) {\n return __awaiter(this, void 0, void 0, function* () {\n const response = yield fetch(`${this.getEndpoint()}/api/v1/content/${params.entryId}?${ContentServiceClient.getContentQueryParams(params)}`);\n if (!response.ok) {\n throw new Error(`Failed to get content: ${response.statusText}`);\n }\n return yield response.json();\n });\n }\n static getUnvariatedContentQueryParams(params) {\n const queryParams = ContentServiceClient.getBaseQueryParams(params);\n if (params.skipCache) {\n queryParams.append('skipCache', 'true');\n }\n return queryParams;\n }\n getUnvariatedContent(params) {\n return __awaiter(this, void 0, void 0, function* () {\n const response = yield fetch(`${this.getEndpoint()}/api/v1/content/unvariated/${params.entryId}?${ContentServiceClient.getUnvariatedContentQueryParams(params)}`);\n if (!response.ok) {\n throw new Error(`Failed to get content: ${response.statusText}`);\n }\n return yield response.json();\n });\n }\n buildAllContent(params) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.config.apiKey) {\n throw new Error('ContentServiceClient must be initialized with an apiKey to build content');\n }\n const response = yield fetch(`${this.getEndpoint()}/api/v1/content/build-all`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: this.config.apiKey,\n },\n body: JSON.stringify(params),\n });\n if (!response.ok) {\n throw new Error(`Failed to build content: ${response.statusText}`);\n }\n return response.body;\n });\n }\n}\nexports.default = ContentServiceClient;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst client_1 = __importDefault(require(\"./client\"));\nexports.default = client_1.default;\n","/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./_src/cfc-interactive-video/amp-plugin-cfc-interactive-video.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./_src/cfc-interactive-video/amp-plugin-cfc-interactive-video.js\":\n/*!************************************************************************!*\\\n !*** ./_src/cfc-interactive-video/amp-plugin-cfc-interactive-video.js ***!\n \\************************************************************************/\n/*! no exports provided */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _cmds__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cmds */ \"./_src/cfc-interactive-video/cmds/index.js\");\n\n/* example:\r\n00:00:10.500 --> 00:00:11.500\r\ncfciv#v1|{cmds:[pause();button(className=yellow,topleft&text=Skip Brain Builder&onclick=seek(timestamp=00:02:52.000));button(className=red,topright&text=Skip All&onclick=seek(timestamp=00:03:17.000))]}\r\n*/\n\n(function () {\n const CUE_POSITION = {\n Before: 'before',\n Inside: 'inside',\n After: 'after'\n };\n const CUE_STATUS = {\n HasNotRun: 'has_not_run',\n Running: 'running',\n HasRun: 'has_run'\n };\n let vttCues = [];\n let player;\n\n const matchCommand = function (cmd) {\n const obj = {};\n const cmdMatches = cmd.match(/^(\\w+)\\((.*)\\)$/);\n\n if (cmdMatches && cmdMatches.length) {\n obj.n = cmdMatches[1];\n\n if (cmdMatches.length > 1 && cmdMatches[2]) {\n obj.p = {};\n cmdMatches[2].split('&').forEach(param => {\n const p = param.split('=');\n\n if (p.length === 1) {\n // no `=` sign, so treat it as a bool\n obj.p[p[0]] = true;\n } else if (p.length === 2) {\n // it's a normal param, as in `key=val`\n if (p[1].endsWith(')')) {\n // the param is a command\n obj.p[p[0]] = matchCommand(p[1]);\n } else {\n obj.p[p[0]] = p[1];\n }\n } else {\n // the param is a command\n const n = p.shift();\n obj.p[n] = matchCommand(p.join('='));\n }\n });\n }\n }\n\n return obj;\n };\n\n const parseCueEvent = function (text) {\n // if it isn't an iteractive video event, move along\n if (!text.startsWith('cfciv')) {\n return {};\n }\n\n const event = {};\n const eventText = text.split('|');\n const eventMeta = eventText[0].split('#');\n event.v = eventMeta[1];\n const commandMatches = eventText[1].match(/{cmds:\\[(.*)\\]}/);\n\n if (commandMatches && commandMatches.length) {\n const commands = commandMatches[1].split(';').map(cmd => matchCommand(cmd));\n event.cmds = commands;\n }\n\n return event;\n };\n\n const loadInteractiveTrack = function (vttURL) {\n const xhr = new XMLHttpRequest();\n\n xhr.onload = function () {\n const data = xhr.responseText;\n parseVTT(data);\n };\n\n xhr.open('GET', vttURL, true);\n xhr.send();\n };\n\n const parseVTT = function (vttData) {\n // empty out the cues array before loading new ones:\n clearCues();\n const decoder = WebVTT.StringDecoder();\n const parser = new WebVTT.Parser(window, window.vttjs, decoder);\n\n parser.oncue = function (cue) {\n const cuePoint = {\n status: CUE_STATUS.HasNotRun,\n position: CUE_POSITION.Before,\n startTime: cue.startTime,\n endTime: cue.endTime,\n event: parseCueEvent(cue.text)\n };\n vttCues.push(cuePoint);\n };\n\n parser.parse(vttData);\n parser.flush();\n };\n\n const clearCues = function () {\n vttCues = [];\n };\n\n const runCue = function (cue) {\n if (cue.status !== CUE_STATUS.Running) {\n cue.status = CUE_STATUS.Running;\n console.info(cue);\n\n try {\n cue.event.cmds.forEach(cmd => {\n if (cmd.n in _cmds__WEBPACK_IMPORTED_MODULE_0__[\"default\"]) {\n _cmds__WEBPACK_IMPORTED_MODULE_0__[\"default\"][cmd.n](player, cmd.p);\n }\n });\n } catch (err) {\n console.error(err);\n }\n\n cue.status = CUE_STATUS.HasRun;\n }\n };\n\n const processCues = function () {\n const currentTime = player.currentTime();\n vttCues.forEach(cue => {\n if (currentTime < cue.startTime) {\n cue.position = CUE_POSITION.Before;\n } else if (currentTime > cue.endTime) {\n cue.position = CUE_POSITION.After;\n } else {\n // we are in the cue!\n // first, see if we *were* before, so now we can run the cue\n if (cue.position === CUE_POSITION.Before) {\n runCue(cue);\n }\n\n cue.position = CUE_POSITION.Inside;\n }\n });\n };\n\n const getElemContainer = function () {\n return player.el();\n };\n\n const addCfcIVElement = function (elem) {\n getElemContainer().appendChild(elem);\n };\n\n const removeCfcIVElements = function () {\n const elems = getElemContainer().querySelectorAll('.cfciv-elem');\n\n for (let i = 0; i < elems.length; i++) {\n try {\n getElemContainer().removeChild(elems[i]);\n } catch (err) {// NOP\n }\n }\n };\n\n if (!window.amp) {\n console.warn('no amp var attached to window');\n return;\n }\n\n amp.plugin('cfcInteractiveVideo', function (options) {\n player = this;\n player.addCfcIVElement = addCfcIVElement;\n player.removeCfcIVElements = removeCfcIVElements;\n player.addEventListener(amp.eventName.loadeddata, function () {\n loadInteractiveTrack(options.vtt);\n });\n player.addEventListener(amp.eventName.timeupdate, function () {\n processCues();\n });\n player.addEventListener(amp.eventName.play, removeCfcIVElements);\n });\n}).call(undefined);\n\n/***/ }),\n\n/***/ \"./_src/cfc-interactive-video/cmds/button.js\":\n/*!***************************************************!*\\\n !*** ./_src/cfc-interactive-video/cmds/button.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return button; });\n/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! . */ \"./_src/cfc-interactive-video/cmds/index.js\");\n\nfunction button(player, params) {\n const button = document.createElement('button');\n button.textContent = params.text;\n button.className = 'cfciv-elem cfciv-button';\n button.classList.add(...params.className.split(','));\n\n if (params.onclick) {\n button.addEventListener('click', () => {\n const cmd = params.onclick;\n\n try {\n if (cmd.n in ___WEBPACK_IMPORTED_MODULE_0__[\"default\"]) {\n ___WEBPACK_IMPORTED_MODULE_0__[\"default\"][cmd.n](player, cmd.p);\n }\n } catch (err) {\n console.error(err);\n }\n });\n }\n\n const removeElementsHandler = () => {\n player.removeEventListener(amp.eventName.seeking, removeElementsHandler);\n player.removeCfcIVElements();\n };\n\n player.addEventListener(amp.eventName.seeking, removeElementsHandler);\n player.addCfcIVElement(button);\n setTimeout(() => {\n button.classList.add('show');\n }, 0);\n}\n\n/***/ }),\n\n/***/ \"./_src/cfc-interactive-video/cmds/index.js\":\n/*!**************************************************!*\\\n !*** ./_src/cfc-interactive-video/cmds/index.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./button */ \"./_src/cfc-interactive-video/cmds/button.js\");\n/* harmony import */ var _pause__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pause */ \"./_src/cfc-interactive-video/cmds/pause.js\");\n/* harmony import */ var _play__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./play */ \"./_src/cfc-interactive-video/cmds/play.js\");\n/* harmony import */ var _seek__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./seek */ \"./_src/cfc-interactive-video/cmds/seek.js\");\n/* harmony import */ var _popup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./popup */ \"./_src/cfc-interactive-video/cmds/popup.js\");\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n button: _button__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n pause: _pause__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n play: _play__WEBPACK_IMPORTED_MODULE_2__[\"default\"],\n seek: _seek__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n popup: _popup__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n});\n\n/***/ }),\n\n/***/ \"./_src/cfc-interactive-video/cmds/pause.js\":\n/*!**************************************************!*\\\n !*** ./_src/cfc-interactive-video/cmds/pause.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return pause; });\nfunction pause(player\n/*, params*/\n) {\n player.pause();\n}\n\n/***/ }),\n\n/***/ \"./_src/cfc-interactive-video/cmds/play.js\":\n/*!*************************************************!*\\\n !*** ./_src/cfc-interactive-video/cmds/play.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return pause; });\nfunction pause(player\n/*, params*/\n) {\n player.play();\n}\n\n/***/ }),\n\n/***/ \"./_src/cfc-interactive-video/cmds/popup.js\":\n/*!**************************************************!*\\\n !*** ./_src/cfc-interactive-video/cmds/popup.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return popup; });\n/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! . */ \"./_src/cfc-interactive-video/cmds/index.js\");\n\nfunction popup(player, params) {\n const coor = JSON.parse(params.coor);\n\n if (params.contentID && player.popup) {\n const removeElementsHandler = () => {\n player.removeEventListener(amp.eventName.play, removeElementsHandler);\n player.removeEventListener(amp.eventName.seeking, removeElementsHandler);\n player.popup({\n visible: false\n });\n };\n\n player.addEventListener(amp.eventName.seeking, removeElementsHandler);\n player.addEventListener(amp.eventName.play, removeElementsHandler);\n player.popup({\n className: params.className.split(','),\n forceReponse: params.forceReponse === \"true\",\n visible: true,\n contentID: params.contentID,\n top: coor.x,\n left: coor.y,\n height: coor.h,\n width: coor.w,\n ...___WEBPACK_IMPORTED_MODULE_0__[\"default\"]\n });\n }\n /** Error handling */\n\n\n const functionExample = `00:00:00.000 --> 00:00:02.000\\n\n\tcfciv#v1|{cmds:[pause();popup(contentID=2U7QtvuRB3aAUrewNiPCZJ&coor={\"x\":1,\"y\":2,\"w\":60,\"h\":40}&className=test1,test2);]}`;\n\n if (!params.contentID) {\n console.warn(`AMP player: popup requires a contentful ID, popup example:\\n${functionExample}`);\n }\n\n if (!player.popup) {\n console.warn(`AMP player: popup() requires a popup function to be attached to the player, example:\\nthis.yourPlayerInstance.popup = someFunction.bind(this)`);\n }\n}\n\n/***/ }),\n\n/***/ \"./_src/cfc-interactive-video/cmds/seek.js\":\n/*!*************************************************!*\\\n !*** ./_src/cfc-interactive-video/cmds/seek.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return setPosition; });\nconst convertTimestampToSeconds = function (ts) {\n const multipliers = [24, 60, 60, 1];\n const timeParts = ts.split(':');\n let factor = 1,\n seconds = 0;\n\n while (timeParts.length && multipliers.length) {\n factor *= multipliers.pop();\n seconds += parseFloat(timeParts.pop() * factor);\n }\n\n return seconds;\n};\n\nfunction setPosition(player, params) {\n player.play();\n player.currentTime(convertTimestampToSeconds(params.timestamp));\n}\n\n/***/ })\n\n/******/ });\n//# sourceMappingURL=current.js.map","import { __awaiter, __generator } from 'tslib';\n\nfunction delay(fn, ms) {\n return new Promise(function (resolve) { return setTimeout(function () { return resolve(fn()); }, ms); });\n}\nvar totalDuration = 30000;\nfunction setDefaultMaxDuration(maxDuration) {\n totalDuration = maxDuration;\n}\nfunction calculateSafeRetryMs(maxRetries, retryMs) {\n var maxRetriesSquared = Math.pow(maxRetries, 2);\n var maxMs = retryMs * maxRetriesSquared;\n if (maxMs >= totalDuration) {\n return totalDuration / maxRetriesSquared;\n }\n return retryMs;\n}\nvar defaultMaxRetries = 5;\n/**\n * @param callback A function that returns a promise\n * @param maxRetries Maximum number of retries. Defaults to 5\n * @param retryMs Milliseconds factor to wait before retrying. Defaults to 100\n * @returns The result of the callback\n */\nfunction backoff(callback, maxRetries, retryMs) {\n if (maxRetries === void 0) { maxRetries = defaultMaxRetries; }\n if (retryMs === void 0) { retryMs = 100; }\n return __awaiter(this, void 0, void 0, function () {\n function execute(retryCount) {\n return __awaiter(this, void 0, void 0, function () {\n var result, error_1, newRetryCount_1, definitiveRetryMs;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, callback()];\n case 1:\n result = _a.sent();\n return [2 /*return*/, result];\n case 2:\n error_1 = _a.sent();\n if (retryCount <= maxRetries) {\n newRetryCount_1 = retryCount + 1;\n definitiveRetryMs = calculateSafeRetryMs(maxRetries, retryMs);\n return [2 /*return*/, delay(function () { return execute(newRetryCount_1); }, definitiveRetryMs * newRetryCount_1 * maxRetries)];\n }\n else {\n throw error_1;\n }\n case 3: return [2 /*return*/];\n }\n });\n });\n }\n return __generator(this, function (_a) {\n return [2 /*return*/, execute(1)];\n });\n });\n}\n\nexport { backoff, setDefaultMaxDuration };\n//# sourceMappingURL=index.esm.js.map\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst jsx_runtime_1 = require(\"react/jsx-runtime\");\nconst react_h5_audio_player_1 = __importDefault(require(\"react-h5-audio-player\"));\nrequire(\"react-h5-audio-player/lib/styles.css\");\nfunction Audio(props) {\n const { src } = props;\n return ((0, jsx_runtime_1.jsx)(react_h5_audio_player_1.default, { autoPlay: false, src: src }));\n}\nexports.default = Audio;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = void 0;\nvar Audio_1 = require(\"./Audio\");\nObject.defineProperty(exports, \"default\", { enumerable: true, get: function () { return __importDefault(Audio_1).default; } });\n"],"sourceRoot":""}