@sprig-technologies/sprig-browser 2.22.4 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var gi=Object.defineProperty;var vi=(e,t,n)=>t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t,n)=>(vi(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var he=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(he||{}),j=(e=>(e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e))(j||{}),br=(e=>(e.SurveyId="survey.id",e))(br||{});const mn={SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};var oe=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(oe||{}),Me=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Me||{});let mt;const wi=new Uint8Array(16);function _i(){if(!mt&&(mt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!mt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mt(wi)}const K=[];for(let e=0;e<256;++e)K.push((e+256).toString(16).slice(1));function yi(e,t=0){return(K[e[t+0]]+K[e[t+1]]+K[e[t+2]]+K[e[t+3]]+"-"+K[e[t+4]]+K[e[t+5]]+"-"+K[e[t+6]]+K[e[t+7]]+"-"+K[e[t+8]]+K[e[t+9]]+"-"+K[e[t+10]]+K[e[t+11]]+K[e[t+12]]+K[e[t+13]]+K[e[t+14]]+K[e[t+15]]).toLowerCase()}const bi=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Dn={randomUUID:bi};function Be(e,t,n){if(Dn.randomUUID&&!t&&!e)return Dn.randomUUID();e=e||{};const r=e.random||(e.rng||_i)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return yi(r)}const ze="ul-app";var C=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e))(C||{});const hn="#e6e6e6",rt="#bd282a",xi=500,Ci=1030;var J=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(J||{});const xr=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},ki=()=>{const e=xr();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Si=()=>{const e=xr();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Ei=Object.freeze(Object.defineProperty({__proto__:null,enable:ki,disable:Si},Symbol.toStringTag,{value:"Module"})),An=[Ei];class Jt{static disable(){An.forEach(t=>t.disable())}static enable(){An.forEach(t=>t.enable())}}const Li=1,We=e=>e instanceof HTMLElement,Ii=e=>e instanceof HTMLInputElement,ot=e=>e instanceof HTMLTextAreaElement,Cr=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=C.CustomStyle,e.head.appendChild(r)},kr=e=>{const t=e.querySelector(`.${C.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const o=getComputedStyle(t),i=parseFloat(o.marginTop)+parseFloat(o.marginBottom),s=parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth);r=i+s}return n+r+Li},Ui=e=>{const t=e.querySelector(`.${C.CardContainer}`);t&&(t.scrollTop=0)};var tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ti(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pi(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Sr={},Pt={},ct={};Object.defineProperty(ct,"__esModule",{value:!0});ct.MemoryLeakError=void 0;class Ri extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}ct.MemoryLeakError=Ri;Object.defineProperty(Pt,"__esModule",{value:!0});Pt.Emitter=void 0;const Di=ct;class Rt{constructor(){this.events=new Map,this.maxListeners=Rt.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...o)=>{this.removeListener(t,r),n.apply(this,o)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(o=>{o.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const o=new Di.MemoryLeakError(this,t,this.listenerCount(t));console.warn(o)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const o=[n].concat(r);this.events.set(t,o)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}Pt.Emitter=Rt;Rt.defaultMaxListeners=10;(function(e){var t=tt&&tt.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=tt&&tt.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(Pt,e),n(ct,e)})(Sr);const F=new Sr.Emitter;var nt=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(nt||{}),fe=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(fe||{}),Fe=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Fe||{}),Ie=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(Ie||{});const Ct=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),qe=({"userleap-platform":e})=>e!==Fe.Web,W=(e,t)=>{const n=t?C.MobileSuffix:C.DesktopSuffix;return[e+n,e]},_e=(e,t)=>[e,`${e}__${t}`];class Ai{constructor(t){te(this,"payload");te(this,"promise");te(this,"reject",()=>{});te(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const ji={RATELIMIT_RESET_DEFAULT:10};let Er=!1,Lr="",ht=!1,gt=[];const Oi=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?Ie.Gtm:e._segment?Ie.Segment:Ie.Snippet,Xt=(e="")=>{Er=!0,Lr=e};function dt(e={}){const t={"Content-Type":"application/json","userleap-platform":Fe.Web,"x-ul-sdk-version":"2.22.4",[fe.InstallationMethod]:Oi(e)};if(e.envId&&(t[fe.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[fe.UserID]=e.userId),e.visitorId&&(t[fe.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[fe.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[fe.PreviewMode]="1"),t}const jn=async(e,t,n)=>{if(e)return{status:429};{const r=new Ai(n);return gt.push(r),r.promise}},ge=async(e,t,n=0,r=!1,o=!1)=>{const i={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(ht&&!o)return jn(r,o,i);const s={ok:!1,reportError:!1};if(Er)return console.info(`UserLeap - ${Lr}`),s;try{t.headers=Object.assign(dt(),t.headers);const a=await fetch(e,t);if(a.status===429)if(!ht&&!r||o){ht=!0;const d=a.headers.has("ratelimit-reset")?Number(a.headers.get("ratelimit-reset")):ji.RATELIMIT_RESET_DEFAULT;return await Ct(d*1e3),ge(e,t,0,r,!0)}else return jn(r,!1,i);if(ht=!1,gt.length&&(gt.map(c=>{const{url:d,options:l,attempt:m,shouldDropOnRateLimit:p}=c.payload;ge(d,l,m,p).then(f=>{c.resolveRequest(f)})}),gt=[]),a.ok){if(a.status===249)return Xt(),s;const c=await a.text();try{return c&&c!=="OK"&&(a.json=JSON.parse(c)),a}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${c}`)}}}return a}catch(a){const c=n+1;return c>5?{ok:!1,reportError:!1,error:a}:(await Ct(Math.pow(2,n)*1e3),ge(e,t,c))}};var Ir={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(tt,function(){var n=function(i,s){if(s=s||{},typeof i!="function")throw new o("fetch must be a function");if(typeof s!="object")throw new o("defaults must be an object");if(s.retries!==void 0&&!r(s.retries))throw new o("retries must be a positive integer");if(s.retryDelay!==void 0&&!r(s.retryDelay)&&typeof s.retryDelay!="function")throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(s.retryOn!==void 0&&!Array.isArray(s.retryOn)&&typeof s.retryOn!="function")throw new o("retryOn property expects an array or function");var a={retries:3,retryDelay:1e3,retryOn:[]};return s=Object.assign(a,s),function(d,l){var m=s.retries,p=s.retryDelay,f=s.retryOn;if(l&&l.retries!==void 0)if(r(l.retries))m=l.retries;else throw new o("retries must be a positive integer");if(l&&l.retryDelay!==void 0)if(r(l.retryDelay)||typeof l.retryDelay=="function")p=l.retryDelay;else throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(l&&l.retryOn)if(Array.isArray(l.retryOn)||typeof l.retryOn=="function")f=l.retryOn;else throw new o("retryOn property expects an array or function");return new Promise(function(h,g){var v=function(_){var S=typeof Request<"u"&&d instanceof Request?d.clone():d;i(S,l).then(function(b){if(Array.isArray(f)&&f.indexOf(b.status)===-1)h(b);else if(typeof f=="function")try{return Promise.resolve(f(_,null,b)).then(function(E){E?w(_,null,b):h(b)}).catch(g)}catch(E){g(E)}else _<m?w(_,null,b):h(b)}).catch(function(b){if(typeof f=="function")try{Promise.resolve(f(_,b,null)).then(function(E){E?w(_,b,null):g(b)}).catch(function(E){g(E)})}catch(E){g(E)}else _<m?w(_,b,null):g(b)})};function w(_,S,b){var E=typeof p=="function"?p(_,S,b):p;setTimeout(function(){v(++_)},E)}v(0)})}};function r(i){return Number.isInteger(i)&&i>=0}function o(i){this.name="ArgumentError",this.message=i}return n})})(Ir);const Mi=Ir.exports;class Ni{constructor(t){te(this,"awaitingResolvers",[]);te(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const Ur=new Ni(2),Vi=e=>Ur.setLimit(e),Bi=Mi(fetch),Fi=async(e,t=3)=>Ur.execute(async()=>{const r=(await Bi(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:o=>Math.pow(2,o)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),$i=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:o,responseGroupUuid:i})=>ge(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:i,surveyId:t}),headers:o}),Hi=(e,t)=>t.some(n=>e instanceof n);let On,Mn;function zi(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function qi(){return Mn||(Mn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Tr=new WeakMap,en=new WeakMap,Pr=new WeakMap,Nt=new WeakMap,gn=new WeakMap;function Wi(e){const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{n(Ue(e.result)),o()},s=()=>{r(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(n=>{n instanceof IDBCursor&&Tr.set(n,e)}).catch(()=>{}),gn.set(t,e),t}function Gi(e){if(en.has(e))return;const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{n(),o()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});en.set(e,t)}let tn={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return en.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Pr.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ue(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Ki(e){tn=e(tn)}function Zi(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Vt(this),t,...n);return Pr.set(r,t.sort?t.sort():[t]),Ue(r)}:qi().includes(e)?function(...t){return e.apply(Vt(this),t),Ue(Tr.get(this))}:function(...t){return Ue(e.apply(Vt(this),t))}}function Yi(e){return typeof e=="function"?Zi(e):(e instanceof IDBTransaction&&Gi(e),Hi(e,zi())?new Proxy(e,tn):e)}function Ue(e){if(e instanceof IDBRequest)return Wi(e);if(Nt.has(e))return Nt.get(e);const t=Yi(e);return t!==e&&(Nt.set(e,t),gn.set(t,e)),t}const Vt=e=>gn.get(e);function Qi(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const s=indexedDB.open(e,t),a=Ue(s);return r&&s.addEventListener("upgradeneeded",c=>{r(Ue(s.result),c.oldVersion,c.newVersion,Ue(s.transaction),c)}),n&&s.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),o&&c.addEventListener("versionchange",d=>o(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const Ji=["get","getKey","getAll","getAllKeys","count"],Xi=["put","add","delete","clear"],Bt=new Map;function Nn(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Bt.get(t))return Bt.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=Xi.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(o||Ji.includes(n)))return;const i=async function(s,...a){const c=this.transaction(s,o?"readwrite":"readonly");let d=c.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),o&&c.done]))[0]};return Bt.set(t,i),i}Ki(e=>({...e,get:(t,n,r)=>Nn(t,n)||e.get(t,n,r),has:(t,n)=>!!Nn(t,n)||e.has(t,n)}));var we=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(we||{});const nn="sprig.sessionId",Rr="sprig.disableReplayRecording",N={name:"sprig.replay",version:1,tables:{events:{name:"events",indices:{session_timestamp:"session_timestamp",timestamp:"timestamp"}},chunkUploads:{name:"chunkUploads",indices:{timestamp:"timestamp",upload_status:"upload_status",session_status:"session_status",session_status_upload:"session_status_upload"}}}},es=()=>{sessionStorage.setItem(Rr,"disabled")},Dr=()=>!!sessionStorage.getItem(Rr),ts=()=>{const e=sessionStorage.getItem(nn);return e?(sessionStorage.removeItem(nn),e):Be()},de=ts();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(nn,de)});const ns=async()=>Qi(N.name,N.version,{upgrade:e=>{const t=e.createObjectStore(N.tables.events.name,{keyPath:"uuid"});t.createIndex(N.tables.events.indices.session_timestamp,["sessionId","timestamp"]),t.createIndex(N.tables.events.indices.timestamp,"timestamp");const n=e.createObjectStore(N.tables.chunkUploads.name,{keyPath:"uuid"});n.createIndex(N.tables.chunkUploads.indices.session_status,["sessionId","status"]),n.createIndex(N.tables.chunkUploads.indices.upload_status,["uploadId","status"]),n.createIndex(N.tables.chunkUploads.indices.session_status_upload,["sessionId","status","uploadId"]),n.createIndex(N.tables.chunkUploads.indices.timestamp,"timestamp")}}),ee=ns(),rs=async()=>{const e=await ee;return Promise.all([e.clear(N.tables.events.name),e.clear(N.tables.chunkUploads.name)])},os=async e=>{const n=(await ee).transaction(N.tables.events.name,"readwrite");return Promise.all([...e.map(r=>n.store.put({...r,sessionId:r.sessionId||de})),n.done])},is=async e=>await(await ee).getAllFromIndex(N.tables.events.name,N.tables.events.indices.session_timestamp,IDBKeyRange.bound([de,e],[de,Number.MAX_VALUE])),ss=async(e,t)=>(await ee).getAllKeysFromIndex(t,"timestamp",IDBKeyRange.upperBound(e-1)),Ar=async(e,t)=>{const r=(await ee).transaction(e,"readwrite");return Promise.all([...t.map(async o=>{try{await r.store.delete(o)}catch{}}),r.done])},jr=async(e,t)=>{const n=await ss(e,t);await Ar(t,n)},as=async e=>{await jr(e,N.tables.events.name)},ls=async e=>{await jr(e,N.tables.chunkUploads.name)},cs=async()=>{const t=await(await ee).getAllKeysFromIndex(N.tables.events.name,N.tables.events.indices.session_timestamp,IDBKeyRange.bound([de,Number.MIN_VALUE],[de,Number.MAX_VALUE]));await Promise.all([Ar(N.tables.events.name,t)])},ds=async e=>(await ee).put(N.tables.chunkUploads.name,{...e,sessionId:e.sessionId||de,etag:null}),us=async(e,t)=>{const n=await ee,r=await n.get(N.tables.chunkUploads.name,e);if(r)return n.put(N.tables.chunkUploads.name,{...r,data:null,etag:t,status:we.UploadComplete})},ps=async e=>await(await ee).countFromIndex(N.tables.chunkUploads.name,N.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,we.ReadyForUpload],[e,we.ReadyForUpload]))>0,fs=async()=>{const n=(await(await ee).getAllFromIndex(N.tables.chunkUploads.name,N.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([de,we.UploadComplete],[de,we.UploadComplete]))).reduce((i,s)=>(i.add(s.uploadId),i),new Set),r=Array.from(n),o=await Promise.all(r.map(async i=>ps(i)));return r.filter((i,s)=>!o[s])},ms=async({status:e,uploadId:t})=>(await ee).getAllKeysFromIndex(N.tables.chunkUploads.name,t?N.tables.chunkUploads.indices.upload_status:N.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([t||de,e],[t||de,e])),hs=async e=>(await ee).get(N.tables.chunkUploads.name,e),gs=async e=>(await ee).getAllFromIndex(N.tables.chunkUploads.name,N.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,we.UploadComplete],[e,we.UploadComplete])),vs=async(e,t,n)=>new Promise((r,o)=>{const i=e.createElement("script");i.src=t,i.onload=r,i.onerror=o,n&&(i.nonce=n),e.head.appendChild(i)});let Or=5e3;const ws=async(e,t,n,r=2,o)=>{if(!t)return;o!=null&&o.minDuration&&(Or=o.minDuration),Vi(r),Ss(),bs();const i=window;i.rrwebRecord||await vs(e,"https://cdn.sprig.com/dependencies/rrweb-record-2.0.0-alpha.6.min.js",n);const s=i.rrwebRecord;if(!s)return;let a=!0;s({checkoutEveryNms:30*1e3,sampling:{input:"last",scroll:250,media:800},emit:(c,d)=>{if(Dr())return;const l=a||!!d;a=!1,_s({uuid:Be(),event:JSON.stringify(c),isValidStart:l,timestamp:Date.now()})},...o})};let rn=!1,on=[];const _s=e=>{on.push(e),rn||ys()},ys=()=>{rn=!0,setTimeout(async()=>{if(Dr())return;const e=on;on=[],rn=!1;try{await os(e)}catch(t){Mr(t)}},500)},Mr=async e=>{es(),await rs(),e instanceof Error&&window.UserLeap.reportError("Error storing replay data",e)},bs=(e=30,t=6*60,n=30*60)=>{setInterval(async()=>{const r=Date.now();await Promise.all([as(r-t*1e3),ls(r-n*1e3)])},e*1e3)},xs=async e=>{const t=await is(Date.now()-e*1e3),n=t.findIndex(r=>r.isValidStart);return n<0?[]:t.slice(n)},Cs=async e=>{const t=`[${e.map(o=>o.event).join(",")}]`,r=new TextEncoder().encode(t);try{if(window.CompressionStream===void 0)return r;const o=new CompressionStream("gzip"),i=o.writable.getWriter();return i.write(r),i.close(),new Uint8Array(await new Response(o.readable).arrayBuffer())}catch(o){return o instanceof Error&&window.UserLeap.reportError("Error compressing replay for upload",o),r}},ks=(e,t,n)=>{const r=e.length,o=t*1024*1024,i=Math.ceil(r/n),s=Math.max(o,i),a=[];let c=0;for(;c<r;)a.push(e.slice(c,c+s)),c+=s;return a},Nr=async e=>{await Promise.all(e.map(async t=>{const n=await hs(t),r=await Fi(n);await us(n.uuid,r)}))},Vr=async e=>{const t=await gs(e);if(!t.length)return;t.sort((o,i)=>o.chunkIndex-i.chunkIndex);const n=t.map(o=>({ETag:o.etag,PartNumber:o.chunkIndex})).filter(o=>o.ETag!==null),r=t[0];await $i({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders})},Ss=async()=>{const e=await ms({status:we.ReadyForUpload});if(!e.length)return;await Nr(e);const t=await fs();await Promise.all(t.map(n=>Vr(n)))},Es=async(e,t)=>{await Nr(t),await Promise.all(e.map(n=>Vr(n)))},Ls=async(e,t,n,r,o,i)=>{await Is();const s=await xs(r.replayDurationSeconds);if(!s.length||s[s.length-1].timestamp-s[0].timestamp<=Or)return;const c=await Cs(s),d=ks(c,r.minimumChunkSizeMb,r.signedUrls.length),l=Date.now();let m=[];try{m=await Promise.all(d.map(async(p,f)=>{const h=Be();return await ds({uuid:h,chunkIndex:f+1,totalChunks:d.length,timestamp:l,surveyId:t,responseGroupId:e,status:we.ReadyForUpload,data:p,visitorId:n,uploadId:r.uploadId,uploadUrl:r.signedUrls[f].url,apiUrl:i,completeUploadHeaders:o}),h}))}catch(p){Mr(p);return}await Es([r.uploadId],m)};let kt=null;const Is=async()=>{kt&&await kt},Vn=async()=>(kt=cs(),kt);var ut,L,Br,Ge,je,Bn,Fr,$r,St={},Hr=[],Us=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function xe(e,t){for(var n in t)e[n]=t[n];return e}function zr(e){var t=e.parentNode;t&&t.removeChild(e)}function q(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?ut.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return it(e,s,r,o,null)}function it(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:o==null?++Br:o};return o==null&&L.vnode!=null&&L.vnode(i),i}function qr(){return{current:null}}function ue(e){return e.children}function Ts(e,t,n,r,o){var i;for(i in n)i==="children"||i==="key"||i in t||Et(e,i,null,n[i],r);for(i in t)o&&typeof t[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||n[i]===t[i]||Et(e,i,t[i],n[i],r)}function Fn(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Us.test(t)?n:n+"px"}function Et(e,t,n,r,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Fn(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Fn(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?Hn:$n,i):e.removeEventListener(t,i?Hn:$n,i);else if(t!=="dangerouslySetInnerHTML"){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,n))}}function $n(e){Ge=!0;try{return this.l[e.type+!1](L.event?L.event(e):e)}finally{Ge=!1}}function Hn(e){Ge=!0;try{return this.l[e.type+!0](L.event?L.event(e):e)}finally{Ge=!1}}function le(e,t){this.props=e,this.context=t}function at(e,t){if(t==null)return e.__?at(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?at(e):null}function Wr(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Wr(e)}}function Ps(e){Ge?setTimeout(e):Fr(e)}function sn(e){(!e.__d&&(e.__d=!0)&&je.push(e)&&!Lt.__r++||Bn!==L.debounceRendering)&&((Bn=L.debounceRendering)||Ps)(Lt)}function Lt(){var e,t,n,r,o,i,s,a;for(je.sort(function(c,d){return c.__v.__b-d.__v.__b});e=je.shift();)e.__d&&(t=je.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=xe({},i)).__v=i.__v+1,vn(a,i,o,n.__n,a.ownerSVGElement!==void 0,i.__h!=null?[s]:null,r,s==null?at(i):s,i.__h),Qr(r,i),i.__e!=s&&Wr(i)),je.length>t&&je.sort(function(c,d){return c.__v.__b-d.__v.__b}));Lt.__r=0}function Gr(e,t,n,r,o,i,s,a,c,d){var l,m,p,f,h,g,v,w=r&&r.__k||Hr,_=w.length;for(n.__k=[],l=0;l<t.length;l++)if((f=n.__k[l]=(f=t[l])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?it(null,f,null,null,f):Array.isArray(f)?it(ue,{children:f},null,null,null):f.__b>0?it(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(p=w[l])===null||p&&f.key==p.key&&f.type===p.type)w[l]=void 0;else for(m=0;m<_;m++){if((p=w[m])&&f.key==p.key&&f.type===p.type){w[m]=void 0;break}p=null}vn(e,f,p=p||St,o,i,s,a,c,d),h=f.__e,(m=f.ref)&&p.ref!=m&&(v||(v=[]),p.ref&&v.push(p.ref,null,f),v.push(m,f.__c||h,f)),h!=null?(g==null&&(g=h),typeof f.type=="function"&&f.__k===p.__k?f.__d=c=Kr(f,c,e):c=Zr(e,f,p,w,h,c),typeof n.type=="function"&&(n.__d=c)):c&&p.__e==c&&c.parentNode!=e&&(c=at(p))}for(n.__e=g,l=_;l--;)w[l]!=null&&(typeof n.type=="function"&&w[l].__e!=null&&w[l].__e==n.__d&&(n.__d=Yr(r).nextSibling),Xr(w[l],w[l]));if(v)for(l=0;l<v.length;l++)Jr(v[l],v[++l],v[++l])}function Kr(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t=typeof r.type=="function"?Kr(r,t,n):Zr(n,r,r,o,r.__e,t));return t}function Ce(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Ce(n,t)}):t.push(e)),t}function Zr(e,t,n,r,o,i){var s,a,c;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(n==null||o!=i||o.parentNode==null)e:if(i==null||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,c=0;(a=a.nextSibling)&&c<r.length;c+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function Yr(e){var t,n,r;if(e.type==null||typeof e.type=="string")return e.__e;if(e.__k){for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=Yr(n)))return r}return null}function vn(e,t,n,r,o,i,s,a,c){var d,l,m,p,f,h,g,v,w,_,S,b,E,D,x,P=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(d=L.__b)&&d(t);try{e:if(typeof P=="function"){if(v=t.props,w=(d=P.contextType)&&r[d.__c],_=d?w?w.props.value:d.__:r,n.__c?g=(l=t.__c=n.__c).__=l.__E:("prototype"in P&&P.prototype.render?t.__c=l=new P(v,_):(t.__c=l=new le(v,_),l.constructor=P,l.render=Ds),w&&w.sub(l),l.props=v,l.state||(l.state={}),l.context=_,l.__n=r,m=l.__d=!0,l.__h=[],l._sb=[]),l.__s==null&&(l.__s=l.state),P.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=xe({},l.__s)),xe(l.__s,P.getDerivedStateFromProps(v,l.__s))),p=l.props,f=l.state,l.__v=t,m)P.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(P.getDerivedStateFromProps==null&&v!==p&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(v,_),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(v,l.__s,_)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(l.props=v,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(T){T&&(T.__=t)}),S=0;S<l._sb.length;S++)l.__h.push(l._sb[S]);l._sb=[],l.__h.length&&s.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(v,l.__s,_),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(p,f,h)})}if(l.context=_,l.props=v,l.__P=e,b=L.__r,E=0,"prototype"in P&&P.prototype.render){for(l.state=l.__s,l.__d=!1,b&&b(t),d=l.render(l.props,l.state,l.context),D=0;D<l._sb.length;D++)l.__h.push(l._sb[D]);l._sb=[]}else do l.__d=!1,b&&b(t),d=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++E<25);l.state=l.__s,l.getChildContext!=null&&(r=xe(xe({},r),l.getChildContext())),m||l.getSnapshotBeforeUpdate==null||(h=l.getSnapshotBeforeUpdate(p,f)),x=d!=null&&d.type===ue&&d.key==null?d.props.children:d,Gr(e,Array.isArray(x)?x:[x],t,n,r,o,i,s,a,c),l.base=t.__e,t.__h=null,l.__h.length&&s.push(l),g&&(l.__E=l.__=null),l.__e=!1}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Rs(n.__e,t,n,r,o,i,s,c);(d=L.diffed)&&d(t)}catch(T){t.__v=null,(c||i!=null)&&(t.__e=a,t.__h=!!c,i[i.indexOf(a)]=null),L.__e(T,t,n)}}function Qr(e,t){L.__c&&L.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){L.__e(r,n.__v)}})}function Rs(e,t,n,r,o,i,s,a){var c,d,l,m=n.props,p=t.props,f=t.type,h=0;if(f==="svg"&&(o=!0),i!=null){for(;h<i.length;h++)if((c=i[h])&&"setAttribute"in c==!!f&&(f?c.localName===f:c.nodeType===3)){e=c,i[h]=null;break}}if(e==null){if(f===null)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,p.is&&p),i=null,a=!1}if(f===null)m===p||a&&e.data===p||(e.data=p);else{if(i=i&&ut.call(e.childNodes),d=(m=n.props||St).dangerouslySetInnerHTML,l=p.dangerouslySetInnerHTML,!a){if(i!=null)for(m={},h=0;h<e.attributes.length;h++)m[e.attributes[h].name]=e.attributes[h].value;(l||d)&&(l&&(d&&l.__html==d.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(Ts(e,p,m,o,a),l)t.__k=[];else if(h=t.props.children,Gr(e,Array.isArray(h)?h:[h],t,n,r,o&&f!=="foreignObject",i,s,i?i[0]:n.__k&&at(n,0),a),i!=null)for(h=i.length;h--;)i[h]!=null&&zr(i[h]);a||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||f==="progress"&&!h||f==="option"&&h!==m.value)&&Et(e,"value",h,m.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&Et(e,"checked",h,m.checked,!1))}return e}function Jr(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){L.__e(r,n)}}function Xr(e,t,n){var r,o;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Jr(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){L.__e(i,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Xr(r[o],t,n||typeof e.type!="function");n||e.__e==null||zr(e.__e),e.__=e.__e=e.__d=void 0}function Ds(e,t,n){return this.constructor(e,n)}function Ke(e,t,n){var r,o,i;L.__&&L.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],vn(t,e=(!r&&n||t).__k=q(ue,null,[e]),o||St,St,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?ut.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r),Qr(i,e)}function eo(e,t){Ke(e,t,eo)}function As(e,t,n){var r,o,i,s=xe({},e.props);for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?ut.call(arguments,2):n),it(e.type,s,r||e.key,o||e.ref,null)}function to(e,t){var n={__c:t="__cC"+$r++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,i;return this.getChildContext||(o=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(a){a.__e=!0,sn(a)})},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),a&&a.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}ut=Hr.slice,L={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},Br=0,Ge=!1,le.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=xe({},this.state),typeof e=="function"&&(e=e(xe({},n),this.props)),e&&xe(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),sn(this))},le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),sn(this))},le.prototype.render=ue,je=[],Fr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Lt.__r=0,$r=0;var I=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.MultipleChoice="multiplechoice",e.MultipleSelect="multipleselect",e.NPS="nps",e.Open="open",e.RecordedTask="recordedtask",e.TextUrlPrompt="texturlprompt",e.Thanks="thanks",e.Uploading="uploading",e.VideoVoice="videovoice",e))(I||{}),Ve=(e=>(e.Answered="answered",e.Equal="eq",e.NotEqual="neq",e.Skipped="skipped",e.LessThan="lt",e.LessThanOrEqual="lte",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e))(Ve||{}),Ze=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Ze||{}),ne=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(ne||{}),Ne=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(Ne||{}),ae=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(ae||{}),Y=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(Y||{}),ce=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(ce||{}),M=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))(M||{});const zn=e=>{let t;const n=new Set,r=(c,d)=>{const l=typeof c=="function"?c(t):c;if(!Object.is(l,t)){const m=t;t=(d!=null?d:typeof l!="object")?l:Object.assign({},t,l),n.forEach(p=>p(t,m))}},o=()=>t,a={setState:r,getState:o,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return t=e(r,o,a),a},js=e=>e?zn(e):zn;var Pe,H,Ft,qn,Ye=0,no=[],vt=[],Wn=L.__b,Gn=L.__r,Kn=L.diffed,Zn=L.__c,Yn=L.unmount;function $e(e,t){L.__h&&L.__h(H,e,Ye||t),Ye=0;var n=H.__H||(H.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:vt}),n.__[e]}function Z(e){return Ye=1,wn(ao,e)}function wn(e,t,n){var r=$e(Pe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ao(void 0,t),function(i){var s=r.__N?r.__N[0]:r.__[0],a=r.t(s,i);s!==a&&(r.__N=[a,r.__[1]],r.__c.setState({}))}],r.__c=H,!H.u)){H.u=!0;var o=H.shouldComponentUpdate;H.shouldComponentUpdate=function(i,s,a){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(l){return l.__c});if(c.every(function(l){return!l.__N}))return!o||o.call(this,i,s,a);var d=!1;return c.forEach(function(l){if(l.__N){var m=l.__[0];l.__=l.__N,l.__N=void 0,m!==l.__[0]&&(d=!0)}}),!(!d&&r.__c.props===i)&&(!o||o.call(this,i,s,a))}}return r.__N||r.__}function re(e,t){var n=$e(Pe++,3);!L.__s&&yn(n.__H,t)&&(n.__=e,n.i=t,H.__H.__h.push(n))}function pt(e,t){var n=$e(Pe++,4);!L.__s&&yn(n.__H,t)&&(n.__=e,n.i=t,H.__h.push(n))}function Te(e){return Ye=5,Dt(function(){return{current:e}},[])}function ro(e,t,n){Ye=6,pt(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function Dt(e,t){var n=$e(Pe++,7);return yn(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function oo(e,t){return Ye=8,Dt(function(){return e},t)}function io(e){var t=H.context[e.__c],n=$e(Pe++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(H)),t.props.value):e.__}function _n(e,t){L.useDebugValue&&L.useDebugValue(t?t(e):e)}function Os(e){var t=$e(Pe++,10),n=Z();return t.__=e,H.componentDidCatch||(H.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]}function so(){var e=$e(Pe++,11);if(!e.__){for(var t=H.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ms(){for(var e;e=no.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wt),e.__H.__h.forEach(an),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}L.__b=function(e){H=null,Wn&&Wn(e)},L.__r=function(e){Gn&&Gn(e),Pe=0;var t=(H=e.__c).__H;t&&(Ft===H?(t.__h=[],H.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=vt,n.__N=n.i=void 0})):(t.__h.forEach(wt),t.__h.forEach(an),t.__h=[])),Ft=H},L.diffed=function(e){Kn&&Kn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(no.push(t)!==1&&qn===L.requestAnimationFrame||((qn=L.requestAnimationFrame)||Ns)(Ms)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==vt&&(n.__=n.__V),n.i=void 0,n.__V=vt})),Ft=H=null},L.__c=function(e,t){t.some(function(n){try{n.__h.forEach(wt),n.__h=n.__h.filter(function(r){return!r.__||an(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(r,n.__v)}}),Zn&&Zn(e,t)},L.unmount=function(e){Yn&&Yn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{wt(r)}catch(o){t=o}}),n.__H=void 0,t&&L.__e(t,n.__v))};var Qn=typeof requestAnimationFrame=="function";function Ns(e){var t,n=function(){clearTimeout(r),Qn&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Qn&&(t=requestAnimationFrame(n))}function wt(e){var t=H,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),H=t}function an(e){var t=H;e.__c=e.__(),H=t}function yn(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function ao(e,t){return typeof t=="function"?t(e):t}function lo(e,t){for(var n in t)e[n]=t[n];return e}function ln(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function $t(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function It(e){this.props=e}function co(e,t){function n(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:ln(this.props,o)}function r(o){return this.shouldComponentUpdate=n,q(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(It.prototype=new le).isPureReactComponent=!0,It.prototype.shouldComponentUpdate=function(e,t){return ln(this.props,e)||ln(this.state,t)};var Jn=L.__b;L.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Jn&&Jn(e)};var Vs=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function uo(e){function t(n){var r=lo({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=Vs,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Xn=function(e,t){return e==null?null:Ce(Ce(e).map(t))},po={map:Xn,forEach:Xn,count:function(e){return e?Ce(e).length:0},only:function(e){var t=Ce(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Ce},Bs=L.__e;L.__e=function(e,t,n,r){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Bs(e,t,n,r)};var er=L.unmount;function fo(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=lo({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return fo(r,t,n)})),e}function mo(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return mo(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function st(){this.__u=0,this.t=null,this.__b=null}function ho(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function go(e){var t,n,r;function o(i){if(t||(t=e()).then(function(s){n=s.default||s},function(s){r=s}),r)throw r;if(!n)throw t;return q(n,i)}return o.displayName="Lazy",o.__f=!0,o}function He(){this.u=null,this.o=null}L.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),er&&er(e)},(st.prototype=new le).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=ho(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=mo(d,d.__c.__P,d.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.t.pop();)l.forceUpdate()}},c=t.__h===!0;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},st.prototype.componentWillUnmount=function(){this.t=[]},st.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=fo(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&q(ue,null,e.fallback);return o&&(o.__h=null),[q(ue,null,t.__a?null:e.children),o]};var tr=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function Fs(e){return this.getChildContext=function(){return e.context},e.children}function $s(e){var t=this,n=e.i;t.componentWillUnmount=function(){Ke(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,o){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Ke(q(Fs,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function vo(e,t){var n=q($s,{__v:e,i:t});return n.containerInfo=t,n}(He.prototype=new le).__a=function(e){var t=this,n=ho(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),tr(t,e,r)):o()};n?n(i):i()}},He.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ce(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},He.prototype.componentDidUpdate=He.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){tr(e,n,t)})};var wo=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Hs=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,zs=typeof document<"u",qs=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function _o(e,t,n){return t.__k==null&&(t.textContent=""),Ke(e,t),typeof n=="function"&&n(),e?e.__c:null}function yo(e,t,n){return eo(e,t),typeof n=="function"&&n(),e?e.__c:null}le.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(le.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var nr=L.event;function Ws(){}function Gs(){return this.cancelBubble}function Ks(){return this.defaultPrevented}L.event=function(e){return nr&&(e=nr(e)),e.persist=Ws,e.isPropagationStopped=Gs,e.isDefaultPrevented=Ks,e.nativeEvent=e};var bo,rr={configurable:!0,get:function(){return this.class}},or=L.vnode;L.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var o=t.indexOf("-")===-1;for(var i in r={},n){var s=n[i];zs&&i==="children"&&t==="noscript"||i==="value"&&"defaultValue"in n&&s==null||(i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!qs(n.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&Hs.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():s===null&&(s=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),r[i]&&(i="oninputCapture")),r[i]=s)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Ce(n.children).forEach(function(a){a.props.selected=r.value.indexOf(a.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Ce(n.children).forEach(function(a){a.props.selected=r.multiple?r.defaultValue.indexOf(a.props.value)!=-1:r.defaultValue==a.props.value})),e.props=r,n.class!=n.className&&(rr.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",rr))}e.$$typeof=wo,or&&or(e)};var ir=L.__r;L.__r=function(e){ir&&ir(e),bo=e.__c};var xo={ReactCurrentDispatcher:{current:{readContext:function(e){return bo.__n[e.__c].props.value}}}},Zs="17.0.2";function Co(e){return q.bind(null,e)}function bn(e){return!!e&&e.$$typeof===wo}function ko(e){return bn(e)?As.apply(null,arguments):e}function So(e){return!!e.__k&&(Ke(null,e),!0)}function Eo(e){return e&&(e.base||e.nodeType===1&&e)||null}var Lo=function(e,t){return e(t)},Io=function(e,t){return e(t)},Uo=ue;function xn(e){e()}function To(e){return e}function Po(){return[!1,xn]}var Ro=pt;function Do(e,t){var n=t(),r=Z({h:{__:n,v:t}}),o=r[0].h,i=r[1];return pt(function(){o.__=n,o.v=t,$t(o.__,t())||i({h:o})},[e,n,t]),re(function(){return $t(o.__,o.v())||i({h:o}),e(function(){$t(o.__,o.v())||i({h:o})})},[e]),n}var Ys={useState:Z,useId:so,useReducer:wn,useEffect:re,useLayoutEffect:pt,useInsertionEffect:Ro,useTransition:Po,useDeferredValue:To,useSyncExternalStore:Do,startTransition:xn,useRef:Te,useImperativeHandle:ro,useMemo:Dt,useCallback:oo,useContext:io,useDebugValue:_n,version:"17.0.2",Children:po,render:_o,hydrate:yo,unmountComponentAtNode:So,createPortal:vo,createElement:q,createContext:to,createFactory:Co,cloneElement:ko,createRef:qr,Fragment:ue,isValidElement:bn,findDOMNode:Eo,Component:le,PureComponent:It,memo:co,forwardRef:uo,flushSync:Io,unstable_batchedUpdates:Lo,StrictMode:Uo,Suspense:st,SuspenseList:He,lazy:go,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:xo};const Qs=Object.freeze(Object.defineProperty({__proto__:null,Children:po,PureComponent:It,StrictMode:Uo,Suspense:st,SuspenseList:He,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:xo,cloneElement:ko,createFactory:Co,createPortal:vo,default:Ys,findDOMNode:Eo,flushSync:Io,forwardRef:uo,hydrate:yo,isValidElement:bn,lazy:go,memo:co,render:_o,startTransition:xn,unmountComponentAtNode:So,unstable_batchedUpdates:Lo,useDeferredValue:To,useInsertionEffect:Ro,useSyncExternalStore:Do,useTransition:Po,version:Zs,Component:le,Fragment:ue,createContext:to,createElement:q,createRef:qr,useCallback:oo,useContext:io,useDebugValue:_n,useEffect:re,useErrorBoundary:Os,useId:so,useImperativeHandle:ro,useLayoutEffect:pt,useMemo:Dt,useReducer:wn,useRef:Te,useState:Z},Symbol.toStringTag,{value:"Module"}));var Ao={exports:{}},jo={};const Oo=Pi(Qs);var Mo={exports:{}},No={};/**
1
+ "use strict";var bi=Object.defineProperty;var xi=(e,t,n)=>t in e?bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var X=(e,t,n)=>(xi(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var he=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(he||{}),j=(e=>(e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e))(j||{}),Sr=(e=>(e.SurveyId="survey.id",e))(Sr||{});const vn={SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};var ie=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(ie||{}),Ne=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Ne||{});let ht;const Ci=new Uint8Array(16);function ki(){if(!ht&&(ht=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ht))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ht(Ci)}const K=[];for(let e=0;e<256;++e)K.push((e+256).toString(16).slice(1));function Si(e,t=0){return(K[e[t+0]]+K[e[t+1]]+K[e[t+2]]+K[e[t+3]]+"-"+K[e[t+4]]+K[e[t+5]]+"-"+K[e[t+6]]+K[e[t+7]]+"-"+K[e[t+8]]+K[e[t+9]]+"-"+K[e[t+10]]+K[e[t+11]]+K[e[t+12]]+K[e[t+13]]+K[e[t+14]]+K[e[t+15]]).toLowerCase()}const Ei=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mn={randomUUID:Ei};function Pe(e,t,n){if(Mn.randomUUID&&!t&&!e)return Mn.randomUUID();e=e||{};const r=e.random||(e.rng||ki)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return Si(r)}const ze="ul-app";var k=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e))(k||{});const wn="#e6e6e6",rt="#bd282a",Li=500,Ii=1030;var te=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(te||{});const Er=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},Ui=()=>{const e=Er();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Pi=()=>{const e=Er();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Ti=Object.freeze(Object.defineProperty({__proto__:null,enable:Ui,disable:Pi},Symbol.toStringTag,{value:"Module"})),Nn=[Ti];class Xt{static disable(){Nn.forEach(t=>t.disable())}static enable(){Nn.forEach(t=>t.enable())}}const Di=1,We=e=>e instanceof HTMLElement,Ri=e=>e instanceof HTMLInputElement,ot=e=>e instanceof HTMLTextAreaElement,Lr=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=k.CustomStyle,e.head.appendChild(r)},Ir=e=>{const t=e.querySelector(`.${k.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const o=getComputedStyle(t),i=parseFloat(o.marginTop)+parseFloat(o.marginBottom),s=parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth);r=i+s}return n+r+Di},Ai=e=>{const t=e.querySelector(`.${k.CardContainer}`);t&&(t.scrollTop=0)};var tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ji(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Ur={},Dt={},dt={};Object.defineProperty(dt,"__esModule",{value:!0});dt.MemoryLeakError=void 0;class Mi extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}dt.MemoryLeakError=Mi;Object.defineProperty(Dt,"__esModule",{value:!0});Dt.Emitter=void 0;const Ni=dt;class Rt{constructor(){this.events=new Map,this.maxListeners=Rt.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...o)=>{this.removeListener(t,r),n.apply(this,o)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(o=>{o.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const o=new Ni.MemoryLeakError(this,t,this.listenerCount(t));console.warn(o)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const o=[n].concat(r);this.events.set(t,o)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}Dt.Emitter=Rt;Rt.defaultMaxListeners=10;(function(e){var t=tt&&tt.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=tt&&tt.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(Dt,e),n(dt,e)})(Ur);const F=new Ur.Emitter;var nt=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(nt||{}),fe=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(fe||{}),Fe=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Fe||{}),Ie=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(Ie||{});const kt=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),qe=({"userleap-platform":e})=>e!==Fe.Web,W=(e,t)=>{const n=t?k.MobileSuffix:k.DesktopSuffix;return[e+n,e]},_e=(e,t)=>[e,`${e}__${t}`];class Vi{constructor(t){X(this,"payload");X(this,"promise");X(this,"reject",()=>{});X(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Bi={RATELIMIT_RESET_DEFAULT:10};let Pr=!1,Tr="",gt=!1,vt=[];const Fi=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?Ie.Gtm:e._segment?Ie.Segment:Ie.Snippet,en=(e="")=>{Pr=!0,Tr=e};function ut(e={}){const t={"Content-Type":"application/json","userleap-platform":Fe.Web,"x-ul-sdk-version":"2.23.0",[fe.InstallationMethod]:Fi(e)};if(e.envId&&(t[fe.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[fe.UserID]=e.userId),e.visitorId&&(t[fe.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[fe.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[fe.PreviewMode]="1"),t}const Vn=async(e,t,n)=>{if(e)return{status:429};{const r=new Vi(n);return vt.push(r),r.promise}},ge=async(e,t,n=0,r=!1,o=!1)=>{const i={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(gt&&!o)return Vn(r,o,i);const s={ok:!1,reportError:!1};if(Pr)return console.info(`UserLeap - ${Tr}`),s;try{t.headers=Object.assign(ut(),t.headers);const a=await fetch(e,t);if(a.status===429)if(!gt&&!r||o){gt=!0;const d=a.headers.has("ratelimit-reset")?Number(a.headers.get("ratelimit-reset")):Bi.RATELIMIT_RESET_DEFAULT;return await kt(d*1e3),ge(e,t,0,r,!0)}else return Vn(r,!1,i);if(gt=!1,vt.length&&(vt.map(c=>{const{url:d,options:l,attempt:m,shouldDropOnRateLimit:p}=c.payload;ge(d,l,m,p).then(f=>{c.resolveRequest(f)})}),vt=[]),a.ok){if(a.status===249)return en(),s;const c=await a.text();try{return c&&c!=="OK"&&(a.json=JSON.parse(c)),a}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${c}`)}}}return a}catch(a){const c=n+1;return c>5?{ok:!1,reportError:!1,error:a}:(await kt(Math.pow(2,n)*1e3),ge(e,t,c))}};var Dr={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(tt,function(){var n=function(i,s){if(s=s||{},typeof i!="function")throw new o("fetch must be a function");if(typeof s!="object")throw new o("defaults must be an object");if(s.retries!==void 0&&!r(s.retries))throw new o("retries must be a positive integer");if(s.retryDelay!==void 0&&!r(s.retryDelay)&&typeof s.retryDelay!="function")throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(s.retryOn!==void 0&&!Array.isArray(s.retryOn)&&typeof s.retryOn!="function")throw new o("retryOn property expects an array or function");var a={retries:3,retryDelay:1e3,retryOn:[]};return s=Object.assign(a,s),function(d,l){var m=s.retries,p=s.retryDelay,f=s.retryOn;if(l&&l.retries!==void 0)if(r(l.retries))m=l.retries;else throw new o("retries must be a positive integer");if(l&&l.retryDelay!==void 0)if(r(l.retryDelay)||typeof l.retryDelay=="function")p=l.retryDelay;else throw new o("retryDelay must be a positive integer or a function returning a positive integer");if(l&&l.retryOn)if(Array.isArray(l.retryOn)||typeof l.retryOn=="function")f=l.retryOn;else throw new o("retryOn property expects an array or function");return new Promise(function(h,g){var v=function(w){var C=typeof Request<"u"&&d instanceof Request?d.clone():d;i(C,l).then(function(b){if(Array.isArray(f)&&f.indexOf(b.status)===-1)h(b);else if(typeof f=="function")try{return Promise.resolve(f(w,null,b)).then(function(E){E?y(w,null,b):h(b)}).catch(g)}catch(E){g(E)}else w<m?y(w,null,b):h(b)}).catch(function(b){if(typeof f=="function")try{Promise.resolve(f(w,b,null)).then(function(E){E?y(w,b,null):g(b)}).catch(function(E){g(E)})}catch(E){g(E)}else w<m?y(w,b,null):g(b)})};function y(w,C,b){var E=typeof p=="function"?p(w,C,b):p;setTimeout(function(){v(++w)},E)}v(0)})}};function r(i){return Number.isInteger(i)&&i>=0}function o(i){this.name="ArgumentError",this.message=i}return n})})(Dr);const Hi=Dr.exports;class $i{constructor(t){X(this,"awaitingResolvers",[]);X(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const Rr=new $i(2),zi=e=>Rr.setLimit(e),qi=Hi(fetch),Wi=async(e,t=3)=>Rr.execute(async()=>{const r=(await qi(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:o=>Math.pow(2,o)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),Gi=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:o,responseGroupUuid:i,replayDuration:s})=>ge(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:i,surveyId:t,replayDuration:s}),headers:o}),Ki=(e,t)=>t.some(n=>e instanceof n);let Bn,Fn;function Zi(){return Bn||(Bn=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Yi(){return Fn||(Fn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ar=new WeakMap,tn=new WeakMap,Or=new WeakMap,Vt=new WeakMap,_n=new WeakMap;function Qi(e){const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{n(Ue(e.result)),o()},s=()=>{r(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(n=>{n instanceof IDBCursor&&Ar.set(n,e)}).catch(()=>{}),_n.set(t,e),t}function Ji(e){if(tn.has(e))return;const t=new Promise((n,r)=>{const o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{n(),o()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});tn.set(e,t)}let nn={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return tn.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Or.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ue(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Xi(e){nn=e(nn)}function es(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Bt(this),t,...n);return Or.set(r,t.sort?t.sort():[t]),Ue(r)}:Yi().includes(e)?function(...t){return e.apply(Bt(this),t),Ue(Ar.get(this))}:function(...t){return Ue(e.apply(Bt(this),t))}}function ts(e){return typeof e=="function"?es(e):(e instanceof IDBTransaction&&Ji(e),Ki(e,Zi())?new Proxy(e,nn):e)}function Ue(e){if(e instanceof IDBRequest)return Qi(e);if(Vt.has(e))return Vt.get(e);const t=ts(e);return t!==e&&(Vt.set(e,t),_n.set(t,e)),t}const Bt=e=>_n.get(e);function ns(e,t,{blocked:n,upgrade:r,blocking:o,terminated:i}={}){const s=indexedDB.open(e,t),a=Ue(s);return r&&s.addEventListener("upgradeneeded",c=>{r(Ue(s.result),c.oldVersion,c.newVersion,Ue(s.transaction),c)}),n&&s.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),o&&c.addEventListener("versionchange",d=>o(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const rs=["get","getKey","getAll","getAllKeys","count"],os=["put","add","delete","clear"],Ft=new Map;function Hn(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ft.get(t))return Ft.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=os.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(o||rs.includes(n)))return;const i=async function(s,...a){const c=this.transaction(s,o?"readwrite":"readonly");let d=c.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),o&&c.done]))[0]};return Ft.set(t,i),i}Xi(e=>({...e,get:(t,n,r)=>Hn(t,n)||e.get(t,n,r),has:(t,n)=>!!Hn(t,n)||e.has(t,n)}));var we=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(we||{}),at=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(at||{});const rn="sprig.sessionId",jr="sprig.disableReplayRecording",D={name:"sprig.replay",version:2,tables:{events:{name:"events",indices:{session_timestamp:"session_timestamp",timestamp:"timestamp"}},chunkUploads:{name:"chunkUploads",indices:{timestamp:"timestamp",upload_status:"upload_status",session_status:"session_status",session_status_upload:"session_status_upload"}},pendingCaptures:{name:"pendingCaptures",indices:{timestamp:"timestamp",session_targetTimestamp:"session_targetTimestamp"}}}},is=()=>{sessionStorage.setItem(jr,"disabled")},Mr=()=>!!sessionStorage.getItem(jr),ss=()=>{const e=sessionStorage.getItem(rn);return e?(sessionStorage.removeItem(rn),e):Pe()},Q=ss();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(rn,Q)});const as=async()=>ns(D.name,D.version,{upgrade:(e,t)=>{if(!t){const n=e.createObjectStore(D.tables.events.name,{keyPath:"uuid"});n.createIndex(D.tables.events.indices.session_timestamp,["sessionId","timestamp"]),n.createIndex(D.tables.events.indices.timestamp,"timestamp");const r=e.createObjectStore(D.tables.chunkUploads.name,{keyPath:"uuid"});r.createIndex(D.tables.chunkUploads.indices.session_status,["sessionId","status"]),r.createIndex(D.tables.chunkUploads.indices.upload_status,["uploadId","status"]),r.createIndex(D.tables.chunkUploads.indices.session_status_upload,["sessionId","status","uploadId"]),r.createIndex(D.tables.chunkUploads.indices.timestamp,"timestamp")}if(!t||t<2){const n=e.createObjectStore(D.tables.pendingCaptures.name,{keyPath:"uuid"});n.createIndex(D.tables.pendingCaptures.indices.session_targetTimestamp,["sessionId","targetTimestamp"]),n.createIndex(D.tables.pendingCaptures.indices.timestamp,"timestamp")}}}),J=as(),ls=async()=>{const e=await J;return Promise.all([e.clear(D.tables.events.name),e.clear(D.tables.chunkUploads.name),e.clear(D.tables.pendingCaptures.name)])},cs=async e=>{const n=(await J).transaction(D.tables.events.name,"readwrite");return Promise.all([...e.map(r=>n.store.put({...r,sessionId:r.sessionId||Q})),n.done])},ds=async e=>await(await J).getAllFromIndex(D.tables.events.name,D.tables.events.indices.session_timestamp,IDBKeyRange.bound([Q,e],[Q,Number.MAX_VALUE])),us=async(e,t)=>(await J).getAllKeysFromIndex(t,"timestamp",IDBKeyRange.upperBound(e-1)),on=async(e,t)=>{if(!t||!t.length)return;const r=(await J).transaction(e,"readwrite");return Promise.all([...t.map(async o=>{try{await r.store.delete(o)}catch{}}),r.done])},yn=async(e,t)=>{const n=await us(e,t);await on(t,n)},ps=async e=>{await yn(e,D.tables.events.name)},fs=async e=>{await yn(e,D.tables.chunkUploads.name)},ms=async e=>{await yn(e,D.tables.pendingCaptures.name)},hs=async()=>{const e=await J,t=await e.getAllKeysFromIndex(D.tables.events.name,D.tables.events.indices.session_timestamp,IDBKeyRange.bound([Q,Number.MIN_VALUE],[Q,Number.MAX_VALUE])),n=await e.getAllKeysFromIndex(D.tables.pendingCaptures.name,D.tables.pendingCaptures.indices.session_targetTimestamp,IDBKeyRange.bound([Q,Number.MIN_VALUE],[Q,Number.MAX_VALUE]));await Promise.all([on(D.tables.events.name,t),on(D.tables.pendingCaptures.name,n)])},gs=async e=>(await J).put(D.tables.chunkUploads.name,{...e,sessionId:e.sessionId||Q,etag:null}),vs=async(e,t)=>{const n=await J,r=await n.get(D.tables.chunkUploads.name,e);if(r)return n.put(D.tables.chunkUploads.name,{...r,data:null,etag:t,status:we.UploadComplete})},ws=async e=>await(await J).countFromIndex(D.tables.chunkUploads.name,D.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,we.ReadyForUpload],[e,we.ReadyForUpload]))>0,_s=async()=>{const n=(await(await J).getAllFromIndex(D.tables.chunkUploads.name,D.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([Q,we.UploadComplete],[Q,we.UploadComplete]))).reduce((i,s)=>(i.add(s.uploadId),i),new Set),r=Array.from(n),o=await Promise.all(r.map(async i=>ws(i)));return r.filter((i,s)=>!o[s])},ys=async({status:e,uploadId:t})=>(await J).getAllKeysFromIndex(D.tables.chunkUploads.name,t?D.tables.chunkUploads.indices.upload_status:D.tables.chunkUploads.indices.session_status,IDBKeyRange.bound([t||Q,e],[t||Q,e])),bs=async e=>(await J).get(D.tables.chunkUploads.name,e),xs=async e=>(await J).getAllFromIndex(D.tables.chunkUploads.name,D.tables.chunkUploads.indices.upload_status,IDBKeyRange.bound([e,we.UploadComplete],[e,we.UploadComplete])),Cs=async e=>(await J).put(D.tables.pendingCaptures.name,{...e,sessionId:e.sessionId||Q}),ks=async e=>(await J).delete(D.tables.pendingCaptures.name,e),Ss=async()=>await(await J).getAllFromIndex(D.tables.pendingCaptures.name,D.tables.pendingCaptures.indices.session_targetTimestamp,IDBKeyRange.bound([Q,Number.MIN_VALUE],[Q,Date.now()])),Es=async(e,t,n)=>new Promise((r,o)=>{const i=e.createElement("script");i.src=t,i.onload=r,i.onerror=o,n&&(i.nonce=n),e.head.appendChild(i)});let Nr=5e3;const Ls=5,Vr=30,Br=Vr+Ls,Is=async(e,t,n,r=2,o)=>{if(!t)return;o!=null&&o.minDuration&&(Nr=o.minDuration),zi(r),js(),Ts(t+Br),Ds();const i=window;i.rrwebRecord||await Es(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const s=i.rrwebRecord;if(!s)return;let a=!0;s({checkoutEveryNms:Vr*1e3,sampling:{input:"last",scroll:250,media:800},emit:(c,d)=>{if(Mr())return;const l=a||!!d;a=!1,Us({uuid:Pe(),event:JSON.stringify(c),isValidStart:l,timestamp:Date.now()})},...o})};let sn=!1,an=[];const Us=e=>{an.push(e),sn||Ps()},Ps=()=>{sn=!0,setTimeout(async()=>{if(Mr())return;const e=an;an=[],sn=!1;try{await cs(e)}catch(t){Fr(t)}},500)},Fr=async e=>{var n,r;is();const t=(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?await window.navigator.storage.estimate():{};await ls(),e instanceof Error&&window.UserLeap.reportError("Error storing replay data",e,t)},Ts=(e=6*60,t=30*60,n=4*60)=>{setInterval(async()=>{const r=Date.now();await Promise.all([ps(r-e*1e3),fs(r-t*1e3),ms(r-n*1e3)])},30*1e3)},Ds=async(e=5)=>{setInterval(Bs,e*1e3)},Rs=async e=>{const t=await ds(Date.now()-(e+Br)*1e3);let n=-1;const r=Date.now()-e*1e3;return t.forEach((o,i)=>{if(!o.isValidStart)return;const s=o.timestamp<=r;(n<0||s)&&(n=i)}),n<0?[]:t.slice(n)},As=async e=>{const t=`[${e.map(o=>o.event).join(",")}]`,r=new TextEncoder().encode(t);try{if(window.CompressionStream===void 0)return r;const o=new CompressionStream("gzip"),i=o.writable.getWriter();return i.write(r),i.close(),new Uint8Array(await new Response(o.readable).arrayBuffer())}catch(o){return o instanceof Error&&window.UserLeap.reportError("Error compressing replay for upload",o),r}},Os=(e,t,n)=>{const r=e.length,o=t*1024*1024,i=Math.ceil(r/n),s=Math.max(o,i),a=[];let c=0;for(;c<r;)a.push(e.slice(c,c+s)),c+=s;return a},Hr=async e=>{await Promise.all(e.map(async t=>{const n=await bs(t),r=await Wi(n);await vs(n.uuid,r)}))},$r=async e=>{const t=await xs(e);if(!t.length)return;t.sort((o,i)=>o.chunkIndex-i.chunkIndex);const n=t.map(o=>({ETag:o.etag,PartNumber:o.chunkIndex})).filter(o=>o.ETag!==null),r=t[0];await Gi({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration})},js=async()=>{const e=await ys({status:we.ReadyForUpload});if(!e.length)return;await Hr(e);const t=await _s();await Promise.all(t.map(n=>$r(n)))},Ms=async(e,t)=>{await Hr(t),await Promise.all(e.map(n=>$r(n)))},zr=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:o,completeUploadHeaders:i,replayParams:s}=e;if(await Ns(),s.replayDurationType===at.After||s.replayDurationType===at.BeforeAndAfter)return Vs(e);const a=await Rs(s.replayDurationSeconds);if(!a.length)return;const c=a[a.length-1].timestamp-a[0].timestamp;if(c<=Nr)return;const d=await As(a),l=Os(d,s.minimumChunkSizeMb,s.signedUrls.length),m=Date.now();let p=[];try{p=await Promise.all(l.map(async(f,h)=>{const g=Pe();return await gs({uuid:g,chunkIndex:h+1,totalChunks:l.length,timestamp:m,surveyId:t,responseGroupId:n,status:we.ReadyForUpload,data:f,visitorId:r,uploadId:s.uploadId,uploadUrl:s.signedUrls[h].url,apiUrl:o,completeUploadHeaders:i,replayDuration:c}),g}))}catch(f){Fr(f);return}await Ms([s.uploadId],p)};let St=null;const Ns=async()=>{St&&await St},$n=async()=>(St=hs(),St),Vs=async e=>{const t={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===at.BeforeAndAfter&&(t.replayParams.replayDurationSeconds*=2),t.replayParams.replayDurationType=at.Before;const n=Date.now()+e.replayParams.replayDurationSeconds*1e3;return Cs({uuid:Pe(),targetTimestamp:n,timestamp:Date.now(),captureParams:t})},Bs=async()=>{const e=await Ss();await Promise.all(e.map(async t=>{await ks(t.uuid),await zr(t.captureParams)}))};var pt,L,qr,Ge,je,zn,Wr,Gr,Et={},Kr=[],Fs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function xe(e,t){for(var n in t)e[n]=t[n];return e}function Zr(e){var t=e.parentNode;t&&t.removeChild(e)}function q(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?pt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return it(e,s,r,o,null)}function it(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:o==null?++qr:o};return o==null&&L.vnode!=null&&L.vnode(i),i}function Yr(){return{current:null}}function ue(e){return e.children}function Hs(e,t,n,r,o){var i;for(i in n)i==="children"||i==="key"||i in t||Lt(e,i,null,n[i],r);for(i in t)o&&typeof t[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||n[i]===t[i]||Lt(e,i,t[i],n[i],r)}function qn(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Fs.test(t)?n:n+"px"}function Lt(e,t,n,r,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||qn(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||qn(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?Gn:Wn,i):e.removeEventListener(t,i?Gn:Wn,i);else if(t!=="dangerouslySetInnerHTML"){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,n))}}function Wn(e){Ge=!0;try{return this.l[e.type+!1](L.event?L.event(e):e)}finally{Ge=!1}}function Gn(e){Ge=!0;try{return this.l[e.type+!0](L.event?L.event(e):e)}finally{Ge=!1}}function ce(e,t){this.props=e,this.context=t}function lt(e,t){if(t==null)return e.__?lt(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?lt(e):null}function Qr(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Qr(e)}}function $s(e){Ge?setTimeout(e):Wr(e)}function ln(e){(!e.__d&&(e.__d=!0)&&je.push(e)&&!It.__r++||zn!==L.debounceRendering)&&((zn=L.debounceRendering)||$s)(It)}function It(){var e,t,n,r,o,i,s,a;for(je.sort(function(c,d){return c.__v.__b-d.__v.__b});e=je.shift();)e.__d&&(t=je.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=xe({},i)).__v=i.__v+1,bn(a,i,o,n.__n,a.ownerSVGElement!==void 0,i.__h!=null?[s]:null,r,s==null?lt(i):s,i.__h),no(r,i),i.__e!=s&&Qr(i)),je.length>t&&je.sort(function(c,d){return c.__v.__b-d.__v.__b}));It.__r=0}function Jr(e,t,n,r,o,i,s,a,c,d){var l,m,p,f,h,g,v,y=r&&r.__k||Kr,w=y.length;for(n.__k=[],l=0;l<t.length;l++)if((f=n.__k[l]=(f=t[l])==null||typeof f=="boolean"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"?it(null,f,null,null,f):Array.isArray(f)?it(ue,{children:f},null,null,null):f.__b>0?it(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null){if(f.__=n,f.__b=n.__b+1,(p=y[l])===null||p&&f.key==p.key&&f.type===p.type)y[l]=void 0;else for(m=0;m<w;m++){if((p=y[m])&&f.key==p.key&&f.type===p.type){y[m]=void 0;break}p=null}bn(e,f,p=p||Et,o,i,s,a,c,d),h=f.__e,(m=f.ref)&&p.ref!=m&&(v||(v=[]),p.ref&&v.push(p.ref,null,f),v.push(m,f.__c||h,f)),h!=null?(g==null&&(g=h),typeof f.type=="function"&&f.__k===p.__k?f.__d=c=Xr(f,c,e):c=eo(e,f,p,y,h,c),typeof n.type=="function"&&(n.__d=c)):c&&p.__e==c&&c.parentNode!=e&&(c=lt(p))}for(n.__e=g,l=w;l--;)y[l]!=null&&(typeof n.type=="function"&&y[l].__e!=null&&y[l].__e==n.__d&&(n.__d=to(r).nextSibling),oo(y[l],y[l]));if(v)for(l=0;l<v.length;l++)ro(v[l],v[++l],v[++l])}function Xr(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t=typeof r.type=="function"?Xr(r,t,n):eo(n,r,r,o,r.__e,t));return t}function Ce(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){Ce(n,t)}):t.push(e)),t}function eo(e,t,n,r,o,i){var s,a,c;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(n==null||o!=i||o.parentNode==null)e:if(i==null||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,c=0;(a=a.nextSibling)&&c<r.length;c+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function to(e){var t,n,r;if(e.type==null||typeof e.type=="string")return e.__e;if(e.__k){for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=to(n)))return r}return null}function bn(e,t,n,r,o,i,s,a,c){var d,l,m,p,f,h,g,v,y,w,C,b,E,A,x,T=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(c=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(d=L.__b)&&d(t);try{e:if(typeof T=="function"){if(v=t.props,y=(d=T.contextType)&&r[d.__c],w=d?y?y.props.value:d.__:r,n.__c?g=(l=t.__c=n.__c).__=l.__E:("prototype"in T&&T.prototype.render?t.__c=l=new T(v,w):(t.__c=l=new ce(v,w),l.constructor=T,l.render=qs),y&&y.sub(l),l.props=v,l.state||(l.state={}),l.context=w,l.__n=r,m=l.__d=!0,l.__h=[],l._sb=[]),l.__s==null&&(l.__s=l.state),T.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=xe({},l.__s)),xe(l.__s,T.getDerivedStateFromProps(v,l.__s))),p=l.props,f=l.state,l.__v=t,m)T.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(T.getDerivedStateFromProps==null&&v!==p&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(v,w),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(v,l.__s,w)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(l.props=v,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(P){P&&(P.__=t)}),C=0;C<l._sb.length;C++)l.__h.push(l._sb[C]);l._sb=[],l.__h.length&&s.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(v,l.__s,w),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(p,f,h)})}if(l.context=w,l.props=v,l.__P=e,b=L.__r,E=0,"prototype"in T&&T.prototype.render){for(l.state=l.__s,l.__d=!1,b&&b(t),d=l.render(l.props,l.state,l.context),A=0;A<l._sb.length;A++)l.__h.push(l._sb[A]);l._sb=[]}else do l.__d=!1,b&&b(t),d=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++E<25);l.state=l.__s,l.getChildContext!=null&&(r=xe(xe({},r),l.getChildContext())),m||l.getSnapshotBeforeUpdate==null||(h=l.getSnapshotBeforeUpdate(p,f)),x=d!=null&&d.type===ue&&d.key==null?d.props.children:d,Jr(e,Array.isArray(x)?x:[x],t,n,r,o,i,s,a,c),l.base=t.__e,t.__h=null,l.__h.length&&s.push(l),g&&(l.__E=l.__=null),l.__e=!1}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=zs(n.__e,t,n,r,o,i,s,c);(d=L.diffed)&&d(t)}catch(P){t.__v=null,(c||i!=null)&&(t.__e=a,t.__h=!!c,i[i.indexOf(a)]=null),L.__e(P,t,n)}}function no(e,t){L.__c&&L.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){L.__e(r,n.__v)}})}function zs(e,t,n,r,o,i,s,a){var c,d,l,m=n.props,p=t.props,f=t.type,h=0;if(f==="svg"&&(o=!0),i!=null){for(;h<i.length;h++)if((c=i[h])&&"setAttribute"in c==!!f&&(f?c.localName===f:c.nodeType===3)){e=c,i[h]=null;break}}if(e==null){if(f===null)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,p.is&&p),i=null,a=!1}if(f===null)m===p||a&&e.data===p||(e.data=p);else{if(i=i&&pt.call(e.childNodes),d=(m=n.props||Et).dangerouslySetInnerHTML,l=p.dangerouslySetInnerHTML,!a){if(i!=null)for(m={},h=0;h<e.attributes.length;h++)m[e.attributes[h].name]=e.attributes[h].value;(l||d)&&(l&&(d&&l.__html==d.__html||l.__html===e.innerHTML)||(e.innerHTML=l&&l.__html||""))}if(Hs(e,p,m,o,a),l)t.__k=[];else if(h=t.props.children,Jr(e,Array.isArray(h)?h:[h],t,n,r,o&&f!=="foreignObject",i,s,i?i[0]:n.__k&&lt(n,0),a),i!=null)for(h=i.length;h--;)i[h]!=null&&Zr(i[h]);a||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||f==="progress"&&!h||f==="option"&&h!==m.value)&&Lt(e,"value",h,m.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&Lt(e,"checked",h,m.checked,!1))}return e}function ro(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){L.__e(r,n)}}function oo(e,t,n){var r,o;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ro(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){L.__e(i,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&oo(r[o],t,n||typeof e.type!="function");n||e.__e==null||Zr(e.__e),e.__=e.__e=e.__d=void 0}function qs(e,t,n){return this.constructor(e,n)}function Ke(e,t,n){var r,o,i;L.__&&L.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],bn(t,e=(!r&&n||t).__k=q(ue,null,[e]),o||Et,Et,t.ownerSVGElement!==void 0,!r&&n?[n]:o?null:t.firstChild?pt.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r),no(i,e)}function io(e,t){Ke(e,t,io)}function Ws(e,t,n){var r,o,i,s=xe({},e.props);for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?pt.call(arguments,2):n),it(e.type,s,r||e.key,o||e.ref,null)}function so(e,t){var n={__c:t="__cC"+Gr++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,i;return this.getChildContext||(o=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(a){a.__e=!0,ln(a)})},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),a&&a.call(s)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}pt=Kr.slice,L={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},qr=0,Ge=!1,ce.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=xe({},this.state),typeof e=="function"&&(e=e(xe({},n),this.props)),e&&xe(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ln(this))},ce.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ln(this))},ce.prototype.render=ue,je=[],Wr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,It.__r=0,Gr=0;var I=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.MultipleChoice="multiplechoice",e.MultipleSelect="multipleselect",e.NPS="nps",e.Open="open",e.RecordedTask="recordedtask",e.TextUrlPrompt="texturlprompt",e.Thanks="thanks",e.Uploading="uploading",e.VideoVoice="videovoice",e))(I||{}),Be=(e=>(e.Answered="answered",e.Equal="eq",e.NotEqual="neq",e.Skipped="skipped",e.LessThan="lt",e.LessThanOrEqual="lte",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e))(Be||{}),Ze=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Ze||{}),re=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(re||{}),Ve=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(Ve||{}),le=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(le||{}),Y=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(Y||{}),de=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(de||{}),N=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))(N||{});const Kn=e=>{let t;const n=new Set,r=(c,d)=>{const l=typeof c=="function"?c(t):c;if(!Object.is(l,t)){const m=t;t=(d!=null?d:typeof l!="object")?l:Object.assign({},t,l),n.forEach(p=>p(t,m))}},o=()=>t,a={setState:r,getState:o,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return t=e(r,o,a),a},Gs=e=>e?Kn(e):Kn;var De,$,Ht,Zn,Ye=0,ao=[],wt=[],Yn=L.__b,Qn=L.__r,Jn=L.diffed,Xn=L.__c,er=L.unmount;function He(e,t){L.__h&&L.__h($,e,Ye||t),Ye=0;var n=$.__H||($.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:wt}),n.__[e]}function Z(e){return Ye=1,xn(fo,e)}function xn(e,t,n){var r=He(De++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):fo(void 0,t),function(i){var s=r.__N?r.__N[0]:r.__[0],a=r.t(s,i);s!==a&&(r.__N=[a,r.__[1]],r.__c.setState({}))}],r.__c=$,!$.u)){$.u=!0;var o=$.shouldComponentUpdate;$.shouldComponentUpdate=function(i,s,a){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(l){return l.__c});if(c.every(function(l){return!l.__N}))return!o||o.call(this,i,s,a);var d=!1;return c.forEach(function(l){if(l.__N){var m=l.__[0];l.__=l.__N,l.__N=void 0,m!==l.__[0]&&(d=!0)}}),!(!d&&r.__c.props===i)&&(!o||o.call(this,i,s,a))}}return r.__N||r.__}function oe(e,t){var n=He(De++,3);!L.__s&&kn(n.__H,t)&&(n.__=e,n.i=t,$.__H.__h.push(n))}function ft(e,t){var n=He(De++,4);!L.__s&&kn(n.__H,t)&&(n.__=e,n.i=t,$.__h.push(n))}function Te(e){return Ye=5,At(function(){return{current:e}},[])}function lo(e,t,n){Ye=6,ft(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function At(e,t){var n=He(De++,7);return kn(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function co(e,t){return Ye=8,At(function(){return e},t)}function uo(e){var t=$.context[e.__c],n=He(De++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub($)),t.props.value):e.__}function Cn(e,t){L.useDebugValue&&L.useDebugValue(t?t(e):e)}function Ks(e){var t=He(De++,10),n=Z();return t.__=e,$.componentDidCatch||($.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]}function po(){var e=He(De++,11);if(!e.__){for(var t=$.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Zs(){for(var e;e=ao.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(_t),e.__H.__h.forEach(cn),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}L.__b=function(e){$=null,Yn&&Yn(e)},L.__r=function(e){Qn&&Qn(e),De=0;var t=($=e.__c).__H;t&&(Ht===$?(t.__h=[],$.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=wt,n.__N=n.i=void 0})):(t.__h.forEach(_t),t.__h.forEach(cn),t.__h=[])),Ht=$},L.diffed=function(e){Jn&&Jn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ao.push(t)!==1&&Zn===L.requestAnimationFrame||((Zn=L.requestAnimationFrame)||Ys)(Zs)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==wt&&(n.__=n.__V),n.i=void 0,n.__V=wt})),Ht=$=null},L.__c=function(e,t){t.some(function(n){try{n.__h.forEach(_t),n.__h=n.__h.filter(function(r){return!r.__||cn(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(r,n.__v)}}),Xn&&Xn(e,t)},L.unmount=function(e){er&&er(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{_t(r)}catch(o){t=o}}),n.__H=void 0,t&&L.__e(t,n.__v))};var tr=typeof requestAnimationFrame=="function";function Ys(e){var t,n=function(){clearTimeout(r),tr&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);tr&&(t=requestAnimationFrame(n))}function _t(e){var t=$,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),$=t}function cn(e){var t=$;e.__c=e.__(),$=t}function kn(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function fo(e,t){return typeof t=="function"?t(e):t}function mo(e,t){for(var n in t)e[n]=t[n];return e}function dn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function $t(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Ut(e){this.props=e}function ho(e,t){function n(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:dn(this.props,o)}function r(o){return this.shouldComponentUpdate=n,q(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Ut.prototype=new ce).isPureReactComponent=!0,Ut.prototype.shouldComponentUpdate=function(e,t){return dn(this.props,e)||dn(this.state,t)};var nr=L.__b;L.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),nr&&nr(e)};var Qs=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function go(e){function t(n){var r=mo({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=Qs,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var rr=function(e,t){return e==null?null:Ce(Ce(e).map(t))},vo={map:rr,forEach:rr,count:function(e){return e?Ce(e).length:0},only:function(e){var t=Ce(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Ce},Js=L.__e;L.__e=function(e,t,n,r){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Js(e,t,n,r)};var or=L.unmount;function wo(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=mo({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return wo(r,t,n)})),e}function _o(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return _o(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function st(){this.__u=0,this.t=null,this.__b=null}function yo(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function bo(e){var t,n,r;function o(i){if(t||(t=e()).then(function(s){n=s.default||s},function(s){r=s}),r)throw r;if(!n)throw t;return q(n,i)}return o.displayName="Lazy",o.__f=!0,o}function $e(){this.u=null,this.o=null}L.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),or&&or(e)},(st.prototype=new ce).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=yo(r.__v),i=!1,s=function(){i||(i=!0,n.__R=null,o?o(a):a())};n.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=_o(d,d.__c.__P,d.__c.__O)}var l;for(r.setState({__a:r.__b=null});l=r.t.pop();)l.forceUpdate()}},c=t.__h===!0;r.__u++||c||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},st.prototype.componentWillUnmount=function(){this.t=[]},st.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=wo(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&q(ue,null,e.fallback);return o&&(o.__h=null),[q(ue,null,t.__a?null:e.children),o]};var ir=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function Xs(e){return this.getChildContext=function(){return e.context},e.children}function ea(e){var t=this,n=e.i;t.componentWillUnmount=function(){Ke(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,o){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),Ke(q(Xs,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function xo(e,t){var n=q(ea,{__v:e,i:t});return n.containerInfo=t,n}($e.prototype=new ce).__a=function(e){var t=this,n=yo(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),ir(t,e,r)):o()};n?n(i):i()}},$e.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ce(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},$e.prototype.componentDidUpdate=$e.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){ir(e,n,t)})};var Co=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ta=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,na=typeof document<"u",ra=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function ko(e,t,n){return t.__k==null&&(t.textContent=""),Ke(e,t),typeof n=="function"&&n(),e?e.__c:null}function So(e,t,n){return io(e,t),typeof n=="function"&&n(),e?e.__c:null}ce.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ce.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var sr=L.event;function oa(){}function ia(){return this.cancelBubble}function sa(){return this.defaultPrevented}L.event=function(e){return sr&&(e=sr(e)),e.persist=oa,e.isPropagationStopped=ia,e.isDefaultPrevented=sa,e.nativeEvent=e};var Eo,ar={configurable:!0,get:function(){return this.class}},lr=L.vnode;L.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var o=t.indexOf("-")===-1;for(var i in r={},n){var s=n[i];na&&i==="children"&&t==="noscript"||i==="value"&&"defaultValue"in n&&s==null||(i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!ra(n.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&ta.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():s===null&&(s=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),r[i]&&(i="oninputCapture")),r[i]=s)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=Ce(n.children).forEach(function(a){a.props.selected=r.value.indexOf(a.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=Ce(n.children).forEach(function(a){a.props.selected=r.multiple?r.defaultValue.indexOf(a.props.value)!=-1:r.defaultValue==a.props.value})),e.props=r,n.class!=n.className&&(ar.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",ar))}e.$$typeof=Co,lr&&lr(e)};var cr=L.__r;L.__r=function(e){cr&&cr(e),Eo=e.__c};var Lo={ReactCurrentDispatcher:{current:{readContext:function(e){return Eo.__n[e.__c].props.value}}}},aa="17.0.2";function Io(e){return q.bind(null,e)}function Sn(e){return!!e&&e.$$typeof===Co}function Uo(e){return Sn(e)?Ws.apply(null,arguments):e}function Po(e){return!!e.__k&&(Ke(null,e),!0)}function To(e){return e&&(e.base||e.nodeType===1&&e)||null}var Do=function(e,t){return e(t)},Ro=function(e,t){return e(t)},Ao=ue;function En(e){e()}function Oo(e){return e}function jo(){return[!1,En]}var Mo=ft;function No(e,t){var n=t(),r=Z({h:{__:n,v:t}}),o=r[0].h,i=r[1];return ft(function(){o.__=n,o.v=t,$t(o.__,t())||i({h:o})},[e,n,t]),oe(function(){return $t(o.__,o.v())||i({h:o}),e(function(){$t(o.__,o.v())||i({h:o})})},[e]),n}var la={useState:Z,useId:po,useReducer:xn,useEffect:oe,useLayoutEffect:ft,useInsertionEffect:Mo,useTransition:jo,useDeferredValue:Oo,useSyncExternalStore:No,startTransition:En,useRef:Te,useImperativeHandle:lo,useMemo:At,useCallback:co,useContext:uo,useDebugValue:Cn,version:"17.0.2",Children:vo,render:ko,hydrate:So,unmountComponentAtNode:Po,createPortal:xo,createElement:q,createContext:so,createFactory:Io,cloneElement:Uo,createRef:Yr,Fragment:ue,isValidElement:Sn,findDOMNode:To,Component:ce,PureComponent:Ut,memo:ho,forwardRef:go,flushSync:Ro,unstable_batchedUpdates:Do,StrictMode:Ao,Suspense:st,SuspenseList:$e,lazy:bo,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Lo};const ca=Object.freeze(Object.defineProperty({__proto__:null,Children:vo,PureComponent:Ut,StrictMode:Ao,Suspense:st,SuspenseList:$e,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Lo,cloneElement:Uo,createFactory:Io,createPortal:xo,default:la,findDOMNode:To,flushSync:Ro,forwardRef:go,hydrate:So,isValidElement:Sn,lazy:bo,memo:ho,render:ko,startTransition:En,unmountComponentAtNode:Po,unstable_batchedUpdates:Do,useDeferredValue:Oo,useInsertionEffect:Mo,useSyncExternalStore:No,useTransition:jo,version:aa,Component:ce,Fragment:ue,createContext:so,createElement:q,createRef:Yr,useCallback:co,useContext:uo,useDebugValue:Cn,useEffect:oe,useErrorBoundary:Ks,useId:po,useImperativeHandle:lo,useLayoutEffect:ft,useMemo:At,useReducer:xn,useRef:Te,useState:Z},Symbol.toStringTag,{value:"Module"}));var Vo={exports:{}},Bo={};const Fo=ji(ca);var Ho={exports:{}},$o={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Qe=Oo;function Js(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xs=typeof Object.is=="function"?Object.is:Js,ea=Qe.useState,ta=Qe.useEffect,na=Qe.useLayoutEffect,ra=Qe.useDebugValue;function oa(e,t){var n=t(),r=ea({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return na(function(){o.value=n,o.getSnapshot=t,Ht(o)&&i({inst:o})},[e,n,t]),ta(function(){return Ht(o)&&i({inst:o}),e(function(){Ht(o)&&i({inst:o})})},[e]),ra(n),n}function Ht(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xs(e,n)}catch{return!0}}function ia(e,t){return t()}var sa=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ia:oa;No.useSyncExternalStore=Qe.useSyncExternalStore!==void 0?Qe.useSyncExternalStore:sa;(function(e){e.exports=No})(Mo);/**
9
+ */var Qe=Fo;function da(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ua=typeof Object.is=="function"?Object.is:da,pa=Qe.useState,fa=Qe.useEffect,ma=Qe.useLayoutEffect,ha=Qe.useDebugValue;function ga(e,t){var n=t(),r=pa({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return ma(function(){o.value=n,o.getSnapshot=t,zt(o)&&i({inst:o})},[e,n,t]),fa(function(){return zt(o)&&i({inst:o}),e(function(){zt(o)&&i({inst:o})})},[e]),ha(n),n}function zt(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ua(e,n)}catch{return!0}}function va(e,t){return t()}var wa=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?va:ga;$o.useSyncExternalStore=Qe.useSyncExternalStore!==void 0?Qe.useSyncExternalStore:wa;(function(e){e.exports=$o})(Ho);/**
10
10
  * @license React
11
11
  * use-sync-external-store-shim/with-selector.production.min.js
12
12
  *
@@ -14,18 +14,18 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var At=Oo,aa=Mo.exports;function la(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ca=typeof Object.is=="function"?Object.is:la,da=aa.useSyncExternalStore,ua=At.useRef,pa=At.useEffect,fa=At.useMemo,ma=At.useDebugValue;jo.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=ua(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=fa(function(){function c(f){if(!d){if(d=!0,l=f,f=r(f),o!==void 0&&s.hasValue){var h=s.value;if(o(h,f))return m=h}return m=f}if(h=m,ca(l,f))return h;var g=r(f);return o!==void 0&&o(h,g)?h:(l=f,m=g)}var d=!1,l,m,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,o]);var a=da(e,i[0],i[1]);return pa(function(){s.hasValue=!0,s.value=a},[a]),ma(a),a};(function(e){e.exports=jo})(Ao);const ha=Ti(Ao.exports),{useSyncExternalStoreWithSelector:ga}=ha;function va(e,t=e.getState,n){const r=ga(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return _n(r),r}const sr=e=>{const t=typeof e=="function"?js(e):e,n=(r,o)=>va(t,r,o);return Object.assign(n,t),n},Vo=e=>e?sr(e):sr,zt=1,Cn={eq(e,t){return e==t},neq(e,t){return!this.eq(e,t)},gt(e,t){return e>t},gte(e,t){return e>=t},lt(e,t){return e<t},lte(e,t){return e<=t},list_exact(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:e.slice().sort().join(",")===t.slice().sort().join(",")},list_all(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:!t.some(n=>e.indexOf(n)===-1)},list_alo(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:t.some(n=>e.indexOf(n)!=-1)}},kn=(e,t,n)=>{switch(t){case I.VideoVoice:return Boolean(e&&e.value);case I.Open:return!!n;case I.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case I.RecordedTask:return(n==null?void 0:n.taskStatus)===ce.Completed;case I.TextUrlPrompt:return!e.value;case I.ConsentLegal:return n!==null;case I.MultipleChoice:return n!==void 0;case I.NPS:return n!==null;case I.Likert:return n!==null;default:return!0}},Bo=({cards:e,index:t,hasEndCard:n,selectedValue:r,hasValidAnswer:o=!0,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const a=e[t].props.routingOptions||[];let c=null,d=null;for(let f=0;f<a.length;f++){const{comparator:h,target:g,value:v}=a[f];if(h===Ve.Answered&&o){c=g;break}else if(h===Ve.GivenUp&&r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===ce.GivenUp){c=g;break}else if(h===Ve.Skipped&&!o&&!(r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===ce.GivenUp)){c=g;break}else if(o&&Fo(h)&&Cn[h](r,v)){c=g;break}}const l=c&&parseInt(String(c),10);c&&l!==null&&!isNaN(l)&&(l===-1||l>t)&&(d=l);const m=e.findIndex(f=>f.type===I.Uploading);let p;return m>0&&n?p=e.length-3:m>0||n?p=e.length-2:p=e.length-1,t>=p||d===-1||d!==null&&d>p?m>0&&Object.values(i).some(h=>h.isSubmitted&&!h.isComplete)?m:n?e.length-1:null:d!==null?d:t+1},wa=13,_a=(e,t)=>e.reduce((n,r)=>n.concat(n.map(o=>[...o,r])),[[]]).filter(n=>t||n.length>0),ya=e=>{switch(e.type){case I.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>wa?e.props.options.map(t=>[t.value]):_a(e.props.options.map(t=>t.value),!e.props.properties.required);case I.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const t=e.props.options.map(n=>n.value);return e.props.properties.required||t.push(void 0),t}case I.Likert:return[1,2,3,4,5,...e.props.properties.required?[]:[null]];case I.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case I.VideoVoice:case I.Open:return[zt,...e.props.properties.required?[]:[""]];case I.RecordedTask:return[{taskStatus:ce.Completed},{taskStatus:ce.GivenUp},...e.props.properties.required?[]:[{taskStatus:ce.Abandoned}]];case I.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case I.ConsentLegal:return[zt,...e.props.properties.required?[]:[null]];default:return[zt]}},Fo=e=>e in Cn,ba=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,xa=(e,t)=>{const n=new Set([I.Thanks,I.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(i=>!n.has(i.type));if(t===r.length-1)return 1;const o={[r.length-1]:1,[-1]:0};for(let i=r.length-2;i>=t;i--){const s=r[i],a=s.props.routingOptions||[];if(a.length===0){o[i]=o[i+1]+1;continue}let c=0,d=ya(s);if(d===null)return r.length-1-t;for(let l=0;l<a.length&&d.length!==0;l++){const{comparator:m,target:p,value:f}=a[l],h=d.filter(g=>{const v=kn({value:g},s.type,g);return!(v&&m===Ve.Answered||!v&&m===Ve.Skipped||m===Ve.GivenUp&&ba(g)&&g.taskStatus===ce.GivenUp||v&&Fo(m)&&Cn[m](g,f))});if(h.length<d.length){const g=parseInt(String(p),10);if(g!==-1&&g<=i||g>=r.length)return r.length-1-t;c=Math.max(o[g]+1,c)}d=h}d.length>0&&(c=Math.max(o[i+1]+1,c)),o[i]=c}return o[t]},Ca=e=>!(e.type===I.Thanks||e.type===I.Uploading),z=Vo()((e,t)=>({answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=ze)=>{const r=t(),{fadeout:o,remove:i,trackHistory:s}=r;await o(n),qt(r)||s({event:"closed"}),Jt.enable(),i({initiator:he.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:o,remove:i}=t();r(oe.SurveyComplete),await o(n),Jt.enable(),i({initiator:he.Complete})},endCard:{headline:""},envId:"",eventEmitFn:F.emit.bind(F),fadeout:async n=>{const{eventEmitFn:r,headers:o,viewDocument:i}=t();return qe(o)?Promise.resolve():(r(j.SurveyFadingOut),new Promise(s=>{const a=i.getElementById(n);a?(a.addEventListener("transitionend",()=>{s()}),a.classList.remove("ul-app--visible")):s()}))},frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:o,index:i}=t();o(n,{[Me.QuestionId]:r[i].name,[Me.Props]:r[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:o,isSubmitted:i})=>{var p,f,h;const{cards:s,destroy:a,index:c,uploadProgress:d}=t(),l={...d,[n]:{progressPct:o||o===0?o:(p=d[n])==null?void 0:p.progressPct,isComplete:r||((f=d[n])==null?void 0:f.isComplete),isSubmitted:i||((h=d[n])==null?void 0:h.isSubmitted)}};if(s[c].type!==I.Uploading){e({uploadProgress:l});return}const m=Object.entries(d).every(([g,v])=>!v.isSubmitted||v.isComplete||n==g&&r);if(m&&c>=s.length-1){a(ze);return}e({index:m?c+1:c,uploadingCardViewed:!0,uploadProgress:l})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Fe.Web,"x-ul-environment-id":"","x-ul-installation-method":Ie.Snippet,"x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{cards:r,eventEmitFn:o,index:i,responseGroupUid:s,submit:a,trackHistory:c,uploadProgress:d,viewedCardCount:l}=t(),m=Date.now(),p=[...r],f=p[i],{type:h}=n.data,g={...n.data},v=g.value;Ca(f)&&(f.value=v),g.answeredAt=m,delete g.type;const w={response:g,responseGroupUid:s};let _=h===I.MultipleChoice?Object.values(v).find(x=>x!==!1):v;h===I.MultipleSelect&&(_=p[i].props.options.reduce((x,P)=>(v[P.id]&&x.push(P.value),x),[]));const S=kn(g,h,_),b=Bo({cards:p,index:i,selectedValue:_,hasEndCard:!!n.endCard,hasValidAnswer:S,uploadProgress:d});if(b===null){w.completedAt=m,a(w),n.completeSurvey();return}else[I.Thanks,I.Uploading].includes(p[b].type)&&(w.completedAt=m);const E=a(w);[I.Thanks,I.Uploading].includes(p[b].type)||E.finally(()=>{c({event:"seen",index:b})});const D=p[b];p[b]&&o&&o(oe.CurrentQuestion,{[Me.QuestionId]:D.name,[Me.Props]:D.props}),e({cards:p,hasViewedEmbed:!1,index:b,viewedCardCount:l+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:F,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:o,eventEmitFn:i}=t();["ios","android"].includes(o["userleap-platform"])&&i(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),!qe(o)&&(i(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),r.remove())},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,response:r,responseGroupUid:o})=>{const i=t();if(!o||qt(i))return;const s={responseGroupUid:o,meta:i.meta,customMetadata:i.customMetadata,responses:[r],completedAt:n,previewKey:i.previewKey},a=await ge(`${i.apiURL}/sdk/1/environments/${i.envId}/visitors/${i.userId}/responses/submit`,{body:JSON.stringify(s),headers:i.headers,method:"POST"});if(!a.ok){a.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",a.error),await ar(i,"submitResponse",a.error));return}},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:o=!1})=>{const i=t();if(qt(i))return;const{cards:s,index:a}=i,c=r!==void 0?s[r]:s[a],d={sid:i.surveyId,qid:c.name,action:n,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid},l=await ge(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{body:JSON.stringify(d),headers:i.headers,method:"POST"});!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",l.error),await ar(i,"trackHistory",l.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:o,viewDocument:i}=t();setTimeout(()=>{var a;const s=kr(i);qe(n)?r(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:s}):(a=o.setHeight)==null||a.call(o,s)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),qt=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,ar=async(e,t,n)=>{const{mode:r,userId:o,envId:i,apiURL:s,headers:a,viewDocument:c}=e,d=c.documentElement,l={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:window.navigator.language},m={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:l,vid:o,envId:i};(await ge(`${s}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},a),body:JSON.stringify(m)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},ka=async(e,t)=>{var r;const n=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok){const o=await n.json();return(r=o==null?void 0:o.upload)==null?void 0:r.url}else return null},$o=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",lr=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:$o()};return new MediaRecorder(e,t)},cr=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function dr(e,t,n,r,o,i){if(e&&e.state!=="inactive"){const{[M.BeginCallback]:s}=r,a=e.currentMediaRecordingUid;if(!a)return;s&&s(a),e.onstop=()=>Sa(t,e,n,r,a,o,i),e.stop()}}async function Sa(e,t,n,r,o,i,s){const a=z.getState().viewDocument,{[M.UploadCallback]:c,[M.ProgressCallback]:d}=r,l={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:o,...r[M.PassthroughData]},m=await ka(l,e);if(!m){c&&c(null,{message:"failed to get upload url"});return}const p=new Blob(s,{type:$o()});if(!a.defaultView)return;const f=new a.defaultView.File([p],`recording video ${Date.now()}`),h=i.createUpload({endpoint:m,file:f,chunkSize:5120});h.startTime=Date.now(),h.on("error",g=>{c&&c(null,g)}),h.on("progress",g=>{d&&d(o,g)}),h.on("success",()=>{c&&c(o,!0)})}const Ea={chunks:{}},La={state:{...Ea},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?ae.Video:ae.Audio;this.state.chunks&&t&&o&&(n!=null&&n.currentMediaRecordingUid&&dr(n,t,i,e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&dr(r,t,ae.Screen,e,o,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),n=e.getAudioTracks();let r=t.length&&t[0];r=r||n.length&&n[0],r&&r.addEventListener("ended",()=>{[this.state.avRecorder,this.state.screenRecorder].map(o=>{o&&(o.state==="recording"&&o.stop(),o.stream.getTracks().map(i=>{i.readyState==="live"&&i.stop()}))}),Object.assign(this.state,{avStream:null,captureStream:null,avRecorder:null,screenRecorder:null})})},taskDurationMillisecond(){return this.state.startTime?new Date().getTime()-this.state.startTime.getTime():0},setUpChunk(e){this.state.UpChunk=e},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on(Y.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(Y.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(Y.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(Y.StartTask,this.startTaskCallback.bind(this)),e.on(Y.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(Y.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,o,i;const{[M.StreamReadyCallback]:t,[M.PermissionDescriptors]:n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(s=>s.readyState==="live"&&s.stop()),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes(Ze.Camera),audio:!0}),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(s){console.warn("Error: failed to get permissions: "+s),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[M.ScreenPermissionRequested]:t,[M.StreamReadyCallback]:n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){t==null||t(!1),console.warn("Error: failed to get permissions: "+r),n&&n(null,null);return}t==null||t(!1),this.state.avStream&&this.state.avStream.getAudioTracks().length>0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.captureStream),n&&n(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{[M.RecordingMediaTypes]:t,[M.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(ae.Video)&&this.state.avStream){this.state.avRecorder=lr(this.state.avStream);const o=Be();cr(this.state.avRecorder,o,this.state.chunks),r.push(o)}if(t.includes(ae.Screen)&&this.state.captureStream){this.state.screenRecorder=lr(this.state.captureStream);const o=Be();cr(this.state.screenRecorder,o,this.state.chunks),r.push(o)}r&&n&&n(r)},async finishTaskCallback(e){const{[M.CurrentIndex]:t,[M.TaskResponse]:n,[M.TaskCompleteCallback]:r}=e;await this.stopRecording(e),r&&r(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,n,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var r;const{[M.PermissionStatusCallback]:t}=e,n=this.state.avStream;t&&t(n,n?(n==null?void 0:n.getVideoTracks().length)>0:!1,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:o,screenRecorder:i}=this.state,s=Bo({cards:n,index:e,selectedValue:t.value,hasEndCard:r,hasValidAnswer:kn(t,t.type,t.value)});s!==null&&n[s].type===I.RecordedTask||[o,i].map(a=>{a&&(a.state==="recording"&&a.stop(),a.stream.getTracks().map(c=>{c.readyState==="live"&&c.stop()}))})}},_t=Object.create(La);Object.freeze(_t);function Ho(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ho(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function R(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ho(e))&&(r&&(r+=" "),r+=t);return r}var Ia=0;function u(e,t,n,r,o,i){var s,a,c={};for(a in t)a=="ref"?s=t[a]:c[a]=t[a];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Ia,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return L.vnode&&L.vnode(d),d}const X=e=>u("button",{...e,className:R("ul-card-text__button",e.className),id:"ul-card-text__button"}),ye=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return u(ue,{children:[e&&u("h1",{className:C.QuestionHeader,id:C.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&u("p",{className:C.Caption,id:C.Caption,children:n})]})},ur=({buttonText:e="View Prototype",handleClick:t})=>u("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),Re=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var m;const{handleClickEmbedButton:r,hasViewedEmbed:o,headers:i,useDesktopPrototype:s}=z(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),a=(n==null?void 0:n.conceptUrl)||((m=n==null?void 0:n.consentDocument)==null?void 0:m.url),c=window.innerWidth<Ci,d=i["userleap-platform"],l=(p,f)=>{p.preventDefault(),r(f)};if(!s&&c&&!o&&a&&["email","link"].includes(d)){if(t==="prototype")return u(ur,{handleClick:p=>{l(p,oe.ViewPrototypeClick)}});if(t==="pdf")return u(ur,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{l(p,oe.ViewAgreementClick)}})}return e()},zo=(e,t)=>{const n=Te(0),r=()=>{if(e.current){const o=e.current;o.style.height="1px";const i=o.scrollHeight,s=o.offsetHeight-o.clientHeight,a=i+s,c=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),d=a<=c?a:c;n.current!==d&&t(),n.current=d,o.style.height=`${d}px`}};return re(r,[]),r},qo=({border:e,label:t,isSelected:n,value:r,text:o,id:i,isRadio:s,useMobileStyling:a,error:c,allowTextEntry:d,promptText:l,onUserInputChanged:m})=>{const{styleNonce:p,viewDocument:f}=z(T=>({styleNonce:T.styleNonce,viewDocument:T.viewDocument})),[h,g]=Z(!1);Pa(f,e,p);const v=({isSelected:T,userText:V})=>{m&&m({id:i||"",selected:T,value:r,userText:V})},w=T=>{T.stopPropagation(),v({isSelected:s||!n,userText:o}),g(!1)},_=()=>{h||g(!0)},S=()=>{h&&g(!1)},b=T=>{ot(T.target)||(T.key==="Enter"||T.key===" ")&&w(T)},E={onClick:T=>w(T),onKeyPress:T=>b(T)};"ontouchstart"in f.documentElement?(E.onTouchStart=S,E.onTouchCancel=S,E.onTouchEnd=S):(E.onMouseDown=_,E.onMouseLeave=S);const D=s?`radio-${i}`:`checkbox-${i}`,x=n||h?[yt]:[],P=[...c?[Wo]:[],...x];return u("div",{className:R([...W(C.Choice,a),...P]),id:`choice-div-${i}`,style:c?{borderColor:rt}:{},...E,children:[u("div",{className:R([C.ChoiceLabelContainer]),children:[s?u("div",{"aria-labelledby":`label-${i}`,className:R([C.ChoiceRadio,...x]),id:D,role:"radio",tabIndex:0}):u("div",{"aria-checked":n,"aria-labelledby":`label-${i}`,className:C.ChoiceCheckbox,id:D,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&u("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:u("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),u("label",{className:R(W(C.ChoiceLabel,a)),htmlFor:D,id:`label-${i}`,children:t})]}),d&&n&&u("div",{className:R([C.ChoiceTextEntryContainer,...x]),children:u(Ua,{onTextChange:T=>v({isSelected:n,userText:T}),promptText:l||"Please specify",textValue:o,useMobileStyling:a})})]})},Ua=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const o=Te(null),{update:i}=z(a=>({update:a.update})),s=zo(o,()=>i());return re(()=>{o.current&&o.current.focus()},[]),u("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:R(W(C.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:a=>{s(),ot(a.target)&&(a.stopPropagation(),n(a.target.value))},onClick:a=>{a.stopPropagation()},onKeyPress:a=>{a.stopPropagation()},placeholder:e,ref:o,role:"textbox",rows:1,value:t})},pr="ul-select-style-element",yt="ul-select-active-dynamic-style",Wo="ul-select-error-dynamic-style",Ta=e=>e.tagName.toLowerCase()==="style",Pa=(e,t,n)=>{let r=e.getElementById(pr),o=!1;r||(r=e.createElement("style"),o=!0),Ta(r)&&(r.id=pr,n&&(r.nonce=n),r.textContent=Ra(t),o&&e.head.appendChild(r))},Ra=e=>`
18
- .${yt} {
17
+ */var Ot=Fo,_a=Ho.exports;function ya(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ba=typeof Object.is=="function"?Object.is:ya,xa=_a.useSyncExternalStore,Ca=Ot.useRef,ka=Ot.useEffect,Sa=Ot.useMemo,Ea=Ot.useDebugValue;Bo.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=Ca(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=Sa(function(){function c(f){if(!d){if(d=!0,l=f,f=r(f),o!==void 0&&s.hasValue){var h=s.value;if(o(h,f))return m=h}return m=f}if(h=m,ba(l,f))return h;var g=r(f);return o!==void 0&&o(h,g)?h:(l=f,m=g)}var d=!1,l,m,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,o]);var a=xa(e,i[0],i[1]);return ka(function(){s.hasValue=!0,s.value=a},[a]),Ea(a),a};(function(e){e.exports=Bo})(Vo);const La=Oi(Vo.exports),{useSyncExternalStoreWithSelector:Ia}=La;function Ua(e,t=e.getState,n){const r=Ia(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return Cn(r),r}const dr=e=>{const t=typeof e=="function"?Gs(e):e,n=(r,o)=>Ua(t,r,o);return Object.assign(n,t),n},zo=e=>e?dr(e):dr,qt=1,Ln={eq(e,t){return e==t},neq(e,t){return!this.eq(e,t)},gt(e,t){return e>t},gte(e,t){return e>=t},lt(e,t){return e<t},lte(e,t){return e<=t},list_exact(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:e.slice().sort().join(",")===t.slice().sort().join(",")},list_all(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:!t.some(n=>e.indexOf(n)===-1)},list_alo(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:t.some(n=>e.indexOf(n)!=-1)}},In=(e,t,n)=>{switch(t){case I.VideoVoice:return Boolean(e&&e.value);case I.Open:return!!n;case I.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case I.RecordedTask:return(n==null?void 0:n.taskStatus)===de.Completed;case I.TextUrlPrompt:return!e.value;case I.ConsentLegal:return n!==null;case I.MultipleChoice:return n!==void 0;case I.NPS:return n!==null;case I.Likert:return n!==null;default:return!0}},qo=({cards:e,index:t,hasEndCard:n,selectedValue:r,hasValidAnswer:o=!0,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const a=e[t].props.routingOptions||[];let c=null,d=null;for(let f=0;f<a.length;f++){const{comparator:h,target:g,value:v}=a[f];if(h===Be.Answered&&o){c=g;break}else if(h===Be.GivenUp&&r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===de.GivenUp){c=g;break}else if(h===Be.Skipped&&!o&&!(r instanceof Object&&"taskStatus"in r&&(r==null?void 0:r.taskStatus)===de.GivenUp)){c=g;break}else if(o&&Wo(h)&&Ln[h](r,v)){c=g;break}}const l=c&&parseInt(String(c),10);c&&l!==null&&!isNaN(l)&&(l===-1||l>t)&&(d=l);const m=e.findIndex(f=>f.type===I.Uploading);let p;return m>0&&n?p=e.length-3:m>0||n?p=e.length-2:p=e.length-1,t>=p||d===-1||d!==null&&d>p?m>0&&Object.values(i).some(h=>h.isSubmitted&&!h.isComplete)?m:n?e.length-1:null:d!==null?d:t+1},Pa=13,Ta=(e,t)=>e.reduce((n,r)=>n.concat(n.map(o=>[...o,r])),[[]]).filter(n=>t||n.length>0),Da=e=>{switch(e.type){case I.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>Pa?e.props.options.map(t=>[t.value]):Ta(e.props.options.map(t=>t.value),!e.props.properties.required);case I.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const t=e.props.options.map(n=>n.value);return e.props.properties.required||t.push(void 0),t}case I.Likert:return[1,2,3,4,5,...e.props.properties.required?[]:[null]];case I.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case I.VideoVoice:case I.Open:return[qt,...e.props.properties.required?[]:[""]];case I.RecordedTask:return[{taskStatus:de.Completed},{taskStatus:de.GivenUp},...e.props.properties.required?[]:[{taskStatus:de.Abandoned}]];case I.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case I.ConsentLegal:return[qt,...e.props.properties.required?[]:[null]];default:return[qt]}},Wo=e=>e in Ln,Ra=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,Aa=(e,t)=>{const n=new Set([I.Thanks,I.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(i=>!n.has(i.type));if(t===r.length-1)return 1;const o={[r.length-1]:1,[-1]:0};for(let i=r.length-2;i>=t;i--){const s=r[i],a=s.props.routingOptions||[];if(a.length===0){o[i]=o[i+1]+1;continue}let c=0,d=Da(s);if(d===null)return r.length-1-t;for(let l=0;l<a.length&&d.length!==0;l++){const{comparator:m,target:p,value:f}=a[l],h=d.filter(g=>{const v=In({value:g},s.type,g);return!(v&&m===Be.Answered||!v&&m===Be.Skipped||m===Be.GivenUp&&Ra(g)&&g.taskStatus===de.GivenUp||v&&Wo(m)&&Ln[m](g,f))});if(h.length<d.length){const g=parseInt(String(p),10);if(g!==-1&&g<=i||g>=r.length)return r.length-1-t;c=Math.max(o[g]+1,c)}d=h}d.length>0&&(c=Math.max(o[i+1]+1,c)),o[i]=c}return o[t]},Oa=e=>!(e.type===I.Thanks||e.type===I.Uploading),z=zo()((e,t)=>({answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=ze)=>{const r=t(),{fadeout:o,remove:i,trackHistory:s}=r;await o(n),Wt(r)||s({event:"closed"}),Xt.enable(),i({initiator:he.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:o,remove:i}=t();r(ie.SurveyComplete),await o(n),Xt.enable(),i({initiator:he.Complete})},endCard:{headline:""},envId:"",eventEmitFn:F.emit.bind(F),fadeout:async n=>{const{eventEmitFn:r,headers:o,viewDocument:i}=t();return qe(o)?Promise.resolve():(r(j.SurveyFadingOut),new Promise(s=>{const a=i.getElementById(n);a?(a.addEventListener("transitionend",()=>{s()}),a.classList.remove("ul-app--visible")):s()}))},frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:o,index:i}=t();o(n,{[Ne.QuestionId]:r[i].name,[Ne.Props]:r[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:o,isSubmitted:i})=>{var p,f,h;const{cards:s,destroy:a,index:c,uploadProgress:d}=t(),l={...d,[n]:{progressPct:o||o===0?o:(p=d[n])==null?void 0:p.progressPct,isComplete:r||((f=d[n])==null?void 0:f.isComplete),isSubmitted:i||((h=d[n])==null?void 0:h.isSubmitted)}};if(s[c].type!==I.Uploading){e({uploadProgress:l});return}const m=Object.entries(d).every(([g,v])=>!v.isSubmitted||v.isComplete||n==g&&r);if(m&&c>=s.length-1){a(ze);return}e({index:m?c+1:c,uploadingCardViewed:!0,uploadProgress:l})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Fe.Web,"x-ul-environment-id":"","x-ul-installation-method":Ie.Snippet,"x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{cards:r,eventEmitFn:o,index:i,responseGroupUid:s,submit:a,trackHistory:c,uploadProgress:d,viewedCardCount:l}=t(),m=Date.now(),p=[...r],f=p[i],{type:h}=n.data,g={...n.data},v=g.value;Oa(f)&&(f.value=v),g.answeredAt=m,delete g.type;const y={response:g,responseGroupUid:s};let w=h===I.MultipleChoice?Object.values(v).find(x=>x!==!1):v;h===I.MultipleSelect&&(w=p[i].props.options.reduce((x,T)=>(v[T.id]&&x.push(T.value),x),[]));const C=In(g,h,w),b=qo({cards:p,index:i,selectedValue:w,hasEndCard:!!n.endCard,hasValidAnswer:C,uploadProgress:d});if(b===null){y.completedAt=m,a(y),n.completeSurvey();return}else[I.Thanks,I.Uploading].includes(p[b].type)&&(y.completedAt=m);const E=a(y);[I.Thanks,I.Uploading].includes(p[b].type)||E.finally(()=>{c({event:"seen",index:b})});const A=p[b];p[b]&&o&&o(ie.CurrentQuestion,{[Ne.QuestionId]:A.name,[Ne.Props]:A.props}),e({cards:p,hasViewedEmbed:!1,index:b,viewedCardCount:l+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:F,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:o,eventEmitFn:i}=t();["ios","android"].includes(o["userleap-platform"])&&i(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),!qe(o)&&(i(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),r.remove())},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,response:r,responseGroupUid:o})=>{const i=t();if(!o||Wt(i))return;const s={responseGroupUid:o,meta:i.meta,customMetadata:i.customMetadata,responses:[r],completedAt:n,previewKey:i.previewKey},a=await ge(`${i.apiURL}/sdk/1/environments/${i.envId}/visitors/${i.userId}/responses/submit`,{body:JSON.stringify(s),headers:i.headers,method:"POST"});if(!a.ok){a.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",a.error),await ur(i,"submitResponse",a.error));return}},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:o=!1})=>{const i=t();if(Wt(i))return;const{cards:s,index:a}=i,c=r!==void 0?s[r]:s[a],d={sid:i.surveyId,qid:c.name,action:n,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid},l=await ge(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{body:JSON.stringify(d),headers:i.headers,method:"POST"});!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",l.error),await ur(i,"trackHistory",l.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:o,viewDocument:i}=t();setTimeout(()=>{var a;const s=Ir(i);qe(n)?r(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:s}):(a=o.setHeight)==null||a.call(o,s)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),Wt=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,ur=async(e,t,n)=>{const{mode:r,userId:o,envId:i,apiURL:s,headers:a,viewDocument:c}=e,d=c.documentElement,l={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:window.navigator.language},m={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:l,vid:o,envId:i};(await ge(`${s}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},a),body:JSON.stringify(m)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},ja=async(e,t)=>{var r;const n=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok){const o=await n.json();return(r=o==null?void 0:o.upload)==null?void 0:r.url}else return null},Go=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",pr=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Go()};return new MediaRecorder(e,t)},fr=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function mr(e,t,n,r,o,i){if(e&&e.state!=="inactive"){const{[N.BeginCallback]:s}=r,a=e.currentMediaRecordingUid;if(!a)return;s&&s(a),e.onstop=()=>Ma(t,e,n,r,a,o,i),e.stop()}}async function Ma(e,t,n,r,o,i,s){const a=z.getState().viewDocument,{[N.UploadCallback]:c,[N.ProgressCallback]:d}=r,l={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:o,...r[N.PassthroughData]},m=await ja(l,e);if(!m){c&&c(null,{message:"failed to get upload url"});return}const p=new Blob(s,{type:Go()});if(!a.defaultView)return;const f=new a.defaultView.File([p],`recording video ${Date.now()}`),h=i.createUpload({endpoint:m,file:f,chunkSize:5120});h.startTime=Date.now(),h.on("error",g=>{c&&c(null,g)}),h.on("progress",g=>{d&&d(o,g)}),h.on("success",()=>{c&&c(o,!0)})}const Na={chunks:{}},Va={state:{...Na},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?le.Video:le.Audio;this.state.chunks&&t&&o&&(n!=null&&n.currentMediaRecordingUid&&mr(n,t,i,e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&mr(r,t,le.Screen,e,o,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),n=e.getAudioTracks();let r=t.length&&t[0];r=r||n.length&&n[0],r&&r.addEventListener("ended",()=>{[this.state.avRecorder,this.state.screenRecorder].map(o=>{o&&(o.state==="recording"&&o.stop(),o.stream.getTracks().map(i=>{i.readyState==="live"&&i.stop()}))}),Object.assign(this.state,{avStream:null,captureStream:null,avRecorder:null,screenRecorder:null})})},taskDurationMillisecond(){return this.state.startTime?new Date().getTime()-this.state.startTime.getTime():0},setUpChunk(e){this.state.UpChunk=e},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on(Y.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(Y.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(Y.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(Y.StartTask,this.startTaskCallback.bind(this)),e.on(Y.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(Y.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,o,i;const{[N.StreamReadyCallback]:t,[N.PermissionDescriptors]:n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(s=>s.readyState==="live"&&s.stop()),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes(Ze.Camera),audio:!0}),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(s){console.warn("Error: failed to get permissions: "+s),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[N.ScreenPermissionRequested]:t,[N.StreamReadyCallback]:n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){t==null||t(!1),console.warn("Error: failed to get permissions: "+r),n&&n(null,null);return}t==null||t(!1),this.state.avStream&&this.state.avStream.getAudioTracks().length>0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.captureStream),n&&n(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{[N.RecordingMediaTypes]:t,[N.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(le.Video)&&this.state.avStream){this.state.avRecorder=pr(this.state.avStream);const o=Pe();fr(this.state.avRecorder,o,this.state.chunks),r.push(o)}if(t.includes(le.Screen)&&this.state.captureStream){this.state.screenRecorder=pr(this.state.captureStream);const o=Pe();fr(this.state.screenRecorder,o,this.state.chunks),r.push(o)}r&&n&&n(r)},async finishTaskCallback(e){const{[N.CurrentIndex]:t,[N.TaskResponse]:n,[N.TaskCompleteCallback]:r}=e;await this.stopRecording(e),r&&r(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,n,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var r;const{[N.PermissionStatusCallback]:t}=e,n=this.state.avStream;t&&t(n,n?(n==null?void 0:n.getVideoTracks().length)>0:!1,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:o,screenRecorder:i}=this.state,s=qo({cards:n,index:e,selectedValue:t.value,hasEndCard:r,hasValidAnswer:In(t,t.type,t.value)});s!==null&&n[s].type===I.RecordedTask||[o,i].map(a=>{a&&(a.state==="recording"&&a.stop(),a.stream.getTracks().map(c=>{c.readyState==="live"&&c.stop()}))})}},yt=Object.create(Va);Object.freeze(yt);function Ko(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ko(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function R(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ko(e))&&(r&&(r+=" "),r+=t);return r}var Ba=0;function u(e,t,n,r,o,i){var s,a,c={};for(a in t)a=="ref"?s=t[a]:c[a]=t[a];var d={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Ba,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return L.vnode&&L.vnode(d),d}const ne=e=>u("button",{...e,className:R("ul-card-text__button",e.className),id:"ul-card-text__button"}),ye=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return u(ue,{children:[e&&u("h1",{className:k.QuestionHeader,id:k.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&u("p",{className:k.Caption,id:k.Caption,children:n})]})},hr=({buttonText:e="View Prototype",handleClick:t})=>u("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),Re=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var m;const{handleClickEmbedButton:r,hasViewedEmbed:o,headers:i,useDesktopPrototype:s}=z(p=>({handleClickEmbedButton:p.handleClickEmbedButton,hasViewedEmbed:p.hasViewedEmbed,headers:p.headers,useDesktopPrototype:p.useDesktopPrototype})),a=(n==null?void 0:n.conceptUrl)||((m=n==null?void 0:n.consentDocument)==null?void 0:m.url),c=window.innerWidth<Ii,d=i["userleap-platform"],l=(p,f)=>{p.preventDefault(),r(f)};if(!s&&c&&!o&&a&&["email","link"].includes(d)){if(t==="prototype")return u(hr,{handleClick:p=>{l(p,ie.ViewPrototypeClick)}});if(t==="pdf")return u(hr,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:p=>{l(p,ie.ViewAgreementClick)}})}return e()},Zo=(e,t)=>{const n=Te(0),r=()=>{if(e.current){const o=e.current;o.style.height="1px";const i=o.scrollHeight,s=o.offsetHeight-o.clientHeight,a=i+s,c=parseInt(window.getComputedStyle(o).getPropertyValue("max-height")),d=a<=c?a:c;n.current!==d&&t(),n.current=d,o.style.height=`${d}px`}};return oe(r,[]),r},Yo=({border:e,label:t,isSelected:n,value:r,text:o,id:i,isRadio:s,useMobileStyling:a,error:c,allowTextEntry:d,promptText:l,onUserInputChanged:m})=>{const{styleNonce:p,viewDocument:f}=z(P=>({styleNonce:P.styleNonce,viewDocument:P.viewDocument})),[h,g]=Z(!1);$a(f,e,p);const v=({isSelected:P,userText:V})=>{m&&m({id:i||"",selected:P,value:r,userText:V})},y=P=>{P.stopPropagation(),v({isSelected:s||!n,userText:o}),g(!1)},w=()=>{h||g(!0)},C=()=>{h&&g(!1)},b=P=>{ot(P.target)||(P.key==="Enter"||P.key===" ")&&y(P)},E={onClick:P=>y(P),onKeyPress:P=>b(P)};"ontouchstart"in f.documentElement?(E.onTouchStart=C,E.onTouchCancel=C,E.onTouchEnd=C):(E.onMouseDown=w,E.onMouseLeave=C);const A=s?`radio-${i}`:`checkbox-${i}`,x=n||h?[bt]:[],T=[...c?[Qo]:[],...x];return u("div",{className:R([...W(k.Choice,a),...T]),id:`choice-div-${i}`,style:c?{borderColor:rt}:{},...E,children:[u("div",{className:R([k.ChoiceLabelContainer]),children:[s?u("div",{"aria-labelledby":`label-${i}`,className:R([k.ChoiceRadio,...x]),id:A,role:"radio",tabIndex:0}):u("div",{"aria-checked":n,"aria-labelledby":`label-${i}`,className:k.ChoiceCheckbox,id:A,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&u("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:u("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),u("label",{className:R(W(k.ChoiceLabel,a)),htmlFor:A,id:`label-${i}`,children:t})]}),d&&n&&u("div",{className:R([k.ChoiceTextEntryContainer,...x]),children:u(Fa,{onTextChange:P=>v({isSelected:n,userText:P}),promptText:l||"Please specify",textValue:o,useMobileStyling:a})})]})},Fa=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const o=Te(null),{update:i}=z(a=>({update:a.update})),s=Zo(o,()=>i());return oe(()=>{o.current&&o.current.focus()},[]),u("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:R(W(k.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:a=>{s(),ot(a.target)&&(a.stopPropagation(),n(a.target.value))},onClick:a=>{a.stopPropagation()},onKeyPress:a=>{a.stopPropagation()},placeholder:e,ref:o,role:"textbox",rows:1,value:t})},gr="ul-select-style-element",bt="ul-select-active-dynamic-style",Qo="ul-select-error-dynamic-style",Ha=e=>e.tagName.toLowerCase()==="style",$a=(e,t,n)=>{let r=e.getElementById(gr),o=!1;r||(r=e.createElement("style"),o=!0),Ha(r)&&(r.id=gr,n&&(r.nonce=n),r.textContent=za(t),o&&e.head.appendChild(r))},za=e=>`
18
+ .${bt} {
19
19
  border-color: ${e};
20
20
  }
21
- .${yt} .${C.ChoiceRadio}, .${yt}.${C.ChoiceRadio} {
21
+ .${bt} .${k.ChoiceRadio}, .${bt}.${k.ChoiceRadio} {
22
22
  border: 6px solid ${e};
23
23
  box-shadow: none;
24
24
  }
25
- .${Wo} {
25
+ .${Qo} {
26
26
  border-color: ${rt};
27
27
  }
28
- `,Je=e=>(e==null?void 0:e.buttonText)||"Next",Sn=e=>(e==null?void 0:e.skipButtonText)||"Skip",Da=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,useMobileStyling:a,border:c}=z(k=>({headers:k.headers,useMobileStyling:k.useMobileStyling,border:k.border})),[d,l]=Z(!1),[m,p]=Z(""),[f,h]=Z(!1),g=s["userleap-platform"],v=r==null?void 0:r.collectName,w=(r==null?void 0:r.nameLabelText)||"Full Name",_=(r==null?void 0:r.consentText)||"I agree to the stated conditions",S=(r==null?void 0:r.submitButtonText)||"Submit",b=!!m.trim(),E=d&&(!v||b),D=(k,$=!1)=>{k.preventDefault(),k.stopPropagation();let y=null;if(!$){if(!E){h(!0);return}y={submitted:!0},v&&(y.name=m)}n({value:y,questionId:o,type:i})},x=k=>{Ii(k.target)&&(k.preventDefault(),k.stopPropagation(),p(k.target.value))},P=k=>{We(k.target)&&(k.target.style.borderColor=f&&!b?rt:c)},T=k=>{We(k.target)&&(k.target.style.borderColor=f&&!b?rt:hn)},V=()=>u("div",{children:[u(qo,{allowTextEntry:!1,border:c,error:f&&!d,index:0,isRadio:!1,isSelected:d,label:_,onUserInputChanged:({selected:k})=>{k!==d&&l(!d)},useMobileStyling:a}),v&&u("input",{"aria-label":w,"aria-placeholder":w,className:R(W(C.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:T,onFocus:P,onInput:x,placeholder:w,style:f&&!b?{borderColor:rt}:{},tabIndex:0,value:m}),u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[u(X,{className:E?"":C.ButtonDisabled,onClick:D,children:S}),r.required===!1&&u("button",{className:"ul-card-skip__button",onClick:k=>D(k,!0),children:Sn(r)})]})]});return u("div",{className:R(_e(C.CardMainContent,g)),children:u("div",{className:R([e,"ul-card__consent-legal",C.FadeInTransition]),children:[u(ye,{message:t}),u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),u(Re,{properties:r,defaultBody:V,embeddedType:"pdf"})]},o)})},Aa=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:o,range:i,scaleLabelType:s,setActiveValue:a,setIsPressed:c,useMobileStyling:d,value:l})=>{const m=`option-${l}`,p=s===Ne.Number,f=s===Ne.Star,h=p&&l===e,[g,v]=(()=>l<=e&&f||l===e?r?[t,1]:[t,.3]:["",1])(),w=()=>{switch(s){case Ne.Star:return R([...W(C.LikertStar,d),...W(`${C.LikertStar}-${l}`,d)]);case Ne.Smiley:return R([...W(C.LikertSmiley,d),...W(`${C.LikertSmiley}-${l}`,d)]);default:return R(l===i?[...W(C.LikertNumber,d),...W(`${C.LikertNumber}-${l}`,d),...W("likert-last-option",d)]:[...W(C.LikertNumber,d),...W(`${C.LikertNumber}-${l}`,d)])}},_=()=>{a(-1),c(!1)};return u("div",{"aria-label":p?void 0:String(l),className:w(),dangerouslySetInnerHTML:{__html:n},id:m,onClick:()=>o(),onPointerDown:()=>c(!0),onPointerEnter:()=>a(l),onPointerLeave:_,role:"radio",style:{color:p?"":g,borderColor:h?g:"",fillOpacity:h?"":v,zIndex:h?3:"auto"},tabIndex:0})},ja=({className:e,labels:t,message:n,next:r,properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(V=>({border:V.border,headers:V.headers,useMobileStyling:V.useMobileStyling})),[l,m]=Z(-1),[p,f]=Z(!1),h=c["userleap-platform"],g=t&&t.left,v=t&&t.right;let w;const{range:_,scaleLabelType:S,ratingIcons:b}=o;_&&(w=Number(_));const E=w||5,D=V=>{var k,$;switch(S){case Ne.Star:return(k=b[0])==null?void 0:k.svg;case Ne.Smiley:return($=b[V])==null?void 0:$.svg;default:return String(V+1)}},x=[...Array(E)].map((V,k)=>{const $=k+1;return u(Aa,{activeValue:l,border:a,icon:D(k),isPressed:p,onSubmit:()=>r({value:$,questionId:i,type:s}),range:E,scaleLabelType:S,setActiveValue:m,setIsPressed:f,useMobileStyling:d,value:$},k)}),P=V=>{V.preventDefault(),V.stopPropagation(),r({value:null,questionId:i,type:s})},T=()=>u(ue,{children:[u("div",{"aria-label":`Rating (1 - ${E})`,className:"ul-card--likert__numbers",role:"radiogroup",children:x}),u("div",{className:"ul-card--likert__labels",children:[u("span",{children:g}),u("span",{children:v})]}),!o.required&&u("div",{className:"ul-vertical-centered-container",children:u(X,{onClick:P,children:Je(o)})})]});return u("div",{className:R(_e(C.CardMainContent,h)),children:u("form",{className:R([e,"ul-card--likert",C.FadeInTransition]),children:[u(ye,{message:n,properties:o}),u(Re,{properties:o,defaultBody:T})]},i)})},Go=({className:e,message:t,onSubmit:n,options:r=[],properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(x=>({border:x.border,headers:x.headers,useMobileStyling:x.useMobileStyling})),l=r.reduce((x,P)=>(x[P.id]={isSelected:!1},x),{}),[m,p]=Z(l),f=c["userleap-platform"],h=s===I.MultipleChoice,g=o.required,v=Object.entries(m).some(([x,P])=>{var k;const T=r.find($=>`${$.id}`===x),V=P.userText===void 0||P.userText.trim()==="";return((k=T==null?void 0:T.optionProperties)==null?void 0:k.allowsTextEntry)&&V&&P.isSelected}),w=Object.values(m).some(x=>x.isSelected),_=v||g&&!w,S=r.map(({id:x,label:P,value:T,optionProperties:V},k)=>{var B,O;const $=`${x}`,{allowsTextEntry:y}=V||{allowsTextEntry:!1};return u(qo,{allowTextEntry:y,border:a,error:!1,id:$,index:k,isRadio:h,isSelected:!!((B=m[$])!=null&&B.isSelected),label:P,onUserInputChanged:ie=>E(ie.id,ie.selected,ie.userText),promptText:"Please specify",text:(O=m[x])==null?void 0:O.userText,useMobileStyling:d,value:T},$)}),b=x=>{x.preventDefault(),x.stopPropagation(),n(m)},E=(x,P,T)=>{const V=Object.assign({},m);if(h&&P)for(const k of Object.values(V))k.isSelected=!1,delete k.userText;V[x]={isSelected:P,userText:T},p(V)},D=()=>u("div",{children:[u("div",{className:R(W(C.ChoiceGroup,d)),role:h?"radiogroup":"group",children:S}),u("div",{className:"ul-card__button-wrapper",children:u(X,{disabled:_,onClick:b,children:Je(o)})})]});return u("div",{className:R(_e(C.CardMainContent,f)),children:u("form",{className:R([e,"ul-card--multiple",C.FadeInTransition]),id:"text-form",onSubmit:b,children:[u(ye,{message:t,properties:o}),u(Re,{properties:o,defaultBody:D})]},i)})},Oa=e=>{const{questionId:t,type:n,next:r,options:o}=e;return u(Go,{...e,onSubmit:s=>{const a=Object.entries(s).find(([,p])=>p.isSelected)||[void 0,void 0],[c,d]=a,l=o.find(p=>`${p.id}`===c),m=d!=null&&d.userText?{[c]:{userText:d.userText}}:null;r({value:l&&c?{[c]:l.value}:{},secondaryValue:m,questionId:t,type:n})}})},Ma=e=>{const{questionId:t,type:n,next:r}=e;return u(Go,{...e,onSubmit:i=>{const s={},a=Object.entries(i).reduce((d,[l,m])=>(d[l]=m.isSelected,d),s),c=Object.entries(i).reduce((d,[l,m])=>{if(!m.userText)return d;const p=d||{};return p[l]={userText:m.userText},p},null);r({value:a,secondaryValue:c,questionId:t,type:n})}})},Na=({className:e,props:{labels:t,message:n,properties:r},next:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(v=>({border:v.border,headers:v.headers,useMobileStyling:v.useMobileStyling})),l=c["userleap-platform"],m=t&&t.left,p=t&&t.right,f=[...Array(11)].map((v,w)=>u("div",{className:R([...W(C.NPSNumber,d),...W(`${C.NPSNumber}-${w}`,d)]),id:`option-${w}`,onClick:()=>o({value:w,questionId:i,type:s}),onKeyPress:_=>{_.preventDefault(),(_.key==="Enter"||_.key===" ")&&o({value:w,questionId:i,type:s})},onPointerDown:_=>{We(_.target)&&(_.target.style.zIndex="2",_.target.style.borderColor=a)},onPointerLeave:_=>{We(_.target)&&(_.target.style.zIndex="auto",_.target.style.borderColor=hn)},role:"radio",tabIndex:0,children:w},w)),h=v=>{v.preventDefault(),v.stopPropagation(),o({value:null,questionId:i,type:s})},g=()=>u("div",{children:[u("div",{className:"ul-card--nps__numbers",children:f}),u("div",{className:"ul-card--nps__labels",children:[u("span",{children:m}),u("span",{children:p})]}),!r.required&&u("div",{className:"ul-vertical-centered-container",children:u(X,{onClick:h,children:Je(r)})})]});return u("div",{className:R(_e(C.CardMainContent,l)),children:u("form",{className:R([e,"ul-card--nps",C.FadeInTransition]),children:[u(ye,{message:n,properties:r}),u(Re,{properties:r,defaultBody:g})]},i)})},Va=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{border:s,headers:a,useMobileStyling:c,update:d}=z(x=>({border:x.border,headers:x.headers,useMobileStyling:x.useMobileStyling,update:x.update})),[l,m]=Z(""),p=Te(null),f=a["userleap-platform"],h=l.trim(),g=r.required===!0&&!h,v=zo(p,()=>d()),w=x=>{v(),x.preventDefault(),x.stopPropagation(),ot(x.target)&&m(x.target.value)},_=x=>{x.preventDefault(),x.stopPropagation(),n({value:l,questionId:o,type:i})},S=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",b=x=>{ot(x.target)&&(x.target.style.borderColor=s)},E=x=>{ot(x.target)&&(x.target.style.borderColor=hn)},D=()=>u("div",{className:"ul-card-text",children:[u("div",{className:"ul-card-text__container",children:u("textarea",{"aria-label":S,"aria-labelledby":C.QuestionHeader,"aria-multiline":"true","aria-placeholder":S,className:R(W(C.OpenTextInput,c)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:E,onChange:w,onFocus:b,placeholder:S,ref:p,role:"textbox",tabIndex:0})}),u(X,{disabled:g,onClick:_,style:{backgroundColor:g?"":s},children:Je(r)})]});return u("div",{className:R(_e(C.CardMainContent,f)),children:u("form",{className:R([e,"ul-card--text",C.FadeInTransition]),id:"text-form",children:[u(ye,{message:t,properties:r}),u(Re,{defaultBody:D,properties:r})]},o)})};var Ee=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Ee||{});const jt=e=>e.type===ne.AvPermission,Ko=e=>e.type===ne.ScreenPermission,Ba=(e,t)=>!(jt(t)?t.permissionDescriptors:[]).includes(Ze.Camera)||e.getVideoTracks().length>0,Zo=(e,t)=>{if(e===void 0)return Ee.RequestNeeded;if(e){if(!Ba(e,t))return Ee.RequestNeeded}else return Ee.TryAgain;return Ee.Ready},fr={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ve=Vo(e=>({...fr,reset:()=>{e(fr)},updatePage:t=>{e(t)}}));function cn({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:o}=ve.getState(),{recorderEventEmitter:i}=z.getState();i.emit(Y.AvPermission,{[M.PermissionDescriptors]:e.permissionDescriptors,[M.StreamReadyCallback]:(s,a)=>{if(n===s)return;let c=e;if(s&&!e.permissionDescriptors.includes(Ze.Camera)){const d=t.indexOf(e),l=a!=null&&a.active?d+2:d+1;(a==null?void 0:a.active)&&r&&i.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:r,[M.StartRecordingCallback]:m=>o({mediaRecordingUids:m})}),c=t[l]}o({currentPage:c,avStream:s})}})}function Fa({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:o,next:i}){const{updatePage:s}=ve.getState(),{eventEmitFn:a,recorderEventEmitter:c}=z.getState(),d={questionId:o,surveyId:r,visitorId:t,responseGroupUid:n};let l=0;c.emit(oe.RecordedTaskPermissionScreen),a(oe.RecordedTaskPermissionScreen),c.emit(Y.PermissionStatus,{[M.PermissionStatusCallback]:(p,f,h,g)=>{const v=e[l],{type:w}=v,_=[ae.Screen];if(jt(v)){const{permissionDescriptors:S}=v,b=S==null?void 0:S.includes(Ze.Microphone),E=S==null?void 0:S.includes(Ze.Camera);b&&_.push(ae.Audio),E&&_.push(ae.Video);const D=(p==null?void 0:p.active)&&!E,x=(p==null?void 0:p.active)&&f;(D||x)&&l++}Ko(e[l])&&h&&(l++,c.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:_,[M.StartRecordingCallback]:S=>s({mediaRecordingUids:S})})),s({currentPage:e[l],avStream:p,screenPermissionRequested:h,nextQuestion:i,type:w,passthroughData:d,recordingMediaTypes:_,captureStream:g})}});const m=e[l];return m.type===ne.AvPermission&&cn({currentPage:m,pages:e}),m}function dn({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:o}=ve.getState(),{recorderEventEmitter:i,handleUploadUpdate:s,index:a}=z.getState(),c={value:{taskStatus:e},type:I.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||i.emit(Y.FinishTask,{[M.BeginCallback]:d=>{s({mediaRecordingUid:d,isSubmitted:!0,progressPct:0,isComplete:!1})},[M.ProgressCallback]:(d,l)=>{s({mediaRecordingUid:d,progressPct:l.detail,isSubmitted:!1,isComplete:!1})},[M.UploadCallback]:d=>{d&&s({mediaRecordingUid:d,isComplete:!0,isSubmitted:!0,progressPct:100})},[M.PassthroughData]:n,[M.CurrentIndex]:a,[M.TaskResponse]:c,[M.TaskCompleteCallback]:d=>{c.value.taskDurationMillisecond=d,r&&(c.value.mediaRecordingUids=r),o(),t(c)}})}function En({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=z.getState(),{updatePage:o,currentPage:i,recordingMediaTypes:s,screenPermissionRequested:a}=ve.getState();if(!i)return;const c=e.indexOf(i);switch(i.type){case ne.AvPermission:{const d=a?c+2:c+1;a&&s&&n.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:s,[M.StartRecordingCallback]:l=>{o({mediaRecordingUids:l})}}),o({currentPage:e[d]});return}case ne.ScreenPermission:n.emit(Y.ScreenPermission,{[M.ScreenPermissionRequested]:t,[M.StreamReadyCallback]:(d,l)=>{const m=l?e[c+1]:i;l&&s&&n.emit(Y.BeginRecording,{[M.RecordingMediaTypes]:s,[M.StartRecordingCallback]:p=>{o({captureStream:l,mediaRecordingUids:p})}}),o({currentPage:m,screenPermissionRequested:!0,captureStream:l})}});return;case ne.StartTask:r(oe.RecordedTaskStart),n.emit(oe.RecordedTaskStart),n.emit(Y.StartTask),o({currentPage:e[c+1],screenPermissionRequested:!0});return;case ne.CompleteTask:return}}const Yo="ul-permission-graphics-container",Qo="ul-permission-body",Jo=R([Yo,"ul_recorded-task-inset-spacing"]),Ot=R(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),Xo=({richTextBody:e})=>u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Mt=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:u(X,{className:R([n&&"ul-skip-button-below",C.InactiveButton]),onClick:dn.bind(null,{status:ce.Abandoned}),children:t||"Skip"}),Ln=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:o}=ve.getState(),i=(r==null?void 0:r.includes(ae.Audio))||(r==null?void 0:r.includes(ae.Video));re(()=>{const s=setInterval(()=>{i&&t&&!t.active?o({avStream:null,currentPage:e[0]}):(!n||!n.active)&&o({captureStream:void 0,currentPage:e[i?1:0]})},1e3);return()=>clearInterval(s)},[t,n,i,e,r,o])},$a=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o,taskDetail:i}=e;return Ln(t),u("div",{className:"ul-task-page",children:[u(Xo,{richTextBody:i}),u("div",{className:Ot,children:[u(X,{onClick:En.bind(null,{pages:t}),children:r}),u(Mt,{required:n,skipButtonText:o})]})]},"start-task")},Ha=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:o}=e;Ln(t);const s=u(Re,{properties:n,defaultBody:()=>u("div",{className:Ot,children:[u(X,{className:"ul-complete-task-button",onClick:dn.bind(null,{status:ce.Completed}),children:r}),u(X,{className:R([C.InactiveButton]),onClick:dn.bind(null,{status:ce.GivenUp}),children:o})]})});return u("div",{className:"ul-task-page",children:[u(Xo,{richTextBody:e.taskDetail}),s]},"complete-task")},za=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o}=e,[i]=z(c=>[c.tabTitle]),[s,a]=Z(!1);return u("div",{children:[u("div",{className:Jo,children:[u("p",{style:{marginTop:"auto"},children:e.selectTabText}),u("div",{className:"ul-select-tab-container",children:u("p",{className:Qo,children:i})})]}),u("div",{className:n?"":Ot,children:[u(X,{disabled:s,onClick:En.bind(null,{pages:t,setIsRequestingPermission:a}),children:r}),u(Mt,{required:n,skipButtonText:o})]})]})},qa=({content:e})=>u("div",{className:R([Yo,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),Wa=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:o,skipButtonText:i,tryAgainButtonText:s}=e,a=jt(t[0])?t[0]:null;return re(()=>{const c=setInterval(()=>{a!==null&&cn({currentPage:a,pages:t})},1e3);return()=>clearInterval(c)},[a,t]),a?u("div",{children:[u("div",{className:Jo,children:u("p",{className:"ul-av-permission-denied-paragraph",children:[u("span",{className:"ul-av-permission-denied-headline",children:r}),u("span",{className:Qo,children:o})]})}),u("div",{className:Ot,children:[u(X,{onClick:cn.bind(null,{currentPage:a,pages:t}),children:s}),u(Mt,{required:n,skipButtonText:i})]})]}):null},Ga=({stream:e})=>u("video",{autoPlay:!0,className:R(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Ka=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:o}=ve.getState();return Ln(t),u("div",{children:[u(Ga,{stream:o}),u("div",{className:"ul-vertical-button-container-center",children:[u(X,{onClick:En.bind(null,{pages:t}),children:e.buttonText}),u(Mt,{bottom:!0,required:n,skipButtonText:r})]})]})},Za=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:o}=ve.getState();if(o===void 0)return null;switch(o==null?void 0:o.type){case ne.AvPermission:{const i=Zo(r,o);return i===Ee.RequestNeeded?u(qa,{content:o}):i===Ee.TryAgain?u(Wa,{content:o,pages:t,required:n}):u(Ka,{content:o,pages:t,required:n})}case ne.ScreenPermission:return u(za,{content:o,pages:t,required:n});case ne.StartTask:return u($a,{content:o,pages:t,required:n});case ne.CompleteTask:return u(Ha,{content:o,pages:t,properties:e});default:return null}},Ya=({className:e,properties:t,next:n,questionId:r})=>{const o=z(),{headers:i,surveyId:s,responseGroupUid:a,userId:c}=o,d=ve(),{screenPermissionRequested:l}=d,m=ve(v=>v.avStream);let p=ve(v=>v.currentPage);p||(p=Fa({questionId:r,surveyId:s,next:v=>{n(v)},pages:t.pages,responseGroupUid:a,userId:c}));let f=p.headline,h=p.captionText;const g=Zo(m,p);return Ko(p)&&l&&(f=p.permissionDeniedHeadline,h=p.permissionDeniedCaptionText),jt(p)&&g===Ee.Ready&&(f=p.permissionGrantedHeadline,h=p.permissionGrantedCaptionText),u("div",{className:R([..._e(C.CardMainContent,i["userleap-platform"])]),children:u("div",{className:R([e,"ul-center-horizontally",C.FadeInTransition]),children:[u(ye,{message:f,properties:{captionText:h}}),u(Za,{properties:t})]})})},Qa={"{{user_id}}":"externalUserId","{{email}}":"email"},Ja=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[c,d]of Object.entries(Qa))if(n.toLowerCase().includes(c))if(t[d]){const l=new RegExp(c,"gi");n=n.replace(l,t[d])}else r.push(c);if(r.length===0||!n.includes("?"))return n;const o=n.slice(0,n.indexOf("?")),s=n.slice(n.indexOf("?")+1).split("&").map(c=>c.split("=")).filter(c=>!r.includes(c[1]));if(s.length===0)return o;const a=s.map(c=>c.join("=")).join("&");return`${o}?${a}`},Xa=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,visitorAttributes:a}=z(f=>({headers:f.headers,visitorAttributes:f.visitorAttributes})),c=s["userleap-platform"],d=(f,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:o,type:i})},l=f=>{(f.key==="Enter"||f.key===" ")&&n({value:void 0,questionId:o,type:i})},m=()=>u("div",{className:"ul-card-button-group",children:[u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:Ja(r&&r.buttonUrl,a),id:"ul-card-text__button",onClick:d,onKeyPress:l,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:Je(r)}),r.required===!1&&u("button",{className:"ul-card-skip__button",onClick:f=>d(f,!0),children:Sn(r)})]}),p=(f,h)=>f?u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:f},id:"ul-card__text-url-body-container"}):u("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((g,v)=>u("p",{children:g},v))});return u("div",{className:R(_e(C.CardMainContent,c)),children:u("div",{className:R([e,"ul-card__text-url-prompt",C.FadeInTransition]),children:[u(ye,{message:t}),p(r&&r.richTextBody,r&&r.body),u(Re,{defaultBody:m,properties:r})]},o)})},el=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:o,headers:i}=z(c=>({border:c.border,endCard:c.endCard,destroy:c.destroy,headers:c.headers}));re(()=>{setTimeout(()=>{r(ze)},2e3)},[r]);const s=o&&o.subheader?u("p",{className:C.Caption,children:o.subheader}):null,a=o&&o.headline?o.headline:"";return u("div",{className:R(_e(C.CardMainContent,i["userleap-platform"])),children:u("div",{className:R([e,"ul-card--thanks",C.FadeInTransition]),children:u("div",{children:u("div",{className:"ul-card--thanks-content",children:[u("div",{className:"ul-thanks-check",children:u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:n,fillRule:"evenodd"}),u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:n,fillRule:"evenodd"}),u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),u(ye,{message:a}),s]})})},t)})},Oe="https://cdn.sprig.com",U={document:void 0,videojs:void 0},tl=`/* progress control styles */
28
+ `,Je=e=>(e==null?void 0:e.buttonText)||"Next",Un=e=>(e==null?void 0:e.skipButtonText)||"Skip",qa=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,useMobileStyling:a,border:c}=z(S=>({headers:S.headers,useMobileStyling:S.useMobileStyling,border:S.border})),[d,l]=Z(!1),[m,p]=Z(""),[f,h]=Z(!1),g=s["userleap-platform"],v=r==null?void 0:r.collectName,y=(r==null?void 0:r.nameLabelText)||"Full Name",w=(r==null?void 0:r.consentText)||"I agree to the stated conditions",C=(r==null?void 0:r.submitButtonText)||"Submit",b=!!m.trim(),E=d&&(!v||b),A=(S,H=!1)=>{S.preventDefault(),S.stopPropagation();let _=null;if(!H){if(!E){h(!0);return}_={submitted:!0},v&&(_.name=m)}n({value:_,questionId:o,type:i})},x=S=>{Ri(S.target)&&(S.preventDefault(),S.stopPropagation(),p(S.target.value))},T=S=>{We(S.target)&&(S.target.style.borderColor=f&&!b?rt:c)},P=S=>{We(S.target)&&(S.target.style.borderColor=f&&!b?rt:wn)},V=()=>u("div",{children:[u(Yo,{allowTextEntry:!1,border:c,error:f&&!d,index:0,isRadio:!1,isSelected:d,label:w,onUserInputChanged:({selected:S})=>{S!==d&&l(!d)},useMobileStyling:a}),v&&u("input",{"aria-label":y,"aria-placeholder":y,className:R(W(k.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:P,onFocus:T,onInput:x,placeholder:y,style:f&&!b?{borderColor:rt}:{},tabIndex:0,value:m}),u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[u(ne,{className:E?"":k.ButtonDisabled,onClick:A,children:C}),r.required===!1&&u("button",{className:"ul-card-skip__button",onClick:S=>A(S,!0),children:Un(r)})]})]});return u("div",{className:R(_e(k.CardMainContent,g)),children:u("div",{className:R([e,"ul-card__consent-legal",k.FadeInTransition]),children:[u(ye,{message:t}),u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),u(Re,{properties:r,defaultBody:V,embeddedType:"pdf"})]},o)})},Wa=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:o,range:i,scaleLabelType:s,setActiveValue:a,setIsPressed:c,useMobileStyling:d,value:l})=>{const m=`option-${l}`,p=s===Ve.Number,f=s===Ve.Star,h=p&&l===e,[g,v]=(()=>l<=e&&f||l===e?r?[t,1]:[t,.3]:["",1])(),y=()=>{switch(s){case Ve.Star:return R([...W(k.LikertStar,d),...W(`${k.LikertStar}-${l}`,d)]);case Ve.Smiley:return R([...W(k.LikertSmiley,d),...W(`${k.LikertSmiley}-${l}`,d)]);default:return R(l===i?[...W(k.LikertNumber,d),...W(`${k.LikertNumber}-${l}`,d),...W("likert-last-option",d)]:[...W(k.LikertNumber,d),...W(`${k.LikertNumber}-${l}`,d)])}},w=()=>{a(-1),c(!1)};return u("div",{"aria-label":p?void 0:String(l),className:y(),dangerouslySetInnerHTML:{__html:n},id:m,onClick:()=>o(),onPointerDown:()=>c(!0),onPointerEnter:()=>a(l),onPointerLeave:w,role:"radio",style:{color:p?"":g,borderColor:h?g:"",fillOpacity:h?"":v,zIndex:h?3:"auto"},tabIndex:0})},Ga=({className:e,labels:t,message:n,next:r,properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(V=>({border:V.border,headers:V.headers,useMobileStyling:V.useMobileStyling})),[l,m]=Z(-1),[p,f]=Z(!1),h=c["userleap-platform"],g=t&&t.left,v=t&&t.right;let y;const{range:w,scaleLabelType:C,ratingIcons:b}=o;w&&(y=Number(w));const E=y||5,A=V=>{var S,H;switch(C){case Ve.Star:return(S=b[0])==null?void 0:S.svg;case Ve.Smiley:return(H=b[V])==null?void 0:H.svg;default:return String(V+1)}},x=[...Array(E)].map((V,S)=>{const H=S+1;return u(Wa,{activeValue:l,border:a,icon:A(S),isPressed:p,onSubmit:()=>r({value:H,questionId:i,type:s}),range:E,scaleLabelType:C,setActiveValue:m,setIsPressed:f,useMobileStyling:d,value:H},S)}),T=V=>{V.preventDefault(),V.stopPropagation(),r({value:null,questionId:i,type:s})},P=()=>u(ue,{children:[u("div",{"aria-label":`Rating (1 - ${E})`,className:"ul-card--likert__numbers",role:"radiogroup",children:x}),u("div",{className:"ul-card--likert__labels",children:[u("span",{children:g}),u("span",{children:v})]}),!o.required&&u("div",{className:"ul-vertical-centered-container",children:u(ne,{onClick:T,children:Je(o)})})]});return u("div",{className:R(_e(k.CardMainContent,h)),children:u("form",{className:R([e,"ul-card--likert",k.FadeInTransition]),children:[u(ye,{message:n,properties:o}),u(Re,{properties:o,defaultBody:P})]},i)})},Jo=({className:e,message:t,onSubmit:n,options:r=[],properties:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(x=>({border:x.border,headers:x.headers,useMobileStyling:x.useMobileStyling})),l=r.reduce((x,T)=>(x[T.id]={isSelected:!1},x),{}),[m,p]=Z(l),f=c["userleap-platform"],h=s===I.MultipleChoice,g=o.required,v=Object.entries(m).some(([x,T])=>{var S;const P=r.find(H=>`${H.id}`===x),V=T.userText===void 0||T.userText.trim()==="";return((S=P==null?void 0:P.optionProperties)==null?void 0:S.allowsTextEntry)&&V&&T.isSelected}),y=Object.values(m).some(x=>x.isSelected),w=v||g&&!y,C=r.map(({id:x,label:T,value:P,optionProperties:V},S)=>{var B,M;const H=`${x}`,{allowsTextEntry:_}=V||{allowsTextEntry:!1};return u(Yo,{allowTextEntry:_,border:a,error:!1,id:H,index:S,isRadio:h,isSelected:!!((B=m[H])!=null&&B.isSelected),label:T,onUserInputChanged:se=>E(se.id,se.selected,se.userText),promptText:"Please specify",text:(M=m[x])==null?void 0:M.userText,useMobileStyling:d,value:P},H)}),b=x=>{x.preventDefault(),x.stopPropagation(),n(m)},E=(x,T,P)=>{const V=Object.assign({},m);if(h&&T)for(const S of Object.values(V))S.isSelected=!1,delete S.userText;V[x]={isSelected:T,userText:P},p(V)},A=()=>u("div",{children:[u("div",{className:R(W(k.ChoiceGroup,d)),role:h?"radiogroup":"group",children:C}),u("div",{className:"ul-card__button-wrapper",children:u(ne,{disabled:w,onClick:b,children:Je(o)})})]});return u("div",{className:R(_e(k.CardMainContent,f)),children:u("form",{className:R([e,"ul-card--multiple",k.FadeInTransition]),id:"text-form",onSubmit:b,children:[u(ye,{message:t,properties:o}),u(Re,{properties:o,defaultBody:A})]},i)})},Ka=e=>{const{questionId:t,type:n,next:r,options:o}=e;return u(Jo,{...e,onSubmit:s=>{const a=Object.entries(s).find(([,p])=>p.isSelected)||[void 0,void 0],[c,d]=a,l=o.find(p=>`${p.id}`===c),m=d!=null&&d.userText?{[c]:{userText:d.userText}}:null;r({value:l&&c?{[c]:l.value}:{},secondaryValue:m,questionId:t,type:n})}})},Za=e=>{const{questionId:t,type:n,next:r}=e;return u(Jo,{...e,onSubmit:i=>{const s={},a=Object.entries(i).reduce((d,[l,m])=>(d[l]=m.isSelected,d),s),c=Object.entries(i).reduce((d,[l,m])=>{if(!m.userText)return d;const p=d||{};return p[l]={userText:m.userText},p},null);r({value:a,secondaryValue:c,questionId:t,type:n})}})},Ya=({className:e,props:{labels:t,message:n,properties:r},next:o,questionId:i,type:s})=>{const{border:a,headers:c,useMobileStyling:d}=z(v=>({border:v.border,headers:v.headers,useMobileStyling:v.useMobileStyling})),l=c["userleap-platform"],m=t&&t.left,p=t&&t.right,f=[...Array(11)].map((v,y)=>u("div",{className:R([...W(k.NPSNumber,d),...W(`${k.NPSNumber}-${y}`,d)]),id:`option-${y}`,onClick:()=>o({value:y,questionId:i,type:s}),onKeyPress:w=>{w.preventDefault(),(w.key==="Enter"||w.key===" ")&&o({value:y,questionId:i,type:s})},onPointerDown:w=>{We(w.target)&&(w.target.style.zIndex="2",w.target.style.borderColor=a)},onPointerLeave:w=>{We(w.target)&&(w.target.style.zIndex="auto",w.target.style.borderColor=wn)},role:"radio",tabIndex:0,children:y},y)),h=v=>{v.preventDefault(),v.stopPropagation(),o({value:null,questionId:i,type:s})},g=()=>u("div",{children:[u("div",{className:"ul-card--nps__numbers",children:f}),u("div",{className:"ul-card--nps__labels",children:[u("span",{children:m}),u("span",{children:p})]}),!r.required&&u("div",{className:"ul-vertical-centered-container",children:u(ne,{onClick:h,children:Je(r)})})]});return u("div",{className:R(_e(k.CardMainContent,l)),children:u("form",{className:R([e,"ul-card--nps",k.FadeInTransition]),children:[u(ye,{message:n,properties:r}),u(Re,{properties:r,defaultBody:g})]},i)})},Qa=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{border:s,headers:a,useMobileStyling:c,update:d}=z(x=>({border:x.border,headers:x.headers,useMobileStyling:x.useMobileStyling,update:x.update})),[l,m]=Z(""),p=Te(null),f=a["userleap-platform"],h=l.trim(),g=r.required===!0&&!h,v=Zo(p,()=>d()),y=x=>{v(),x.preventDefault(),x.stopPropagation(),ot(x.target)&&m(x.target.value)},w=x=>{x.preventDefault(),x.stopPropagation(),n({value:l,questionId:o,type:i})},C=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",b=x=>{ot(x.target)&&(x.target.style.borderColor=s)},E=x=>{ot(x.target)&&(x.target.style.borderColor=wn)},A=()=>u("div",{className:"ul-card-text",children:[u("div",{className:"ul-card-text__container",children:u("textarea",{"aria-label":C,"aria-labelledby":k.QuestionHeader,"aria-multiline":"true","aria-placeholder":C,className:R(W(k.OpenTextInput,c)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:E,onChange:y,onFocus:b,placeholder:C,ref:p,role:"textbox",tabIndex:0})}),u(ne,{disabled:g,onClick:w,style:{backgroundColor:g?"":s},children:Je(r)})]});return u("div",{className:R(_e(k.CardMainContent,f)),children:u("form",{className:R([e,"ul-card--text",k.FadeInTransition]),id:"text-form",children:[u(ye,{message:t,properties:r}),u(Re,{defaultBody:A,properties:r})]},o)})};var Ee=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Ee||{});const jt=e=>e.type===re.AvPermission,Xo=e=>e.type===re.ScreenPermission,Ja=(e,t)=>!(jt(t)?t.permissionDescriptors:[]).includes(Ze.Camera)||e.getVideoTracks().length>0,ei=(e,t)=>{if(e===void 0)return Ee.RequestNeeded;if(e){if(!Ja(e,t))return Ee.RequestNeeded}else return Ee.TryAgain;return Ee.Ready},vr={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ve=zo(e=>({...vr,reset:()=>{e(vr)},updatePage:t=>{e(t)}}));function un({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:o}=ve.getState(),{recorderEventEmitter:i}=z.getState();i.emit(Y.AvPermission,{[N.PermissionDescriptors]:e.permissionDescriptors,[N.StreamReadyCallback]:(s,a)=>{if(n===s)return;let c=e;if(s&&!e.permissionDescriptors.includes(Ze.Camera)){const d=t.indexOf(e),l=a!=null&&a.active?d+2:d+1;(a==null?void 0:a.active)&&r&&i.emit(Y.BeginRecording,{[N.RecordingMediaTypes]:r,[N.StartRecordingCallback]:m=>o({mediaRecordingUids:m})}),c=t[l]}o({currentPage:c,avStream:s})}})}function Xa({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:o,next:i}){const{updatePage:s}=ve.getState(),{eventEmitFn:a,recorderEventEmitter:c}=z.getState(),d={questionId:o,surveyId:r,visitorId:t,responseGroupUid:n};let l=0;c.emit(ie.RecordedTaskPermissionScreen),a(ie.RecordedTaskPermissionScreen),c.emit(Y.PermissionStatus,{[N.PermissionStatusCallback]:(p,f,h,g)=>{const v=e[l],{type:y}=v,w=[le.Screen];if(jt(v)){const{permissionDescriptors:C}=v,b=C==null?void 0:C.includes(Ze.Microphone),E=C==null?void 0:C.includes(Ze.Camera);b&&w.push(le.Audio),E&&w.push(le.Video);const A=(p==null?void 0:p.active)&&!E,x=(p==null?void 0:p.active)&&f;(A||x)&&l++}Xo(e[l])&&h&&(l++,c.emit(Y.BeginRecording,{[N.RecordingMediaTypes]:w,[N.StartRecordingCallback]:C=>s({mediaRecordingUids:C})})),s({currentPage:e[l],avStream:p,screenPermissionRequested:h,nextQuestion:i,type:y,passthroughData:d,recordingMediaTypes:w,captureStream:g})}});const m=e[l];return m.type===re.AvPermission&&un({currentPage:m,pages:e}),m}function pn({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:o}=ve.getState(),{recorderEventEmitter:i,handleUploadUpdate:s,index:a}=z.getState(),c={value:{taskStatus:e},type:I.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||i.emit(Y.FinishTask,{[N.BeginCallback]:d=>{s({mediaRecordingUid:d,isSubmitted:!0,progressPct:0,isComplete:!1})},[N.ProgressCallback]:(d,l)=>{s({mediaRecordingUid:d,progressPct:l.detail,isSubmitted:!1,isComplete:!1})},[N.UploadCallback]:d=>{d&&s({mediaRecordingUid:d,isComplete:!0,isSubmitted:!0,progressPct:100})},[N.PassthroughData]:n,[N.CurrentIndex]:a,[N.TaskResponse]:c,[N.TaskCompleteCallback]:d=>{c.value.taskDurationMillisecond=d,r&&(c.value.mediaRecordingUids=r),o(),t(c)}})}function Pn({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=z.getState(),{updatePage:o,currentPage:i,recordingMediaTypes:s,screenPermissionRequested:a}=ve.getState();if(!i)return;const c=e.indexOf(i);switch(i.type){case re.AvPermission:{const d=a?c+2:c+1;a&&s&&n.emit(Y.BeginRecording,{[N.RecordingMediaTypes]:s,[N.StartRecordingCallback]:l=>{o({mediaRecordingUids:l})}}),o({currentPage:e[d]});return}case re.ScreenPermission:n.emit(Y.ScreenPermission,{[N.ScreenPermissionRequested]:t,[N.StreamReadyCallback]:(d,l)=>{const m=l?e[c+1]:i;l&&s&&n.emit(Y.BeginRecording,{[N.RecordingMediaTypes]:s,[N.StartRecordingCallback]:p=>{o({captureStream:l,mediaRecordingUids:p})}}),o({currentPage:m,screenPermissionRequested:!0,captureStream:l})}});return;case re.StartTask:r(ie.RecordedTaskStart),n.emit(ie.RecordedTaskStart),n.emit(Y.StartTask),o({currentPage:e[c+1],screenPermissionRequested:!0});return;case re.CompleteTask:return}}const ti="ul-permission-graphics-container",ni="ul-permission-body",ri=R([ti,"ul_recorded-task-inset-spacing"]),Mt=R(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),oi=({richTextBody:e})=>u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Nt=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:u(ne,{className:R([n&&"ul-skip-button-below",k.InactiveButton]),onClick:pn.bind(null,{status:de.Abandoned}),children:t||"Skip"}),Tn=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:o}=ve.getState(),i=(r==null?void 0:r.includes(le.Audio))||(r==null?void 0:r.includes(le.Video));oe(()=>{const s=setInterval(()=>{i&&t&&!t.active?o({avStream:null,currentPage:e[0]}):(!n||!n.active)&&o({captureStream:void 0,currentPage:e[i?1:0]})},1e3);return()=>clearInterval(s)},[t,n,i,e,r,o])},el=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o,taskDetail:i}=e;return Tn(t),u("div",{className:"ul-task-page",children:[u(oi,{richTextBody:i}),u("div",{className:Mt,children:[u(ne,{onClick:Pn.bind(null,{pages:t}),children:r}),u(Nt,{required:n,skipButtonText:o})]})]},"start-task")},tl=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:o}=e;Tn(t);const s=u(Re,{properties:n,defaultBody:()=>u("div",{className:Mt,children:[u(ne,{className:"ul-complete-task-button",onClick:pn.bind(null,{status:de.Completed}),children:r}),u(ne,{className:R([k.InactiveButton]),onClick:pn.bind(null,{status:de.GivenUp}),children:o})]})});return u("div",{className:"ul-task-page",children:[u(oi,{richTextBody:e.taskDetail}),s]},"complete-task")},nl=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:o}=e,[i]=z(c=>[c.tabTitle]),[s,a]=Z(!1);return u("div",{children:[u("div",{className:ri,children:[u("p",{style:{marginTop:"auto"},children:e.selectTabText}),u("div",{className:"ul-select-tab-container",children:u("p",{className:ni,children:i})})]}),u("div",{className:n?"":Mt,children:[u(ne,{disabled:s,onClick:Pn.bind(null,{pages:t,setIsRequestingPermission:a}),children:r}),u(Nt,{required:n,skipButtonText:o})]})]})},rl=({content:e})=>u("div",{className:R([ti,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),ol=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:o,skipButtonText:i,tryAgainButtonText:s}=e,a=jt(t[0])?t[0]:null;return oe(()=>{const c=setInterval(()=>{a!==null&&un({currentPage:a,pages:t})},1e3);return()=>clearInterval(c)},[a,t]),a?u("div",{children:[u("div",{className:ri,children:u("p",{className:"ul-av-permission-denied-paragraph",children:[u("span",{className:"ul-av-permission-denied-headline",children:r}),u("span",{className:ni,children:o})]})}),u("div",{className:Mt,children:[u(ne,{onClick:un.bind(null,{currentPage:a,pages:t}),children:s}),u(Nt,{required:n,skipButtonText:i})]})]}):null},il=({stream:e})=>u("video",{autoPlay:!0,className:R(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),sl=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:o}=ve.getState();return Tn(t),u("div",{children:[u(il,{stream:o}),u("div",{className:"ul-vertical-button-container-center",children:[u(ne,{onClick:Pn.bind(null,{pages:t}),children:e.buttonText}),u(Nt,{bottom:!0,required:n,skipButtonText:r})]})]})},al=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:o}=ve.getState();if(o===void 0)return null;switch(o==null?void 0:o.type){case re.AvPermission:{const i=ei(r,o);return i===Ee.RequestNeeded?u(rl,{content:o}):i===Ee.TryAgain?u(ol,{content:o,pages:t,required:n}):u(sl,{content:o,pages:t,required:n})}case re.ScreenPermission:return u(nl,{content:o,pages:t,required:n});case re.StartTask:return u(el,{content:o,pages:t,required:n});case re.CompleteTask:return u(tl,{content:o,pages:t,properties:e});default:return null}},ll=({className:e,properties:t,next:n,questionId:r})=>{const o=z(),{headers:i,surveyId:s,responseGroupUid:a,userId:c}=o,d=ve(),{screenPermissionRequested:l}=d,m=ve(v=>v.avStream);let p=ve(v=>v.currentPage);p||(p=Xa({questionId:r,surveyId:s,next:v=>{n(v)},pages:t.pages,responseGroupUid:a,userId:c}));let f=p.headline,h=p.captionText;const g=ei(m,p);return Xo(p)&&l&&(f=p.permissionDeniedHeadline,h=p.permissionDeniedCaptionText),jt(p)&&g===Ee.Ready&&(f=p.permissionGrantedHeadline,h=p.permissionGrantedCaptionText),u("div",{className:R([..._e(k.CardMainContent,i["userleap-platform"])]),children:u("div",{className:R([e,"ul-center-horizontally",k.FadeInTransition]),children:[u(ye,{message:f,properties:{captionText:h}}),u(al,{properties:t})]})})},cl={"{{user_id}}":"externalUserId","{{email}}":"email"},dl=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[c,d]of Object.entries(cl))if(n.toLowerCase().includes(c))if(t[d]){const l=new RegExp(c,"gi");n=n.replace(l,t[d])}else r.push(c);if(r.length===0||!n.includes("?"))return n;const o=n.slice(0,n.indexOf("?")),s=n.slice(n.indexOf("?")+1).split("&").map(c=>c.split("=")).filter(c=>!r.includes(c[1]));if(s.length===0)return o;const a=s.map(c=>c.join("=")).join("&");return`${o}?${a}`},ul=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{headers:s,visitorAttributes:a}=z(f=>({headers:f.headers,visitorAttributes:f.visitorAttributes})),c=s["userleap-platform"],d=(f,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:o,type:i})},l=f=>{(f.key==="Enter"||f.key===" ")&&n({value:void 0,questionId:o,type:i})},m=()=>u("div",{className:"ul-card-button-group",children:[u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:dl(r&&r.buttonUrl,a),id:"ul-card-text__button",onClick:d,onKeyPress:l,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:Je(r)}),r.required===!1&&u("button",{className:"ul-card-skip__button",onClick:f=>d(f,!0),children:Un(r)})]}),p=(f,h)=>f?u("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:f},id:"ul-card__text-url-body-container"}):u("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((g,v)=>u("p",{children:g},v))});return u("div",{className:R(_e(k.CardMainContent,c)),children:u("div",{className:R([e,"ul-card__text-url-prompt",k.FadeInTransition]),children:[u(ye,{message:t}),p(r&&r.richTextBody,r&&r.body),u(Re,{defaultBody:m,properties:r})]},o)})},pl=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:o,headers:i}=z(c=>({border:c.border,endCard:c.endCard,destroy:c.destroy,headers:c.headers}));oe(()=>{setTimeout(()=>{r(ze)},2e3)},[r]);const s=o&&o.subheader?u("p",{className:k.Caption,children:o.subheader}):null,a=o&&o.headline?o.headline:"";return u("div",{className:R(_e(k.CardMainContent,i["userleap-platform"])),children:u("div",{className:R([e,"ul-card--thanks",k.FadeInTransition]),children:u("div",{children:u("div",{className:"ul-card--thanks-content",children:[u("div",{className:"ul-thanks-check",children:u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:n,fillRule:"evenodd"}),u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:n,fillRule:"evenodd"}),u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),u(ye,{message:a}),s]})})},t)})},Me="https://cdn.sprig.com",U={document:void 0,videojs:void 0},fl=`/* progress control styles */
29
29
  .video-js .vjs-control {
30
30
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
31
31
  }
@@ -682,5 +682,5 @@ span.ul-button-text {
682
682
  .vjs-poster {
683
683
  background-size: cover;
684
684
  }
685
- `,nl=e=>{const t=U.document.createElement("div");return t.className="ul-video-player-loading",t.id=In(e),["first","second","third","fourth"].map(n=>{const r=U.document.createElement("div");r.className=n,t.appendChild(r)}),t},In=e=>e+"-loading-spiner",G="hidden",mr=".m3u8",Wt="questionId",Gt="ul-video-recorder-camera-off-button",Kt="ul-recording-in-session",rl=[{type:"link",content:`${Oe}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Oe}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Oe}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Oe}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Oe}/userleap-web-upchunk-v2.2.2.js`}],ei=[{type:"link",content:`${Oe}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Oe}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:tl}],ti="-video-player",ni="-secondary-video-player",ri="-video-recorder";let pe,hr;const Se=async({event:e,apiBase:t,headers:n,visitorId:r,envId:o,metadata:i})=>{const s=U.document.documentElement;if(!r||!o)return;const a={event:`SDK - ${e}`,visitorId:r,environmentId:o,metadata:{...i||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(a)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},be=async(e,t,n,r,o,i)=>{Se({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:o,envId:i,metadata:{errorMessage:e.message}});const s=U.document.documentElement,a={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language},c={action:t,err:{message:e.message,stack:e.stack},meta:a,vid:o,envId:i};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},ol=(e,{type:t,content:n})=>new Promise(function(r,o){let i;t==="script"?(i=U.document.createElement("script"),i.src=n):t==="link"?(i=U.document.createElement("link"),i.rel="stylesheet",i.href=n,i.type="text/css"):(i=U.document.createElement("style"),i.innerHTML=n),i.onload=function(){r(n)},i.onerror=function(){o(n)},i.async=!1,i.id=btoa(n),e.appendChild(i)}),oi=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(ol(U.document.head,r)),n),[])).then(()=>{U.videojs=U.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},gr=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=G;else if(t==="success")e.style.visibility=G,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},Zt=(e,t)=>{const n=U.videojs(e.id());return n==null?void 0:n.payload[t]},il=(e,t,n,r,o)=>{const{surveyId:i,responseGroupUid:s,visitorId:a,envId:c}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(A.ERROR,{type:A.PERMISSION_DENIED}),Se({event:"Video Permission Denied",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Zt(e,Wt),responseGroupUid:s,surveyId:i}})):(n&&n(A.ERROR,{type:A.OTHER}),be(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,o,a,c))}),e.on("error",function(d,l){be(l||e.error(),"recorderError",t,o,a,c)}),e.on("startRecord",function(d,l){r(e.uploadProgressLabel,"none"),Se({event:"Video Record Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Zt(e,Wt),responseGroupUid:s,surveyId:i}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const d=Zt(e,Wt);if(!i){const g="internal error: missing fields in payload";return n&&n(A.ERROR,{type:A.OTHER}),be(new Error(g),"finishRecord",t,o,a,c),null}e.record().stopDevice();const l=e.cameraOff?A.MEDIA_TYPE_AUDIO:A.MEDIA_TYPE_VIDEO,m=Be();Se({event:"Video Record Finish",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l}});const p={surveyId:i,updatedAt:new Date().toISOString(),mediaType:l,mediaRecordingUid:m};d&&(p.questionId=d),s&&(p.responseGroupUid=s),a&&(p.visitorId=a);const h=await(async()=>{const g=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(g.ok){const v=await g.json();return n&&n(A.UPLOAD_STARTED,{[A.UPLOAD_ID]:v.upload.id,[A.MEDIA_TYPE]:l,[A.MEDIA_RECORDING_UID]:m}),v.upload.url}else return n&&n(A.ERROR,{type:A.OTHER,response:g}),be(new Error("failed to get upload response with url"),"finishRecord",t,o,a,c),null})();!h||(pe=U.document.defaultView.UpChunk.createUpload({endpoint:h,file:new U.document.defaultView.File([e.recordedData],`recording ${l} ${Date.now()}`),chunkSize:5120}),pe.startTime=Date.now(),Se({event:"Video Upload Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l,url:h}}),pe.on("error",g=>{r(e.uploadProgressLabel,"none"),n&&n(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:m}),be(g,"finishRecord",t,o,a,c)}),pe.on("progress",g=>{n&&n(A.UPLOAD_PROGRESS,{[A.MEDIA_RECORDING_UID]:m,[A.UPLOAD_PROGRESS_PCT]:g.detail}),r(e.uploadProgressLabel,"progress",g.detail)}),pe.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(A.UPLOAD_FINISHED,{[A.MEDIA_RECORDING_UID]:m}),Se({event:"Video Upload Success",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l,url:h,elapsedMs:pe.startTime&&Date.now()-pe.startTime}})}))})},ii=(e,t)=>{const n=new(U.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),sl(n),n},sl=e=>{e.children().forEach(t=>{if(se[t.name_]){const n=bt(se[t.name_],`ul-${se[t.name_]}`);t.el_.appendChild(n)}})},bt=(e,t="")=>{const n=U.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},si=(e,t,n,r,o=!1,i)=>{e.addClass("ul-video-player");const s=new(U.videojs.getComponent("Component"))(e);s.addClass("ul-control-panel"),e.progressBar=s.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(U.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const a=n&&n.src?ml(n.src):null;n&&(o||!a)?(e.children()[0].classList.add("vjs-hidden"),U.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),U.document.getElementById(`${e.id()}_html5_api`).style.height="100%",a&&e.poster(a)),e.on("play",()=>{!o&&n&&!a&&cl(e,!1),i==null||i.play()}),e.on("pause",()=>{i==null||i.pause()}),e.on("seeked",()=>{i==null||i.currentTime(e.currentTime())}),e.on("ratechange",()=>{i==null||i.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),s.addChild(t),e.addChild(s),r&&r(e)},al=(e,t,n)=>{e.addClass(`ul${ni}`);const r=new(U.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},ll=(e,t,n,r,o,i,s,a=!1)=>{hr=Date.now();const d=Ut(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!d)return;d.payload=n;const{surveyId:l,questionId:m,responseGroupUid:p,visitorId:f,envId:h}=n;let g;const v=k=>{const $=Gt,y=Gt+"-audio-only";gr(d.uploadProgressLabel,"none"),pe&&pe.startTime>=hr&&pe.abort();const B=U.document.getElementById("ul-camera-button");k?(d.children()[0].classList.add("vjs-hidden"),b.removeClass($),b.addClass(y),B.innerHTML=se.TurnOnCamera,d.audioPlayerPlaceholder.removeClass("vjs-hidden"),g==null||g.getTracks().forEach(O=>{O.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(O=>{g=O,O.getVideoTracks().forEach(ie=>{ie.enabled=!1}),d.record().onDeviceReady(O)}).catch(d.record().onDeviceError.bind(d.record()))):(g==null||g.getVideoTracks().forEach(O=>{O.enabled=!0}),d.children()[0].classList.remove("vjs-hidden"),d.record().getDevice(),b.removeClass(y),b.addClass($),B.innerHTML=se.TurnOffCamera,d.audioPlayerPlaceholder.addClass("vjs-hidden"))},w=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{w.hasClass(G)||(Se({event:"Video Delete Button Clicked",apiBase:r,headers:s,visitorId:f,envId:h,metadata:{questionId:m,responseGroupUid:p,surveyId:l}}),v(d.cameraOff),o(A.DELETE,{}),b.removeClass(G),w.addClass(G))}});w.addClass("ul-video-recorder-delete-button"),w.el_.appendChild(bt(se.DeleteButton,"ul-delete-button"));const _=U.document.getElementById(t),S=()=>{_.classList.contains("vjs-fullscreen")&&d.cameraOff?_.style.display="table":_.style.display="flex"};S();const b=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{d.record().isRecording()||(d.cameraOff=!d.cameraOff,Se({event:"Video Camera Button Clicked",apiBase:r,headers:s,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:m,responseGroupUid:p,surveyId:l,cameraOff:d.cameraOff}}),v(d.cameraOff),!w.hasClass(G)&&w.addClass(G),o(A.DELETE,{}),S())}});b.addClass(Gt),b.el_.appendChild(bt(se.TurnOffCamera,"ul-camera-button"));const E=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{const k=U.document.getElementById("ul-recorder-toggle");if(d.record().isRecording())d.record().stop(),k&&(k.innerHTML=se.RecordButton),E.removeClass(Kt),w.removeClass(G);else{const $=U.document.getElementById("ul-recording-countdown-screen");if($)$.remove(),k&&(k.innerHTML=se.RecordButton),v(d.cameraOff),o(A.DELETE,{}),b.removeClass(G),w.addClass(G),E.removeClass(Kt),P.show();else{E.addClass(Kt),P.hide(),b.addClass(G),w.addClass(G),k&&(k.innerHTML=se.StopButton);const y=U.document.createElement("div");y.id="ul-recording-countdown-screen",_.insertBefore(y,_.children[1]),y.style.height=`${_.offsetHeight}px`,ai(d,3)}}}});E.addClass("ul-video-recorder-toggle-button"),E.el_.appendChild(bt(se.RecordButton,"ul-recorder-toggle"));const D=U.document.createElement("p");D.style.visibility="hidden",D.className="ul-upload-progress-label",e.appendChild(D),d.uploadProgressLabel=D;const x=ii(d,[w,b,"PlayToggle",E,"FullscreenToggle"]),P=x.children().find(k=>k.name_==="FullscreenToggle");P.hasClass("vjs-disabled")&&P.hide();const T=x.children().find(k=>k.name_==="PlayToggle");T.hide(),i&&b.addClass(G),!i&&w.addClass(G),si(d,x,i,!1,a),d.on("stopRecord",()=>{E.hide(),T.show(),P.show(),w.removeClass(G)}),d.on("deviceReady",()=>{E.show(),T.hide(),w.addClass(G)}),il(d,r,o,gr,s),i&&(d.deviceButton&&d.deviceButton.hide(),d.src(i),T.show(),E.hide(),w.removeClass(G));const V=[{name:"microphone"}];!d.cameraOff&&V.push({name:"camera"}),Promise.all(V.map(k=>{var $;return($=navigator==null?void 0:navigator.permissions)==null?void 0:$.query(k)})).then(k=>{k.reduce((y,B)=>y&B.state==="granted",!0)&&d&&(d.deviceButton&&d.deviceButton.hide(),!i&&d.record().getDevice())}).catch(k=>{})},ai=(e,t=3)=>{const n=U.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{ai(e,t-1)},1e3))},li=e=>{const t=U.document.createElement("div");return t.className="ul-video-container",t.appendChild(nl(e)),t},un=(e,t)=>{const n=U.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=U.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const o=U.document.createElement("a");return o.href="https://videojs.com/html5-video-support/",o.target="_blank",o.innerHTML="supports HTML5 video",r.appendChild(o),n.appendChild(r),t.appendChild(n),t},cl=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),U.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),U.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Ut=(e,t)=>U.document.getElementById(e)?t?U.videojs(e,t):U.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),dl=(e,t,n,r=!1,o="https://api.sprig.com",i=document,s=null,a=null)=>{U.document=i;const c=e+ti,d=li(c);return U.document.addEventListener("securitypolicyviolation",l=>{be(new Error(`Voice & Video feature violates ${l.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",o,{})}),oi(ei,()=>{U.document.getElementById(In(c)).remove(),un(c,d);const l={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const m=e+ni;un(m,d);const p=Ut(c,l),f=Ut(m,{muted:!0,...l});if(!p||!f)return;al(f,s,a),s||f.addClass(G);const h=ii(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),g=h.children().find(v=>v.name_==="FullscreenToggle");g.hasClass("vjs-disabled")&&g.hide(),si(p,h,t,n,r,f)}catch(m){be(new Error(`Error when creating video player object ${m}`),"playerDeviceError",o,{});return}}),d},ul=(e,t={},n="https://api.userleap.com",r,o,i,s=!1,a=document)=>{U.document=a;const c=e+ri,d=li(c);return U.document.addEventListener("securitypolicyviolation",l=>{be(new Error(`Voice & Video feature violates ${l.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,i,t.visitorId,t.envId)}),oi(ei.concat(rl),()=>{un(c,d),U.document.getElementById(In(c)).remove();try{ll(d,c,t,n,r,o,i,s)}catch(l){be(new Error(`Error when creating video recorder player object ${l}`),"recorderDeviceError",n,i,t.visitorId,t.envId);return}}),d},pl=e=>{const t=e+ri;if(!!U.document.getElementById(t)&&!!U.videojs){try{if(!U.videojs(t).record().stream)return}catch{return}U.videojs(t).record().stop(),U.videojs(t).record().stopDevice()}},fl=e=>{const t=Ut(e+ti);t==null||t.pause()},ml=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(mr)&&(n=n.replace(mr,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},A={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},se={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},Xe="ul-card-video__player_recorder",hl="ul-card-video__skip_button",gl="ul-video-interview-form",vr="ul-video-btn",vl=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{apiURL:s,envId:a,handleUploadUpdate:c,headers:d,responseGroupUid:l,surveyId:m,viewDocument:p,visitorId:f}=z(y=>({apiURL:y.apiURL,envId:y.envId,handleUploadUpdate:y.handleUploadUpdate,headers:y.headers,responseGroupUid:y.responseGroupUid,surveyId:y.surveyId,viewDocument:y.viewDocument,visitorId:y.userId})),[h,g]=Z(!1),[v,w]=Z(null),[_,S]=Z(null),[b,E]=Z(0),D=d["userleap-platform"],x=r&&r.videoUrl,P=(y,B)=>{y===A.UPLOAD_STARTED?(w(B[A.UPLOAD_ID]),S(B[A.MEDIA_RECORDING_UID]),g(!0)):y===A.DELETE?(w(null),S(null),g(!1)):y===A.UPLOAD_PROGRESS?isNaN(B[A.UPLOAD_PROGRESS_PCT])?c({mediaRecordingUid:B[A.MEDIA_RECORDING_UID],isComplete:!0}):c({mediaRecordingUid:B[A.MEDIA_RECORDING_UID],progressPct:B[A.UPLOAD_PROGRESS_PCT]}):y===A.UPLOAD_FINISHED&&c({mediaRecordingUid:B[A.MEDIA_RECORDING_UID],isComplete:!0})},T=y=>{if(y&&y.children.length===0){const B=dl(Xe,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===A.MEDIA_TYPE_AUDIO,s,p);y.appendChild(B)}},V=y=>{if(y&&y.children.length===0){const B=ul(Xe,{surveyId:m,responseGroupUid:l,questionId:o,visitorId:f,envId:a},s,P,void 0,{...d,"x-ul-video-recorder-origin":"sdk"},r.mediaType===A.MEDIA_TYPE_AUDIO,p);y.appendChild(B)}},k=y=>{y.preventDefault(),y.stopPropagation(),pl(Xe),v&&_?(c({mediaRecordingUid:_,isSubmitted:!0}),n({value:{mediaRecordingUid:_},questionId:o,type:i})):n({value:null,questionId:o,type:i})},$=()=>u(Re,{defaultBody:()=>u("button",{className:`${vr} ul-record-response-btn`,onClick:y=>{y.preventDefault(),y.stopPropagation(),fl(Xe),E(1)}}),properties:r});return u("div",{className:R(_e(C.CardMainContent,D)),style:{marginTop:"unset"},children:u("form",{className:R([e,C.VideoCard,C.FadeInTransition]),id:gl,children:[u(ye,{message:t,properties:r}),u("div",{id:"ul-card-voice__video",children:[u("div",{children:[u("div",{id:"ul-question-player-container",style:{display:b===0?"":"none"},children:[u("div",{id:Xe,ref:T}),$()]}),u("div",{style:{display:b===1?"block":"none"},children:[u("button",{className:`${vr} ul-back-question-btn`,onClick:y=>{y.preventDefault(),y.stopPropagation(),E(0)}}),u("div",{id:"ul-recorder-player-container",ref:V})]})]}),u(X,{disabled:!h,onClick:k,children:Je(r)}),u("button",{className:`ul-card-text__button ${C.InactiveButton}`,id:hl,onClick:k,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:Sn(r)})]})]})})},wl=({className:e})=>{const{headers:t,uploadProgress:n}=z(s=>({headers:s.headers,uploadProgress:s.uploadProgress}));let r,o;Object.values(n).filter(s=>s.isSubmitted).length>1?(r="Your responses are processing",o="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",o="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(n).filter(s=>s.isSubmitted).map(s=>s.progressPct)));return u("div",{className:R(_e(C.CardMainContent,t["userleap-platform"])),children:u("div",{className:R([e,"ul-card--uploading",C.FadeInTransition]),children:[u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:C.LoadingSpinnerContainer,role:"progressbar",children:u("div",{className:C.LoadingSpinner,children:[u("div",{className:C.LoadingSpinnerFirst}),u("div",{className:C.LoadingSpinnerSecond}),u("div",{className:C.LoadingSpinnerThird}),u("div",{className:C.LoadingSpinnerFourth})]})}),u(ye,{message:`${r} (${i}% complete)`}),u("p",{className:C.Caption,children:o})]})})},wr=()=>u("svg",{alt:"Powered by Sprig",fill:"none",height:"13",viewBox:"0 0 100 13",width:"100",xmlns:"http://www.w3.org/2000/svg",children:[u("path",{d:"M3.0369 0.839981H0.0249023V8.99998H1.3209V6.53998H2.8569C4.8969 6.53998 6.2409 5.37598 6.2409 3.62398C6.2409 1.95598 4.9689 0.839981 3.0369 0.839981ZM3.0009 5.35198H1.3209V2.02798H3.0009C4.1769 2.02798 4.9689 2.67598 4.9689 3.62398C4.9689 4.65598 4.1769 5.35198 3.0009 5.35198Z",fill:"#5D696F"}),u("path",{d:"M9.90653 3.21598C8.15453 3.21598 6.90653 4.45198 6.90653 6.17998C6.90653 7.90798 8.15453 9.14398 9.90653 9.14398C11.6585 9.14398 12.9065 7.90798 12.9065 6.17998C12.9065 4.45198 11.6585 3.21598 9.90653 3.21598ZM9.90653 8.01598C8.88653 8.01598 8.15453 7.23598 8.15453 6.17998C8.15453 5.11198 8.88653 4.34398 9.90653 4.34398C10.9265 4.34398 11.6585 5.11198 11.6585 6.17998C11.6585 7.23598 10.9265 8.01598 9.90653 8.01598Z",fill:"#5D696F"}),u("path",{d:"M20.9631 3.35998L19.7391 7.11598L18.3951 3.35998H17.3271L15.9831 7.12798L14.7591 3.35998H13.4151L15.4431 8.99998H16.5351L17.8671 5.08798L19.1871 8.99998H20.2791L22.3071 3.35998H20.9631Z",fill:"#5D696F"}),u("path",{d:"M25.7246 3.21598C24.0086 3.21598 22.8206 4.51198 22.8206 6.17998C22.8206 7.85998 24.0206 9.14398 25.7966 9.14398C27.0206 9.14398 28.0166 8.54398 28.3766 7.52398H27.0086C26.7806 7.88398 26.3606 8.05198 25.8086 8.05198C24.7526 8.05198 24.2126 7.40398 24.0926 6.55198H28.5206C28.7606 4.64398 27.5966 3.21598 25.7246 3.21598ZM25.7366 4.27198C26.6126 4.27198 27.2126 4.76398 27.2846 5.68798H24.1166C24.2606 4.89598 24.8006 4.27198 25.7366 4.27198Z",fill:"#5D696F"}),u("path",{d:"M31.1297 4.12798V3.35998H29.8817V8.99998H31.1297V5.44798C31.6337 4.78798 32.3177 4.45198 33.2177 4.41598V3.23998C32.3537 3.23998 31.6457 3.56398 31.1297 4.12798Z",fill:"#5D696F"}),u("path",{d:"M36.8222 3.21598C35.1062 3.21598 33.9182 4.51198 33.9182 6.17998C33.9182 7.85998 35.1182 9.14398 36.8942 9.14398C38.1182 9.14398 39.1142 8.54398 39.4742 7.52398H38.1062C37.8782 7.88398 37.4582 8.05198 36.9062 8.05198C35.8502 8.05198 35.3102 7.40398 35.1902 6.55198H39.6182C39.8582 4.64398 38.6942 3.21598 36.8222 3.21598ZM36.8342 4.27198C37.7102 4.27198 38.3102 4.76398 38.3822 5.68798H35.2142C35.3582 4.89598 35.8982 4.27198 36.8342 4.27198Z",fill:"#5D696F"}),u("path",{d:"M45.4886 0.47998V3.80398C45.0086 3.43198 44.3966 3.21598 43.6766 3.21598C42.0926 3.21598 40.8206 4.53598 40.8206 6.16798C40.8206 7.82398 42.0926 9.14398 43.6766 9.14398C44.3966 9.14398 45.0086 8.92798 45.4886 8.54398V8.99998H46.7246V0.47998H45.4886ZM43.8566 8.01598C42.8246 8.01598 42.0686 7.17598 42.0686 6.16798C42.0686 5.17198 42.8246 4.34398 43.8566 4.34398C44.4806 4.34398 45.0686 4.55998 45.4886 5.15998V7.18798C45.0686 7.79998 44.4806 8.01598 43.8566 8.01598Z",fill:"#5D696F"}),u("path",{d:"M54.6797 3.21598C53.9597 3.21598 53.3477 3.43198 52.8797 3.79198V0.47998H51.6317V8.99998H52.8797V8.55598C53.3477 8.92798 53.9597 9.14398 54.6797 9.14398C56.2637 9.14398 57.5477 7.82398 57.5477 6.16798C57.5477 4.53598 56.2637 3.21598 54.6797 3.21598ZM54.4997 8.01598C53.8757 8.01598 53.2997 7.79998 52.8797 7.21198V5.13598C53.2997 4.54798 53.8757 4.34398 54.4997 4.34398C55.5437 4.34398 56.2997 5.17198 56.2997 6.16798C56.2997 7.17598 55.5437 8.01598 54.4997 8.01598Z",fill:"#5D696F"}),u("path",{d:"M63.3347 3.34798L61.3907 7.76398L59.2667 3.34798H57.9347L60.8147 9.08398L59.6267 11.784H60.9347L64.6547 3.34798H63.3347Z",fill:"#5D696F"}),u("path",{d:"M71.1466 4.34661C69.8092 4.05038 69.131 3.53001 69.131 2.80065C69.131 2.04705 69.8546 1.47822 70.8142 1.47822C71.8034 1.47822 72.5496 2.10339 72.5496 2.9321V2.99813H73.9165V2.9321C73.9165 1.41764 72.5883 0.272705 70.8271 0.272705C69.9784 0.272705 69.2009 0.533191 68.6379 1.0057C68.3584 1.23619 68.1339 1.52487 67.9805 1.8511C67.8271 2.17733 67.7486 2.53303 67.7506 2.89273C67.7451 3.22255 67.8137 3.54949 67.9515 3.84994C68.0894 4.15038 68.293 4.41686 68.5478 4.63012C69.0218 5.04266 69.6945 5.34798 70.5463 5.5388C71.9806 5.85502 72.7078 6.39296 72.7078 7.13686C72.7078 7.94316 71.9156 8.55076 70.8682 8.55076C69.7804 8.55076 68.9599 7.87531 68.9599 6.97996V6.91393H67.5918V6.97996C67.5918 8.56348 68.9942 9.75688 70.8535 9.75688C71.7426 9.75688 72.5588 9.48731 73.1518 8.99662C73.446 8.75831 73.6827 8.4581 73.8445 8.1179C74.0063 7.7777 74.0891 7.40611 74.087 7.03024C74.087 5.6854 73.0991 4.78217 71.1466 4.34661Z",fill:"#5D696F"}),u("path",{d:"M78.7986 2.50806C78.2874 2.50175 77.7823 2.6176 77.3263 2.84576C76.8703 3.07391 76.4768 3.40759 76.1795 3.81837V2.66738H74.8789V12.0752H76.1795V8.48716C76.4768 8.8979 76.8703 9.23152 77.3263 9.45957C77.7824 9.68763 78.2875 9.80335 78.7986 9.79687C80.8167 9.79687 82.3381 8.23031 82.3381 6.15246C82.3381 4.07462 80.8167 2.50806 78.7986 2.50806ZM80.9835 6.42264C80.9316 6.9629 80.6921 7.46879 80.3056 7.8544C79.919 8.24001 79.4093 8.48156 78.863 8.53804C78.1369 8.61074 77.4605 8.40295 76.9583 7.95407C76.4561 7.50518 76.1795 6.86365 76.1795 6.15246C76.1795 4.7846 77.2122 3.75295 78.5815 3.75295C79.2904 3.75295 79.9306 4.02191 80.3776 4.51018C80.8387 5.01116 81.054 5.69025 80.9835 6.42264Z",fill:"#5D696F"}),u("path",{d:"M98.2908 2.6692V3.80747C97.6776 2.97875 96.7302 2.50806 95.6583 2.50806C93.6482 2.50806 92.1323 4.04615 92.1323 6.08582C92.1323 8.1255 93.6482 9.66299 95.6583 9.66299C96.7345 9.66299 97.6819 9.19714 98.2908 8.37691V8.55198C98.2908 9.96891 97.3906 10.8843 95.9974 10.8843C95.0561 10.8843 94.2718 10.4766 93.8996 9.79384L93.8806 9.7587H92.5389L92.5695 9.84654C92.7961 10.514 93.2392 11.0889 93.8303 11.4822C94.4233 11.8723 95.1726 12.0783 95.9974 12.0783C97.0552 12.0783 97.9554 11.7451 98.6017 11.1157C99.2481 10.4862 99.5915 9.6012 99.5915 8.56773V2.6692H98.2908ZM97.5611 7.842C97.0092 8.36418 96.2225 8.58348 95.4001 8.44294C94.9132 8.35796 94.4664 8.12184 94.1245 7.76889C93.7827 7.41593 93.5636 6.96452 93.4992 6.48019C93.3833 5.66541 93.631 4.89364 94.1786 4.36418C94.6383 3.92741 95.2542 3.68788 95.8919 3.69782C96.0464 3.69795 96.2006 3.71031 96.3531 3.73477C97.3459 3.89349 98.1314 4.70403 98.2632 5.71024C98.3749 6.53835 98.1179 7.31436 97.5611 7.842Z",fill:"#5D696F"}),u("path",{d:"M90.705 0.0995975C90.4602 0.046773 90.2043 0.0911971 89.9925 0.223269C89.7806 0.35534 89.6299 0.564452 89.5729 0.805409C89.5159 1.04637 89.5571 1.29982 89.6877 1.51098C89.8183 1.72215 90.0277 1.87407 90.2708 1.93391C90.3415 1.94954 90.4136 1.95747 90.486 1.95754C90.72 1.9579 90.9458 1.87325 91.1206 1.71973C91.2955 1.5662 91.407 1.35452 91.4341 1.125C91.4611 0.89547 91.4017 0.664135 91.2673 0.475046C91.1329 0.285958 90.9327 0.152325 90.705 0.0995975V0.0995975Z",fill:"#5D696F"}),u("path",{d:"M89.8366 8.39143H88.715C87.9178 8.39143 87.4389 7.85531 87.4389 6.95693C87.4389 6.08096 87.8681 5.03659 88.7432 3.76444L88.7548 3.74748V3.38825L85.0271 2.86727C85.0284 2.71553 84.9886 2.56622 84.9118 2.43478C84.8351 2.30335 84.7241 2.19458 84.5905 2.11973C84.2563 1.938 83.8908 1.938 83.5879 2.11368C83.4361 2.2023 83.3122 2.33077 83.23 2.4848C83.1477 2.63884 83.1103 2.8124 83.1219 2.98618C83.1336 3.15996 83.1938 3.32714 83.2958 3.46914C83.3979 3.61114 83.5379 3.72238 83.7001 3.79049L82.5405 9.63753H83.8283L84.8977 4.08551L86.9115 4.42111C86.3701 5.38007 86.0953 6.27421 86.0953 7.07869C86.0953 8.56347 87.0041 9.53576 88.4734 9.62965V9.63753H91.1341V2.69099H89.8366V8.39143Z",fill:"#5D696F"})]}),_l=()=>{const{border:e,cards:t,headers:n,index:r,marketingUrl:o,showSurveyBrand:i,slugName:s,surveyId:a,viewedCardCount:c}=z(g=>({border:g.border,cards:g.cards,headers:g.headers,index:g.index,marketingUrl:g.marketingUrl,showSurveyBrand:g.showSurveyBrand,slugName:g.slugName,surveyId:g.surveyId,viewedCardCount:g.viewedCardCount})),d=Te(null),l=t.filter(g=>g.type!==I.Uploading&&g.type!==I.Thanks),m=xa(t,r),p=c+1,f=p/(p+m);re(()=>{d.current&&(d.current.style.width=`${f*100}%`)},[f]);const h=()=>i?u("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:u(wr,{})}):null;return!l||l.length===1?u("footer",{className:"ul-footer",style:i?{}:{marginBottom:"10px"},children:h()}):u("footer",{className:`ul-footer ${n["userleap-platform"]==="link"?"ul-footer__link":""}`,children:[l.length>1&&u("div",{id:"ul-progress-bar-container",children:u("div",{id:"ul-progress-bar-current",ref:d,style:{border:`1px solid ${e||"#000"}`}})}),i&&u("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:u(wr,{})})]})},yl=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:o,destroy:i,endCard:s,eventEmitFn:a,fontFamily:c,headers:d,index:l,next:m,showStripes:p,update:f,useMobileStyling:h,viewDocument:g}=z(y=>({answers:y.answers,border:y.border,cards:y.cards,close:y.close,configureExitOnOverlayClick:y.configureExitOnOverlayClick,destroy:y.destroy,endCard:y.endCard,eventEmitFn:y.eventEmitFn,fontFamily:y.fontFamily,headers:y.headers,index:y.index,next:y.next,showStripes:y.showStripes,update:y.update,useMobileStyling:y.useMobileStyling,viewDocument:y.viewDocument})),v=Te(null),w=Te(!1),{props:_,type:S,name:b}=n[l],E=n.length;re(()=>{v.current&&(v.current.classList.contains("ul-app--visible")||v.current.classList.add("ul-app--visible"),!w.current&&a&&(w.current=!0,a(j.SurveyAppeared)))},[a]),re(()=>{f()},[l,f]),re(()=>{o(()=>r())},[r,o]);const D=()=>r(ze),x=y=>{y.key==="Enter"&&D()},P=async function(y){m({data:y,completeSurvey:()=>{i(ze)},endCard:s}),Ui(g)};if(e){for(const y of e)if(y.questionId===b){let B;if(S===I.MultipleChoice){const O=_.options.find(({value:ie})=>ie===y.value);if(!O)break;B={[O.id]:O.value}}else B=y.value;P({value:B,type:S,questionId:y.questionId});break}}const T=()=>[Fe.Email,Fe.Link].includes(d["userleap-platform"])?!1:!s||l+1!==E,V=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},k=()=>{const y={className:"ul-card",next:P,questionId:b,type:S};switch(S){case I.ConsentLegal:return q(Da,{...y,..._,key:b});case I.Likert:return q(ja,{...y,..._,key:b});case I.MultipleChoice:return q(Oa,{...y,..._,key:b});case I.MultipleSelect:return q(Ma,{...y,..._,key:b});case I.NPS:return q(Na,{...y,key:b,props:_});case I.Open:return q(Va,{...y,..._,key:b});case I.RecordedTask:return q(Ya,{...y,..._,key:b});case I.TextUrlPrompt:return q(Xa,{...y,..._,key:b});case I.Thanks:return q(el,{...y,..._,key:b});case I.Uploading:return q(wl,{...y,..._,key:b});case I.VideoVoice:return q(vl,{...y,..._,key:b});default:return null}},$=y=>{var Rn;const B=window.sprigAPI,O=y.target;if(!B||!O)return;const ie=[O,O.parentElement];for(const ft of ie)if(((Rn=ft==null?void 0:ft.tagName)==null?void 0:Rn.toLowerCase())==="a"){y.preventDefault(),B==null||B.openUrl(ft.href);return}};return u("div",{className:R("ul-app",qe(d)?"ul-app--visible":"ul-app--overlay"),id:ze,onClick:$,ref:v,style:{"--theme":t,...c?{fontFamily:c.replace(";","")}:{}},children:u("div",{className:"ul-app__container",children:[u("div",{className:R(W(C.CardContainer,h)),style:V(),children:[p&&u("div",{className:"ul-header__container",children:u("div",{className:"ul-header",children:"For development purposes only"})}),k(),u(_l,{})]}),T()&&u("div",{className:R(W(C.CloseContainer,h)),children:u("div",{"aria-label":"Close button",className:C.CloseButton,onClick:D,onKeyPress:x,role:"button",tabIndex:0,children:u("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})})]})})},bl=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels span:last-child{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:left;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
686
- `,xl=(e,t)=>{const n=[...e],r=new Set([I.VideoVoice,I.RecordedTask]);return e.some(o=>r.has(o.type))&&n.push({name:-2,props:{routingOptions:[]},type:I.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:I.Thanks}),n},Cl=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function kl(e,t=!0){var b,E,D;const{answers:n,apiURL:r,customStyles:o,endCard:i,eventEmitFn:s,fontFamilyURL:a,frame:c,UpChunk:d,viewDocument:l,viewWindow:m}=e,p=qe(e.headers)?e.frame:l.body,f=F,h=xl(e.cards,!!i);_t.configure(f,{cards:h,hasEndCard:!!i,apiURL:r,UpChunk:d}),z.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:s,fontFamily:e.fontFamily,frame:c,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Cl({mode:e.mode,viewWindow:m,viewDocument:l}),mode:e.mode,previewKey:(b=window.UserLeap)!=null&&b.localStorageAvailable?(E=window.localStorage)==null?void 0:E.getItem(J.Preview):null,recorder:_t,recorderEventEmitter:f,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:g}=z.getState();g();const{head:v}=l,w=l.createElement("style");if(w.id="sprig-style",w.textContent=bl,w.nonce=e.styleNonce,v.appendChild(w),e.fontFamily&&a&&parent){const x=l.createElement("link");x.rel="stylesheet",x.href=a,v.appendChild(x)}if(e.customStyles&&Cr(l,o,e.styleNonce),!d)if(e.installationMethod!==Ie.Npm){const x=l.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{_t.setUpChunk(m.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},v.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const _="2.22.4",S=s||((D=c.eventEmitter)==null?void 0:D.emit);S==null||S(oe.VerifyViewVersion,{[Me.ViewVersion]:_}),p&&t&&Ke(u(yl,{}),p)}const Sl={configure:kl};window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig);window.UserLeap||(window.UserLeap=window.Sprig);window.Sprig||(window.Sprig=window.UserLeap);const El="rgba(255,255,255, 0.95)",Ll="rgba(0,0,0,0.9)",Il="360px",Yt="0px",ci=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},di=e=>{const t=window.UserLeap.container;if(!!t)try{document.body.removeChild(t),window.UserLeap.container=null,Q("trackStartUrl",null),F.emit(j.SurveyLifeCycle,{state:"dismissed"}),F.emit(j.SurveyClosed,{name:j.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},ui=()=>{F.on(j.SurveyWillClose,({initiator:e})=>{di(e)})},Ul=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},o=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=o==="light"?El:Ll,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},Tl=(e,t,n)=>{var a,c;const r={position:"fixed",bottom:"0px",right:Yt,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},o=Object.assign({},t,window.UserLeap);let i,s=!1;return n?((a=window.UserLeap.windowDimensions)!=null&&a.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(c=window.UserLeap.windowDimensions)!=null&&c.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(o.overlayStyleMobile)&&(s=!0)):(r.width=Il,r.maxHeight=window.UserLeap.maxHeight||"66vh",o.framePosition===nt.BottomLeft?i={left:Yt}:o.framePosition===nt.TopLeft?i={left:Yt,top:"0px"}:o.framePosition===nt.TopRight?i={top:"0px"}:o.framePosition===nt.Center&&(s=!0,i={margin:"auto",position:"static"},r.maxHeight=null)),s&&Ul(o,n),Object.assign(e.style,r,i),s},Pl=(e,t)=>{var a,c;const n="ul-frame";ci();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const o=Tl(r,e,t);F.on(j.SurveyFadingOut,()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}),ui(),r.setHeight=d=>{parseInt(r.style.height)!=d&&(r.style.height=`${d}px`,F.emit(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:d}))},(a=window.UserLeap.container)==null||a.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{F.emit(j.CloseSurveyOnOverlayClick)}),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented});const i=(c=r.contentWindow)==null?void 0:c.document;i&&(i.open("text/html","replace"),i.write("<!doctype html><head></head><body></body></html>"),i.close());const s=i==null?void 0:i.head;return{frameId:n,contentWinDocHead:s,contentWindow:r.contentWindow,hasOverlay:o,iframe:r}},Rl="!optimizely_experiments_";class Dl{constructor(){te(this,"_optimizelyData",{})}setOptimizelyExperiment(t){if(!t||typeof t!="object")return!1;const{experiments:n}=t;try{return Object.keys(this._optimizelyData).map(r=>{delete this._optimizelyData[r]}),n&&n.map(r=>{const{id:o,variation:i}=r,s=this.transformExperimentId(o);i&&typeof i=="string"&&(this._optimizelyData[s]=i)}),!0}catch(r){return r instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",r),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return Rl+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(o=>{var i,s;return(i=n[o].variation)!=null&&i.name?{id:o,variation:(s=n[o].variation)==null?void 0:s.name}:{id:o,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r}),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const xt=new Dl;Object.freeze(xt);class Al{constructor(t,n){te(this,"paused");te(this,"queue");te(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],o=this.ul[r];o instanceof Function?o.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(o){n=function(){o(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const jl=["popState","pushState","replaceState"],Ol={test:"test"},et="!email",Ml=["ios","android"],Le="environments",pn="pageUrl",De="visitors",_r="ul-view-sdk-script",yr=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function Un(e,t){const{matchType:n,pattern:r}=e,o=n?yr[n]:yr.legacy;let i=!1;try{i=o(r,t)}catch(s){const a=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;s instanceof Error&&(console.warn(a,s),s.stack=JSON.stringify(e),window.UserLeap.reportError(a,s))}return i}function Nl(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:o}=window.UserLeap._config;if(!o)return!0;const i=[];n&&n.length&&i.push(...n),r&&r.length&&i.push(...r);const s=e&&i.find(a=>a.id===e);return s?Un(s,window.location.href):t===window.location.href}function lt(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:o}=window.UserLeap._config;if(o&&o!==Fe.Web)return;const i=Ae("trackStartUrl"),s=i?String(i):null;t&&zl(window.location.href),n&&(fi(),Vl()),r&&s&&s!==window.location.href&&e&&jl.includes(e.type)&&window.UserLeap("dismissActiveSurvey",he.PageChange)}const pi={capture:!0},Vl=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>Un(r,window.location.href)).map(r=>{const{name:o,properties:i}=r,{selector:s,innerText:a}=i;return s?c=>{if(We(c.target))try{c.target.closest(s)&&window.UserLeap("track",o)}catch{}return!1}:c=>(We(c.target)&&c.target.innerText===a&&window.UserLeap("track",o),!1)}),n=r=>t.forEach(o=>o(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,pi)},fi=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,pi),delete window.UserLeap._config.interactiveEventsHandler};function Bl(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,lt,!0))}function Fl(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,lt,!0)),window.UserLeap._config.interactiveEvents&&fi()}function me(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(o=>{r.push(o),o===Le?r.push(window.UserLeap.envId):o===De&&r.push(Tn())}),n&&r.push(n),r.join("/")}function $l(e,t){let n=me("1",[Le],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Hl(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Ae(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(J.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function Q(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(J.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(i){i instanceof Error&&(i.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",i)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",i)}let o=r[window.UserLeap.envId];o?o[e]=t:o={[e]:t},r[window.UserLeap.envId]=o;try{localStorage.setItem(J.Credentials,JSON.stringify(r))}catch(i){i instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${i.message}`)}}function mi(){window.previewMode||(window.UserLeap.visitorId=Be(),Q("vid",window.UserLeap.visitorId),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function Tn(){return window.previewMode?"0":window.UserLeap.visitorId||""}function zl(e){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const t=window.UserLeap._config.pageUrlEvents;if(t&&t.length){let a=!1;for(let c=0;c<t.length&&(a=Un(t[c],e),!a);c++);if(!a)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const n=10,r=1;let o=[];const i={viewedAt:Date.now(),location:e},s=localStorage.getItem(J.PageViews);try{if(o=s?JSON.parse(s):[],Array.isArray(o)||(o=[]),o.length>0){const a=o[o.length-1],c=(Date.now()-a.viewedAt)/1e3;(a.location!=e&&c>r||c>n)&&(window.UserLeap._queue.push(["track",pn,null,{url:e}]),o.push(i))}else window.UserLeap._queue.push(["track",pn,null,{url:e}]),o.push(i);o.length>5&&o.splice(0,o.length-5);try{localStorage.setItem(J.PageViews,JSON.stringify(o))}catch(a){a instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${a.message}`)}}catch(a){a instanceof Error&&(a.stack=s||"",window.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ql(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const o=t.apply(this,r),i=new Event("pushState");return window.dispatchEvent(i),lt(i),o})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const o=t.apply(this,r),i=new Event("replaceState");return window.dispatchEvent(i),lt(i),o})(e.replaceState)),Bl()}async function Qt(e,t){const n=Tn();e&&!t&&(window.UserLeap._config.mode=Ol.test);const r=await ke($l(n,e),{},0,!0);return r.ok?(r.json.delay&&await Ct(r.json.delay),hi(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const hi=async(e,t)=>{var y,B;const{context:n,endCard:r,locale:o,productConfig:i,questions:s,responseGroupUid:a,surveyId:c,uuid:d,vid:l,sessionReplay:m}=e,p=dt(window.UserLeap),f=Pn(p),h=Wl(p);if(m&&Ls(a,c,l,m,p,window.UserLeap._API_URL),l==null||!s||!s.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const O="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(O),{success:!1,message:O,surveyState:"no survey"}}if(l!==window.UserLeap.visitorId&&d!==window.UserLeap.visitorId&&!window.previewMode){const O="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(O)),{success:!1,message:O,surveyState:"no survey"}}if(!(t?await t(c):!0))return{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"};Jt.disable(),F.emit(j.SurveyWillPresent,{name:j.SurveyWillPresent,[br.SurveyId]:c});let v,w=document.createElement("div"),_,S,b;const E=O=>{const{[Me.ViewVersion]:ie}=O;ie!==p["x-ul-sdk-version"]&&di(),F.removeListener(oe.VerifyViewVersion,E)};F.on(oe.VerifyViewVersion,E),qe(p)?(v="ul-direct-embeded-frame",_=document.head,S=window,b=!1,f&&(ci(),w.id=v,window.UserLeap.container.appendChild(w),ui(),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented}))):{frameId:v,contentWinDocHead:_,contentWindow:S,hasOverlay:b,iframe:w}=Pl(i,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const D=O=>{F.on(j.CloseSurveyOnOverlayClick,O)},x=Object.assign({frame:w,envId:window.UserLeap.envId,surveyId:c,userId:d,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:s,context:n,locale:o,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:a,headers:p,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:D,eventEmitFn:F.emit.bind(F),ulEvents:mn,viewDocument:S==null?void 0:S.document,viewWindow:S,tabTitle:document.title,startingQuestionIdx:(y=window.UserLeap.config)==null?void 0:y.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce},window.UserLeap._config);(B=window.UserLeap.config)!=null&&B.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),S&&(S.__cfg=x);function P(){const O=document.createElement("script");return window.UserLeap.nonce&&O.setAttribute("nonce",window.UserLeap.nonce),O.id=_r,O}const T=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,V=document.getElementById(_r);V&&V.remove();const k=P(),$=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===Ie.Npm?(Sl.configure(x),b&&window.UserLeap.container&&$()):T&&(k.src=T,b&&k.addEventListener("load",()=>{window.UserLeap.container&&$()}),S==null||S.addEventListener("error",O=>{O.target instanceof HTMLScriptElement&&O.target.src===T&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(k),{success:!0,surveyState:"ready"}};function Wl(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return Pn(e)||t>10&&t<xi}function Pn(e){return Ml.includes(e[fe.Platform])}function Gl(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function Kl(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Gl(t),(t||n||r)&&(ql(),lt())}async function ke(e,t,n=0,r=!1){var i,s;t.headers=Object.assign(dt(window.UserLeap),t.headers);const o=await ge(e,t,n,r);if(o.ok){const a=(i=o.headers)==null?void 0:i.get("Authorization"),c=a?a.split(" "):void 0,d=c&&c.length===2?c[1]:void 0,l=(s=o.headers)==null?void 0:s.get(fe.VisitorID);d&&l&&(l!==window.UserLeap.visitorId||window.UserLeap.token!==d)&&(Q("token",d),Q("vid",l),F.emit(j.VisitorIDUpdated,{visitorId:l}),window.UserLeap.token=d,window.UserLeap.visitorId=l)}return o.json&&o.json.logMessage&&console.warn(`[Sprig] ${o.json.logMessage}`),o}async function Zl(e){var t;!((t=e==null?void 0:e.json)!=null&&t.delay)||(window.UserLeap.delayingSurvey=!0,await Ct(e.json.delay),window.UserLeap.delayingSurvey=!1)}const Yl=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,g,v;const{userId:o,anonymousId:i,metadata:s={},properties:a,showSurveyCallback:c}=r;let{eventName:d}=r;if(window.UserLeap.debugMode&&d!==pn&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const l=window.UserLeap.localStorageAvailable&&(h=localStorage.getItem(J.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const w="[Sprig] - Skipping tracking without userId";return console.warn(w),{success:!1,message:w,surveyState:"no survey"}}if(!d||d.trim().length===0){d=d?String(d):"";const w="[Sprig] - Invalid event name "+d;return console.warn(w),{success:!1,message:w,surveyState:"no survey"}}const m=window.location.href;if(s.url||(s.url=m),Q("trackStartUrl",m),(v=(g=window.UserLeap)==null?void 0:g._config)!=null&&v.optimizelyEnabled){const w=dt(window.UserLeap);Pn(w)||xt.getAndSetWebOptimizelyExperiments(),s.optimizelyExperiments=Object.assign({},xt.getAllOptimizelyExperiments())}o&&(window.UserLeap.userId=o),i&&(window.UserLeap.partnerAnonymousId=i),a&&(s.eventProperties=a);const p=window.UserLeap.delayingSurvey?await ke(me("1",[De],"events/batch"),{body:JSON.stringify({events:[{event:d,metadata:s}],previewKey:l}),method:"POST"},0,!0):await ke(me("1",[De],"events"),{body:JSON.stringify({event:d,metadata:s,previewKey:l}),method:"POST"},0,!0);if(!p.ok){const w="[Sprig] (ERR-421) Failed to track event";return p.reportError&&(console.warn(w,p.error),p.error&&window.UserLeap.reportError("track",p.error)),{success:!1,message:w,error:p.error,surveyState:"no survey"}}o&&Q("uid",o),i&&Q("aid",i);const f=p.json;return f.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(J.Preview),await Zl(p),Nl(f.eventId,m)?hi(f,c):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",he.Override),Qt({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",he.Override),Qt({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",he.Override),Qt({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=he.API){F.emit(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:r})},async setAttribute(r,o){if(!r||!o&&o!==0){const i="[Sprig] - Disregarding empty attribute / value provided";return console.warn(i),{success:!1,message:i}}return this.setAttributes({[r]:o})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const d="[Sprig] - Disregarding empty payload provided";return console.warn(d),{success:!1,message:d}}const{userId:o,anonymousId:i,attributes:s}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const d="[Sprig] - Skipping tracking without userId";return console.warn(d),{success:!1,message:d}}if(!s&&(!o||window.UserLeap.userId===o)&&(!i||window.UserLeap.partnerAnonymousId===i))return{success:!0};const a={};o&&(a.userId=window.UserLeap.userId=o),i&&(a.partnerAnonymousId=window.UserLeap.partnerAnonymousId=i);let c;return s?(s.email&&!Object.prototype.hasOwnProperty.call(s,et)&&(s[et]=s.email,delete s.email),c=await ke(me("1",[Le,De],"attributes"),{body:JSON.stringify(s),method:"PUT"}),!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await ke(me("1",[Le,De]),{body:JSON.stringify(a),method:"PUT"}),s&&s[et]&&(window.UserLeap.email=s[et]),c.ok&&(o&&Q("uid",o),i&&Q("aid",i)),{success:!!c.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const i="[Sprig] - Skipping tracking without userId";return console.warn(i),{success:!1,message:i}}const o=await ke(me("1",[Le,De],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!o.ok&&o.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",o.error),o.error&&window.UserLeap.reportError("removeAttributes",o.error)),{success:!!o.ok}},async addSurveyListener(r){F.on(j.SurveyLifeCycle,r)},async removeSurveyListener(r){F.removeListener(j.SurveyLifeCycle,r)},async addListener(r,o){F.on(r,o)},async removeListener(r,o){F.removeListener(r,o)},async removeAllListeners(){F.removeAllListeners()},setVisitorAttribute(r,o){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,o)},async setEmail(r){return n.setAttribute(et,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const s=`[Sprig] - Invalid userId ${r}`;return console.warn(s),{success:!1,message:s}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const o=window.UserLeap.visitorId,i=await ke(me("1",[Le,De]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!i.ok){i.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",i.error),i.error&&window.UserLeap.reportError("setUserId",i.error));return}o!==window.UserLeap.visitorId&&Vn(),Q("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const o=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(o),{success:!1,message:o}}return window.UserLeap.partnerAnonymousId=r,Q("aid",r),{success:!0}},async track(r,o,i={},s=void 0){return t({eventName:r,properties:o,metadata:i,showSurveyCallback:s})},async identifyAndTrack(r){return await t(r)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const o=window.UserLeap.container.children[0].contentDocument;if(o){const i=o.getElementById(C.CustomStyle);i?i.textContent=r:Cr(o,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,o){var c,d;const i=typeof r=="string"?parseInt(r,10):r,s=typeof o=="string"?parseInt(o,10):o;if(!isNaN(i)&&!isNaN(s)&&(window.UserLeap.windowDimensions={width:i,height:s}),!window.UserLeap.frameId)return;const a=document.getElementById(window.UserLeap.frameId);!a||(window.UserLeap.useMobileStyling&&((c=window.UserLeap.windowDimensions)!=null&&c.width&&(a.style.width=`${window.UserLeap.windowDimensions.width}px`),(d=window.UserLeap.windowDimensions)!=null&&d.height&&(a.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),a.contentDocument&&(a.style.height=String(kr(a.contentDocument))+"px")),F.emit(j.SurveyDimensions,{name:j.SurveyDimensions,contentFrameWidth:a.clientWidth,contentFrameHeight:a.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(J.Credentials),localStorage.removeItem(J.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),mi(),Vn(),window.UserLeap._queue.unpause()},teardown(){Fl(),window.UserLeap("dismissActiveSurvey",he.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r){const o=JSON.parse(r);xt.setOptimizelyExperiment(o)}};Object.assign(window.UserLeap,n)};async function Ql(e){const t=dt(window.UserLeap);let n=await ge(me("1",[Le],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await ge(me("1",[Le],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Xt("Disabled: failed to fetch configuration"),e;const o=n.json;return o!=null&&o.disabled?(Xt(`Disabled: ${o.disabled}`),{disabled:o.disabled}):Object.assign({},o,e)}async function Jl(e,t){const n=window.__cfg&&window.__cfg.mode,r=Tn(),o=window.UserLeap.envId,i=window.document.documentElement,s={mode:n,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:i.clientWidth,clientHeight:i.clientHeight,location:window.location.href,language:window.navigator.language},a={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:r,envId:o};(await ke(me("1",null,"errors"),{method:"POST",headers:{[fe.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(a)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Xl(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey"),n=Hl();window.UserLeap.localStorageAvailable=n,n&&t&&localStorage.setItem(J.Preview,t),window.UserLeap.UPDATES=mn;async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Jl,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const c in window.UserLeap._config)window.UserLeap[c]=window.UserLeap._config[c];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let c=Ae("sampled");if(c===null&&(c=Math.random()<o,Q("sampled",c)),!c)return}else n&&Ae("sampled")!==null&&Q("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const i=[...window.UserLeap._queue];window.UserLeap._queue=new Al(window.UserLeap,[]),window.UserLeap._queue.pause();for(let c=0;c<i.length;c++)window.UserLeap._queue.push(i[c]);const s=Ae("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Ae("vid"),window.UserLeap.userId=Ae("uid"),window.UserLeap.partnerAnonymousId=Ae("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(J.Credentials),mi());const a=await Ql(e);ws(window.document,a.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,a.replaySettings),Yl(a),await Kl(a),window.UserLeap._queue.unpause(),F.emit(j.SDKReady),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Tt{constructor(){te(this,"UPDATES",mn)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const fn={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod=Ie.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Tt.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Tt.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Xl(e),window.Sprig}},ec={sprig:fn,SprigAPI:Tt,configure:fn.configure};exports.DismissReason=he;exports.SprigAPI=Tt;exports.SprigEvent=j;exports.default=ec;exports.sprig=fn;
685
+ `,ml=e=>{const t=U.document.createElement("div");return t.className="ul-video-player-loading",t.id=Dn(e),["first","second","third","fourth"].map(n=>{const r=U.document.createElement("div");r.className=n,t.appendChild(r)}),t},Dn=e=>e+"-loading-spiner",G="hidden",wr=".m3u8",Gt="questionId",Kt="ul-video-recorder-camera-off-button",Zt="ul-recording-in-session",hl=[{type:"link",content:`${Me}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Me}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Me}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Me}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Me}/userleap-web-upchunk-v2.2.2.js`}],ii=[{type:"link",content:`${Me}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Me}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:fl}],si="-video-player",ai="-secondary-video-player",li="-video-recorder";let pe,_r;const Se=async({event:e,apiBase:t,headers:n,visitorId:r,envId:o,metadata:i})=>{const s=U.document.documentElement;if(!r||!o)return;const a={event:`SDK - ${e}`,visitorId:r,environmentId:o,metadata:{...i||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(a)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},be=async(e,t,n,r,o,i)=>{Se({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:o,envId:i,metadata:{errorMessage:e.message}});const s=U.document.documentElement,a={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:navigator.language},c={action:t,err:{message:e.message,stack:e.stack},meta:a,vid:o,envId:i};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},gl=(e,{type:t,content:n})=>new Promise(function(r,o){let i;t==="script"?(i=U.document.createElement("script"),i.src=n):t==="link"?(i=U.document.createElement("link"),i.rel="stylesheet",i.href=n,i.type="text/css"):(i=U.document.createElement("style"),i.innerHTML=n),i.onload=function(){r(n)},i.onerror=function(){o(n)},i.async=!1,i.id=btoa(n),e.appendChild(i)}),ci=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(gl(U.document.head,r)),n),[])).then(()=>{U.videojs=U.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},yr=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=G;else if(t==="success")e.style.visibility=G,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},Yt=(e,t)=>{const n=U.videojs(e.id());return n==null?void 0:n.payload[t]},vl=(e,t,n,r,o)=>{const{surveyId:i,responseGroupUid:s,visitorId:a,envId:c}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(O.ERROR,{type:O.PERMISSION_DENIED}),Se({event:"Video Permission Denied",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Yt(e,Gt),responseGroupUid:s,surveyId:i}})):(n&&n(O.ERROR,{type:O.OTHER}),be(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,o,a,c))}),e.on("error",function(d,l){be(l||e.error(),"recorderError",t,o,a,c)}),e.on("startRecord",function(d,l){r(e.uploadProgressLabel,"none"),Se({event:"Video Record Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{questionId:Yt(e,Gt),responseGroupUid:s,surveyId:i}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const d=Yt(e,Gt);if(!i){const g="internal error: missing fields in payload";return n&&n(O.ERROR,{type:O.OTHER}),be(new Error(g),"finishRecord",t,o,a,c),null}e.record().stopDevice();const l=e.cameraOff?O.MEDIA_TYPE_AUDIO:O.MEDIA_TYPE_VIDEO,m=Pe();Se({event:"Video Record Finish",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l}});const p={surveyId:i,updatedAt:new Date().toISOString(),mediaType:l,mediaRecordingUid:m};d&&(p.questionId=d),s&&(p.responseGroupUid=s),a&&(p.visitorId=a);const h=await(async()=>{const g=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(g.ok){const v=await g.json();return n&&n(O.UPLOAD_STARTED,{[O.UPLOAD_ID]:v.upload.id,[O.MEDIA_TYPE]:l,[O.MEDIA_RECORDING_UID]:m}),v.upload.url}else return n&&n(O.ERROR,{type:O.OTHER,response:g}),be(new Error("failed to get upload response with url"),"finishRecord",t,o,a,c),null})();!h||(pe=U.document.defaultView.UpChunk.createUpload({endpoint:h,file:new U.document.defaultView.File([e.recordedData],`recording ${l} ${Date.now()}`),chunkSize:5120}),pe.startTime=Date.now(),Se({event:"Video Upload Start",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l,url:h}}),pe.on("error",g=>{r(e.uploadProgressLabel,"none"),n&&n(O.UPLOAD_FINISHED,{[O.MEDIA_RECORDING_UID]:m}),be(g,"finishRecord",t,o,a,c)}),pe.on("progress",g=>{n&&n(O.UPLOAD_PROGRESS,{[O.MEDIA_RECORDING_UID]:m,[O.UPLOAD_PROGRESS_PCT]:g.detail}),r(e.uploadProgressLabel,"progress",g.detail)}),pe.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(O.UPLOAD_FINISHED,{[O.MEDIA_RECORDING_UID]:m}),Se({event:"Video Upload Success",apiBase:t,headers:o,visitorId:a,envId:c,metadata:{mediaRecordingUid:m,questionId:d,responseGroupUid:s,surveyId:i,mediaType:l,url:h,elapsedMs:pe.startTime&&Date.now()-pe.startTime}})}))})},di=(e,t)=>{const n=new(U.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),wl(n),n},wl=e=>{e.children().forEach(t=>{if(ae[t.name_]){const n=xt(ae[t.name_],`ul-${ae[t.name_]}`);t.el_.appendChild(n)}})},xt=(e,t="")=>{const n=U.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},ui=(e,t,n,r,o=!1,i)=>{e.addClass("ul-video-player");const s=new(U.videojs.getComponent("Component"))(e);s.addClass("ul-control-panel"),e.progressBar=s.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(U.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const a=n&&n.src?El(n.src):null;n&&(o||!a)?(e.children()[0].classList.add("vjs-hidden"),U.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),U.document.getElementById(`${e.id()}_html5_api`).style.height="100%",a&&e.poster(a)),e.on("play",()=>{!o&&n&&!a&&bl(e,!1),i==null||i.play()}),e.on("pause",()=>{i==null||i.pause()}),e.on("seeked",()=>{i==null||i.currentTime(e.currentTime())}),e.on("ratechange",()=>{i==null||i.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),s.addChild(t),e.addChild(s),r&&r(e)},_l=(e,t,n)=>{e.addClass(`ul${ai}`);const r=new(U.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},yl=(e,t,n,r,o,i,s,a=!1)=>{_r=Date.now();const d=Pt(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!d)return;d.payload=n;const{surveyId:l,questionId:m,responseGroupUid:p,visitorId:f,envId:h}=n;let g;const v=S=>{const H=Kt,_=Kt+"-audio-only";yr(d.uploadProgressLabel,"none"),pe&&pe.startTime>=_r&&pe.abort();const B=U.document.getElementById("ul-camera-button");S?(d.children()[0].classList.add("vjs-hidden"),b.removeClass(H),b.addClass(_),B.innerHTML=ae.TurnOnCamera,d.audioPlayerPlaceholder.removeClass("vjs-hidden"),g==null||g.getTracks().forEach(M=>{M.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(M=>{g=M,M.getVideoTracks().forEach(se=>{se.enabled=!1}),d.record().onDeviceReady(M)}).catch(d.record().onDeviceError.bind(d.record()))):(g==null||g.getVideoTracks().forEach(M=>{M.enabled=!0}),d.children()[0].classList.remove("vjs-hidden"),d.record().getDevice(),b.removeClass(_),b.addClass(H),B.innerHTML=ae.TurnOffCamera,d.audioPlayerPlaceholder.addClass("vjs-hidden"))},y=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{y.hasClass(G)||(Se({event:"Video Delete Button Clicked",apiBase:r,headers:s,visitorId:f,envId:h,metadata:{questionId:m,responseGroupUid:p,surveyId:l}}),v(d.cameraOff),o(O.DELETE,{}),b.removeClass(G),y.addClass(G))}});y.addClass("ul-video-recorder-delete-button"),y.el_.appendChild(xt(ae.DeleteButton,"ul-delete-button"));const w=U.document.getElementById(t),C=()=>{w.classList.contains("vjs-fullscreen")&&d.cameraOff?w.style.display="table":w.style.display="flex"};C();const b=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{d.record().isRecording()||(d.cameraOff=!d.cameraOff,Se({event:"Video Camera Button Clicked",apiBase:r,headers:s,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:m,responseGroupUid:p,surveyId:l,cameraOff:d.cameraOff}}),v(d.cameraOff),!y.hasClass(G)&&y.addClass(G),o(O.DELETE,{}),C())}});b.addClass(Kt),b.el_.appendChild(xt(ae.TurnOffCamera,"ul-camera-button"));const E=new(U.videojs.getComponent("Button"))(d,{clickHandler:()=>{const S=U.document.getElementById("ul-recorder-toggle");if(d.record().isRecording())d.record().stop(),S&&(S.innerHTML=ae.RecordButton),E.removeClass(Zt),y.removeClass(G);else{const H=U.document.getElementById("ul-recording-countdown-screen");if(H)H.remove(),S&&(S.innerHTML=ae.RecordButton),v(d.cameraOff),o(O.DELETE,{}),b.removeClass(G),y.addClass(G),E.removeClass(Zt),T.show();else{E.addClass(Zt),T.hide(),b.addClass(G),y.addClass(G),S&&(S.innerHTML=ae.StopButton);const _=U.document.createElement("div");_.id="ul-recording-countdown-screen",w.insertBefore(_,w.children[1]),_.style.height=`${w.offsetHeight}px`,pi(d,3)}}}});E.addClass("ul-video-recorder-toggle-button"),E.el_.appendChild(xt(ae.RecordButton,"ul-recorder-toggle"));const A=U.document.createElement("p");A.style.visibility="hidden",A.className="ul-upload-progress-label",e.appendChild(A),d.uploadProgressLabel=A;const x=di(d,[y,b,"PlayToggle",E,"FullscreenToggle"]),T=x.children().find(S=>S.name_==="FullscreenToggle");T.hasClass("vjs-disabled")&&T.hide();const P=x.children().find(S=>S.name_==="PlayToggle");P.hide(),i&&b.addClass(G),!i&&y.addClass(G),ui(d,x,i,!1,a),d.on("stopRecord",()=>{E.hide(),P.show(),T.show(),y.removeClass(G)}),d.on("deviceReady",()=>{E.show(),P.hide(),y.addClass(G)}),vl(d,r,o,yr,s),i&&(d.deviceButton&&d.deviceButton.hide(),d.src(i),P.show(),E.hide(),y.removeClass(G));const V=[{name:"microphone"}];!d.cameraOff&&V.push({name:"camera"}),Promise.all(V.map(S=>{var H;return(H=navigator==null?void 0:navigator.permissions)==null?void 0:H.query(S)})).then(S=>{S.reduce((_,B)=>_&B.state==="granted",!0)&&d&&(d.deviceButton&&d.deviceButton.hide(),!i&&d.record().getDevice())}).catch(S=>{})},pi=(e,t=3)=>{const n=U.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{pi(e,t-1)},1e3))},fi=e=>{const t=U.document.createElement("div");return t.className="ul-video-container",t.appendChild(ml(e)),t},fn=(e,t)=>{const n=U.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=U.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const o=U.document.createElement("a");return o.href="https://videojs.com/html5-video-support/",o.target="_blank",o.innerHTML="supports HTML5 video",r.appendChild(o),n.appendChild(r),t.appendChild(n),t},bl=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),U.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),U.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Pt=(e,t)=>U.document.getElementById(e)?t?U.videojs(e,t):U.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),xl=(e,t,n,r=!1,o="https://api.sprig.com",i=document,s=null,a=null)=>{U.document=i;const c=e+si,d=fi(c);return U.document.addEventListener("securitypolicyviolation",l=>{be(new Error(`Voice & Video feature violates ${l.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",o,{})}),ci(ii,()=>{U.document.getElementById(Dn(c)).remove(),fn(c,d);const l={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const m=e+ai;fn(m,d);const p=Pt(c,l),f=Pt(m,{muted:!0,...l});if(!p||!f)return;_l(f,s,a),s||f.addClass(G);const h=di(p,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),g=h.children().find(v=>v.name_==="FullscreenToggle");g.hasClass("vjs-disabled")&&g.hide(),ui(p,h,t,n,r,f)}catch(m){be(new Error(`Error when creating video player object ${m}`),"playerDeviceError",o,{});return}}),d},Cl=(e,t={},n="https://api.userleap.com",r,o,i,s=!1,a=document)=>{U.document=a;const c=e+li,d=fi(c);return U.document.addEventListener("securitypolicyviolation",l=>{be(new Error(`Voice & Video feature violates ${l.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,i,t.visitorId,t.envId)}),ci(ii.concat(hl),()=>{fn(c,d),U.document.getElementById(Dn(c)).remove();try{yl(d,c,t,n,r,o,i,s)}catch(l){be(new Error(`Error when creating video recorder player object ${l}`),"recorderDeviceError",n,i,t.visitorId,t.envId);return}}),d},kl=e=>{const t=e+li;if(!!U.document.getElementById(t)&&!!U.videojs){try{if(!U.videojs(t).record().stream)return}catch{return}U.videojs(t).record().stop(),U.videojs(t).record().stopDevice()}},Sl=e=>{const t=Pt(e+si);t==null||t.pause()},El=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(wr)&&(n=n.replace(wr,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},O={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},ae={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},Xe="ul-card-video__player_recorder",Ll="ul-card-video__skip_button",Il="ul-video-interview-form",br="ul-video-btn",Ul=({className:e,message:t,next:n,properties:r,questionId:o,type:i})=>{const{apiURL:s,envId:a,handleUploadUpdate:c,headers:d,responseGroupUid:l,surveyId:m,viewDocument:p,visitorId:f}=z(_=>({apiURL:_.apiURL,envId:_.envId,handleUploadUpdate:_.handleUploadUpdate,headers:_.headers,responseGroupUid:_.responseGroupUid,surveyId:_.surveyId,viewDocument:_.viewDocument,visitorId:_.userId})),[h,g]=Z(!1),[v,y]=Z(null),[w,C]=Z(null),[b,E]=Z(0),A=d["userleap-platform"],x=r&&r.videoUrl,T=(_,B)=>{_===O.UPLOAD_STARTED?(y(B[O.UPLOAD_ID]),C(B[O.MEDIA_RECORDING_UID]),g(!0)):_===O.DELETE?(y(null),C(null),g(!1)):_===O.UPLOAD_PROGRESS?isNaN(B[O.UPLOAD_PROGRESS_PCT])?c({mediaRecordingUid:B[O.MEDIA_RECORDING_UID],isComplete:!0}):c({mediaRecordingUid:B[O.MEDIA_RECORDING_UID],progressPct:B[O.UPLOAD_PROGRESS_PCT]}):_===O.UPLOAD_FINISHED&&c({mediaRecordingUid:B[O.MEDIA_RECORDING_UID],isComplete:!0})},P=_=>{if(_&&_.children.length===0){const B=xl(Xe,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===O.MEDIA_TYPE_AUDIO,s,p);_.appendChild(B)}},V=_=>{if(_&&_.children.length===0){const B=Cl(Xe,{surveyId:m,responseGroupUid:l,questionId:o,visitorId:f,envId:a},s,T,void 0,{...d,"x-ul-video-recorder-origin":"sdk"},r.mediaType===O.MEDIA_TYPE_AUDIO,p);_.appendChild(B)}},S=_=>{_.preventDefault(),_.stopPropagation(),kl(Xe),v&&w?(c({mediaRecordingUid:w,isSubmitted:!0}),n({value:{mediaRecordingUid:w},questionId:o,type:i})):n({value:null,questionId:o,type:i})},H=()=>u(Re,{defaultBody:()=>u("button",{className:`${br} ul-record-response-btn`,onClick:_=>{_.preventDefault(),_.stopPropagation(),Sl(Xe),E(1)}}),properties:r});return u("div",{className:R(_e(k.CardMainContent,A)),style:{marginTop:"unset"},children:u("form",{className:R([e,k.VideoCard,k.FadeInTransition]),id:Il,children:[u(ye,{message:t,properties:r}),u("div",{id:"ul-card-voice__video",children:[u("div",{children:[u("div",{id:"ul-question-player-container",style:{display:b===0?"":"none"},children:[u("div",{id:Xe,ref:P}),H()]}),u("div",{style:{display:b===1?"block":"none"},children:[u("button",{className:`${br} ul-back-question-btn`,onClick:_=>{_.preventDefault(),_.stopPropagation(),E(0)}}),u("div",{id:"ul-recorder-player-container",ref:V})]})]}),u(ne,{disabled:!h,onClick:S,children:Je(r)}),u("button",{className:`ul-card-text__button ${k.InactiveButton}`,id:Ll,onClick:S,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:Un(r)})]})]})})},Pl=({className:e})=>{const{headers:t,uploadProgress:n}=z(s=>({headers:s.headers,uploadProgress:s.uploadProgress}));let r,o;Object.values(n).filter(s=>s.isSubmitted).length>1?(r="Your responses are processing",o="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",o="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(n).filter(s=>s.isSubmitted).map(s=>s.progressPct)));return u("div",{className:R(_e(k.CardMainContent,t["userleap-platform"])),children:u("div",{className:R([e,"ul-card--uploading",k.FadeInTransition]),children:[u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:k.LoadingSpinnerContainer,role:"progressbar",children:u("div",{className:k.LoadingSpinner,children:[u("div",{className:k.LoadingSpinnerFirst}),u("div",{className:k.LoadingSpinnerSecond}),u("div",{className:k.LoadingSpinnerThird}),u("div",{className:k.LoadingSpinnerFourth})]})}),u(ye,{message:`${r} (${i}% complete)`}),u("p",{className:k.Caption,children:o})]})})},xr=()=>u("svg",{alt:"Powered by Sprig",fill:"none",height:"13",viewBox:"0 0 100 13",width:"100",xmlns:"http://www.w3.org/2000/svg",children:[u("path",{d:"M3.0369 0.839981H0.0249023V8.99998H1.3209V6.53998H2.8569C4.8969 6.53998 6.2409 5.37598 6.2409 3.62398C6.2409 1.95598 4.9689 0.839981 3.0369 0.839981ZM3.0009 5.35198H1.3209V2.02798H3.0009C4.1769 2.02798 4.9689 2.67598 4.9689 3.62398C4.9689 4.65598 4.1769 5.35198 3.0009 5.35198Z",fill:"#5D696F"}),u("path",{d:"M9.90653 3.21598C8.15453 3.21598 6.90653 4.45198 6.90653 6.17998C6.90653 7.90798 8.15453 9.14398 9.90653 9.14398C11.6585 9.14398 12.9065 7.90798 12.9065 6.17998C12.9065 4.45198 11.6585 3.21598 9.90653 3.21598ZM9.90653 8.01598C8.88653 8.01598 8.15453 7.23598 8.15453 6.17998C8.15453 5.11198 8.88653 4.34398 9.90653 4.34398C10.9265 4.34398 11.6585 5.11198 11.6585 6.17998C11.6585 7.23598 10.9265 8.01598 9.90653 8.01598Z",fill:"#5D696F"}),u("path",{d:"M20.9631 3.35998L19.7391 7.11598L18.3951 3.35998H17.3271L15.9831 7.12798L14.7591 3.35998H13.4151L15.4431 8.99998H16.5351L17.8671 5.08798L19.1871 8.99998H20.2791L22.3071 3.35998H20.9631Z",fill:"#5D696F"}),u("path",{d:"M25.7246 3.21598C24.0086 3.21598 22.8206 4.51198 22.8206 6.17998C22.8206 7.85998 24.0206 9.14398 25.7966 9.14398C27.0206 9.14398 28.0166 8.54398 28.3766 7.52398H27.0086C26.7806 7.88398 26.3606 8.05198 25.8086 8.05198C24.7526 8.05198 24.2126 7.40398 24.0926 6.55198H28.5206C28.7606 4.64398 27.5966 3.21598 25.7246 3.21598ZM25.7366 4.27198C26.6126 4.27198 27.2126 4.76398 27.2846 5.68798H24.1166C24.2606 4.89598 24.8006 4.27198 25.7366 4.27198Z",fill:"#5D696F"}),u("path",{d:"M31.1297 4.12798V3.35998H29.8817V8.99998H31.1297V5.44798C31.6337 4.78798 32.3177 4.45198 33.2177 4.41598V3.23998C32.3537 3.23998 31.6457 3.56398 31.1297 4.12798Z",fill:"#5D696F"}),u("path",{d:"M36.8222 3.21598C35.1062 3.21598 33.9182 4.51198 33.9182 6.17998C33.9182 7.85998 35.1182 9.14398 36.8942 9.14398C38.1182 9.14398 39.1142 8.54398 39.4742 7.52398H38.1062C37.8782 7.88398 37.4582 8.05198 36.9062 8.05198C35.8502 8.05198 35.3102 7.40398 35.1902 6.55198H39.6182C39.8582 4.64398 38.6942 3.21598 36.8222 3.21598ZM36.8342 4.27198C37.7102 4.27198 38.3102 4.76398 38.3822 5.68798H35.2142C35.3582 4.89598 35.8982 4.27198 36.8342 4.27198Z",fill:"#5D696F"}),u("path",{d:"M45.4886 0.47998V3.80398C45.0086 3.43198 44.3966 3.21598 43.6766 3.21598C42.0926 3.21598 40.8206 4.53598 40.8206 6.16798C40.8206 7.82398 42.0926 9.14398 43.6766 9.14398C44.3966 9.14398 45.0086 8.92798 45.4886 8.54398V8.99998H46.7246V0.47998H45.4886ZM43.8566 8.01598C42.8246 8.01598 42.0686 7.17598 42.0686 6.16798C42.0686 5.17198 42.8246 4.34398 43.8566 4.34398C44.4806 4.34398 45.0686 4.55998 45.4886 5.15998V7.18798C45.0686 7.79998 44.4806 8.01598 43.8566 8.01598Z",fill:"#5D696F"}),u("path",{d:"M54.6797 3.21598C53.9597 3.21598 53.3477 3.43198 52.8797 3.79198V0.47998H51.6317V8.99998H52.8797V8.55598C53.3477 8.92798 53.9597 9.14398 54.6797 9.14398C56.2637 9.14398 57.5477 7.82398 57.5477 6.16798C57.5477 4.53598 56.2637 3.21598 54.6797 3.21598ZM54.4997 8.01598C53.8757 8.01598 53.2997 7.79998 52.8797 7.21198V5.13598C53.2997 4.54798 53.8757 4.34398 54.4997 4.34398C55.5437 4.34398 56.2997 5.17198 56.2997 6.16798C56.2997 7.17598 55.5437 8.01598 54.4997 8.01598Z",fill:"#5D696F"}),u("path",{d:"M63.3347 3.34798L61.3907 7.76398L59.2667 3.34798H57.9347L60.8147 9.08398L59.6267 11.784H60.9347L64.6547 3.34798H63.3347Z",fill:"#5D696F"}),u("path",{d:"M71.1466 4.34661C69.8092 4.05038 69.131 3.53001 69.131 2.80065C69.131 2.04705 69.8546 1.47822 70.8142 1.47822C71.8034 1.47822 72.5496 2.10339 72.5496 2.9321V2.99813H73.9165V2.9321C73.9165 1.41764 72.5883 0.272705 70.8271 0.272705C69.9784 0.272705 69.2009 0.533191 68.6379 1.0057C68.3584 1.23619 68.1339 1.52487 67.9805 1.8511C67.8271 2.17733 67.7486 2.53303 67.7506 2.89273C67.7451 3.22255 67.8137 3.54949 67.9515 3.84994C68.0894 4.15038 68.293 4.41686 68.5478 4.63012C69.0218 5.04266 69.6945 5.34798 70.5463 5.5388C71.9806 5.85502 72.7078 6.39296 72.7078 7.13686C72.7078 7.94316 71.9156 8.55076 70.8682 8.55076C69.7804 8.55076 68.9599 7.87531 68.9599 6.97996V6.91393H67.5918V6.97996C67.5918 8.56348 68.9942 9.75688 70.8535 9.75688C71.7426 9.75688 72.5588 9.48731 73.1518 8.99662C73.446 8.75831 73.6827 8.4581 73.8445 8.1179C74.0063 7.7777 74.0891 7.40611 74.087 7.03024C74.087 5.6854 73.0991 4.78217 71.1466 4.34661Z",fill:"#5D696F"}),u("path",{d:"M78.7986 2.50806C78.2874 2.50175 77.7823 2.6176 77.3263 2.84576C76.8703 3.07391 76.4768 3.40759 76.1795 3.81837V2.66738H74.8789V12.0752H76.1795V8.48716C76.4768 8.8979 76.8703 9.23152 77.3263 9.45957C77.7824 9.68763 78.2875 9.80335 78.7986 9.79687C80.8167 9.79687 82.3381 8.23031 82.3381 6.15246C82.3381 4.07462 80.8167 2.50806 78.7986 2.50806ZM80.9835 6.42264C80.9316 6.9629 80.6921 7.46879 80.3056 7.8544C79.919 8.24001 79.4093 8.48156 78.863 8.53804C78.1369 8.61074 77.4605 8.40295 76.9583 7.95407C76.4561 7.50518 76.1795 6.86365 76.1795 6.15246C76.1795 4.7846 77.2122 3.75295 78.5815 3.75295C79.2904 3.75295 79.9306 4.02191 80.3776 4.51018C80.8387 5.01116 81.054 5.69025 80.9835 6.42264Z",fill:"#5D696F"}),u("path",{d:"M98.2908 2.6692V3.80747C97.6776 2.97875 96.7302 2.50806 95.6583 2.50806C93.6482 2.50806 92.1323 4.04615 92.1323 6.08582C92.1323 8.1255 93.6482 9.66299 95.6583 9.66299C96.7345 9.66299 97.6819 9.19714 98.2908 8.37691V8.55198C98.2908 9.96891 97.3906 10.8843 95.9974 10.8843C95.0561 10.8843 94.2718 10.4766 93.8996 9.79384L93.8806 9.7587H92.5389L92.5695 9.84654C92.7961 10.514 93.2392 11.0889 93.8303 11.4822C94.4233 11.8723 95.1726 12.0783 95.9974 12.0783C97.0552 12.0783 97.9554 11.7451 98.6017 11.1157C99.2481 10.4862 99.5915 9.6012 99.5915 8.56773V2.6692H98.2908ZM97.5611 7.842C97.0092 8.36418 96.2225 8.58348 95.4001 8.44294C94.9132 8.35796 94.4664 8.12184 94.1245 7.76889C93.7827 7.41593 93.5636 6.96452 93.4992 6.48019C93.3833 5.66541 93.631 4.89364 94.1786 4.36418C94.6383 3.92741 95.2542 3.68788 95.8919 3.69782C96.0464 3.69795 96.2006 3.71031 96.3531 3.73477C97.3459 3.89349 98.1314 4.70403 98.2632 5.71024C98.3749 6.53835 98.1179 7.31436 97.5611 7.842Z",fill:"#5D696F"}),u("path",{d:"M90.705 0.0995975C90.4602 0.046773 90.2043 0.0911971 89.9925 0.223269C89.7806 0.35534 89.6299 0.564452 89.5729 0.805409C89.5159 1.04637 89.5571 1.29982 89.6877 1.51098C89.8183 1.72215 90.0277 1.87407 90.2708 1.93391C90.3415 1.94954 90.4136 1.95747 90.486 1.95754C90.72 1.9579 90.9458 1.87325 91.1206 1.71973C91.2955 1.5662 91.407 1.35452 91.4341 1.125C91.4611 0.89547 91.4017 0.664135 91.2673 0.475046C91.1329 0.285958 90.9327 0.152325 90.705 0.0995975V0.0995975Z",fill:"#5D696F"}),u("path",{d:"M89.8366 8.39143H88.715C87.9178 8.39143 87.4389 7.85531 87.4389 6.95693C87.4389 6.08096 87.8681 5.03659 88.7432 3.76444L88.7548 3.74748V3.38825L85.0271 2.86727C85.0284 2.71553 84.9886 2.56622 84.9118 2.43478C84.8351 2.30335 84.7241 2.19458 84.5905 2.11973C84.2563 1.938 83.8908 1.938 83.5879 2.11368C83.4361 2.2023 83.3122 2.33077 83.23 2.4848C83.1477 2.63884 83.1103 2.8124 83.1219 2.98618C83.1336 3.15996 83.1938 3.32714 83.2958 3.46914C83.3979 3.61114 83.5379 3.72238 83.7001 3.79049L82.5405 9.63753H83.8283L84.8977 4.08551L86.9115 4.42111C86.3701 5.38007 86.0953 6.27421 86.0953 7.07869C86.0953 8.56347 87.0041 9.53576 88.4734 9.62965V9.63753H91.1341V2.69099H89.8366V8.39143Z",fill:"#5D696F"})]}),Tl=()=>{const{border:e,cards:t,headers:n,index:r,marketingUrl:o,showSurveyBrand:i,slugName:s,surveyId:a,viewedCardCount:c}=z(g=>({border:g.border,cards:g.cards,headers:g.headers,index:g.index,marketingUrl:g.marketingUrl,showSurveyBrand:g.showSurveyBrand,slugName:g.slugName,surveyId:g.surveyId,viewedCardCount:g.viewedCardCount})),d=Te(null),l=t.filter(g=>g.type!==I.Uploading&&g.type!==I.Thanks),m=Aa(t,r),p=c+1,f=p/(p+m);oe(()=>{d.current&&(d.current.style.width=`${f*100}%`)},[f]);const h=()=>i?u("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:u(xr,{})}):null;return!l||l.length===1?u("footer",{className:"ul-footer",style:i?{}:{marginBottom:"10px"},children:h()}):u("footer",{className:`ul-footer ${n["userleap-platform"]==="link"?"ul-footer__link":""}`,children:[l.length>1&&u("div",{id:"ul-progress-bar-container",children:u("div",{id:"ul-progress-bar-current",ref:d,style:{border:`1px solid ${e||"#000"}`}})}),i&&u("a",{href:`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${a}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:u(xr,{})})]})},Dl=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:o,destroy:i,endCard:s,eventEmitFn:a,fontFamily:c,headers:d,index:l,next:m,showStripes:p,update:f,useMobileStyling:h,viewDocument:g}=z(_=>({answers:_.answers,border:_.border,cards:_.cards,close:_.close,configureExitOnOverlayClick:_.configureExitOnOverlayClick,destroy:_.destroy,endCard:_.endCard,eventEmitFn:_.eventEmitFn,fontFamily:_.fontFamily,headers:_.headers,index:_.index,next:_.next,showStripes:_.showStripes,update:_.update,useMobileStyling:_.useMobileStyling,viewDocument:_.viewDocument})),v=Te(null),y=Te(!1),{props:w,type:C,name:b}=n[l],E=n.length;oe(()=>{v.current&&(v.current.classList.contains("ul-app--visible")||v.current.classList.add("ul-app--visible"),!y.current&&a&&(y.current=!0,a(j.SurveyAppeared)))},[a]),oe(()=>{f()},[l,f]),oe(()=>{o(()=>r())},[r,o]);const A=()=>r(ze),x=_=>{_.key==="Enter"&&A()},T=async function(_){m({data:_,completeSurvey:()=>{i(ze)},endCard:s}),Ai(g)};if(e){for(const _ of e)if(_.questionId===b){let B;if(C===I.MultipleChoice){const M=w.options.find(({value:se})=>se===_.value);if(!M)break;B={[M.id]:M.value}}else B=_.value;T({value:B,type:C,questionId:_.questionId});break}}const P=()=>[Fe.Email,Fe.Link].includes(d["userleap-platform"])?!1:!s||l+1!==E,V=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},S=()=>{const _={className:"ul-card",next:T,questionId:b,type:C};switch(C){case I.ConsentLegal:return q(qa,{..._,...w,key:b});case I.Likert:return q(Ga,{..._,...w,key:b});case I.MultipleChoice:return q(Ka,{..._,...w,key:b});case I.MultipleSelect:return q(Za,{..._,...w,key:b});case I.NPS:return q(Ya,{..._,key:b,props:w});case I.Open:return q(Qa,{..._,...w,key:b});case I.RecordedTask:return q(ll,{..._,...w,key:b});case I.TextUrlPrompt:return q(ul,{..._,...w,key:b});case I.Thanks:return q(pl,{..._,...w,key:b});case I.Uploading:return q(Pl,{..._,...w,key:b});case I.VideoVoice:return q(Ul,{..._,...w,key:b});default:return null}},H=_=>{var jn;const B=window.sprigAPI,M=_.target;if(!B||!M)return;const se=[M,M.parentElement];for(const mt of se)if(((jn=mt==null?void 0:mt.tagName)==null?void 0:jn.toLowerCase())==="a"){_.preventDefault(),B==null||B.openUrl(mt.href);return}};return u("div",{className:R("ul-app",qe(d)?"ul-app--visible":"ul-app--overlay"),id:ze,onClick:H,ref:v,style:{"--theme":t,...c?{fontFamily:c.replace(";","")}:{}},children:u("div",{className:"ul-app__container",children:[u("div",{className:R(W(k.CardContainer,h)),style:V(),children:[p&&u("div",{className:"ul-header__container",children:u("div",{className:"ul-header",children:"For development purposes only"})}),S(),u(Tl,{})]}),P()&&u("div",{className:R(W(k.CloseContainer,h)),children:u("div",{"aria-label":"Close button",className:k.CloseButton,onClick:A,onKeyPress:x,role:"button",tabIndex:0,children:u("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})})]})})},Rl=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels span:last-child{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:left;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
686
+ `,Al=(e,t)=>{const n=[...e],r=new Set([I.VideoVoice,I.RecordedTask]);return e.some(o=>r.has(o.type))&&n.push({name:-2,props:{routingOptions:[]},type:I.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:I.Thanks}),n},Ol=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function jl(e,t=!0){var b,E,A;const{answers:n,apiURL:r,customStyles:o,endCard:i,eventEmitFn:s,fontFamilyURL:a,frame:c,UpChunk:d,viewDocument:l,viewWindow:m}=e,p=qe(e.headers)?e.frame:l.body,f=F,h=Al(e.cards,!!i);yt.configure(f,{cards:h,hasEndCard:!!i,apiURL:r,UpChunk:d}),z.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:s,fontFamily:e.fontFamily,frame:c,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Ol({mode:e.mode,viewWindow:m,viewDocument:l}),mode:e.mode,previewKey:(b=window.UserLeap)!=null&&b.localStorageAvailable?(E=window.localStorage)==null?void 0:E.getItem(te.Preview):null,recorder:yt,recorderEventEmitter:f,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:g}=z.getState();g();const{head:v}=l,y=l.createElement("style");if(y.id="sprig-style",y.textContent=Rl,y.nonce=e.styleNonce,v.appendChild(y),e.fontFamily&&a&&parent){const x=l.createElement("link");x.rel="stylesheet",x.href=a,v.appendChild(x)}if(e.customStyles&&Lr(l,o,e.styleNonce),!d)if(e.installationMethod!==Ie.Npm){const x=l.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{yt.setUpChunk(m.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},v.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const w="2.23.0",C=s||((A=c.eventEmitter)==null?void 0:A.emit);C==null||C(ie.VerifyViewVersion,{[Ne.ViewVersion]:w}),p&&t&&Ke(u(Dl,{}),p)}const Ml={configure:jl};window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig);window.UserLeap||(window.UserLeap=window.Sprig);window.Sprig||(window.Sprig=window.UserLeap);const Nl="rgba(255,255,255, 0.95)",Vl="rgba(0,0,0,0.9)",Bl="360px",Qt="0px",mi=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},hi=e=>{const t=window.UserLeap.container;if(!!t)try{document.body.removeChild(t),window.UserLeap.container=null,ee("trackStartUrl",null),F.emit(j.SurveyLifeCycle,{state:"dismissed"}),F.emit(j.SurveyClosed,{name:j.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},gi=()=>{F.on(j.SurveyWillClose,({initiator:e})=>{hi(e)})},Fl=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},o=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=o==="light"?Nl:Vl,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},Hl=(e,t,n)=>{var a,c;const r={position:"fixed",bottom:"0px",right:Qt,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},o=Object.assign({},t,window.UserLeap);let i,s=!1;return n?((a=window.UserLeap.windowDimensions)!=null&&a.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(c=window.UserLeap.windowDimensions)!=null&&c.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(o.overlayStyleMobile)&&(s=!0)):(r.width=Bl,r.maxHeight=window.UserLeap.maxHeight||"66vh",o.framePosition===nt.BottomLeft?i={left:Qt}:o.framePosition===nt.TopLeft?i={left:Qt,top:"0px"}:o.framePosition===nt.TopRight?i={top:"0px"}:o.framePosition===nt.Center&&(s=!0,i={margin:"auto",position:"static"},r.maxHeight=null)),s&&Fl(o,n),Object.assign(e.style,r,i),s},$l=(e,t)=>{var a,c;const n="ul-frame";mi();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const o=Hl(r,e,t);F.on(j.SurveyFadingOut,()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}),gi(),r.setHeight=d=>{parseInt(r.style.height)!=d&&(r.style.height=`${d}px`,F.emit(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:d}))},(a=window.UserLeap.container)==null||a.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{F.emit(j.CloseSurveyOnOverlayClick)}),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented});const i=(c=r.contentWindow)==null?void 0:c.document;i&&(i.open("text/html","replace"),i.write("<!doctype html><head></head><body></body></html>"),i.close());const s=i==null?void 0:i.head;return{frameId:n,contentWinDocHead:s,contentWindow:r.contentWindow,hasOverlay:o,iframe:r}},zl="!launch_darkly_";class ql{constructor(){X(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>this._ldData[`${zl}${n}`]=t[n]+1),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const mn=new ql;Object.freeze(mn);const Wl="!optimizely_experiments_";class Gl{constructor(){X(this,"_optimizelyData",{})}setOptimizelyExperiment(t){if(!t||typeof t!="object")return!1;const{experiments:n}=t;try{return Object.keys(this._optimizelyData).map(r=>{delete this._optimizelyData[r]}),n&&n.map(r=>{const{id:o,variation:i}=r,s=this.transformExperimentId(o);i&&typeof i=="string"&&(this._optimizelyData[s]=i)}),!0}catch(r){return r instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",r),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return Wl+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(o=>{var i,s;return(i=n[o].variation)!=null&&i.name?{id:o,variation:(s=n[o].variation)==null?void 0:s.name}:{id:o,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r}),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const Ct=new Gl;Object.freeze(Ct);class Kl{constructor(t,n){X(this,"paused");X(this,"queue");X(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],o=this.ul[r];o instanceof Function?o.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(o){n=function(){o(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const Zl=["popState","pushState","replaceState"],Yl={test:"test"},et="!email",Ql=["ios","android"],Le="environments",hn="pageUrl",Ae="visitors",Cr="ul-view-sdk-script",kr=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function Rn(e,t){const{matchType:n,pattern:r}=e,o=n?kr[n]:kr.legacy;let i=!1;try{i=o(r,t)}catch(s){const a=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;s instanceof Error&&(console.warn(a,s),s.stack=JSON.stringify(e),window.UserLeap.reportError(a,s))}return i}function Jl(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:o}=window.UserLeap._config;if(!o)return!0;const i=[];n&&n.length&&i.push(...n),r&&r.length&&i.push(...r);const s=e&&i.find(a=>a.id===e);return s?Rn(s,window.location.href):t===window.location.href}function ct(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:o}=window.UserLeap._config;if(o&&o!==Fe.Web)return;const i=Oe("trackStartUrl"),s=i?String(i):null;t&&oc(window.location.href),n&&(wi(),Xl()),r&&s&&s!==window.location.href&&e&&Zl.includes(e.type)&&window.UserLeap("dismissActiveSurvey",he.PageChange)}const vi={capture:!0},Xl=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>Rn(r,window.location.href)).map(r=>{const{name:o,properties:i}=r,{selector:s,innerText:a}=i;return s?c=>{if(We(c.target))try{c.target.closest(s)&&window.UserLeap("track",o)}catch{}return!1}:c=>(We(c.target)&&c.target.innerText===a&&window.UserLeap("track",o),!1)}),n=r=>t.forEach(o=>o(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,vi)},wi=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,vi),delete window.UserLeap._config.interactiveEventsHandler};function ec(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,ct,!0))}function tc(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,ct,!0)),window.UserLeap._config.interactiveEvents&&wi()}function me(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(o=>{r.push(o),o===Le?r.push(window.UserLeap.envId):o===Ae&&r.push(An())}),n&&r.push(n),r.join("/")}function nc(e,t){let n=me("1",[Le],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function rc(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Oe(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(te.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function ee(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(te.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(i){i instanceof Error&&(i.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",i)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",i)}let o=r[window.UserLeap.envId];o?o[e]=t:o={[e]:t},r[window.UserLeap.envId]=o;try{localStorage.setItem(te.Credentials,JSON.stringify(r))}catch(i){i instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${i.message}`)}}function _i(){window.previewMode||(window.UserLeap.visitorId=Pe(),ee("vid",window.UserLeap.visitorId),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function An(){return window.previewMode?"0":window.UserLeap.visitorId||""}function oc(e){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const t=window.UserLeap._config.pageUrlEvents;if(t&&t.length){let a=!1;for(let c=0;c<t.length&&(a=Rn(t[c],e),!a);c++);if(!a)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const n=10,r=1;let o=[];const i={viewedAt:Date.now(),location:e},s=localStorage.getItem(te.PageViews);try{if(o=s?JSON.parse(s):[],Array.isArray(o)||(o=[]),o.length>0){const a=o[o.length-1],c=(Date.now()-a.viewedAt)/1e3;(a.location!=e&&c>r||c>n)&&(window.UserLeap._queue.push(["track",hn,null,{url:e}]),o.push(i))}else window.UserLeap._queue.push(["track",hn,null,{url:e}]),o.push(i);o.length>5&&o.splice(0,o.length-5);try{localStorage.setItem(te.PageViews,JSON.stringify(o))}catch(a){a instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${a.message}`)}}catch(a){a instanceof Error&&(a.stack=s||"",window.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ic(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const o=t.apply(this,r),i=new Event("pushState");return window.dispatchEvent(i),ct(i),o})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const o=t.apply(this,r),i=new Event("replaceState");return window.dispatchEvent(i),ct(i),o})(e.replaceState)),ec()}async function Jt(e,t){const n=An();e&&!t&&(window.UserLeap._config.mode=Yl.test);const r=await ke(nc(n,e),{},0,!0);return r.ok?(r.json.delay&&await kt(r.json.delay),yi(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const yi=async(e,t)=>{var _,B;const{context:n,endCard:r,locale:o,productConfig:i,questions:s,responseGroupUid:a,surveyId:c,uuid:d,vid:l,sessionReplay:m}=e,p=ut(window.UserLeap),f=On(p),h=sc(p);if(m&&zr({responseGroupId:a,surveyId:c,visitorId:l,replayParams:m,completeUploadHeaders:p,apiUrl:window.UserLeap._API_URL}),l==null||!s||!s.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const M="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(M),{success:!1,message:M,surveyState:"no survey"}}if(l!==window.UserLeap.visitorId&&d!==window.UserLeap.visitorId&&!window.previewMode){const M="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(M)),{success:!1,message:M,surveyState:"no survey"}}if(!(t?await t(c):!0))return{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"};Xt.disable(),F.emit(j.SurveyWillPresent,{name:j.SurveyWillPresent,[Sr.SurveyId]:c});let v,y=document.createElement("div"),w,C,b;const E=M=>{const{[Ne.ViewVersion]:se}=M;se!==p["x-ul-sdk-version"]&&hi(),F.removeListener(ie.VerifyViewVersion,E)};F.on(ie.VerifyViewVersion,E),qe(p)?(v="ul-direct-embeded-frame",w=document.head,C=window,b=!1,f&&(mi(),y.id=v,window.UserLeap.container.appendChild(y),gi(),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented}))):{frameId:v,contentWinDocHead:w,contentWindow:C,hasOverlay:b,iframe:y}=$l(i,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const A=M=>{F.on(j.CloseSurveyOnOverlayClick,M)},x=Object.assign({frame:y,envId:window.UserLeap.envId,surveyId:c,userId:d,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:s,context:n,locale:o,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:a,headers:p,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:A,eventEmitFn:F.emit.bind(F),ulEvents:vn,viewDocument:C==null?void 0:C.document,viewWindow:C,tabTitle:document.title,startingQuestionIdx:(_=window.UserLeap.config)==null?void 0:_.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce},window.UserLeap._config);(B=window.UserLeap.config)!=null&&B.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),C&&(C.__cfg=x);function T(){const M=document.createElement("script");return window.UserLeap.nonce&&M.setAttribute("nonce",window.UserLeap.nonce),M.id=Cr,M}const P=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,V=document.getElementById(Cr);V&&V.remove();const S=T(),H=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===Ie.Npm?(Ml.configure(x),b&&window.UserLeap.container&&H()):P&&(S.src=P,b&&S.addEventListener("load",()=>{window.UserLeap.container&&H()}),C==null||C.addEventListener("error",M=>{M.target instanceof HTMLScriptElement&&M.target.src===P&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),w==null||w.appendChild(S),{success:!0,surveyState:"ready"}};function sc(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return On(e)||t>10&&t<Li}function On(e){return Ql.includes(e[fe.Platform])}function ac(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function lc(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&ac(t),(t||n||r)&&(ic(),ct())}async function ke(e,t,n=0,r=!1){var i,s;t.headers=Object.assign(ut(window.UserLeap),t.headers);const o=await ge(e,t,n,r);if(o.ok){const a=(i=o.headers)==null?void 0:i.get("Authorization"),c=a?a.split(" "):void 0,d=c&&c.length===2?c[1]:void 0,l=(s=o.headers)==null?void 0:s.get(fe.VisitorID);d&&l&&(l!==window.UserLeap.visitorId||window.UserLeap.token!==d)&&(ee("token",d),ee("vid",l),F.emit(j.VisitorIDUpdated,{visitorId:l}),window.UserLeap.token=d,window.UserLeap.visitorId=l)}return o.json&&o.json.logMessage&&console.warn(`[Sprig] ${o.json.logMessage}`),o}async function cc(e){var t;!((t=e==null?void 0:e.json)!=null&&t.delay)||(window.UserLeap.delayingSurvey=!0,await kt(e.json.delay),window.UserLeap.delayingSurvey=!1)}const dc=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,g,v,y,w;const{userId:o,anonymousId:i,metadata:s={},properties:a,showSurveyCallback:c}=r;let{eventName:d}=r;if(window.UserLeap.debugMode&&d!==hn&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const l=window.UserLeap.localStorageAvailable&&(h=localStorage.getItem(te.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const C="[Sprig] - Skipping tracking without userId";return console.warn(C),{success:!1,message:C,surveyState:"no survey"}}if(!d||d.trim().length===0){d=d?String(d):"";const C="[Sprig] - Invalid event name "+d;return console.warn(C),{success:!1,message:C,surveyState:"no survey"}}const m=window.location.href;if(s.url||(s.url=m),ee("trackStartUrl",m),(v=(g=window.UserLeap)==null?void 0:g._config)!=null&&v.optimizelyEnabled){const C=ut(window.UserLeap);On(C)||Ct.getAndSetWebOptimizelyExperiments(),s.optimizelyExperiments=Object.assign({},Ct.getAllOptimizelyExperiments())}(w=(y=window.UserLeap)==null?void 0:y._config)!=null&&w.launchDarklyEnabled&&(s.launchDarklyFlags=mn.getAllLaunchDarklyVariations()),o&&(window.UserLeap.userId=o),i&&(window.UserLeap.partnerAnonymousId=i),a&&(s.eventProperties=a);const p=window.UserLeap.delayingSurvey?await ke(me("1",[Ae],"events/batch"),{body:JSON.stringify({events:[{event:d,metadata:s}],previewKey:l}),method:"POST"},0,!0):await ke(me("1",[Ae],"events"),{body:JSON.stringify({event:d,metadata:s,previewKey:l}),method:"POST"},0,!0);if(!p.ok){const C="[Sprig] (ERR-421) Failed to track event";return p.reportError&&(console.warn(C,p.error),p.error&&window.UserLeap.reportError("track",p.error)),{success:!1,message:C,error:p.error,surveyState:"no survey"}}o&&ee("uid",o),i&&ee("aid",i);const f=p.json;return f.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(te.Preview),await cc(p),Jl(f.eventId,m)?yi(f,c):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",he.Override),Jt({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",he.Override),Jt({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",he.Override),Jt({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=he.API){F.emit(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:r})},async setAttribute(r,o){if(!r||!o&&o!==0){const i="[Sprig] - Disregarding empty attribute / value provided";return console.warn(i),{success:!1,message:i}}return this.setAttributes({[r]:o})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const d="[Sprig] - Disregarding empty payload provided";return console.warn(d),{success:!1,message:d}}const{userId:o,anonymousId:i,attributes:s}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!o){const d="[Sprig] - Skipping tracking without userId";return console.warn(d),{success:!1,message:d}}if(!s&&(!o||window.UserLeap.userId===o)&&(!i||window.UserLeap.partnerAnonymousId===i))return{success:!0};const a={};o&&(a.userId=window.UserLeap.userId=o),i&&(a.partnerAnonymousId=window.UserLeap.partnerAnonymousId=i);let c;return s?(s.email&&!Object.prototype.hasOwnProperty.call(s,et)&&(s[et]=s.email,delete s.email),c=await ke(me("1",[Le,Ae],"attributes"),{body:JSON.stringify(s),method:"PUT"}),!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await ke(me("1",[Le,Ae]),{body:JSON.stringify(a),method:"PUT"}),s&&s[et]&&(window.UserLeap.email=s[et]),c.ok&&(o&&ee("uid",o),i&&ee("aid",i)),{success:!!c.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const i="[Sprig] - Skipping tracking without userId";return console.warn(i),{success:!1,message:i}}const o=await ke(me("1",[Le,Ae],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!o.ok&&o.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",o.error),o.error&&window.UserLeap.reportError("removeAttributes",o.error)),{success:!!o.ok}},async addSurveyListener(r){F.on(j.SurveyLifeCycle,r)},async removeSurveyListener(r){F.removeListener(j.SurveyLifeCycle,r)},async addListener(r,o){F.on(r,o)},async removeListener(r,o){F.removeListener(r,o)},async removeAllListeners(){F.removeAllListeners()},setVisitorAttribute(r,o){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,o)},async setEmail(r){return n.setAttribute(et,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const s=`[Sprig] - Invalid userId ${r}`;return console.warn(s),{success:!1,message:s}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const o=window.UserLeap.visitorId,i=await ke(me("1",[Le,Ae]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!i.ok){i.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",i.error),i.error&&window.UserLeap.reportError("setUserId",i.error));return}o!==window.UserLeap.visitorId&&$n(),ee("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const o=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(o),{success:!1,message:o}}return window.UserLeap.partnerAnonymousId=r,ee("aid",r),{success:!0}},async track(r,o,i={},s=void 0){return t({eventName:r,properties:o,metadata:i,showSurveyCallback:s})},async identifyAndTrack(r){return await t(r)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const o=window.UserLeap.container.children[0].contentDocument;if(o){const i=o.getElementById(k.CustomStyle);i?i.textContent=r:Lr(o,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,o){var c,d;const i=typeof r=="string"?parseInt(r,10):r,s=typeof o=="string"?parseInt(o,10):o;if(!isNaN(i)&&!isNaN(s)&&(window.UserLeap.windowDimensions={width:i,height:s}),!window.UserLeap.frameId)return;const a=document.getElementById(window.UserLeap.frameId);!a||(window.UserLeap.useMobileStyling&&((c=window.UserLeap.windowDimensions)!=null&&c.width&&(a.style.width=`${window.UserLeap.windowDimensions.width}px`),(d=window.UserLeap.windowDimensions)!=null&&d.height&&(a.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),a.contentDocument&&(a.style.height=String(Ir(a.contentDocument))+"px")),F.emit(j.SurveyDimensions,{name:j.SurveyDimensions,contentFrameWidth:a.clientWidth,contentFrameHeight:a.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(te.Credentials),localStorage.removeItem(te.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),_i(),$n(),window.UserLeap._queue.unpause()},teardown(){tc(),window.UserLeap("dismissActiveSurvey",he.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r){var i,s;if(!((s=(i=window.UserLeap)==null?void 0:i._config)!=null&&s.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const o=JSON.parse(r);Ct.setOptimizelyExperiment(o)},importLaunchDarklyData(r){var o,i;if(!((i=(o=window.UserLeap)==null?void 0:o._config)!=null&&i.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}mn.setLDFlagsVariations(r)}};Object.assign(window.UserLeap,n)};async function uc(e){const t=ut(window.UserLeap);let n=await ge(me("1",[Le],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await ge(me("1",[Le],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),en("Disabled: failed to fetch configuration"),e;const o=n.json;return o!=null&&o.disabled?(en(`Disabled: ${o.disabled}`),{disabled:o.disabled}):Object.assign({},o,e)}async function pc(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,o=An(),i=window.UserLeap.envId,s=window.document.documentElement,a={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:window.location.href,language:window.navigator.language,...n},c={action:e,err:{message:t.message,stack:t.stack},meta:a,vid:o,envId:i};(await ke(me("1",null,"errors"),{method:"POST",headers:{[fe.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function fc(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey"),n=rc();window.UserLeap.localStorageAvailable=n,n&&t&&localStorage.setItem(te.Preview,t),window.UserLeap.UPDATES=vn;async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=pc,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const c in window.UserLeap._config)window.UserLeap[c]=window.UserLeap._config[c];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let c=Oe("sampled");if(c===null&&(c=Math.random()<o,ee("sampled",c)),!c)return}else n&&Oe("sampled")!==null&&ee("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const i=[...window.UserLeap._queue];window.UserLeap._queue=new Kl(window.UserLeap,[]),window.UserLeap._queue.pause();for(let c=0;c<i.length;c++)window.UserLeap._queue.push(i[c]);const s=Oe("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Oe("vid"),window.UserLeap.userId=Oe("uid"),window.UserLeap.partnerAnonymousId=Oe("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(te.Credentials),_i());const a=await uc(e);Is(window.document,a.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,a.replaySettings),dc(a),await lc(a),window.UserLeap._queue.unpause(),F.emit(j.SDKReady),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Tt{constructor(){X(this,"UPDATES",vn)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const gn={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod=Ie.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Tt.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Tt.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,fc(e),window.Sprig}},mc={sprig:gn,SprigAPI:Tt,configure:gn.configure};exports.DismissReason=he;exports.SprigAPI=Tt;exports.SprigEvent=j;exports.default=mc;exports.sprig=gn;