@vouchfor/embeds 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/embeds.js +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 Ch=xa(fv);var Bh;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 dl({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}}let ro;const mv=new Uint8Array(16);function Ev(){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(mv)}const wt=[];for(let i=0;i<256;++i)wt.push((i+256).toString(16).slice(1));function Iv(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 Th={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function vv(i,e,t){if(Th.randomUUID&&!i)return Th.randomUUID();i=i||{};const r=i.random||(i.rng||Ev)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Iv(r)}function yv(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 Cv(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 Bv(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 Tv(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 bv(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 Sv(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 xv=Ji(()=>jc.loadYoga());function bh(i,e,{layout:t,scale:r=1}){const{position:n="relative",inset:s,width:o,height:a,minWidth:A,minHeight:l,maxWidth:u,maxHeight:c,flex:h,flexGrow:d,flexShrink:f,gap:g,margin:p,padding:v,direction:T="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:F,right:j,bottom:X,left:le}=Cv(s,r);typeof F<"u"&&e.setPosition(i.EDGE_TOP,F),typeof j<"u"&&e.setPosition(i.EDGE_RIGHT,j),typeof X<"u"&&e.setPosition(i.EDGE_BOTTOM,X),typeof le<"u"&&e.setPosition(i.EDGE_LEFT,le)}const D={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(D[T]);const M={start:i.ALIGN_FLEX_START,end:i.ALIGN_FLEX_END,center:i.ALIGN_CENTER,stretch:i.ALIGN_STRETCH};e.setAlignItems(M[C]),y&&e.setAlignSelf(M[y]);const P={start:i.JUSTIFY_FLEX_START,end:i.JUSTIFY_FLEX_END,center:i.JUSTIFY_CENTER,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND,"space-evenly":i.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(P[x]),typeof p<"u"){const{top:F,right:j,bottom:X,left:le}=Bv(p,r);e.setMargin(i.EDGE_TOP,F),e.setMargin(i.EDGE_RIGHT,j),e.setMargin(i.EDGE_BOTTOM,X),e.setMargin(i.EDGE_LEFT,le)}if(typeof v<"u"){const{top:F,right:j,bottom:X,left:le}=Tv(v,r);e.setPadding(i.EDGE_TOP,F),e.setPadding(i.EDGE_RIGHT,j),e.setPadding(i.EDGE_BOTTOM,X),e.setPadding(i.EDGE_LEFT,le)}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"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*r:a)),typeof A<"u"&&e.setMinWidth(typeof A=="number"?A*r:A),typeof l<"u"&&e.setMinHeight(typeof l=="number"?l*r:l),typeof u<"u"&&e.setMaxWidth(typeof u=="number"?u*r:u),typeof c<"u"&&e.setMaxHeight(typeof c=="number"?c*r:c)}async function Sh({id:i,yoga:e,index:t,parent:r,element:n,resolvers:s}){var o,a,A;const{layout:l={},config:u={},options:c={},renderer:h}=n,d=e.Node.create();bh(e,d,{layout:l}),r.insertChild(d,t);let f=null;s&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="caption"||(h==null?void 0:h.type)==="image"||(h==null?void 0:h.type)==="video")&&((h==null?void 0:h.type)==="caption"?f=await((o=s.text)==null?void 0:o.call(s,{id:i,config:u,options: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((A=n.children)==null?void 0:A.entries())??[])g.push(await Sh({id:i,yoga:e,index:p,parent:d,element:v,resolvers:s}));return{node:d,radius:yv(l.radius),element:n,renderer:h,config:u,options:c,dependencies:f,childNodes:g}}function xh(i,e,t=0,r=0){const{top:n,left:s}=i.getComputedLayout(),{top:o,left:a,width:A,height:l}=e.node.getComputedLayout(),u=t+a,c=r+o,h=e.childNodes.map(d=>xh(i,d,u,c));return{...e,x:s+u,y:n+c,width:A,height:l,childNodes:h}}async function Qh(i,e,t){for await(const{node:r,options:n,dependencies:s,renderer:o,childNodes:a}of e){if(o){const{width:A,height:l}=o;if(A&&t){i.calculateLayout();const u=await A({node:r,options:n,dependencies:s,measureCanvas:t});r.setWidth(u)}if(l&&t){i.calculateLayout();const u=await l({node:r,options:n,dependencies:s,measureCanvas:t});r.setHeight(u)}}i.calculateLayout(),await Qh(i,a,t)}}async function _h({id:i,root:e,resolvers:t,measureCanvas:r}){const n=await xv(),s=n.Node.create();bh(n,s,{layout:e.layout});const o=await Sh({id:i,yoga:n,index:0,parent:s,element:e.element,resolvers:t});await Qh(s,[o],r);const{top:a,left:A,width:l,height:u}=s.getComputedLayout(),c={root:{x:A,y:a,width:l,height:u},node:xh(s,o)};return s.freeRecursive(),c}const Qv={type:"audio"},On=/(?<value>\d+\.?\d*)(?=px)/;function fl({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)}Os(({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 A=i.measureText(r[0].text);return r.slice(1).reduce((l,u)=>{const c=l[l.length-1],h=i.measureText(u.text),d={...u,metrics:h},f=[...c.words,d],g=fl({strokeWidth:s,words:f,spaceMetrics:c.spaceMetrics});if(g>n){const p=t[l.length%t.length];i.font=e.replace(On,p.toString());const v=i.measureText(" "),T=i.measureText(u.text),C=[{...u,metrics:T}],y=i.measureText("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");l=[...l,{allMetrics:y,spaceMetrics:v,lineWidth:fl({strokeWidth:s,spaceMetrics:v,words:C}),font:i.font,words:C,lineHeight:y.actualBoundingBoxAscent+y.actualBoundingBoxDescent+s}]}else l[l.length-1]={...c,lineWidth:g,words:f};return l},[{allMetrics:a,lineWidth:fl({strokeWidth:s,words:[{...r[0],metrics:A}],spaceMetrics:i.measureText(" ")}),lineHeight:a.actualBoundingBoxAscent+a.actualBoundingBoxDescent+s,font:i.font,words:[{...r[0],metrics:A}],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}`});const wh={linear:$m,easeIn:Ua,easeInOut:Ym,easeOut:Hm,circIn:yu,circInOut:Vm,circOut:Cu,backIn:Ga,backInOut:Wm,backOut:Km,anticipate:qm,bounceIn:zm,bounceInOut:Zm,bounceOut:Ys},no=Os((i,e,{clamp:t=!0,ease:r="easeIn",...n}={})=>Mm(i,e,{...n,clamp:t,ease:wh[r]}),{cacheKey:([i,e,t])=>JSON.stringify({from:i,to:e,options:t})}),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 _v({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(wh).map(i=>({label:i.charAt(0).toUpperCase()+i.slice(1),value:i,data:i}));const Rv={type:wv},Dv={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],A=i.measureText(a);A.width<t?r[o?r.length-1:0]={text:a,metrics:A}:r.push({text:e[s],metrics:i.measureText(e[s])})}return r}const Lv=Os(({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 A=a.split(" ").filter(Boolean);return A.length?A.slice(1).reduce((l,u,c)=>{const d=`${l[l.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)l=[...l,...Dh({context:e,word:u,maxW:n})];else{const g=t[c%t.length];e.font=i.replace(On,g.toString()),l[l.length-1]={text:d,metrics:f}}return l},Dh({context:e,word:A[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}`});Os(({font:i,text:e,scale:t,context:r,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:A=0})=>{var l,u;let c=0;if(a){c=(o??0)*t;let d=0;for(;a*t>c+1;){c+=1;const f=Lv({font:i,context:r,fontSizes:[c],text:e,maxW:n,letterSpacing:A});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=(l=i.match(On))==null?void 0:l.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 kv={type:"text"},Fv={type:"video"};function Lh(){return document.createElement("canvas")}function Mv(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 so(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const A=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,l=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,c=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(A?l/2:l,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 Fh(i){const e={box: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,image:n,video:s,text:o,audio:a,gradient:A,caption:l}=Fh(t);e.box+=r,e.image+=n,e.video+=s,e.text+=o,e.audio+=a,e.gradient+=A,e.caption+=l}return e}function Nv(i){return i.video>0?Fv.type:i.image>0?Dv.type:i.audio>0?Qv.type:i.caption>0?Rv.type:kv.type}function Mh({node:i,duration:e,parentAnimations:t=[]}){const r=[],n=[...i.element.animations??[],...t];if(i.renderer){const s=kh({...i.element,animations:n,layout:{...i.element.layout?Mv(i.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=Fh(s);r.push({type:Nv(o),id:vv(),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(...Mh({node:s,duration:e,parentAnimations:n}));return r}j0.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${Sv(i)}"`:bv(i)||Array.isArray(i)?JSON.stringify(i):i);const Pv="3";async function Ov({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await _h({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function Uv({track:i}){const e=so(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const A=Jt(e.slice(0,a));return s.push(Ov({scene:o,start:A})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const A=Jt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:A,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))}}function gl(i){return i.type==="fade"}function pl(i){return i.type==="translate"}function ml(i){return i.type==="clip"}function El(i){return i.type==="scale"}async function Nh({node:i,canvases:e,sceneTime:t,parentOpacity:r=1,parentTransform:n,debug:s=!1}){var o,a,A;const l=e.sceneCanvas.getContext("2d");if(l){l.save(),l.setTransform(n);const c=(i.element.animations??[]).reduce((p,v)=>(p[v.type]||(p[v.type]=[]),p[v.type].push(v),p),{});let h=((o=i.element.layout)==null?void 0:o.opacity)??1,d={x:0,y:0},f=1,g=null;for(const p of Object.keys(c)){const v=c[p].reduce((y,x)=>(x.start<=t&&(y=x),y),null),T=v?c[p].indexOf(v):-1,C=c[p][T+1];v?(gl(v)&&(h=v.to),pl(v)&&(d={x:v.to.x,y:v.to.y}),ml(v)&&(g={x:v.to.x,y:v.to.y,width:v.to.width,height:v.to.height}),El(v)&&(f=v.to)):C&&(gl(C)&&(h=C.from),pl(C)&&(d={x:C.from.x,y:C.from.y}),ml(C)&&(g={x:C.from.x,y:C.from.y,width:C.from.width,height:C.from.height}),El(C)&&(f=C.from));for(const y of c[p]){const{start:x,duration:w}=y;if(t>=x&&t<x+w){if(gl(y)){const{from:D,to:M,easing:P}=y;h=no([x,x+w],[D,M],{ease:P})(t)}if(pl(y)){const{from:D,to:M,easing:P}=y;d=no([x,x+w],[D,M],{ease:P})(t)}if(ml(y)){const{from:D,to:M,easing:P}=y;g=no([x,x+w],[D,M],{ease:P})(t)}if(El(y)){const{from:D,to:M,easing:P}=y;f=no([x,x+w],[D,M],{ease:P})(t)}}}}if(l.globalAlpha=h*r,l.translate(d.x,d.y),l.translate(i.x+i.width/2,i.y+i.height/2),l.scale(f,f),l.translate(-(i.x+i.width/2),-(i.y+i.height/2)),g){l.beginPath();const p={x:i.x+g.x*i.width,y:i.y+g.y*i.height,width:g.width*i.width,height:g.height*i.height};l.rect(p.x,p.y,p.width,p.height),l.clip()}s&&(l.strokeStyle="red",l.strokeRect(i.x,i.y,i.width,i.height)),await((A=(a=i.renderer)==null?void 0:a.render)==null?void 0:A.call(a,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:i.width,dh:i.height,radius:i.radius,options:i.options,dependencies:i.dependencies}));for await(const p of i.childNodes)await Nh({debug:s,node:p,canvases:e,sceneTime:t,parentOpacity:l.globalAlpha,parentTransform:l.getTransform()});l.restore()}}async function Gv({layout:i,canvases:e,sceneTime:t,debug:r=!1}){const{node:n}=i;await Nh({debug:r,node:n,canvases:e,sceneTime:t})}async function oo({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=Lh}){var a,A;const{id:l,x:u,y:c,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),T=o(),C=o(),y=o(),x=await _h({id:l,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??((A=f.element.layout)==null?void 0:A.height)}}},resolvers:r,measureCanvas:y}),w=async D=>{const M=Math.max(0,D-t);p.width=p.height=0,p.width=n,p.height=s,await Gv({debug:i,layout:x,sceneTime:M,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:T,posterCanvas:C}})};return{id:l,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:w,config:e,childScenes:Mh({node:x.node,duration:g})}}async function $v({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="caption"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),A=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},[]),l=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)??A.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:A,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function Hv({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="video"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),A=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},[]),l=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)??A.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:A,transitions:l,mergedScenes:u,duration:Math.max(0,...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function Yv({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="text"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),A=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},[]),l=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)??A.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)).filter(Boolean);return{type:"text",scenes:a,gapScenes:A,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}function Vv(i){return i.some(({type:e})=>e==="text")}function Kv(i){return i.some(({type:e})=>e==="caption")}function Wv(i){return i.some(({type:e})=>e==="audio")}function qv(i){return i.some(({type:e})=>e==="video"||e==="image")}function Jv(i){return i.type==="audio"}const jv=(((Bh=Ch)==null?void 0:Bh.default)??Ch).reduce((i,e)=>(i[e.name]=e,i),{});function Xv(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function zv({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:A=!0}){var l,u,c;const h=Xv(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=Zs)==null?void 0:l.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=yh)==null?void 0:c.default)??yh)(o,jv[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!A)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 Zv(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 ey({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),zv({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Ph({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=Lh,drawTransition:o=ey}){const a=new Map,A=await Promise.all(e.tracks.map(async c=>{if(qv(c))return{...await Hv({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Vv(c))return{...await Yv({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Kv(c))return{...await $v({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Wv(c))return{...await Uv({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 A){if(Jv(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=c.width,v.height=c.height;const T=v.getContext("2d"),C=g.filter(({start:x,duration:w})=>h>=x&&h<x+w);if(!T||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))&&T.drawImage(x,0,0,x.width,x.height);if(y&&y.to&&y.from){const{name:x,to:w,from:D,duration:M,transitionCanvas:P}=y;P.width=P.height=0,P.width=v.width,P.height=v.height;const F=Math.min(1,Math.max(0,(h-w.start)/M));await o({name:x,progress:F,contextResources:a,to:w.sceneCanvas,from:D.sceneCanvas,canvas:P}),T.globalCompositeOperation="lighter",T.drawImage(P,0,0,P.width,P.height)}d.drawImage(v,0,0,v.width,v.height)}}},cleanup:()=>{Zv(a)},tracks:A,aspectRatio:e.aspectRatio,duration:Math.max(...A.map(({duration:c})=>c))}}const ty={version:"4.5.0"};function iy(i){const{publicApiUrl:e}=ws(i),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function ry(i){var s,o,a,A,l,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=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),r=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=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 ny(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function sy(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 A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());r[A]=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:ty.version,templateVersion:Pv,...r}}const Oh=1;class oy{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=ny(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}=ry(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":sy(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 Il={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qi<"u"&&qi,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 qi<"u"&&qi||{},A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(L){return L&&DataView.prototype.isPrototypeOf(L)}if(A.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(L){return L&&u.indexOf(Object.prototype.toString.call(L))>-1};function h(L){if(typeof L!="string"&&(L=String(L)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(L)||L==="")throw new TypeError('Invalid character in header field name: "'+L+'"');return L.toLowerCase()}function d(L){return typeof L!="string"&&(L=String(L)),L}function f(L){var U={next:function(){var J=L.shift();return{done:J===void 0,value:J}}};return A.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(L){this.map={},L instanceof g?L.forEach(function(U,J){this.append(J,U)},this):Array.isArray(L)?L.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):L&&Object.getOwnPropertyNames(L).forEach(function(U){this.append(U,L[U])},this)}g.prototype.append=function(L,U){L=h(L),U=d(U);var J=this.map[L];this.map[L]=J?J+", "+U:U},g.prototype.delete=function(L){delete this.map[h(L)]},g.prototype.get=function(L){return L=h(L),this.has(L)?this.map[L]:null},g.prototype.has=function(L){return this.map.hasOwnProperty(h(L))},g.prototype.set=function(L,U){this.map[h(L)]=d(U)},g.prototype.forEach=function(L,U){for(var J in this.map)this.map.hasOwnProperty(J)&&L.call(U,this.map[J],J,this)},g.prototype.keys=function(){var L=[];return this.forEach(function(U,J){L.push(J)}),f(L)},g.prototype.values=function(){var L=[];return this.forEach(function(U){L.push(U)}),f(L)},g.prototype.entries=function(){var L=[];return this.forEach(function(U,J){L.push([J,U])}),f(L)},A.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(L){if(!L._noBody){if(L.bodyUsed)return Promise.reject(new TypeError("Already read"));L.bodyUsed=!0}}function v(L){return new Promise(function(U,J){L.onload=function(){U(L.result)},L.onerror=function(){J(L.error)}})}function T(L){var U=new FileReader,J=v(U);return U.readAsArrayBuffer(L),J}function C(L){var U=new FileReader,J=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(L.type),_=R?R[1]:"utf-8";return U.readAsText(L,_),J}function y(L){for(var U=new Uint8Array(L),J=new Array(U.length),R=0;R<U.length;R++)J[R]=String.fromCharCode(U[R]);return J.join("")}function x(L){if(L.slice)return L.slice(0);var U=new Uint8Array(L.byteLength);return U.set(new Uint8Array(L)),U.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(L){this.bodyUsed=this.bodyUsed,this._bodyInit=L,L?typeof L=="string"?this._bodyText=L:A.blob&&Blob.prototype.isPrototypeOf(L)?this._bodyBlob=L:A.formData&&FormData.prototype.isPrototypeOf(L)?this._bodyFormData=L:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)?this._bodyText=L.toString():A.arrayBuffer&&A.blob&&l(L)?(this._bodyArrayBuffer=x(L.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(L)||c(L))?this._bodyArrayBuffer=x(L):this._bodyText=L=Object.prototype.toString.call(L):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof L=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var L=p(this);return L||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(A.blob)return this.blob().then(T);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var L=p(this);if(L)return L;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)},A.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function M(L){var U=L.toUpperCase();return D.indexOf(U)>-1?U:L}function P(L,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 J=U.body;if(L instanceof P){if(L.bodyUsed)throw new TypeError("Already read");this.url=L.url,this.credentials=L.credentials,U.headers||(this.headers=new g(L.headers)),this.method=L.method,this.mode=L.mode,this.signal=L.signal,!J&&L._bodyInit!=null&&(J=L._bodyInit,L.bodyUsed=!0)}else this.url=String(L);if(this.credentials=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=M(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.signal||this.signal||function(){if("AbortController"in a){var k=new AbortController;return k.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&J)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(J),(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()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function F(L){var U=new FormData;return L.trim().split("&").forEach(function(J){if(J){var R=J.split("="),_=R.shift().replace(/\+/g," "),k=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(_),decodeURIComponent(k))}}),U}function j(L){var U=new g,J=L.replace(/\r?\n[\t ]+/g," ");return J.split("\r").map(function(R){return R.indexOf(`
|
2476
|
+
`).flatMap(a=>{const A=a.split(" ").filter(Boolean);return A.length?A.slice(1).reduce((l,u,c)=>{const d=`${l[l.length-1].text} ${u}`.trim(),f=e.measureText(d);if(f.width>n)l=[...l,...Dh({context:e,word:u,maxW:n})];else{const g=t[c%t.length];e.font=i.replace(On,g.toString()),l[l.length-1]={text:d,metrics:f}}return l},Dh({context:e,word:A[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}`});Os(({font:i,text:e,scale:t,context:r,maxW:n,maxH:s,minSize:o,maxSize:a,letterSpacing:A=0})=>{var l,u;let c=0;if(a){c=(o??0)*t;let d=0;for(;a*t>c+1;){c+=1;const f=Lv({font:i,context:r,fontSizes:[c],text:e,maxW:n,letterSpacing:A});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=(l=i.match(On))==null?void 0:l.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 kv={type:"text"},Fv={type:"video"};function Lh(){return document.createElement("canvas")}function Mv(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 so(i){return i.map(({type:e,duration:t},r)=>{var n,s,o,a;if(e==="transition"){const A=((n=i[r-2])==null?void 0:n.type)==="transition"?i[r-2]:null,l=((s=i[r-1])==null?void 0:s.duration)??1/0,u=((o=i[r+1])==null?void 0:o.duration)??1/0,c=((a=i[r+2])==null?void 0:a.type)==="transition"?i[r+2]:null;return Math.min(A?l/2:l,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 Fh(i){const e={box: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,image:n,video:s,text:o,audio:a,gradient:A,caption:l}=Fh(t);e.box+=r,e.image+=n,e.video+=s,e.text+=o,e.audio+=a,e.gradient+=A,e.caption+=l}return e}function Nv(i){return i.video>0?Fv.type:i.image>0?Dv.type:i.audio>0?Qv.type:i.caption>0?Rv.type:kv.type}function Mh({node:i,duration:e,parentAnimations:t=[]}){const r=[],n=[...i.element.animations??[],...t];if(i.renderer){const s=kh({...i.element,animations:n,layout:{...i.element.layout?Mv(i.element.layout,["maxWidth","maxHeight"]):{},width:"100%",height:"100%",margin:0}}),o=Fh(s);r.push({type:Nv(o),id:vv(),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(...Mh({node:s,duration:e,parentAnimations:n}));return r}j0.filters.define("parse",i=>typeof i>"u"?null:typeof i=="string"?`"${Sv(i)}"`:bv(i)||Array.isArray(i)?JSON.stringify(i):i);const Pv="3";async function Ov({scene:i,start:e=0}){const{id:t,root:r,duration:n}=i,s=await _h({id:t,root:r});return{type:i.type,start:e,duration:n,layout:s,id:i.id,config:i}}async function Uv({track:i}){const e=so(i),t=await Promise.all(i.reduce((s,o,a)=>{if(o.type!=="audio")return s;const A=Jt(e.slice(0,a));return s.push(Ov({scene:o,start:A})),s},[])),r=i.reduce((s,o,a)=>{if(o.type!=="gap")return s;const A=Jt(e.slice(0,a));return s.push({type:o.type,id:o.id,start:A,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))}}function gl(i){return i.type==="fade"}function pl(i){return i.type==="translate"}function ml(i){return i.type==="clip"}function El(i){return i.type==="scale"}async function Nh({node:i,canvases:e,sceneTime:t,parentOpacity:r=1,parentTransform:n,debug:s=!1}){var o,a,A;const l=e.sceneCanvas.getContext("2d");if(l){l.save(),l.setTransform(n);const c=(i.element.animations??[]).reduce((p,v)=>(p[v.type]||(p[v.type]=[]),p[v.type].push(v),p),{});let h=((o=i.element.layout)==null?void 0:o.opacity)??1,d={x:0,y:0},f=1,g=null;for(const p of Object.keys(c)){const v=c[p].reduce((y,x)=>(x.start<=t&&(y=x),y),null),T=v?c[p].indexOf(v):-1,C=c[p][T+1];v?(gl(v)&&(h=v.to),pl(v)&&(d={x:v.to.x,y:v.to.y}),ml(v)&&(g={x:v.to.x,y:v.to.y,width:v.to.width,height:v.to.height}),El(v)&&(f=v.to)):C&&(gl(C)&&(h=C.from),pl(C)&&(d={x:C.from.x,y:C.from.y}),ml(C)&&(g={x:C.from.x,y:C.from.y,width:C.from.width,height:C.from.height}),El(C)&&(f=C.from));for(const y of c[p]){const{start:x,duration:w}=y;if(t>=x&&t<x+w){if(gl(y)){const{from:D,to:M,easing:P}=y;h=no([x,x+w],[D,M],{ease:P})(t)}if(pl(y)){const{from:D,to:M,easing:P}=y;d=no([x,x+w],[D,M],{ease:P})(t)}if(ml(y)){const{from:D,to:M,easing:P}=y;g=no([x,x+w],[D,M],{ease:P})(t)}if(El(y)){const{from:D,to:M,easing:P}=y;f=no([x,x+w],[D,M],{ease:P})(t)}}}}if(l.globalAlpha=h*r,l.translate(d.x,d.y),l.translate(i.x+i.width/2,i.y+i.height/2),l.scale(f,f),l.translate(-(i.x+i.width/2),-(i.y+i.height/2)),g){l.beginPath();const p={x:i.x+g.x*i.width,y:i.y+g.y*i.height,width:g.width*i.width,height:g.height*i.height};l.rect(p.x,p.y,p.width,p.height),l.clip()}s&&(l.strokeStyle="red",l.strokeRect(i.x,i.y,i.width,i.height)),await((A=(a=i.renderer)==null?void 0:a.render)==null?void 0:A.call(a,{canvases:e,sceneTime:t,dx:i.x,dy:i.y,dw:i.width,dh:i.height,radius:i.radius,options:i.options,dependencies:i.dependencies}));for await(const p of i.childNodes)await Nh({debug:s,node:p,canvases:e,sceneTime:t,parentOpacity:l.globalAlpha,parentTransform:l.getTransform()});l.restore()}}async function Gv({layout:i,canvases:e,sceneTime:t,debug:r=!1}){const{node:n}=i;await Nh({debug:r,node:n,canvases:e,sceneTime:t})}async function oo({debug:i=!1,scene:e,start:t=0,resolvers:r,rootWidth:n,rootHeight:s,canvasFactory:o=Lh}){var a,A;const{id:l,x:u,y:c,width:h,height:d,root:f,duration:g}=e,p=o(),v=o(),T=o(),C=o(),y=o(),x=await _h({id:l,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??((A=f.element.layout)==null?void 0:A.height)}}},resolvers:r,measureCanvas:y}),w=async D=>{const M=Math.max(0,D-t);p.width=p.height=0,p.width=n,p.height=s,await Gv({debug:i,layout:x,sceneTime:M,canvases:{sceneCanvas:p,cropCanvas:v,letterboxCanvas:T,posterCanvas:C}})};return{id:l,type:e.type,start:t,duration:g,layout:x,sceneCanvas:p,draw:w,config:e,childScenes:Mh({node:x.node,duration:g})}}async function $v({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="caption"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),A=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},[]),l=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)??A.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)).filter(Boolean);return{type:"caption",scenes:a,gapScenes:A,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function Hv({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="video"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),h.type==="image"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),A=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},[]),l=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)??A.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)).filter(Boolean);return{type:"picture",scenes:a,gapScenes:A,transitions:l,mergedScenes:u,duration:Math.max(0,...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}async function Yv({debug:i=!1,track:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}){const o=so(e),a=await Promise.all(e.reduce((c,h,d)=>{const f=Jt(o.slice(0,d));return h.type==="text"&&c.push(oo({debug:i,scene:h,start:f,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s})),c},[])),A=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},[]),l=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)??A.find(({id:h})=>h===c)??l.find(({id:h})=>h===c)).filter(Boolean);return{type:"text",scenes:a,gapScenes:A,transitions:l,mergedScenes:u,duration:Math.max(...u.map(({start:c,duration:h})=>c+h)),trackCanvas:s()}}function Vv(i){return i.some(({type:e})=>e==="text")}function Kv(i){return i.some(({type:e})=>e==="caption")}function Wv(i){return i.some(({type:e})=>e==="audio")}function qv(i){return i.some(({type:e})=>e==="video"||e==="image")}function Jv(i){return i.type==="audio"}const jv=(((Bh=Ch)==null?void 0:Bh.default)??Ch).reduce((i,e)=>(i[e.name]=e,i),{});function Xv(i,e){return i.has(e)||i.set(e,{buffer:null,transitions:{},fromTexture:null,toTexture:null}),i.get(e)}function zv({name:i,to:e,from:t,progress:r,width:n,height:s,glContext:o,contextResources:a,returnPixels:A=!0}){var l,u,c;const h=Xv(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=Zs)==null?void 0:l.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=yh)==null?void 0:c.default)??yh)(o,jv[i])),h.transitions[i].draw(r,h.fromTexture,h.toTexture,n,s),!A)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 Zv(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 ey({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),zv({name:i,to:e,from:t,progress:r,width:n.width,height:n.height,glContext:o,contextResources:s,returnPixels:!1}))}async function Ph({debug:i=!1,config:e,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s=Lh,drawTransition:o=ey}){const a=new Map,A=await Promise.all(e.tracks.map(async c=>{if(qv(c))return{...await Hv({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Vv(c))return{...await Yv({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Kv(c))return{...await $v({debug:i,track:c,resolvers:t,rootWidth:r,rootHeight:n,canvasFactory:s}),config:c};if(Wv(c))return{...await Uv({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 A){if(Jv(f))continue;const{scenes:g,transitions:p,trackCanvas:v}=f;v.width=v.height=0,v.width=c.width,v.height=c.height;const T=v.getContext("2d"),C=g.filter(({start:x,duration:w})=>h>=x&&h<x+w);if(!T||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))&&T.drawImage(x,0,0,x.width,x.height);if(y&&y.to&&y.from){const{name:x,to:w,from:D,duration:M,transitionCanvas:P}=y;P.width=P.height=0,P.width=v.width,P.height=v.height;const F=Math.min(1,Math.max(0,(h-w.start)/M));await o({name:x,progress:F,contextResources:a,to:w.sceneCanvas,from:D.sceneCanvas,canvas:P}),T.globalCompositeOperation="lighter",T.drawImage(P,0,0,P.width,P.height)}d.drawImage(v,0,0,v.width,v.height)}}},cleanup:()=>{Zv(a)},tracks:A,aspectRatio:e.aspectRatio,duration:Math.max(...A.map(({duration:c})=>c))}}const ty={version:"4.6.0"};function iy(i){const{publicApiUrl:e}=ws(i),t=Ki();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function ry(i){var s,o,a,A,l,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=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),r=(u=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:u.call(l,"vouch-uid-tab");const n=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 ny(i,e){return i&&"vouchId"in i?i.vouchId:(e==null?void 0:e.id)??null}function sy(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 A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());r[A]=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:ty.version,templateVersion:Pv,...r}}const Oh=1;class oy{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,r)=>{const n=ny(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}=ry(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":sy(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 Il={exports:{}};(function(i,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qi<"u"&&qi,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 qi<"u"&&qi||{},A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(L){return L&&DataView.prototype.isPrototypeOf(L)}if(A.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(L){return L&&u.indexOf(Object.prototype.toString.call(L))>-1};function h(L){if(typeof L!="string"&&(L=String(L)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(L)||L==="")throw new TypeError('Invalid character in header field name: "'+L+'"');return L.toLowerCase()}function d(L){return typeof L!="string"&&(L=String(L)),L}function f(L){var U={next:function(){var J=L.shift();return{done:J===void 0,value:J}}};return A.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(L){this.map={},L instanceof g?L.forEach(function(U,J){this.append(J,U)},this):Array.isArray(L)?L.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):L&&Object.getOwnPropertyNames(L).forEach(function(U){this.append(U,L[U])},this)}g.prototype.append=function(L,U){L=h(L),U=d(U);var J=this.map[L];this.map[L]=J?J+", "+U:U},g.prototype.delete=function(L){delete this.map[h(L)]},g.prototype.get=function(L){return L=h(L),this.has(L)?this.map[L]:null},g.prototype.has=function(L){return this.map.hasOwnProperty(h(L))},g.prototype.set=function(L,U){this.map[h(L)]=d(U)},g.prototype.forEach=function(L,U){for(var J in this.map)this.map.hasOwnProperty(J)&&L.call(U,this.map[J],J,this)},g.prototype.keys=function(){var L=[];return this.forEach(function(U,J){L.push(J)}),f(L)},g.prototype.values=function(){var L=[];return this.forEach(function(U){L.push(U)}),f(L)},g.prototype.entries=function(){var L=[];return this.forEach(function(U,J){L.push([J,U])}),f(L)},A.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(L){if(!L._noBody){if(L.bodyUsed)return Promise.reject(new TypeError("Already read"));L.bodyUsed=!0}}function v(L){return new Promise(function(U,J){L.onload=function(){U(L.result)},L.onerror=function(){J(L.error)}})}function T(L){var U=new FileReader,J=v(U);return U.readAsArrayBuffer(L),J}function C(L){var U=new FileReader,J=v(U),R=/charset=([A-Za-z0-9_-]+)/.exec(L.type),_=R?R[1]:"utf-8";return U.readAsText(L,_),J}function y(L){for(var U=new Uint8Array(L),J=new Array(U.length),R=0;R<U.length;R++)J[R]=String.fromCharCode(U[R]);return J.join("")}function x(L){if(L.slice)return L.slice(0);var U=new Uint8Array(L.byteLength);return U.set(new Uint8Array(L)),U.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(L){this.bodyUsed=this.bodyUsed,this._bodyInit=L,L?typeof L=="string"?this._bodyText=L:A.blob&&Blob.prototype.isPrototypeOf(L)?this._bodyBlob=L:A.formData&&FormData.prototype.isPrototypeOf(L)?this._bodyFormData=L:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)?this._bodyText=L.toString():A.arrayBuffer&&A.blob&&l(L)?(this._bodyArrayBuffer=x(L.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(L)||c(L))?this._bodyArrayBuffer=x(L):this._bodyText=L=Object.prototype.toString.call(L):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof L=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(L)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var L=p(this);if(L)return L;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var L=p(this);return L||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(A.blob)return this.blob().then(T);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var L=p(this);if(L)return L;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)},A.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function M(L){var U=L.toUpperCase();return D.indexOf(U)>-1?U:L}function P(L,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 J=U.body;if(L instanceof P){if(L.bodyUsed)throw new TypeError("Already read");this.url=L.url,this.credentials=L.credentials,U.headers||(this.headers=new g(L.headers)),this.method=L.method,this.mode=L.mode,this.signal=L.signal,!J&&L._bodyInit!=null&&(J=L._bodyInit,L.bodyUsed=!0)}else this.url=String(L);if(this.credentials=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=M(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.signal||this.signal||function(){if("AbortController"in a){var k=new AbortController;return k.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&J)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(J),(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()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function F(L){var U=new FormData;return L.trim().split("&").forEach(function(J){if(J){var R=J.split("="),_=R.shift().replace(/\+/g," "),k=R.join("=").replace(/\+/g," ");U.append(decodeURIComponent(_),decodeURIComponent(k))}}),U}function j(L){var U=new g,J=L.replace(/\r?\n[\t ]+/g," ");return J.split("\r").map(function(R){return R.indexOf(`
|
2477
2477
|
`)===0?R.substr(1,R.length):R}).forEach(function(R){var _=R.split(":"),k=_.shift().trim();if(k){var K=_.join(":").trim();try{U.append(k,K)}catch(Y){console.warn("Response "+Y.message)}}}),U}w.call(P.prototype);function X(L,U){if(!(this instanceof X))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(L)}w.call(X.prototype),X.prototype.clone=function(){return new X(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},X.error=function(){var L=new X(null,{status:200,statusText:""});return L.ok=!1,L.status=0,L.type="error",L};var le=[301,302,303,307,308];X.redirect=function(L,U){if(le.indexOf(U)===-1)throw new RangeError("Invalid status code");return new X(null,{status:U,headers:{location:L}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(U,J){this.message=U,this.name=J;var R=Error(U);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function oe(L,U){return new Promise(function(J,R){var _=new P(L,U);if(_.signal&&_.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var k=new XMLHttpRequest;function K(){k.abort()}k.onload=function(){var re={statusText:k.statusText,headers:j(k.getAllResponseHeaders()||"")};_.url.indexOf("file://")===0&&(k.status<200||k.status>599)?re.status=200:re.status=k.status,re.url="responseURL"in k?k.responseURL:re.headers.get("X-Request-URL");var he="response"in k?k.response:k.responseText;setTimeout(function(){J(new X(he,re))},0)},k.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},k.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request timed out"))},0)},k.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(k.open(_.method,Y(_.url),!0),_.credentials==="include"?k.withCredentials=!0:_.credentials==="omit"&&(k.withCredentials=!1),"responseType"in k&&(A.blob?k.responseType="blob":A.arrayBuffer&&(k.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)),k.setRequestHeader(re,d(U.headers[re]))}),_.headers.forEach(function(re,he){ie.indexOf(he)===-1&&k.setRequestHeader(he,re)})}else _.headers.forEach(function(re,he){k.setRequestHeader(he,re)});_.signal&&(_.signal.addEventListener("abort",K),k.onreadystatechange=function(){k.readyState===4&&_.signal.removeEventListener("abort",K)}),k.send(typeof _._bodyInit>"u"?null:_._bodyInit)})}return oe.polyfill=!0,a.fetch||(a.fetch=oe,a.Headers=g,a.Request=P,a.Response=X),o.Headers=g,o.Request=P,o.Response=X,o.fetch=oe,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})(Il,Il.exports);var ay=Il.exports;const Uh=xa(ay);async function ly(i){var e;try{if((e=await Uh(i,{method:"HEAD"}))!=null&&e.ok)return i}catch{return}}async function vl({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=>ly(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Ay(i){try{return(await Uh(i)).text()}catch{return null}}async function cy(i){return i=i.trim(),i.startsWith("http")||i.startsWith("blob:")?Ay(i):i}const uy=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},A=(n&&a[n])??i;return A?cy(A):null},{cacheKey:([i,{language:e}])=>JSON.stringify({...i,language:e})});function hy(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 dy=Ji(async i=>{var e,t,r,n,s,o,a,A,l,u,c;const[h,d,f]=await Promise.all([vl({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]}),vl({sources:[(o=(s=i==null?void 0:i.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),vl({sources:[((A=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:A.reducedQuality)??((c=(u=(l=i==null?void 0:i.answer)==null?void 0:l.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,A,l,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:((A=(a=i==null?void 0:i.answer)==null?void 0:a.media)==null?void 0:A.reducedQuality)??((c=(u=(l=i==null?void 0:i.answer)==null?void 0:l.media)==null?void 0:u.videos)==null?void 0:c.xs)})}});function Gh(i){var e,t,r,n,s,o,a,A,l,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=((A=(a=(o=i==null?void 0:i.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:A.name)==="Not Supplied"?"":((h=(c=(u=(l=i==null?void 0:i.answer)==null?void 0:l.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}}const fy=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((A,l)=>{var u;return((u=l==null?void 0:l.answer)==null?void 0:u.id)===o?(A??0)+1:A},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 yl({data:i,rootData:e,index:t},r){var n,s,o,a,A,l,u,c,h,d,f,g,p,v,T,C,y,x,w,D,M,P,F,j;const[X,le,oe]=await Promise.all([fy(i,e,t),dy(e),uy({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:((l=(A=e==null?void 0:e.answer)==null?void 0:A.media)==null?void 0:l.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)]),L=Gh(e);return{...le,...L,key:X,captions:oe,wordTimings:hy((v=e==null?void 0:e.answer)==null?void 0:v.transcription),answerLabel:((T=e==null?void 0:e.answer)==null?void 0:T.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)??((P=(M=(D=i==null?void 0:i.questions)==null?void 0:D.items)==null?void 0:M[t-1])==null?void 0:P.title)??null:null,isFirstInstanceOfName:t?((j=(F=i==null?void 0:i.questions)==null?void 0:F.items)==null?void 0:j.findIndex(U=>Gh(U).name===L.name))===t:!0}}const ao={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 gy({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,A,l,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=(l=(A=n==null?void 0:n.answer)==null?void 0:A.transcription)==null?void 0:l.translation)==null?void 0:u.language)==null?void 0:c.split("-")[0];return h&&ao[h]&&!r.find(f=>f.value===h)&&r.push({value:h,label:ao[h]}),d&&ao[d]&&!r.find(f=>f.value===d)&&r.push({value:d,label:ao[d]}),r},[]))??[]}/**
|
2478
2478
|
* @license
|
2479
2479
|
* Copyright 2018 Google LLC
|