@vouchfor/embeds 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/embeds.js +4 -4
- package/dist/iife/dialog-embed/embed.iife.js +1 -1
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/embeds.iife.js +1 -1
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.iife.js +1 -1
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/package.json +4 -4
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 = "8.
|
|
199
|
+
const version = "8.7.0";
|
|
200
200
|
const license = "MIT";
|
|
201
201
|
const author = "Aaron Williams";
|
|
202
202
|
const main = "dist/es/embeds.js";
|
|
@@ -237,8 +237,8 @@ const scripts = {
|
|
|
237
237
|
const dependencies = {
|
|
238
238
|
"@a11y/focus-trap": "^1.0.5",
|
|
239
239
|
"@lit/task": "^1.0.2",
|
|
240
|
-
"@vouchfor/canvas-video": "^13.
|
|
241
|
-
"@vouchfor/media-player": "^9.
|
|
240
|
+
"@vouchfor/canvas-video": "^13.7.0",
|
|
241
|
+
"@vouchfor/media-player": "^9.7.0",
|
|
242
242
|
uuid: "^9.0.1"
|
|
243
243
|
};
|
|
244
244
|
const peerDependencies = {
|
|
@@ -256,7 +256,7 @@ const devDependencies = {
|
|
|
256
256
|
"@types/mocha": "^10.0.10",
|
|
257
257
|
"@vouchfor/eslint-config": "^1.0.8",
|
|
258
258
|
"@vouchfor/prettier-config": "^1.0.1",
|
|
259
|
-
"@vouchfor/video-utils": "^6.
|
|
259
|
+
"@vouchfor/video-utils": "^6.7.0",
|
|
260
260
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
261
261
|
"@web/test-runner": "^0.20.1",
|
|
262
262
|
"@web/test-runner-browserstack": "^0.8.0",
|
|
@@ -2459,7 +2459,7 @@ vec4 transition(vec2 uv) {
|
|
|
2459
2459
|
return mix(a, b, step(0.0+p.y,progress));
|
|
2460
2460
|
}
|
|
2461
2461
|
`,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const qh=ul(Hv);var Xh;function $v(i){if(typeof i=="string"){const[e,t]=i.split(":");return Math.min(parseFloat(e),parseFloat(t))}return i}function Yv(i){if(typeof i=="string"){const[e,t]=i.split(":"),r=parseFloat(e),n=parseFloat(t);return r/n}return i}function Hl({resolution:i,aspectRatio:e}){const t=$v(i),r=Yv(e),n=r>=1,s=Math.min(n?t*r:t/r,t),o=Math.max(n?t*r:t/r,t);return{resolution:t,aspectRatio:r,height:Math.round(n?s:o),width:Math.round(n?o:s)}}function zh({canvas:i,width:e,height:t,scaleFactor:r=1}){i.width=e*r,i.height=t*r}function Vv({context:i,scaleFactor:e=1}){i.scale(e,e)}function Kv({source:i,sx:e,sy:t,sw:r,sh:n,dx:s,dy:o,dw:a,dh:c}){const l=(i==null?void 0:i.naturalWidth)??(i==null?void 0:i.videoWidth)??(i==null?void 0:i.width),u=(i==null?void 0:i.naturalHeight)??(i==null?void 0:i.videoHeight)??(i==null?void 0:i.height);e=e??0,t=t??0,r=r??l,n=n??u,r<0&&(e+=r,r=Math.abs(r)),n<0&&(t+=n,n=Math.abs(n)),a<0&&(s+=a,a=Math.abs(a)),c<0&&(o+=c,c=Math.abs(c));const A=Math.max(e,0),h=Math.min(e+r,l),d=Math.max(t,0),f=Math.min(t+n,u),g=a/r,p=c/n;return[i,A,d,h-A,f-d,e<0?s-e*g:s,t<0?o-t*p:o,(h-A)*g,(f-d)*p]}function Wv({context:i,source:e,crop:t,flip:r,format:n="letterbox",posX:s,posY:o,scaleFactor:a=1,drawAreaWidth:c,drawAreaHeight:l,sourceWidth:u,sourceHeight:A,cropCanvas:h}){const{x:d,y:f,width:g,height:p}=t??{},I=u*(d??0),C=A*(f??0),B=u*Math.min(1-(d??0),g??1),y=A*Math.min(1-(f??0),p??1);let x=I,Q=C,_=B,M=y,P=B,D=y;if(zh({scaleFactor:a,canvas:h,width:B,height:y}),n==="crop"){const K=c/l,ee=B/y,z=ee>K?B-y*K:0,L=ee<K?y-B/K:0;zh({scaleFactor:a,canvas:h,width:B+z,height:y+L}),x+=z/2,Q+=L/2,_-=z,M-=L,P+=z,D+=L}const $=h.getContext("2d");if($){Vv({scaleFactor:a,context:$});const K=Kv({source:e,sx:x,sy:Q,sw:_,sh:M,dx:0,dy:0,dw:P,dh:D});$.drawImage(...K)}r?(i.save(),i.translate(s+c,o),i.scale(-1,1),i.drawImage(h,0,0,c,l),i.restore()):i.drawImage(h,s,o,c,l)}const Zh={linear:iE,easeIn:cl,easeInOut:nE,easeOut:rE,circIn:Ku,circInOut:sE,circOut:Wu,backIn:Al,backInOut:aE,backOut:oE,anticipate:lE,bounceIn:hE,bounceInOut:dE,bounceOut:uo},Lo=Tu((i,e,{clamp:t=!0,ease:r="easeIn",...n}={})=>qm(i,e,{...n,clamp:t,ease:Zh[r]}),{cacheKey:([i,e,t])=>JSON.stringify({from:i,to:e,options:t})}),jv={type:"clip",processor:{getTargetState:i=>({clip:{x:i.coordinates.x,y:i.coordinates.y,width:i.dimensions.width,height:i.dimensions.height}}),interpolateState:({value:i,easing:e,progress:t,from:r})=>{const n=r.clip??{x:0,y:0,width:1,height:1},s={x:i.coordinates.x,y:i.coordinates.y,width:i.dimensions.width,height:i.dimensions.height};return{clip:Lo([0,1],[n,s],{ease:e})(t)}}}},ko={type:"fade",processor:{getTargetState:i=>({opacity:i}),interpolateState:({value:i,easing:e,progress:t,from:r})=>({opacity:Lo([0,1],[r.opacity,i],{ease:e})(t)})}},Jv={type:"scale",processor:{getTargetState:i=>({scale:i}),interpolateState:({value:i,easing:e,progress:t,from:r})=>({scale:Lo([0,1],[r.scale,i],{ease:e})(t)})}},ed={type:"translate",processor:{getTargetState:i=>({translation:i}),interpolateState:({value:i,easing:e,progress:t,from:r})=>({translation:Lo([0,1],[r.translation,i],{ease:e})(t)})}},qv=[{label:"Both",value:"both"},{label:"At start",value:"enter"},{label:"At end",value:"exit"}],Xv=[{value:"left",icon:"arrow-left"},{value:"right",icon:"arrow-right"},{value:"up",icon:"arrow-up"},{value:"down",icon:"arrow-down"}],zv=[{value:"left",icon:"arrow-left"},{value:"right",icon:"arrow-right"}],Zv=[{value:"up",icon:"arrow-up"},{value:"down",icon:"arrow-down"}],as={timing:{type:"buttonRadio",name:"timing",label:"Animate",options:qv},speed:{type:"slider",name:"speed",label:"Speed",min:0,max:100,step:1}},$l={type:"switch",name:"reverseExit",label:"Reverse exit animation"},ey=.2,ty=3;function iy(i,e){const t=i==="both"?e/2:e;return Math.min(ty,t)}function ls({speed:i,timing:e,elementDuration:t}){const r=iy(e,t),n=Math.min(ey,r),s=Math.max(0,Math.min(100,i))/100;return r-s*(r-n)}const ry="easeOut";function cs(i){return{values:e=>{var t;return{timing:e.timing??"both",speed:[e.speed??50],...((t=i==null?void 0:i.values)==null?void 0:t.call(i,e))??{}}},options:e=>{var t;return{timing:e.timing,speed:e.speed[0],easing:ry,...((t=i==null?void 0:i.options)==null?void 0:t.call(i,e))??{}}}}}function hr({timing:i,duration:e,elementDuration:t,easing:r,reverseExit:n=!1,enterFrom:s,exitTo:o,restValue:a}){const c=[],l=i==="both"||i==="enter",u=i==="both"||i==="exit",A=Math.max(0,t-e);if(l?(c.push({time:0,value:s,easing:r}),c.push({time:e,value:a,easing:"linear"})):c.push({time:0,value:a,easing:"linear"}),u){A>e&&c.push({time:A,value:a,easing:r});const h=n?s:o;c.push({time:t,value:h,easing:r})}return c}const td="fade",ny={type:td,name:"Fade",options:{...as},transform:cs(),generate:(i,e)=>{const t=ls({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration});return{fade:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,enterFrom:0,exitTo:0,restValue:1}),renderer:ko}}}},id="pan",rd=.25,nd="left";function sd(i,e,t){switch(i){case"left":return{x:e.width*t,y:0};case"right":return{x:-e.width*t,y:0};default:return sd(nd,e,t)}}function sy(i){return{x:-i.x,y:-i.y}}const oy={type:id,name:"Pan",options:{...as,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:zv},distance:{type:"slider",name:"distance",label:"Distance",min:.1,max:1,step:.05,transform:{format:i=>`${(i*100).toFixed(0)}%`}},reverseExit:$l},transform:cs({values:i=>({direction:i.direction??nd,distance:[i.distance??rd],reverseExit:i.reverseExit??!1}),options:i=>({direction:i.direction,distance:i.distance[0],reverseExit:i.reverseExit})}),generate:(i,e)=>{const t=ls({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration}),r=i.distance??rd,n=sd(i.direction,e.elementDimensions,r),s=sy(n);return{fade:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:0,exitTo:0,restValue:1}),renderer:ko},translate:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:n,exitTo:s,restValue:{x:0,y:0}}),renderer:ed}}}},od="pop",ad=.5,ay={type:od,name:"Pop",options:{...as},transform:cs(),generate:(i,e)=>{const t=ls({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration});return{fade:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,enterFrom:0,exitTo:0,restValue:1}),renderer:ko},scale:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:"backOut",enterFrom:ad,exitTo:ad,restValue:1}),renderer:Jv}}}},ld="rise",cd=50,ly="up";function cy(i,e){switch(i){case"down":return{enterY:-e,exitY:e};case"up":default:return{enterY:e,exitY:-e}}}const Ay={type:ld,name:"Rise",options:{...as,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:Zv},distance:{type:"slider",name:"distance",label:"Distance",min:5,max:100,step:5,transform:{format:i=>`${i}px`}},reverseExit:$l},transform:cs({values:i=>({direction:i.direction??ly,distance:[i.distance??cd],reverseExit:i.reverseExit??!1}),options:i=>({direction:i.direction,distance:i.distance[0],reverseExit:i.reverseExit})}),generate:(i,e)=>{const t=ls({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration}),r=i.distance??cd,{enterY:n,exitY:s}=cy(i.direction,r);return{fade:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:0,exitTo:0,restValue:1}),renderer:ko},translate:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:{x:0,y:n},exitTo:{x:0,y:s},restValue:{x:0,y:0}}),renderer:ed}}}},Ad="wipe",Yl="left";function an(i){switch(i){case"left":return{coordinates:{x:1,y:0},dimensions:{width:0,height:1}};case"right":return{coordinates:{x:0,y:0},dimensions:{width:0,height:1}};case"up":return{coordinates:{x:0,y:1},dimensions:{width:1,height:0}};case"down":return{coordinates:{x:0,y:0},dimensions:{width:1,height:0}};default:return an(Yl)}}function ud(i){switch(i){case"left":return an("right");case"right":return an("left");case"up":return an("down");case"down":return an("up");default:return ud(Yl)}}const uy={coordinates:{x:0,y:0},dimensions:{width:1,height:1}},hy={type:Ad,name:"Wipe",options:{...as,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:Xv},reverseExit:$l},transform:cs({values:i=>({direction:i.direction??Yl,reverseExit:i.reverseExit??!1}),options:i=>({direction:i.direction,reverseExit:i.reverseExit})}),generate:(i,e)=>{const t=ls({speed:i.speed,timing:i.timing,elementDuration:e.elementDuration}),r=an(i.direction),n=ud(i.direction);return{clip:{keyframes:hr({timing:i.timing,duration:t,elementDuration:e.elementDuration,easing:i.easing,reverseExit:i.reverseExit,enterFrom:r,exitTo:n,restValue:uy}),renderer:jv}}}},dy={[td]:ny,[ld]:Ay,[od]:ay,[id]:oy,[Ad]:hy};function fy(i,e){const{type:t,...r}=i,n=dy[t];if(!n)throw new Error(`Unknown preset type: ${t}`);return n.generate(r,e)}function gy({animation:i,sceneTime:e}){const t=i.keyframes;if(!t||t.length===0)return null;const r=[...t].sort((s,o)=>s.time-o.time);if(e<r[0].time)return null;const n=r[r.length-1];if(e>=n.time)return i.renderer.processor.getTargetState(n.value);for(let s=0;s<r.length-1;s++){const o=r[s],a=r[s+1];if(e>=o.time&&e<=a.time){const c=a.time-o.time,l=c===0?0:(e-o.time)/c,u=o.easing||"linear",A=i.renderer.processor.getTargetState(o.value);return i.renderer.processor.interpolateState({easing:u,progress:l,from:A,value:a.value})}}return null}function py(i,e,t){const{preset:r,...n}=i;if(!r)return n;const s=fy(r,{elementDuration:e,elementDimensions:t});return{...n,...s}}function hd({layout:i,sceneTime:e,animations:t,elementDuration:r=5,elementDimensions:n={width:100,height:100}}){var s,o,a,c,l,u,A,h,d,f,g;let p={clip:null,opacity:((s=i==null?void 0:i.transform)==null?void 0:s.opacity)??1,translation:{x:((a=(o=i==null?void 0:i.transform)==null?void 0:o.translate)==null?void 0:a.x)??0,y:((l=(c=i==null?void 0:i.transform)==null?void 0:c.translate)==null?void 0:l.y)??0},scale:((u=i==null?void 0:i.transform)==null?void 0:u.scale)??1,rotation:((A=i==null?void 0:i.transform)==null?void 0:A.rotation)??0,dimensions:{widthRatio:((d=(h=i==null?void 0:i.transform)==null?void 0:h.dimension)==null?void 0:d.widthRatio)??1,heightRatio:((g=(f=i==null?void 0:i.transform)==null?void 0:f.dimension)==null?void 0:g.heightRatio)??1}};if(!t)return p;const I=py(t,r,n);for(const C of Object.values(I)){if(!C)continue;const B=gy({animation:C,sceneTime:e});B&&(p={...p,...B})}return p}const my=[];for(let i=0;i<256;++i)my.push((i+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ey="audio",dd=i=>`${i.toFixed(1)}s`,Iy={type:Ey,options:{speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:2,step:.01,transform:{input:i=>i/100,output:i=>i*100,format:i=>`${(i*100).toFixed(0)}%`}},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01,transform:{input:i=>i/2/100,output:i=>i*2*100,format:i=>`${(i*2*100).toFixed(0)}%`}},duck:{type:"checkbox",name:"duck",label:"Duck under video"},duckLevel:{type:"slider",name:"duckLevel",label:"Duck to",min:0,max:1,step:.01,visible:i=>i.duck,transform:{input:i=>i/100,output:i=>i*100,format:i=>`${(i*100).toFixed(0)}%`}},fadeIn:{type:"slider",name:"fadeIn",label:"Fade in",min:0,max:5,step:.1,transform:{format:dd}},fadeOut:{type:"slider",name:"fadeOut",label:"Fade out",min:0,max:5,step:.1,transform:{format:dd}},loop:{type:"checkbox",name:"loop",label:"Loop"}},transform:{values:i=>({speed:[i.speed??1],volume:[i.volume??.5],loop:i.loop??!1,duck:i.duck??!1,duckLevel:[i.duckLevel??.25],fadeIn:[i.fadeIn??0],fadeOut:[i.fadeOut??0]}),options:i=>({speed:i.speed[0],volume:i.volume[0],loop:i.loop,duck:i.duck,duckLevel:i.duckLevel[0],fadeIn:i.fadeIn[0],fadeOut:i.fadeOut[0]})}},Ki=1.8;function vy({context:i,x:e,y:t,width:r,height:n,radii:s}){let o,a,c,l;typeof s=="number"?o=a=c=l=s:[o,a,c,l]=s,i.beginPath(),i.moveTo(e+Math.min(n/Ki,o),t),i.lineTo(e+r-Math.min(n/Ki,a),t),i.quadraticCurveTo(e+r,t,e+r,t+Math.min(n/Ki,a)),i.lineTo(e+r,t+n-Math.min(n/Ki,c)),i.quadraticCurveTo(e+r,t+n,e+r-Math.min(n/Ki,c),t+n),i.lineTo(e+Math.min(n/Ki,l),t+n),i.quadraticCurveTo(e,t+n,e,t+n-Math.min(n/Ki,l)),i.lineTo(e,t+Math.min(n/Ki,o)),i.quadraticCurveTo(e,t,e+Math.min(n/Ki,o),t),i.closePath()}function yy({context:i,x:e,y:t,width:r,height:n,radii:s,clip:o=!1,debug:a=!1}){vy({context:i,x:e,y:t,width:r,height:n,radii:s}),a&&(i.strokeStyle="blue",i.stroke()),o&&i.clip()}function fd(){var i=function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},n={};r.L=1,n[1]="L",Object.keys(t).forEach(function(ue,Le){r[ue]=1<<Le+1,n[r[ue]]=ue}),Object.freeze(r);var s=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,a=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,c=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,l=r.S|r.WS|r.B|s|r.PDI|c,u=null;function A(){if(!u){u=new Map;var ue=function(be){if(t.hasOwnProperty(be)){var le=0;t[be].split(",").forEach(function(ge){var ve=ge.split("+"),Te=ve[0],Ce=ve[1];Te=parseInt(Te,36),Ce=Ce?parseInt(Ce,36):0,u.set(le+=Te,r[be]);for(var Ue=0;Ue<Ce;Ue++)u.set(++le,r[be])})}};for(var Le in t)ue(Le)}}function h(ue){return A(),u.get(ue.codePointAt(0))||r.L}function d(ue){return n[h(ue)]}var f={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function g(ue,Le){var be=36,le=0,ge=new Map,ve=Le&&new Map,Te;return ue.split(",").forEach(function Ce(Ue){if(Ue.indexOf("+")!==-1)for(var T=+Ue;T--;)Ce(Te);else{Te=Ue;var m=Ue.split(">"),E=m[0],w=m[1];E=String.fromCodePoint(le+=parseInt(E,be)),w=String.fromCodePoint(le+=parseInt(w,be)),ge.set(E,w),Le&&ve.set(w,E)}}),{map:ge,reverseMap:ve}}var p,I,C;function B(){if(!p){var ue=g(f.pairs,!0),Le=ue.map,be=ue.reverseMap;p=Le,I=be,C=g(f.canonical,!1).map}}function y(ue){return B(),p.get(ue)||null}function x(ue){return B(),I.get(ue)||null}function Q(ue){return B(),C.get(ue)||null}var _=r.L,M=r.R,P=r.EN,D=r.ES,$=r.ET,K=r.AN,ee=r.CS,z=r.B,L=r.S,O=r.ON,V=r.BN,k=r.NSM,R=r.AL,F=r.LRO,j=r.RLO,Y=r.LRE,ie=r.RLE,ae=r.PDF,fe=r.LRI,Ee=r.RLI,Pe=r.FSI,we=r.PDI;function Ne(ue,Le){for(var be=125,le=new Uint32Array(ue.length),ge=0;ge<ue.length;ge++)le[ge]=h(ue[ge]);var ve=new Map;function Te(Wt,Bi){var jt=le[Wt];le[Wt]=Bi,ve.set(jt,ve.get(jt)-1),jt&a&&ve.set(a,ve.get(a)-1),ve.set(Bi,(ve.get(Bi)||0)+1),Bi&a&&ve.set(a,(ve.get(a)||0)+1)}for(var Ce=new Uint8Array(ue.length),Ue=new Map,T=[],m=null,E=0;E<ue.length;E++)m||T.push(m={start:E,end:ue.length-1,level:Le==="rtl"?1:Le==="ltr"?0:xp(E,!1)}),le[E]&z&&(m.end=E,m=null);for(var w=ie|Y|j|F|s|we|ae|z,U=function(Wt){return Wt+(Wt&1?1:2)},J=function(Wt){return Wt+(Wt&1?2:1)},Z=0;Z<T.length;Z++){m=T[Z];var G=[{_level:m.level,_override:0,_isolate:0}],se=void 0,he=0,Be=0,ye=0;ve.clear();for(var $e=m.start;$e<=m.end;$e++){var Xe=le[$e];if(se=G[G.length-1],ve.set(Xe,(ve.get(Xe)||0)+1),Xe&a&&ve.set(a,(ve.get(a)||0)+1),Xe&w)if(Xe&(ie|Y)){Ce[$e]=se._level;var Bt=(Xe===ie?J:U)(se._level);Bt<=be&&!he&&!Be?G.push({_level:Bt,_override:0,_isolate:0}):he||Be++}else if(Xe&(j|F)){Ce[$e]=se._level;var er=(Xe===j?J:U)(se._level);er<=be&&!he&&!Be?G.push({_level:er,_override:Xe&j?M:_,_isolate:0}):he||Be++}else if(Xe&s){Xe&Pe&&(Xe=xp($e+1,!0)===1?Ee:fe),Ce[$e]=se._level,se._override&&Te($e,se._override);var Tt=(Xe===Ee?J:U)(se._level);Tt<=be&&he===0&&Be===0?(ye++,G.push({_level:Tt,_override:0,_isolate:1,_isolInitIndex:$e})):he++}else if(Xe&we){if(he>0)he--;else if(ye>0){for(Be=0;!G[G.length-1]._isolate;)G.pop();var Ii=G[G.length-1]._isolInitIndex;Ii!=null&&(Ue.set(Ii,$e),Ue.set($e,Ii)),G.pop(),ye--}se=G[G.length-1],Ce[$e]=se._level,se._override&&Te($e,se._override)}else Xe&ae?(he===0&&(Be>0?Be--:!se._isolate&&G.length>1&&(G.pop(),se=G[G.length-1])),Ce[$e]=se._level):Xe&z&&(Ce[$e]=m.level);else Ce[$e]=se._level,se._override&&Xe!==V&&Te($e,se._override)}for(var Zt=[],bt=null,ei=m.start;ei<=m.end;ei++){var tr=le[ei];if(!(tr&c)){var ir=Ce[ei],ka=tr&s,vi=tr===we;bt&&ir===bt._level?(bt._end=ei,bt._endsWithIsolInit=ka):Zt.push(bt={_start:ei,_end:ei,_level:ir,_startsWithPDI:vi,_endsWithIsolInit:ka})}}for(var Os=[],wn=0;wn<Zt.length;wn++){var Ft=Zt[wn];if(!Ft._startsWithPDI||Ft._startsWithPDI&&!Ue.has(Ft._start)){for(var Qn=[bt=Ft],qr=void 0;bt&&bt._endsWithIsolInit&&(qr=Ue.get(bt._end))!=null;)for(var Br=wn+1;Br<Zt.length;Br++)if(Zt[Br]._start===qr){Qn.push(bt=Zt[Br]);break}for(var Gi=[],Xr=0;Xr<Qn.length;Xr++)for(var Rn=Qn[Xr],Us=Rn._start;Us<=Rn._end;Us++)Gi.push(Us);for(var MA=Ce[Gi[0]],Ma=m.level,_n=Gi[0]-1;_n>=0;_n--)if(!(le[_n]&c)){Ma=Ce[_n];break}var Gs=Gi[Gi.length-1],FA=Ce[Gs],Fa=m.level;if(!(le[Gs]&s)){for(var Dn=Gs+1;Dn<=m.end;Dn++)if(!(le[Dn]&c)){Fa=Ce[Dn];break}}Os.push({_seqIndices:Gi,_sosType:Math.max(Ma,MA)%2?M:_,_eosType:Math.max(Fa,FA)%2?M:_})}}for(var Hs=0;Hs<Os.length;Hs++){var Ln=Os[Hs],Qe=Ln._seqIndices,zr=Ln._sosType,PA=Ln._eosType,rr=Ce[Qe[0]]&1?M:_;if(ve.get(k))for(var kn=0;kn<Qe.length;kn++){var $s=Qe[kn];if(le[$s]&k){for(var Tr=zr,Mn=kn-1;Mn>=0;Mn--)if(!(le[Qe[Mn]]&c)){Tr=le[Qe[Mn]];break}Te($s,Tr&(s|we)?O:Tr)}}if(ve.get(P))for(var Fn=0;Fn<Qe.length;Fn++){var Ys=Qe[Fn];if(le[Ys]&P)for(var br=Fn-1;br>=-1;br--){var hi=br===-1?zr:le[Qe[br]];if(hi&o){hi===R&&Te(Ys,K);break}}}if(ve.get(R))for(var Sr=0;Sr<Qe.length;Sr++){var Vs=Qe[Sr];le[Vs]&R&&Te(Vs,M)}if(ve.get(D)||ve.get(ee))for(var b=1;b<Qe.length-1;b++){var S=Qe[b];if(le[S]&(D|ee)){for(var N=0,H=0,X=b-1;X>=0&&(N=le[Qe[X]],!!(N&c));X--);for(var te=b+1;te<Qe.length&&(H=le[Qe[te]],!!(H&c));te++);N===H&&(le[S]===D?N===P:N&(P|K))&&Te(S,N)}}if(ve.get(P))for(var oe=0;oe<Qe.length;oe++){var ce=Qe[oe];if(le[ce]&P){for(var de=oe-1;de>=0&&le[Qe[de]]&($|c);de--)Te(Qe[de],P);for(oe++;oe<Qe.length&&le[Qe[oe]]&($|c|P);oe++)le[Qe[oe]]!==P&&Te(Qe[oe],P)}}if(ve.get($)||ve.get(D)||ve.get(ee))for(var Ae=0;Ae<Qe.length;Ae++){var Ie=Qe[Ae];if(le[Ie]&($|D|ee)){Te(Ie,O);for(var _e=Ae-1;_e>=0&&le[Qe[_e]]&c;_e--)Te(Qe[_e],O);for(var je=Ae+1;je<Qe.length&&le[Qe[je]]&c;je++)Te(Qe[je],O)}}if(ve.get(P))for(var lt=0,Ze=zr;lt<Qe.length;lt++){var Pt=Qe[lt],Ot=le[Pt];Ot&P?Ze===_&&Te(Pt,_):Ot&o&&(Ze=Ot)}if(ve.get(a)){var yi=M|P|K,di=yi|_,Zr=[];{for(var nr=[],Pn=0;Pn<Qe.length;Pn++)if(le[Qe[Pn]]&a){var Ks=ue[Qe[Pn]],Ep=void 0;if(y(Ks)!==null)if(nr.length<63)nr.push({char:Ks,seqIndex:Pn});else break;else if((Ep=x(Ks))!==null)for(var Ws=nr.length-1;Ws>=0;Ws--){var NA=nr[Ws].char;if(NA===Ep||NA===x(Q(Ks))||y(Q(NA))===Ks){Zr.push([nr[Ws].seqIndex,Pn]),nr.length=Ws;break}}}Zr.sort(function(Wt,Bi){return Wt[0]-Bi[0]})}for(var OA=0;OA<Zr.length;OA++){for(var Ip=Zr[OA],Pa=Ip[0],UA=Ip[1],vp=!1,Ci=0,GA=Pa+1;GA<UA;GA++){var yp=Qe[GA];if(le[yp]&di){vp=!0;var Cp=le[yp]&yi?M:_;if(Cp===rr){Ci=Cp;break}}}if(vp&&!Ci){Ci=zr;for(var HA=Pa-1;HA>=0;HA--){var Bp=Qe[HA];if(le[Bp]&di){var Tp=le[Bp]&yi?M:_;Tp!==rr?Ci=Tp:Ci=rr;break}}}if(Ci){if(le[Qe[Pa]]=le[Qe[UA]]=Ci,Ci!==rr){for(var js=Pa+1;js<Qe.length;js++)if(!(le[Qe[js]]&c)){h(ue[Qe[js]])&k&&(le[Qe[js]]=Ci);break}}if(Ci!==rr){for(var Js=UA+1;Js<Qe.length;Js++)if(!(le[Qe[Js]]&c)){h(ue[Qe[Js]])&k&&(le[Qe[Js]]=Ci);break}}}}for(var xr=0;xr<Qe.length;xr++)if(le[Qe[xr]]&a){for(var bp=xr,$A=xr,YA=zr,qs=xr-1;qs>=0;qs--)if(le[Qe[qs]]&c)bp=qs;else{YA=le[Qe[qs]]&yi?M:_;break}for(var Sp=PA,Xs=xr+1;Xs<Qe.length;Xs++)if(le[Qe[Xs]]&(a|c))$A=Xs;else{Sp=le[Qe[Xs]]&yi?M:_;break}for(var VA=bp;VA<=$A;VA++)le[Qe[VA]]=YA===Sp?YA:rr;xr=$A}}}for(var ti=m.start;ti<=m.end;ti++){var MQ=Ce[ti],Na=le[ti];if(MQ&1?Na&(_|P|K)&&Ce[ti]++:Na&M?Ce[ti]++:Na&(K|P)&&(Ce[ti]+=2),Na&c&&(Ce[ti]=ti===0?m.level:Ce[ti-1]),ti===m.end||h(ue[ti])&(L|z))for(var Oa=ti;Oa>=0&&h(ue[Oa])&l;Oa--)Ce[Oa]=m.level}}return{levels:Ce,paragraphs:T};function xp(Wt,Bi){for(var jt=Wt;jt<ue.length;jt++){var wr=le[jt];if(wr&(M|R))return 1;if(wr&(z|_)||Bi&&wr===we)return 0;if(wr&s){var wp=FQ(jt);jt=wp===-1?ue.length:wp}}return 0}function FQ(Wt){for(var Bi=1,jt=Wt+1;jt<ue.length;jt++){var wr=le[jt];if(wr&z)break;if(wr&we){if(--Bi===0)return jt}else wr&s&&Bi++}return-1}}var pe="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",Me;function We(){if(!Me){var ue=g(pe,!0),Le=ue.map,be=ue.reverseMap;be.forEach(function(le,ge){Le.set(ge,le)}),Me=Le}}function Oe(ue){return We(),Me.get(ue)||null}function ze(ue,Le,be,le){var ge=ue.length;be=Math.max(0,be==null?0:+be),le=Math.min(ge-1,le==null?ge-1:+le);for(var ve=new Map,Te=be;Te<=le;Te++)if(Le[Te]&1){var Ce=Oe(ue[Te]);Ce!==null&&ve.set(Te,Ce)}return ve}function De(ue,Le,be,le){var ge=ue.length;be=Math.max(0,be==null?0:+be),le=Math.min(ge-1,le==null?ge-1:+le);var ve=[];return Le.paragraphs.forEach(function(Te){var Ce=Math.max(be,Te.start),Ue=Math.min(le,Te.end);if(Ce<Ue){for(var T=Le.levels.slice(Ce,Ue+1),m=Ue;m>=Ce&&h(ue[m])&l;m--)T[m]=Te.level;for(var E=Te.level,w=1/0,U=0;U<T.length;U++){var J=T[U];J>E&&(E=J),J<w&&(w=J|1)}for(var Z=E;Z>=w;Z--)for(var G=0;G<T.length;G++)if(T[G]>=Z){for(var se=G;G+1<T.length&&T[G+1]>=Z;)G++;G>se&&ve.push([se+Ce,G+Ce])}}}),ve}function Re(ue,Le,be,le){var ge=He(ue,Le,be,le),ve=[].concat(ue);return ge.forEach(function(Te,Ce){ve[Ce]=(Le.levels[Te]&1?Oe(ue[Te]):null)||ue[Te]}),ve.join("")}function He(ue,Le,be,le){for(var ge=De(ue,Le,be,le),ve=[],Te=0;Te<ue.length;Te++)ve[Te]=Te;return ge.forEach(function(Ce){for(var Ue=Ce[0],T=Ce[1],m=ve.slice(Ue,T+1),E=m.length;E--;)ve[T-E]=m[E]}),ve}return e.closingToOpeningBracket=x,e.getBidiCharType=h,e.getBidiCharTypeName=d,e.getCanonicalBracket=Q,e.getEmbeddingLevels=Ne,e.getMirroredCharacter=Oe,e.getMirroredCharactersMap=ze,e.getReorderSegments=De,e.getReorderedIndices=He,e.getReorderedString=Re,e.openingToClosingBracket=y,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return i}const gd=Object.freeze(Object.defineProperty({__proto__:null,default:fd},Symbol.toStringTag,{value:"Module"})),Cy=typeof gd=="function"?gd:fd;function By(i,e){return i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":i??"left"}const pd=Cy();function Ty(i){var e;if(!i)return"ltr";try{const{paragraphs:t}=pd.getEmbeddingLevels(i);return(((e=t[0])==null?void 0:e.level)??0)%2===1?"rtl":"ltr"}catch{return"ltr"}}function by(i){return{order:i.map((e,t)=>t),directions:i.map(()=>"ltr"),baseDirection:"ltr"}}function Sy(i,e){var t;if(!i.length)return{order:[],directions:[],baseDirection:e??"ltr"};try{const r=i.map(({text:d})=>d).join(" "),{levels:n,paragraphs:s}=pd.getEmbeddingLevels(r,e),o=((t=s[0])==null?void 0:t.level)??0,a=o%2===1?"rtl":"ltr",c=[];let l=0;for(const d of i)c.push(n[l]??o),l+=d.text.length+1;const u=i.map((d,f)=>f),A=Math.max(...c);for(let d=A;d>=1;d--){let f=-1;for(let g=0;g<=u.length;g++){const p=g<u.length&&c[u[g]]>=d;if(p&&f<0)f=g;else if(!p&&f>=0){const I=u.slice(f,g).reverse();u.splice(f,I.length,...I),f=-1}}}const h=c.map(d=>d%2===1?"rtl":"ltr");return{order:u,directions:h,baseDirection:a}}catch{return by(i)}}const xy=500;function wy(){const i=new Map,e={has:t=>i.has(t),get:t=>i.get(t),set:(t,r)=>{if(i.size>=xy&&!i.has(t)){const n=i.keys().next();n.done||i.delete(n.value)}i.set(t,r)},delete:t=>i.delete(t),clear:()=>i.clear()};return typeof document<"u"&&"fonts"in document&&document.fonts.addEventListener("loadingdone",()=>e.clear()),e}let Vl;function Qy(){return Vl===void 0&&(Vl=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"word"}):null),Vl}const md=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;function Ry(i){return i.split(`
|
|
2462
|
-
`).map(e=>{if(!e)return[];const t=[];for(const r of e.match(/\S+|\s+/g)??[])if(/^\s+$/.test(r))t.push({text:r,logicalIndex:t.length,whitespace:!0,spaceBefore:!1});else if(md.test(r))for(const n of Ed(r))t.push({text:n.text,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});else t.push({text:r,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});return t})}function Ed(i){const e=[];let t=!1,r="";const n=Qy();if(!n)return[{text:i,spaceBefore:!1}];for(const{segment:s,isWordLike:o}of n.segment(i)){if(!o&&s.trim().length===0){t=e.length>0?!0:t;continue}if(o){e.push({text:s,spaceBefore:t}),t=!1;continue}e.length>0?e[e.length-1].text+=s:r+=s}return r&&e.length>0?e[0].text=r+e[0].text:r&&e.push({text:r,spaceBefore:t}),e}function _y(i){const e=[];for(const t of i){const n=md.test(t.text)||/\s/.test(t.text)?Ed(t.text):[{text:t.text,spaceBefore:!1}];if(n.length<=1){e.push({text:t.text,logicalIndex:e.length,whitespace:!1,spaceBefore:e.length>0,timing:{id:t.id,start:t.start,end:t.end}});continue}const s=n.reduce((c,l)=>c+[...l.text].length,0),o=t.end-t.start;let a=t.start;n.forEach((c,l)=>{const u=[...c.text].length/s*o,A=a,h=l===n.length-1?t.end:a+u;a=h,e.push({text:c.text,logicalIndex:e.length,whitespace:!1,spaceBefore:l===0?e.length>0:c.spaceBefore,timing:{id:t.id,subIndex:l,start:A,end:h}})})}return e}const Dy=/(?<value>\d+\.?\d*)(?=px)/,Kl=1;function Ly(i,e){const t=typeof i=="string"?Ry(i):[_y(i)];return e?t.map(r=>r.map(n=>({...n,text:n.text.toUpperCase()}))):t}function ky({context:i,groups:e,appendedFont:t,fontSizes:r,maxW:n,wrap:s,strokeWidth:o,letterSpacing:a,wholeLineMeasure:c}){const l=[],u=h=>{const d=r[h%r.length];return{fontSize:d,font:t.replace(Dy,d.toString())}},A=(h,d)=>(i.font=h,i.letterSpacing=`${a}px`,i.measureText(d));for(const h of e){const d=l.length,{fontSize:f,font:g}=u(l.length);let p={items:[],font:g,fontSize:f,lineWidth:0,fontAscent:0,fontDescent:0},I="",C="";const B=()=>{const y=A(p.font,"");p.fontAscent=y.fontBoundingBoxAscent,p.fontDescent=y.fontBoundingBoxDescent,l.push(p);const x=u(l.length);p={items:[],font:x.font,fontSize:x.fontSize,lineWidth:0,fontAscent:0,fontDescent:0},I="",C=""};for(const y of h){if(y.whitespace){C+=y.text;continue}const x=()=>{const M=p.items.length>0&&y.spaceBefore&&!C?" ":C,P=M?A(p.font,M).width:0,D=A(p.font,y.text);return{token:y,metrics:D,width:D.width+o,gapBefore:P,gapText:M}};let Q=x();const _=c?A(p.font,I+Q.gapText+y.text).width+o*(p.items.length+1):p.lineWidth+Q.gapBefore+Q.width;if(s&&_>n+Kl&&p.items.length>0&&(B(),Q=x()),s&&c&&p.items.length===0&&Q.width>n+Kl){let M=y.text;for(;M.length>0;){let P="";for(const $ of M){const K=A(p.font,P+$).width+o;if(P&&K>n+Kl)break;P+=$}M=M.slice(P.length);const D=A(p.font,P);p.items.push({token:{...y,text:P},metrics:D,width:D.width+o,gapBefore:0,gapText:""}),I=P,p.lineWidth=D.width+o*p.items.length,M.length>0&&B()}C="";continue}p.items.push(Q),I+=Q.gapText+y.text,p.lineWidth=c?A(p.font,I).width+o*p.items.length:p.lineWidth+Q.gapBefore+Q.width,C=""}c&&C&&(p.items.length>0||l.length===d)&&(I+=C,p.lineWidth=A(p.font,I).width+o*p.items.length),(p.items.length>0||l.length===d)&&B()}return l}const Id=[{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"},{family:"Noto Telugu",regex:new RegExp("\\p{Script=Telugu}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansTelugu-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Tamil",regex:new RegExp("\\p{Script=Tamil}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansTamil-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Kannada",regex:new RegExp("\\p{Script=Kannada}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKannada-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Malayalam",regex:new RegExp("\\p{Script=Malayalam}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansMalayalam-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Bengali",regex:new RegExp("\\p{Script=Bengali}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansBengali-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Gujarati",regex:new RegExp("\\p{Script=Gujarati}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansGujarati-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Gurmukhi",regex:new RegExp("\\p{Script=Gurmukhi}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansGurmukhi-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Sinhala",regex:new RegExp("\\p{Script=Sinhala}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSinhala-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Thai",regex:new RegExp("\\p{Script=Thai}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansThai-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Lao",regex:new RegExp("\\p{Script=Lao}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansLao-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Khmer",regex:new RegExp("\\p{Script=Khmer}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKhmer-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Myanmar",regex:new RegExp("\\p{Script=Myanmar}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansMyanmar-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Ethiopic",regex:new RegExp("\\p{Script=Ethiopic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansEthiopic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Armenian",regex:new RegExp("\\p{Script=Armenian}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArmenian-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Georgian",regex:new RegExp("\\p{Script=Georgian}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansGeorgian-VariableFont_wdth%2Cwght.woff2",style:"normal"}];function vd({text:i,font:e}){let t=e;return Id.forEach(({family:r,regex:n})=>{n.exec(i)&&(t+=`, ${r}`)}),t}function yd(i){return Math.max(i??1,.5)}function My({measured:i,index:e,lineTop:t,dx:r,dw:n,align:s,direction:o,lineHeight:a,strokeWidth:c}){const{items:l,font:u,fontSize:A,lineWidth:h,fontAscent:d,fontDescent:f}=i;let g=0;s==="center"?g=(n-h)/2:s==="right"&&(g=n-h);const p=yd(a),I=A*p+c,C=(p-1)*A/2,B=(A+d-f)/2,y=t+C+B+c/2,{order:x,directions:Q,baseDirection:_}=Sy(l.map(({token:z})=>({text:z.text})),o),M=l.map(({gapBefore:z})=>z);let P=r+g+c/2;const D=[];x.forEach((z,L)=>{const O=l[z];P+=M[L],D.push({...O.token,x:P,baselineY:y,width:O.width,lineIndex:e,direction:Q[z],font:u,metrics:O.metrics}),P+=O.width});const $=[],K=[];D.forEach((z,L)=>{const O=$[$.length-1];if(O&&O.direction===z.direction){const V=Math.max(O.x+O.width,z.x+z.width);O.tokens.push(z),O.x=Math.min(O.x,z.x),O.width=V-O.x,K[K.length-1].push(x[L])}else $.push({text:"",x:z.x,width:z.width,direction:z.direction,tokens:[z]}),K.push([x[L]])}),$.forEach((z,L)=>{const O=[...K[L]].sort((V,k)=>V-k);z.text=O.map((V,k)=>k===0?l[V].token.text:`${l[V].gapText}${l[V].token.text}`).join("")});const ee=o??_;return{index:e,box:{x:r+g,y:t,width:h,height:I},baselineY:y,direction:ee,runs:$,tokens:D}}function Fy(i){const{context:e,text:t,font:r,fontSizes:n,dx:s=0,dy:o=0,maxW:a=1/0,dw:c=a,align:l="left",direction:u,lineHeight:A,lineGap:h=0,letterSpacing:d=0,strokeWidth:f=0,wrap:g=!0,uppercase:p=!1}=i,I=Ly(t,p),C=I.flat().map(({text:Q})=>Q).join(" "),B=vd({font:r,text:C}),y=u??Ty(C),x=By(l,y);try{e.save();const Q=ky({context:e,groups:I,appendedFont:B,fontSizes:n,maxW:a,wrap:g,strokeWidth:f,letterSpacing:d,wholeLineMeasure:typeof t=="string"}),_=[];let M=o;for(let ee=0;ee<Q.length;ee++){const z=My({measured:Q[ee],index:ee,lineTop:M,dx:s,dw:c,align:x,direction:u,lineHeight:A,strokeWidth:f});_.push(z),M+=z.box.height+h}const P=Q[Q.length-1],D=P?Math.max(0,(P.fontAscent+P.fontDescent-P.fontSize*yd(A))/2):0,$=_.reduce((ee,{box:z})=>ee+z.height,0)+h*Math.max(0,_.length-1)+D,K=_.length?{x:Math.min(..._.map(({box:ee})=>ee.x)),y:Math.min(..._.map(({box:ee})=>ee.y)),width:Math.max(..._.map(({box:ee})=>ee.x+ee.width))-Math.min(..._.map(({box:ee})=>ee.x)),height:Math.max(..._.map(({box:ee})=>ee.y+ee.height))-Math.min(..._.map(({box:ee})=>ee.y))}:{x:s,y:o,width:0,height:0};return{lines:_,totalHeight:$,blockBox:K,direction:y,font:B}}finally{e.restore()}}Tu(Fy,{cache:wy(),cacheKey:([i])=>JSON.stringify([i.text,i.font,i.fontSizes,i.dx,i.dy,i.dw,i.maxW,i.align,i.direction,i.lineHeight,i.lineGap,i.letterSpacing,i.strokeWidth,i.wrap,i.uppercase])});function Py(i){return i.slice(0,1).toUpperCase()+i.slice(1)}Object.keys(Zh).map(i=>({label:Py(i),value:i,data:i}));const Ny=bi(()=>ju.loadYoga());function Oy(i=.4,e=.4){const t=Math.max(.1,Math.min(.8,i)),r=Math.max(.2,Math.min(.6,e)),s=(1-t)/2,a=1-r;return[{x:0,y:s},{x:a,y:s},{x:a,y:0},{x:1,y:.5},{x:a,y:1},{x:a,y:1-s},{x:0,y:1-s}]}const Mo=64;function Uy(){const i=[],e={x:.5,y:.5},t=.5;for(let r=0;r<Mo;r++){const n=r/Mo*2*Math.PI,s=e.x+t*Math.cos(n),o=e.y+t*Math.sin(n);i.push({x:s,y:o})}return i}function Gy(i=1){const e=[],t={x:.5,y:.5};let r,n;i>=1?(r=.5,n=.5/i):(r=.5*i,n=.5);for(let s=0;s<Mo;s++){const o=s/Mo*2*Math.PI,a=t.x+r*Math.cos(o),c=t.y+n*Math.sin(o);e.push({x:a,y:c})}return e}function Hy(){const i=[];for(let t=0;t<=100;t++){const r=t/100*2*Math.PI,n=16*Math.sin(r)**3,s=-(13*Math.cos(r)-5*Math.cos(2*r)-2*Math.cos(3*r)-Math.cos(4*r)),o=(n+16)/32,a=(s+13)/26;i.push({x:o,y:a})}return i}function Cd(i=0,e=1){if(i===0)return[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}];const t=i*Math.PI/180,r=Math.tan(t)/e;return[{x:Math.max(0,Math.min(1,0+r)),y:0},{x:Math.max(0,Math.min(1,1+r)),y:0},{x:Math.max(0,Math.min(1,1-r)),y:1},{x:Math.max(0,Math.min(1,0-r)),y:1}]}function Fo(i){if(i<3)throw new Error("A polygon must have at least 3 sides");const e=[],t=[];for(let l=0;l<i;l++){const u=l*2*Math.PI/i-Math.PI/2,A=Math.cos(u),h=Math.sin(u);t.push({x:A,y:h})}const r=Math.min(...t.map(l=>l.x)),n=Math.max(...t.map(l=>l.x)),s=Math.min(...t.map(l=>l.y)),o=Math.max(...t.map(l=>l.y)),a=n-r,c=o-s;for(const l of t){const u=(l.x-r)/a,A=(l.y-s)/c;e.push({x:u,y:A})}return e}function Bd(i=90){const e=i*Math.PI/180,r=.5/Math.tan(e),s=1/(1+Math.abs(r)*2),o=r*s;return[{x:.5+o,y:0},{x:1,y:.5},{x:.5-o,y:1},{x:0,y:.5}]}function $y(i=5,e=.4){const t=[];for(let n=0;n<i*2;n++){const s=n*Math.PI/i-Math.PI/2,o=n%2===0?.5:e,a=.5+o*Math.cos(s),c=.5+o*Math.sin(s);t.push({x:a,y:c})}return t}function Yy(i="isosceles",e={}){switch(i){case"equilateral":return Vy();case"isosceles":return Td(e.baseAngle??60);case"right":return Ky(e.rightAnglePosition??"bottom-left");case"scalene":return Wy(e.angles??[60,60,60])}}function Vy(){return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}function Td(i){const e=i*Math.PI/180,t=.5/Math.tan(e),r=Math.max(.1,Math.min(2,t));return[{x:.5,y:1-Math.min(1,r)},{x:0,y:1},{x:1,y:1}]}function Ky(i){switch(i){case"top":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-left":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-right":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}}function Wy(i){return Td(i[0])}function jy(i={},e=1){const{type:t="rectangle",customPolygon:r,parallelogram:n,triangle:s,rhombus:o,arrow:a,star:c,regularPolygon:l}=i;switch(t){case"rectangle":return Cd(0,e);case"parallelogram":return Cd((n==null?void 0:n.angle)??30,e);case"triangle":return Yy((s==null?void 0:s.type)??"isosceles",{baseAngle:s==null?void 0:s.baseAngle,angles:s==null?void 0:s.angles,rightAnglePosition:s==null?void 0:s.rightAnglePosition});case"rhombus":return Bd((o==null?void 0:o.angle)??90);case"diamond":return Bd(90);case"pentagon":return Fo(5);case"hexagon":return Fo(6);case"octagon":return Fo(8);case"star":return $y((c==null?void 0:c.points)??5,(c==null?void 0:c.innerRadius)??.4);case"arrow":return Oy((a==null?void 0:a.shaftRatio)??.4,(a==null?void 0:a.headRatio)??.4);case"heart":return Hy();case"circle":return Uy();case"ellipse":return Gy(e);case"custom-polygon":if(!(r!=null&&r.points)||r.points.length<3)throw new Error("Custom polygon must have at least 3 points");return r.points;default:return Fo((l==null?void 0:l.sides)??6)}}function Jy(i,e){let t=!1;const r=i.x,n=i.y;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,c=e[s].y,l=e[o].x,u=e[o].y;c>n!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(t=!t)}return t}function qy(i,e){let t=1,r=0;const n=200;for(let s=0;s<=n;s++){const o=s/n;Jy({x:o,y:i},e)&&(t=Math.min(t,o),r=Math.max(r,o))}return r>=t?{left:t,right:r}:null}function Xy(i){const e=Math.min(...i.map(c=>c.y)),t=Math.max(...i.map(c=>c.y));let r={x:0,y:0,width:0,height:0},n=0;const s=200,o=(t-e)/s,a=[];for(let c=0;c<=s;c++){const l=e+c*o;a.push({y:l,span:qy(l,i)})}for(let c=0;c<a.length-1;c++){const l=a[c].y;for(let u=c+1;u<a.length;u++){const h=a[u].y-l;let d=0,f=1,g=!0;const p=Math.min(5,u-c+1);for(let I=0;I<p;I++){const C=c+Math.floor(I/(p-1)*(u-c)),B=a[C].span;if(B){if(d=Math.max(d,B.left),f=Math.min(f,B.right),d>=f){g=!1;break}}else{g=!1;break}}if(g&&f>d){const I=f-d,C=I*h;C>n&&(n=C,r={x:d,y:l,width:I,height:h})}}}return r}function zy(i,e=1){const t=jy(i,e);if(t.length<3)return{top:0,right:0,bottom:0,left:0};if(i.type==="rectangle")return{top:0,right:0,bottom:0,left:0};const r=Xy(t),n=r.y,s=r.x,o=1-(r.x+r.width),a=1-(r.y+r.height);return{top:Math.max(0,n),right:Math.max(0,o),bottom:Math.max(0,a),left:Math.max(0,s)}}const Zy="video",eC=.01,bd=(i,e)=>Math.abs(i-e)<=e*eC,tC={type:Zy,options:{flip:{type:"checkbox",name:"flip",label:"Flip"},loop:{type:"checkbox",name:"loop",label:"Loop"},speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:2,step:.01,transform:{input:i=>i/100,output:i=>i*100,format:i=>`${(i*100).toFixed(0)}%`}},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01,transform:{input:i=>i/2/100,output:i=>i*2*100,format:i=>`${(i*2*100).toFixed(0)}%`}}},transform:{values:i=>({flip:i.flip??!1,loop:i.loop??!1,crop:i.crop??{x:0,y:0,width:1,height:1},format:i.format??"letterbox",speed:[i.speed??1],volume:[i.volume??.5]}),options:i=>({flip:i.flip,loop:i.loop,crop:i.crop,format:i.format,speed:i.speed[0],volume:i.volume[0]})},width:({node:i,options:e,dependencies:t})=>{const{crop:r,format:n}=e;if(!t||n==="crop")return i.getComputedWidth();const s=t.aspectRatio*(((r==null?void 0:r.width)??1)/((r==null?void 0:r.height)??1)),o=i.getComputedWidth(),a=i.getComputedHeight(),c=o/a;return s>c||bd(s,c)?o:a*s},height:({node:i,options:e,dependencies:t})=>{const{crop:r,format:n}=e;if(!t||n==="crop")return i.getComputedHeight();const s=t.aspectRatio*(((r==null?void 0:r.width)??1)/((r==null?void 0:r.height)??1)),o=i.getComputedWidth(),a=i.getComputedHeight();return bd(s,o/a)?a:o/s},render:async({dx:i,dy:e,dw:t,dh:r,radius:n,sceneTime:s,options:o,dependencies:a,canvases:c})=>{const{crop:l,flip:u=!1,format:A="letterbox",speed:h=1}=o,d=c.sceneCanvas.getContext("2d");if(!d||!(a!=null&&a.video))return;const f=await a.video(s*h),g=(f==null?void 0:f.videoWidth)??(f==null?void 0:f.naturalWidth)??(f==null?void 0:f.width),p=(f==null?void 0:f.videoHeight)??(f==null?void 0:f.naturalHeight)??(f==null?void 0:f.height);if(g&&p){d.save();const{topLeft:I,topRight:C,bottomLeft:B,bottomRight:y}=n;yy({context:d,x:i,y:e,width:t,height:r,radii:[I,C,y,B]}),d.clip(),Wv({context:d,crop:l,flip:u,format:A,sourceWidth:g,sourceHeight:p,source:f,posX:i,posY:e,drawAreaWidth:t,drawAreaHeight:r,cropCanvas:c.cropCanvas,letterboxCanvas:c.letterboxCanvas}),d.restore()}}};function ri(i){let e=0;for(const t of i)Array.isArray(t)?e+=ri(t):e+=t;return e}function Po(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const c=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,l=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,A=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(c?l/2:l,t,A?u/2:u)*-1}return t})}function Wl(i,e){var t;const r=[];if(((t=i.renderer)==null?void 0:t.type)===e&&r.push(i),i.children)for(const n of i.children)r.push(...Wl(n,e));return r}function Sd(i){return i===null||typeof i=="number"&&!Number.isFinite(i)}function iC(i){const e={};for(const[t,r]of Object.entries(i))Sd(r)||(typeof r=="object"&&!Array.isArray(r)?e[t]=Object.fromEntries(Object.entries(r).filter(([,n])=>!Sd(n))):e[t]=r);return e}function rC(i){return typeof i=="number"?{topLeft:i,topRight:i,bottomRight:i,bottomLeft:i}:{topLeft:(i==null?void 0:i.topLeft)??0,topRight:(i==null?void 0:i.topRight)??0,bottomRight:(i==null?void 0:i.bottomRight)??0,bottomLeft:(i==null?void 0:i.bottomLeft)??0}}function nC(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:typeof i.top=="number"?i.top*e:i.top,right:typeof i.right=="number"?i.right*e:i.right,bottom:typeof i.bottom=="number"?i.bottom*e:i.bottom,left:typeof i.left=="number"?i.left*e:i.left}}function sC(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function oC(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function xd(i,e,{layout:t,scale:r=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:c,minHeight:l,maxWidth:u,maxHeight:A,flex:h,flexGrow:d,flexShrink:f,gap:g,margin:p,padding:I,direction:C="column",align:B="start",alignSelf:y,justify:x="start"}=iC(t??{}),Q={static:i.POSITION_TYPE_STATIC,relative:i.POSITION_TYPE_RELATIVE,absolute:i.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(Q[n]),typeof s<"u"){const{top:D,right:$,bottom:K,left:ee}=nC(s,r);typeof D<"u"&&e.setPosition(i.EDGE_TOP,D),typeof $<"u"&&e.setPosition(i.EDGE_RIGHT,$),typeof K<"u"&&e.setPosition(i.EDGE_BOTTOM,K),typeof ee<"u"&&e.setPosition(i.EDGE_LEFT,ee)}const _={row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(_[C]);const M={start:i.ALIGN_FLEX_START,end:i.ALIGN_FLEX_END,center:i.ALIGN_CENTER,stretch:i.ALIGN_STRETCH};e.setAlignItems(M[B]),y&&e.setAlignSelf(M[y]);const P={start:i.JUSTIFY_FLEX_START,end:i.JUSTIFY_FLEX_END,center:i.JUSTIFY_CENTER,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND,"space-evenly":i.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(P[x]),typeof p<"u"){const{top:D,right:$,bottom:K,left:ee}=sC(p,r);e.setMargin(i.EDGE_TOP,D),e.setMargin(i.EDGE_RIGHT,$),e.setMargin(i.EDGE_BOTTOM,K),e.setMargin(i.EDGE_LEFT,ee)}if(typeof I<"u"){const{top:D,right:$,bottom:K,left:ee}=oC(I,r);e.setPadding(i.EDGE_TOP,D),e.setPadding(i.EDGE_RIGHT,$),e.setPadding(i.EDGE_BOTTOM,K),e.setPadding(i.EDGE_LEFT,ee)}typeof d<"u"||typeof f<"u"?(typeof d<"u"&&e.setFlexGrow(d),typeof f<"u"&&e.setFlexShrink(f)):typeof h<"u"&&e.setFlex(h),e.setGap(i.GUTTER_ALL,(g??0)*r),typeof o<"u"&&e.setWidth(typeof o=="number"?o*r:o),typeof a<"u"&&e.setHeight(typeof a=="number"?a*r:a),typeof c<"u"&&e.setMinWidth(typeof c=="number"?c*r:c),typeof l<"u"&&e.setMinHeight(typeof l=="number"?l*r:l),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*r:u),typeof A<"u"&&e.setMaxHeight(typeof A=="number"?A*r:A)}async function wd({id:i,yoga:e,index:t,parent:r,element:n,resolvers:s}){var o,a,c;const{layout:l={},config:u={},options:A={},renderer:h}=n,d=e.Node.create();xd(e,d,{layout:l}),r.insertChild(d,t);let f=null;s&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="caption"||(h==null?void 0:h.type)==="image"||(h==null?void 0:h.type)==="video")&&((h==null?void 0:h.type)==="caption"?f=await((o=s.text)==null?void 0:o.call(s,{id:i,config:u,options:A}))??null:f=await((a=s[h.type])==null?void 0:a.call(s,{id:i,config:u,options:A}))??null);const g=[];for await(const[p,I]of((c=n.children)==null?void 0:c.entries())??[])g.push(await wd({id:i,yoga:e,index:p,parent:d,element:I,resolvers:s}));return{node:d,radius:rC(l.radius),element:n,renderer:h,config:u,options:A,dependencies:f,childNodes:g}}function Qd(i,e,t=0,r=0){const{top:n,left:s}=i.getComputedLayout(),{top:o,left:a,width:c,height:l}=e.node.getComputedLayout(),u=t+a,A=r+o,h=e.childNodes.map(d=>Qd(i,d,u,A));return{...e,x:s+u,y:n+A,width:c,height:l,childNodes:h}}async function jl({yoga:i,root:e,tree:t,measureCanvas:r}){for await(const{node:n,options:s,dependencies:o,renderer:a,childNodes:c}of t){if(a){const{width:l,height:u}=a;if(l&&r){e.calculateLayout();const A=await l({node:n,options:s,dependencies:o,measureCanvas:r});A&&n.setWidth(A)}if(u&&r){e.calculateLayout();const A=await u({node:n,options:s,dependencies:o,measureCanvas:r});A&&n.setHeight(A)}if((s==null?void 0:s.format)==="crop"&&(o!=null&&o.aspectRatio)&&(a.type==="video"||a.type==="image")){const A=s.crop;if(!A||A.x===0&&A.y===0&&A.width===1&&A.height===1){e.calculateLayout();const d=n.getComputedWidth(),f=n.getComputedHeight();if(d>0&&f>0){const g=d/f,p=o.aspectRatio;if(Math.abs(g-p)>.001){let I,C;g<p?(I=g/p,C=1):(I=1,C=p/g),s.crop={x:(1-I)/2,y:(1-C)/2,width:I,height:C}}}}}if(await jl({yoga:i,root:e,tree:c,measureCanvas:r}),s!=null&&s.shape){const A=n.getComputedWidth(),h=n.getComputedHeight(),d=zy(s.shape,A/h);n.setPadding(i.EDGE_TOP,d.top*h),n.setPadding(i.EDGE_RIGHT,d.right*A),n.setPadding(i.EDGE_BOTTOM,d.bottom*h),n.setPadding(i.EDGE_LEFT,d.left*A)}}e.calculateLayout(),await jl({yoga:i,root:e,tree:c,measureCanvas:r})}}async function Rd({id:i,root:e,resolvers:t,measureCanvas:r}){const n=await Ny(),s=n.Node.create();xd(n,s,{layout:e.layout});const o=await wd({id:i,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await jl({yoga:n,root:s,tree:[o],measureCanvas:r});const{top:a,left:c,width:l,height:u}=s.getComputedLayout(),A={root:{x:c,y:a,width:l,height:u},node:Qd(s,o)};return s.freeRecursive(),A}function _d(){return document.createElement("canvas")}function aC(i){if(i===null||typeof i!="object")return!1;if(Object.getPrototypeOf(i)===null)return!0;let e=i;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(i)===e}function lC(i){return i.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}xE.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${lC(i)}"`:aC(i)||Array.isArray(i)?JSON.stringify(i):i);function cC(i){return i.some(({type:e})=>e==="text")}function AC(i){return i.some(({type:e})=>e==="caption")}function uC(i){return i.some(({type:e})=>e==="audio")}function hC(i){return i.some(({type:e})=>e==="video"||e==="image")}function No(i){return i.type==="audio"}function dC(i){return i.type==="video"}const fC="3";async function gC({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await Rd({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function pC({track:i}){const e=Po(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const c=ri(e.slice(0,a));return s.push(gC({scene:o,start:c})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const c=ri(e.slice(0,a));return s.push({type:o.type,id:o.id,start:c,config:o,duration:o.duration}),s},[]),n=i.map(({id:s})=>t.find(({id:o})=>o===s)??r.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:r,mergedScenes:n,config:i,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Dd({node:i,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:n=1,parentTransform:s,debug:o=!1,override:a}){var c,l,u,A,h;const d=e.sceneCanvas.getContext("2d");if(d){d.save(),d.setTransform(s);const f=(a==null?void 0:a.rotation)!=null&&((c=i.element.layout)!=null&&c.transform)?{...i.element.layout,transform:{...i.element.layout.transform,rotation:a.rotation}}:i.element.layout,g=hd({layout:f,sceneTime:t,animations:i.element.animations,elementDuration:r,elementDimensions:{width:i.width,height:i.height}}),{opacity:p,translation:I,scale:C,clip:B,dimensions:y,rotation:x}=g,Q=i.width*y.widthRatio,_=i.height*y.heightRatio;if(d.globalAlpha=p*n,(I.x||I.y)&&d.translate(I.x,I.y),(C!==1||x!==0)&&(d.translate(i.x+Q/2,i.y+_/2),d.scale(C,C),d.rotate(x*Math.PI/180),d.translate(-(i.x+Q/2),-(i.y+_/2))),B){d.beginPath();const D={x:i.x+B.x*Q,y:i.y+B.y*_,width:B.width*Q,height:B.height*_};d.rect(D.x,D.y,D.width,D.height),d.clip()}if(o){const D=d.globalAlpha;d.globalAlpha=1,d.strokeStyle="red",d.strokeRect(i.x,i.y,Q,_),d.globalAlpha=D}const M=(a==null?void 0:a.fontSize)!=null||(a==null?void 0:a.textValue)!=null?{...i.options,...a.textValue!=null?{value:a.textValue}:{},...a.fontSize!=null&&((l=i.options)!=null&&l.font)?{font:{...i.options.font,size:a.fontSize}}:{}}:i.options,P=(a==null?void 0:a.fontSize)!=null&&((u=i.dependencies)!=null&&u.font)?{...i.dependencies,font:{...i.dependencies.font,size:a.fontSize}}:i.dependencies;await((h=(A=i.renderer)==null?void 0:A.render)==null?void 0:h.call(A,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:Q,dh:_,radius:i.radius,options:M,dependencies:P}));for await(const D of i.childNodes)await Dd({debug:o,node:D,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:d.globalAlpha,parentTransform:d.getTransform(),override:a});d.restore()}}async function mC({layout:i,canvases:e,sceneTime:t,sceneDuration:r,debug:n=!1,override:s}){const{node:o}=i;await Dd({debug:n,node:o,canvases:e,sceneDuration:r,sceneTime:t,override:s})}async function Oo({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=_d}){var a,c;const{id:l,x:u,y:A,width:h,height:d,root:f,duration:g}=e,p=o(),I=o(),C=o(),B=o(),y=o(),x=await Rd({id:l,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((c=f.element.layout)==null?void 0:c.height)}}},resolvers:r,measureCanvas:y}),Q=async(_,M)=>{const P=Math.max(0,_-t);p.width=p.height=0,p.width=n,p.height=s,await mC({debug:i,layout:x,sceneTime:P,sceneDuration:g,canvases:{sceneCanvas:p,cropCanvas:I,letterboxCanvas:C,posterCanvas:B},override:M})};return{id:l,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:Q,config:e,childScenes:[]}}async function EC({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=Po(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ri(o.slice(0,d));return h.type==="caption"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ri(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=ri(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var I;return p===((I=e[d+1])==null?void 0:I.id)}),from:a.find(({id:p})=>{var I;return p===((I=e[d-1])==null?void 0:I.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}function IC({groups:i,tracks:e}){const t=i.map(s=>new Set(s.sceneIds)),r=i.map((s,o)=>{const a=[];for(let u=0;u<e.length;u++){const A=e[u];No(A)||A.scenes.some(h=>s.sceneIds.includes(h.id))&&a.push(u)}let c,l=1/0;for(let u=0;u<i.length;u++){if(o===u)continue;const A=t[u];s.sceneIds.every(d=>A.has(d))&&A.size>t[o].size&&A.size<l&&(c=i[u].id,l=A.size)}return{id:s.id,sceneIds:s.sceneIds,animations:s.animations,bounds:s.bounds,kind:s.kind,topmostTrackIndex:a.length>0?Math.max(...a):-1,parentGroupId:c,depth:0}}),n=new Map(r.map(s=>[s.id,s]));for(const s of r){let o=0,a=s;for(;a!=null&&a.parentGroupId;)o++,a=n.get(a.parentGroupId);s.depth=o}return r}function vC({group:i,currentTime:e,activeMembers:t,fallbackDimensions:r}){if(!i.animations||t.length===0)return null;const n=Math.min(...t.map(A=>A.start)),o=Math.max(...t.map(A=>A.end))-n,a=Math.max(0,e-n),c=i.bounds,l=(c==null?void 0:c.width)??r.width,u=(c==null?void 0:c.height)??r.height;return hd({sceneTime:a,animations:i.animations,elementDuration:o,elementDimensions:{width:l,height:u}})}function Ld({group:i,animationState:e,targetCtx:t,fallbackDimensions:r}){const n=i.bounds,s=(n==null?void 0:n.x)??0,o=(n==null?void 0:n.y)??0,a=(n==null?void 0:n.width)??r.width,c=(n==null?void 0:n.height)??r.height,{opacity:l,translation:u,scale:A,clip:h,rotation:d}=e;if(t.globalAlpha*=l,(u.x||u.y)&&t.translate(u.x,u.y),A!==1||d!==0){const f=s+a/2,g=o+c/2;t.translate(f,g),t.scale(A,A),t.rotate(d*Math.PI/180),t.translate(-f,-g)}h&&(t.beginPath(),t.rect(s+h.x*a,o+h.y*c,h.width*a,h.height*c),t.clip())}async function yC({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=Po(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ri(o.slice(0,d));return h.type==="video"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ri(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=ri(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var I;return p===((I=e[d+1])==null?void 0:I.id)}),from:a.find(({id:p})=>{var I;return p===((I=e[d-1])==null?void 0:I.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(0,...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}async function CC({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=Po(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ri(o.slice(0,d));return h.type==="text"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ri(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=ri(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var I;return p===((I=e[d+1])==null?void 0:I.id)}),from:a.find(({id:p})=>{var I;return p===((I=e[d-1])==null?void 0:I.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"text",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}const BC=(((Xh=qh)==null?void 0:Xh.default)??qh).reduce((i,e)=>(i[e.name]=e,i),{});function TC(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function bC({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:c=!0}){var l,u,A;const h=TC(a,o);if(o.disable(o.DEPTH_TEST),h.buffer?o.bindBuffer(o.ARRAY_BUFFER,h.buffer):(h.buffer=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,h.buffer),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),o.STATIC_DRAW)),o.viewport(0,0,n,s),h.fromTexture?h.fromTexture.setPixels(t):(h.fromTexture=(((l=Qo)==null?void 0:l.default)??Qo)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=Qo)==null?void 0:u.default)??Qo)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[i]||(h.transitions[i]=(((A=Jh)==null?void 0:A.default)??Jh)(o,BC[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!c)return o.flush(),new Uint8Array(0);const f=new Uint8Array(n*s*4);return o.readPixels(0,0,n,s,o.RGBA,o.UNSIGNED_BYTE,f),o.flush(),f}function SC(i){for(const[e,t]of i.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(r=>{r.dispose()}),i.delete(e)}function xC({name:i,to:e,from:t,progress:r,canvas:n,contextResources:s}){const o=n.getContext("webgl",{alpha:!0,depth:!1,antialias:!1,preserveDrawingBuffer:!1});o&&(o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),bC({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function kd({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=_d,drawTransition:o=xC}){var a;const c=new Map,l=await Promise.all(e.tracks.map(async I=>{if(hC(I))return{...await yC({debug:i,track:I,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:I};if(cC(I))return{...await CC({debug:i,track:I,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:I};if(AC(I))return{...await EC({debug:i,track:I,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:I};if(uC(I))return{...await pC({track:I}),config:I};throw new Error("Unknown track type")})),u=(a=e.groups)!=null&&a.length?IC({groups:e.groups,tracks:l}):[],A=new Map,h=[...u].sort((I,C)=>I.depth-C.depth);for(const I of h)for(const C of I.sceneIds)A.set(C,I);const d=new Map(u.map(I=>[I.id,I]));function f(I){const C=[];let B=A.get(I.id);for(;B;)B.animations&&C.push(B),B=B.parentGroupId?d.get(B.parentGroupId):void 0;return C}return{draw:async({canvas:I,currentTime:C,overrides:B,signal:y})=>{const x=I.getContext("2d");if(!x)return;x.globalAlpha=1,x.globalCompositeOperation="source-over",x.clearRect(0,0,I.width,I.height),x.save(),x.fillStyle="black",x.fillRect(0,0,I.width,I.height),x.restore();const Q=new Map;for(const D of l)if(!No(D))for(const $ of D.scenes){if(C<$.start||C>=$.start+$.duration)continue;const K=$.layout,ee=K==null?void 0:K.node,z={start:$.start,end:$.start+$.duration,x:(ee==null?void 0:ee.x)??0,y:(ee==null?void 0:ee.y)??0,width:(ee==null?void 0:ee.width)??I.width,height:(ee==null?void 0:ee.height)??I.height};let L=A.get($.id);for(;L;)L.animations&&(Q.has(L.id)||Q.set(L.id,[]),Q.get(L.id).push(z)),L=L.parentGroupId?d.get(L.parentGroupId):void 0}const _=new Map;function M(D){if(_.has(D.id))return _.get(D.id);const $=vC({group:D,currentTime:C,activeMembers:Q.get(D.id)??[],fallbackDimensions:{width:I.width,height:I.height}});return _.set(D.id,$),$}function P(D,$,K){const ee=f({id:K});if(ee.length===0){D.drawImage($,0,0,$.width,$.height);return}D.save();for(let z=ee.length-1;z>=0;z--){const L=ee[z],O=M(L);O&&Ld({group:L,animationState:O,targetCtx:D,fallbackDimensions:{width:I.width,height:I.height}})}D.drawImage($,0,0,$.width,$.height),D.restore()}for(let D=0;D<l.length;D++){if(y!=null&&y.aborted)return;const $=l[D];if(No($))continue;const{scenes:K,transitions:ee,trackCanvas:z}=$;z.width=z.height=0,z.width=I.width,z.height=I.height;const L=z.getContext("2d");if(!L)continue;const O=K.filter(({start:R,duration:F})=>C>=R&&C<R+F);if(O.length===0)continue;const V=ee.find(({start:R,duration:F})=>C>=R&&C<R+F),k=!!(V&&V.to&&V.from&&V.duration>0);for await(const R of O){if(y!=null&&y.aborted)return;const{sceneCanvas:F,draw:j,id:Y}=R;if(await(j==null?void 0:j(C,B==null?void 0:B.get(Y))),y!=null&&y.aborted)return;k&&(V.to.id===Y||V.from.id===Y)||P(L,F,Y)}if(k){const{name:R,to:F,from:j,duration:Y,transitionCanvas:ie}=V;ie.width=ie.height=0,ie.width=z.width,ie.height=z.height;const ae=Math.min(1,Math.max(0,(C-F.start)/Y));if(await o({name:R,progress:ae,contextResources:c,to:F.sceneCanvas,from:j.sceneCanvas,canvas:ie}),y!=null&&y.aborted)return;const fe=new Set(f({id:j.id})),Ee=new Set(f({id:F.id})),we=[...fe].filter(Ne=>Ee.has(Ne)).sort((Ne,pe)=>Ne.depth-pe.depth);if(we.length===0)L.drawImage(ie,0,0,ie.width,ie.height);else{L.save();for(const Ne of we){const pe=M(Ne);pe&&Ld({group:Ne,animationState:pe,targetCtx:L,fallbackDimensions:{width:I.width,height:I.height}})}L.drawImage(ie,0,0,ie.width,ie.height),L.restore()}}x.drawImage(z,0,0,z.width,z.height)}},cleanup:()=>{SC(c)},tracks:l,groups:u,aspectRatio:e.aspectRatio,transcriptions:e.transcriptions,duration:Math.max(...l.map(({duration:I})=>I))}}const As=.3,Uo=.5,wC=1;function QC(i){return i.tracks.flatMap(t=>t.scenes).filter(dC).filter(t=>{var r;const n=Wl(t.config.root.element,"video")[0];if(!n||(r=n.config)!=null&&r.alpha)return!1;const{volume:s}=tC.transform.values(n.options??{});return s[0]>0}).map(({start:t,duration:r})=>({start:t,end:t+r})).sort((t,r)=>t.start-r.start).reduce((t,r)=>{const n=t[t.length-1];return n&&r.start-n.end<wC?t[t.length-1]={start:n.start,end:Math.max(n.end,r.end)}:t.push(r),t},[])}const RC=i=>Math.round(i*1e6)/1e6;function _C(i,e,t){return e.reduce((r,{start:n,end:s})=>i<=n-As||i>=s+Uo?r:i<n?Math.min(r,1-(1-t)*(i-(n-As))/As):i<=s?Math.min(r,t):Math.min(r,t+(1-t)*(i-s)/Uo),1)}function DC(i,e){const t=Wl(i.config.root.element,"audio")[0],{duration:r}=i;if(!t||r<=0)return null;const n=Iy.transform.values(t.options??{}),[s]=n.duckLevel,[o]=n.fadeIn,[a]=n.fadeOut,c=n.duck&&s<1?e.map(({start:A,end:h})=>({start:A-i.start,end:h-i.start})).filter(({start:A,end:h})=>A-As<r&&h+Uo>0):[];if(o<=0&&a<=0&&c.length===0)return null;const l=A=>Math.max(0,Math.min(1,o>0?A/o:1,a>0?(r-A)/a:1)),u=[0,r,o,r-a,...o>0&&a>0?[r*o/(o+a)]:[],...c.flatMap(({start:A,end:h})=>[A-As,A,h,h+Uo])];return[...new Set(u.filter(A=>A>=0&&A<=r).map(RC))].sort((A,h)=>A-h).map(A=>({time:A,gain:l(A)*_C(A,c,s)}))}function LC(i){const e=QC(i),t=new Map;for(const r of i.tracks)if(No(r))for(const n of r.scenes){const s=DC(n,e);s&&t.set(n.id,s)}return t}function kC(i,e){if(i.length===0)return 1;if(e<=i[0].time)return i[0].gain;for(let t=1;t<i.length;t++){const r=i[t];if(e<=r.time){const n=i[t-1];return n.gain+(r.gain-n.gain)*(e-n.time)/(r.time-n.time)}}return i[i.length-1].gain}const MC={name:"@vouchfor/embeds",version:"8.6.0",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","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 generate:manifest","test:browser":"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner --config web-test-runner.ci.config.js","test:browser:local":"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:watch":"yarn test:browser --watch",typecheck:"tsc --noEmit"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.2","@vouchfor/canvas-video":"^13.6.0","@vouchfor/media-player":"^9.6.0",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4","@open-wc/testing":"^4.0.0","@storybook/addon-docs":"^10.6.0","@storybook/addon-links":"^10.6.0","@storybook/web-components":"^10.6.0","@storybook/web-components-vite":"^10.6.0","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.10","@vouchfor/eslint-config":"^1.0.8","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^6.6.0","@web/dev-server-esbuild":"^1.0.4","@web/test-runner":"^0.20.1","@web/test-runner-browserstack":"^0.8.0","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",dotenv:"^17.4.2",eslint:"^8.57.0",glob:"^10.4.5","lint-staged":"^15.5.1",lit:"^3.3.0",lodash:"^4.17.21",react:"^18.3.1","react-dom":"^18.3.1","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^10.6.0",svgson:"^5.3.1",typescript:"^5.8.3",vite:"^5.4.18","vite-plugin-commonjs":"^0.10.4","vite-plugin-dts":"^3.9.1","web-component-analyzer":"^2.0.0"}};function FC(i){const{publicApiUrl:e}=oo(i),t=or();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function PC(i){var s,o,a,c,l,u,A,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:or()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(c=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:c.call(a,"vouch-uid-client"),r=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=or();return e||(e=FC(i),(h=(A=window.localStorage)==null?void 0:A.setItem)==null||h.call(A,"vouch-uid-visitor",e)),t||(t=or(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),r||(r=or(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",r)),{client:t,tab:r,request:n,visitor:e}}function NC(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function OC(i="embedded_player"){var n,s;const[e,t]=((s=(n=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:n.split)==null?void 0:s.call(n,"/"))??[],r={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const c=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());r[c]=a}}),{source:i,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:MC.version,templateVersion:fC,...r}}const Md=1;class UC{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=NC(r,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...r,senderId:this.host.senderId,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=oo(this.host.env),{client:r,tab:n,request:s,visitor:o}=PC(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":r,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":OC(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:r}=this._currentlyPlayingVideo;this._streamLatestTime[r]>this._streamStartTime[r]+Md&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]}},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:r}})=>{this._answersViewed[r]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[r]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:r,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:r,node:n},this._streamLatestTime[r]=n.currentTime,this._streamStartTime[r]||(this._streamStartTime[r]=n.currentTime,this._streamLatestTime[r]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:r}})=>{this._streamLatestTime[r]>this._streamStartTime[r]+Md&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]},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,r,n;"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),(r=this.host.mediaPlayer)==null||r.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,r,n;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),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Jl={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof cr<"u"&&cr,r=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 cr<"u"&&cr||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(L){return L&&DataView.prototype.isPrototypeOf(L)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(L){return L&&u.indexOf(Object.prototype.toString.call(L))>-1};function h(L){if(typeof L!="string"&&(L=String(L)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(L)||L==="")throw new TypeError('Invalid character in header field name: "'+L+'"');return L.toLowerCase()}function d(L){return typeof L!="string"&&(L=String(L)),L}function f(L){var O={next:function(){var V=L.shift();return{done:V===void 0,value:V}}};return c.iterable&&(O[Symbol.iterator]=function(){return O}),O}function g(L){this.map={},L instanceof g?L.forEach(function(O,V){this.append(V,O)},this):Array.isArray(L)?L.forEach(function(O){if(O.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+O.length);this.append(O[0],O[1])},this):L&&Object.getOwnPropertyNames(L).forEach(function(O){this.append(O,L[O])},this)}g.prototype.append=function(L,O){L=h(L),O=d(O);var V=this.map[L];this.map[L]=V?V+", "+O:O},g.prototype.delete=function(L){delete this.map[h(L)]},g.prototype.get=function(L){return L=h(L),this.has(L)?this.map[L]:null},g.prototype.has=function(L){return this.map.hasOwnProperty(h(L))},g.prototype.set=function(L,O){this.map[h(L)]=d(O)},g.prototype.forEach=function(L,O){for(var V in this.map)this.map.hasOwnProperty(V)&&L.call(O,this.map[V],V,this)},g.prototype.keys=function(){var L=[];return this.forEach(function(O,V){L.push(V)}),f(L)},g.prototype.values=function(){var L=[];return this.forEach(function(O){L.push(O)}),f(L)},g.prototype.entries=function(){var L=[];return this.forEach(function(O,V){L.push([V,O])}),f(L)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(L){if(!L._noBody){if(L.bodyUsed)return Promise.reject(new TypeError("Already read"));L.bodyUsed=!0}}function I(L){return new Promise(function(O,V){L.onload=function(){O(L.result)},L.onerror=function(){V(L.error)}})}function C(L){var O=new FileReader,V=I(O);return O.readAsArrayBuffer(L),V}function B(L){var O=new FileReader,V=I(O),k=/charset=([A-Za-z0-9_-]+)/.exec(L.type),R=k?k[1]:"utf-8";return O.readAsText(L,R),V}function y(L){for(var O=new Uint8Array(L),V=new Array(O.length),k=0;k<O.length;k++)V[k]=String.fromCharCode(O[k]);return V.join("")}function x(L){if(L.slice)return L.slice(0);var O=new Uint8Array(L.byteLength);return O.set(new Uint8Array(L)),O.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(L){this.bodyUsed=this.bodyUsed,this._bodyInit=L,L?typeof L=="string"?this._bodyText=L:c.blob&&Blob.prototype.isPrototypeOf(L)?this._bodyBlob=L:c.formData&&FormData.prototype.isPrototypeOf(L)?this._bodyFormData=L:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)?this._bodyText=L.toString():c.arrayBuffer&&c.blob&&l(L)?(this._bodyArrayBuffer=x(L.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(L)||A(L))?this._bodyArrayBuffer=x(L):this._bodyText=L=Object.prototype.toString.call(L):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof L=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var L=p(this);if(L)return L;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 L=p(this);return L||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return B(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function M(L){var O=L.toUpperCase();return _.indexOf(O)>-1?O:L}function P(L,O){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');O=O||{};var V=O.body;if(L instanceof P){if(L.bodyUsed)throw new TypeError("Already read");this.url=L.url,this.credentials=L.credentials,O.headers||(this.headers=new g(L.headers)),this.method=L.method,this.mode=L.mode,this.signal=L.signal,!V&&L._bodyInit!=null&&(V=L._bodyInit,L.bodyUsed=!0)}else this.url=String(L);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new g(O.headers)),this.method=M(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal||function(){if("AbortController"in a){var F=new AbortController;return F.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(V),(this.method==="GET"||this.method==="HEAD")&&(O.cache==="no-store"||O.cache==="no-cache")){var k=/([?&])_=[^&]*/;if(k.test(this.url))this.url=this.url.replace(k,"$1_="+new Date().getTime());else{var R=/\?/;this.url+=(R.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function D(L){var O=new FormData;return L.trim().split("&").forEach(function(V){if(V){var k=V.split("="),R=k.shift().replace(/\+/g," "),F=k.join("=").replace(/\+/g," ");O.append(decodeURIComponent(R),decodeURIComponent(F))}}),O}function $(L){var O=new g,V=L.replace(/\r?\n[\t ]+/g," ");return V.split("\r").map(function(k){return k.indexOf(`
|
|
2462
|
+
`).map(e=>{if(!e)return[];const t=[];for(const r of e.match(/\S+|\s+/g)??[])if(/^\s+$/.test(r))t.push({text:r,logicalIndex:t.length,whitespace:!0,spaceBefore:!1});else if(md.test(r))for(const n of Ed(r))t.push({text:n.text,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});else t.push({text:r,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});return t})}function Ed(i){const e=[];let t=!1,r="";const n=Qy();if(!n)return[{text:i,spaceBefore:!1}];for(const{segment:s,isWordLike:o}of n.segment(i)){if(!o&&s.trim().length===0){t=e.length>0?!0:t;continue}if(o){e.push({text:s,spaceBefore:t}),t=!1;continue}e.length>0?e[e.length-1].text+=s:r+=s}return r&&e.length>0?e[0].text=r+e[0].text:r&&e.push({text:r,spaceBefore:t}),e}function _y(i){const e=[];for(const t of i){const n=md.test(t.text)||/\s/.test(t.text)?Ed(t.text):[{text:t.text,spaceBefore:!1}];if(n.length<=1){e.push({text:t.text,logicalIndex:e.length,whitespace:!1,spaceBefore:e.length>0,timing:{id:t.id,start:t.start,end:t.end}});continue}const s=n.reduce((c,l)=>c+[...l.text].length,0),o=t.end-t.start;let a=t.start;n.forEach((c,l)=>{const u=[...c.text].length/s*o,A=a,h=l===n.length-1?t.end:a+u;a=h,e.push({text:c.text,logicalIndex:e.length,whitespace:!1,spaceBefore:l===0?e.length>0:c.spaceBefore,timing:{id:t.id,subIndex:l,start:A,end:h}})})}return e}const Dy=/(?<value>\d+\.?\d*)(?=px)/,Kl=1;function Ly(i,e){const t=typeof i=="string"?Ry(i):[_y(i)];return e?t.map(r=>r.map(n=>({...n,text:n.text.toUpperCase()}))):t}function ky({context:i,groups:e,appendedFont:t,fontSizes:r,maxW:n,wrap:s,strokeWidth:o,letterSpacing:a,wholeLineMeasure:c}){const l=[],u=h=>{const d=r[h%r.length];return{fontSize:d,font:t.replace(Dy,d.toString())}},A=(h,d)=>(i.font=h,i.letterSpacing=`${a}px`,i.measureText(d));for(const h of e){const d=l.length,{fontSize:f,font:g}=u(l.length);let p={items:[],font:g,fontSize:f,lineWidth:0,fontAscent:0,fontDescent:0},I="",C="";const B=()=>{const y=A(p.font,"");p.fontAscent=y.fontBoundingBoxAscent,p.fontDescent=y.fontBoundingBoxDescent,l.push(p);const x=u(l.length);p={items:[],font:x.font,fontSize:x.fontSize,lineWidth:0,fontAscent:0,fontDescent:0},I="",C=""};for(const y of h){if(y.whitespace){C+=y.text;continue}const x=()=>{const M=p.items.length>0&&y.spaceBefore&&!C?" ":C,P=M?A(p.font,M).width:0,D=A(p.font,y.text);return{token:y,metrics:D,width:D.width+o,gapBefore:P,gapText:M}};let Q=x();const _=c?A(p.font,I+Q.gapText+y.text).width+o*(p.items.length+1):p.lineWidth+Q.gapBefore+Q.width;if(s&&_>n+Kl&&p.items.length>0&&(B(),Q=x()),s&&c&&p.items.length===0&&Q.width>n+Kl){let M=y.text;for(;M.length>0;){let P="";for(const $ of M){const K=A(p.font,P+$).width+o;if(P&&K>n+Kl)break;P+=$}M=M.slice(P.length);const D=A(p.font,P);p.items.push({token:{...y,text:P},metrics:D,width:D.width+o,gapBefore:0,gapText:""}),I=P,p.lineWidth=D.width+o*p.items.length,M.length>0&&B()}C="";continue}p.items.push(Q),I+=Q.gapText+y.text,p.lineWidth=c?A(p.font,I).width+o*p.items.length:p.lineWidth+Q.gapBefore+Q.width,C=""}c&&C&&(p.items.length>0||l.length===d)&&(I+=C,p.lineWidth=A(p.font,I).width+o*p.items.length),(p.items.length>0||l.length===d)&&B()}return l}const Id=[{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"},{family:"Noto Telugu",regex:new RegExp("\\p{Script=Telugu}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansTelugu-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Tamil",regex:new RegExp("\\p{Script=Tamil}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansTamil-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Kannada",regex:new RegExp("\\p{Script=Kannada}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKannada-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Malayalam",regex:new RegExp("\\p{Script=Malayalam}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansMalayalam-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Bengali",regex:new RegExp("\\p{Script=Bengali}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansBengali-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Gujarati",regex:new RegExp("\\p{Script=Gujarati}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansGujarati-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Gurmukhi",regex:new RegExp("\\p{Script=Gurmukhi}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansGurmukhi-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Sinhala",regex:new RegExp("\\p{Script=Sinhala}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSinhala-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Thai",regex:new RegExp("\\p{Script=Thai}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansThai-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Lao",regex:new RegExp("\\p{Script=Lao}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansLao-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Khmer",regex:new RegExp("\\p{Script=Khmer}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKhmer-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Myanmar",regex:new RegExp("\\p{Script=Myanmar}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansMyanmar-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Ethiopic",regex:new RegExp("\\p{Script=Ethiopic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansEthiopic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Armenian",regex:new RegExp("\\p{Script=Armenian}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArmenian-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Georgian",regex:new RegExp("\\p{Script=Georgian}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansGeorgian-VariableFont_wdth%2Cwght.woff2",style:"normal"}];function vd({text:i,font:e}){let t=e;return Id.forEach(({family:r,regex:n})=>{n.exec(i)&&(t+=`, ${r}`)}),t}function yd(i){return Math.max(i??1,.5)}function My({measured:i,index:e,lineTop:t,dx:r,dw:n,align:s,direction:o,lineHeight:a,strokeWidth:c}){const{items:l,font:u,fontSize:A,lineWidth:h,fontAscent:d,fontDescent:f}=i;let g=0;s==="center"?g=(n-h)/2:s==="right"&&(g=n-h);const p=yd(a),I=A*p+c,C=(p-1)*A/2,B=(A+d-f)/2,y=t+C+B+c/2,{order:x,directions:Q,baseDirection:_}=Sy(l.map(({token:z})=>({text:z.text})),o),M=l.map(({gapBefore:z})=>z);let P=r+g+c/2;const D=[];x.forEach((z,L)=>{const O=l[z];P+=M[L],D.push({...O.token,x:P,baselineY:y,width:O.width,lineIndex:e,direction:Q[z],font:u,metrics:O.metrics}),P+=O.width});const $=[],K=[];D.forEach((z,L)=>{const O=$[$.length-1];if(O&&O.direction===z.direction){const V=Math.max(O.x+O.width,z.x+z.width);O.tokens.push(z),O.x=Math.min(O.x,z.x),O.width=V-O.x,K[K.length-1].push(x[L])}else $.push({text:"",x:z.x,width:z.width,direction:z.direction,tokens:[z]}),K.push([x[L]])}),$.forEach((z,L)=>{const O=[...K[L]].sort((V,k)=>V-k);z.text=O.map((V,k)=>k===0?l[V].token.text:`${l[V].gapText}${l[V].token.text}`).join("")});const ee=o??_;return{index:e,box:{x:r+g,y:t,width:h,height:I},baselineY:y,direction:ee,runs:$,tokens:D}}function Fy(i){const{context:e,text:t,font:r,fontSizes:n,dx:s=0,dy:o=0,maxW:a=1/0,dw:c=a,align:l="left",direction:u,lineHeight:A,lineGap:h=0,letterSpacing:d=0,strokeWidth:f=0,wrap:g=!0,uppercase:p=!1}=i,I=Ly(t,p),C=I.flat().map(({text:Q})=>Q).join(" "),B=vd({font:r,text:C}),y=u??Ty(C),x=By(l,y);try{e.save();const Q=ky({context:e,groups:I,appendedFont:B,fontSizes:n,maxW:a,wrap:g,strokeWidth:f,letterSpacing:d,wholeLineMeasure:typeof t=="string"}),_=[];let M=o;for(let ee=0;ee<Q.length;ee++){const z=My({measured:Q[ee],index:ee,lineTop:M,dx:s,dw:c,align:x,direction:u,lineHeight:A,strokeWidth:f});_.push(z),M+=z.box.height+h}const P=Q[Q.length-1],D=P?Math.max(0,(P.fontAscent+P.fontDescent-P.fontSize*yd(A))/2):0,$=_.reduce((ee,{box:z})=>ee+z.height,0)+h*Math.max(0,_.length-1)+D,K=_.length?{x:Math.min(..._.map(({box:ee})=>ee.x)),y:Math.min(..._.map(({box:ee})=>ee.y)),width:Math.max(..._.map(({box:ee})=>ee.x+ee.width))-Math.min(..._.map(({box:ee})=>ee.x)),height:Math.max(..._.map(({box:ee})=>ee.y+ee.height))-Math.min(..._.map(({box:ee})=>ee.y))}:{x:s,y:o,width:0,height:0};return{lines:_,totalHeight:$,blockBox:K,direction:y,font:B}}finally{e.restore()}}Tu(Fy,{cache:wy(),cacheKey:([i])=>JSON.stringify([i.text,i.font,i.fontSizes,i.dx,i.dy,i.dw,i.maxW,i.align,i.direction,i.lineHeight,i.lineGap,i.letterSpacing,i.strokeWidth,i.wrap,i.uppercase])});function Py(i){return i.slice(0,1).toUpperCase()+i.slice(1)}Object.keys(Zh).map(i=>({label:Py(i),value:i,data:i}));const Ny=bi(()=>ju.loadYoga());function Oy(i=.4,e=.4){const t=Math.max(.1,Math.min(.8,i)),r=Math.max(.2,Math.min(.6,e)),s=(1-t)/2,a=1-r;return[{x:0,y:s},{x:a,y:s},{x:a,y:0},{x:1,y:.5},{x:a,y:1},{x:a,y:1-s},{x:0,y:1-s}]}const Mo=64;function Uy(){const i=[],e={x:.5,y:.5},t=.5;for(let r=0;r<Mo;r++){const n=r/Mo*2*Math.PI,s=e.x+t*Math.cos(n),o=e.y+t*Math.sin(n);i.push({x:s,y:o})}return i}function Gy(i=1){const e=[],t={x:.5,y:.5};let r,n;i>=1?(r=.5,n=.5/i):(r=.5*i,n=.5);for(let s=0;s<Mo;s++){const o=s/Mo*2*Math.PI,a=t.x+r*Math.cos(o),c=t.y+n*Math.sin(o);e.push({x:a,y:c})}return e}function Hy(){const i=[];for(let t=0;t<=100;t++){const r=t/100*2*Math.PI,n=16*Math.sin(r)**3,s=-(13*Math.cos(r)-5*Math.cos(2*r)-2*Math.cos(3*r)-Math.cos(4*r)),o=(n+16)/32,a=(s+13)/26;i.push({x:o,y:a})}return i}function Cd(i=0,e=1){if(i===0)return[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}];const t=i*Math.PI/180,r=Math.tan(t)/e;return[{x:Math.max(0,Math.min(1,0+r)),y:0},{x:Math.max(0,Math.min(1,1+r)),y:0},{x:Math.max(0,Math.min(1,1-r)),y:1},{x:Math.max(0,Math.min(1,0-r)),y:1}]}function Fo(i){if(i<3)throw new Error("A polygon must have at least 3 sides");const e=[],t=[];for(let l=0;l<i;l++){const u=l*2*Math.PI/i-Math.PI/2,A=Math.cos(u),h=Math.sin(u);t.push({x:A,y:h})}const r=Math.min(...t.map(l=>l.x)),n=Math.max(...t.map(l=>l.x)),s=Math.min(...t.map(l=>l.y)),o=Math.max(...t.map(l=>l.y)),a=n-r,c=o-s;for(const l of t){const u=(l.x-r)/a,A=(l.y-s)/c;e.push({x:u,y:A})}return e}function Bd(i=90){const e=i*Math.PI/180,r=.5/Math.tan(e),s=1/(1+Math.abs(r)*2),o=r*s;return[{x:.5+o,y:0},{x:1,y:.5},{x:.5-o,y:1},{x:0,y:.5}]}function $y(i=5,e=.4){const t=[];for(let n=0;n<i*2;n++){const s=n*Math.PI/i-Math.PI/2,o=n%2===0?.5:e,a=.5+o*Math.cos(s),c=.5+o*Math.sin(s);t.push({x:a,y:c})}return t}function Yy(i="isosceles",e={}){switch(i){case"equilateral":return Vy();case"isosceles":return Td(e.baseAngle??60);case"right":return Ky(e.rightAnglePosition??"bottom-left");case"scalene":return Wy(e.angles??[60,60,60])}}function Vy(){return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}function Td(i){const e=i*Math.PI/180,t=.5/Math.tan(e),r=Math.max(.1,Math.min(2,t));return[{x:.5,y:1-Math.min(1,r)},{x:0,y:1},{x:1,y:1}]}function Ky(i){switch(i){case"top":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-left":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-right":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}}function Wy(i){return Td(i[0])}function jy(i={},e=1){const{type:t="rectangle",customPolygon:r,parallelogram:n,triangle:s,rhombus:o,arrow:a,star:c,regularPolygon:l}=i;switch(t){case"rectangle":return Cd(0,e);case"parallelogram":return Cd((n==null?void 0:n.angle)??30,e);case"triangle":return Yy((s==null?void 0:s.type)??"isosceles",{baseAngle:s==null?void 0:s.baseAngle,angles:s==null?void 0:s.angles,rightAnglePosition:s==null?void 0:s.rightAnglePosition});case"rhombus":return Bd((o==null?void 0:o.angle)??90);case"diamond":return Bd(90);case"pentagon":return Fo(5);case"hexagon":return Fo(6);case"octagon":return Fo(8);case"star":return $y((c==null?void 0:c.points)??5,(c==null?void 0:c.innerRadius)??.4);case"arrow":return Oy((a==null?void 0:a.shaftRatio)??.4,(a==null?void 0:a.headRatio)??.4);case"heart":return Hy();case"circle":return Uy();case"ellipse":return Gy(e);case"custom-polygon":if(!(r!=null&&r.points)||r.points.length<3)throw new Error("Custom polygon must have at least 3 points");return r.points;default:return Fo((l==null?void 0:l.sides)??6)}}function Jy(i,e){let t=!1;const r=i.x,n=i.y;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,c=e[s].y,l=e[o].x,u=e[o].y;c>n!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(t=!t)}return t}function qy(i,e){let t=1,r=0;const n=200;for(let s=0;s<=n;s++){const o=s/n;Jy({x:o,y:i},e)&&(t=Math.min(t,o),r=Math.max(r,o))}return r>=t?{left:t,right:r}:null}function Xy(i){const e=Math.min(...i.map(c=>c.y)),t=Math.max(...i.map(c=>c.y));let r={x:0,y:0,width:0,height:0},n=0;const s=200,o=(t-e)/s,a=[];for(let c=0;c<=s;c++){const l=e+c*o;a.push({y:l,span:qy(l,i)})}for(let c=0;c<a.length-1;c++){const l=a[c].y;for(let u=c+1;u<a.length;u++){const h=a[u].y-l;let d=0,f=1,g=!0;const p=Math.min(5,u-c+1);for(let I=0;I<p;I++){const C=c+Math.floor(I/(p-1)*(u-c)),B=a[C].span;if(B){if(d=Math.max(d,B.left),f=Math.min(f,B.right),d>=f){g=!1;break}}else{g=!1;break}}if(g&&f>d){const I=f-d,C=I*h;C>n&&(n=C,r={x:d,y:l,width:I,height:h})}}}return r}function zy(i,e=1){const t=jy(i,e);if(t.length<3)return{top:0,right:0,bottom:0,left:0};if(i.type==="rectangle")return{top:0,right:0,bottom:0,left:0};const r=Xy(t),n=r.y,s=r.x,o=1-(r.x+r.width),a=1-(r.y+r.height);return{top:Math.max(0,n),right:Math.max(0,o),bottom:Math.max(0,a),left:Math.max(0,s)}}const Zy="video",eC=.01,bd=(i,e)=>Math.abs(i-e)<=e*eC,tC={type:Zy,options:{flip:{type:"checkbox",name:"flip",label:"Flip"},loop:{type:"checkbox",name:"loop",label:"Loop"},speed:{type:"slider",name:"speed",label:"Speed",min:.5,max:2,step:.01,transform:{input:i=>i/100,output:i=>i*100,format:i=>`${(i*100).toFixed(0)}%`}},volume:{type:"slider",name:"volume",label:"Volume",min:0,max:1,step:.01,transform:{input:i=>i/2/100,output:i=>i*2*100,format:i=>`${(i*2*100).toFixed(0)}%`}}},transform:{values:i=>({flip:i.flip??!1,loop:i.loop??!1,crop:i.crop??{x:0,y:0,width:1,height:1},format:i.format??"letterbox",speed:[i.speed??1],volume:[i.volume??.5]}),options:i=>({flip:i.flip,loop:i.loop,crop:i.crop,format:i.format,speed:i.speed[0],volume:i.volume[0]})},width:({node:i,options:e,dependencies:t})=>{const{crop:r,format:n}=e;if(!t||n==="crop")return i.getComputedWidth();const s=t.aspectRatio*(((r==null?void 0:r.width)??1)/((r==null?void 0:r.height)??1)),o=i.getComputedWidth(),a=i.getComputedHeight(),c=o/a;return s>c||bd(s,c)?o:a*s},height:({node:i,options:e,dependencies:t})=>{const{crop:r,format:n}=e;if(!t||n==="crop")return i.getComputedHeight();const s=t.aspectRatio*(((r==null?void 0:r.width)??1)/((r==null?void 0:r.height)??1)),o=i.getComputedWidth(),a=i.getComputedHeight();return bd(s,o/a)?a:o/s},render:async({dx:i,dy:e,dw:t,dh:r,radius:n,sceneTime:s,options:o,dependencies:a,canvases:c})=>{const{crop:l,flip:u=!1,format:A="letterbox",speed:h=1}=o,d=c.sceneCanvas.getContext("2d");if(!d||!(a!=null&&a.video))return;const f=await a.video(s*h),g=(f==null?void 0:f.videoWidth)??(f==null?void 0:f.naturalWidth)??(f==null?void 0:f.width),p=(f==null?void 0:f.videoHeight)??(f==null?void 0:f.naturalHeight)??(f==null?void 0:f.height);if(g&&p){d.save();const{topLeft:I,topRight:C,bottomLeft:B,bottomRight:y}=n;yy({context:d,x:i,y:e,width:t,height:r,radii:[I,C,y,B]}),d.clip(),Wv({context:d,crop:l,flip:u,format:A,sourceWidth:g,sourceHeight:p,source:f,posX:i,posY:e,drawAreaWidth:t,drawAreaHeight:r,cropCanvas:c.cropCanvas,letterboxCanvas:c.letterboxCanvas}),d.restore()}}};function ri(i){let e=0;for(const t of i)Array.isArray(t)?e+=ri(t):e+=t;return e}function Po(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const c=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,l=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,A=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(c?l/2:l,t,A?u/2:u)*-1}return t})}function Wl(i,e){var t;const r=[];if(((t=i.renderer)==null?void 0:t.type)===e&&r.push(i),i.children)for(const n of i.children)r.push(...Wl(n,e));return r}function Sd(i){return i===null||typeof i=="number"&&!Number.isFinite(i)}function iC(i){const e={};for(const[t,r]of Object.entries(i))Sd(r)||(typeof r=="object"&&!Array.isArray(r)?e[t]=Object.fromEntries(Object.entries(r).filter(([,n])=>!Sd(n))):e[t]=r);return e}function rC(i){return typeof i=="number"?{topLeft:i,topRight:i,bottomRight:i,bottomLeft:i}:{topLeft:(i==null?void 0:i.topLeft)??0,topRight:(i==null?void 0:i.topRight)??0,bottomRight:(i==null?void 0:i.bottomRight)??0,bottomLeft:(i==null?void 0:i.bottomLeft)??0}}function nC(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:typeof i.top=="number"?i.top*e:i.top,right:typeof i.right=="number"?i.right*e:i.right,bottom:typeof i.bottom=="number"?i.bottom*e:i.bottom,left:typeof i.left=="number"?i.left*e:i.left}}function sC(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function oC(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function xd(i,e,{layout:t,scale:r=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:c,minHeight:l,maxWidth:u,maxHeight:A,flex:h,flexGrow:d,flexShrink:f,gap:g,margin:p,padding:I,direction:C="column",align:B="start",alignSelf:y,justify:x="start"}=iC(t??{}),Q={static:i.POSITION_TYPE_STATIC,relative:i.POSITION_TYPE_RELATIVE,absolute:i.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(Q[n]),typeof s<"u"){const{top:D,right:$,bottom:K,left:ee}=nC(s,r);typeof D<"u"&&e.setPosition(i.EDGE_TOP,D),typeof $<"u"&&e.setPosition(i.EDGE_RIGHT,$),typeof K<"u"&&e.setPosition(i.EDGE_BOTTOM,K),typeof ee<"u"&&e.setPosition(i.EDGE_LEFT,ee)}const _={row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(_[C]);const M={start:i.ALIGN_FLEX_START,end:i.ALIGN_FLEX_END,center:i.ALIGN_CENTER,stretch:i.ALIGN_STRETCH};e.setAlignItems(M[B]),y&&e.setAlignSelf(M[y]);const P={start:i.JUSTIFY_FLEX_START,end:i.JUSTIFY_FLEX_END,center:i.JUSTIFY_CENTER,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND,"space-evenly":i.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(P[x]),typeof p<"u"){const{top:D,right:$,bottom:K,left:ee}=sC(p,r);e.setMargin(i.EDGE_TOP,D),e.setMargin(i.EDGE_RIGHT,$),e.setMargin(i.EDGE_BOTTOM,K),e.setMargin(i.EDGE_LEFT,ee)}if(typeof I<"u"){const{top:D,right:$,bottom:K,left:ee}=oC(I,r);e.setPadding(i.EDGE_TOP,D),e.setPadding(i.EDGE_RIGHT,$),e.setPadding(i.EDGE_BOTTOM,K),e.setPadding(i.EDGE_LEFT,ee)}typeof d<"u"||typeof f<"u"?(typeof d<"u"&&e.setFlexGrow(d),typeof f<"u"&&e.setFlexShrink(f)):typeof h<"u"&&e.setFlex(h),e.setGap(i.GUTTER_ALL,(g??0)*r),typeof o<"u"&&e.setWidth(typeof o=="number"?o*r:o),typeof a<"u"&&e.setHeight(typeof a=="number"?a*r:a),typeof c<"u"&&e.setMinWidth(typeof c=="number"?c*r:c),typeof l<"u"&&e.setMinHeight(typeof l=="number"?l*r:l),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*r:u),typeof A<"u"&&e.setMaxHeight(typeof A=="number"?A*r:A)}async function wd({id:i,yoga:e,index:t,parent:r,element:n,resolvers:s}){var o,a,c;const{layout:l={},config:u={},options:A={},renderer:h}=n,d=e.Node.create();xd(e,d,{layout:l}),r.insertChild(d,t);let f=null;s&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="caption"||(h==null?void 0:h.type)==="image"||(h==null?void 0:h.type)==="video")&&((h==null?void 0:h.type)==="caption"?f=await((o=s.text)==null?void 0:o.call(s,{id:i,config:u,options:A}))??null:f=await((a=s[h.type])==null?void 0:a.call(s,{id:i,config:u,options:A}))??null);const g=[];for await(const[p,I]of((c=n.children)==null?void 0:c.entries())??[])g.push(await wd({id:i,yoga:e,index:p,parent:d,element:I,resolvers:s}));return{node:d,radius:rC(l.radius),element:n,renderer:h,config:u,options:A,dependencies:f,childNodes:g}}function Qd(i,e,t=0,r=0){const{top:n,left:s}=i.getComputedLayout(),{top:o,left:a,width:c,height:l}=e.node.getComputedLayout(),u=t+a,A=r+o,h=e.childNodes.map(d=>Qd(i,d,u,A));return{...e,x:s+u,y:n+A,width:c,height:l,childNodes:h}}async function jl({yoga:i,root:e,tree:t,measureCanvas:r}){for await(const{node:n,options:s,dependencies:o,renderer:a,childNodes:c}of t){if(a){const{width:l,height:u}=a;if(l&&r){e.calculateLayout();const A=await l({node:n,options:s,dependencies:o,measureCanvas:r});A&&n.setWidth(A)}if(u&&r){e.calculateLayout();const A=await u({node:n,options:s,dependencies:o,measureCanvas:r});A&&n.setHeight(A)}if((s==null?void 0:s.format)==="crop"&&(o!=null&&o.aspectRatio)&&(a.type==="video"||a.type==="image")){const A=s.crop;if(!A||A.x===0&&A.y===0&&A.width===1&&A.height===1){e.calculateLayout();const d=n.getComputedWidth(),f=n.getComputedHeight();if(d>0&&f>0){const g=d/f,p=o.aspectRatio;if(Math.abs(g-p)>.001){let I,C;g<p?(I=g/p,C=1):(I=1,C=p/g),s.crop={x:(1-I)/2,y:(1-C)/2,width:I,height:C}}}}}if(await jl({yoga:i,root:e,tree:c,measureCanvas:r}),s!=null&&s.shape){const A=n.getComputedWidth(),h=n.getComputedHeight(),d=zy(s.shape,A/h);n.setPadding(i.EDGE_TOP,d.top*h),n.setPadding(i.EDGE_RIGHT,d.right*A),n.setPadding(i.EDGE_BOTTOM,d.bottom*h),n.setPadding(i.EDGE_LEFT,d.left*A)}}e.calculateLayout(),await jl({yoga:i,root:e,tree:c,measureCanvas:r})}}async function Rd({id:i,root:e,resolvers:t,measureCanvas:r}){const n=await Ny(),s=n.Node.create();xd(n,s,{layout:e.layout});const o=await wd({id:i,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await jl({yoga:n,root:s,tree:[o],measureCanvas:r});const{top:a,left:c,width:l,height:u}=s.getComputedLayout(),A={root:{x:c,y:a,width:l,height:u},node:Qd(s,o)};return s.freeRecursive(),A}function _d(){return document.createElement("canvas")}function aC(i){if(i===null||typeof i!="object")return!1;if(Object.getPrototypeOf(i)===null)return!0;let e=i;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(i)===e}function lC(i){return i.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}xE.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${lC(i)}"`:aC(i)||Array.isArray(i)?JSON.stringify(i):i);function cC(i){return i.some(({type:e})=>e==="text")}function AC(i){return i.some(({type:e})=>e==="caption")}function uC(i){return i.some(({type:e})=>e==="audio")}function hC(i){return i.some(({type:e})=>e==="video"||e==="image")}function No(i){return i.type==="audio"}function dC(i){return i.type==="video"}const fC="3";async function gC({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await Rd({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function pC({track:i}){const e=Po(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const c=ri(e.slice(0,a));return s.push(gC({scene:o,start:c})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const c=ri(e.slice(0,a));return s.push({type:o.type,id:o.id,start:c,config:o,duration:o.duration}),s},[]),n=i.map(({id:s})=>t.find(({id:o})=>o===s)??r.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:r,mergedScenes:n,config:i,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Dd({node:i,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:n=1,parentTransform:s,debug:o=!1,override:a}){var c,l,u,A,h;const d=e.sceneCanvas.getContext("2d");if(d){d.save(),d.setTransform(s);const f=(a==null?void 0:a.rotation)!=null&&((c=i.element.layout)!=null&&c.transform)?{...i.element.layout,transform:{...i.element.layout.transform,rotation:a.rotation}}:i.element.layout,g=hd({layout:f,sceneTime:t,animations:i.element.animations,elementDuration:r,elementDimensions:{width:i.width,height:i.height}}),{opacity:p,translation:I,scale:C,clip:B,dimensions:y,rotation:x}=g,Q=i.width*y.widthRatio,_=i.height*y.heightRatio;if(d.globalAlpha=p*n,(I.x||I.y)&&d.translate(I.x,I.y),(C!==1||x!==0)&&(d.translate(i.x+Q/2,i.y+_/2),d.scale(C,C),d.rotate(x*Math.PI/180),d.translate(-(i.x+Q/2),-(i.y+_/2))),B){d.beginPath();const D={x:i.x+B.x*Q,y:i.y+B.y*_,width:B.width*Q,height:B.height*_};d.rect(D.x,D.y,D.width,D.height),d.clip()}if(o){const D=d.globalAlpha;d.globalAlpha=1,d.strokeStyle="red",d.strokeRect(i.x,i.y,Q,_),d.globalAlpha=D}const M=(a==null?void 0:a.fontSize)!=null||(a==null?void 0:a.textValue)!=null?{...i.options,...a.textValue!=null?{value:a.textValue}:{},...a.fontSize!=null&&((l=i.options)!=null&&l.font)?{font:{...i.options.font,size:a.fontSize}}:{}}:i.options,P=(a==null?void 0:a.fontSize)!=null&&((u=i.dependencies)!=null&&u.font)?{...i.dependencies,font:{...i.dependencies.font,size:a.fontSize}}:i.dependencies;await((h=(A=i.renderer)==null?void 0:A.render)==null?void 0:h.call(A,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:Q,dh:_,radius:i.radius,options:M,dependencies:P}));for await(const D of i.childNodes)await Dd({debug:o,node:D,canvases:e,sceneTime:t,sceneDuration:r,parentOpacity:d.globalAlpha,parentTransform:d.getTransform(),override:a});d.restore()}}async function mC({layout:i,canvases:e,sceneTime:t,sceneDuration:r,debug:n=!1,override:s}){const{node:o}=i;await Dd({debug:n,node:o,canvases:e,sceneDuration:r,sceneTime:t,override:s})}async function Oo({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=_d}){var a,c;const{id:l,x:u,y:A,width:h,height:d,root:f,duration:g}=e,p=o(),I=o(),C=o(),B=o(),y=o(),x=await Rd({id:l,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((c=f.element.layout)==null?void 0:c.height)}}},resolvers:r,measureCanvas:y}),Q=async(_,M)=>{const P=Math.max(0,_-t);p.width=p.height=0,p.width=n,p.height=s,await mC({debug:i,layout:x,sceneTime:P,sceneDuration:g,canvases:{sceneCanvas:p,cropCanvas:I,letterboxCanvas:C,posterCanvas:B},override:M})};return{id:l,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:Q,config:e,childScenes:[]}}async function EC({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=Po(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ri(o.slice(0,d));return h.type==="caption"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ri(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=ri(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var I;return p===((I=e[d+1])==null?void 0:I.id)}),from:a.find(({id:p})=>{var I;return p===((I=e[d-1])==null?void 0:I.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}function IC({groups:i,tracks:e}){const t=i.map(s=>new Set(s.sceneIds)),r=i.map((s,o)=>{const a=[];for(let u=0;u<e.length;u++){const A=e[u];No(A)||A.scenes.some(h=>s.sceneIds.includes(h.id))&&a.push(u)}let c,l=1/0;for(let u=0;u<i.length;u++){if(o===u)continue;const A=t[u];s.sceneIds.every(d=>A.has(d))&&A.size>t[o].size&&A.size<l&&(c=i[u].id,l=A.size)}return{id:s.id,sceneIds:s.sceneIds,animations:s.animations,bounds:s.bounds,kind:s.kind,topmostTrackIndex:a.length>0?Math.max(...a):-1,parentGroupId:c,depth:0}}),n=new Map(r.map(s=>[s.id,s]));for(const s of r){let o=0,a=s;for(;a!=null&&a.parentGroupId;)o++,a=n.get(a.parentGroupId);s.depth=o}return r}function vC({group:i,currentTime:e,activeMembers:t,fallbackDimensions:r}){if(!i.animations||t.length===0)return null;const n=Math.min(...t.map(A=>A.start)),o=Math.max(...t.map(A=>A.end))-n,a=Math.max(0,e-n),c=i.bounds,l=(c==null?void 0:c.width)??r.width,u=(c==null?void 0:c.height)??r.height;return hd({sceneTime:a,animations:i.animations,elementDuration:o,elementDimensions:{width:l,height:u}})}function Ld({group:i,animationState:e,targetCtx:t,fallbackDimensions:r}){const n=i.bounds,s=(n==null?void 0:n.x)??0,o=(n==null?void 0:n.y)??0,a=(n==null?void 0:n.width)??r.width,c=(n==null?void 0:n.height)??r.height,{opacity:l,translation:u,scale:A,clip:h,rotation:d}=e;if(t.globalAlpha*=l,(u.x||u.y)&&t.translate(u.x,u.y),A!==1||d!==0){const f=s+a/2,g=o+c/2;t.translate(f,g),t.scale(A,A),t.rotate(d*Math.PI/180),t.translate(-f,-g)}h&&(t.beginPath(),t.rect(s+h.x*a,o+h.y*c,h.width*a,h.height*c),t.clip())}async function yC({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=Po(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ri(o.slice(0,d));return h.type==="video"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ri(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=ri(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var I;return p===((I=e[d+1])==null?void 0:I.id)}),from:a.find(({id:p})=>{var I;return p===((I=e[d-1])==null?void 0:I.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(0,...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}async function CC({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=Po(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ri(o.slice(0,d));return h.type==="text"&&A.push(Oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ri(o.slice(0,d));return A.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),A},[]),l=e.reduce((A,h,d)=>{if(h.type!=="transition")return A;const f=h.duration,g=ri(o.slice(0,d))-f;return A.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var I;return p===((I=e[d+1])==null?void 0:I.id)}),from:a.find(({id:p})=>{var I;return p===((I=e[d-1])==null?void 0:I.id)})}),A},[]),u=e.map(({id:A})=>a.find(({id:h})=>h===A)??c.find(({id:h})=>h===A)??l.find(({id:h})=>h===A)).filter(Boolean);return{type:"text",scenes:a,gapScenes:c,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:A,duration:h})=>A+h)),trackCanvas:s()}}const BC=(((Xh=qh)==null?void 0:Xh.default)??qh).reduce((i,e)=>(i[e.name]=e,i),{});function TC(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function bC({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:c=!0}){var l,u,A;const h=TC(a,o);if(o.disable(o.DEPTH_TEST),h.buffer?o.bindBuffer(o.ARRAY_BUFFER,h.buffer):(h.buffer=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,h.buffer),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),o.STATIC_DRAW)),o.viewport(0,0,n,s),h.fromTexture?h.fromTexture.setPixels(t):(h.fromTexture=(((l=Qo)==null?void 0:l.default)??Qo)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=Qo)==null?void 0:u.default)??Qo)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[i]||(h.transitions[i]=(((A=Jh)==null?void 0:A.default)??Jh)(o,BC[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!c)return o.flush(),new Uint8Array(0);const f=new Uint8Array(n*s*4);return o.readPixels(0,0,n,s,o.RGBA,o.UNSIGNED_BYTE,f),o.flush(),f}function SC(i){for(const[e,t]of i.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(r=>{r.dispose()}),i.delete(e)}function xC({name:i,to:e,from:t,progress:r,canvas:n,contextResources:s}){const o=n.getContext("webgl",{alpha:!0,depth:!1,antialias:!1,preserveDrawingBuffer:!1});o&&(o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),bC({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function kd({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=_d,drawTransition:o=xC}){var a;const c=new Map,l=await Promise.all(e.tracks.map(async I=>{if(hC(I))return{...await yC({debug:i,track:I,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:I};if(cC(I))return{...await CC({debug:i,track:I,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:I};if(AC(I))return{...await EC({debug:i,track:I,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:I};if(uC(I))return{...await pC({track:I}),config:I};throw new Error("Unknown track type")})),u=(a=e.groups)!=null&&a.length?IC({groups:e.groups,tracks:l}):[],A=new Map,h=[...u].sort((I,C)=>I.depth-C.depth);for(const I of h)for(const C of I.sceneIds)A.set(C,I);const d=new Map(u.map(I=>[I.id,I]));function f(I){const C=[];let B=A.get(I.id);for(;B;)B.animations&&C.push(B),B=B.parentGroupId?d.get(B.parentGroupId):void 0;return C}return{draw:async({canvas:I,currentTime:C,overrides:B,signal:y})=>{const x=I.getContext("2d");if(!x)return;x.globalAlpha=1,x.globalCompositeOperation="source-over",x.clearRect(0,0,I.width,I.height),x.save(),x.fillStyle="black",x.fillRect(0,0,I.width,I.height),x.restore();const Q=new Map;for(const D of l)if(!No(D))for(const $ of D.scenes){if(C<$.start||C>=$.start+$.duration)continue;const K=$.layout,ee=K==null?void 0:K.node,z={start:$.start,end:$.start+$.duration,x:(ee==null?void 0:ee.x)??0,y:(ee==null?void 0:ee.y)??0,width:(ee==null?void 0:ee.width)??I.width,height:(ee==null?void 0:ee.height)??I.height};let L=A.get($.id);for(;L;)L.animations&&(Q.has(L.id)||Q.set(L.id,[]),Q.get(L.id).push(z)),L=L.parentGroupId?d.get(L.parentGroupId):void 0}const _=new Map;function M(D){if(_.has(D.id))return _.get(D.id);const $=vC({group:D,currentTime:C,activeMembers:Q.get(D.id)??[],fallbackDimensions:{width:I.width,height:I.height}});return _.set(D.id,$),$}function P(D,$,K){const ee=f({id:K});if(ee.length===0){D.drawImage($,0,0,$.width,$.height);return}D.save();for(let z=ee.length-1;z>=0;z--){const L=ee[z],O=M(L);O&&Ld({group:L,animationState:O,targetCtx:D,fallbackDimensions:{width:I.width,height:I.height}})}D.drawImage($,0,0,$.width,$.height),D.restore()}for(let D=0;D<l.length;D++){if(y!=null&&y.aborted)return;const $=l[D];if(No($))continue;const{scenes:K,transitions:ee,trackCanvas:z}=$;z.width=z.height=0,z.width=I.width,z.height=I.height;const L=z.getContext("2d");if(!L)continue;const O=K.filter(({start:R,duration:F})=>C>=R&&C<R+F);if(O.length===0)continue;const V=ee.find(({start:R,duration:F})=>C>=R&&C<R+F),k=!!(V&&V.to&&V.from&&V.duration>0);for await(const R of O){if(y!=null&&y.aborted)return;const{sceneCanvas:F,draw:j,id:Y}=R;if(await(j==null?void 0:j(C,B==null?void 0:B.get(Y))),y!=null&&y.aborted)return;k&&(V.to.id===Y||V.from.id===Y)||P(L,F,Y)}if(k){const{name:R,to:F,from:j,duration:Y,transitionCanvas:ie}=V;ie.width=ie.height=0,ie.width=z.width,ie.height=z.height;const ae=Math.min(1,Math.max(0,(C-F.start)/Y));if(await o({name:R,progress:ae,contextResources:c,to:F.sceneCanvas,from:j.sceneCanvas,canvas:ie}),y!=null&&y.aborted)return;const fe=new Set(f({id:j.id})),Ee=new Set(f({id:F.id})),we=[...fe].filter(Ne=>Ee.has(Ne)).sort((Ne,pe)=>Ne.depth-pe.depth);if(we.length===0)L.drawImage(ie,0,0,ie.width,ie.height);else{L.save();for(const Ne of we){const pe=M(Ne);pe&&Ld({group:Ne,animationState:pe,targetCtx:L,fallbackDimensions:{width:I.width,height:I.height}})}L.drawImage(ie,0,0,ie.width,ie.height),L.restore()}}x.drawImage(z,0,0,z.width,z.height)}},cleanup:()=>{SC(c)},tracks:l,groups:u,aspectRatio:e.aspectRatio,transcriptions:e.transcriptions,duration:Math.max(...l.map(({duration:I})=>I))}}const As=.3,Uo=.5,wC=1;function QC(i){return i.tracks.flatMap(t=>t.scenes).filter(dC).filter(t=>{var r;const n=Wl(t.config.root.element,"video")[0];if(!n||(r=n.config)!=null&&r.alpha)return!1;const{volume:s}=tC.transform.values(n.options??{});return s[0]>0}).map(({start:t,duration:r})=>({start:t,end:t+r})).sort((t,r)=>t.start-r.start).reduce((t,r)=>{const n=t[t.length-1];return n&&r.start-n.end<wC?t[t.length-1]={start:n.start,end:Math.max(n.end,r.end)}:t.push(r),t},[])}const RC=i=>Math.round(i*1e6)/1e6;function _C(i,e,t){return e.reduce((r,{start:n,end:s})=>i<=n-As||i>=s+Uo?r:i<n?Math.min(r,1-(1-t)*(i-(n-As))/As):i<=s?Math.min(r,t):Math.min(r,t+(1-t)*(i-s)/Uo),1)}function DC(i,e){const t=Wl(i.config.root.element,"audio")[0],{duration:r}=i;if(!t||r<=0)return null;const n=Iy.transform.values(t.options??{}),[s]=n.duckLevel,[o]=n.fadeIn,[a]=n.fadeOut,c=n.duck&&s<1?e.map(({start:A,end:h})=>({start:A-i.start,end:h-i.start})).filter(({start:A,end:h})=>A-As<r&&h+Uo>0):[];if(o<=0&&a<=0&&c.length===0)return null;const l=A=>Math.max(0,Math.min(1,o>0?A/o:1,a>0?(r-A)/a:1)),u=[0,r,o,r-a,...o>0&&a>0?[r*o/(o+a)]:[],...c.flatMap(({start:A,end:h})=>[A-As,A,h,h+Uo])];return[...new Set(u.filter(A=>A>=0&&A<=r).map(RC))].sort((A,h)=>A-h).map(A=>({time:A,gain:l(A)*_C(A,c,s)}))}function LC(i){const e=QC(i),t=new Map;for(const r of i.tracks)if(No(r))for(const n of r.scenes){const s=DC(n,e);s&&t.set(n.id,s)}return t}function kC(i,e){if(i.length===0)return 1;if(e<=i[0].time)return i[0].gain;for(let t=1;t<i.length;t++){const r=i[t];if(e<=r.time){const n=i[t-1];return n.gain+(r.gain-n.gain)*(e-n.time)/(r.time-n.time)}}return i[i.length-1].gain}const MC={name:"@vouchfor/embeds",version:"8.7.0",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","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 generate:manifest","test:browser":"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner --config web-test-runner.ci.config.js","test:browser:local":"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:watch":"yarn test:browser --watch",typecheck:"tsc --noEmit"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.2","@vouchfor/canvas-video":"^13.7.0","@vouchfor/media-player":"^9.7.0",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4","@open-wc/testing":"^4.0.0","@storybook/addon-docs":"^10.6.0","@storybook/addon-links":"^10.6.0","@storybook/web-components":"^10.6.0","@storybook/web-components-vite":"^10.6.0","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.10","@vouchfor/eslint-config":"^1.0.8","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^6.7.0","@web/dev-server-esbuild":"^1.0.4","@web/test-runner":"^0.20.1","@web/test-runner-browserstack":"^0.8.0","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",dotenv:"^17.4.2",eslint:"^8.57.0",glob:"^10.4.5","lint-staged":"^15.5.1",lit:"^3.3.0",lodash:"^4.17.21",react:"^18.3.1","react-dom":"^18.3.1","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^10.6.0",svgson:"^5.3.1",typescript:"^5.8.3",vite:"^5.4.18","vite-plugin-commonjs":"^0.10.4","vite-plugin-dts":"^3.9.1","web-component-analyzer":"^2.0.0"}};function FC(i){const{publicApiUrl:e}=oo(i),t=or();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function PC(i){var s,o,a,c,l,u,A,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:or()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(c=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:c.call(a,"vouch-uid-client"),r=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=or();return e||(e=FC(i),(h=(A=window.localStorage)==null?void 0:A.setItem)==null||h.call(A,"vouch-uid-visitor",e)),t||(t=or(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),r||(r=or(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",r)),{client:t,tab:r,request:n,visitor:e}}function NC(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function OC(i="embedded_player"){var n,s;const[e,t]=((s=(n=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:n.split)==null?void 0:s.call(n,"/"))??[],r={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const c=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());r[c]=a}}),{source:i,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:MC.version,templateVersion:fC,...r}}const Md=1;class UC{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=NC(r,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...r,senderId:this.host.senderId,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=oo(this.host.env),{client:r,tab:n,request:s,visitor:o}=PC(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":r,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":OC(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:r}=this._currentlyPlayingVideo;this._streamLatestTime[r]>this._streamStartTime[r]+Md&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]}},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:r}})=>{this._answersViewed[r]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[r]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:r,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:r,node:n},this._streamLatestTime[r]=n.currentTime,this._streamStartTime[r]||(this._streamStartTime[r]=n.currentTime,this._streamLatestTime[r]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:r}})=>{this._streamLatestTime[r]>this._streamStartTime[r]+Md&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]},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,r,n;"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),(r=this.host.mediaPlayer)==null||r.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,r,n;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),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Jl={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof cr<"u"&&cr,r=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 cr<"u"&&cr||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(L){return L&&DataView.prototype.isPrototypeOf(L)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],A=ArrayBuffer.isView||function(L){return L&&u.indexOf(Object.prototype.toString.call(L))>-1};function h(L){if(typeof L!="string"&&(L=String(L)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(L)||L==="")throw new TypeError('Invalid character in header field name: "'+L+'"');return L.toLowerCase()}function d(L){return typeof L!="string"&&(L=String(L)),L}function f(L){var O={next:function(){var V=L.shift();return{done:V===void 0,value:V}}};return c.iterable&&(O[Symbol.iterator]=function(){return O}),O}function g(L){this.map={},L instanceof g?L.forEach(function(O,V){this.append(V,O)},this):Array.isArray(L)?L.forEach(function(O){if(O.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+O.length);this.append(O[0],O[1])},this):L&&Object.getOwnPropertyNames(L).forEach(function(O){this.append(O,L[O])},this)}g.prototype.append=function(L,O){L=h(L),O=d(O);var V=this.map[L];this.map[L]=V?V+", "+O:O},g.prototype.delete=function(L){delete this.map[h(L)]},g.prototype.get=function(L){return L=h(L),this.has(L)?this.map[L]:null},g.prototype.has=function(L){return this.map.hasOwnProperty(h(L))},g.prototype.set=function(L,O){this.map[h(L)]=d(O)},g.prototype.forEach=function(L,O){for(var V in this.map)this.map.hasOwnProperty(V)&&L.call(O,this.map[V],V,this)},g.prototype.keys=function(){var L=[];return this.forEach(function(O,V){L.push(V)}),f(L)},g.prototype.values=function(){var L=[];return this.forEach(function(O){L.push(O)}),f(L)},g.prototype.entries=function(){var L=[];return this.forEach(function(O,V){L.push([V,O])}),f(L)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(L){if(!L._noBody){if(L.bodyUsed)return Promise.reject(new TypeError("Already read"));L.bodyUsed=!0}}function I(L){return new Promise(function(O,V){L.onload=function(){O(L.result)},L.onerror=function(){V(L.error)}})}function C(L){var O=new FileReader,V=I(O);return O.readAsArrayBuffer(L),V}function B(L){var O=new FileReader,V=I(O),k=/charset=([A-Za-z0-9_-]+)/.exec(L.type),R=k?k[1]:"utf-8";return O.readAsText(L,R),V}function y(L){for(var O=new Uint8Array(L),V=new Array(O.length),k=0;k<O.length;k++)V[k]=String.fromCharCode(O[k]);return V.join("")}function x(L){if(L.slice)return L.slice(0);var O=new Uint8Array(L.byteLength);return O.set(new Uint8Array(L)),O.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(L){this.bodyUsed=this.bodyUsed,this._bodyInit=L,L?typeof L=="string"?this._bodyText=L:c.blob&&Blob.prototype.isPrototypeOf(L)?this._bodyBlob=L:c.formData&&FormData.prototype.isPrototypeOf(L)?this._bodyFormData=L:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)?this._bodyText=L.toString():c.arrayBuffer&&c.blob&&l(L)?(this._bodyArrayBuffer=x(L.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(L)||A(L))?this._bodyArrayBuffer=x(L):this._bodyText=L=Object.prototype.toString.call(L):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof L=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var L=p(this);if(L)return L;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 L=p(this);return L||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return B(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function M(L){var O=L.toUpperCase();return _.indexOf(O)>-1?O:L}function P(L,O){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');O=O||{};var V=O.body;if(L instanceof P){if(L.bodyUsed)throw new TypeError("Already read");this.url=L.url,this.credentials=L.credentials,O.headers||(this.headers=new g(L.headers)),this.method=L.method,this.mode=L.mode,this.signal=L.signal,!V&&L._bodyInit!=null&&(V=L._bodyInit,L.bodyUsed=!0)}else this.url=String(L);if(this.credentials=O.credentials||this.credentials||"same-origin",(O.headers||!this.headers)&&(this.headers=new g(O.headers)),this.method=M(O.method||this.method||"GET"),this.mode=O.mode||this.mode||null,this.signal=O.signal||this.signal||function(){if("AbortController"in a){var F=new AbortController;return F.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(V),(this.method==="GET"||this.method==="HEAD")&&(O.cache==="no-store"||O.cache==="no-cache")){var k=/([?&])_=[^&]*/;if(k.test(this.url))this.url=this.url.replace(k,"$1_="+new Date().getTime());else{var R=/\?/;this.url+=(R.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function D(L){var O=new FormData;return L.trim().split("&").forEach(function(V){if(V){var k=V.split("="),R=k.shift().replace(/\+/g," "),F=k.join("=").replace(/\+/g," ");O.append(decodeURIComponent(R),decodeURIComponent(F))}}),O}function $(L){var O=new g,V=L.replace(/\r?\n[\t ]+/g," ");return V.split("\r").map(function(k){return k.indexOf(`
|
|
2463
2463
|
`)===0?k.substr(1,k.length):k}).forEach(function(k){var R=k.split(":"),F=R.shift().trim();if(F){var j=R.join(":").trim();try{O.append(F,j)}catch(Y){console.warn("Response "+Y.message)}}}),O}Q.call(P.prototype);function K(L,O){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(O||(O={}),this.type="default",this.status=O.status===void 0?200:O.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=O.statusText===void 0?"":""+O.statusText,this.headers=new g(O.headers),this.url=O.url||"",this._initBody(L)}Q.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},K.error=function(){var L=new K(null,{status:200,statusText:""});return L.ok=!1,L.status=0,L.type="error",L};var ee=[301,302,303,307,308];K.redirect=function(L,O){if(ee.indexOf(O)===-1)throw new RangeError("Invalid status code");return new K(null,{status:O,headers:{location:L}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(O,V){this.message=O,this.name=V;var k=Error(O);this.stack=k.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function z(L,O){return new Promise(function(V,k){var R=new P(L,O);if(R.signal&&R.signal.aborted)return k(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function j(){F.abort()}F.onload=function(){var ae={statusText:F.statusText,headers:$(F.getAllResponseHeaders()||"")};R.url.indexOf("file://")===0&&(F.status<200||F.status>599)?ae.status=200:ae.status=F.status,ae.url="responseURL"in F?F.responseURL:ae.headers.get("X-Request-URL");var fe="response"in F?F.response:F.responseText;setTimeout(function(){V(new K(fe,ae))},0)},F.onerror=function(){setTimeout(function(){k(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){k(new TypeError("Network request timed out"))},0)},F.onabort=function(){setTimeout(function(){k(new o.DOMException("Aborted","AbortError"))},0)};function Y(ae){try{return ae===""&&a.location.href?a.location.href:ae}catch{return ae}}if(F.open(R.method,Y(R.url),!0),R.credentials==="include"?F.withCredentials=!0:R.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(c.blob?F.responseType="blob":c.arrayBuffer&&(F.responseType="arraybuffer")),O&&typeof O.headers=="object"&&!(O.headers instanceof g||a.Headers&&O.headers instanceof a.Headers)){var ie=[];Object.getOwnPropertyNames(O.headers).forEach(function(ae){ie.push(h(ae)),F.setRequestHeader(ae,d(O.headers[ae]))}),R.headers.forEach(function(ae,fe){ie.indexOf(fe)===-1&&F.setRequestHeader(fe,ae)})}else R.headers.forEach(function(ae,fe){F.setRequestHeader(fe,ae)});R.signal&&(R.signal.addEventListener("abort",j),F.onreadystatechange=function(){F.readyState===4&&R.signal.removeEventListener("abort",j)}),F.send(typeof R._bodyInit>"u"?null:R._bodyInit)})}return z.polyfill=!0,a.fetch||(a.fetch=z,a.Headers=g,a.Request=P,a.Response=K),o.Headers=g,o.Request=P,o.Response=K,o.fetch=z,o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=t.fetch?t:r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(Jl,Jl.exports);var GC=Jl.exports;const Fd=ul(GC);async function HC(i){var e;try{if((e=await Fd(i,{method:"HEAD"}))!=null&&e.ok)return i}catch{return}}async function ql({sources:i}){const e=i==null?void 0:i.filter(Boolean),t=e==null?void 0:e.find(s=>s.startsWith("blob:")),r=e==null?void 0:e.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(t||r)return t??r;let n=e[0];if(e.length>0){const s=e.map(a=>HC(a)),o=(await Promise.all(s)).find(Boolean);o&&(n=o)}return n}async function $C(i){try{return(await Fd(i)).text()}catch{return null}}async function YC(i){return i=i.trim(),i.startsWith("http")||i.startsWith("blob:")?$C(i):i}function VC(i){if(typeof i=="string"){const[e,t]=i.split(":");return parseFloat(e)/parseFloat(t)}return i}const KC=bi(async({original:i,translation:e,originalLanguage:t="",translationLanguage:r=""},{language:n})=>{var s,o;const a={[(s=r==null?void 0:r.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:i},c=(n&&a[n])??i;return c?YC(c):null},{cacheKey:([i,{language:e}])=>JSON.stringify({...i,language:e})});function WC(i){var e;return((e=i==null?void 0:i.items)==null?void 0:e.map(t=>{var r;return{text:(r=t.alternatives[0])==null?void 0:r.content,start:t.start_time,end:t.end_time}}))??[]}const jC=bi(async i=>{var e,t,r,n,s,o,a,c,l,u,A;const[h,d,f]=await Promise.all([ql({sources:[(t=(e=i==null?void 0:i.answer)==null?void 0:e.media)==null?void 0:t.video,(n=(r=i==null?void 0:i.answer)==null?void 0:r.media)==null?void 0:n.input]}),ql({sources:[(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),ql({sources:[((c=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:c.reducedQuality)??((A=(u=(l=i==null?void 0:i.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:A.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([i])=>{var e,t,r,n,s,o,a,c,l,u,A;return JSON.stringify({video:(t=(e=i==null?void 0:i.answer)==null?void 0:e.media)==null?void 0:t.video,input:(n=(r=i==null?void 0:i.answer)==null?void 0:r.media)==null?void 0:n.input,playlist:(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((c=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:c.reducedQuality)??((A=(u=(l=i==null?void 0:i.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:A.xs)})}});function Pd(i){var e,t,r,n,s,o,a,c,l,u,A,h;const d=((t=(e=i==null?void 0:i.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(n=(r=i==null?void 0:i.answer)==null?void 0:r.contact)==null?void 0:n.name)==null?void 0:s.trim())??"",f=((c=(a=(o=i==null?void 0:i.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:c.name)==="Not Supplied"?"":((h=(A=(u=(l=i==null?void 0:i.answer)==null?void 0:l.contact)==null?void 0:u.client)==null?void 0:A.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}function JC(i){var e,t;const r=(t=(e=i==null?void 0:i.answer)==null?void 0:e.contact)==null?void 0:t.roleTitle,n=r==null?void 0:r.split(" ");return{roleTitle:r,roleWords:n,firstRoleWord:n==null?void 0:n[0],remainingRoleWords:n==null?void 0:n.slice(1).join(" ")}}async function qC(i,e,t){var r,n,s;const o=(r=e==null?void 0:e.answer)==null?void 0:r.id;return((s=(n=i==null?void 0:i.questions)==null?void 0:n.items)==null?void 0:s.reduce((c,l)=>{var u;return((u=l==null?void 0:l.answer)==null?void 0:u.id)===o?(c??0)+1:c},0))<=1?o:`${o}-${t}`}async function Xl({data:i,rootData:e,index:t},r){var n,s,o,a,c,l,u,A,h,d,f,g,p,I,C,B,y,x,Q,_,M,P,D,$,K;const ee=(n=e==null?void 0:e.answer)==null?void 0:n.metadata;(ee==null?void 0:ee.aspectRatio)!=null&&(ee.aspectRatio=VC(ee.aspectRatio));const[z,L,O]=await Promise.all([qC(i,e,t),jC(e),KC({original:((o=(s=e==null?void 0:e.answer)==null?void 0:s.media)==null?void 0:o.captions)??((c=(a=e==null?void 0:e.answer)==null?void 0:a.captions)==null?void 0:c.current),translation:((u=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:u.translation)??((h=(A=e==null?void 0:e.answer)==null?void 0:A.captions)==null?void 0:h.translation),originalLanguage:(f=(d=e==null?void 0:e.answer)==null?void 0:d.transcription)==null?void 0:f.language,translationLanguage:(I=(p=(g=e==null?void 0:e.answer)==null?void 0:g.transcription)==null?void 0:p.translation)==null?void 0:I.language},r)]),V=Pd(e),k=JC(e);return{...L,...V,...k,key:z,captions:O,wordTimings:WC((C=e==null?void 0:e.answer)==null?void 0:C.transcription),answerLabel:((B=e==null?void 0:e.answer)==null?void 0:B.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((_=(Q=(x=(y=i==null?void 0:i.questions)==null?void 0:y.items)==null?void 0:x[t-1])==null?void 0:Q.answer)==null?void 0:_.label)??((D=(P=(M=i==null?void 0:i.questions)==null?void 0:M.items)==null?void 0:P[t-1])==null?void 0:D.title)??null:null,isFirstInstanceOfName:t?((K=($=i==null?void 0:i.questions)==null?void 0:$.items)==null?void 0:K.findIndex(R=>Pd(R).name===V.name))===t:!0}}const Go={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 XC({data:i}){var e,t;return((t=(e=i==null?void 0:i.questions)==null?void 0:e.items)==null?void 0:t.reduce((r,n)=>{var s,o,a,c,l,u,A;const h=(a=(o=(s=n==null?void 0:n.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(A=(u=(l=(c=n==null?void 0:n.answer)==null?void 0:c.transcription)==null?void 0:l.translation)==null?void 0:u.language)==null?void 0:A.split("-")[0];return h&&Go[h]&&!r.find(f=>f.value===h)&&r.push({value:h,label:Go[h]}),d&&Go[d]&&!r.find(f=>f.value===d)&&r.push({value:d,label:Go[d]}),r},[]))??[]}/**
|
|
2464
2464
|
* @license
|
|
2465
2465
|
* Copyright 2018 Google LLC
|