@vouchfor/embeds-legacy 4.7.0 → 4.7.1

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.
@@ -195,7 +195,7 @@ class FetcherController {
195
195
  return this._fetching;
196
196
  }
197
197
  }
198
- const version = "4.7.0";
198
+ const version = "4.7.1";
199
199
  const packageJson = {
200
200
  version
201
201
  };
@@ -171,7 +171,7 @@ ${e}`,zp=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Zp=Objec
171
171
  "playlist": {{ it._derived?.playlist }},
172
172
  "preview": {{ it._derived?.preview }},
173
173
  "captions": {{ it._derived?.captions }}
174
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"}};async function y0(){const s=new Image;return s.crossOrigin="anonymous",s}const Yc=zt(async function(e,t=y0){return e?new Promise((i,r)=>{t().then(n=>{n.onload=()=>{i(n)},n.onerror=o=>{r(o)},n.src=e})}):null});async function va({element:s,meta:e,imageFactory:t},i,r){var n,o,a;let l={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((n=A==null?void 0:A.value)!=null&&n.src||(o=A==null?void 0:A.value)!=null&&o.playlist)){const c=await i(A.value,e);let h;try{h=await Yc(A.value.poster,t)}catch{h=null}l={...l,node:{...A,video:c,poster:h,meta:await r(A.value,c.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let c;try{c=await Yc(A.value,t)}catch{c=null}l={...l,node:{...A,image:c}}}return l.node&&((a=s.node)!=null&&a.elements)&&(l.node.elements=await Promise.all(s.node.elements.map(c=>va({element:c,meta:e,imageFactory:t},i,r)))),s.elements&&(l.elements=await Promise.all(s.elements.map(c=>va({element:c,meta:e,imageFactory:t},i,r)))),l}async function v0(){return document.createElement("canvas")}function Br(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=Br(t==null?void 0:t.elements);if(i)return i}}function B0(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},l)=>r===s.length-1&&o===i.length-1&&l===n.length-1?a:a-e))],[])}function Q0(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function S0(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Pn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const b0=zt(()=>bc.loadYoga());da.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${S0(s)}"`:Q0(s)||Array.isArray(s)?JSON.stringify(s):s);const Ts=(s,e,t)=>da.render(s,e,da.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Rs({data:s,template:e,burnCaptions:t=!1,debug:i=!1,imageFactory:r,canvasFactory:n=v0},o,a,l){var A,c,h,u;const d=await b0(),f=e??C0;if(!((A=f.templates)!=null&&A.length))throw new Error(`No templates found for template instance: ${f.id}`);let g=f.templates.find(({version:G})=>G===Ba);if(!g){const G=f.templates.map(({version:z})=>`"${z}"`).join(", ");console.warn(`Template renderer expects template version "${Ba}" but got ${G}`),g=f.templates[f.templates.length-1]}const p=await Promise.all(g.content.map(async({scenes:G,root:z})=>{const j={...f.options,...s,intro:f.intro,outro:f.outro};async function T(x,P){return Promise.all(G.map(async({layout:S,duration:b,data:L,derived:H,options:O})=>{var q,X,re;const ne={...j,_index:P,_root:x,_derived:await o({data:s,rootData:x,index:P})},Be=L?JSON.parse(await Ts(L,ne)):{},ge=H?JSON.parse(await Ts(H,ne)):{},we=O?JSON.parse(await Ts(O,ne)):{},ae=b?parseFloat(await Ts(b,ne)):NaN,pe=(q=g.layouts.find(le=>le.name===S))==null?void 0:q.tree;if(!pe)throw new Error(`Layout tree "${S}" not found in template "${g.id}" layouts.`);const xe=JSON.parse(await Ts(pe,{...Be,...ge,...we})),Te=await Promise.all(xe.flatMap(le=>va({element:le,meta:f.meta,imageFactory:r},a,l))),Ue=Br(Te);return{duration:(isNaN(ae)?null:ae)??((X=Ue==null?void 0:Ue.meta)==null?void 0:X.duration)??0,captions:(re=Ue==null?void 0:Ue.meta)==null?void 0:re.captions,elements:Te}}))}if(z){const x=JSON.parse(await Ts(z,j));return Array.isArray(x)?Promise.all(x.map(async(P,S)=>T(P,S))):Promise.all([T(x,null)])}return Promise.all([T(s,null)])}));if(p.every(G=>G.every(z=>z.every(j=>{const T=Br(j.elements);return!(T!=null&&T.value.src)&&!(T!=null&&T.value.playlist)})))){const G=p.flatMap(z=>z.flatMap(j=>j.map(T=>{const x=Br(T.elements);return!(x!=null&&x.value.src)&&!(x!=null&&x.value.playlist)&&(x==null?void 0:x.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${G} failed to load, video can not be processed`)}if(p.every(G=>G.every(z=>z.every(j=>j.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const y=p.reduce((G,z)=>{const j=z.reduce((T,x)=>{const P=x.filter(S=>S.duration>0);return P.length>0?[...T,P]:T},[]);return j.length>0?[...G,j]:G},[]),m=((c=f.meta)==null?void 0:c.frameRate)??30,w=((h=f.meta)==null?void 0:h.resolution)??1080,Q=((u=f.meta)==null?void 0:u.transitionDuration)??1/3,D=B0(y,Q),R=Pn(D),M=await Promise.all(y.map((G,z)=>{const j=Pn(D[z]),T=Pn(D.slice(0,z));return Promise.all(G.map((x,P)=>Promise.all(x.map(async({duration:S,captions:b,elements:L},H)=>{var O,q;const X=await n(),re=await n(),ne=await n(),Be=await n(),ge=Br(L),we=Pn([...D.slice(0,z),...D[z].slice(0,P),...D[z][P].slice(0,H)]);return{draw:async({canvas:pe,currentTime:xe})=>{const Te=Math.max(0,xe-T),Ue=Math.max(0,xe-we);await ya({yoga:d,debug:i,canvas:pe,cropCanvas:X,posterCanvas:Be,letterboxCanvas:re,elements:L,currentTime:xe,contentTime:Te,sceneTime:Ue,totalDuration:R,contentDuration:j,sceneDuration:S}),b&&t&&g0({canvas:pe,dx:0,dy:0,dw:pe.width,dh:pe.height,vttCaptions:b,sceneTime:Ue+((ge==null?void 0:ge.meta.start)??0)})},duration:S,transitionCanvas:ne,id:I0(),start:we,video:ge==null?void 0:ge.video,videoMeta:ge==null?void 0:ge.meta,audio:{duration:S,src:(O=ge==null?void 0:ge.value)==null?void 0:O.src,start:(q=ge==null?void 0:ge.meta)==null?void 0:q.start}}}))))})),_=M.flatMap(G=>G);return{scenes:_.flatMap(G=>G),sections:_,contents:M,frameRate:m,resolution:w,transitionDuration:Q,fonts:g.fonts??[],duration:R}}const Ba="3",T0={version:"4.7.0"};function R0(s){const{publicApiUrl:e}=gn(s),t=Oi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function w0(s){var n,o,a,l,A,c,h,u,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Oi()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const r=Oi();return e||(e=R0(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Oi(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Oi(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function x0(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function D0(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};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());i[l]=a}}),{source:s,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:T0.version,templateVersion:Ba,...i}}const Kc=1;class L0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=x0(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=gn(this.host.env),{client:i,tab:r,request:n,visitor:o}=w0(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":D0(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Kc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Kc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Qa={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof mr<"u"&&mr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof mr<"u"&&mr||{},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(T){return T&&DataView.prototype.isPrototypeOf(T)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&c.indexOf(Object.prototype.toString.call(T))>-1};function u(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(T)||T==="")throw new TypeError('Invalid character in header field name: "'+T+'"');return T.toLowerCase()}function d(T){return typeof T!="string"&&(T=String(T)),T}function f(T){var x={next:function(){var P=T.shift();return{done:P===void 0,value:P}}};return l.iterable&&(x[Symbol.iterator]=function(){return x}),x}function g(T){this.map={},T instanceof g?T.forEach(function(x,P){this.append(P,x)},this):Array.isArray(T)?T.forEach(function(x){if(x.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+x.length);this.append(x[0],x[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(x){this.append(x,T[x])},this)}g.prototype.append=function(T,x){T=u(T),x=d(x);var P=this.map[T];this.map[T]=P?P+", "+x:x},g.prototype.delete=function(T){delete this.map[u(T)]},g.prototype.get=function(T){return T=u(T),this.has(T)?this.map[T]:null},g.prototype.has=function(T){return this.map.hasOwnProperty(u(T))},g.prototype.set=function(T,x){this.map[u(T)]=d(x)},g.prototype.forEach=function(T,x){for(var P in this.map)this.map.hasOwnProperty(P)&&T.call(x,this.map[P],P,this)},g.prototype.keys=function(){var T=[];return this.forEach(function(x,P){T.push(P)}),f(T)},g.prototype.values=function(){var T=[];return this.forEach(function(x){T.push(x)}),f(T)},g.prototype.entries=function(){var T=[];return this.forEach(function(x,P){T.push([P,x])}),f(T)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(T){if(!T._noBody){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}}function I(T){return new Promise(function(x,P){T.onload=function(){x(T.result)},T.onerror=function(){P(T.error)}})}function C(T){var x=new FileReader,P=I(x);return x.readAsArrayBuffer(T),P}function y(T){var x=new FileReader,P=I(x),S=/charset=([A-Za-z0-9_-]+)/.exec(T.type),b=S?S[1]:"utf-8";return x.readAsText(T,b),P}function m(T){for(var x=new Uint8Array(T),P=new Array(x.length),S=0;S<x.length;S++)P[S]=String.fromCharCode(x[S]);return P.join("")}function w(T){if(T.slice)return T.slice(0);var x=new Uint8Array(T.byteLength);return x.set(new Uint8Array(T)),x.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(T){this.bodyUsed=this.bodyUsed,this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:l.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:l.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():l.arrayBuffer&&l.blob&&A(T)?(this._bodyArrayBuffer=w(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=w(T):this._bodyText=T=Object.prototype.toString.call(T):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof T=="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(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var T=p(this);if(T)return T;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 T=p(this);return T||(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(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var T=p(this);if(T)return T;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(T){var x=T.toUpperCase();return D.indexOf(x)>-1?x:T}function M(T,x){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var P=x.body;if(T instanceof M){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,x.headers||(this.headers=new g(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!P&&T._bodyInit!=null&&(P=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new g(x.headers)),this.method=R(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.signal||this.signal||function(){if("AbortController"in a){var L=new AbortController;return L.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(x.cache==="no-store"||x.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function _(T){var x=new FormData;return T.trim().split("&").forEach(function(P){if(P){var S=P.split("="),b=S.shift().replace(/\+/g," "),L=S.join("=").replace(/\+/g," ");x.append(decodeURIComponent(b),decodeURIComponent(L))}}),x}function Y(T){var x=new g,P=T.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(S){return S.indexOf(`
174
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"}};async function y0(){const s=new Image;return s.crossOrigin="anonymous",s}const Yc=zt(async function(e,t=y0){return e?new Promise((i,r)=>{t().then(n=>{n.onload=()=>{i(n)},n.onerror=o=>{r(o)},n.src=e})}):null});async function va({element:s,meta:e,imageFactory:t},i,r){var n,o,a;let l={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((n=A==null?void 0:A.value)!=null&&n.src||(o=A==null?void 0:A.value)!=null&&o.playlist)){const c=await i(A.value,e);let h;try{h=await Yc(A.value.poster,t)}catch{h=null}l={...l,node:{...A,video:c,poster:h,meta:await r(A.value,c.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let c;try{c=await Yc(A.value,t)}catch{c=null}l={...l,node:{...A,image:c}}}return l.node&&((a=s.node)!=null&&a.elements)&&(l.node.elements=await Promise.all(s.node.elements.map(c=>va({element:c,meta:e,imageFactory:t},i,r)))),s.elements&&(l.elements=await Promise.all(s.elements.map(c=>va({element:c,meta:e,imageFactory:t},i,r)))),l}async function v0(){return document.createElement("canvas")}function Br(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=Br(t==null?void 0:t.elements);if(i)return i}}function B0(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},l)=>r===s.length-1&&o===i.length-1&&l===n.length-1?a:a-e))],[])}function Q0(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function S0(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Pn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const b0=zt(()=>bc.loadYoga());da.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${S0(s)}"`:Q0(s)||Array.isArray(s)?JSON.stringify(s):s);const Ts=(s,e,t)=>da.render(s,e,da.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Rs({data:s,template:e,burnCaptions:t=!1,debug:i=!1,imageFactory:r,canvasFactory:n=v0},o,a,l){var A,c,h,u;const d=await b0(),f=e??C0;if(!((A=f.templates)!=null&&A.length))throw new Error(`No templates found for template instance: ${f.id}`);let g=f.templates.find(({version:G})=>G===Ba);if(!g){const G=f.templates.map(({version:z})=>`"${z}"`).join(", ");console.warn(`Template renderer expects template version "${Ba}" but got ${G}`),g=f.templates[f.templates.length-1]}const p=await Promise.all(g.content.map(async({scenes:G,root:z})=>{const j={...f.options,...s,intro:f.intro,outro:f.outro};async function T(x,P){return Promise.all(G.map(async({layout:S,duration:b,data:L,derived:H,options:O})=>{var q,X,re;const ne={...j,_index:P,_root:x,_derived:await o({data:s,rootData:x,index:P})},Be=L?JSON.parse(await Ts(L,ne)):{},ge=H?JSON.parse(await Ts(H,ne)):{},we=O?JSON.parse(await Ts(O,ne)):{},ae=b?parseFloat(await Ts(b,ne)):NaN,pe=(q=g.layouts.find(le=>le.name===S))==null?void 0:q.tree;if(!pe)throw new Error(`Layout tree "${S}" not found in template "${g.id}" layouts.`);const xe=JSON.parse(await Ts(pe,{...Be,...ge,...we})),Te=await Promise.all(xe.flatMap(le=>va({element:le,meta:f.meta,imageFactory:r},a,l))),Ue=Br(Te);return{duration:(isNaN(ae)?null:ae)??((X=Ue==null?void 0:Ue.meta)==null?void 0:X.duration)??0,captions:(re=Ue==null?void 0:Ue.meta)==null?void 0:re.captions,elements:Te}}))}if(z){const x=JSON.parse(await Ts(z,j));return Array.isArray(x)?Promise.all(x.map(async(P,S)=>T(P,S))):Promise.all([T(x,null)])}return Promise.all([T(s,null)])}));if(p.every(G=>G.every(z=>z.every(j=>{const T=Br(j.elements);return!(T!=null&&T.value.src)&&!(T!=null&&T.value.playlist)})))){const G=p.flatMap(z=>z.flatMap(j=>j.map(T=>{const x=Br(T.elements);return!(x!=null&&x.value.src)&&!(x!=null&&x.value.playlist)&&(x==null?void 0:x.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${G} failed to load, video can not be processed`)}if(p.every(G=>G.every(z=>z.every(j=>j.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const y=p.reduce((G,z)=>{const j=z.reduce((T,x)=>{const P=x.filter(S=>S.duration>0);return P.length>0?[...T,P]:T},[]);return j.length>0?[...G,j]:G},[]),m=((c=f.meta)==null?void 0:c.frameRate)??30,w=((h=f.meta)==null?void 0:h.resolution)??1080,Q=((u=f.meta)==null?void 0:u.transitionDuration)??1/3,D=B0(y,Q),R=Pn(D),M=await Promise.all(y.map((G,z)=>{const j=Pn(D[z]),T=Pn(D.slice(0,z));return Promise.all(G.map((x,P)=>Promise.all(x.map(async({duration:S,captions:b,elements:L},H)=>{var O,q;const X=await n(),re=await n(),ne=await n(),Be=await n(),ge=Br(L),we=Pn([...D.slice(0,z),...D[z].slice(0,P),...D[z][P].slice(0,H)]);return{draw:async({canvas:pe,currentTime:xe})=>{const Te=Math.max(0,xe-T),Ue=Math.max(0,xe-we);await ya({yoga:d,debug:i,canvas:pe,cropCanvas:X,posterCanvas:Be,letterboxCanvas:re,elements:L,currentTime:xe,contentTime:Te,sceneTime:Ue,totalDuration:R,contentDuration:j,sceneDuration:S}),b&&t&&g0({canvas:pe,dx:0,dy:0,dw:pe.width,dh:pe.height,vttCaptions:b,sceneTime:Ue+((ge==null?void 0:ge.meta.start)??0)})},duration:S,transitionCanvas:ne,id:I0(),start:we,video:ge==null?void 0:ge.video,videoMeta:ge==null?void 0:ge.meta,audio:{duration:S,src:(O=ge==null?void 0:ge.value)==null?void 0:O.src,start:(q=ge==null?void 0:ge.meta)==null?void 0:q.start}}}))))})),_=M.flatMap(G=>G);return{scenes:_.flatMap(G=>G),sections:_,contents:M,frameRate:m,resolution:w,transitionDuration:Q,fonts:g.fonts??[],duration:R}}const Ba="3",T0={version:"4.7.1"};function R0(s){const{publicApiUrl:e}=gn(s),t=Oi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function w0(s){var n,o,a,l,A,c,h,u,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Oi()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const r=Oi();return e||(e=R0(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Oi(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Oi(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function x0(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function D0(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};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());i[l]=a}}),{source:s,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:T0.version,templateVersion:Ba,...i}}const Kc=1;class L0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=x0(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=gn(this.host.env),{client:i,tab:r,request:n,visitor:o}=w0(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":D0(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Kc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Kc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Qa={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof mr<"u"&&mr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof mr<"u"&&mr||{},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(T){return T&&DataView.prototype.isPrototypeOf(T)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&c.indexOf(Object.prototype.toString.call(T))>-1};function u(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(T)||T==="")throw new TypeError('Invalid character in header field name: "'+T+'"');return T.toLowerCase()}function d(T){return typeof T!="string"&&(T=String(T)),T}function f(T){var x={next:function(){var P=T.shift();return{done:P===void 0,value:P}}};return l.iterable&&(x[Symbol.iterator]=function(){return x}),x}function g(T){this.map={},T instanceof g?T.forEach(function(x,P){this.append(P,x)},this):Array.isArray(T)?T.forEach(function(x){if(x.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+x.length);this.append(x[0],x[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(x){this.append(x,T[x])},this)}g.prototype.append=function(T,x){T=u(T),x=d(x);var P=this.map[T];this.map[T]=P?P+", "+x:x},g.prototype.delete=function(T){delete this.map[u(T)]},g.prototype.get=function(T){return T=u(T),this.has(T)?this.map[T]:null},g.prototype.has=function(T){return this.map.hasOwnProperty(u(T))},g.prototype.set=function(T,x){this.map[u(T)]=d(x)},g.prototype.forEach=function(T,x){for(var P in this.map)this.map.hasOwnProperty(P)&&T.call(x,this.map[P],P,this)},g.prototype.keys=function(){var T=[];return this.forEach(function(x,P){T.push(P)}),f(T)},g.prototype.values=function(){var T=[];return this.forEach(function(x){T.push(x)}),f(T)},g.prototype.entries=function(){var T=[];return this.forEach(function(x,P){T.push([P,x])}),f(T)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(T){if(!T._noBody){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}}function I(T){return new Promise(function(x,P){T.onload=function(){x(T.result)},T.onerror=function(){P(T.error)}})}function C(T){var x=new FileReader,P=I(x);return x.readAsArrayBuffer(T),P}function y(T){var x=new FileReader,P=I(x),S=/charset=([A-Za-z0-9_-]+)/.exec(T.type),b=S?S[1]:"utf-8";return x.readAsText(T,b),P}function m(T){for(var x=new Uint8Array(T),P=new Array(x.length),S=0;S<x.length;S++)P[S]=String.fromCharCode(x[S]);return P.join("")}function w(T){if(T.slice)return T.slice(0);var x=new Uint8Array(T.byteLength);return x.set(new Uint8Array(T)),x.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(T){this.bodyUsed=this.bodyUsed,this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:l.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:l.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():l.arrayBuffer&&l.blob&&A(T)?(this._bodyArrayBuffer=w(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=w(T):this._bodyText=T=Object.prototype.toString.call(T):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof T=="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(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var T=p(this);if(T)return T;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 T=p(this);return T||(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(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var T=p(this);if(T)return T;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var D=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(T){var x=T.toUpperCase();return D.indexOf(x)>-1?x:T}function M(T,x){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var P=x.body;if(T instanceof M){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,x.headers||(this.headers=new g(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!P&&T._bodyInit!=null&&(P=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new g(x.headers)),this.method=R(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.signal||this.signal||function(){if("AbortController"in a){var L=new AbortController;return L.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(x.cache==="no-store"||x.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function _(T){var x=new FormData;return T.trim().split("&").forEach(function(P){if(P){var S=P.split("="),b=S.shift().replace(/\+/g," "),L=S.join("=").replace(/\+/g," ");x.append(decodeURIComponent(b),decodeURIComponent(L))}}),x}function Y(T){var x=new g,P=T.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(S){return S.indexOf(`
175
175
  `)===0?S.substr(1,S.length):S}).forEach(function(S){var b=S.split(":"),L=b.shift().trim();if(L){var H=b.join(":").trim();try{x.append(L,H)}catch(O){console.warn("Response "+O.message)}}}),x}Q.call(M.prototype);function G(T,x){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(x||(x={}),this.type="default",this.status=x.status===void 0?200:x.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=x.statusText===void 0?"":""+x.statusText,this.headers=new g(x.headers),this.url=x.url||"",this._initBody(T)}Q.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},G.error=function(){var T=new G(null,{status:200,statusText:""});return T.ok=!1,T.status=0,T.type="error",T};var z=[301,302,303,307,308];G.redirect=function(T,x){if(z.indexOf(x)===-1)throw new RangeError("Invalid status code");return new G(null,{status:x,headers:{location:T}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(x,P){this.message=x,this.name=P;var S=Error(x);this.stack=S.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function j(T,x){return new Promise(function(P,S){var b=new M(T,x);if(b.signal&&b.signal.aborted)return S(new o.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function H(){L.abort()}L.onload=function(){var X={statusText:L.statusText,headers:Y(L.getAllResponseHeaders()||"")};b.url.indexOf("file://")===0&&(L.status<200||L.status>599)?X.status=200:X.status=L.status,X.url="responseURL"in L?L.responseURL:X.headers.get("X-Request-URL");var re="response"in L?L.response:L.responseText;setTimeout(function(){P(new G(re,X))},0)},L.onerror=function(){setTimeout(function(){S(new TypeError("Network request failed"))},0)},L.ontimeout=function(){setTimeout(function(){S(new TypeError("Network request timed out"))},0)},L.onabort=function(){setTimeout(function(){S(new o.DOMException("Aborted","AbortError"))},0)};function O(X){try{return X===""&&a.location.href?a.location.href:X}catch{return X}}if(L.open(b.method,O(b.url),!0),b.credentials==="include"?L.withCredentials=!0:b.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&(l.blob?L.responseType="blob":l.arrayBuffer&&(L.responseType="arraybuffer")),x&&typeof x.headers=="object"&&!(x.headers instanceof g||a.Headers&&x.headers instanceof a.Headers)){var q=[];Object.getOwnPropertyNames(x.headers).forEach(function(X){q.push(u(X)),L.setRequestHeader(X,d(x.headers[X]))}),b.headers.forEach(function(X,re){q.indexOf(re)===-1&&L.setRequestHeader(re,X)})}else b.headers.forEach(function(X,re){L.setRequestHeader(re,X)});b.signal&&(b.signal.addEventListener("abort",H),L.onreadystatechange=function(){L.readyState===4&&b.signal.removeEventListener("abort",H)}),L.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=g,a.Request=M,a.Response=G),o.Headers=g,o.Request=M,o.Response=G,o.fetch=j,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(Qa,Qa.exports);var _0=Qa.exports;const Vc=Jp(_0);async function k0(s){var e;try{if((e=await Vc(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Sa({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>k0(o));e=(await Promise.all(n)).find(Boolean)}return e}async function M0(s){try{return(await Vc(s)).text()}catch{return null}}async function P0(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?M0(s):s}const F0=zt(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=i==null?void 0:i.split("-"))==null?void 0:n[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:s},l=(r&&a[r])??s;return l?P0(l):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})}),N0=zt(async s=>{var e,t,i,r,n,o,a,l,A,c,h;const[u,d,f]=await Promise.all([Sa({sources:[(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input]}),Sa({sources:[(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist]}),Sa({sources:[((l=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:h.xs)]})]);return{src:u,playlist:d,preview:f}},{cacheKey:([s])=>{var e,t,i,r,n,o,a,l,A,c,h;return JSON.stringify({video:(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,input:(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,playlist:(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist,preview:((l=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:h.xs)})}});function Jc(s){var e,t,i,r,n,o,a,l,A,c,h,u;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((n=(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)==null?void 0:n.trim())??"",f=((l=(a=(o=s==null?void 0:s.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((u=(h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:h.name)==null?void 0:u.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const O0=zt(async(s,e,t)=>{var i,r,n;const o=(i=e==null?void 0:e.answer)==null?void 0:i.id;return((n=(r=s==null?void 0:s.questions)==null?void 0:r.items)==null?void 0:n.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([s,e,t])=>{var i;return JSON.stringify({index:t,rootData:e,allQuestions:(i=s==null?void 0:s.questions)==null?void 0:i.items})}});async function ba({data:s,rootData:e,index:t},i){var r,n,o,a,l,A,c,h,u,d,f,g,p,I,C,y,m,w,Q,D,R,M,_;const[Y,G,z]=await Promise.all([O0(s,e,t),N0(e),F0({original:((n=(r=e==null?void 0:e.answer)==null?void 0:r.media)==null?void 0:n.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)??((h=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:h.translation),originalLanguage:(d=(u=e==null?void 0:e.answer)==null?void 0:u.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},i)]),j=Jc(e);return{...G,...j,key:Y,captions:z,answerLabel:((I=e==null?void 0:e.answer)==null?void 0:I.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((w=(m=(y=(C=s==null?void 0:s.questions)==null?void 0:C.items)==null?void 0:y[t-1])==null?void 0:m.answer)==null?void 0:w.label)??((R=(D=(Q=s==null?void 0:s.questions)==null?void 0:Q.items)==null?void 0:D[t-1])==null?void 0:R.title)??null:null,isFirstInstanceOfName:t?((_=(M=s==null?void 0:s.questions)==null?void 0:M.items)==null?void 0:_.findIndex(T=>Jc(T).name===j.name))===t:!0}}const Fn={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 U0({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,l,A,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(A=(l=r==null?void 0:r.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&Fn[u]&&!i.find(f=>f.value===u)&&i.push({value:u,label:Fn[u]}),d&&Fn[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:Fn[d]}),i},[]))??[]}/**
176
176
  * @license
177
177
  * Copyright 2018 Google LLC
@@ -171,7 +171,7 @@ ${e}`,Xp=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zp=Objec
171
171
  "playlist": {{ it._derived?.playlist }},
172
172
  "preview": {{ it._derived?.preview }},
173
173
  "captions": {{ it._derived?.captions }}
174
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"}};async function C0(){const s=new Image;return s.crossOrigin="anonymous",s}const Hc=Xt(async function(e,t=C0){return e?new Promise((i,r)=>{t().then(n=>{n.onload=()=>{i(n)},n.onerror=o=>{r(o)},n.src=e})}):null});async function ya({element:s,meta:e,imageFactory:t},i,r){var n,o,a;let l={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((n=A==null?void 0:A.value)!=null&&n.src||(o=A==null?void 0:A.value)!=null&&o.playlist)){const c=await i(A.value,e);let h;try{h=await Hc(A.value.poster,t)}catch{h=null}l={...l,node:{...A,video:c,poster:h,meta:await r(A.value,c.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let c;try{c=await Hc(A.value,t)}catch{c=null}l={...l,node:{...A,image:c}}}return l.node&&((a=s.node)!=null&&a.elements)&&(l.node.elements=await Promise.all(s.node.elements.map(c=>ya({element:c,meta:e,imageFactory:t},i,r)))),s.elements&&(l.elements=await Promise.all(s.elements.map(c=>ya({element:c,meta:e,imageFactory:t},i,r)))),l}async function y0(){return document.createElement("canvas")}function vr(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=vr(t==null?void 0:t.elements);if(i)return i}}function v0(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},l)=>r===s.length-1&&o===i.length-1&&l===n.length-1?a:a-e))],[])}function B0(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Q0(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Mn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const S0=Xt(()=>Sc.loadYoga());ua.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Q0(s)}"`:B0(s)||Array.isArray(s)?JSON.stringify(s):s);const bs=(s,e,t)=>ua.render(s,e,ua.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Ts({data:s,template:e,burnCaptions:t=!1,debug:i=!1,imageFactory:r,canvasFactory:n=y0},o,a,l){var A,c,h,u;const d=await S0(),f=e??I0;if(!((A=f.templates)!=null&&A.length))throw new Error(`No templates found for template instance: ${f.id}`);let g=f.templates.find(({version:G})=>G===va);if(!g){const G=f.templates.map(({version:z})=>`"${z}"`).join(", ");console.warn(`Template renderer expects template version "${va}" but got ${G}`),g=f.templates[f.templates.length-1]}const p=await Promise.all(g.content.map(async({scenes:G,root:z})=>{const j={...f.options,...s,intro:f.intro,outro:f.outro};async function T(D,P){return Promise.all(G.map(async({layout:S,duration:b,data:L,derived:H,options:O})=>{var q,X,re;const ne={...j,_index:P,_root:D,_derived:await o({data:s,rootData:D,index:P})},Be=L?JSON.parse(await bs(L,ne)):{},ge=H?JSON.parse(await bs(H,ne)):{},we=O?JSON.parse(await bs(O,ne)):{},ae=b?parseFloat(await bs(b,ne)):NaN,pe=(q=g.layouts.find(le=>le.name===S))==null?void 0:q.tree;if(!pe)throw new Error(`Layout tree "${S}" not found in template "${g.id}" layouts.`);const De=JSON.parse(await bs(pe,{...Be,...ge,...we})),Te=await Promise.all(De.flatMap(le=>ya({element:le,meta:f.meta,imageFactory:r},a,l))),$e=vr(Te);return{duration:(isNaN(ae)?null:ae)??((X=$e==null?void 0:$e.meta)==null?void 0:X.duration)??0,captions:(re=$e==null?void 0:$e.meta)==null?void 0:re.captions,elements:Te}}))}if(z){const D=JSON.parse(await bs(z,j));return Array.isArray(D)?Promise.all(D.map(async(P,S)=>T(P,S))):Promise.all([T(D,null)])}return Promise.all([T(s,null)])}));if(p.every(G=>G.every(z=>z.every(j=>{const T=vr(j.elements);return!(T!=null&&T.value.src)&&!(T!=null&&T.value.playlist)})))){const G=p.flatMap(z=>z.flatMap(j=>j.map(T=>{const D=vr(T.elements);return!(D!=null&&D.value.src)&&!(D!=null&&D.value.playlist)&&(D==null?void 0:D.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${G} failed to load, video can not be processed`)}if(p.every(G=>G.every(z=>z.every(j=>j.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const y=p.reduce((G,z)=>{const j=z.reduce((T,D)=>{const P=D.filter(S=>S.duration>0);return P.length>0?[...T,P]:T},[]);return j.length>0?[...G,j]:G},[]),m=((c=f.meta)==null?void 0:c.frameRate)??30,w=((h=f.meta)==null?void 0:h.resolution)??1080,Q=((u=f.meta)==null?void 0:u.transitionDuration)??1/3,x=v0(y,Q),R=Mn(x),M=await Promise.all(y.map((G,z)=>{const j=Mn(x[z]),T=Mn(x.slice(0,z));return Promise.all(G.map((D,P)=>Promise.all(D.map(async({duration:S,captions:b,elements:L},H)=>{var O,q;const X=await n(),re=await n(),ne=await n(),Be=await n(),ge=vr(L),we=Mn([...x.slice(0,z),...x[z].slice(0,P),...x[z][P].slice(0,H)]);return{draw:async({canvas:pe,currentTime:De})=>{const Te=Math.max(0,De-T),$e=Math.max(0,De-we);await Ca({yoga:d,debug:i,canvas:pe,cropCanvas:X,posterCanvas:Be,letterboxCanvas:re,elements:L,currentTime:De,contentTime:Te,sceneTime:$e,totalDuration:R,contentDuration:j,sceneDuration:S}),b&&t&&f0({canvas:pe,dx:0,dy:0,dw:pe.width,dh:pe.height,vttCaptions:b,sceneTime:$e+((ge==null?void 0:ge.meta.start)??0)})},duration:S,transitionCanvas:ne,id:m0(),start:we,video:ge==null?void 0:ge.video,videoMeta:ge==null?void 0:ge.meta,audio:{duration:S,src:(O=ge==null?void 0:ge.value)==null?void 0:O.src,start:(q=ge==null?void 0:ge.meta)==null?void 0:q.start}}}))))})),_=M.flatMap(G=>G);return{scenes:_.flatMap(G=>G),sections:_,contents:M,frameRate:m,resolution:w,transitionDuration:Q,fonts:g.fonts??[],duration:R}}const va="3",b0={version:"4.7.0"};function T0(s){const{publicApiUrl:e}=fn(s),t=Oi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function R0(s){var n,o,a,l,A,c,h,u,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Oi()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const r=Oi();return e||(e=T0(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Oi(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Oi(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function w0(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function D0(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};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());i[l]=a}}),{source:s,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:b0.version,templateVersion:va,...i}}const Yc=1;class x0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=w0(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=fn(this.host.env),{client:i,tab:r,request:n,visitor:o}=R0(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":D0(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Yc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Yc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Ba={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Er<"u"&&Er,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof Er<"u"&&Er||{},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(T){return T&&DataView.prototype.isPrototypeOf(T)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&c.indexOf(Object.prototype.toString.call(T))>-1};function u(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(T)||T==="")throw new TypeError('Invalid character in header field name: "'+T+'"');return T.toLowerCase()}function d(T){return typeof T!="string"&&(T=String(T)),T}function f(T){var D={next:function(){var P=T.shift();return{done:P===void 0,value:P}}};return l.iterable&&(D[Symbol.iterator]=function(){return D}),D}function g(T){this.map={},T instanceof g?T.forEach(function(D,P){this.append(P,D)},this):Array.isArray(T)?T.forEach(function(D){if(D.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+D.length);this.append(D[0],D[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(D){this.append(D,T[D])},this)}g.prototype.append=function(T,D){T=u(T),D=d(D);var P=this.map[T];this.map[T]=P?P+", "+D:D},g.prototype.delete=function(T){delete this.map[u(T)]},g.prototype.get=function(T){return T=u(T),this.has(T)?this.map[T]:null},g.prototype.has=function(T){return this.map.hasOwnProperty(u(T))},g.prototype.set=function(T,D){this.map[u(T)]=d(D)},g.prototype.forEach=function(T,D){for(var P in this.map)this.map.hasOwnProperty(P)&&T.call(D,this.map[P],P,this)},g.prototype.keys=function(){var T=[];return this.forEach(function(D,P){T.push(P)}),f(T)},g.prototype.values=function(){var T=[];return this.forEach(function(D){T.push(D)}),f(T)},g.prototype.entries=function(){var T=[];return this.forEach(function(D,P){T.push([P,D])}),f(T)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(T){if(!T._noBody){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}}function I(T){return new Promise(function(D,P){T.onload=function(){D(T.result)},T.onerror=function(){P(T.error)}})}function C(T){var D=new FileReader,P=I(D);return D.readAsArrayBuffer(T),P}function y(T){var D=new FileReader,P=I(D),S=/charset=([A-Za-z0-9_-]+)/.exec(T.type),b=S?S[1]:"utf-8";return D.readAsText(T,b),P}function m(T){for(var D=new Uint8Array(T),P=new Array(D.length),S=0;S<D.length;S++)P[S]=String.fromCharCode(D[S]);return P.join("")}function w(T){if(T.slice)return T.slice(0);var D=new Uint8Array(T.byteLength);return D.set(new Uint8Array(T)),D.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(T){this.bodyUsed=this.bodyUsed,this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:l.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:l.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():l.arrayBuffer&&l.blob&&A(T)?(this._bodyArrayBuffer=w(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=w(T):this._bodyText=T=Object.prototype.toString.call(T):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof T=="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(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var T=p(this);if(T)return T;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 T=p(this);return T||(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(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var T=p(this);if(T)return T;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(T){var D=T.toUpperCase();return x.indexOf(D)>-1?D:T}function M(T,D){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var P=D.body;if(T instanceof M){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,D.headers||(this.headers=new g(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!P&&T._bodyInit!=null&&(P=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new g(D.headers)),this.method=R(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal||function(){if("AbortController"in a){var L=new AbortController;return L.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function _(T){var D=new FormData;return T.trim().split("&").forEach(function(P){if(P){var S=P.split("="),b=S.shift().replace(/\+/g," "),L=S.join("=").replace(/\+/g," ");D.append(decodeURIComponent(b),decodeURIComponent(L))}}),D}function Y(T){var D=new g,P=T.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(S){return S.indexOf(`
174
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"}};async function C0(){const s=new Image;return s.crossOrigin="anonymous",s}const Hc=Xt(async function(e,t=C0){return e?new Promise((i,r)=>{t().then(n=>{n.onload=()=>{i(n)},n.onerror=o=>{r(o)},n.src=e})}):null});async function ya({element:s,meta:e,imageFactory:t},i,r){var n,o,a;let l={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((n=A==null?void 0:A.value)!=null&&n.src||(o=A==null?void 0:A.value)!=null&&o.playlist)){const c=await i(A.value,e);let h;try{h=await Hc(A.value.poster,t)}catch{h=null}l={...l,node:{...A,video:c,poster:h,meta:await r(A.value,c.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let c;try{c=await Hc(A.value,t)}catch{c=null}l={...l,node:{...A,image:c}}}return l.node&&((a=s.node)!=null&&a.elements)&&(l.node.elements=await Promise.all(s.node.elements.map(c=>ya({element:c,meta:e,imageFactory:t},i,r)))),s.elements&&(l.elements=await Promise.all(s.elements.map(c=>ya({element:c,meta:e,imageFactory:t},i,r)))),l}async function y0(){return document.createElement("canvas")}function vr(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=vr(t==null?void 0:t.elements);if(i)return i}}function v0(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},l)=>r===s.length-1&&o===i.length-1&&l===n.length-1?a:a-e))],[])}function B0(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Q0(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Mn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const S0=Xt(()=>Sc.loadYoga());ua.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Q0(s)}"`:B0(s)||Array.isArray(s)?JSON.stringify(s):s);const bs=(s,e,t)=>ua.render(s,e,ua.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Ts({data:s,template:e,burnCaptions:t=!1,debug:i=!1,imageFactory:r,canvasFactory:n=y0},o,a,l){var A,c,h,u;const d=await S0(),f=e??I0;if(!((A=f.templates)!=null&&A.length))throw new Error(`No templates found for template instance: ${f.id}`);let g=f.templates.find(({version:G})=>G===va);if(!g){const G=f.templates.map(({version:z})=>`"${z}"`).join(", ");console.warn(`Template renderer expects template version "${va}" but got ${G}`),g=f.templates[f.templates.length-1]}const p=await Promise.all(g.content.map(async({scenes:G,root:z})=>{const j={...f.options,...s,intro:f.intro,outro:f.outro};async function T(D,P){return Promise.all(G.map(async({layout:S,duration:b,data:L,derived:H,options:O})=>{var q,X,re;const ne={...j,_index:P,_root:D,_derived:await o({data:s,rootData:D,index:P})},Be=L?JSON.parse(await bs(L,ne)):{},ge=H?JSON.parse(await bs(H,ne)):{},we=O?JSON.parse(await bs(O,ne)):{},ae=b?parseFloat(await bs(b,ne)):NaN,pe=(q=g.layouts.find(le=>le.name===S))==null?void 0:q.tree;if(!pe)throw new Error(`Layout tree "${S}" not found in template "${g.id}" layouts.`);const De=JSON.parse(await bs(pe,{...Be,...ge,...we})),Te=await Promise.all(De.flatMap(le=>ya({element:le,meta:f.meta,imageFactory:r},a,l))),$e=vr(Te);return{duration:(isNaN(ae)?null:ae)??((X=$e==null?void 0:$e.meta)==null?void 0:X.duration)??0,captions:(re=$e==null?void 0:$e.meta)==null?void 0:re.captions,elements:Te}}))}if(z){const D=JSON.parse(await bs(z,j));return Array.isArray(D)?Promise.all(D.map(async(P,S)=>T(P,S))):Promise.all([T(D,null)])}return Promise.all([T(s,null)])}));if(p.every(G=>G.every(z=>z.every(j=>{const T=vr(j.elements);return!(T!=null&&T.value.src)&&!(T!=null&&T.value.playlist)})))){const G=p.flatMap(z=>z.flatMap(j=>j.map(T=>{const D=vr(T.elements);return!(D!=null&&D.value.src)&&!(D!=null&&D.value.playlist)&&(D==null?void 0:D.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${G} failed to load, video can not be processed`)}if(p.every(G=>G.every(z=>z.every(j=>j.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const y=p.reduce((G,z)=>{const j=z.reduce((T,D)=>{const P=D.filter(S=>S.duration>0);return P.length>0?[...T,P]:T},[]);return j.length>0?[...G,j]:G},[]),m=((c=f.meta)==null?void 0:c.frameRate)??30,w=((h=f.meta)==null?void 0:h.resolution)??1080,Q=((u=f.meta)==null?void 0:u.transitionDuration)??1/3,x=v0(y,Q),R=Mn(x),M=await Promise.all(y.map((G,z)=>{const j=Mn(x[z]),T=Mn(x.slice(0,z));return Promise.all(G.map((D,P)=>Promise.all(D.map(async({duration:S,captions:b,elements:L},H)=>{var O,q;const X=await n(),re=await n(),ne=await n(),Be=await n(),ge=vr(L),we=Mn([...x.slice(0,z),...x[z].slice(0,P),...x[z][P].slice(0,H)]);return{draw:async({canvas:pe,currentTime:De})=>{const Te=Math.max(0,De-T),$e=Math.max(0,De-we);await Ca({yoga:d,debug:i,canvas:pe,cropCanvas:X,posterCanvas:Be,letterboxCanvas:re,elements:L,currentTime:De,contentTime:Te,sceneTime:$e,totalDuration:R,contentDuration:j,sceneDuration:S}),b&&t&&f0({canvas:pe,dx:0,dy:0,dw:pe.width,dh:pe.height,vttCaptions:b,sceneTime:$e+((ge==null?void 0:ge.meta.start)??0)})},duration:S,transitionCanvas:ne,id:m0(),start:we,video:ge==null?void 0:ge.video,videoMeta:ge==null?void 0:ge.meta,audio:{duration:S,src:(O=ge==null?void 0:ge.value)==null?void 0:O.src,start:(q=ge==null?void 0:ge.meta)==null?void 0:q.start}}}))))})),_=M.flatMap(G=>G);return{scenes:_.flatMap(G=>G),sections:_,contents:M,frameRate:m,resolution:w,transitionDuration:Q,fonts:g.fonts??[],duration:R}}const va="3",b0={version:"4.7.1"};function T0(s){const{publicApiUrl:e}=fn(s),t=Oi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function R0(s){var n,o,a,l,A,c,h,u,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Oi()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const r=Oi();return e||(e=T0(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Oi(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=Oi(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function w0(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function D0(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};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());i[l]=a}}),{source:s,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:b0.version,templateVersion:va,...i}}const Yc=1;class x0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=w0(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=fn(this.host.env),{client:i,tab:r,request:n,visitor:o}=R0(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":D0(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Yc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Yc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Ba={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Er<"u"&&Er,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof Er<"u"&&Er||{},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(T){return T&&DataView.prototype.isPrototypeOf(T)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&c.indexOf(Object.prototype.toString.call(T))>-1};function u(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(T)||T==="")throw new TypeError('Invalid character in header field name: "'+T+'"');return T.toLowerCase()}function d(T){return typeof T!="string"&&(T=String(T)),T}function f(T){var D={next:function(){var P=T.shift();return{done:P===void 0,value:P}}};return l.iterable&&(D[Symbol.iterator]=function(){return D}),D}function g(T){this.map={},T instanceof g?T.forEach(function(D,P){this.append(P,D)},this):Array.isArray(T)?T.forEach(function(D){if(D.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+D.length);this.append(D[0],D[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(D){this.append(D,T[D])},this)}g.prototype.append=function(T,D){T=u(T),D=d(D);var P=this.map[T];this.map[T]=P?P+", "+D:D},g.prototype.delete=function(T){delete this.map[u(T)]},g.prototype.get=function(T){return T=u(T),this.has(T)?this.map[T]:null},g.prototype.has=function(T){return this.map.hasOwnProperty(u(T))},g.prototype.set=function(T,D){this.map[u(T)]=d(D)},g.prototype.forEach=function(T,D){for(var P in this.map)this.map.hasOwnProperty(P)&&T.call(D,this.map[P],P,this)},g.prototype.keys=function(){var T=[];return this.forEach(function(D,P){T.push(P)}),f(T)},g.prototype.values=function(){var T=[];return this.forEach(function(D){T.push(D)}),f(T)},g.prototype.entries=function(){var T=[];return this.forEach(function(D,P){T.push([P,D])}),f(T)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(T){if(!T._noBody){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}}function I(T){return new Promise(function(D,P){T.onload=function(){D(T.result)},T.onerror=function(){P(T.error)}})}function C(T){var D=new FileReader,P=I(D);return D.readAsArrayBuffer(T),P}function y(T){var D=new FileReader,P=I(D),S=/charset=([A-Za-z0-9_-]+)/.exec(T.type),b=S?S[1]:"utf-8";return D.readAsText(T,b),P}function m(T){for(var D=new Uint8Array(T),P=new Array(D.length),S=0;S<D.length;S++)P[S]=String.fromCharCode(D[S]);return P.join("")}function w(T){if(T.slice)return T.slice(0);var D=new Uint8Array(T.byteLength);return D.set(new Uint8Array(T)),D.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(T){this.bodyUsed=this.bodyUsed,this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:l.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:l.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():l.arrayBuffer&&l.blob&&A(T)?(this._bodyArrayBuffer=w(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=w(T):this._bodyText=T=Object.prototype.toString.call(T):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof T=="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(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var T=p(this);if(T)return T;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 T=p(this);return T||(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(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var T=p(this);if(T)return T;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(T){var D=T.toUpperCase();return x.indexOf(D)>-1?D:T}function M(T,D){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var P=D.body;if(T instanceof M){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,D.headers||(this.headers=new g(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!P&&T._bodyInit!=null&&(P=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new g(D.headers)),this.method=R(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal||function(){if("AbortController"in a){var L=new AbortController;return L.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function _(T){var D=new FormData;return T.trim().split("&").forEach(function(P){if(P){var S=P.split("="),b=S.shift().replace(/\+/g," "),L=S.join("=").replace(/\+/g," ");D.append(decodeURIComponent(b),decodeURIComponent(L))}}),D}function Y(T){var D=new g,P=T.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(S){return S.indexOf(`
175
175
  `)===0?S.substr(1,S.length):S}).forEach(function(S){var b=S.split(":"),L=b.shift().trim();if(L){var H=b.join(":").trim();try{D.append(L,H)}catch(O){console.warn("Response "+O.message)}}}),D}Q.call(M.prototype);function G(T,D){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(D||(D={}),this.type="default",this.status=D.status===void 0?200:D.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=D.statusText===void 0?"":""+D.statusText,this.headers=new g(D.headers),this.url=D.url||"",this._initBody(T)}Q.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},G.error=function(){var T=new G(null,{status:200,statusText:""});return T.ok=!1,T.status=0,T.type="error",T};var z=[301,302,303,307,308];G.redirect=function(T,D){if(z.indexOf(D)===-1)throw new RangeError("Invalid status code");return new G(null,{status:D,headers:{location:T}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(D,P){this.message=D,this.name=P;var S=Error(D);this.stack=S.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function j(T,D){return new Promise(function(P,S){var b=new M(T,D);if(b.signal&&b.signal.aborted)return S(new o.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function H(){L.abort()}L.onload=function(){var X={statusText:L.statusText,headers:Y(L.getAllResponseHeaders()||"")};b.url.indexOf("file://")===0&&(L.status<200||L.status>599)?X.status=200:X.status=L.status,X.url="responseURL"in L?L.responseURL:X.headers.get("X-Request-URL");var re="response"in L?L.response:L.responseText;setTimeout(function(){P(new G(re,X))},0)},L.onerror=function(){setTimeout(function(){S(new TypeError("Network request failed"))},0)},L.ontimeout=function(){setTimeout(function(){S(new TypeError("Network request timed out"))},0)},L.onabort=function(){setTimeout(function(){S(new o.DOMException("Aborted","AbortError"))},0)};function O(X){try{return X===""&&a.location.href?a.location.href:X}catch{return X}}if(L.open(b.method,O(b.url),!0),b.credentials==="include"?L.withCredentials=!0:b.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&(l.blob?L.responseType="blob":l.arrayBuffer&&(L.responseType="arraybuffer")),D&&typeof D.headers=="object"&&!(D.headers instanceof g||a.Headers&&D.headers instanceof a.Headers)){var q=[];Object.getOwnPropertyNames(D.headers).forEach(function(X){q.push(u(X)),L.setRequestHeader(X,d(D.headers[X]))}),b.headers.forEach(function(X,re){q.indexOf(re)===-1&&L.setRequestHeader(re,X)})}else b.headers.forEach(function(X,re){L.setRequestHeader(re,X)});b.signal&&(b.signal.addEventListener("abort",H),L.onreadystatechange=function(){L.readyState===4&&b.signal.removeEventListener("abort",H)}),L.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=g,a.Request=M,a.Response=G),o.Headers=g,o.Request=M,o.Response=G,o.fetch=j,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(Ba,Ba.exports);var L0=Ba.exports;const Kc=Vp(L0);async function _0(s){var e;try{if((e=await Kc(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Qa({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>_0(o));e=(await Promise.all(n)).find(Boolean)}return e}async function k0(s){try{return(await Kc(s)).text()}catch{return null}}async function M0(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?k0(s):s}const P0=Xt(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=i==null?void 0:i.split("-"))==null?void 0:n[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:s},l=(r&&a[r])??s;return l?M0(l):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})}),F0=Xt(async s=>{var e,t,i,r,n,o,a,l,A,c,h;const[u,d,f]=await Promise.all([Qa({sources:[(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input]}),Qa({sources:[(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist]}),Qa({sources:[((l=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:h.xs)]})]);return{src:u,playlist:d,preview:f}},{cacheKey:([s])=>{var e,t,i,r,n,o,a,l,A,c,h;return JSON.stringify({video:(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,input:(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,playlist:(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist,preview:((l=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:h.xs)})}});function Vc(s){var e,t,i,r,n,o,a,l,A,c,h,u;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((n=(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)==null?void 0:n.trim())??"",f=((l=(a=(o=s==null?void 0:s.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((u=(h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:h.name)==null?void 0:u.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const N0=Xt(async(s,e,t)=>{var i,r,n;const o=(i=e==null?void 0:e.answer)==null?void 0:i.id;return((n=(r=s==null?void 0:s.questions)==null?void 0:r.items)==null?void 0:n.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([s,e,t])=>{var i;return JSON.stringify({index:t,rootData:e,allQuestions:(i=s==null?void 0:s.questions)==null?void 0:i.items})}});async function Sa({data:s,rootData:e,index:t},i){var r,n,o,a,l,A,c,h,u,d,f,g,p,I,C,y,m,w,Q,x,R,M,_;const[Y,G,z]=await Promise.all([N0(s,e,t),F0(e),P0({original:((n=(r=e==null?void 0:e.answer)==null?void 0:r.media)==null?void 0:n.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)??((h=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:h.translation),originalLanguage:(d=(u=e==null?void 0:e.answer)==null?void 0:u.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},i)]),j=Vc(e);return{...G,...j,key:Y,captions:z,answerLabel:((I=e==null?void 0:e.answer)==null?void 0:I.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((w=(m=(y=(C=s==null?void 0:s.questions)==null?void 0:C.items)==null?void 0:y[t-1])==null?void 0:m.answer)==null?void 0:w.label)??((R=(x=(Q=s==null?void 0:s.questions)==null?void 0:Q.items)==null?void 0:x[t-1])==null?void 0:R.title)??null:null,isFirstInstanceOfName:t?((_=(M=s==null?void 0:s.questions)==null?void 0:M.items)==null?void 0:_.findIndex(T=>Vc(T).name===j.name))===t:!0}}const Pn={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 O0({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,l,A,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(A=(l=r==null?void 0:r.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&Pn[u]&&!i.find(f=>f.value===u)&&i.push({value:u,label:Pn[u]}),d&&Pn[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:Pn[d]}),i},[]))??[]}/**
176
176
  * @license
177
177
  * Copyright 2018 Google LLC
@@ -171,7 +171,7 @@ ${e}`,$p=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hp=Objec
171
171
  "playlist": {{ it._derived?.playlist }},
172
172
  "preview": {{ it._derived?.preview }},
173
173
  "captions": {{ it._derived?.captions }}
174
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"}};async function h0(){const s=new Image;return s.crossOrigin="anonymous",s}const Mc=Jt(async function(e,t=h0){return e?new Promise((i,r)=>{t().then(n=>{n.onload=()=>{i(n)},n.onerror=o=>{r(o)},n.src=e})}):null});async function fa({element:s,meta:e,imageFactory:t},i,r){var n,o,a;let l={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((n=A==null?void 0:A.value)!=null&&n.src||(o=A==null?void 0:A.value)!=null&&o.playlist)){const c=await i(A.value,e);let h;try{h=await Mc(A.value.poster,t)}catch{h=null}l={...l,node:{...A,video:c,poster:h,meta:await r(A.value,c.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let c;try{c=await Mc(A.value,t)}catch{c=null}l={...l,node:{...A,image:c}}}return l.node&&((a=s.node)!=null&&a.elements)&&(l.node.elements=await Promise.all(s.node.elements.map(c=>fa({element:c,meta:e,imageFactory:t},i,r)))),s.elements&&(l.elements=await Promise.all(s.elements.map(c=>fa({element:c,meta:e,imageFactory:t},i,r)))),l}async function u0(){return document.createElement("canvas")}function Ir(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=Ir(t==null?void 0:t.elements);if(i)return i}}function d0(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},l)=>r===s.length-1&&o===i.length-1&&l===n.length-1?a:a-e))],[])}function f0(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function g0(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function wn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const p0=Jt(()=>Ec.loadYoga());na.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${g0(s)}"`:f0(s)||Array.isArray(s)?JSON.stringify(s):s);const Bs=(s,e,t)=>na.render(s,e,na.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Qs({data:s,template:e,burnCaptions:t=!1,debug:i=!1,imageFactory:r,canvasFactory:n=u0},o,a,l){var A,c,h,u;const d=await p0(),f=e??c0;if(!((A=f.templates)!=null&&A.length))throw new Error(`No templates found for template instance: ${f.id}`);let g=f.templates.find(({version:$})=>$===ga);if(!g){const $=f.templates.map(({version:X})=>`"${X}"`).join(", ");console.warn(`Template renderer expects template version "${ga}" but got ${$}`),g=f.templates[f.templates.length-1]}const p=await Promise.all(g.content.map(async({scenes:$,root:X})=>{const q={...f.options,...s,intro:f.intro,outro:f.outro};async function T(D,P){return Promise.all($.map(async({layout:S,duration:b,data:L,derived:H,options:O})=>{var W,j,re;const ne={...q,_index:P,_root:D,_derived:await o({data:s,rootData:D,index:P})},ve=L?JSON.parse(await Bs(L,ne)):{},ge=H?JSON.parse(await Bs(H,ne)):{},we=O?JSON.parse(await Bs(O,ne)):{},ae=b?parseFloat(await Bs(b,ne)):NaN,pe=(W=g.layouts.find(le=>le.name===S))==null?void 0:W.tree;if(!pe)throw new Error(`Layout tree "${S}" not found in template "${g.id}" layouts.`);const De=JSON.parse(await Bs(pe,{...ve,...ge,...we})),Te=await Promise.all(De.flatMap(le=>fa({element:le,meta:f.meta,imageFactory:r},a,l))),Ue=Ir(Te);return{duration:(isNaN(ae)?null:ae)??((j=Ue==null?void 0:Ue.meta)==null?void 0:j.duration)??0,captions:(re=Ue==null?void 0:Ue.meta)==null?void 0:re.captions,elements:Te}}))}if(X){const D=JSON.parse(await Bs(X,q));return Array.isArray(D)?Promise.all(D.map(async(P,S)=>T(P,S))):Promise.all([T(D,null)])}return Promise.all([T(s,null)])}));if(p.every($=>$.every(X=>X.every(q=>{const T=Ir(q.elements);return!(T!=null&&T.value.src)&&!(T!=null&&T.value.playlist)})))){const $=p.flatMap(X=>X.flatMap(q=>q.map(T=>{const D=Ir(T.elements);return!(D!=null&&D.value.src)&&!(D!=null&&D.value.playlist)&&(D==null?void 0:D.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${$} failed to load, video can not be processed`)}if(p.every($=>$.every(X=>X.every(q=>q.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const y=p.reduce(($,X)=>{const q=X.reduce((T,D)=>{const P=D.filter(S=>S.duration>0);return P.length>0?[...T,P]:T},[]);return q.length>0?[...$,q]:$},[]),m=((c=f.meta)==null?void 0:c.frameRate)??30,w=((h=f.meta)==null?void 0:h.resolution)??1080,Q=((u=f.meta)==null?void 0:u.transitionDuration)??1/3,x=d0(y,Q),R=wn(x),M=await Promise.all(y.map(($,X)=>{const q=wn(x[X]),T=wn(x.slice(0,X));return Promise.all($.map((D,P)=>Promise.all(D.map(async({duration:S,captions:b,elements:L},H)=>{var O,W;const j=await n(),re=await n(),ne=await n(),ve=await n(),ge=Ir(L),we=wn([...x.slice(0,X),...x[X].slice(0,P),...x[X][P].slice(0,H)]);return{draw:async({canvas:pe,currentTime:De})=>{const Te=Math.max(0,De-T),Ue=Math.max(0,De-we);await da({yoga:d,debug:i,canvas:pe,cropCanvas:j,posterCanvas:ve,letterboxCanvas:re,elements:L,currentTime:De,contentTime:Te,sceneTime:Ue,totalDuration:R,contentDuration:q,sceneDuration:S}),b&&t&&n0({canvas:pe,dx:0,dy:0,dw:pe.width,dh:pe.height,vttCaptions:b,sceneTime:Ue+((ge==null?void 0:ge.meta.start)??0)})},duration:S,transitionCanvas:ne,id:A0(),start:we,video:ge==null?void 0:ge.video,videoMeta:ge==null?void 0:ge.meta,audio:{duration:S,src:(O=ge==null?void 0:ge.value)==null?void 0:O.src,start:(W=ge==null?void 0:ge.meta)==null?void 0:W.start}}}))))})),_=M.flatMap($=>$);return{scenes:_.flatMap($=>$),sections:_,contents:M,frameRate:m,resolution:w,transitionDuration:Q,fonts:g.fonts??[],duration:R}}const ga="3",E0={version:"4.7.0"};function m0(s){const{publicApiUrl:e}=ln(s),t=is();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function I0(s){var n,o,a,l,A,c,h,u,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:is()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const r=is();return e||(e=m0(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=is(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=is(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function C0(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function y0(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};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());i[l]=a}}),{source:s,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:E0.version,templateVersion:ga,...i}}const Pc=1;class v0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=C0(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=ln(this.host.env),{client:i,tab:r,request:n,visitor:o}=I0(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":y0(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Pc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Pc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var pa={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof fr<"u"&&fr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof fr<"u"&&fr||{},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(T){return T&&DataView.prototype.isPrototypeOf(T)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&c.indexOf(Object.prototype.toString.call(T))>-1};function u(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(T)||T==="")throw new TypeError('Invalid character in header field name: "'+T+'"');return T.toLowerCase()}function d(T){return typeof T!="string"&&(T=String(T)),T}function f(T){var D={next:function(){var P=T.shift();return{done:P===void 0,value:P}}};return l.iterable&&(D[Symbol.iterator]=function(){return D}),D}function g(T){this.map={},T instanceof g?T.forEach(function(D,P){this.append(P,D)},this):Array.isArray(T)?T.forEach(function(D){if(D.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+D.length);this.append(D[0],D[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(D){this.append(D,T[D])},this)}g.prototype.append=function(T,D){T=u(T),D=d(D);var P=this.map[T];this.map[T]=P?P+", "+D:D},g.prototype.delete=function(T){delete this.map[u(T)]},g.prototype.get=function(T){return T=u(T),this.has(T)?this.map[T]:null},g.prototype.has=function(T){return this.map.hasOwnProperty(u(T))},g.prototype.set=function(T,D){this.map[u(T)]=d(D)},g.prototype.forEach=function(T,D){for(var P in this.map)this.map.hasOwnProperty(P)&&T.call(D,this.map[P],P,this)},g.prototype.keys=function(){var T=[];return this.forEach(function(D,P){T.push(P)}),f(T)},g.prototype.values=function(){var T=[];return this.forEach(function(D){T.push(D)}),f(T)},g.prototype.entries=function(){var T=[];return this.forEach(function(D,P){T.push([P,D])}),f(T)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(T){if(!T._noBody){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}}function I(T){return new Promise(function(D,P){T.onload=function(){D(T.result)},T.onerror=function(){P(T.error)}})}function C(T){var D=new FileReader,P=I(D);return D.readAsArrayBuffer(T),P}function y(T){var D=new FileReader,P=I(D),S=/charset=([A-Za-z0-9_-]+)/.exec(T.type),b=S?S[1]:"utf-8";return D.readAsText(T,b),P}function m(T){for(var D=new Uint8Array(T),P=new Array(D.length),S=0;S<D.length;S++)P[S]=String.fromCharCode(D[S]);return P.join("")}function w(T){if(T.slice)return T.slice(0);var D=new Uint8Array(T.byteLength);return D.set(new Uint8Array(T)),D.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(T){this.bodyUsed=this.bodyUsed,this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:l.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:l.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():l.arrayBuffer&&l.blob&&A(T)?(this._bodyArrayBuffer=w(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=w(T):this._bodyText=T=Object.prototype.toString.call(T):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof T=="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(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var T=p(this);if(T)return T;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 T=p(this);return T||(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(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var T=p(this);if(T)return T;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(T){var D=T.toUpperCase();return x.indexOf(D)>-1?D:T}function M(T,D){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var P=D.body;if(T instanceof M){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,D.headers||(this.headers=new g(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!P&&T._bodyInit!=null&&(P=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new g(D.headers)),this.method=R(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal||function(){if("AbortController"in a){var L=new AbortController;return L.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function _(T){var D=new FormData;return T.trim().split("&").forEach(function(P){if(P){var S=P.split("="),b=S.shift().replace(/\+/g," "),L=S.join("=").replace(/\+/g," ");D.append(decodeURIComponent(b),decodeURIComponent(L))}}),D}function Y(T){var D=new g,P=T.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(S){return S.indexOf(`
174
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"}};async function h0(){const s=new Image;return s.crossOrigin="anonymous",s}const Mc=Jt(async function(e,t=h0){return e?new Promise((i,r)=>{t().then(n=>{n.onload=()=>{i(n)},n.onerror=o=>{r(o)},n.src=e})}):null});async function fa({element:s,meta:e,imageFactory:t},i,r){var n,o,a;let l={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((n=A==null?void 0:A.value)!=null&&n.src||(o=A==null?void 0:A.value)!=null&&o.playlist)){const c=await i(A.value,e);let h;try{h=await Mc(A.value.poster,t)}catch{h=null}l={...l,node:{...A,video:c,poster:h,meta:await r(A.value,c.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let c;try{c=await Mc(A.value,t)}catch{c=null}l={...l,node:{...A,image:c}}}return l.node&&((a=s.node)!=null&&a.elements)&&(l.node.elements=await Promise.all(s.node.elements.map(c=>fa({element:c,meta:e,imageFactory:t},i,r)))),s.elements&&(l.elements=await Promise.all(s.elements.map(c=>fa({element:c,meta:e,imageFactory:t},i,r)))),l}async function u0(){return document.createElement("canvas")}function Ir(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=Ir(t==null?void 0:t.elements);if(i)return i}}function d0(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},l)=>r===s.length-1&&o===i.length-1&&l===n.length-1?a:a-e))],[])}function f0(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function g0(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function wn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const p0=Jt(()=>Ec.loadYoga());na.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${g0(s)}"`:f0(s)||Array.isArray(s)?JSON.stringify(s):s);const Bs=(s,e,t)=>na.render(s,e,na.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Qs({data:s,template:e,burnCaptions:t=!1,debug:i=!1,imageFactory:r,canvasFactory:n=u0},o,a,l){var A,c,h,u;const d=await p0(),f=e??c0;if(!((A=f.templates)!=null&&A.length))throw new Error(`No templates found for template instance: ${f.id}`);let g=f.templates.find(({version:$})=>$===ga);if(!g){const $=f.templates.map(({version:X})=>`"${X}"`).join(", ");console.warn(`Template renderer expects template version "${ga}" but got ${$}`),g=f.templates[f.templates.length-1]}const p=await Promise.all(g.content.map(async({scenes:$,root:X})=>{const q={...f.options,...s,intro:f.intro,outro:f.outro};async function T(D,P){return Promise.all($.map(async({layout:S,duration:b,data:L,derived:H,options:O})=>{var W,j,re;const ne={...q,_index:P,_root:D,_derived:await o({data:s,rootData:D,index:P})},ve=L?JSON.parse(await Bs(L,ne)):{},ge=H?JSON.parse(await Bs(H,ne)):{},we=O?JSON.parse(await Bs(O,ne)):{},ae=b?parseFloat(await Bs(b,ne)):NaN,pe=(W=g.layouts.find(le=>le.name===S))==null?void 0:W.tree;if(!pe)throw new Error(`Layout tree "${S}" not found in template "${g.id}" layouts.`);const De=JSON.parse(await Bs(pe,{...ve,...ge,...we})),Te=await Promise.all(De.flatMap(le=>fa({element:le,meta:f.meta,imageFactory:r},a,l))),Ue=Ir(Te);return{duration:(isNaN(ae)?null:ae)??((j=Ue==null?void 0:Ue.meta)==null?void 0:j.duration)??0,captions:(re=Ue==null?void 0:Ue.meta)==null?void 0:re.captions,elements:Te}}))}if(X){const D=JSON.parse(await Bs(X,q));return Array.isArray(D)?Promise.all(D.map(async(P,S)=>T(P,S))):Promise.all([T(D,null)])}return Promise.all([T(s,null)])}));if(p.every($=>$.every(X=>X.every(q=>{const T=Ir(q.elements);return!(T!=null&&T.value.src)&&!(T!=null&&T.value.playlist)})))){const $=p.flatMap(X=>X.flatMap(q=>q.map(T=>{const D=Ir(T.elements);return!(D!=null&&D.value.src)&&!(D!=null&&D.value.playlist)&&(D==null?void 0:D.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${$} failed to load, video can not be processed`)}if(p.every($=>$.every(X=>X.every(q=>q.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const y=p.reduce(($,X)=>{const q=X.reduce((T,D)=>{const P=D.filter(S=>S.duration>0);return P.length>0?[...T,P]:T},[]);return q.length>0?[...$,q]:$},[]),m=((c=f.meta)==null?void 0:c.frameRate)??30,w=((h=f.meta)==null?void 0:h.resolution)??1080,Q=((u=f.meta)==null?void 0:u.transitionDuration)??1/3,x=d0(y,Q),R=wn(x),M=await Promise.all(y.map(($,X)=>{const q=wn(x[X]),T=wn(x.slice(0,X));return Promise.all($.map((D,P)=>Promise.all(D.map(async({duration:S,captions:b,elements:L},H)=>{var O,W;const j=await n(),re=await n(),ne=await n(),ve=await n(),ge=Ir(L),we=wn([...x.slice(0,X),...x[X].slice(0,P),...x[X][P].slice(0,H)]);return{draw:async({canvas:pe,currentTime:De})=>{const Te=Math.max(0,De-T),Ue=Math.max(0,De-we);await da({yoga:d,debug:i,canvas:pe,cropCanvas:j,posterCanvas:ve,letterboxCanvas:re,elements:L,currentTime:De,contentTime:Te,sceneTime:Ue,totalDuration:R,contentDuration:q,sceneDuration:S}),b&&t&&n0({canvas:pe,dx:0,dy:0,dw:pe.width,dh:pe.height,vttCaptions:b,sceneTime:Ue+((ge==null?void 0:ge.meta.start)??0)})},duration:S,transitionCanvas:ne,id:A0(),start:we,video:ge==null?void 0:ge.video,videoMeta:ge==null?void 0:ge.meta,audio:{duration:S,src:(O=ge==null?void 0:ge.value)==null?void 0:O.src,start:(W=ge==null?void 0:ge.meta)==null?void 0:W.start}}}))))})),_=M.flatMap($=>$);return{scenes:_.flatMap($=>$),sections:_,contents:M,frameRate:m,resolution:w,transitionDuration:Q,fonts:g.fonts??[],duration:R}}const ga="3",E0={version:"4.7.1"};function m0(s){const{publicApiUrl:e}=ln(s),t=is();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function I0(s){var n,o,a,l,A,c,h,u,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:is()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),i=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const r=is();return e||(e=m0(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=is(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),i||(i=is(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function C0(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function y0(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};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());i[l]=a}}),{source:s,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:E0.version,templateVersion:ga,...i}}const Pc=1;class v0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=C0(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,senderId:this.host.senderId,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=ln(this.host.env),{client:i,tab:r,request:n,visitor:o}=I0(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":y0(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Pc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Pc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var pa={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof fr<"u"&&fr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof fr<"u"&&fr||{},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(T){return T&&DataView.prototype.isPrototypeOf(T)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&c.indexOf(Object.prototype.toString.call(T))>-1};function u(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(T)||T==="")throw new TypeError('Invalid character in header field name: "'+T+'"');return T.toLowerCase()}function d(T){return typeof T!="string"&&(T=String(T)),T}function f(T){var D={next:function(){var P=T.shift();return{done:P===void 0,value:P}}};return l.iterable&&(D[Symbol.iterator]=function(){return D}),D}function g(T){this.map={},T instanceof g?T.forEach(function(D,P){this.append(P,D)},this):Array.isArray(T)?T.forEach(function(D){if(D.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+D.length);this.append(D[0],D[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function(D){this.append(D,T[D])},this)}g.prototype.append=function(T,D){T=u(T),D=d(D);var P=this.map[T];this.map[T]=P?P+", "+D:D},g.prototype.delete=function(T){delete this.map[u(T)]},g.prototype.get=function(T){return T=u(T),this.has(T)?this.map[T]:null},g.prototype.has=function(T){return this.map.hasOwnProperty(u(T))},g.prototype.set=function(T,D){this.map[u(T)]=d(D)},g.prototype.forEach=function(T,D){for(var P in this.map)this.map.hasOwnProperty(P)&&T.call(D,this.map[P],P,this)},g.prototype.keys=function(){var T=[];return this.forEach(function(D,P){T.push(P)}),f(T)},g.prototype.values=function(){var T=[];return this.forEach(function(D){T.push(D)}),f(T)},g.prototype.entries=function(){var T=[];return this.forEach(function(D,P){T.push([P,D])}),f(T)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(T){if(!T._noBody){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}}function I(T){return new Promise(function(D,P){T.onload=function(){D(T.result)},T.onerror=function(){P(T.error)}})}function C(T){var D=new FileReader,P=I(D);return D.readAsArrayBuffer(T),P}function y(T){var D=new FileReader,P=I(D),S=/charset=([A-Za-z0-9_-]+)/.exec(T.type),b=S?S[1]:"utf-8";return D.readAsText(T,b),P}function m(T){for(var D=new Uint8Array(T),P=new Array(D.length),S=0;S<D.length;S++)P[S]=String.fromCharCode(D[S]);return P.join("")}function w(T){if(T.slice)return T.slice(0);var D=new Uint8Array(T.byteLength);return D.set(new Uint8Array(T)),D.buffer}function Q(){return this.bodyUsed=!1,this._initBody=function(T){this.bodyUsed=this.bodyUsed,this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:l.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:l.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():l.arrayBuffer&&l.blob&&A(T)?(this._bodyArrayBuffer=w(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=w(T):this._bodyText=T=Object.prototype.toString.call(T):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof T=="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(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var T=p(this);if(T)return T;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 T=p(this);return T||(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(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var T=p(this);if(T)return T;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function R(T){var D=T.toUpperCase();return x.indexOf(D)>-1?D:T}function M(T,D){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var P=D.body;if(T instanceof M){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,D.headers||(this.headers=new g(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!P&&T._bodyInit!=null&&(P=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new g(D.headers)),this.method=R(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal||function(){if("AbortController"in a){var L=new AbortController;return L.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function _(T){var D=new FormData;return T.trim().split("&").forEach(function(P){if(P){var S=P.split("="),b=S.shift().replace(/\+/g," "),L=S.join("=").replace(/\+/g," ");D.append(decodeURIComponent(b),decodeURIComponent(L))}}),D}function Y(T){var D=new g,P=T.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(S){return S.indexOf(`
175
175
  `)===0?S.substr(1,S.length):S}).forEach(function(S){var b=S.split(":"),L=b.shift().trim();if(L){var H=b.join(":").trim();try{D.append(L,H)}catch(O){console.warn("Response "+O.message)}}}),D}Q.call(M.prototype);function $(T,D){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(D||(D={}),this.type="default",this.status=D.status===void 0?200:D.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=D.statusText===void 0?"":""+D.statusText,this.headers=new g(D.headers),this.url=D.url||"",this._initBody(T)}Q.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},$.error=function(){var T=new $(null,{status:200,statusText:""});return T.ok=!1,T.status=0,T.type="error",T};var X=[301,302,303,307,308];$.redirect=function(T,D){if(X.indexOf(D)===-1)throw new RangeError("Invalid status code");return new $(null,{status:D,headers:{location:T}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(D,P){this.message=D,this.name=P;var S=Error(D);this.stack=S.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function q(T,D){return new Promise(function(P,S){var b=new M(T,D);if(b.signal&&b.signal.aborted)return S(new o.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function H(){L.abort()}L.onload=function(){var j={statusText:L.statusText,headers:Y(L.getAllResponseHeaders()||"")};b.url.indexOf("file://")===0&&(L.status<200||L.status>599)?j.status=200:j.status=L.status,j.url="responseURL"in L?L.responseURL:j.headers.get("X-Request-URL");var re="response"in L?L.response:L.responseText;setTimeout(function(){P(new $(re,j))},0)},L.onerror=function(){setTimeout(function(){S(new TypeError("Network request failed"))},0)},L.ontimeout=function(){setTimeout(function(){S(new TypeError("Network request timed out"))},0)},L.onabort=function(){setTimeout(function(){S(new o.DOMException("Aborted","AbortError"))},0)};function O(j){try{return j===""&&a.location.href?a.location.href:j}catch{return j}}if(L.open(b.method,O(b.url),!0),b.credentials==="include"?L.withCredentials=!0:b.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&(l.blob?L.responseType="blob":l.arrayBuffer&&(L.responseType="arraybuffer")),D&&typeof D.headers=="object"&&!(D.headers instanceof g||a.Headers&&D.headers instanceof a.Headers)){var W=[];Object.getOwnPropertyNames(D.headers).forEach(function(j){W.push(u(j)),L.setRequestHeader(j,d(D.headers[j]))}),b.headers.forEach(function(j,re){W.indexOf(re)===-1&&L.setRequestHeader(re,j)})}else b.headers.forEach(function(j,re){L.setRequestHeader(re,j)});b.signal&&(b.signal.addEventListener("abort",H),L.onreadystatechange=function(){L.readyState===4&&b.signal.removeEventListener("abort",H)}),L.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return q.polyfill=!0,a.fetch||(a.fetch=q,a.Headers=g,a.Request=M,a.Response=$),o.Headers=g,o.Request=M,o.Response=$,o.fetch=q,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(pa,pa.exports);var B0=pa.exports;const Nc=Np(B0);async function Q0(s){var e;try{if((e=await Nc(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Ea({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>Q0(o));e=(await Promise.all(n)).find(Boolean)}return e}async function S0(s){try{return(await Nc(s)).text()}catch{return null}}async function b0(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?S0(s):s}const T0=Jt(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=i==null?void 0:i.split("-"))==null?void 0:n[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:s},l=(r&&a[r])??s;return l?b0(l):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})}),R0=Jt(async s=>{var e,t,i,r,n,o,a,l,A,c,h;const[u,d,f]=await Promise.all([Ea({sources:[(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input]}),Ea({sources:[(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist]}),Ea({sources:[((l=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:h.xs)]})]);return{src:u,playlist:d,preview:f}},{cacheKey:([s])=>{var e,t,i,r,n,o,a,l,A,c,h;return JSON.stringify({video:(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,input:(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,playlist:(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist,preview:((l=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:h.xs)})}});function Fc(s){var e,t,i,r,n,o,a,l,A,c,h,u;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((n=(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)==null?void 0:n.trim())??"",f=((l=(a=(o=s==null?void 0:s.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((u=(h=(c=(A=s==null?void 0:s.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:h.name)==null?void 0:u.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const w0=Jt(async(s,e,t)=>{var i,r,n;const o=(i=e==null?void 0:e.answer)==null?void 0:i.id;return((n=(r=s==null?void 0:s.questions)==null?void 0:r.items)==null?void 0:n.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([s,e,t])=>{var i;return JSON.stringify({index:t,rootData:e,allQuestions:(i=s==null?void 0:s.questions)==null?void 0:i.items})}});async function ma({data:s,rootData:e,index:t},i){var r,n,o,a,l,A,c,h,u,d,f,g,p,I,C,y,m,w,Q,x,R,M,_;const[Y,$,X]=await Promise.all([w0(s,e,t),R0(e),T0({original:((n=(r=e==null?void 0:e.answer)==null?void 0:r.media)==null?void 0:n.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)??((h=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:h.translation),originalLanguage:(d=(u=e==null?void 0:e.answer)==null?void 0:u.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},i)]),q=Fc(e);return{...$,...q,key:Y,captions:X,answerLabel:((I=e==null?void 0:e.answer)==null?void 0:I.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((w=(m=(y=(C=s==null?void 0:s.questions)==null?void 0:C.items)==null?void 0:y[t-1])==null?void 0:m.answer)==null?void 0:w.label)??((R=(x=(Q=s==null?void 0:s.questions)==null?void 0:Q.items)==null?void 0:x[t-1])==null?void 0:R.title)??null:null,isFirstInstanceOfName:t?((_=(M=s==null?void 0:s.questions)==null?void 0:M.items)==null?void 0:_.findIndex(T=>Fc(T).name===q.name))===t:!0}}const Dn={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 D0({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,l,A,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(A=(l=r==null?void 0:r.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&Dn[u]&&!i.find(f=>f.value===u)&&i.push({value:u,label:Dn[u]}),d&&Dn[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:Dn[d]}),i},[]))??[]}/**
176
176
  * @license
177
177
  * Copyright 2018 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/embeds-legacy",
3
- "version": "4.7.0",
3
+ "version": "4.7.1",
4
4
  "license": "MIT",
5
5
  "author": "Aaron Williams",
6
6
  "main": "dist/es/embeds-legacy.js",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@a11y/focus-trap": "^1.0.5",
49
49
  "@lit/task": "^1.0.2",
50
- "@vouchfor/canvas-video-legacy": "^9.5.0",
50
+ "@vouchfor/canvas-video-legacy": "^9.6.0",
51
51
  "@vouchfor/media-player-legacy": "^5.6.0",
52
52
  "uuid": "^9.0.1"
53
53
  },