@vouchfor/embeds 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/embeds.js +1 -1
- package/dist/iife/dialog-embed/embed.iife.js +1 -1
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/embeds.iife.js +1 -1
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.iife.js +1 -1
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/package.json +4 -4
package/dist/es/embeds.js
CHANGED
@@ -2473,7 +2473,7 @@ vec4 transition(vec2 uv) {
|
|
2473
2473
|
return mix(a, b, step(0.0+p.y,progress));
|
2474
2474
|
}
|
2475
2475
|
`,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const vh=Pa(fv);var yh;function gv(i){if(typeof i=="string"){const[e,t]=i.split(":");return Math.min(parseFloat(e),parseFloat(t))}return i}function pv(i){if(typeof i=="string"){const[e,t]=i.split(":"),r=parseFloat(e),n=parseFloat(t);return r/n}return i}function fl({resolution:i,aspectRatio:e}){const t=gv(i),r=pv(e),n=r>=1,s=Math.min(n?t*r:t/r,t),o=Math.max(n?t*r:t/r,t);return{resolution:t,aspectRatio:r,height:n?s:o,width:n?o:s}}const Ch={linear:Qm,easeIn:Ma,easeInOut:wm,easeOut:_m,circIn:pu,circInOut:Rm,circOut:mu,backIn:Fa,backInOut:Lm,backOut:Dm,anticipate:km,bounceIn:Nm,bounceInOut:Om,bounceOut:Fs};Rs((i,e,{clamp:t=!0,ease:r="easeIn",...n}={})=>Cm(i,e,{...n,clamp:t,ease:Ch[r]}),{cacheKey:([i,e,t])=>JSON.stringify({from:i,to:e,options:t})});function mv({animation:i,sceneTime:e}){const t=i.keyframes;if(!t||t.length===0)return null;const r=[...t].sort((s,o)=>s.time-o.time);if(e<=r[0].time)return i.renderer.processor.getTargetState(r[0].value);const n=r[r.length-1];if(e>=n.time)return i.renderer.processor.getTargetState(n.value);for(let s=0;s<r.length-1;s++){const o=r[s],a=r[s+1];if(e>=o.time&&e<=a.time){const l=a.time-o.time,A=l===0?0:(e-o.time)/l,u=o.easing||"linear",c=i.renderer.processor.getTargetState(o.value);return i.renderer.processor.interpolateState({easing:u,progress:A,from:c,value:a.value})}}return i.renderer.processor.getTargetState(r[0].value)}function Ev({sceneTime:i,animations:e}){let t={};if(!e)return t;for(const r of Object.values(e)){const n=mv({animation:r,sceneTime:i});n&&(t={...t,...n})}return t}let ro;const Iv=new Uint8Array(16);function vv(){if(!ro&&(ro=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ro))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ro(Iv)}const wt=[];for(let i=0;i<256;++i)wt.push((i+256).toString(16).slice(1));function yv(i,e=0){return wt[i[e+0]]+wt[i[e+1]]+wt[i[e+2]]+wt[i[e+3]]+"-"+wt[i[e+4]]+wt[i[e+5]]+"-"+wt[i[e+6]]+wt[i[e+7]]+"-"+wt[i[e+8]]+wt[i[e+9]]+"-"+wt[i[e+10]]+wt[i[e+11]]+wt[i[e+12]]+wt[i[e+13]]+wt[i[e+14]]+wt[i[e+15]]}const Bh={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Cv(i,e,t){if(Bh.randomUUID&&!i)return Bh.randomUUID();i=i||{};const r=i.random||(i.rng||vv)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,yv(r)}function Bv(i=.4,e=.4){const t=Math.max(.1,Math.min(.8,i)),r=Math.max(.2,Math.min(.6,e)),s=(1-t)/2,a=1-r;return[{x:0,y:s},{x:a,y:s},{x:a,y:0},{x:1,y:.5},{x:a,y:1},{x:a,y:1-s},{x:0,y:1-s}]}const no=64;function Tv(){const i=[],e={x:.5,y:.5},t=.5;for(let r=0;r<no;r++){const n=r/no*2*Math.PI,s=e.x+t*Math.cos(n),o=e.y+t*Math.sin(n);i.push({x:s,y:o})}return i}function bv(i=1){const e=[],t={x:.5,y:.5};let r,n;i>=1?(r=.5,n=.5/i):(r=.5*i,n=.5);for(let s=0;s<no;s++){const o=s/no*2*Math.PI,a=t.x+r*Math.cos(o),l=t.y+n*Math.sin(o);e.push({x:a,y:l})}return e}function Sv(){const i=[];for(let t=0;t<=100;t++){const r=t/100*2*Math.PI,n=16*Math.sin(r)**3,s=-(13*Math.cos(r)-5*Math.cos(2*r)-2*Math.cos(3*r)-Math.cos(4*r)),o=(n+16)/32,a=(s+13)/26;i.push({x:o,y:a})}return i}function Th(i=0,e=1){if(i===0)return[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}];const t=i*Math.PI/180,r=Math.tan(t)/e;return[{x:Math.max(0,Math.min(1,0+r)),y:0},{x:Math.max(0,Math.min(1,1+r)),y:0},{x:Math.max(0,Math.min(1,1-r)),y:1},{x:Math.max(0,Math.min(1,0-r)),y:1}]}function so(i){if(i<3)throw new Error("A polygon must have at least 3 sides");const e=[],t=[];for(let A=0;A<i;A++){const u=A*2*Math.PI/i-Math.PI/2,c=Math.cos(u),h=Math.sin(u);t.push({x:c,y:h})}const r=Math.min(...t.map(A=>A.x)),n=Math.max(...t.map(A=>A.x)),s=Math.min(...t.map(A=>A.y)),o=Math.max(...t.map(A=>A.y)),a=n-r,l=o-s;for(const A of t){const u=(A.x-r)/a,c=(A.y-s)/l;e.push({x:u,y:c})}return e}function bh(i=90){const e=i*Math.PI/180,r=.5/Math.tan(e),s=1/(1+Math.abs(r)*2),o=r*s;return[{x:.5+o,y:0},{x:1,y:.5},{x:.5-o,y:1},{x:0,y:.5}]}function xv(i=5,e=.4){const t=[];for(let n=0;n<i*2;n++){const s=n*Math.PI/i-Math.PI/2,o=n%2===0?.5:e,a=.5+o*Math.cos(s),l=.5+o*Math.sin(s);t.push({x:a,y:l})}return t}function Qv(i="isosceles",e={}){switch(i){case"equilateral":return _v();case"isosceles":return Sh(e.baseAngle??60);case"right":return wv(e.rightAnglePosition??"bottom-left");case"scalene":return Rv(e.angles??[60,60,60])}}function _v(){return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}function Sh(i){const e=i*Math.PI/180,t=.5/Math.tan(e),r=Math.max(.1,Math.min(2,t));return[{x:.5,y:1-Math.min(1,r)},{x:0,y:1},{x:1,y:1}]}function wv(i){switch(i){case"top":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-left":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}];case"bottom-right":return[{x:.5,y:0},{x:0,y:1},{x:1,y:1}]}}function Rv(i){return Sh(i[0])}function Dv(i={},e=1){const{type:t="rectangle",customPolygon:r,parallelogram:n,triangle:s,rhombus:o,arrow:a,star:l,regularPolygon:A}=i;switch(t){case"rectangle":return Th(0,e);case"parallelogram":return Th((n==null?void 0:n.angle)??30,e);case"triangle":return Qv((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 bh((o==null?void 0:o.angle)??90);case"diamond":return bh(90);case"pentagon":return so(5);case"hexagon":return so(6);case"octagon":return so(8);case"star":return xv((l==null?void 0:l.points)??5,(l==null?void 0:l.innerRadius)??.4);case"arrow":return Bv((a==null?void 0:a.shaftRatio)??.4,(a==null?void 0:a.headRatio)??.4);case"heart":return Sv();case"circle":return Tv();case"ellipse":return bv(e);case"custom-polygon":if(!(r!=null&&r.points)||r.points.length<3)throw new Error("Custom polygon must have at least 3 points");return r.points;default:return so((A==null?void 0:A.sides)??6)}}function Lv(i,e){let t=!1;const r=i.x,n=i.y;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s].x,l=e[s].y,A=e[o].x,u=e[o].y;l>n!=u>n&&r<(A-a)*(n-l)/(u-l)+a&&(t=!t)}return t}function kv(i,e){let t=1,r=0;const n=200;for(let s=0;s<=n;s++){const o=s/n;Lv({x:o,y:i},e)&&(t=Math.min(t,o),r=Math.max(r,o))}return r>=t?{left:t,right:r}:null}function Mv(i){const e=Math.min(...i.map(l=>l.y)),t=Math.max(...i.map(l=>l.y));let r={x:0,y:0,width:0,height:0},n=0;const s=200,o=(t-e)/s,a=[];for(let l=0;l<=s;l++){const A=e+l*o;a.push({y:A,span:kv(A,i)})}for(let l=0;l<a.length-1;l++){const A=a[l].y;for(let u=l+1;u<a.length;u++){const h=a[u].y-A;let d=0,f=1,g=!0;const p=Math.min(5,u-l+1);for(let v=0;v<p;v++){const B=l+Math.floor(v/(p-1)*(u-l)),C=a[B].span;if(C){if(d=Math.max(d,C.left),f=Math.min(f,C.right),d>=f){g=!1;break}}else{g=!1;break}}if(g&&f>d){const v=f-d,B=v*h;B>n&&(n=B,r={x:d,y:A,width:v,height:h})}}}return r}function Fv(i,e=1){const t=Dv(i,e);if(t.length<3)return{top:0,right:0,bottom:0,left:0};if(i.type==="rectangle")return{top:0,right:0,bottom:0,left:0};const r=Mv(t),n=r.y,s=r.x,o=1-(r.x+r.width),a=1-(r.y+r.height);return{top:Math.max(0,n),right:Math.max(0,o),bottom:Math.max(0,a),left:Math.max(0,s)}}function Pv(i){return typeof i=="number"?{topLeft:i,topRight:i,bottomRight:i,bottomLeft:i}:{topLeft:(i==null?void 0:i.topLeft)??0,topRight:(i==null?void 0:i.topRight)??0,bottomRight:(i==null?void 0:i.bottomRight)??0,bottomLeft:(i==null?void 0:i.bottomLeft)??0}}function Nv(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:typeof i.top=="number"?i.top*e:i.top,right:typeof i.right=="number"?i.right*e:i.right,bottom:typeof i.bottom=="number"?i.bottom*e:i.bottom,left:typeof i.left=="number"?i.left*e:i.left}}function Ov(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function Uv(i,e){return typeof i=="number"?{top:i*e,right:i*e,bottom:i*e,left:i*e}:typeof i=="string"?{top:i,right:i,bottom:i,left:i}:{top:(typeof i.top=="number"?i.top*e:i.top)??0,right:(typeof i.right=="number"?i.right*e:i.right)??0,bottom:(typeof i.bottom=="number"?i.bottom*e:i.bottom)??0,left:(typeof i.left=="number"?i.left*e:i.left)??0}}function Gv(i){if(i===null||typeof i!="object")return!1;if(Object.getPrototypeOf(i)===null)return!0;let e=i;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(i)===e}function $v(i){return i.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const Hv=ji(()=>Eu.loadYoga());function xh(i,e,{layout:t,scale:r=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:u,maxHeight:c,flex:h,flexGrow:d,flexShrink:f,gap:g,margin:p,padding:v,direction:B="column",align:C="start",alignSelf:y,justify:x="start"}=t??{},w={static:i.POSITION_TYPE_STATIC,relative:i.POSITION_TYPE_RELATIVE,absolute:i.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(w[n]),typeof s<"u"){const{top:D,right:X,bottom:j,left:oe}=Nv(s,r);typeof D<"u"&&e.setPosition(i.EDGE_TOP,D),typeof X<"u"&&e.setPosition(i.EDGE_RIGHT,X),typeof j<"u"&&e.setPosition(i.EDGE_BOTTOM,j),typeof oe<"u"&&e.setPosition(i.EDGE_LEFT,oe)}const L={row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(L[B]);const F={start:i.ALIGN_FLEX_START,end:i.ALIGN_FLEX_END,center:i.ALIGN_CENTER,stretch:i.ALIGN_STRETCH};e.setAlignItems(F[C]),y&&e.setAlignSelf(F[y]);const O={start:i.JUSTIFY_FLEX_START,end:i.JUSTIFY_FLEX_END,center:i.JUSTIFY_CENTER,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND,"space-evenly":i.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(O[x]),typeof p<"u"){const{top:D,right:X,bottom:j,left:oe}=Ov(p,r);e.setMargin(i.EDGE_TOP,D),e.setMargin(i.EDGE_RIGHT,X),e.setMargin(i.EDGE_BOTTOM,j),e.setMargin(i.EDGE_LEFT,oe)}if(typeof v<"u"){const{top:D,right:X,bottom:j,left:oe}=Uv(v,r);e.setPadding(i.EDGE_TOP,D),e.setPadding(i.EDGE_RIGHT,X),e.setPadding(i.EDGE_BOTTOM,j),e.setPadding(i.EDGE_LEFT,oe)}typeof d<"u"||typeof f<"u"?(typeof d<"u"&&e.setFlexGrow(d),typeof f<"u"&&e.setFlexShrink(f)):typeof h<"u"&&e.setFlex(h),e.setGap(i.GUTTER_ALL,(g??0)*r),typeof o<"u"&&e.setWidth(typeof o=="number"?o*r:o),typeof a<"u"&&e.setHeight(typeof a=="number"?a*r:a),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*r:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*r:A),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*r:u),typeof c<"u"&&e.setMaxHeight(typeof c=="number"?c*r:c)}async function Qh({id:i,yoga:e,index:t,parent:r,element:n,resolvers:s}){var o,a,l;const{layout:A={},config:u={},options:c={},renderer:h}=n,d=e.Node.create();xh(e,d,{layout:A}),r.insertChild(d,t);let f=null;s&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="caption"||(h==null?void 0:h.type)==="image"||(h==null?void 0:h.type)==="video")&&((h==null?void 0:h.type)==="caption"?f=await((o=s.text)==null?void 0:o.call(s,{id:i,config:u,options:c}))??null:f=await((a=s[h.type])==null?void 0:a.call(s,{id:i,config:u,options:c}))??null);const g=[];for await(const[p,v]of((l=n.children)==null?void 0:l.entries())??[])g.push(await Qh({id:i,yoga:e,index:p,parent:d,element:v,resolvers:s}));return{node:d,radius:Pv(A.radius),element:n,renderer:h,config:u,options:c,dependencies:f,childNodes:g}}function _h(i,e,t=0,r=0){const{top:n,left:s}=i.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),u=t+a,c=r+o,h=e.childNodes.map(d=>_h(i,d,u,c));return{...e,x:s+u,y:n+c,width:l,height:A,childNodes:h}}async function gl({yoga:i,root:e,tree:t,measureCanvas:r}){for await(const{node:n,options:s,dependencies:o,renderer:a,childNodes:l}of t){if(a){const{width:A,height:u}=a;if(A&&r){e.calculateLayout();const c=await A({node:n,options:s,dependencies:o,measureCanvas:r});c&&n.setWidth(c)}if(u&&r){e.calculateLayout();const c=await u({node:n,options:s,dependencies:o,measureCanvas:r});c&&n.setHeight(c)}if(await gl({yoga:i,root:e,tree:l,measureCanvas:r}),s!=null&&s.shape){const c=n.getComputedWidth(),h=n.getComputedHeight(),d=Fv(s.shape,c/h);n.setPadding(i.EDGE_TOP,d.top*c),n.setPadding(i.EDGE_RIGHT,d.right*c),n.setPadding(i.EDGE_BOTTOM,d.bottom*h),n.setPadding(i.EDGE_LEFT,d.left*c)}}e.calculateLayout(),await gl({yoga:i,root:e,tree:l,measureCanvas:r})}}async function wh({id:i,root:e,resolvers:t,measureCanvas:r}){const n=await Hv(),s=n.Node.create();xh(n,s,{layout:e.layout});const o=await Qh({id:i,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await gl({yoga:n,root:s,tree:[o],measureCanvas:r});const{top:a,left:l,width:A,height:u}=s.getComputedLayout(),c={root:{x:l,y:a,width:A,height:u},node:_h(s,o)};return s.freeRecursive(),c}const Yv={type:"audio"},On=/(?<value>\d+\.?\d*)(?=px)/;function pl({words:i,spaceMetrics:e,strokeWidth:t=0}){return i.reduce((r,n,s)=>{const o=n.metrics.width+t,a=s<i.length-1?e.width:0;return r+o+a},0)}Rs(({context:i,font:e,fontSizes:t,words:r,maxW:n=1/0,strokeWidth:s=0,letterSpacing:o=0})=>{try{i.save(),i.letterSpacing=`${o}px`,i.font=e.replace(On,t[0].toString());const a=i.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");if(r.length<=0)return[];const l=i.measureText(r[0].text);return r.slice(1).reduce((A,u)=>{const c=A[A.length-1],h=i.measureText(u.text),d={...u,metrics:h},f=[...c.words,d],g=pl({strokeWidth:s,words:f,spaceMetrics:c.spaceMetrics});if(g>n){const p=t[A.length%t.length];i.font=e.replace(On,p.toString());const v=i.measureText(" "),B=i.measureText(u.text),C=[{...u,metrics:B}],y=i.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");A=[...A,{allMetrics:y,spaceMetrics:v,lineWidth:pl({strokeWidth:s,spaceMetrics:v,words:C}),font:i.font,words:C,lineHeight:y.actualBoundingBoxAscent+y.actualBoundingBoxDescent+s}]}else A[A.length-1]={...c,lineWidth:g,words:f};return A},[{allMetrics:a,lineWidth:pl({strokeWidth:s,words:[{...r[0],metrics:l}],spaceMetrics:i.measureText(" ")}),lineHeight:a.actualBoundingBoxAscent+a.actualBoundingBoxDescent+s,font:i.font,words:[{...r[0],metrics:l}],spaceMetrics:i.measureText(" ")}])}finally{i.restore()}},{cacheKey:([{font:i,fontSizes:e,words:t,maxW:r,strokeWidth:n,letterSpacing:s}])=>`${i}_${JSON.stringify(e)}_${JSON.stringify(t)}_${r}_${n}_${s}`});function Vv(i){return i.slice(0,1).toUpperCase()+i.slice(1)}const Rh=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function Kv({text:i,font:e}){let t=e;return Rh.forEach(({family:r,regex:n})=>{n.exec(i)&&(t+=`, ${r}`)}),t}const Wv="caption";Object.keys(Ch).map(i=>({label:Vv(i),value:i,data:i}));const qv={type:Wv},Jv={type:"image"};function Dh({context:i,word:e,maxW:t=1/0}){const r=[],n=i.measureText(e);if(Math.floor(n.width)<=t)return[{text:e,metrics:n}];for(let s=0;s<e.length;s++){const o=r[r.length-1],a=((o==null?void 0:o.text)??"")+e[s],l=i.measureText(a);l.width<t?r[o?r.length-1:0]={text:a,metrics:l}:r.push({text:e[s],metrics:i.measureText(e[s])})}return r}const jv=Rs(({font:i,context:e,fontSizes:t,text:r,maxW:n=1/0,letterSpacing:s=0})=>{try{return e.save(),e.letterSpacing=`${s}px`,e.font=i.replace(On,t[0].toString()),r.split(`
|
2476
|
-
`).flatMap(a=>{const l=a.split(" ").filter(Boolean);return l.length?l.slice(1).reduce((A,u,c)=>{const d=`${A[A.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)A=[...A,...Dh({context:e,word:u,maxW:n})];else{const g=t[c%t.length];e.font=i.replace(On,g.toString()),A[A.length-1]={text:d,metrics:f}}return A},Dh({context:e,word:l[0],maxW:n})):{text:"",metrics:e.measureText("")}})}finally{e.restore()}},{cacheKey:([{font:i,fontSizes:e,text:t,maxW:r,letterSpacing:n}])=>`${i}_${JSON.stringify(e)}_${t}_${r}_${n}`});Rs(({font:i,text:e,scale:t,context:r,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:l=0})=>{var A,u;let c=0;if(a){c=(o??0)*t;let d=0;for(;a*t>c+1;){c+=1;const f=jv({font:i,context:r,fontSizes:[c],text:e,maxW:n,letterSpacing:l});if(d=f.reduce((g,p)=>(p.metrics.width>g&&(g=p.metrics.width),g),0),d>n||f.length*c>s){c-=1;break}}}else c=parseFloat(((u=(A=i.match(On))==null?void 0:A.groups)==null?void 0:u.value)??"0")*t;return c},{cacheKey:([{font:i,text:e,scale:t,maxW:r,maxH:n,minSize:s,maxSize:o,letterSpacing:a}])=>`${i}_${e}_${s}_${o}_${t}_${r}_${n}_${a}`});const Xv={type:"text"},zv={type:"video"};function Lh(){return document.createElement("canvas")}function Zv(i,e){return Object.keys(i).reduce((t,r)=>(e.includes(r)||(t[r]=i[r]),t),{})}function Jt(i){let e=0;for(const t of i)Array.isArray(t)?e+=Jt(t):e+=t;return e}function oo(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const l=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,A=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,c=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(l?A/2:A,t,c?u/2:u)*-1}return t})}function kh(i){var e;return{...i,children:((e=i.children)==null?void 0:e.map(t=>{if(!t.renderer)return kh(t)}).filter(Boolean))??[]}}function Mh(i){const e={box:0,shape:0,image:0,video:0,text:0,audio:0,gradient:0,caption:0};i.renderer&&(e[i.renderer.type]+=1);for(const t of i.children??[]){const{box:r,shape:n,image:s,video:o,text:a,audio:l,gradient:A,caption:u}=Mh(t);e.box+=r,e.shape+=n,e.image+=s,e.video+=o,e.text+=a,e.audio+=l,e.gradient+=A,e.caption+=u}return e}function ey(i){return i.video>0?zv.type:i.image>0?Jv.type:i.audio>0?Yv.type:i.caption>0?qv.type:Xv.type}function Fh({node:i,duration:e,parentAnimations:t}){const r=[],n={...t,...i.element.animations};if(i.renderer){const s=kh({...i.element,layout:{...i.element.layout?Zv(i.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=Mh(s);r.push({type:ey(o),id:Cv(),x:i.x,y:i.y,width:i.width,height:i.height,duration:e,root:{element:s}})}for(const s of i.childNodes)r.push(...Fh({node:s,duration:e,parentAnimations:n}));return r}Um.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${$v(i)}"`:Gv(i)||Array.isArray(i)?JSON.stringify(i):i);const ty="3";async function iy({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await wh({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function ry({track:i}){const e=oo(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const l=Jt(e.slice(0,a));return s.push(iy({scene:o,start:l})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const l=Jt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:l,config:o,duration:o.duration}),s},[]),n=i.map(({id:s})=>t.find(({id:o})=>o===s)??r.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:r,mergedScenes:n,config:i,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Ph({node:i,canvases:e,sceneTime:t,parentOpacity:r=1,parentTransform:n,debug:s=!1}){var o,a,l,A,u,c,h,d,f,g,p,v,B,C,y,x,w,L,F,O;const D=e.sceneCanvas.getContext("2d");if(D){D.save(),D.setTransform(n);const X=Ev({sceneTime:t,animations:i.element.animations});let{opacity:j,translation:oe,scale:ae,clip:k,dimensions:U,rotation:K}=X;typeof j>"u"&&(j=((a=(o=i.element.layout)==null?void 0:o.transform)==null?void 0:a.opacity)??1),typeof oe>"u"&&(oe={x:((u=(A=(l=i.element.layout)==null?void 0:l.transform)==null?void 0:A.translate)==null?void 0:u.x)??0,y:((d=(h=(c=i.element.layout)==null?void 0:c.transform)==null?void 0:h.translate)==null?void 0:d.y)??0}),typeof ae>"u"&&(ae=((g=(f=i.element.layout)==null?void 0:f.transform)==null?void 0:g.scale)??1),typeof k>"u"&&(k=null),typeof U>"u"&&(U={widthRatio:((B=(v=(p=i.element.layout)==null?void 0:p.transform)==null?void 0:v.dimension)==null?void 0:B.widthRatio)??1,heightRatio:((x=(y=(C=i.element.layout)==null?void 0:C.transform)==null?void 0:y.dimension)==null?void 0:x.heightRatio)??1}),typeof K>"u"&&(K=((L=(w=i.element.layout)==null?void 0:w.transform)==null?void 0:L.rotation)??0);const R=i.width*U.widthRatio,_=i.height*U.heightRatio;if(D.globalAlpha=j*r,(oe.x||oe.y)&&D.translate(oe.x,oe.y),(ae!==1||K!==0)&&(D.translate(i.x+R/2,i.y+_/2),D.scale(ae,ae),D.rotate(K*Math.PI/180),D.translate(-(i.x+R/2),-(i.y+_/2))),k){D.beginPath();const M={x:i.x+k.x*R,y:i.y+k.y*_,width:k.width*R,height:k.height*_};D.rect(M.x,M.y,M.width,M.height),D.clip()}if(s){const M=D.globalAlpha;D.globalAlpha=1,D.strokeStyle="red",D.strokeRect(i.x,i.y,R,_),D.globalAlpha=M}await((O=(F=i.renderer)==null?void 0:F.render)==null?void 0:O.call(F,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:R,dh:_,radius:i.radius,options:i.options,dependencies:i.dependencies}));for await(const M of i.childNodes)await Ph({debug:s,node:M,canvases:e,sceneTime:t,parentOpacity:D.globalAlpha,parentTransform:D.getTransform()});D.restore()}}async function ny({layout:i,canvases:e,sceneTime:t,debug:r=!1}){const{node:n}=i;await Ph({debug:r,node:n,canvases:e,sceneTime:t})}async function ao({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=Lh}){var a,l;const{id:A,x:u,y:c,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),B=o(),C=o(),y=o(),x=await wh({id:A,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof c=="number"?{position:"absolute",inset:{top:c,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((l=f.element.layout)==null?void 0:l.height)}}},resolvers:r,measureCanvas:y}),w=async L=>{const F=Math.max(0,L-t);p.width=p.height=0,p.width=n,p.height=s,await ny({debug:i,layout:x,sceneTime:F,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:B,posterCanvas:C}})};return{id:A,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:w,config:e,childScenes:Fh({node:x.node,duration:g})}}async function sy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=oo(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="caption"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=Jt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=Jt(o.slice(0,d))-f;return c.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function oy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=oo(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="video"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=Jt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=Jt(o.slice(0,d))-f;return c.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(0,...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function ay({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=oo(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="text"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=Jt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=Jt(o.slice(0,d))-f;return c.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"text",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}function ly(i){return i.some(({type:e})=>e==="text")}function Ay(i){return i.some(({type:e})=>e==="caption")}function cy(i){return i.some(({type:e})=>e==="audio")}function uy(i){return i.some(({type:e})=>e==="video"||e==="image")}function hy(i){return i.type==="audio"}const dy=(((yh=vh)==null?void 0:yh.default)??vh).reduce((i,e)=>(i[e.name]=e,i),{});function fy(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function gy({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:l=!0}){var A,u,c;const h=fy(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=(((A=Zs)==null?void 0:A.default)??Zs)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=Zs)==null?void 0:u.default)??Zs)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[i]||(h.transitions[i]=(((c=Ih)==null?void 0:c.default)??Ih)(o,dy[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!l)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 py(i){for(const[e,t]of i.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(r=>{r.dispose()}),i.delete(e)}function my({name:i,to:e,from:t,progress:r,canvas:n,contextResources:s}){const o=n.getContext("webgl",{alpha:!0,depth:!1,antialias:!1,preserveDrawingBuffer:!1});o&&(o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),gy({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Nh({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=Lh,drawTransition:o=my}){const a=new Map,l=await Promise.all(e.tracks.map(async c=>{if(uy(c))return{...await oy({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(ly(c))return{...await ay({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Ay(c))return{...await sy({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(cy(c))return{...await ry({track:c}),config:c};throw new Error("Unknown track type")}));return{draw:async({canvas:c,currentTime:h})=>{const d=c.getContext("2d");if(d){d.globalAlpha=1,d.globalCompositeOperation="source-over",d.clearRect(0,0,c.width,c.height),d.save(),d.fillStyle="black",d.fillRect(0,0,c.width,c.height),d.restore();for await(const f of l){if(hy(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=c.width,v.height=c.height;const B=v.getContext("2d"),C=g.filter(({start:x,duration:w})=>h>=x&&h<x+w);if(!B||C.length<=0)continue;const y=p.find(({start:x,duration:w})=>h>=x&&h<x+w);for await(const{sceneCanvas:x,draw:w}of C)await(w==null?void 0:w(h)),(!y||y&&(!y.to||!y.from))&&B.drawImage(x,0,0,x.width,x.height);if(y&&y.to&&y.from&&y.duration>0){const{name:x,to:w,from:L,duration:F,transitionCanvas:O}=y;O.width=O.height=0,O.width=v.width,O.height=v.height;const D=Math.min(1,Math.max(0,(h-w.start)/F));await o({name:x,progress:D,contextResources:a,to:w.sceneCanvas,from:L.sceneCanvas,canvas:O}),B.globalCompositeOperation="lighter",B.drawImage(O,0,0,O.width,O.height)}d.drawImage(v,0,0,v.width,v.height)}}},cleanup:()=>{py(a)},tracks:l,aspectRatio:e.aspectRatio,duration:Math.max(...l.map(({duration:c})=>c))}}const Ey={version:"5.0.1"};function Iy(i){const{publicApiUrl:e}=ws(i),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function vy(i){var s,o,a,l,A,u,c,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Ki()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),r=(u=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:u.call(A,"vouch-uid-tab");const n=Ki();return e||(e=Iy(i),(h=(c=window.localStorage)==null?void 0:c.setItem)==null||h.call(c,"vouch-uid-visitor",e)),t||(t=Ki(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),r||(r=Ki(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",r)),{client:t,tab:r,request:n,visitor:e}}function yy(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function Cy(i="embedded_player"){var n,s;const[e,t]=((s=(n=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:n.split)==null?void 0:s.call(n,"/"))??[],r={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());r[l]=a}}),{source:i,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:Ey.version,templateVersion:ty,...r}}const Oh=1;class By{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=yy(r,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...r,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=ws(this.host.env),{client:r,tab:n,request:s,visitor:o}=vy(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":r,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":Cy(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:r}=this._currentlyPlayingVideo;this._streamLatestTime[r]>this._streamStartTime[r]+Oh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:r}})=>{this._answersViewed[r]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[r]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:r,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:r,node:n},this._streamLatestTime[r]=n.currentTime,this._streamStartTime[r]||(this._streamStartTime[r]=n.currentTime,this._streamLatestTime[r]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:r}})=>{this._streamLatestTime[r]>this._streamStartTime[r]+Oh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,r,n;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,r,n;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ml={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ji<"u"&&Ji,r=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof Ji<"u"&&Ji||{},l={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function A(k){return k&&DataView.prototype.isPrototypeOf(k)}if(l.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=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 K=k.shift();return{done:K===void 0,value:K}}};return l.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,K){this.append(K,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 K=this.map[k];this.map[k]=K?K+", "+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 K in this.map)this.map.hasOwnProperty(K)&&k.call(U,this.map[K],K,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,K){k.push(K)}),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,K){k.push([K,U])}),f(k)},l.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 v(k){return new Promise(function(U,K){k.onload=function(){U(k.result)},k.onerror=function(){K(k.error)}})}function B(k){var U=new FileReader,K=v(U);return U.readAsArrayBuffer(k),K}function C(k){var U=new FileReader,K=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(k.type),_=R?R[1]:"utf-8";return U.readAsText(k,_),K}function y(k){for(var U=new Uint8Array(k),K=new Array(U.length),R=0;R<U.length;R++)K[R]=String.fromCharCode(U[R]);return K.join("")}function x(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:l.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:l.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():l.arrayBuffer&&l.blob&&A(k)?(this._bodyArrayBuffer=x(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||c(k))?this._bodyArrayBuffer=x(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):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.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(l.blob)return this.blob().then(B);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var k=p(this);if(k)return k;if(this._bodyBlob)return C(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)},l.formData&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(k){var U=k.toUpperCase();return L.indexOf(U)>-1?U:k}function O(k,U){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var K=U.body;if(k instanceof O){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,!K&&k._bodyInit!=null&&(K=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")&&K)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(K),(this.method==="GET"||this.method==="HEAD")&&(U.cache==="no-store"||U.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var _=/\?/;this.url+=(_.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function D(k){var U=new FormData;return k.trim().split("&").forEach(function(K){if(K){var R=K.split("="),_=R.shift().replace(/\+/g," "),M=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(_),decodeURIComponent(M))}}),U}function X(k){var U=new g,K=k.replace(/\r?\n[\t ]+/g," ");return K.split("\r").map(function(R){return R.indexOf(`
|
2476
|
+
`).flatMap(a=>{const l=a.split(" ").filter(Boolean);return l.length?l.slice(1).reduce((A,u,c)=>{const d=`${A[A.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)A=[...A,...Dh({context:e,word:u,maxW:n})];else{const g=t[c%t.length];e.font=i.replace(On,g.toString()),A[A.length-1]={text:d,metrics:f}}return A},Dh({context:e,word:l[0],maxW:n})):{text:"",metrics:e.measureText("")}})}finally{e.restore()}},{cacheKey:([{font:i,fontSizes:e,text:t,maxW:r,letterSpacing:n}])=>`${i}_${JSON.stringify(e)}_${t}_${r}_${n}`});Rs(({font:i,text:e,scale:t,context:r,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:l=0})=>{var A,u;let c=0;if(a){c=(o??0)*t;let d=0;for(;a*t>c+1;){c+=1;const f=jv({font:i,context:r,fontSizes:[c],text:e,maxW:n,letterSpacing:l});if(d=f.reduce((g,p)=>(p.metrics.width>g&&(g=p.metrics.width),g),0),d>n||f.length*c>s){c-=1;break}}}else c=parseFloat(((u=(A=i.match(On))==null?void 0:A.groups)==null?void 0:u.value)??"0")*t;return c},{cacheKey:([{font:i,text:e,scale:t,maxW:r,maxH:n,minSize:s,maxSize:o,letterSpacing:a}])=>`${i}_${e}_${s}_${o}_${t}_${r}_${n}_${a}`});const Xv={type:"text"},zv={type:"video"};function Lh(){return document.createElement("canvas")}function Zv(i,e){return Object.keys(i).reduce((t,r)=>(e.includes(r)||(t[r]=i[r]),t),{})}function Jt(i){let e=0;for(const t of i)Array.isArray(t)?e+=Jt(t):e+=t;return e}function oo(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const l=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,A=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,c=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(l?A/2:A,t,c?u/2:u)*-1}return t})}function kh(i){var e;return{...i,children:((e=i.children)==null?void 0:e.map(t=>{if(!t.renderer)return kh(t)}).filter(Boolean))??[]}}function Mh(i){const e={box:0,shape:0,image:0,video:0,text:0,audio:0,gradient:0,caption:0};i.renderer&&(e[i.renderer.type]+=1);for(const t of i.children??[]){const{box:r,shape:n,image:s,video:o,text:a,audio:l,gradient:A,caption:u}=Mh(t);e.box+=r,e.shape+=n,e.image+=s,e.video+=o,e.text+=a,e.audio+=l,e.gradient+=A,e.caption+=u}return e}function ey(i){return i.video>0?zv.type:i.image>0?Jv.type:i.audio>0?Yv.type:i.caption>0?qv.type:Xv.type}function Fh({node:i,duration:e,parentAnimations:t}){const r=[],n={...t,...i.element.animations};if(i.renderer){const s=kh({...i.element,layout:{...i.element.layout?Zv(i.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=Mh(s);r.push({type:ey(o),id:Cv(),x:i.x,y:i.y,width:i.width,height:i.height,duration:e,root:{element:s}})}for(const s of i.childNodes)r.push(...Fh({node:s,duration:e,parentAnimations:n}));return r}Um.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${$v(i)}"`:Gv(i)||Array.isArray(i)?JSON.stringify(i):i);const ty="3";async function iy({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await wh({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function ry({track:i}){const e=oo(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const l=Jt(e.slice(0,a));return s.push(iy({scene:o,start:l})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const l=Jt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:l,config:o,duration:o.duration}),s},[]),n=i.map(({id:s})=>t.find(({id:o})=>o===s)??r.find(({id:o})=>o===s)).filter(Boolean);return{type:"audio",scenes:t,gapScenes:r,mergedScenes:n,config:i,duration:Math.max(...n.map(({start:s,duration:o})=>s+o))}}async function Ph({node:i,canvases:e,sceneTime:t,parentOpacity:r=1,parentTransform:n,debug:s=!1}){var o,a,l,A,u,c,h,d,f,g,p,v,B,C,y,x,w,L,F,O;const D=e.sceneCanvas.getContext("2d");if(D){D.save(),D.setTransform(n);const X=Ev({sceneTime:t,animations:i.element.animations});let{opacity:j,translation:oe,scale:ae,clip:k,dimensions:U,rotation:K}=X;typeof j>"u"&&(j=((a=(o=i.element.layout)==null?void 0:o.transform)==null?void 0:a.opacity)??1),typeof oe>"u"&&(oe={x:((u=(A=(l=i.element.layout)==null?void 0:l.transform)==null?void 0:A.translate)==null?void 0:u.x)??0,y:((d=(h=(c=i.element.layout)==null?void 0:c.transform)==null?void 0:h.translate)==null?void 0:d.y)??0}),typeof ae>"u"&&(ae=((g=(f=i.element.layout)==null?void 0:f.transform)==null?void 0:g.scale)??1),typeof k>"u"&&(k=null),typeof U>"u"&&(U={widthRatio:((B=(v=(p=i.element.layout)==null?void 0:p.transform)==null?void 0:v.dimension)==null?void 0:B.widthRatio)??1,heightRatio:((x=(y=(C=i.element.layout)==null?void 0:C.transform)==null?void 0:y.dimension)==null?void 0:x.heightRatio)??1}),typeof K>"u"&&(K=((L=(w=i.element.layout)==null?void 0:w.transform)==null?void 0:L.rotation)??0);const R=i.width*U.widthRatio,_=i.height*U.heightRatio;if(D.globalAlpha=j*r,(oe.x||oe.y)&&D.translate(oe.x,oe.y),(ae!==1||K!==0)&&(D.translate(i.x+R/2,i.y+_/2),D.scale(ae,ae),D.rotate(K*Math.PI/180),D.translate(-(i.x+R/2),-(i.y+_/2))),k){D.beginPath();const M={x:i.x+k.x*R,y:i.y+k.y*_,width:k.width*R,height:k.height*_};D.rect(M.x,M.y,M.width,M.height),D.clip()}if(s){const M=D.globalAlpha;D.globalAlpha=1,D.strokeStyle="red",D.strokeRect(i.x,i.y,R,_),D.globalAlpha=M}await((O=(F=i.renderer)==null?void 0:F.render)==null?void 0:O.call(F,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:R,dh:_,radius:i.radius,options:i.options,dependencies:i.dependencies}));for await(const M of i.childNodes)await Ph({debug:s,node:M,canvases:e,sceneTime:t,parentOpacity:D.globalAlpha,parentTransform:D.getTransform()});D.restore()}}async function ny({layout:i,canvases:e,sceneTime:t,debug:r=!1}){const{node:n}=i;await Ph({debug:r,node:n,canvases:e,sceneTime:t})}async function ao({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=Lh}){var a,l;const{id:A,x:u,y:c,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),B=o(),C=o(),y=o(),x=await wh({id:A,root:{...f,layout:{...f.layout,width:n,height:s},element:{...f.element,layout:{...f.element.layout,...typeof u=="number"&&typeof c=="number"?{position:"absolute",inset:{top:c,left:u}}:{},width:h??((a=f.element.layout)==null?void 0:a.width),height:d??((l=f.element.layout)==null?void 0:l.height)}}},resolvers:r,measureCanvas:y}),w=async L=>{const F=Math.max(0,L-t);p.width=p.height=0,p.width=n,p.height=s,await ny({debug:i,layout:x,sceneTime:F,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:B,posterCanvas:C}})};return{id:A,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:w,config:e,childScenes:Fh({node:x.node,duration:g})}}async function sy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=oo(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="caption"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=Jt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=Jt(o.slice(0,d))-f;return c.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function oy({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=oo(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="video"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=Jt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=Jt(o.slice(0,d))-f;return c.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(0,...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function ay({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=oo(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="text"&&c.push(ao({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),l=e.reduce((c,h,d)=>{if(h.type!=="gap")return c;const f=Jt(o.slice(0,d));return c.push({type:h.type,id:h.id,start:f,config:h,duration:h.duration}),c},[]),A=e.reduce((c,h,d)=>{if(h.type!=="transition")return c;const f=h.duration,g=Jt(o.slice(0,d))-f;return c.push({type:h.type,id:h.id,name:h.name,start:g,duration:f,config:h,transitionCanvas:s(),to:a.find(({id:p})=>{var v;return p===((v=e[d+1])==null?void 0:v.id)}),from:a.find(({id:p})=>{var v;return p===((v=e[d-1])==null?void 0:v.id)})}),c},[]),u=e.map(({id:c})=>a.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)??A.find(({id:h})=>h===c)).filter(Boolean);return{type:"text",scenes:a,gapScenes:l,transitions:A,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}function ly(i){return i.some(({type:e})=>e==="text")}function Ay(i){return i.some(({type:e})=>e==="caption")}function cy(i){return i.some(({type:e})=>e==="audio")}function uy(i){return i.some(({type:e})=>e==="video"||e==="image")}function hy(i){return i.type==="audio"}const dy=(((yh=vh)==null?void 0:yh.default)??vh).reduce((i,e)=>(i[e.name]=e,i),{});function fy(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function gy({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:l=!0}){var A,u,c;const h=fy(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=(((A=Zs)==null?void 0:A.default)??Zs)(o,t),h.fromTexture.minFilter=o.LINEAR,h.fromTexture.magFilter=o.LINEAR),h.toTexture?h.toTexture.setPixels(e):(h.toTexture=(((u=Zs)==null?void 0:u.default)??Zs)(o,e),h.toTexture.minFilter=o.LINEAR,h.toTexture.magFilter=o.LINEAR),h.transitions[i]||(h.transitions[i]=(((c=Ih)==null?void 0:c.default)??Ih)(o,dy[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!l)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 py(i){for(const[e,t]of i.entries())t.buffer&&e.deleteBuffer(t.buffer),t.fromTexture&&t.fromTexture.dispose(),t.toTexture&&t.toTexture.dispose(),Object.values(t.transitions).forEach(r=>{r.dispose()}),i.delete(e)}function my({name:i,to:e,from:t,progress:r,canvas:n,contextResources:s}){const o=n.getContext("webgl",{alpha:!0,depth:!1,antialias:!1,preserveDrawingBuffer:!1});o&&(o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),gy({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Nh({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=Lh,drawTransition:o=my}){const a=new Map,l=await Promise.all(e.tracks.map(async c=>{if(uy(c))return{...await oy({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(ly(c))return{...await ay({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Ay(c))return{...await sy({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(cy(c))return{...await ry({track:c}),config:c};throw new Error("Unknown track type")}));return{draw:async({canvas:c,currentTime:h})=>{const d=c.getContext("2d");if(d){d.globalAlpha=1,d.globalCompositeOperation="source-over",d.clearRect(0,0,c.width,c.height),d.save(),d.fillStyle="black",d.fillRect(0,0,c.width,c.height),d.restore();for await(const f of l){if(hy(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=c.width,v.height=c.height;const B=v.getContext("2d"),C=g.filter(({start:x,duration:w})=>h>=x&&h<x+w);if(!B||C.length<=0)continue;const y=p.find(({start:x,duration:w})=>h>=x&&h<x+w);for await(const{sceneCanvas:x,draw:w}of C)await(w==null?void 0:w(h)),(!y||y&&(!y.to||!y.from))&&B.drawImage(x,0,0,x.width,x.height);if(y&&y.to&&y.from&&y.duration>0){const{name:x,to:w,from:L,duration:F,transitionCanvas:O}=y;O.width=O.height=0,O.width=v.width,O.height=v.height;const D=Math.min(1,Math.max(0,(h-w.start)/F));await o({name:x,progress:D,contextResources:a,to:w.sceneCanvas,from:L.sceneCanvas,canvas:O}),B.globalCompositeOperation="lighter",B.drawImage(O,0,0,O.width,O.height)}d.drawImage(v,0,0,v.width,v.height)}}},cleanup:()=>{py(a)},tracks:l,aspectRatio:e.aspectRatio,duration:Math.max(...l.map(({duration:c})=>c))}}const Ey={version:"5.0.2"};function Iy(i){const{publicApiUrl:e}=ws(i),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function vy(i){var s,o,a,l,A,u,c,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Ki()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),r=(u=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:u.call(A,"vouch-uid-tab");const n=Ki();return e||(e=Iy(i),(h=(c=window.localStorage)==null?void 0:c.setItem)==null||h.call(c,"vouch-uid-visitor",e)),t||(t=Ki(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),r||(r=Ki(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",r)),{client:t,tab:r,request:n,visitor:e}}function yy(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function Cy(i="embedded_player"){var n,s;const[e,t]=((s=(n=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:n.split)==null?void 0:s.call(n,"/"))??[],r={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());r[l]=a}}),{source:i,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:Ey.version,templateVersion:ty,...r}}const Oh=1;class By{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=yy(r,this.host.vouch);!n||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...r,vouchId:n,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=ws(this.host.env),{client:r,tab:n,request:s,visitor:o}=vy(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":r,"x-uid-tab":n,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":Cy(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:r}=this._currentlyPlayingVideo;this._streamLatestTime[r]>this._streamStartTime[r]+Oh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:r}})=>{this._answersViewed[r]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[r]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:r,node:n}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:r,node:n},this._streamLatestTime[r]=n.currentTime,this._streamStartTime[r]||(this._streamStartTime[r]=n.currentTime,this._streamLatestTime[r]=n.currentTime))},this._handleVideoPause=({detail:{id:t,key:r}})=>{this._streamLatestTime[r]>this._streamStartTime[r]+Oh&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[r],streamEnd:this._streamLatestTime[r]}),delete this._streamStartTime[r],delete this._streamLatestTime[r]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,r,n;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.addEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,r,n;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:pause",this._handleVideoPause),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ml={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ji<"u"&&Ji,r=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof Ji<"u"&&Ji||{},l={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function A(k){return k&&DataView.prototype.isPrototypeOf(k)}if(l.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=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 K=k.shift();return{done:K===void 0,value:K}}};return l.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,K){this.append(K,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 K=this.map[k];this.map[k]=K?K+", "+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 K in this.map)this.map.hasOwnProperty(K)&&k.call(U,this.map[K],K,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,K){k.push(K)}),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,K){k.push([K,U])}),f(k)},l.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 v(k){return new Promise(function(U,K){k.onload=function(){U(k.result)},k.onerror=function(){K(k.error)}})}function B(k){var U=new FileReader,K=v(U);return U.readAsArrayBuffer(k),K}function C(k){var U=new FileReader,K=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(k.type),_=R?R[1]:"utf-8";return U.readAsText(k,_),K}function y(k){for(var U=new Uint8Array(k),K=new Array(U.length),R=0;R<U.length;R++)K[R]=String.fromCharCode(U[R]);return K.join("")}function x(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:l.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:l.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():l.arrayBuffer&&l.blob&&A(k)?(this._bodyArrayBuffer=x(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||c(k))?this._bodyArrayBuffer=x(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):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.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(l.blob)return this.blob().then(B);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var k=p(this);if(k)return k;if(this._bodyBlob)return C(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)},l.formData&&(this.formData=function(){return this.text().then(D)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(k){var U=k.toUpperCase();return L.indexOf(U)>-1?U:k}function O(k,U){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var K=U.body;if(k instanceof O){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,!K&&k._bodyInit!=null&&(K=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")&&K)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(K),(this.method==="GET"||this.method==="HEAD")&&(U.cache==="no-store"||U.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var _=/\?/;this.url+=(_.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function D(k){var U=new FormData;return k.trim().split("&").forEach(function(K){if(K){var R=K.split("="),_=R.shift().replace(/\+/g," "),M=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(_),decodeURIComponent(M))}}),U}function X(k){var U=new g,K=k.replace(/\r?\n[\t ]+/g," ");return K.split("\r").map(function(R){return R.indexOf(`
|
2477
2477
|
`)===0?R.substr(1,R.length):R}).forEach(function(R){var _=R.split(":"),M=_.shift().trim();if(M){var W=_.join(":").trim();try{U.append(M,W)}catch(Y){console.warn("Response "+Y.message)}}}),U}w.call(O.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)}w.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 oe=[301,302,303,307,308];j.redirect=function(k,U){if(oe.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,K){this.message=U,this.name=K;var R=Error(U);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function ae(k,U){return new Promise(function(K,R){var _=new O(k,U);if(_.signal&&_.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var M=new XMLHttpRequest;function W(){M.abort()}M.onload=function(){var re={statusText:M.statusText,headers:X(M.getAllResponseHeaders()||"")};_.url.indexOf("file://")===0&&(M.status<200||M.status>599)?re.status=200:re.status=M.status,re.url="responseURL"in M?M.responseURL:re.headers.get("X-Request-URL");var he="response"in M?M.response:M.responseText;setTimeout(function(){K(new j(he,re))},0)},M.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},M.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request timed out"))},0)},M.onabort=function(){setTimeout(function(){R(new o.DOMException("Aborted","AbortError"))},0)};function Y(re){try{return re===""&&a.location.href?a.location.href:re}catch{return re}}if(M.open(_.method,Y(_.url),!0),_.credentials==="include"?M.withCredentials=!0:_.credentials==="omit"&&(M.withCredentials=!1),"responseType"in M&&(l.blob?M.responseType="blob":l.arrayBuffer&&(M.responseType="arraybuffer")),U&&typeof U.headers=="object"&&!(U.headers instanceof g||a.Headers&&U.headers instanceof a.Headers)){var ie=[];Object.getOwnPropertyNames(U.headers).forEach(function(re){ie.push(h(re)),M.setRequestHeader(re,d(U.headers[re]))}),_.headers.forEach(function(re,he){ie.indexOf(he)===-1&&M.setRequestHeader(he,re)})}else _.headers.forEach(function(re,he){M.setRequestHeader(he,re)});_.signal&&(_.signal.addEventListener("abort",W),M.onreadystatechange=function(){M.readyState===4&&_.signal.removeEventListener("abort",W)}),M.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return ae.polyfill=!0,a.fetch||(a.fetch=ae,a.Headers=g,a.Request=O,a.Response=j),o.Headers=g,o.Request=O,o.Response=j,o.fetch=ae,o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=t.fetch?t:r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(ml,ml.exports);var Ty=ml.exports;const Uh=Pa(Ty);async function by(i){var e;try{if((e=await Uh(i,{method:"HEAD"}))!=null&&e.ok)return i}catch{return}}async function El({sources:i}){let e=null;const t=i==null?void 0:i.filter(Boolean),r=t==null?void 0:t.find(s=>s.startsWith("blob:")),n=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(r||n)return r??n;if(t.length>0){const s=t.map(o=>by(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Sy(i){try{return(await Uh(i)).text()}catch{return null}}async function xy(i){return i=i.trim(),i.startsWith("http")||i.startsWith("blob:")?Sy(i):i}const Qy=ji(async({original:i,translation:e,originalLanguage:t="",translationLanguage:r=""},{language:n})=>{var s,o;const a={[(s=r==null?void 0:r.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:i},l=(n&&a[n])??i;return l?xy(l):null},{cacheKey:([i,{language:e}])=>JSON.stringify({...i,language:e})});function _y(i){var e;return((e=i==null?void 0:i.items)==null?void 0:e.map(t=>{var r;return{text:(r=t.alternatives[0])==null?void 0:r.content,start:t.start_time,end:t.end_time}}))??[]}const wy=ji(async i=>{var e,t,r,n,s,o,a,l,A,u,c;const[h,d,f]=await Promise.all([El({sources:[(t=(e=i==null?void 0:i.answer)==null?void 0:e.media)==null?void 0:t.video,(n=(r=i==null?void 0:i.answer)==null?void 0:r.media)==null?void 0:n.input]}),El({sources:[(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),El({sources:[((l=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((c=(u=(A=i==null?void 0:i.answer)==null?void 0:A.media)==null?void 0:u.videos)==null?void 0:c.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([i])=>{var e,t,r,n,s,o,a,l,A,u,c;return JSON.stringify({video:(t=(e=i==null?void 0:i.answer)==null?void 0:e.media)==null?void 0:t.video,input:(n=(r=i==null?void 0:i.answer)==null?void 0:r.media)==null?void 0:n.input,playlist:(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((c=(u=(A=i==null?void 0:i.answer)==null?void 0:A.media)==null?void 0:u.videos)==null?void 0:c.xs)})}});function Gh(i){var e,t,r,n,s,o,a,l,A,u,c,h;const d=((t=(e=i==null?void 0:i.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(n=(r=i==null?void 0:i.answer)==null?void 0:r.contact)==null?void 0:n.name)==null?void 0:s.trim())??"",f=((l=(a=(o=i==null?void 0:i.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(c=(u=(A=i==null?void 0:i.answer)==null?void 0:A.contact)==null?void 0:u.client)==null?void 0:c.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}function Ry(i){var e,t;const r=(t=(e=i==null?void 0:i.answer)==null?void 0:e.contact)==null?void 0:t.roleTitle,n=r==null?void 0:r.split(" ");return{roleTitle:r,roleWords:n,firstRoleWord:n==null?void 0:n[0],remainingRoleWords:n==null?void 0:n.slice(1).join(" ")}}const Dy=ji(async(i,e,t)=>{var r,n,s;const o=(r=e==null?void 0:e.answer)==null?void 0:r.id;return((s=(n=i==null?void 0:i.questions)==null?void 0:n.items)==null?void 0:s.reduce((l,A)=>{var u;return((u=A==null?void 0:A.answer)==null?void 0:u.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([i,e,t])=>{var r;return JSON.stringify({index:t,rootData:e,allQuestions:(r=i==null?void 0:i.questions)==null?void 0:r.items})}});async function Il({data:i,rootData:e,index:t},r){var n,s,o,a,l,A,u,c,h,d,f,g,p,v,B,C,y,x,w,L,F,O,D,X;const[j,oe,ae]=await Promise.all([Dy(i,e,t),wy(e),Qy({original:((s=(n=e==null?void 0:e.answer)==null?void 0:n.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.translation)??((c=(u=e==null?void 0:e.answer)==null?void 0:u.captions)==null?void 0:c.translation),originalLanguage:(d=(h=e==null?void 0:e.answer)==null?void 0:h.transcription)==null?void 0:d.language,translationLanguage:(p=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},r)]),k=Gh(e),U=Ry(e);return{...oe,...k,...U,key:j,captions:ae,wordTimings:_y((v=e==null?void 0:e.answer)==null?void 0:v.transcription),answerLabel:((B=e==null?void 0:e.answer)==null?void 0:B.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((w=(x=(y=(C=i==null?void 0:i.questions)==null?void 0:C.items)==null?void 0:y[t-1])==null?void 0:x.answer)==null?void 0:w.label)??((O=(F=(L=i==null?void 0:i.questions)==null?void 0:L.items)==null?void 0:F[t-1])==null?void 0:O.title)??null:null,isFirstInstanceOfName:t?((X=(D=i==null?void 0:i.questions)==null?void 0:D.items)==null?void 0:X.findIndex(K=>Gh(K).name===k.name))===t:!0}}const lo={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 Ly({data:i}){var e,t;return((t=(e=i==null?void 0:i.questions)==null?void 0:e.items)==null?void 0:t.reduce((r,n)=>{var s,o,a,l,A,u,c;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=(c=(u=(A=(l=n==null?void 0:n.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:u.language)==null?void 0:c.split("-")[0];return h&&lo[h]&&!r.find(f=>f.value===h)&&r.push({value:h,label:lo[h]}),d&&lo[d]&&!r.find(f=>f.value===d)&&r.push({value:d,label:lo[d]}),r},[]))??[]}/**
|
2478
2478
|
* @license
|
2479
2479
|
* Copyright 2018 Google LLC
|