@sprig-technologies/sprig-browser 2.42.0 → 2.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{conversational-ui-DtwfDSqx.cjs → conversational-ui-Bxn2-bHk.cjs} +1 -1
- package/dist/{conversational-ui-AwKR1XUT.js → conversational-ui-D6UnLFmt.js} +4 -4
- package/dist/{core-CP9Lrdyw.cjs → core-C7eAp3i8.cjs} +2 -2
- package/dist/{core-bEj9FkiJ.js → core-D9RfS2Z8.js} +7 -7
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-BGCIZtTj.js → getAttributedUrl-BkFxZZq1.js} +3 -3
- package/dist/{getAttributedUrl-pgeeuX2S.cjs → getAttributedUrl-DndmCZhi.cjs} +1 -1
- package/dist/{index-lO4vq_pY.cjs → index-C3QpXMSG.cjs} +1 -1
- package/dist/{index-C7zv53wV.js → index-CygVREGR.js} +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-DbRyYFfD.js → metricsReporter-DqmmYkn-.js} +1 -1
- package/dist/{metricsReporter-DTdxsqej.cjs → metricsReporter-Dy6jXbOf.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-BlV4gOTD.cjs +1 -0
- package/dist/{view-BqGpnqXK.js → view-q6KAoLll.js} +440 -440
- package/package.json +1 -1
- package/dist/view-CmZqxMJO.cjs +0 -1
package/dist/replay.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var rt=Object.defineProperty;var nt=(e,t,r)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var N=(e,t,r)=>nt(e,typeof t!="symbol"?t+"":t,r);const o=require("./metricsReporter-DTdxsqej.cjs"),at=require("./debounce-DsC7462b.cjs");var L=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(L||{}),k=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(k||{});const Z=(e,t)=>t.some(r=>e instanceof r);let we,he;const ee=new WeakMap,q=new WeakMap,$=new WeakMap;let te={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return ee.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return x(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&(t==="done"||t==="store")||t in e};function Re(e){te=e(te)}function st(e){return(he||(he=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(re(this),t),x(this.request)}:function(...t){return x(e.apply(re(this),t))}}function ot(e){return typeof e=="function"?st(e):(e instanceof IDBTransaction&&function(t){if(ee.has(t))return;const r=new Promise((n,a)=>{const s=()=>{a(t.error||new DOMException("AbortError","AbortError"))};t.oncomplete=()=>{n()},t.onerror=s,t.onabort=s});ee.set(t,r)}(e),Z(e,we||(we=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,te):e)}function x(e){if(e instanceof IDBRequest)return function(r){const n=new Promise((a,s)=>{r.onsuccess=()=>{a(x(r.result))},r.onerror=()=>{s(r.error)}});return $.set(n,r),n}(e);if(q.has(e))return q.get(e);const t=ot(e);return t!==e&&(q.set(e,t),$.set(t,e)),t}const re=e=>$.get(e);function ne(e,{blocked:t}={}){const r=indexedDB.deleteDatabase(e);return t&&(r.onblocked=n=>t(n.oldVersion,n)),x(r).then(()=>{})}const it=["get","getKey","getAll","getAllKeys","count"],dt=["put","add","delete","clear"],z=new Map;function fe(e,t){if(!(e instanceof IDBDatabase)||t in e||typeof t!="string")return;if(z.get(t))return z.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,a=dt.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!it.includes(r))return;const s=async function(i,...l){const d=this.transaction(i,a?"readwrite":"readonly");let c=d.store;return n&&(c=c.index(l.shift())),(await Promise.all([c[r](...l),a&&d.done]))[0]};return z.set(t,s),s}Re(e=>({...e,get:(t,r,n)=>fe(t,r)||e.get(t,r,n),has:(t,r)=>!!fe(t,r)||e.has(t,r)}));const lt=["continue","continuePrimaryKey","advance"],be={},ae=new WeakMap,Ce=new WeakMap,ct={get(e,t){if(!lt.includes(t))return e[t];let r=be[t];return r||(r=be[t]=function(...n){ae.set(this,Ce.get(this)[t](...n))}),r}};async function*ut(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,ct);for(Ce.set(r,t),$.set(r,re(t));t;)yield r,t=await(ae.get(r)||t.continue()),ae.delete(r)}function Ie(e,t){return t===Symbol.asyncIterator&&Z(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Z(e,[IDBIndex,IDBObjectStore])}Re(e=>({...e,get:(t,r,n)=>Ie(t,r)?ut:e.get(t,r,n),has:(t,r)=>Ie(t,r)||e.has(t,r)}));const pt="sprigReplayIframeLoaded",gt="sprigReplayIframeSettings",mt="sprigReplayIframeTakeFullSnapshot",yt="sprigReplayTeardown",pe=[],ke=new class{constructor(e){N(this,"awaitingResolvers",[]);N(this,"activeCount",0);this.capacity=e}async acquire(){if(!(this.activeCount<this.capacity))return new Promise(e=>{this.awaitingResolvers.push(e)});this.activeCount++}release(){const e=this.awaitingResolvers.shift();e&&this.activeCount<=this.capacity?e():this.activeCount--}async execute(e){try{return await this.acquire(),await e()}finally{this.release()}}setLimit(e){this.capacity=e}}(2),Pe=async({apiUrl:e,surveyId:t,uploadId:r,etags:n,headers:a,responseGroupUuid:s,replayDuration:i,eventDigest:l},d=!1)=>{var y;if(!d&&!r&&!n)return void o.breadcrumbsLogger.error("UploadErr",{isMobile:d,uploadId:r,etags:n});o.breadcrumbsLogger.info("MarkUploadComplete",{surveyId:t});const c=await o.sprigFetch(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:n,uploadId:r,responseGroupUuid:s,surveyId:t,replayDuration:i,eventDigest:l,userAgent:(y=window==null?void 0:window.navigator)==null?void 0:y.userAgent}),headers:a,shouldRetryRequest:!0});return o.breadcrumbsLogger.info("MarkUploadDone",{surveyId:t}),c},wt=e=>{if(e instanceof Attr)return null;let t=1;for(let r=e.previousSibling;r;r=r.previousSibling)r.nodeName===e.nodeName&&++t;return t},Ue=e=>{if(e===null)return"";const t=[];if(e instanceof Document)return"/";for(let r=e;r&&!(r instanceof Document)&&r!==null;r=r instanceof Attr?r.ownerElement:r.parentElement){const n=t[t.length]={name:void 0,position:null};switch(r.nodeType){case Node.TEXT_NODE:n.name="text()";break;case Node.ATTRIBUTE_NODE:n.name="@"+r.nodeName;break;case Node.PROCESSING_INSTRUCTION_NODE:n.name="processing-instruction()";break;case Node.COMMENT_NODE:n.name="comment()";break;case Node.ELEMENT_NODE:n.name=r.nodeName}n.position=wt(r)}return"/"+t.reverse().map(r=>r.position!==null?`/${r.name}[${r.position}]`:`/${r.name}`).join("")},ge=e=>e&&e.trim().substring(0,500).replace(/\s\s+/g," ").replace(/\r?\n|\r/g," ").substring(0,250),T={capture:!0,passive:!0},ht=["a","button","input","option","li","link"],ft=["Escape","Enter","Backspace","F5","Tab"];let K=!1,S=null,j=null;const ve=e=>{var r;if(((r=e.tagName)==null?void 0:r.toLowerCase())==="html")return{element:"html"};const t={};return t.element=(n=>{if(!n.tagName)return"No tagName";const a=n.getAttribute("type");return a?`${a} ${n.tagName.toLowerCase()}`:n.tagName.toLowerCase()})(e),t},bt=e=>{var n;if(!e)return{};const t={...ve(e)},r=e.parentElement;if(r&&ht.includes((n=r.tagName)==null?void 0:n.toLowerCase())){const a=ve(r);Object.assign(t,a)}return t},Le=(e,t)=>{var a,s;let r=t.target;var n;t.target===((a=window.document)==null?void 0:a.body)&&window.Sprig.pointerDownTarget&&(r=window.Sprig.pointerDownTarget),n={x:t.x,y:t.y,type:e,elementAttributes:bt(r),windowHeight:window.innerHeight,windowWidth:window.innerWidth,...r instanceof HTMLElement||r instanceof SVGElement||r instanceof MathMLElement?{rect:r==null?void 0:r.getBoundingClientRect(),xPath:Ue(r)}:{}},(s=n==null?void 0:n.elementAttributes)!=null&&s.text&&(n.elementAttributes.text=ge(n.elementAttributes.text)),S==null||S("Sprig_Click",n)},xe=e=>{var t;ft.includes(e.key)&&(t={key:e.key},S==null||S("Sprig_Keystroke",t))},It=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("reload")&&(e={url:window.location.href,currentPageTitle:document.title},S==null||S("Sprig_Refresh",e))},vt=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("back_forward")&&((e={curUrl:window.location.href,fromUrl:document.referrer,currentPageTitle:document.title}).currentPageTitle&&(e.currentPageTitle=ge(e.currentPageTitle)),S==null||S("Sprig_BackForward",e))},Be=at.debounce(e=>{if(!(e.target instanceof HTMLElement||e.target instanceof Document))return;let t=e.target;"scrollTop"in t||(t=t.documentElement),j==null||j({xPath:Ue(t),x:t.scrollLeft,y:t.scrollTop,elementAttributes:{targetScrollWidth:t.scrollWidth,targetClientWidth:t.clientWidth,targetScrollHeight:t.scrollHeight,targetClientHeight:t.clientHeight}})},750),Me=(Se="left_click",e=>Le(Se,e));var Se;const Ae=e=>{e.button===2&&Le("right_click",e)},_e=e=>{window.Sprig&&(window.Sprig.pointerDownTarget=e.target)},g={isRecording:!1,scrollEventUuids:{},stopRecording:()=>{}},He=()=>globalThis.indexedDB&&globalThis.IDBKeyRange&&globalThis.CompressionStream,f=(()=>{const e=o.sessionStorageHelper.getItem("sprig.sessionId");if(e)return o.breadcrumbsLogger.info("SessionIDFound",{savedSessionId:e}),o.sessionStorageHelper.removeItem("sprig.sessionId"),e;const t=o.v4();return o.breadcrumbsLogger.info("GeneratedSessionID",{uuid:t}),t})(),se=()=>{o.sessionStorageHelper.setItem("sprig.disableReplayRecording","disabled")},R=()=>!!o.sessionStorageHelper.getItem("sprig.disableReplayRecording"),V=()=>!!o.sessionStorageHelper.getItem("sprig.isReplayPaused");var Ee;(Ee=globalThis.addEventListener)==null||Ee.call(globalThis,"beforeunload",()=>{o.breadcrumbsLogger.info("BeforeUnload",{sessionId:f}),o.sessionStorageHelper.setItem("sprig.sessionId",f)});const P=(e,t)=>{var r,n;if(!R()&&g.isRecording&&!V())try{(n=(r=globalThis.rrwebRecord)==null?void 0:r.addCustomEvent)==null||n.call(r,e,t)}catch(a){O("Error recording custom event",a)}},St=async e=>{const{x:t,xPath:r,y:n}=e,a=g.scrollEventUuids[r];if(a)return v(async()=>{var l,d,c,y;const s=await u.openDB(),i=await s.get("events",a);if(i!=null&&i.event){const p=JSON.parse(i.event),h=t>((d=(l=p.data)==null?void 0:l.payload)==null?void 0:d.x),m=n>((y=(c=p.data)==null?void 0:c.payload)==null?void 0:y.y);if(!h&&!m)return null;h&&(p.data.payload.x=t),m&&(p.data.payload.y=n),p.data.payload.elementAttributes=e.elementAttributes,i.event=JSON.stringify(p),await s.put("events",i)}else P("Sprig_Scroll",e)},"Error updating scroll event");P("Sprig_Scroll",e)},Ne=()=>{g.stopRecording&&(g.stopRecording(),g.stopRecording=void 0),g.isRecording=!1,["cleanupInterval","inactivityInterval","pendingCheckInterval"].forEach(e=>{g[e]&&(clearInterval(g[e]),g[e]=void 0)}),K&&(window.removeEventListener("click",Me,T),window.removeEventListener("pointerdown",_e,T),window.removeEventListener("mousedown",Ae,T),window.removeEventListener("keydown",xe,T),window.removeEventListener("scroll",Be,T),K=!1),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:yt},{targetOrigin:e.origin})})},Dt=["did not allow mutations","called in an invalid security context"],Et=(e,t,{reportError:r=!0,extraInfo:n={}})=>{if(!R()&&t instanceof Error){if(se(),t.name==="VersionError")return o.breadcrumbsLogger.error("VersionErr",{message:e}),void u.deleteDB();(a=>{if(!a)return!0;for(const s of Dt)if(a.toLowerCase().includes(s))return!1;return!0})(t==null?void 0:t.message)&&(r&&globalThis.UserLeap.reportError(e,t,n),u.clearAll())}},O=(e,t,{reportError:r}={reportError:!0})=>{Ne(),o.breadcrumbsLogger.error("ReplayErr",{code:t.code,name:t.name}),Et(e,t,{reportError:r})},v=async(e,t)=>{try{return await e()}catch(r){O(t,r)}},oe=()=>{g.isRecording&&(v(()=>{var e,t;return(t=(e=globalThis.rrwebRecord)==null?void 0:e.takeFullSnapshot)==null?void 0:t.call(e,!0)},"Error recording full snapshot"),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:mt},{targetOrigin:e.origin})}))};let Q=0;(async()=>He()&&Promise.allSettled([ne("replayStorage"),ne("sprig.replay")]))();const u=new class{constructor(){N(this,"wrapTransactionWithCounter",e=>{var n,a;const t=(a=(n=window.Sprig)==null?void 0:n._config)==null?void 0:a.outstandingTransactionLimit,r=t===void 0?100:t;if(r&&Q>r){const s="Too many outstanding transactions";O(s,new Error(s),{reportError:!1})}Q++,e.done.finally(()=>{Q--})});N(this,"getTransaction",async e=>{const t=(await this.openDB()).transaction(e,"readwrite");return this.wrapTransactionWithCounter(t),t})}openDB(){return function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:s}={}){const i=indexedDB.open(e,t),l=x(i);return n&&(i.onupgradeneeded=d=>{n(x(i.result),d.oldVersion,d.newVersion,x(i.transaction),d)}),r&&(i.onblocked=d=>r(d.oldVersion,d.newVersion,d)),l.then(d=>{s&&(d.onclose=()=>s()),a&&(d.onversionchange=c=>a(c.oldVersion,c.newVersion,c))}).catch(()=>{}),l}("sprigReplay",1,{upgrade:(e,t,r)=>{if(r===0&&o.sessionStorageHelper.setItem("sprig.pendingCount","0"),!e.objectStoreNames.contains("events")){const n=e.createObjectStore("events",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+timestamp]",["sessionId","timestamp"])}if(!e.objectStoreNames.contains("chunkUploads")){const n=e.createObjectStore("chunkUploads",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+status]",["sessionId","status"]),n.createIndex("[uploadId+status]",["uploadId","status"]),n.createIndex("[sessionId+status+uploadId]",["sessionId","status","uploadId"])}if(!e.objectStoreNames.contains("pendingCaptures")){const n=e.createObjectStore("pendingCaptures",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+targetTimestamp]",["sessionId","targetTimestamp"])}}})}async deleteDB(){try{await ne("sprigReplay")}catch{}}async bulkAdd(e,t){const r=await this.getTransaction(e);return Promise.all([...t.map(n=>r.store.add(n)),r.done])}async clearAll(){const e=(await this.openDB()).transaction(["events","chunkUploads","pendingCaptures"],"readwrite");return this.wrapTransactionWithCounter(e),Promise.all([e.objectStore("events").clear(),e.objectStore("chunkUploads").clear(),e.objectStore("pendingCaptures").clear()])}async deleteBySessionId(e,t){const r=IDBKeyRange.only(t),n=await this.getTransaction(e),a=n.store.index("sessionId");for await(const s of a.iterate(r))await s.delete();await n.done}async updatePartial(e,t,r){const n=await this.getTransaction(e),a=await n.store.get(t);a&&await n.store.put({...a,...r}),await n.done}async deleteRowsBefore(e,t,r=()=>!0){const n=IDBKeyRange.upperBound(t,!0),a=await this.getTransaction(e),s=a.store.index("timestamp");for await(const i of s.iterate(n))r(i.value)&&await i.delete();await a.done}async getEventsBetween(e,t=Date.now()){if(e>=t)return Promise.resolve([]);const r=IDBKeyRange.bound([f,e],[f,t],!1,!0);return(await this.openDB()).getAllFromIndex("events","[sessionId+timestamp]",r)}async updateEventsExpiredAt(e,t,r=30){const n=new Date,a=n.setMinutes(n.getMinutes()+(r??30)),s=await this.getTransaction("events"),i=s.store.index("[sessionId+timestamp]"),l=IDBKeyRange.bound([f,e],[f,t],!1,!0);for await(const d of i.iterate(l))await d.update({...d.value,expiredAt:a});await s.done}async deleteChunkUploads(e,t){const r=IDBKeyRange.only([t,e]),n=await this.getTransaction("chunkUploads");let s=await n.store.index("[uploadId+status]").openCursor(r);for(;s;)s.delete(),s=await s.continue();await n.done}async getChunkUploadsByStatus({sessionId:e,status:t,uploadId:r}){const n=(await this.openDB()).transaction("chunkUploads","readonly");this.wrapTransactionWithCounter(n);const a=r?n.store.index("[uploadId+status]"):n.store.index("[sessionId+status]"),s=r?IDBKeyRange.only([r,t]):IDBKeyRange.only([e,t]);return a.getAll(s)}async getPendingCaptures(e={}){return(await(await this.openDB()).getAllFromIndex("pendingCaptures","sessionId",f)).filter(r=>!e.beforePresent||r.targetTimestamp<Date.now()).filter(r=>!e.isBeforeType||r.captureParams.replayParams.replayDurationType==="before").filter(r=>!e.isHeatmap||(r.captureParams.isHeatmap??!1))}async markPendingCaptureToCanUpload(e){const t=await this.getTransaction("pendingCaptures"),r=t.store.index("sessionId");for await(const n of r.iterate(f)){const a=n.value;a.captureParams.responseGroupId===e&&await n.update({...a,canUpload:!0})}await t.done}async markPendingHeatmapsReady(e){if(parseInt(o.sessionStorageHelper.getItem("sprig.pendingCount")??"0")===0)return null;const t=Date.now(),r=await this.getTransaction("pendingCaptures"),n=r.store.index("sessionId");for await(const a of n.iterate(f)){const s=a.value;!s.captureParams.isHeatmap||e&&!e.includes(s.uuid)||await a.update({...s,targetTimestamp:t,captureParams:{...s.captureParams,triggerTimestamp:t,replayParams:{...s.captureParams.replayParams,replayDurationSeconds:Math.floor((t-s.timestamp)/1e3)}}})}await r.done}},U=[];let F,Oe,M=[],_=!1,A=0,W=!1,Fe=!1;const me=[];let J,je,G,We,X=!1;const H=()=>W&&!_&&Date.now()<=J,Tt=({apiUrl:e,config:t,triggerSnapshot:r,forceInit:n=!1})=>{W&&!n||(o.sessionStorageHelper.isStorageAvailable?(M=[],me.splice(0),U.splice(0),A=0,G=r,Oe=e,F={responseGroupUuid:t.responseGroupUuid,surveyId:t.surveyId,userAgent:t.userAgent,sdkVersion:t.sdkVersion},je=t.maxDurationSeconds,Pt(),W||(We=globalThis.setInterval(kt,500)),W=!0):_=!0)},Rt=[k.Drag,k.Input,k.MediaInteraction,k.MouseInteraction,k.MouseMove,k.Scroll,k.Selection,k.TouchMove],Ct=e=>e.type===L.Custom||e.type===L.IncrementalSnapshot&&Rt.includes(e.data.source),ye=e=>e.some(Ct),kt=async()=>{if(!H())return void globalThis.clearInterval(We);if(Ge(),!ye(U))return;const e=U[0].timestamp;Date.now()-e>35e3&&(G==null||G())},Ge=async()=>{if(M.length||X)return;X=!0;const e=await Lt();if(!e)return void(_=!0);me.splice(0,e.length).forEach(t=>t(e.shift())),e.forEach(t=>M.push(t)),X=!1},Pt=()=>{const e=o.sessionStorageHelper.getItem("sprig.alwayson.info");if(e){o.breadcrumbsLogger.info("Read stored session state",e);const t=JSON.parse(e);_=t.disabled,F=t.metadata,M=t.uploadUrls,A=t.currentIndex,J=t.expirationTimestamp,t.pendingEventTimestamp&&(o.breadcrumbsLogger.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`),Ut(t.pendingEventTimestamp))}else J=1e3*je+Date.now()},Ut=async e=>{const t=Date.now(),r=(await u.getEventsBetween(e,t)).map(a=>JSON.parse(a.event));if(!ye(r))return;Je(r);const n=await Ve();n&&await Ke(n,r)},$e=async(e,t)=>{try{const r=await e();if(!r.ok)throw new Error(`Error ${t}`);return r}catch{_=!0}},Ke=async(e,t)=>{if(!H()||!e)return;const r=await(async n=>{const a=new TextEncoder,s=new CompressionStream("gzip"),i=s.writable.getWriter(),l=a.encode(JSON.stringify(n));return i.write(l),i.close(),new Uint8Array(await new Response(s.readable).arrayBuffer())})(t);o.breadcrumbsLogger.info("Uploading always-on events with presigned url"),await $e(()=>o.sprigFetch(e,{body:r,method:"PUT"}),"uploading always-on with presigned url")},Lt=async()=>{if(!H())return;const{surveyId:e,responseGroupUuid:t}=F,r={responseGroupUuid:t,surveyId:e,index:A+1};o.breadcrumbsLogger.info("Fetching always-on upload urls",r);const n=await $e(()=>o.sprigFetch(`${Oe}/sdk/1/replayUrls`,{method:"POST",body:JSON.stringify(r),headers:o.getHttpHeaders(globalThis.UserLeap)}),"fetching always-on signed urls");if(!n)return;const a=n.json.signedUrls;return o.breadcrumbsLogger.info("Fetched more always-on upload urls",{body:r,urls:a}),a},Ve=async()=>{if(M.length)return M.shift();const e=new Promise(t=>{me.push(t)});return Ge(),e},Je=e=>{var a,s,i;const t=e.length?e[e.length-1].timestamp:Date.now(),r=A,n=((s=(a=globalThis.UserLeap)==null?void 0:a.config)==null?void 0:s.customMetadata)??((i=globalThis.__cfg)==null?void 0:i.customMetadata);A++,e.push({timestamp:t,type:L.Custom,data:{tag:"Sprig_Meta",payload:{...F,index:r,visitorId:globalThis.UserLeap.visitorId??"",timestamp:t,customMetadata:n}}})},xt=(e,t)=>{H()&&!Fe&&(e||U.length)&&(e&&U.length&&(async()=>{const r=U.splice(0);if(!ye(r))return;o.breadcrumbsLogger.info("Capturing always-on event array to upload"),Je(r);const n=await Ve();n&&await Ke(n,r)})(),U.push(t))};var Te;(Te=globalThis.addEventListener)==null||Te.call(globalThis,"beforeunload",async()=>{Fe=!0,H()&&(o.breadcrumbsLogger.info("Always On handle page unload"),(()=>{let e;U.length&&(e=U[0].timestamp);const t={disabled:_,metadata:F,uploadUrls:M,currentIndex:A,pendingEventTimestamp:e,expirationTimestamp:J};o.breadcrumbsLogger.info("Storing session state on unload",t),o.sessionStorageHelper.setItem("sprig.alwayson.info",JSON.stringify(t))})())});const qe=async(e,t)=>{const r=performance.now();let n;try{n=await e()}finally{const a=performance.now()-r;let s=o.PerformanceMetrics[t];s||(s=o.registerMetric(t)),s.report(a/1e3)}return n},ze=(e,t)=>{const r=performance.now();try{e()}finally{const n=performance.now()-r;let a=o.PerformanceMetrics[t];a||(a=o.registerMetric(t)),a.report(n/1e3)}};let Qe=5e3,ie=6e4,de=0,B,le=!1,ce=[];const Bt=e=>{var t,r,n,a;if((t=e.event)!=null&&t.includes("Sprig_Scroll")){const s=(a=(n=(r=JSON.parse(e.event))==null?void 0:r.data)==null?void 0:n.payload)==null?void 0:a.xPath;if(!s)return;g.scrollEventUuids[s]=e.uuid}ce.push(e),le||Mt()},Mt=()=>{le=!0,setTimeout(async()=>{if(R()||V())return;const e=ce;ce=[],le=!1,ze(async()=>{await(async t=>{const r=t.map(n=>({...n,sessionId:n.sessionId??f}));if(r.length!==0)return v(()=>u.bulkAdd("events",r),"Error storing replay events")})(e)},"sdk_replay_add_event_batch_seconds")},500)},At=(e,t,r)=>{g.cleanupInterval=window.setInterval(()=>{const n=Date.now();qe(()=>v(async()=>{R()||await Promise.all([u.deleteRowsBefore("events",n-1e3*e,a=>a.expiredAt===void 0||a.expiredAt<n-1e3*e),u.deleteRowsBefore("chunkUploads",n-1e3*t),u.deleteRowsBefore("pendingCaptures",n-1e3*r,a=>!a.canUpload)])},"Error deleting table rows"),"sdk_replay_cleanup_seconds"),o.breadcrumbsLogger.debug("CleanupComplete")},3e4)},_t=()=>{g.pendingCheckInterval=window.setInterval(async()=>{v(async()=>{await ue()},"Error initiating pending captures")},5e3)};let Y=!1;const ue=async(e=!1)=>{if(!Y)try{Y=!0;const t=parseInt(B??"0");if(t===0)return;const r=await u.getPendingCaptures({beforePresent:!0,isBeforeType:e}),n=await u.openDB();await Promise.all(r.map(async a=>(await n.delete("pendingCaptures",a.uuid),Ze(a.captureParams,a.canUpload)))),B=(t-r.length).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B)}finally{Y=!1}},Ht=async(e,t,r,n,a)=>{const s=Math.min(e+a,r),i=await qe(()=>u.getEventsBetween(e,s),"sdk_replay_get_events_between_seconds");if(!(i!=null&&i.length))return o.breadcrumbsLogger.debug("NoEventsFound"),{validStartFound:n,events:[]};if(!n){o.breadcrumbsLogger.debug("ValidStartSearch");let l=-1;return i==null||i.forEach((d,c)=>{if(!d.isValidStart)return;const y=d.timestamp<=t;(l<0||y)&&(l=c)}),l<0?(o.breadcrumbsLogger.debug("ValidStartNotFound"),{validStartFound:n,events:[]}):{validStartFound:!0,events:i==null?void 0:i.slice(l)}}return{validStartFound:n,events:i}},Xe=e=>Promise.all(e.map(async t=>{const r=await(async n=>ke.execute(async()=>{var i;o.breadcrumbsLogger.info("UploadChunkStart",{chunkIndex:n.chunkIndex,surveyId:n.surveyId});const a=await o.sprigFetch(n.uploadUrl,{body:n.data,method:"PUT"});o.breadcrumbsLogger.http("UploadChunkEnd",{url:n.uploadUrl,method:"PUT",status_code:a.status,reason:a.statusText??"OK",chunkIndex:n.chunkIndex,surveyId:n.surveyId});const s=(i=a.headers)==null?void 0:i.get("ETag");if(!s)throw new Error(`Upload response did not include etag for upload ${n.uploadId}, part ${n.chunkIndex}`);return s}))(t);return await u.updatePartial("chunkUploads",t.uuid,{data:null,etag:r,status:"UploadComplete"}),t.uploadId})),Ye=async e=>{const t=await u.getChunkUploadsByStatus({status:"UploadComplete",uploadId:e});if(!(t!=null&&t.length))return void o.breadcrumbsLogger.info("NoChunksForUpload",{uploadId:e});const r=t.reduce((s,i)=>(s.find(l=>l.chunkIndex===i.chunkIndex)||s.push(i),s),[]);r.sort((s,i)=>s.chunkIndex-i.chunkIndex);const n=r.map(s=>({ETag:s.etag,PartNumber:s.chunkIndex})).filter(s=>s.ETag!==null),a=r[0];await Pe({apiUrl:a.apiUrl,surveyId:a.surveyId,uploadId:e,responseGroupUuid:a.responseGroupId,etags:n,headers:a.completeUploadHeaders,replayDuration:a.replayDuration}),await u.deleteChunkUploads("UploadComplete",e)},Nt=()=>{v(async()=>{const e=await u.getChunkUploadsByStatus({sessionId:f,status:"ReadyForUpload"});if(!(e!=null&&e.length))return;const t=await Xe(e);t!=null&&t.length&&await Promise.all(t.map(r=>{if(r)return Ye(r)}))},"Error uploading unfinished chunks")},Ot=async(e,t)=>{const r=t??Date.now();return(async(n,a)=>{const s=new TextEncoder;let i=null;const l=new CompressionStream("gzip"),d=l.writable.getWriter();let c=!1,y=!1,[p,h]=[0,0],m=[];for(let C=n-35e3;C<a;C+=ie){if({validStartFound:y,events:m}=await Ht(C,n,a,y,ie),!(m!=null&&m.length)){o.breadcrumbsLogger.debug("NoEventsFound");continue}p===0&&(p=m[0].timestamp),h=m[m.length-1].timestamp;const w=m.map(E=>E.event);w.push(`{"timestamp":${a}}`);const b=`${c?",":"["}${w}`,I=s.encode(b);ze(()=>{d.write(I)},"sdk_replay_compression_seconds"),c=!0}if(h-p<Qe)return o.breadcrumbsLogger.debug("ReplayTooShort"),null;const D=s.encode("]");return d.write(D),d.close(),i=new Uint8Array(await new Response(l.readable).arrayBuffer()),i})(r-e,r)},De=async e=>{const{surveyId:t,responseGroupId:r,visitorId:n,apiUrl:a,completeUploadHeaders:s,replayParams:i,triggerTimestamp:l}=e,d=await Ot(1e3*i.replayDurationSeconds,l);if(!(d!=null&&d.length))return void o.breadcrumbsLogger.info("FileDataEmpty",{surveyId:t});const c=((p,h,m)=>{const D=p.length,C=1024*h*1024,w=Math.ceil(D/m),b=Math.max(C,w),I=[];let E=0;for(;E<D;)I.push(p.slice(E,E+b)),E+=b;return I})(d,i.minimumChunkSizeMb,i.signedUrls.length),y=await Promise.all(c.map(async(p,h)=>{const m=o.v4(),D={apiUrl:a,chunkIndex:h+1,completeUploadHeaders:s,etag:null,responseGroupId:r,status:"ReadyForUpload",surveyId:t,timestamp:l,totalChunks:c.length,data:p,uploadId:i.uploadId,uploadUrl:i.signedUrls[h].url,uuid:m,visitorId:n};return await(await u.openDB()).add("chunkUploads",{...D,sessionId:D.sessionId??f}),D}));await(async(p,h)=>{await Xe(h),await Promise.all(p.map(m=>Ye(m)))})([i.uploadId],y)},Ze=async(e,t)=>{if(R())return o.breadcrumbsLogger.debug("ReplayDisabled-ScheduleOrCapture");const{isHeatmap:r,isStandalone:n,replayParams:a,triggerTimestamp:s,responseGroupId:i}=e,l=async()=>{setTimeout(()=>o.eventEmitter.removeListener(o.SprigEvent.QuestionAnswered,l),0),v(async()=>{a.replayDurationType==="before"?await De(e):await u.markPendingCaptureToCanUpload(i)},"Error in schedule/capture callback")};v(async()=>{if(a.replayDurationType==="after"||a.replayDurationType==="beforeAndAfter")return!n&&!r&&o.eventEmitter.on(o.SprigEvent.QuestionAnswered,l),void await tt(e);if(n||r||t)await De(e),r&&Ft();else{const d=35+a.replayDurationSeconds,c=s-1e3*d,y=s;await u.updateEventsExpiredAt(c,y,a.expirationTimeLimitMinutes),o.eventEmitter.on(o.SprigEvent.QuestionAnswered,l)}},"Error in scheduling/capturing replay")},Ft=async()=>{parseInt(B??"0")||o.sessionStorageHelper.removeItem("sprig.isCapturingHeatmap"),o.sessionStorageHelper.getItem("sprig.teardownAfterCapture")&&(Ne(),et(),o.sessionStorageHelper.removeItem("sprig.teardownAfterCapture"))},et=async()=>R()?o.breadcrumbsLogger.debug("ReplayDisabled-ClearData"):Promise.all([u.deleteBySessionId("events",f),u.deleteBySessionId("pendingCaptures",f)]).catch(e=>{O("Error clearing user replay data",e)}),tt=async e=>{if(R())return;const{isHeatmap:t,surveyId:r}=e,n=await u.getPendingCaptures(),a=n==null?void 0:n.filter(d=>d.captureParams.surveyId===r);if(a!=null&&a.length)return void o.breadcrumbsLogger.info("PendingCaptureExists",{surveyId:r});t&&(oe(),o.sessionStorageHelper.setItem("sprig.isCapturingHeatmap","true"),de=Date.now(),g.inactivityInterval||(g.inactivityInterval=window.setInterval(()=>{var d;d=de,Date.now()-d>=3e4&&v(()=>u.markPendingHeatmapsReady(),"Error in heatmap inactivity")},1e3)));const s={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType==="beforeAndAfter"&&(s.replayParams.replayDurationSeconds*=2),s.replayParams.replayDurationType="before";const i=e.triggerTimestamp+1e3*e.replayParams.replayDurationSeconds;s.triggerTimestamp=i,B=(parseInt(B??"0")+1).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B),await(await u.openDB()).add("pendingCaptures",{canUpload:!1,captureParams:s,sessionId:f,targetTimestamp:i,timestamp:Date.now(),uuid:o.v4()})},jt=Object.freeze(Object.defineProperty({__proto__:null,RecordEvent:e=>{P("Sprig_TrackEvent",e)},RecordPageView:e=>{e.description&&(e.description=ge(e.description)),P("Sprig_PageView",e)},RecordSurveyShown:e=>{P("Sprig_ShowSurvey",e)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:t,eventDigest:r,headers:n})=>{if(!e||!t)return!1;const a=globalThis.UserLeap._API_URL,s=await Pe({surveyId:e,responseGroupUuid:t,eventDigest:r,apiUrl:a,headers:n},!0);return!(s!=null&&s.error)},checkPendingHeatmapsUrl:()=>R()?o.breadcrumbsLogger.debug("ReplayDisabled-PendingHeatmaps"):v(async()=>{const e=(await u.getPendingCaptures({isHeatmap:!0})).map(t=>({eventId:t.captureParams.eventId,uuid:t.uuid})).filter(({eventId:t})=>!o.checkUrlStillMatching(t)).map(({uuid:t})=>t);return o.breadcrumbsLogger.info("PendingHeatmapsToComplete",{count:e.length}),e.length&&(await u.markPendingHeatmapsReady(e),o.breadcrumbsLogger.info("MarkedPendingHeatmapsReady")),e.length},"Error marking pending heatmaps ready"),clearUserReplayData:et,disableRecording:O,initializeReplay:async({maxReplayDurationSeconds:e,maxInflightRequests:t=2,replaySettings:r,teardownAfter:n=!1,apiUrl:a,alwaysOnConfig:s})=>{if(s&&Tt({apiUrl:a,config:s,triggerSnapshot:()=>{oe()}}),B=o.sessionStorageHelper.getItem("sprig.pendingCount"),g.isRecording)return;if(n&&o.sessionStorageHelper.setItem("sprig.teardownAfterCapture","true"),R())return o.breadcrumbsLogger.debug("ReplayDisabled");if(await(async()=>{var d;if(!He())return!0;if((d=globalThis.navigator.storage)!=null&&d.estimate)try{const{quota:c=0,usage:y=0}=await globalThis.navigator.storage.estimate(),p=(c-y)/1024**3;return o.breadcrumbsLogger.info("Storage",{availableGb:p}),p<.5}catch{return!0}return!1})())return o.breadcrumbsLogger.debug("IDBNotSupported"),se();try{const d=await u.openDB();o.breadcrumbsLogger.info("DBVersion",{version:d.version})}catch(d){return o.breadcrumbsLogger.error("ReplayOpenErr",{name:d.name}),d.name==="VersionError"&&u.deleteDB(),se()}v(async()=>{await ue(!0)},"Error uploading ready pending captures");const i=H()?30:0,l=Math.max(e??0,i);if(!l)return o.breadcrumbsLogger.debug("MissingDuration");o.breadcrumbsLogger.debug("ReplayInit"),await v(async()=>{var d;r!=null&&r.minDuration&&(Qe=r.minDuration),r!=null&&r.batchDuration&&(ie=r.batchDuration),d=t,ke.setLimit(d),Nt(),At(l+35,1800,l+35),_t();const c=window.UserLeap.replayLibraryURL??"https://cdn.sprig.com/dependencies/record.min.js";if(!window.rrwebRecord){const{record:w}=await import(c);window.rrwebRecord=w}const y=window.rrwebRecord;if(!y)return o.breadcrumbsLogger.error("RecordScriptFailed");let p=!0,h=0;const m={checkoutEveryNms:3e4,sampling:{input:"last",scroll:250,media:800},...r,mutationQueueEnabled:r==null?void 0:r.enableMutationQueue};var D,C;g.stopRecording=y({emit:(w,b)=>{if(w.type===L.Custom&&(de=Date.now()),R()||V())return;if(b&&w.type===L.Meta)h=performance.now();else if(b&&h&&w.type===L.FullSnapshot){const E=performance.now()-h;o.reportAndRegister("sdk_replay_snapshot_seconds",E/1e3)}const I=p||!!b&&w.type===L.Meta;p=!1,xt(I,w),Bt({uuid:o.v4(),event:JSON.stringify(w),isValidStart:I,timestamp:Date.now()})},...m}),g.isRecording=!!g.stopRecording,g.isRecording&&(((w,b)=>{window.addEventListener("message",I=>{var E;I.data.type===pt&&(pe.push({source:I.source,origin:I.origin}),(E=I.source)==null||E.postMessage({type:gt,settings:w,replayLibraryUrl:b},{targetOrigin:I.origin}))})})(m,c),o.eventEmitter.on("survey.complete",w=>{var b;b={id:w,userAgent:window.navigator.userAgent},P("Sprig_SubmitSurvey",b)}),D=P,C=St,K||(S=D,j=C,window.addEventListener("click",Me,T),window.addEventListener("pointerdown",_e,T),window.addEventListener("mousedown",Ae,T),window.addEventListener("keydown",xe,T),window.addEventListener("scroll",Be,T),K=!0,It(),vt()))},"Error initializing replay")},isReplayPaused:V,isReplayRecording:()=>g.isRecording,recordFullSnapshot:oe,recordReplayPaused:()=>{P("Sprig_ReplayPaused",{timestamp:Date.now()}),o.sessionStorageHelper.setItem("sprig.isReplayPaused","true")},recordReplayResumed:()=>{o.sessionStorageHelper.removeItem("sprig.isReplayPaused"),P("Sprig_ReplayResumed",{timestamp:Date.now()})},scheduleCapture:tt,scheduleOrCaptureReplay:Ze,tryReplayAction:v,uploadReadyPendingCaptures:ue},Symbol.toStringTag,{value:"Module"}));o.registerReplay(jt);
|
|
1
|
+
"use strict";var rt=Object.defineProperty;var nt=(e,t,r)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var N=(e,t,r)=>nt(e,typeof t!="symbol"?t+"":t,r);const o=require("./metricsReporter-Dy6jXbOf.cjs"),at=require("./debounce-DsC7462b.cjs");var L=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(L||{}),k=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(k||{});const Z=(e,t)=>t.some(r=>e instanceof r);let we,he;const ee=new WeakMap,q=new WeakMap,$=new WeakMap;let te={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return ee.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return x(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&(t==="done"||t==="store")||t in e};function Re(e){te=e(te)}function st(e){return(he||(he=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(re(this),t),x(this.request)}:function(...t){return x(e.apply(re(this),t))}}function ot(e){return typeof e=="function"?st(e):(e instanceof IDBTransaction&&function(t){if(ee.has(t))return;const r=new Promise((n,a)=>{const s=()=>{a(t.error||new DOMException("AbortError","AbortError"))};t.oncomplete=()=>{n()},t.onerror=s,t.onabort=s});ee.set(t,r)}(e),Z(e,we||(we=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,te):e)}function x(e){if(e instanceof IDBRequest)return function(r){const n=new Promise((a,s)=>{r.onsuccess=()=>{a(x(r.result))},r.onerror=()=>{s(r.error)}});return $.set(n,r),n}(e);if(q.has(e))return q.get(e);const t=ot(e);return t!==e&&(q.set(e,t),$.set(t,e)),t}const re=e=>$.get(e);function ne(e,{blocked:t}={}){const r=indexedDB.deleteDatabase(e);return t&&(r.onblocked=n=>t(n.oldVersion,n)),x(r).then(()=>{})}const it=["get","getKey","getAll","getAllKeys","count"],dt=["put","add","delete","clear"],z=new Map;function fe(e,t){if(!(e instanceof IDBDatabase)||t in e||typeof t!="string")return;if(z.get(t))return z.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,a=dt.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!it.includes(r))return;const s=async function(i,...l){const d=this.transaction(i,a?"readwrite":"readonly");let c=d.store;return n&&(c=c.index(l.shift())),(await Promise.all([c[r](...l),a&&d.done]))[0]};return z.set(t,s),s}Re(e=>({...e,get:(t,r,n)=>fe(t,r)||e.get(t,r,n),has:(t,r)=>!!fe(t,r)||e.has(t,r)}));const lt=["continue","continuePrimaryKey","advance"],be={},ae=new WeakMap,Ce=new WeakMap,ct={get(e,t){if(!lt.includes(t))return e[t];let r=be[t];return r||(r=be[t]=function(...n){ae.set(this,Ce.get(this)[t](...n))}),r}};async function*ut(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const r=new Proxy(t,ct);for(Ce.set(r,t),$.set(r,re(t));t;)yield r,t=await(ae.get(r)||t.continue()),ae.delete(r)}function Ie(e,t){return t===Symbol.asyncIterator&&Z(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Z(e,[IDBIndex,IDBObjectStore])}Re(e=>({...e,get:(t,r,n)=>Ie(t,r)?ut:e.get(t,r,n),has:(t,r)=>Ie(t,r)||e.has(t,r)}));const pt="sprigReplayIframeLoaded",gt="sprigReplayIframeSettings",mt="sprigReplayIframeTakeFullSnapshot",yt="sprigReplayTeardown",pe=[],ke=new class{constructor(e){N(this,"awaitingResolvers",[]);N(this,"activeCount",0);this.capacity=e}async acquire(){if(!(this.activeCount<this.capacity))return new Promise(e=>{this.awaitingResolvers.push(e)});this.activeCount++}release(){const e=this.awaitingResolvers.shift();e&&this.activeCount<=this.capacity?e():this.activeCount--}async execute(e){try{return await this.acquire(),await e()}finally{this.release()}}setLimit(e){this.capacity=e}}(2),Pe=async({apiUrl:e,surveyId:t,uploadId:r,etags:n,headers:a,responseGroupUuid:s,replayDuration:i,eventDigest:l},d=!1)=>{var y;if(!d&&!r&&!n)return void o.breadcrumbsLogger.error("UploadErr",{isMobile:d,uploadId:r,etags:n});o.breadcrumbsLogger.info("MarkUploadComplete",{surveyId:t});const c=await o.sprigFetch(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:n,uploadId:r,responseGroupUuid:s,surveyId:t,replayDuration:i,eventDigest:l,userAgent:(y=window==null?void 0:window.navigator)==null?void 0:y.userAgent}),headers:a,shouldRetryRequest:!0});return o.breadcrumbsLogger.info("MarkUploadDone",{surveyId:t}),c},wt=e=>{if(e instanceof Attr)return null;let t=1;for(let r=e.previousSibling;r;r=r.previousSibling)r.nodeName===e.nodeName&&++t;return t},Ue=e=>{if(e===null)return"";const t=[];if(e instanceof Document)return"/";for(let r=e;r&&!(r instanceof Document)&&r!==null;r=r instanceof Attr?r.ownerElement:r.parentElement){const n=t[t.length]={name:void 0,position:null};switch(r.nodeType){case Node.TEXT_NODE:n.name="text()";break;case Node.ATTRIBUTE_NODE:n.name="@"+r.nodeName;break;case Node.PROCESSING_INSTRUCTION_NODE:n.name="processing-instruction()";break;case Node.COMMENT_NODE:n.name="comment()";break;case Node.ELEMENT_NODE:n.name=r.nodeName}n.position=wt(r)}return"/"+t.reverse().map(r=>r.position!==null?`/${r.name}[${r.position}]`:`/${r.name}`).join("")},ge=e=>e&&e.trim().substring(0,500).replace(/\s\s+/g," ").replace(/\r?\n|\r/g," ").substring(0,250),T={capture:!0,passive:!0},ht=["a","button","input","option","li","link"],ft=["Escape","Enter","Backspace","F5","Tab"];let K=!1,S=null,j=null;const ve=e=>{var r;if(((r=e.tagName)==null?void 0:r.toLowerCase())==="html")return{element:"html"};const t={};return t.element=(n=>{if(!n.tagName)return"No tagName";const a=n.getAttribute("type");return a?`${a} ${n.tagName.toLowerCase()}`:n.tagName.toLowerCase()})(e),t},bt=e=>{var n;if(!e)return{};const t={...ve(e)},r=e.parentElement;if(r&&ht.includes((n=r.tagName)==null?void 0:n.toLowerCase())){const a=ve(r);Object.assign(t,a)}return t},Le=(e,t)=>{var a,s;let r=t.target;var n;t.target===((a=window.document)==null?void 0:a.body)&&window.Sprig.pointerDownTarget&&(r=window.Sprig.pointerDownTarget),n={x:t.x,y:t.y,type:e,elementAttributes:bt(r),windowHeight:window.innerHeight,windowWidth:window.innerWidth,...r instanceof HTMLElement||r instanceof SVGElement||r instanceof MathMLElement?{rect:r==null?void 0:r.getBoundingClientRect(),xPath:Ue(r)}:{}},(s=n==null?void 0:n.elementAttributes)!=null&&s.text&&(n.elementAttributes.text=ge(n.elementAttributes.text)),S==null||S("Sprig_Click",n)},xe=e=>{var t;ft.includes(e.key)&&(t={key:e.key},S==null||S("Sprig_Keystroke",t))},It=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("reload")&&(e={url:window.location.href,currentPageTitle:document.title},S==null||S("Sprig_Refresh",e))},vt=()=>{var e;window.performance.getEntriesByType("navigation").map(t=>t.type).includes("back_forward")&&((e={curUrl:window.location.href,fromUrl:document.referrer,currentPageTitle:document.title}).currentPageTitle&&(e.currentPageTitle=ge(e.currentPageTitle)),S==null||S("Sprig_BackForward",e))},Be=at.debounce(e=>{if(!(e.target instanceof HTMLElement||e.target instanceof Document))return;let t=e.target;"scrollTop"in t||(t=t.documentElement),j==null||j({xPath:Ue(t),x:t.scrollLeft,y:t.scrollTop,elementAttributes:{targetScrollWidth:t.scrollWidth,targetClientWidth:t.clientWidth,targetScrollHeight:t.scrollHeight,targetClientHeight:t.clientHeight}})},750),Me=(Se="left_click",e=>Le(Se,e));var Se;const Ae=e=>{e.button===2&&Le("right_click",e)},_e=e=>{window.Sprig&&(window.Sprig.pointerDownTarget=e.target)},g={isRecording:!1,scrollEventUuids:{},stopRecording:()=>{}},He=()=>globalThis.indexedDB&&globalThis.IDBKeyRange&&globalThis.CompressionStream,f=(()=>{const e=o.sessionStorageHelper.getItem("sprig.sessionId");if(e)return o.breadcrumbsLogger.info("SessionIDFound",{savedSessionId:e}),o.sessionStorageHelper.removeItem("sprig.sessionId"),e;const t=o.v4();return o.breadcrumbsLogger.info("GeneratedSessionID",{uuid:t}),t})(),se=()=>{o.sessionStorageHelper.setItem("sprig.disableReplayRecording","disabled")},R=()=>!!o.sessionStorageHelper.getItem("sprig.disableReplayRecording"),V=()=>!!o.sessionStorageHelper.getItem("sprig.isReplayPaused");var Ee;(Ee=globalThis.addEventListener)==null||Ee.call(globalThis,"beforeunload",()=>{o.breadcrumbsLogger.info("BeforeUnload",{sessionId:f}),o.sessionStorageHelper.setItem("sprig.sessionId",f)});const P=(e,t)=>{var r,n;if(!R()&&g.isRecording&&!V())try{(n=(r=globalThis.rrwebRecord)==null?void 0:r.addCustomEvent)==null||n.call(r,e,t)}catch(a){O("Error recording custom event",a)}},St=async e=>{const{x:t,xPath:r,y:n}=e,a=g.scrollEventUuids[r];if(a)return v(async()=>{var l,d,c,y;const s=await u.openDB(),i=await s.get("events",a);if(i!=null&&i.event){const p=JSON.parse(i.event),h=t>((d=(l=p.data)==null?void 0:l.payload)==null?void 0:d.x),m=n>((y=(c=p.data)==null?void 0:c.payload)==null?void 0:y.y);if(!h&&!m)return null;h&&(p.data.payload.x=t),m&&(p.data.payload.y=n),p.data.payload.elementAttributes=e.elementAttributes,i.event=JSON.stringify(p),await s.put("events",i)}else P("Sprig_Scroll",e)},"Error updating scroll event");P("Sprig_Scroll",e)},Ne=()=>{g.stopRecording&&(g.stopRecording(),g.stopRecording=void 0),g.isRecording=!1,["cleanupInterval","inactivityInterval","pendingCheckInterval"].forEach(e=>{g[e]&&(clearInterval(g[e]),g[e]=void 0)}),K&&(window.removeEventListener("click",Me,T),window.removeEventListener("pointerdown",_e,T),window.removeEventListener("mousedown",Ae,T),window.removeEventListener("keydown",xe,T),window.removeEventListener("scroll",Be,T),K=!1),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:yt},{targetOrigin:e.origin})})},Dt=["did not allow mutations","called in an invalid security context"],Et=(e,t,{reportError:r=!0,extraInfo:n={}})=>{if(!R()&&t instanceof Error){if(se(),t.name==="VersionError")return o.breadcrumbsLogger.error("VersionErr",{message:e}),void u.deleteDB();(a=>{if(!a)return!0;for(const s of Dt)if(a.toLowerCase().includes(s))return!1;return!0})(t==null?void 0:t.message)&&(r&&globalThis.UserLeap.reportError(e,t,n),u.clearAll())}},O=(e,t,{reportError:r}={reportError:!0})=>{Ne(),o.breadcrumbsLogger.error("ReplayErr",{code:t.code,name:t.name}),Et(e,t,{reportError:r})},v=async(e,t)=>{try{return await e()}catch(r){O(t,r)}},oe=()=>{g.isRecording&&(v(()=>{var e,t;return(t=(e=globalThis.rrwebRecord)==null?void 0:e.takeFullSnapshot)==null?void 0:t.call(e,!0)},"Error recording full snapshot"),pe.forEach(e=>{var t;(t=e.source)==null||t.postMessage({type:mt},{targetOrigin:e.origin})}))};let Q=0;(async()=>He()&&Promise.allSettled([ne("replayStorage"),ne("sprig.replay")]))();const u=new class{constructor(){N(this,"wrapTransactionWithCounter",e=>{var n,a;const t=(a=(n=window.Sprig)==null?void 0:n._config)==null?void 0:a.outstandingTransactionLimit,r=t===void 0?100:t;if(r&&Q>r){const s="Too many outstanding transactions";O(s,new Error(s),{reportError:!1})}Q++,e.done.finally(()=>{Q--})});N(this,"getTransaction",async e=>{const t=(await this.openDB()).transaction(e,"readwrite");return this.wrapTransactionWithCounter(t),t})}openDB(){return function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:s}={}){const i=indexedDB.open(e,t),l=x(i);return n&&(i.onupgradeneeded=d=>{n(x(i.result),d.oldVersion,d.newVersion,x(i.transaction),d)}),r&&(i.onblocked=d=>r(d.oldVersion,d.newVersion,d)),l.then(d=>{s&&(d.onclose=()=>s()),a&&(d.onversionchange=c=>a(c.oldVersion,c.newVersion,c))}).catch(()=>{}),l}("sprigReplay",1,{upgrade:(e,t,r)=>{if(r===0&&o.sessionStorageHelper.setItem("sprig.pendingCount","0"),!e.objectStoreNames.contains("events")){const n=e.createObjectStore("events",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+timestamp]",["sessionId","timestamp"])}if(!e.objectStoreNames.contains("chunkUploads")){const n=e.createObjectStore("chunkUploads",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+status]",["sessionId","status"]),n.createIndex("[uploadId+status]",["uploadId","status"]),n.createIndex("[sessionId+status+uploadId]",["sessionId","status","uploadId"])}if(!e.objectStoreNames.contains("pendingCaptures")){const n=e.createObjectStore("pendingCaptures",{keyPath:"uuid"});n.createIndex("sessionId","sessionId"),n.createIndex("timestamp","timestamp"),n.createIndex("[sessionId+targetTimestamp]",["sessionId","targetTimestamp"])}}})}async deleteDB(){try{await ne("sprigReplay")}catch{}}async bulkAdd(e,t){const r=await this.getTransaction(e);return Promise.all([...t.map(n=>r.store.add(n)),r.done])}async clearAll(){const e=(await this.openDB()).transaction(["events","chunkUploads","pendingCaptures"],"readwrite");return this.wrapTransactionWithCounter(e),Promise.all([e.objectStore("events").clear(),e.objectStore("chunkUploads").clear(),e.objectStore("pendingCaptures").clear()])}async deleteBySessionId(e,t){const r=IDBKeyRange.only(t),n=await this.getTransaction(e),a=n.store.index("sessionId");for await(const s of a.iterate(r))await s.delete();await n.done}async updatePartial(e,t,r){const n=await this.getTransaction(e),a=await n.store.get(t);a&&await n.store.put({...a,...r}),await n.done}async deleteRowsBefore(e,t,r=()=>!0){const n=IDBKeyRange.upperBound(t,!0),a=await this.getTransaction(e),s=a.store.index("timestamp");for await(const i of s.iterate(n))r(i.value)&&await i.delete();await a.done}async getEventsBetween(e,t=Date.now()){if(e>=t)return Promise.resolve([]);const r=IDBKeyRange.bound([f,e],[f,t],!1,!0);return(await this.openDB()).getAllFromIndex("events","[sessionId+timestamp]",r)}async updateEventsExpiredAt(e,t,r=30){const n=new Date,a=n.setMinutes(n.getMinutes()+(r??30)),s=await this.getTransaction("events"),i=s.store.index("[sessionId+timestamp]"),l=IDBKeyRange.bound([f,e],[f,t],!1,!0);for await(const d of i.iterate(l))await d.update({...d.value,expiredAt:a});await s.done}async deleteChunkUploads(e,t){const r=IDBKeyRange.only([t,e]),n=await this.getTransaction("chunkUploads");let s=await n.store.index("[uploadId+status]").openCursor(r);for(;s;)s.delete(),s=await s.continue();await n.done}async getChunkUploadsByStatus({sessionId:e,status:t,uploadId:r}){const n=(await this.openDB()).transaction("chunkUploads","readonly");this.wrapTransactionWithCounter(n);const a=r?n.store.index("[uploadId+status]"):n.store.index("[sessionId+status]"),s=r?IDBKeyRange.only([r,t]):IDBKeyRange.only([e,t]);return a.getAll(s)}async getPendingCaptures(e={}){return(await(await this.openDB()).getAllFromIndex("pendingCaptures","sessionId",f)).filter(r=>!e.beforePresent||r.targetTimestamp<Date.now()).filter(r=>!e.isBeforeType||r.captureParams.replayParams.replayDurationType==="before").filter(r=>!e.isHeatmap||(r.captureParams.isHeatmap??!1))}async markPendingCaptureToCanUpload(e){const t=await this.getTransaction("pendingCaptures"),r=t.store.index("sessionId");for await(const n of r.iterate(f)){const a=n.value;a.captureParams.responseGroupId===e&&await n.update({...a,canUpload:!0})}await t.done}async markPendingHeatmapsReady(e){if(parseInt(o.sessionStorageHelper.getItem("sprig.pendingCount")??"0")===0)return null;const t=Date.now(),r=await this.getTransaction("pendingCaptures"),n=r.store.index("sessionId");for await(const a of n.iterate(f)){const s=a.value;!s.captureParams.isHeatmap||e&&!e.includes(s.uuid)||await a.update({...s,targetTimestamp:t,captureParams:{...s.captureParams,triggerTimestamp:t,replayParams:{...s.captureParams.replayParams,replayDurationSeconds:Math.floor((t-s.timestamp)/1e3)}}})}await r.done}},U=[];let F,Oe,M=[],_=!1,A=0,W=!1,Fe=!1;const me=[];let J,je,G,We,X=!1;const H=()=>W&&!_&&Date.now()<=J,Tt=({apiUrl:e,config:t,triggerSnapshot:r,forceInit:n=!1})=>{W&&!n||(o.sessionStorageHelper.isStorageAvailable?(M=[],me.splice(0),U.splice(0),A=0,G=r,Oe=e,F={responseGroupUuid:t.responseGroupUuid,surveyId:t.surveyId,userAgent:t.userAgent,sdkVersion:t.sdkVersion},je=t.maxDurationSeconds,Pt(),W||(We=globalThis.setInterval(kt,500)),W=!0):_=!0)},Rt=[k.Drag,k.Input,k.MediaInteraction,k.MouseInteraction,k.MouseMove,k.Scroll,k.Selection,k.TouchMove],Ct=e=>e.type===L.Custom||e.type===L.IncrementalSnapshot&&Rt.includes(e.data.source),ye=e=>e.some(Ct),kt=async()=>{if(!H())return void globalThis.clearInterval(We);if(Ge(),!ye(U))return;const e=U[0].timestamp;Date.now()-e>35e3&&(G==null||G())},Ge=async()=>{if(M.length||X)return;X=!0;const e=await Lt();if(!e)return void(_=!0);me.splice(0,e.length).forEach(t=>t(e.shift())),e.forEach(t=>M.push(t)),X=!1},Pt=()=>{const e=o.sessionStorageHelper.getItem("sprig.alwayson.info");if(e){o.breadcrumbsLogger.info("Read stored session state",e);const t=JSON.parse(e);_=t.disabled,F=t.metadata,M=t.uploadUrls,A=t.currentIndex,J=t.expirationTimestamp,t.pendingEventTimestamp&&(o.breadcrumbsLogger.info(`Uploading with pending timestamp: ${t.pendingEventTimestamp}`),Ut(t.pendingEventTimestamp))}else J=1e3*je+Date.now()},Ut=async e=>{const t=Date.now(),r=(await u.getEventsBetween(e,t)).map(a=>JSON.parse(a.event));if(!ye(r))return;Je(r);const n=await Ve();n&&await Ke(n,r)},$e=async(e,t)=>{try{const r=await e();if(!r.ok)throw new Error(`Error ${t}`);return r}catch{_=!0}},Ke=async(e,t)=>{if(!H()||!e)return;const r=await(async n=>{const a=new TextEncoder,s=new CompressionStream("gzip"),i=s.writable.getWriter(),l=a.encode(JSON.stringify(n));return i.write(l),i.close(),new Uint8Array(await new Response(s.readable).arrayBuffer())})(t);o.breadcrumbsLogger.info("Uploading always-on events with presigned url"),await $e(()=>o.sprigFetch(e,{body:r,method:"PUT"}),"uploading always-on with presigned url")},Lt=async()=>{if(!H())return;const{surveyId:e,responseGroupUuid:t}=F,r={responseGroupUuid:t,surveyId:e,index:A+1};o.breadcrumbsLogger.info("Fetching always-on upload urls",r);const n=await $e(()=>o.sprigFetch(`${Oe}/sdk/1/replayUrls`,{method:"POST",body:JSON.stringify(r),headers:o.getHttpHeaders(globalThis.UserLeap)}),"fetching always-on signed urls");if(!n)return;const a=n.json.signedUrls;return o.breadcrumbsLogger.info("Fetched more always-on upload urls",{body:r,urls:a}),a},Ve=async()=>{if(M.length)return M.shift();const e=new Promise(t=>{me.push(t)});return Ge(),e},Je=e=>{var a,s,i;const t=e.length?e[e.length-1].timestamp:Date.now(),r=A,n=((s=(a=globalThis.UserLeap)==null?void 0:a.config)==null?void 0:s.customMetadata)??((i=globalThis.__cfg)==null?void 0:i.customMetadata);A++,e.push({timestamp:t,type:L.Custom,data:{tag:"Sprig_Meta",payload:{...F,index:r,visitorId:globalThis.UserLeap.visitorId??"",timestamp:t,customMetadata:n}}})},xt=(e,t)=>{H()&&!Fe&&(e||U.length)&&(e&&U.length&&(async()=>{const r=U.splice(0);if(!ye(r))return;o.breadcrumbsLogger.info("Capturing always-on event array to upload"),Je(r);const n=await Ve();n&&await Ke(n,r)})(),U.push(t))};var Te;(Te=globalThis.addEventListener)==null||Te.call(globalThis,"beforeunload",async()=>{Fe=!0,H()&&(o.breadcrumbsLogger.info("Always On handle page unload"),(()=>{let e;U.length&&(e=U[0].timestamp);const t={disabled:_,metadata:F,uploadUrls:M,currentIndex:A,pendingEventTimestamp:e,expirationTimestamp:J};o.breadcrumbsLogger.info("Storing session state on unload",t),o.sessionStorageHelper.setItem("sprig.alwayson.info",JSON.stringify(t))})())});const qe=async(e,t)=>{const r=performance.now();let n;try{n=await e()}finally{const a=performance.now()-r;let s=o.PerformanceMetrics[t];s||(s=o.registerMetric(t)),s.report(a/1e3)}return n},ze=(e,t)=>{const r=performance.now();try{e()}finally{const n=performance.now()-r;let a=o.PerformanceMetrics[t];a||(a=o.registerMetric(t)),a.report(n/1e3)}};let Qe=5e3,ie=6e4,de=0,B,le=!1,ce=[];const Bt=e=>{var t,r,n,a;if((t=e.event)!=null&&t.includes("Sprig_Scroll")){const s=(a=(n=(r=JSON.parse(e.event))==null?void 0:r.data)==null?void 0:n.payload)==null?void 0:a.xPath;if(!s)return;g.scrollEventUuids[s]=e.uuid}ce.push(e),le||Mt()},Mt=()=>{le=!0,setTimeout(async()=>{if(R()||V())return;const e=ce;ce=[],le=!1,ze(async()=>{await(async t=>{const r=t.map(n=>({...n,sessionId:n.sessionId??f}));if(r.length!==0)return v(()=>u.bulkAdd("events",r),"Error storing replay events")})(e)},"sdk_replay_add_event_batch_seconds")},500)},At=(e,t,r)=>{g.cleanupInterval=window.setInterval(()=>{const n=Date.now();qe(()=>v(async()=>{R()||await Promise.all([u.deleteRowsBefore("events",n-1e3*e,a=>a.expiredAt===void 0||a.expiredAt<n-1e3*e),u.deleteRowsBefore("chunkUploads",n-1e3*t),u.deleteRowsBefore("pendingCaptures",n-1e3*r,a=>!a.canUpload)])},"Error deleting table rows"),"sdk_replay_cleanup_seconds"),o.breadcrumbsLogger.debug("CleanupComplete")},3e4)},_t=()=>{g.pendingCheckInterval=window.setInterval(async()=>{v(async()=>{await ue()},"Error initiating pending captures")},5e3)};let Y=!1;const ue=async(e=!1)=>{if(!Y)try{Y=!0;const t=parseInt(B??"0");if(t===0)return;const r=await u.getPendingCaptures({beforePresent:!0,isBeforeType:e}),n=await u.openDB();await Promise.all(r.map(async a=>(await n.delete("pendingCaptures",a.uuid),Ze(a.captureParams,a.canUpload)))),B=(t-r.length).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B)}finally{Y=!1}},Ht=async(e,t,r,n,a)=>{const s=Math.min(e+a,r),i=await qe(()=>u.getEventsBetween(e,s),"sdk_replay_get_events_between_seconds");if(!(i!=null&&i.length))return o.breadcrumbsLogger.debug("NoEventsFound"),{validStartFound:n,events:[]};if(!n){o.breadcrumbsLogger.debug("ValidStartSearch");let l=-1;return i==null||i.forEach((d,c)=>{if(!d.isValidStart)return;const y=d.timestamp<=t;(l<0||y)&&(l=c)}),l<0?(o.breadcrumbsLogger.debug("ValidStartNotFound"),{validStartFound:n,events:[]}):{validStartFound:!0,events:i==null?void 0:i.slice(l)}}return{validStartFound:n,events:i}},Xe=e=>Promise.all(e.map(async t=>{const r=await(async n=>ke.execute(async()=>{var i;o.breadcrumbsLogger.info("UploadChunkStart",{chunkIndex:n.chunkIndex,surveyId:n.surveyId});const a=await o.sprigFetch(n.uploadUrl,{body:n.data,method:"PUT"});o.breadcrumbsLogger.http("UploadChunkEnd",{url:n.uploadUrl,method:"PUT",status_code:a.status,reason:a.statusText??"OK",chunkIndex:n.chunkIndex,surveyId:n.surveyId});const s=(i=a.headers)==null?void 0:i.get("ETag");if(!s)throw new Error(`Upload response did not include etag for upload ${n.uploadId}, part ${n.chunkIndex}`);return s}))(t);return await u.updatePartial("chunkUploads",t.uuid,{data:null,etag:r,status:"UploadComplete"}),t.uploadId})),Ye=async e=>{const t=await u.getChunkUploadsByStatus({status:"UploadComplete",uploadId:e});if(!(t!=null&&t.length))return void o.breadcrumbsLogger.info("NoChunksForUpload",{uploadId:e});const r=t.reduce((s,i)=>(s.find(l=>l.chunkIndex===i.chunkIndex)||s.push(i),s),[]);r.sort((s,i)=>s.chunkIndex-i.chunkIndex);const n=r.map(s=>({ETag:s.etag,PartNumber:s.chunkIndex})).filter(s=>s.ETag!==null),a=r[0];await Pe({apiUrl:a.apiUrl,surveyId:a.surveyId,uploadId:e,responseGroupUuid:a.responseGroupId,etags:n,headers:a.completeUploadHeaders,replayDuration:a.replayDuration}),await u.deleteChunkUploads("UploadComplete",e)},Nt=()=>{v(async()=>{const e=await u.getChunkUploadsByStatus({sessionId:f,status:"ReadyForUpload"});if(!(e!=null&&e.length))return;const t=await Xe(e);t!=null&&t.length&&await Promise.all(t.map(r=>{if(r)return Ye(r)}))},"Error uploading unfinished chunks")},Ot=async(e,t)=>{const r=t??Date.now();return(async(n,a)=>{const s=new TextEncoder;let i=null;const l=new CompressionStream("gzip"),d=l.writable.getWriter();let c=!1,y=!1,[p,h]=[0,0],m=[];for(let C=n-35e3;C<a;C+=ie){if({validStartFound:y,events:m}=await Ht(C,n,a,y,ie),!(m!=null&&m.length)){o.breadcrumbsLogger.debug("NoEventsFound");continue}p===0&&(p=m[0].timestamp),h=m[m.length-1].timestamp;const w=m.map(E=>E.event);w.push(`{"timestamp":${a}}`);const b=`${c?",":"["}${w}`,I=s.encode(b);ze(()=>{d.write(I)},"sdk_replay_compression_seconds"),c=!0}if(h-p<Qe)return o.breadcrumbsLogger.debug("ReplayTooShort"),null;const D=s.encode("]");return d.write(D),d.close(),i=new Uint8Array(await new Response(l.readable).arrayBuffer()),i})(r-e,r)},De=async e=>{const{surveyId:t,responseGroupId:r,visitorId:n,apiUrl:a,completeUploadHeaders:s,replayParams:i,triggerTimestamp:l}=e,d=await Ot(1e3*i.replayDurationSeconds,l);if(!(d!=null&&d.length))return void o.breadcrumbsLogger.info("FileDataEmpty",{surveyId:t});const c=((p,h,m)=>{const D=p.length,C=1024*h*1024,w=Math.ceil(D/m),b=Math.max(C,w),I=[];let E=0;for(;E<D;)I.push(p.slice(E,E+b)),E+=b;return I})(d,i.minimumChunkSizeMb,i.signedUrls.length),y=await Promise.all(c.map(async(p,h)=>{const m=o.v4(),D={apiUrl:a,chunkIndex:h+1,completeUploadHeaders:s,etag:null,responseGroupId:r,status:"ReadyForUpload",surveyId:t,timestamp:l,totalChunks:c.length,data:p,uploadId:i.uploadId,uploadUrl:i.signedUrls[h].url,uuid:m,visitorId:n};return await(await u.openDB()).add("chunkUploads",{...D,sessionId:D.sessionId??f}),D}));await(async(p,h)=>{await Xe(h),await Promise.all(p.map(m=>Ye(m)))})([i.uploadId],y)},Ze=async(e,t)=>{if(R())return o.breadcrumbsLogger.debug("ReplayDisabled-ScheduleOrCapture");const{isHeatmap:r,isStandalone:n,replayParams:a,triggerTimestamp:s,responseGroupId:i}=e,l=async()=>{setTimeout(()=>o.eventEmitter.removeListener(o.SprigEvent.QuestionAnswered,l),0),v(async()=>{a.replayDurationType==="before"?await De(e):await u.markPendingCaptureToCanUpload(i)},"Error in schedule/capture callback")};v(async()=>{if(a.replayDurationType==="after"||a.replayDurationType==="beforeAndAfter")return!n&&!r&&o.eventEmitter.on(o.SprigEvent.QuestionAnswered,l),void await tt(e);if(n||r||t)await De(e),r&&Ft();else{const d=35+a.replayDurationSeconds,c=s-1e3*d,y=s;await u.updateEventsExpiredAt(c,y,a.expirationTimeLimitMinutes),o.eventEmitter.on(o.SprigEvent.QuestionAnswered,l)}},"Error in scheduling/capturing replay")},Ft=async()=>{parseInt(B??"0")||o.sessionStorageHelper.removeItem("sprig.isCapturingHeatmap"),o.sessionStorageHelper.getItem("sprig.teardownAfterCapture")&&(Ne(),et(),o.sessionStorageHelper.removeItem("sprig.teardownAfterCapture"))},et=async()=>R()?o.breadcrumbsLogger.debug("ReplayDisabled-ClearData"):Promise.all([u.deleteBySessionId("events",f),u.deleteBySessionId("pendingCaptures",f)]).catch(e=>{O("Error clearing user replay data",e)}),tt=async e=>{if(R())return;const{isHeatmap:t,surveyId:r}=e,n=await u.getPendingCaptures(),a=n==null?void 0:n.filter(d=>d.captureParams.surveyId===r);if(a!=null&&a.length)return void o.breadcrumbsLogger.info("PendingCaptureExists",{surveyId:r});t&&(oe(),o.sessionStorageHelper.setItem("sprig.isCapturingHeatmap","true"),de=Date.now(),g.inactivityInterval||(g.inactivityInterval=window.setInterval(()=>{var d;d=de,Date.now()-d>=3e4&&v(()=>u.markPendingHeatmapsReady(),"Error in heatmap inactivity")},1e3)));const s={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType==="beforeAndAfter"&&(s.replayParams.replayDurationSeconds*=2),s.replayParams.replayDurationType="before";const i=e.triggerTimestamp+1e3*e.replayParams.replayDurationSeconds;s.triggerTimestamp=i,B=(parseInt(B??"0")+1).toString(),o.sessionStorageHelper.setItem("sprig.pendingCount",B),await(await u.openDB()).add("pendingCaptures",{canUpload:!1,captureParams:s,sessionId:f,targetTimestamp:i,timestamp:Date.now(),uuid:o.v4()})},jt=Object.freeze(Object.defineProperty({__proto__:null,RecordEvent:e=>{P("Sprig_TrackEvent",e)},RecordPageView:e=>{e.description&&(e.description=ge(e.description)),P("Sprig_PageView",e)},RecordSurveyShown:e=>{P("Sprig_ShowSurvey",e)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:t,eventDigest:r,headers:n})=>{if(!e||!t)return!1;const a=globalThis.UserLeap._API_URL,s=await Pe({surveyId:e,responseGroupUuid:t,eventDigest:r,apiUrl:a,headers:n},!0);return!(s!=null&&s.error)},checkPendingHeatmapsUrl:()=>R()?o.breadcrumbsLogger.debug("ReplayDisabled-PendingHeatmaps"):v(async()=>{const e=(await u.getPendingCaptures({isHeatmap:!0})).map(t=>({eventId:t.captureParams.eventId,uuid:t.uuid})).filter(({eventId:t})=>!o.checkUrlStillMatching(t)).map(({uuid:t})=>t);return o.breadcrumbsLogger.info("PendingHeatmapsToComplete",{count:e.length}),e.length&&(await u.markPendingHeatmapsReady(e),o.breadcrumbsLogger.info("MarkedPendingHeatmapsReady")),e.length},"Error marking pending heatmaps ready"),clearUserReplayData:et,disableRecording:O,initializeReplay:async({maxReplayDurationSeconds:e,maxInflightRequests:t=2,replaySettings:r,teardownAfter:n=!1,apiUrl:a,alwaysOnConfig:s})=>{if(s&&Tt({apiUrl:a,config:s,triggerSnapshot:()=>{oe()}}),B=o.sessionStorageHelper.getItem("sprig.pendingCount"),g.isRecording)return;if(n&&o.sessionStorageHelper.setItem("sprig.teardownAfterCapture","true"),R())return o.breadcrumbsLogger.debug("ReplayDisabled");if(await(async()=>{var d;if(!He())return!0;if((d=globalThis.navigator.storage)!=null&&d.estimate)try{const{quota:c=0,usage:y=0}=await globalThis.navigator.storage.estimate(),p=(c-y)/1024**3;return o.breadcrumbsLogger.info("Storage",{availableGb:p}),p<.5}catch{return!0}return!1})())return o.breadcrumbsLogger.debug("IDBNotSupported"),se();try{const d=await u.openDB();o.breadcrumbsLogger.info("DBVersion",{version:d.version})}catch(d){return o.breadcrumbsLogger.error("ReplayOpenErr",{name:d.name}),d.name==="VersionError"&&u.deleteDB(),se()}v(async()=>{await ue(!0)},"Error uploading ready pending captures");const i=H()?30:0,l=Math.max(e??0,i);if(!l)return o.breadcrumbsLogger.debug("MissingDuration");o.breadcrumbsLogger.debug("ReplayInit"),await v(async()=>{var d;r!=null&&r.minDuration&&(Qe=r.minDuration),r!=null&&r.batchDuration&&(ie=r.batchDuration),d=t,ke.setLimit(d),Nt(),At(l+35,1800,l+35),_t();const c=window.UserLeap.replayLibraryURL??"https://cdn.sprig.com/dependencies/record.min.js";if(!window.rrwebRecord){const{record:w}=await import(c);window.rrwebRecord=w}const y=window.rrwebRecord;if(!y)return o.breadcrumbsLogger.error("RecordScriptFailed");let p=!0,h=0;const m={checkoutEveryNms:3e4,sampling:{input:"last",scroll:250,media:800},...r,mutationQueueEnabled:r==null?void 0:r.enableMutationQueue};var D,C;g.stopRecording=y({emit:(w,b)=>{if(w.type===L.Custom&&(de=Date.now()),R()||V())return;if(b&&w.type===L.Meta)h=performance.now();else if(b&&h&&w.type===L.FullSnapshot){const E=performance.now()-h;o.reportAndRegister("sdk_replay_snapshot_seconds",E/1e3)}const I=p||!!b&&w.type===L.Meta;p=!1,xt(I,w),Bt({uuid:o.v4(),event:JSON.stringify(w),isValidStart:I,timestamp:Date.now()})},...m}),g.isRecording=!!g.stopRecording,g.isRecording&&(((w,b)=>{window.addEventListener("message",I=>{var E;I.data.type===pt&&(pe.push({source:I.source,origin:I.origin}),(E=I.source)==null||E.postMessage({type:gt,settings:w,replayLibraryUrl:b},{targetOrigin:I.origin}))})})(m,c),o.eventEmitter.on("survey.complete",w=>{var b;b={id:w,userAgent:window.navigator.userAgent},P("Sprig_SubmitSurvey",b)}),D=P,C=St,K||(S=D,j=C,window.addEventListener("click",Me,T),window.addEventListener("pointerdown",_e,T),window.addEventListener("mousedown",Ae,T),window.addEventListener("keydown",xe,T),window.addEventListener("scroll",Be,T),K=!0,It(),vt()))},"Error initializing replay")},isReplayPaused:V,isReplayRecording:()=>g.isRecording,recordFullSnapshot:oe,recordReplayPaused:()=>{P("Sprig_ReplayPaused",{timestamp:Date.now()}),o.sessionStorageHelper.setItem("sprig.isReplayPaused","true")},recordReplayResumed:()=>{o.sessionStorageHelper.removeItem("sprig.isReplayPaused"),P("Sprig_ReplayResumed",{timestamp:Date.now()})},scheduleCapture:tt,scheduleOrCaptureReplay:Ze,tryReplayAction:v,uploadReadyPendingCaptures:ue},Symbol.toStringTag,{value:"Module"}));o.registerReplay(jt);
|
package/dist/replay.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var lt = Object.defineProperty;
|
|
2
2
|
var ct = (e, t, a) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
3
|
var F = (e, t, a) => ct(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
-
import { b as d, s as Q, a as m, v as X, c as ut, g as pt, P as xe, r as Be, d as gt, e as V, S as Y, f as mt } from "./metricsReporter-
|
|
4
|
+
import { b as d, s as Q, a as m, v as X, c as ut, g as pt, P as xe, r as Be, d as gt, e as V, S as Y, f as mt } from "./metricsReporter-DqmmYkn-.js";
|
|
5
5
|
import { d as yt } from "./debounce-CMb8f7wh.js";
|
|
6
6
|
var B = ((e) => (e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot", e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom", e[e.Plugin = 6] = "Plugin", e))(B || {}), k = ((e) => (e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction", e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input", e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction", e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation", e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration", e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e[e.CustomElement = 16] = "CustomElement", e))(k || {});
|
|
7
7
|
const re = (e, t) => t.some((a) => e instanceof a);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const V=require("./core-C7eAp3i8.cjs"),j=require("./metricsReporter-Dy6jXbOf.cjs");var pe,x,Zt,J,at,Gt,Me,Kt,ue={},Jt=[],Jr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ae=Array.isArray;function $(e,t){for(var r in t)e[r]=t[r];return e}function Yt(e){var t=e.parentNode;t&&t.removeChild(e)}function H(e,t,r){var n,o,i,a={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?pe.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return le(e,a,n,o,null)}function le(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++Zt,__i:-1,__u:0};return o==null&&x.vnode!=null&&x.vnode(i),i}function Xt(){return{current:null}}function D(e){return e.children}function F(e,t){this.props=e,this.context=t}function re(e,t){if(t==null)return e.__?re(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?re(e):null}function er(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return er(e)}}function De(e){(!e.__d&&(e.__d=!0)&&J.push(e)&&!we.__r++||at!==x.debounceRendering)&&((at=x.debounceRendering)||Gt)(we)}function we(){var e,t,r,n,o,i,a,s,l;for(J.sort(Me);e=J.shift();)e.__d&&(t=J.length,n=void 0,i=(o=(r=e).__v).__e,s=[],l=[],(a=r.__P)&&((n=$({},o)).__v=o.__v+1,x.vnode&&x.vnode(n),Qe(a,n,o,r.__n,a.ownerSVGElement!==void 0,32&o.__u?[i]:null,s,i??re(o),!!(32&o.__u),l),n.__.__k[n.__i]=n,nr(s,n,l),n.__e!=i&&er(n)),J.length>t&&J.sort(Me));we.__r=0}function tr(e,t,r,n,o,i,a,s,l,c,d){var u,h,m,_,w,v=n&&n.__k||Jt,S=t.length;for(r.__d=l,function(b,A,L){var p,f,g,R,y,E=A.length,N=L.length,I=N,O=0;for(b.__k=[],p=0;p<E;p++)(f=b.__k[p]=(f=A[p])==null||typeof f=="boolean"||typeof f=="function"?null:typeof f=="string"||typeof f=="number"||typeof f=="bigint"||f.constructor==String?le(null,f,null,null,f):Ae(f)?le(D,{children:f},null,null,null):f.constructor===void 0&&f.__b>0?le(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)!=null?(f.__=b,f.__b=b.__b+1,y=Yr(f,L,R=p+O,I),f.__i=y,g=null,y!==-1&&(I--,(g=L[y])&&(g.__u|=131072)),g==null||g.__v===null?(y==-1&&O--,typeof f.type!="function"&&(f.__u|=65536)):y!==R&&(y===R+1?O++:y>R?I>E-R?O+=y-R:O--:O=y<R&&y==R-1?y-R:0,y!==p+O&&(f.__u|=65536))):(g=L[p])&&g.key==null&&g.__e&&(g.__e==b.__d&&(b.__d=re(g)),Fe(g,g,!1),L[p]=null,I--);if(I)for(p=0;p<N;p++)(g=L[p])!=null&&!(131072&g.__u)&&(g.__e==b.__d&&(b.__d=re(g)),Fe(g,g))}(r,t,v),l=r.__d,u=0;u<S;u++)(m=r.__k[u])!=null&&typeof m!="boolean"&&typeof m!="function"&&(h=m.__i===-1?ue:v[m.__i]||ue,m.__i=u,Qe(e,m,h,o,i,a,s,l,c,d),_=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&Ze(h.ref,null,m),d.push(m.ref,m.__c||_,m)),w==null&&_!=null&&(w=_),65536&m.__u||h.__k===m.__k?l=rr(m,l,e):typeof m.type=="function"&&m.__d!==void 0?l=m.__d:_&&(l=_.nextSibling),m.__d=void 0,m.__u&=-196609);r.__d=l,r.__e=w}function rr(e,t,r){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=rr(n[o],t,r));return t}return e.__e!=t&&(r.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function W(e,t){return t=t||[],e==null||typeof e=="boolean"||(Ae(e)?e.some(function(r){W(r,t)}):t.push(e)),t}function Yr(e,t,r,n){var o=e.key,i=e.type,a=r-1,s=r+1,l=t[r];if(l===null||l&&o==l.key&&i===l.type)return r;if(n>(l==null||131072&l.__u?0:1))for(;a>=0||s<t.length;){if(a>=0){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&i===l.type)return a;a--}if(s<t.length){if((l=t[s])&&!(131072&l.__u)&&o==l.key&&i===l.type)return s;s++}}return-1}function st(e,t,r){t[0]==="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||Jr.test(t)?r:r+"px"}function ge(e,t,r,n,o){var i;e:if(t==="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||st(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||st(e.style,t,r[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.u=n.u:(r.u=Date.now(),e.addEventListener(t,i?ut:lt,i)):e.removeEventListener(t,i?ut:lt,i);else{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!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,r))}}function lt(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(x.event?x.event(e):e)}function ut(e){return this.l[e.type+!0](x.event?x.event(e):e)}function Qe(e,t,r,n,o,i,a,s,l,c){var d,u,h,m,_,w,v,S,b,A,L,p,f,g,R,y=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[s=t.__e=r.__e]),(d=x.__b)&&d(t);e:if(typeof y=="function")try{if(S=t.props,b=(d=y.contextType)&&n[d.__c],A=d?b?b.props.value:d.__:n,r.__c?v=(u=t.__c=r.__c).__=u.__E:("prototype"in y&&y.prototype.render?t.__c=u=new y(S,A):(t.__c=u=new F(S,A),u.constructor=y,u.render=en),b&&b.sub(u),u.props=S,u.state||(u.state={}),u.context=A,u.__n=n,h=u.__d=!0,u.__h=[],u._sb=[]),u.__s==null&&(u.__s=u.state),y.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=$({},u.__s)),$(u.__s,y.getDerivedStateFromProps(S,u.__s))),m=u.props,_=u.state,u.__v=t,h)y.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(y.getDerivedStateFromProps==null&&S!==m&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(S,A),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(S,u.__s,A)===!1||t.__v===r.__v)){for(t.__v!==r.__v&&(u.props=S,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(E){E&&(E.__=t)}),L=0;L<u._sb.length;L++)u.__h.push(u._sb[L]);u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(S,u.__s,A),u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(m,_,w)})}if(u.context=A,u.props=S,u.__P=e,u.__e=!1,p=x.__r,f=0,"prototype"in y&&y.prototype.render){for(u.state=u.__s,u.__d=!1,p&&p(t),d=u.render(u.props,u.state,u.context),g=0;g<u._sb.length;g++)u.__h.push(u._sb[g]);u._sb=[]}else do u.__d=!1,p&&p(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++f<25);u.state=u.__s,u.getChildContext!=null&&(n=$($({},n),u.getChildContext())),h||u.getSnapshotBeforeUpdate==null||(w=u.getSnapshotBeforeUpdate(m,_)),tr(e,Ae(R=d!=null&&d.type===D&&d.key==null?d.props.children:d)?R:[R],t,r,n,o,i,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),v&&(u.__E=u.__=null)}catch(E){t.__v=null,l||i!=null?(t.__e=s,t.__u|=l?160:32,i[i.indexOf(s)]=null):(t.__e=r.__e,t.__k=r.__k),x.__e(E,t,r)}else i==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=Xr(r.__e,t,r,n,o,i,a,l,c);(d=x.diffed)&&d(t)}function nr(e,t,r){t.__d=void 0;for(var n=0;n<r.length;n++)Ze(r[n],r[++n],r[++n]);x.__c&&x.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){x.__e(i,o.__v)}})}function Xr(e,t,r,n,o,i,a,s,l){var c,d,u,h,m,_,w,v=r.props,S=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!b&&(b?m.localName===b:m.nodeType===3)){e=m,i[c]=null;break}}if(e==null){if(b===null)return document.createTextNode(S);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,S.is&&S),i=null,s=!1}if(b===null)v===S||s&&e.data===S||(e.data=S);else{if(i=i&&pe.call(e.childNodes),v=r.props||ue,!s&&i!=null)for(v={},c=0;c<e.attributes.length;c++)v[(m=e.attributes[c]).name]=m.value;for(c in v)m=v[c],c=="children"||(c=="dangerouslySetInnerHTML"?u=m:c==="key"||c in S||ge(e,c,null,m,o));for(c in S)m=S[c],c=="children"?h=m:c=="dangerouslySetInnerHTML"?d=m:c=="value"?_=m:c=="checked"?w=m:c==="key"||s&&typeof m!="function"||v[c]===m||ge(e,c,m,v[c],o);if(d)s||u&&(d.__html===u.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),tr(e,Ae(h)?h:[h],t,r,n,o&&b!=="foreignObject",i,a,i?i[0]:r.__k&&re(r,0),s,l),i!=null)for(c=i.length;c--;)i[c]!=null&&Yt(i[c]);s||(c="value",_!==void 0&&(_!==e[c]||b==="progress"&&!_||b==="option"&&_!==v[c])&&ge(e,c,_,v[c],!1),c="checked",w!==void 0&&w!==e[c]&&ge(e,c,w,v[c],!1))}return e}function Ze(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(n){x.__e(n,r)}}function Fe(e,t,r){var n,o;if(x.unmount&&x.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Ze(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){x.__e(i,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&Fe(n[o],t,r||typeof e.type!="function");r||e.__e==null||Yt(e.__e),e.__=e.__e=e.__d=void 0}function en(e,t,r){return this.constructor(e,r)}function ne(e,t,r){var n,o,i,a;x.__&&x.__(e,t),o=(n=typeof r=="function")?null:r&&r.__k||t.__k,i=[],a=[],Qe(t,e=(!n&&r||t).__k=H(D,null,[e]),o||ue,ue,t.ownerSVGElement!==void 0,!n&&r?[r]:o?null:t.firstChild?pe.call(t.childNodes):null,i,!n&&r?r:o?o.__e:t.firstChild,n,a),nr(i,e,a)}function or(e,t){ne(e,t,or)}function tn(e,t,r){var n,o,i,a,s=$({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i]===void 0&&a!==void 0?a[i]:t[i];return arguments.length>2&&(s.children=arguments.length>3?pe.call(arguments,2):r),le(e.type,s,n||e.key,o||e.ref,null)}function Ge(e,t){var r={__c:t="__cC"+Kt++,__:e,Consumer:function(n,o){return n.children(o)},Provider:function(n){var o,i;return this.getChildContext||(o=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&o.some(function(s){s.__e=!0,De(s)})},this.sub=function(a){o.push(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){o.splice(o.indexOf(a),1),s&&s.call(a)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}pe=Jt.slice,x={__e:function(e,t,r,n){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},Zt=0,F.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},r),this.props)),e&&$(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),De(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),De(this))},F.prototype.render=D,J=[],Gt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Me=function(e,t){return e.__v.__b-t.__v.__b},we.__r=0,Kt=0;var rn=0;function k(e,t,r,n,o,i){var a,s,l={};for(s in t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--rn,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return x.vnode&&x.vnode(c),c}var Z,U,Le,ct,oe=0,ir=[],be=[],dt=x.__b,pt=x.__r,ft=x.diffed,_t=x.__c,mt=x.unmount;function Y(e,t){x.__h&&x.__h(U,e,oe||t),oe=0;var r=U.__H||(U.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:be}),r.__[e]}function G(e){return oe=1,Ke(lr,e)}function Ke(e,t,r){var n=Y(Z++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):lr(void 0,t),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=U,!U.u)){var o=function(s,l,c){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(h){return h.__c});if(d.every(function(h){return!h.__N}))return!i||i.call(this,s,l,c);var u=!1;return d.forEach(function(h){if(h.__N){var m=h.__[0];h.__=h.__N,h.__N=void 0,m!==h.__[0]&&(u=!0)}}),!(!u&&n.__c.props===s)&&(!i||i.call(this,s,l,c))};U.u=!0;var i=U.shouldComponentUpdate,a=U.componentWillUpdate;U.componentWillUpdate=function(s,l,c){if(this.__e){var d=i;i=void 0,o(s,l,c),i=d}a&&a.call(this,s,l,c)},U.shouldComponentUpdate=o}return n.__N||n.__}function q(e,t){var r=Y(Z++,3);!x.__s&&Xe(r.__H,t)&&(r.__=e,r.i=t,U.__H.__h.push(r))}function ie(e,t){var r=Y(Z++,4);!x.__s&&Xe(r.__H,t)&&(r.__=e,r.i=t,U.__h.push(r))}function Q(e){return oe=5,K(function(){return{current:e}},[])}function ar(e,t,r){oe=6,ie(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function K(e,t){var r=Y(Z++,7);return Xe(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function ce(e,t){return oe=8,K(function(){return e},t)}function Je(e){var t=U.context[e.__c],r=Y(Z++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(U)),t.props.value):e.__}function Ye(e,t){x.useDebugValue&&x.useDebugValue(t?t(e):e)}function sr(){var e=Y(Z++,11);if(!e.__){for(var t=U.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function nn(){for(var e;e=ir.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ve),e.__H.__h.forEach(ze),e.__H.__h=[]}catch(t){e.__H.__h=[],x.__e(t,e.__v)}}x.__b=function(e){U=null,dt&&dt(e)},x.__r=function(e){pt&&pt(e),Z=0;var t=(U=e.__c).__H;t&&(Le===U?(t.__h=[],U.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=be,r.__N=r.i=void 0})):(t.__h.forEach(ve),t.__h.forEach(ze),t.__h=[],Z=0)),Le=U},x.diffed=function(e){ft&&ft(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ir.push(t)!==1&&ct===x.requestAnimationFrame||((ct=x.requestAnimationFrame)||on)(nn)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==be&&(r.__=r.__V),r.i=void 0,r.__V=be})),Le=U=null},x.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ve),r.__h=r.__h.filter(function(n){return!n.__||ze(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],x.__e(n,r.__v)}}),_t&&_t(e,t)},x.unmount=function(e){mt&&mt(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ve(n)}catch(o){t=o}}),r.__H=void 0,t&&x.__e(t,r.__v))};var ht=typeof requestAnimationFrame=="function";function on(e){var t,r=function(){clearTimeout(n),ht&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);ht&&(t=requestAnimationFrame(r))}function ve(e){var t=U,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),U=t}function ze(e){var t=U;e.__c=e.__(),U=t}function Xe(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function lr(e,t){return typeof t=="function"?t(e):t}function ur(e,t){for(var r in t)e[r]=t[r];return e}function Be(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Ce(e){this.props=e}function cr(e,t){function r(o){var i=this.props.ref,a=i==o.ref;return!a&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!a:Be(this.props,o)}function n(o){return this.shouldComponentUpdate=r,H(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}(Ce.prototype=new F).isPureReactComponent=!0,Ce.prototype.shouldComponentUpdate=function(e,t){return Be(this.props,e)||Be(this.state,t)};var gt=x.__b;x.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),gt&>(e)};var an=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function et(e){function t(r){var n=ur({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=an,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var yt=function(e,t){return e==null?null:W(W(e).map(t))},dr={map:yt,forEach:yt,count:function(e){return e?W(e).length:0},only:function(e){var t=W(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:W},sn=x.__e;x.__e=function(e,t,r,n){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}sn(e,t,r,n)};var bt=x.unmount;function pr(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=ur({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return pr(n,t,r)})),e}function fr(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return fr(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function te(){this.__u=0,this.t=null,this.__b=null}function _r(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ie(e){var t,r,n;function o(i){if(t||(t=e()).then(function(a){r=a.default||a},function(a){n=a}),n)throw n;if(!r)throw t;return H(r,i)}return o.displayName="Lazy",o.__f=!0,o}function X(){this.u=null,this.o=null}x.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),bt&&bt(e)},(te.prototype=new F).__c=function(e,t){var r=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(r);var o=_r(n.__v),i=!1,a=function(){i||(i=!0,r.__R=null,o?o(s):s())};r.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=fr(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.t.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(a,a)},te.prototype.componentWillUnmount=function(){this.t=[]},te.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=pr(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&H(D,null,e.fallback);return o&&(o.__u&=-33),[H(D,null,t.__a?null:e.children),o]};var vt=function(e,t,r){if(++r[1]===r[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(r=e.u;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.u=r=r[2]}};function ln(e){return this.getChildContext=function(){return e.context},e.children}function un(e){var t=this,r=e.i;t.componentWillUnmount=function(){ne(null,t.l),t.l=null,t.i=null},t.i&&t.i!==r&&t.componentWillUnmount(),t.l||(t.i=r,t.l={nodeType:1,parentNode:r,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n)},insertBefore:function(n,o){this.childNodes.push(n),t.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n)}}),ne(H(ln,{context:t.context},e.__v),t.l)}function mr(e,t){var r=H(un,{__v:e,i:t});return r.containerInfo=t,r}(X.prototype=new F).__a=function(e){var t=this,r=_r(t.__v),n=t.o.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),vt(t,e,n)):o()};r?r(i):i()}},X.prototype.render=function(e){this.u=null,this.o=new Map;var t=W(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.o.set(t[r],this.u=[1,0,this.u]);return e.children},X.prototype.componentDidUpdate=X.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,r){vt(e,r,t)})};var hr=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,cn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|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]/,dn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,pn=/[A-Z0-9]/g,fn=typeof document<"u",_n=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function gr(e,t,r){return t.__k==null&&(t.textContent=""),ne(e,t),typeof r=="function"&&r(),e?e.__c:null}function yr(e,t,r){return or(e,t),typeof r=="function"&&r(),e?e.__c:null}F.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(F.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var xt=x.event;function mn(){}function hn(){return this.cancelBubble}function gn(){return this.defaultPrevented}x.event=function(e){return xt&&(e=xt(e)),e.persist=mn,e.isPropagationStopped=hn,e.isDefaultPrevented=gn,e.nativeEvent=e};var tt,yn={enumerable:!1,configurable:!0,get:function(){return this.class}},kt=x.vnode;x.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,o={};for(var i in r){var a=r[i];if(!(i==="value"&&"defaultValue"in r&&a==null||fn&&i==="children"&&n==="noscript"||i==="class"||i==="className")){var s=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&a===!0?a="":s==="ondoubleclick"?i="ondblclick":s!=="onchange"||n!=="input"&&n!=="textarea"||_n(r.type)?s==="onfocus"?i="onfocusin":s==="onblur"?i="onfocusout":dn.test(i)?i=s:n.indexOf("-")===-1&&cn.test(i)?i=i.replace(pn,"-$&").toLowerCase():a===null&&(a=void 0):s=i="oninput",s==="oninput"&&o[i=s]&&(i="oninputCapture"),o[i]=a}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=W(r.children).forEach(function(l){l.props.selected=o.value.indexOf(l.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=W(r.children).forEach(function(l){l.props.selected=o.multiple?o.defaultValue.indexOf(l.props.value)!=-1:o.defaultValue==l.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",yn)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o}(e),e.$$typeof=hr,kt&&kt(e)};var wt=x.__r;x.__r=function(e){wt&&wt(e),tt=e.__c};var Ct=x.diffed;x.diffed=function(e){Ct&&Ct(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),tt=null};var br={ReactCurrentDispatcher:{current:{readContext:function(e){return tt.__n[e.__c].props.value}}}};function vr(e){return H.bind(null,e)}function fe(e){return!!e&&e.$$typeof===hr}function xr(e){return fe(e)&&e.type===D}function kr(e){return fe(e)?tn.apply(null,arguments):e}function Se(e){return!!e.__k&&(ne(null,e),!0)}function wr(e){return e&&(e.base||e.nodeType===1&&e)||null}var Cr=function(e,t){return e(t)},Sr=function(e,t){return e(t)},Rr=D;function rt(e){e()}function Er(e){return e}function Ar(){return[!1,rt]}var Ir=ie,jr=fe;function Lr(e,t){var r=t(),n=G({h:{__:r,v:t}}),o=n[0].h,i=n[1];return ie(function(){o.__=r,o.v=t,Ne(o)&&i({h:o})},[e,r,t]),q(function(){return Ne(o)&&i({h:o}),e(function(){Ne(o)&&i({h:o})})},[e]),r}function Ne(e){var t,r,n=e.v,o=e.__;try{var i=n();return!((t=o)===(r=i)&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch{return!0}}var Nr={useState:G,useId:sr,useReducer:Ke,useEffect:q,useLayoutEffect:ie,useInsertionEffect:Ir,useTransition:Ar,useDeferredValue:Er,useSyncExternalStore:Lr,startTransition:rt,useRef:Q,useImperativeHandle:ar,useMemo:K,useCallback:ce,useContext:Je,useDebugValue:Ye,version:"17.0.2",Children:dr,render:gr,hydrate:yr,unmountComponentAtNode:Se,createPortal:mr,createElement:H,createContext:Ge,createFactory:vr,cloneElement:kr,createRef:Xt,Fragment:D,isValidElement:fe,isElement:jr,isFragment:xr,findDOMNode:wr,Component:F,PureComponent:Ce,memo:cr,forwardRef:et,flushSync:Sr,unstable_batchedUpdates:Cr,StrictMode:Rr,Suspense:te,SuspenseList:X,lazy:Ie,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:br};const bn=Object.freeze(Object.defineProperty({__proto__:null,Children:dr,Component:F,Fragment:D,PureComponent:Ce,StrictMode:Rr,Suspense:te,SuspenseList:X,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:br,cloneElement:kr,createContext:Ge,createElement:H,createFactory:vr,createPortal:mr,createRef:Xt,default:Nr,findDOMNode:wr,flushSync:Sr,forwardRef:et,hydrate:yr,isElement:jr,isFragment:xr,isValidElement:fe,lazy:Ie,memo:cr,render:gr,startTransition:rt,unmountComponentAtNode:Se,unstable_batchedUpdates:Cr,useCallback:ce,useContext:Je,useDebugValue:Ye,useDeferredValue:Er,useEffect:q,useErrorBoundary:function(e){var t=Y(Z++,10),r=G();return t.__=e,U.componentDidCatch||(U.componentDidCatch=function(n,o){t.__&&t.__(n,o),r[1](n)}),[r[0],function(){r[1](void 0)}]},useId:sr,useImperativeHandle:ar,useInsertionEffect:Ir,useLayoutEffect:ie,useMemo:K,useReducer:Ke,useRef:Q,useState:G,useSyncExternalStore:Lr,useTransition:Ar,version:"17.0.2"},Symbol.toStringTag,{value:"Module"})),St=e=>{let t;const r=new Set,n=(a,s)=>{const l=typeof a=="function"?a(t):a;if(!Object.is(l,t)){const c=t;t=s??typeof l!="object"?l:Object.assign({},t,l),r.forEach(d=>d(t,c))}},o=()=>t,i={setState:n,getState:o,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>r.clear()};return t=e(n,o,i),i};function vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function xn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var Rt={exports:{}},Ue={};const Ur=xn(bn);var Et,At,It,jt,Lt={exports:{}},Oe={};function kn(){return At||(At=1,Lt.exports=function(){if(Et)return Oe;Et=1;var e=Ur,t=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(l){var c=l.getSnapshot;l=l.value;try{var d=c();return!t(l,d)}catch{return!0}}var s=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,c){return c()}:function(l,c){var d=c(),u=r({inst:{value:d,getSnapshot:c}}),h=u[0].inst,m=u[1];return o(function(){h.value=d,h.getSnapshot=c,a(h)&&m({inst:h})},[l,d,c]),n(function(){return a(h)&&m({inst:h}),l(function(){a(h)&&m({inst:h})})},[l]),i(d),d};return Oe.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:s,Oe}()),Lt.exports}var wn=(jt||(jt=1,Rt.exports=function(){if(It)return Ue;It=1;var e=Ur,t=kn(),r=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},n=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,s=e.useDebugValue;return Ue.useSyncExternalStoreWithSelector=function(l,c,d,u,h){var m=o(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=a(function(){function v(p){if(!A){if(A=!0,S=p,p=u(p),h!==void 0&&_.hasValue){var f=_.value;if(h(f,p))return b=f}return b=p}if(f=b,r(S,p))return f;var g=u(p);return h!==void 0&&h(f,g)?f:(S=p,b=g)}var S,b,A=!1,L=d===void 0?null:d;return[function(){return v(c())},L===null?void 0:function(){return v(L())}]},[c,d,u,h]);var w=n(l,m[0],m[1]);return i(function(){_.hasValue=!0,_.value=w},[w]),s(w),w},Ue}()),Rt.exports);const Cn=vn(wn),{useSyncExternalStoreWithSelector:Sn}=Cn,Nt=e=>{const t=typeof e=="function"?(n=>n?St(n):St)(e):e,r=(n,o)=>function(i,a=i.getState,s){const l=Sn(i.subscribe,i.getState,i.getServerState||i.getState,a,s);return Ye(l),l}(t,n,o);return Object.assign(r,t),r},Or=e=>e?Nt(e):Nt;var Tr=(e=>(e.RIGHT="right",e.LEFT="left",e))(Tr||{});const Te=e=>e!=null&&typeof e=="object"&&typeof Reflect.get(e,"taskStatus")=="string",Ut=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string"),Ot=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="number"),Tt=e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.every(r=>{if(typeof r!="object"||r===null)return!1;const n=Reflect.get(r,"selected");return n==="left"||n==="right"||n===null})),$e=(e,t)=>{const{allowUndefined:r=!0,rejectBooleanRecord:n=!1}=t??{};if(e===void 0)return r;if(e===null||typeof e=="string"||typeof e=="number"||Array.isArray(e))return!0;if(typeof e=="object"&&e!==null){if(n){const o=Object.values(e);if(o.length>0&&o.every(i=>typeof i=="boolean"))return!1}return!0}return!1},Pr=(e,t)=>{var r;if(t===null)return null;if(e.type==="texturlprompt")return(n=>n===void 0||typeof n=="object"&&n!==null&&"skipped"in n)(t)?t:void 0;if(t===void 0)return null;if(e.type==="multipleselect"){const n=(r=e.props)==null?void 0:r.options;if(Array.isArray(n)&&(o=>typeof o=="object"&&o!==null&&!Array.isArray(o)&&Object.values(o).every(i=>typeof i=="boolean"))(t)){const o=t;return n.reduce((i,a)=>(o[String(a.id)]&&i.push(a.value),i),[])}}if(e.type==="multiplechoice"){const n=(typeof t!="object"||t===null||Array.isArray(t)?[]:Object.values(t)).find(o=>o!==!1&&o!==void 0);return n!==void 0?n:$e(t,{allowUndefined:!1,rejectBooleanRecord:!0})?t:null}return $e(t,{allowUndefined:!1,rejectBooleanRecord:!0})?t:null},Rn=e=>{var t,r,n,o,i,a,s,l,c;switch(e.type){case"rankorder":case"multipleselect":case"multiplechoice":return(r=(t=e==null?void 0:e.props)==null?void 0:t.options)==null?void 0:r.map(d=>d.label);case"nps":return"1-10";case"likert":return`1-${((o=(n=e==null?void 0:e.props)==null?void 0:n.properties)==null?void 0:o.range)??5}`;case"matrix":return{matrixColumns:(s=(a=(i=e==null?void 0:e.props)==null?void 0:i.properties)==null?void 0:a.matrixColumn)==null?void 0:s.map(d=>d.label),matrixRows:(c=(l=e==null?void 0:e.props)==null?void 0:l.options)==null?void 0:c.map(d=>d.label)};default:return}},En=new Set(["rankorder","multipleselect","multiplechoice","matrix","likert","nps","open"]),An=(e,t,r)=>{switch(t){case"videovoice":return!!(e!=null&&e.value);case"open":return!!r;case"multipleselect":return!!(r&&Object.keys(r).length);case"recordedtask":return r!==null&&typeof r=="object"&&"taskStatus"in r&&r.taskStatus==="completed";case"texturlprompt":return!e.value;case"consentlegal":case"nps":case"likert":return r!==null;case"multiplechoice":return r!==void 0;case"matrix":return!!(r&&Object.values(r).every(n=>n!==null));default:return!0}},Vr=(e,t)=>{if(t==="matrix"&&e&&typeof e=="object"){const r=Object.keys(e).length,n=Object.values(e).filter(o=>o!==null).length;return n>0&&n<r}return!1},Re=e=>e==null?"":typeof e=="object"?JSON.stringify(e):typeof e=="string"?e:String(e),ee={eq:(e,t)=>Number(e)===Number(t),neq:(e,t)=>!ee.eq(e,t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),list_exact(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;const r=(n,o)=>String(n).localeCompare(String(o));return e.slice().sort(r).join(",")===t.slice().sort(r).join(",")},list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(r=>!e.includes(r)),list_alo(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],n=new Set(r);return t.some(o=>n.has(o))},list_dni(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],n=new Set(r);return t.every(o=>!n.has(o))},contains(e,t){const r=Re(e).toLowerCase(),n=Re(t).toLowerCase();return r.includes(n)},notcontains:(e,t)=>!ee.contains(e,t)},de={eq:(e,t)=>e==t,neq:(e,t)=>!de.eq(e,t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),list_exact(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;const r=(n,o)=>String(n).localeCompare(String(o));return e.slice().sort(r).join(",")===t.slice().sort(r).join(",")},list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(r=>!e.includes(r)),list_alo(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],n=new Set(r);return t.some(o=>n.has(o))},list_dni(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],n=new Set(r);return t.every(o=>!n.has(o))},contains(e,t){const r=String(e??"").toLowerCase(),n=String(t??"").toLowerCase();return r.includes(n)},notcontains:(e,t)=>!de.contains(e,t)},In=e=>e in de,Pt=1,Vt=2,jn=e=>{var n,o,i;switch(e.type){case"multipleselect":return e&&e.props&&e.props.options?e.props.options.length>13?e.props.options.map(a=>[a.value]):(t=e.props.options.map(a=>a.value),r=!e.props.properties.required,t.reduce((a,s)=>a.concat(a.map(l=>[...l,s])),[[]]).filter(a=>r||a.length>0)):null;case"multiplechoice":{if(!e||!e.props||!e.props.options)return null;const a=e.props.options.map(s=>s.value);return e.props.properties.required||a.push(void 0),a}case"matrix":{if(!((n=e==null?void 0:e.props)!=null&&n.options))return null;const a=e.props.properties.matrixColumn,s=e.props.options,l=s.reduce((d,u)=>(d[u.id]=null,d),{}),c=[{...l,[s[0].id]:a[0].value},s.reduce((d,u)=>(d[u.id]=a[0].value,d),{})];return e.props.properties.required||c.push(l),c}case"likert":{const a=Number((i=(o=e.props)==null?void 0:o.properties)==null?void 0:i.range)||5;return[...Array.from(new Array(a).keys()).map(l=>l+1),...e.props.properties.required?[]:[null]]}case"nps":return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case"videovoice":case"open":return["1",...e.props.properties.required?[]:[""]];case"recordedtask":{const a=[{taskStatus:"completed"},{taskStatus:"given.up"}];return e.props.properties.required||a.push({taskStatus:"abandoned"}),a}case"texturlprompt":return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case"consentlegal":return[1,...e.props.properties.required?[]:[null]];default:return[1]}var t,r},Ln=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,Nn=(e,t=[])=>t.reduce((r,n)=>{const{group:o,target:i}=n;if(!(o!=null&&o.length))return[...r];const a=o.filter(s=>!!Number(s)||typeof s=="object"&&s.questionIndex===e).map(s=>{const{comparator:l,value:c}=s;return{comparator:l,target:i,value:c}});return[...r,...a]},[]),qr=(e,t,r)=>r>0?t?e.length-3:e.length-2:t?e.length-2:e.length-1,Hr=({cards:e,index:t,hasEndCard:r,allResponses:n,uploadProgress:o={},surveyVisitorAttributes:i={}})=>{var u,h,m;if(t>=e.length||t<0)return null;const a=e[t];let s=t+1;const l=a.props.routingOptions||[];for(const _ of l){if(!Mr(_))continue;const{group:w,target:v}=_;if(Dr({group:w,allResponses:n,cards:e,surveyVisitorAttributes:i})){s=v===-1&&r?e.length-1:v;break}}const c=e.findIndex(_=>_.type==="uploading"),d=qr(e,r,c);for(;s!==null&&s!==-1&&s<=d&&((h=(u=e[s])==null?void 0:u.props)!=null&&h.displayLogic)&&e[s].props.displayLogic.length>0;){const _=e[s].props.displayLogic||[];if(nt({displayLogic:_,allResponses:n,cards:e,surveyVisitorAttributes:i}))break;s++}if(s!==-1&&((m=e==null?void 0:e[s])!=null&&m.parentId)){const _=e.findIndex(w=>{var v;return w.name===((v=e==null?void 0:e[s])==null?void 0:v.parentId)});if(_>-1){const w=e[_],v=n[_];Ee({comparator:"answered",type:w.type,response:v})||s++}}return t>=d||s===-1||s!==null&&s>d?c>0&&Object.values(o).some(w=>w.isSubmitted&&!w.isComplete)?c:r?e.length-1:null:s===-1?null:s},qt=({rule:e,allResponses:t,cards:r,surveyVisitorAttributes:n})=>{if(typeof(o=e.questionIndex)=="string"&&o.startsWith("attr-")){const a=(s=>s.slice(5))(e.questionIndex);return a in n?{response:n[a],type:"AttributeCheck"}:null}var o;const i=e.questionIndex;return{response:t[i],type:r[i].type}},Mr=e=>typeof e=="object"&&e!==null&&"group"in e,Ht=(e,t)=>{const r=e[t];return typeof r=="object"&&r!==null&&"comparator"in r?r:void 0},nt=({displayLogic:e,allResponses:t,cards:r,surveyVisitorAttributes:n})=>e.some(o=>!!Mr(o)&&Dr({group:o.group,allResponses:t,cards:r,surveyVisitorAttributes:n})),Dr=({group:e,allResponses:t,cards:r,surveyVisitorAttributes:n})=>{if(!e||e.length===0)return!1;const o=Ht(e,0);if((o==null?void 0:o.questionIndex)===void 0||typeof(o==null?void 0:o.questionIndex)=="number"&&o.questionIndex>=t.length)return!1;const i=qt({rule:o,allResponses:t,cards:r,surveyVisitorAttributes:n});if(i===null)return!1;let a=!!Ee({comparator:o.comparator,response:i.response,type:i.type,value:o.value});for(let s=1;s<e.length;s+=2){const l=e[s];if(l!==Pt&&l!==Vt)continue;const c=l,d=Ht(e,s+1);if(!d)continue;const u=qt({rule:d,allResponses:t,cards:r,surveyVisitorAttributes:n}),h=u!==null&&!!Ee({comparator:d.comparator,response:u.response,type:u.type,value:d.value});c===Pt?a=a&&h:c===Vt&&(a=a||h)}return a},Ee=({comparator:e,response:t,type:r,value:n})=>{if(r==="AttributeCheck")return((i,a,s)=>{const l=Re(a),c=Re(s),d=Number(a),u=Number(s),h=!Number.isNaN(d)&&l===String(d),m=!Number.isNaN(u)&&c===String(u),_=h&&m;switch(i){case"eq":return _?d===u:l.toLowerCase()===c.toLowerCase();case"neq":return _?d!==u:l.toLowerCase()!==c.toLowerCase();case"contains":case"notcontains":return ee[i](l,c);case"gt":case"gte":case"lt":case"lte":return _?ee[i](d,u):ee[i](l.localeCompare(c),0);case"list_exact":case"list_all":case"list_alo":case"list_dni":{const w=Array.isArray(a)?a:[a],v=Array.isArray(s)?s:[s];return ee[i](w,v)}default:return!1}})(e,t,n);if(!$e(t))return!1;const o=t;if(e==="answered")switch(r){case"texturlprompt":return o===void 0;case"consentlegal":return o&&(i=>i===null||i!==void 0&&typeof i=="object"&&"submitted"in i&&typeof i.submitted=="boolean")(o)&&o.submitted===!0;case"recordedtask":return Te(o)&&o.taskStatus==="completed";case"likert":case"nps":return Number.isInteger(o);case"rankorder":return Ot(o)&&Object.values(o).every(i=>i!==null);case"matrix":return Ut(o)&&Object.values(o).every(i=>i!==null);case"maxdiff":return Tt(o)&&o.every(i=>{if(!Array.isArray(i))return!1;const a=i.some(l=>l.selected==="left"),s=i.some(l=>l.selected==="right");return a&&s});case"multiplechoice":return!!o;case"multipleselect":return o&&Array.isArray(o)&&(o.length??0)>0;case"open":return typeof o=="string"&&(o.length??0)>0;case"videovoice":return(i=>i!=null&&typeof i=="object"&&"mediaRecordingUid"in i&&typeof i.mediaRecordingUid=="string")(o)&&!!o.mediaRecordingUid;default:return!1}if(e==="given_up")return r!=="recordedtask"||Te(o)&&o.taskStatus==="given.up";if(e==="partial")return Vr(o,r);if(e==="skipped")switch(r){case"texturlprompt":return(i=>i!==null&&(i===void 0||typeof i=="object"))(o)&&!!(typeof o=="object"&&o!==null&&"skipped"in o&&o.skipped);case"consentlegal":case"likert":case"nps":case"videovoice":return o===null;case"recordedtask":return Te(o)&&o.taskStatus==="abandoned";case"open":return o===null||typeof o=="string"&&o.length===0;case"multiplechoice":return o==null;case"multipleselect":return o===null||Array.isArray(o)&&o.length===0;case"matrix":return o===null||Ut(o)&&Object.values(o).every(i=>i===null);case"maxdiff":return o===null||!Tt(o)||o.some(i=>{if(!Array.isArray(i))return!0;const a=i.some(l=>l.selected==="left"),s=i.some(l=>l.selected==="right");return!(a&&s)});case"rankorder":return o===null||Ot(o)&&Object.values(o).includes(null);default:return!1}return n!==void 0&&de[e](o,n)},Pe=new Set(["thanks","uploading"]),z=Or()((e,t)=>({addResponseGroupMeta:void 0,allResponses:[],allResponsesRaw:{},answers:void 0,apiURL:"",avatars:{agentAvatar:{"1x":"","2x":""},respondentAvatar:{"1x":"","2x":""}},border:"#000000",cards:[],cardIndexByName:{},close:async(r=V.APP_ID)=>{const n=t(),{fadeout:o,remove:i,trackHistory:a,studyType:s}=n;await o(r),Ve(n)||a({event:"closed"}),j.breadcrumbsLogger.info("SurveyClosing",{surveyId:n.surveyId}),V.ConflictingWidgets.enable(),i({initiator:j.DismissReason.Closed,studyType:s})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async r=>{const{eventEmitFn:n,fadeout:o,remove:i,studyType:a,surveyId:s}=t();n("survey.complete",s),await o(r),V.ConflictingWidgets.enable(),i({initiator:j.DismissReason.Complete,studyType:a})},enableCspTrustedTypes:!1,endCard:{headline:""},envId:"",eventEmitFn:j.eventEmitter.emit.bind(j.eventEmitter),fadeout:async r=>{const{eventEmitFn:n,headers:o,viewDocument:i}=t();return j.shouldDirectEmbed(o)?Promise.resolve():(n(j.SprigEvent.SurveyFadingOut),new Promise(a=>{const s=i.getElementById(r);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:r=>{const{cards:n,eventEmitFn:o,index:i}=t();o(r,{qid:n[i].name,props:n[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:r,isComplete:n,progressPct:o,isSubmitted:i})=>{var m,_,w;const{cards:a,destroy:s,index:l,uploadProgress:c}=t(),d=n||((m=c[r])==null?void 0:m.isComplete),u={...c,[r]:{progressPct:d?100:o||((_=c[r])==null?void 0:_.progressPct),isComplete:d,isSubmitted:i||((w=c[r])==null?void 0:w.isSubmitted)}};if(e({uploadProgress:u}),a[l].type!=="uploading")return;const h=Object.entries(c).every(([v,S])=>!S.isSubmitted||S.isComplete||r==v&&n);if(h&&l>=a.length-1)return s(V.APP_ID);e({index:h?l+1:l,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":"web","x-ul-environment-id":"","x-ul-installation-method":"web-snippet","x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isConversationalUI:!1,isPreview:!1,layout:"default",marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:r=>{const{allResponses:n,cards:o,eventEmitFn:i,index:a,responseGroupUid:s,submit:l,trackHistory:c,uploadProgress:d,viewedCardCount:u}=t(),h=Array.isArray(r.data)?r.data:[r.data],m=Date.now(),_=[...o],w={response:[],responseGroupUid:s,questionIndex:a};let v=null;const S=n.slice(0);let b=a;h.forEach((p,f)=>{const g=Math.floor(p.questionId),R=_.findIndex(O=>O.name===g),y=R>=0?_[R]:_[a+f],E={value:p.value,questionId:g,answeredAt:m,...p.secondaryValue!==void 0&&{secondaryValue:p.secondaryValue},...p.questionText!==void 0&&{questionText:p.questionText}},N=E.value;(O=>O&&!Pe.has(O.type))(y)&&(y.value=N,y.secondaryValue=E.secondaryValue||null),w.response.push(E);const I=R>=0?R:a+f;S[I]=Pr(y,N),I>b&&(b=I)}),v=Hr({cards:_,index:b,hasEndCard:!!r.endCard,uploadProgress:d,allResponses:S,surveyVisitorAttributes:t().surveyVisitorAttributes}),e({allResponses:S}),(v===null||Pe.has(_[v].type))&&(w.completedAt=m);const A=l(w);if(v===null)return void r.completeSurvey();v&&!Pe.has(_[v].type)&&A.finally(()=>{c({event:"seen",index:v})});const L=_[v];_[v]&&i&&i("survey.question",{qid:L.name,props:L.props}),e({cards:_,hasViewedEmbed:!1,index:v,viewedCardCount:u+1})},pendingRemoveIframeReason:null,previewKey:null,recorder:()=>{},recorderEventEmitter:j.eventEmitter,resolveTrackedPromise:()=>{const{removeIframeIfReady:r}=t();e(n=>({unresolvedRequestCount:n.unresolvedRequestCount-1})),r()},responseGroupUid:"",remove:({initiator:r,studyType:n})=>{const{eventEmitFn:o,removeIframeIfReady:i,surveyId:a}=t();e({pendingRemoveIframeReason:r,studyType:n}),o(j.SprigEvent.SurveyCloseRequested,{name:j.SprigEvent.SurveyCloseRequested,initiator:r,studyType:n,"survey.id":a}),i()},removeIframeIfReady:()=>{const{eventEmitFn:r,pendingRemoveIframeReason:n,unresolvedRequestCount:o,studyType:i,surveyId:a}=t();n&&o===0&&(r(j.SprigEvent.SurveyWillClose,{name:j.SprigEvent.SurveyWillClose,initiator:n,studyType:i,"survey.id":a}),e({pendingRemoveIframeReason:null,studyType:i}))},seen:async()=>{const{trackHistory:r}=t();return r({event:"seen",isNew:!0})},createDynamicQuestion:async({parentQuestionId:r,parentResponseConfig:n})=>{var b,A,L;if(!t().cards.find(p=>p.parentId===r))return;const o=(p,f,g)=>{let R=!1;const y=p.map(E=>E&&E.parentId===f?(R=!0,g(E)):E);return R?y:p};let i=!1;e(p=>{var R;const f=p.cards.find(y=>(y==null?void 0:y.parentId)===r);return!(f!=null&&f.name)||"props"in(g=f)&&"loading"in g.props&&((R=g==null?void 0:g.props)==null?void 0:R.loading)!==void 0?p:(i=!0,{cards:o(p.cards,r,y=>{const E=y.props;return E&&"message"in E&&"properties"in E?{...y,props:{...E,loading:!0}}:y})});var g});const a=t(),s={...a.allResponsesRaw,...n||{}},{parentQuestionOrder:l,questionsResponses:c}=(({cards:p,combinedReadableRawResponses:f,parentQuestionId:g})=>{let R=1,y=1;const E=p.reduce((N,I)=>{if(I.name>0&&En.has(I.type)){g===I.name&&(y=R);const O="properties"in I.props&&I.props.properties&&"captionText"in I.props.properties?I.props.properties.captionText:void 0,M=(T=>T.type!=="uploading"&&T.type!=="thanks")(I)?{order:R++,question:I.props.message,questionDescription:O,questionType:I.type,response:f==null?void 0:f[I.name],options:Rn(I)}:{order:R++,questionType:I.type,response:f==null?void 0:f[I.name]};N.push(M)}return N},[]);return{parentQuestionOrder:y,questionsResponses:E}})({cards:a.cards,combinedReadableRawResponses:s,parentQuestionId:r}),d=a.cards.find(p=>p.parentId===r),u=a.cards.find(p=>p.name===r),h=Ee({comparator:"answered",type:(u==null?void 0:u.type)||"open",response:s==null?void 0:s[r]});if(!i||!d||!h)return;const m={surveyId:a.surveyId,responseGroupUid:a.responseGroupUid,parentQuestionOrder:l,questionsResponses:c,childQuestionId:d.name,customMetadata:a.customMetadata,meta:a.meta,previewKey:a.previewKey,isPreview:a.isPreview};let _=!1;const w=()=>{if(_)return;_=!0;const p=t(),f=p.cards.find(g=>g.parentId===r);if(f)if(e(g=>({cards:o(g.cards,r,R=>{const y=R.props;return y&&"message"in y&&"properties"in y?{...R,value:"",props:{...y,loading:null,properties:{...y.properties,required:!1}}}:R})})),j.isLongFormSurvey(p.studyType)&&(f!=null&&f.groupId)){const g=p.cards.reduce((E,N)=>((N==null?void 0:N.groupId)===f.groupId&&E.push(N),E),[]),R=g.findIndex(E=>E.name===f.name),y=R+1;if(y<g.length){const E=g[y].name;p.setFocusedQuestionId(E)}else{const E=g[R-1].name;p.setFocusedQuestionId(E)}}else p.next({data:{value:"",questionId:f.name,type:f.type},completeSurvey:()=>p.destroy(V.APP_ID),endCard:p.endCard})},v=new AbortController,S=setTimeout(()=>{v.abort(),w();const p=new Error("Timeout reached—question skipped");a.trackPromise(ye(a,"dynamicQuestion",p))},3e3);try{const p=a.isPreview?`${a.apiURL}/sdk/1/environments/${a.envId}/dynamic-question-preview`:`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/dynamic-question`,f=a.isPreview?"0":a.headers["x-ul-visitor-id"],g=await a.trackPromise(j.sprigFetch(p,{body:JSON.stringify(m),headers:{...a.headers,"x-ul-visitor-id":f},method:"POST",signal:v.signal}));if(!g.ok||!((L=(A=(b=g==null?void 0:g.json)==null?void 0:b.props)==null?void 0:A.message)!=null&&L.length))return w(),void await a.trackPromise(ye(a,"dynamicQuestion",g.error));if(_)return;_=!0,e(R=>({cards:o(R.cards,r,y=>{const E=y.props;return E&&"message"in E&&"properties"in E?{...y,props:{...E,loading:!1,message:g.json.props.message}}:y})}))}finally{clearTimeout(S)}},setAllResponsesRaw:r=>e({allResponsesRaw:r}),slugName:null,showStripes:!1,showSurveyBrand:!1,startingQuestionIdx:null,styleNonce:"",submit:async({completedAt:r,questionIndex:n,response:o,responseGroupUid:i})=>{const a=t();if(!i||Ve(a))return;const s={responseGroupUid:i,meta:a.meta,customMetadata:a.customMetadata,responses:o,completedAt:r,previewKey:a.previewKey};if(typeof a.addResponseGroupMeta=="function")try{const c=await a.addResponseGroupMeta();typeof c=="object"&&c!==null?s.meta={...s.meta,...c}:j.breadcrumbsLogger.error("addResponseGroupMeta must return an object")}catch(c){j.breadcrumbsLogger.error("addResponseGroupMeta promise failed",c)}const l=await a.trackPromise(j.sprigFetch(`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/responses/submit`,{body:JSON.stringify(s),headers:a.headers,method:"POST"}));l.ok?o.forEach((c,d)=>{a.eventEmitFn(j.SprigEvent.QuestionAnswered,{...c,questionIndex:n?n+d:void 0,"survey.id":a.surveyId})}):l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await a.trackPromise(ye(a,"submitResponse",l.error)))},surveyId:0,surveyVisitorAttributes:{},tabTitle:"",trackHistory:async({event:r,index:n,isNew:o=!1})=>{const i=t();if(Ve(i))return;const{cards:a,index:s}=i;let l=n??s,c=a[l];for(;c;){const d={sid:i.surveyId,qid:Math.floor(c.name),action:r,vid:i.userId,eid:i.envId,isNew:o,responseGroupUid:i.responseGroupUid,previewKey:i.previewKey},u=await i.trackPromise(j.sprigFetch(`${i.apiURL}/sdk/1/visitors/${i.userId}/surveys/${i.surveyId}/history`,{method:"POST",headers:i.headers,body:JSON.stringify(d)}));!u.ok&&u.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",u.error),await i.trackPromise(ye(i,"trackHistory",u.error)));const h=a[l+1];if(!c.groupId||!(h!=null&&h.groupId)||h.groupId!==c.groupId)break;l++,c=h,o=!1}},trackPromise:async r=>{const{resolveTrackedPromise:n}=t();return e(o=>({unresolvedRequestCount:o.unresolvedRequestCount+1})),r.then(o=>(n(),o)).catch(o=>{throw n(),o})},unresolvedRequestCount:0,update:()=>{var b,A,L;const{cards:r,index:n,headers:o,eventEmitFn:i,frame:a,useMobileStyling:s,surveyId:l,viewDocument:c,isConversationalUI:d}=t(),u=o["userleap-platform"]==="web",h=j.shouldDirectEmbed(o),m=r[n],_=m.type==="matrix"&&!(m.props.properties.displayMatrixAsAccordion||s);!h&&!s&&((b=a==null?void 0:a.setWidth)==null||b.call(a,V.DEFAULT_WIDTH_PX));const[w,v]=V.calculateFrameDimensions(c,u&&!s,h),S=d&&w<532?532:w;h?(i(j.SprigEvent.SurveyHeight,{name:j.SprigEvent.SurveyHeight,contentFrameHeight:S,"survey.id":l}),i(j.SprigEvent.SurveyWidth,{name:j.SprigEvent.SurveyWidth,contentFrameWidth:v,"survey.id":l})):((A=a.setHeight)==null||A.call(a,S),!s&&_&&((L=a.setWidth)==null||L.call(a,v)))},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0,focusedQuestionId:null,setFocusedQuestionId:r=>e({focusedQuestionId:r})})),Ve=e=>{var t;return!e.userId||((t=e==null?void 0:e.meta)==null?void 0:t.mode)==="test"||e.isPreview},ye=async(e,t,r)=>{const{mode:n,userId:o,envId:i,apiURL:a,headers:s,viewDocument:l}=e,c=l.documentElement,d={mode:n,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:c.clientWidth,clientHeight:c.clientHeight,location:window.location.href,language:window.navigator.language},u={action:t,err:{message:`${r==null?void 0:r.name} - ${r==null?void 0:r.message}`,stack:r==null?void 0:r.stack},meta:d,vid:o,envId:i};(await j.sprigFetch(`${a}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},s),body:JSON.stringify(u)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",r)},Un=()=>{const{cards:e,close:t,endCard:r,headers:n,index:o}=z(s=>({cards:s.cards,close:s.close,endCard:s.endCard,headers:s.headers,index:s.index,useMobileStyling:s.useMobileStyling})),i=e.length,a=K(()=>()=>t(V.APP_ID),[t]);return["email","link"].includes(n["userleap-platform"])||r&&o+1===i?null:k("div",{"aria-label":"Close button",className:"close-btn",onClick:a,onKeyPress:s=>{s.key==="Enter"&&a()},role:"button",tabIndex:0,children:k("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:k("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"})})})},Fr=e=>H("svg",{fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...e},H("path",{d:"M17 10L12 15L7 10",stroke:"#0B2330",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})),zr=e=>H("svg",{fill:"none",height:10,viewBox:"0 0 10 10",width:10,xmlns:"http://www.w3.org/2000/svg",...e},H("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:2})),On=({visible:e})=>k("div",{className:"sprig-check-background",style:{opacity:e?1:0},children:k(zr,{className:"sprig-check"})}),Mt="250ms",Tn=et(({animate:e,children:t,header:r,isOpen:n,onClick:o,showHeaderCheck:i},a)=>{const s=z(w=>w.update),l=Q(null),[c,d]=G(0),[u,h]=G("none"),[m,_]=G(!0);return q(()=>{var v;const w=(v=l.current)==null?void 0:v.getBoundingClientRect();d(n&&w?w.height:0)},[n]),q(()=>{s()},[c,s]),q(()=>{!c&&n||!m||_(!1),h(e&&!m?`height ${Mt} ease`:"none")},[e,m,c,n]),k("div",{className:"sprig-accordion",ref:a,children:[k("button",{className:"sprig-accordion-header-container",onClick:o,type:"button",children:[k("div",{className:"sprig-header-label-container",children:[k("span",{className:"sprig-header-label",children:r}),k(On,{visible:i})]}),k(Fr,{className:"sprig-caret",style:{transitionDuration:e?Mt:"0",transform:n?"rotate(-180deg)":"none"}})]}),k("div",{className:"sprig-accordion-body",style:{transition:u,height:c},children:k("div",{ref:l,children:t})})]})}),ot=({style:e,stroke:t="black"})=>k("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[k("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:t,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),k("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:t,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),xe=(...e)=>e.filter(Boolean).join(" "),Br=(e,t,r)=>{const n=t?"--mobile":"--desktop";return`${e+n} ${e+(r?`${n}_${r}`:"")} ${e}`},Pn=(e,t)=>`${e} ${e}__${t}`,$r=({logoOnly:e=!1,style:t={}})=>k("svg",{alt:(e?"Powered by ":"")+"Sprig",fill:"none",height:"15",style:{display:"block",...t},viewBox:e?"79 0 31 15":"0 0 112 15",width:e?"35":"112",xmlns:"http://www.w3.org/2000/svg",children:[!e&&k("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),k("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),k("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),k("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),k("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),k("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),Wr=({forceBrandedLogo:e,marketingUrlLink:t})=>k("div",{className:e?"yellow-footer-logo":"",style:{marginTop:"4px",marginBottom:"4px"},children:k("a",{href:t,rel:"noreferrer",target:"_blank",children:k("div",{style:{display:"flex"},children:[k($r,{logoOnly:!1}),e&&k(ot,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}),Qr=({marketingUrlLink:e})=>k("a",{dir:"ltr",href:e,rel:"noreferrer",target:"_blank",children:k("div",{className:"thank-you-card-link",children:[k("div",{className:"sprig-box-logo",children:k($r,{logoOnly:!0,style:{margin:"auto"}})}),k("div",{children:k("p",{children:["Capture insights about your own product",k(ot,{style:{display:"inline-flex",marginInlineStart:"4px",verticalAlign:"middle"}})]})})]})}),Zr=({marketingUrl:e,slugName:t,surveyId:r,forceBrandedLogo:n})=>`${e}?utm_source=survey_branding&utm_medium=website&utm_campaign=${t}&utm_content=${r}${n?"&utm_term=poweredby_pill":""}`,Vn=()=>{var S;const{border:e,cards:t,forceBrandedLogo:r,headers:n,index:o,marketingUrl:i,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:c}=z(b=>({border:b.border,cards:b.cards,forceBrandedLogo:b.forceBrandedLogo,headers:b.headers,index:b.index,marketingUrl:b.marketingUrl,showSurveyBrand:b.showSurveyBrand,slugName:b.slugName,surveyId:b.surveyId,viewedCardCount:b.viewedCardCount})),d=Q(null),u=t.filter(b=>b.type!=="uploading"&&b.type!=="thanks"),h=((b,A)=>{const L=new Set(["thanks","uploading"]);if(A>=b.length||A<0||L.has(b[A].type))return 0;const p=b.filter(g=>!L.has(g.type));if(A===p.length-1)return 1;const f={[p.length-1]:1,[-1]:0};for(let g=p.length-2;g>=A;g--){const R=p[g],y=(R.props.routingOptions??[]).filter(M=>typeof M=="object"&&M!==null&&"group"in M),E=Nn(g,y);if(E.length===0){f[g]=f[g+1]+1;continue}let N=0;const I=jn(R);if(I===null)return p.length-1-A;let O=I;for(const M of E){if(O.length===0)break;const{comparator:T,target:_e,value:ae}=M,me=O.filter(C=>{const P=An({value:C},R.type,C),B=Vr(C,R.type);return!(P&&T==="answered"||B&&T==="partial"||!P&&!B&&T==="skipped"||T==="given_up"&&Ln(C)&&C.taskStatus==="given.up"||P&&R.type==="open"&&(T==="contains"||T==="notcontains")||P&&In(T)&&de[T](C,ae))});if(me.length<O.length){const C=Number.parseInt(String(_e),10);if(C!==-1&&C<=g||C>=p.length)return p.length-1-A;N=Math.max(f[C]+1,N)}O=me}O.length>0&&(N=Math.max(f[g+1]+1,N)),f[g]=N}return f[A]})(t,o),m=c+1,_=m/(m+h),w=Zr({marketingUrl:i,slugName:s,surveyId:l,forceBrandedLogo:r});q(()=>{d.current&&(d.current.style.width=100*_+"%")},[_]);const v=((S=t[o])==null?void 0:S.type)==="thanks";return k("footer",{className:"ul-footer "+(n["userleap-platform"]==="link"?"ul-footer__link":""),children:v&&r?k(Qr,{marketingUrlLink:w}):k(D,{children:[u.length>1&&k("div",{className:"ul-progress-bar-container ul-progress-bar-container__footer",children:k("div",{className:"ul-progress-bar-current",ref:d,style:{border:`1px solid ${e||"#000"}`}})}),a?k(Wr,{forceBrandedLogo:r,marketingUrlLink:w}):null]})})},qn=/<piped-value\b([^>]*)>.*?<\/piped-value>/gis,Dt=["questionHtml","captionHtml","footerHtml","richTextBody"],We=e=>!!e.props&&typeof e.props=="object"&&"properties"in e.props,qe=e=>!!e.props&&typeof e.props=="object"&&"options"in e.props&&Array.isArray(e.props.options),Ft=e=>["string","number"].includes(typeof e),zt=e=>e.length===0?"":e.length===1?e[0]:e.join(", "),Hn=e=>{var r,n;const t=(o=>o!=null&&typeof o=="object"&&"value"in o)(e)?e.value:void 0;if(t!=null){if(e.type==="multipleselect"&&qe(e)&&(o=>!!o&&typeof o=="object"&&!Array.isArray(o))(t)){const o=e.secondaryValue??null,i=e.props.options.filter(a=>t[String(a.id)]===!0).map(a=>{var s;return a.label+((s=o==null?void 0:o[String(a.id)])!=null&&s.userText?`: ${o[String(a.id)].userText}`:"")});return i.length?zt(i):"No options selected"}if(e.type==="multiplechoice"&&typeof t=="object"&&t!==null){const o=e.secondaryValue??null,i=Object.keys(t)[0];if(i){const a=e.props.options.find(s=>String(s.id)===i);return(a==null?void 0:a.label)+((r=o==null?void 0:o[i])!=null&&r.userText?`: ${(n=o==null?void 0:o[i])==null?void 0:n.userText}`:"")}}if(e.type==="matrix"&&qe(e)&&(o=>{if(!We(o))return!1;const i=o.props.properties;return!!i&&typeof i=="object"&&"matrixColumn"in i})(e)){const o=e.props.options,i=e.props.properties.matrixColumn,a=[];for(const[s,l]of Object.entries(t)){const c=o.find(_=>String(_.id)===s),d=(c==null?void 0:c.label)??s,u=Ft(l)?String(l):JSON.stringify(l),h=i.find(_=>_.value===u),m=(h==null?void 0:h.label)??u;a.push(`${d}: ${m}`)}return a.join("; ")}if(e.type==="rankorder"&&qe(e)){const o=e.props.options.reduce((a,s)=>(a[String(s.id)]=s.label,a),{}),i=[];for(const[a,s]of Object.entries(t)){const l=o[a];l&&(i[s-1]=l)}return zt(i)}if(Ft(t)){const o=String(t).replaceAll(/[\u200B-\u200D\uFEFF]/g,"").trim();return o===""?void 0:o}try{return JSON.stringify(t)}catch{return String(t)}}},Bt=(e,t)=>{const r=new RegExp(`${t}="([^"]*)"`,"i").exec(e);return(r==null?void 0:r[1])??null},Mn=(e,t)=>{if(e==null)return e;let r=!1;const n=e.replace(qn,(o,i)=>{r=!0;const a=Bt(i,"answer-id"),s=Bt(i,"fallback-text")??"";if(!a)return s;const l=a.startsWith("attr-")?a:Number(a);if(Object.hasOwn(t,l)){const c=t[l];return String(c)}return s});return r?n:e},Gr=(e,t)=>{const r={};if(t)for(const[n,o]of Object.entries(t))typeof o=="string"?r[`attr-${n}`]=o:o!=null&&(r[`attr-${n}`]=JSON.stringify(o));for(const n of e){const o=Hn(n);o!==void 0&&(r[n.name]=o)}return r},Dn=()=>{const{border:e,cards:t,index:r,focusedQuestionId:n,isConversationalUI:o}=z(s=>({border:s.border,cards:s.cards,index:s.index,focusedQuestionId:s.focusedQuestionId,isConversationalUI:s.isConversationalUI})),{totalQuestions:i,fraction:a}=K(()=>{var d;const s=t.filter(u=>u.type!=="uploading"&&u.type!=="thanks"),l=s.length;if(l<=1)return{totalQuestions:l,fraction:0};if(((d=t[r])==null?void 0:d.type)==="thanks")return{totalQuestions:l,fraction:1};let c=0;return c=o?r+1:s.findIndex(u=>u.name===n),{totalQuestions:l,fraction:c/(l+1)}},[t,r,n,o]);return i<=1?null:k("div",{className:"ul-progress-bar-container ul-progress-bar-container__header",children:k("div",{className:"ul-progress-bar-current",style:{width:100*a+"%",border:`1px solid ${e??"#000"}`}})})},Fn=Ie(()=>Promise.resolve().then(()=>require("./conversational-ui-Bxn2-bHk.cjs"))),zn=Ie(async()=>({default:(await Promise.resolve().then(()=>require("./index-C3QpXMSG.cjs"))).PageCard})),Bn=()=>{const{answers:e,border:t,cards:r,close:n,configureExitOnOverlayClick:o,destroy:i,endCard:a,eventEmitFn:s,fontFamily:l,headers:c,isConversationalUI:d,index:u,next:h,previewKey:m,productConfig:_,seen:w,showStripes:v,studyType:S,surveyId:b,surveyVisitorAttributes:A,update:L,useMobileStyling:p,viewDocument:f}=z(C=>({answers:C.answers,border:C.border,cards:C.cards,close:C.close,configureExitOnOverlayClick:C.configureExitOnOverlayClick,destroy:C.destroy,endCard:C.endCard,eventEmitFn:C.eventEmitFn,fontFamily:C.fontFamily,headers:C.headers,index:C.index,isConversationalUI:C.isConversationalUI,previewKey:C.previewKey,productConfig:C.productConfig,next:C.next,seen:C.seen,showStripes:C.showStripes,studyType:C.studyType,surveyId:C.surveyId,surveyVisitorAttributes:C.surveyVisitorAttributes,update:C.update,useMobileStyling:C.useMobileStyling,viewDocument:C.viewDocument})),g=Q(null),R=Q(!1),y=Q(!1),E=c["userleap-platform"],{props:N,type:I,name:O}=r[u];q(()=>{if(window.Sprig)return window.Sprig.trackHistory=C=>z.getState().trackHistory(C),()=>{window.Sprig.trackHistory=void 0}},[]),q(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!R.current&&s&&(R.current=!0,s(j.SprigEvent.SurveyAppeared,{name:j.SprigEvent.SurveyAppeared,"survey.id":b})))},[s,b]),q(()=>{const C=()=>{f.visibilityState==="visible"&&(w(),f.removeEventListener("visibilitychange",C))};return f.addEventListener("visibilitychange",C),C(),()=>{f.removeEventListener("visibilitychange",C)}},[w,f]);const M=ce(async()=>{if(!f)return;const C=f.getElementById("conversational-ui-styles");if(!d&&C)return C.remove(),void(y.current=!1);if(d&&!C){const P=await Promise.resolve().then(()=>require("./conversational-styles-41oiRRxR.cjs"));V.setSurveyStyles({document:f,elementId:"conversational-ui-styles",styleString:P.default}),requestAnimationFrame(()=>{L()}),y.current=!0}},[d,f,L]);q(()=>{o(()=>n())},[n,o]),q(()=>{M()},[M,f]);const T=K(()=>j.groupCards(r,u),[r,u]),_e=Gr(r,A),ae=ce(C=>{h({data:C,completeSurvey:()=>i(V.APP_ID),endCard:a}),V.resetScrollPosition(f)},[h,i,a,f]);if(e){for(const C of e)if(C.questionId===O){let P;if(I==="multiplechoice"){const B=N.options.find(({value:je})=>je===C.value);if(!B)break;P={[B.id]:B.value}}else P=C.value;ae({value:P,type:I,questionId:C.questionId});break}}const me=!p&&((_==null?void 0:_.framePosition)==="center"||(_==null?void 0:_.desktopDisplay)==="center-modal"||((_==null?void 0:_.placement)||"").includes("center"));return k("div",{className:xe("ul-app",j.shouldDirectEmbed(c)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:V.APP_ID,onClick:C=>{var it;const P=window.sprigAPI,B=C.target;if(!P||!B)return;const je=[B,B.parentElement];for(const he of je)if(((it=he==null?void 0:he.tagName)==null?void 0:it.toLowerCase())==="a"){C.preventDefault();try{const se=new URL(he.href);se.protocol!=="http:"&&se.protocol!=="https:"||(P==null||P.openUrl(se.toString()))}catch(se){console.error(se)}return}},ref:g,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{},...me?{position:"relative"}:{}},children:k("div",{className:"ul-app__container",children:k("div",{className:xe(Br("ul-card__container",p,S)),style:{...S!=="feedbackButton"||(_==null?void 0:_.desktopDisplay)==="center-modal"?{borderColor:t}:{},...(_==null?void 0:_.desktopDisplay)==="slider"?{margin:"0px"}:{}},children:[k("div",{className:"sprig-container",children:[v&&k("div",{className:"ul-header__container",dir:"ltr",children:k("div",{className:"ul-header",children:"For development purposes only"})}),m&&k("div",{className:"ul-header__container",dir:"ltr",children:k("div",{className:"ul-header",children:"Preview Mode: Response will not be recorded."})}),j.isLongFormSurvey(S)&&k(Dn,{}),k("div",{className:xe(Pn("ul-card-main-content",E)),children:k(te,d?{fallback:null,children:k(Fn,{cards:r,next:ae,previousResponses:_e})}:{fallback:null,children:k(zn,{cards:T,next:ae,previousResponses:_e})})}),!j.isLongFormSurvey(S)&&k(Vn,{})]}),!d&&k(Un,{})]})})})},Kr=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",$t=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Kr()};return new MediaRecorder(e,t)},Wt=(e,t,r)=>{r[t]=[],e.ondataavailable=function(n){r[t].push(n.data)},e.currentMediaRecordingUid=t,e.start()};function Qt(e,t,r,n,o,i){if(e&&e.state!=="inactive"){const{"begin.callback":a}=n,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>async function(l,c,d,u,h,m,_){const w=z.getState().viewDocument,{"upload.callback":v,"progress.callback":S}=u,b={mediaType:d,updatedAt:new Date().toISOString(),mediaRecordingUid:h,...u["passthrough.data"]},A=await(async(g,R)=>{var E;const y=await fetch(R,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(y.ok){const N=await y.json();return(E=N==null?void 0:N.upload)==null?void 0:E.url}return null})(b,l);if(!A)return void(v&&v(null,{message:"failed to get upload url"}));const L=new Blob(_,{type:Kr()});if(!w.defaultView)return;const p=new w.defaultView.File([L],`recording video ${Date.now()}`),f=m.createUpload({endpoint:A,file:p,chunkSize:5120});f.on("error",g=>{v&&v(null,g)}),f.on("progress",g=>{S&&S(h,g)}),f.on("success",()=>{v&&v(h,!0)})}(t,0,r,n,s,o,i),e.stop()}}const $n={state:{chunks:{}},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:r,screenRecorder:n,UpChunk:o}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?"video":"audio";this.state.chunks&&t&&o&&(r!=null&&r.currentMediaRecordingUid&&Qt(r,t,i,e,o,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]),n!=null&&n.currentMediaRecordingUid&&Qt(n,t,"screen",e,o,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),r=e.getAudioTracks();let n=t.length&&t[0];n=n||r.length&&r[0],n&&n.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("permission.status",this.permissionStatusCallback.bind(this)),e.on("av.permission",async r=>{this.avPermissionCallback(r)}),e.on("begin.recording",this.beginRecordingCallback.bind(this)),e.on("start.task",this.startTaskCallback.bind(this)),e.on("screen.permission",async r=>{this.screenPermissionCallback(r)}),e.on("finish.task",async r=>{this.finishTaskCallback(r)})},async avPermissionCallback(e){var n,o,i;const{"stream.ready":t,"permission.descriptors":r}=e;try{(n=this.state.avStream)!=null&&n.active&&(this.state.avStream.getTracks().map(a=>a.readyState==="live"&&a.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:r.includes("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(a){return console.warn("Error: failed to get permissions: "+a),void(t&&t(null,null))}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{"screen.permission.requested":t,"stream.ready.callback":r}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(n){return t==null||t(!1),console.warn("Error: failed to get permissions: "+n),void(r&&r(null,null))}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),r&&r(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{"recording.media.types":t,"start.recording.callback":r=()=>{}}=e;if(!t)return;const n=[];if(t.includes("video")&&this.state.avStream){this.state.avRecorder=$t(this.state.avStream);const o=j.v4();Wt(this.state.avRecorder,o,this.state.chunks),n.push(o)}if(t.includes("screen")&&this.state.captureStream){this.state.screenRecorder=$t(this.state.captureStream);const o=j.v4();Wt(this.state.screenRecorder,o,this.state.chunks),n.push(o)}n&&r&&r(n)},async finishTaskCallback(e){const{"current.index":t,"task.response":r,"task.complete.callback":n}=e;await this.stopRecording(e),n&&n(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,r,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var n;const{"permission.status.callback":t}=e,r=this.state.avStream;t&&t(r,!!r&&(r==null?void 0:r.getVideoTracks().length)>0,!!((n=this.state.captureStream)!=null&&n.active),this.state.captureStream)},lookAheadAndStopStream(e,t,r,n){const{avRecorder:o,screenRecorder:i}=this.state,{allResponses:a,surveyVisitorAttributes:s}=z.getState(),l=Hr({cards:r,index:e,hasEndCard:n,allResponses:a,surveyVisitorAttributes:s});l!==null&&r[l].type==="recordedtask"||[o,i].map(c=>{c&&(c.state==="recording"&&c.stop(),c.stream.getTracks().map(d=>{d.readyState==="live"&&d.stop()}))})}},ke=Object.create($n);Object.freeze(ke);const Wn=({mode:e=null,viewWindow:t,viewDocument:r,trackPageViewUrl:n})=>{const o=r.documentElement;let i;try{i=t.parent.location.href}catch{i=t.location.href}return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:o.clientWidth,ch:o.clientHeight,p:n??i,l:t.navigator.language}};let He=!1;const Qn={configure:function(e,t=!0){var L;const{answers:r,apiURL:n,endCard:o,eventEmitFn:i,fontFamilyURL:a,frame:s,previewKey:l,viewDocument:c,viewWindow:d}=e,u=j.shouldDirectEmbed(e.headers)?e.frame:c.body,h=e.UpChunk||window.UpChunk,m=j.eventEmitter,_=((p,f)=>{const g=[...p],R=new Set(["videovoice","recordedtask"]);return p.some(y=>R.has(y.type))&&g.push({name:-2,props:{routingOptions:[],displayLogic:[]},type:"uploading"}),f&&g.push({name:-1,props:{routingOptions:[],displayLogic:[]},type:"thanks"}),g})(e.cards,!!o),w=Object.fromEntries(_.map((p,f)=>[p.name,f]));ke.configure(m,{cards:_,hasEndCard:!!o,apiURL:n,UpChunk:h});const v=e.layout==="conversational",S=(({cards:p,hasEndCard:f,allResponses:g=[],surveyVisitorAttributes:R={},startingQuestionIdx:y=0})=>{var O,M;const E=p.findIndex(T=>T.type==="uploading"),N=qr(p,f,E);let I=Math.min(Math.max(0,y??0),N);for(;I<=N&&((M=(O=p[I])==null?void 0:O.props)!=null&&M.displayLogic)&&p[I].props.displayLogic.length>0;){const T=p[I].props.displayLogic||[];if(nt({displayLogic:T,allResponses:g,cards:p,surveyVisitorAttributes:R}))break;I++}return Math.min(I,N)})({cards:_,hasEndCard:!!o,allResponses:[],surveyVisitorAttributes:e.surveyVisitorAttributes??{},startingQuestionIdx:e.startingQuestionIdx});z.setState({addResponseGroupMeta:e.addResponseGroupMeta,apiURL:n,answers:r,avatars:e.avatars,border:e.border,index:S,isConversationalUI:v,cards:_,cardIndexByName:w,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,enableCspTrustedTypes:e.enableCspTrustedTypes,endCard:e.endCard,envId:e.envId,eventEmitFn:i,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:s,headers:e.headers,hasViewedEmbed:!1,isPreview:e.previewMode,layout:e.layout,marketingUrl:"https://sprig.com",meta:Wn({mode:e.mode,viewWindow:d,viewDocument:c,trackPageViewUrl:e.trackPageViewUrl}),mode:e.mode,previewKey:l,productConfig:e.productConfig,recorder:ke,recorderEventEmitter:m,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,startingQuestionIdx:e.startingQuestionIdx,styleNonce:e.styleNonce,studyType:e.studyType,surveyId:e.surveyId,surveyVisitorAttributes:e.surveyVisitorAttributes,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:S});const{head:b}=c;if(V.setSurveyStyles({document:c,elementId:"sprig-style",styleString:`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}ol,ul{padding-inline-start:1em}.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)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;min-width:200px;justify-content:center;animation:enable-transitions 0s .3s forwards;min-height:0}@keyframes enable-transitions{to{transition:opacity .2s ease-in-out}}.ul-focus-transitions-active .ul-card,.ul-card--with-transitions{transition:opacity .2s ease-in-out}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026;margin:15px}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container--desktop_longFormSurvey,.ul-card__container--mobile_longFormSurvey{margin:0}.sprig-container{display:flex;flex-direction:column;width:100%;height:fit-content;flex:1 1 auto;min-height:0;justify-content:center}.ul-card__container{background:#fff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;padding:0;min-height:0;position:relative;text-align:center;word-break:normal}.ul-card__container--desktop_feedbackButton{box-shadow:unset}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:center;align-self:stretch}.sprig-question-footer-container{align-items:center;width:100%;height:fit-content;display:flex;flex-direction:column;padding:12px 20px 0}.long-form-question-footer-container{position:fixed;bottom:0;left:0;width:100%;display:flex;justify-content:space-between;align-items:center;overflow:visible;z-index:1000;pointer-events:none;padding:32px}@media only screen and (max-width: 700px){.long-form-question-footer-container{position:relative}}.long-form-question-footer-container--mobile{background-color:#fff;border-top:1px solid #e6e6e6;padding:16px 24px;flex:0 1}.long-form-question-footer-container-center{justify-content:center}.long-form-question-footer-container .long-form-question-footer-container-logo{width:auto;pointer-events:auto}.conversational-ui .long-form-question-footer-container-logo{position:sticky;bottom:32px;margin:16px}.long-form-question-footer-container-center .long-form-question-footer-container-logo{margin-left:0}.long-form-question-footer-container .long-form-question-footer-container-actions{display:flex;gap:8px;pointer-events:auto}.long-form-question-footer-container .long-form-question-footer-container-actions .long-form-button{display:flex;justify-content:center;align-items:center;gap:8px;padding:12px;border-radius:8px;height:40px;width:40px}.long-form-question-footer-container .long-form-question-footer-container-actions .long-form-button .long-form-button-text-container{display:flex;align-items: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}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;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,.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{display:flex;flex:1 1 auto;min-height:0;flex-direction:column;z-index:2;height:fit-content;overflow:auto;scrollbar-width:thin;scroll-behavior:smooth}.sprig-border-bottom{border-bottom:1px solid rgba(0,0,0,.1)}.sprig-border-top{border-top:1px solid rgba(0,0,0,.1)}.question-header-container{z-index:1}.sprig-header-container{padding:16px}.question-header-button-container{display:grid;grid-template-columns:97fr 3fr;align-items:center;justify-content:space-between;width:100%;height:fit-content}.ul-card--thanks-content .question-header-button-container{justify-content:center}.sprig-question-body{padding:0 20px;min-height:0;flex-shrink:1;overflow:auto;position:relative;align-self:stretch;width:100%}.sprig-stretch{align-self:stretch}.ul-question{color:#343442;display:block;font-size:17px;line-height:125%;font-weight:500;cursor:default;text-align:start}.ul-question ol,.ul-question ul,.ul-caption ol,.ul-caption ul{margin-left:1em}.ul-caption{flex:1 0 auto;font-size:14px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:start;margin-top:4px}.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{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.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;-webkit-hyphens:auto;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}.select-checkbox{height:16px;width:16px;display:flex;box-sizing:border-box;background-color:"transparent";align-items:center;justify-content:center;border-radius:4px;border:1px solid #b0b5b7;flex-shrink:0}.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}.footer{width:100%;margin-top:12px;font-size:12px;line-height:12px;color:#000000b3}[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{align-self:center;box-shadow:unset;border-radius:unset;border:none!important;position:unset;width:100%}@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;align-self:stretch}.sprig-accordion{width:100%;margin-bottom:8px}.sprig-accordion-body{width:100%;overflow:hidden}.sprig-accordion-header-container{background:transparent;border:none;display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;cursor:pointer;margin:8px 0 0;padding:0;font-family:inherit}.sprig-header-label-container{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;flex:1 1 0}.sprig-header-label{color:#343442;font-size:15px;font-weight:590;line-height:21px;text-align:start;overflow:hidden}.sprig-check-background{flex:0 0 16px;height:16px;width:16px;border-radius:8px;margin-right:8px;background-color:#efefee;display:flex;align-items:center;justify-content:center}.sprig-check{height:9px;width:9px;margin-left:-1px}.sprig-check path{stroke:#506067;stroke-width:1.5}.sprig-caret{height:20px;width:20px;transition-property:transform}.sprig-caret path{stroke:#000}.ul-card-longform__submit-button-container{display:flex;justify-content:flex-end}.ul-card-longform__submit-button-container .ul-card-longform__submit-button{display:flex;flex-direction:row;align-items:center;white-space:nowrap;gap:4px;border-radius:8px;color:#fff;cursor:pointer}.ul-card-longform__submit-button-container .ul-card-longform__submit-button:disabled{opacity:.5;cursor:not-allowed}.ul-card-list-container--longform{display:flex;flex-direction:column;gap:2rem;width:100%;align-items:center;height:auto;justify-content:center;flex:1 0 auto}.ul-card-list-container--longform:has(.ul-card-scroll-wrapper:nth-child(2)){gap:1rem;padding-block-start:40px;padding-block-end:40px}@media (max-width: 600px){.ul-websurvey-frame-mobile.long-form-survey>.ul-websurvey-sidebar-mobile{padding-top:0}.ul-card-list-container--longform .ul-card-scroll-wrapper:last-child{padding-bottom:80px}.ul-card-list-container--longform:has(.ul-card-scroll-wrapper:nth-child(2)){padding-block-start:80px;padding-block-end:40px}}.ul-card-scroll-wrapper{width:100%;max-width:100vw;position:relative;display:flex;justify-content:center;flex:1 0 auto}.ul-card--unfocused{opacity:.3;transition:opacity .3s ease-in-out}.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:#00000003;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:#fff}.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}.ul-card--likert__numbers>button{padding:unset}.likert-number--mobile{border:2px solid #e6e6e6}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-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:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-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;background:unset;border:unset}.likert-smiley--mobile:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px;background:unset;border:unset}.likert-smiley>svg{margin:0 auto}.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{margin-left:auto;flex:1 1 auto;min-width:0;text-align:right}.ul-card--matrix_grid{display:grid;grid-template-columns:max-content repeat(var(--numColumns),minmax(107px,1fr));grid-template-rows:repeat(var(--numRows),min-content);margin:0 auto;row-gap:4px;width:max-content}.ul-card--matrix_grid_longform{width:100%}.ul-matrix-row-options{display:grid;grid-column:2/-1;grid-template-columns:subgrid}.ul-matrix-column-label{font-size:15px;max-width:150px;padding:10px 12px;text-align:center}.ul-card--matrix_container{margin-bottom:16px;overflow:auto}.ul-card--matrix_question_container{display:flex;flex-direction:column}.ul-matrix-scroll-gradient{-webkit-mask-image:linear-gradient(90deg,#000 90%,transparent);mask-image:linear-gradient(90deg,#000 90%,transparent)}.ul-matrix-scroll-gradient:dir(rtl){-webkit-mask-image:linear-gradient(270deg,#000,90%,transparent);mask-image:linear-gradient(270deg,#000,90%,transparent)}.ul-matrix-scroll-gradient:dir(rtl)+.ul-matrix-scroll-arrow{rotate:180deg}.ul-matrix-scroll-arrow{align-self:flex-end;background:none;border:none;color:#000;padding:0;position:absolute;top:45%}.ul-matrix-scroll-arrow:hover{cursor:pointer}.ul-matrix-option-wrapper{align-items:center;background:#f9f9f8;display:flex;justify-content:center;padding:10px 12px}.ul-matrix-last-option{border-start-end-radius:4px;border-end-end-radius:4px}.ul-matrix-row-label{align-items:center;background:#f9f9f8;border-end-start-radius:4px;border-start-start-radius:4px;display:flex;font-size:15px;left:0;right:0;max-width:200px;min-width:100px;padding:10px 12px;position:sticky}.ul-matrix-option-selected{border:6px solid var(--border);box-shadow:none}.ul-card__matrix{max-width:100%}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.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}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-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;padding:unset}.nps-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.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-rank__labels{font-size:14px;font-style:normal;font-weight:600;line-height:150%;text-align:left}.ul-card-rank__list{list-style-type:none;padding-inline-start:0;margin:4px 0}.ul-card-rank__option{display:flex;align-items:center;padding:8px;gap:8px;align-self:stretch;border:1px solid #e2e3e1;border-radius:8px;margin-bottom:4px;background:#fff}.ul-card-rank__option:last-child{margin-bottom:0}.ul-card-rank__drag-btn{display:inline-flex;align-items:center;justify-content:center;line-height:0;padding:0;width:25px;height:25px;margin-left:auto;color:#0b2330;cursor:grab;background:transparent;border:0}.ul-card-rank__drag-btn:active,.ul-card-rank__option:active{cursor:grabbing}.ul-card-rank__option svg{display:block}.ul-card-rank__option.is-dragging{opacity:1;box-shadow:0 8px 25px #00000026,0 3px 10px #0000001a;z-index:1000;background:#fff;border-color:#0b2330;transition:none}.ul-card-rank__option.is-drop-target{background:#0b23301a;border-radius:8px;border-color:#0b23301a}.ul-card-rank__option.is-drop-target select,.ul-card-rank__option.is-drop-target span,.ul-card-rank__option.is-drop-target button{visibility:hidden}.ul-card-rank__option span{font-size:14px;font-weight:400;pointer-events:none}.ul-card-rank__select{appearance:none;-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;height:25px;min-height:25px;border:1px solid #E2E3E1;border-radius:4px;font-size:14px;line-height:1.4;padding:2px 28px 2px 8px;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='13' viewBox='0 0 12 13' fill='none'><path d='M9.75 5L6 8.75L2.25 5' stroke='%230B2330' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 8px center;background-size:12px 12px;background-color:#fff;cursor:pointer;pointer-events:auto}.ul-card-rank__select.ul-card-rank__select--placeholder{color:#b0b5b7}.ul-card-text{margin-top:2px;margin-bottom:3px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.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:#00000003;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:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card-text__input__loading{background-image:linear-gradient(70deg,#e2e3e1,#f9f9f8,#e2e3e1);background-size:200% 100%;animation:shimmer 2s infinite linear}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:-webkit-fill-available}#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:#fff;border-radius:5px;text-align:start;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:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#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:15px;justify-content:center;flex-direction:column}.select-button{align-items:center;background-color:transparent;border-radius:8px;border:1px solid #0b2330;box-shadow:0 0 0 2px #c8cccc;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:16px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.ul-card--maxdiff__question-inner-container{display:grid;grid-template-columns:1fr 2.5fr 1fr;grid-template-rows:repeat(3,minmax(40px,auto));grid-gap:6px;align-items:center}@media (max-width: 600px){.ul-card-maxdiff__labels-row{column-gap:30%}}.ul-card-maxdiff__label{font-weight:600;text-align:center;margin:auto;flex:1;padding:8px;overflow:auto;overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto}.ul-card-maxdiff__label-spacer{flex:6}.ul-card-maxdiff .ul-question{text-align:center}.ul-card-maxdiff__option-row{display:flex;justify-content:space-between;margin-bottom:8px;padding:0 24px}.ul-card-maxdiff__option-label{flex:6;align-self:center;padding:12px;text-align:center;max-width:100%;overflow-wrap:anywhere;-webkit-hyphens:auto;hyphens:auto}.ul-card-maxdiff__option-control.smiley{display:flex;justify-content:center;align-items:center;min-width:86px;flex:1;padding:12px;border-radius:none;border:none;background:none;cursor:pointer}.ul-card-maxdiff__option-control .choice-label-container{justify-content:center}.ul-card-maxdiff p.ul-caption{text-align:center}.ul-card-maxdiff .question-header-button-container{display:flex;justify-content:center}.ul-card-maxdiff__option-selected{border-radius:100px}.ul-card-maxdiff__option-selected.good{background:#90ee90}.ul-card-maxdiff__option-selected.bad{background:#f08080}.ul-card-maxdiff__option-btn{width:42px;height:42px;justify-content:center;align-items:center}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}form{margin-block-end:0;margin-block-start:0}#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;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;margin-top:auto;flex-grow:0;width:100%;min-height:10px;height:fit-content;flex-shrink:0}.ul-footer>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:#00000003;border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:12px;margin-bottom:15px;padding:12px;text-align:initial;width:280px}.ul-footer .thank-you-card-link:hover{background:#00000008}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:#f9c600;border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%;height:0}.close-btn{position:absolute;top:8px;right:8px;cursor:pointer;height:16px;width:16px;z-index:2}.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}.ul-progress-bar-container__footer{max-width:250px;margin:16px 0}.ul-progress-bar-container__header{position:fixed;top:80px;max-width:unset;margin:0;z-index:3}.ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{align-self:stretch;background:#00000003;border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:0;height:fit-content;line-height:16.5px;margin:0 20px;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}`}),e.customStyles&&V.setSurveyStyles({document:c,elementId:"ul-custom-style",styleString:e.customStyles,nonce:e.styleNonce}),e.fontFamily&&a&&parent){const p=c.createElement("link");p.rel="stylesheet",p.href=a,b.appendChild(p)}if(!h&&e.cards.some(p=>p.type==="recordedtask")){const p=c.createElement("script");p.src=e.upchunkLibraryURL??"https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",p.onload=()=>{ke.setUpChunk(d.UpChunk)},p.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},b.appendChild(p)}const A=i||((L=s.eventEmitter)==null?void 0:L.emit);A==null||A("verify.view.version",{"view.version":"2.42.1"}),u&&t&&(He&&Se(u),ne(k(Bn,{}),u),He=!0,j.eventEmitter.once(j.SprigEvent.SurveyClosed,()=>{Se(u),He=!1}))}},Zn=Object.freeze(Object.defineProperty({__proto__:null,default:Qn},Symbol.toStringTag,{value:"Module"}));exports.Accordion=Tn,exports.Arrow=ot,exports.F=K,exports.F$1=Ge,exports.MaxDiffChoice=Tr,exports.SprigBrandLogo=Wr,exports.SvgCaret=Fr,exports.SvgCheckmark=zr,exports.T=ce,exports.ThankYouLink=Qr,exports._=Q,exports.buildMarketingUrl=Zr,exports.buildReadableResponseMap=Gr,exports.buildResponsesArrayForDisplayLogic=({storeAllResponses:e,cards:t,cardValues:r,cardIndexByName:n})=>{const o=e?[...e]:[];if(n===void 0)return o;for(const i of t){const a=n[i.name];if(typeof a!="number")continue;const s=r[i.name];(s==null?void 0:s.value)!==void 0&&(o[a]=Pr(i,s.value))}return o},exports.cc=xe,exports.create=Or,exports.g=D,exports.getButtonText=e=>(e==null?void 0:e.buttonText)||"Next",exports.getClasses=Br,exports.getProcessedQuestionText=e=>{var t;return We(e)&&((t=e.props.properties)!=null&&t.questionHtml)&&typeof e.props.properties.questionHtml=="string"?e.props.properties.questionHtml.replace(/<[^>]*>/g,"").trim():e.props&&"message"in e.props&&typeof e.props.message=="string"?e.props.message.trim():e.props&&"questionHtml"in e.props&&typeof e.props.questionHtml=="string"?e.props.questionHtml.replace(/<[^>]*>/g,"").trim():""},exports.getSkipButtonText=e=>(e==null?void 0:e.skipButtonText)||"Skip",exports.h=G,exports.p=q,exports.pipeReadableResponsesIntoCards=(e,t)=>e.map(r=>{if(!We(r)||r.props.properties===void 0||r.props.properties===null)return r;const n=r.props.properties;if(n===null||typeof n!="object"||!Dt.some(a=>a in n))return r;let o=!1;const i={};for(const a of Dt){const s=n[a];if(s!==void 0){const l=Mn(s,t);i[a]=l,l!==s&&(o=!0)}}return o?{...r,props:{...r.props,properties:{...n,...i}}}:r}),exports.q=Je,exports.someDisplayLogicOptionMatches=nt,exports.u=k,exports.useConfig=z,exports.useSetAllResponsesRaw=e=>{const t=Q(),{setAllResponsesRaw:r}=z(n=>({setAllResponsesRaw:n.setAllResponsesRaw}));q(()=>{const n=t.current;(!n||Object.keys(e).length!==Object.keys(n).length||Object.keys(e).some(o=>e[o]!==n[o]))&&(r(e),t.current=e)},[e,r])},exports.view=Zn,exports.wn=Nr,exports.y=ie;
|