@vouchfor/embeds 2.0.4 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -145,7 +145,7 @@ ${e}`,bg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),wg=Objec
145
145
  "src": {{ it._derived?.src }},
146
146
  "playlist": {{ it._derived?.playlist }},
147
147
  "captions": {{ it._derived?.captions }}
148
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},system:!0,default:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};async function Kg(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Fu);return new s.Image}return new Image}const Il=ui(async function(e){return e?new Promise((t,i)=>{Kg().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Eo({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await Il(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await Il(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Eo({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Eo({element:l,meta:e},t,i)))),a}async function Vr(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Fu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function zs(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=zs(t==null?void 0:t.elements);if(i)return i}}function Vg(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function Jg(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Wg(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Jr(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}const qg=ui(()=>tl.loadYoga());Ao.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Wg(s)}"`:Jg(s)||Array.isArray(s)?JSON.stringify(s):s);const os=(s,e,t)=>Ao.render(s,e,Ao.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function as({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const h=await qg(),u=e??Yg;if(!((a=u.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${u.id}`);let d=u.templates.find(({version:D})=>D===Io);if(!d){const D=u.templates.map(({version:G})=>`"${G}"`).join(", ");console.warn(`Template renderer expects template version "${Io}" but got ${D}`),d=u.templates[u.templates.length-1]}const g=await Promise.all(d.content.map(async({scenes:D,root:G})=>{const F={...u.options,...s,intro:u.intro,outro:u.outro};async function H(j,V){return Promise.all(D.map(async({layout:J,duration:b,data:R,derived:U,options:x})=>{var w,T,K;const M={...F,_index:V,_root:j,_derived:await r({data:s,rootData:j,index:V})},q=R?JSON.parse(await os(R,M)):{},ie=U?JSON.parse(await os(U,M)):{},ce=x?JSON.parse(await os(x,M)):{},Ae=b?parseFloat(await os(b,M)):NaN,me=(w=d.layouts.find(ye=>ye.name===J))==null?void 0:w.tree;if(!me)throw new Error(`Layout tree "${J}" not found in template "${d.id}" layouts.`);const Be=JSON.parse(await os(me,{...q,...ie,...ce})),xe=await Promise.all(Be.flatMap(ye=>Eo({element:ye,meta:u.meta},n,o))),re=zs(xe);return{duration:(isNaN(Ae)?null:Ae)??((T=re==null?void 0:re.meta)==null?void 0:T.duration)??0,captions:(K=re==null?void 0:re.meta)==null?void 0:K.captions,elements:xe}}))}if(G){const j=JSON.parse(await os(G,F));return Array.isArray(j)?(await Promise.all(j.map(async(V,J)=>H(V,J)))).flatMap(V=>V):H(j,null)}return H(s,null)}));if(g.every(D=>D.every(G=>{const F=zs(G.elements);return!(F!=null&&F.value.src)&&!(F!=null&&F.value.playlist)}))){const D=g.flatMap(G=>G.map(F=>{const H=zs(F.elements);return!(H!=null&&H.value.src)&&!(H!=null&&H.value.playlist)&&(H==null?void 0:H.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${D} failed to load, video can not be processed`)}if(g.every(D=>D.every(G=>G.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const y=g.reduce((D,G)=>{const F=G.filter(H=>H.duration>0);return F.length>0&&(D=[...D,F]),D},[]),v=((A=u.meta)==null?void 0:A.frameRate)??30,S=((l=u.meta)==null?void 0:l.resolution)??720,C=((c=u.meta)==null?void 0:c.transitionDuration)??1/3,Q=Vg(y,C),B=Jr(Q);return{scenes:(await Promise.all(y.map((D,G)=>{const F=Jr(Q[G]),H=Jr(Q.slice(0,G));return Promise.all(D.map(async({duration:j,captions:V,elements:J},b)=>{var R,U;const x=await Vr(),w=await Vr(),T=await Vr(),K=await Vr(),M=zs(J),q=Jr([...Q.slice(0,G),...Q[G].slice(0,b)]);return{draw:({canvas:ce,currentTime:Ae})=>{const me=Math.max(0,Ae-H),Be=Math.max(0,Ae-q);po({yoga:h,debug:i,canvas:ce,cropCanvas:x,posterCanvas:K,letterboxCanvas:w,elements:J,currentTime:Ae,contentTime:me,sceneTime:Be,totalDuration:B,contentDuration:F,sceneDuration:j}),V&&t&&$g({canvas:ce,dx:0,dy:0,dw:ce.width,dh:ce.height,vttCaptions:V,sceneTime:Be+((M==null?void 0:M.meta.start)??0)})},duration:j,transitionCanvas:T,start:q,video:M==null?void 0:M.video,videoMeta:M==null?void 0:M.meta,audio:{duration:j,src:(R=M==null?void 0:M.value)==null?void 0:R.src,start:(U=M==null?void 0:M.meta)==null?void 0:U.start}}}))}))).flatMap(D=>D),frameRate:v,resolution:S,transitionDuration:C,fonts:d.fonts??[],duration:B}}const Io="3",jg={name:"@vouchfor/embeds",version:"2.0.4",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"^8.0.0","@vouchfor/media-player":"^3.0.4",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^1.0.4","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function Xg(s){const{publicApiUrl:e}=br(s),t=Ui();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function zg(s){var n,o,a,A,l,c,h,u,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:Ui()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=Ui();return e||(e=Xg(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Ui(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=Ui(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function Zg(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function ef(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:jg.version,templateVersion:Io,...i}}const ml=1;class tf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=Zg(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=br(this.host.env),{client:i,tab:r,request:n,visitor:o}=zg(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":ef(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var mo={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Lr<"u"&&Lr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(b){return b&&DataView.prototype.isPrototypeOf(b)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(b){return b&&c.indexOf(Object.prototype.toString.call(b))>-1};function u(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(b)||b==="")throw new TypeError('Invalid character in header field name: "'+b+'"');return b.toLowerCase()}function d(b){return typeof b!="string"&&(b=String(b)),b}function g(b){var R={next:function(){var U=b.shift();return{done:U===void 0,value:U}}};return A.iterable&&(R[Symbol.iterator]=function(){return R}),R}function f(b){this.map={},b instanceof f?b.forEach(function(R,U){this.append(U,R)},this):Array.isArray(b)?b.forEach(function(R){this.append(R[0],R[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(R){this.append(R,b[R])},this)}f.prototype.append=function(b,R){b=u(b),R=d(R);var U=this.map[b];this.map[b]=U?U+", "+R:R},f.prototype.delete=function(b){delete this.map[u(b)]},f.prototype.get=function(b){return b=u(b),this.has(b)?this.map[b]:null},f.prototype.has=function(b){return this.map.hasOwnProperty(u(b))},f.prototype.set=function(b,R){this.map[u(b)]=d(R)},f.prototype.forEach=function(b,R){for(var U in this.map)this.map.hasOwnProperty(U)&&b.call(R,this.map[U],U,this)},f.prototype.keys=function(){var b=[];return this.forEach(function(R,U){b.push(U)}),g(b)},f.prototype.values=function(){var b=[];return this.forEach(function(R){b.push(R)}),g(b)},f.prototype.entries=function(){var b=[];return this.forEach(function(R,U){b.push([U,R])}),g(b)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}function y(b){return new Promise(function(R,U){b.onload=function(){R(b.result)},b.onerror=function(){U(b.error)}})}function v(b){var R=new FileReader,U=y(R);return R.readAsArrayBuffer(b),U}function S(b){var R=new FileReader,U=y(R);return R.readAsText(b),U}function C(b){for(var R=new Uint8Array(b),U=new Array(R.length),x=0;x<R.length;x++)U[x]=String.fromCharCode(R[x]);return U.join("")}function Q(b){if(b.slice)return b.slice(0);var R=new Uint8Array(b.byteLength);return R.set(new Uint8Array(b)),R.buffer}function B(){return this.bodyUsed=!1,this._initBody=function(b){this.bodyUsed=this.bodyUsed,this._bodyInit=b,b?typeof b=="string"?this._bodyText=b:A.blob&&Blob.prototype.isPrototypeOf(b)?this._bodyBlob=b:A.formData&&FormData.prototype.isPrototypeOf(b)?this._bodyFormData=b:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)?this._bodyText=b.toString():A.arrayBuffer&&A.blob&&l(b)?(this._bodyArrayBuffer=Q(b.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(b)||h(b))?this._bodyArrayBuffer=Q(b):this._bodyText=b=Object.prototype.toString.call(b):this._bodyText="",this.headers.get("content-type")||(typeof b=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var b=p(this);if(b)return b;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var b=p(this);return b||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var b=p(this);if(b)return b;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(b){var R=b.toUpperCase();return _.indexOf(R)>-1?R:b}function G(b,R){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var U=R.body;if(b instanceof G){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,R.headers||(this.headers=new f(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!U&&b._bodyInit!=null&&(U=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new f(R.headers)),this.method=D(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&U)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(U),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var x=/([?&])_=[^&]*/;if(x.test(this.url))this.url=this.url.replace(x,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}G.prototype.clone=function(){return new G(this,{body:this._bodyInit})};function F(b){var R=new FormData;return b.trim().split("&").forEach(function(U){if(U){var x=U.split("="),w=x.shift().replace(/\+/g," "),T=x.join("=").replace(/\+/g," ");R.append(decodeURIComponent(w),decodeURIComponent(T))}}),R}function H(b){var R=new f,U=b.replace(/\r?\n[\t ]+/g," ");return U.split("\r").map(function(x){return x.indexOf(`
148
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},system:!0,default:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};async function Kg(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Fu);return new s.Image}return new Image}const Il=ui(async function(e){return e?new Promise((t,i)=>{Kg().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Eo({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await Il(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await Il(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Eo({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Eo({element:l,meta:e},t,i)))),a}async function Vr(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Fu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function zs(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=zs(t==null?void 0:t.elements);if(i)return i}}function Vg(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function Jg(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Wg(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Jr(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}const qg=ui(()=>tl.loadYoga());Ao.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Wg(s)}"`:Jg(s)||Array.isArray(s)?JSON.stringify(s):s);const os=(s,e,t)=>Ao.render(s,e,Ao.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function as({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const h=await qg(),u=e??Yg;if(!((a=u.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${u.id}`);let d=u.templates.find(({version:D})=>D===Io);if(!d){const D=u.templates.map(({version:G})=>`"${G}"`).join(", ");console.warn(`Template renderer expects template version "${Io}" but got ${D}`),d=u.templates[u.templates.length-1]}const g=await Promise.all(d.content.map(async({scenes:D,root:G})=>{const F={...u.options,...s,intro:u.intro,outro:u.outro};async function H(j,V){return Promise.all(D.map(async({layout:J,duration:b,data:R,derived:U,options:x})=>{var w,T,K;const M={...F,_index:V,_root:j,_derived:await r({data:s,rootData:j,index:V})},q=R?JSON.parse(await os(R,M)):{},ie=U?JSON.parse(await os(U,M)):{},ce=x?JSON.parse(await os(x,M)):{},Ae=b?parseFloat(await os(b,M)):NaN,me=(w=d.layouts.find(ye=>ye.name===J))==null?void 0:w.tree;if(!me)throw new Error(`Layout tree "${J}" not found in template "${d.id}" layouts.`);const Be=JSON.parse(await os(me,{...q,...ie,...ce})),xe=await Promise.all(Be.flatMap(ye=>Eo({element:ye,meta:u.meta},n,o))),re=zs(xe);return{duration:(isNaN(Ae)?null:Ae)??((T=re==null?void 0:re.meta)==null?void 0:T.duration)??0,captions:(K=re==null?void 0:re.meta)==null?void 0:K.captions,elements:xe}}))}if(G){const j=JSON.parse(await os(G,F));return Array.isArray(j)?(await Promise.all(j.map(async(V,J)=>H(V,J)))).flatMap(V=>V):H(j,null)}return H(s,null)}));if(g.every(D=>D.every(G=>{const F=zs(G.elements);return!(F!=null&&F.value.src)&&!(F!=null&&F.value.playlist)}))){const D=g.flatMap(G=>G.map(F=>{const H=zs(F.elements);return!(H!=null&&H.value.src)&&!(H!=null&&H.value.playlist)&&(H==null?void 0:H.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${D} failed to load, video can not be processed`)}if(g.every(D=>D.every(G=>G.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const y=g.reduce((D,G)=>{const F=G.filter(H=>H.duration>0);return F.length>0&&(D=[...D,F]),D},[]),v=((A=u.meta)==null?void 0:A.frameRate)??30,S=((l=u.meta)==null?void 0:l.resolution)??720,C=((c=u.meta)==null?void 0:c.transitionDuration)??1/3,Q=Vg(y,C),B=Jr(Q);return{scenes:(await Promise.all(y.map((D,G)=>{const F=Jr(Q[G]),H=Jr(Q.slice(0,G));return Promise.all(D.map(async({duration:j,captions:V,elements:J},b)=>{var R,U;const x=await Vr(),w=await Vr(),T=await Vr(),K=await Vr(),M=zs(J),q=Jr([...Q.slice(0,G),...Q[G].slice(0,b)]);return{draw:({canvas:ce,currentTime:Ae})=>{const me=Math.max(0,Ae-H),Be=Math.max(0,Ae-q);po({yoga:h,debug:i,canvas:ce,cropCanvas:x,posterCanvas:K,letterboxCanvas:w,elements:J,currentTime:Ae,contentTime:me,sceneTime:Be,totalDuration:B,contentDuration:F,sceneDuration:j}),V&&t&&$g({canvas:ce,dx:0,dy:0,dw:ce.width,dh:ce.height,vttCaptions:V,sceneTime:Be+((M==null?void 0:M.meta.start)??0)})},duration:j,transitionCanvas:T,start:q,video:M==null?void 0:M.video,videoMeta:M==null?void 0:M.meta,audio:{duration:j,src:(R=M==null?void 0:M.value)==null?void 0:R.src,start:(U=M==null?void 0:M.meta)==null?void 0:U.start}}}))}))).flatMap(D=>D),frameRate:v,resolution:S,transitionDuration:C,fonts:d.fonts??[],duration:B}}const Io="3",jg={name:"@vouchfor/embeds",version:"2.0.6",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"^8.0.0","@vouchfor/media-player":"^3.0.6",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^1.0.4","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function Xg(s){const{publicApiUrl:e}=br(s),t=Ui();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function zg(s){var n,o,a,A,l,c,h,u,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:Ui()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=Ui();return e||(e=Xg(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Ui(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=Ui(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function Zg(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function ef(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:jg.version,templateVersion:Io,...i}}const ml=1;class tf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=Zg(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=br(this.host.env),{client:i,tab:r,request:n,visitor:o}=zg(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":ef(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var mo={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Lr<"u"&&Lr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(b){return b&&DataView.prototype.isPrototypeOf(b)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(b){return b&&c.indexOf(Object.prototype.toString.call(b))>-1};function u(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(b)||b==="")throw new TypeError('Invalid character in header field name: "'+b+'"');return b.toLowerCase()}function d(b){return typeof b!="string"&&(b=String(b)),b}function g(b){var R={next:function(){var U=b.shift();return{done:U===void 0,value:U}}};return A.iterable&&(R[Symbol.iterator]=function(){return R}),R}function f(b){this.map={},b instanceof f?b.forEach(function(R,U){this.append(U,R)},this):Array.isArray(b)?b.forEach(function(R){this.append(R[0],R[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(R){this.append(R,b[R])},this)}f.prototype.append=function(b,R){b=u(b),R=d(R);var U=this.map[b];this.map[b]=U?U+", "+R:R},f.prototype.delete=function(b){delete this.map[u(b)]},f.prototype.get=function(b){return b=u(b),this.has(b)?this.map[b]:null},f.prototype.has=function(b){return this.map.hasOwnProperty(u(b))},f.prototype.set=function(b,R){this.map[u(b)]=d(R)},f.prototype.forEach=function(b,R){for(var U in this.map)this.map.hasOwnProperty(U)&&b.call(R,this.map[U],U,this)},f.prototype.keys=function(){var b=[];return this.forEach(function(R,U){b.push(U)}),g(b)},f.prototype.values=function(){var b=[];return this.forEach(function(R){b.push(R)}),g(b)},f.prototype.entries=function(){var b=[];return this.forEach(function(R,U){b.push([U,R])}),g(b)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}function y(b){return new Promise(function(R,U){b.onload=function(){R(b.result)},b.onerror=function(){U(b.error)}})}function v(b){var R=new FileReader,U=y(R);return R.readAsArrayBuffer(b),U}function S(b){var R=new FileReader,U=y(R);return R.readAsText(b),U}function C(b){for(var R=new Uint8Array(b),U=new Array(R.length),x=0;x<R.length;x++)U[x]=String.fromCharCode(R[x]);return U.join("")}function Q(b){if(b.slice)return b.slice(0);var R=new Uint8Array(b.byteLength);return R.set(new Uint8Array(b)),R.buffer}function B(){return this.bodyUsed=!1,this._initBody=function(b){this.bodyUsed=this.bodyUsed,this._bodyInit=b,b?typeof b=="string"?this._bodyText=b:A.blob&&Blob.prototype.isPrototypeOf(b)?this._bodyBlob=b:A.formData&&FormData.prototype.isPrototypeOf(b)?this._bodyFormData=b:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)?this._bodyText=b.toString():A.arrayBuffer&&A.blob&&l(b)?(this._bodyArrayBuffer=Q(b.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(b)||h(b))?this._bodyArrayBuffer=Q(b):this._bodyText=b=Object.prototype.toString.call(b):this._bodyText="",this.headers.get("content-type")||(typeof b=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var b=p(this);if(b)return b;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var b=p(this);return b||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var b=p(this);if(b)return b;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(b){var R=b.toUpperCase();return _.indexOf(R)>-1?R:b}function G(b,R){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var U=R.body;if(b instanceof G){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,R.headers||(this.headers=new f(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!U&&b._bodyInit!=null&&(U=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new f(R.headers)),this.method=D(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&U)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(U),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var x=/([?&])_=[^&]*/;if(x.test(this.url))this.url=this.url.replace(x,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}G.prototype.clone=function(){return new G(this,{body:this._bodyInit})};function F(b){var R=new FormData;return b.trim().split("&").forEach(function(U){if(U){var x=U.split("="),w=x.shift().replace(/\+/g," "),T=x.join("=").replace(/\+/g," ");R.append(decodeURIComponent(w),decodeURIComponent(T))}}),R}function H(b){var R=new f,U=b.replace(/\r?\n[\t ]+/g," ");return U.split("\r").map(function(x){return x.indexOf(`
149
149
  `)===0?x.substr(1,x.length):x}).forEach(function(x){var w=x.split(":"),T=w.shift().trim();if(T){var K=w.join(":").trim();R.append(T,K)}}),R}B.call(G.prototype);function j(b,R){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new f(R.headers),this.url=R.url||"",this._initBody(b)}B.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},j.error=function(){var b=new j(null,{status:0,statusText:""});return b.type="error",b};var V=[301,302,303,307,308];j.redirect=function(b,R){if(V.indexOf(R)===-1)throw new RangeError("Invalid status code");return new j(null,{status:R,headers:{location:b}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(R,U){this.message=R,this.name=U;var x=Error(R);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function J(b,R){return new Promise(function(U,x){var w=new G(b,R);if(w.signal&&w.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function K(){T.abort()}T.onload=function(){var q={status:T.status,statusText:T.statusText,headers:H(T.getAllResponseHeaders()||"")};q.url="responseURL"in T?T.responseURL:q.headers.get("X-Request-URL");var ie="response"in T?T.response:T.responseText;setTimeout(function(){U(new j(ie,q))},0)},T.onerror=function(){setTimeout(function(){x(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){x(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){x(new o.DOMException("Aborted","AbortError"))},0)};function M(q){try{return q===""&&a.location.href?a.location.href:q}catch{return q}}T.open(w.method,M(w.url),!0),w.credentials==="include"?T.withCredentials=!0:w.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof f)?Object.getOwnPropertyNames(R.headers).forEach(function(q){T.setRequestHeader(q,d(R.headers[q]))}):w.headers.forEach(function(q,ie){T.setRequestHeader(ie,q)}),w.signal&&(w.signal.addEventListener("abort",K),T.onreadystatechange=function(){T.readyState===4&&w.signal.removeEventListener("abort",K)}),T.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return J.polyfill=!0,a.fetch||(a.fetch=J,a.Headers=f,a.Request=G,a.Response=j),o.Headers=f,o.Request=G,o.Response=j,o.fetch=J,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(mo,mo.exports);var sf=mo.exports;const Cl=el(sf);async function rf(s){var e;try{if((e=await Cl(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function yl({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>rf(o));e=(await Promise.all(n)).find(Boolean)}return e}async function nf(s){try{return(await Cl(s)).text()}catch{return null}}async function of(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?nf(s):s}const af=ui(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=t==null?void 0:t.split("-"))==null?void 0:n[0]]:s,[(o=i==null?void 0:i.split("-"))==null?void 0:o[0]]:e},A=(r&&a[r])??s;return A?of(A):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})});async function Af(s){var e,t,i,r,n,o;const a=(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,A=(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,l=(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist;return{src:await yl({sources:[a,A]}),playlist:await yl({sources:[l]})}}function lf(s){var e,t,i,r,n,o,a,A,l,c;const h=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)??"",u=((a=(o=(n=s==null?void 0:s.answer)==null?void 0:n.contact)==null?void 0:o.client)==null?void 0:a.name)==="Not Supplied"?"":((c=(l=(A=s==null?void 0:s.answer)==null?void 0:A.contact)==null?void 0:l.client)==null?void 0:c.name)??"",[d,g]=h.split(" ");return{name:h,firstName:d,lastName:g,companyName:u}}async function Co({rootData:s,index:e},t){var i,r,n,o,a,A,l,c,h,u,d,g,f,p;return{...lf(s),...await Af(s),key:`${s==null?void 0:s.id}-${e}`,captions:await af({original:((r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.captions)??((o=(n=s==null?void 0:s.answer)==null?void 0:n.captions)==null?void 0:o.current),translation:((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.translation)??((c=(l=s==null?void 0:s.answer)==null?void 0:l.captions)==null?void 0:c.translation),originalLanguage:(u=(h=s==null?void 0:s.answer)==null?void 0:h.transcription)==null?void 0:u.language,translationLanguage:(f=(g=(d=s==null?void 0:s.answer)==null?void 0:d.transcription)==null?void 0:g.translation)==null?void 0:f.language},t),answerLabel:((p=s==null?void 0:s.answer)==null?void 0:p.label)??(s==null?void 0:s.title)}}const Wr={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese (Simplified)",zh_TW:"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",fa:"Farsi",tl:"Filipino",ka:"Georgian",de:"German",el:"Greek",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",kk:"Kazakh",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",ml:"Malayalam",mt:"Maltese",mr:"Marathi",mn:"Mongolian",no:"Norwegian",ps:"Pashto",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",sr:"Serbian",si:"Sinhala",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",cy:"Welsh"};function cf({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,A,l,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(l=(A=r==null?void 0:r.answer)==null?void 0:A.transcription)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&Wr[u]&&!i.find(g=>g.value===u)&&i.push({value:u,label:Wr[u]}),d&&Wr[d]&&!i.find(g=>g.value===d)&&i.push({value:d,label:Wr[d]}),i},[]))??[]}/**
150
150
  * @license
151
151
  * Copyright 2018 Google LLC
@@ -183,7 +183,7 @@ ${e}`,bg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),wg=Objec
183
183
  * @license
184
184
  * Copyright 2017 Google LLC
185
185
  * SPDX-License-Identifier: BSD-3-Clause
186
- */const Mh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},Oh=ns(class extends $s{constructor(s){if(super(s),s.type!==rs.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=hd(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??(this.ut=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=Pi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=Pi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=Pi(r[h],n[g]),Hs(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=Pi(r[u],n[d]),Hs(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Mh(o,d,g),c=Mh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const y=Hs(s,r[h]);Pi(y,n[d]),A[d]=y}else A[d]=Pi(p,n[d]),Hs(s,r[h],p),r[f]=null;d++}else qn(r[u]),u--;else qn(r[h]),h++;for(;d<=g;){const f=Hs(s,A[g+1]);Pi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&qn(f)}return this.ut=o,cd(s,A),Ot}});var wt="top",kt="bottom",Ft="right",Rt="left",va="auto",nr=[wt,kt,Ft,Rt],vs="start",or="end",FI="clippingParents",Ph="viewport",ar="popper",NI="reference",Uh=nr.reduce(function(s,e){return s.concat([e+"-"+vs,e+"-"+or])},[]),Gh=[].concat(nr,[va]).reduce(function(s,e){return s.concat([e,e+"-"+vs,e+"-"+or])},[]),MI="beforeRead",OI="read",PI="afterRead",UI="beforeMain",GI="main",HI="afterMain",$I="beforeWrite",YI="write",KI="afterWrite",VI=[MI,OI,PI,UI,GI,HI,$I,YI,KI];function ti(s){return s?(s.nodeName||"").toLowerCase():null}function xt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function Wi(s){var e=xt(s).Element;return s instanceof e||s instanceof Element}function Nt(s){var e=xt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ba(s){if(typeof ShadowRoot>"u")return!1;var e=xt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function JI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Nt(n)||!ti(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function WI(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Nt(r)||!ti(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const Hh={name:"applyStyles",enabled:!0,phase:"write",fn:JI,effect:WI,requires:["computeStyles"]};function ii(s){return s.split("-")[0]}var qi=Math.max,Sn=Math.min,Bs=Math.round;function Qa(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function $h(){return!/^((?!chrome|android).)*safari/i.test(Qa())}function Qs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Nt(s)&&(r=s.offsetWidth>0&&Bs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&Bs(i.height)/s.offsetHeight||1);var o=Wi(s)?xt(s):window,a=o.visualViewport,A=!$h()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Sa(s){var e=Qs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function Yh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ba(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Ci(s){return xt(s).getComputedStyle(s)}function qI(s){return["table","td","th"].indexOf(ti(s))>=0}function Ti(s){return((Wi(s)?s.ownerDocument:s.document)||window.document).documentElement}function bn(s){return ti(s)==="html"?s:s.assignedSlot||s.parentNode||(Ba(s)?s.host:null)||Ti(s)}function Kh(s){return!Nt(s)||Ci(s).position==="fixed"?null:s.offsetParent}function jI(s){var e=/firefox/i.test(Qa()),t=/Trident/i.test(Qa());if(t&&Nt(s)){var i=Ci(s);if(i.position==="fixed")return null}var r=bn(s);for(Ba(r)&&(r=r.host);Nt(r)&&["html","body"].indexOf(ti(r))<0;){var n=Ci(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function Ar(s){for(var e=xt(s),t=Kh(s);t&&qI(t)&&Ci(t).position==="static";)t=Kh(t);return t&&(ti(t)==="html"||ti(t)==="body"&&Ci(t).position==="static")?e:t||jI(s)||e}function ba(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function lr(s,e,t){return qi(s,Sn(e,t))}function XI(s,e,t){var i=lr(s,e,t);return i>t?t:i}function Vh(){return{top:0,right:0,bottom:0,left:0}}function Jh(s){return Object.assign({},Vh(),s)}function Wh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var zI=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Jh(typeof e!="number"?e:Wh(e,nr))};function ZI(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ii(t.placement),A=ba(a),l=[Rt,Ft].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=zI(r.padding,t),u=Sa(n),d=A==="y"?wt:Rt,g=A==="y"?kt:Ft,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],y=Ar(n),v=y?A==="y"?y.clientHeight||0:y.clientWidth||0:0,S=f/2-p/2,C=h[d],Q=v-u[c]-h[g],B=v/2-u[c]/2+S,_=lr(C,B,Q),D=A;t.modifiersData[i]=(e={},e[D]=_,e.centerOffset=_-B,e)}}function em(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Yh(e.elements.popper,r)&&(e.elements.arrow=r))}const tm={name:"arrow",enabled:!0,phase:"main",fn:ZI,effect:em,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ss(s){return s.split("-")[1]}var im={top:"auto",right:"auto",bottom:"auto",left:"auto"};function sm(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:Bs(t*r)/r||0,y:Bs(i*r)/r||0}}function qh(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),S=Rt,C=wt,Q=window;if(l){var B=Ar(t),_="clientHeight",D="clientWidth";if(B===xt(t)&&(B=Ti(t),Ci(B).position!=="static"&&a==="absolute"&&(_="scrollHeight",D="scrollWidth")),B=B,r===wt||(r===Rt||r===Ft)&&n===or){C=kt;var G=h&&B===Q&&Q.visualViewport?Q.visualViewport.height:B[_];f-=G-i.height,f*=A?1:-1}if(r===Rt||(r===wt||r===kt)&&n===or){S=Ft;var F=h&&B===Q&&Q.visualViewport?Q.visualViewport.width:B[D];d-=F-i.width,d*=A?1:-1}}var H=Object.assign({position:a},l&&im),j=c===!0?sm({x:d,y:f},xt(t)):{x:d,y:f};if(d=j.x,f=j.y,A){var V;return Object.assign({},H,(V={},V[C]=v?"0":"",V[S]=y?"0":"",V.transform=(Q.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},H,(e={},e[C]=v?f+"px":"",e[S]=y?d+"px":"",e.transform="",e))}function rm(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:ii(e.placement),variation:Ss(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,qh(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,qh(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const nm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:rm,data:{}};var wn={passive:!0};function om(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=xt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,wn)}),a&&A.addEventListener("resize",t.update,wn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,wn)}),a&&A.removeEventListener("resize",t.update,wn)}}const am={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:om,data:{}};var Am={left:"right",right:"left",bottom:"top",top:"bottom"};function Rn(s){return s.replace(/left|right|bottom|top/g,function(e){return Am[e]})}var lm={start:"end",end:"start"};function jh(s){return s.replace(/start|end/g,function(e){return lm[e]})}function wa(s){var e=xt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ra(s){return Qs(Ti(s)).left+wa(s).scrollLeft}function cm(s,e){var t=xt(s),i=Ti(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=$h();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ra(s),y:A}}function hm(s){var e,t=Ti(s),i=wa(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=qi(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=qi(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Ra(s),A=-i.scrollTop;return Ci(r||t).direction==="rtl"&&(a+=qi(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function xa(s){var e=Ci(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function Xh(s){return["html","body","#document"].indexOf(ti(s))>=0?s.ownerDocument.body:Nt(s)&&xa(s)?s:Xh(bn(s))}function cr(s,e){var t;e===void 0&&(e=[]);var i=Xh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=xt(i),o=r?[n].concat(n.visualViewport||[],xa(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(cr(bn(o)))}function Da(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function um(s,e){var t=Qs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function zh(s,e,t){return e===Ph?Da(cm(s,t)):Wi(e)?um(e,t):Da(hm(Ti(s)))}function dm(s){var e=cr(bn(s)),t=["absolute","fixed"].indexOf(Ci(s).position)>=0,i=t&&Nt(s)?Ar(s):s;return Wi(i)?e.filter(function(r){return Wi(r)&&Yh(r,i)&&ti(r)!=="body"}):[]}function gm(s,e,t,i){var r=e==="clippingParents"?dm(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=zh(s,l,i);return A.top=qi(c.top,A.top),A.right=Sn(c.right,A.right),A.bottom=Sn(c.bottom,A.bottom),A.left=qi(c.left,A.left),A},zh(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Zh(s){var e=s.reference,t=s.element,i=s.placement,r=i?ii(i):null,n=i?Ss(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case wt:A={x:o,y:e.y-t.height};break;case kt:A={x:o,y:e.y+e.height};break;case Ft:A={x:e.x+e.width,y:a};break;case Rt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?ba(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case vs:A[l]=A[l]-(e[c]/2-t[c]/2);break;case or:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function hr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?FI:a,l=t.rootBoundary,c=l===void 0?Ph:l,h=t.elementContext,u=h===void 0?ar:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,y=Jh(typeof p!="number"?p:Wh(p,nr)),v=u===ar?NI:ar,S=s.rects.popper,C=s.elements[g?v:u],Q=gm(Wi(C)?C:C.contextElement||Ti(s.elements.popper),A,c,o),B=Qs(s.elements.reference),_=Zh({reference:B,element:S,strategy:"absolute",placement:r}),D=Da(Object.assign({},S,_)),G=u===ar?D:B,F={top:Q.top-G.top+y.top,bottom:G.bottom-Q.bottom+y.bottom,left:Q.left-G.left+y.left,right:G.right-Q.right+y.right},H=s.modifiersData.offset;if(u===ar&&H){var j=H[r];Object.keys(F).forEach(function(V){var J=[Ft,kt].indexOf(V)>=0?1:-1,b=[wt,kt].indexOf(V)>=0?"y":"x";F[V]+=j[b]*J})}return F}function fm(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?Gh:A,c=Ss(i),h=c?a?Uh:Uh.filter(function(g){return Ss(g)===c}):nr,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=hr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[ii(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function pm(s){if(ii(s)===va)return[];var e=Rn(s);return[jh(s),e,jh(e)]}function Em(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,y=ii(p),v=y===p,S=A||(v||!g?[Rn(p)]:pm(p)),C=[p].concat(S).reduce(function(ie,ce){return ie.concat(ii(ce)===va?fm(e,{placement:ce,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ce)},[]),Q=e.rects.reference,B=e.rects.popper,_=new Map,D=!0,G=C[0],F=0;F<C.length;F++){var H=C[F],j=ii(H),V=Ss(H)===vs,J=[wt,kt].indexOf(j)>=0,b=J?"width":"height",R=hr(e,{placement:H,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),U=J?V?Ft:Rt:V?kt:wt;Q[b]>B[b]&&(U=Rn(U));var x=Rn(U),w=[];if(n&&w.push(R[j]<=0),a&&w.push(R[U]<=0,R[x]<=0),w.every(function(ie){return ie})){G=H,D=!1;break}_.set(H,w)}if(D)for(var T=g?3:1,K=function(ce){var Ae=C.find(function(me){var Be=_.get(me);if(Be)return Be.slice(0,ce).every(function(xe){return xe})});if(Ae)return G=Ae,"break"},M=T;M>0;M--){var q=K(M);if(q==="break")break}e.placement!==G&&(e.modifiersData[i]._skip=!0,e.placement=G,e.reset=!0)}}const Im={name:"flip",enabled:!0,phase:"main",fn:Em,requiresIfExists:["offset"],data:{_skip:!1}};function eu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function tu(s){return[wt,Ft,kt,Rt].some(function(e){return s[e]>=0})}function mm(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=hr(e,{elementContext:"reference"}),a=hr(e,{altBoundary:!0}),A=eu(o,i),l=eu(a,r,n),c=tu(A),h=tu(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const Cm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:mm};function ym(s,e,t){var i=ii(s),r=[Rt,wt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Rt,Ft].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function vm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=Gh.reduce(function(c,h){return c[h]=ym(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Bm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:vm};function Qm(s){var e=s.state,t=s.name;e.modifiersData[t]=Zh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Sm={name:"popperOffsets",enabled:!0,phase:"read",fn:Qm,data:{}};function bm(s){return s==="x"?"y":"x"}function wm(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,p=hr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),y=ii(e.placement),v=Ss(e.placement),S=!v,C=ba(y),Q=bm(C),B=e.modifiersData.popperOffsets,_=e.rects.reference,D=e.rects.popper,G=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,F=typeof G=="number"?{mainAxis:G,altAxis:G}:Object.assign({mainAxis:0,altAxis:0},G),H=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,j={x:0,y:0};if(B){if(n){var V,J=C==="y"?wt:Rt,b=C==="y"?kt:Ft,R=C==="y"?"height":"width",U=B[C],x=U+p[J],w=U-p[b],T=d?-D[R]/2:0,K=v===vs?_[R]:D[R],M=v===vs?-D[R]:-_[R],q=e.elements.arrow,ie=d&&q?Sa(q):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Vh(),Ae=ce[J],me=ce[b],Be=lr(0,_[R],ie[R]),xe=S?_[R]/2-T-Be-Ae-F.mainAxis:K-Be-Ae-F.mainAxis,re=S?-_[R]/2+T+Be+me+F.mainAxis:M+Be+me+F.mainAxis,Ce=e.elements.arrow&&Ar(e.elements.arrow),ye=Ce?C==="y"?Ce.clientTop||0:Ce.clientLeft||0:0,ue=(V=H==null?void 0:H[C])!=null?V:0,he=U+xe-ue-ye,ae=U+re-ue,we=lr(d?Sn(x,he):x,U,d?qi(w,ae):w);B[C]=we,j[C]=we-U}if(a){var Pe,Te=C==="x"?wt:Rt,ke=C==="x"?kt:Ft,Ue=B[Q],Le=Q==="y"?"height":"width",Se=Ue+p[Te],Ve=Ue-p[ke],je=[wt,Rt].indexOf(y)!==-1,ct=(Pe=H==null?void 0:H[Q])!=null?Pe:0,st=je?Se:Ue-_[Le]-D[Le]-ct+F.altAxis,mt=je?Ue+_[Le]+D[Le]-ct-F.altAxis:Ve,yi=d&&je?XI(st,Ue,mt):lr(d?st:Se,Ue,d?mt:Ve);B[Q]=yi,j[Q]=yi-Ue}e.modifiersData[i]=j}}const Rm={name:"preventOverflow",enabled:!0,phase:"main",fn:wm,requiresIfExists:["offset"]};function xm(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function Dm(s){return s===xt(s)||!Nt(s)?wa(s):xm(s)}function Tm(s){var e=s.getBoundingClientRect(),t=Bs(e.width)/s.offsetWidth||1,i=Bs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function Lm(s,e,t){t===void 0&&(t=!1);var i=Nt(e),r=Nt(e)&&Tm(e),n=Ti(e),o=Qs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ti(e)!=="body"||xa(n))&&(a=Dm(e)),Nt(e)?(A=Qs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ra(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function _m(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function km(s){var e=_m(s);return VI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Fm(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function Nm(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var iu={placement:"bottom",modifiers:[],strategy:"absolute"};function su(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Mm(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?iu:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},iu,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;f(),c.options=Object.assign({},n,c.options,v),c.scrollParents={reference:Wi(a)?cr(a):a.contextElement?cr(a.contextElement):[],popper:cr(A)};var S=km(Nm([].concat(i,c.options.modifiers)));return c.orderedModifiers=S.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var y=c.elements,v=y.reference,S=y.popper;if(su(v,S)){c.rects={reference:Lm(v,Ar(S),c.options.strategy==="fixed"),popper:Sa(S)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(F){return c.modifiersData[F.name]=Object.assign({},F.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var Q=c.orderedModifiers[C],B=Q.fn,_=Q.options,D=_===void 0?{}:_,G=Q.name;typeof B=="function"&&(c=B({state:c,options:D,name:G,instance:d})||c)}}}},update:Fm(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!su(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var y=p.name,v=p.options,S=v===void 0?{}:v,C=p.effect;if(typeof C=="function"){var Q=C({state:c,name:y,instance:d,options:S}),B=function(){};h.push(Q||B)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var Om=[am,Sm,nm,Hh,Bm,Im,Rm,tm,Cm],Pm=Mm({defaultModifiers:Om}),Um="tippy-box",ru="tippy-content",Gm="tippy-backdrop",nu="tippy-arrow",ou="tippy-svg-arrow",ji={passive:!0,capture:!0},au=function(){return document.body};function Ta(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function La(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Au(s,e){return typeof s=="function"?s.apply(void 0,e):s}function lu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function Hm(s){return s.split(/\s+/).filter(Boolean)}function bs(s){return[].concat(s)}function cu(s,e){s.indexOf(e)===-1&&s.push(e)}function $m(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function Ym(s){return s.split("-")[0]}function xn(s){return[].slice.call(s)}function hu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function ur(){return document.createElement("div")}function Dn(s){return["Element","Fragment"].some(function(e){return La(s,e)})}function Km(s){return La(s,"NodeList")}function Vm(s){return La(s,"MouseEvent")}function Jm(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function Wm(s){return Dn(s)?[s]:Km(s)?xn(s):Array.isArray(s)?s:xn(document.querySelectorAll(s))}function _a(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function uu(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function qm(s){var e,t=bs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function jm(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=Ym(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,p=i-n.bottom-u>A,y=n.left-t+d>A,v=t-n.right-g>A;return f||p||y||v})}function ka(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function du(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var si={isTouch:!1},gu=0;function Xm(){si.isTouch||(si.isTouch=!0,window.performance&&document.addEventListener("mousemove",fu))}function fu(){var s=performance.now();s-gu<20&&(si.isTouch=!1,document.removeEventListener("mousemove",fu)),gu=s}function zm(){var s=document.activeElement;if(Jm(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function Zm(){document.addEventListener("touchstart",Xm,ji),window.addEventListener("blur",zm)}var eC=typeof window<"u"&&typeof document<"u",tC=eC?!!window.msCrypto:!1,iC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},sC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ht=Object.assign({appendTo:au,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},iC,sC),rC=Object.keys(Ht),nC=function(e){var t=Object.keys(e);t.forEach(function(i){Ht[i]=e[i]})};function pu(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Ht[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function oC(s,e){var t=e?Object.keys(pu(Object.assign({},Ht,{plugins:e}))):rC,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function Eu(s,e){var t=Object.assign({},e,{content:Au(e.content,[s])},e.ignoreAttributes?{}:oC(s,e.plugins));return t.aria=Object.assign({},Ht.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var aC=function(){return"innerHTML"};function Fa(s,e){s[aC()]=e}function Iu(s){var e=ur();return s===!0?e.className=nu:(e.className=ou,Dn(s)?e.appendChild(s):Fa(e,s)),e}function mu(s,e){Dn(e.content)?(Fa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Fa(s,e.content):s.textContent=e.content)}function Na(s){var e=s.firstElementChild,t=xn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(ru)}),arrow:t.find(function(i){return i.classList.contains(nu)||i.classList.contains(ou)}),backdrop:t.find(function(i){return i.classList.contains(Gm)})}}function Cu(s){var e=ur(),t=ur();t.className=Um,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=ur();i.className=ru,i.setAttribute("data-state","hidden"),mu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=Na(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&mu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(Iu(o.arrow))):A.appendChild(Iu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}Cu.$$tippy=!0;var AC=1,Tn=[],Ma=[];function lC(s,e){var t=Eu(s,Object.assign({},Ht,pu(hu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=lu(he,t.interactiveDebounce),f,p=AC++,y=null,v=$m(t.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:ur(),popperInstance:y,props:t,state:S,plugins:v,clearDelayTimeouts:st,setProps:mt,setContent:yi,show:Ct,hide:ai,hideWithInteractivity:Ai,enable:je,disable:ct,unmount:li,destroy:gt};if(!t.render)return C;var Q=t.render(C),B=Q.popper,_=Q.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+C.id,C.popper=B,s._tippy=C,B._tippy=C;var D=v.map(function(Y){return Y.fn(C)}),G=s.hasAttribute("aria-expanded");return Ce(),T(),U(),x("onCreate",[C]),t.showOnCreate&&Se(),B.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&J().addEventListener("mousemove",g)}),C;function F(){var Y=C.props.touch;return Array.isArray(Y)?Y:[Y,0]}function H(){return F()[0]==="hold"}function j(){var Y;return!!((Y=C.props.render)!=null&&Y.$$tippy)}function V(){return f||s}function J(){var Y=V().parentNode;return Y?qm(Y):document}function b(){return Na(B)}function R(Y){return C.state.isMounted&&!C.state.isVisible||si.isTouch||c&&c.type==="focus"?0:Ta(C.props.delay,Y?0:1,Ht.delay)}function U(Y){Y===void 0&&(Y=!1),B.style.pointerEvents=C.props.interactive&&!Y?"":"none",B.style.zIndex=""+C.props.zIndex}function x(Y,le,ge){if(ge===void 0&&(ge=!0),D.forEach(function(be){be[Y]&&be[Y].apply(be,le)}),ge){var Re;(Re=C.props)[Y].apply(Re,le)}}function w(){var Y=C.props.aria;if(Y.content){var le="aria-"+Y.content,ge=B.id,Re=bs(C.props.triggerTarget||s);Re.forEach(function(be){var Je=be.getAttribute(le);if(C.state.isVisible)be.setAttribute(le,Je?Je+" "+ge:ge);else{var yt=Je&&Je.replace(ge,"").trim();yt?be.setAttribute(le,yt):be.removeAttribute(le)}})}}function T(){if(!(G||!C.props.aria.expanded)){var Y=bs(C.props.triggerTarget||s);Y.forEach(function(le){C.props.interactive?le.setAttribute("aria-expanded",C.state.isVisible&&le===V()?"true":"false"):le.removeAttribute("aria-expanded")})}}function K(){J().removeEventListener("mousemove",g),Tn=Tn.filter(function(Y){return Y!==g})}function M(Y){if(!(si.isTouch&&(A||Y.type==="mousedown"))){var le=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(C.props.interactive&&du(B,le))){if(bs(C.props.triggerTarget||s).some(function(ge){return du(ge,le)})){if(si.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else x("onClickOutside",[C,Y]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||Ae())}}}function q(){A=!0}function ie(){A=!1}function ce(){var Y=J();Y.addEventListener("mousedown",M,!0),Y.addEventListener("touchend",M,ji),Y.addEventListener("touchstart",ie,ji),Y.addEventListener("touchmove",q,ji)}function Ae(){var Y=J();Y.removeEventListener("mousedown",M,!0),Y.removeEventListener("touchend",M,ji),Y.removeEventListener("touchstart",ie,ji),Y.removeEventListener("touchmove",q,ji)}function me(Y,le){xe(Y,function(){!C.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&le()})}function Be(Y,le){xe(Y,le)}function xe(Y,le){var ge=b().box;function Re(be){be.target===ge&&(ka(ge,"remove",Re),le())}if(Y===0)return le();ka(ge,"remove",h),ka(ge,"add",Re),h=Re}function re(Y,le,ge){ge===void 0&&(ge=!1);var Re=bs(C.props.triggerTarget||s);Re.forEach(function(be){be.addEventListener(Y,le,ge),d.push({node:be,eventType:Y,handler:le,options:ge})})}function Ce(){H()&&(re("touchstart",ue,{passive:!0}),re("touchend",ae,{passive:!0})),Hm(C.props.trigger).forEach(function(Y){if(Y!=="manual")switch(re(Y,ue),Y){case"mouseenter":re("mouseleave",ae);break;case"focus":re(tC?"focusout":"blur",we);break;case"focusin":re("focusout",we);break}})}function ye(){d.forEach(function(Y){var le=Y.node,ge=Y.eventType,Re=Y.handler,be=Y.options;le.removeEventListener(ge,Re,be)}),d=[]}function ue(Y){var le,ge=!1;if(!(!C.state.isEnabled||Pe(Y)||a)){var Re=((le=c)==null?void 0:le.type)==="focus";c=Y,f=Y.currentTarget,T(),!C.state.isVisible&&Vm(Y)&&Tn.forEach(function(be){return be(Y)}),Y.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?ge=!0:Se(Y),Y.type==="click"&&(o=!ge),ge&&!Re&&Ve(Y)}}function he(Y){var le=Y.target,ge=V().contains(le)||B.contains(le);if(!(Y.type==="mousemove"&&ge)){var Re=Le().concat(B).map(function(be){var Je,yt=be._tippy,vt=(Je=yt.popperInstance)==null?void 0:Je.state;return vt?{popperRect:be.getBoundingClientRect(),popperState:vt,props:t}:null}).filter(Boolean);jm(Re,Y)&&(K(),Ve(Y))}}function ae(Y){var le=Pe(Y)||C.props.trigger.indexOf("click")>=0&&o;if(!le){if(C.props.interactive){C.hideWithInteractivity(Y);return}Ve(Y)}}function we(Y){C.props.trigger.indexOf("focusin")<0&&Y.target!==V()||C.props.interactive&&Y.relatedTarget&&B.contains(Y.relatedTarget)||Ve(Y)}function Pe(Y){return si.isTouch?H()!==Y.type.indexOf("touch")>=0:!1}function Te(){ke();var Y=C.props,le=Y.popperOptions,ge=Y.placement,Re=Y.offset,be=Y.getReferenceClientRect,Je=Y.moveTransition,yt=j()?Na(B).arrow:null,vt=be?{getBoundingClientRect:be,contextElement:be.contextElement||V()}:s,Ts={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ls){var ki=Ls.state;if(j()){var Er=b(),Ir=Er.box;["placement","reference-hidden","escaped"].forEach(function(_s){_s==="placement"?Ir.setAttribute("data-placement",ki.placement):ki.attributes.popper["data-popper-"+_s]?Ir.setAttribute("data-"+_s,""):Ir.removeAttribute("data-"+_s)}),ki.attributes.popper={}}}},Bt=[{name:"offset",options:{offset:Re}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Je}},Ts];j()&&yt&&Bt.push({name:"arrow",options:{element:yt,padding:3}}),Bt.push.apply(Bt,(le==null?void 0:le.modifiers)||[]),C.popperInstance=Pm(vt,B,Object.assign({},le,{placement:ge,onFirstUpdate:u,modifiers:Bt}))}function ke(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Ue(){var Y=C.props.appendTo,le,ge=V();C.props.interactive&&Y===au||Y==="parent"?le=ge.parentNode:le=Au(Y,[ge]),le.contains(B)||le.appendChild(B),C.state.isMounted=!0,Te()}function Le(){return xn(B.querySelectorAll("[data-tippy-root]"))}function Se(Y){C.clearDelayTimeouts(),Y&&x("onTrigger",[C,Y]),ce();var le=R(!0),ge=F(),Re=ge[0],be=ge[1];si.isTouch&&Re==="hold"&&be&&(le=be),le?i=setTimeout(function(){C.show()},le):C.show()}function Ve(Y){if(C.clearDelayTimeouts(),x("onUntrigger",[C,Y]),!C.state.isVisible){Ae();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var le=R(!1);le?r=setTimeout(function(){C.state.isVisible&&C.hide()},le):n=requestAnimationFrame(function(){C.hide()})}}function je(){C.state.isEnabled=!0}function ct(){C.hide(),C.state.isEnabled=!1}function st(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function mt(Y){if(!C.state.isDestroyed){x("onBeforeUpdate",[C,Y]),ye();var le=C.props,ge=Eu(s,Object.assign({},le,hu(Y),{ignoreAttributes:!0}));C.props=ge,Ce(),le.interactiveDebounce!==ge.interactiveDebounce&&(K(),g=lu(he,ge.interactiveDebounce)),le.triggerTarget&&!ge.triggerTarget?bs(le.triggerTarget).forEach(function(Re){Re.removeAttribute("aria-expanded")}):ge.triggerTarget&&s.removeAttribute("aria-expanded"),T(),U(),_&&_(le,ge),C.popperInstance&&(Te(),Le().forEach(function(Re){requestAnimationFrame(Re._tippy.popperInstance.forceUpdate)})),x("onAfterUpdate",[C,Y])}}function yi(Y){C.setProps({content:Y})}function Ct(){var Y=C.state.isVisible,le=C.state.isDestroyed,ge=!C.state.isEnabled,Re=si.isTouch&&!C.props.touch,be=Ta(C.props.duration,0,Ht.duration);if(!(Y||le||ge||Re)&&!V().hasAttribute("disabled")&&(x("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,j()&&(B.style.visibility="visible"),U(),ce(),C.state.isMounted||(B.style.transition="none"),j()){var Je=b(),yt=Je.box,vt=Je.content;_a([yt,vt],0)}u=function(){var Bt;if(!(!C.state.isVisible||l)){if(l=!0,B.offsetHeight,B.style.transition=C.props.moveTransition,j()&&C.props.animation){var es=b(),Ls=es.box,ki=es.content;_a([Ls,ki],be),uu([Ls,ki],"visible")}w(),T(),cu(Ma,C),(Bt=C.popperInstance)==null||Bt.forceUpdate(),x("onMount",[C]),C.props.animation&&j()&&Be(be,function(){C.state.isShown=!0,x("onShown",[C])})}},Ue()}}function ai(){var Y=!C.state.isVisible,le=C.state.isDestroyed,ge=!C.state.isEnabled,Re=Ta(C.props.duration,1,Ht.duration);if(!(Y||le||ge)&&(x("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,j()&&(B.style.visibility="hidden"),K(),Ae(),U(!0),j()){var be=b(),Je=be.box,yt=be.content;C.props.animation&&(_a([Je,yt],Re),uu([Je,yt],"hidden"))}w(),T(),C.props.animation?j()&&me(Re,C.unmount):C.unmount()}}function Ai(Y){J().addEventListener("mousemove",g),cu(Tn,g),g(Y)}function li(){C.state.isVisible&&C.hide(),C.state.isMounted&&(ke(),Le().forEach(function(Y){Y._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),Ma=Ma.filter(function(Y){return Y!==C}),C.state.isMounted=!1,x("onHidden",[C]))}function gt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),ye(),delete s._tippy,C.state.isDestroyed=!0,x("onDestroy",[C]))}}function Xi(s,e){e===void 0&&(e={});var t=Ht.plugins.concat(e.plugins||[]);Zm();var i=Object.assign({},e,{plugins:t}),r=Wm(s),n=r.reduce(function(o,a){var A=a&&lC(a,i);return A&&o.push(A),o},[]);return Dn(s)?n[0]:n}Xi.defaultProps=Ht,Xi.setDefaultProps=nC,Xi.currentInput=si,Object.assign({},Hh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),Xi.setDefaultProps({render:Cu});class ri extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const cC=5;class hC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=ft(),this._controls=ft(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this._currentTime=a,this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:c,duration:h})=>a>=c&&a<c+h))??[],this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:c})=>a>=c-cC&&a<c))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const A=this.activeScenes[0],l=El((n=A==null?void 0:A.videoMeta)==null?void 0:n.captions);this.caption=((o=l.find(({start:c,end:h})=>{var u;const d=a-A.start+(((u=A.videoMeta)==null?void 0:u.start)??0);return c&&h&&d>=Kr(c)&&d<=Kr(h)}))==null?void 0:o.text)??"",this.draw(a),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return pt(this._canvas)}controls(){return pt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,u.currentTime):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new ri("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function uC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function dC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Oa(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!uC()&&mi.isSupported()){let l=!1;a=new mi({autoStartLoad:!0,progressive:!0,fetchSetup:(c,h)=>{let u=c.url;const d=r.split("?")[1];return u.toString().includes("?")||(u+="?"+d),new Request(u,h)}}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);a.startLevel=a.firstLevel,a.startLoad(c),l=!0,a.currentLevel=u!==-1?u:a.firstLevel}},a.on(mi.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})})}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function yu(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const gC=ui(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let fC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._delayProcessing=(t=100)=>{const i=new AbortController,r=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(r)}),i},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=ui(async t=>{const{id:i,key:r}=t,n=await Oa(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await yu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new ri(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Qr(this.host,async([e,t,i,r,n,o,a])=>{var A;const l=this._delayProcessing();try{let c=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:h})=>n===h))&&(this.host._language=(A=this.host._languages[0])==null?void 0:A.value),i||e){if(i){let d=null;if(r)try{d=await(await fetch(r,{method:"GET"})).text()}catch(p){const y=new ri("Track failed to fetch",p);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:y,message:y.message}))}const f={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:d}}}]}};try{this.scenes=await as({data:f,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(p){try{this.scenes=await as({data:f,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){throw new ri("Fatal source template error",y,!0)}c=new ri("Source template error",p)}}else try{this.scenes=await as({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(d){try{this.scenes=await as({data:e,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new ri("Fatal data template error",g,!0)}c=new ri("Data template error",d)}Object.keys(this.videos).forEach(d=>{this.scenes.scenes.find(({video:g})=>d===(g==null?void 0:g.key))||this._videos[d].node.pause()});const h=this.scenes.scenes.reduce((d,{video:g})=>(g&&(d[g.key]=g),d),{});Object.keys(this.videos).join("|")!==Object.keys(h).join("|")&&this.host.reset(0,!1),this.videos=h,this.videoState={...this.videoState,...this.scenes.scenes.reduce((d,{video:g,start:f,duration:p})=>{var y;const v=(g==null?void 0:g.key)??`${f}-${p}`,S=this._getBufferSegments({key:v,node:g==null?void 0:g.node,duration:this.scenes.duration});return d[v]={initialised:!g,waiting:!!g,...this.videoState[v],buffered:g?S:(y=this.videoState[v])==null?void 0:y.buffered},d},{})},this.videoMeta=this.scenes.scenes.reduce((d,{video:g,videoMeta:f})=>(g&&f&&(d[g.key]=f),d),{}),(await Promise.all(this.scenes.fonts.map(d=>gC(d)))).forEach(d=>{document.fonts.add(d)}),this.duration=this.scenes.duration,this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}c&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}catch(c){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}finally{l.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,language:this.host.language,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function pC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function EC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Pa=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],IC={id:"captions",event:"captions:click",label:"Closed Captions"},mC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},vu={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},CC={id:"playbackRate",label:"Playback playbackRate",subItems:vu};class yC extends bA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==rs.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Ot}}const Ua=ns(yC),vC=kI(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=dl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),ni={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},BC={colors:ni,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${ni["dark-100"]}`,medium:`0 .125rem .625rem ${ni["dark-100"]}`,large:`0 .25rem 1rem ${ni["dark-50"]}`,xl:`.25rem .25rem 1rem ${ni["dark-250"]}`,xxl:`0 .25rem 2rem ${ni["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ni["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ni["dark-50"]}`,text:`0 0 .25rem ${ni["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ni["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Bu=TI(BC,{delimiter:"-"}),QC=Object.keys(Bu).map(s=>ks(`:host { --${s}: ${Bu[s]}; }`)),Ne=(s=>{const e=class extends s{firstUpdated(){vC().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],QC,ht`
186
+ */const Mh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},Oh=ns(class extends $s{constructor(s){if(super(s),s.type!==rs.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=hd(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??(this.ut=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=Pi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=Pi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=Pi(r[h],n[g]),Hs(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=Pi(r[u],n[d]),Hs(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Mh(o,d,g),c=Mh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const y=Hs(s,r[h]);Pi(y,n[d]),A[d]=y}else A[d]=Pi(p,n[d]),Hs(s,r[h],p),r[f]=null;d++}else qn(r[u]),u--;else qn(r[h]),h++;for(;d<=g;){const f=Hs(s,A[g+1]);Pi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&qn(f)}return this.ut=o,cd(s,A),Ot}});var wt="top",kt="bottom",Ft="right",Rt="left",va="auto",nr=[wt,kt,Ft,Rt],vs="start",or="end",FI="clippingParents",Ph="viewport",ar="popper",NI="reference",Uh=nr.reduce(function(s,e){return s.concat([e+"-"+vs,e+"-"+or])},[]),Gh=[].concat(nr,[va]).reduce(function(s,e){return s.concat([e,e+"-"+vs,e+"-"+or])},[]),MI="beforeRead",OI="read",PI="afterRead",UI="beforeMain",GI="main",HI="afterMain",$I="beforeWrite",YI="write",KI="afterWrite",VI=[MI,OI,PI,UI,GI,HI,$I,YI,KI];function ti(s){return s?(s.nodeName||"").toLowerCase():null}function xt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function Wi(s){var e=xt(s).Element;return s instanceof e||s instanceof Element}function Nt(s){var e=xt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ba(s){if(typeof ShadowRoot>"u")return!1;var e=xt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function JI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Nt(n)||!ti(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function WI(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Nt(r)||!ti(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const Hh={name:"applyStyles",enabled:!0,phase:"write",fn:JI,effect:WI,requires:["computeStyles"]};function ii(s){return s.split("-")[0]}var qi=Math.max,Sn=Math.min,Bs=Math.round;function Qa(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function $h(){return!/^((?!chrome|android).)*safari/i.test(Qa())}function Qs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Nt(s)&&(r=s.offsetWidth>0&&Bs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&Bs(i.height)/s.offsetHeight||1);var o=Wi(s)?xt(s):window,a=o.visualViewport,A=!$h()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Sa(s){var e=Qs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function Yh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ba(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Ci(s){return xt(s).getComputedStyle(s)}function qI(s){return["table","td","th"].indexOf(ti(s))>=0}function Ti(s){return((Wi(s)?s.ownerDocument:s.document)||window.document).documentElement}function bn(s){return ti(s)==="html"?s:s.assignedSlot||s.parentNode||(Ba(s)?s.host:null)||Ti(s)}function Kh(s){return!Nt(s)||Ci(s).position==="fixed"?null:s.offsetParent}function jI(s){var e=/firefox/i.test(Qa()),t=/Trident/i.test(Qa());if(t&&Nt(s)){var i=Ci(s);if(i.position==="fixed")return null}var r=bn(s);for(Ba(r)&&(r=r.host);Nt(r)&&["html","body"].indexOf(ti(r))<0;){var n=Ci(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function Ar(s){for(var e=xt(s),t=Kh(s);t&&qI(t)&&Ci(t).position==="static";)t=Kh(t);return t&&(ti(t)==="html"||ti(t)==="body"&&Ci(t).position==="static")?e:t||jI(s)||e}function ba(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function lr(s,e,t){return qi(s,Sn(e,t))}function XI(s,e,t){var i=lr(s,e,t);return i>t?t:i}function Vh(){return{top:0,right:0,bottom:0,left:0}}function Jh(s){return Object.assign({},Vh(),s)}function Wh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var zI=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Jh(typeof e!="number"?e:Wh(e,nr))};function ZI(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ii(t.placement),A=ba(a),l=[Rt,Ft].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=zI(r.padding,t),u=Sa(n),d=A==="y"?wt:Rt,g=A==="y"?kt:Ft,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],y=Ar(n),v=y?A==="y"?y.clientHeight||0:y.clientWidth||0:0,S=f/2-p/2,C=h[d],Q=v-u[c]-h[g],B=v/2-u[c]/2+S,_=lr(C,B,Q),D=A;t.modifiersData[i]=(e={},e[D]=_,e.centerOffset=_-B,e)}}function em(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Yh(e.elements.popper,r)&&(e.elements.arrow=r))}const tm={name:"arrow",enabled:!0,phase:"main",fn:ZI,effect:em,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ss(s){return s.split("-")[1]}var im={top:"auto",right:"auto",bottom:"auto",left:"auto"};function sm(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:Bs(t*r)/r||0,y:Bs(i*r)/r||0}}function qh(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),S=Rt,C=wt,Q=window;if(l){var B=Ar(t),_="clientHeight",D="clientWidth";if(B===xt(t)&&(B=Ti(t),Ci(B).position!=="static"&&a==="absolute"&&(_="scrollHeight",D="scrollWidth")),B=B,r===wt||(r===Rt||r===Ft)&&n===or){C=kt;var G=h&&B===Q&&Q.visualViewport?Q.visualViewport.height:B[_];f-=G-i.height,f*=A?1:-1}if(r===Rt||(r===wt||r===kt)&&n===or){S=Ft;var F=h&&B===Q&&Q.visualViewport?Q.visualViewport.width:B[D];d-=F-i.width,d*=A?1:-1}}var H=Object.assign({position:a},l&&im),j=c===!0?sm({x:d,y:f},xt(t)):{x:d,y:f};if(d=j.x,f=j.y,A){var V;return Object.assign({},H,(V={},V[C]=v?"0":"",V[S]=y?"0":"",V.transform=(Q.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},H,(e={},e[C]=v?f+"px":"",e[S]=y?d+"px":"",e.transform="",e))}function rm(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:ii(e.placement),variation:Ss(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,qh(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,qh(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const nm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:rm,data:{}};var wn={passive:!0};function om(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=xt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,wn)}),a&&A.addEventListener("resize",t.update,wn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,wn)}),a&&A.removeEventListener("resize",t.update,wn)}}const am={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:om,data:{}};var Am={left:"right",right:"left",bottom:"top",top:"bottom"};function Rn(s){return s.replace(/left|right|bottom|top/g,function(e){return Am[e]})}var lm={start:"end",end:"start"};function jh(s){return s.replace(/start|end/g,function(e){return lm[e]})}function wa(s){var e=xt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ra(s){return Qs(Ti(s)).left+wa(s).scrollLeft}function cm(s,e){var t=xt(s),i=Ti(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=$h();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ra(s),y:A}}function hm(s){var e,t=Ti(s),i=wa(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=qi(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=qi(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Ra(s),A=-i.scrollTop;return Ci(r||t).direction==="rtl"&&(a+=qi(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function xa(s){var e=Ci(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function Xh(s){return["html","body","#document"].indexOf(ti(s))>=0?s.ownerDocument.body:Nt(s)&&xa(s)?s:Xh(bn(s))}function cr(s,e){var t;e===void 0&&(e=[]);var i=Xh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=xt(i),o=r?[n].concat(n.visualViewport||[],xa(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(cr(bn(o)))}function Da(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function um(s,e){var t=Qs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function zh(s,e,t){return e===Ph?Da(cm(s,t)):Wi(e)?um(e,t):Da(hm(Ti(s)))}function dm(s){var e=cr(bn(s)),t=["absolute","fixed"].indexOf(Ci(s).position)>=0,i=t&&Nt(s)?Ar(s):s;return Wi(i)?e.filter(function(r){return Wi(r)&&Yh(r,i)&&ti(r)!=="body"}):[]}function gm(s,e,t,i){var r=e==="clippingParents"?dm(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=zh(s,l,i);return A.top=qi(c.top,A.top),A.right=Sn(c.right,A.right),A.bottom=Sn(c.bottom,A.bottom),A.left=qi(c.left,A.left),A},zh(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Zh(s){var e=s.reference,t=s.element,i=s.placement,r=i?ii(i):null,n=i?Ss(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case wt:A={x:o,y:e.y-t.height};break;case kt:A={x:o,y:e.y+e.height};break;case Ft:A={x:e.x+e.width,y:a};break;case Rt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?ba(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case vs:A[l]=A[l]-(e[c]/2-t[c]/2);break;case or:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function hr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?FI:a,l=t.rootBoundary,c=l===void 0?Ph:l,h=t.elementContext,u=h===void 0?ar:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,y=Jh(typeof p!="number"?p:Wh(p,nr)),v=u===ar?NI:ar,S=s.rects.popper,C=s.elements[g?v:u],Q=gm(Wi(C)?C:C.contextElement||Ti(s.elements.popper),A,c,o),B=Qs(s.elements.reference),_=Zh({reference:B,element:S,strategy:"absolute",placement:r}),D=Da(Object.assign({},S,_)),G=u===ar?D:B,F={top:Q.top-G.top+y.top,bottom:G.bottom-Q.bottom+y.bottom,left:Q.left-G.left+y.left,right:G.right-Q.right+y.right},H=s.modifiersData.offset;if(u===ar&&H){var j=H[r];Object.keys(F).forEach(function(V){var J=[Ft,kt].indexOf(V)>=0?1:-1,b=[wt,kt].indexOf(V)>=0?"y":"x";F[V]+=j[b]*J})}return F}function fm(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?Gh:A,c=Ss(i),h=c?a?Uh:Uh.filter(function(g){return Ss(g)===c}):nr,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=hr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[ii(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function pm(s){if(ii(s)===va)return[];var e=Rn(s);return[jh(s),e,jh(e)]}function Em(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,y=ii(p),v=y===p,S=A||(v||!g?[Rn(p)]:pm(p)),C=[p].concat(S).reduce(function(ie,ce){return ie.concat(ii(ce)===va?fm(e,{placement:ce,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ce)},[]),Q=e.rects.reference,B=e.rects.popper,_=new Map,D=!0,G=C[0],F=0;F<C.length;F++){var H=C[F],j=ii(H),V=Ss(H)===vs,J=[wt,kt].indexOf(j)>=0,b=J?"width":"height",R=hr(e,{placement:H,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),U=J?V?Ft:Rt:V?kt:wt;Q[b]>B[b]&&(U=Rn(U));var x=Rn(U),w=[];if(n&&w.push(R[j]<=0),a&&w.push(R[U]<=0,R[x]<=0),w.every(function(ie){return ie})){G=H,D=!1;break}_.set(H,w)}if(D)for(var T=g?3:1,K=function(ce){var Ae=C.find(function(me){var Be=_.get(me);if(Be)return Be.slice(0,ce).every(function(xe){return xe})});if(Ae)return G=Ae,"break"},M=T;M>0;M--){var q=K(M);if(q==="break")break}e.placement!==G&&(e.modifiersData[i]._skip=!0,e.placement=G,e.reset=!0)}}const Im={name:"flip",enabled:!0,phase:"main",fn:Em,requiresIfExists:["offset"],data:{_skip:!1}};function eu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function tu(s){return[wt,Ft,kt,Rt].some(function(e){return s[e]>=0})}function mm(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=hr(e,{elementContext:"reference"}),a=hr(e,{altBoundary:!0}),A=eu(o,i),l=eu(a,r,n),c=tu(A),h=tu(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const Cm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:mm};function ym(s,e,t){var i=ii(s),r=[Rt,wt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Rt,Ft].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function vm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=Gh.reduce(function(c,h){return c[h]=ym(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Bm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:vm};function Qm(s){var e=s.state,t=s.name;e.modifiersData[t]=Zh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Sm={name:"popperOffsets",enabled:!0,phase:"read",fn:Qm,data:{}};function bm(s){return s==="x"?"y":"x"}function wm(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,p=hr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),y=ii(e.placement),v=Ss(e.placement),S=!v,C=ba(y),Q=bm(C),B=e.modifiersData.popperOffsets,_=e.rects.reference,D=e.rects.popper,G=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,F=typeof G=="number"?{mainAxis:G,altAxis:G}:Object.assign({mainAxis:0,altAxis:0},G),H=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,j={x:0,y:0};if(B){if(n){var V,J=C==="y"?wt:Rt,b=C==="y"?kt:Ft,R=C==="y"?"height":"width",U=B[C],x=U+p[J],w=U-p[b],T=d?-D[R]/2:0,K=v===vs?_[R]:D[R],M=v===vs?-D[R]:-_[R],q=e.elements.arrow,ie=d&&q?Sa(q):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Vh(),Ae=ce[J],me=ce[b],Be=lr(0,_[R],ie[R]),xe=S?_[R]/2-T-Be-Ae-F.mainAxis:K-Be-Ae-F.mainAxis,re=S?-_[R]/2+T+Be+me+F.mainAxis:M+Be+me+F.mainAxis,Ce=e.elements.arrow&&Ar(e.elements.arrow),ye=Ce?C==="y"?Ce.clientTop||0:Ce.clientLeft||0:0,ue=(V=H==null?void 0:H[C])!=null?V:0,he=U+xe-ue-ye,ae=U+re-ue,we=lr(d?Sn(x,he):x,U,d?qi(w,ae):w);B[C]=we,j[C]=we-U}if(a){var Pe,Te=C==="x"?wt:Rt,ke=C==="x"?kt:Ft,Ue=B[Q],Le=Q==="y"?"height":"width",Se=Ue+p[Te],Ve=Ue-p[ke],je=[wt,Rt].indexOf(y)!==-1,ct=(Pe=H==null?void 0:H[Q])!=null?Pe:0,st=je?Se:Ue-_[Le]-D[Le]-ct+F.altAxis,mt=je?Ue+_[Le]+D[Le]-ct-F.altAxis:Ve,yi=d&&je?XI(st,Ue,mt):lr(d?st:Se,Ue,d?mt:Ve);B[Q]=yi,j[Q]=yi-Ue}e.modifiersData[i]=j}}const Rm={name:"preventOverflow",enabled:!0,phase:"main",fn:wm,requiresIfExists:["offset"]};function xm(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function Dm(s){return s===xt(s)||!Nt(s)?wa(s):xm(s)}function Tm(s){var e=s.getBoundingClientRect(),t=Bs(e.width)/s.offsetWidth||1,i=Bs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function Lm(s,e,t){t===void 0&&(t=!1);var i=Nt(e),r=Nt(e)&&Tm(e),n=Ti(e),o=Qs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ti(e)!=="body"||xa(n))&&(a=Dm(e)),Nt(e)?(A=Qs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ra(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function _m(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function km(s){var e=_m(s);return VI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Fm(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function Nm(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var iu={placement:"bottom",modifiers:[],strategy:"absolute"};function su(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Mm(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?iu:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},iu,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;f(),c.options=Object.assign({},n,c.options,v),c.scrollParents={reference:Wi(a)?cr(a):a.contextElement?cr(a.contextElement):[],popper:cr(A)};var S=km(Nm([].concat(i,c.options.modifiers)));return c.orderedModifiers=S.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var y=c.elements,v=y.reference,S=y.popper;if(su(v,S)){c.rects={reference:Lm(v,Ar(S),c.options.strategy==="fixed"),popper:Sa(S)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(F){return c.modifiersData[F.name]=Object.assign({},F.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var Q=c.orderedModifiers[C],B=Q.fn,_=Q.options,D=_===void 0?{}:_,G=Q.name;typeof B=="function"&&(c=B({state:c,options:D,name:G,instance:d})||c)}}}},update:Fm(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!su(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var y=p.name,v=p.options,S=v===void 0?{}:v,C=p.effect;if(typeof C=="function"){var Q=C({state:c,name:y,instance:d,options:S}),B=function(){};h.push(Q||B)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var Om=[am,Sm,nm,Hh,Bm,Im,Rm,tm,Cm],Pm=Mm({defaultModifiers:Om}),Um="tippy-box",ru="tippy-content",Gm="tippy-backdrop",nu="tippy-arrow",ou="tippy-svg-arrow",ji={passive:!0,capture:!0},au=function(){return document.body};function Ta(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function La(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Au(s,e){return typeof s=="function"?s.apply(void 0,e):s}function lu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function Hm(s){return s.split(/\s+/).filter(Boolean)}function bs(s){return[].concat(s)}function cu(s,e){s.indexOf(e)===-1&&s.push(e)}function $m(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function Ym(s){return s.split("-")[0]}function xn(s){return[].slice.call(s)}function hu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function ur(){return document.createElement("div")}function Dn(s){return["Element","Fragment"].some(function(e){return La(s,e)})}function Km(s){return La(s,"NodeList")}function Vm(s){return La(s,"MouseEvent")}function Jm(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function Wm(s){return Dn(s)?[s]:Km(s)?xn(s):Array.isArray(s)?s:xn(document.querySelectorAll(s))}function _a(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function uu(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function qm(s){var e,t=bs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function jm(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=Ym(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,p=i-n.bottom-u>A,y=n.left-t+d>A,v=t-n.right-g>A;return f||p||y||v})}function ka(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function du(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var si={isTouch:!1},gu=0;function Xm(){si.isTouch||(si.isTouch=!0,window.performance&&document.addEventListener("mousemove",fu))}function fu(){var s=performance.now();s-gu<20&&(si.isTouch=!1,document.removeEventListener("mousemove",fu)),gu=s}function zm(){var s=document.activeElement;if(Jm(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function Zm(){document.addEventListener("touchstart",Xm,ji),window.addEventListener("blur",zm)}var eC=typeof window<"u"&&typeof document<"u",tC=eC?!!window.msCrypto:!1,iC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},sC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ht=Object.assign({appendTo:au,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},iC,sC),rC=Object.keys(Ht),nC=function(e){var t=Object.keys(e);t.forEach(function(i){Ht[i]=e[i]})};function pu(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Ht[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function oC(s,e){var t=e?Object.keys(pu(Object.assign({},Ht,{plugins:e}))):rC,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function Eu(s,e){var t=Object.assign({},e,{content:Au(e.content,[s])},e.ignoreAttributes?{}:oC(s,e.plugins));return t.aria=Object.assign({},Ht.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var aC=function(){return"innerHTML"};function Fa(s,e){s[aC()]=e}function Iu(s){var e=ur();return s===!0?e.className=nu:(e.className=ou,Dn(s)?e.appendChild(s):Fa(e,s)),e}function mu(s,e){Dn(e.content)?(Fa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Fa(s,e.content):s.textContent=e.content)}function Na(s){var e=s.firstElementChild,t=xn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(ru)}),arrow:t.find(function(i){return i.classList.contains(nu)||i.classList.contains(ou)}),backdrop:t.find(function(i){return i.classList.contains(Gm)})}}function Cu(s){var e=ur(),t=ur();t.className=Um,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=ur();i.className=ru,i.setAttribute("data-state","hidden"),mu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=Na(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&mu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(Iu(o.arrow))):A.appendChild(Iu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}Cu.$$tippy=!0;var AC=1,Tn=[],Ma=[];function lC(s,e){var t=Eu(s,Object.assign({},Ht,pu(hu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=lu(he,t.interactiveDebounce),f,p=AC++,y=null,v=$m(t.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:ur(),popperInstance:y,props:t,state:S,plugins:v,clearDelayTimeouts:st,setProps:mt,setContent:yi,show:Ct,hide:ai,hideWithInteractivity:Ai,enable:je,disable:ct,unmount:li,destroy:gt};if(!t.render)return C;var Q=t.render(C),B=Q.popper,_=Q.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+C.id,C.popper=B,s._tippy=C,B._tippy=C;var D=v.map(function(Y){return Y.fn(C)}),G=s.hasAttribute("aria-expanded");return Ce(),T(),U(),x("onCreate",[C]),t.showOnCreate&&Se(),B.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&J().addEventListener("mousemove",g)}),C;function F(){var Y=C.props.touch;return Array.isArray(Y)?Y:[Y,0]}function H(){return F()[0]==="hold"}function j(){var Y;return!!((Y=C.props.render)!=null&&Y.$$tippy)}function V(){return f||s}function J(){var Y=V().parentNode;return Y?qm(Y):document}function b(){return Na(B)}function R(Y){return C.state.isMounted&&!C.state.isVisible||si.isTouch||c&&c.type==="focus"?0:Ta(C.props.delay,Y?0:1,Ht.delay)}function U(Y){Y===void 0&&(Y=!1),B.style.pointerEvents=C.props.interactive&&!Y?"":"none",B.style.zIndex=""+C.props.zIndex}function x(Y,le,ge){if(ge===void 0&&(ge=!0),D.forEach(function(be){be[Y]&&be[Y].apply(be,le)}),ge){var Re;(Re=C.props)[Y].apply(Re,le)}}function w(){var Y=C.props.aria;if(Y.content){var le="aria-"+Y.content,ge=B.id,Re=bs(C.props.triggerTarget||s);Re.forEach(function(be){var Je=be.getAttribute(le);if(C.state.isVisible)be.setAttribute(le,Je?Je+" "+ge:ge);else{var yt=Je&&Je.replace(ge,"").trim();yt?be.setAttribute(le,yt):be.removeAttribute(le)}})}}function T(){if(!(G||!C.props.aria.expanded)){var Y=bs(C.props.triggerTarget||s);Y.forEach(function(le){C.props.interactive?le.setAttribute("aria-expanded",C.state.isVisible&&le===V()?"true":"false"):le.removeAttribute("aria-expanded")})}}function K(){J().removeEventListener("mousemove",g),Tn=Tn.filter(function(Y){return Y!==g})}function M(Y){if(!(si.isTouch&&(A||Y.type==="mousedown"))){var le=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(C.props.interactive&&du(B,le))){if(bs(C.props.triggerTarget||s).some(function(ge){return du(ge,le)})){if(si.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else x("onClickOutside",[C,Y]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||Ae())}}}function q(){A=!0}function ie(){A=!1}function ce(){var Y=J();Y.addEventListener("mousedown",M,!0),Y.addEventListener("touchend",M,ji),Y.addEventListener("touchstart",ie,ji),Y.addEventListener("touchmove",q,ji)}function Ae(){var Y=J();Y.removeEventListener("mousedown",M,!0),Y.removeEventListener("touchend",M,ji),Y.removeEventListener("touchstart",ie,ji),Y.removeEventListener("touchmove",q,ji)}function me(Y,le){xe(Y,function(){!C.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&le()})}function Be(Y,le){xe(Y,le)}function xe(Y,le){var ge=b().box;function Re(be){be.target===ge&&(ka(ge,"remove",Re),le())}if(Y===0)return le();ka(ge,"remove",h),ka(ge,"add",Re),h=Re}function re(Y,le,ge){ge===void 0&&(ge=!1);var Re=bs(C.props.triggerTarget||s);Re.forEach(function(be){be.addEventListener(Y,le,ge),d.push({node:be,eventType:Y,handler:le,options:ge})})}function Ce(){H()&&(re("touchstart",ue,{passive:!0}),re("touchend",ae,{passive:!0})),Hm(C.props.trigger).forEach(function(Y){if(Y!=="manual")switch(re(Y,ue),Y){case"mouseenter":re("mouseleave",ae);break;case"focus":re(tC?"focusout":"blur",we);break;case"focusin":re("focusout",we);break}})}function ye(){d.forEach(function(Y){var le=Y.node,ge=Y.eventType,Re=Y.handler,be=Y.options;le.removeEventListener(ge,Re,be)}),d=[]}function ue(Y){var le,ge=!1;if(!(!C.state.isEnabled||Pe(Y)||a)){var Re=((le=c)==null?void 0:le.type)==="focus";c=Y,f=Y.currentTarget,T(),!C.state.isVisible&&Vm(Y)&&Tn.forEach(function(be){return be(Y)}),Y.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?ge=!0:Se(Y),Y.type==="click"&&(o=!ge),ge&&!Re&&Ve(Y)}}function he(Y){var le=Y.target,ge=V().contains(le)||B.contains(le);if(!(Y.type==="mousemove"&&ge)){var Re=Le().concat(B).map(function(be){var Je,yt=be._tippy,vt=(Je=yt.popperInstance)==null?void 0:Je.state;return vt?{popperRect:be.getBoundingClientRect(),popperState:vt,props:t}:null}).filter(Boolean);jm(Re,Y)&&(K(),Ve(Y))}}function ae(Y){var le=Pe(Y)||C.props.trigger.indexOf("click")>=0&&o;if(!le){if(C.props.interactive){C.hideWithInteractivity(Y);return}Ve(Y)}}function we(Y){C.props.trigger.indexOf("focusin")<0&&Y.target!==V()||C.props.interactive&&Y.relatedTarget&&B.contains(Y.relatedTarget)||Ve(Y)}function Pe(Y){return si.isTouch?H()!==Y.type.indexOf("touch")>=0:!1}function Te(){ke();var Y=C.props,le=Y.popperOptions,ge=Y.placement,Re=Y.offset,be=Y.getReferenceClientRect,Je=Y.moveTransition,yt=j()?Na(B).arrow:null,vt=be?{getBoundingClientRect:be,contextElement:be.contextElement||V()}:s,Ts={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ls){var ki=Ls.state;if(j()){var Er=b(),Ir=Er.box;["placement","reference-hidden","escaped"].forEach(function(_s){_s==="placement"?Ir.setAttribute("data-placement",ki.placement):ki.attributes.popper["data-popper-"+_s]?Ir.setAttribute("data-"+_s,""):Ir.removeAttribute("data-"+_s)}),ki.attributes.popper={}}}},Bt=[{name:"offset",options:{offset:Re}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Je}},Ts];j()&&yt&&Bt.push({name:"arrow",options:{element:yt,padding:3}}),Bt.push.apply(Bt,(le==null?void 0:le.modifiers)||[]),C.popperInstance=Pm(vt,B,Object.assign({},le,{placement:ge,onFirstUpdate:u,modifiers:Bt}))}function ke(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Ue(){var Y=C.props.appendTo,le,ge=V();C.props.interactive&&Y===au||Y==="parent"?le=ge.parentNode:le=Au(Y,[ge]),le.contains(B)||le.appendChild(B),C.state.isMounted=!0,Te()}function Le(){return xn(B.querySelectorAll("[data-tippy-root]"))}function Se(Y){C.clearDelayTimeouts(),Y&&x("onTrigger",[C,Y]),ce();var le=R(!0),ge=F(),Re=ge[0],be=ge[1];si.isTouch&&Re==="hold"&&be&&(le=be),le?i=setTimeout(function(){C.show()},le):C.show()}function Ve(Y){if(C.clearDelayTimeouts(),x("onUntrigger",[C,Y]),!C.state.isVisible){Ae();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var le=R(!1);le?r=setTimeout(function(){C.state.isVisible&&C.hide()},le):n=requestAnimationFrame(function(){C.hide()})}}function je(){C.state.isEnabled=!0}function ct(){C.hide(),C.state.isEnabled=!1}function st(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function mt(Y){if(!C.state.isDestroyed){x("onBeforeUpdate",[C,Y]),ye();var le=C.props,ge=Eu(s,Object.assign({},le,hu(Y),{ignoreAttributes:!0}));C.props=ge,Ce(),le.interactiveDebounce!==ge.interactiveDebounce&&(K(),g=lu(he,ge.interactiveDebounce)),le.triggerTarget&&!ge.triggerTarget?bs(le.triggerTarget).forEach(function(Re){Re.removeAttribute("aria-expanded")}):ge.triggerTarget&&s.removeAttribute("aria-expanded"),T(),U(),_&&_(le,ge),C.popperInstance&&(Te(),Le().forEach(function(Re){requestAnimationFrame(Re._tippy.popperInstance.forceUpdate)})),x("onAfterUpdate",[C,Y])}}function yi(Y){C.setProps({content:Y})}function Ct(){var Y=C.state.isVisible,le=C.state.isDestroyed,ge=!C.state.isEnabled,Re=si.isTouch&&!C.props.touch,be=Ta(C.props.duration,0,Ht.duration);if(!(Y||le||ge||Re)&&!V().hasAttribute("disabled")&&(x("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,j()&&(B.style.visibility="visible"),U(),ce(),C.state.isMounted||(B.style.transition="none"),j()){var Je=b(),yt=Je.box,vt=Je.content;_a([yt,vt],0)}u=function(){var Bt;if(!(!C.state.isVisible||l)){if(l=!0,B.offsetHeight,B.style.transition=C.props.moveTransition,j()&&C.props.animation){var es=b(),Ls=es.box,ki=es.content;_a([Ls,ki],be),uu([Ls,ki],"visible")}w(),T(),cu(Ma,C),(Bt=C.popperInstance)==null||Bt.forceUpdate(),x("onMount",[C]),C.props.animation&&j()&&Be(be,function(){C.state.isShown=!0,x("onShown",[C])})}},Ue()}}function ai(){var Y=!C.state.isVisible,le=C.state.isDestroyed,ge=!C.state.isEnabled,Re=Ta(C.props.duration,1,Ht.duration);if(!(Y||le||ge)&&(x("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,j()&&(B.style.visibility="hidden"),K(),Ae(),U(!0),j()){var be=b(),Je=be.box,yt=be.content;C.props.animation&&(_a([Je,yt],Re),uu([Je,yt],"hidden"))}w(),T(),C.props.animation?j()&&me(Re,C.unmount):C.unmount()}}function Ai(Y){J().addEventListener("mousemove",g),cu(Tn,g),g(Y)}function li(){C.state.isVisible&&C.hide(),C.state.isMounted&&(ke(),Le().forEach(function(Y){Y._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),Ma=Ma.filter(function(Y){return Y!==C}),C.state.isMounted=!1,x("onHidden",[C]))}function gt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),ye(),delete s._tippy,C.state.isDestroyed=!0,x("onDestroy",[C]))}}function Xi(s,e){e===void 0&&(e={});var t=Ht.plugins.concat(e.plugins||[]);Zm();var i=Object.assign({},e,{plugins:t}),r=Wm(s),n=r.reduce(function(o,a){var A=a&&lC(a,i);return A&&o.push(A),o},[]);return Dn(s)?n[0]:n}Xi.defaultProps=Ht,Xi.setDefaultProps=nC,Xi.currentInput=si,Object.assign({},Hh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),Xi.setDefaultProps({render:Cu});class ri extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const cC=5;class hC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=ft(),this._controls=ft(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this._currentTime=a,this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:c,duration:h})=>a>=c&&a<c+h))??[],this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:c})=>a>=c-cC&&a<c))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const A=this.activeScenes[0],l=El((n=A==null?void 0:A.videoMeta)==null?void 0:n.captions);this.caption=((o=l.find(({start:c,end:h})=>{var u;const d=a-A.start+(((u=A.videoMeta)==null?void 0:u.start)??0);return c&&h&&d>=Kr(c)&&d<=Kr(h)}))==null?void 0:o.text)??"",this.draw(a),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return pt(this._canvas)}controls(){return pt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,u.currentTime):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new ri("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function uC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function dC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Oa(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!uC()&&mi.isSupported()){let l=!1;a=new mi({autoStartLoad:!0,xhrSetup:c=>{const{open:h}=c,u=r.split("?")[1];c.open=function(d,g,f){g.toString().includes("?")||(g+="?"+u),!(!l&&g.toString().includes(".ts"))&&h.apply(this,[d,g,f])}}}),a.on(mi.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);l=!0,a.startLevel=a.firstLevel,a.startLoad(c),a.currentLevel=u!==-1?u:a.firstLevel}}}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function yu(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const gC=ui(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let fC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._delayProcessing=(t=100)=>{const i=new AbortController,r=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(r)}),i},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=ui(async t=>{const{id:i,key:r}=t,n=await Oa(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await yu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new ri(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Qr(this.host,async([e,t,i,r,n,o,a])=>{var A;const l=this._delayProcessing();try{let c=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:h})=>n===h))&&(this.host._language=(A=this.host._languages[0])==null?void 0:A.value),i||e){if(i){let d=null;if(r)try{d=await(await fetch(r,{method:"GET"})).text()}catch(p){const y=new ri("Track failed to fetch",p);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:y,message:y.message}))}const f={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:d}}}]}};try{this.scenes=await as({data:f,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(p){try{this.scenes=await as({data:f,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){throw new ri("Fatal source template error",y,!0)}c=new ri("Source template error",p)}}else try{this.scenes=await as({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(d){try{this.scenes=await as({data:e,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new ri("Fatal data template error",g,!0)}c=new ri("Data template error",d)}Object.keys(this.videos).forEach(d=>{this.scenes.scenes.find(({video:g})=>d===(g==null?void 0:g.key))||this._videos[d].node.pause()});const h=this.scenes.scenes.reduce((d,{video:g})=>(g&&(d[g.key]=g),d),{});Object.keys(this.videos).join("|")!==Object.keys(h).join("|")&&this.host.reset(0,!1),this.videos=h,this.videoState={...this.videoState,...this.scenes.scenes.reduce((d,{video:g,start:f,duration:p})=>{var y;const v=(g==null?void 0:g.key)??`${f}-${p}`,S=this._getBufferSegments({key:v,node:g==null?void 0:g.node,duration:this.scenes.duration});return d[v]={initialised:!g,waiting:!!g,...this.videoState[v],buffered:g?S:(y=this.videoState[v])==null?void 0:y.buffered},d},{})},this.videoMeta=this.scenes.scenes.reduce((d,{video:g,videoMeta:f})=>(g&&f&&(d[g.key]=f),d),{}),(await Promise.all(this.scenes.fonts.map(d=>gC(d)))).forEach(d=>{document.fonts.add(d)}),this.duration=this.scenes.duration,this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}c&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}catch(c){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}finally{l.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,language:this.host.language,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function pC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function EC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Pa=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],IC={id:"captions",event:"captions:click",label:"Closed Captions"},mC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},vu={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},CC={id:"playbackRate",label:"Playback playbackRate",subItems:vu};class yC extends bA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==rs.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Ot}}const Ua=ns(yC),vC=kI(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=dl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),ni={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},BC={colors:ni,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${ni["dark-100"]}`,medium:`0 .125rem .625rem ${ni["dark-100"]}`,large:`0 .25rem 1rem ${ni["dark-50"]}`,xl:`.25rem .25rem 1rem ${ni["dark-250"]}`,xxl:`0 .25rem 2rem ${ni["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ni["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ni["dark-50"]}`,text:`0 0 .25rem ${ni["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ni["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Bu=TI(BC,{delimiter:"-"}),QC=Object.keys(Bu).map(s=>ks(`:host { --${s}: ${Bu[s]}; }`)),Ne=(s=>{const e=class extends s{firstUpdated(){vC().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],QC,ht`
187
187
  :host {
188
188
  font-family: var(--fontFamilies-sans);
189
189
  font-size: var(--fontSizes-medium);