@vouchfor/embeds 0.0.0-experiment.fcb18c1 → 0.0.0-experiment.fcfd44c

Sign up to get free protection for your applications and to get access to all the features.
package/dist/es/embeds.js CHANGED
@@ -196,7 +196,7 @@ class FetcherController {
196
196
  }
197
197
  }
198
198
  const name = "@vouchfor/embeds";
199
- const version = "0.0.0-experiment.fcb18c1";
199
+ const version = "0.0.0-experiment.fcfd44c";
200
200
  const license = "MIT";
201
201
  const author = "Aaron Williams";
202
202
  const main = "dist/es/embeds.js";
@@ -238,8 +238,8 @@ const scripts = {
238
238
  const dependencies = {
239
239
  "@a11y/focus-trap": "^1.0.5",
240
240
  "@lit/task": "^1.0.0",
241
- "@vouchfor/canvas-video": "0.0.0-experiment.fcb18c1",
242
- "@vouchfor/media-player": "0.0.0-experiment.fcb18c1",
241
+ "@vouchfor/canvas-video": "0.0.0-experiment.fcfd44c",
242
+ "@vouchfor/media-player": "0.0.0-experiment.fcfd44c",
243
243
  uuid: "^9.0.1"
244
244
  };
245
245
  const peerDependencies = {
@@ -258,7 +258,7 @@ const devDependencies = {
258
258
  "@types/mocha": "^10.0.6",
259
259
  "@vouchfor/eslint-config": "^1.0.1",
260
260
  "@vouchfor/prettier-config": "^1.0.1",
261
- "@vouchfor/video-utils": "0.0.0-experiment.fcb18c1",
261
+ "@vouchfor/video-utils": "0.0.0-experiment.fcfd44c",
262
262
  "@web/dev-server-esbuild": "^1.0.2",
263
263
  "@web/test-runner": "^0.18.1",
264
264
  "@web/test-runner-browserstack": "^0.7.1",
@@ -2451,7 +2451,7 @@ vec4 transition(vec2 uv) {
2451
2451
  return mix(a, b, step(0.0+p.y,progress));
2452
2452
  }
2453
2453
  `,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const oc=Eo(lp);var ac;function Ap(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function cp(r){if(typeof r=="string"){const[e,t]=r.split(":"),n=parseFloat(e),i=parseFloat(t);return n/i}return r}function qo({resolution:r,aspectRatio:e}){const t=Ap(r),n=cp(e),i=n>=1,s=Math.min(i?t*n:t/n,t),o=Math.max(i?t*n:t/n,t);return{resolution:t,aspectRatio:n,height:i?s:o,width:i?o:s}}const ci=/(?<value>\d+\.?\d*)(?=px)/;function lc({context:r,word:e,maxW:t=1/0}){const n=[],i=r.measureText(e);if(Math.floor(i.width)<=t)return[{text:e,metrics:i}];for(let s=0;s<e.length;s++){const o=n[n.length-1],a=((o==null?void 0:o.text)??"")+e[s],l=r.measureText(a);l.width<t?n[o?n.length-1:0]={text:a,metrics:l}:n.push({text:e[s],metrics:r.measureText(e[s])})}return n}const up=mo(({context:r,fontSizes:e,text:t,maxW:n=1/0})=>{try{return r.save(),r.font=r.font.replace(ci,e[0].toString()),t.split(`
2454
- `).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>n)a=[...a,...lc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(ci,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},lc({context:r,word:o[0],maxW:n})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),Ac=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function hp({text:r,font:e}){let t=e;return Ac.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}mo(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(ci,e[0].toString()),n.length<=0?[]:n.slice(1).reduce((i,s)=>{var o;const a=s.text,A=`${(o=i[i.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[i.length%e.length];r.font=r.font.replace(ci,u.toString()),i=[...i,{text:a,metrics:r.measureText(a),words:[s]}]}else i[i.length-1]={text:A,metrics:c,words:[...i[i.length-1].words,s]};return i},[{text:n[0].text,metrics:r.measureText(n[0].text),words:[n[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let cs;const dp=new Uint8Array(16);function fp(){if(!cs&&(cs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cs(dp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function gp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const cc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pp(r,e,t){if(cc.randomUUID&&!e&&!r)return cc.randomUUID();r=r||{};const n=r.random||(r.rng||fp)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return gp(n)}mo(({font:r,scale:e,context:t,maxW:n,maxH:i,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=up({context:t,fontSizes:[c],text:s,maxW:n});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>n||d.length*c>i){c-=1;break}}}else c=parseFloat(((A=(l=r.match(ci))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:n,scale:i,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${n}_${i}_${s}_${o}`});function mp(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function Ep(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const Ip=Xr(()=>iA.loadYoga());Ff.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Ep(r)}"`:mp(r)||Array.isArray(r)?JSON.stringify(r):r);const Cp="3";function vp(r){return typeof r=="number"?{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}:{topLeft:(r==null?void 0:r.topLeft)??0,topRight:(r==null?void 0:r.topRight)??0,bottomRight:(r==null?void 0:r.bottomRight)??0,bottomLeft:(r==null?void 0:r.bottomLeft)??0}}function yp(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function uc(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function hc(r,e,{layout:t,scale:n=1}){const{position:i="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:C="start",alignSelf:Q,justify:b="start"}=t??{},v={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(v[i]),s){const{top:$,right:K,bottom:O,left:W}=yp(s,n);typeof $<"u"&&e.setPosition(r.EDGE_TOP,$),typeof K<"u"&&e.setPosition(r.EDGE_RIGHT,K),typeof O<"u"&&e.setPosition(r.EDGE_BOTTOM,O),typeof W<"u"&&e.setPosition(r.EDGE_LEFT,W)}const x={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(x[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[C]),Q&&e.setAlignSelf(R[Q]);const k={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(k[b]),f){const{top:$,right:K,bottom:O,left:W}=uc(f,n);e.setMargin(r.EDGE_TOP,$),e.setMargin(r.EDGE_RIGHT,K),e.setMargin(r.EDGE_BOTTOM,O),e.setMargin(r.EDGE_LEFT,W)}if(g){const{top:$,right:K,bottom:O,left:W}=uc(g,n);e.setPadding(r.EDGE_TOP,$),e.setPadding(r.EDGE_RIGHT,K),e.setPadding(r.EDGE_BOTTOM,O),e.setPadding(r.EDGE_LEFT,W)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*n),typeof o<"u"&&e.setWidth(typeof o=="number"?o*n:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*n:a)),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*n:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*n:A),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*n:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*n:u)}async function dc({yoga:r,index:e,parent:t,element:n,resolvers:i}){var s,o;const{type:a,layout:l={},config:A,options:c,renderer:u}=n,h=r.Node.create();hc(r,h,{layout:l}),t.insertChild(h,e);let d=null;i&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="image"||(u==null?void 0:u.type)==="video")&&(d=await((s=i[u.type])==null?void 0:s.call(i,{config:A,options:c}))??null);const f=[];for await(const[g,p]of((o=n.children)==null?void 0:o.entries())??[])f.push(await dc({yoga:r,index:g,parent:h,element:p,resolvers:i}));return t.calculateLayout(),{type:a,node:h,radius:vp(l.radius),element:n,renderer:u,config:A,options:c,dependencies:d,childNodes:f}}function fc(r,e,t=0,n=0){const{top:i,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=n+o,h=e.childNodes.map(d=>fc(r,d,c,u));return{...e,x:s+c,y:i+u,width:l,height:A,childNodes:h}}async function Xo(r,e,t){for await(const{node:n,options:i,dependencies:s,renderer:o,childNodes:a}of e){if(o){const{width:l,height:A}=o;if(l){const c=await l({node:n,options:i,dependencies:s,measureCanvas:t});n.setWidth(c)}if(await Xo(r,a,t),A){const c=await A({node:n,options:i,dependencies:s,measureCanvas:t});n.setHeight(c)}}await Xo(r,a,t)}r.calculateLayout()}async function gc({root:r,resolvers:e,measureCanvas:t}){const n=await Ip(),i=n.Node.create();hc(n,i,{layout:r.layout});const s=await dc({yoga:n,index:0,parent:i,element:r.element,resolvers:e});await Xo(i,[s],t);const{top:o,left:a,width:l,height:A}=i.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:fc(i,s)};return i.freeRecursive(),c}async function Bp({scene:r,start:e=0}){const{root:t,duration:n}=r,i=await gc({root:t});return{type:r.type,start:e,duration:n,layout:i,id:r.id,config:r}}async function pc(){return document.createElement("canvas")}function vn(r){let e=0;for(const t of r)Array.isArray(t)?e+=vn(t):e+=t;return e}function Tp(r){return r.map(({type:e,duration:t},n)=>{var i,s,o,a;if(e==="transition"){const l=((i=r[n-2])==null?void 0:i.type)==="transition"?r[n-2]:null,A=((s=r[n-1])==null?void 0:s.duration)??1/0,c=((o=r[n+1])==null?void 0:o.duration)??1/0,u=((a=r[n+2])==null?void 0:a.type)==="transition"?r[n+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function mc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return mc(t)}).filter(Boolean))??[]}}function Ec({node:r,duration:e}){const t=[];r.type==="recipe"&&t.push({id:pp(),type:"scene",x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:mc({...r.element,layout:{...r.element.layout,position:"static",width:"100%",height:"100%",margin:0}})}});for(const n of r.childNodes)t.push(...Ec({node:n,duration:e}));return t}async function Ic({node:r,canvases:e,sceneTime:t}){var n,i;await((i=(n=r.renderer)==null?void 0:n.render)==null?void 0:i.call(n,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,radius:r.radius,options:r.options,dependencies:r.dependencies}));const{sceneCanvas:s}=e,o=s.getContext("2d");o&&(o.strokeStyle="red",o.strokeRect(r.x,r.y,r.width,r.height));for await(const a of r.childNodes)await Ic({node:a,canvases:e,sceneTime:t})}async function Qp({layout:r,canvases:e,sceneTime:t}){const{node:n}=r;await Ic({node:n,canvases:e,sceneTime:t})}async function bp({scene:r,start:e=0,resolvers:t,rootWidth:n,rootHeight:i,canvasFactory:s=pc}){var o,a;const{x:l,y:A,width:c,height:u,root:h,duration:d}=r,f=await s(),g=await s(),p=await s(),C=await s(),Q=await s(),b=await s(),v=await gc({root:{...h,layout:{...h.layout,width:n,height:i},element:{...h.element,layout:{...h.element.layout,...typeof l=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:l}}:{},width:c??((o=h.element.layout)==null?void 0:o.width),height:u??((a=h.element.layout)==null?void 0:a.height)}}},resolvers:t,measureCanvas:b}),x=async R=>{const k=Math.max(0,R-e);f.width=f.height=0,f.width=n,f.height=i,await Qp({layout:v,sceneTime:k,canvases:{sceneCanvas:f,cropCanvas:p,letterboxCanvas:C,posterCanvas:Q}})};return{type:r.type,draw:x,start:e,duration:d,layout:v,sceneCanvas:f,transitionCanvas:g,id:r.id,config:r,childScenes:Ec({node:v.node,duration:d})}}function xp(r){return r.some(({type:e})=>e==="scene"||e==="transition")}function wp(r){return r.type==="video"}const Sp=(((ac=oc)==null?void 0:ac.default)??oc).reduce((r,e)=>(r[e.name]=e,r),{});function Rp({name:r,canvas:e,to:t,from:n,progress:i}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=os)==null?void 0:s.default)??os)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=os)==null?void 0:o.default)??os)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=sc)==null?void 0:a.default)??sc)(l,Sp[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Cc({config:r,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i=pc}){const s=await Promise.all(r.tracks.map(async l=>{const A=Tp(l);if(!xp(l)){const f=await Promise.all(l.reduce((C,Q,b)=>{if(Q.type!=="audio")return C;const v=vn(A.slice(0,b));return C.push(Bp({scene:Q,start:v})),C},[])),g=l.reduce((C,Q,b)=>{if(Q.type!=="gap")return C;const v=vn(A.slice(0,b));return C.push({type:Q.type,id:Q.id,start:v,config:Q,duration:Q.duration}),C},[]),p=l.map(({id:C})=>f.find(({id:Q})=>Q===C)??g.find(({id:Q})=>Q===C)).filter(Boolean);return{type:"audio",scenes:f,gapScenes:g,mergedScenes:p,config:l,duration:Math.max(...p.map(({start:C,duration:Q})=>C+Q))}}const c=await Promise.all(l.reduce((f,g,p)=>{if(g.type!=="scene")return f;const C=vn(A.slice(0,p));return f.push(bp({scene:g,start:C,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i})),f},[])),u=l.reduce((f,g,p)=>{if(g.type!=="gap")return f;const C=vn(A.slice(0,p));return f.push({type:g.type,id:g.id,start:C,config:g,duration:g.duration}),f},[]),h=l.reduce((f,g,p)=>{if(g.type!=="transition")return f;const C=g.duration,Q=vn(A.slice(0,p))-C;return f.push({type:g.type,id:g.id,name:g.name,start:Q,duration:C,config:g,to:c.find(({id:b})=>{var v;return b===((v=l[p+1])==null?void 0:v.id)}),from:c.find(({id:b})=>{var v;return b===((v=l[p-1])==null?void 0:v.id)})}),f},[]),d=l.map(({id:f})=>c.find(({id:g})=>g===f)??u.find(({id:g})=>g===f)??h.find(({id:g})=>g===f)).filter(Boolean);return{type:"video",scenes:c,gapScenes:u,transitions:h,mergedScenes:d,config:l,duration:Math.max(...d.map(({start:f,duration:g})=>f+g)),trackCanvas:await i()}}));console.log({tracks:s});const o=await i();return{draw:async({canvas:l,currentTime:A})=>{const c=l.getContext("2d");if(c){c.globalAlpha=1,c.globalCompositeOperation="source-over",c.clearRect(0,0,l.width,l.height),c.save(),c.fillStyle="black",c.fillRect(0,0,l.width,l.height),c.restore();for await(const u of s){if(!wp(u))continue;const{scenes:h,transitions:d,trackCanvas:f}=u;f.width=f.height=0,f.width=l.width,f.height=l.height;const g=h.filter(({start:C,duration:Q})=>A>=C&&A<C+Q);if(g.length<=0)continue;const p=d.find(({start:C,duration:Q})=>A>=C&&A<C+Q);for await(const{id:C,start:Q,duration:b,sceneCanvas:v,transitionCanvas:x,draw:R}of g)if(await(R==null?void 0:R(A)),!p)c.drawImage(v,0,0,v.width,v.height);else{const{name:k,to:$,from:K,duration:O}=p;o.width=o.height=x.width=x.height=0,o.width=x.width=v.width,o.height=x.height=v.height;const W=($==null?void 0:$.id)===C,ie=(K==null?void 0:K.id)===C,te=W&&$.sceneCanvas||o,le=ie&&K.sceneCanvas||o,D=W?Math.min(1,Math.max(0,(A-Q)/O)):Math.min(1,Math.max(0,1-(Q+b-A)/O));Rp({name:k,progress:D,to:te,from:le,canvas:x});const P=f.getContext("2d");if(!P)return;P.globalCompositeOperation="lighter",P.drawImage(x,0,0,x.width,x.height)}c.drawImage(f,0,0,f.width,f.height)}}},tracks:s,duration:Math.max(...s.map(({duration:l})=>l))}}const Dp={name:"@vouchfor/embeds",version:"0.0.0-experiment.fcb18c1",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:"experiment",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","test:watch":"yarn test --watch"},"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":"0.0.0-experiment.fcb18c1","@vouchfor/media-player":"0.0.0-experiment.fcb18c1",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":"0.0.0-experiment.fcb18c1","@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 _p(r){const{publicApiUrl:e}=$i(r),t=kr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Lp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:kr()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),n=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const i=kr();return e||(e=_p(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=kr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=kr(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",n)),{client:t,tab:n,request:i,visitor:e}}function Fp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function kp(r="embedded_player"){var i,s;const[e,t]=((s=(i=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:i.split)==null?void 0:s.call(i,"/"))??[],n={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());n[l]=a}}),{source:r,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:Dp.version,templateVersion:Cp,...n}}const vc=1;class Np{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=Fp(n,this.host.vouch);!i||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...n,vouchId:i,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=$i(this.host.env),{client:n,tab:i,request:s,visitor:o}=Lp(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":n,"x-uid-tab":i,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":kp(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+vc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]}},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:n}})=>{this._answersViewed[n]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[n]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:n,node:i}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:n,node:i},this._streamLatestTime[n]=i.currentTime,this._streamStartTime[n]||(this._streamStartTime[n]=i.currentTime,this._streamLatestTime[n]=i.currentTime))},this._handleVideoPause=({detail:{id:t,key:n}})=>{this._streamLatestTime[n]>this._streamStartTime[n]+vc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]},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,n,i;"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),(n=this.host.mediaPlayer)==null||n.addEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,n,i;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),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var jo={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof En<"u"&&En,n=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={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 A(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var P={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return l.iterable&&(P[Symbol.iterator]=function(){return P}),P}function g(D){this.map={},D instanceof g?D.forEach(function(P,X){this.append(X,P)},this):Array.isArray(D)?D.forEach(function(P){this.append(P[0],P[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(P){this.append(P,D[P])},this)}g.prototype.append=function(D,P){D=h(D),P=d(P);var X=this.map[D];this.map[D]=X?X+", "+P:P},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,P){this.map[h(D)]=d(P)},g.prototype.forEach=function(D,P){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(P,this.map[X],X,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(P,X){D.push(X)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(P){D.push(P)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(P,X){D.push([X,P])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function C(D){return new Promise(function(P,X){D.onload=function(){P(D.result)},D.onerror=function(){X(D.error)}})}function Q(D){var P=new FileReader,X=C(P);return P.readAsArrayBuffer(D),X}function b(D){var P=new FileReader,X=C(P);return P.readAsText(D),X}function v(D){for(var P=new Uint8Array(D),X=new Array(P.length),_=0;_<P.length;_++)X[_]=String.fromCharCode(P[_]);return X.join("")}function x(D){if(D.slice)return D.slice(0);var P=new Uint8Array(D.byteLength);return P.set(new Uint8Array(D)),P.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=x(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=x(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(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(Q)}),this.text=function(){var D=p(this);if(D)return D;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(v(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(D){var P=D.toUpperCase();return k.indexOf(P)>-1?P:D}function K(D,P){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var X=P.body;if(D instanceof K){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,P.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new g(P.headers)),this.method=$(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}K.prototype.clone=function(){return new K(this,{body:this._bodyInit})};function O(D){var P=new FormData;return D.trim().split("&").forEach(function(X){if(X){var _=X.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");P.append(decodeURIComponent(S),decodeURIComponent(F))}}),P}function W(D){var P=new g,X=D.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(_){return _.indexOf(`
2454
+ `).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>n)a=[...a,...lc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(ci,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},lc({context:r,word:o[0],maxW:n})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),Ac=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function hp({text:r,font:e}){let t=e;return Ac.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}mo(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(ci,e[0].toString()),n.length<=0?[]:n.slice(1).reduce((i,s)=>{var o;const a=s.text,A=`${(o=i[i.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[i.length%e.length];r.font=r.font.replace(ci,u.toString()),i=[...i,{text:a,metrics:r.measureText(a),words:[s]}]}else i[i.length-1]={text:A,metrics:c,words:[...i[i.length-1].words,s]};return i},[{text:n[0].text,metrics:r.measureText(n[0].text),words:[n[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let cs;const dp=new Uint8Array(16);function fp(){if(!cs&&(cs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!cs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cs(dp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function gp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const cc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pp(r,e,t){if(cc.randomUUID&&!e&&!r)return cc.randomUUID();r=r||{};const n=r.random||(r.rng||fp)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return gp(n)}mo(({font:r,scale:e,context:t,maxW:n,maxH:i,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=up({context:t,fontSizes:[c],text:s,maxW:n});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>n||d.length*c>i){c-=1;break}}}else c=parseFloat(((A=(l=r.match(ci))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:n,scale:i,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${n}_${i}_${s}_${o}`});function mp(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function Ep(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const Ip=Xr(()=>iA.loadYoga());Ff.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Ep(r)}"`:mp(r)||Array.isArray(r)?JSON.stringify(r):r);const Cp="3";function vp(r){return typeof r=="number"?{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}:{topLeft:(r==null?void 0:r.topLeft)??0,topRight:(r==null?void 0:r.topRight)??0,bottomRight:(r==null?void 0:r.bottomRight)??0,bottomLeft:(r==null?void 0:r.bottomLeft)??0}}function yp(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function uc(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function hc(r,e,{layout:t,scale:n=1}){const{position:i="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:C="start",alignSelf:Q,justify:b="start"}=t??{},v={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(v[i]),s){const{top:$,right:K,bottom:O,left:W}=yp(s,n);typeof $<"u"&&e.setPosition(r.EDGE_TOP,$),typeof K<"u"&&e.setPosition(r.EDGE_RIGHT,K),typeof O<"u"&&e.setPosition(r.EDGE_BOTTOM,O),typeof W<"u"&&e.setPosition(r.EDGE_LEFT,W)}const x={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(x[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[C]),Q&&e.setAlignSelf(R[Q]);const k={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(k[b]),f){const{top:$,right:K,bottom:O,left:W}=uc(f,n);e.setMargin(r.EDGE_TOP,$),e.setMargin(r.EDGE_RIGHT,K),e.setMargin(r.EDGE_BOTTOM,O),e.setMargin(r.EDGE_LEFT,W)}if(g){const{top:$,right:K,bottom:O,left:W}=uc(g,n);e.setPadding(r.EDGE_TOP,$),e.setPadding(r.EDGE_RIGHT,K),e.setPadding(r.EDGE_BOTTOM,O),e.setPadding(r.EDGE_LEFT,W)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*n),typeof o<"u"&&e.setWidth(typeof o=="number"?o*n:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*n:a)),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*n:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*n:A),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*n:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*n:u)}async function dc({yoga:r,index:e,parent:t,element:n,resolvers:i}){var s,o;const{type:a,layout:l={},config:A,options:c,renderer:u}=n,h=r.Node.create();hc(r,h,{layout:l}),t.insertChild(h,e);let d=null;i&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="image"||(u==null?void 0:u.type)==="video")&&(d=await((s=i[u.type])==null?void 0:s.call(i,{config:A,options:c}))??null);const f=[];for await(const[g,p]of((o=n.children)==null?void 0:o.entries())??[])f.push(await dc({yoga:r,index:g,parent:h,element:p,resolvers:i}));return t.calculateLayout(),{type:a,node:h,radius:vp(l.radius),element:n,renderer:u,config:A,options:c,dependencies:d,childNodes:f}}function fc(r,e,t=0,n=0){const{top:i,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=n+o,h=e.childNodes.map(d=>fc(r,d,c,u));return{...e,x:s+c,y:i+u,width:l,height:A,childNodes:h}}async function Xo(r,e,t){for await(const{node:n,options:i,dependencies:s,renderer:o,childNodes:a}of e){if(o){const{width:l,height:A}=o;if(l){const c=await l({node:n,options:i,dependencies:s,measureCanvas:t});n.setWidth(c)}if(await Xo(r,a,t),A){const c=await A({node:n,options:i,dependencies:s,measureCanvas:t});n.setHeight(c)}}await Xo(r,a,t)}r.calculateLayout()}async function gc({root:r,resolvers:e,measureCanvas:t}){const n=await Ip(),i=n.Node.create();hc(n,i,{layout:r.layout});const s=await dc({yoga:n,index:0,parent:i,element:r.element,resolvers:e});await Xo(i,[s],t);const{top:o,left:a,width:l,height:A}=i.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:fc(i,s)};return i.freeRecursive(),c}async function Bp({scene:r,start:e=0}){const{root:t,duration:n}=r,i=await gc({root:t});return{type:r.type,start:e,duration:n,layout:i,id:r.id,config:r}}async function pc(){return document.createElement("canvas")}function vn(r){let e=0;for(const t of r)Array.isArray(t)?e+=vn(t):e+=t;return e}function Tp(r){return r.map(({type:e,duration:t},n)=>{var i,s,o,a;if(e==="transition"){const l=((i=r[n-2])==null?void 0:i.type)==="transition"?r[n-2]:null,A=((s=r[n-1])==null?void 0:s.duration)??1/0,c=((o=r[n+1])==null?void 0:o.duration)??1/0,u=((a=r[n+2])==null?void 0:a.type)==="transition"?r[n+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function mc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return mc(t)}).filter(Boolean))??[]}}function Ec({node:r,duration:e}){const t=[];r.type==="recipe"&&t.push({id:pp(),type:"scene",x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:mc({...r.element,layout:{...r.element.layout,position:"static",width:"100%",height:"100%",margin:0}})}});for(const n of r.childNodes)t.push(...Ec({node:n,duration:e}));return t}async function Ic({node:r,canvases:e,sceneTime:t}){var n,i;await((i=(n=r.renderer)==null?void 0:n.render)==null?void 0:i.call(n,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,radius:r.radius,options:r.options,dependencies:r.dependencies}));const{sceneCanvas:s}=e,o=s.getContext("2d");o&&(o.strokeStyle="red",o.strokeRect(r.x,r.y,r.width,r.height));for await(const a of r.childNodes)await Ic({node:a,canvases:e,sceneTime:t})}async function Qp({layout:r,canvases:e,sceneTime:t}){const{node:n}=r;await Ic({node:n,canvases:e,sceneTime:t})}async function bp({scene:r,start:e=0,resolvers:t,rootWidth:n,rootHeight:i,canvasFactory:s=pc}){var o,a;const{x:l,y:A,width:c,height:u,root:h,duration:d}=r,f=await s(),g=await s(),p=await s(),C=await s(),Q=await s(),b=await s(),v=await gc({root:{...h,layout:{...h.layout,width:n,height:i},element:{...h.element,layout:{...h.element.layout,...typeof l=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:l}}:{},width:c??((o=h.element.layout)==null?void 0:o.width),height:u??((a=h.element.layout)==null?void 0:a.height)}}},resolvers:t,measureCanvas:b}),x=async R=>{const k=Math.max(0,R-e);f.width=f.height=0,f.width=n,f.height=i,await Qp({layout:v,sceneTime:k,canvases:{sceneCanvas:f,cropCanvas:p,letterboxCanvas:C,posterCanvas:Q}})};return{type:r.type,draw:x,start:e,duration:d,layout:v,sceneCanvas:f,transitionCanvas:g,id:r.id,config:r,childScenes:Ec({node:v.node,duration:d})}}function xp(r){return r.some(({type:e})=>e==="scene"||e==="transition")}function wp(r){return r.type==="video"}const Sp=(((ac=oc)==null?void 0:ac.default)??oc).reduce((r,e)=>(r[e.name]=e,r),{});function Rp({name:r,canvas:e,to:t,from:n,progress:i}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=os)==null?void 0:s.default)??os)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=os)==null?void 0:o.default)??os)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=sc)==null?void 0:a.default)??sc)(l,Sp[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Cc({config:r,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i=pc}){const s=await Promise.all(r.tracks.map(async l=>{const A=Tp(l);if(!xp(l)){const f=await Promise.all(l.reduce((C,Q,b)=>{if(Q.type!=="audio")return C;const v=vn(A.slice(0,b));return C.push(Bp({scene:Q,start:v})),C},[])),g=l.reduce((C,Q,b)=>{if(Q.type!=="gap")return C;const v=vn(A.slice(0,b));return C.push({type:Q.type,id:Q.id,start:v,config:Q,duration:Q.duration}),C},[]),p=l.map(({id:C})=>f.find(({id:Q})=>Q===C)??g.find(({id:Q})=>Q===C)).filter(Boolean);return{type:"audio",scenes:f,gapScenes:g,mergedScenes:p,config:l,duration:Math.max(...p.map(({start:C,duration:Q})=>C+Q))}}const c=await Promise.all(l.reduce((f,g,p)=>{if(g.type!=="scene")return f;const C=vn(A.slice(0,p));return f.push(bp({scene:g,start:C,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i})),f},[])),u=l.reduce((f,g,p)=>{if(g.type!=="gap")return f;const C=vn(A.slice(0,p));return f.push({type:g.type,id:g.id,start:C,config:g,duration:g.duration}),f},[]),h=l.reduce((f,g,p)=>{if(g.type!=="transition")return f;const C=g.duration,Q=vn(A.slice(0,p))-C;return f.push({type:g.type,id:g.id,name:g.name,start:Q,duration:C,config:g,to:c.find(({id:b})=>{var v;return b===((v=l[p+1])==null?void 0:v.id)}),from:c.find(({id:b})=>{var v;return b===((v=l[p-1])==null?void 0:v.id)})}),f},[]),d=l.map(({id:f})=>c.find(({id:g})=>g===f)??u.find(({id:g})=>g===f)??h.find(({id:g})=>g===f)).filter(Boolean);return{type:"video",scenes:c,gapScenes:u,transitions:h,mergedScenes:d,config:l,duration:Math.max(...d.map(({start:f,duration:g})=>f+g)),trackCanvas:await i()}}));console.log({tracks:s});const o=await i();return{draw:async({canvas:l,currentTime:A})=>{const c=l.getContext("2d");if(c){c.globalAlpha=1,c.globalCompositeOperation="source-over",c.clearRect(0,0,l.width,l.height),c.save(),c.fillStyle="black",c.fillRect(0,0,l.width,l.height),c.restore();for await(const u of s){if(!wp(u))continue;const{scenes:h,transitions:d,trackCanvas:f}=u;f.width=f.height=0,f.width=l.width,f.height=l.height;const g=h.filter(({start:C,duration:Q})=>A>=C&&A<C+Q);if(g.length<=0)continue;const p=d.find(({start:C,duration:Q})=>A>=C&&A<C+Q);for await(const{id:C,start:Q,duration:b,sceneCanvas:v,transitionCanvas:x,draw:R}of g)if(await(R==null?void 0:R(A)),!p)c.drawImage(v,0,0,v.width,v.height);else{const{name:k,to:$,from:K,duration:O}=p;o.width=o.height=x.width=x.height=0,o.width=x.width=v.width,o.height=x.height=v.height;const W=($==null?void 0:$.id)===C,ie=(K==null?void 0:K.id)===C,te=W&&$.sceneCanvas||o,le=ie&&K.sceneCanvas||o,D=W?Math.min(1,Math.max(0,(A-Q)/O)):Math.min(1,Math.max(0,1-(Q+b-A)/O));Rp({name:k,progress:D,to:te,from:le,canvas:x});const P=f.getContext("2d");if(!P)return;P.globalCompositeOperation="lighter",P.drawImage(x,0,0,x.width,x.height)}c.drawImage(f,0,0,f.width,f.height)}}},tracks:s,duration:Math.max(...s.map(({duration:l})=>l))}}const Dp={name:"@vouchfor/embeds",version:"0.0.0-experiment.fcfd44c",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:"experiment",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","test:watch":"yarn test --watch"},"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":"0.0.0-experiment.fcfd44c","@vouchfor/media-player":"0.0.0-experiment.fcfd44c",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":"0.0.0-experiment.fcfd44c","@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 _p(r){const{publicApiUrl:e}=$i(r),t=kr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Lp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:kr()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),n=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const i=kr();return e||(e=_p(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=kr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=kr(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",n)),{client:t,tab:n,request:i,visitor:e}}function Fp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function kp(r="embedded_player"){var i,s;const[e,t]=((s=(i=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:i.split)==null?void 0:s.call(i,"/"))??[],n={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());n[l]=a}}),{source:r,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:Dp.version,templateVersion:Cp,...n}}const vc=1;class Np{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=Fp(n,this.host.vouch);!i||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...n,vouchId:i,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=$i(this.host.env),{client:n,tab:i,request:s,visitor:o}=Lp(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":n,"x-uid-tab":i,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":kp(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+vc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]}},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:n}})=>{this._answersViewed[n]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[n]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:n,node:i}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:n,node:i},this._streamLatestTime[n]=i.currentTime,this._streamStartTime[n]||(this._streamStartTime[n]=i.currentTime,this._streamLatestTime[n]=i.currentTime))},this._handleVideoPause=({detail:{id:t,key:n}})=>{this._streamLatestTime[n]>this._streamStartTime[n]+vc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]},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,n,i;"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),(n=this.host.mediaPlayer)==null||n.addEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,n,i;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),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var jo={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof En<"u"&&En,n=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={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 A(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var P={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return l.iterable&&(P[Symbol.iterator]=function(){return P}),P}function g(D){this.map={},D instanceof g?D.forEach(function(P,X){this.append(X,P)},this):Array.isArray(D)?D.forEach(function(P){this.append(P[0],P[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(P){this.append(P,D[P])},this)}g.prototype.append=function(D,P){D=h(D),P=d(P);var X=this.map[D];this.map[D]=X?X+", "+P:P},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,P){this.map[h(D)]=d(P)},g.prototype.forEach=function(D,P){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(P,this.map[X],X,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(P,X){D.push(X)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(P){D.push(P)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(P,X){D.push([X,P])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function C(D){return new Promise(function(P,X){D.onload=function(){P(D.result)},D.onerror=function(){X(D.error)}})}function Q(D){var P=new FileReader,X=C(P);return P.readAsArrayBuffer(D),X}function b(D){var P=new FileReader,X=C(P);return P.readAsText(D),X}function v(D){for(var P=new Uint8Array(D),X=new Array(P.length),_=0;_<P.length;_++)X[_]=String.fromCharCode(P[_]);return X.join("")}function x(D){if(D.slice)return D.slice(0);var P=new Uint8Array(D.byteLength);return P.set(new Uint8Array(D)),P.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=x(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=x(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(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(Q)}),this.text=function(){var D=p(this);if(D)return D;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(v(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(D){var P=D.toUpperCase();return k.indexOf(P)>-1?P:D}function K(D,P){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var X=P.body;if(D instanceof K){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,P.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new g(P.headers)),this.method=$(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}K.prototype.clone=function(){return new K(this,{body:this._bodyInit})};function O(D){var P=new FormData;return D.trim().split("&").forEach(function(X){if(X){var _=X.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");P.append(decodeURIComponent(S),decodeURIComponent(F))}}),P}function W(D){var P=new g,X=D.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(_){return _.indexOf(`
2455
2455
  `)===0?_.substr(1,_.length):_}).forEach(function(_){var S=_.split(":"),F=S.shift().trim();if(F){var J=S.join(":").trim();P.append(F,J)}}),P}R.call(K.prototype);function ie(D,P){if(!(this instanceof ie))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new g(P.headers),this.url=P.url||"",this._initBody(D)}R.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},ie.error=function(){var D=new ie(null,{status:0,statusText:""});return D.type="error",D};var te=[301,302,303,307,308];ie.redirect=function(D,P){if(te.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:D}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,X){this.message=P,this.name=X;var _=Error(P);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function le(D,P){return new Promise(function(X,_){var S=new K(D,P);if(S.signal&&S.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function J(){F.abort()}F.onload=function(){var ne={status:F.status,statusText:F.statusText,headers:W(F.getAllResponseHeaders()||"")};ne.url="responseURL"in F?F.responseURL:ne.headers.get("X-Request-URL");var ce="response"in F?F.response:F.responseText;setTimeout(function(){X(new ie(ce,ne))},0)},F.onerror=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.onabort=function(){setTimeout(function(){_(new o.DOMException("Aborted","AbortError"))},0)};function Y(ne){try{return ne===""&&a.location.href?a.location.href:ne}catch{return ne}}F.open(S.method,Y(S.url),!0),S.credentials==="include"?F.withCredentials=!0:S.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(l.blob?F.responseType="blob":l.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(F.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof g)?Object.getOwnPropertyNames(P.headers).forEach(function(ne){F.setRequestHeader(ne,d(P.headers[ne]))}):S.headers.forEach(function(ne,ce){F.setRequestHeader(ce,ne)}),S.signal&&(S.signal.addEventListener("abort",J),F.onreadystatechange=function(){F.readyState===4&&S.signal.removeEventListener("abort",J)}),F.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return le.polyfill=!0,a.fetch||(a.fetch=le,a.Headers=g,a.Request=K,a.Response=ie),o.Headers=g,o.Request=K,o.Response=ie,o.fetch=le,o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=t.fetch?t:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(jo,jo.exports);var Mp=jo.exports;const yc=Eo(Mp);async function Pp(r){var e;try{if((e=await yc(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function zo({sources:r}){let e=null;const t=r==null?void 0:r.filter(Boolean),n=t==null?void 0:t.find(s=>s.startsWith("blob:")),i=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(n||i)return n??i;if(t.length>0){const s=t.map(o=>Pp(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Op(r){try{return(await yc(r)).text()}catch{return null}}async function Up(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?Op(r):r}const Gp=Xr(async({original:r,translation:e,originalLanguage:t="",translationLanguage:n=""},{language:i})=>{var s,o;const a={[(s=n==null?void 0:n.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},l=(i&&a[i])??r;return l?Up(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function Hp(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var n;return{text:(n=t.alternatives[0])==null?void 0:n.content,start:t.start_time,end:t.end_time}}))??[]}const $p=Xr(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([zo({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input]}),zo({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),zo({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,n,i,s,o,a,l,A,c,u;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function Bc(r){var e,t,n,i,s,o,a,l,A,c,u,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(i=(n=r==null?void 0:r.answer)==null?void 0:n.contact)==null?void 0:i.name)==null?void 0:s.trim())??"",f=((l=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const Yp=Xr(async(r,e,t)=>{var n,i,s;const o=(n=e==null?void 0:e.answer)==null?void 0:n.id;return((s=(i=r==null?void 0:r.questions)==null?void 0:i.items)==null?void 0:s.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([r,e,t])=>{var n;return JSON.stringify({index:t,rootData:e,allQuestions:(n=r==null?void 0:r.questions)==null?void 0:n.items})}});async function Zo({data:r,rootData:e,index:t},n){var i,s,o,a,l,A,c,u,h,d,f,g,p,C,Q,b,v,x,R,k,$,K,O,W;const[ie,te,le]=await Promise.all([Yp(r,e,t),$p(e),Gp({original:((s=(i=e==null?void 0:e.answer)==null?void 0:i.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.translation)??((u=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:u.translation),originalLanguage:(d=(h=e==null?void 0:e.answer)==null?void 0:h.transcription)==null?void 0:d.language,translationLanguage:(p=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},n)]),D=Bc(e);return{...te,...D,key:ie,captions:le,wordTimings:Hp((C=e==null?void 0:e.answer)==null?void 0:C.transcription),answerLabel:((Q=e==null?void 0:e.answer)==null?void 0:Q.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((R=(x=(v=(b=r==null?void 0:r.questions)==null?void 0:b.items)==null?void 0:v[t-1])==null?void 0:x.answer)==null?void 0:R.label)??((K=($=(k=r==null?void 0:r.questions)==null?void 0:k.items)==null?void 0:$[t-1])==null?void 0:K.title)??null:null,isFirstInstanceOfName:t?((W=(O=r==null?void 0:r.questions)==null?void 0:O.items)==null?void 0:W.findIndex(P=>Bc(P).name===D.name))===t:!0}}const us={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 Vp({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((n,i)=>{var s,o,a,l,A,c,u;const h=(a=(o=(s=i==null?void 0:i.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(u=(c=(A=(l=i==null?void 0:i.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&us[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:us[h]}),d&&us[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:us[d]}),n},[]))??[]}/**
2456
2456
  * @license
2457
2457
  * Copyright 2018 Google LLC
@@ -2489,7 +2489,7 @@ vec4 transition(vec2 uv) {
2489
2489
  * @license
2490
2490
  * Copyright 2017 Google LLC
2491
2491
  * SPDX-License-Identifier: BSD-3-Clause
2492
- */const Mh=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Ph=mn(class extends ti{constructor(r){if(super(r),r.type!==pn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],s=[];let o=0;for(const a of r)i[o]=n?n(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){const i=af(r),{values:s,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=i.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===o[d])l[d]=qr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=qr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=qr(i[u],s[f]),ei(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=qr(i[h],s[d]),ei(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=Mh(o,d,f),c=Mh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?i[g]:null;if(p===null){const C=ei(r,i[u]);qr(C,s[d]),l[d]=C}else l[d]=qr(p,s[d]),ei(r,i[u],p),i[g]=null;d++}else go(i[h]),h--;else go(i[u]),u++;for(;d<=f;){const g=ei(r,l[f+1]);qr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&go(g)}return this.ut=o,of(r,l),Xt}});var Ft="top",Kt="bottom",Jt="right",kt="left",el="auto",Ei=[Ft,Kt,Jt,kt],Fn="start",Ii="end",Cv="clippingParents",Oh="viewport",Ci="popper",vv="reference",Uh=Ei.reduce(function(r,e){return r.concat([e+"-"+Fn,e+"-"+Ii])},[]),Gh=[].concat(Ei,[el]).reduce(function(r,e){return r.concat([e,e+"-"+Fn,e+"-"+Ii])},[]),yv="beforeRead",Bv="read",Tv="afterRead",Qv="beforeMain",bv="main",xv="afterMain",wv="beforeWrite",Sv="write",Rv="afterWrite",Dv=[yv,Bv,Tv,Qv,bv,xv,wv,Sv,Rv];function dr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function on(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Wt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function tl(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function _v(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Wt(s)||!dr(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Lv(r){var e=r.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(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=o.reduce(function(l,A){return l[A]="",l},{});!Wt(i)||!dr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Hh={name:"applyStyles",enabled:!0,phase:"write",fn:_v,effect:Lv,requires:["computeStyles"]};function fr(r){return r.split("-")[0]}var an=Math.max,Ys=Math.min,kn=Math.round;function rl(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function $h(){return!/^((?!chrome|android).)*safari/i.test(rl())}function Nn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Wt(r)&&(i=r.offsetWidth>0&&kn(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&kn(n.height)/r.offsetHeight||1);var o=on(r)?Pt(r):window,a=o.visualViewport,l=!$h()&&t,A=(n.left+(l&&a?a.offsetLeft:0))/i,c=(n.top+(l&&a?a.offsetTop:0))/s,u=n.width/i,h=n.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function nl(r){var e=Nn(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function Yh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&tl(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Sr(r){return Pt(r).getComputedStyle(r)}function Fv(r){return["table","td","th"].indexOf(dr(r))>=0}function Ur(r){return((on(r)?r.ownerDocument:r.document)||window.document).documentElement}function Vs(r){return dr(r)==="html"?r:r.assignedSlot||r.parentNode||(tl(r)?r.host:null)||Ur(r)}function Vh(r){return!Wt(r)||Sr(r).position==="fixed"?null:r.offsetParent}function kv(r){var e=/firefox/i.test(rl()),t=/Trident/i.test(rl());if(t&&Wt(r)){var n=Sr(r);if(n.position==="fixed")return null}var i=Vs(r);for(tl(i)&&(i=i.host);Wt(i)&&["html","body"].indexOf(dr(i))<0;){var s=Sr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function vi(r){for(var e=Pt(r),t=Vh(r);t&&Fv(t)&&Sr(t).position==="static";)t=Vh(t);return t&&(dr(t)==="html"||dr(t)==="body"&&Sr(t).position==="static")?e:t||kv(r)||e}function il(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function yi(r,e,t){return an(r,Ys(e,t))}function Nv(r,e,t){var n=yi(r,e,t);return n>t?t:n}function Kh(){return{top:0,right:0,bottom:0,left:0}}function Jh(r){return Object.assign({},Kh(),r)}function Wh(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var Mv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Jh(typeof e!="number"?e:Wh(e,Ei))};function Pv(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=fr(t.placement),l=il(a),A=[kt,Jt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=Mv(i.padding,t),h=nl(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Jt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],C=vi(s),Q=C?l==="y"?C.clientHeight||0:C.clientWidth||0:0,b=g/2-p/2,v=u[d],x=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=yi(v,R,x),$=l;t.modifiersData[n]=(e={},e[$]=k,e.centerOffset=k-R,e)}}function Ov(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Yh(e.elements.popper,i)&&(e.elements.arrow=i))}const Uv={name:"arrow",enabled:!0,phase:"main",fn:Pv,effect:Ov,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Mn(r){return r.split("-")[1]}var Gv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Hv(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:kn(t*i)/i||0,y:kn(n*i)/i||0}}function qh(r){var e,t=r.popper,n=r.popperRect,i=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var C=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,v=Ft,x=window;if(A){var R=vi(t),k="clientHeight",$="clientWidth";if(R===Pt(t)&&(R=Ur(t),Sr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",$="scrollWidth")),R=R,i===Ft||(i===kt||i===Jt)&&s===Ii){v=Kt;var K=u&&R===x&&x.visualViewport?x.visualViewport.height:R[k];g-=K-n.height,g*=l?1:-1}if(i===kt||(i===Ft||i===Kt)&&s===Ii){b=Jt;var O=u&&R===x&&x.visualViewport?x.visualViewport.width:R[$];d-=O-n.width,d*=l?1:-1}}var W=Object.assign({position:a},A&&Gv),ie=c===!0?Hv({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var te;return Object.assign({},W,(te={},te[v]=Q?"0":"",te[b]=C?"0":"",te.transform=(x.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",te))}return Object.assign({},W,(e={},e[v]=Q?g+"px":"",e[b]=C?d+"px":"",e.transform="",e))}function $v(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:fr(e.placement),variation:Mn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,qh(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,qh(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Yv={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$v,data:{}};var Ks={passive:!0};function Vv(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,s=i===void 0?!0:i,o=n.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Ks)}),a&&l.addEventListener("resize",t.update,Ks),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Ks)}),a&&l.removeEventListener("resize",t.update,Ks)}}const Kv={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Vv,data:{}};var Jv={left:"right",right:"left",bottom:"top",top:"bottom"};function Js(r){return r.replace(/left|right|bottom|top/g,function(e){return Jv[e]})}var Wv={start:"end",end:"start"};function Xh(r){return r.replace(/start|end/g,function(e){return Wv[e]})}function sl(r){var e=Pt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function ol(r){return Nn(Ur(r)).left+sl(r).scrollLeft}function qv(r,e){var t=Pt(r),n=Ur(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=$h();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+ol(r),y:l}}function Xv(r){var e,t=Ur(r),n=sl(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=an(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=an(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+ol(r),l=-n.scrollTop;return Sr(i||t).direction==="rtl"&&(a+=an(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function al(r){var e=Sr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function jh(r){return["html","body","#document"].indexOf(dr(r))>=0?r.ownerDocument.body:Wt(r)&&al(r)?r:jh(Vs(r))}function Bi(r,e){var t;e===void 0&&(e=[]);var n=jh(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(n),o=i?[s].concat(s.visualViewport||[],al(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(Bi(Vs(o)))}function ll(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function jv(r,e){var t=Nn(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function zh(r,e,t){return e===Oh?ll(qv(r,t)):on(e)?jv(e,t):ll(Xv(Ur(r)))}function zv(r){var e=Bi(Vs(r)),t=["absolute","fixed"].indexOf(Sr(r).position)>=0,n=t&&Wt(r)?vi(r):r;return on(n)?e.filter(function(i){return on(i)&&Yh(i,n)&&dr(i)!=="body"}):[]}function Zv(r,e,t,n){var i=e==="clippingParents"?zv(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=zh(r,A,n);return l.top=an(c.top,l.top),l.right=Ys(c.right,l.right),l.bottom=Ys(c.bottom,l.bottom),l.left=an(c.left,l.left),l},zh(r,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Zh(r){var e=r.reference,t=r.element,n=r.placement,i=n?fr(n):null,s=n?Mn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Jt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?il(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case Fn:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Ii:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Ti(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?Cv:a,A=t.rootBoundary,c=A===void 0?Oh:A,u=t.elementContext,h=u===void 0?Ci:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,C=Jh(typeof p!="number"?p:Wh(p,Ei)),Q=h===Ci?vv:Ci,b=r.rects.popper,v=r.elements[f?Q:h],x=Zv(on(v)?v:v.contextElement||Ur(r.elements.popper),l,c,o),R=Nn(r.elements.reference),k=Zh({reference:R,element:b,strategy:"absolute",placement:i}),$=ll(Object.assign({},b,k)),K=h===Ci?$:R,O={top:x.top-K.top+C.top,bottom:K.bottom-x.bottom+C.bottom,left:x.left-K.left+C.left,right:K.right-x.right+C.right},W=r.modifiersData.offset;if(h===Ci&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Jt,Kt].indexOf(te)>=0?1:-1,D=[Ft,Kt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function ey(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Gh:l,c=Mn(n),u=c?a?Uh:Uh.filter(function(f){return Mn(f)===c}):Ei,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=Ti(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[fr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function ty(r){if(fr(r)===el)return[];var e=Js(r);return[Xh(r),e,Xh(e)]}function ry(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,C=fr(p),Q=C===p,b=l||(Q||!f?[Js(p)]:ty(p)),v=[p].concat(b).reduce(function(ce,pe){return ce.concat(fr(pe)===el?ey(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),x=e.rects.reference,R=e.rects.popper,k=new Map,$=!0,K=v[0],O=0;O<v.length;O++){var W=v[O],ie=fr(W),te=Mn(W)===Fn,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",P=Ti(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?te?Jt:kt:te?Kt:Ft;x[D]>R[D]&&(X=Js(X));var _=Js(X),S=[];if(s&&S.push(P[ie]<=0),a&&S.push(P[X]<=0,P[_]<=0),S.every(function(ce){return ce})){K=W,$=!1;break}k.set(W,S)}if($)for(var F=f?3:1,J=function(pe){var ge=v.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return K=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==K&&(e.modifiersData[n]._skip=!0,e.placement=K,e.reset=!0)}}const ny={name:"flip",enabled:!0,phase:"main",fn:ry,requiresIfExists:["offset"],data:{_skip:!1}};function ed(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function td(r){return[Ft,Jt,Kt,kt].some(function(e){return r[e]>=0})}function iy(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ti(e,{elementContext:"reference"}),a=Ti(e,{altBoundary:!0}),l=ed(o,n),A=ed(a,i,s),c=td(l),u=td(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const sy={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:iy};function oy(r,e,t){var n=fr(r),i=[kt,Ft].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[kt,Jt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function ay(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=Gh.reduce(function(c,u){return c[u]=oy(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[n]=o}const ly={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ay};function Ay(r){var e=r.state,t=r.name;e.modifiersData[t]=Zh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const cy={name:"popperOffsets",enabled:!0,phase:"read",fn:Ay,data:{}};function uy(r){return r==="x"?"y":"x"}function hy(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=Ti(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),C=fr(e.placement),Q=Mn(e.placement),b=!Q,v=il(C),x=uy(v),R=e.modifiersData.popperOffsets,k=e.rects.reference,$=e.rects.popper,K=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof K=="number"?{mainAxis:K,altAxis:K}:Object.assign({mainAxis:0,altAxis:0},K),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var te,le=v==="y"?Ft:kt,D=v==="y"?Kt:Jt,P=v==="y"?"height":"width",X=R[v],_=X+p[le],S=X-p[D],F=d?-$[P]/2:0,J=Q===Fn?k[P]:$[P],Y=Q===Fn?-$[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?nl(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Kh(),ge=pe[le],Se=pe[D],Le=yi(0,k[P],ce[P]),Ge=b?k[P]/2-F-Le-ge-O.mainAxis:J-Le-ge-O.mainAxis,fe=b?-k[P]/2+F+Le+Se+O.mainAxis:Y+Le+Se+O.mainAxis,Qe=e.elements.arrow&&vi(e.elements.arrow),Me=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[v])!=null?te:0,qe=X+Ge-we-Me,Te=X+fe-we,T=yi(d?Ys(_,qe):_,X,d?an(S,Te):S);R[v]=T,ie[v]=T-X}if(a){var m,E=v==="x"?Ft:kt,w=v==="x"?Kt:Jt,M=R[x],z=x==="y"?"height":"width",j=M+p[E],Ie=M-p[w],be=[Ft,kt].indexOf(C)!==-1,De=(m=W==null?void 0:W[x])!=null?m:0,ke=be?j:M-k[z]-$[z]-De+O.altAxis,_e=be?M+k[z]+$[z]-De-O.altAxis:Ie,Mt=d&&be?Nv(ke,M,_e):yi(d?ke:j,M,d?_e:Ie);R[x]=Mt,ie[x]=Mt-M}e.modifiersData[n]=ie}}const dy={name:"preventOverflow",enabled:!0,phase:"main",fn:hy,requiresIfExists:["offset"]};function fy(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function gy(r){return r===Pt(r)||!Wt(r)?sl(r):fy(r)}function py(r){var e=r.getBoundingClientRect(),t=kn(e.width)/r.offsetWidth||1,n=kn(e.height)/r.offsetHeight||1;return t!==1||n!==1}function my(r,e,t){t===void 0&&(t=!1);var n=Wt(e),i=Wt(e)&&py(e),s=Ur(e),o=Nn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((dr(e)!=="body"||al(s))&&(a=gy(e)),Wt(e)?(l=Nn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=ol(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ey(r){var e=new Map,t=new Set,n=[];r.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(s)}return r.forEach(function(s){t.has(s.name)||i(s)}),n}function Iy(r){var e=Ey(r);return Dv.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function Cy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function vy(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var rd={placement:"bottom",modifiers:[],strategy:"absolute"};function nd(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function yy(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?rd:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},rd,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(C){var Q=typeof C=="function"?C(c.options):C;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:on(a)?Bi(a):a.contextElement?Bi(a.contextElement):[],popper:Bi(l)};var b=Iy(vy([].concat(n,c.options.modifiers)));return c.orderedModifiers=b.filter(function(v){return v.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var C=c.elements,Q=C.reference,b=C.popper;if(nd(Q,b)){c.rects={reference:my(Q,vi(b),c.options.strategy==="fixed"),popper:nl(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(O){return c.modifiersData[O.name]=Object.assign({},O.data)});for(var v=0;v<c.orderedModifiers.length;v++){if(c.reset===!0){c.reset=!1,v=-1;continue}var x=c.orderedModifiers[v],R=x.fn,k=x.options,$=k===void 0?{}:k,K=x.name;typeof R=="function"&&(c=R({state:c,options:$,name:K,instance:d})||c)}}}},update:Cy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!nd(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var C=p.name,Q=p.options,b=Q===void 0?{}:Q,v=p.effect;if(typeof v=="function"){var x=v({state:c,name:C,instance:d,options:b}),R=function(){};u.push(x||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var By=[Kv,cy,Yv,Hh,ly,ny,dy,Uv,sy],Ty=yy({defaultModifiers:By}),Qy="tippy-box",id="tippy-content",by="tippy-backdrop",sd="tippy-arrow",od="tippy-svg-arrow",ln={passive:!0,capture:!0},ad=function(){return document.body};function Al(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function cl(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function ld(r,e){return typeof r=="function"?r.apply(void 0,e):r}function Ad(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function xy(r){return r.split(/\s+/).filter(Boolean)}function Pn(r){return[].concat(r)}function cd(r,e){r.indexOf(e)===-1&&r.push(e)}function wy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function Sy(r){return r.split("-")[0]}function Ws(r){return[].slice.call(r)}function ud(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function Qi(){return document.createElement("div")}function qs(r){return["Element","Fragment"].some(function(e){return cl(r,e)})}function Ry(r){return cl(r,"NodeList")}function Dy(r){return cl(r,"MouseEvent")}function _y(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function Ly(r){return qs(r)?[r]:Ry(r)?Ws(r):Array.isArray(r)?r:Ws(document.querySelectorAll(r))}function ul(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function hd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Fy(r){var e,t=Pn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function ky(r,e){var t=e.clientX,n=e.clientY;return r.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,A=Sy(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-n+u>l,p=n-s.bottom-h>l,C=s.left-t+d>l,Q=t-s.right-f>l;return g||p||C||Q})}function hl(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function dd(r,e){for(var t=e;t;){var n;if(r.contains(t))return!0;t=t.getRootNode==null||(n=t.getRootNode())==null?void 0:n.host}return!1}var gr={isTouch:!1},fd=0;function Ny(){gr.isTouch||(gr.isTouch=!0,window.performance&&document.addEventListener("mousemove",gd))}function gd(){var r=performance.now();r-fd<20&&(gr.isTouch=!1,document.removeEventListener("mousemove",gd)),fd=r}function My(){var r=document.activeElement;if(_y(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function Py(){document.addEventListener("touchstart",Ny,ln),window.addEventListener("blur",My)}var Oy=typeof window<"u"&&typeof document<"u",Uy=Oy?!!window.msCrypto:!1,Gy={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Hy={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:ad,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},Gy,Hy),$y=Object.keys(tr),Yy=function(e){var t=Object.keys(e);t.forEach(function(n){tr[n]=e[n]})};function pd(r){var e=r.plugins||[],t=e.reduce(function(n,i){var s=i.name,o=i.defaultValue;if(s){var a;n[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function Vy(r,e){var t=e?Object.keys(pd(Object.assign({},tr,{plugins:e}))):$y,n=t.reduce(function(i,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return n}function md(r,e){var t=Object.assign({},e,{content:ld(e.content,[r])},e.ignoreAttributes?{}:Vy(r,e.plugins));return t.aria=Object.assign({},tr.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 Ky=function(){return"innerHTML"};function dl(r,e){r[Ky()]=e}function Ed(r){var e=Qi();return r===!0?e.className=sd:(e.className=od,qs(r)?e.appendChild(r):dl(e,r)),e}function Id(r,e){qs(e.content)?(dl(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?dl(r,e.content):r.textContent=e.content)}function fl(r){var e=r.firstElementChild,t=Ws(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(id)}),arrow:t.find(function(n){return n.classList.contains(sd)||n.classList.contains(od)}),backdrop:t.find(function(n){return n.classList.contains(by)})}}function Cd(r){var e=Qi(),t=Qi();t.className=Qy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=Qi();n.className=id,n.setAttribute("data-state","hidden"),Id(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=fl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Id(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(Ed(o.arrow))):l.appendChild(Ed(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}Cd.$$tippy=!0;var Jy=1,Xs=[],gl=[];function Wy(r,e){var t=md(r,Object.assign({},tr,pd(ud(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=Ad(qe,t.interactiveDebounce),g,p=Jy++,C=null,Q=wy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:p,reference:r,popper:Qi(),popperInstance:C,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Mt,show:ut,hide:Ut,hideWithInteractivity:Er,enable:be,disable:De,unmount:Ir,destroy:Tt};if(!t.render)return v;var x=t.render(v),R=x.popper,k=x.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+v.id,v.popper=R,r._tippy=v,R._tippy=v;var $=Q.map(function(q){return q.fn(v)}),K=r.hasAttribute("aria-expanded");return Qe(),F(),X(),_("onCreate",[v]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),v;function O(){var q=v.props.touch;return Array.isArray(q)?q:[q,0]}function W(){return O()[0]==="hold"}function ie(){var q;return!!((q=v.props.render)!=null&&q.$$tippy)}function te(){return g||r}function le(){var q=te().parentNode;return q?Fy(q):document}function D(){return fl(R)}function P(q){return v.state.isMounted&&!v.state.isVisible||gr.isTouch||c&&c.type==="focus"?0:Al(v.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=v.props.interactive&&!q?"":"none",R.style.zIndex=""+v.props.zIndex}function _(q,de,Ce){if(Ce===void 0&&(Ce=!0),$.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),Ce){var Pe;(Pe=v.props)[q].apply(Pe,de)}}function S(){var q=v.props.aria;if(q.content){var de="aria-"+q.content,Ce=R.id,Pe=Pn(v.props.triggerTarget||r);Pe.forEach(function(Fe){var Xe=Fe.getAttribute(de);if(v.state.isVisible)Fe.setAttribute(de,Xe?Xe+" "+Ce:Ce);else{var xt=Xe&&Xe.replace(Ce,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(K||!v.props.aria.expanded)){var q=Pn(v.props.triggerTarget||r);q.forEach(function(de){v.props.interactive?de.setAttribute("aria-expanded",v.state.isVisible&&de===te()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),Xs=Xs.filter(function(q){return q!==f})}function Y(q){if(!(gr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(v.props.interactive&&dd(R,de))){if(Pn(v.props.triggerTarget||r).some(function(Ce){return dd(Ce,de)})){if(gr.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[v,q]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,ln),q.addEventListener("touchstart",ce,ln),q.addEventListener("touchmove",ne,ln)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,ln),q.removeEventListener("touchstart",ce,ln),q.removeEventListener("touchmove",ne,ln)}function Se(q,de){Ge(q,function(){!v.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var Ce=D().box;function Pe(Fe){Fe.target===Ce&&(hl(Ce,"remove",Pe),de())}if(q===0)return de();hl(Ce,"remove",u),hl(Ce,"add",Pe),u=Pe}function fe(q,de,Ce){Ce===void 0&&(Ce=!1);var Pe=Pn(v.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,Ce),d.push({node:Fe,eventType:q,handler:de,options:Ce})})}function Qe(){W()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),xy(v.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(Uy?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Me(){d.forEach(function(q){var de=q.node,Ce=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(Ce,Pe,Fe)}),d=[]}function we(q){var de,Ce=!1;if(!(!v.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!v.state.isVisible&&Dy(q)&&Xs.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?Ce=!0:j(q),q.type==="click"&&(o=!Ce),Ce&&!Pe&&Ie(q)}}function qe(q){var de=q.target,Ce=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&Ce)){var Pe=z().concat(R).map(function(Fe){var Xe,xt=Fe._tippy,wt=(Xe=xt.popperInstance)==null?void 0:Xe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);ky(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||v.props.trigger.indexOf("click")>=0&&o;if(!de){if(v.props.interactive){v.hideWithInteractivity(q);return}Ie(q)}}function T(q){v.props.trigger.indexOf("focusin")<0&&q.target!==te()||v.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return gr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){w();var q=v.props,de=q.popperOptions,Ce=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,Xe=q.moveTransition,xt=ie()?fl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,$n={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Yn){var Yr=Yn.state;if(ie()){var _i=D(),Li=_i.box;["placement","reference-hidden","escaped"].forEach(function(Vn){Vn==="placement"?Li.setAttribute("data-placement",Yr.placement):Yr.attributes.popper["data-popper-"+Vn]?Li.setAttribute("data-"+Vn,""):Li.removeAttribute("data-"+Vn)}),Yr.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Xe}},$n];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),v.popperInstance=Ty(wt,R,Object.assign({},de,{placement:Ce,onFirstUpdate:h,modifiers:St}))}function w(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function M(){var q=v.props.appendTo,de,Ce=te();v.props.interactive&&q===ad||q==="parent"?de=Ce.parentNode:de=ld(q,[Ce]),de.contains(R)||de.appendChild(R),v.state.isMounted=!0,E()}function z(){return Ws(R.querySelectorAll("[data-tippy-root]"))}function j(q){v.clearDelayTimeouts(),q&&_("onTrigger",[v,q]),pe();var de=P(!0),Ce=O(),Pe=Ce[0],Fe=Ce[1];gr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?n=setTimeout(function(){v.show()},de):v.show()}function Ie(q){if(v.clearDelayTimeouts(),_("onUntrigger",[v,q]),!v.state.isVisible){ge();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=P(!1);de?i=setTimeout(function(){v.state.isVisible&&v.hide()},de):s=requestAnimationFrame(function(){v.hide()})}}function be(){v.state.isEnabled=!0}function De(){v.hide(),v.state.isEnabled=!1}function ke(){clearTimeout(n),clearTimeout(i),cancelAnimationFrame(s)}function _e(q){if(!v.state.isDestroyed){_("onBeforeUpdate",[v,q]),Me();var de=v.props,Ce=md(r,Object.assign({},de,ud(q),{ignoreAttributes:!0}));v.props=Ce,Qe(),de.interactiveDebounce!==Ce.interactiveDebounce&&(J(),f=Ad(qe,Ce.interactiveDebounce)),de.triggerTarget&&!Ce.triggerTarget?Pn(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):Ce.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,Ce),v.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,q])}}function Mt(q){v.setProps({content:q})}function ut(){var q=v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=gr.isTouch&&!v.props.touch,Fe=Al(v.props.duration,0,tr.duration);if(!(q||de||Ce||Pe)&&!te().hasAttribute("disabled")&&(_("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),v.state.isMounted||(R.style.transition="none"),ie()){var Xe=D(),xt=Xe.box,wt=Xe.content;ul([xt,wt],0)}h=function(){var St;if(!(!v.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=v.props.moveTransition,ie()&&v.props.animation){var dn=D(),Yn=dn.box,Yr=dn.content;ul([Yn,Yr],Fe),hd([Yn,Yr],"visible")}S(),F(),cd(gl,v),(St=v.popperInstance)==null||St.forceUpdate(),_("onMount",[v]),v.props.animation&&ie()&&Le(Fe,function(){v.state.isShown=!0,_("onShown",[v])})}},M()}}function Ut(){var q=!v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=Al(v.props.duration,1,tr.duration);if(!(q||de||Ce)&&(_("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),X(!0),ie()){var Fe=D(),Xe=Fe.box,xt=Fe.content;v.props.animation&&(ul([Xe,xt],Pe),hd([Xe,xt],"hidden"))}S(),F(),v.props.animation?ie()&&Se(Pe,v.unmount):v.unmount()}}function Er(q){le().addEventListener("mousemove",f),cd(Xs,f),f(q)}function Ir(){v.state.isVisible&&v.hide(),v.state.isMounted&&(w(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),gl=gl.filter(function(q){return q!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Tt(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Me(),delete r._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function An(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);Py();var n=Object.assign({},e,{plugins:t}),i=Ly(r),s=i.reduce(function(o,a){var l=a&&Wy(a,n);return l&&o.push(l),o},[]);return qs(r)?s[0]:s}An.defaultProps=tr,An.setDefaultProps=Yy,An.currentInput=gr,Object.assign({},Hh,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),An.setDefaultProps({render:Cd});function Rr(r){var e,t;const n=[];return(((e=r.renderer)==null?void 0:e.type)==="video"||((t=r.renderer)==null?void 0:t.type)==="audio")&&n.push({...r.config,...r.options}),n.push(...r.childNodes.flatMap(Rr).filter(Boolean)),n}class js extends Error{constructor(e,t=new Error,n=!1){super(),this.fatal=!1,this.fatal=n,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}function Gr(r,e,t){return Math.min(Math.max(e,r),t)}const qy=5;function Xy(r,e){return r.length!==e.length||r.some((t,n)=>t!==e[n])}class jy{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){Xy(e,this._activeScenes)&&(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,n,i;const s=Gr(0,e,this.host.duration);this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((n=this.host.composition)==null?void 0:n.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A})=>s>=A-qy&&s<A)),[]))??[],this.loadScenes(),this.syncMediaState(),(i=this._controls.value)==null||i.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return Ct(this._canvas)}controls(){return Ct(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{Rr(e.layout.node).forEach(n=>{var i,s,o;const{start:a,duration:l}=e,A=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(this.host.media[n.key]){const c=this.host.media[n.key],{speed:u,volume:h,hls:d,node:f,start:g,duration:p}=c,C=this.host.mediaState[n.key];f&&C&&(f.currentTime>=g+p||f.ended||A&&(d?(i=d.startLoadOnce)==null||i.call(d,g):C.initialised||(s=f.startLoadOnce)==null||s.call(f),f.volume=Gr(0,this.host.volume*(h??1),1),f.playbackRate=Gr(.1,this.host.playbackRate*(u??1),4)))}else if(A){const c=`${a}-${l}`,u=this.host._sceneController.mediaState[c];this.host.duration&&!((o=u==null?void 0:u.buffered)!=null&&o.length)&&(this.host._sceneController.mediaState={...this.host._sceneController.mediaState,[c]:{...u,buffered:[{start:Math.max(0,a/this.host.duration*100),end:Math.min((a+l)/this.host.duration*100,100)}]}})}})})}syncMediaState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var n;(n=t.scenes)==null||n.forEach(i=>{Rr(i.layout.node).forEach(o=>{if(this.host.media[o.key]){const a=this.host.media[o.key],{node:l}=a,A=this.host.mediaState[o.key],c=this.activeScenes.includes(i);if(A)if(c&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(l.paused&&A.initialised)try{return l.play()}catch(u){throw new js("Video play error",u,!0)}}else l.paused||l.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,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)}}async function vd(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function zy(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Zy(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function eB(r){return new Promise(async e=>{let t=null;const{type:n,key:i,src:s,duration:o,startOffset:a,endOffset:l}=r;n==="video"?(t=document.createElement("video"),t.playsInline=!0):t=document.createElement("audio"),t.muted=!0,t.loop=!1,t.src=s;let A=!1;if(t.startLoadOnce=()=>{A||(t.preload="auto",t.load(),A=!0)},n==="video"&&o&&r.aspectRatio){t.preload="none";const c=(a??0)*o,u=(1-(l??0))*o;e({key:i,hls:null,node:t,start:c,duration:u-c,aspectRatio:r.aspectRatio})}else{t.preload="metadata";const c=async()=>{const u=await vd(t),h=(a??0)*u,d=(1-(l??0))*u;e({key:i,hls:null,node:t,start:h,duration:d-h,aspectRatio:t instanceof HTMLVideoElement?t.videoWidth/t.videoHeight:null}),t.removeEventListener("loadedmetadata",c)};t.addEventListener("loadedmetadata",c)}})}function tB({key:r,playlist:e,startOffset:t,endOffset:n}){return new Promise(i=>{const s=document.createElement("video");s instanceof HTMLVideoElement&&(s.playsInline=!0),s.muted=!0,s.loop=!1;let o=!1;const a=new wr({autoStartLoad:!0,xhrSetup:l=>{const{open:A}=l,c=e.split("?")[1];l.open=function(u,h,d){c&&!h.toString().includes("?")&&(h+="?"+c),!(!o&&h.toString().includes(".ts"))&&A.apply(this,[u,h,d])}}});a.on(wr.Events.LEVEL_LOADED,async()=>{o||a==null||a.stopLoad();const l=await vd(s),A=(t??0)*l,c=(1-(n??0))*l;i({key:r,hls:a,node:s,start:A,duration:c-A,aspectRatio:a.levels[0].width/a.levels[0].height})}),a.loadSource(e),a.attachMedia(s),a.startLoadOnce=(l=-1,A)=>{if(a&&!o){const c=a.levels.findIndex(u=>Math.min(u.height,u.width)===A);o=!0,a.startLevel=a.firstLevel,a.startLoad(l),a.currentLevel=c!==-1?c:a.firstLevel}}})}function rB(r){const{playlist:e}=r;return e&&!zy()&&wr.isSupported()?tB({...r,playlist:e}):eB(r)}const nB=Xr(async function(e){const{weight:t,family:n}=e,{client:i,server:s}=n.weights.find(a=>a.weight===t)??{};return!i&&!s?null:new FontFace(e.family.name,`url(${i??s})`,{weight:t,style:"normal"}).load()},{cacheKey:([r])=>JSON.stringify(r)});let iB=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._media={},this._mediaState={},this._compositionController=new AbortController,this._delayProcessing=(t=100)=>{const n=new AbortController,i=setTimeout(()=>{n.signal.aborted||(this.host._processing=!0)},t);return n.signal.addEventListener("abort",()=>{clearTimeout(i)}),n},this._createImageResolver=Xr(async({config:t})=>t.src?new Promise((n,i)=>{const s=new Image;s.onload=()=>{n({image:s})},s.onerror=o=>{i(o)},s.src=t.src}):{image:null},{cacheKey:([{config:t}])=>JSON.stringify(t)}),this._mediaFactory=Xr(async t=>{const{key:n}=t,i=await rB(t),s={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},o=Object.keys(s).reduce((a,l)=>{const A=l,c=s[A]({key:n,node:i.node});return a[A]=c,i.node.addEventListener(l,c),a},{});return{media:i,listeners:o,aspectRatio:i.aspectRatio,source:()=>i.node}},{cacheKey:([{key:t,src:n,playlist:i}])=>JSON.stringify({key:t,src:n==null?void 0:n.split("?")[0],playlist:i==null?void 0:i.split("?")[0]})}),this._handleLoadedData=({id:t,key:n,node:i})=>()=>{const s=this.mediaState[n];s!=null&&s.initialised||(this.mediaState={...this.mediaState,[n]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setMediaCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:n,node:i}})))},this._handleWaiting=({key:t})=>()=>{const n=this.mediaState[t];n!=null&&n.initialised&&!(n!=null&&n.waiting)&&(this.mediaState={...this.mediaState,[t]:{...n,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const n=this.mediaState[t];n!=null&&n.initialised&&(n!=null&&n.waiting)&&(this.mediaState={...this.mediaState,[t]:{...n,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:n,node:i}}))},this._handleSeeked=({id:t,key:n,node:i})=>()=>{const s=this.mediaState[n];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>Rr(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:n,node:i}})))},this._handlePlay=({id:t,key:n,node:i})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:n,node:i}}))},this._handlePlaying=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:n,node:i}}))},this._handlePause=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:n,node:i}}))},this._handleStalled=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:n,node:i}}))},this._handleTimeUpdate=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:n,node:i}}))},this._handleEnded=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:n,node:i}}))},this._handleError=({id:t,key:n,node:i})=>()=>{const s=new js(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:n,node:i}}))},this._cleanupMedia=t=>{var n;const i=this.media[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),Object.keys(i.listeners??{}).forEach(s=>{var o,a;if((o=this.media)!=null&&o[t]){const l=(a=i.listeners)==null?void 0:a[s];l&&i.node.removeEventListener(s,l)}}),delete this._media[t],delete this._mediaState[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 composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set media(e){e!==this._media&&(this._media=e,this.host.requestUpdate())}get media(){return this._media}set mediaState(e){e!==this._mediaState&&(this._mediaState=e,this.host.requestUpdate())}get mediaState(){return this._mediaState}_setupTask(){new Hi(this.host,async([e,t,n])=>{var i;this._compositionController.abort(),this._compositionController=new AbortController;const s=this._compositionController,o=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:a})=>t===a))&&(this.host._language=(i=this.host._languages[0])==null?void 0:i.value),e){const{width:a,height:l}=qo({aspectRatio:n,resolution:1080});try{const h=await Cc({config:e,resolvers:{text:async({options:d})=>{const f=await nB(d.font);return f&&document.fonts.add(f),{font:d.font}},image:this._createImageResolver,video:async({config:d,options:f})=>{const{media:g,source:p}=await this._mediaFactory({...d,...f});return{video:p,aspectRatio:g.aspectRatio}}},rootWidth:a,rootHeight:l});if(s.signal.aborted)return;this.composition=h}catch(h){throw new js("Fatal composition error",h,!0)}this.duration=this.composition.duration;let A={},c={};for await(const h of this.composition.tracks)for await(const d of h.scenes){const f=Rr(d.layout.node);for await(const g of f){const{media:p,listeners:C}=await this._mediaFactory(g);A={...A,[p.key]:{...p,listeners:C,speed:g.speed??1,volume:g.volume??1}},c={...c,[p.key]:{initialised:!p,waiting:!!p,...c[p.key]}}}}const u=Object.keys(this.media);Object.keys(this.media).forEach(h=>{u.includes(h)||this._cleanupMedia(h)}),this.media=A,this.mediaState=c,this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused?this.host.reset(this.host.currentTime,!this.host.paused):this.setMediaCurrentTime(this.host.currentTime)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(a){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{o.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language,aspectRatio:this.host.aspectRatio});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language,this.host.aspectRatio];return this._memoKey=e,this._lastDeps=t,t})}_setMediaCurrentTime({time:e,scene:t}){const{start:n}=t;Rr(t.layout.node).forEach(s=>{if(this.media[s.key]){const o=this.media[s.key],a=(e-n)*o.speed;o.node.currentTime=Gr(o.start,a+o.start,o.start+o.duration)}})}setMediaCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(n=>{n.scenes.forEach(i=>{this._setMediaCurrentTime({time:e,scene:i})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.media).forEach(e=>{this._cleanupMedia(e)}),this.media={}}};function sB(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function oB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const pl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],aB={id:"captions",event:"captions:click",label:"Closed Captions"},lB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},yd={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}]},AB={id:"playbackRate",label:"Playback playbackRate",subItems:yd};class cB extends eA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==pn.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)),Xt}}const ml=mn(cB),uB=Iv(()=>{const r=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","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),n=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=Ac.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:n},...i]}),pr={"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"},hB={colors:pr,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 ${pr["dark-100"]}`,medium:`0 .125rem .625rem ${pr["dark-100"]}`,large:`0 .25rem 1rem ${pr["dark-50"]}`,xl:`.25rem .25rem 1rem ${pr["dark-250"]}`,xxl:`0 .25rem 2rem ${pr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${pr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${pr["dark-50"]}`,text:`0 0 .25rem ${pr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:pr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Bd=pv(hB,{delimiter:"-"}),dB=Object.keys(Bd).map(r=>Kn(`:host { --${r}: ${Bd[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){uB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],dB,lt`
2492
+ */const Mh=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Ph=mn(class extends ti{constructor(r){if(super(r),r.type!==pn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],s=[];let o=0;for(const a of r)i[o]=n?n(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){const i=af(r),{values:s,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=i.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===o[d])l[d]=qr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=qr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=qr(i[u],s[f]),ei(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=qr(i[h],s[d]),ei(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=Mh(o,d,f),c=Mh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?i[g]:null;if(p===null){const C=ei(r,i[u]);qr(C,s[d]),l[d]=C}else l[d]=qr(p,s[d]),ei(r,i[u],p),i[g]=null;d++}else go(i[h]),h--;else go(i[u]),u++;for(;d<=f;){const g=ei(r,l[f+1]);qr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&go(g)}return this.ut=o,of(r,l),Xt}});var Ft="top",Kt="bottom",Jt="right",kt="left",el="auto",Ei=[Ft,Kt,Jt,kt],Fn="start",Ii="end",Cv="clippingParents",Oh="viewport",Ci="popper",vv="reference",Uh=Ei.reduce(function(r,e){return r.concat([e+"-"+Fn,e+"-"+Ii])},[]),Gh=[].concat(Ei,[el]).reduce(function(r,e){return r.concat([e,e+"-"+Fn,e+"-"+Ii])},[]),yv="beforeRead",Bv="read",Tv="afterRead",Qv="beforeMain",bv="main",xv="afterMain",wv="beforeWrite",Sv="write",Rv="afterWrite",Dv=[yv,Bv,Tv,Qv,bv,xv,wv,Sv,Rv];function dr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function on(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Wt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function tl(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function _v(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Wt(s)||!dr(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Lv(r){var e=r.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(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=o.reduce(function(l,A){return l[A]="",l},{});!Wt(i)||!dr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Hh={name:"applyStyles",enabled:!0,phase:"write",fn:_v,effect:Lv,requires:["computeStyles"]};function fr(r){return r.split("-")[0]}var an=Math.max,Ys=Math.min,kn=Math.round;function rl(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function $h(){return!/^((?!chrome|android).)*safari/i.test(rl())}function Nn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Wt(r)&&(i=r.offsetWidth>0&&kn(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&kn(n.height)/r.offsetHeight||1);var o=on(r)?Pt(r):window,a=o.visualViewport,l=!$h()&&t,A=(n.left+(l&&a?a.offsetLeft:0))/i,c=(n.top+(l&&a?a.offsetTop:0))/s,u=n.width/i,h=n.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function nl(r){var e=Nn(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function Yh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&tl(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Sr(r){return Pt(r).getComputedStyle(r)}function Fv(r){return["table","td","th"].indexOf(dr(r))>=0}function Ur(r){return((on(r)?r.ownerDocument:r.document)||window.document).documentElement}function Vs(r){return dr(r)==="html"?r:r.assignedSlot||r.parentNode||(tl(r)?r.host:null)||Ur(r)}function Vh(r){return!Wt(r)||Sr(r).position==="fixed"?null:r.offsetParent}function kv(r){var e=/firefox/i.test(rl()),t=/Trident/i.test(rl());if(t&&Wt(r)){var n=Sr(r);if(n.position==="fixed")return null}var i=Vs(r);for(tl(i)&&(i=i.host);Wt(i)&&["html","body"].indexOf(dr(i))<0;){var s=Sr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function vi(r){for(var e=Pt(r),t=Vh(r);t&&Fv(t)&&Sr(t).position==="static";)t=Vh(t);return t&&(dr(t)==="html"||dr(t)==="body"&&Sr(t).position==="static")?e:t||kv(r)||e}function il(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function yi(r,e,t){return an(r,Ys(e,t))}function Nv(r,e,t){var n=yi(r,e,t);return n>t?t:n}function Kh(){return{top:0,right:0,bottom:0,left:0}}function Jh(r){return Object.assign({},Kh(),r)}function Wh(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var Mv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Jh(typeof e!="number"?e:Wh(e,Ei))};function Pv(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=fr(t.placement),l=il(a),A=[kt,Jt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=Mv(i.padding,t),h=nl(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Jt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],C=vi(s),Q=C?l==="y"?C.clientHeight||0:C.clientWidth||0:0,b=g/2-p/2,v=u[d],x=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=yi(v,R,x),$=l;t.modifiersData[n]=(e={},e[$]=k,e.centerOffset=k-R,e)}}function Ov(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Yh(e.elements.popper,i)&&(e.elements.arrow=i))}const Uv={name:"arrow",enabled:!0,phase:"main",fn:Pv,effect:Ov,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Mn(r){return r.split("-")[1]}var Gv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Hv(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:kn(t*i)/i||0,y:kn(n*i)/i||0}}function qh(r){var e,t=r.popper,n=r.popperRect,i=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var C=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,v=Ft,x=window;if(A){var R=vi(t),k="clientHeight",$="clientWidth";if(R===Pt(t)&&(R=Ur(t),Sr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",$="scrollWidth")),R=R,i===Ft||(i===kt||i===Jt)&&s===Ii){v=Kt;var K=u&&R===x&&x.visualViewport?x.visualViewport.height:R[k];g-=K-n.height,g*=l?1:-1}if(i===kt||(i===Ft||i===Kt)&&s===Ii){b=Jt;var O=u&&R===x&&x.visualViewport?x.visualViewport.width:R[$];d-=O-n.width,d*=l?1:-1}}var W=Object.assign({position:a},A&&Gv),ie=c===!0?Hv({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var te;return Object.assign({},W,(te={},te[v]=Q?"0":"",te[b]=C?"0":"",te.transform=(x.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",te))}return Object.assign({},W,(e={},e[v]=Q?g+"px":"",e[b]=C?d+"px":"",e.transform="",e))}function $v(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:fr(e.placement),variation:Mn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,qh(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,qh(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Yv={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$v,data:{}};var Ks={passive:!0};function Vv(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,s=i===void 0?!0:i,o=n.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Ks)}),a&&l.addEventListener("resize",t.update,Ks),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Ks)}),a&&l.removeEventListener("resize",t.update,Ks)}}const Kv={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Vv,data:{}};var Jv={left:"right",right:"left",bottom:"top",top:"bottom"};function Js(r){return r.replace(/left|right|bottom|top/g,function(e){return Jv[e]})}var Wv={start:"end",end:"start"};function Xh(r){return r.replace(/start|end/g,function(e){return Wv[e]})}function sl(r){var e=Pt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function ol(r){return Nn(Ur(r)).left+sl(r).scrollLeft}function qv(r,e){var t=Pt(r),n=Ur(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=$h();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+ol(r),y:l}}function Xv(r){var e,t=Ur(r),n=sl(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=an(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=an(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+ol(r),l=-n.scrollTop;return Sr(i||t).direction==="rtl"&&(a+=an(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function al(r){var e=Sr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function jh(r){return["html","body","#document"].indexOf(dr(r))>=0?r.ownerDocument.body:Wt(r)&&al(r)?r:jh(Vs(r))}function Bi(r,e){var t;e===void 0&&(e=[]);var n=jh(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(n),o=i?[s].concat(s.visualViewport||[],al(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(Bi(Vs(o)))}function ll(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function jv(r,e){var t=Nn(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function zh(r,e,t){return e===Oh?ll(qv(r,t)):on(e)?jv(e,t):ll(Xv(Ur(r)))}function zv(r){var e=Bi(Vs(r)),t=["absolute","fixed"].indexOf(Sr(r).position)>=0,n=t&&Wt(r)?vi(r):r;return on(n)?e.filter(function(i){return on(i)&&Yh(i,n)&&dr(i)!=="body"}):[]}function Zv(r,e,t,n){var i=e==="clippingParents"?zv(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=zh(r,A,n);return l.top=an(c.top,l.top),l.right=Ys(c.right,l.right),l.bottom=Ys(c.bottom,l.bottom),l.left=an(c.left,l.left),l},zh(r,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Zh(r){var e=r.reference,t=r.element,n=r.placement,i=n?fr(n):null,s=n?Mn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Jt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?il(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case Fn:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Ii:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Ti(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?Cv:a,A=t.rootBoundary,c=A===void 0?Oh:A,u=t.elementContext,h=u===void 0?Ci:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,C=Jh(typeof p!="number"?p:Wh(p,Ei)),Q=h===Ci?vv:Ci,b=r.rects.popper,v=r.elements[f?Q:h],x=Zv(on(v)?v:v.contextElement||Ur(r.elements.popper),l,c,o),R=Nn(r.elements.reference),k=Zh({reference:R,element:b,strategy:"absolute",placement:i}),$=ll(Object.assign({},b,k)),K=h===Ci?$:R,O={top:x.top-K.top+C.top,bottom:K.bottom-x.bottom+C.bottom,left:x.left-K.left+C.left,right:K.right-x.right+C.right},W=r.modifiersData.offset;if(h===Ci&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Jt,Kt].indexOf(te)>=0?1:-1,D=[Ft,Kt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function ey(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Gh:l,c=Mn(n),u=c?a?Uh:Uh.filter(function(f){return Mn(f)===c}):Ei,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=Ti(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[fr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function ty(r){if(fr(r)===el)return[];var e=Js(r);return[Xh(r),e,Xh(e)]}function ry(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,C=fr(p),Q=C===p,b=l||(Q||!f?[Js(p)]:ty(p)),v=[p].concat(b).reduce(function(ce,pe){return ce.concat(fr(pe)===el?ey(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),x=e.rects.reference,R=e.rects.popper,k=new Map,$=!0,K=v[0],O=0;O<v.length;O++){var W=v[O],ie=fr(W),te=Mn(W)===Fn,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",P=Ti(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?te?Jt:kt:te?Kt:Ft;x[D]>R[D]&&(X=Js(X));var _=Js(X),S=[];if(s&&S.push(P[ie]<=0),a&&S.push(P[X]<=0,P[_]<=0),S.every(function(ce){return ce})){K=W,$=!1;break}k.set(W,S)}if($)for(var F=f?3:1,J=function(pe){var ge=v.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return K=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==K&&(e.modifiersData[n]._skip=!0,e.placement=K,e.reset=!0)}}const ny={name:"flip",enabled:!0,phase:"main",fn:ry,requiresIfExists:["offset"],data:{_skip:!1}};function ed(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function td(r){return[Ft,Jt,Kt,kt].some(function(e){return r[e]>=0})}function iy(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ti(e,{elementContext:"reference"}),a=Ti(e,{altBoundary:!0}),l=ed(o,n),A=ed(a,i,s),c=td(l),u=td(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const sy={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:iy};function oy(r,e,t){var n=fr(r),i=[kt,Ft].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[kt,Jt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function ay(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=Gh.reduce(function(c,u){return c[u]=oy(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[n]=o}const ly={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ay};function Ay(r){var e=r.state,t=r.name;e.modifiersData[t]=Zh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const cy={name:"popperOffsets",enabled:!0,phase:"read",fn:Ay,data:{}};function uy(r){return r==="x"?"y":"x"}function hy(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=Ti(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),C=fr(e.placement),Q=Mn(e.placement),b=!Q,v=il(C),x=uy(v),R=e.modifiersData.popperOffsets,k=e.rects.reference,$=e.rects.popper,K=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof K=="number"?{mainAxis:K,altAxis:K}:Object.assign({mainAxis:0,altAxis:0},K),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var te,le=v==="y"?Ft:kt,D=v==="y"?Kt:Jt,P=v==="y"?"height":"width",X=R[v],_=X+p[le],S=X-p[D],F=d?-$[P]/2:0,J=Q===Fn?k[P]:$[P],Y=Q===Fn?-$[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?nl(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Kh(),ge=pe[le],Se=pe[D],Le=yi(0,k[P],ce[P]),Ge=b?k[P]/2-F-Le-ge-O.mainAxis:J-Le-ge-O.mainAxis,fe=b?-k[P]/2+F+Le+Se+O.mainAxis:Y+Le+Se+O.mainAxis,Qe=e.elements.arrow&&vi(e.elements.arrow),Me=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[v])!=null?te:0,qe=X+Ge-we-Me,Te=X+fe-we,T=yi(d?Ys(_,qe):_,X,d?an(S,Te):S);R[v]=T,ie[v]=T-X}if(a){var m,E=v==="x"?Ft:kt,w=v==="x"?Kt:Jt,M=R[x],z=x==="y"?"height":"width",j=M+p[E],Ie=M-p[w],be=[Ft,kt].indexOf(C)!==-1,De=(m=W==null?void 0:W[x])!=null?m:0,ke=be?j:M-k[z]-$[z]-De+O.altAxis,_e=be?M+k[z]+$[z]-De-O.altAxis:Ie,Mt=d&&be?Nv(ke,M,_e):yi(d?ke:j,M,d?_e:Ie);R[x]=Mt,ie[x]=Mt-M}e.modifiersData[n]=ie}}const dy={name:"preventOverflow",enabled:!0,phase:"main",fn:hy,requiresIfExists:["offset"]};function fy(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function gy(r){return r===Pt(r)||!Wt(r)?sl(r):fy(r)}function py(r){var e=r.getBoundingClientRect(),t=kn(e.width)/r.offsetWidth||1,n=kn(e.height)/r.offsetHeight||1;return t!==1||n!==1}function my(r,e,t){t===void 0&&(t=!1);var n=Wt(e),i=Wt(e)&&py(e),s=Ur(e),o=Nn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((dr(e)!=="body"||al(s))&&(a=gy(e)),Wt(e)?(l=Nn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=ol(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ey(r){var e=new Map,t=new Set,n=[];r.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(s)}return r.forEach(function(s){t.has(s.name)||i(s)}),n}function Iy(r){var e=Ey(r);return Dv.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function Cy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function vy(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var rd={placement:"bottom",modifiers:[],strategy:"absolute"};function nd(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function yy(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?rd:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},rd,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(C){var Q=typeof C=="function"?C(c.options):C;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:on(a)?Bi(a):a.contextElement?Bi(a.contextElement):[],popper:Bi(l)};var b=Iy(vy([].concat(n,c.options.modifiers)));return c.orderedModifiers=b.filter(function(v){return v.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var C=c.elements,Q=C.reference,b=C.popper;if(nd(Q,b)){c.rects={reference:my(Q,vi(b),c.options.strategy==="fixed"),popper:nl(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(O){return c.modifiersData[O.name]=Object.assign({},O.data)});for(var v=0;v<c.orderedModifiers.length;v++){if(c.reset===!0){c.reset=!1,v=-1;continue}var x=c.orderedModifiers[v],R=x.fn,k=x.options,$=k===void 0?{}:k,K=x.name;typeof R=="function"&&(c=R({state:c,options:$,name:K,instance:d})||c)}}}},update:Cy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!nd(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var C=p.name,Q=p.options,b=Q===void 0?{}:Q,v=p.effect;if(typeof v=="function"){var x=v({state:c,name:C,instance:d,options:b}),R=function(){};u.push(x||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var By=[Kv,cy,Yv,Hh,ly,ny,dy,Uv,sy],Ty=yy({defaultModifiers:By}),Qy="tippy-box",id="tippy-content",by="tippy-backdrop",sd="tippy-arrow",od="tippy-svg-arrow",ln={passive:!0,capture:!0},ad=function(){return document.body};function Al(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function cl(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function ld(r,e){return typeof r=="function"?r.apply(void 0,e):r}function Ad(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function xy(r){return r.split(/\s+/).filter(Boolean)}function Pn(r){return[].concat(r)}function cd(r,e){r.indexOf(e)===-1&&r.push(e)}function wy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function Sy(r){return r.split("-")[0]}function Ws(r){return[].slice.call(r)}function ud(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function Qi(){return document.createElement("div")}function qs(r){return["Element","Fragment"].some(function(e){return cl(r,e)})}function Ry(r){return cl(r,"NodeList")}function Dy(r){return cl(r,"MouseEvent")}function _y(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function Ly(r){return qs(r)?[r]:Ry(r)?Ws(r):Array.isArray(r)?r:Ws(document.querySelectorAll(r))}function ul(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function hd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Fy(r){var e,t=Pn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function ky(r,e){var t=e.clientX,n=e.clientY;return r.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,A=Sy(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-n+u>l,p=n-s.bottom-h>l,C=s.left-t+d>l,Q=t-s.right-f>l;return g||p||C||Q})}function hl(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function dd(r,e){for(var t=e;t;){var n;if(r.contains(t))return!0;t=t.getRootNode==null||(n=t.getRootNode())==null?void 0:n.host}return!1}var gr={isTouch:!1},fd=0;function Ny(){gr.isTouch||(gr.isTouch=!0,window.performance&&document.addEventListener("mousemove",gd))}function gd(){var r=performance.now();r-fd<20&&(gr.isTouch=!1,document.removeEventListener("mousemove",gd)),fd=r}function My(){var r=document.activeElement;if(_y(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function Py(){document.addEventListener("touchstart",Ny,ln),window.addEventListener("blur",My)}var Oy=typeof window<"u"&&typeof document<"u",Uy=Oy?!!window.msCrypto:!1,Gy={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Hy={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:ad,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},Gy,Hy),$y=Object.keys(tr),Yy=function(e){var t=Object.keys(e);t.forEach(function(n){tr[n]=e[n]})};function pd(r){var e=r.plugins||[],t=e.reduce(function(n,i){var s=i.name,o=i.defaultValue;if(s){var a;n[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function Vy(r,e){var t=e?Object.keys(pd(Object.assign({},tr,{plugins:e}))):$y,n=t.reduce(function(i,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return n}function md(r,e){var t=Object.assign({},e,{content:ld(e.content,[r])},e.ignoreAttributes?{}:Vy(r,e.plugins));return t.aria=Object.assign({},tr.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 Ky=function(){return"innerHTML"};function dl(r,e){r[Ky()]=e}function Ed(r){var e=Qi();return r===!0?e.className=sd:(e.className=od,qs(r)?e.appendChild(r):dl(e,r)),e}function Id(r,e){qs(e.content)?(dl(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?dl(r,e.content):r.textContent=e.content)}function fl(r){var e=r.firstElementChild,t=Ws(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(id)}),arrow:t.find(function(n){return n.classList.contains(sd)||n.classList.contains(od)}),backdrop:t.find(function(n){return n.classList.contains(by)})}}function Cd(r){var e=Qi(),t=Qi();t.className=Qy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=Qi();n.className=id,n.setAttribute("data-state","hidden"),Id(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=fl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Id(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(Ed(o.arrow))):l.appendChild(Ed(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}Cd.$$tippy=!0;var Jy=1,Xs=[],gl=[];function Wy(r,e){var t=md(r,Object.assign({},tr,pd(ud(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=Ad(qe,t.interactiveDebounce),g,p=Jy++,C=null,Q=wy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:p,reference:r,popper:Qi(),popperInstance:C,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Mt,show:ut,hide:Ut,hideWithInteractivity:Er,enable:be,disable:De,unmount:Ir,destroy:Tt};if(!t.render)return v;var x=t.render(v),R=x.popper,k=x.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+v.id,v.popper=R,r._tippy=v,R._tippy=v;var $=Q.map(function(q){return q.fn(v)}),K=r.hasAttribute("aria-expanded");return Qe(),F(),X(),_("onCreate",[v]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),v;function O(){var q=v.props.touch;return Array.isArray(q)?q:[q,0]}function W(){return O()[0]==="hold"}function ie(){var q;return!!((q=v.props.render)!=null&&q.$$tippy)}function te(){return g||r}function le(){var q=te().parentNode;return q?Fy(q):document}function D(){return fl(R)}function P(q){return v.state.isMounted&&!v.state.isVisible||gr.isTouch||c&&c.type==="focus"?0:Al(v.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=v.props.interactive&&!q?"":"none",R.style.zIndex=""+v.props.zIndex}function _(q,de,Ce){if(Ce===void 0&&(Ce=!0),$.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),Ce){var Pe;(Pe=v.props)[q].apply(Pe,de)}}function S(){var q=v.props.aria;if(q.content){var de="aria-"+q.content,Ce=R.id,Pe=Pn(v.props.triggerTarget||r);Pe.forEach(function(Fe){var Xe=Fe.getAttribute(de);if(v.state.isVisible)Fe.setAttribute(de,Xe?Xe+" "+Ce:Ce);else{var xt=Xe&&Xe.replace(Ce,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(K||!v.props.aria.expanded)){var q=Pn(v.props.triggerTarget||r);q.forEach(function(de){v.props.interactive?de.setAttribute("aria-expanded",v.state.isVisible&&de===te()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),Xs=Xs.filter(function(q){return q!==f})}function Y(q){if(!(gr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(v.props.interactive&&dd(R,de))){if(Pn(v.props.triggerTarget||r).some(function(Ce){return dd(Ce,de)})){if(gr.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[v,q]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,ln),q.addEventListener("touchstart",ce,ln),q.addEventListener("touchmove",ne,ln)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,ln),q.removeEventListener("touchstart",ce,ln),q.removeEventListener("touchmove",ne,ln)}function Se(q,de){Ge(q,function(){!v.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var Ce=D().box;function Pe(Fe){Fe.target===Ce&&(hl(Ce,"remove",Pe),de())}if(q===0)return de();hl(Ce,"remove",u),hl(Ce,"add",Pe),u=Pe}function fe(q,de,Ce){Ce===void 0&&(Ce=!1);var Pe=Pn(v.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,Ce),d.push({node:Fe,eventType:q,handler:de,options:Ce})})}function Qe(){W()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),xy(v.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(Uy?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Me(){d.forEach(function(q){var de=q.node,Ce=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(Ce,Pe,Fe)}),d=[]}function we(q){var de,Ce=!1;if(!(!v.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!v.state.isVisible&&Dy(q)&&Xs.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?Ce=!0:j(q),q.type==="click"&&(o=!Ce),Ce&&!Pe&&Ie(q)}}function qe(q){var de=q.target,Ce=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&Ce)){var Pe=z().concat(R).map(function(Fe){var Xe,xt=Fe._tippy,wt=(Xe=xt.popperInstance)==null?void 0:Xe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);ky(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||v.props.trigger.indexOf("click")>=0&&o;if(!de){if(v.props.interactive){v.hideWithInteractivity(q);return}Ie(q)}}function T(q){v.props.trigger.indexOf("focusin")<0&&q.target!==te()||v.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return gr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){w();var q=v.props,de=q.popperOptions,Ce=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,Xe=q.moveTransition,xt=ie()?fl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,$n={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Yn){var Yr=Yn.state;if(ie()){var _i=D(),Li=_i.box;["placement","reference-hidden","escaped"].forEach(function(Vn){Vn==="placement"?Li.setAttribute("data-placement",Yr.placement):Yr.attributes.popper["data-popper-"+Vn]?Li.setAttribute("data-"+Vn,""):Li.removeAttribute("data-"+Vn)}),Yr.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Xe}},$n];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),v.popperInstance=Ty(wt,R,Object.assign({},de,{placement:Ce,onFirstUpdate:h,modifiers:St}))}function w(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function M(){var q=v.props.appendTo,de,Ce=te();v.props.interactive&&q===ad||q==="parent"?de=Ce.parentNode:de=ld(q,[Ce]),de.contains(R)||de.appendChild(R),v.state.isMounted=!0,E()}function z(){return Ws(R.querySelectorAll("[data-tippy-root]"))}function j(q){v.clearDelayTimeouts(),q&&_("onTrigger",[v,q]),pe();var de=P(!0),Ce=O(),Pe=Ce[0],Fe=Ce[1];gr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?n=setTimeout(function(){v.show()},de):v.show()}function Ie(q){if(v.clearDelayTimeouts(),_("onUntrigger",[v,q]),!v.state.isVisible){ge();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=P(!1);de?i=setTimeout(function(){v.state.isVisible&&v.hide()},de):s=requestAnimationFrame(function(){v.hide()})}}function be(){v.state.isEnabled=!0}function De(){v.hide(),v.state.isEnabled=!1}function ke(){clearTimeout(n),clearTimeout(i),cancelAnimationFrame(s)}function _e(q){if(!v.state.isDestroyed){_("onBeforeUpdate",[v,q]),Me();var de=v.props,Ce=md(r,Object.assign({},de,ud(q),{ignoreAttributes:!0}));v.props=Ce,Qe(),de.interactiveDebounce!==Ce.interactiveDebounce&&(J(),f=Ad(qe,Ce.interactiveDebounce)),de.triggerTarget&&!Ce.triggerTarget?Pn(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):Ce.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,Ce),v.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,q])}}function Mt(q){v.setProps({content:q})}function ut(){var q=v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=gr.isTouch&&!v.props.touch,Fe=Al(v.props.duration,0,tr.duration);if(!(q||de||Ce||Pe)&&!te().hasAttribute("disabled")&&(_("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),v.state.isMounted||(R.style.transition="none"),ie()){var Xe=D(),xt=Xe.box,wt=Xe.content;ul([xt,wt],0)}h=function(){var St;if(!(!v.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=v.props.moveTransition,ie()&&v.props.animation){var dn=D(),Yn=dn.box,Yr=dn.content;ul([Yn,Yr],Fe),hd([Yn,Yr],"visible")}S(),F(),cd(gl,v),(St=v.popperInstance)==null||St.forceUpdate(),_("onMount",[v]),v.props.animation&&ie()&&Le(Fe,function(){v.state.isShown=!0,_("onShown",[v])})}},M()}}function Ut(){var q=!v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=Al(v.props.duration,1,tr.duration);if(!(q||de||Ce)&&(_("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),X(!0),ie()){var Fe=D(),Xe=Fe.box,xt=Fe.content;v.props.animation&&(ul([Xe,xt],Pe),hd([Xe,xt],"hidden"))}S(),F(),v.props.animation?ie()&&Se(Pe,v.unmount):v.unmount()}}function Er(q){le().addEventListener("mousemove",f),cd(Xs,f),f(q)}function Ir(){v.state.isVisible&&v.hide(),v.state.isMounted&&(w(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),gl=gl.filter(function(q){return q!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Tt(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Me(),delete r._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function An(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);Py();var n=Object.assign({},e,{plugins:t}),i=Ly(r),s=i.reduce(function(o,a){var l=a&&Wy(a,n);return l&&o.push(l),o},[]);return qs(r)?s[0]:s}An.defaultProps=tr,An.setDefaultProps=Yy,An.currentInput=gr,Object.assign({},Hh,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),An.setDefaultProps({render:Cd});function Rr(r){var e,t;const n=[];return(((e=r.renderer)==null?void 0:e.type)==="video"||((t=r.renderer)==null?void 0:t.type)==="audio")&&n.push({...r.config,...r.options}),n.push(...r.childNodes.flatMap(Rr).filter(Boolean)),n}class js extends Error{constructor(e,t=new Error,n=!1){super(),this.fatal=!1,this.fatal=n,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}function Gr(r,e,t){return Math.min(Math.max(e,r),t)}const qy=5;function Xy(r,e){return r.length!==e.length||r.some((t,n)=>t!==e[n])}class jy{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){Xy(e,this._activeScenes)&&(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,n,i;const s=Gr(0,e,this.host.duration);this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((n=this.host.composition)==null?void 0:n.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A})=>s>=A-qy&&s<A)),[]))??[],this.loadScenes(),this.syncMediaState(),(i=this._controls.value)==null||i.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return Ct(this._canvas)}controls(){return Ct(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{Rr(e.layout.node).forEach(n=>{var i,s,o;const{start:a,duration:l}=e,A=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(this.host.media[n.key]){const c=this.host.media[n.key],{speed:u,volume:h,hls:d,node:f,start:g,duration:p}=c,C=this.host.mediaState[n.key];f&&C&&(f.currentTime>=g+p||f.ended||A&&(d?(i=d.startLoadOnce)==null||i.call(d,g):C.initialised||(s=f.startLoadOnce)==null||s.call(f),f.volume=Gr(0,this.host.volume*(h??1),1),f.playbackRate=Gr(.1,this.host.playbackRate*(u??1),4)))}else if(A){const c=`${a}-${l}`,u=this.host._sceneController.mediaState[c];this.host.duration&&!((o=u==null?void 0:u.buffered)!=null&&o.length)&&(this.host._sceneController.mediaState={...this.host._sceneController.mediaState,[c]:{...u,buffered:[{start:Math.max(0,a/this.host.duration*100),end:Math.min((a+l)/this.host.duration*100,100)}]}})}})})}syncMediaState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var n;(n=t.scenes)==null||n.forEach(i=>{Rr(i.layout.node).forEach(o=>{if(this.host.media[o.key]){const a=this.host.media[o.key],{node:l}=a,A=this.host.mediaState[o.key],c=this.activeScenes.includes(i);if(A)if(c&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(l.paused&&A.initialised)try{return l.play()}catch(u){throw new js("Video play error",u,!0)}}else l.paused||l.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,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)}}async function vd(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function zy(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Zy(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function eB(r){return new Promise(async e=>{let t=null;const{type:n,key:i,src:s,duration:o,startOffset:a,endOffset:l}=r;n==="video"?(t=document.createElement("video"),t.playsInline=!0):t=document.createElement("audio"),t.muted=!0,t.loop=!1,t.src=s;let A=!1;if(t.startLoadOnce=()=>{A||(t.preload="auto",t.load(),A=!0)},n==="video"&&o&&r.aspectRatio){t.preload="none";const c=(a??0)*o,u=(1-(l??0))*o;e({key:i,hls:null,node:t,start:c,duration:u-c,aspectRatio:r.aspectRatio})}else{t.preload="metadata";const c=async()=>{const u=await vd(t),h=(a??0)*u,d=(1-(l??0))*u;e({key:i,hls:null,node:t,start:h,duration:d-h,aspectRatio:t instanceof HTMLVideoElement?t.videoWidth/t.videoHeight:null}),t.removeEventListener("loadedmetadata",c)};t.addEventListener("loadedmetadata",c)}})}function tB({key:r,playlist:e,startOffset:t,endOffset:n}){return new Promise(i=>{const s=document.createElement("video");s instanceof HTMLVideoElement&&(s.playsInline=!0),s.muted=!0,s.loop=!1;let o=!1;const a=new wr({autoStartLoad:!0,xhrSetup:l=>{const{open:A}=l,c=e.split("?")[1];l.open=function(u,h,d){c&&!h.toString().includes("?")&&(h+="?"+c),!(!o&&h.toString().includes(".ts"))&&A.apply(this,[u,h,d])}}});a.on(wr.Events.LEVEL_LOADED,async()=>{o||a==null||a.stopLoad();const l=await vd(s),A=(t??0)*l,c=(1-(n??0))*l;i({key:r,hls:a,node:s,start:A,duration:c-A,aspectRatio:a.levels[0].width/a.levels[0].height})}),a.loadSource(e),a.attachMedia(s),a.startLoadOnce=(l=-1,A)=>{if(a&&!o){const c=a.levels.findIndex(u=>Math.min(u.height,u.width)===A);o=!0,a.startLevel=a.firstLevel,a.startLoad(l),a.currentLevel=c!==-1?c:a.firstLevel}}})}function rB(r){const{playlist:e}=r;return e&&!zy()&&wr.isSupported()?tB({...r,playlist:e}):eB(r)}const nB=Xr(async function(e){const{weight:t,family:n}=e,{client:i,server:s}=n.weights.find(a=>a.weight===t)??{};return!i&&!s?null:new FontFace(e.family.name,`url(${i??s})`,{weight:t,style:"normal"}).load()},{cacheKey:([r])=>JSON.stringify(r)});let iB=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._media={},this._mediaState={},this._compositionController=new AbortController,this._delayProcessing=(t=100)=>{const n=new AbortController,i=setTimeout(()=>{n.signal.aborted||(this.host._processing=!0)},t);return n.signal.addEventListener("abort",()=>{clearTimeout(i)}),n},this._createImageResolver=Xr(async({config:t})=>t.src?new Promise((n,i)=>{const s=new Image;s.onload=()=>{n({image:s})},s.onerror=o=>{i(o)},s.src=t.src}):{image:null},{cacheKey:([{config:t}])=>JSON.stringify(t)}),this._mediaFactory=Xr(async t=>{const{key:n}=t,i=await rB(t),s={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},o=Object.keys(s).reduce((a,l)=>{const A=l,c=s[A]({key:n,node:i.node});return a[A]=c,i.node.addEventListener(l,c),a},{});return{media:i,listeners:o,aspectRatio:i.aspectRatio,source:()=>i.node}},{cacheKey:([{key:t,src:n,playlist:i}])=>JSON.stringify({key:t,src:n==null?void 0:n.split("?")[0],playlist:i==null?void 0:i.split("?")[0]})}),this._handleLoadedData=({id:t,key:n,node:i})=>()=>{const s=this.mediaState[n];s!=null&&s.initialised||(this.mediaState={...this.mediaState,[n]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setMediaCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:n,node:i}})))},this._handleWaiting=({key:t})=>()=>{const n=this.mediaState[t];n!=null&&n.initialised&&!(n!=null&&n.waiting)&&(this.mediaState={...this.mediaState,[t]:{...n,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const n=this.mediaState[t];n!=null&&n.initialised&&(n!=null&&n.waiting)&&(this.mediaState={...this.mediaState,[t]:{...n,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:n,node:i}}))},this._handleSeeked=({id:t,key:n,node:i})=>()=>{const s=this.mediaState[n];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>Rr(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:n,node:i}})))},this._handlePlay=({id:t,key:n,node:i})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:n,node:i}}))},this._handlePlaying=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:n,node:i}}))},this._handlePause=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:n,node:i}}))},this._handleStalled=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:n,node:i}}))},this._handleTimeUpdate=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:n,node:i}}))},this._handleEnded=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:n,node:i}}))},this._handleError=({id:t,key:n,node:i})=>()=>{const s=new js(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:n,node:i}}))},this._cleanupVideo=t=>{var n;const i=this.media[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),Object.keys(i.listeners??{}).forEach(s=>{var o,a;if((o=this.media)!=null&&o[t]){const l=(a=i.listeners)==null?void 0:a[s];l&&i.node.removeEventListener(s,l)}}),delete this.media[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 composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set media(e){e!==this._media&&(this._media=e,this.host.requestUpdate())}get media(){return this._media}set mediaState(e){e!==this._mediaState&&(this._mediaState=e,this.host.requestUpdate())}get mediaState(){return this._mediaState}_setupTask(){new Hi(this.host,async([e,t,n])=>{var i;this._compositionController.abort(),this._compositionController=new AbortController;const s=this._compositionController,o=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:a})=>t===a))&&(this.host._language=(i=this.host._languages[0])==null?void 0:i.value),e){const{width:a,height:l}=qo({aspectRatio:n,resolution:1080});try{const A=await Cc({config:e,resolvers:{text:async({options:c})=>{const u=await nB(c.font);return u&&document.fonts.add(u),{font:c.font}},image:this._createImageResolver,video:async({config:c,options:u})=>{const{media:h,source:d}=await this._mediaFactory({...c,...u});return{video:d,aspectRatio:h.aspectRatio}}},rootWidth:a,rootHeight:l});if(s.signal.aborted)return;this.composition=A}catch(A){throw new js("Fatal composition error",A,!0)}this.duration=this.composition.duration;for await(const A of this.composition.tracks)for await(const c of A.scenes){const u=Rr(c.layout.node);for await(const h of u){const{media:d,listeners:f}=await this._mediaFactory(h);this.media={...this.media,[d.key]:{...d,listeners:f,speed:h.speed??1,volume:h.volume??1}},this.mediaState={...this.mediaState,[d.key]:{initialised:!d,waiting:!!d,...this.mediaState[d.key]}}}}this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused?this.host.reset(this.host.currentTime,!this.host.paused):this.setMediaCurrentTime(this.host.currentTime)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(a){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{o.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language,aspectRatio:this.host.aspectRatio});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language,this.host.aspectRatio];return this._memoKey=e,this._lastDeps=t,t})}_setMediaCurrentTime({time:e,scene:t}){const{start:n}=t;Rr(t.layout.node).forEach(s=>{if(this.media[s.key]){const o=this.media[s.key],a=(e-n)*o.speed;o.node.currentTime=Gr(o.start,a+o.start,o.start+o.duration)}})}setMediaCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(n=>{n.scenes.forEach(i=>{this._setMediaCurrentTime({time:e,scene:i})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.media).forEach(e=>{this._cleanupVideo(e)}),this.media={}}};function sB(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function oB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const pl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],aB={id:"captions",event:"captions:click",label:"Closed Captions"},lB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},yd={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}]},AB={id:"playbackRate",label:"Playback playbackRate",subItems:yd};class cB extends eA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==pn.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)),Xt}}const ml=mn(cB),uB=Iv(()=>{const r=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","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),n=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=Ac.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:n},...i]}),pr={"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"},hB={colors:pr,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 ${pr["dark-100"]}`,medium:`0 .125rem .625rem ${pr["dark-100"]}`,large:`0 .25rem 1rem ${pr["dark-50"]}`,xl:`.25rem .25rem 1rem ${pr["dark-250"]}`,xxl:`0 .25rem 2rem ${pr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${pr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${pr["dark-50"]}`,text:`0 0 .25rem ${pr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:pr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Bd=pv(hB,{delimiter:"-"}),dB=Object.keys(Bd).map(r=>Kn(`:host { --${r}: ${Bd[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){uB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],dB,lt`
2493
2493
  :host {
2494
2494
  font-family: var(--fontFamilies-sans);
2495
2495
  font-size: var(--fontSizes-medium);