@sprig-technologies/sprig-browser 2.44.0 → 2.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{conversational-ui-Cai2CXxq.js → conversational-ui-BfsT6E2d.js} +281 -285
- package/dist/{conversational-ui-uecC--rF.cjs → conversational-ui-CeWXVRdC.cjs} +1 -1
- package/dist/conversational-v2-styles-BuQiqTAN.js +4 -0
- package/dist/conversational-v2-styles-C-AtgFtc.cjs +1 -0
- package/dist/{core-CgFFOhiH.cjs → core-DSREyRo8.cjs} +2 -2
- package/dist/{core-CWHAsU-S.js → core-YTxB8B8q.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +22 -8
- package/dist/core.js +2 -2
- package/dist/index-BH1V9tx5.js +760 -0
- package/dist/index-Cuw5vpuY.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +22 -8
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-Bg5aC8mO.js → metricsReporter-0HbKrvkx.js} +1 -1
- package/dist/{metricsReporter-BGIzo9eh.cjs → metricsReporter-CIbUupJP.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/{videoPlayer-ChSRlzGk.js → videoPlayer-HNloD0SJ.js} +184 -184
- package/dist/{videoPlayer-B4YqaVpY.cjs → videoPlayer-ocnoABDk.cjs} +4 -4
- package/dist/view-BxTV1_m-.cjs +1 -0
- package/dist/{view-MpYHLeMt.js → view-CDrJuRMn.js} +689 -680
- package/package.json +1 -1
- package/dist/conversational-v2-styles-BTm-8rVB.cjs +0 -1
- package/dist/conversational-v2-styles-Bj3dBWvf.js +0 -4
- package/dist/index-CbagEkvN.js +0 -754
- package/dist/index-D2nvY-Yh.cjs +0 -1
- package/dist/view-5xam8eBF.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-5xam8eBF.cjs"),v=require("./videoPlayer-B4YqaVpY.cjs"),j=require("./core-CgFFOhiH.cjs"),me=require("./metricsReporter-BGIzo9eh.cjs"),_e=({properties:t,surveyVideoUrl:i,questionId:r})=>{const n=`ul-card-video__question_player-q${r}`,{apiURL:s,viewDocument:a}=e.useConfig(l=>({apiURL:l.apiURL,viewDocument:l.viewDocument}));return e.u("div",{id:n,ref:l=>{if(l&&l.children.length===0&&!t.properties.hideRecordedPrompt){const d=v.videoPlayer(n,{src:i,type:"application/x-mpegURL"},void 0,t.properties.mediaType===v.RECORDER.MEDIA_TYPE_AUDIO,s,a);l.appendChild(d)}}})},z=({isDisabled:t,onClick:i,children:r})=>e.u(v.Button,{className:"ul-card__button-checkmark",disabled:t,onClick:i,type:"button",children:[e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),r||"Ok"]}),Re=({className:t,next:i,properties:r,questionId:n,type:s})=>{const{useMobileStyling:a,border:l}=e.useConfig(R=>({useMobileStyling:R.useMobileStyling,border:R.border})),[d,c]=e.h(!1),[y,f]=e.h(""),[o,g]=e.h(!1),x=r==null?void 0:r.collectName,k=(r==null?void 0:r.nameLabelText)||"Full Name",h=(r==null?void 0:r.consentText)||"I agree to the stated conditions",T=(r==null?void 0:r.submitButtonText)||"Submit",N=!!y.trim(),B=d&&(!x||N),M=(R,A=!1)=>{R.preventDefault(),R.stopPropagation();let O=null;if(!A){if(!B)return void g(!0);O={submitted:!0},x&&(O.name=y)}i({value:O,questionId:n,type:s},!!A||B)};return e.u("div",{className:e.cc(t,"ul-card__consent-legal","fade-in-transition"),children:e.u(v.MobileEmbedView,{embeddedType:"pdf",properties:r,children:e.u(v.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(v.Option,{allowTextEntry:!1,border:l,error:o&&!d,id:"consent",isRadio:!1,isSelected:d,label:h,onUserInputChanged:({selected:R})=>{R!==d&&c(!d)},useMobileStyling:a}),x&&e.u("input",{"aria-label":k,"aria-placeholder":k,className:e.cc(e.getClasses("ul-consent-legal__name-input",a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:R=>{R.currentTarget.style.borderColor=o&&!N?j.ERROR_BORDER_COLOR:j.DEFAULT_BORDER_COLOR},onFocus:R=>{R.currentTarget.style.borderColor=o&&!N?j.ERROR_BORDER_COLOR:l},onInput:R=>{R.preventDefault(),R.stopPropagation(),f(R.currentTarget.value)},placeholder:k,style:o&&!N?{borderColor:j.ERROR_BORDER_COLOR}:{},tabIndex:0,value:y})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(z,{isDisabled:!B,onClick:R=>M(new SubmitEvent(R.type)),children:e.getButtonText({buttonText:T})}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:R=>M(new SubmitEvent(R.type),!0),children:e.getSkipButtonText(r)})]})]})})},n)},Ne=()=>{const{destroy:t,forceBrandedLogo:i}=e.useConfig(r=>({destroy:r.destroy,forceBrandedLogo:r.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{t(j.APP_ID)},i?4e3:2e3)},[t,i]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},De=({activeValue:t,border:i,icon:r,enableCspTrustedTypes:n,isPressed:s,range:a,scaleLabelType:l,selectedValue:d,setSelectedValue:c,setActiveValue:y,setIsPressed:f,useMobileStyling:o,value:g,viewDocument:x})=>{const k=`option-${g}`,h=l==="number",T=l==="star",N=l==="smiley",B=h&&g===t||g===d,[M,R]=(()=>{const u=T&&d!==null&&g<=d;return T&&g<=t||N&&g===t||u||g===t||g===d?[i,s||u||g===d?1:.3]:["",1]})(),A=e.F(()=>{const u={borderColor:B?M:"",fillOpacity:B?"":R,zIndex:B?3:"auto",color:d===g?"#fff":""};return h?{...u,backgroundColor:d===g?M:""}:{...u,color:T||N||d===g?M:""}},[B,M,R,d,g,h,T,N]),O=e.F(()=>j.getHtml((({icon:u,scaleLabelType:p,value:C,selectedValue:m})=>{if(p==="smiley"&&C===m){let b=0;return u.replace(/black/g,()=>++b==1?"black":"white")}return u})({icon:r,scaleLabelType:l,value:g,selectedValue:d}),n),[n,r,l,d,g]);return e.u("button",{"aria-label":h?void 0:String(g),className:(()=>{switch(l){case"star":return e.cc(e.getClasses("likert-star",o),e.getClasses(`likert-star-${g}`,o));case"smiley":return e.cc(e.getClasses("likert-smiley",o),e.getClasses(`likert-smiley-${g}`,o));default:return g===a?e.cc(e.getClasses("likert-number",o),e.getClasses(`likert-number-${g}`,o),e.getClasses("likert-last-option",o)):e.cc(e.getClasses("likert-number",o),e.getClasses(`likert-number-${g}`,o))}})(),dangerouslySetInnerHTML:{__html:O},id:k,onClick:u=>{u.preventDefault(),u.stopPropagation(),c(g)},onKeyDown:u=>{var m,b;const p=x.querySelectorAll(`.likert-${l??"number"}`),C=g-1;u.key==="ArrowRight"?(m=p[C+1])==null||m.focus():u.key==="ArrowLeft"?(b=p[C-1])==null||b.focus():u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),u.stopPropagation(),c(g))},onPointerDown:()=>f(!0),onPointerEnter:()=>y(g),onPointerLeave:()=>{y(-1),f(!1)},style:A,tabIndex:0})},Ie=({className:t,labels:i,next:r,properties:n,questionId:s,type:a})=>{const{border:l,useMobileStyling:d,viewDocument:c,enableCspTrustedTypes:y}=e.useConfig(p=>({border:p.border,useMobileStyling:p.useMobileStyling,viewDocument:p.viewDocument,enableCspTrustedTypes:p.enableCspTrustedTypes})),[f,o]=e.h(-1),[g,x]=e.h(!1),[k,h]=e.h(null),T=i&&i.left,N=i&&i.right;let B;const{range:M,scaleLabelType:R,ratingIcons:A}=n;M&&(B=Number(M));const O=B||5,u=p=>{var C,m;switch(R){case"star":return(C=A[0])==null?void 0:C.svg;case"smiley":return(m=A[p])==null?void 0:m.svg;default:return String(p+1)}};return e.u("form",{className:e.cc(t,"ul-card--likert","fade-in-transition"),children:e.u(v.MobileEmbedView,{properties:n,children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${O})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(O)].map((p,C)=>{const m=C+1;return e.u(De,{activeValue:f,border:l,enableCspTrustedTypes:y,icon:u(C),isPressed:g,range:O,scaleLabelType:R,selectedValue:k,setActiveValue:o,setIsPressed:x,setSelectedValue:h,useMobileStyling:d,value:m,viewDocument:c},C)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:T}),e.u("span",{children:N})]})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:k===null&&n.required,onClick:()=>r({value:k,questionId:s,type:a},!0),children:e.getButtonText(n)})})]})},s)},we=({columns:t,onSelect:i,options:r,selectedOptions:n})=>{const s=e._([]),{border:a,useMobileStyling:l}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling})),d=r.findIndex(g=>n[g.id]===null),[c,y]=e.h(d),f=e.T((g,x)=>{i(g,x);const k=c+1,h=r[k];h&&n[h.id]===null&&y(k)},[i,r,n,c]),o=e.T((g,x)=>{const k=c===g;return e.u(e.Accordion,{animate:!0,header:x.label,isOpen:k,onClick:()=>{var h;return y(k&&!((h=window.UserLeap)!=null&&h.isMobileSDK)?-1:g)},ref:h=>{h&&(s.current[g]=h)},showHeaderCheck:n[x.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:t.map(h=>e.u(v.Option,{allowTextEntry:!1,ariaLabel:`${x.label}-${h.label}`,border:a,error:!1,id:`${x.id}-${h.value}`,isRadio:!0,isSelected:n[x.id]===h.value,label:h.label,onUserInputChanged:()=>f(x.id,h.value),useMobileStyling:l},h.label))})},x.id)},[a,t,c,f,n,l]);return e.u("div",{children:r.map((g,x)=>o(x,g))})},Ee=({className:t,next:i,options:r,properties:n,questionId:s,type:a,onSubmitButtonClick:l})=>{const d=n.matrixColumn,c=n.required,y=k=>{k.preventDefault(),k.stopPropagation(),i({value:o,questionId:s,type:a},!0),l&&l()},f=r.reduce((k,h)=>(k[h.id]=null,k),{}),[o,g]=e.h(f);return e.u("form",{className:e.cc(t,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:y,children:e.u(v.MobileEmbedView,{properties:n,children:[e.u(v.QuestionBodyWrapper,{children:e.u(we,{columns:d,onSelect:(k,h)=>{g(T=>({...T,[k]:h}))},options:r,selectedOptions:o})}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:(x=o,c&&Object.values(x).every(k=>k==null)),onClick:()=>y(new SubmitEvent("submit")),children:e.getButtonText(n)})})]})},s);var x},ge=({className:t,onSubmit:i,options:r=[],properties:n,questionId:s,type:a,showIndividualSubmit:l=!1,onSubmitButtonClick:d})=>{const{border:c,useMobileStyling:y}=e.useConfig(m=>({border:m.border,useMobileStyling:m.useMobileStyling})),f=r.reduce((m,b)=>(m[b.id]={isSelected:!1},m),{}),[o,g]=e.h(f),x=a==="multiplechoice",k=n.required,h=r.find(m=>{var b;return(b=m.optionProperties)==null?void 0:b.noneOfTheAbove}),T=m=>Object.entries(m).some(([b,D])=>{var Q;const I=r.find($=>`${$.id}`===b),P=D.userText===void 0||D.userText.trim()==="";return((Q=I==null?void 0:I.optionProperties)==null?void 0:Q.allowsTextEntry)&&P&&D.isSelected}),N=m=>Object.values(m).filter(b=>b.isSelected).length,B=n.minSelect&&n.minSelect>0&&n.maxSelectMode===e.MaxSelectModes.Range&&N(o)<n.minSelect&&(k||N(o)>0),M=m=>T(m)||k&&!N(m)||!(b=>{const{minSelect:D=0,maxSelect:I=1/0,maxSelectMode:P}=n,Q=N(b);switch(P){case e.MaxSelectModes.Maximum:return Q<=I;case e.MaxSelectModes.Range:return Q===0||Q>=D;default:return!0}})(m),R=Object.entries(o).some(([m,b])=>{var D,I;return b.isSelected&&((I=(D=r.find(P=>`${P.id}`===m))==null?void 0:D.optionProperties)==null?void 0:I.allowsTextEntry)}),A=l&&(!x||R),O=m=>{C(m.id,m.selected,m.userText,m.noneOfTheAbove)},u=m=>{var b;return(n==null?void 0:n.maxSelectMode)!==e.MaxSelectModes.Unlimited&&N(o)===(n==null?void 0:n.maxSelect)&&!((b=o[m])!=null&&b.isSelected)},p=()=>{i(o,!0),d&&d()},C=(m,b,D,I)=>{const P=Object.assign({},o);if((x||I)&&b)for(const Q of Object.values(P))Q.isSelected=!1,delete Q.userText;else h&&!I&&o[h.id].isSelected&&(P[h.id].isSelected=!1);P[m]={isSelected:b,userText:D},g(P)};return e.u("form",{className:e.cc(t,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:p,children:e.u(v.MobileEmbedView,{properties:n,children:[e.u(v.QuestionBodyWrapper,{children:[n.isDropdown?e.u(v.Select,{disabledOptions:r.filter(m=>u(m.id)),dropdownFooter:B?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[N(o),"/",n.minSelect]}):void 0,isMultiSelect:!x,multiselectText:n.dropdownMultiselectedText??"choices selected",onChange:m=>{const b={...o};for(const D of r)m.includes(D)?b[D.id].isSelected=!0:b[D.id].isSelected=!1;g(b)},options:r,placeholderText:n.dropdownPlaceholderText??(x?"Select choice":"Select choice(s)"),value:r.filter(m=>o[m.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",y)),role:x?"radiogroup":"group",children:[r.map(({id:m,label:b,value:D,optionProperties:I})=>{var H,G;const P=`${m}`,{allowsTextEntry:Q,noneOfTheAbove:$}={allowsTextEntry:!1,noneOfTheAbove:!1,...I};return e.u(v.Option,{allowTextEntry:Q,border:c,disabled:u(P),error:(F=o,T(F)),id:P,isRadio:x,isSelected:!!((H=o[P])!=null&&H.isSelected),label:b,noneOfTheAbove:$,onUserInputChanged:O,promptText:(I==null?void 0:I.otherOptionPlaceholder)||"Please specify",text:(G=o[m])==null?void 0:G.userText,useMobileStyling:y,value:D},P);var F}),!!B&&e.u("div",{className:"ul-card__min-select-counter",children:[N(o),"/",n.minSelect]})]}),A&&e.u(v.LongformSubmitButton,{handleSubmit:p,isSubmitDisabled:M(o)})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:M(o),onClick:p,children:e.getButtonText(n)})})]})},s)},Be=t=>{const{questionId:i,type:r,next:n,options:s}=t;return e.u(ge,{...t,onSubmit:(a,l)=>{const d=Object.entries(a).find(([,g])=>g.isSelected)||[void 0,void 0],[c,y]=d,f=s.find(g=>`${g.id}`===c),o=y!=null&&y.userText?{[c]:{userText:y.userText}}:null;n({value:f&&c?{[c]:f.value}:{},secondaryValue:o,questionId:i,type:r},l)}})},Pe=t=>{const{questionId:i,type:r,next:n}=t;return e.u(ge,{...t,onSubmit:(s,a)=>{const l=Object.entries(s).reduce((c,[y,f])=>(c[y]=f.isSelected,c),{}),d=Object.entries(s).reduce((c,[y,f])=>{if(!f.userText)return c;const o=c||{};return o[y]={userText:f.userText},o},null);n({value:l,secondaryValue:d,questionId:i,type:r},a)}})},qe=({className:t,labels:i,properties:r,next:n,questionId:s,type:a})=>{const[l,d]=e.h(null),{border:c,useMobileStyling:y,viewDocument:f}=e.useConfig(x=>({border:x.border,useMobileStyling:x.useMobileStyling,viewDocument:x.viewDocument})),o=i&&i.left,g=i&&i.right;return e.u("form",{className:e.cc(t,"ul-card--nps","fade-in-transition"),children:e.u(v.MobileEmbedView,{properties:r,children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((x,k)=>e.u("button",{className:e.cc(e.getClasses("nps-number",y),e.getClasses(`nps-number-${k}`,y)),id:`option-${k}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),d(k)},onKeyDown:h=>{var N,B;const T=f.querySelectorAll("button.nps-number");h.key==="ArrowRight"?(N=T[k+1])==null||N.focus():h.key==="ArrowLeft"?(B=T[k-1])==null||B.focus():h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),h.stopPropagation(),d(k))},onPointerDown:h=>{h.currentTarget.style.zIndex="2",h.currentTarget.style.borderColor=c},onPointerLeave:h=>{h.currentTarget.style.zIndex="auto",h.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},style:l===k?{backgroundColor:c,color:"#fff"}:void 0,tabIndex:0,children:k},k))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:o}),e.u("span",{children:g})]})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:l===null&&r.required,onClick:()=>n({value:l,questionId:s,type:a},!0),children:e.getButtonText(r)})})]})},s)},Le=({className:t,next:i,properties:r,questionId:n,type:s,onSubmitButtonClick:a})=>{const{border:l,useMobileStyling:d,update:c}=e.useConfig(T=>({border:T.border,useMobileStyling:T.useMobileStyling,update:T.update})),[y,f]=e.h(""),o=e._(null),g=y.trim(),x=r.required===!0&&!g,k=v.useAutoSize(o,()=>c()),h=r&&r.openTextPlaceholder?r.openTextPlaceholder:"";return e.u("form",{className:e.cc(t,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(v.MobileEmbedView,{properties:r,children:e.u("div",{className:"ul-card-text",children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":h,className:e.cc(e.getClasses("ul-card-text__input",d)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:T=>{T.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},onChange:T=>{const{value:N}=T.currentTarget;k(),T.preventDefault(),T.stopPropagation(),f(N)},onFocus:T=>{T.currentTarget.style.borderColor=l},placeholder:h,ref:o,role:"textbox",tabIndex:0})}),r.footerHtml&&e.u(v.Html,{className:"footer",html:r.footerHtml})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:x,onClick:T=>{T.preventDefault(),T.stopPropagation();const N=r.required!==!0||g.length>0;i({value:y,questionId:n,type:s},N),a&&a()},children:e.getButtonText(r)})})]})})},n)},Me=({className:t,labels:i,next:r,properties:n,questionId:s,type:a,onSubmitButtonClick:l,options:d})=>{const c=e._(null),y=e._(0),f=e._(0),o=e._(null),g=e._(!1),x=e._([]),[k,h]=e.h(()=>(n==null?void 0:n.required)===!0),[T,N]=e.h(()=>d.map(S=>({...S,rank:null}))),B=e.F(()=>Array.from({length:d.length},(S,w)=>w+1),[d.length]),{useMobileStyling:M,isPreview:R,headers:A}=e.useConfig(S=>({useMobileStyling:S.useMobileStyling,isPreview:S.isPreview,headers:S.headers})),O=(A==null?void 0:A["userleap-platform"])==="android",u=M&&!R&&!O,p=!u&&!O,C=(S,w)=>{N(E=>{const _=parseInt(w),L=E.map(q=>({...q}));L.some(q=>q.rank==null)&&L.forEach((q,W)=>q.rank=W+1);const V=L.findIndex(q=>q.id===S);if(V===-1)return E;const U=L[V].rank;return _<U?L.forEach(q=>{q.id!==S&&q.rank>=_&&q.rank<U&&(q.rank=q.rank+1)}):_>U&&L.forEach(q=>{q.id!==S&&q.rank>U&&q.rank<=_&&(q.rank=q.rank-1)}),L[V].rank=_,L.sort((q,W)=>q.rank-W.rank),$(),L})},m=(S,w)=>{for(let E=0;E<x.current.length;E++){const _=x.current[E];if(!_||_===o.current)continue;const L=_.getBoundingClientRect();if(S>=L.left&&S<=L.right&&w>=L.top&&w<=L.bottom)return{element:_,index:E}}return null},b=S=>w=>{if(!u)return;w.preventDefault(),w.stopPropagation(),g.current=!0,c.current=S;const E=w.touches[0];y.current=E.clientY,f.current=E.clientY;const _=w.currentTarget.closest(".ul-card-rank__option");_&&(o.current=_,_.classList.add("is-dragging"))},D=S=>{if(!u||!g.current||c.current===null)return;S.preventDefault(),S.stopPropagation();const w=S.touches[0];f.current=w.clientY;const E=f.current-y.current;o.current&&(o.current.style.transform=`translateY(${E}px)`,o.current.style.zIndex="1000"),x.current.forEach(L=>{L&&L!==o.current&&L.classList.remove("is-drop-target")});const _=m(w.clientX,w.clientY);_&&_.element.classList.add("is-drop-target")},I=S=>{if(!u||!g.current||c.current===null)return;S.preventDefault(),S.stopPropagation();const w=S.changedTouches[0],E=m(w.clientX,w.clientY);o.current&&(o.current.style.transform="",o.current.style.zIndex="",o.current.classList.remove("is-dragging")),x.current.forEach(_=>{_&&_.classList.remove("is-drop-target")}),E&&E.index!==c.current&&P(c.current,E.index),c.current=null,o.current=null,g.current=!1},P=(S,w)=>{N(E=>{const _=E.map(V=>({...V})),[L]=_.splice(S,1);return _.splice(w,0,L),_.forEach((V,U)=>{V.rank=U+1}),$(),_})},Q=S=>{const w={};S.reduce((E,_)=>(E[_.id]=_.rank,E),w),r({value:w,questionId:s,type:a},!0)},$=()=>{h(!1)},{left:F,right:H}=i,G=d.length,X=S=>{S.preventDefault(),S.currentTarget.classList.add("is-drop-target")},Se=S=>{S.currentTarget.classList.remove("is-drop-target")},Te=S=>{c.current=null,S.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(t,"ul-card-rank","fade-in-transition"),onSubmit:S=>{S.preventDefault(),Q(T),l&&l()},children:e.u(v.MobileEmbedView,{properties:n,children:O?e.u(e.g,{children:[e.u(v.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",F]})}),e.u("ol",{className:"ul-card-rank__list",children:T.map(({id:S,label:w,rank:E})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${w}`,className:e.cc("ul-card-rank__select",E==null&&"ul-card-rank__select--placeholder"),name:`rank[${S}]`,onChange:_=>C(S,_.currentTarget.value),value:E??"",children:[E==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),B.map(_=>e.u("option",{className:"ul-card-rank__select-option",value:_,children:_},`${_}-${s}`))]}),e.u("span",{children:w})]},S))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[G," - ",H]})})]})}),e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:k,children:e.getButtonText(n)})})})]}):e.u(e.g,{children:[e.u(v.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",F]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:O?void 0:S=>{S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="move")},children:T.map(({id:S,label:w,rank:E},_)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!p||void 0,onDragEnd:p?Te:void 0,onDragEnter:p?X:void 0,onDragLeave:p?Se:void 0,onDragStart:p?(V=_,U=>{c.current=V,U.dataTransfer&&(U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",String(V)),U.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:p?(L=_,U=>{var W,le;U.preventDefault(),U.currentTarget.classList.remove("is-drop-target");const q=c.current;c.current=null,(le=(W=U.currentTarget.closest(".ul-card-rank__list"))==null?void 0:W.querySelector(".is-dragging"))==null||le.classList.remove("is-dragging"),q!=null&&q!==L&&P(q,L)}):void 0,ref:U=>x.current[_]=U,children:[e.u("select",{"aria-label":`Rank for ${w}`,className:e.cc("ul-card-rank__select",E==null&&"ul-card-rank__select--placeholder"),name:`rank[${S}]`,onChange:U=>C(S,U.currentTarget.value),value:E??"",children:[E==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),B.map(U=>e.u("option",{className:"ul-card-rank__select-option",value:U,children:U},U))]}),e.u("span",{children:w}),!O&&e.u("button",{"aria-label":`Drag ${w} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:u?I:void 0,onTouchMove:u?D:void 0,onTouchStart:u?b(_):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z",fill:"currentColor"})})})]},S);var L,V})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[G," - ",H]})})]})}),e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:k,children:e.getButtonText(n)})})})]})})},s)},ne=1,he=2,ve=3,J=t=>t.type==="av_permission",ue=t=>t.type==="screen_permission",be=(t,i)=>t===void 0?ne:t?((r,n)=>!(J(n)?n.permissionDescriptors:[]).includes("camera")||r.getVideoTracks().length>0)(t,i)?ve:ne:he,ce={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},Z=e.create(t=>({...ce,reset:()=>{t(ce)},updatePage:i=>{t(i)}}));function ie({currentPage:t,pages:i}){const{avStream:r,recordingMediaTypes:n,updatePage:s}=Z.getState(),{recorderEventEmitter:a}=e.useConfig.getState();a.emit("av.permission",{"permission.descriptors":t.permissionDescriptors,"stream.ready":(l,d)=>{if(r===l)return;let c=t;if(l&&!t.permissionDescriptors.includes("camera")){const y=i.indexOf(t),f=d!=null&&d.active?y+2:y+1;d!=null&&d.active&&n&&a.emit("begin.recording",{"recording.media.types":n,"start.recording.callback":o=>s({mediaRecordingUids:o})}),c=i[f]}s({currentPage:c,avStream:l})}})}function se({status:t}){const{nextQuestion:i,passthroughData:r,mediaRecordingUids:n,reset:s}=Z.getState(),{recorderEventEmitter:a,handleUploadUpdate:l,index:d}=e.useConfig.getState(),c={value:{taskStatus:t},type:"recordedtask",questionId:(r==null?void 0:r.questionId)||1};r&&a.emit("finish.task",{"begin.callback":y=>{l({mediaRecordingUid:y,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(y,f)=>{l({mediaRecordingUid:y,progressPct:f.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":y=>{y&&l({mediaRecordingUid:y,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":r,"current.index":d,"task.response":c,"task.complete.callback":y=>{c.value.taskDurationMillisecond=y,n&&(c.value.mediaRecordingUids=n),s(),i(c)}})}function ae({pages:t,setIsRequestingPermission:i}){const{recorderEventEmitter:r,eventEmitFn:n}=e.useConfig.getState(),{updatePage:s,currentPage:a,recordingMediaTypes:l,screenPermissionRequested:d}=Z.getState();if(!a)return;const c=t.indexOf(a);switch(a.type){case"av_permission":{const y=d?c+2:c+1;return d&&l&&r.emit("begin.recording",{"recording.media.types":l,"start.recording.callback":f=>{s({mediaRecordingUids:f})}}),void s({currentPage:t[y]})}case"screen_permission":return void r.emit("screen.permission",{"screen.permission.requested":i,"stream.ready.callback":(y,f)=>{const o=f?t[c+1]:a;f&&l&&r.emit("begin.recording",{"recording.media.types":l,"start.recording.callback":g=>{s({captureStream:f,mediaRecordingUids:g})}}),s({currentPage:o,screenPermissionRequested:!0,captureStream:f})}});case"start_task":return n("recorded.task.start"),r.emit("recorded.task.start"),r.emit("start.task"),void s({currentPage:t[c+1],screenPermissionRequested:!0});case"complete_task":return}}const ye="ul-permission-graphics-container",fe="ul-permission-body",Ce=e.cc(ye,"ul_recorded-task-inset-spacing"),ee=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),ke=({richTextBody:t})=>e.u(v.Html,{className:"ul-rich-text-body",html:t,id:"ul-task-detail-container"}),te=({required:t,skipButtonText:i,bottom:r=!1})=>t?null:e.u(v.Button,{className:e.cc(r&&"ul-skip-button-below","ul-button-inactive"),onClick:se.bind(null,{status:"abandoned"}),children:i||"Skip"}),oe=t=>{const{avStream:i,captureStream:r,recordingMediaTypes:n,updatePage:s}=Z.getState(),a=(n==null?void 0:n.includes("audio"))||(n==null?void 0:n.includes("video"));e.p(()=>{const l=setInterval(()=>{a&&i&&!i.active?s({avStream:null,currentPage:t[0]}):r&&r.active||s({captureStream:void 0,currentPage:t[a?1:0]})},1e3);return()=>clearInterval(l)},[i,r,a,t,n,s])},Oe=({content:t,pages:i,required:r})=>{const{buttonText:n,skipButtonText:s,taskDetail:a}=t;return oe(i),e.u("div",{className:"ul-task-page",children:[a&&e.u(ke,{richTextBody:a}),e.u("div",{className:ee,children:[e.u(v.Button,{onClick:ae.bind(null,{pages:i}),children:n}),e.u(te,{required:r,skipButtonText:s})]})]},"start-task")},Ue=({content:t,pages:i,properties:r})=>{const{buttonText:n,skipButtonText:s}=t;return oe(i),e.u("div",{className:"ul-task-page",children:[t.taskDetail&&e.u(ke,{richTextBody:t.taskDetail}),e.u(v.MobileEmbedView,{properties:r,children:e.u("div",{className:ee,children:[e.u(v.Button,{className:"ul-complete-task-button",onClick:se.bind(null,{status:"completed"}),children:n}),e.u(v.Button,{className:e.cc("ul-button-inactive"),onClick:se.bind(null,{status:"given.up"}),children:s})]})})]},"complete-task")},Ae=({content:t,pages:i,required:r})=>{const{buttonText:n,skipButtonText:s}=t,[a]=e.useConfig(c=>[c.tabTitle]),[l,d]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ce,children:[e.u("p",{style:{marginTop:"auto"},children:t.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:fe,children:a})})]}),e.u("div",{className:r?"":ee,children:[e.u(v.Button,{disabled:l,onClick:ae.bind(null,{pages:i,setIsRequestingPermission:d}),children:n}),e.u(te,{required:r,skipButtonText:s})]})]})},Qe=({content:t})=>e.u(v.Html,{className:e.cc(ye,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:t.svg},"ul-permission-request-graphic"),$e=({content:t,pages:i,required:r})=>{const{permissionDeniedHeadline:n,permissionDeniedBody:s,skipButtonText:a,tryAgainButtonText:l}=t,d=J(i[0])?i[0]:null;return e.p(()=>{const c=setInterval(()=>{d!==null&&ie({currentPage:d,pages:i})},1e3);return()=>clearInterval(c)},[d,i]),d?e.u("div",{children:[e.u("div",{className:Ce,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:n}),e.u("span",{className:fe,children:s})]})}),e.u("div",{className:ee,children:[e.u(v.Button,{onClick:ie.bind(null,{currentPage:d,pages:i}),children:l}),e.u(te,{required:r,skipButtonText:a})]})]}):null},Fe=({stream:t})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:i=>{i&&(i.srcObject=t||null)}}),He=({content:t,pages:i,required:r})=>{const{skipButtonText:n}=t,{avStream:s}=Z.getState();return oe(i),e.u("div",{children:[e.u(Fe,{stream:s}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(v.Button,{onClick:ae.bind(null,{pages:i}),children:t.buttonText}),e.u(te,{bottom:!0,required:r,skipButtonText:n})]})]})},Ve=({properties:t})=>{const{pages:i,required:r}=t,{avStream:n,currentPage:s}=Z.getState();if(s===void 0)return null;switch(s==null?void 0:s.type){case"av_permission":{const a=be(n,s);return a===ne?e.u(Qe,{content:s}):a===he?e.u($e,{content:s,pages:i,required:r}):e.u(He,{content:s,pages:i,required:r})}case"screen_permission":return e.u(Ae,{content:s,pages:i,required:r});case"start_task":return e.u(Oe,{content:s,pages:i,required:r});case"complete_task":return e.u(Ue,{content:s,pages:i,properties:t});default:return null}},Ge=({className:t,properties:i,next:r,questionId:n})=>{const s=e.useConfig(),{surveyId:a,responseGroupUid:l,userId:d}=s,c=Z(),{screenPermissionRequested:y}=c,f=Z(h=>h.avStream);let o=Z(h=>h.currentPage);o||(o=function({pages:h,userId:T,responseGroupUid:N,surveyId:B,questionId:M,next:R}){const{updatePage:A}=Z.getState(),{eventEmitFn:O,recorderEventEmitter:u}=e.useConfig.getState(),p={questionId:M,surveyId:B,visitorId:T,responseGroupUid:N};let C=0;u.emit("recorded.task.permission.screen"),O("recorded.task.permission.screen"),u.emit("permission.status",{"permission.status.callback":(b,D,I,P)=>{const Q=h[C],{type:$}=Q,F=["screen"];if(J(Q)){const{permissionDescriptors:H}=Q,G=H==null?void 0:H.includes("microphone"),X=H==null?void 0:H.includes("camera");G&&F.push("audio"),X&&F.push("video"),(b!=null&&b.active&&!X||b!=null&&b.active&&D)&&C++}ue(h[C])&&I&&(C++,u.emit("begin.recording",{"recording.media.types":F,"start.recording.callback":H=>A({mediaRecordingUids:H})})),A({currentPage:h[C],avStream:b,screenPermissionRequested:I,nextQuestion:R,type:$,passthroughData:p,recordingMediaTypes:F,captureStream:P})}});const m=h[C];return m.type==="av_permission"&&ie({currentPage:m,pages:h}),m}({questionId:n,surveyId:a,next:h=>{r(h,!0)},pages:i.pages,responseGroupUid:l,userId:d}));let g=o.headline,x=o.captionText;const k=be(f,o);return ue(o)&&y&&(g=o.permissionDeniedHeadline,x=o.permissionDeniedCaptionText),J(o)&&k===ve&&(g=o.permissionGrantedHeadline,x=o.permissionGrantedCaptionText),e.u("div",{className:e.cc(t,"ul-center-horizontally","fade-in-transition"),children:[e.u(v.Header,{isRequired:i==null?void 0:i.required,message:g,properties:{captionText:x}}),e.u(v.QuestionBodyWrapper,{children:e.u(Ve,{properties:i})})]})},je=({className:t,next:i,properties:r,questionId:n,type:s})=>{const{visitorAttributes:a,isLongFormSurvey:l}=e.useConfig(f=>({visitorAttributes:f.visitorAttributes,isLongFormSurvey:me.isLongFormSurvey(f.studyType)})),d=(f,o=!1)=>{i({value:o?{skipped:!0}:void 0,questionId:n,type:s},!0)},c=v.getAttributedUrl(r&&r.buttonUrl,a),y=l&&r.promptActionType===e.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(t,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(v.MobileEmbedView,{properties:r,children:!y&&e.u("div",{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:c,id:"ul-card-text__button",onClick:d,onKeyPress:f=>{f.key!=="Enter"&&f.key!==" "||i({value:void 0,questionId:n,type:s},!0)},rel:"noreferrer",role:c?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(r)}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:f=>d(0,!0),children:e.getSkipButtonText(r)})]})})})},n)},Ze=({className:t,questionId:i})=>{const{border:r,destroy:n,endCard:s,forceBrandedLogo:a}=e.useConfig(c=>({border:c.border,destroy:c.destroy,endCard:c.endCard,forceBrandedLogo:c.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{n(j.APP_ID)},a?4e3:2e3)},[n,a]);const l=s&&s.subheader?e.u("p",{className:"ul-caption",children:s.subheader}):null,d=s&&s.headline?s.headline:"";return e.u("div",{className:e.cc(t,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:r,fillRule:"evenodd"}),e.u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:r,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(v.Header,{message:d}),l]})})},i)},ze=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),We=({className:t})=>{const{uploadProgress:i}=e.useConfig(a=>({uploadProgress:a.uploadProgress}));let r,n;Object.values(i).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",n="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",n="Please keep this tab open until your response is fully processed.");const s=Math.round(Math.min(99,...Object.values(i).filter(a=>a.isSubmitted).map(a=>a.progressPct||0)));return e.u("div",{className:e.cc(t,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(v.Header,{message:`${r} (${s}% complete)`}),e.u("p",{className:"ul-caption",children:n})]})},de=0,pe=1,Ye=({className:t,next:i,properties:r,questionId:n,type:s})=>{const a=`ul-card-video__player_recorder-q${n}`,{apiURL:l,envId:d,handleUploadUpdate:c,headers:y,responseGroupUid:f,surveyId:o,viewDocument:g,visitorId:x}=e.useConfig(p=>({apiURL:p.apiURL,envId:p.envId,handleUploadUpdate:p.handleUploadUpdate,headers:p.headers,responseGroupUid:p.responseGroupUid,surveyId:p.surveyId,viewDocument:p.viewDocument,visitorId:p.userId})),[k,h]=e.h(!1),[T,N]=e.h(null),[B,M]=e.h(null),[R,A]=e.h(de),O=(p,C)=>{p===v.RECORDER.UPLOAD_STARTED?(N(C[v.RECORDER.UPLOAD_ID]),M(C[v.RECORDER.MEDIA_RECORDING_UID]),h(!0)):p===v.RECORDER.DELETE?(N(null),M(null),h(!1)):p===v.RECORDER.UPLOAD_PROGRESS?isNaN(C[v.RECORDER.UPLOAD_PROGRESS_PCT])?c({mediaRecordingUid:C[v.RECORDER.MEDIA_RECORDING_UID],isComplete:!0}):c({mediaRecordingUid:C[v.RECORDER.MEDIA_RECORDING_UID],progressPct:C[v.RECORDER.UPLOAD_PROGRESS_PCT]}):p===v.RECORDER.UPLOAD_FINISHED&&c({mediaRecordingUid:C[v.RECORDER.MEDIA_RECORDING_UID],isComplete:!0})},u=p=>{p.preventDefault(),p.stopPropagation(),document.getElementById(a)&&v.stopRecording(a),T&&B?(c({mediaRecordingUid:B,isSubmitted:!0}),i({value:{mediaRecordingUid:B},questionId:n,type:s},!0)):i({value:null,questionId:n,type:s},!0)};return e.u("form",{className:e.cc(t,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",style:{display:R===de?"":"none"},children:e.u(v.MobileEmbedView,{properties:r,children:e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:p=>{p.preventDefault(),p.stopPropagation(),document.getElementById(a)&&v.pauseQuestionPlayer(a),A(pe)}})})}),e.u("div",{style:{display:R===pe?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:p=>{if(p&&p.children.length===0){const C=v.videoRecorderPlayer(a,{surveyId:o,responseGroupUid:f,questionId:n,visitorId:x,envId:d},l,O,void 0,{...y,"x-ul-video-recorder-origin":"sdk"},r.mediaType===v.RECORDER.MEDIA_TYPE_AUDIO,g);p.appendChild(C)}}})})]}),e.u(v.QuestionBodyFooterContainer,{children:[e.u(z,{isDisabled:!!r.required&&!k,onClick:u,children:e.getButtonText(r)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:u,style:{...r.required?{display:"none"}:{},...k?{display:"none"}:{}},children:e.getSkipButtonText(r)})]})]})},K=t=>t.type==="aidynamicfollowup"||t.type==="aidynamicstandalone",re=t=>{var i;return K(t)&&((i=t.props)==null?void 0:i.loading)===e.DynamicQuestionLoadingStates.inFlight},xe=t=>t.type==="thanks"||t.type==="uploading",Ke=({card:t,avatars:i,isThinking:r,isCurrentQuestion:n,currentQuestionBubbleRef:s})=>{const a=(l=>"properties"in l.props&&l.props.properties&&"questionHtml"in l.props.properties&&l.props.properties.questionHtml?{content:l.props.properties.questionHtml,isHtml:!0}:"message"in l.props?{content:l.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(t);return e.u(Y,{avatars:i,isLeft:!0,message:{id:`question-${t.name}`,type:"question",content:a.content},ref:n?s:null,children:r?e.u(ze,{}):e.u(e.g,{children:[a.isHtml?e.u(v.Html,{className:"chat-message-text",html:a.content}):e.u("div",{className:"chat-message-text",children:a.content}),t.type==="videovoice"&&e.u(_e,{properties:t.props,questionId:t.name,surveyVideoUrl:t.props.properties.videoUrl})]})})},Xe=({card:t,avatars:i})=>{const r=(n=>{if(!("properties"in n.props)||!n.props.properties||typeof n.props.properties!="object")return null;const s=n.props.properties,a=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:l,isHtml:d}of a){const c=s[l];if(typeof c!="string")continue;const y=c.trim();if(y){if(d&&!y.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:y,isHtml:d}}}return null})(t);return r?e.u(Y,{avatars:i,hideAvatar:!0,isLeft:!0,message:{id:`caption-${t.name}`,type:"question",content:r.content},children:r.isHtml?e.u(v.Html,{className:"chat-message-text",html:r.content}):e.u("div",{className:"chat-message-text",children:r.content})}):null},Je=({card:t,userResponse:i,avatars:r})=>{const n=((s,a)=>{if(s.type==="open"&&a&&typeof a=="object"&&"value"in a)return a.value})(t,i);return e.u("div",{className:"chat-bubble-container chat-right",children:[e.u("div",{className:"chat-bubble chat-bubble-right chat-bubble-text-only",children:e.u("div",{className:"chat-message-text",children:n||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})},et=({card:t,avatars:i,isCurrentQuestion:r,currentQuestionBubbleRef:n})=>{const{endCard:s}=e.useConfig(a=>({endCard:a.endCard}));return e.u(e.g,{children:[e.u(Y,{avatars:i,isLeft:!0,message:{id:`thanks-${t.name}`,type:"question",content:(s==null?void 0:s.headline)??"Great! Thank you for your participation."},ref:r?n:null}),(s==null?void 0:s.subheader)&&e.u(Y,{avatars:i,hideAvatar:!0,isLeft:!0,message:{id:`caption-${t.name}`,type:"question",content:s.subheader}}),e.u(Ne,{})]})},tt=({card:t,cardIndex:i,index:r,avatars:n,cardResponses:s,questionThinkingStates:a,startingQuestionIdx:l,currentQuestionBubbleRef:d,handleCardResponse:c})=>{const y=i===r,f=i<r,o=xe(t);if(o)return e.u(et,{avatars:n,card:t,currentQuestionBubbleRef:d,isCurrentQuestion:y});const g=`${t.name}`,x=s.get(g),k=t.type==="open",h=a.get(g);if(t.type==="aidynamicfollowup"&&(t.props.loading===e.DynamicQuestionLoadingStates.failure||t.props.loading===void 0)||t.type==="aidynamicstandalone"&&t.props.loading===e.DynamicQuestionLoadingStates.failure)return e.u(e.g,{});const T=(i>(l??0)||K(t))&&t.type!=="thanks"&&t.type!=="uploading"&&(h===!0||h===void 0);return e.u(e.wn.Fragment,{children:[e.u(Ke,{avatars:n,card:t,currentQuestionBubbleRef:d,isCurrentQuestion:y,isThinking:T}),!T&&e.u(Xe,{avatars:n,card:t}),f&&k?e.u(Je,{avatars:n,card:t,userResponse:x}):(!f||!k)&&!T&&e.u(Y,{avatars:n,isLeft:!1,message:{id:`card-${t.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(nt,{card:t,className:o?"chat-thanks-card":"chat-card",isAnswered:f,next:y?c:()=>{}})})})]},`question-card-${t.name}`)},Y=e.wn.forwardRef(({message:t,isLeft:i=!1,children:r,avatars:n,hideAvatar:s=!1},a)=>{const l=i?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${i?"chat-left":"chat-right"}${i&&s?" chat-no-avatar":""}`,ref:a,children:[i&&!s&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${l}`,children:r||e.u("div",{className:"chat-message-text",children:t.content})}),!i&&!s&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x`})]})});Y.displayName="ChatBubble";const rt=()=>{const t=e.useConfig(r=>r.close),i=e.F(()=>()=>t(j.APP_ID),[t]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:i,onKeyPress:r=>{r.key==="Enter"&&i()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})},nt=({card:t,next:i,className:r="",isAnswered:n=!1})=>{const s={className:n?`${r} answered-card`:r,next:n?()=>{}:i,questionId:t.name,type:t.type,isAnswered:n};switch(t.type){case"consentlegal":return e.u(Re,{...s,...t.props});case"likert":return e.u(Ie,{...s,...t.props});case"matrix":return e.u(Ee,{...s,...t.props});case"multiplechoice":return e.u(Be,{...s,...t.props});case"multipleselect":return e.u(Pe,{...s,...t.props});case"nps":return e.u(qe,{...s,...t.props});case"aidynamicstandalone":case"aidynamicfollowup":case"open":return e.u(Le,{...s,type:t.type,...t.props});case"rankorder":return e.u(Me,{...s,...t.props});case"recordedtask":return e.u(Ge,{...s,...t.props});case"texturlprompt":return e.u(je,{...s,...t.props});case"thanks":return e.u(Ze,{...s,...t.props});case"uploading":return e.u(We,{...s,...t.props});case"videovoice":return e.u(Ye,{...s,...t.props});default:return null}};exports.default=({cards:t,next:i,previousResponses:r})=>{const{cardResponses:n,setCardResponse:s}=(()=>{const[u,p]=e.h(new Map);return{cardResponses:u,setCardResponse:e.T((C,m)=>{p(b=>new Map(b).set(C,m))},[])}})(),{index:a,isLongFormSurvey:l,avatars:d,showSurveyBrand:c,forceBrandedLogo:y,marketingUrlLink:f,startingQuestionIdx:o,viewDocument:g,createDynamicFollowupQuestion:x,update:k}=e.useConfig(u=>({index:u.index,isLongFormSurvey:me.isLongFormSurvey(u.studyType),avatars:u.avatars,forceBrandedLogo:u.forceBrandedLogo,startingQuestionIdx:u.startingQuestionIdx,showSurveyBrand:u.showSurveyBrand,marketingUrlLink:e.buildMarketingUrl({marketingUrl:u.marketingUrl,slugName:u.slugName,surveyId:u.surveyId,forceBrandedLogo:u.forceBrandedLogo}),viewDocument:u.viewDocument,createDynamicFollowupQuestion:u.createDynamicFollowupQuestion,update:u.update})),{currentQuestionBubbleRef:h,scrollToCurrentQuestion:T}=(({viewDocument:u})=>{const p=e._(null),C=e.T(()=>{const m=u.querySelector(".ul-card-main-content");if(p.current&&m&&m instanceof HTMLElement){const b=p.current.offsetTop-m.offsetTop-16;m.scrollTo({top:Math.max(0,b),behavior:"smooth"})}},[]);return{currentQuestionBubbleRef:p,scrollToCurrentQuestion:C}})({viewDocument:g}),N=((u,p,C)=>{const[m,b]=e.h(new Map);return e.p(()=>{if(u.length>0&&p<u.length){const D=u[p],I=`${D.name}`,P=$=>{if(p>0){const F=u[p-1];if(K(F)){const H=`${F.name}`,G=re(F);if($.get(H)!==G)return new Map($).set(H,G)}}return $};if((p<=(C??0)||xe(D))&&(D==null?void 0:D.type)!=="aidynamicstandalone")return b($=>P(new Map($).set(I,!1)));b($=>{const F=!K(D)||re(D);return P(new Map($).set(I,F))});const Q=setTimeout(()=>{b($=>{const F=!!K(D)&&re(D);return P(new Map($).set(I,F))})},1e3);return()=>clearTimeout(Q)}},[p,u,C]),m})(t,a,o);((u,p)=>{const{createDynamicStandaloneQuestion:C}=e.useConfig(D=>({createDynamicStandaloneQuestion:D.createDynamicStandaloneQuestion})),m=u[p],b=(m==null?void 0:m.type)==="aidynamicstandalone"&&m.props.loading===void 0?m.name:null;e.p(()=>{b!==null&&C({questionId:b})},[b,C])})(t,a);const B=((u,p)=>{const[C,m]=e.h(()=>new Set([u]));return e.p(()=>{m(b=>new Set(b).add(u))},[u]),e.p(()=>{const b=p??0;b>0&&m(D=>{const I=new Set(D);for(let P=0;P<=b;P++)I.add(P);return I})},[p]),C})(a,o),M=e.F(()=>({...r,...e.buildReadableResponseMap(t.map((u,p)=>{var C,m;return{...u,value:p<a?((C=n.get(`${u.name}`))==null?void 0:C.value)??null:null,secondaryValue:p<a?((m=n.get(`${u.name}`))==null?void 0:m.secondaryValue)??null:null}}))}),[r,n,t,a]);v.useSetAllResponsesRaw(M);const R=e.pipeReadableResponsesIntoCards(t,M);e.p(()=>{requestAnimationFrame(()=>{T()}),k()},[a,T,N,k]);const A=e.T((u,p)=>{if(!p)return;const C=R[a];if(!C)return;const m=`${C.name}`;s(m,u);const b={...u,questionText:e.getProcessedQuestionText(C)};if(C.childId&&(b==null?void 0:b.value)!=null){const D=e.buildReadableResponseMap([C].map(I=>({...I,value:(b==null?void 0:b.value)??null,secondaryValue:(b==null?void 0:b.secondaryValue)??null})));x({parentQuestionId:C.name,parentResponseConfig:D})}i([b])},[R,a,i,s]),O=R.map((u,p)=>({card:u,cardIndex:p})).filter(({cardIndex:u})=>B.has(u));return e.u("div",{className:"conversational-ui ul-conversational-ui","data-testid":"ui-container",children:[!l&&e.u(rt,{}),e.u("div",{className:"chat-container",children:e.u("div",{className:"chat-messages",children:O.map(({card:u,cardIndex:p})=>e.u(tt,{avatars:d,card:u,cardIndex:p,cardResponses:n,currentQuestionBubbleRef:h,handleCardResponse:A,index:a,questionThinkingStates:N,startingQuestionIdx:o},`question-card-${u.name}`))})}),l&&e.u("div",{className:"long-form-question-footer-container-logo",children:c&&e.u(e.SprigBrandLogo,{forceBrandedLogo:y,marketingUrlLink:f})})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-BxTV1_m-.cjs"),v=require("./videoPlayer-ocnoABDk.cjs"),j=require("./core-DSREyRo8.cjs"),me=require("./metricsReporter-CIbUupJP.cjs"),_e=({properties:t,surveyVideoUrl:i,questionId:r})=>{const n=`ul-card-video__question_player-q${r}`,{apiURL:s,viewDocument:a}=e.useConfig(l=>({apiURL:l.apiURL,viewDocument:l.viewDocument}));return e.u("div",{id:n,ref:l=>{if(l&&l.children.length===0&&!t.properties.hideRecordedPrompt){const d=v.videoPlayer(n,{src:i,type:"application/x-mpegURL"},void 0,t.properties.mediaType===v.RECORDER.MEDIA_TYPE_AUDIO,s,a);l.appendChild(d)}}})},z=({isDisabled:t,onClick:i,children:r})=>e.u(v.Button,{className:"ul-card__button-checkmark",disabled:t,onClick:i,type:"button",children:[e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),r||"Ok"]}),Re=({className:t,next:i,properties:r,questionId:n,type:s})=>{const{useMobileStyling:a,border:l}=e.useConfig(R=>({useMobileStyling:R.useMobileStyling,border:R.border})),[d,c]=e.h(!1),[b,f]=e.h(""),[o,g]=e.h(!1),x=r==null?void 0:r.collectName,C=(r==null?void 0:r.nameLabelText)||"Full Name",h=(r==null?void 0:r.consentText)||"I agree to the stated conditions",T=(r==null?void 0:r.submitButtonText)||"Submit",N=!!b.trim(),E=d&&(!x||N),M=(R,A=!1)=>{R.preventDefault(),R.stopPropagation();let O=null;if(!A){if(!E)return void g(!0);O={submitted:!0},x&&(O.name=b)}i({value:O,questionId:n,type:s},!!A||E)};return e.u("div",{className:e.cc(t,"ul-card__consent-legal","fade-in-transition"),children:e.u(v.MobileEmbedView,{embeddedType:"pdf",properties:r,children:e.u(v.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(v.Option,{allowTextEntry:!1,border:l,error:o&&!d,id:"consent",isRadio:!1,isSelected:d,label:h,onUserInputChanged:({selected:R})=>{R!==d&&c(!d)},useMobileStyling:a}),x&&e.u("input",{"aria-label":C,"aria-placeholder":C,className:e.cc(e.getClasses("ul-consent-legal__name-input",a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:R=>{R.currentTarget.style.borderColor=o&&!N?j.ERROR_BORDER_COLOR:j.DEFAULT_BORDER_COLOR},onFocus:R=>{R.currentTarget.style.borderColor=o&&!N?j.ERROR_BORDER_COLOR:l},onInput:R=>{R.preventDefault(),R.stopPropagation(),f(R.currentTarget.value)},placeholder:C,style:o&&!N?{borderColor:j.ERROR_BORDER_COLOR}:{},tabIndex:0,value:b})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(z,{isDisabled:!E,onClick:R=>M(new SubmitEvent(R.type)),children:e.getButtonText({buttonText:T})}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:R=>M(new SubmitEvent(R.type),!0),children:e.getSkipButtonText(r)})]})]})})},n)},Ne=()=>{const{destroy:t,forceBrandedLogo:i}=e.useConfig(r=>({destroy:r.destroy,forceBrandedLogo:r.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{t(j.APP_ID)},i?4e3:2e3)},[t,i]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},De=({activeValue:t,border:i,icon:r,enableCspTrustedTypes:n,isPressed:s,range:a,scaleLabelType:l,selectedValue:d,setSelectedValue:c,setActiveValue:b,setIsPressed:f,useMobileStyling:o,value:g,viewDocument:x})=>{const C=`option-${g}`,h=l==="number",T=l==="star",N=l==="smiley",E=h&&g===t||g===d,[M,R]=(()=>{const u=T&&d!==null&&g<=d;return T&&g<=t||N&&g===t||u||g===t||g===d?[i,s||u||g===d?1:.3]:["",1]})(),A=e.F(()=>{const u={borderColor:E?M:"",fillOpacity:E?"":R,zIndex:E?3:"auto",color:d===g?"#fff":""};return h?{...u,backgroundColor:d===g?M:""}:{...u,color:T||N||d===g?M:""}},[E,M,R,d,g,h,T,N]),O=e.F(()=>j.getHtml((({icon:u,scaleLabelType:p,value:k,selectedValue:m})=>{if(p==="smiley"&&k===m){let y=0;return u.replace(/black/g,()=>++y==1?"black":"white")}return u})({icon:r,scaleLabelType:l,value:g,selectedValue:d}),n),[n,r,l,d,g]);return e.u("button",{"aria-label":h?void 0:String(g),className:(()=>{switch(l){case"star":return e.cc(e.getClasses("likert-star",o),e.getClasses(`likert-star-${g}`,o));case"smiley":return e.cc(e.getClasses("likert-smiley",o),e.getClasses(`likert-smiley-${g}`,o));default:return g===a?e.cc(e.getClasses("likert-number",o),e.getClasses(`likert-number-${g}`,o),e.getClasses("likert-last-option",o)):e.cc(e.getClasses("likert-number",o),e.getClasses(`likert-number-${g}`,o))}})(),dangerouslySetInnerHTML:{__html:O},id:C,onClick:u=>{u.preventDefault(),u.stopPropagation(),c(g)},onKeyDown:u=>{var m,y;const p=x.querySelectorAll(`.likert-${l??"number"}`),k=g-1;u.key==="ArrowRight"?(m=p[k+1])==null||m.focus():u.key==="ArrowLeft"?(y=p[k-1])==null||y.focus():u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),u.stopPropagation(),c(g))},onPointerDown:()=>f(!0),onPointerEnter:()=>b(g),onPointerLeave:()=>{b(-1),f(!1)},style:A,tabIndex:0})},we=({className:t,labels:i,next:r,properties:n,questionId:s,type:a})=>{const{border:l,useMobileStyling:d,viewDocument:c,enableCspTrustedTypes:b}=e.useConfig(p=>({border:p.border,useMobileStyling:p.useMobileStyling,viewDocument:p.viewDocument,enableCspTrustedTypes:p.enableCspTrustedTypes})),[f,o]=e.h(-1),[g,x]=e.h(!1),[C,h]=e.h(null),T=i&&i.left,N=i&&i.right;let E;const{range:M,scaleLabelType:R,ratingIcons:A}=n;M&&(E=Number(M));const O=E||5,u=p=>{var k,m;switch(R){case"star":return(k=A[0])==null?void 0:k.svg;case"smiley":return(m=A[p])==null?void 0:m.svg;default:return String(p+1)}};return e.u("form",{className:e.cc(t,"ul-card--likert","fade-in-transition"),children:e.u(v.MobileEmbedView,{properties:n,children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${O})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(O)].map((p,k)=>{const m=k+1;return e.u(De,{activeValue:f,border:l,enableCspTrustedTypes:b,icon:u(k),isPressed:g,range:O,scaleLabelType:R,selectedValue:C,setActiveValue:o,setIsPressed:x,setSelectedValue:h,useMobileStyling:d,value:m,viewDocument:c},k)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:T}),e.u("span",{children:N})]})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:C===null&&n.required,onClick:()=>r({value:C,questionId:s,type:a},!0),children:e.getButtonText(n)})})]})},s)},Ie=({columns:t,onSelect:i,options:r,selectedOptions:n})=>{const s=e._([]),{border:a,useMobileStyling:l}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling})),d=r.findIndex(g=>n[g.id]===null),[c,b]=e.h(d),f=e.T((g,x)=>{i(g,x);const C=c+1,h=r[C];h&&n[h.id]===null&&b(C)},[i,r,n,c]),o=e.T((g,x)=>{const C=c===g;return e.u(e.Accordion,{animate:!0,header:x.label,isOpen:C,onClick:()=>{var h;return b(C&&!((h=window.UserLeap)!=null&&h.isMobileSDK)?-1:g)},ref:h=>{h&&(s.current[g]=h)},showHeaderCheck:n[x.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:t.map(h=>e.u(v.Option,{allowTextEntry:!1,ariaLabel:`${x.label}-${h.label}`,border:a,error:!1,id:`${x.id}-${h.value}`,isRadio:!0,isSelected:n[x.id]===h.value,label:h.label,onUserInputChanged:()=>f(x.id,h.value),useMobileStyling:l},h.label))})},x.id)},[a,t,c,f,n,l]);return e.u("div",{children:r.map((g,x)=>o(x,g))})},Ee=({className:t,next:i,options:r,properties:n,questionId:s,type:a,onSubmitButtonClick:l})=>{const d=n.matrixColumn,c=n.required,b=C=>{C.preventDefault(),C.stopPropagation(),i({value:o,questionId:s,type:a},!0),l&&l()},f=r.reduce((C,h)=>(C[h.id]=null,C),{}),[o,g]=e.h(f);return e.u("form",{className:e.cc(t,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:b,children:e.u(v.MobileEmbedView,{properties:n,children:[e.u(v.QuestionBodyWrapper,{children:e.u(Ie,{columns:d,onSelect:(C,h)=>{g(T=>({...T,[C]:h}))},options:r,selectedOptions:o})}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:(x=o,c&&Object.values(x).every(C=>C==null)),onClick:()=>b(new SubmitEvent("submit")),children:e.getButtonText(n)})})]})},s);var x},ge=({className:t,onSubmit:i,options:r=[],properties:n,questionId:s,type:a,showIndividualSubmit:l=!1,onSubmitButtonClick:d})=>{const{border:c,useMobileStyling:b}=e.useConfig(m=>({border:m.border,useMobileStyling:m.useMobileStyling})),f=r.reduce((m,y)=>(m[y.id]={isSelected:!1},m),{}),[o,g]=e.h(f),x=a==="multiplechoice",C=n.required,h=r.find(m=>{var y;return(y=m.optionProperties)==null?void 0:y.noneOfTheAbove}),T=m=>Object.entries(m).some(([y,D])=>{var Q;const B=r.find($=>`${$.id}`===y),P=D.userText===void 0||D.userText.trim()==="";return((Q=B==null?void 0:B.optionProperties)==null?void 0:Q.allowsTextEntry)&&P&&D.isSelected}),N=m=>Object.values(m).filter(y=>y.isSelected).length,E=n.minSelect&&n.minSelect>0&&n.maxSelectMode===e.MaxSelectModes.Range&&N(o)<n.minSelect&&(C||N(o)>0),M=m=>T(m)||C&&!N(m)||!(y=>{const{minSelect:D=0,maxSelect:B=1/0,maxSelectMode:P}=n,Q=N(y);switch(P){case e.MaxSelectModes.Maximum:return Q<=B;case e.MaxSelectModes.Range:return Q===0||Q>=D;default:return!0}})(m),R=Object.entries(o).some(([m,y])=>{var D,B;return y.isSelected&&((B=(D=r.find(P=>`${P.id}`===m))==null?void 0:D.optionProperties)==null?void 0:B.allowsTextEntry)}),A=l&&(!x||R),O=m=>{k(m.id,m.selected,m.userText,m.noneOfTheAbove)},u=m=>{var y;return(n==null?void 0:n.maxSelectMode)!==e.MaxSelectModes.Unlimited&&N(o)===(n==null?void 0:n.maxSelect)&&!((y=o[m])!=null&&y.isSelected)},p=()=>{i(o,!0),d&&d()},k=(m,y,D,B)=>{const P=Object.assign({},o);if((x||B)&&y)for(const Q of Object.values(P))Q.isSelected=!1,delete Q.userText;else h&&!B&&o[h.id].isSelected&&(P[h.id].isSelected=!1);P[m]={isSelected:y,userText:D},g(P)};return e.u("form",{className:e.cc(t,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:p,children:e.u(v.MobileEmbedView,{properties:n,children:[e.u(v.QuestionBodyWrapper,{children:[n.isDropdown?e.u(v.Select,{disabledOptions:r.filter(m=>u(m.id)),dropdownFooter:E?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[N(o),"/",n.minSelect]}):void 0,isMultiSelect:!x,multiselectText:n.dropdownMultiselectedText??"choices selected",onChange:m=>{const y={...o};for(const D of r)m.includes(D)?y[D.id].isSelected=!0:y[D.id].isSelected=!1;g(y)},options:r,placeholderText:n.dropdownPlaceholderText??(x?"Select choice":"Select choice(s)"),value:r.filter(m=>o[m.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",b)),role:x?"radiogroup":"group",children:[r.map(({id:m,label:y,value:D,optionProperties:B})=>{var H,G;const P=`${m}`,{allowsTextEntry:Q,noneOfTheAbove:$}={allowsTextEntry:!1,noneOfTheAbove:!1,...B};return e.u(v.Option,{allowTextEntry:Q,border:c,disabled:u(P),error:(F=o,T(F)),id:P,isRadio:x,isSelected:!!((H=o[P])!=null&&H.isSelected),label:y,noneOfTheAbove:$,onUserInputChanged:O,promptText:(B==null?void 0:B.otherOptionPlaceholder)||"Please specify",text:(G=o[m])==null?void 0:G.userText,useMobileStyling:b,value:D},P);var F}),!!E&&e.u("div",{className:"ul-card__min-select-counter",children:[N(o),"/",n.minSelect]})]}),A&&e.u(v.LongformSubmitButton,{handleSubmit:p,isSubmitDisabled:M(o)})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:M(o),onClick:p,children:e.getButtonText(n)})})]})},s)},Be=t=>{const{questionId:i,type:r,next:n,options:s}=t;return e.u(ge,{...t,onSubmit:(a,l)=>{const d=Object.entries(a).find(([,g])=>g.isSelected)||[void 0,void 0],[c,b]=d,f=s.find(g=>`${g.id}`===c),o=b!=null&&b.userText?{[c]:{userText:b.userText}}:null;n({value:f&&c?{[c]:f.value}:{},secondaryValue:o,questionId:i,type:r},l)}})},Pe=t=>{const{questionId:i,type:r,next:n}=t;return e.u(ge,{...t,onSubmit:(s,a)=>{const l=Object.entries(s).reduce((c,[b,f])=>(c[b]=f.isSelected,c),{}),d=Object.entries(s).reduce((c,[b,f])=>{if(!f.userText)return c;const o=c||{};return o[b]={userText:f.userText},o},null);n({value:l,secondaryValue:d,questionId:i,type:r},a)}})},qe=({className:t,labels:i,properties:r,next:n,questionId:s,type:a})=>{const[l,d]=e.h(null),{border:c,useMobileStyling:b,viewDocument:f}=e.useConfig(x=>({border:x.border,useMobileStyling:x.useMobileStyling,viewDocument:x.viewDocument})),o=i&&i.left,g=i&&i.right;return e.u("form",{className:e.cc(t,"ul-card--nps","fade-in-transition"),children:e.u(v.MobileEmbedView,{properties:r,children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((x,C)=>e.u("button",{className:e.cc(e.getClasses("nps-number",b),e.getClasses(`nps-number-${C}`,b)),id:`option-${C}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),d(C)},onKeyDown:h=>{var N,E;const T=f.querySelectorAll("button.nps-number");h.key==="ArrowRight"?(N=T[C+1])==null||N.focus():h.key==="ArrowLeft"?(E=T[C-1])==null||E.focus():h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),h.stopPropagation(),d(C))},onPointerDown:h=>{h.currentTarget.style.zIndex="2",h.currentTarget.style.borderColor=c},onPointerLeave:h=>{h.currentTarget.style.zIndex="auto",h.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},style:l===C?{backgroundColor:c,color:"#fff"}:void 0,tabIndex:0,children:C},C))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:o}),e.u("span",{children:g})]})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:l===null&&r.required,onClick:()=>n({value:l,questionId:s,type:a},!0),children:e.getButtonText(r)})})]})},s)},Le=({className:t,next:i,properties:r,questionId:n,type:s,onSubmitButtonClick:a})=>{const{border:l,useMobileStyling:d,update:c}=e.useConfig(T=>({border:T.border,useMobileStyling:T.useMobileStyling,update:T.update})),[b,f]=e.h(""),o=e._(null),g=b.trim(),x=r.required===!0&&!g,C=v.useAutoSize(o,()=>c()),h=r&&r.openTextPlaceholder?r.openTextPlaceholder:"";return e.u("form",{className:e.cc(t,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(v.MobileEmbedView,{properties:r,children:e.u("div",{className:"ul-card-text",children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":h,className:e.cc(e.getClasses("ul-card-text__input",d)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:T=>{T.currentTarget.style.borderColor=j.DEFAULT_BORDER_COLOR},onChange:T=>{const{value:N}=T.currentTarget;C(),T.preventDefault(),T.stopPropagation(),f(N)},onFocus:T=>{T.currentTarget.style.borderColor=l},placeholder:h,ref:o,role:"textbox",tabIndex:0})}),r.footerHtml&&e.u(v.Html,{className:"footer",html:r.footerHtml})]}),e.u(v.QuestionBodyFooterContainer,{children:e.u(z,{isDisabled:x,onClick:T=>{T.preventDefault(),T.stopPropagation();const N=r.required!==!0||g.length>0;i({value:b,questionId:n,type:s},N),a&&a()},children:e.getButtonText(r)})})]})})},n)},Me=({className:t,labels:i,next:r,properties:n,questionId:s,type:a,onSubmitButtonClick:l,options:d})=>{const c=e._(null),b=e._(0),f=e._(0),o=e._(null),g=e._(!1),x=e._([]),[C,h]=e.h(()=>(n==null?void 0:n.required)===!0),[T,N]=e.h(()=>d.map(S=>({...S,rank:null}))),E=e.F(()=>Array.from({length:d.length},(S,w)=>w+1),[d.length]),{useMobileStyling:M,isPreview:R,headers:A}=e.useConfig(S=>({useMobileStyling:S.useMobileStyling,isPreview:S.isPreview,headers:S.headers})),O=(A==null?void 0:A["userleap-platform"])==="android",u=M&&!R&&!O,p=!u&&!O,k=(S,w)=>{N(I=>{const _=parseInt(w),L=I.map(q=>({...q}));L.some(q=>q.rank==null)&&L.forEach((q,W)=>q.rank=W+1);const V=L.findIndex(q=>q.id===S);if(V===-1)return I;const U=L[V].rank;return _<U?L.forEach(q=>{q.id!==S&&q.rank>=_&&q.rank<U&&(q.rank=q.rank+1)}):_>U&&L.forEach(q=>{q.id!==S&&q.rank>U&&q.rank<=_&&(q.rank=q.rank-1)}),L[V].rank=_,L.sort((q,W)=>q.rank-W.rank),$(),L})},m=(S,w)=>{for(let I=0;I<x.current.length;I++){const _=x.current[I];if(!_||_===o.current)continue;const L=_.getBoundingClientRect();if(S>=L.left&&S<=L.right&&w>=L.top&&w<=L.bottom)return{element:_,index:I}}return null},y=S=>w=>{if(!u)return;w.preventDefault(),w.stopPropagation(),g.current=!0,c.current=S;const I=w.touches[0];b.current=I.clientY,f.current=I.clientY;const _=w.currentTarget.closest(".ul-card-rank__option");_&&(o.current=_,_.classList.add("is-dragging"))},D=S=>{if(!u||!g.current||c.current===null)return;S.preventDefault(),S.stopPropagation();const w=S.touches[0];f.current=w.clientY;const I=f.current-b.current;o.current&&(o.current.style.transform=`translateY(${I}px)`,o.current.style.zIndex="1000"),x.current.forEach(L=>{L&&L!==o.current&&L.classList.remove("is-drop-target")});const _=m(w.clientX,w.clientY);_&&_.element.classList.add("is-drop-target")},B=S=>{if(!u||!g.current||c.current===null)return;S.preventDefault(),S.stopPropagation();const w=S.changedTouches[0],I=m(w.clientX,w.clientY);o.current&&(o.current.style.transform="",o.current.style.zIndex="",o.current.classList.remove("is-dragging")),x.current.forEach(_=>{_&&_.classList.remove("is-drop-target")}),I&&I.index!==c.current&&P(c.current,I.index),c.current=null,o.current=null,g.current=!1},P=(S,w)=>{N(I=>{const _=I.map(V=>({...V})),[L]=_.splice(S,1);return _.splice(w,0,L),_.forEach((V,U)=>{V.rank=U+1}),$(),_})},Q=S=>{const w={};S.reduce((I,_)=>(I[_.id]=_.rank,I),w),r({value:w,questionId:s,type:a},!0)},$=()=>{h(!1)},{left:F,right:H}=i,G=d.length,X=S=>{S.preventDefault(),S.currentTarget.classList.add("is-drop-target")},Se=S=>{S.currentTarget.classList.remove("is-drop-target")},Te=S=>{c.current=null,S.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(t,"ul-card-rank","fade-in-transition"),onSubmit:S=>{S.preventDefault(),Q(T),l&&l()},children:e.u(v.MobileEmbedView,{properties:n,children:O?e.u(e.g,{children:[e.u(v.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",F]})}),e.u("ol",{className:"ul-card-rank__list",children:T.map(({id:S,label:w,rank:I})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${w}`,className:e.cc("ul-card-rank__select",I==null&&"ul-card-rank__select--placeholder"),name:`rank[${S}]`,onChange:_=>k(S,_.currentTarget.value),value:I??"",children:[I==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),E.map(_=>e.u("option",{className:"ul-card-rank__select-option",value:_,children:_},`${_}-${s}`))]}),e.u("span",{children:w})]},S))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[G," - ",H]})})]})}),e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:C,children:e.getButtonText(n)})})})]}):e.u(e.g,{children:[e.u(v.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",F]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:O?void 0:S=>{S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="move")},children:T.map(({id:S,label:w,rank:I},_)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!p||void 0,onDragEnd:p?Te:void 0,onDragEnter:p?X:void 0,onDragLeave:p?Se:void 0,onDragStart:p?(V=_,U=>{c.current=V,U.dataTransfer&&(U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",String(V)),U.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:p?(L=_,U=>{var W,le;U.preventDefault(),U.currentTarget.classList.remove("is-drop-target");const q=c.current;c.current=null,(le=(W=U.currentTarget.closest(".ul-card-rank__list"))==null?void 0:W.querySelector(".is-dragging"))==null||le.classList.remove("is-dragging"),q!=null&&q!==L&&P(q,L)}):void 0,ref:U=>x.current[_]=U,children:[e.u("select",{"aria-label":`Rank for ${w}`,className:e.cc("ul-card-rank__select",I==null&&"ul-card-rank__select--placeholder"),name:`rank[${S}]`,onChange:U=>k(S,U.currentTarget.value),value:I??"",children:[I==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),E.map(U=>e.u("option",{className:"ul-card-rank__select-option",value:U,children:U},U))]}),e.u("span",{children:w}),!O&&e.u("button",{"aria-label":`Drag ${w} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:u?B:void 0,onTouchMove:u?D:void 0,onTouchStart:u?y(_):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z",fill:"currentColor"})})})]},S);var L,V})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[G," - ",H]})})]})}),e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:C,children:e.getButtonText(n)})})})]})})},s)},ne=1,he=2,ve=3,J=t=>t.type==="av_permission",ue=t=>t.type==="screen_permission",be=(t,i)=>t===void 0?ne:t?((r,n)=>!(J(n)?n.permissionDescriptors:[]).includes("camera")||r.getVideoTracks().length>0)(t,i)?ve:ne:he,ce={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},Z=e.create(t=>({...ce,reset:()=>{t(ce)},updatePage:i=>{t(i)}}));function ie({currentPage:t,pages:i}){const{avStream:r,recordingMediaTypes:n,updatePage:s}=Z.getState(),{recorderEventEmitter:a}=e.useConfig.getState();a.emit("av.permission",{"permission.descriptors":t.permissionDescriptors,"stream.ready":(l,d)=>{if(r===l)return;let c=t;if(l&&!t.permissionDescriptors.includes("camera")){const b=i.indexOf(t),f=d!=null&&d.active?b+2:b+1;d!=null&&d.active&&n&&a.emit("begin.recording",{"recording.media.types":n,"start.recording.callback":o=>s({mediaRecordingUids:o})}),c=i[f]}s({currentPage:c,avStream:l})}})}function se({status:t}){const{nextQuestion:i,passthroughData:r,mediaRecordingUids:n,reset:s}=Z.getState(),{recorderEventEmitter:a,handleUploadUpdate:l,index:d}=e.useConfig.getState(),c={value:{taskStatus:t},type:"recordedtask",questionId:(r==null?void 0:r.questionId)||1};r&&a.emit("finish.task",{"begin.callback":b=>{l({mediaRecordingUid:b,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(b,f)=>{l({mediaRecordingUid:b,progressPct:f.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":b=>{b&&l({mediaRecordingUid:b,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":r,"current.index":d,"task.response":c,"task.complete.callback":b=>{c.value.taskDurationMillisecond=b,n&&(c.value.mediaRecordingUids=n),s(),i(c)}})}function ae({pages:t,setIsRequestingPermission:i}){const{recorderEventEmitter:r,eventEmitFn:n}=e.useConfig.getState(),{updatePage:s,currentPage:a,recordingMediaTypes:l,screenPermissionRequested:d}=Z.getState();if(!a)return;const c=t.indexOf(a);switch(a.type){case"av_permission":{const b=d?c+2:c+1;return d&&l&&r.emit("begin.recording",{"recording.media.types":l,"start.recording.callback":f=>{s({mediaRecordingUids:f})}}),void s({currentPage:t[b]})}case"screen_permission":return void r.emit("screen.permission",{"screen.permission.requested":i,"stream.ready.callback":(b,f)=>{const o=f?t[c+1]:a;f&&l&&r.emit("begin.recording",{"recording.media.types":l,"start.recording.callback":g=>{s({captureStream:f,mediaRecordingUids:g})}}),s({currentPage:o,screenPermissionRequested:!0,captureStream:f})}});case"start_task":return n("recorded.task.start"),r.emit("recorded.task.start"),r.emit("start.task"),void s({currentPage:t[c+1],screenPermissionRequested:!0});case"complete_task":return}}const ye="ul-permission-graphics-container",fe="ul-permission-body",Ce=e.cc(ye,"ul_recorded-task-inset-spacing"),ee=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),ke=({richTextBody:t})=>e.u(v.Html,{className:"ul-rich-text-body",html:t,id:"ul-task-detail-container"}),te=({required:t,skipButtonText:i,bottom:r=!1})=>t?null:e.u(v.Button,{className:e.cc(r&&"ul-skip-button-below","ul-button-inactive"),onClick:se.bind(null,{status:"abandoned"}),children:i||"Skip"}),oe=t=>{const{avStream:i,captureStream:r,recordingMediaTypes:n,updatePage:s}=Z.getState(),a=(n==null?void 0:n.includes("audio"))||(n==null?void 0:n.includes("video"));e.p(()=>{const l=setInterval(()=>{a&&i&&!i.active?s({avStream:null,currentPage:t[0]}):r&&r.active||s({captureStream:void 0,currentPage:t[a?1:0]})},1e3);return()=>clearInterval(l)},[i,r,a,t,n,s])},Oe=({content:t,pages:i,required:r})=>{const{buttonText:n,skipButtonText:s,taskDetail:a}=t;return oe(i),e.u("div",{className:"ul-task-page",children:[a&&e.u(ke,{richTextBody:a}),e.u("div",{className:ee,children:[e.u(v.Button,{onClick:ae.bind(null,{pages:i}),children:n}),e.u(te,{required:r,skipButtonText:s})]})]},"start-task")},Ue=({content:t,pages:i,properties:r})=>{const{buttonText:n,skipButtonText:s}=t;return oe(i),e.u("div",{className:"ul-task-page",children:[t.taskDetail&&e.u(ke,{richTextBody:t.taskDetail}),e.u(v.MobileEmbedView,{properties:r,children:e.u("div",{className:ee,children:[e.u(v.Button,{className:"ul-complete-task-button",onClick:se.bind(null,{status:"completed"}),children:n}),e.u(v.Button,{className:e.cc("ul-button-inactive"),onClick:se.bind(null,{status:"given.up"}),children:s})]})})]},"complete-task")},Ae=({content:t,pages:i,required:r})=>{const{buttonText:n,skipButtonText:s}=t,[a]=e.useConfig(c=>[c.tabTitle]),[l,d]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ce,children:[e.u("p",{style:{marginTop:"auto"},children:t.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:fe,children:a})})]}),e.u("div",{className:r?"":ee,children:[e.u(v.Button,{disabled:l,onClick:ae.bind(null,{pages:i,setIsRequestingPermission:d}),children:n}),e.u(te,{required:r,skipButtonText:s})]})]})},Qe=({content:t})=>e.u(v.Html,{className:e.cc(ye,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:t.svg},"ul-permission-request-graphic"),$e=({content:t,pages:i,required:r})=>{const{permissionDeniedHeadline:n,permissionDeniedBody:s,skipButtonText:a,tryAgainButtonText:l}=t,d=J(i[0])?i[0]:null;return e.p(()=>{const c=setInterval(()=>{d!==null&&ie({currentPage:d,pages:i})},1e3);return()=>clearInterval(c)},[d,i]),d?e.u("div",{children:[e.u("div",{className:Ce,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:n}),e.u("span",{className:fe,children:s})]})}),e.u("div",{className:ee,children:[e.u(v.Button,{onClick:ie.bind(null,{currentPage:d,pages:i}),children:l}),e.u(te,{required:r,skipButtonText:a})]})]}):null},Fe=({stream:t})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:i=>{i&&(i.srcObject=t||null)}}),He=({content:t,pages:i,required:r})=>{const{skipButtonText:n}=t,{avStream:s}=Z.getState();return oe(i),e.u("div",{children:[e.u(Fe,{stream:s}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(v.Button,{onClick:ae.bind(null,{pages:i}),children:t.buttonText}),e.u(te,{bottom:!0,required:r,skipButtonText:n})]})]})},Ve=({properties:t})=>{const{pages:i,required:r}=t,{avStream:n,currentPage:s}=Z.getState();if(s===void 0)return null;switch(s==null?void 0:s.type){case"av_permission":{const a=be(n,s);return a===ne?e.u(Qe,{content:s}):a===he?e.u($e,{content:s,pages:i,required:r}):e.u(He,{content:s,pages:i,required:r})}case"screen_permission":return e.u(Ae,{content:s,pages:i,required:r});case"start_task":return e.u(Oe,{content:s,pages:i,required:r});case"complete_task":return e.u(Ue,{content:s,pages:i,properties:t});default:return null}},Ge=({className:t,properties:i,next:r,questionId:n})=>{const s=e.useConfig(),{surveyId:a,responseGroupUid:l,userId:d}=s,c=Z(),{screenPermissionRequested:b}=c,f=Z(h=>h.avStream);let o=Z(h=>h.currentPage);o||(o=function({pages:h,userId:T,responseGroupUid:N,surveyId:E,questionId:M,next:R}){const{updatePage:A}=Z.getState(),{eventEmitFn:O,recorderEventEmitter:u}=e.useConfig.getState(),p={questionId:M,surveyId:E,visitorId:T,responseGroupUid:N};let k=0;u.emit("recorded.task.permission.screen"),O("recorded.task.permission.screen"),u.emit("permission.status",{"permission.status.callback":(y,D,B,P)=>{const Q=h[k],{type:$}=Q,F=["screen"];if(J(Q)){const{permissionDescriptors:H}=Q,G=H==null?void 0:H.includes("microphone"),X=H==null?void 0:H.includes("camera");G&&F.push("audio"),X&&F.push("video"),(y!=null&&y.active&&!X||y!=null&&y.active&&D)&&k++}ue(h[k])&&B&&(k++,u.emit("begin.recording",{"recording.media.types":F,"start.recording.callback":H=>A({mediaRecordingUids:H})})),A({currentPage:h[k],avStream:y,screenPermissionRequested:B,nextQuestion:R,type:$,passthroughData:p,recordingMediaTypes:F,captureStream:P})}});const m=h[k];return m.type==="av_permission"&&ie({currentPage:m,pages:h}),m}({questionId:n,surveyId:a,next:h=>{r(h,!0)},pages:i.pages,responseGroupUid:l,userId:d}));let g=o.headline,x=o.captionText;const C=be(f,o);return ue(o)&&b&&(g=o.permissionDeniedHeadline,x=o.permissionDeniedCaptionText),J(o)&&C===ve&&(g=o.permissionGrantedHeadline,x=o.permissionGrantedCaptionText),e.u("div",{className:e.cc(t,"ul-center-horizontally","fade-in-transition"),children:[e.u(v.Header,{isRequired:i==null?void 0:i.required,message:g,properties:{captionText:x}}),e.u(v.QuestionBodyWrapper,{children:e.u(Ve,{properties:i})})]})},je=({className:t,next:i,properties:r,questionId:n,type:s})=>{const{visitorAttributes:a,isLongFormSurvey:l}=e.useConfig(f=>({visitorAttributes:f.visitorAttributes,isLongFormSurvey:me.isLongFormSurvey(f.studyType)})),d=(f,o=!1)=>{i({value:o?{skipped:!0}:void 0,questionId:n,type:s},!0)},c=v.getAttributedUrl(r&&r.buttonUrl,a),b=l&&r.promptActionType===e.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(t,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(v.MobileEmbedView,{properties:r,children:!b&&e.u("div",{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:c,id:"ul-card-text__button",onClick:d,onKeyPress:f=>{f.key!=="Enter"&&f.key!==" "||i({value:void 0,questionId:n,type:s},!0)},rel:"noreferrer",role:c?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(r)}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:f=>d(0,!0),children:e.getSkipButtonText(r)})]})})})},n)},Ze=({className:t,questionId:i})=>{const{border:r,destroy:n,endCard:s,forceBrandedLogo:a}=e.useConfig(c=>({border:c.border,destroy:c.destroy,endCard:c.endCard,forceBrandedLogo:c.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{n(j.APP_ID)},a?4e3:2e3)},[n,a]);const l=s&&s.subheader?e.u("p",{className:"ul-caption",children:s.subheader}):null,d=s&&s.headline?s.headline:"";return e.u("div",{className:e.cc(t,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:r,fillRule:"evenodd"}),e.u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:r,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(v.Header,{message:d}),l]})})},i)},ze=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),We=({className:t})=>{const{uploadProgress:i}=e.useConfig(a=>({uploadProgress:a.uploadProgress}));let r,n;Object.values(i).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",n="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",n="Please keep this tab open until your response is fully processed.");const s=Math.round(Math.min(99,...Object.values(i).filter(a=>a.isSubmitted).map(a=>a.progressPct||0)));return e.u("div",{className:e.cc(t,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(v.Header,{message:`${r} (${s}% complete)`}),e.u("p",{className:"ul-caption",children:n})]})},de=0,pe=1,Ye=({className:t,next:i,properties:r,questionId:n,type:s})=>{const a=`ul-card-video__player_recorder-q${n}`,{apiURL:l,envId:d,handleUploadUpdate:c,headers:b,responseGroupUid:f,surveyId:o,viewDocument:g,visitorId:x}=e.useConfig(p=>({apiURL:p.apiURL,envId:p.envId,handleUploadUpdate:p.handleUploadUpdate,headers:p.headers,responseGroupUid:p.responseGroupUid,surveyId:p.surveyId,viewDocument:p.viewDocument,visitorId:p.userId})),[C,h]=e.h(!1),[T,N]=e.h(null),[E,M]=e.h(null),[R,A]=e.h(de),O=(p,k)=>{p===v.RECORDER.UPLOAD_STARTED?(N(k[v.RECORDER.UPLOAD_ID]),M(k[v.RECORDER.MEDIA_RECORDING_UID]),h(!0)):p===v.RECORDER.DELETE?(N(null),M(null),h(!1)):p===v.RECORDER.UPLOAD_PROGRESS?isNaN(k[v.RECORDER.UPLOAD_PROGRESS_PCT])?c({mediaRecordingUid:k[v.RECORDER.MEDIA_RECORDING_UID],isComplete:!0}):c({mediaRecordingUid:k[v.RECORDER.MEDIA_RECORDING_UID],progressPct:k[v.RECORDER.UPLOAD_PROGRESS_PCT]}):p===v.RECORDER.UPLOAD_FINISHED&&c({mediaRecordingUid:k[v.RECORDER.MEDIA_RECORDING_UID],isComplete:!0})},u=p=>{p.preventDefault(),p.stopPropagation(),document.getElementById(a)&&v.stopRecording(a),T&&E?(c({mediaRecordingUid:E,isSubmitted:!0}),i({value:{mediaRecordingUid:E},questionId:n,type:s},!0)):i({value:null,questionId:n,type:s},!0)};return e.u("form",{className:e.cc(t,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",style:{display:R===de?"":"none"},children:e.u(v.MobileEmbedView,{properties:r,children:e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:p=>{p.preventDefault(),p.stopPropagation(),document.getElementById(a)&&v.pauseQuestionPlayer(a),A(pe)}})})}),e.u("div",{style:{display:R===pe?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:p=>{if(p&&p.children.length===0){const k=v.videoRecorderPlayer(a,{surveyId:o,responseGroupUid:f,questionId:n,visitorId:x,envId:d},l,O,void 0,{...b,"x-ul-video-recorder-origin":"sdk"},r.mediaType===v.RECORDER.MEDIA_TYPE_AUDIO,g);p.appendChild(k)}}})})]}),e.u(v.QuestionBodyFooterContainer,{children:[e.u(z,{isDisabled:!!r.required&&!C,onClick:u,children:e.getButtonText(r)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:u,style:{...r.required?{display:"none"}:{},...C?{display:"none"}:{}},children:e.getSkipButtonText(r)})]})]})},K=t=>t.type==="aidynamicfollowup"||t.type==="aidynamicstandalone",re=t=>{var i;return K(t)&&((i=t.props)==null?void 0:i.loading)===e.DynamicQuestionLoadingStates.inFlight},xe=t=>t.type==="thanks"||t.type==="uploading",Ke=({card:t,avatars:i,isThinking:r,isCurrentQuestion:n,currentQuestionBubbleRef:s})=>{const a=(l=>"properties"in l.props&&l.props.properties&&"questionHtml"in l.props.properties&&l.props.properties.questionHtml?{content:l.props.properties.questionHtml,isHtml:!0}:"message"in l.props?{content:l.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(t);return e.u(Y,{avatars:i,isLeft:!0,message:{id:`question-${t.name}`,type:"question",content:a.content},ref:n?s:null,children:r?e.u(ze,{}):e.u(e.g,{children:[a.isHtml?e.u(v.Html,{className:"chat-message-text",html:a.content}):e.u("div",{className:"chat-message-text",children:a.content}),t.type==="videovoice"&&e.u(_e,{properties:t.props,questionId:t.name,surveyVideoUrl:t.props.properties.videoUrl})]})})},Xe=({card:t,avatars:i})=>{const r=(n=>{if(!("properties"in n.props)||!n.props.properties||typeof n.props.properties!="object")return null;const s=n.props.properties,a=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:l,isHtml:d}of a){const c=s[l];if(typeof c!="string")continue;const b=c.trim();if(b){if(d&&!b.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:b,isHtml:d}}}return null})(t);return r?e.u(Y,{avatars:i,hideAvatar:!0,isLeft:!0,message:{id:`caption-${t.name}`,type:"question",content:r.content},children:r.isHtml?e.u(v.Html,{className:"chat-message-text",html:r.content}):e.u("div",{className:"chat-message-text",children:r.content})}):null},Je=({card:t,userResponse:i,avatars:r})=>{const n=((s,a)=>{if((s.type==="open"||s.type==="aidynamicfollowup"||s.type==="aidynamicstandalone")&&a&&typeof a=="object"&&"value"in a)return a.value})(t,i);return e.u("div",{className:"chat-bubble-container chat-right",children:[e.u("div",{className:"chat-bubble chat-bubble-right chat-bubble-text-only",children:e.u("div",{className:"chat-message-text",children:n||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})},et=({card:t,avatars:i,isCurrentQuestion:r,currentQuestionBubbleRef:n})=>{const{endCard:s}=e.useConfig(a=>({endCard:a.endCard}));return e.u(e.g,{children:[e.u(Y,{avatars:i,isLeft:!0,message:{id:`thanks-${t.name}`,type:"question",content:(s==null?void 0:s.headline)??"Great! Thank you for your participation."},ref:r?n:null}),(s==null?void 0:s.subheader)&&e.u(Y,{avatars:i,hideAvatar:!0,isLeft:!0,message:{id:`caption-${t.name}`,type:"question",content:s.subheader}}),e.u(Ne,{})]})},tt=({card:t,cardIndex:i,index:r,avatars:n,cardResponses:s,questionThinkingStates:a,startingQuestionIdx:l,currentQuestionBubbleRef:d,handleCardResponse:c})=>{const b=i===r,f=i<r,o=xe(t);if(o)return e.u(et,{avatars:n,card:t,currentQuestionBubbleRef:d,isCurrentQuestion:b});const g=`${t.name}`,x=s.get(g),C=t.type==="open"||t.type==="aidynamicfollowup"||t.type==="aidynamicstandalone",h=a.get(g);if(t.type==="aidynamicfollowup"&&(t.props.loading===e.DynamicQuestionLoadingStates.failure||t.props.loading===void 0)||t.type==="aidynamicstandalone"&&t.props.loading===e.DynamicQuestionLoadingStates.failure)return e.u(e.g,{});const T=(i>(l??0)||K(t))&&t.type!=="thanks"&&t.type!=="uploading"&&(h===!0||h===void 0);return e.u(e.wn.Fragment,{children:[e.u(Ke,{avatars:n,card:t,currentQuestionBubbleRef:d,isCurrentQuestion:b,isThinking:T}),!T&&e.u(Xe,{avatars:n,card:t}),f&&C?e.u(Je,{avatars:n,card:t,userResponse:x}):(!f||!C)&&!T&&e.u(Y,{avatars:n,isLeft:!1,message:{id:`card-${t.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(nt,{card:t,className:o?"chat-thanks-card":"chat-card",isAnswered:f,next:b?c:()=>{}})})})]},`question-card-${t.name}`)},Y=e.wn.forwardRef(({message:t,isLeft:i=!1,children:r,avatars:n,hideAvatar:s=!1},a)=>{const l=i?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${i?"chat-left":"chat-right"}${i&&s?" chat-no-avatar":""}`,ref:a,children:[i&&!s&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${n.agentAvatar["1x"]} 1x, ${n.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${l}`,children:r||e.u("div",{className:"chat-message-text",children:t.content})}),!i&&!s&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${n.respondentAvatar["1x"]} 1x, ${n.respondentAvatar["2x"]} 2x`})]})});Y.displayName="ChatBubble";const rt=()=>{const t=e.useConfig(r=>r.close),i=e.F(()=>()=>t(j.APP_ID),[t]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:i,onKeyPress:r=>{r.key==="Enter"&&i()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})},nt=({card:t,next:i,className:r="",isAnswered:n=!1})=>{const s={className:n?`${r} answered-card`:r,next:n?()=>{}:i,questionId:t.name,type:t.type,isAnswered:n};switch(t.type){case"consentlegal":return e.u(Re,{...s,...t.props});case"likert":return e.u(we,{...s,...t.props});case"matrix":return e.u(Ee,{...s,...t.props});case"multiplechoice":return e.u(Be,{...s,...t.props});case"multipleselect":return e.u(Pe,{...s,...t.props});case"nps":return e.u(qe,{...s,...t.props});case"aidynamicstandalone":case"aidynamicfollowup":case"open":return e.u(Le,{...s,type:t.type,...t.props});case"rankorder":return e.u(Me,{...s,...t.props});case"recordedtask":return e.u(Ge,{...s,...t.props});case"texturlprompt":return e.u(je,{...s,...t.props});case"thanks":return e.u(Ze,{...s,...t.props});case"uploading":return e.u(We,{...s,...t.props});case"videovoice":return e.u(Ye,{...s,...t.props});default:return null}};exports.default=({cards:t,next:i,previousResponses:r})=>{const{cardResponses:n,setCardResponse:s}=(()=>{const[u,p]=e.h(new Map);return{cardResponses:u,setCardResponse:e.T((k,m)=>{p(y=>new Map(y).set(k,m))},[])}})(),{index:a,isLongFormSurvey:l,avatars:d,showSurveyBrand:c,forceBrandedLogo:b,marketingUrlLink:f,startingQuestionIdx:o,viewDocument:g,createDynamicFollowupQuestion:x,update:C}=e.useConfig(u=>({index:u.index,isLongFormSurvey:me.isLongFormSurvey(u.studyType),avatars:u.avatars,forceBrandedLogo:u.forceBrandedLogo,startingQuestionIdx:u.startingQuestionIdx,showSurveyBrand:u.showSurveyBrand,marketingUrlLink:e.buildMarketingUrl({marketingUrl:u.marketingUrl,slugName:u.slugName,surveyId:u.surveyId,forceBrandedLogo:u.forceBrandedLogo}),viewDocument:u.viewDocument,createDynamicFollowupQuestion:u.createDynamicFollowupQuestion,update:u.update})),{currentQuestionBubbleRef:h,scrollToCurrentQuestion:T}=(({viewDocument:u})=>{const p=e._(null),k=e.T(()=>{const m=u.querySelector(".ul-card-main-content");if(p.current&&m&&m instanceof HTMLElement){const y=p.current.offsetTop-m.offsetTop-16;m.scrollTo({top:Math.max(0,y),behavior:"smooth"})}},[]);return{currentQuestionBubbleRef:p,scrollToCurrentQuestion:k}})({viewDocument:g}),N=((u,p,k)=>{const[m,y]=e.h(new Map);return e.p(()=>{if(u.length>0&&p<u.length){const D=u[p],B=`${D.name}`,P=$=>{if(p>0){const F=u[p-1];if(K(F)){const H=`${F.name}`,G=re(F);if($.get(H)!==G)return new Map($).set(H,G)}}return $};if((p<=(k??0)||xe(D))&&(D==null?void 0:D.type)!=="aidynamicstandalone")return y($=>P(new Map($).set(B,!1)));y($=>{const F=!K(D)||re(D);return P(new Map($).set(B,F))});const Q=setTimeout(()=>{y($=>{const F=!!K(D)&&re(D);return P(new Map($).set(B,F))})},1e3);return()=>clearTimeout(Q)}},[p,u,k]),m})(t,a,o);((u,p)=>{const{createDynamicStandaloneQuestion:k}=e.useConfig(D=>({createDynamicStandaloneQuestion:D.createDynamicStandaloneQuestion})),m=u[p],y=(m==null?void 0:m.type)==="aidynamicstandalone"&&m.props.loading===void 0?m.name:null;e.p(()=>{y!==null&&k({questionId:y})},[y,k])})(t,a);const E=((u,p)=>{const[k,m]=e.h(()=>new Set([u]));return e.p(()=>{m(y=>new Set(y).add(u))},[u]),e.p(()=>{const y=p??0;y>0&&m(D=>{const B=new Set(D);for(let P=0;P<=y;P++)B.add(P);return B})},[p]),k})(a,o),M=e.F(()=>({...r,...e.buildReadableResponseMap(t.map((u,p)=>{var k,m;return{...u,value:p<a?((k=n.get(`${u.name}`))==null?void 0:k.value)??null:null,secondaryValue:p<a?((m=n.get(`${u.name}`))==null?void 0:m.secondaryValue)??null:null}}))}),[r,n,t,a]);v.useSetAllResponsesRaw(M);const R=e.pipeReadableResponsesIntoCards(t,M);e.p(()=>{requestAnimationFrame(()=>{T()}),C()},[a,T,N,C]);const A=e.T((u,p)=>{if(!p)return;const k=R[a];if(!k)return;const m=`${k.name}`;s(m,u);const y={...u,questionText:e.getProcessedQuestionText(k)};k.childId&&(y==null?void 0:y.value)!=null&&e.triggerFollowUpQuestionGeneration({displayCard:k,response:y,createDynamicFollowupQuestion:x}),i([y])},[R,a,i,s]),O=R.map((u,p)=>({card:u,cardIndex:p})).filter(({cardIndex:u})=>E.has(u));return e.u("div",{className:"conversational-ui ul-conversational-ui","data-testid":"ui-container",children:[!l&&e.u(rt,{}),e.u("div",{className:"chat-container",children:e.u("div",{className:"chat-messages",children:O.map(({card:u,cardIndex:p})=>e.u(tt,{avatars:d,card:u,cardIndex:p,cardResponses:n,currentQuestionBubbleRef:h,handleCardResponse:A,index:a,questionThinkingStates:N,startingQuestionIdx:o},`question-card-${u.name}`))})}),l&&e.u("div",{className:"long-form-question-footer-container-logo",children:c&&e.u(e.SprigBrandLogo,{forceBrandedLogo:b,marketingUrlLink:f})})]})};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const t = '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-card-text__button{background-color:var(--theme);border-radius:8px;padding:11px 16px;gap:5px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px}.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;color:#5d696f}.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}.sprig-question-footer-container{padding:0;align-items:center}.ul-card__button-checkmark{display:flex;align-items:center;font-size:15px;gap:5px;padding:11px 16px;border-radius:8px;background-color:var(--theme);color:#fff}.ul-card__button-checkmark:disabled{background-color:var(--theme);opacity:.5;color:#fff}.ul-card__button-checkmark:disabled>svg path{stroke:#fff}.ul-conversational-ui{width:100%;height:100%;display:flex;flex-direction:column;min-height:500px;font-size:15px;position:relative}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:right;align-self:stretch}.conversational-close-btn{position:fixed;top:20px;right:16px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;z-index:1000}.conversational-close-btn:hover{background:#ffffff80}.chat-container{flex:1;display:flex;flex-direction:column;align-items:center}.chat-messages{flex:1;display:flex;flex-direction:column;max-width:600px;width:100%;padding:36px 16px 44px;gap:8px;box-sizing:border-box}.chat-message-no-response{font-style:italic;color:#666}.chat-card .choice{margin-bottom:0;background-color:unset;padding:0;line-height:2;border:none;min-height:28px}.chat-card .choice.ul-select-active-dynamic-style{border:none}.chat-bubble-container{display:flex;flex-direction:row;align-items:flex-start;width:100%;animation:fadeInUp .3s ease-out}.chat-bubble-container img{display:none}.chat-left{align-self:flex-start;width:auto;justify-content:flex-start}.chat-container .chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:0}.chat-right{align-self:flex-end;width:100%;justify-content:flex-end;margin-top:8px}.sprig-question-body{word-wrap:break-word;position:relative;border-radius:8px;box-sizing:border-box;max-width:448px;gap:8px;padding:0;overflow:unset}.chat-bubble-text-only{width:auto;max-width:286px}.chat-bubble.chat-bubble-right .chat-message-text{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble-left{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#f7f6f5}.chat-bubble.chat-bubble-right:has(.answered-card) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble.chat-bubble-right:not(:has(.chat-bubble-text-only)) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-message-text{line-height:1.4;margin:0;text-align:left;color:#141312;font-size:14px;font-weight:400;word-wrap:break-word}.chat-card-container{padding:0;background:transparent}@media (max-width: 600px){.conversational-ui .long-form-question-footer-container-logo{position:unset}}.chat-card-container .chat-card{display:flex;flex-direction:column;gap:8px}.chat-thanks-card{background:transparent;box-shadow:none;text-align:center}.end-of-survey-text{text-align:center;color:#999;font-size:14px;margin-top:8px;font-weight:400}.answered-card{pointer-events:none;opacity:.7;position:relative}.footer{width:100%;margin-top:12px;font-size:12px;font-weight:400;line-height:12px;color:#000000b3}.answered-card:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff4d;pointer-events:none;border-radius:inherit}.answered-card button,.answered-card input,.answered-card textarea,.answered-card select{pointer-events:none}.answered-card:not(.ul-card__consent-legal):not(.ul-card__text-url-prompt) .ul-card-button-group *{display:none}.sprig-question-footer-container{padding:0;align-items:end}.chat-card.ul-card--video .sprig-question-footer-container{flex-direction:row;justify-content:flex-end;align-items:center}.ul-card-text__button{font-size:13px}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:42px}.ul-card-vertical__button-wrapper{align-items:end}.ul-card-skip__button{padding:0 16px}.sprig-stretch{padding:16px;display:flex;flex-direction:column;gap:8px;border-radius:8px;background:#e8e7e6}.sprig-stretch input{background-color:#fff}.ul-card--likert__numbers{background-color:#fff;display:flex;width:100%;box-sizing:border-box;flex-wrap:nowrap;justify-content:space-between;align-items:center}.ul-card--likert__numbers:has(.likert-star,.likert-smiley){background-color:transparent;justify-content:space-evenly}.likert-smiley>svg{scale:1.176}.ul-card--likert__numbers .likert-star,.ul-card--likert__numbers .likert-smiley{min-width:24px;min-height:24px;max-width:38px;max-height:38px;flex:0 1 auto;transition:height .2s,width .2s}.ul-card--likert__labels{font-weight:400;color:#2f2e2c;text-align:center;word-break:break-word;font-size:.95rem}.likert-number,.likert-smiley,.likert-star{aspect-ratio:1 / 1;min-height:34px;max-height:54px;box-sizing:border-box;flex:1 1 auto;display:flex;align-items:center;justify-content:center;transition:height .2s,width .2s,font-size .2s}.sprig-question-body:has(.likert-number,.likert-smiley,.likert-star){max-width:100%;padding:0 .5rem;display:flex;flex-direction:column}.chat-bubble.chat-bubble-right:has(.likert-number,.likert-smiley,.likert-star){width:100%}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:700px}@media (min-width: 1200px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:900px}}@media (max-width: 768px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%;padding:0 4px}}.chat-card-container .ul-card--matrix_container{max-width:100%;overflow-x:auto}.chat-card-container .ul-card--matrix_grid{min-width:100%}.chat-card-container .ul-card__matrix{width:100%}.chat-card-container .choice-label-container{gap:8px}@media (max-width: 768px){.sprig-header-label-container,.sprig-header-label,.choice{font-size:14px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%}.chat-card-container .ul-card--matrix_container{overflow-x:auto;-webkit-overflow-scrolling:touch}}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-conversational-ui .chat-card-container .chat-card.ul-card--nps{width:100%;min-width:262px;max-width:500px;box-sizing:border-box}.ul-conversational-ui .ul-card--nps__numbers{background-color:#fff}.ul-conversational-ui .nps-number{color:#2f2e2c}@media (max-width: 768px){.ul-conversational-ui .nps-number{font-size:16px;height:35px}.ul-conversational-ui .ul-card--nps__labels{font-size:12px;font-weight:400;color:#2f2e2c}}@media (min-width: 769px){.ul-conversational-ui .nps-number{font-size:20px;height:40px}.ul-conversational-ui .ul-card--nps__labels{font-size:14px;font-weight:400;color:#2f2e2c}}.ul-card-rank__option{text-align:left;background:#0000000d;margin-bottom:8px}.ul-card-rank__option.is-dragging{background-color:#0000000d;border:none}.ul-card-rank__labels{font-weight:400;color:#2f2e2c}@media (min-width: 1200px){.ul-card--rank__question-inner-container{max-width:900px}}@media (max-width: 768px){.ul-card--rank__question-inner-container{min-width:0;max-width:100%;width:100%;font-size:14px}.ul-card-rank__labels{font-size:14px}.ul-card-rank__option>span{font-size:14px}.ul-card-rank__option>select{font-size:14px}}.select-button{align-items:center;background-color:#fff;border-radius:8px;border:1px solid #E8E7E6;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:8px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.chat-card .select-checkbox{border:1px solid #323232;background-color:#fff}.chat-card .select-radio{box-shadow:unset;border:1px solid #323232;background-color:#f3f3f3}.chat-card .select-radio.ul-select-active-dynamic-style{border:1px solid #323232;background-color:#000;box-shadow:inset 0 0 1px 3px #fff}.ul-card-text{margin-top:2px;margin-bottom:3px;gap:8px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;display:flex;justify-content:center;margin-bottom:12px;flex:1 1 auto;flex-direction:row;border-radius:8px;gap:0;width:auto;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__container{max-width:100%;width:100%;margin-bottom:8px}}.ul-card-text__container textarea{border-radius:8px;width:60vw;box-sizing:border-box}.ul-card-text__container textarea:focus{border:1px solid #0B2330}.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:#fff;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:8px;resize:none;width:100%;border-radius:3px;line-height:20px;overflow-wrap:break-word;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__input{min-width:0;max-width:100%;width:100%;font-size:14px}}.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:#fff}@media (max-width: 768px){.ul-card-text__input{font-size:14px}}.ul-card__text-url-prompt .sprig-question-body{padding:0}.ul-card__text-url-prompt .ul-card-button-group{padding:10px}.chat-card.ul-card__text-url-prompt .ul-card-button-group{align-items:flex-end;padding:0}@keyframes flashingDot{0%{background-color:#262136}50%,to{background-color:#f8f9fa}}.thinking-dots-container{display:flex;justify-content:center;align-items:flex-end;position:relative;width:18px;margin-top:.5em}.thinking-dot{position:relative;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite linear alternate;animation-delay:.5s}.thinking-dot:before,.thinking-dot:after{content:"";display:inline-block;position:absolute;top:0;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite alternate}.thinking-dot:before{left:-5px;animation-delay:0s}.thinking-dot:after{left:5px;animation-delay:1s}[id^=ul-card-video__player_recorder],[id^=ul-card-video__question_player]{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.answered-card [id^=ul-card-video__player_recorder] .ul-control-panel{display:none!important}';
|
|
2
|
+
export {
|
|
3
|
+
t as default
|
|
4
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.default='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-card-text__button{background-color:var(--theme);border-radius:8px;padding:11px 16px;gap:5px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px}.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;color:#5d696f}.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}.sprig-question-footer-container{padding:0;align-items:center}.ul-card__button-checkmark{display:flex;align-items:center;font-size:15px;gap:5px;padding:11px 16px;border-radius:8px;background-color:var(--theme);color:#fff}.ul-card__button-checkmark:disabled{background-color:var(--theme);opacity:.5;color:#fff}.ul-card__button-checkmark:disabled>svg path{stroke:#fff}.ul-conversational-ui{width:100%;height:100%;display:flex;flex-direction:column;min-height:500px;font-size:15px;position:relative}.ul-card__button-wrapper{margin-top:4px;display:flex;gap:16px;justify-content:right;align-self:stretch}.conversational-close-btn{position:fixed;top:20px;right:16px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;z-index:1000}.conversational-close-btn:hover{background:#ffffff80}.chat-container{flex:1;display:flex;flex-direction:column;align-items:center}.chat-messages{flex:1;display:flex;flex-direction:column;max-width:600px;width:100%;padding:36px 16px 44px;gap:8px;box-sizing:border-box}.chat-message-no-response{font-style:italic;color:#666}.chat-card .choice{margin-bottom:0;background-color:unset;padding:0;line-height:2;border:none;min-height:28px}.chat-card .choice.ul-select-active-dynamic-style{border:none}.chat-bubble-container{display:flex;flex-direction:row;align-items:flex-start;width:100%;animation:fadeInUp .3s ease-out}.chat-bubble-container img{display:none}.chat-left{align-self:flex-start;width:auto;justify-content:flex-start}.chat-container .chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:0}.chat-right{align-self:flex-end;width:100%;justify-content:flex-end;margin-top:8px}.sprig-question-body{word-wrap:break-word;position:relative;border-radius:8px;box-sizing:border-box;max-width:448px;gap:8px;padding:0;overflow:unset}.chat-bubble-text-only{width:auto;max-width:286px}.chat-bubble.chat-bubble-right .chat-message-text{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble-left{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#f7f6f5}.chat-bubble.chat-bubble-right:has(.answered-card) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-bubble.chat-bubble-right:not(:has(.chat-bubble-text-only)) .sprig-question-body{border-radius:8px;word-wrap:break-word;position:relative;padding:16px;color:#333;background:#e8e7e6}.chat-message-text{line-height:1.4;margin:0;text-align:left;color:#141312;font-size:14px;font-weight:400;word-wrap:break-word}.chat-card-container{padding:0;background:transparent}@media (max-width: 600px){.conversational-ui .long-form-question-footer-container-logo{position:unset}}.chat-card-container .chat-card{display:flex;flex-direction:column;gap:8px}.chat-thanks-card{background:transparent;box-shadow:none;text-align:center}.end-of-survey-text{text-align:center;color:#999;font-size:14px;margin-top:8px;font-weight:400}.answered-card{pointer-events:none;opacity:.7;position:relative}.footer{width:100%;margin-top:12px;font-size:12px;font-weight:400;line-height:12px;color:#000000b3}.answered-card:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff4d;pointer-events:none;border-radius:inherit}.answered-card button,.answered-card input,.answered-card textarea,.answered-card select{pointer-events:none}.answered-card:not(.ul-card__consent-legal):not(.ul-card__text-url-prompt) .ul-card-button-group *{display:none}.sprig-question-footer-container{padding:0;align-items:end}.chat-card.ul-card--video .sprig-question-footer-container{flex-direction:row;justify-content:flex-end;align-items:center}.ul-card-text__button{font-size:13px}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:42px}.ul-card-vertical__button-wrapper{align-items:end}.ul-card-skip__button{padding:0 16px}.sprig-stretch{padding:16px;display:flex;flex-direction:column;gap:8px;border-radius:8px;background:#e8e7e6}.sprig-stretch input{background-color:#fff}.ul-card--likert__numbers{background-color:#fff;display:flex;width:100%;box-sizing:border-box;flex-wrap:nowrap;justify-content:space-between;align-items:center}.ul-card--likert__numbers:has(.likert-star,.likert-smiley){background-color:transparent;justify-content:space-evenly}.likert-smiley>svg{scale:1.176}.ul-card--likert__numbers .likert-star,.ul-card--likert__numbers .likert-smiley{min-width:24px;min-height:24px;max-width:38px;max-height:38px;flex:0 1 auto;transition:height .2s,width .2s}.ul-card--likert__labels{font-weight:400;color:#2f2e2c;text-align:center;word-break:break-word;font-size:.95rem}.likert-number,.likert-smiley,.likert-star{aspect-ratio:1 / 1;min-height:34px;max-height:54px;box-sizing:border-box;flex:1 1 auto;display:flex;align-items:center;justify-content:center;transition:height .2s,width .2s,font-size .2s}.sprig-question-body:has(.likert-number,.likert-smiley,.likert-star){max-width:100%;padding:0 .5rem;display:flex;flex-direction:column}.chat-bubble.chat-bubble-right:has(.likert-number,.likert-smiley,.likert-star){width:100%}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:700px}@media (min-width: 1200px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:900px}}@media (max-width: 768px){.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%;padding:0 4px}}.chat-card-container .ul-card--matrix_container{max-width:100%;overflow-x:auto}.chat-card-container .ul-card--matrix_grid{min-width:100%}.chat-card-container .ul-card__matrix{width:100%}.chat-card-container .choice-label-container{gap:8px}@media (max-width: 768px){.sprig-header-label-container,.sprig-header-label,.choice{font-size:14px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:280px;max-width:100%;width:100%}.chat-card-container .ul-card--matrix_container{overflow-x:auto;-webkit-overflow-scrolling:touch}}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-conversational-ui .chat-card-container .chat-card.ul-card--nps{width:100%;min-width:262px;max-width:500px;box-sizing:border-box}.ul-conversational-ui .ul-card--nps__numbers{background-color:#fff}.ul-conversational-ui .nps-number{color:#2f2e2c}@media (max-width: 768px){.ul-conversational-ui .nps-number{font-size:16px;height:35px}.ul-conversational-ui .ul-card--nps__labels{font-size:12px;font-weight:400;color:#2f2e2c}}@media (min-width: 769px){.ul-conversational-ui .nps-number{font-size:20px;height:40px}.ul-conversational-ui .ul-card--nps__labels{font-size:14px;font-weight:400;color:#2f2e2c}}.ul-card-rank__option{text-align:left;background:#0000000d;margin-bottom:8px}.ul-card-rank__option.is-dragging{background-color:#0000000d;border:none}.ul-card-rank__labels{font-weight:400;color:#2f2e2c}@media (min-width: 1200px){.ul-card--rank__question-inner-container{max-width:900px}}@media (max-width: 768px){.ul-card--rank__question-inner-container{min-width:0;max-width:100%;width:100%;font-size:14px}.ul-card-rank__labels{font-size:14px}.ul-card-rank__option>span{font-size:14px}.ul-card-rank__option>select{font-size:14px}}.select-button{align-items:center;background-color:#fff;border-radius:8px;border:1px solid #E8E7E6;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:8px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.chat-card .select-checkbox{border:1px solid #323232;background-color:#fff}.chat-card .select-radio{box-shadow:unset;border:1px solid #323232;background-color:#f3f3f3}.chat-card .select-radio.ul-select-active-dynamic-style{border:1px solid #323232;background-color:#000;box-shadow:inset 0 0 1px 3px #fff}.ul-card-text{margin-top:2px;margin-bottom:3px;gap:8px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;display:flex;justify-content:center;margin-bottom:12px;flex:1 1 auto;flex-direction:row;border-radius:8px;gap:0;width:auto;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__container{max-width:100%;width:100%;margin-bottom:8px}}.ul-card-text__container textarea{border-radius:8px;width:60vw;box-sizing:border-box}.ul-card-text__container textarea:focus{border:1px solid #0B2330}.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:#fff;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:8px;resize:none;width:100%;border-radius:3px;line-height:20px;overflow-wrap:break-word;min-width:180px;max-width:100%}@media (max-width: 768px){.ul-card-text__input{min-width:0;max-width:100%;width:100%;font-size:14px}}.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:#fff}@media (max-width: 768px){.ul-card-text__input{font-size:14px}}.ul-card__text-url-prompt .sprig-question-body{padding:0}.ul-card__text-url-prompt .ul-card-button-group{padding:10px}.chat-card.ul-card__text-url-prompt .ul-card-button-group{align-items:flex-end;padding:0}@keyframes flashingDot{0%{background-color:#262136}50%,to{background-color:#f8f9fa}}.thinking-dots-container{display:flex;justify-content:center;align-items:flex-end;position:relative;width:18px;margin-top:.5em}.thinking-dot{position:relative;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite linear alternate;animation-delay:.5s}.thinking-dot:before,.thinking-dot:after{content:"";display:inline-block;position:absolute;top:0;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite alternate}.thinking-dot:before{left:-5px;animation-delay:0s}.thinking-dot:after{left:5px;animation-delay:1s}[id^=ul-card-video__player_recorder],[id^=ul-card-video__question_player]{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.answered-card [id^=ul-card-video__player_recorder] .ul-control-panel{display:none!important}';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var wt=Object.defineProperty;var St=(r,e,s)=>e in r?wt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var F=(r,e,s)=>St(r,typeof e!="symbol"?e+"":e,s);const i=require("./metricsReporter-BGIzo9eh.cjs"),qe=()=>{try{return window.parent.Intercom}catch{return null}},Ve=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=qe();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=qe();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class Xe{static disable(){Ve.forEach(e=>e.disable())}static enable(){Ve.forEach(e=>e.enable())}}const We="ul-view-sdk-script",Lt=new Set(["ios","android"]),O="visitors",C="environments";async function _(r,e){var o,l,a;const{shouldDropOnRateLimit:s,...n}=e;n.headers=Object.assign(i.getHttpHeaders(window.UserLeap),n.headers);const t=await i.sprigFetch(r,{...n,shouldDropOnRateLimit:s});if(t.ok){const d=(o=t.headers)==null?void 0:o.get("Authorization"),c=d?d.split(" "):void 0,p=c&&c.length===2?c[1]:void 0,g=(l=t.headers)==null?void 0:l.get("x-ul-visitor-id");if(window.UserLeap.userId&&g===window.UserLeap.visitorId){const y=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");y&&y[window.UserLeap.envId]===g&&(delete y[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",y))}p&&g&&(g!==window.UserLeap.visitorId||window.UserLeap.token!==p)&&(I("token",p),I("vid",g),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:g}),window.UserLeap.token=p,window.UserLeap.visitorId=g)}return(a=t.json)!=null&&a.logMessage&&console.warn(`[Sprig] ${t.json.logMessage}`),t}function I(r,e){const s=i.localStorageHelper.getItemObject("userleap.ids");let n=s[window.UserLeap.envId];n?n[r]=e:n={[r]:e},s[window.UserLeap.envId]=n,i.localStorageHelper.setItemObject("userleap.ids",s)}function ke(){return window.previewMode?"0":window.UserLeap.visitorId??""}function R(r,e,s){const n=[window.UserLeap._API_URL,"sdk",r];return e&&e.forEach(t=>{n.push(t),t===C?n.push(window.UserLeap.envId):t===O&&n.push(ke())}),s&&n.push(s),n.join("/")}const G=async(r,e,s)=>{var Pe,He,Me,Fe;const{context:n,delay:t,avatars:o,experimentFlags:l,forceBrandedLogo:a,endCard:d,isFeedback:c=!1,heatmap:p,locale:g,layout:y,previewMode:b,productConfig:u,questions:h,responseGroupUid:v,surveyId:m,uuid:U,vid:w,sessionReplay:T,studyType:P,surveyVisitorAttributes:L}=r,E=i.getHttpHeaders(window.UserLeap),A=Y(E),V=ce(E);if(T)if(A)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:v,hasQuestions:!!(h!=null&&h.length),surveyId:m,uploadId:T.uploadId,replayType:T.replayDurationType??"before",seconds:T.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:v,surveyId:m,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}});else{if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};i.modules.replay.scheduleOrCaptureReplay({responseGroupId:v,surveyId:m,visitorId:w,replayParams:T,completeUploadHeaders:E,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:h.length===0})}if(p){if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};const{eventId:S,replayParams:M,responseGroupUid:he,surveyId:ye}=p;await i.modules.replay.initializeReplay({maxReplayDurationSeconds:300,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0,apiUrl:window.UserLeap._API_URL,replaySettings:s}),i.modules.replay.tryReplayAction(()=>{var je;return(je=i.modules.replay)==null?void 0:je.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:E,eventId:S,isHeatmap:!0,replayParams:M,responseGroupId:he,surveyId:ye,triggerTimestamp:Date.now(),visitorId:w})},"Error in scheduling/capturing replay")}if(w==null||!(h!=null&&h.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:w}),{success:!1,message:"[Sprig] no survey found",surveyState:window.UserLeap.container?"previous survey ready":"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const S="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(S),{success:!1,message:S,surveyState:"previous survey ready"}}if(w!==window.UserLeap.visitorId&&U!==window.UserLeap.visitorId&&!window.previewMode){const S="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(S)),{success:!1,message:S,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:m}),(Pe=i.modules.replay)==null||Pe.RecordSurveyShown({id:m,userAgent:window.navigator.userAgent}),Xe.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":m,layout:y});let H,N,k,ee,te=document.createElement("div");const xe=S=>{const{"view.version":M}=S;M!==E["x-ul-sdk-version"]&&et(),i.eventEmitter.removeListener("verify.view.version",xe)};i.eventEmitter.on("verify.view.version",xe),window.UserLeap.useMobileStyling=V,i.shouldDirectEmbed(E)?(H="ul-direct-embeded-frame",N=document.head,k=window,ee=!1,(()=>{const S=i.getHttpHeaders(window.UserLeap),M=Y(S),he=window.UserLeap.forceDirectEmbed,ye=S["userleap-platform"]==="web";return M||he&&ye})()&&(Ze(m,c),te.id=H,window.UserLeap.container.appendChild(te),tt(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":m}))):{frameId:H,contentWinDocHead:N,contentWindow:k,hasOverlay:ee,iframe:te}=Et({productConfig:u,useMobileStyling:V,surveyId:m,isFeedback:c,enableCspTrustedTypes:(He=window.UserLeap._config)==null?void 0:He.enableCspTrustedTypes}),window.UserLeap.frameId=H;const W={apiURL:window.UserLeap._API_URL,avatars:o,cards:h,configureExitOnOverlayClick:S=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,S)},context:n,endCard:d,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),experimentFlags:l,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:a,frame:te,headers:E,layout:y,locale:g,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.sessionStorageHelper.getItem("sprig.previewKey"),previewMode:b||!!window.previewMode,productConfig:{framePosition:u==null?void 0:u.framePosition,desktopDisplay:u==null?void 0:u.desktopDisplay,placement:u==null?void 0:u.placement},responseGroupUid:v,startingQuestionIdx:(Me=window.UserLeap.config)==null?void 0:Me.startingQuestionIdx,studyType:P,styleNonce:window.UserLeap.styleNonce,surveyId:m,tabTitle:document.title,trackPageViewUrl:e,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:V,userId:U,viewDocument:k==null?void 0:k.document,viewWindow:k,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},surveyVisitorAttributes:L||{},...window.UserLeap._config};(Fe=window.UserLeap._config)!=null&&Fe.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const ft=(c?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??u.customStyles;W.customStyles=ft,k&&(k.__cfg=W);const ue=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:W.path,Ae=document.getElementById(We);Ae&&Ae.remove();const me=function(){const S=document.createElement("script");return window.UserLeap.isMobileSDK||S.setAttribute("type","module"),window.UserLeap.nonce&&S.setAttribute("nonce",window.UserLeap.nonce),S.id=We,S}(),Oe=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(W.installationMethod==="web-npm"||W.installationMethod==="web-npm-bundled"){const{default:S}=await Promise.resolve().then(()=>require("./view-5xam8eBF.cjs")).then(M=>M.view);S.configure(W),ee&&window.UserLeap.container&&Oe()}else ue&&(me.src=`${ue}${window.UserLeap.isMobileSDK?"":`?t=${Date.now()}`}`,ee&&me.addEventListener("load",()=>{window.UserLeap.container&&Oe()}),k==null||k.addEventListener("error",S=>{S.target instanceof HTMLScriptElement&&S.target.src===ue&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));N==null||N.appendChild(me);const Ce={success:!0,surveyState:"ready",surveyId:m,responseGroupUid:v};return window.UserLeap.isMobileSDK&&t&&(Ce.delay=t),Ce};function ce(r){var s;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const e=((s=window.UserLeap.windowDimensions)==null?void 0:s.width)??document.body.clientWidth;return Y(r)||e>10&&e<500}function Y(r){return Lt.has(r["userleap-platform"])}const ze=new WeakMap,Ut=(r,e)=>{try{return(n=>{var l,a;const t=ze.get(n);if(t)return t;if(!((l=n.trustedTypes)!=null&&l.createPolicy))throw new Error("Trusted types not supported");const o=(a=n.trustedTypes)==null?void 0:a.createPolicy("sprig-sdk",{createHTML:d=>d,createScript:d=>d,createScriptURL:d=>d});return ze.set(n,o),o})(e).createHTML(r)}catch(s){return console.warn("Could not create TrustedHTML object",s),r}},ge=(r,e,s=window)=>{var n;return e&&((n=s.trustedTypes)!=null&&n.createPolicy)?Ut(r,s):r},Re="ul-frame";globalThis.UserLeap&&globalThis.Sprig&&(globalThis.Sprig._gtm?globalThis.Sprig=globalThis.UserLeap:globalThis.UserLeap=globalThis.Sprig),globalThis.UserLeap||(globalThis.UserLeap=globalThis.Sprig),globalThis.Sprig||(globalThis.Sprig=globalThis.UserLeap);const be="0px",Ze=(r,e,s)=>{globalThis.UserLeap.container=document.createElement("div"),globalThis.UserLeap.container.className="ul-container"+(e?" ul-container-feedback":""),r&&(globalThis.UserLeap.container.dataset.studyId=r.toString());const n=st();s&&n&&!globalThis.UserLeap.useMobileStyling?n.appendChild(globalThis.UserLeap.container):document.body.appendChild(globalThis.UserLeap.container)},et=(r,e)=>{var n;kt();const s=globalThis.UserLeap.container;if(s)try{(n=s.parentNode)==null||n.removeChild(s),globalThis.UserLeap.container=null,I("trackStartUrl",null),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"dismissed"}),i.eventEmitter.emit(i.SprigEvent.SurveyClosed,{name:i.SprigEvent.SurveyClosed,initiator:r,"survey.id":parseInt(s.dataset.studyId),...e&&{studyType:e}})}catch(t){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} `+s),t instanceof Error&&globalThis.UserLeap.reportError("dismissActiveSurvey",t)}},tt=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:e})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),et(r,e)})},Tt=(r,e,s,n)=>{var p,g;const t={position:"fixed",bottom:"0px",right:be,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},o=Object.assign({},e,globalThis.UserLeap),{desktopDisplay:l}=e||{},a=l==="center-modal";let d;a&&(o.framePosition="center");let c=!1;if(s)(p=globalThis.UserLeap.windowDimensions)!=null&&p.width?t.width=`${globalThis.UserLeap.windowDimensions.width}px`:t.width="100%",(g=globalThis.UserLeap.windowDimensions)!=null&&g.height?t.maxHeight=globalThis.UserLeap.windowDimensions.height-20+"px":globalThis.UserLeap.maxHeight?t.maxHeight=globalThis.UserLeap.maxHeight:t.maxHeight=document.body.clientHeight-20+"px",["light","dark"].includes(o.overlayStyleMobile)&&(c=!0);else{t.width="360px",t.maxHeight=globalThis.UserLeap.maxHeight||"66vh";const y=()=>{c=!0,d={margin:"auto",position:"static"}};if(n)a?y():d={position:"relative",height:"300px"};else switch(o.framePosition){case"bottomLeft":d={left:be};break;case"topLeft":d={left:be,top:0};break;case"topRight":d={top:0};break;case"center":y()}}return c&&((y,b)=>{const u={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},h=b?y.overlayStyleMobile:y.overlayStyle;u["background-color"]=h==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",b||(u.margin="auto"),globalThis.UserLeap.container&&Object.assign(globalThis.UserLeap.container.style,u)})(o,s),Object.assign(r.style,t,d),c},Et=({productConfig:r,useMobileStyling:e,surveyId:s,isFeedback:n,enableCspTrustedTypes:t})=>{var b,u;const o=Re,l=n&&r.desktopDisplay==="slider";Ze(s,n,l),It();const a=document.createElement("iframe");a.id=o,a.setAttribute("title","Sprig User Feedback Dialog");const d=Tt(a,r,e,n);tt();let c=!1;a.setHeight=h=>{parseInt(a.style.height)==h&&c||(c=!0,a.style.height=`${h}px`,i.eventEmitter.emit(i.SprigEvent.SurveyHeight,{name:i.SprigEvent.SurveyHeight,contentFrameHeight:h,"survey.id":s}))};let p=!1;a.setWidth=h=>{parseInt(a.style.width)==h&&p||(p=!0,a.style.width=`${h}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:h,"survey.id":s}))},(b=globalThis.UserLeap.container)==null||b.appendChild(a),r&&(e?r.exitOnOverlayClickMobile:r.exitOnOverlayClick)&&globalThis.UserLeap.container&&(globalThis.UserLeap.container.onclick=()=>{i.eventEmitter.emit(i.SprigEvent.CloseSurveyOnOverlayClick)}),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":s});const g=(u=a.contentWindow)==null?void 0:u.document;if(g&&(g.open("text/html","replace"),g.write(ge("<!doctype html><head></head><body></body></html>",t,a.contentWindow)),g.close(),!e)){const h=g.body;h.style.display="flex",h.style.alignItems="center"}const y=g==null?void 0:g.head;return{frameId:o,contentWinDocHead:y,contentWindow:a.contentWindow,hasOverlay:d,iframe:a}},rt={[i.SprigEvent.SurveyFadingOut]:()=>{globalThis.UserLeap.container&&Object.assign(globalThis.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},It=()=>{Object.entries(rt).forEach(([r,e])=>{i.eventEmitter.on(r,e)})},kt=()=>{Object.entries(rt).forEach(([r,e])=>{i.eventEmitter.off(r,e)})},x=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,Ne=r=>r instanceof HTMLElement||r instanceof SVGElement,X=({document:r,elementId:e,styleString:s,nonce:n})=>{const t=r.getElementById(e);if(t)return void(t.textContent=s);const o=r.createElement("style");n&&(o.nonce=n),o.textContent=s,o.id=e,r.head.appendChild(o)},Be=(r,e)=>{const s=e.querySelector(r);if(!x(s))return 0;const n=getComputedStyle(s);return parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+(parseFloat(n.marginLeft)+parseFloat(n.marginRight))+(parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth))},it=(r,e,s)=>{const n=r.querySelector(".ul-card__container"),t=r.querySelector(".ul-app");let o=600,l=360;if(x(n)&&x(t)){const a=n.querySelector(".ul-card--matrix_grid"),d=!a&&e&&s;try{d&&(t.style.width="360px"),o=n.scrollHeight,o+=(g=>{const y=g.querySelector(".sprig-question-body"),b=g.querySelector(".ul-card"),u=g.querySelector(".ul-card-main-content"),h=g.querySelector(".ul-footer"),v=g.querySelector(".sprig-container");let m=0;return x(b)&&(m+=b.scrollHeight-b.clientHeight),x(u)&&(m+=u.scrollHeight-u.clientHeight),x(y)&&(m+=y.scrollHeight-y.clientHeight),x(h)&&x(v)&&v.clientHeight===0&&(m+=h.clientHeight),m})(r);const c=getComputedStyle(n),p=parseFloat(c.marginTop)+parseFloat(c.marginBottom);o+=p+(parseFloat(c.borderTopWidth)+parseFloat(c.borderBottomWidth)),a&&(l=a.scrollWidth,l+=Be(".ul-card__container",r),l+=Be(".sprig-question-body",r))}finally{d&&t.style.removeProperty("width")}}return[o+2,l]},st=()=>f,z=()=>document.getElementById("sprig-feedback-container"),Se=()=>document.getElementById("sprig-feedback-loading-animation"),ot=()=>!!document.getElementById(Re);let $e=!1,f=null,D=null,_e=!1,K=null,j=null;const Rt=["bottom-left","bottom-right","center-left","center-right"],se=()=>{var e;const r=window.UserLeap.container;return((e=r==null?void 0:r.parentElement)==null?void 0:e.id)==="sprig-feedback-loading-container"},nt=()=>document.getElementById("sprig-feedback-error-container"),at=()=>{if(!f)return 0;const r=f==null?void 0:f.clientWidth,e=window.getComputedStyle(f);return r+parseInt(e.borderRightWidth||"0")+parseInt(e.borderLeftWidth||"0")},oe=r=>{const e=z();e&&(j!=null&&j.endsWith("right")?e.style.right=`${r}px`:j!=null&&j.endsWith("left")&&(e.style.left=`${r}px`))},ve=()=>{if(f&&(se()||nt())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,$),Le();const r=at();return oe(-r),!0}return!1},$=()=>{if(!f||!D)return;const r=Se();r&&r.remove(),f.style.height="auto",f.style.width="auto",D.disabled=!1,_e=!1},Le=()=>{if(f&&!Se()){const r=(()=>{var s;if(Se())return;const e=document.createElement("div");return e.className="ul-loading-spinner-container",e.id="sprig-feedback-loading-animation",e.role="progressbar",e.setAttribute("aria-live","polite"),e.setAttribute("aria-busy","true"),e.setAttribute("aria-label","Processing..."),e.innerHTML=ge(`
|
|
1
|
+
"use strict";var wt=Object.defineProperty;var St=(r,e,s)=>e in r?wt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var F=(r,e,s)=>St(r,typeof e!="symbol"?e+"":e,s);const i=require("./metricsReporter-CIbUupJP.cjs"),qe=()=>{try{return window.parent.Intercom}catch{return null}},Ve=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=qe();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=qe();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class Xe{static disable(){Ve.forEach(e=>e.disable())}static enable(){Ve.forEach(e=>e.enable())}}const We="ul-view-sdk-script",Lt=new Set(["ios","android"]),O="visitors",C="environments";async function _(r,e){var o,l,a;const{shouldDropOnRateLimit:s,...n}=e;n.headers=Object.assign(i.getHttpHeaders(window.UserLeap),n.headers);const t=await i.sprigFetch(r,{...n,shouldDropOnRateLimit:s});if(t.ok){const d=(o=t.headers)==null?void 0:o.get("Authorization"),c=d?d.split(" "):void 0,p=c&&c.length===2?c[1]:void 0,g=(l=t.headers)==null?void 0:l.get("x-ul-visitor-id");if(window.UserLeap.userId&&g===window.UserLeap.visitorId){const y=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");y&&y[window.UserLeap.envId]===g&&(delete y[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",y))}p&&g&&(g!==window.UserLeap.visitorId||window.UserLeap.token!==p)&&(I("token",p),I("vid",g),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:g}),window.UserLeap.token=p,window.UserLeap.visitorId=g)}return(a=t.json)!=null&&a.logMessage&&console.warn(`[Sprig] ${t.json.logMessage}`),t}function I(r,e){const s=i.localStorageHelper.getItemObject("userleap.ids");let n=s[window.UserLeap.envId];n?n[r]=e:n={[r]:e},s[window.UserLeap.envId]=n,i.localStorageHelper.setItemObject("userleap.ids",s)}function ke(){return window.previewMode?"0":window.UserLeap.visitorId??""}function R(r,e,s){const n=[window.UserLeap._API_URL,"sdk",r];return e&&e.forEach(t=>{n.push(t),t===C?n.push(window.UserLeap.envId):t===O&&n.push(ke())}),s&&n.push(s),n.join("/")}const G=async(r,e,s)=>{var Pe,He,Me,Fe;const{context:n,delay:t,avatars:o,experimentFlags:l,forceBrandedLogo:a,endCard:d,isFeedback:c=!1,heatmap:p,locale:g,layout:y,previewMode:b,productConfig:u,questions:h,responseGroupUid:v,surveyId:m,uuid:U,vid:w,sessionReplay:T,studyType:P,surveyVisitorAttributes:L}=r,E=i.getHttpHeaders(window.UserLeap),A=Y(E),V=ce(E);if(T)if(A)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:v,hasQuestions:!!(h!=null&&h.length),surveyId:m,uploadId:T.uploadId,replayType:T.replayDurationType??"before",seconds:T.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:v,surveyId:m,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}});else{if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};i.modules.replay.scheduleOrCaptureReplay({responseGroupId:v,surveyId:m,visitorId:w,replayParams:T,completeUploadHeaders:E,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:h.length===0})}if(p){if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};const{eventId:S,replayParams:M,responseGroupUid:he,surveyId:ye}=p;await i.modules.replay.initializeReplay({maxReplayDurationSeconds:300,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0,apiUrl:window.UserLeap._API_URL,replaySettings:s}),i.modules.replay.tryReplayAction(()=>{var je;return(je=i.modules.replay)==null?void 0:je.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:E,eventId:S,isHeatmap:!0,replayParams:M,responseGroupId:he,surveyId:ye,triggerTimestamp:Date.now(),visitorId:w})},"Error in scheduling/capturing replay")}if(w==null||!(h!=null&&h.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:w}),{success:!1,message:"[Sprig] no survey found",surveyState:window.UserLeap.container?"previous survey ready":"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const S="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(S),{success:!1,message:S,surveyState:"previous survey ready"}}if(w!==window.UserLeap.visitorId&&U!==window.UserLeap.visitorId&&!window.previewMode){const S="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(S)),{success:!1,message:S,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:m}),(Pe=i.modules.replay)==null||Pe.RecordSurveyShown({id:m,userAgent:window.navigator.userAgent}),Xe.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":m,layout:y});let H,N,k,ee,te=document.createElement("div");const xe=S=>{const{"view.version":M}=S;M!==E["x-ul-sdk-version"]&&et(),i.eventEmitter.removeListener("verify.view.version",xe)};i.eventEmitter.on("verify.view.version",xe),window.UserLeap.useMobileStyling=V,i.shouldDirectEmbed(E)?(H="ul-direct-embeded-frame",N=document.head,k=window,ee=!1,(()=>{const S=i.getHttpHeaders(window.UserLeap),M=Y(S),he=window.UserLeap.forceDirectEmbed,ye=S["userleap-platform"]==="web";return M||he&&ye})()&&(Ze(m,c),te.id=H,window.UserLeap.container.appendChild(te),tt(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":m}))):{frameId:H,contentWinDocHead:N,contentWindow:k,hasOverlay:ee,iframe:te}=Et({productConfig:u,useMobileStyling:V,surveyId:m,isFeedback:c,enableCspTrustedTypes:(He=window.UserLeap._config)==null?void 0:He.enableCspTrustedTypes}),window.UserLeap.frameId=H;const W={apiURL:window.UserLeap._API_URL,avatars:o,cards:h,configureExitOnOverlayClick:S=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,S)},context:n,endCard:d,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),experimentFlags:l,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:a,frame:te,headers:E,layout:y,locale:g,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.sessionStorageHelper.getItem("sprig.previewKey"),previewMode:b||!!window.previewMode,productConfig:{framePosition:u==null?void 0:u.framePosition,desktopDisplay:u==null?void 0:u.desktopDisplay,placement:u==null?void 0:u.placement},responseGroupUid:v,startingQuestionIdx:(Me=window.UserLeap.config)==null?void 0:Me.startingQuestionIdx,studyType:P,styleNonce:window.UserLeap.styleNonce,surveyId:m,tabTitle:document.title,trackPageViewUrl:e,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:V,userId:U,viewDocument:k==null?void 0:k.document,viewWindow:k,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},surveyVisitorAttributes:L||{},...window.UserLeap._config};(Fe=window.UserLeap._config)!=null&&Fe.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const ft=(c?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??u.customStyles;W.customStyles=ft,k&&(k.__cfg=W);const ue=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:W.path,Ae=document.getElementById(We);Ae&&Ae.remove();const me=function(){const S=document.createElement("script");return window.UserLeap.isMobileSDK||S.setAttribute("type","module"),window.UserLeap.nonce&&S.setAttribute("nonce",window.UserLeap.nonce),S.id=We,S}(),Oe=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(W.installationMethod==="web-npm"||W.installationMethod==="web-npm-bundled"){const{default:S}=await Promise.resolve().then(()=>require("./view-BxTV1_m-.cjs")).then(M=>M.view);S.configure(W),ee&&window.UserLeap.container&&Oe()}else ue&&(me.src=`${ue}${window.UserLeap.isMobileSDK?"":`?t=${Date.now()}`}`,ee&&me.addEventListener("load",()=>{window.UserLeap.container&&Oe()}),k==null||k.addEventListener("error",S=>{S.target instanceof HTMLScriptElement&&S.target.src===ue&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));N==null||N.appendChild(me);const Ce={success:!0,surveyState:"ready",surveyId:m,responseGroupUid:v};return window.UserLeap.isMobileSDK&&t&&(Ce.delay=t),Ce};function ce(r){var s;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const e=((s=window.UserLeap.windowDimensions)==null?void 0:s.width)??document.body.clientWidth;return Y(r)||e>10&&e<500}function Y(r){return Lt.has(r["userleap-platform"])}const ze=new WeakMap,Ut=(r,e)=>{try{return(n=>{var l,a;const t=ze.get(n);if(t)return t;if(!((l=n.trustedTypes)!=null&&l.createPolicy))throw new Error("Trusted types not supported");const o=(a=n.trustedTypes)==null?void 0:a.createPolicy("sprig-sdk",{createHTML:d=>d,createScript:d=>d,createScriptURL:d=>d});return ze.set(n,o),o})(e).createHTML(r)}catch(s){return console.warn("Could not create TrustedHTML object",s),r}},ge=(r,e,s=window)=>{var n;return e&&((n=s.trustedTypes)!=null&&n.createPolicy)?Ut(r,s):r},Re="ul-frame";globalThis.UserLeap&&globalThis.Sprig&&(globalThis.Sprig._gtm?globalThis.Sprig=globalThis.UserLeap:globalThis.UserLeap=globalThis.Sprig),globalThis.UserLeap||(globalThis.UserLeap=globalThis.Sprig),globalThis.Sprig||(globalThis.Sprig=globalThis.UserLeap);const be="0px",Ze=(r,e,s)=>{globalThis.UserLeap.container=document.createElement("div"),globalThis.UserLeap.container.className="ul-container"+(e?" ul-container-feedback":""),r&&(globalThis.UserLeap.container.dataset.studyId=r.toString());const n=st();s&&n&&!globalThis.UserLeap.useMobileStyling?n.appendChild(globalThis.UserLeap.container):document.body.appendChild(globalThis.UserLeap.container)},et=(r,e)=>{var n;kt();const s=globalThis.UserLeap.container;if(s)try{(n=s.parentNode)==null||n.removeChild(s),globalThis.UserLeap.container=null,I("trackStartUrl",null),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"dismissed"}),i.eventEmitter.emit(i.SprigEvent.SurveyClosed,{name:i.SprigEvent.SurveyClosed,initiator:r,"survey.id":parseInt(s.dataset.studyId),...e&&{studyType:e}})}catch(t){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} `+s),t instanceof Error&&globalThis.UserLeap.reportError("dismissActiveSurvey",t)}},tt=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:e})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),et(r,e)})},Tt=(r,e,s,n)=>{var p,g;const t={position:"fixed",bottom:"0px",right:be,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},o=Object.assign({},e,globalThis.UserLeap),{desktopDisplay:l}=e||{},a=l==="center-modal";let d;a&&(o.framePosition="center");let c=!1;if(s)(p=globalThis.UserLeap.windowDimensions)!=null&&p.width?t.width=`${globalThis.UserLeap.windowDimensions.width}px`:t.width="100%",(g=globalThis.UserLeap.windowDimensions)!=null&&g.height?t.maxHeight=globalThis.UserLeap.windowDimensions.height-20+"px":globalThis.UserLeap.maxHeight?t.maxHeight=globalThis.UserLeap.maxHeight:t.maxHeight=document.body.clientHeight-20+"px",["light","dark"].includes(o.overlayStyleMobile)&&(c=!0);else{t.width="360px",t.maxHeight=globalThis.UserLeap.maxHeight||"66vh";const y=()=>{c=!0,d={margin:"auto",position:"static"}};if(n)a?y():d={position:"relative",height:"300px"};else switch(o.framePosition){case"bottomLeft":d={left:be};break;case"topLeft":d={left:be,top:0};break;case"topRight":d={top:0};break;case"center":y()}}return c&&((y,b)=>{const u={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},h=b?y.overlayStyleMobile:y.overlayStyle;u["background-color"]=h==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",b||(u.margin="auto"),globalThis.UserLeap.container&&Object.assign(globalThis.UserLeap.container.style,u)})(o,s),Object.assign(r.style,t,d),c},Et=({productConfig:r,useMobileStyling:e,surveyId:s,isFeedback:n,enableCspTrustedTypes:t})=>{var b,u;const o=Re,l=n&&r.desktopDisplay==="slider";Ze(s,n,l),It();const a=document.createElement("iframe");a.id=o,a.setAttribute("title","Sprig User Feedback Dialog");const d=Tt(a,r,e,n);tt();let c=!1;a.setHeight=h=>{parseInt(a.style.height)==h&&c||(c=!0,a.style.height=`${h}px`,i.eventEmitter.emit(i.SprigEvent.SurveyHeight,{name:i.SprigEvent.SurveyHeight,contentFrameHeight:h,"survey.id":s}))};let p=!1;a.setWidth=h=>{parseInt(a.style.width)==h&&p||(p=!0,a.style.width=`${h}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:h,"survey.id":s}))},(b=globalThis.UserLeap.container)==null||b.appendChild(a),r&&(e?r.exitOnOverlayClickMobile:r.exitOnOverlayClick)&&globalThis.UserLeap.container&&(globalThis.UserLeap.container.onclick=()=>{i.eventEmitter.emit(i.SprigEvent.CloseSurveyOnOverlayClick)}),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":s});const g=(u=a.contentWindow)==null?void 0:u.document;if(g&&(g.open("text/html","replace"),g.write(ge("<!doctype html><head></head><body></body></html>",t,a.contentWindow)),g.close(),!e)){const h=g.body;h.style.display="flex",h.style.alignItems="center"}const y=g==null?void 0:g.head;return{frameId:o,contentWinDocHead:y,contentWindow:a.contentWindow,hasOverlay:d,iframe:a}},rt={[i.SprigEvent.SurveyFadingOut]:()=>{globalThis.UserLeap.container&&Object.assign(globalThis.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},It=()=>{Object.entries(rt).forEach(([r,e])=>{i.eventEmitter.on(r,e)})},kt=()=>{Object.entries(rt).forEach(([r,e])=>{i.eventEmitter.off(r,e)})},x=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,Ne=r=>r instanceof HTMLElement||r instanceof SVGElement,X=({document:r,elementId:e,styleString:s,nonce:n})=>{const t=r.getElementById(e);if(t)return void(t.textContent=s);const o=r.createElement("style");n&&(o.nonce=n),o.textContent=s,o.id=e,r.head.appendChild(o)},Be=(r,e)=>{const s=e.querySelector(r);if(!x(s))return 0;const n=getComputedStyle(s);return parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+(parseFloat(n.marginLeft)+parseFloat(n.marginRight))+(parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth))},it=(r,e,s)=>{const n=r.querySelector(".ul-card__container"),t=r.querySelector(".ul-app");let o=600,l=360;if(x(n)&&x(t)){const a=n.querySelector(".ul-card--matrix_grid"),d=!a&&e&&s;try{d&&(t.style.width="360px"),o=n.scrollHeight,o+=(g=>{const y=g.querySelector(".sprig-question-body"),b=g.querySelector(".ul-card"),u=g.querySelector(".ul-card-main-content"),h=g.querySelector(".ul-footer"),v=g.querySelector(".sprig-container");let m=0;return x(b)&&(m+=b.scrollHeight-b.clientHeight),x(u)&&(m+=u.scrollHeight-u.clientHeight),x(y)&&(m+=y.scrollHeight-y.clientHeight),x(h)&&x(v)&&v.clientHeight===0&&(m+=h.clientHeight),m})(r);const c=getComputedStyle(n),p=parseFloat(c.marginTop)+parseFloat(c.marginBottom);o+=p+(parseFloat(c.borderTopWidth)+parseFloat(c.borderBottomWidth)),a&&(l=a.scrollWidth,l+=Be(".ul-card__container",r),l+=Be(".sprig-question-body",r))}finally{d&&t.style.removeProperty("width")}}return[o+2,l]},st=()=>f,z=()=>document.getElementById("sprig-feedback-container"),Se=()=>document.getElementById("sprig-feedback-loading-animation"),ot=()=>!!document.getElementById(Re);let $e=!1,f=null,D=null,_e=!1,K=null,j=null;const Rt=["bottom-left","bottom-right","center-left","center-right"],se=()=>{var e;const r=window.UserLeap.container;return((e=r==null?void 0:r.parentElement)==null?void 0:e.id)==="sprig-feedback-loading-container"},nt=()=>document.getElementById("sprig-feedback-error-container"),at=()=>{if(!f)return 0;const r=f==null?void 0:f.clientWidth,e=window.getComputedStyle(f);return r+parseInt(e.borderRightWidth||"0")+parseInt(e.borderLeftWidth||"0")},oe=r=>{const e=z();e&&(j!=null&&j.endsWith("right")?e.style.right=`${r}px`:j!=null&&j.endsWith("left")&&(e.style.left=`${r}px`))},ve=()=>{if(f&&(se()||nt())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,$),Le();const r=at();return oe(-r),!0}return!1},$=()=>{if(!f||!D)return;const r=Se();r&&r.remove(),f.style.height="auto",f.style.width="auto",D.disabled=!1,_e=!1},Le=()=>{if(f&&!Se()){const r=(()=>{var s;if(Se())return;const e=document.createElement("div");return e.className="ul-loading-spinner-container",e.id="sprig-feedback-loading-animation",e.role="progressbar",e.setAttribute("aria-live","polite"),e.setAttribute("aria-busy","true"),e.setAttribute("aria-label","Processing..."),e.innerHTML=ge(`
|
|
2
2
|
<div class="ul-loading-spinner">
|
|
3
3
|
<div class="first"></div>
|
|
4
4
|
<div class="second"></div>
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
10
10
|
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
11
11
|
<circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
|
|
12
|
-
</svg>`,(s=window.UserLeap._config)==null?void 0:s.enableCspTrustedTypes);const e=document.createElement("h3");return e.className="sprig-feedback-error-text",e.innerText="There was an error while loading the survey",r.appendChild(e),r},Ue=new class{constructor(){F(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(r){try{return!(!r||typeof r!="object"||Array.isArray(r))&&(Object.keys(this._ldData).forEach(e=>{delete this._ldData[e]}),Object.keys(r).forEach(e=>this._ldData[`!launch_darkly_${e}`]=(r[e]??0)+1),!0)}catch(e){return e instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",e),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}};Object.freeze(Ue);const ie=new class{constructor(){F(this,"_optimizelyData",{})}setOptimizelyExperiment(r,e=!0){if(!r||typeof r!="object")return!1;const{experiments:s}=r;try{return e&&Object.keys(this._optimizelyData).map(n=>{delete this._optimizelyData[n]}),s&&s.map(n=>{const{id:t,variation:o}=n,l=this.transformExperimentId(t);o&&typeof o=="string"&&(this._optimizelyData[l]=o)}),!0}catch(n){return n instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",n),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(r){return this._optimizelyData[this.transformExperimentId(r)]}transformExperimentId(r){return"!optimizely_experiments_"+r}getAndSetWebOptimizelyExperiments(){var r;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const e=(r=window.optimizely.get("state"))==null?void 0:r.getExperimentStates({isActive:!0});if(e){const s=Object.keys(e).map(n=>{var t,o;return(t=e[n].variation)!=null&&t.name?{id:n,variation:(o=e[n].variation)==null?void 0:o.name}:{id:n,variation:"Original"}});return this.setOptimizelyExperiment({experiments:s},!1),!0}return!1}return!1}catch(e){return e instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",e),!1}}};Object.freeze(ie);class Dt{constructor(e,s){F(this,"paused");F(this,"queue");F(this,"ul");this.ul=e,this.paused=!1,this.queue=[],this.flush(s)}flush(e){const s=e.length;if(s)for(let n=0;n<s;n++)this.push(e[n])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const e=this.queue.slice();this.empty(),this.flush(e)}push(e){if(this.paused)this.queue.push(e);else if(e instanceof Function)e();else{const s=Array.prototype.slice.call(e,1),n=e[0],t=this.ul[n];t instanceof Function?t.apply(this.ul,s):n&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",n)}}perform(e){if(this.paused){let s=()=>{};const n=new Promise(function(t){s=function(){t(e())}});return this.queue.push(s),n}return e()}empty(){this.queue.length=0}}let dt,pt;const Te=r=>{let e=0,s=r.firstElementChild;for(;s;)e+=Te(s),s.shadowRoot&&(e+=Te(s.shadowRoot)),s=s.nextElementSibling,e++;return e},Ke=()=>{dt.report(Te(document.body)),pt.report(document.documentElement.innerHTML.toString().length)},Ee=(r,e)=>{const s=performance.now();document.hidden?setTimeout(()=>Ee(r,e),r):setTimeout(()=>{const n=performance.now()-s;e.report(n/1e3),setTimeout(()=>Ee(r,e),r)},0)};let ne,ae,le,de,Je,q={};const re=(r,e=1)=>{const{name:s}=r;q[s]=(q[s]||0)+e},ct=r=>{let e=1;return r.childNodes.forEach(s=>{e+=ct(s)}),e},Qe=r=>{let e=0;return r.forEach(s=>{e+=ct(s)}),e},xt=r=>{switch(r.type){case"childList":return re(ne,Qe(r.addedNodes)),void re(ae,Qe(r.removedNodes));case"attributes":return void re(le);case"characterData":return void re(de)}},At=r=>r.forEach(xt),Ot=()=>{ne.report(q[ne.name]||0),ae.report(q[ae.name]||0),le.report(q[le.name]||0),de.report(q[de.name]||0),q={}},Ct=(r=1e3)=>{ne=i.registerMetric("sdk_mutations_nodes_added"),ae=i.registerMetric("sdk_mutations_nodes_removed"),le=i.registerMetric("sdk_mutations_attributes_changed"),de=i.registerMetric("sdk_mutations_character_data"),Je=new MutationObserver(At),Je.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(Ot,r)},Pt=({isWeb:r,reportingIntervalSeconds:e,thresholds:s,postMetrics:n})=>{i.registerThresholds(s,(t,o)=>{var l,a;if((l=i.modules.replay)!=null&&l.isReplayRecording()){const d=`Value: ${t} on ${o.metric} violated threshold of ${o.type} ${o.value}`;(a=i.modules.replay)==null||a.disableRecording("Threshold violated",new Error(d),{reportError:!1}),window.UserLeap.reportError("Sdk Performance Metric threshold violated",new Error("Sdk Performance Metric threshold violated"),{metricName:o.metric,type:o.type,value:o.value},{metricName:o.metric}),i.disableThresholdChecking()}}),i.initPerformanceReporting({reportingIntervalSeconds:e,postMetrics:n}),r&&(((t=1e3)=>{const o=i.registerMetric("sdk_event_queue_latency_seconds");Ee(t,o)})(),((t=1e4)=>{dt=i.registerMetric("sdk_dom_nodes_count"),pt=i.registerMetric("sdk_page_html_characters"),Ke(),setInterval(Ke,t)})(),Ct())},Ht="test",Mt=["popState","pushState","replaceState"];let De,J;const pe={},B="!email",gt="pageUrl";var Ye;let fe=((Ye=globalThis.location)==null?void 0:Ye.href)||"";function Q(r){var a,d;const{pageUrlEvents:e,interactiveEvents:s,dismissOnPageChange:n,platform:t}=globalThis.UserLeap._config;if(t&&t!=="web")return;fe!==globalThis.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:fe,to:globalThis.location.href}),fe=globalThis.location.href;const o=ht().trackStartUrl,l=o?String(o):null;e&&bt(globalThis.location.href),s&&(mt(),Ft()),st()&&(()=>{if(se())return;const c=z();c&&(i.checkUrlStillMatching(K)||(c.remove(),K=null,f=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((d=(a=i.modules.replay)==null?void 0:a.checkPendingHeatmapsUrl())==null||d.then(c=>{var p;c&&((p=i.modules.replay)==null||p.uploadReadyPendingCaptures(!0))})),!se()&&n&&l&&l!==globalThis.location.href&&r&&Mt.includes(r.type)&&globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const ut={capture:!0},Ft=()=>{const r=globalThis.UserLeap._config.interactiveEvents.filter(s=>i.checkUrlMatch(s,globalThis.location.href)).map(s=>{const{name:n,properties:t}=s,{selector:o,innerText:l}=t;return o?a=>{if(Ne(a.target))try{a.target.closest(o)&&globalThis.UserLeap("track",n)}catch{}return!1}:a=>(Ne(a.target)&&a.target.innerText===l&&globalThis.UserLeap("track",n),!1)}),e=s=>r.forEach(n=>n(s));globalThis.UserLeap._config.interactiveEventsHandler=e,globalThis.addEventListener("click",e,ut)},mt=()=>{globalThis.UserLeap._config.interactiveEventsHandler&&globalThis.removeEventListener("click",globalThis.UserLeap._config.interactiveEventsHandler,ut),delete globalThis.UserLeap._config.interactiveEventsHandler};function ht(){const r=i.localStorageHelper.getItemObject("userleap.ids");return(r==null?void 0:r[globalThis.UserLeap.envId])||{}}function yt(){if(globalThis.previewMode)return;const r=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map")||{},e=r[globalThis.UserLeap.envId];globalThis.UserLeap.visitorId=e||i.v4(),i.breadcrumbsLogger.info("NewVid",{vid:globalThis.UserLeap.visitorId}),I("vid",globalThis.UserLeap.visitorId),e||(r[globalThis.UserLeap.envId]=globalThis.UserLeap.visitorId,i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",r)),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:globalThis.UserLeap.visitorId})}function bt(r,e,s,n){var t,o;try{if(r.endsWith("mock_snippet.html"))return;i.breadcrumbsLogger.info("PageView",{url:r});const l=(t=document==null?void 0:document.querySelector('meta[name="description"]'))==null?void 0:t.getAttribute("content");(o=i.modules.replay)==null||o.RecordPageView({...l&&{description:l},url:r,referrer:document.referrer,pageTitle:document.title});const a=globalThis.UserLeap._config.pageUrlEvents;let d=!1;if(a&&a.length)for(let p=0;p<a.length&&(d=i.checkUrlMatch(a[p],r),!d);p++);if(!d)return;globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",r);const c={url:r};n&&(c.trackPageView=!0),globalThis.UserLeap._queue.push(["track",gt,e,c,s])}catch(l){l instanceof Error&&(l.stack=r,globalThis.UserLeap.reportError("trackPageView",l)),console.warn("[Sprig] (ERR-428) Failed to track page view",l)}}function jt(){var e;const r=((e=globalThis.Backbone)==null?void 0:e.history)||globalThis.history;"pushState"in r&&(r.pushState=(s=>function(...n){const t=s.apply(this,n),o=new Event("pushState");return globalThis.dispatchEvent(o),Q(o),t})(r.pushState)),"replaceState"in r&&(r.replaceState=(s=>function(...n){const t=s.apply(this,n),o=new Event("replaceState");return globalThis.dispatchEvent(o),Q(o),t})(r.replaceState)),["hashchange","popstate"].forEach(s=>globalThis.addEventListener(s,Q,!0))}async function we(r,e){const s=ke();r&&!e&&(globalThis.UserLeap._config.mode=Ht);const n=ce(i.getHttpHeaders(globalThis.UserLeap)),t=await _(function(o){const l=new URL(R("1",[C],"questions"));return Object.entries(o||{}).forEach(([a,d])=>{d&&l.searchParams.append(a,String(d))}),l.toString()}({desktopDisplay:globalThis.UserLeap._config.desktopDisplay,isMobile:n,previewLanguage:globalThis.UserLeap._config.previewLanguage,surveyid:r==null?void 0:r.surveyId,surveytemplateid:r==null?void 0:r.surveyTemplateId,vid:s}),{shouldDropOnRateLimit:!0});if(!t.ok)return t.reportError&&t.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",t.error),globalThis.UserLeap.reportError("getQuestions",t.error)),{success:!1,surveyState:"no survey"};if(t.json.delay&&await i.delay(t.json.delay),!t.json.isFeedback)return G(t.json,J,De);{const{feedbackLabel:o,productConfig:l,surveyUuid:a,feedbackCustomStyles:d}=t.json,{buttonTheme:c,placement:p,desktopDisplay:g}=l;lt({customStyles:d,buttonTheme:c,desktopDisplay:g,eventId:0,feedbackLabel:o,placement:p,surveyUuid:a,surveyId:r==null?void 0:r.surveyId},t.json)}}function qt(r){if(!r)return;globalThis.UserLeap._config=r,r.mute&&globalThis.UserLeap._queue.pause();const{interactiveEvents:e,pageUrlEvents:s,dismissOnPageChange:n}=r;e&&function(t){let o=t.length;for(;o;){const l=Math.floor(Math.random()*o);o-=1;const a=t[o];t[o]=t[l],t[l]=a}}(e),(e||s||n)&&(jt(),Q())}const Vt=function(r){if(!globalThis.UserLeap)return;const e=async(t={})=>{var m,U,w,T,P;const{userId:o,anonymousId:l,metadata:a={},properties:d,showSurveyCallback:c}=t;let{eventName:p}=t;if(globalThis.UserLeap.debugMode&&p!==gt&&console.info("[DEBUG] Sprig track",t),r.mode==="test")return;const g=i.sessionStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!globalThis.UserLeap.userId&&!o){const L="[Sprig] - Skipping tracking without userId";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(!p||p.trim().length===0){p=p?String(p):"";const L="[Sprig] - Invalid event name "+p;return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}const y=J??globalThis.location.href;a.url||(a.url=y),I("trackStartUrl",y),(U=(m=globalThis.UserLeap)==null?void 0:m._config)!=null&&U.optimizelyEnabled&&(Y(i.getHttpHeaders(globalThis.UserLeap))||ie.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},ie.getAllOptimizelyExperiments())),(T=(w=globalThis.UserLeap)==null?void 0:w._config)!=null&&T.launchDarklyEnabled&&(a.launchDarklyFlags=Ue.getAllLaunchDarklyVariations()),o&&(globalThis.UserLeap.userId=o),l&&(globalThis.UserLeap.partnerAnonymousId=l),d&&(a.eventProperties=d),(P=i.modules.replay)==null||P.RecordEvent({name:p,url:a.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:p});const b=globalThis.UserLeap.delayingSurvey||ot()?await _(R("1",[O],"events/batch"),{body:JSON.stringify({events:[{event:p,metadata:a}],previewKey:g}),method:"POST",shouldDropOnRateLimit:!0}):await _(R("1",[O],"events"),{body:JSON.stringify({event:p,metadata:a,previewKey:g}),method:"POST",shouldDropOnRateLimit:!0});if(!b.ok){const L="[Sprig] (ERR-421) Failed to track event";return b.reportError&&(console.warn(L,b.error),b.error&&globalThis.UserLeap.reportError("track",b.error)),{success:!1,message:L,error:b.error,surveyState:"no survey"}}o&&I("uid",o),l&&I("aid",l);const u=b.json;u.invalidPreviewKey&&i.sessionStorageHelper.removeItem("sprig.previewKey");const h=a.trackPageView?a.url:void 0;return u!=null&&u.feedbackButton&<(u.feedbackButton,void 0,h),await async function(L,E){var V,H;let A=!0;return!(E&&((V=L==null?void 0:L.json)!=null&&V.surveyId)&&(globalThis.UserLeap.delayingSurvey=!0,A=await E(L.json.surveyId),globalThis.UserLeap.delayingSurvey=!1,!A))&&((H=L==null?void 0:L.json)!=null&&H.delay&&!globalThis.UserLeap.isMobileSDK&&(globalThis.UserLeap.delayingSurvey=!0,await i.delay(L.json.delay),globalThis.UserLeap.delayingSurvey=!1),A)}(b,c)?function(L){if(!globalThis.UserLeap._config.dismissOnPageChange)return!0;const E=new URL(L),A=new URL(J??globalThis.location.href);return E.hostname===A.hostname&&E.pathname===A.pathname}(y)?G(u,h,De):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},s=(t,o)=>{var a;const l=(a=t==null?void 0:t.querySelector(`[id="${Re}"]`))==null?void 0:a.contentDocument;l&&X({document:l,elementId:"ul-custom-style",styleString:o})},n={displaySurvey:async t=>(console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.Override),we({surveyId:t},!0)),_previewSurvey(t){globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.Override),we({surveyTemplateId:t},!1)},_reviewSurvey(t){globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.Override),we({surveyId:t},!1)},previewSurvey(t){n._previewSurvey(t)},reviewSurvey(t){n._reviewSurvey(t)},mute(){globalThis.UserLeap._queue.pause()},unmute(){globalThis.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(t=i.DismissReason.API){globalThis.UserLeap.container&&(t===i.DismissReason.Closed&&globalThis.Sprig.trackHistory&&globalThis.Sprig.trackHistory({event:"closed"}),i.eventEmitter.emit(i.SprigEvent.SurveyCloseRequested,{name:i.SprigEvent.SurveyCloseRequested,initiator:t,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}),i.eventEmitter.emit(i.SprigEvent.SurveyWillClose,{name:i.SprigEvent.SurveyWillClose,initiator:t,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}))},async setAttribute(t,o){if(!t||!o&&o!==0&&o!==!1){const l="[Sprig] - Disregarding empty attribute / value provided";return console.warn(l),{success:!1,message:l}}return this.setAttributes({[t]:o})},async setAttributes(t){if(t==null||Object.keys(t).length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}return this.identifyAndSetAttributes({attributes:t})},async identifyAndSetAttributes(t){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",t),r.mode==="test")return;if(t===null||typeof t!="object"||!(t.userId||t.anonymousId||t.attributes)){const p="[Sprig] - Disregarding empty payload provided";return console.warn(p),{success:!1,message:p}}const{userId:o,anonymousId:l,attributes:a}=t;if(r.requireUserIdForTracking&&!globalThis.UserLeap.userId&&!o){const p="[Sprig] - Skipping tracking without userId";return console.warn(p),{success:!1,message:p}}if(a){a.email&&!a[B]&&(a[B]=a.email,delete a.email);const p=Object.keys(a);for(const g of p)a[g]===pe[g]&&delete a[g]}if(!(a&&Object.keys(a).length!==0||o&&globalThis.UserLeap.userId!==o||l&&globalThis.UserLeap.partnerAnonymousId!==l))return{success:!0};const d={};let c;return o&&(d.userId=globalThis.UserLeap.userId=o),l&&(d.partnerAnonymousId=globalThis.UserLeap.partnerAnonymousId=l),a&&Object.keys(a).length>0?(c=await _(R("1",[C,O],"attributes"),{body:JSON.stringify(a),method:"PUT"}),c.ok?Object.assign(pe,a):c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&globalThis.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await _(R("1",[C,O]),{body:JSON.stringify(d),method:"PUT"}),a&&a[B]&&(globalThis.UserLeap.email=a[B]),c.ok&&(o&&I("uid",o),l&&I("aid",l)),{success:!!c.ok}},async removeAttributes(t){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",t),r.mode==="test")return;if(t==null||t.length===0){const l="[Sprig] - Disregarding empty attributes provided";return console.warn(l),{success:!1,message:l}}if(r.requireUserIdForTracking&&!globalThis.UserLeap.userId){const l="[Sprig] - Skipping tracking without userId";return console.warn(l),{success:!1,message:l}}const o=await _(R("1",[C,O],"attributes"),{body:JSON.stringify({delete:t}),method:"DELETE"});return!o.ok&&o.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",o.error),o.error&&globalThis.UserLeap.reportError("removeAttributes",o.error)),{success:!!o.ok}},async addSurveyListener(t){i.eventEmitter.on(i.SprigEvent.SurveyLifeCycle,t)},async removeSurveyListener(t){i.eventEmitter.removeListener(i.SprigEvent.SurveyLifeCycle,t)},async addListener(t,o){i.eventEmitter.on(t,o)},async removeListener(t,o){i.eventEmitter.removeListener(t,o)},async removeAllListeners(){i.eventEmitter.removeAllListeners()},setPreviewKey(t){t&&typeof t=="string"&&i.sessionStorageHelper.isStorageAvailable&&t&&i.sessionStorageHelper.setItem("sprig.previewKey",t)},async setUserId(t){var a;if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",t),t==null){const d=`[Sprig] - Invalid userId ${t}`;return console.warn(d),{success:!1,message:d}}if(r.mode==="test"||t===globalThis.UserLeap.userId)return;globalThis.UserLeap.userId=t;const o=globalThis.UserLeap.visitorId,l=await _(R("1",[C,O]),{body:JSON.stringify({userId:t}),method:"PUT"});l.ok?(o!==globalThis.UserLeap.visitorId&&((a=i.modules.replay)==null||a.clearUserReplayData()),I("uid",t)):l.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",l.error),l.error&&globalThis.UserLeap.reportError("setUserId",l.error))},async setPartnerAnonymousId(t){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",t),t==null){const o=`[Sprig] - Invalid partnerAnonymousId ${t}`;return console.warn(o),{success:!1,message:o}}return globalThis.UserLeap.partnerAnonymousId=t,I("aid",t),{success:!0}},track:async(t,o,l={},a=void 0)=>e({eventName:t,properties:o,metadata:l,showSurveyCallback:a}),identifyAndTrack:async t=>await e(t),trackPageView(t,o=void 0,l=void 0,a=!0){J=t,bt(t,o,l,a)},applyFeedbackStyles({button:t="",view:o=""}){globalThis.UserLeap.feedbackCustomStyles=o,document.getElementById("sprig-feedback-style")&&X({document,elementId:"ul-custom-style",styleString:t,nonce:globalThis.UserLeap.styleNonce}),s(document.querySelector(".ul-container-feedback"),o)},applyStyles(t){globalThis.UserLeap.customStyles=t,s(globalThis.UserLeap.container,t)},setWindowDimensions(t,o){var y,b;const l=typeof t=="string"?parseInt(t,10):t,a=typeof o=="string"?parseInt(o,10):o;isNaN(l)||isNaN(a)||(globalThis.UserLeap.windowDimensions={width:l,height:a});const d=i.getHttpHeaders(globalThis.UserLeap),c=ce(d),p=d["userleap-platform"]==="web";if(!globalThis.UserLeap.frameId)return;const g=document.getElementById(globalThis.UserLeap.frameId);g&&(globalThis.UserLeap.useMobileStyling&&((y=globalThis.UserLeap.windowDimensions)!=null&&y.width&&(g.style.width=`${globalThis.UserLeap.windowDimensions.width}px`),(b=globalThis.UserLeap.windowDimensions)!=null&&b.height&&(g.style.maxHeight=globalThis.UserLeap.windowDimensions.height-20+"px"),g.contentDocument&&(g.style.height=String(it(g.contentDocument,p&&!c,i.shouldDirectEmbed(d))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:g.clientWidth,contentFrameHeight:g.clientHeight,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}))},logoutUser(){var t;globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),i.breadcrumbsLogger.info("LogOut",{vid:globalThis.UserLeap.visitorId,userId:globalThis.UserLeap.userId}),globalThis.UserLeap.visitorId=null,globalThis.UserLeap.userId=null,globalThis.UserLeap.partnerAnonymousId=null,globalThis.UserLeap.token=null,globalThis.UserLeap.email=null,i.localStorageHelper.removeItem("userleap.ids"),globalThis.UserLeap._queue.isPaused()&&globalThis.UserLeap._queue.empty(),yt(),(t=i.modules.replay)==null||t.clearUserReplayData(),globalThis.UserLeap._queue.unpause()},teardown(){["hashchange","popstate"].forEach(t=>globalThis.removeEventListener(t,Q,!0)),globalThis.UserLeap._config.interactiveEvents&&mt(),globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.API),delete globalThis.UserLeap,delete globalThis.Sprig,delete globalThis._Sprig},integrateOptimizely(t,o=!0){var l,a;if((a=(l=globalThis.UserLeap)==null?void 0:l._config)!=null&&a.optimizelyEnabled)try{const d=typeof t=="string"?JSON.parse(t):t;ie.setOptimizelyExperiment(d,o)}catch(d){console.warn("[Sprig] Error with integrating Optimizely data"),d instanceof Error&&globalThis.UserLeap.reportError("integrateOptimizely",d)}else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.")},integrateOptimizelyClient(t){var o,l;if(!((l=(o=globalThis.UserLeap)==null?void 0:o._config)!=null&&l.optimizelyEnabled))return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");t.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",({experiment:a,variation:d})=>{const c={experiments:[{id:a.id,variation:d.key}]};globalThis.UserLeap("integrateOptimizely",c,!1)})},importLaunchDarklyData(t){var o,l;(l=(o=globalThis.UserLeap)==null?void 0:o._config)!=null&&l.launchDarklyEnabled?Ue.setLDFlagsVariations(t):console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.")},setVisitorAttribute:(t,o)=>(console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(t,o)),setEmail:async t=>n.setAttribute(B,t),setVisitorEmail:async t=>(console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(t)),_generateVideoUploadUrl:async t=>async function(o){var a;if(!o)return;const l=`${globalThis.UserLeap._API_URL}/2/environments/integrations/upload`;try{const d=await fetch(l,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(d.ok){const c=await d.json();return(a=c==null?void 0:c.upload)==null?void 0:a.url}return null}catch(d){console.warn("[Sprig] Error with generating video upload url"),d instanceof Error&&globalThis.UserLeap.reportError("generateVideoUploadUrl",d)}}(t),_reportMetric(t,o){i.reportAndRegister(t,o)},_completeSessionReplay:async({surveyId:t,responseGroupUuid:o,eventDigest:l})=>{var a;return i.modules.replay?(a=i.modules.replay)==null?void 0:a._completeSessionReplay({surveyId:t,responseGroupUuid:o,eventDigest:l,headers:i.getHttpHeaders(globalThis.UserLeap)}):(globalThis.UserLeap.reportError("_completeSessionReplay",new Error("Replay module not registered")),!1)},pauseReplayRecording(){var t,o,l,a;(o=(t=i.modules.replay)==null?void 0:t.isReplayPaused)!=null&&o.call(t)||((a=(l=i.modules.replay)==null?void 0:l.recordReplayPaused)==null||a.call(l))},resumeReplayRecording(){var t,o,l,a,d,c;(o=(t=i.modules.replay)==null?void 0:t.isReplayPaused)!=null&&o.call(t)&&((a=(l=i.modules.replay)==null?void 0:l.recordReplayResumed)==null||a.call(l),(c=(d=i.modules.replay)==null?void 0:d.recordFullSnapshot)==null||c.call(d))}};Object.assign(globalThis.UserLeap,n)};async function Wt(r,e,s={},n={}){var p;const t=(p=globalThis.__cfg)==null?void 0:p.mode,o=ke(),l=globalThis.UserLeap.envId,a=globalThis.document.documentElement,d={mode:t,screenWidth:globalThis.screen.width,screenHeight:globalThis.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:J??globalThis.location.href,language:globalThis.navigator.language,...s},c={action:r,breadcrumbs:i.breadcrumbsLogger.breadcrumbs,err:{message:`${e==null?void 0:e.name} - ${e==null?void 0:e.message}`,stack:e==null?void 0:e.stack},meta:d,vid:o,envId:l,...n};(await _(R("1",null,"errors"),{method:"POST",headers:{"x-ul-error":globalThis.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)}function zt(r={}){var n;(n=globalThis.SprigLoggerCallback)==null||n.call(globalThis,"Initializing Sprig");const e=new URLSearchParams(globalThis.location.search).get("sprigPreviewKey")??"";async function s(){var g,y,b,u,h;if(globalThis.UserLeap.loaded)return;if((g=globalThis.SprigLoggerCallback)==null||g.call(globalThis,"Loading Sprig"),globalThis.UserLeap.reportError=Wt,globalThis.UserLeap.loaded=!0,globalThis.UserLeap._config=Object.assign({},r,globalThis.UserLeap.config),globalThis.UserLeap.delayingSurvey=!1,globalThis.UserLeap._config&&typeof globalThis.UserLeap._config=="object")for(const v in globalThis.UserLeap._config)globalThis.UserLeap[v]=globalThis.UserLeap._config[v];if(globalThis.Sprig.outstandingTransactionLimit!==void 0&&(r.outstandingTransactionLimit=globalThis.Sprig.outstandingTransactionLimit),!globalThis.UserLeap.envId){if(!globalThis.UserLeap.appId)throw new Error("Missing Environment id");globalThis.UserLeap.envId=globalThis.UserLeap.appId}globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const t=ht(),o=globalThis.UserLeap.sampleRate;let l=t.sampled;if(o){if(l===null&&(l=Math.random()<o,I("sampled",l)),!l)return}else l!==null&&I("sampled",null);globalThis.UserLeap._API_URL||(globalThis.UserLeap._API_URL="https://api.sprig.com");const a=[...globalThis.UserLeap._queue];globalThis.UserLeap._queue=new Dt(globalThis.UserLeap,[]),globalThis.UserLeap._queue.pause();for(let v=0;v<a.length;v++)globalThis.UserLeap._queue.push(a[v]);const d=t.token;d?(globalThis.UserLeap.token=d,globalThis.UserLeap.visitorId=t.vid??null,globalThis.UserLeap.userId=t.uid??null,globalThis.UserLeap.partnerAnonymousId=t.aid??null):yt();const c=Y(i.getHttpHeaders(globalThis.UserLeap));(y=globalThis.SprigLoggerCallback)==null||y.call(globalThis,"Sprig fetching config");const p=await async function(v){var T,P;const m=i.getHttpHeaders(globalThis.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const U=await i.sprigFetch(R("1",[C],"config"),{headers:m});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!U.ok)return(T=globalThis.SprigLoggerCallback)==null||T.call(globalThis,"Sprig config fetch failed"),U.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",U.error),U.error&&globalThis.UserLeap.reportError("applyRemoteConfig",U.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),v;const w=U.json;return w!=null&&w.disabled?((P=globalThis.SprigLoggerCallback)==null||P.call(globalThis,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${w.disabled}`),{disabled:w.disabled}):Object.assign({},w,v)}(r);if((b=globalThis.SprigLoggerCallback)==null||b.call(globalThis,"Sprig fetched config"),Pt({isWeb:!c,reportingIntervalSeconds:p.metricsReportingEnabled||p.mobileMetricsReportingEnabled?p.metricsReportingIntervalSeconds:0,thresholds:p.metricThresholds,postMetrics:async v=>{var m;await _(R("1",[C],"metrics"),{body:v,method:"POST",headers:{"x-ul-replay-enabled":`${!!((m=i.modules.replay)!=null&&m.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!c){const v=p.alwaysOnReplay?{userAgent:globalThis.navigator.userAgent,surveyId:p.alwaysOnReplay.surveyId,responseGroupUuid:p.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.44.0",maxDurationSeconds:p.alwaysOnReplay.maxDurationSeconds}:void 0;await((u=i.modules.replay)==null?void 0:u.initializeReplay({maxReplayDurationSeconds:p.maxReplayDurationSeconds,maxInflightRequests:globalThis.UserLeap.maxInflightReplayRequests??2,replaySettings:p.replaySettings,apiUrl:globalThis.UserLeap._API_URL,alwaysOnConfig:v})),De=p.replaySettings}Vt(p),await qt(p),globalThis.UserLeap._queue.unpause(),(h=globalThis.SprigLoggerCallback)==null||h.call(globalThis,"SdkReady"),i.eventEmitter.emit(i.SprigEvent.SDKReady,{mobileMetricsReportingEnabled:!!p.mobileMetricsReportingEnabled,metricsReportingInterval:p.metricsReportingIntervalSeconds||0,metricsThresholds:p.metricThresholds||[],maxMobileReplayDurationSeconds:p.maxMobileReplayDurationSeconds,mobileReplaySettings:p.mobileReplaySettings}),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:globalThis.UserLeap.visitorId}),i.eventEmitter.on(i.SprigEvent.VisitorIDUpdated,()=>{for(const v in pe)delete pe[v]})}globalThis.UserLeap.UPDATES=i.EVENTS,globalThis.UserLeap("setPreviewKey",e),document.readyState==="complete"?s():globalThis.attachEvent?globalThis.attachEvent("onload",s):globalThis.addEventListener("load",()=>{s()},!1)}class Z{constructor(){F(this,"UPDATES",i.EVENTS)}displaySurvey(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"displaySurvey",e)}mute(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"mute")}unmute(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"unmute")}dismissActiveSurvey(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"dismissActiveSurvey")}setAttribute(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"setAttribute",e,s)}setAttributes(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setAttributes",e)}identifyAndSetAttributes(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"identifyAndSetAttributes",e)}removeAttributes(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"removeAttributes",e)}addListener(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"addListener",e,s)}removeListener(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"removeListener",e,s)}removeAllListeners(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"removeAllListeners")}setEmail(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setAttribute","!email",e)}setUserId(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setUserId",e)}setPartnerAnonymousId(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setPartnerAnonymousId",e)}track(e,s={},n={}){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"track",e,s,n)}identifyAndTrack(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"identifyAndTrack",e)}trackPageView(e,s,n){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"trackPageView",e,s,n)}applyStyles(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"applyStyles",e)}setWindowDimensions(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"setWindowDimensions",e,s)}logoutUser(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"logoutUser")}teardown(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"teardown")}pauseReplayRecording(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"pauseReplayRecording")}resumeReplayRecording(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"resumeReplayRecording")}}const Ie={configure:r=>{if(!r.envId&&!r.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(r.envId||(r.envId=r.environmentId??""),r.installationMethod="web-npm",globalThis.Sprig)return globalThis.Sprig;globalThis.Sprig=function(){var s;(s=globalThis.Sprig)==null||s._queue.push(arguments)},Object.getOwnPropertyNames(Z.prototype).map(s=>{s!=="constructor"&&(globalThis.Sprig[s]=Z.prototype[s])});const e=globalThis.Sprig;return e.appId=r.envId,e._queue=[],globalThis.UserLeap=e,zt(r),globalThis.Sprig}},vt=new Z,Nt={sprig:Ie,SprigAPI:Z,configure:Ie.configure,Sprig:vt};exports.APP_ID="ul-app",exports.ConflictingWidgets=Xe,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.Sprig=vt,exports.SprigAPI=Z,exports.calculateFrameDimensions=it,exports.core=Nt,exports.getHtml=ge,exports.isHTMLElement=x,exports.resetScrollPosition=r=>{const e=r.querySelector(".ul-card__container");e&&(e.scrollTop=0)},exports.setSurveyStyles=X,exports.sprig=Ie;
|
|
12
|
+
</svg>`,(s=window.UserLeap._config)==null?void 0:s.enableCspTrustedTypes);const e=document.createElement("h3");return e.className="sprig-feedback-error-text",e.innerText="There was an error while loading the survey",r.appendChild(e),r},Ue=new class{constructor(){F(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(r){try{return!(!r||typeof r!="object"||Array.isArray(r))&&(Object.keys(this._ldData).forEach(e=>{delete this._ldData[e]}),Object.keys(r).forEach(e=>this._ldData[`!launch_darkly_${e}`]=(r[e]??0)+1),!0)}catch(e){return e instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",e),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}};Object.freeze(Ue);const ie=new class{constructor(){F(this,"_optimizelyData",{})}setOptimizelyExperiment(r,e=!0){if(!r||typeof r!="object")return!1;const{experiments:s}=r;try{return e&&Object.keys(this._optimizelyData).map(n=>{delete this._optimizelyData[n]}),s&&s.map(n=>{const{id:t,variation:o}=n,l=this.transformExperimentId(t);o&&typeof o=="string"&&(this._optimizelyData[l]=o)}),!0}catch(n){return n instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",n),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(r){return this._optimizelyData[this.transformExperimentId(r)]}transformExperimentId(r){return"!optimizely_experiments_"+r}getAndSetWebOptimizelyExperiments(){var r;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const e=(r=window.optimizely.get("state"))==null?void 0:r.getExperimentStates({isActive:!0});if(e){const s=Object.keys(e).map(n=>{var t,o;return(t=e[n].variation)!=null&&t.name?{id:n,variation:(o=e[n].variation)==null?void 0:o.name}:{id:n,variation:"Original"}});return this.setOptimizelyExperiment({experiments:s},!1),!0}return!1}return!1}catch(e){return e instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",e),!1}}};Object.freeze(ie);class Dt{constructor(e,s){F(this,"paused");F(this,"queue");F(this,"ul");this.ul=e,this.paused=!1,this.queue=[],this.flush(s)}flush(e){const s=e.length;if(s)for(let n=0;n<s;n++)this.push(e[n])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const e=this.queue.slice();this.empty(),this.flush(e)}push(e){if(this.paused)this.queue.push(e);else if(e instanceof Function)e();else{const s=Array.prototype.slice.call(e,1),n=e[0],t=this.ul[n];t instanceof Function?t.apply(this.ul,s):n&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",n)}}perform(e){if(this.paused){let s=()=>{};const n=new Promise(function(t){s=function(){t(e())}});return this.queue.push(s),n}return e()}empty(){this.queue.length=0}}let dt,pt;const Te=r=>{let e=0,s=r.firstElementChild;for(;s;)e+=Te(s),s.shadowRoot&&(e+=Te(s.shadowRoot)),s=s.nextElementSibling,e++;return e},Ke=()=>{dt.report(Te(document.body)),pt.report(document.documentElement.innerHTML.toString().length)},Ee=(r,e)=>{const s=performance.now();document.hidden?setTimeout(()=>Ee(r,e),r):setTimeout(()=>{const n=performance.now()-s;e.report(n/1e3),setTimeout(()=>Ee(r,e),r)},0)};let ne,ae,le,de,Je,q={};const re=(r,e=1)=>{const{name:s}=r;q[s]=(q[s]||0)+e},ct=r=>{let e=1;return r.childNodes.forEach(s=>{e+=ct(s)}),e},Qe=r=>{let e=0;return r.forEach(s=>{e+=ct(s)}),e},xt=r=>{switch(r.type){case"childList":return re(ne,Qe(r.addedNodes)),void re(ae,Qe(r.removedNodes));case"attributes":return void re(le);case"characterData":return void re(de)}},At=r=>r.forEach(xt),Ot=()=>{ne.report(q[ne.name]||0),ae.report(q[ae.name]||0),le.report(q[le.name]||0),de.report(q[de.name]||0),q={}},Ct=(r=1e3)=>{ne=i.registerMetric("sdk_mutations_nodes_added"),ae=i.registerMetric("sdk_mutations_nodes_removed"),le=i.registerMetric("sdk_mutations_attributes_changed"),de=i.registerMetric("sdk_mutations_character_data"),Je=new MutationObserver(At),Je.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(Ot,r)},Pt=({isWeb:r,reportingIntervalSeconds:e,thresholds:s,postMetrics:n})=>{i.registerThresholds(s,(t,o)=>{var l,a;if((l=i.modules.replay)!=null&&l.isReplayRecording()){const d=`Value: ${t} on ${o.metric} violated threshold of ${o.type} ${o.value}`;(a=i.modules.replay)==null||a.disableRecording("Threshold violated",new Error(d),{reportError:!1}),window.UserLeap.reportError("Sdk Performance Metric threshold violated",new Error("Sdk Performance Metric threshold violated"),{metricName:o.metric,type:o.type,value:o.value},{metricName:o.metric}),i.disableThresholdChecking()}}),i.initPerformanceReporting({reportingIntervalSeconds:e,postMetrics:n}),r&&(((t=1e3)=>{const o=i.registerMetric("sdk_event_queue_latency_seconds");Ee(t,o)})(),((t=1e4)=>{dt=i.registerMetric("sdk_dom_nodes_count"),pt=i.registerMetric("sdk_page_html_characters"),Ke(),setInterval(Ke,t)})(),Ct())},Ht="test",Mt=["popState","pushState","replaceState"];let De,J;const pe={},B="!email",gt="pageUrl";var Ye;let fe=((Ye=globalThis.location)==null?void 0:Ye.href)||"";function Q(r){var a,d;const{pageUrlEvents:e,interactiveEvents:s,dismissOnPageChange:n,platform:t}=globalThis.UserLeap._config;if(t&&t!=="web")return;fe!==globalThis.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:fe,to:globalThis.location.href}),fe=globalThis.location.href;const o=ht().trackStartUrl,l=o?String(o):null;e&&bt(globalThis.location.href),s&&(mt(),Ft()),st()&&(()=>{if(se())return;const c=z();c&&(i.checkUrlStillMatching(K)||(c.remove(),K=null,f=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((d=(a=i.modules.replay)==null?void 0:a.checkPendingHeatmapsUrl())==null||d.then(c=>{var p;c&&((p=i.modules.replay)==null||p.uploadReadyPendingCaptures(!0))})),!se()&&n&&l&&l!==globalThis.location.href&&r&&Mt.includes(r.type)&&globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const ut={capture:!0},Ft=()=>{const r=globalThis.UserLeap._config.interactiveEvents.filter(s=>i.checkUrlMatch(s,globalThis.location.href)).map(s=>{const{name:n,properties:t}=s,{selector:o,innerText:l}=t;return o?a=>{if(Ne(a.target))try{a.target.closest(o)&&globalThis.UserLeap("track",n)}catch{}return!1}:a=>(Ne(a.target)&&a.target.innerText===l&&globalThis.UserLeap("track",n),!1)}),e=s=>r.forEach(n=>n(s));globalThis.UserLeap._config.interactiveEventsHandler=e,globalThis.addEventListener("click",e,ut)},mt=()=>{globalThis.UserLeap._config.interactiveEventsHandler&&globalThis.removeEventListener("click",globalThis.UserLeap._config.interactiveEventsHandler,ut),delete globalThis.UserLeap._config.interactiveEventsHandler};function ht(){const r=i.localStorageHelper.getItemObject("userleap.ids");return(r==null?void 0:r[globalThis.UserLeap.envId])||{}}function yt(){if(globalThis.previewMode)return;const r=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map")||{},e=r[globalThis.UserLeap.envId];globalThis.UserLeap.visitorId=e||i.v4(),i.breadcrumbsLogger.info("NewVid",{vid:globalThis.UserLeap.visitorId}),I("vid",globalThis.UserLeap.visitorId),e||(r[globalThis.UserLeap.envId]=globalThis.UserLeap.visitorId,i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",r)),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:globalThis.UserLeap.visitorId})}function bt(r,e,s,n){var t,o;try{if(r.endsWith("mock_snippet.html"))return;i.breadcrumbsLogger.info("PageView",{url:r});const l=(t=document==null?void 0:document.querySelector('meta[name="description"]'))==null?void 0:t.getAttribute("content");(o=i.modules.replay)==null||o.RecordPageView({...l&&{description:l},url:r,referrer:document.referrer,pageTitle:document.title});const a=globalThis.UserLeap._config.pageUrlEvents;let d=!1;if(a&&a.length)for(let p=0;p<a.length&&(d=i.checkUrlMatch(a[p],r),!d);p++);if(!d)return;globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",r);const c={url:r};n&&(c.trackPageView=!0),globalThis.UserLeap._queue.push(["track",gt,e,c,s])}catch(l){l instanceof Error&&(l.stack=r,globalThis.UserLeap.reportError("trackPageView",l)),console.warn("[Sprig] (ERR-428) Failed to track page view",l)}}function jt(){var e;const r=((e=globalThis.Backbone)==null?void 0:e.history)||globalThis.history;"pushState"in r&&(r.pushState=(s=>function(...n){const t=s.apply(this,n),o=new Event("pushState");return globalThis.dispatchEvent(o),Q(o),t})(r.pushState)),"replaceState"in r&&(r.replaceState=(s=>function(...n){const t=s.apply(this,n),o=new Event("replaceState");return globalThis.dispatchEvent(o),Q(o),t})(r.replaceState)),["hashchange","popstate"].forEach(s=>globalThis.addEventListener(s,Q,!0))}async function we(r,e){const s=ke();r&&!e&&(globalThis.UserLeap._config.mode=Ht);const n=ce(i.getHttpHeaders(globalThis.UserLeap)),t=await _(function(o){const l=new URL(R("1",[C],"questions"));return Object.entries(o||{}).forEach(([a,d])=>{d&&l.searchParams.append(a,String(d))}),l.toString()}({desktopDisplay:globalThis.UserLeap._config.desktopDisplay,isMobile:n,previewLanguage:globalThis.UserLeap._config.previewLanguage,surveyid:r==null?void 0:r.surveyId,surveytemplateid:r==null?void 0:r.surveyTemplateId,vid:s}),{shouldDropOnRateLimit:!0});if(!t.ok)return t.reportError&&t.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",t.error),globalThis.UserLeap.reportError("getQuestions",t.error)),{success:!1,surveyState:"no survey"};if(t.json.delay&&await i.delay(t.json.delay),!t.json.isFeedback)return G(t.json,J,De);{const{feedbackLabel:o,productConfig:l,surveyUuid:a,feedbackCustomStyles:d}=t.json,{buttonTheme:c,placement:p,desktopDisplay:g}=l;lt({customStyles:d,buttonTheme:c,desktopDisplay:g,eventId:0,feedbackLabel:o,placement:p,surveyUuid:a,surveyId:r==null?void 0:r.surveyId},t.json)}}function qt(r){if(!r)return;globalThis.UserLeap._config=r,r.mute&&globalThis.UserLeap._queue.pause();const{interactiveEvents:e,pageUrlEvents:s,dismissOnPageChange:n}=r;e&&function(t){let o=t.length;for(;o;){const l=Math.floor(Math.random()*o);o-=1;const a=t[o];t[o]=t[l],t[l]=a}}(e),(e||s||n)&&(jt(),Q())}const Vt=function(r){if(!globalThis.UserLeap)return;const e=async(t={})=>{var m,U,w,T,P;const{userId:o,anonymousId:l,metadata:a={},properties:d,showSurveyCallback:c}=t;let{eventName:p}=t;if(globalThis.UserLeap.debugMode&&p!==gt&&console.info("[DEBUG] Sprig track",t),r.mode==="test")return;const g=i.sessionStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!globalThis.UserLeap.userId&&!o){const L="[Sprig] - Skipping tracking without userId";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(!p||p.trim().length===0){p=p?String(p):"";const L="[Sprig] - Invalid event name "+p;return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}const y=J??globalThis.location.href;a.url||(a.url=y),I("trackStartUrl",y),(U=(m=globalThis.UserLeap)==null?void 0:m._config)!=null&&U.optimizelyEnabled&&(Y(i.getHttpHeaders(globalThis.UserLeap))||ie.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},ie.getAllOptimizelyExperiments())),(T=(w=globalThis.UserLeap)==null?void 0:w._config)!=null&&T.launchDarklyEnabled&&(a.launchDarklyFlags=Ue.getAllLaunchDarklyVariations()),o&&(globalThis.UserLeap.userId=o),l&&(globalThis.UserLeap.partnerAnonymousId=l),d&&(a.eventProperties=d),(P=i.modules.replay)==null||P.RecordEvent({name:p,url:a.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:p});const b=globalThis.UserLeap.delayingSurvey||ot()?await _(R("1",[O],"events/batch"),{body:JSON.stringify({events:[{event:p,metadata:a}],previewKey:g}),method:"POST",shouldDropOnRateLimit:!0}):await _(R("1",[O],"events"),{body:JSON.stringify({event:p,metadata:a,previewKey:g}),method:"POST",shouldDropOnRateLimit:!0});if(!b.ok){const L="[Sprig] (ERR-421) Failed to track event";return b.reportError&&(console.warn(L,b.error),b.error&&globalThis.UserLeap.reportError("track",b.error)),{success:!1,message:L,error:b.error,surveyState:"no survey"}}o&&I("uid",o),l&&I("aid",l);const u=b.json;u.invalidPreviewKey&&i.sessionStorageHelper.removeItem("sprig.previewKey");const h=a.trackPageView?a.url:void 0;return u!=null&&u.feedbackButton&<(u.feedbackButton,void 0,h),await async function(L,E){var V,H;let A=!0;return!(E&&((V=L==null?void 0:L.json)!=null&&V.surveyId)&&(globalThis.UserLeap.delayingSurvey=!0,A=await E(L.json.surveyId),globalThis.UserLeap.delayingSurvey=!1,!A))&&((H=L==null?void 0:L.json)!=null&&H.delay&&!globalThis.UserLeap.isMobileSDK&&(globalThis.UserLeap.delayingSurvey=!0,await i.delay(L.json.delay),globalThis.UserLeap.delayingSurvey=!1),A)}(b,c)?function(L){if(!globalThis.UserLeap._config.dismissOnPageChange)return!0;const E=new URL(L),A=new URL(J??globalThis.location.href);return E.hostname===A.hostname&&E.pathname===A.pathname}(y)?G(u,h,De):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},s=(t,o)=>{var a;const l=(a=t==null?void 0:t.querySelector(`[id="${Re}"]`))==null?void 0:a.contentDocument;l&&X({document:l,elementId:"ul-custom-style",styleString:o})},n={displaySurvey:async t=>(console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.Override),we({surveyId:t},!0)),_previewSurvey(t){globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.Override),we({surveyTemplateId:t},!1)},_reviewSurvey(t){globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.Override),we({surveyId:t},!1)},previewSurvey(t){n._previewSurvey(t)},reviewSurvey(t){n._reviewSurvey(t)},mute(){globalThis.UserLeap._queue.pause()},unmute(){globalThis.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(t=i.DismissReason.API){globalThis.UserLeap.container&&(t===i.DismissReason.Closed&&globalThis.Sprig.trackHistory&&globalThis.Sprig.trackHistory({event:"closed"}),i.eventEmitter.emit(i.SprigEvent.SurveyCloseRequested,{name:i.SprigEvent.SurveyCloseRequested,initiator:t,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}),i.eventEmitter.emit(i.SprigEvent.SurveyWillClose,{name:i.SprigEvent.SurveyWillClose,initiator:t,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}))},async setAttribute(t,o){if(!t||!o&&o!==0&&o!==!1){const l="[Sprig] - Disregarding empty attribute / value provided";return console.warn(l),{success:!1,message:l}}return this.setAttributes({[t]:o})},async setAttributes(t){if(t==null||Object.keys(t).length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}return this.identifyAndSetAttributes({attributes:t})},async identifyAndSetAttributes(t){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",t),r.mode==="test")return;if(t===null||typeof t!="object"||!(t.userId||t.anonymousId||t.attributes)){const p="[Sprig] - Disregarding empty payload provided";return console.warn(p),{success:!1,message:p}}const{userId:o,anonymousId:l,attributes:a}=t;if(r.requireUserIdForTracking&&!globalThis.UserLeap.userId&&!o){const p="[Sprig] - Skipping tracking without userId";return console.warn(p),{success:!1,message:p}}if(a){a.email&&!a[B]&&(a[B]=a.email,delete a.email);const p=Object.keys(a);for(const g of p)a[g]===pe[g]&&delete a[g]}if(!(a&&Object.keys(a).length!==0||o&&globalThis.UserLeap.userId!==o||l&&globalThis.UserLeap.partnerAnonymousId!==l))return{success:!0};const d={};let c;return o&&(d.userId=globalThis.UserLeap.userId=o),l&&(d.partnerAnonymousId=globalThis.UserLeap.partnerAnonymousId=l),a&&Object.keys(a).length>0?(c=await _(R("1",[C,O],"attributes"),{body:JSON.stringify(a),method:"PUT"}),c.ok?Object.assign(pe,a):c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&globalThis.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await _(R("1",[C,O]),{body:JSON.stringify(d),method:"PUT"}),a&&a[B]&&(globalThis.UserLeap.email=a[B]),c.ok&&(o&&I("uid",o),l&&I("aid",l)),{success:!!c.ok}},async removeAttributes(t){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",t),r.mode==="test")return;if(t==null||t.length===0){const l="[Sprig] - Disregarding empty attributes provided";return console.warn(l),{success:!1,message:l}}if(r.requireUserIdForTracking&&!globalThis.UserLeap.userId){const l="[Sprig] - Skipping tracking without userId";return console.warn(l),{success:!1,message:l}}const o=await _(R("1",[C,O],"attributes"),{body:JSON.stringify({delete:t}),method:"DELETE"});return!o.ok&&o.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",o.error),o.error&&globalThis.UserLeap.reportError("removeAttributes",o.error)),{success:!!o.ok}},async addSurveyListener(t){i.eventEmitter.on(i.SprigEvent.SurveyLifeCycle,t)},async removeSurveyListener(t){i.eventEmitter.removeListener(i.SprigEvent.SurveyLifeCycle,t)},async addListener(t,o){i.eventEmitter.on(t,o)},async removeListener(t,o){i.eventEmitter.removeListener(t,o)},async removeAllListeners(){i.eventEmitter.removeAllListeners()},setPreviewKey(t){t&&typeof t=="string"&&i.sessionStorageHelper.isStorageAvailable&&t&&i.sessionStorageHelper.setItem("sprig.previewKey",t)},async setUserId(t){var a;if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",t),t==null){const d=`[Sprig] - Invalid userId ${t}`;return console.warn(d),{success:!1,message:d}}if(r.mode==="test"||t===globalThis.UserLeap.userId)return;globalThis.UserLeap.userId=t;const o=globalThis.UserLeap.visitorId,l=await _(R("1",[C,O]),{body:JSON.stringify({userId:t}),method:"PUT"});l.ok?(o!==globalThis.UserLeap.visitorId&&((a=i.modules.replay)==null||a.clearUserReplayData()),I("uid",t)):l.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",l.error),l.error&&globalThis.UserLeap.reportError("setUserId",l.error))},async setPartnerAnonymousId(t){if(globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",t),t==null){const o=`[Sprig] - Invalid partnerAnonymousId ${t}`;return console.warn(o),{success:!1,message:o}}return globalThis.UserLeap.partnerAnonymousId=t,I("aid",t),{success:!0}},track:async(t,o,l={},a=void 0)=>e({eventName:t,properties:o,metadata:l,showSurveyCallback:a}),identifyAndTrack:async t=>await e(t),trackPageView(t,o=void 0,l=void 0,a=!0){J=t,bt(t,o,l,a)},applyFeedbackStyles({button:t="",view:o=""}){globalThis.UserLeap.feedbackCustomStyles=o,document.getElementById("sprig-feedback-style")&&X({document,elementId:"ul-custom-style",styleString:t,nonce:globalThis.UserLeap.styleNonce}),s(document.querySelector(".ul-container-feedback"),o)},applyStyles(t){globalThis.UserLeap.customStyles=t,s(globalThis.UserLeap.container,t)},setWindowDimensions(t,o){var y,b;const l=typeof t=="string"?parseInt(t,10):t,a=typeof o=="string"?parseInt(o,10):o;isNaN(l)||isNaN(a)||(globalThis.UserLeap.windowDimensions={width:l,height:a});const d=i.getHttpHeaders(globalThis.UserLeap),c=ce(d),p=d["userleap-platform"]==="web";if(!globalThis.UserLeap.frameId)return;const g=document.getElementById(globalThis.UserLeap.frameId);g&&(globalThis.UserLeap.useMobileStyling&&((y=globalThis.UserLeap.windowDimensions)!=null&&y.width&&(g.style.width=`${globalThis.UserLeap.windowDimensions.width}px`),(b=globalThis.UserLeap.windowDimensions)!=null&&b.height&&(g.style.maxHeight=globalThis.UserLeap.windowDimensions.height-20+"px"),g.contentDocument&&(g.style.height=String(it(g.contentDocument,p&&!c,i.shouldDirectEmbed(d))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:g.clientWidth,contentFrameHeight:g.clientHeight,"survey.id":parseInt(globalThis.UserLeap.container.dataset.studyId)}))},logoutUser(){var t;globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),i.breadcrumbsLogger.info("LogOut",{vid:globalThis.UserLeap.visitorId,userId:globalThis.UserLeap.userId}),globalThis.UserLeap.visitorId=null,globalThis.UserLeap.userId=null,globalThis.UserLeap.partnerAnonymousId=null,globalThis.UserLeap.token=null,globalThis.UserLeap.email=null,i.localStorageHelper.removeItem("userleap.ids"),globalThis.UserLeap._queue.isPaused()&&globalThis.UserLeap._queue.empty(),yt(),(t=i.modules.replay)==null||t.clearUserReplayData(),globalThis.UserLeap._queue.unpause()},teardown(){["hashchange","popstate"].forEach(t=>globalThis.removeEventListener(t,Q,!0)),globalThis.UserLeap._config.interactiveEvents&&mt(),globalThis.UserLeap("dismissActiveSurvey",i.DismissReason.API),delete globalThis.UserLeap,delete globalThis.Sprig,delete globalThis._Sprig},integrateOptimizely(t,o=!0){var l,a;if((a=(l=globalThis.UserLeap)==null?void 0:l._config)!=null&&a.optimizelyEnabled)try{const d=typeof t=="string"?JSON.parse(t):t;ie.setOptimizelyExperiment(d,o)}catch(d){console.warn("[Sprig] Error with integrating Optimizely data"),d instanceof Error&&globalThis.UserLeap.reportError("integrateOptimizely",d)}else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.")},integrateOptimizelyClient(t){var o,l;if(!((l=(o=globalThis.UserLeap)==null?void 0:o._config)!=null&&l.optimizelyEnabled))return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");t.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",({experiment:a,variation:d})=>{const c={experiments:[{id:a.id,variation:d.key}]};globalThis.UserLeap("integrateOptimizely",c,!1)})},importLaunchDarklyData(t){var o,l;(l=(o=globalThis.UserLeap)==null?void 0:o._config)!=null&&l.launchDarklyEnabled?Ue.setLDFlagsVariations(t):console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.")},setVisitorAttribute:(t,o)=>(console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(t,o)),setEmail:async t=>n.setAttribute(B,t),setVisitorEmail:async t=>(console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(t)),_generateVideoUploadUrl:async t=>async function(o){var a;if(!o)return;const l=`${globalThis.UserLeap._API_URL}/2/environments/integrations/upload`;try{const d=await fetch(l,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(d.ok){const c=await d.json();return(a=c==null?void 0:c.upload)==null?void 0:a.url}return null}catch(d){console.warn("[Sprig] Error with generating video upload url"),d instanceof Error&&globalThis.UserLeap.reportError("generateVideoUploadUrl",d)}}(t),_reportMetric(t,o){i.reportAndRegister(t,o)},_completeSessionReplay:async({surveyId:t,responseGroupUuid:o,eventDigest:l})=>{var a;return i.modules.replay?(a=i.modules.replay)==null?void 0:a._completeSessionReplay({surveyId:t,responseGroupUuid:o,eventDigest:l,headers:i.getHttpHeaders(globalThis.UserLeap)}):(globalThis.UserLeap.reportError("_completeSessionReplay",new Error("Replay module not registered")),!1)},pauseReplayRecording(){var t,o,l,a;(o=(t=i.modules.replay)==null?void 0:t.isReplayPaused)!=null&&o.call(t)||((a=(l=i.modules.replay)==null?void 0:l.recordReplayPaused)==null||a.call(l))},resumeReplayRecording(){var t,o,l,a,d,c;(o=(t=i.modules.replay)==null?void 0:t.isReplayPaused)!=null&&o.call(t)&&((a=(l=i.modules.replay)==null?void 0:l.recordReplayResumed)==null||a.call(l),(c=(d=i.modules.replay)==null?void 0:d.recordFullSnapshot)==null||c.call(d))}};Object.assign(globalThis.UserLeap,n)};async function Wt(r,e,s={},n={}){var p;const t=(p=globalThis.__cfg)==null?void 0:p.mode,o=ke(),l=globalThis.UserLeap.envId,a=globalThis.document.documentElement,d={mode:t,screenWidth:globalThis.screen.width,screenHeight:globalThis.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:J??globalThis.location.href,language:globalThis.navigator.language,...s},c={action:r,breadcrumbs:i.breadcrumbsLogger.breadcrumbs,err:{message:`${e==null?void 0:e.name} - ${e==null?void 0:e.message}`,stack:e==null?void 0:e.stack},meta:d,vid:o,envId:l,...n};(await _(R("1",null,"errors"),{method:"POST",headers:{"x-ul-error":globalThis.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)}function zt(r={}){var n;(n=globalThis.SprigLoggerCallback)==null||n.call(globalThis,"Initializing Sprig");const e=new URLSearchParams(globalThis.location.search).get("sprigPreviewKey")??"";async function s(){var g,y,b,u,h;if(globalThis.UserLeap.loaded)return;if((g=globalThis.SprigLoggerCallback)==null||g.call(globalThis,"Loading Sprig"),globalThis.UserLeap.reportError=Wt,globalThis.UserLeap.loaded=!0,globalThis.UserLeap._config=Object.assign({},r,globalThis.UserLeap.config),globalThis.UserLeap.delayingSurvey=!1,globalThis.UserLeap._config&&typeof globalThis.UserLeap._config=="object")for(const v in globalThis.UserLeap._config)globalThis.UserLeap[v]=globalThis.UserLeap._config[v];if(globalThis.Sprig.outstandingTransactionLimit!==void 0&&(r.outstandingTransactionLimit=globalThis.Sprig.outstandingTransactionLimit),!globalThis.UserLeap.envId){if(!globalThis.UserLeap.appId)throw new Error("Missing Environment id");globalThis.UserLeap.envId=globalThis.UserLeap.appId}globalThis.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const t=ht(),o=globalThis.UserLeap.sampleRate;let l=t.sampled;if(o){if(l===null&&(l=Math.random()<o,I("sampled",l)),!l)return}else l!==null&&I("sampled",null);globalThis.UserLeap._API_URL||(globalThis.UserLeap._API_URL="https://api.sprig.com");const a=[...globalThis.UserLeap._queue];globalThis.UserLeap._queue=new Dt(globalThis.UserLeap,[]),globalThis.UserLeap._queue.pause();for(let v=0;v<a.length;v++)globalThis.UserLeap._queue.push(a[v]);const d=t.token;d?(globalThis.UserLeap.token=d,globalThis.UserLeap.visitorId=t.vid??null,globalThis.UserLeap.userId=t.uid??null,globalThis.UserLeap.partnerAnonymousId=t.aid??null):yt();const c=Y(i.getHttpHeaders(globalThis.UserLeap));(y=globalThis.SprigLoggerCallback)==null||y.call(globalThis,"Sprig fetching config");const p=await async function(v){var T,P;const m=i.getHttpHeaders(globalThis.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const U=await i.sprigFetch(R("1",[C],"config"),{headers:m});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!U.ok)return(T=globalThis.SprigLoggerCallback)==null||T.call(globalThis,"Sprig config fetch failed"),U.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",U.error),U.error&&globalThis.UserLeap.reportError("applyRemoteConfig",U.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),v;const w=U.json;return w!=null&&w.disabled?((P=globalThis.SprigLoggerCallback)==null||P.call(globalThis,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${w.disabled}`),{disabled:w.disabled}):Object.assign({},w,v)}(r);if((b=globalThis.SprigLoggerCallback)==null||b.call(globalThis,"Sprig fetched config"),Pt({isWeb:!c,reportingIntervalSeconds:p.metricsReportingEnabled||p.mobileMetricsReportingEnabled?p.metricsReportingIntervalSeconds:0,thresholds:p.metricThresholds,postMetrics:async v=>{var m;await _(R("1",[C],"metrics"),{body:v,method:"POST",headers:{"x-ul-replay-enabled":`${!!((m=i.modules.replay)!=null&&m.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!c){const v=p.alwaysOnReplay?{userAgent:globalThis.navigator.userAgent,surveyId:p.alwaysOnReplay.surveyId,responseGroupUuid:p.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.45.0",maxDurationSeconds:p.alwaysOnReplay.maxDurationSeconds}:void 0;await((u=i.modules.replay)==null?void 0:u.initializeReplay({maxReplayDurationSeconds:p.maxReplayDurationSeconds,maxInflightRequests:globalThis.UserLeap.maxInflightReplayRequests??2,replaySettings:p.replaySettings,apiUrl:globalThis.UserLeap._API_URL,alwaysOnConfig:v})),De=p.replaySettings}Vt(p),await qt(p),globalThis.UserLeap._queue.unpause(),(h=globalThis.SprigLoggerCallback)==null||h.call(globalThis,"SdkReady"),i.eventEmitter.emit(i.SprigEvent.SDKReady,{mobileMetricsReportingEnabled:!!p.mobileMetricsReportingEnabled,metricsReportingInterval:p.metricsReportingIntervalSeconds||0,metricsThresholds:p.metricThresholds||[],maxMobileReplayDurationSeconds:p.maxMobileReplayDurationSeconds,mobileReplaySettings:p.mobileReplaySettings}),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:globalThis.UserLeap.visitorId}),i.eventEmitter.on(i.SprigEvent.VisitorIDUpdated,()=>{for(const v in pe)delete pe[v]})}globalThis.UserLeap.UPDATES=i.EVENTS,globalThis.UserLeap("setPreviewKey",e),document.readyState==="complete"?s():globalThis.attachEvent?globalThis.attachEvent("onload",s):globalThis.addEventListener("load",()=>{s()},!1)}class Z{constructor(){F(this,"UPDATES",i.EVENTS)}displaySurvey(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"displaySurvey",e)}mute(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"mute")}unmute(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"unmute")}dismissActiveSurvey(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"dismissActiveSurvey")}setAttribute(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"setAttribute",e,s)}setAttributes(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setAttributes",e)}identifyAndSetAttributes(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"identifyAndSetAttributes",e)}removeAttributes(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"removeAttributes",e)}addListener(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"addListener",e,s)}removeListener(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"removeListener",e,s)}removeAllListeners(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"removeAllListeners")}setEmail(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setAttribute","!email",e)}setUserId(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setUserId",e)}setPartnerAnonymousId(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"setPartnerAnonymousId",e)}track(e,s={},n={}){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"track",e,s,n)}identifyAndTrack(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"identifyAndTrack",e)}trackPageView(e,s,n){var t;(t=globalThis.Sprig)==null||t.call(globalThis,"trackPageView",e,s,n)}applyStyles(e){var s;(s=globalThis.Sprig)==null||s.call(globalThis,"applyStyles",e)}setWindowDimensions(e,s){var n;(n=globalThis.Sprig)==null||n.call(globalThis,"setWindowDimensions",e,s)}logoutUser(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"logoutUser")}teardown(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"teardown")}pauseReplayRecording(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"pauseReplayRecording")}resumeReplayRecording(){var e;(e=globalThis.Sprig)==null||e.call(globalThis,"resumeReplayRecording")}}const Ie={configure:r=>{if(!r.envId&&!r.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(r.envId||(r.envId=r.environmentId??""),r.installationMethod="web-npm",globalThis.Sprig)return globalThis.Sprig;globalThis.Sprig=function(){var s;(s=globalThis.Sprig)==null||s._queue.push(arguments)},Object.getOwnPropertyNames(Z.prototype).map(s=>{s!=="constructor"&&(globalThis.Sprig[s]=Z.prototype[s])});const e=globalThis.Sprig;return e.appId=r.envId,e._queue=[],globalThis.UserLeap=e,zt(r),globalThis.Sprig}},vt=new Z,Nt={sprig:Ie,SprigAPI:Z,configure:Ie.configure,Sprig:vt};exports.APP_ID="ul-app",exports.ConflictingWidgets=Xe,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.Sprig=vt,exports.SprigAPI=Z,exports.calculateFrameDimensions=it,exports.core=Nt,exports.getHtml=ge,exports.isHTMLElement=x,exports.resetScrollPosition=r=>{const e=r.querySelector(".ul-card__container");e&&(e.scrollTop=0)},exports.setSurveyStyles=X,exports.sprig=Ie;
|