@vouchfor/embeds 8.4.2 → 8.4.3

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.
@@ -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 zh=ll(qv);var Xh;function zv(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function Xv(r){if(typeof r=="string"){const[e,t]=r.split(":"),i=parseFloat(e),n=parseFloat(t);return i/n}return r}function Ol({resolution:r,aspectRatio:e}){const t=zv(r),i=Xv(e),n=i>=1,s=Math.min(n?t*i:t/i,t),o=Math.max(n?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:Math.round(n?s:o),width:Math.round(n?o:s)}}const Zh={linear:lE,easeIn:ol,easeInOut:AE,easeOut:cE,circIn:Wu,circInOut:uE,circOut:Ju,backIn:al,backInOut:dE,backOut:hE,anticipate:fE,bounceIn:EE,bounceInOut:IE,bounceOut:co},Ro=bu((r,e,{clamp:t=!0,ease:i="easeIn",...n}={})=>rE(r,e,{...n,clamp:t,ease:Zh[i]}),{cacheKey:([r,e,t])=>JSON.stringify({from:r,to:e,options:t})}),Zv={type:"clip",processor:{getTargetState:r=>({clip:{x:r.coordinates.x,y:r.coordinates.y,width:r.dimensions.width,height:r.dimensions.height}}),interpolateState:({value:r,easing:e,progress:t,from:i})=>{const n=i.clip??{x:0,y:0,width:1,height:1},s={x:r.coordinates.x,y:r.coordinates.y,width:r.dimensions.width,height:r.dimensions.height};return{clip:Ro([0,1],[n,s],{ease:e})(t)}}}},Do={type:"fade",processor:{getTargetState:r=>({opacity:r}),interpolateState:({value:r,easing:e,progress:t,from:i})=>({opacity:Ro([0,1],[i.opacity,r],{ease:e})(t)})}},ey={type:"scale",processor:{getTargetState:r=>({scale:r}),interpolateState:({value:r,easing:e,progress:t,from:i})=>({scale:Ro([0,1],[i.scale,r],{ease:e})(t)})}},ed={type:"translate",processor:{getTargetState:r=>({translation:r}),interpolateState:({value:r,easing:e,progress:t,from:i})=>({translation:Ro([0,1],[i.translation,r],{ease:e})(t)})}},ty=[{label:"Both",value:"both"},{label:"At start",value:"enter"},{label:"At end",value:"exit"}],ry=[{value:"left",icon:"arrow-left"},{value:"right",icon:"arrow-right"},{value:"up",icon:"arrow-up"},{value:"down",icon:"arrow-down"}],iy=[{value:"left",icon:"arrow-left"},{value:"right",icon:"arrow-right"}],ny=[{value:"up",icon:"arrow-up"},{value:"down",icon:"arrow-down"}],os={timing:{type:"buttonRadio",name:"timing",label:"Animate",options:ty},speed:{type:"slider",name:"speed",label:"Speed",min:0,max:100,step:1}},Ul={type:"switch",name:"reverseExit",label:"Reverse exit animation"},sy=.2,oy=3;function ay(r,e){const t=r==="both"?e/2:e;return Math.min(oy,t)}function as({speed:r,timing:e,elementDuration:t}){const i=ay(e,t),n=Math.min(sy,i),s=Math.max(0,Math.min(100,r))/100;return i-s*(i-n)}const ly="easeOut";function ls(r){return{values:e=>{var t;return{timing:e.timing??"both",speed:[e.speed??50],...((t=r==null?void 0:r.values)==null?void 0:t.call(r,e))??{}}},options:e=>{var t;return{timing:e.timing,speed:e.speed[0],easing:ly,...((t=r==null?void 0:r.options)==null?void 0:t.call(r,e))??{}}}}}function ui({timing:r,duration:e,elementDuration:t,easing:i,reverseExit:n=!1,enterFrom:s,exitTo:o,restValue:a}){const c=[],l=r==="both"||r==="enter",u=r==="both"||r==="exit",A=Math.max(0,t-e);if(l?(c.push({time:0,value:s,easing:i}),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:i});const h=n?s:o;c.push({time:t,value:h,easing:i})}return c}const td="fade",cy={type:td,name:"Fade",options:{...os},transform:ls(),generate:(r,e)=>{const t=as({speed:r.speed,timing:r.timing,elementDuration:e.elementDuration});return{fade:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,enterFrom:0,exitTo:0,restValue:1}),renderer:Do}}}},rd="pan",id=.25,nd="left";function sd(r,e,t){switch(r){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 Ay(r){return{x:-r.x,y:-r.y}}const uy={type:rd,name:"Pan",options:{...os,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:iy},distance:{type:"slider",name:"distance",label:"Distance",min:.1,max:1,step:.05,transform:{format:r=>`${(r*100).toFixed(0)}%`}},reverseExit:Ul},transform:ls({values:r=>({direction:r.direction??nd,distance:[r.distance??id],reverseExit:r.reverseExit??!1}),options:r=>({direction:r.direction,distance:r.distance[0],reverseExit:r.reverseExit})}),generate:(r,e)=>{const t=as({speed:r.speed,timing:r.timing,elementDuration:e.elementDuration}),i=r.distance??id,n=sd(r.direction,e.elementDimensions,i),s=Ay(n);return{fade:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,reverseExit:r.reverseExit,enterFrom:0,exitTo:0,restValue:1}),renderer:Do},translate:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,reverseExit:r.reverseExit,enterFrom:n,exitTo:s,restValue:{x:0,y:0}}),renderer:ed}}}},od="pop",ad=.5,hy={type:od,name:"Pop",options:{...os},transform:ls(),generate:(r,e)=>{const t=as({speed:r.speed,timing:r.timing,elementDuration:e.elementDuration});return{fade:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,enterFrom:0,exitTo:0,restValue:1}),renderer:Do},scale:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:"backOut",enterFrom:ad,exitTo:ad,restValue:1}),renderer:ey}}}},ld="rise",cd=50,dy="up";function fy(r,e){switch(r){case"down":return{enterY:-e,exitY:e};case"up":default:return{enterY:e,exitY:-e}}}const gy={type:ld,name:"Rise",options:{...os,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:ny},distance:{type:"slider",name:"distance",label:"Distance",min:5,max:100,step:5,transform:{format:r=>`${r}px`}},reverseExit:Ul},transform:ls({values:r=>({direction:r.direction??dy,distance:[r.distance??cd],reverseExit:r.reverseExit??!1}),options:r=>({direction:r.direction,distance:r.distance[0],reverseExit:r.reverseExit})}),generate:(r,e)=>{const t=as({speed:r.speed,timing:r.timing,elementDuration:e.elementDuration}),i=r.distance??cd,{enterY:n,exitY:s}=fy(r.direction,i);return{fade:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,reverseExit:r.reverseExit,enterFrom:0,exitTo:0,restValue:1}),renderer:Do},translate:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,reverseExit:r.reverseExit,enterFrom:{x:0,y:n},exitTo:{x:0,y:s},restValue:{x:0,y:0}}),renderer:ed}}}},Ad="wipe",Gl="left";function on(r){switch(r){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 on(Gl)}}function ud(r){switch(r){case"left":return on("right");case"right":return on("left");case"up":return on("down");case"down":return on("up");default:return ud(Gl)}}const py={coordinates:{x:0,y:0},dimensions:{width:1,height:1}},my={type:Ad,name:"Wipe",options:{...os,direction:{type:"buttonRadio",name:"direction",label:"Direction",options:ry},reverseExit:Ul},transform:ls({values:r=>({direction:r.direction??Gl,reverseExit:r.reverseExit??!1}),options:r=>({direction:r.direction,reverseExit:r.reverseExit})}),generate:(r,e)=>{const t=as({speed:r.speed,timing:r.timing,elementDuration:e.elementDuration}),i=on(r.direction),n=ud(r.direction);return{clip:{keyframes:ui({timing:r.timing,duration:t,elementDuration:e.elementDuration,easing:r.easing,reverseExit:r.reverseExit,enterFrom:i,exitTo:n,restValue:py}),renderer:Zv}}}},Ey={[td]:cy,[ld]:gy,[od]:hy,[rd]:uy,[Ad]:my};function Iy(r,e){const{type:t,...i}=r,n=Ey[t];if(!n)throw new Error(`Unknown preset type: ${t}`);return n.generate(i,e)}function vy({animation:r,sceneTime:e}){const t=r.keyframes;if(!t||t.length===0)return null;const i=[...t].sort((s,o)=>s.time-o.time);if(e<i[0].time)return null;const n=i[i.length-1];if(e>=n.time)return r.renderer.processor.getTargetState(n.value);for(let s=0;s<i.length-1;s++){const o=i[s],a=i[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=r.renderer.processor.getTargetState(o.value);return r.renderer.processor.interpolateState({easing:u,progress:l,from:A,value:a.value})}}return null}function yy(r,e,t){const{preset:i,...n}=r;if(!i)return n;const s=Iy(i,{elementDuration:e,elementDimensions:t});return{...n,...s}}function hd({layout:r,sceneTime:e,animations:t,elementDuration:i=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=r==null?void 0:r.transform)==null?void 0:s.opacity)??1,translation:{x:((a=(o=r==null?void 0:r.transform)==null?void 0:o.translate)==null?void 0:a.x)??0,y:((l=(c=r==null?void 0:r.transform)==null?void 0:c.translate)==null?void 0:l.y)??0},scale:((u=r==null?void 0:r.transform)==null?void 0:u.scale)??1,rotation:((A=r==null?void 0:r.transform)==null?void 0:A.rotation)??0,dimensions:{widthRatio:((d=(h=r==null?void 0:r.transform)==null?void 0:h.dimension)==null?void 0:d.widthRatio)??1,heightRatio:((g=(f=r==null?void 0:r.transform)==null?void 0:f.dimension)==null?void 0:g.heightRatio)??1}};if(!t)return p;const m=yy(t,i,n);for(const C of Object.values(m)){if(!C)continue;const B=vy({animation:C,sceneTime:e});B&&(p={...p,...B})}return p}var Hl={exports:{}},dd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(dd){var fd=new Uint8Array(16);Hl.exports=function(){return dd(fd),fd}}else{var gd=new Array(16);Hl.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),gd[e]=t>>>((e&3)<<3)&255;return gd}}for(var pd=Hl.exports,md=[],Lo=0;Lo<256;++Lo)md[Lo]=(Lo+256).toString(16).substr(1);function Cy(r,e){var t=e||0,i=md;return[i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]]].join("")}var Ed=Cy,By=pd,Ty=Ed,Id,$l,Yl=0,Vl=0;function by(r,e,t){var i=e&&t||0,n=e||[];r=r||{};var s=r.node||Id,o=r.clockseq!==void 0?r.clockseq:$l;if(s==null||o==null){var a=By();s==null&&(s=Id=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=$l=(a[6]<<8|a[7])&16383)}var c=r.msecs!==void 0?r.msecs:new Date().getTime(),l=r.nsecs!==void 0?r.nsecs:Vl+1,u=c-Yl+(l-Vl)/1e4;if(u<0&&r.clockseq===void 0&&(o=o+1&16383),(u<0||c>Yl)&&r.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Yl=c,Vl=l,$l=o,c+=122192928e5;var A=((c&268435455)*1e4+l)%4294967296;n[i++]=A>>>24&255,n[i++]=A>>>16&255,n[i++]=A>>>8&255,n[i++]=A&255;var h=c/4294967296*1e4&268435455;n[i++]=h>>>8&255,n[i++]=h&255,n[i++]=h>>>24&15|16,n[i++]=h>>>16&255,n[i++]=o>>>8|128,n[i++]=o&255;for(var d=0;d<6;++d)n[i+d]=s[d];return e||Ty(n)}var Sy=by,xy=pd,wy=Ed;function Qy(r,e,t){var i=e&&t||0;typeof r=="string"&&(e=r==="binary"?new Array(16):null,r=null),r=r||{};var n=r.random||(r.rng||xy)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e)for(var s=0;s<16;++s)e[i+s]=n[s];return e||wy(n)}var _y=Qy,Ry=Sy,vd=_y,yd=vd;yd.v1=Ry,yd.v4=vd;function Dy(r=.4,e=.4){const t=Math.max(.1,Math.min(.8,r)),i=Math.max(.2,Math.min(.6,e)),s=(1-t)/2,a=1-i;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 ko=64;function Ly(){const r=[],e={x:.5,y:.5},t=.5;for(let i=0;i<ko;i++){const n=i/ko*2*Math.PI,s=e.x+t*Math.cos(n),o=e.y+t*Math.sin(n);r.push({x:s,y:o})}return r}function ky(r=1){const e=[],t={x:.5,y:.5};let i,n;r>=1?(i=.5,n=.5/r):(i=.5*r,n=.5);for(let s=0;s<ko;s++){const o=s/ko*2*Math.PI,a=t.x+i*Math.cos(o),c=t.y+n*Math.sin(o);e.push({x:a,y:c})}return e}function My(){const r=[];for(let t=0;t<=100;t++){const i=t/100*2*Math.PI,n=16*Math.sin(i)**3,s=-(13*Math.cos(i)-5*Math.cos(2*i)-2*Math.cos(3*i)-Math.cos(4*i)),o=(n+16)/32,a=(s+13)/26;r.push({x:o,y:a})}return r}function Cd(r=0,e=1){if(r===0)return[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}];const t=r*Math.PI/180,i=Math.tan(t)/e;return[{x:Math.max(0,Math.min(1,0+i)),y:0},{x:Math.max(0,Math.min(1,1+i)),y:0},{x:Math.max(0,Math.min(1,1-i)),y:1},{x:Math.max(0,Math.min(1,0-i)),y:1}]}function Mo(r){if(r<3)throw new Error("A polygon must have at least 3 sides");const e=[],t=[];for(let l=0;l<r;l++){const u=l*2*Math.PI/r-Math.PI/2,A=Math.cos(u),h=Math.sin(u);t.push({x:A,y:h})}const i=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-i,c=o-s;for(const l of t){const u=(l.x-i)/a,A=(l.y-s)/c;e.push({x:u,y:A})}return e}function Bd(r=90){const e=r*Math.PI/180,i=.5/Math.tan(e),s=1/(1+Math.abs(i)*2),o=i*s;return[{x:.5+o,y:0},{x:1,y:.5},{x:.5-o,y:1},{x:0,y:.5}]}function Fy(r=5,e=.4){const t=[];for(let n=0;n<r*2;n++){const s=n*Math.PI/r-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 Py(r="isosceles",e={}){switch(r){case"equilateral":return Ny();case"isosceles":return Td(e.baseAngle??60);case"right":return Oy(e.rightAnglePosition??"bottom-left");case"scalene":return Uy(e.angles??[60,60,60])}}function Ny(){return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}function Td(r){const e=r*Math.PI/180,t=.5/Math.tan(e),i=Math.max(.1,Math.min(2,t));return[{x:.5,y:1-Math.min(1,i)},{x:0,y:1},{x:1,y:1}]}function Oy(r){switch(r){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 Uy(r){return Td(r[0])}function Gy(r={},e=1){const{type:t="rectangle",customPolygon:i,parallelogram:n,triangle:s,rhombus:o,arrow:a,star:c,regularPolygon:l}=r;switch(t){case"rectangle":return Cd(0,e);case"parallelogram":return Cd((n==null?void 0:n.angle)??30,e);case"triangle":return Py((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 Mo(5);case"hexagon":return Mo(6);case"octagon":return Mo(8);case"star":return Fy((c==null?void 0:c.points)??5,(c==null?void 0:c.innerRadius)??.4);case"arrow":return Dy((a==null?void 0:a.shaftRatio)??.4,(a==null?void 0:a.headRatio)??.4);case"heart":return My();case"circle":return Ly();case"ellipse":return ky(e);case"custom-polygon":if(!(i!=null&&i.points)||i.points.length<3)throw new Error("Custom polygon must have at least 3 points");return i.points;default:return Mo((l==null?void 0:l.sides)??6)}}function Hy(r,e){let t=!1;const i=r.x,n=r.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&&i<(l-a)*(n-c)/(u-c)+a&&(t=!t)}return t}function $y(r,e){let t=1,i=0;const n=200;for(let s=0;s<=n;s++){const o=s/n;Hy({x:o,y:r},e)&&(t=Math.min(t,o),i=Math.max(i,o))}return i>=t?{left:t,right:i}:null}function Yy(r){const e=Math.min(...r.map(c=>c.y)),t=Math.max(...r.map(c=>c.y));let i={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:$y(l,r)})}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 m=0;m<p;m++){const C=c+Math.floor(m/(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 m=f-d,C=m*h;C>n&&(n=C,i={x:d,y:l,width:m,height:h})}}}return i}function Vy(r,e=1){const t=Gy(r,e);if(t.length<3)return{top:0,right:0,bottom:0,left:0};if(r.type==="rectangle")return{top:0,right:0,bottom:0,left:0};const i=Yy(t),n=i.y,s=i.x,o=1-(i.x+i.width),a=1-(i.y+i.height);return{top:Math.max(0,n),right:Math.max(0,o),bottom:Math.max(0,a),left:Math.max(0,s)}}function bd(r){return r===null||typeof r=="number"&&!Number.isFinite(r)}function Ky(r){const e={};for(const[t,i]of Object.entries(r))bd(i)||(typeof i=="object"&&!Array.isArray(i)?e[t]=Object.fromEntries(Object.entries(i).filter(([,n])=>!bd(n))):e[t]=i);return e}function Wy(r){return typeof r=="number"?{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}:{topLeft:(r==null?void 0:r.topLeft)??0,topRight:(r==null?void 0:r.topRight)??0,bottomRight:(r==null?void 0:r.bottomRight)??0,bottomLeft:(r==null?void 0:r.bottomLeft)??0}}function Jy(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:typeof r=="string"?{top:r,right:r,bottom:r,left:r}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function jy(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:typeof r=="string"?{top:r,right:r,bottom:r,left:r}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function qy(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:typeof r=="string"?{top:r,right:r,bottom:r,left:r}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}const zy=br(()=>ju.loadYoga());function Sd(r,e,{layout:t,scale:i=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:m,direction:C="column",align:B="start",alignSelf:y,justify:w="start"}=Ky(t??{}),_={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(_[n]),typeof s<"u"){const{top:D,right:H,bottom:J,left:ee}=Jy(s,i);typeof D<"u"&&e.setPosition(r.EDGE_TOP,D),typeof H<"u"&&e.setPosition(r.EDGE_RIGHT,H),typeof J<"u"&&e.setPosition(r.EDGE_BOTTOM,J),typeof ee<"u"&&e.setPosition(r.EDGE_LEFT,ee)}const R={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(R[C]);const F={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(F[B]),y&&e.setAlignSelf(F[y]);const P={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(P[w]),typeof p<"u"){const{top:D,right:H,bottom:J,left:ee}=jy(p,i);e.setMargin(r.EDGE_TOP,D),e.setMargin(r.EDGE_RIGHT,H),e.setMargin(r.EDGE_BOTTOM,J),e.setMargin(r.EDGE_LEFT,ee)}if(typeof m<"u"){const{top:D,right:H,bottom:J,left:ee}=qy(m,i);e.setPadding(r.EDGE_TOP,D),e.setPadding(r.EDGE_RIGHT,H),e.setPadding(r.EDGE_BOTTOM,J),e.setPadding(r.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(r.GUTTER_ALL,(g??0)*i),typeof o<"u"&&e.setWidth(typeof o=="number"?o*i:o),typeof a<"u"&&e.setHeight(typeof a=="number"?a*i:a),typeof c<"u"&&e.setMinWidth(typeof c=="number"?c*i:c),typeof l<"u"&&e.setMinHeight(typeof l=="number"?l*i:l),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*i:u),typeof A<"u"&&e.setMaxHeight(typeof A=="number"?A*i:A)}async function xd({id:r,yoga:e,index:t,parent:i,element:n,resolvers:s}){var o,a,c;const{layout:l={},config:u={},options:A={},renderer:h}=n,d=e.Node.create();Sd(e,d,{layout:l}),i.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:r,config:u,options:A}))??null:f=await((a=s[h.type])==null?void 0:a.call(s,{id:r,config:u,options:A}))??null);const g=[];for await(const[p,m]of((c=n.children)==null?void 0:c.entries())??[])g.push(await xd({id:r,yoga:e,index:p,parent:d,element:m,resolvers:s}));return{node:d,radius:Wy(l.radius),element:n,renderer:h,config:u,options:A,dependencies:f,childNodes:g}}function wd(r,e,t=0,i=0){const{top:n,left:s}=r.getComputedLayout(),{top:o,left:a,width:c,height:l}=e.node.getComputedLayout(),u=t+a,A=i+o,h=e.childNodes.map(d=>wd(r,d,u,A));return{...e,x:s+u,y:n+A,width:c,height:l,childNodes:h}}async function Kl({yoga:r,root:e,tree:t,measureCanvas:i}){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&&i){e.calculateLayout();const A=await l({node:n,options:s,dependencies:o,measureCanvas:i});A&&n.setWidth(A)}if(u&&i){e.calculateLayout();const A=await u({node:n,options:s,dependencies:o,measureCanvas:i});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 m,C;g<p?(m=g/p,C=1):(m=1,C=p/g),s.crop={x:(1-m)/2,y:(1-C)/2,width:m,height:C}}}}}if(await Kl({yoga:r,root:e,tree:c,measureCanvas:i}),s!=null&&s.shape){const A=n.getComputedWidth(),h=n.getComputedHeight(),d=Vy(s.shape,A/h);n.setPadding(r.EDGE_TOP,d.top*h),n.setPadding(r.EDGE_RIGHT,d.right*A),n.setPadding(r.EDGE_BOTTOM,d.bottom*h),n.setPadding(r.EDGE_LEFT,d.left*A)}}e.calculateLayout(),await Kl({yoga:r,root:e,tree:c,measureCanvas:i})}}async function Qd({id:r,root:e,resolvers:t,measureCanvas:i}){const n=await zy(),s=n.Node.create();Sd(n,s,{layout:e.layout});const o=await xd({id:r,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await Kl({yoga:n,root:s,tree:[o],measureCanvas:i});const{top:a,left:c,width:l,height:u}=s.getComputedLayout(),A={root:{x:c,y:a,width:l,height:u},node:wd(s,o)};return s.freeRecursive(),A}function _d(){var r=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"},i={},n={};i.L=1,n[1]="L",Object.keys(t).forEach(function(T,I){i[T]=1<<I+1,n[i[T]]=T}),Object.freeze(i);var s=i.LRI|i.RLI|i.FSI,o=i.L|i.R|i.AL,a=i.B|i.S|i.WS|i.ON|i.FSI|i.LRI|i.RLI|i.PDI,c=i.BN|i.RLE|i.LRE|i.RLO|i.LRO|i.PDF,l=i.S|i.WS|i.B|s|i.PDI|c,u=null;function A(){if(!u){u=new Map;var T=function(E){if(t.hasOwnProperty(E)){var S=0;t[E].split(",").forEach(function(N){var $=N.split("+"),j=$[0],le=$[1];j=parseInt(j,36),le=le?parseInt(le,36):0,u.set(S+=j,i[E]);for(var pe=0;pe<le;pe++)u.set(++S,i[E])})}};for(var I in t)T(I)}}function h(T){return A(),u.get(T.codePointAt(0))||i.L}function d(T){return n[h(T)]}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(T,I){var E=36,S=0,N=new Map,$=I&&new Map,j;return T.split(",").forEach(function le(pe){if(pe.indexOf("+")!==-1)for(var Ie=+pe;Ie--;)le(j);else{j=pe;var be=pe.split(">"),ve=be[0],et=be[1];ve=String.fromCodePoint(S+=parseInt(ve,E)),et=String.fromCodePoint(S+=parseInt(et,E)),N.set(ve,et),I&&$.set(et,ve)}}),{map:N,reverseMap:$}}var p,m,C;function B(){if(!p){var T=g(f.pairs,!0),I=T.map,E=T.reverseMap;p=I,m=E,C=g(f.canonical,!1).map}}function y(T){return B(),p.get(T)||null}function w(T){return B(),m.get(T)||null}function _(T){return B(),C.get(T)||null}var R=i.L,F=i.R,P=i.EN,D=i.ES,H=i.ET,J=i.AN,ee=i.CS,Z=i.B,k=i.S,U=i.ON,V=i.BN,L=i.NSM,Q=i.AL,M=i.LRO,W=i.RLO,Y=i.LRE,te=i.RLE,oe=i.PDF,he=i.LRI,fe=i.RLI,De=i.FSI,Se=i.PDI;function Le(T,I){for(var E=125,S=new Uint32Array(T.length),N=0;N<T.length;N++)S[N]=h(T[N]);var $=new Map;function j(Wt,Br){var Jt=S[Wt];S[Wt]=Br,$.set(Jt,$.get(Jt)-1),Jt&a&&$.set(a,$.get(a)-1),$.set(Br,($.get(Br)||0)+1),Br&a&&$.set(a,($.get(a)||0)+1)}for(var le=new Uint8Array(T.length),pe=new Map,Ie=[],be=null,ve=0;ve<T.length;ve++)be||Ie.push(be={start:ve,end:T.length-1,level:I==="rtl"?1:I==="ltr"?0:Lp(ve,!1)}),S[ve]&Z&&(be.end=ve,be=null);for(var et=te|Y|W|M|s|Se|oe|Z,rt=function(Wt){return Wt+(Wt&1?1:2)},ht=function(Wt){return Wt+(Wt&1?2:1)},nt=0;nt<Ie.length;nt++){be=Ie[nt];var q=[{_level:be.level,_override:0,_isolate:0}],Ae=void 0,ye=0,ke=0,Pe=0;$.clear();for(var Ne=be.start;Ne<=be.end;Ne++){var We=S[Ne];if(Ae=q[q.length-1],$.set(We,($.get(We)||0)+1),We&a&&$.set(a,($.get(a)||0)+1),We&et)if(We&(te|Y)){le[Ne]=Ae._level;var Bt=(We===te?ht:rt)(Ae._level);Bt<=E&&!ye&&!ke?q.push({_level:Bt,_override:0,_isolate:0}):ye||ke++}else if(We&(W|M)){le[Ne]=Ae._level;var ei=(We===W?ht:rt)(Ae._level);ei<=E&&!ye&&!ke?q.push({_level:ei,_override:We&W?F:R,_isolate:0}):ye||ke++}else if(We&s){We&De&&(We=Lp(Ne+1,!0)===1?fe:he),le[Ne]=Ae._level,Ae._override&&j(Ne,Ae._override);var Tt=(We===fe?ht:rt)(Ae._level);Tt<=E&&ye===0&&ke===0?(Pe++,q.push({_level:Tt,_override:0,_isolate:1,_isolInitIndex:Ne})):ye++}else if(We&Se){if(ye>0)ye--;else if(Pe>0){for(ke=0;!q[q.length-1]._isolate;)q.pop();var Ir=q[q.length-1]._isolInitIndex;Ir!=null&&(pe.set(Ir,Ne),pe.set(Ne,Ir)),q.pop(),Pe--}Ae=q[q.length-1],le[Ne]=Ae._level,Ae._override&&j(Ne,Ae._override)}else We&oe?(ye===0&&(ke>0?ke--:!Ae._isolate&&q.length>1&&(q.pop(),Ae=q[q.length-1])),le[Ne]=Ae._level):We&Z&&(le[Ne]=be.level);else le[Ne]=Ae._level,Ae._override&&We!==V&&j(Ne,Ae._override)}for(var Zt=[],bt=null,er=be.start;er<=be.end;er++){var ti=S[er];if(!(ti&c)){var ri=le[er],Ra=ti&s,vr=ti===Se;bt&&ri===bt._level?(bt._end=er,bt._endsWithIsolInit=Ra):Zt.push(bt={_start:er,_end:er,_level:ri,_startsWithPDI:vr,_endsWithIsolInit:Ra})}}for(var Ps=[],xn=0;xn<Zt.length;xn++){var Ft=Zt[xn];if(!Ft._startsWithPDI||Ft._startsWithPDI&&!pe.has(Ft._start)){for(var wn=[bt=Ft],ji=void 0;bt&&bt._endsWithIsolInit&&(ji=pe.get(bt._end))!=null;)for(var Ci=xn+1;Ci<Zt.length;Ci++)if(Zt[Ci]._start===ji){wn.push(bt=Zt[Ci]);break}for(var Hr=[],qi=0;qi<wn.length;qi++)for(var Qn=wn[qi],Ns=Qn._start;Ns<=Qn._end;Ns++)Hr.push(Ns);for(var FA=le[Hr[0]],Da=be.level,_n=Hr[0]-1;_n>=0;_n--)if(!(S[_n]&c)){Da=le[_n];break}var Os=Hr[Hr.length-1],PA=le[Os],La=be.level;if(!(S[Os]&s)){for(var Rn=Os+1;Rn<=be.end;Rn++)if(!(S[Rn]&c)){La=le[Rn];break}}Ps.push({_seqIndices:Hr,_sosType:Math.max(Da,FA)%2?F:R,_eosType:Math.max(La,PA)%2?F:R})}}for(var Us=0;Us<Ps.length;Us++){var Dn=Ps[Us],Te=Dn._seqIndices,zi=Dn._sosType,NA=Dn._eosType,ii=le[Te[0]]&1?F:R;if($.get(L))for(var Ln=0;Ln<Te.length;Ln++){var Gs=Te[Ln];if(S[Gs]&L){for(var Bi=zi,kn=Ln-1;kn>=0;kn--)if(!(S[Te[kn]]&c)){Bi=S[Te[kn]];break}j(Gs,Bi&(s|Se)?U:Bi)}}if($.get(P))for(var Mn=0;Mn<Te.length;Mn++){var Hs=Te[Mn];if(S[Hs]&P)for(var Ti=Mn-1;Ti>=-1;Ti--){var hr=Ti===-1?zi:S[Te[Ti]];if(hr&o){hr===Q&&j(Hs,J);break}}}if($.get(Q))for(var bi=0;bi<Te.length;bi++){var $s=Te[bi];S[$s]&Q&&j($s,F)}if($.get(D)||$.get(ee))for(var b=1;b<Te.length-1;b++){var x=Te[b];if(S[x]&(D|ee)){for(var O=0,G=0,X=b-1;X>=0&&(O=S[Te[X]],!!(O&c));X--);for(var re=b+1;re<Te.length&&(G=S[Te[re]],!!(G&c));re++);O===G&&(S[x]===D?O===P:O&(P|J))&&j(x,O)}}if($.get(P))for(var se=0;se<Te.length;se++){var ae=Te[se];if(S[ae]&P){for(var ue=se-1;ue>=0&&S[Te[ue]]&(H|c);ue--)j(Te[ue],P);for(se++;se<Te.length&&S[Te[se]]&(H|c|P);se++)S[Te[se]]!==P&&j(Te[se],P)}}if($.get(H)||$.get(D)||$.get(ee))for(var ce=0;ce<Te.length;ce++){var me=Te[ce];if(S[me]&(H|D|ee)){j(me,U);for(var xe=ce-1;xe>=0&&S[Te[xe]]&c;xe--)j(Te[xe],U);for(var Ye=ce+1;Ye<Te.length&&S[Te[Ye]]&c;Ye++)j(Te[Ye],U)}}if($.get(P))for(var at=0,Je=zi;at<Te.length;at++){var Pt=Te[at],Ot=S[Pt];Ot&P?Je===R&&j(Pt,R):Ot&o&&(Je=Ot)}if($.get(a)){var yr=F|P|J,dr=yr|R,Xi=[];{for(var ni=[],Fn=0;Fn<Te.length;Fn++)if(S[Te[Fn]]&a){var Ys=T[Te[Fn]],Tp=void 0;if(y(Ys)!==null)if(ni.length<63)ni.push({char:Ys,seqIndex:Fn});else break;else if((Tp=w(Ys))!==null)for(var Vs=ni.length-1;Vs>=0;Vs--){var OA=ni[Vs].char;if(OA===Tp||OA===w(_(Ys))||y(_(OA))===Ys){Xi.push([ni[Vs].seqIndex,Fn]),ni.length=Vs;break}}}Xi.sort(function(Wt,Br){return Wt[0]-Br[0]})}for(var UA=0;UA<Xi.length;UA++){for(var bp=Xi[UA],ka=bp[0],GA=bp[1],Sp=!1,Cr=0,HA=ka+1;HA<GA;HA++){var xp=Te[HA];if(S[xp]&dr){Sp=!0;var wp=S[xp]&yr?F:R;if(wp===ii){Cr=wp;break}}}if(Sp&&!Cr){Cr=zi;for(var $A=ka-1;$A>=0;$A--){var Qp=Te[$A];if(S[Qp]&dr){var _p=S[Qp]&yr?F:R;_p!==ii?Cr=_p:Cr=ii;break}}}if(Cr){if(S[Te[ka]]=S[Te[GA]]=Cr,Cr!==ii){for(var Ks=ka+1;Ks<Te.length;Ks++)if(!(S[Te[Ks]]&c)){h(T[Te[Ks]])&L&&(S[Te[Ks]]=Cr);break}}if(Cr!==ii){for(var Ws=GA+1;Ws<Te.length;Ws++)if(!(S[Te[Ws]]&c)){h(T[Te[Ws]])&L&&(S[Te[Ws]]=Cr);break}}}}for(var Si=0;Si<Te.length;Si++)if(S[Te[Si]]&a){for(var Rp=Si,YA=Si,VA=zi,Js=Si-1;Js>=0;Js--)if(S[Te[Js]]&c)Rp=Js;else{VA=S[Te[Js]]&yr?F:R;break}for(var Dp=NA,js=Si+1;js<Te.length;js++)if(S[Te[js]]&(a|c))YA=js;else{Dp=S[Te[js]]&yr?F:R;break}for(var KA=Rp;KA<=YA;KA++)S[Te[KA]]=VA===Dp?VA:ii;Si=YA}}}for(var tr=be.start;tr<=be.end;tr++){var kQ=le[tr],Ma=S[tr];if(kQ&1?Ma&(R|P|J)&&le[tr]++:Ma&F?le[tr]++:Ma&(J|P)&&(le[tr]+=2),Ma&c&&(le[tr]=tr===0?be.level:le[tr-1]),tr===be.end||h(T[tr])&(k|Z))for(var Fa=tr;Fa>=0&&h(T[Fa])&l;Fa--)le[Fa]=be.level}}return{levels:le,paragraphs:Ie};function Lp(Wt,Br){for(var Jt=Wt;Jt<T.length;Jt++){var xi=S[Jt];if(xi&(F|Q))return 1;if(xi&(Z|R)||Br&&xi===Se)return 0;if(xi&s){var kp=MQ(Jt);Jt=kp===-1?T.length:kp}}return 0}function MQ(Wt){for(var Br=1,Jt=Wt+1;Jt<T.length;Jt++){var xi=S[Jt];if(xi&Z)break;if(xi&Se){if(--Br===0)return Jt}else xi&s&&Br++}return-1}}var ge="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",_e;function He(){if(!_e){var T=g(ge,!0),I=T.map,E=T.reverseMap;E.forEach(function(S,N){I.set(N,S)}),_e=I}}function Fe(T){return He(),_e.get(T)||null}function tt(T,I,E,S){var N=T.length;E=Math.max(0,E==null?0:+E),S=Math.min(N-1,S==null?N-1:+S);for(var $=new Map,j=E;j<=S;j++)if(I[j]&1){var le=Fe(T[j]);le!==null&&$.set(j,le)}return $}function we(T,I,E,S){var N=T.length;E=Math.max(0,E==null?0:+E),S=Math.min(N-1,S==null?N-1:+S);var $=[];return I.paragraphs.forEach(function(j){var le=Math.max(E,j.start),pe=Math.min(S,j.end);if(le<pe){for(var Ie=I.levels.slice(le,pe+1),be=pe;be>=le&&h(T[be])&l;be--)Ie[be]=j.level;for(var ve=j.level,et=1/0,rt=0;rt<Ie.length;rt++){var ht=Ie[rt];ht>ve&&(ve=ht),ht<et&&(et=ht|1)}for(var nt=ve;nt>=et;nt--)for(var q=0;q<Ie.length;q++)if(Ie[q]>=nt){for(var Ae=q;q+1<Ie.length&&Ie[q+1]>=nt;)q++;q>Ae&&$.push([Ae+le,q+le])}}}),$}function Ce(T,I,E,S){var N=Ge(T,I,E,S),$=[].concat(T);return N.forEach(function(j,le){$[le]=(I.levels[j]&1?Fe(T[j]):null)||T[j]}),$.join("")}function Ge(T,I,E,S){for(var N=we(T,I,E,S),$=[],j=0;j<T.length;j++)$[j]=j;return N.forEach(function(le){for(var pe=le[0],Ie=le[1],be=$.slice(pe,Ie+1),ve=be.length;ve--;)$[Ie-ve]=be[ve]}),$}return e.closingToOpeningBracket=w,e.getBidiCharType=h,e.getBidiCharTypeName=d,e.getCanonicalBracket=_,e.getEmbeddingLevels=Le,e.getMirroredCharacter=Fe,e.getMirroredCharactersMap=tt,e.getReorderSegments=we,e.getReorderedIndices=Ge,e.getReorderedString=Ce,e.openingToClosingBracket=y,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return r}const Rd=Object.freeze(Object.defineProperty({__proto__:null,default:_d},Symbol.toStringTag,{value:"Module"})),Xy=typeof Rd=="function"?Rd:_d;function Zy(r,e){return r==="start"?e==="rtl"?"right":"left":r==="end"?e==="rtl"?"left":"right":r??"left"}const Dd=Xy();function eC(r){var e;if(!r)return"ltr";try{const{paragraphs:t}=Dd.getEmbeddingLevels(r);return(((e=t[0])==null?void 0:e.level)??0)%2===1?"rtl":"ltr"}catch{return"ltr"}}function tC(r){return{order:r.map((e,t)=>t),directions:r.map(()=>"ltr"),baseDirection:"ltr"}}function rC(r,e){var t;if(!r.length)return{order:[],directions:[],baseDirection:e??"ltr"};try{const i=r.map(({text:d})=>d).join(" "),{levels:n,paragraphs:s}=Dd.getEmbeddingLevels(i,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 r)c.push(n[l]??o),l+=d.text.length+1;const u=r.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 m=u.slice(f,g).reverse();u.splice(f,m.length,...m),f=-1}}}const h=c.map(d=>d%2===1?"rtl":"ltr");return{order:u,directions:h,baseDirection:a}}catch{return tC(r)}}const iC=500;function nC(){const r=new Map,e={has:t=>r.has(t),get:t=>r.get(t),set:(t,i)=>{if(r.size>=iC&&!r.has(t)){const n=r.keys().next();n.done||r.delete(n.value)}r.set(t,i)},delete:t=>r.delete(t),clear:()=>r.clear()};return typeof document<"u"&&"fonts"in document&&document.fonts.addEventListener("loadingdone",()=>e.clear()),e}let Wl;function sC(){return Wl===void 0&&(Wl=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"word"}):null),Wl}const Ld=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;function oC(r){return r.split(`
2462
- `).map(e=>{if(!e)return[];const t=[];for(const i of e.match(/\S+|\s+/g)??[])if(/^\s+$/.test(i))t.push({text:i,logicalIndex:t.length,whitespace:!0,spaceBefore:!1});else if(Ld.test(i))for(const n of kd(i))t.push({text:n.text,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});else t.push({text:i,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});return t})}function kd(r){const e=[];let t=!1,i="";const n=sC();if(!n)return[{text:r,spaceBefore:!1}];for(const{segment:s,isWordLike:o}of n.segment(r)){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:i+=s}return i&&e.length>0?e[0].text=i+e[0].text:i&&e.push({text:i,spaceBefore:t}),e}function aC(r){const e=[];for(const t of r){const n=Ld.test(t.text)||/\s/.test(t.text)?kd(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 lC=/(?<value>\d+\.?\d*)(?=px)/,Jl=1;function cC(r,e){const t=typeof r=="string"?oC(r):[aC(r)];return e?t.map(i=>i.map(n=>({...n,text:n.text.toUpperCase()}))):t}function AC({context:r,groups:e,appendedFont:t,fontSizes:i,maxW:n,wrap:s,strokeWidth:o,letterSpacing:a,wholeLineMeasure:c}){const l=[],u=h=>{const d=i[h%i.length];return{fontSize:d,font:t.replace(lC,d.toString())}},A=(h,d)=>(r.font=h,r.letterSpacing=`${a}px`,r.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},m="",C="";const B=()=>{const y=A(p.font,"");p.fontAscent=y.fontBoundingBoxAscent,p.fontDescent=y.fontBoundingBoxDescent,l.push(p);const w=u(l.length);p={items:[],font:w.font,fontSize:w.fontSize,lineWidth:0,fontAscent:0,fontDescent:0},m="",C=""};for(const y of h){if(y.whitespace){C+=y.text;continue}const w=()=>{const F=p.items.length>0&&y.spaceBefore&&!C?" ":C,P=F?A(p.font,F).width:0,D=A(p.font,y.text);return{token:y,metrics:D,width:D.width+o,gapBefore:P,gapText:F}};let _=w();const R=c?A(p.font,m+_.gapText+y.text).width+o*(p.items.length+1):p.lineWidth+_.gapBefore+_.width;if(s&&R>n+Jl&&p.items.length>0&&(B(),_=w()),s&&c&&p.items.length===0&&_.width>n+Jl){let F=y.text;for(;F.length>0;){let P="";for(const H of F){const J=A(p.font,P+H).width+o;if(P&&J>n+Jl)break;P+=H}F=F.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:""}),m=P,p.lineWidth=D.width+o*p.items.length,F.length>0&&B()}C="";continue}p.items.push(_),m+=_.gapText+y.text,p.lineWidth=c?A(p.font,m).width+o*p.items.length:p.lineWidth+_.gapBefore+_.width,C=""}c&&C&&(p.items.length>0||l.length===d)&&(m+=C,p.lineWidth=A(p.font,m).width+o*p.items.length),(p.items.length>0||l.length===d)&&B()}return l}const Md=[{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 Fd({text:r,font:e}){let t=e;return Md.forEach(({family:i,regex:n})=>{n.exec(r)&&(t+=`, ${i}`)}),t}function Pd(r){return Math.max(r??1,.5)}function uC({measured:r,index:e,lineTop:t,dx:i,dw:n,align:s,direction:o,lineHeight:a,strokeWidth:c}){const{items:l,font:u,fontSize:A,lineWidth:h,fontAscent:d,fontDescent:f}=r;let g=0;s==="center"?g=(n-h)/2:s==="right"&&(g=n-h);const p=Pd(a),m=A*p+c,C=(p-1)*A/2,B=(A+d-f)/2,y=t+C+B+c/2,{order:w,directions:_,baseDirection:R}=rC(l.map(({token:Z})=>({text:Z.text})),o),F=l.map(({gapBefore:Z})=>Z);let P=i+g+c/2;const D=[];w.forEach((Z,k)=>{const U=l[Z];P+=F[k],D.push({...U.token,x:P,baselineY:y,width:U.width,lineIndex:e,direction:_[Z],font:u,metrics:U.metrics}),P+=U.width});const H=[],J=[];D.forEach((Z,k)=>{const U=H[H.length-1];if(U&&U.direction===Z.direction){const V=Math.max(U.x+U.width,Z.x+Z.width);U.tokens.push(Z),U.x=Math.min(U.x,Z.x),U.width=V-U.x,J[J.length-1].push(w[k])}else H.push({text:"",x:Z.x,width:Z.width,direction:Z.direction,tokens:[Z]}),J.push([w[k]])}),H.forEach((Z,k)=>{const U=[...J[k]].sort((V,L)=>V-L);Z.text=U.map((V,L)=>L===0?l[V].token.text:`${l[V].gapText}${l[V].token.text}`).join("")});const ee=o??R;return{index:e,box:{x:i+g,y:t,width:h,height:m},baselineY:y,direction:ee,runs:H,tokens:D}}function hC(r){const{context:e,text:t,font:i,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}=r,m=cC(t,p),C=m.flat().map(({text:_})=>_).join(" "),B=Fd({font:i,text:C}),y=u??eC(C),w=Zy(l,y);try{e.save();const _=AC({context:e,groups:m,appendedFont:B,fontSizes:n,maxW:a,wrap:g,strokeWidth:f,letterSpacing:d,wholeLineMeasure:typeof t=="string"}),R=[];let F=o;for(let ee=0;ee<_.length;ee++){const Z=uC({measured:_[ee],index:ee,lineTop:F,dx:s,dw:c,align:w,direction:u,lineHeight:A,strokeWidth:f});R.push(Z),F+=Z.box.height+h}const P=_[_.length-1],D=P?Math.max(0,(P.fontAscent+P.fontDescent-P.fontSize*Pd(A))/2):0,H=R.reduce((ee,{box:Z})=>ee+Z.height,0)+h*Math.max(0,R.length-1)+D,J=R.length?{x:Math.min(...R.map(({box:ee})=>ee.x)),y:Math.min(...R.map(({box:ee})=>ee.y)),width:Math.max(...R.map(({box:ee})=>ee.x+ee.width))-Math.min(...R.map(({box:ee})=>ee.x)),height:Math.max(...R.map(({box:ee})=>ee.y+ee.height))-Math.min(...R.map(({box:ee})=>ee.y))}:{x:s,y:o,width:0,height:0};return{lines:R,totalHeight:H,blockBox:J,direction:y,font:B}}finally{e.restore()}}bu(hC,{cache:nC(),cacheKey:([r])=>JSON.stringify([r.text,r.font,r.fontSizes,r.dx,r.dy,r.dw,r.maxW,r.align,r.direction,r.lineHeight,r.lineGap,r.letterSpacing,r.strokeWidth,r.wrap,r.uppercase])});function dC(r){return r.slice(0,1).toUpperCase()+r.slice(1)}Object.keys(Zh).map(r=>({label:dC(r),value:r,data:r}));function Nd(){return document.createElement("canvas")}function ir(r){let e=0;for(const t of r)Array.isArray(t)?e+=ir(t):e+=t;return e}function Fo(r){return r.map(({type:e,duration:t},i)=>{var n,s,o,a;if(e==="transition"){const c=((n=r[i-2])==null?void 0:n.type)==="transition"?r[i-2]:null,l=((s=r[i-1])==null?void 0:s.duration)??1/0,u=((o=r[i+1])==null?void 0:o.duration)??1/0,A=((a=r[i+2])==null?void 0:a.type)==="transition"?r[i+2]:null;return Math.min(c?l/2:l,t,A?u/2:u)*-1}return t})}function fC(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function gC(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}vE.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${gC(r)}"`:fC(r)||Array.isArray(r)?JSON.stringify(r):r);function pC(r){return r.some(({type:e})=>e==="text")}function mC(r){return r.some(({type:e})=>e==="caption")}function EC(r){return r.some(({type:e})=>e==="audio")}function IC(r){return r.some(({type:e})=>e==="video"||e==="image")}function jl(r){return r.type==="audio"}const vC="3";async function yC({scene:r,start:e=0}){const{id:t,root:i,duration:n}=r,s=await Qd({id:t,root:i});return{type:r.type,start:e,duration:n,layout:s,id:r.id,config:r}}async function CC({track:r}){const e=Fo(r),t=await Promise.all(r.reduce((s,o,a)=>{if(o.type!=="audio")return s;const c=ir(e.slice(0,a));return s.push(yC({scene:o,start:c})),s},[])),i=r.reduce((s,o,a)=>{if(o.type!=="gap")return s;const c=ir(e.slice(0,a));return s.push({type:o.type,id:o.id,start:c,config:o,duration:o.duration}),s},[]),n=r.map(({id:s})=>t.find(({id:o})=>o===s)??i.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:i,mergedScenes:n,config:r,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Od({node:r,canvases:e,sceneTime:t,sceneDuration:i,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=r.element.layout)!=null&&c.transform)?{...r.element.layout,transform:{...r.element.layout.transform,rotation:a.rotation}}:r.element.layout,g=hd({layout:f,sceneTime:t,animations:r.element.animations,elementDuration:i,elementDimensions:{width:r.width,height:r.height}}),{opacity:p,translation:m,scale:C,clip:B,dimensions:y,rotation:w}=g,_=r.width*y.widthRatio,R=r.height*y.heightRatio;if(d.globalAlpha=p*n,(m.x||m.y)&&d.translate(m.x,m.y),(C!==1||w!==0)&&(d.translate(r.x+_/2,r.y+R/2),d.scale(C,C),d.rotate(w*Math.PI/180),d.translate(-(r.x+_/2),-(r.y+R/2))),B){d.beginPath();const D={x:r.x+B.x*_,y:r.y+B.y*R,width:B.width*_,height:B.height*R};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(r.x,r.y,_,R),d.globalAlpha=D}const F=(a==null?void 0:a.fontSize)!=null||(a==null?void 0:a.textValue)!=null?{...r.options,...a.textValue!=null?{value:a.textValue}:{},...a.fontSize!=null&&((l=r.options)!=null&&l.font)?{font:{...r.options.font,size:a.fontSize}}:{}}:r.options,P=(a==null?void 0:a.fontSize)!=null&&((u=r.dependencies)!=null&&u.font)?{...r.dependencies,font:{...r.dependencies.font,size:a.fontSize}}:r.dependencies;await((h=(A=r.renderer)==null?void 0:A.render)==null?void 0:h.call(A,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:_,dh:R,radius:r.radius,options:F,dependencies:P}));for await(const D of r.childNodes)await Od({debug:o,node:D,canvases:e,sceneTime:t,sceneDuration:i,parentOpacity:d.globalAlpha,parentTransform:d.getTransform(),override:a});d.restore()}}async function BC({layout:r,canvases:e,sceneTime:t,sceneDuration:i,debug:n=!1,override:s}){const{node:o}=r;await Od({debug:n,node:o,canvases:e,sceneDuration:i,sceneTime:t,override:s})}async function Po({debug:r=!1,scene:e,start:t=0,resolvers:i,rootWidth:n,rootHeight:s,canvasFactory:o=Nd}){var a,c;const{id:l,x:u,y:A,width:h,height:d,root:f,duration:g}=e,p=o(),m=o(),C=o(),B=o(),y=o(),w=await Qd({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:i,measureCanvas:y}),_=async(R,F)=>{const P=Math.max(0,R-t);p.width=p.height=0,p.width=n,p.height=s,await BC({debug:r,layout:w,sceneTime:P,sceneDuration:g,canvases:{sceneCanvas:p,cropCanvas:m,letterboxCanvas:C,posterCanvas:B},override:F})};return{id:l,type:e.type,start:t,duration:g,layout:w,sceneCanvas:p,draw:_,config:e,childScenes:[]}}async function TC({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=Fo(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ir(o.slice(0,d));return h.type==="caption"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ir(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=ir(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 m;return p===((m=e[d+1])==null?void 0:m.id)}),from:a.find(({id:p})=>{var m;return p===((m=e[d-1])==null?void 0:m.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 bC({groups:r,tracks:e}){const t=r.map(s=>new Set(s.sceneIds)),i=r.map((s,o)=>{const a=[];for(let u=0;u<e.length;u++){const A=e[u];jl(A)||A.scenes.some(h=>s.sceneIds.includes(h.id))&&a.push(u)}let c,l=1/0;for(let u=0;u<r.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=r[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(i.map(s=>[s.id,s]));for(const s of i){let o=0,a=s;for(;a!=null&&a.parentGroupId;)o++,a=n.get(a.parentGroupId);s.depth=o}return i}function SC({group:r,currentTime:e,activeMembers:t,fallbackDimensions:i}){if(!r.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=r.bounds,l=(c==null?void 0:c.width)??i.width,u=(c==null?void 0:c.height)??i.height;return hd({sceneTime:a,animations:r.animations,elementDuration:o,elementDimensions:{width:l,height:u}})}function Ud({group:r,animationState:e,targetCtx:t,fallbackDimensions:i}){const n=r.bounds,s=(n==null?void 0:n.x)??0,o=(n==null?void 0:n.y)??0,a=(n==null?void 0:n.width)??i.width,c=(n==null?void 0:n.height)??i.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 xC({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=Fo(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ir(o.slice(0,d));return h.type==="video"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),h.type==="image"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ir(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=ir(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 m;return p===((m=e[d+1])==null?void 0:m.id)}),from:a.find(({id:p})=>{var m;return p===((m=e[d-1])==null?void 0:m.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 wC({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=Fo(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ir(o.slice(0,d));return h.type==="text"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ir(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=ir(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 m;return p===((m=e[d+1])==null?void 0:m.id)}),from:a.find(({id:p})=>{var m;return p===((m=e[d-1])==null?void 0:m.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 QC=(((Xh=zh)==null?void 0:Xh.default)??zh).reduce((r,e)=>(r[e.name]=e,r),{});function _C(r,e){return r.has(e)||r.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),r.get(e)}function RC({name:r,to:e,from:t,progress:i,width:n,height:s,glContext:o,contextResources:a,returnPixels:c=!0}){var l,u,A;const h=_C(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=xo)==null?void 0:l.default)??xo)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=xo)==null?void 0:u.default)??xo)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[r]||(h.transitions[r]=(((A=qh)==null?void 0:A.default)??qh)(o,QC[r])),h.transitions[r].draw(i,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 DC(r){for(const[e,t]of r.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(i=>{i.dispose()}),r.delete(e)}function LC({name:r,to:e,from:t,progress:i,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),RC({name:r,to:e,from:t,progress:i,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Gd({debug:r=!1,config:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s=Nd,drawTransition:o=LC}){var a;const c=new Map,l=await Promise.all(e.tracks.map(async m=>{if(IC(m))return{...await xC({debug:r,track:m,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:m};if(pC(m))return{...await wC({debug:r,track:m,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:m};if(mC(m))return{...await TC({debug:r,track:m,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:m};if(EC(m))return{...await CC({track:m}),config:m};throw new Error("Unknown track type")})),u=(a=e.groups)!=null&&a.length?bC({groups:e.groups,tracks:l}):[],A=new Map,h=[...u].sort((m,C)=>m.depth-C.depth);for(const m of h)for(const C of m.sceneIds)A.set(C,m);const d=new Map(u.map(m=>[m.id,m]));function f(m){const C=[];let B=A.get(m.id);for(;B;)B.animations&&C.push(B),B=B.parentGroupId?d.get(B.parentGroupId):void 0;return C}return{draw:async({canvas:m,currentTime:C,overrides:B,signal:y})=>{const w=m.getContext("2d");if(!w)return;w.globalAlpha=1,w.globalCompositeOperation="source-over",w.clearRect(0,0,m.width,m.height),w.save(),w.fillStyle="black",w.fillRect(0,0,m.width,m.height),w.restore();const _=new Map;for(const D of l)if(!jl(D))for(const H of D.scenes){if(C<H.start||C>=H.start+H.duration)continue;const J=H.layout,ee=J==null?void 0:J.node,Z={start:H.start,end:H.start+H.duration,x:(ee==null?void 0:ee.x)??0,y:(ee==null?void 0:ee.y)??0,width:(ee==null?void 0:ee.width)??m.width,height:(ee==null?void 0:ee.height)??m.height};let k=A.get(H.id);for(;k;)k.animations&&(_.has(k.id)||_.set(k.id,[]),_.get(k.id).push(Z)),k=k.parentGroupId?d.get(k.parentGroupId):void 0}const R=new Map;function F(D){if(R.has(D.id))return R.get(D.id);const H=SC({group:D,currentTime:C,activeMembers:_.get(D.id)??[],fallbackDimensions:{width:m.width,height:m.height}});return R.set(D.id,H),H}function P(D,H,J){const ee=f({id:J});if(ee.length===0){D.drawImage(H,0,0,H.width,H.height);return}D.save();for(let Z=ee.length-1;Z>=0;Z--){const k=ee[Z],U=F(k);U&&Ud({group:k,animationState:U,targetCtx:D,fallbackDimensions:{width:m.width,height:m.height}})}D.drawImage(H,0,0,H.width,H.height),D.restore()}for(let D=0;D<l.length;D++){if(y!=null&&y.aborted)return;const H=l[D];if(jl(H))continue;const{scenes:J,transitions:ee,trackCanvas:Z}=H;Z.width=Z.height=0,Z.width=m.width,Z.height=m.height;const k=Z.getContext("2d");if(!k)continue;const U=J.filter(({start:Q,duration:M})=>C>=Q&&C<Q+M);if(U.length===0)continue;const V=ee.find(({start:Q,duration:M})=>C>=Q&&C<Q+M),L=!!(V&&V.to&&V.from&&V.duration>0);for await(const Q of U){if(y!=null&&y.aborted)return;const{sceneCanvas:M,draw:W,id:Y}=Q;if(await(W==null?void 0:W(C,B==null?void 0:B.get(Y))),y!=null&&y.aborted)return;L&&(V.to.id===Y||V.from.id===Y)||P(k,M,Y)}if(L){const{name:Q,to:M,from:W,duration:Y,transitionCanvas:te}=V;te.width=te.height=0,te.width=Z.width,te.height=Z.height;const oe=Math.min(1,Math.max(0,(C-M.start)/Y));if(await o({name:Q,progress:oe,contextResources:c,to:M.sceneCanvas,from:W.sceneCanvas,canvas:te}),y!=null&&y.aborted)return;const he=new Set(f({id:W.id})),fe=new Set(f({id:M.id})),Se=[...he].filter(Le=>fe.has(Le)).sort((Le,ge)=>Le.depth-ge.depth);if(Se.length===0)k.drawImage(te,0,0,te.width,te.height);else{k.save();for(const Le of Se){const ge=F(Le);ge&&Ud({group:Le,animationState:ge,targetCtx:k,fallbackDimensions:{width:m.width,height:m.height}})}k.drawImage(te,0,0,te.width,te.height),k.restore()}}w.drawImage(Z,0,0,Z.width,Z.height)}},cleanup:()=>{DC(c)},tracks:l,groups:u,aspectRatio:e.aspectRatio,transcriptions:e.transcriptions,duration:Math.max(...l.map(({duration:m})=>m))}}const kC={name:"@vouchfor/embeds",version:"8.4.2",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":"turbo run build --filter=@vouchfor/embeds^... && 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.4.1","@vouchfor/media-player":"^9.4.1",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.6.12","@storybook/addon-links":"^8.6.12","@storybook/blocks":"^8.6.12","@storybook/web-components":"^8.6.12","@storybook/web-components-vite":"^8.6.12","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.10","@vouchfor/eslint-config":"^1.0.5","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^6.4.2","@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",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:"^8.6.12",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 MC(r){const{publicApiUrl:e}=no(r),t=oi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function FC(r){var s,o,a,c,l,u,A,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:oi()};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"),i=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=oi();return e||(e=MC(r),(h=(A=window.localStorage)==null?void 0:A.setItem)==null||h.call(A,"vouch-uid-visitor",e)),t||(t=oi(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=oi(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:n,visitor:e}}function PC(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function NC(r="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,"/"))??[],i={};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());i[c]=a}}),{source:r,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:kC.version,templateVersion:vC,...i}}const Hd=1;class OC{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const n=PC(i,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=no(this.host.env),{client:i,tab:n,request:s,visitor:o}=FC(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":NC(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Hd&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:i,node:n},this._streamLatestTime[i]=n.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=n.currentTime,this._streamLatestTime[i]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Hd&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,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),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,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),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ql={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Tr<"u"&&Tr,i=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 Tr<"u"&&Tr||{},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(k){return k&&DataView.prototype.isPrototypeOf(k)}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(k){return k&&u.indexOf(Object.prototype.toString.call(k))>-1};function h(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function d(k){return typeof k!="string"&&(k=String(k)),k}function f(k){var U={next:function(){var V=k.shift();return{done:V===void 0,value:V}}};return c.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,V){this.append(V,U)},this):Array.isArray(k)?k.forEach(function(U){if(U.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+U.length);this.append(U[0],U[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(U){this.append(U,k[U])},this)}g.prototype.append=function(k,U){k=h(k),U=d(U);var V=this.map[k];this.map[k]=V?V+", "+U:U},g.prototype.delete=function(k){delete this.map[h(k)]},g.prototype.get=function(k){return k=h(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(h(k))},g.prototype.set=function(k,U){this.map[h(k)]=d(U)},g.prototype.forEach=function(k,U){for(var V in this.map)this.map.hasOwnProperty(V)&&k.call(U,this.map[V],V,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,V){k.push(V)}),f(k)},g.prototype.values=function(){var k=[];return this.forEach(function(U){k.push(U)}),f(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(U,V){k.push([V,U])}),f(k)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(k){if(!k._noBody){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}}function m(k){return new Promise(function(U,V){k.onload=function(){U(k.result)},k.onerror=function(){V(k.error)}})}function C(k){var U=new FileReader,V=m(U);return U.readAsArrayBuffer(k),V}function B(k){var U=new FileReader,V=m(U),L=/charset=([A-Za-z0-9_-]+)/.exec(k.type),Q=L?L[1]:"utf-8";return U.readAsText(k,Q),V}function y(k){for(var U=new Uint8Array(k),V=new Array(U.length),L=0;L<U.length;L++)V[L]=String.fromCharCode(U[L]);return V.join("")}function w(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=w(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||A(k))?this._bodyArrayBuffer=w(k):this._bodyText=k=Object.prototype.toString.call(k):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof k=="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(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=p(this);if(k)return k;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 k=p(this);return k||(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 k=p(this);if(k)return k;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 R=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(k){var U=k.toUpperCase();return R.indexOf(U)>-1?U:k}function P(k,U){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var V=U.body;if(k instanceof P){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,U.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!V&&k._bodyInit!=null&&(V=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=F(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.signal||this.signal||function(){if("AbortController"in a){var M=new AbortController;return M.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")&&(U.cache==="no-store"||U.cache==="no-cache")){var L=/([?&])_=[^&]*/;if(L.test(this.url))this.url=this.url.replace(L,"$1_="+new Date().getTime());else{var Q=/\?/;this.url+=(Q.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function D(k){var U=new FormData;return k.trim().split("&").forEach(function(V){if(V){var L=V.split("="),Q=L.shift().replace(/\+/g," "),M=L.join("=").replace(/\+/g," ");U.append(decodeURIComponent(Q),decodeURIComponent(M))}}),U}function H(k){var U=new g,V=k.replace(/\r?\n[\t ]+/g," ");return V.split("\r").map(function(L){return L.indexOf(`
2462
+ `).map(e=>{if(!e)return[];const t=[];for(const i of e.match(/\S+|\s+/g)??[])if(/^\s+$/.test(i))t.push({text:i,logicalIndex:t.length,whitespace:!0,spaceBefore:!1});else if(Ld.test(i))for(const n of kd(i))t.push({text:n.text,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});else t.push({text:i,logicalIndex:t.length,whitespace:!1,spaceBefore:!1});return t})}function kd(r){const e=[];let t=!1,i="";const n=sC();if(!n)return[{text:r,spaceBefore:!1}];for(const{segment:s,isWordLike:o}of n.segment(r)){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:i+=s}return i&&e.length>0?e[0].text=i+e[0].text:i&&e.push({text:i,spaceBefore:t}),e}function aC(r){const e=[];for(const t of r){const n=Ld.test(t.text)||/\s/.test(t.text)?kd(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 lC=/(?<value>\d+\.?\d*)(?=px)/,Jl=1;function cC(r,e){const t=typeof r=="string"?oC(r):[aC(r)];return e?t.map(i=>i.map(n=>({...n,text:n.text.toUpperCase()}))):t}function AC({context:r,groups:e,appendedFont:t,fontSizes:i,maxW:n,wrap:s,strokeWidth:o,letterSpacing:a,wholeLineMeasure:c}){const l=[],u=h=>{const d=i[h%i.length];return{fontSize:d,font:t.replace(lC,d.toString())}},A=(h,d)=>(r.font=h,r.letterSpacing=`${a}px`,r.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},m="",C="";const B=()=>{const y=A(p.font,"");p.fontAscent=y.fontBoundingBoxAscent,p.fontDescent=y.fontBoundingBoxDescent,l.push(p);const w=u(l.length);p={items:[],font:w.font,fontSize:w.fontSize,lineWidth:0,fontAscent:0,fontDescent:0},m="",C=""};for(const y of h){if(y.whitespace){C+=y.text;continue}const w=()=>{const F=p.items.length>0&&y.spaceBefore&&!C?" ":C,P=F?A(p.font,F).width:0,D=A(p.font,y.text);return{token:y,metrics:D,width:D.width+o,gapBefore:P,gapText:F}};let _=w();const R=c?A(p.font,m+_.gapText+y.text).width+o*(p.items.length+1):p.lineWidth+_.gapBefore+_.width;if(s&&R>n+Jl&&p.items.length>0&&(B(),_=w()),s&&c&&p.items.length===0&&_.width>n+Jl){let F=y.text;for(;F.length>0;){let P="";for(const H of F){const J=A(p.font,P+H).width+o;if(P&&J>n+Jl)break;P+=H}F=F.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:""}),m=P,p.lineWidth=D.width+o*p.items.length,F.length>0&&B()}C="";continue}p.items.push(_),m+=_.gapText+y.text,p.lineWidth=c?A(p.font,m).width+o*p.items.length:p.lineWidth+_.gapBefore+_.width,C=""}c&&C&&(p.items.length>0||l.length===d)&&(m+=C,p.lineWidth=A(p.font,m).width+o*p.items.length),(p.items.length>0||l.length===d)&&B()}return l}const Md=[{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 Fd({text:r,font:e}){let t=e;return Md.forEach(({family:i,regex:n})=>{n.exec(r)&&(t+=`, ${i}`)}),t}function Pd(r){return Math.max(r??1,.5)}function uC({measured:r,index:e,lineTop:t,dx:i,dw:n,align:s,direction:o,lineHeight:a,strokeWidth:c}){const{items:l,font:u,fontSize:A,lineWidth:h,fontAscent:d,fontDescent:f}=r;let g=0;s==="center"?g=(n-h)/2:s==="right"&&(g=n-h);const p=Pd(a),m=A*p+c,C=(p-1)*A/2,B=(A+d-f)/2,y=t+C+B+c/2,{order:w,directions:_,baseDirection:R}=rC(l.map(({token:Z})=>({text:Z.text})),o),F=l.map(({gapBefore:Z})=>Z);let P=i+g+c/2;const D=[];w.forEach((Z,k)=>{const U=l[Z];P+=F[k],D.push({...U.token,x:P,baselineY:y,width:U.width,lineIndex:e,direction:_[Z],font:u,metrics:U.metrics}),P+=U.width});const H=[],J=[];D.forEach((Z,k)=>{const U=H[H.length-1];if(U&&U.direction===Z.direction){const V=Math.max(U.x+U.width,Z.x+Z.width);U.tokens.push(Z),U.x=Math.min(U.x,Z.x),U.width=V-U.x,J[J.length-1].push(w[k])}else H.push({text:"",x:Z.x,width:Z.width,direction:Z.direction,tokens:[Z]}),J.push([w[k]])}),H.forEach((Z,k)=>{const U=[...J[k]].sort((V,L)=>V-L);Z.text=U.map((V,L)=>L===0?l[V].token.text:`${l[V].gapText}${l[V].token.text}`).join("")});const ee=o??R;return{index:e,box:{x:i+g,y:t,width:h,height:m},baselineY:y,direction:ee,runs:H,tokens:D}}function hC(r){const{context:e,text:t,font:i,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}=r,m=cC(t,p),C=m.flat().map(({text:_})=>_).join(" "),B=Fd({font:i,text:C}),y=u??eC(C),w=Zy(l,y);try{e.save();const _=AC({context:e,groups:m,appendedFont:B,fontSizes:n,maxW:a,wrap:g,strokeWidth:f,letterSpacing:d,wholeLineMeasure:typeof t=="string"}),R=[];let F=o;for(let ee=0;ee<_.length;ee++){const Z=uC({measured:_[ee],index:ee,lineTop:F,dx:s,dw:c,align:w,direction:u,lineHeight:A,strokeWidth:f});R.push(Z),F+=Z.box.height+h}const P=_[_.length-1],D=P?Math.max(0,(P.fontAscent+P.fontDescent-P.fontSize*Pd(A))/2):0,H=R.reduce((ee,{box:Z})=>ee+Z.height,0)+h*Math.max(0,R.length-1)+D,J=R.length?{x:Math.min(...R.map(({box:ee})=>ee.x)),y:Math.min(...R.map(({box:ee})=>ee.y)),width:Math.max(...R.map(({box:ee})=>ee.x+ee.width))-Math.min(...R.map(({box:ee})=>ee.x)),height:Math.max(...R.map(({box:ee})=>ee.y+ee.height))-Math.min(...R.map(({box:ee})=>ee.y))}:{x:s,y:o,width:0,height:0};return{lines:R,totalHeight:H,blockBox:J,direction:y,font:B}}finally{e.restore()}}bu(hC,{cache:nC(),cacheKey:([r])=>JSON.stringify([r.text,r.font,r.fontSizes,r.dx,r.dy,r.dw,r.maxW,r.align,r.direction,r.lineHeight,r.lineGap,r.letterSpacing,r.strokeWidth,r.wrap,r.uppercase])});function dC(r){return r.slice(0,1).toUpperCase()+r.slice(1)}Object.keys(Zh).map(r=>({label:dC(r),value:r,data:r}));function Nd(){return document.createElement("canvas")}function ir(r){let e=0;for(const t of r)Array.isArray(t)?e+=ir(t):e+=t;return e}function Fo(r){return r.map(({type:e,duration:t},i)=>{var n,s,o,a;if(e==="transition"){const c=((n=r[i-2])==null?void 0:n.type)==="transition"?r[i-2]:null,l=((s=r[i-1])==null?void 0:s.duration)??1/0,u=((o=r[i+1])==null?void 0:o.duration)??1/0,A=((a=r[i+2])==null?void 0:a.type)==="transition"?r[i+2]:null;return Math.min(c?l/2:l,t,A?u/2:u)*-1}return t})}function fC(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function gC(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}vE.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${gC(r)}"`:fC(r)||Array.isArray(r)?JSON.stringify(r):r);function pC(r){return r.some(({type:e})=>e==="text")}function mC(r){return r.some(({type:e})=>e==="caption")}function EC(r){return r.some(({type:e})=>e==="audio")}function IC(r){return r.some(({type:e})=>e==="video"||e==="image")}function jl(r){return r.type==="audio"}const vC="3";async function yC({scene:r,start:e=0}){const{id:t,root:i,duration:n}=r,s=await Qd({id:t,root:i});return{type:r.type,start:e,duration:n,layout:s,id:r.id,config:r}}async function CC({track:r}){const e=Fo(r),t=await Promise.all(r.reduce((s,o,a)=>{if(o.type!=="audio")return s;const c=ir(e.slice(0,a));return s.push(yC({scene:o,start:c})),s},[])),i=r.reduce((s,o,a)=>{if(o.type!=="gap")return s;const c=ir(e.slice(0,a));return s.push({type:o.type,id:o.id,start:c,config:o,duration:o.duration}),s},[]),n=r.map(({id:s})=>t.find(({id:o})=>o===s)??i.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:i,mergedScenes:n,config:r,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Od({node:r,canvases:e,sceneTime:t,sceneDuration:i,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=r.element.layout)!=null&&c.transform)?{...r.element.layout,transform:{...r.element.layout.transform,rotation:a.rotation}}:r.element.layout,g=hd({layout:f,sceneTime:t,animations:r.element.animations,elementDuration:i,elementDimensions:{width:r.width,height:r.height}}),{opacity:p,translation:m,scale:C,clip:B,dimensions:y,rotation:w}=g,_=r.width*y.widthRatio,R=r.height*y.heightRatio;if(d.globalAlpha=p*n,(m.x||m.y)&&d.translate(m.x,m.y),(C!==1||w!==0)&&(d.translate(r.x+_/2,r.y+R/2),d.scale(C,C),d.rotate(w*Math.PI/180),d.translate(-(r.x+_/2),-(r.y+R/2))),B){d.beginPath();const D={x:r.x+B.x*_,y:r.y+B.y*R,width:B.width*_,height:B.height*R};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(r.x,r.y,_,R),d.globalAlpha=D}const F=(a==null?void 0:a.fontSize)!=null||(a==null?void 0:a.textValue)!=null?{...r.options,...a.textValue!=null?{value:a.textValue}:{},...a.fontSize!=null&&((l=r.options)!=null&&l.font)?{font:{...r.options.font,size:a.fontSize}}:{}}:r.options,P=(a==null?void 0:a.fontSize)!=null&&((u=r.dependencies)!=null&&u.font)?{...r.dependencies,font:{...r.dependencies.font,size:a.fontSize}}:r.dependencies;await((h=(A=r.renderer)==null?void 0:A.render)==null?void 0:h.call(A,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:_,dh:R,radius:r.radius,options:F,dependencies:P}));for await(const D of r.childNodes)await Od({debug:o,node:D,canvases:e,sceneTime:t,sceneDuration:i,parentOpacity:d.globalAlpha,parentTransform:d.getTransform(),override:a});d.restore()}}async function BC({layout:r,canvases:e,sceneTime:t,sceneDuration:i,debug:n=!1,override:s}){const{node:o}=r;await Od({debug:n,node:o,canvases:e,sceneDuration:i,sceneTime:t,override:s})}async function Po({debug:r=!1,scene:e,start:t=0,resolvers:i,rootWidth:n,rootHeight:s,canvasFactory:o=Nd}){var a,c;const{id:l,x:u,y:A,width:h,height:d,root:f,duration:g}=e,p=o(),m=o(),C=o(),B=o(),y=o(),w=await Qd({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:i,measureCanvas:y}),_=async(R,F)=>{const P=Math.max(0,R-t);p.width=p.height=0,p.width=n,p.height=s,await BC({debug:r,layout:w,sceneTime:P,sceneDuration:g,canvases:{sceneCanvas:p,cropCanvas:m,letterboxCanvas:C,posterCanvas:B},override:F})};return{id:l,type:e.type,start:t,duration:g,layout:w,sceneCanvas:p,draw:_,config:e,childScenes:[]}}async function TC({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=Fo(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ir(o.slice(0,d));return h.type==="caption"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ir(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=ir(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 m;return p===((m=e[d+1])==null?void 0:m.id)}),from:a.find(({id:p})=>{var m;return p===((m=e[d-1])==null?void 0:m.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 bC({groups:r,tracks:e}){const t=r.map(s=>new Set(s.sceneIds)),i=r.map((s,o)=>{const a=[];for(let u=0;u<e.length;u++){const A=e[u];jl(A)||A.scenes.some(h=>s.sceneIds.includes(h.id))&&a.push(u)}let c,l=1/0;for(let u=0;u<r.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=r[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(i.map(s=>[s.id,s]));for(const s of i){let o=0,a=s;for(;a!=null&&a.parentGroupId;)o++,a=n.get(a.parentGroupId);s.depth=o}return i}function SC({group:r,currentTime:e,activeMembers:t,fallbackDimensions:i}){if(!r.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=r.bounds,l=(c==null?void 0:c.width)??i.width,u=(c==null?void 0:c.height)??i.height;return hd({sceneTime:a,animations:r.animations,elementDuration:o,elementDimensions:{width:l,height:u}})}function Ud({group:r,animationState:e,targetCtx:t,fallbackDimensions:i}){const n=r.bounds,s=(n==null?void 0:n.x)??0,o=(n==null?void 0:n.y)??0,a=(n==null?void 0:n.width)??i.width,c=(n==null?void 0:n.height)??i.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 xC({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=Fo(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ir(o.slice(0,d));return h.type==="video"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),h.type==="image"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ir(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=ir(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 m;return p===((m=e[d+1])==null?void 0:m.id)}),from:a.find(({id:p})=>{var m;return p===((m=e[d-1])==null?void 0:m.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 wC({debug:r=!1,track:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}){const o=Fo(e),a=await Promise.all(e.reduce((A,h,d)=>{const f=ir(o.slice(0,d));return h.type==="text"&&A.push(Po({debug:r,scene:h,start:f,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s})),A},[])),c=e.reduce((A,h,d)=>{if(h.type!=="gap")return A;const f=ir(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=ir(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 m;return p===((m=e[d+1])==null?void 0:m.id)}),from:a.find(({id:p})=>{var m;return p===((m=e[d-1])==null?void 0:m.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 QC=(((Xh=zh)==null?void 0:Xh.default)??zh).reduce((r,e)=>(r[e.name]=e,r),{});function _C(r,e){return r.has(e)||r.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),r.get(e)}function RC({name:r,to:e,from:t,progress:i,width:n,height:s,glContext:o,contextResources:a,returnPixels:c=!0}){var l,u,A;const h=_C(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=xo)==null?void 0:l.default)??xo)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=xo)==null?void 0:u.default)??xo)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[r]||(h.transitions[r]=(((A=qh)==null?void 0:A.default)??qh)(o,QC[r])),h.transitions[r].draw(i,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 DC(r){for(const[e,t]of r.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(i=>{i.dispose()}),r.delete(e)}function LC({name:r,to:e,from:t,progress:i,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),RC({name:r,to:e,from:t,progress:i,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Gd({debug:r=!1,config:e,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s=Nd,drawTransition:o=LC}){var a;const c=new Map,l=await Promise.all(e.tracks.map(async m=>{if(IC(m))return{...await xC({debug:r,track:m,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:m};if(pC(m))return{...await wC({debug:r,track:m,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:m};if(mC(m))return{...await TC({debug:r,track:m,resolvers:t,rootWidth:i,rootHeight:n,canvasFactory:s}),config:m};if(EC(m))return{...await CC({track:m}),config:m};throw new Error("Unknown track type")})),u=(a=e.groups)!=null&&a.length?bC({groups:e.groups,tracks:l}):[],A=new Map,h=[...u].sort((m,C)=>m.depth-C.depth);for(const m of h)for(const C of m.sceneIds)A.set(C,m);const d=new Map(u.map(m=>[m.id,m]));function f(m){const C=[];let B=A.get(m.id);for(;B;)B.animations&&C.push(B),B=B.parentGroupId?d.get(B.parentGroupId):void 0;return C}return{draw:async({canvas:m,currentTime:C,overrides:B,signal:y})=>{const w=m.getContext("2d");if(!w)return;w.globalAlpha=1,w.globalCompositeOperation="source-over",w.clearRect(0,0,m.width,m.height),w.save(),w.fillStyle="black",w.fillRect(0,0,m.width,m.height),w.restore();const _=new Map;for(const D of l)if(!jl(D))for(const H of D.scenes){if(C<H.start||C>=H.start+H.duration)continue;const J=H.layout,ee=J==null?void 0:J.node,Z={start:H.start,end:H.start+H.duration,x:(ee==null?void 0:ee.x)??0,y:(ee==null?void 0:ee.y)??0,width:(ee==null?void 0:ee.width)??m.width,height:(ee==null?void 0:ee.height)??m.height};let k=A.get(H.id);for(;k;)k.animations&&(_.has(k.id)||_.set(k.id,[]),_.get(k.id).push(Z)),k=k.parentGroupId?d.get(k.parentGroupId):void 0}const R=new Map;function F(D){if(R.has(D.id))return R.get(D.id);const H=SC({group:D,currentTime:C,activeMembers:_.get(D.id)??[],fallbackDimensions:{width:m.width,height:m.height}});return R.set(D.id,H),H}function P(D,H,J){const ee=f({id:J});if(ee.length===0){D.drawImage(H,0,0,H.width,H.height);return}D.save();for(let Z=ee.length-1;Z>=0;Z--){const k=ee[Z],U=F(k);U&&Ud({group:k,animationState:U,targetCtx:D,fallbackDimensions:{width:m.width,height:m.height}})}D.drawImage(H,0,0,H.width,H.height),D.restore()}for(let D=0;D<l.length;D++){if(y!=null&&y.aborted)return;const H=l[D];if(jl(H))continue;const{scenes:J,transitions:ee,trackCanvas:Z}=H;Z.width=Z.height=0,Z.width=m.width,Z.height=m.height;const k=Z.getContext("2d");if(!k)continue;const U=J.filter(({start:Q,duration:M})=>C>=Q&&C<Q+M);if(U.length===0)continue;const V=ee.find(({start:Q,duration:M})=>C>=Q&&C<Q+M),L=!!(V&&V.to&&V.from&&V.duration>0);for await(const Q of U){if(y!=null&&y.aborted)return;const{sceneCanvas:M,draw:W,id:Y}=Q;if(await(W==null?void 0:W(C,B==null?void 0:B.get(Y))),y!=null&&y.aborted)return;L&&(V.to.id===Y||V.from.id===Y)||P(k,M,Y)}if(L){const{name:Q,to:M,from:W,duration:Y,transitionCanvas:te}=V;te.width=te.height=0,te.width=Z.width,te.height=Z.height;const oe=Math.min(1,Math.max(0,(C-M.start)/Y));if(await o({name:Q,progress:oe,contextResources:c,to:M.sceneCanvas,from:W.sceneCanvas,canvas:te}),y!=null&&y.aborted)return;const he=new Set(f({id:W.id})),fe=new Set(f({id:M.id})),Se=[...he].filter(Le=>fe.has(Le)).sort((Le,ge)=>Le.depth-ge.depth);if(Se.length===0)k.drawImage(te,0,0,te.width,te.height);else{k.save();for(const Le of Se){const ge=F(Le);ge&&Ud({group:Le,animationState:ge,targetCtx:k,fallbackDimensions:{width:m.width,height:m.height}})}k.drawImage(te,0,0,te.width,te.height),k.restore()}}w.drawImage(Z,0,0,Z.width,Z.height)}},cleanup:()=>{DC(c)},tracks:l,groups:u,aspectRatio:e.aspectRatio,transcriptions:e.transcriptions,duration:Math.max(...l.map(({duration:m})=>m))}}const kC={name:"@vouchfor/embeds",version:"8.4.3",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":"turbo run build --filter=@vouchfor/embeds^... && 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.4.1","@vouchfor/media-player":"^9.4.3",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.5","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^6.4.2","@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",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 MC(r){const{publicApiUrl:e}=no(r),t=oi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function FC(r){var s,o,a,c,l,u,A,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:oi()};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"),i=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=oi();return e||(e=MC(r),(h=(A=window.localStorage)==null?void 0:A.setItem)==null||h.call(A,"vouch-uid-visitor",e)),t||(t=oi(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=oi(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:n,visitor:e}}function PC(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function NC(r="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,"/"))??[],i={};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());i[c]=a}}),{source:r,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:kC.version,templateVersion:vC,...i}}const Hd=1;class OC{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const n=PC(i,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=no(this.host.env),{client:i,tab:n,request:s,visitor:o}=FC(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":NC(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Hd&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:i,node:n},this._streamLatestTime[i]=n.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=n.currentTime,this._streamLatestTime[i]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Hd&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,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),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,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),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ql={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Tr<"u"&&Tr,i=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 Tr<"u"&&Tr||{},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(k){return k&&DataView.prototype.isPrototypeOf(k)}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(k){return k&&u.indexOf(Object.prototype.toString.call(k))>-1};function h(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function d(k){return typeof k!="string"&&(k=String(k)),k}function f(k){var U={next:function(){var V=k.shift();return{done:V===void 0,value:V}}};return c.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,V){this.append(V,U)},this):Array.isArray(k)?k.forEach(function(U){if(U.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+U.length);this.append(U[0],U[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(U){this.append(U,k[U])},this)}g.prototype.append=function(k,U){k=h(k),U=d(U);var V=this.map[k];this.map[k]=V?V+", "+U:U},g.prototype.delete=function(k){delete this.map[h(k)]},g.prototype.get=function(k){return k=h(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(h(k))},g.prototype.set=function(k,U){this.map[h(k)]=d(U)},g.prototype.forEach=function(k,U){for(var V in this.map)this.map.hasOwnProperty(V)&&k.call(U,this.map[V],V,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,V){k.push(V)}),f(k)},g.prototype.values=function(){var k=[];return this.forEach(function(U){k.push(U)}),f(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(U,V){k.push([V,U])}),f(k)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(k){if(!k._noBody){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}}function m(k){return new Promise(function(U,V){k.onload=function(){U(k.result)},k.onerror=function(){V(k.error)}})}function C(k){var U=new FileReader,V=m(U);return U.readAsArrayBuffer(k),V}function B(k){var U=new FileReader,V=m(U),L=/charset=([A-Za-z0-9_-]+)/.exec(k.type),Q=L?L[1]:"utf-8";return U.readAsText(k,Q),V}function y(k){for(var U=new Uint8Array(k),V=new Array(U.length),L=0;L<U.length;L++)V[L]=String.fromCharCode(U[L]);return V.join("")}function w(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=w(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||A(k))?this._bodyArrayBuffer=w(k):this._bodyText=k=Object.prototype.toString.call(k):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof k=="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(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=p(this);if(k)return k;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 k=p(this);return k||(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 k=p(this);if(k)return k;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 R=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(k){var U=k.toUpperCase();return R.indexOf(U)>-1?U:k}function P(k,U){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var V=U.body;if(k instanceof P){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,U.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!V&&k._bodyInit!=null&&(V=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=F(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.signal||this.signal||function(){if("AbortController"in a){var M=new AbortController;return M.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")&&(U.cache==="no-store"||U.cache==="no-cache")){var L=/([?&])_=[^&]*/;if(L.test(this.url))this.url=this.url.replace(L,"$1_="+new Date().getTime());else{var Q=/\?/;this.url+=(Q.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function D(k){var U=new FormData;return k.trim().split("&").forEach(function(V){if(V){var L=V.split("="),Q=L.shift().replace(/\+/g," "),M=L.join("=").replace(/\+/g," ");U.append(decodeURIComponent(Q),decodeURIComponent(M))}}),U}function H(k){var U=new g,V=k.replace(/\r?\n[\t ]+/g," ");return V.split("\r").map(function(L){return L.indexOf(`
2463
2463
  `)===0?L.substr(1,L.length):L}).forEach(function(L){var Q=L.split(":"),M=Q.shift().trim();if(M){var W=Q.join(":").trim();try{U.append(M,W)}catch(Y){console.warn("Response "+Y.message)}}}),U}_.call(P.prototype);function J(k,U){if(!(this instanceof J))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(U||(U={}),this.type="default",this.status=U.status===void 0?200:U.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=U.statusText===void 0?"":""+U.statusText,this.headers=new g(U.headers),this.url=U.url||"",this._initBody(k)}_.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},J.error=function(){var k=new J(null,{status:200,statusText:""});return k.ok=!1,k.status=0,k.type="error",k};var ee=[301,302,303,307,308];J.redirect=function(k,U){if(ee.indexOf(U)===-1)throw new RangeError("Invalid status code");return new J(null,{status:U,headers:{location:k}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(U,V){this.message=U,this.name=V;var L=Error(U);this.stack=L.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Z(k,U){return new Promise(function(V,L){var Q=new P(k,U);if(Q.signal&&Q.signal.aborted)return L(new o.DOMException("Aborted","AbortError"));var M=new XMLHttpRequest;function W(){M.abort()}M.onload=function(){var oe={statusText:M.statusText,headers:H(M.getAllResponseHeaders()||"")};Q.url.indexOf("file://")===0&&(M.status<200||M.status>599)?oe.status=200:oe.status=M.status,oe.url="responseURL"in M?M.responseURL:oe.headers.get("X-Request-URL");var he="response"in M?M.response:M.responseText;setTimeout(function(){V(new J(he,oe))},0)},M.onerror=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},M.ontimeout=function(){setTimeout(function(){L(new TypeError("Network request timed out"))},0)},M.onabort=function(){setTimeout(function(){L(new o.DOMException("Aborted","AbortError"))},0)};function Y(oe){try{return oe===""&&a.location.href?a.location.href:oe}catch{return oe}}if(M.open(Q.method,Y(Q.url),!0),Q.credentials==="include"?M.withCredentials=!0:Q.credentials==="omit"&&(M.withCredentials=!1),"responseType"in M&&(c.blob?M.responseType="blob":c.arrayBuffer&&(M.responseType="arraybuffer")),U&&typeof U.headers=="object"&&!(U.headers instanceof g||a.Headers&&U.headers instanceof a.Headers)){var te=[];Object.getOwnPropertyNames(U.headers).forEach(function(oe){te.push(h(oe)),M.setRequestHeader(oe,d(U.headers[oe]))}),Q.headers.forEach(function(oe,he){te.indexOf(he)===-1&&M.setRequestHeader(he,oe)})}else Q.headers.forEach(function(oe,he){M.setRequestHeader(he,oe)});Q.signal&&(Q.signal.addEventListener("abort",W),M.onreadystatechange=function(){M.readyState===4&&Q.signal.removeEventListener("abort",W)}),M.send(typeof Q._bodyInit>"u"?null:Q._bodyInit)})}return Z.polyfill=!0,a.fetch||(a.fetch=Z,a.Headers=g,a.Request=P,a.Response=J),o.Headers=g,o.Request=P,o.Response=J,o.fetch=Z,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var n=t.fetch?t:i;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,r.exports=e})(ql,ql.exports);var UC=ql.exports;const $d=ll(UC);async function GC(r){var e;try{if((e=await $d(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function zl({sources:r}){const e=r==null?void 0:r.filter(Boolean),t=e==null?void 0:e.find(s=>s.startsWith("blob:")),i=e==null?void 0:e.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(t||i)return t??i;let n=e[0];if(e.length>0){const s=e.map(a=>GC(a)),o=(await Promise.all(s)).find(Boolean);o&&(n=o)}return n}async function HC(r){try{return(await $d(r)).text()}catch{return null}}async function $C(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?HC(r):r}function YC(r){if(typeof r=="string"){const[e,t]=r.split(":");return parseFloat(e)/parseFloat(t)}return r}const VC=br(async({original:r,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:n})=>{var s,o;const a={[(s=i==null?void 0:i.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},c=(n&&a[n])??r;return c?$C(c):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function KC(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var i;return{text:(i=t.alternatives[0])==null?void 0:i.content,start:t.start_time,end:t.end_time}}))??[]}const WC=br(async r=>{var e,t,i,n,s,o,a,c,l,u,A;const[h,d,f]=await Promise.all([zl({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(n=(i=r==null?void 0:r.answer)==null?void 0:i.media)==null?void 0:n.input]}),zl({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),zl({sources:[((c=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:c.reducedQuality)??((A=(u=(l=r==null?void 0:r.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:A.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,i,n,s,o,a,c,l,u,A;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(n=(i=r==null?void 0:r.answer)==null?void 0:i.media)==null?void 0:n.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((c=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:c.reducedQuality)??((A=(u=(l=r==null?void 0:r.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:A.xs)})}});function Yd(r){var e,t,i,n,s,o,a,c,l,u,A,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(n=(i=r==null?void 0:r.answer)==null?void 0:i.contact)==null?void 0:n.name)==null?void 0:s.trim())??"",f=((c=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:c.name)==="Not Supplied"?"":((h=(A=(u=(l=r==null?void 0:r.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(r){var e,t;const i=(t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.roleTitle,n=i==null?void 0:i.split(" ");return{roleTitle:i,roleWords:n,firstRoleWord:n==null?void 0:n[0],remainingRoleWords:n==null?void 0:n.slice(1).join(" ")}}async function jC(r,e,t){var i,n,s;const o=(i=e==null?void 0:e.answer)==null?void 0:i.id;return((s=(n=r==null?void 0:r.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:r,rootData:e,index:t},i){var n,s,o,a,c,l,u,A,h,d,f,g,p,m,C,B,y,w,_,R,F,P,D,H,J;const ee=(n=e==null?void 0:e.answer)==null?void 0:n.metadata;(ee==null?void 0:ee.aspectRatio)!=null&&(ee.aspectRatio=YC(ee.aspectRatio));const[Z,k,U]=await Promise.all([jC(r,e,t),WC(e),VC({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:(m=(p=(g=e==null?void 0:e.answer)==null?void 0:g.transcription)==null?void 0:p.translation)==null?void 0:m.language},i)]),V=Yd(e),L=JC(e);return{...k,...V,...L,key:Z,captions:U,wordTimings:KC((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?((R=(_=(w=(y=r==null?void 0:r.questions)==null?void 0:y.items)==null?void 0:w[t-1])==null?void 0:_.answer)==null?void 0:R.label)??((D=(P=(F=r==null?void 0:r.questions)==null?void 0:F.items)==null?void 0:P[t-1])==null?void 0:D.title)??null:null,isFirstInstanceOfName:t?((J=(H=r==null?void 0:r.questions)==null?void 0:H.items)==null?void 0:J.findIndex(Q=>Yd(Q).name===V.name))===t:!0}}const No={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 qC({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,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&&No[h]&&!i.find(f=>f.value===h)&&i.push({value:h,label:No[h]}),d&&No[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:No[d]}),i},[]))??[]}/**
2464
2464
  * @license
2465
2465
  * Copyright 2018 Google LLC