@clickview/player 1.48.0-rc.1 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -288,7 +288,7 @@ ${Sg(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),
288
288
  </svg>
289
289
  `;class w2 extends Vwe{constructor(e,t){super(e,t)}createEl(){const e=Wwe.prototype.createEl.call(this,"button",{className:this.buildCSSClass()},{type:"button",title:this.controlText_});return e.innerHTML=Kwe,this.createControlTextEl(e),e}handleClick(e){var t;e.stopPropagation(),e.preventDefault(),(t=this.options_)!=null&&t.onClick&&this.options_.onClick()}buildCSSClass(){return"cv-remove-video-button"}}je.registerComponent("removeVideoButton",w2),w2.prototype.controlText_="Remove from watch history";const mq="cvplayer-playback-quality:v2",vq="cvplayer-localcache-playback-quality:v2";class Fc{static isQualityUserPreference(){const e=localStorage.getItem(mq),t=localStorage.getItem(vq);return!!(e||t)}static getPlayerMode(e){var o,u,l,c,d,h,v;const t=((o=e.isFullscreen)==null?void 0:o.call(e))??!1,i=((u=e.usingPlugin)==null?void 0:u.call(e,"playerModePlugin"))?((c=(l=e.playerModePlugin())==null?void 0:l.isHovering)==null?void 0:c.call(l))??!1:!1,s=((d=e.usingPlugin)==null?void 0:d.call(e,"theatreModePlugin"))?((v=(h=e.theatreModePlugin())==null?void 0:h.getTheatreMode)==null?void 0:v.call(h))??!1:!1;return t?"fullscreen":i?"hover":s?"theatre":"default"}static findQualityLevel(e,t){for(let i=0;i<e.length;i++)if(e[i].quality<=t)return e[i];const n=e[e.length-1];if(!n)throw new Error("No quality levels available");return n}static enableQualityLevel(e,t){for(let n=0;n<e.length;n++){const i=e[n];i.enabled=i.id===t}}}var C2=(r=>(r.Default="play",r.Hover="hover",r))(C2||{});const Gwe=je.getPlugin("plugin"),yq="cv-preview-mode",_q="cv-force-16-9";class Ywe extends Gwe{constructor(e,t){super(e),this.hasSeeked=!1,this.buttonAdded=!1,this.mode=null,this.defaultDisplayMode="normal",this.onQualityReady=null,t!=null&&t.defaultDisplayMode&&(this.defaultDisplayMode=t.defaultDisplayMode),t!=null&&t.startTime&&(this.startTime=t.startTime),this.onSeek=this.onSeek.bind(this),this.player.one("seeking",this.onSeek)}onSeek(){this.hasSeeked=!0}dispose(){this.cleanupQualityListener(),this.player.off("seeking",this.onSeek),super.dispose()}getMode(){return this.mode}isHovering(){return this.mode==="hover"}setPlayerMode(e,t,n){this.player.trigger("flushprogress");const i=this.mode;if(this.mode=e,e==="hover"){this.buttonAdded||this.addButtons(t,n),this.player.addClass(yq),this.applyAspectRatioFix(),this.enableSubtitles(),this.mute(),this.setLowQuality(),this.removeActivityTimeout(),this.player.trigger("resize");return}i==="hover"&&(this.applyDefaultModeLayout(),this.player.removeClass(yq),this.player.removeClass(_q),this.disableSubtitles(),this.unmute(),this.cleanupQualityListener(),this.restorePreviousQuality(),this.restoreActivityTimeout(),this.player.trigger("resize"),this.hasSeeked||(this.player.currentTime(this.startTime??0),this.hasSeeked=!1))}applyDefaultModeLayout(){var t,n,i,a;const e=(n=(t=this.player).usingPlugin)==null?void 0:n.call(t,"theatreModePlugin");this.defaultDisplayMode==="theatre"?(e&&((i=this.player.theatreModePlugin())==null||i.toggleTheatreMode(!0)),this.player.fill(!0)):(e&&((a=this.player.theatreModePlugin())==null||a.toggleTheatreMode(!1)),this.player.fluid(!0))}applyAspectRatioFix(){const e=()=>{const t=this.player.videoWidth(),n=this.player.videoHeight();if(t>0&&n>0){const i=t/n;Math.abs(i-16/9)<.01||this.player.addClass(_q)}};this.player.readyState()>=1?e():this.player.one("loadedmetadata",e)}addButtons(e,t){const n=new T2(this.player),i=new gq(this.player,{onClickHandler:e}),a=new w2(this.player,{onClick:t});t&&Co.isFunction(t)&&this.player.addChild(a),this.player.addChild(n),this.player.addChild(i),this.buttonAdded=!0}enableSubtitles(){this.player.dataLoaded(()=>this.player.persistSubtitleSettingsPlugin().previewModeSubtitles())}disableSubtitles(){this.player.dataLoaded(()=>this.player.persistSubtitleSettingsPlugin().applyUserPreferences())}mute(){this.player.ready(()=>{this.player.persistVolumePlugin().disable(),this.player.muted(!0)})}unmute(){this.player.ready(()=>{this.player.persistVolumePlugin().applyUserPreferences(),this.player.persistVolumePlugin().enable()})}setLowQuality(){this.player.dataLoaded(()=>{this.player.persistQualitySettingsPlugin().disable();const e=this.player.qualityLevels();if(e.length>0){this.switchToLowestQuality(e);return}this.cleanupQualityListener(),this.onQualityReady=()=>{this.onQualityReady=null,this.switchToLowestQuality(e)},e.one("change",this.onQualityReady)})}cleanupQualityListener(){this.onQualityReady&&(this.player.qualityLevels().off("change",this.onQualityReady),this.onQualityReady=null)}switchToLowestQuality(e){const t=e[e.length-1];t&&Fc.enableQualityLevel(e,t.id)}restorePreviousQuality(){this.player.dataLoaded(()=>{this.player.persistQualitySettingsPlugin().applyUserPreferences(),this.player.persistQualitySettingsPlugin().enable()})}removeActivityTimeout(){this.player.cache_.inactivityTimeout=this.player.options_.inactivityTimeout,this.player.options_.inactivityTimeout=0}restoreActivityTimeout(){this.player.options_.inactivityTimeout=this.player.cache_.inactivityTimeout}}je.registerPlugin("playerModePlugin",Ywe);const bq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Sq(r,e,t,n){let i,a,s;const o=e||[0],u=(t=t||0)>>>3,l=n===-1?3:0;for(i=0;i<r.length;i+=1)s=i+u,a=s>>>2,o.length<=a&&o.push(0),o[a]|=r[i]<<8*(l+n*(s%4));return{value:o,binLen:8*r.length+t}}function E2(r,e,t){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(r){case"HEX":return function(n,i,a){return(function(s,o,u,l){let c,d,h,v;if(s.length%2!=0)throw new Error("String of HEX type must be in byte increments");const g=o||[0],y=(u=u||0)>>>3,_=l===-1?3:0;for(c=0;c<s.length;c+=2){if(d=parseInt(s.substr(c,2),16),isNaN(d))throw new Error("String of HEX type contains invalid characters");for(v=(c>>>1)+y,h=v>>>2;g.length<=h;)g.push(0);g[h]|=d<<8*(_+l*(v%4))}return{value:g,binLen:4*s.length+u}})(n,i,a,t)};case"TEXT":return function(n,i,a){return(function(s,o,u,l,c){let d,h,v,g,y,_,C,k,N=0;const L=u||[0],M=(l=l||0)>>>3;if(o==="UTF8")for(C=c===-1?3:0,v=0;v<s.length;v+=1)for(d=s.charCodeAt(v),h=[],128>d?h.push(d):2048>d?(h.push(192|d>>>6),h.push(128|63&d)):55296>d||57344<=d?h.push(224|d>>>12,128|d>>>6&63,128|63&d):(v+=1,d=65536+((1023&d)<<10|1023&s.charCodeAt(v)),h.push(240|d>>>18,128|d>>>12&63,128|d>>>6&63,128|63&d)),g=0;g<h.length;g+=1){for(_=N+M,y=_>>>2;L.length<=y;)L.push(0);L[y]|=h[g]<<8*(C+c*(_%4)),N+=1}else for(C=c===-1?2:0,k=o==="UTF16LE"&&c!==1||o!=="UTF16LE"&&c===1,v=0;v<s.length;v+=1){for(d=s.charCodeAt(v),k===!0&&(g=255&d,d=g<<8|d>>>8),_=N+M,y=_>>>2;L.length<=y;)L.push(0);L[y]|=d<<8*(C+c*(_%4)),N+=2}return{value:L,binLen:8*N+l}})(n,e,i,a,t)};case"B64":return function(n,i,a){return(function(s,o,u,l){let c,d,h,v,g,y,_,C=0;const k=o||[0],N=(u=u||0)>>>3,L=l===-1?3:0,M=s.indexOf("=");if(s.search(/^[a-zA-Z0-9=+/]+$/)===-1)throw new Error("Invalid character in base-64 string");if(s=s.replace(/=/g,""),M!==-1&&M<s.length)throw new Error("Invalid '=' found in base-64 string");for(d=0;d<s.length;d+=4){for(g=s.substr(d,4),v=0,h=0;h<g.length;h+=1)c=bq.indexOf(g.charAt(h)),v|=c<<18-6*h;for(h=0;h<g.length-1;h+=1){for(_=C+N,y=_>>>2;k.length<=y;)k.push(0);k[y]|=(v>>>16-8*h&255)<<8*(L+l*(_%4)),C+=1}}return{value:k,binLen:8*C+u}})(n,i,a,t)};case"BYTES":return function(n,i,a){return(function(s,o,u,l){let c,d,h,v;const g=o||[0],y=(u=u||0)>>>3,_=l===-1?3:0;for(d=0;d<s.length;d+=1)c=s.charCodeAt(d),v=d+y,h=v>>>2,g.length<=h&&g.push(0),g[h]|=c<<8*(_+l*(v%4));return{value:g,binLen:8*s.length+u}})(n,i,a,t)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch{throw new Error("ARRAYBUFFER not supported by this environment")}return function(n,i,a){return(function(s,o,u,l){return Sq(new Uint8Array(s),o,u,l)})(n,i,a,t)};case"UINT8ARRAY":try{new Uint8Array(0)}catch{throw new Error("UINT8ARRAY not supported by this environment")}return function(n,i,a){return Sq(n,i,a,t)};default:throw new Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function Tq(r,e,t,n){switch(r){case"HEX":return function(i){return(function(a,s,o,u){let l,c,d="";const h=s/8,v=o===-1?3:0;for(l=0;l<h;l+=1)c=a[l>>>2]>>>8*(v+o*(l%4)),d+="0123456789abcdef".charAt(c>>>4&15)+"0123456789abcdef".charAt(15&c);return u.outputUpper?d.toUpperCase():d})(i,e,t,n)};case"B64":return function(i){return(function(a,s,o,u){let l,c,d,h,v,g="";const y=s/8,_=o===-1?3:0;for(l=0;l<y;l+=3)for(h=l+1<y?a[l+1>>>2]:0,v=l+2<y?a[l+2>>>2]:0,d=(a[l>>>2]>>>8*(_+o*(l%4))&255)<<16|(h>>>8*(_+o*((l+1)%4))&255)<<8|v>>>8*(_+o*((l+2)%4))&255,c=0;c<4;c+=1)g+=8*l+6*c<=s?bq.charAt(d>>>6*(3-c)&63):u.b64Pad;return g})(i,e,t,n)};case"BYTES":return function(i){return(function(a,s,o){let u,l,c="";const d=s/8,h=o===-1?3:0;for(u=0;u<d;u+=1)l=a[u>>>2]>>>8*(h+o*(u%4))&255,c+=String.fromCharCode(l);return c})(i,e,t)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch{throw new Error("ARRAYBUFFER not supported by this environment")}return function(i){return(function(a,s,o){let u;const l=s/8,c=new ArrayBuffer(l),d=new Uint8Array(c),h=o===-1?3:0;for(u=0;u<l;u+=1)d[u]=a[u>>>2]>>>8*(h+o*(u%4))&255;return c})(i,e,t)};case"UINT8ARRAY":try{new Uint8Array(0)}catch{throw new Error("UINT8ARRAY not supported by this environment")}return function(i){return(function(a,s,o){let u;const l=s/8,c=o===-1?3:0,d=new Uint8Array(l);for(u=0;u<l;u+=1)d[u]=a[u>>>2]>>>8*(c+o*(u%4))&255;return d})(i,e,t)};default:throw new Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function wq(r){const e={outputUpper:!1,b64Pad:"=",outputLen:-1},t=r||{},n="Output length must be a multiple of 8";if(e.outputUpper=t.outputUpper||!1,t.b64Pad&&(e.b64Pad=t.b64Pad),t.outputLen){if(t.outputLen%8!=0)throw new Error(n);e.outputLen=t.outputLen}else if(t.shakeLen){if(t.shakeLen%8!=0)throw new Error(n);e.outputLen=t.shakeLen}if(typeof e.outputUpper!="boolean")throw new Error("Invalid outputUpper formatting option");if(typeof e.b64Pad!="string")throw new Error("Invalid b64Pad formatting option");return e}function wg(r,e){return r<<e|r>>>32-e}function Cq(r,e,t){return r^e^t}function Xwe(r,e,t){return r&e^r&t^e&t}function ey(r,e){const t=(65535&r)+(65535&e);return(65535&(r>>>16)+(e>>>16)+(t>>>16))<<16|65535&t}function i1(r,e,t,n,i){const a=(65535&r)+(65535&e)+(65535&t)+(65535&n)+(65535&i);return(65535&(r>>>16)+(e>>>16)+(t>>>16)+(n>>>16)+(i>>>16)+(a>>>16))<<16|65535&a}function Qwe(r){return[1732584193,4023233417,2562383102,271733878,3285377520]}function Eq(r,e){let t,n,i,a,s,o,u;const l=[];for(t=e[0],n=e[1],i=e[2],a=e[3],s=e[4],u=0;u<80;u+=1)l[u]=u<16?r[u]:wg(l[u-3]^l[u-8]^l[u-14]^l[u-16],1),o=u<20?i1(wg(t,5),(c=n)&i^~c&a,s,1518500249,l[u]):u<40?i1(wg(t,5),Cq(n,i,a),s,1859775393,l[u]):u<60?i1(wg(t,5),Xwe(n,i,a),s,2400959708,l[u]):i1(wg(t,5),Cq(n,i,a),s,3395469782,l[u]),s=a,a=i,i=wg(n,30),n=t,t=o;var c;return e[0]=ey(t,e[0]),e[1]=ey(n,e[1]),e[2]=ey(i,e[2]),e[3]=ey(a,e[3]),e[4]=ey(s,e[4]),e}function Zwe(r,e,t,n){let i;const a=15+(e+65>>>9<<4),s=e+t;for(;r.length<=a;)r.push(0);for(r[e>>>5]|=128<<24-e%32,r[a]=4294967295&s,r[a-1]=s/4294967296|0,i=0;i<r.length;i+=16)n=Eq(r.slice(i,i+16),n);return n}class Jwe extends class{constructor(e,t,n){const i=n||{};if(this.t=t,this.i=i.encoding||"UTF8",this.numRounds=i.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw new Error("numRounds must a integer >= 1");this.s=e,this.o=[],this.h=0,this.u=!1,this.l=0,this.A=!1,this.p=[],this.R=[]}update(e){let t,n=0;const i=this.U>>>5,a=this.T(e,this.o,this.h),s=a.binLen,o=a.value,u=s>>>5;for(t=0;t<u;t+=i)n+this.U<=s&&(this.F=this.m(o.slice(t,t+i),this.F),n+=this.U);this.l+=n,this.o=o.slice(n>>>5),this.h=s%this.U,this.u=!0}getHash(e,t){let n,i,a=this.g;const s=wq(t);if(this.B){if(s.outputLen===-1)throw new Error("Output length must be specified in options");a=s.outputLen}const o=Tq(e,a,this.v,s);if(this.A&&this.Y)return o(this.Y(s));for(i=this.H(this.o.slice(),this.h,this.l,this.C(this.F),a),n=1;n<this.numRounds;n+=1)this.B&&a%32!=0&&(i[i.length-1]&=16777215>>>24-a%32),i=this.H(i,a,0,this.I(this.s),a);return o(i)}setHMACKey(e,t,n){if(!this.L)throw new Error("Variant does not support HMAC");if(this.u)throw new Error("Cannot set MAC key after calling update");const i=E2(t,(n||{}).encoding||"UTF8",this.v);this.M(i(e))}M(e){const t=this.U>>>3,n=t/4-1;let i;if(this.numRounds!==1)throw new Error("Cannot set numRounds with MAC");if(this.A)throw new Error("MAC key already set");for(t<e.binLen/8&&(e.value=this.H(e.value,e.binLen,0,this.I(this.s),this.g));e.value.length<=n;)e.value.push(0);for(i=0;i<=n;i+=1)this.p[i]=909522486^e.value[i],this.R[i]=1549556828^e.value[i];this.F=this.m(this.p,this.F),this.l=this.U,this.A=!0}getHMAC(e,t){const n=wq(t);return Tq(e,this.g,this.v,n)(this.N())}N(){let e;if(!this.A)throw new Error("Cannot call getHMAC without first setting MAC key");const t=this.H(this.o.slice(),this.h,this.l,this.C(this.F),this.g);return e=this.m(this.R,this.I(this.s)),e=this.H(t,this.g,this.U,e,this.g),e}}{constructor(e,t,n){if(e!=="SHA-1")throw new Error("Chosen SHA variant is not supported");super(e,t,n);const i=n||{};this.L=!0,this.Y=this.N,this.v=-1,this.T=E2(this.t,this.i,this.v),this.m=Eq,this.C=function(a){return a.slice()},this.I=Qwe,this.H=Zwe,this.F=[1732584193,4023233417,2562383102,271733878,3285377520],this.U=512,this.g=160,this.B=!1,i.hmacKey&&this.M((function(a,s,o,u){const l=a+" must include a value and format";if(!s)throw new Error(l);if(s.value===void 0||!s.format)throw new Error(l);return E2(s.format,s.encoding||"UTF8",o)(s.value)})("hmacKey",i.hmacKey,this.v))}}var Uc=(r=>(r.CvApSoutheast1="cv-ap-southeast-1",r.CvApSoutheast2="cv-ap-southeast-2",r.CvEuWest1="cv-eu-west-1",r.CvNaWest1="cv-na-west-1",r))(Uc||{});const eCe={systemName:Uc.CvApSoutheast1},tCe={systemName:Uc.CvApSoutheast2},rCe={systemName:Uc.CvEuWest1},nCe={systemName:Uc.CvNaWest1},iCe={CvApSoutheast1:eCe,CvApSoutheast2:tCe,CvEuWest1:rCe,CvNaWest1:nCe};var xq=(r=>(r.Staff="Staff",r.Learner="Learner",r.Unknown="Unknown",r.System="System",r))(xq||{});const kq="r",a1="cv:r",s1="cv:r:e",o1="referrer",Aq="cv:originalReferrer",x2=28800,Iq=["internalReferrer"],k2={getDecodedAttributionData(){const r=So.cacheGet(a1);if(r&&Object.keys(r).length>0)return r;const e=Dq();return e==null?void 0:e.decoded},getEncodedAttributionData(){const r=So.cacheGet(s1);return r!=null&&r.length?r:Dq().encoded},getProfileId(){const r=k2.getDecodedAttributionData();return(r==null?void 0:r.profileId)??null},setAttributionData(r){if(!r)return;const e=Nq(r);I2(e,r)},decodeRValue(r){if(r)try{const e=atob(r),t=JSON.parse(e);if(!A2(t))throw Error(`Decoded R value is invalid: ${JSON.stringify(t)}`);return t}catch(e){const t=e instanceof Error?e.message:e==null?void 0:e.toString();console.error(t)}}};function Dq(){const r=So.cacheGet(a1),e=So.cacheGet(s1);return A2(r)?{encoded:e,decoded:r}:aCe()}function aCe(){So.cacheRemove(a1),So.cacheRemove(s1);const r=oCe(),e=k2.decodeRValue(r);if(e)return I2(r,e),{decoded:e,encoded:r};const t={internalReferrer:window.location.origin+window.location.pathname,originalReferrer:sCe()},n=Nq(t);return I2(n,t),{decoded:t,encoded:n}}function A2(r){return!r||typeof r!="object"||Object.keys(r).length<Iq.length?!1:Iq.every(e=>typeof r[e]=="string")}function sCe(){const r=So.cacheGet(Aq);if(r&&typeof r=="string")return r;let e=document.referrer??"";if(window.URLSearchParams){const t=new URLSearchParams(window.location.search),n=t.has(o1)&&t.get(o1);t.has(o1)&&t.get(o1)&&(e=n)}return e&&So.cacheSet(Aq,e,x2),e}function oCe(){if(!window.URLSearchParams)return;const r=new URLSearchParams(window.location.search);if(r.has(kq))return r.get(kq)}function Nq(r){if(A2(r))try{return btoa(JSON.stringify(r))}catch{console.error(`R value could not be encoded: ${JSON.stringify(r)}`)}}function I2(r,e){try{So.cacheSet(a1,e,x2),So.cacheSet(s1,r,x2)}catch{console.error("Could not store attribution data in session storage")}}const Mq=3,uCe=5e3,lCe=6,D2={};class cCe{constructor(e){this.key=e.toString()}getCount(){return D2[this.key]||0}increment(){D2[this.key]=this.getCount()+1}reset(){delete D2[this.key]}shouldBreak(){return this.getCount()>=lCe}}class dCe{constructor(){this.attempt=0}async wait(){await new Promise(e=>setTimeout(e,uCe*Math.pow(2,this.attempt))),this.attempt++}}async function hCe(r,e){const t=new dCe,n=new cCe(r);async function i(){const a=await fetch(r,e);if(a.status>=500&&!n.shouldBreak())throw new Error(`Server error: ${a.status}`);return a.ok&&n.reset(),a}for(let a=1;a<=Mq;a++)try{return await i()}catch(s){if(a>=Mq||n.shouldBreak())throw s;n.increment(),await t.wait()}}const kf={isObject(r){const e=typeof r;return e==="function"||e==="object"&&!!r},isFunction(r){return typeof r=="function"}},Oq={safeUrlConcat(r,e){if(!r)return;let t=r;return r.endsWith("/")||(t+="/"),e&&(t+=e.startsWith("/")?e.slice(1):e),t}},vi={mobileDevice:/Mobi/i,iphone:/iphone/i,ipad:/ipad/i,android:/android/i,blackberry:/blackberry/i,windowsPhone:/windows phone/i,iosVersion:/OS\s+([\d_.-:]+)\s/i,androidVersion:/android\s+([\d_.-\/]+)[\s;:,\)]/i,blackberryVersion:/(blackberry|version)\s?\d*\/([\d.]+)/i,windowsPhoneVersion:/windows\sphone.*?([\d_.-\/]+)[\s;:,\)]/i,mac:/Mac/i,unix:/X11/i,linux:/Linux/i,windows:/Win/i,win2000:/nt 5.0/i,winXP:/nt 5.1/i,winVista:/nt 6.0/i,win7:/nt 6.1/i,win8:/nt 6.2/i,win81:/nt 6.3/i,win10:/nt 10.0/i,osxVersion:/OS\sX\s([\d_.]+)/i,chrome:/^(?!.*Edge).*Chrome/i,safari:/^(?!.*(?:Chrome|Edge)).*Safari/i,edge:/edge/i,ie:/(msie|trident)/i,opera:/(opr|opera)/i,firefox:/firefox/i,generalVersion:/(chrome|firefox|version)\/(\d+.*?)(\s|$)/i,operaVersion:/(opr|opera)\/(\d+).*?(\s|$)/i,ieVersion:/MSIE\s+(\d+).*?/i,edgeVersion:/(edge)\/(\d+).*?(\s|$)/i},gd="Unknown";function Cg(r,e,t){const n=e.exec(t)||[];let[i]=n;return i||(i=gd),{name:r,version:i}}function Af(r,e,t){if(!e)return{name:r,version:gd};const n=e.exec(t),i=n&&n.length?n[0].trim():gd;return{name:r,version:i}}function fCe(r,e){const t={name:r,version:null};return vi.win2000.test(e)&&(t.version="2000"),vi.winXP.test(e)&&(t.version="XP"),vi.winVista.test(e)&&(t.version="Vista"),vi.win7.test(e)&&(t.version="7"),vi.win8.test(e)&&(t.version="8"),vi.win81.test(e)&&(t.version="8.1"),vi.win10.test(e)&&(t.version="10"),t.version||(t.version=gd),t}const Lq={getDeviceType(){const r=window.navigator.userAgent;return vi.mobileDevice.test(r)?vi.iphone.test(r)?"iPhone":vi.ipad.test(r)?"iPad":vi.android.test(r)?"Android":vi.blackberry.test(r)?"Blackberry":vi.windowsPhone.test(r)?"Windows Phone":gd:"Desktop"},getOperatingSystem(){const r=window.navigator.userAgent;return vi.android.test(r)?Af("Android",vi.androidVersion,r):vi.iphone.test(r)||vi.ipad.test(r)?Af("iOS",vi.iosVersion,r):vi.linux.test(r)?Af("Linux",null,r):vi.unix.test(r)?Af("Unix",null,r):vi.mac.test(r)?Af("Macintosh",vi.osxVersion,r):vi.windows.test(r)?fCe("Windows",r):vi.blackberry.test(r)?Af("BlackBerry",vi.blackberryVersion,r):vi.windowsPhone.test(r)?Af("Windows Phone",vi.windowsPhoneVersion,r):{name:gd,version:gd}},getBrowser(){const r=window.navigator.userAgent;return vi.chrome.test(r)?Cg("Chrome",vi.generalVersion,r):vi.firefox.test(r)?Cg("Firefox",vi.generalVersion,r):vi.safari.test(r)?Cg("Safari",vi.generalVersion,r):vi.ie.test(r)?Cg("Internet Explorer",vi.ieVersion,r):vi.edge.test(r)?Cg("Edge",vi.edgeVersion,r):vi.opera.test(r)?Cg("Opera",vi.operaVersion,r):{name:gd,version:gd}},isTouchScreen(){return!!("ontouchstart"in window||navigator.maxTouchPoints)}},pCe=28800,Pq="cv:utmparams",N2=[["source","utm_source"],["medium","utm_medium"],["campaign","utm_campaign"],["term","utm_term"],["content","utm_content"]],gCe=N2.reduce((r,[e])=>({...r,[e]:e}),{}),Rq={getUtmParameters(){if(!window.URLSearchParams)return null;const r=new URLSearchParams(window.location.search),e={},t=([n,i])=>{r.has(i)&&(e[n]=r.get(i))};return N2.forEach(t),jq(e)},setUtmParameters(r){if(!r)return;const e={},t=n=>{gCe[n]&&(e[n]=r[n])};return Object.keys(r).forEach(t),jq(e)},getURLSearchParams(){if(!window.URLSearchParams)return null;const r=new URLSearchParams,e=Rq.getUtmParameters();return e?(N2.forEach(([t,n])=>{e[t]&&r.set(n,e[t])}),r):null}};function jq(r){if(Object.keys(r).length)return So.cacheSet(Pq,r,pCe),r;const e=So.cacheGet(Pq);return e&&typeof e=="object"&&Object.keys(e).length?e:null}const mCe={version:"2.3.0"},vCe="zXJL9nOHxzDlMUDjiP41",Bq="unknown";class yCe{constructor(e){this.options=e,this.initialize()}initialize(){this.validateOptions(),this.options.logUtmParameters&&(this.utmParameters=Rq.getUtmParameters()),this.options.logAttributionData&&(this.attributionData=k2.getDecodedAttributionData())}get name(){return"CollectionApiClient"}async log(e){if(Array.isArray(e))return this.logBulk(e);this.shouldLog(e)&&(this.validateEvent(e),await this.postData(await this.formatData(e)))}async logBulk(e){const t=e.filter(i=>this.shouldLog(i));if(!t.length)return;t.forEach(i=>this.validateEvent(i));const n=await Promise.all(t.map(i=>this.formatData(i)));await this.postData(n)}validateOptions(){if(!kf.isFunction(this.options.getUser))throw new Error("getUser option is required.")}shouldLog(e){return kf.isFunction(this.options.shouldLog)?this.options.shouldLog(e):!0}async postData(e){const t=await this.getRegionalUrl(this.options.collectionApiUrls),n=JSON.stringify(e),i={"Content-Type":"application/json",...this.getSignatureHeader(n)};let a=Oq.safeUrlConcat(t,"/v1/ingest");Array.isArray(e)&&(a=Oq.safeUrlConcat(a,"/bulk"));try{const s=await hCe(a,{method:"POST",mode:"cors",headers:i,body:n});s.ok||this.logError(new Error(`CollectionApiClient failed to log event. Status: ${s.status} ${s.statusText}`),!1,this.getResponseAsObject(s))}catch(s){this.logError(s)}}getResponseAsObject(e){return{headers:e.headers,ok:e.ok,redirected:e.redirected,status:e.status,statusText:e.statusText,type:e.type,url:e.url,body:e.text()}}getSignatureHeader(e){const t=new Jwe("SHA-1","TEXT",{hmacKey:{value:vCe,format:"TEXT",encoding:"UTF8"}});return t.update(e),{"cv-analytics-signature":`${this.options.collectionApiClientId}.${t.getHash("B64")}`}}async getRegionalUrl(e){switch((await this.getRegion()).systemName){case Uc.CvEuWest1:return e.cvEuWest1;case Uc.CvApSoutheast2:return e.cvApSoutheast2;case Uc.CvNaWest1:return e.cvNaWest1;case Uc.CvApSoutheast1:default:return e.cvApSoutheast1}}validateEvent(e){typeof e.type!="string"&&this.logError(new Error("Event type is required."),!0),kf.isObject(e.actionContext)||this.logError(new Error("Event actionContext is required."),!0),e.actionContext.entity||this.logError(new Error("Event actionContext entity is required."),!0)}async formatData(e){return{type:e.type,data:await this.getEventData(e),metadata:this.getEventMetadata(e)}}async getEventData(e){const t=e.actionContext,n=this.getPlatformMetadata(),i=await this.getUserData(),a=await this.getSessionData(),s={name:this.options.productName,version:this.options.productVersion};this.options.productVariant&&(s.variant=this.options.productVariant);const o={user:i,action:t,platform:n,product:s,session:a};this.utmParameters&&(o.utm=this.utmParameters);const u=this.extractData(e),l=Object.keys(o).map(d=>d.toLowerCase()),c=Object.keys(u).map(d=>d.toLowerCase());return l.forEach(d=>{c.includes(d)&&this.logError(new Error(`${d} is a reserved key.`),!0)}),{...o,...u}}extractData(e){return kf.isFunction(this.options.formatData)?this.options.formatData(e):{[e.actionContext.entity]:e.data}}async getUserData(){var t,n,i;let e;try{e=await((n=(t=this.options).getProfileId)==null?void 0:n.call(t))}catch(a){this.logError(a)}try{const a=await this.options.getUser();return a!=null&&a.id?{id:a.id,role:((i=a.role)==null?void 0:i.toLowerCase())||Bq,userGroup:(a.userGroup??xq.Unknown).toLowerCase(),yearGroup:this.normalizeYearGroup(a.yearGroup),profileId:e,customer:{id:a.customerId,name:a.customerName,customerGuid:a.customerGuid,crmId:a.crmId,country:a.countryCode,region:await this.getRegion(),openCustomer:!1,accessPolicy:a.accessPolicy}}:e?{profileId:e}:void 0}catch(a){this.logError(a)}}async getRegion(){let e=this.options.regionName;try{const t=await this.options.getUser();t!=null&&t.instanceRegion&&(e=t.instanceRegion)}catch(t){this.logError(t)}return e||this.logError(new Error("RegionName is not set."),!0),this.getRegionByName(e.toLowerCase())}async getSessionData(){try{const e=await this.options.getUser();return{...xv.getClientSessionData(e==null?void 0:e.id),authSessionId:e==null?void 0:e.sessionId}}catch(e){return console.error(e),xv.getClientSessionData(null)}}getPlatformMetadata(){var t,n;const e={url:window.location.href,referrer:document.referrer};return(t=this.attributionData)!=null&&t.internalReferrer&&(e.internalReferrer=this.attributionData.internalReferrer),(n=this.attributionData)!=null&&n.originalReferrer&&(e.originalReferrer=this.attributionData.originalReferrer),{browser:Lq.getBrowser(),os:Lq.getOperatingSystem(),request:e,screenResolution:`${window.screen.width}x${window.screen.height}`,viewportResolution:`${window.innerWidth}x${window.innerHeight}`}}getEventMetadata(e){return{client:{name:`${this.name}.ts`,version:mCe.version,region:this.getRegionByName(this.options.regionName)},timestamp:new Date().toISOString(),eventVersion:e.eventVersion}}getRegionByName(e){let t;return Object.values(iCe).forEach(n=>{n.systemName===e&&(t=n)}),t}normalizeYearGroup(e){return e?e.toLowerCase().split(" ").join("_"):Bq}logError(e,t,...n){if(this.options.logError&&this.options.logError(e,...n),t)throw e}}var cr=(r=>(r.Stream="cv_product_stream",r.WebPlayerStream="cv_product_webplayer_stream",r.StreamProgress="cv_product_stream_progress",r.PreviewStreamProgress="cv_product_preview_stream_progress",r.StreamBuffering="cv_product_stream_buffering",r.Login="cv_product_login",r.LoginSsoRedirect="cv_product_login_sso_redirect",r.LoginFailed="cv_product_login_failed",r.Search="cv_product_search",r.InstantSearch="cv_product_instant_search",r.SearchEmptyResult="cv_product_search_empty_result",r.Filter="cv_product_search_filter",r.SearchLanding="cv_product_search_landing",r.Share="cv_product_share",r.Unshare="cv_product_unshare",r.WorkspaceAdd="cv_product_tv_add",r.Rename="cv_product_rename",r.Move="cv_product_move",r.Sort="cv_product_sort",r.Create="cv_product_create",r.Delete="cv_product_delete",r.Associate="cv_product_associate",r.Dissociate="cv_product_dissociate",r.Edit="cv_product_edit",r.Approve="cv_product_approve",r.Reject="cv_product_reject",r.Disable="cv_product_disable",r.Upload="cv_product_upload",r.Download="cv_product_download",r.Navigate="cv_product_navigate",r.Click="cv_product_click",r.Suggest="cv_product_suggest",r.EditAssoc="cv_product_edit_assoc",r.Play="cv_product_play",r.Favourite="cv_product_favourite",r.Follow="cv_product_follow",r.Prefer="cv_product_prefer",r.Print="cv_product_print",r.Copy="cv_product_copy",r.Activate="cv_product_activate",r.VerifyEmail="cv_product_verify_email",r.ChangePassword="cv_product_change_password",r.ManageGroup="cv_product_manage_group",r.Export="cv_product_export",r.SendEmail="cv_product_send_email",r.Publish="cv_product_publish",r.Submit="cv_product_submit",r.Complete="cv_product_complete",r.Archive="cv_product_archive",r.Promote="cv_product_promote",r.Demote="cv_product_demote",r.BulkAction="cv_product_bulk_action",r.Remove="cv_product_remove",r.Dismiss="cv_product_dismiss",r.Open="cv_product_open",r.Hide="cv_product_hide",r.PageView="cv_product_page_view",r.Select="cv_product_select",r.SwitchCustomer="cv_product_switch_customer",r.Focus="cv_product_focus",r.Blur="cv_product_blur",r.Hover="cv_product_hover",r.Unhover="cv_product_unhover",r.SetAccess="cv_product_set_access",r.AddToLocalCache="cv_product_add_to_lc",r.ResolveWarning="cv_product_resolve_warning",r.DismissWarning="cv_product_dismiss_warning",r))(cr||{}),Si=(r=>(r.Folder="folder",r.Video="video",r.Rating="rating",r.Series="series",r.Library="library",r.Resource="resource",r.Tag="tag",r.Subtitle="subtitle",r.Chapter="chapter",r.Resolution="resolution",r.PlaybackSpeed="playback_speed",r.Device="device",r.Restriction="restriction",r.Interactive="interactive",r.Interaction="interaction",r.PDF="pdf",r.CustomerSetting="customer_setting",r.UserSetting="user_setting",r.LibraryRequest="staff_request",r.Logo="logo",r.Pagination="pagination",r.Thumbnail="thumbnail",r.Banner="banner",r.Link="link",r.Playlist="playlist",r.Playlists="playlists",r.Person="person",r.Company="company",r.Classroom="classroom",r.ClassroomGroup="classroom_group",r.Classification="classification",r.ShareLink="share_link",r.DirectShare="direct_share",r.Upload="upload",r.SearchResults="search_results",r.SearchSuggestion="search_suggestion",r.Audience="audience",r.User="user",r.Clip="clip",r.UserChannel="user_channel",r.Widget="widget",r.Url="url",r.SocialShare="social_share",r.Presentation="presentation",r.BatchJob="batch_job",r.DeepLink="deep_link",r.Feedback="feedback",r.AppLink="app_link",r.SignUp="sign_up",r.FileGeneratorJob="file_generator_job",r.ExportLibraries="export_libraries",r.Product="product",r.Customer="customer",r.SpecialEvent="special_event",r.Region="region",r.ProductTip="product_tip",r.Livestream="livestream",r.DevicesCta="devices_cta",r.Integration="integration",r.Faq="faq",r.MixedMedia="mixed_media",r.TableOfContents="table_of_contents",r.Author="author",r.Glance="glance",r.Filter="filter",r.NotificationSetting="notification_setting",r.Transcript="transcript",r.CurriculumCode="curriculum_code",r.Assign="assign",r.PartnerProfile="partner_profile",r))(Si||{}),md=(r=>(r.TopNav="top_nav",r.LeftNav="left_nav",r.Footer="footer",r.Popup="popup",r.Banner="banner",r.VideoList="video_list",r.VideoListItem="video_list_item",r.VideoListHeader="video_header",r.VideoThumbnail="video_thumbnail",r.ExpandableVideoThumbnail="expandable_video_thumbnail",r.VideoItemPreview="video_item_preview",r.InteractiveItemPreview="interactive_item_preview",r.ClipItemPreview="clip_item_preview",r.VideoDetails="video_details",r.InteractiveDetails="interactive_details",r.ClipDetails="clip_details",r.VideoDetailsHeader="video_details_header",r.EditVideoDetails="edit_video_details",r.EditInteractiveVideoDetails="edit_interactive_video_details",r.EditClipDetails="edit_clip_details",r.EditVideoChapters="edit_video_chapters",r.EditVideoResources="edit_video_resources",r.PreviewVideoResources="preview_video_resources",r.VideoUpload="video_upload",r.VideoRequest="video_request",r.Pagination="pagination",r.LibraryHeader="library_header",r.LibraryTiles="library_tiles",r.LibraryRequestDetails="staff_request_details",r.Libraries="libraries",r.SubFolderList="sub_folder_list",r.AwaitingReviewVideoListHeader="awaiting_review_video_list_header",r.AwaitingReviewVideoItem="awaiting_review_video_item",r.PastReleasesHeader="past_releases_header",r.MigrationWarnings="migration_warnings",r.PlaylistListHeader="playlist_list_header",r.PlaylistListItem="playlist_list_item",r.SeriesListItem="series_list_item",r.SeriesWithVideos="series_with_videos",r.PlaylistWithVideos="playlist_with_videos",r.Dropdown="dropdown",r.ViewCurriculumLinks="view_curriculum_links",r.SearchBar="search_bar",r.InstantSearch="instant_search",r.SearchFilters="search_filters",r.FeaturedSeriesSearchResult="featured_series_search_result",r.ExchangeSearchGroupItem="exchange_search_group_item",r.StaffManager="staff_manager",r.StaffManagerListItem="staff_manager_list_item",r.StudentManager="student_manager",r.ViewStudentVideos="view_student_videos",r.StudentManagerListItem="student_manager_list_item",r.EditUser="edit_user",r.UserAuditLog="user_audit_log",r.BulkUserActionsWizard="bulk_user_actions_wizard",r.BulkUserUploadWizard="bulk_user_upload_wizard",r.Classroom="classroom",r.ClassroomsList="classrooms_list",r.ClassroomsListItem="classrooms_list_item",r.ManageClassroomStudents="manage_classroom_students",r.ManageClassroomStudentListItem="manage_classroom_student_list_item",r.ManageClassroomGroups="manage_classroom_groups",r.ManageClassroomGroupListItem="manage_classroom_group_list_item",r.ManageClassroomTeachers="manage_classroom_teachers",r.ManageClassroomTeacherListItem="manage_classroom_teachers_list_item",r.ArchivedClassrooms="archived_classrooms",r.PreviewInteractive="preview_interactive",r.PreviewSharedInteractive="preview_shared_interactive",r.PreviewInteractiveQuestions="preview_interactive_questions",r.EditInteractive="edit_interactive",r.EditInteractiveDetails="edit_interactive_details",r.PlaySharedInteractive="play_shared_interactive",r.PlayInteractive="play_interactive",r.InteractiveListItem="interactive_list_item",r.DeleteInteractive="delete_interactive",r.NewInteractive="new_interactive",r.CopyInteractive="copy_interactive",r.UnpublishInteractive="unpublish_interactive",r.ShareInteractive="share_interactive",r.PlayPage="play_page",r.Player="player",r.FloatingPlayer="floating_player",r.InteractivePlayer="interactive_player",r.EmbeddedPlayer="embedded_player",r.CreateClipPlayer="create_clip_player",r.PlayClip="play_clip",r.PlaySharedClip="play_shared_clip",r.ClipListItem="clip_list_item",r.ContentUpdatesBanner="content_updates_banner",r.ContentUpdatesClassificationBanner="content_updates_classification_banner",r.PreferencesSettings="preferences_settings",r.NotificationSettings="notification_settings",r.TopicsOnboarding="topics_onboarding",r.MyUploads="my_uploads",r.MyVideos="my_videos",r.Playlists="playlists",r.SlidingList="sliding_list",r.HeroBannerItem="hero_banner_item",r.SlidingListItem="sliding_list_item",r.ClassificationListItem="classification_list_item",r.ClassificationComingSoon="classification_coming_soon",r.ClassificationHero="classification_hero",r.ClassificationFooter="classification_footer",r.Classification="classification",r.PresentationClassifications="presentation_classifications",r.Dashboard="dashboard",r.TeachingLevelBanner="teaching_level_banner",r.DiscoverFooter="discover_footer",r.ProductBanner="product_banner",r.UserOptions="user_options",r.MagicTabs="magic_tabs",r.Settings="settings",r.StudentFeed="student_feed",r.MyShares="my_shares",r.SharedByMe="shared_by_me",r.SharedWithMe="shared_with_me",r.Insights="insights",r.Error="error_view",r.UpgradeForm="upgrade_form",r.ClassroomGuide="classroom_guide",r.TeachingResources="teaching_resources",r.ResourcesGuidancePopup="resources_guidance_popup",r.InteractivesGuidancePopup="interactives_guidance_popup",r.CurriculumGuidancePopup="curriculum_guidance_popup",r.TopVideos="top_videos",r.VideoViewsList="video_views_list",r.VideoOverview="video_overview",r.StudentReachPopup="student_reach_popup",r.VideoHighlight="video_highlight",r.ClassroomViewsPopup="classroom_views_popup",r.GiveFeedbackPopup="give_feedback_popup",r.LibraryRequestSettings="library_request_settings",r.OpenInAppPrompt="open_in_app_prompt",r.UseAppButton="use_app_button",r.Launchpad="launchpad",r.EditableSubjectPreferencesWidget="editable_subject_preferences_widget",r.ThumbnailHeroMediaWidget="thumbnail_hero_media_widget",r.ThumbnailFixedListMediaLargeWidget="thumbnail_fixed_list_media_large",r.FilterSlidingPillListSmallWidget="filter_sliding_pill_list_small",r.CircleLogoSlidingListWidget="circle_logo_sliding_list_widget",r.RectangularLogoSlidingListWidget="rectangular_logo_sliding_list_widget",r.HeroBannerSmallWidget="hero_banner_small",r.EventIconSlidingListWidget="event_icon_sliding_list_widget",r.FaqQuestionWidget="faq_question_widget",r.FaqQuestionAccordionWidget="faq_question_accordion_widget",r.SubjectStatsWidgetItem="subject_stats_widget_item",r.AuthorReviewerWidget="author_reviewer_widget",r.ThumbnailFixedListMediaSmallWidget="thumbnail_fixed_list_media_small_widget",r.ThumbnailFixedListFolderSmallWidget="thumbnail_fixed_list_folder_small_widget",r.ThumbnailVerticalListWidget="thumbnail_vertical_list_widget",r.ThumbnailFixedListSmallWidget="thumbnail_fixed_list_small_widget",r.PosterFixedListLargeWidget="poster_fixed_list_large_widget",r.CurriculumResourcesAccordionWidget="curriculum_resources_accordion_widget",r.SearchCurriculumCodeWidget="search_curriculum_code_widget",r.ExchangeLinksWidget="exchange_links_widget",r.TableOfContents="table_of_contents",r.SignUpPopup="sign_up_popup",r.SignUpPage="sign_up_page",r.TrialBanner="trial_banner",r.InviteColleaguePopup="invite_colleague_popup",r.AuthProspectSelect="auth_prospect_select",r.GatedBanner="gated_banner",r.GatedEmptyState="gated_empty_state",r.GatedPopup="gated_popup",r.WelcomePopup="welcome_popup",r.WatchHistoryLanding="watch_history_landing",r.MyFavouritesLanding="my_favourites_landing",r.MyVideoLanding="my_videos_landing",r.PlaylistsLanding="playlists_landing",r.MySharesLanding="myshares_landing",r.PremiumFeatures="premium_features",r.NotificationsDropdown="notifications_dropdown",r.CalendarNav="calendar_nav",r.CalendarDay="calendar_day",r.CalendarPopup="calendar_popup",r.RegionMap="region_map",r.OnboardingSelectRoleScreen="onboarding_select_role_screen",r.OnboardingSchoolLevelScreen="onboarding_school_level_screen",r.OnboardingAudiencePreferencesScreen="onboarding_audience_preferences_screen",r.OnboardingSelectCurriculumScreen="onboarding_select_curriculum_screen",r.OnboardingSubjectsScreen="onboarding_subjects_screen",r.ProductTips="product_tips",r.LivestreamBookingForm="booking_form",r.DateRangeFilter="date_range_selector",r.AudienceFilter="audience_filter",r.AssignFlowView="assign_flow_view",r.ContentPartnerDashboard="content_partner_dashboard",r.ContentPartnerDashboardVideoBanner="content_partner_dashboard_video_banner",r.Global="global",r))(md||{}),nu=(r=>(r.Start="start",r.Complete="complete",r.Save="save",r.Discard="discard",r.Next="next",r.Back="back",r))(nu||{}),If=(r=>(r.Start="start",r.Finish="finish",r.Terminate="terminate",r.Play="play",r.Pause="pause",r.Playback="playback",r.NextChapter="next_chapter",r.PreviousChapter="previous_chapter",r.FullScreenEnter="full_screen_enter",r.FullScreenExit="full_screen_exit",r.ChangeResolution="change_resolution",r.ChangeSpeed="change_speed",r.ChangeDevice="change_device",r.EnableTheatreMode="enable_theatre_mode",r.DisableTheatreMode="disable_theatre_mode",r.ShowTranscript="show_transcript",r.HideTranscript="hide_transcript",r))(If||{}),Fq=(r=>(r.Embedded="embedded",r))(Fq||{}),Uq=(r=>(r.TogglePreview="toggle_preview",r.NavigateHome="navigate_home",r.OpenInStaffView="open_in_staff_view",r.Title="title",r.ToggleHideValidListings="toggle_hide_valid_listings",r.LaunchImmersiveReader="launch_immersive_reader",r.CopyEmbedHtml="copy_embed_html",r.CopyRecommendationEmail="copy_recommendation_email",r.OpenRecommendationMailTo="open_recommendation_mail_to",r.Close="close",r.Open="open",r.Button="button",r.Link="link",r.Tile="tile",r.Thumbnail="thumbnail",r.Cover="cover",r.TallPoster="tall_poster",r.Banner="banner",r.Slide="slide",r.ExternalLink="external_link",r.ViewStudentWorkspace="view_student_workspace",r.Card="card",r.SelectAllUsers="select_all_users",r.ClickViewLogo="clickview_logo",r.Clear="clear",r.SeeMore="see_more",r.Settings="settings",r.Expand="expand",r.Collapse="collapse",r.Search="search",r))(Uq||{}),zq=(r=>(r.FeatureUserChannelVideo="feature_user_channel_video",r.RemoveFromUserChannelPlaylist="remove_from_user_channel_playlist",r.ShareClip="share_clip",r.ViewOriginalVideo="view_original_video",r.ShareInteractive="share_interactive",r.DeleteInteractiveVideo="delete_interactive_video",r.CopyInteractiveVideo="copy_interactive_video",r.EditInteractiveVideo="edit_interactive_video",r.PrintAsWorksheet="print_as_worksheet",r.PreviewInteractiveVideo="preview_interactive_video",r.ViewResults="view_results",r.ViewInsights="view_insights",r.ViewUsage="view_usage",r.MoveToAnotherFolder="move_to_another_folder",r.CreateInteractiveVideo="create_interactive_video",r.ShareVideo="share_video",r.EditVideo="edit_video",r.DownloadVideo="download_video",r.AddToExchange="add_to_exchange",r.AddToUserChannel="add_to_user_channel",r.CreateClip="create_clip",r.FlagVideo="flag_video",r.AddToLibrary="add_to_library",r.AddToWorkspace="add_to_workspace",r.AddToPlaylist="add_to_playlist",r.RemoveFromPlaylist="remove_from_playlist",r.AddCurriculumLink="add_curriculum_link",r.ViewCurriculumLinks="view_curriculum_links",r.OpenInCurator="open_in_curator",r.ManageVideoAccess="manage_video_access",r.Approve="approve",r.AddToLocalCache="add_to_local_cache",r.OpenInLibraryEditor="open_in_library_editor",r.OpenInClickView="open_in_clickview",r.PlayClip="play_clip",r.EditClip="edit_clip",r.DeleteClip="delete_clip",r.EditVideoDetails="edit_video_details",r.DeleteVideo="delete_video",r.ManageAccess="manage_access",r.SuggestEdit="suggest_edit",r.RemoveFromWatchHistory="remove_from_watch_history",r.ShowTranscript="show_transcript",r.HideTranscript="hide_transcript",r.TranscriptTimepoint="transcript_timepoint",r))(zq||{}),M2=(r=>(r.FileSelect="file_select",r.DragDrop="drag_drop",r))(M2||{}),O2=(r=>(r.On="on",r.Off="off",r))(O2||{}),L2=(r=>(r.ContinueSession="continue_session",r.NewSession="new_session",r))(L2||{}),ty=(r=>(r.SearchTranscript="search_transcript",r.NextResult="next_result",r.PreviousResult="previous_result",r.ResetResults="reset_results",r))(ty||{}),P2=(r=>(r.FileSelect="file-select",r.DragDrop="drag-drop",r))(P2||{}),ch=(r=>(r.Video="videos",r.Clip="clips",r.Interactive="interactives",r.Folder="categories",r.Series="series",r.Tags="tags",r.Subjects="subjects",r))(ch||{}),vd=(r=>(r[r.V1=1]="V1",r[r.V2=2]="V2",r[r.V3=3]="V3",r[r.V4=4]="V4",r[r.V5=5]="V5",r))(vd||{});const Za={passthrough(r){return r}},yn={allow:()=>!0,restrict:()=>!1},_Ce={getShareData(r){var o,u,l,c;const{id:e,search:t,pagePositionIndex:n,shareId:i,shareType:a}=r,s={id:e,search:t,pagePositionIndex:n,shareId:i,shareType:a};return(o=r.video)!=null&&o.id&&(s.video={id:r.video.id}),(u=r.clip)!=null&&u.id&&(s.clip={id:r.clip.id},(l=r.clip.video)!=null&&l.id&&(s.video={id:(c=r.clip.video)==null?void 0:c.id})),r.shareCount!==void 0&&(s.shareCount=r.shareCount),r.embedDetails&&(s.embedDetails=r.embedDetails),s}},Eg={getUploadData(r,e){const{entity:t}=e.actionContext;if(t===Si.Video)return Eg.formatVideoUpload(r,e);if(t===Si.Resource||t===Si.Subtitle)return Eg.formatResourceUpload(r);if(t===Si.Banner||t===Si.Thumbnail||t===Si.MixedMedia)return r;throw new Error("Upload data event not correctly formatted.")},formatVideoUpload(r,e){const{workflowPhase:t}=e.actionContext;if(t===nu.Start)return Eg.getStartVideoUploadData(r);if(t===nu.Discard)return Eg.getDiscardVideoUploadData(r);if(t===nu.Complete)return Eg.getCompleteUploadData(r)},getStartVideoUploadData(r){return!r||!r.length?[]:(r instanceof FileList&&(r=Array.from(r)),r.map(e=>({fileName:e.name,size:e.size,type:e.type,count:r.length})))},getDiscardVideoUploadData(r){const e=t=>{const{type:n,name:i,status:a,cvUpload:s}=t.file,o={fileName:i,count:Array.isArray(r)?r.length:1,type:n,status:a};return t.progress&&(o.progress=t.progress.toFixed(2)),s&&(o.uploadId=s.uploadId),o};return Array.isArray(r)?r.map(t=>e(t)):[e(r)]},getCompleteUploadData(r){return!r||!r.length?[]:r.map(e=>{const{fileName:t,libraryId:n,folderId:i,autoCaption:a}=e;return{fileName:t,libraryId:n,folderId:i,autoCaption:a,count:r.length}})},formatResourceUpload(r){const{id:e,name:t}=r,n={id:e,name:t};return kf.isObject(r.metadata)&&(n.type=r.metadata.type),n}},bCe={[cr.Navigate]:yn.restrict,[cr.Click]:yn.allow,[cr.Search]:yn.allow,[cr.InstantSearch]:yn.allow,[cr.Play]:yn.allow,[cr.Stream]:yn.allow,[cr.WebPlayerStream]:yn.allow,[cr.StreamProgress]:yn.allow,[cr.PreviewStreamProgress]:yn.allow,[cr.StreamBuffering]:yn.allow,[cr.Rename]:yn.allow,[cr.Move]:yn.allow,[cr.Create]:yn.allow,[cr.Delete]:yn.allow,[cr.Associate]:yn.allow,[cr.Dissociate]:yn.allow,[cr.Filter]:yn.allow,[cr.Sort]:yn.allow,[cr.Approve]:yn.allow,[cr.Reject]:yn.allow,[cr.Disable]:yn.allow,[cr.Upload]:yn.allow,[cr.Download]:yn.allow,[cr.SetAccess]:yn.allow,[cr.AddToLocalCache]:yn.restrict,[cr.Share]:yn.allow,[cr.Unshare]:yn.allow,[cr.Edit]:yn.allow,[cr.Suggest]:yn.allow,[cr.Favourite]:yn.allow,[cr.WorkspaceAdd]:yn.allow,[cr.ResolveWarning]:yn.allow,[cr.DismissWarning]:yn.allow,[cr.EditAssoc]:yn.allow,[cr.Follow]:yn.allow,[cr.Print]:yn.allow,[cr.Copy]:yn.allow,[cr.Activate]:yn.allow,[cr.VerifyEmail]:yn.allow,[cr.ChangePassword]:yn.allow,[cr.Export]:yn.allow,[cr.SendEmail]:yn.allow,[cr.Publish]:yn.allow,[cr.Submit]:yn.allow,[cr.Complete]:yn.allow,[cr.Archive]:yn.allow,[cr.Promote]:yn.allow,[cr.Demote]:yn.allow,[cr.BulkAction]:yn.allow,[cr.Remove]:yn.allow,[cr.Dismiss]:yn.allow,[cr.Open]:yn.allow,[cr.Hide]:yn.allow,[cr.PageView]:yn.allow,[cr.Select]:yn.allow,[cr.SwitchCustomer]:yn.allow,[cr.Focus]:yn.allow,[cr.Blur]:yn.allow,[cr.Hover]:yn.allow,[cr.Unhover]:yn.allow},SCe={[cr.Search]:Za.passthrough,[cr.InstantSearch]:Za.passthrough,[cr.Play]:Za.passthrough,[cr.Stream]:Za.passthrough,[cr.StreamProgress]:Za.passthrough,[cr.PreviewStreamProgress]:Za.passthrough,[cr.StreamBuffering]:Za.passthrough,[cr.Click]:Za.passthrough,[cr.Filter]:Za.passthrough,[cr.Sort]:Za.passthrough,[cr.SetAccess]:Za.passthrough,[cr.Approve]:Za.passthrough,[cr.Reject]:Za.passthrough,[cr.Create]:Za.passthrough,[cr.Delete]:Za.passthrough,[cr.Rename]:Za.passthrough,[cr.Move]:Za.passthrough,[cr.Edit]:Za.passthrough,[cr.Share]:_Ce.getShareData,[cr.Disable]:Za.passthrough,[cr.Suggest]:Za.passthrough,[cr.Upload]:Eg.getUploadData,[cr.ResolveWarning]:Za.passthrough,[cr.DismissWarning]:Za.passthrough,[cr.Follow]:Za.passthrough,[cr.Print]:Za.passthrough,[cr.Copy]:Za.passthrough},$q={[cr.Search]:()=>"search",[cr.InstantSearch]:()=>"search",[cr.Filter]:()=>"filter",[cr.Stream]:()=>Si.Video},qq={user:"target_user",product:"target_product"},TCe={[cr.StreamProgress]:!0,[cr.WebPlayerStream]:!0,[cr.PreviewStreamProgress]:!0,[cr.StreamBuffering]:!0},Hq={shouldLog(r){return!!bCe[r.type](r)},formatData(r){const e=SCe[r.type],t=kf.isFunction(e)?e(r.data,r):r.data;if(TCe[r.type])return t;let n=r.actionContext.entity;return kf.isFunction($q[r.type])&&(n=$q[r.type](r)),qq[n]&&(n=qq[n]),{[n]:t}}},wCe=1e3*60*60*8;class CCe{constructor(e){this.options=e,this.initialize()}logStream(){const e=`v:${this.options.videoId}`,t=this.getPlayerMetrics();So.cacheExists(e)||(this.collectionApiClient.log({type:cr.WebPlayerStream,actionContext:this.getActionContext(),data:{...this.getAnalyticsData(),player:t},eventVersion:vd.V3}),So&&So.cacheSet(e,null,300))}logVideoProgress(e,t,n){const i=this.getAnalyticsData(),a=this.getPlayerMetrics(),s=n?cr.PreviewStreamProgress:cr.StreamProgress,o=e.map(u=>({type:s,actionContext:this.getActionContext(),data:{...i,player:a,progress:u},eventVersion:vd.V2}));for(const u of t)o.push({type:cr.StreamBuffering,actionContext:this.getActionContext(),data:{...i,player:a,buffering:u},eventVersion:vd.V2});this.collectionApiClient.log(o)}logUserAction(e,t){const n={...this.getAnalyticsData(),...e},i={...this.getActionContext(),...t};this.collectionApiClient.log({type:t.actionType,data:n,actionContext:i,eventVersion:t.eventVersion||vd.V2})}getAnalyticsData(){const e={video:{id:this.options.videoId},flags:{isUsingLocalCache:this.options.isUsingLocalCache,isQualityUserPreference:Fc.isQualityUserPreference()},...this.options.additionalAnalyticsData||{}};this.options.shareId&&(e.video.shareId=this.options.shareId);const t=this.getEntityType();return t===Si.Interactive?e.interactive={id:+this.options.mediaId}:t===Si.Clip&&(e.clip={id:+this.options.mediaId}),e}initialize(){this.setupCollectionApiClient(),xv.lockWindowSession(this.options.userId,wCe),this.options.player.one("dispose",()=>xv.unlockWindowSession(this.options.userId))}setupCollectionApiClient(){this.collectionApiClient=new yCe({productName:"player.web",productVersion:this.options.productVersion,regionName:this.options.regionName,collectionApiUrls:this.options.collectionApiUrls,collectionApiClientId:this.options.collectionApiClientId,getUser:()=>this.getCurrentUser(),shouldLog:Hq.shouldLog,formatData:Hq.formatData})}async getCurrentUser(){return{id:this.options.userId,customerId:this.options.customerId,sessionId:this.options.authSessionId}}getActionContext(){return{entity:this.getEntityType(),location:this.getLocationContext(),productArea:void 0,descriptor:this.options.isEmbedded?Fq.Embedded:void 0,workflowPhase:void 0}}getEntityType(){switch(this.options.mediaType){case"MasterVideo":return Si.Video;case"MasterInteractive":return Si.Interactive;case"MasterClip":return Si.Clip}}getLocationContext(){switch(this.options.playerType){case"player":return md.Player;case"interactive-player":return md.InteractivePlayer;case"create-clip-player":return md.CreateClipPlayer}}getPlayerMetrics(){var n,i;const e=this.options.player,t=(n=e.qualityLevels)==null?void 0:n.call(e);return{mode:Fc.getPlayerMode(e),width:e.currentWidth(),height:e.currentHeight(),quality:(i=t==null?void 0:t[t==null?void 0:t.selectedIndex])==null?void 0:i.id}}}var u1={exports:{}},Vq;function ECe(){return Vq||(Vq=1,(function(r,e){function t(u){if(u&&typeof u=="object"){var l=u.which||u.keyCode||u.charCode;l&&(u=l)}if(typeof u=="number")return s[u];var c=String(u),d=n[c.toLowerCase()];if(d)return d;var d=i[c.toLowerCase()];if(d)return d;if(c.length===1)return c.charCodeAt(0)}t.isEventKey=function(l,c){if(l&&typeof l=="object"){var d=l.which||l.keyCode||l.charCode;if(d==null)return!1;if(typeof c=="string"){var h=n[c.toLowerCase()];if(h)return h===d;var h=i[c.toLowerCase()];if(h)return h===d}else if(typeof c=="number")return c===d;return!1}},e=r.exports=t;var n=e.code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},i=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};/*!
290
290
  * Programatically add the following
291
- */for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var s=e.names=e.title={};for(a in n)s[n[a]]=a;for(var o in i)n[o]=i[o]})(u1,u1.exports)),u1.exports}var xCe=ECe();const ei=Jn(xCe);function kCe(r){document[r.fsApi_.fullscreenEnabled]&&(r.isFullscreen()?r.exitFullscreen():r.requestFullscreen())}function ACe(r){const e=r.theatreModePlugin().getTheatreMode();r.theatreModePlugin().toggleTheatreMode(!e,{shouldLog:!0})}function ICe(r){const e=r.volume(),t=r.lastVolume_();if(e===0){const n=t<.1?.1:t;r.volume(n),r.muted(!1)}else r.muted(!r.muted())}function Wq(r){r.paused()?r.play():r.pause()}function l1(r,e){r.currentTime(r.currentTime()+e)}function Kq(r,e){e>0&&r.muted()&&r.muted(!1),r.volume(r.volume()+e)}function DCe(r){const e=r.target,t=["video-js","vjs-tech"];return e.tagName.toLowerCase()==="video"||!!t.find(n=>e.classList.contains(n))}const Gq={f:kCe,m:ICe,k:Wq,space:Wq,t:ACe,left:r=>l1(r,-5),right:r=>l1(r,5),j:r=>l1(r,-10),l:r=>l1(r,10),up:r=>Kq(r,.05),down:r=>Kq(r,-.05)};function NCe(r,e,t){if(r.ctrlKey||r.metaKey||r.altKey)return;const n=ei(r),a=["up","down"].includes(n);if(a&&!r.shiftKey||!a&&r.shiftKey||n==="t"&&!t.allowTheatreMode||n==="f"&&!t.allowFullscreen||!Gq[n])return;Gq[n](e,r);const s=DCe(r),o=["space"].includes(n);(s||o)&&(r.preventDefault(),r.stopPropagation())}var Yq=(r=>(r.PhysicallyChapteredVideo="physically-chaptered-video",r))(Yq||{});const MCe={version:"1.48.0-rc.0"};function Yn(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xg(r,e){return xg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},xg(r,e)}function Fr(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,xg(r,e)}var R2,Xq;function OCe(){if(Xq)return R2;Xq=1,R2=r;function r(e,t){var n,i=null;try{n=JSON.parse(e,t)}catch(a){i=a}return[i,n]}return R2}var LCe=OCe();const PCe=Jn(LCe);var c1={exports:{}},j2,Qq;function RCe(){if(Qq)return j2;Qq=1;var r=qp(),e=function(i,a){return a===void 0&&(a=!1),function(s,o,u){if(s){i(s);return}if(o.statusCode>=400&&o.statusCode<=599){var l=u;if(a)if(r.TextDecoder){var c=t(o.headers&&o.headers["content-type"]);try{l=new TextDecoder(c).decode(u)}catch{}}else l=String.fromCharCode.apply(null,new Uint8Array(u));i({cause:l});return}i(null,u)}};function t(n){return n===void 0&&(n=""),n.toLowerCase().split(";").reduce(function(i,a){var s=a.split("="),o=s[0],u=s[1];return o.trim()==="charset"?u.trim():i},"utf-8")}return j2=e,j2}var Zq;function jCe(){if(Zq)return c1.exports;Zq=1;var r=qp(),e=L7(),t=R7();o.httpHandler=RCe();/**
291
+ */for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var s=e.names=e.title={};for(a in n)s[n[a]]=a;for(var o in i)n[o]=i[o]})(u1,u1.exports)),u1.exports}var xCe=ECe();const ei=Jn(xCe);function kCe(r){document[r.fsApi_.fullscreenEnabled]&&(r.isFullscreen()?r.exitFullscreen():r.requestFullscreen())}function ACe(r){const e=r.theatreModePlugin().getTheatreMode();r.theatreModePlugin().toggleTheatreMode(!e,{shouldLog:!0})}function ICe(r){const e=r.volume(),t=r.lastVolume_();if(e===0){const n=t<.1?.1:t;r.volume(n),r.muted(!1)}else r.muted(!r.muted())}function Wq(r){r.paused()?r.play():r.pause()}function l1(r,e){r.currentTime(r.currentTime()+e)}function Kq(r,e){e>0&&r.muted()&&r.muted(!1),r.volume(r.volume()+e)}function DCe(r){const e=r.target,t=["video-js","vjs-tech"];return e.tagName.toLowerCase()==="video"||!!t.find(n=>e.classList.contains(n))}const Gq={f:kCe,m:ICe,k:Wq,space:Wq,t:ACe,left:r=>l1(r,-5),right:r=>l1(r,5),j:r=>l1(r,-10),l:r=>l1(r,10),up:r=>Kq(r,.05),down:r=>Kq(r,-.05)};function NCe(r,e,t){if(r.ctrlKey||r.metaKey||r.altKey)return;const n=ei(r),a=["up","down"].includes(n);if(a&&!r.shiftKey||!a&&r.shiftKey||n==="t"&&!t.allowTheatreMode||n==="f"&&!t.allowFullscreen||!Gq[n])return;Gq[n](e,r);const s=DCe(r),o=["space"].includes(n);(s||o)&&(r.preventDefault(),r.stopPropagation())}var Yq=(r=>(r.PhysicallyChapteredVideo="physically-chaptered-video",r))(Yq||{});const MCe={version:"1.48.0-rc.2"};function Yn(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xg(r,e){return xg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},xg(r,e)}function Fr(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,xg(r,e)}var R2,Xq;function OCe(){if(Xq)return R2;Xq=1,R2=r;function r(e,t){var n,i=null;try{n=JSON.parse(e,t)}catch(a){i=a}return[i,n]}return R2}var LCe=OCe();const PCe=Jn(LCe);var c1={exports:{}},j2,Qq;function RCe(){if(Qq)return j2;Qq=1;var r=qp(),e=function(i,a){return a===void 0&&(a=!1),function(s,o,u){if(s){i(s);return}if(o.statusCode>=400&&o.statusCode<=599){var l=u;if(a)if(r.TextDecoder){var c=t(o.headers&&o.headers["content-type"]);try{l=new TextDecoder(c).decode(u)}catch{}}else l=String.fromCharCode.apply(null,new Uint8Array(u));i({cause:l});return}i(null,u)}};function t(n){return n===void 0&&(n=""),n.toLowerCase().split(";").reduce(function(i,a){var s=a.split("="),o=s[0],u=s[1];return o.trim()==="charset"?u.trim():i},"utf-8")}return j2=e,j2}var Zq;function jCe(){if(Zq)return c1.exports;Zq=1;var r=qp(),e=L7(),t=R7();o.httpHandler=RCe();/**
292
292
  * @license
293
293
  * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
294
294
  * Copyright (c) 2014 David Björklund