@sprig-technologies/sprig-bundled 2.46.1 → 2.48.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.
Files changed (35) hide show
  1. package/dist/conversational-styles-BO6t2-y4.js +4 -0
  2. package/dist/conversational-styles-CWaKMg_f.cjs +1 -0
  3. package/dist/conversational-ui-CoOUaxMV.js +1516 -0
  4. package/dist/conversational-ui-D4JFc07q.cjs +658 -0
  5. package/dist/conversational-v2-styles-BCsmmSE3.cjs +1 -0
  6. package/dist/conversational-v2-styles-BK9YvF7Q.js +4 -0
  7. package/dist/getAttributedUrl-Cy6ZmssZ.js +197 -0
  8. package/dist/getAttributedUrl-GFl2RKI_.cjs +12 -0
  9. package/dist/index-Cg785YpL.js +4 -0
  10. package/dist/index-DDZBH-vP.js +768 -0
  11. package/dist/index-DYrVxSAM.cjs +1 -0
  12. package/dist/index-D_IOfB4u.cjs +1 -0
  13. package/dist/index-Dm2nk1lh.js +4 -0
  14. package/dist/{index-D2UpkOdR.js → index-Q_m-uWR7.js} +993 -993
  15. package/dist/index-pfR5IQvc.cjs +66 -0
  16. package/dist/index-rJoqOgIc.cjs +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +43 -0
  19. package/dist/index.js +1 -1
  20. package/dist/view-bHnS65wz.js +1834 -0
  21. package/dist/view-umqtk1IA.cjs +1 -0
  22. package/package.json +1 -1
  23. package/dist/conversational-styles-B-bImmUK.js +0 -4
  24. package/dist/conversational-styles-vDq05r1U.cjs +0 -1
  25. package/dist/conversational-ui-BZDC1buu.js +0 -1511
  26. package/dist/conversational-ui-DqQZMJkq.cjs +0 -658
  27. package/dist/conversational-v2-styles-DeqT460S.js +0 -4
  28. package/dist/conversational-v2-styles-DkN3ff79.cjs +0 -1
  29. package/dist/getAttributedUrl-BuO50-dW.cjs +0 -12
  30. package/dist/getAttributedUrl-BvS4nPJR.js +0 -193
  31. package/dist/index-BCIAxJWJ.cjs +0 -66
  32. package/dist/index-DiPr4x-u.cjs +0 -1
  33. package/dist/index-fcbxeQg3.js +0 -734
  34. package/dist/view-5-qQQKtl.js +0 -1789
  35. package/dist/view-D8rc4Fhu.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-D8rc4Fhu.cjs"),ee=require("./index-BCIAxJWJ.cjs"),v=require("./getAttributedUrl-BuO50-dW.cjs"),Be=({className:n,message:i,next:d,properties:r,questionId:t,type:s})=>{const{useMobileStyling:g,border:y,isLongFormSurvey:c,focusedQuestionId:h}=e.useConfig(m=>({useMobileStyling:m.useMobileStyling,border:m.border,isLongFormSurvey:ee.isLongFormSurvey(m.studyType),focusedQuestionId:m.focusedQuestionId})),[l,b]=e.h(!1),[u,I]=e.h(""),[a,f]=e.h(!1),p=c&&h===t,x=r==null?void 0:r.collectName,C=(r==null?void 0:r.nameLabelText)||"Full Name",q=(r==null?void 0:r.consentText)||"I agree to the stated conditions",L=(r==null?void 0:r.submitButtonText)||"Submit",E=!!u.trim(),M=l&&(!x||E),U=(m,S=!1)=>{m.preventDefault(),m.stopPropagation();let B=null;if(!S){if(!M)return void f(!0);B={submitted:!0},x&&(B.name=u)}d({value:B,questionId:t,type:s},M)};return e.u("div",{className:e.cc(n,c&&!p&&"ul-card--unfocused","ul-card__consent-legal","fade-in-transition"),children:[e.u(v.Header,{isRequired:c&&(r==null?void 0:r.required),message:i,properties:{questionHtml:r.questionHtml}}),r!=null&&r.richTextBody?e.u(v.QuestionBodyWrapper,{children:e.u(v.Html,{className:"ul-rich-text-body",html:r.richTextBody,id:"ul-card__consent-legal-body-container"})}):null,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:y,error:a&&!l,id:"consent",isRadio:!1,isSelected:l,label:q,onUserInputChanged:({selected:m})=>{m!==l&&b(!l)},useMobileStyling:g}),x&&e.u("input",{"aria-label":C,"aria-placeholder":C,className:e.cc(e.getClasses("ul-consent-legal__name-input",g)),"data-gramm":"false",maxLength:250,name:"name",onBlur:m=>{m.currentTarget.style.borderColor=a&&!E?ee.ERROR_BORDER_COLOR:ee.DEFAULT_BORDER_COLOR},onFocus:m=>{m.currentTarget.style.borderColor=a&&!E?ee.ERROR_BORDER_COLOR:y},onInput:m=>{m.preventDefault(),m.stopPropagation(),I(m.currentTarget.value)},placeholder:C,style:a&&!E?{borderColor:ee.ERROR_BORDER_COLOR}:{},tabIndex:0,value:u})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(v.Button,{className:M?"":"sprig-button-disabled",onClick:U,children:L}),r.required===!1&&!c&&e.u("button",{className:"ul-card-skip__button",onClick:m=>U(m,!0),children:e.getSkipButtonText(r)})]})]})})]},t)},ae=n=>i=>{i.pointerType!=="touch"&&n()},Me=({activeValue:n,border:i,icon:d,isPressed:r,onSubmit:t,range:s,scaleLabelType:g,selectedValue:y,setSelectedValue:c,setActiveValue:h,setIsPressed:l,useMobileStyling:b,value:u,viewDocument:I})=>{const{isLongFormSurvey:a,enableCspTrustedTypes:f}=e.useConfig(S=>({isLongFormSurvey:ee.isLongFormSurvey(S.studyType),enableCspTrustedTypes:S.enableCspTrustedTypes})),p=`option-${u}`,x=g==="number",C=g==="star",q=g==="smiley",L=x&&u===n||u===y,[E,M]=(()=>{const S=C&&y!==null&&u<=y;return C&&u<=n||q&&u===n||S||u===n||u===y?[i,r||S||u===y?1:.3]:["",1]})(),U=e.F(()=>{const S=y===u,B={borderColor:L&&!b||S?E:"",fillOpacity:L?"":M,zIndex:L?3:"auto",color:S?"#fff":""};return x?{...B,backgroundColor:S?E:""}:{...B,color:C||q||S?E:""}},[L,E,M,y,u,x,C,q,b]),m=e.F(()=>ee.getHtml((({icon:S,scaleLabelType:B,value:P,selectedValue:H})=>{if(B==="smiley"&&P===H){let w=0;return S.replace(/black/g,()=>++w==1?"black":"white")}return S})({icon:d,scaleLabelType:g,value:u,selectedValue:y}),f),[f,d,g,y,u]);return e.u("button",{"aria-label":x?void 0:String(u),className:(()=>{switch(g){case"star":return e.cc(e.getClasses("likert-star",b),e.getClasses(`likert-star-${u}`,b));case"smiley":return e.cc(e.getClasses("likert-smiley",b),e.getClasses(`likert-smiley-${u}`,b));default:return u===s?e.cc(e.getClasses("likert-number",b),e.getClasses(`likert-number-${u}`,b),e.getClasses("likert-last-option",b)):e.cc(e.getClasses("likert-number",b),e.getClasses(`likert-number-${u}`,b))}})(),dangerouslySetInnerHTML:{__html:m},id:p,onClick:S=>{a&&(S.preventDefault(),S.stopPropagation(),c(u)),t()},onKeyDown:S=>{var H,w;const B=I.querySelectorAll(`.likert-${g??"number"}`),P=u-1;S.key==="ArrowRight"?(H=B[P+1])==null||H.focus():S.key==="ArrowLeft"?(w=B[P-1])==null||w.focus():S.key!=="Enter"&&S.key!==" "||(a&&(S.preventDefault(),S.stopPropagation(),c(u)),t())},onPointerCancel:ae(()=>l(!1)),onPointerDown:ae(()=>{l(!0),h(u)}),onPointerEnter:ae(()=>h(u)),onPointerLeave:ae(()=>{h(-1),l(!1)}),onPointerUp:ae(()=>l(!1)),style:U,tabIndex:0})},Re=({className:n,labels:i,message:d,next:r,properties:t,questionId:s,type:g})=>{const{border:y,useMobileStyling:c,viewDocument:h,isLongFormSurvey:l,focusedQuestionId:b}=e.useConfig(P=>({border:P.border,useMobileStyling:P.useMobileStyling,viewDocument:P.viewDocument,isLongFormSurvey:ee.isLongFormSurvey(P.studyType),focusedQuestionId:P.focusedQuestionId})),[u,I]=e.h(-1),[a,f]=e.h(!1),[p,x]=e.h(null);e.p(()=>{I(-1),f(!1),x(null)},[s]);const C=l&&b===s,q=i&&i.left,L=i&&i.right;let E;const{range:M,scaleLabelType:U,ratingIcons:m}=t;M&&(E=Number(M));const S=E||5,B=P=>{var H,w;switch(U){case"star":return(H=m[0])==null?void 0:H.svg;case"smiley":return(w=m[P])==null?void 0:w.svg;default:return String(P+1)}};return e.u("form",{className:e.cc(n,"ul-card--likert","fade-in-transition",l&&!C&&"ul-card--unfocused"),children:[e.u(v.Header,{isRequired:l&&(t==null?void 0:t.required),message:d,properties:t}),e.u(v.MobileEmbedView,{properties:t,children:e.u(e.g,{children:[e.u(v.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${S})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(S)].map((P,H)=>{const w=H+1;return e.u(Me,{activeValue:u,border:y,icon:B(H),isPressed:a,onSubmit:()=>r({value:w,questionId:s,type:g},!0),range:S,scaleLabelType:U,selectedValue:p,setActiveValue:I,setIsPressed:f,setSelectedValue:x,useMobileStyling:c,value:w,viewDocument:h},H)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:q}),e.u("span",{children:L})]})]}),!t.required&&!l&&e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-vertical-centered-container",children:e.u(v.Button,{onClick:P=>{P.preventDefault(),P.stopPropagation(),r({value:null,questionId:s,type:g},!0)},children:e.getButtonText(t)})})})]})})]},s)},Pe=({columns:n,onSelect:i,options:d,selectedOptions:r})=>{const t=e._([]),{border:s,useMobileStyling:g,cards:y,index:c}=e.useConfig(a=>({border:a.border,useMobileStyling:a.useMobileStyling,cards:a.cards,index:a.index})),h=d.findIndex(a=>r[a.id]===null),[l,b]=e.h(h),u=e.T((a,f)=>{var C;i(a,f);const p=l+1,x=d[p];if(x&&r[x.id]===null){b(p);const q=y[c];(q==null?void 0:q.groupId)!=null||((C=t.current[p])==null||C.scrollIntoView({block:"nearest",behavior:"smooth"}))}},[i,d,r,l,y,c]),I=e.T((a,f)=>{const p=l===a;return e.u(e.Accordion,{animate:!0,header:f.label,isOpen:p,onClick:()=>{var x;return b(p&&!((x=window.UserLeap)!=null&&x.isMobileSDK)?-1:a)},ref:x=>{x&&(t.current[a]=x)},showHeaderCheck:r[f.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:n.map(x=>e.u(v.Option,{allowTextEntry:!1,ariaLabel:`${f.label}-${x.label}`,border:s,error:!1,id:`${f.id}-${x.value}`,isRadio:!0,isSelected:r[f.id]===x.value,label:x.label,onUserInputChanged:()=>u(f.id,x.value),useMobileStyling:g},x.label))})},f.id)},[s,n,l,u,r,g]);return e.u("div",{children:d.map((a,f)=>I(f,a))})},De=({columns:n,onSelect:i,options:d,selectedOptions:r})=>{const{border:t,useMobileStyling:s,isLongFormSurvey:g}=e.useConfig(a=>({border:a.border,useMobileStyling:a.useMobileStyling,isLongFormSurvey:ee.isLongFormSurvey(a.studyType)})),y=d.length,c=n.length,h=e._(null),[l,b]=e.h(!1),[u,I]=e.h(!1);return e.p(()=>{const a=h.current,f=new ResizeObserver(p=>{window.requestAnimationFrame(()=>{a&&(b(Math.round(p[0].contentRect.width)<a.scrollWidth),I(Math.round(p[0].contentRect.width)<a.scrollWidth))})});return a&&f.observe(a),()=>{a&&f.unobserve(a)}},[]),e.u("div",{className:"ul-card--matrix_question_container",children:[e.u("div",{className:e.cc("ul-card--matrix_container",l&&"ul-matrix-scroll-gradient"),onScroll:()=>{(()=>{const a=h.current;a&&b(a.clientWidth+Math.abs(a.scrollLeft)<a.scrollWidth)})()},ref:h,children:e.u("div",{className:e.cc(g&&"ul-card--matrix_grid_longform","ul-card--matrix_grid"),style:`--numColumns: ${c}; --numRows: ${y+1};`,children:[e.u("div",{})," ",n.map(a=>e.u("div",{className:"ul-matrix-column-label",children:a.label},a.label)),d.map(a=>e.u(e.g,{children:[e.u("div",{"aria-label":a.label,className:"ul-matrix-row-label",children:a.label},a.label),e.u("div",{className:"ul-matrix-row-options",role:"radiogroup",children:n.map((f,p)=>{const x=p===c-1;return e.u("div",{className:e.cc("ul-matrix-option-wrapper",x&&"ul-matrix-last-option"),children:e.u(v.Option,{allowTextEntry:!1,ariaLabel:`${a.label}-${f.label}`,border:t,choiceStyle:{background:"transparent",border:"none",marginBottom:"0",padding:"0"},error:!1,id:`${a.id}-${f.value}`,isRadio:!0,isSelected:r[a.id]===f.value,onUserInputChanged:()=>i(a.id,f.value),useMobileStyling:s})},f.value)})})]}))]})}),(l||u)&&e.u("button",{className:u&&!l?"ul-matrix-scroll-arrow left":"ul-matrix-scroll-arrow",onClick:u&&!l?a=>{a.preventDefault();const f=h.current;if(f){const p=getComputedStyle(f).direction==="rtl";f.scrollTo({left:p?f.scrollWidth-f.clientWidth:0,behavior:"smooth"})}}:a=>{a.preventDefault();const f=h.current;if(f){const p=getComputedStyle(f).direction==="rtl";f.scrollTo({left:p?f.clientWidth-f.scrollWidth:f.scrollWidth,behavior:"smooth"})}},children:u&&!l?e.u(Fe,{}):e.u(Qe,{})})]})},Fe=()=>e.u("svg",{fill:"currentColor",height:"32",transform:"matrix(-1,0,0,1,0,0)",version:"1.1",viewBox:"0 0 256 256",width:"32",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"})}),Qe=()=>e.u("svg",{fill:"currentColor",height:"32",viewBox:"0 0 256 256",width:"32",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"})}),Ee=({className:n,message:i,next:d,options:r,properties:t,questionId:s,type:g,showIndividualSubmit:y=!1,onSubmitButtonClick:c})=>{const{useMobileStyling:h,isLongFormSurvey:l,focusedQuestionId:b,setFocusedQuestionId:u}=e.useConfig(m=>({useMobileStyling:m.useMobileStyling,isLongFormSurvey:ee.isLongFormSurvey(m.studyType),focusedQuestionId:m.focusedQuestionId,setFocusedQuestionId:m.setFocusedQuestionId})),I=t.matrixColumn,a=t.required,f=l&&b===s,p=m=>Object.values(m).every(S=>S==null),x=m=>a&&p(m),C=m=>{if(m.preventDefault(),m.stopPropagation(),d({value:L,questionId:s,type:g},!0),c){const S=!p(L);c(S)}},q=r.reduce((m,S)=>(m[S.id]=null,m),{}),[L,E]=e.h(q),M=(m,S)=>{l&&d({value:{...L,[m]:S},questionId:s,type:g},!x({...L,[m]:S})),E(B=>({...B,[m]:S}))},U=t.displayMatrixAsAccordion||h;return e.u("form",{className:e.cc(n,!l&&"ul-card__matrix","fade-in-transition",l&&!f&&"ul-card--unfocused"),id:"text-form",onClick:()=>{f&&u(s)},onSubmit:C,children:[e.u(v.Header,{isRequired:l&&(t==null?void 0:t.required),message:i,properties:t}),e.u(v.MobileEmbedView,{properties:t,children:[e.u(v.QuestionBodyWrapper,{children:[U?e.u(Pe,{columns:I,onSelect:M,options:r,selectedOptions:L}):e.u(De,{columns:I,onSelect:M,options:r,selectedOptions:L}),y&&e.u(v.LongformSubmitButton,{handleSubmit:C,isSubmitDisabled:x(L)})]}),!l&&e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:x(L),children:e.getButtonText(t)})})})]})]},s)},Ce=({className:n,message:i,onSubmit:d,options:r=[],properties:t,questionId:s,type:g,showIndividualSubmit:y=!1,onSubmitButtonClick:c})=>{const{border:h,useMobileStyling:l,isLongFormSurvey:b,focusedQuestionId:u,setFocusedQuestionId:I}=e.useConfig(k=>({border:k.border,useMobileStyling:k.useMobileStyling,isLongFormSurvey:ee.isLongFormSurvey(k.studyType),focusedQuestionId:k.focusedQuestionId,setFocusedQuestionId:k.setFocusedQuestionId})),a=b&&u===s,f=r.reduce((k,Q)=>(k[Q.id]={isSelected:!1},k),{}),[p,x]=e.h(f),C=g==="multiplechoice",q=t.required,L=r.find(k=>{var Q;return(Q=k.optionProperties)==null?void 0:Q.noneOfTheAbove}),E=k=>Object.entries(k).some(([Q,V])=>{var re;const J=r.find(o=>`${o.id}`===Q),G=V.userText===void 0||V.userText.trim()==="";return((re=J==null?void 0:J.optionProperties)==null?void 0:re.allowsTextEntry)&&G&&V.isSelected}),M=k=>Object.values(k).filter(Q=>Q.isSelected).length,U=k=>{const{minSelect:Q=0,maxSelect:V=1/0,maxSelectMode:J}=t,G=M(k);switch(J){case e.MaxSelectModes.Maximum:return G<=V;case e.MaxSelectModes.Range:return G===0||G>=Q;default:return!0}},m=t.minSelect&&t.minSelect>0&&t.maxSelectMode===e.MaxSelectModes.Range&&M(p)<t.minSelect&&(q||M(p)>0),S=k=>E(k)||q&&!M(k)||!U(k),B=k=>U(k)&&!E(k)&&M(k)>0,P=Object.entries(p).some(([k,Q])=>{var V,J;return Q.isSelected&&((J=(V=r.find(G=>`${G.id}`===k))==null?void 0:V.optionProperties)==null?void 0:J.allowsTextEntry)}),H=y&&(!C||P),w=k=>{Y(k.id,k.selected,k.userText,k.noneOfTheAbove),k.selected&&b&&!C&&!a&&I(s)},O=k=>{var Q;return(t==null?void 0:t.maxSelectMode)!==e.MaxSelectModes.Unlimited&&M(p)===(t==null?void 0:t.maxSelect)&&!((Q=p[k])!=null&&Q.isSelected)},z=k=>{if(k.preventDefault(),k.stopPropagation(),d(p,!0),c){const Q=B(p);c(Q)}},Y=(k,Q,V,J)=>{const G=Object.assign({},p);if((C||J)&&Q)for(const T of Object.values(G))T.isSelected=!1,delete T.userText;else L&&!J&&p[L.id].isSelected&&(G[L.id].isSelected=!1);G[k]={isSelected:Q,userText:V};const re=C&&Object.entries(G).some(([T,N])=>{var F,D;return N.isSelected&&((D=(F=r.find(j=>`${j.id}`===T))==null?void 0:F.optionProperties)==null?void 0:D.allowsTextEntry)}),o=!S(G);if(b&&(d(G,o),C&&!re&&o&&c)){const T=B(G);c(T)}x(G)};return e.u("form",{className:e.cc(n,"ul-card--multiple","fade-in-transition",b&&!a&&"ul-card--unfocused"),id:"text-form",onClick:g==="multipleselect"?()=>{b&&u!==s&&g==="multipleselect"&&I(s)}:void 0,onSubmit:z,children:[e.u(v.Header,{isRequired:b&&(t==null?void 0:t.required),message:i,properties:t}),e.u(v.MobileEmbedView,{properties:t,children:e.u(e.g,{children:[e.u(v.QuestionBodyWrapper,{children:[t.isDropdown?e.u(v.Select,{disabledOptions:r.filter(k=>O(k.id)),dropdownFooter:m?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[M(p),"/",t.minSelect]}):void 0,isMultiSelect:!C,multiselectText:t.dropdownMultiselectedText??"choices selected",onChange:k=>{const Q={...p};for(const V of r)k.includes(V)?Q[V.id].isSelected=!0:Q[V.id].isSelected=!1;b&&d(Q,!S(Q)),x(Q)},options:r,placeholderText:t.dropdownPlaceholderText??(C?"Select choice":"Select choice(s)"),value:r.filter(k=>p[k.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",l)),role:C?"radiogroup":"group",children:[r.map(({id:k,label:Q,value:V,optionProperties:J})=>{var T,N;const G=`${k}`,{allowsTextEntry:re,noneOfTheAbove:o}={allowsTextEntry:!1,noneOfTheAbove:!1,...J};return e.u(v.Option,{allowTextEntry:re,border:h,disabled:O(G),error:E(p),id:G,isRadio:C,isSelected:!!((T=p[G])!=null&&T.isSelected),label:Q,noneOfTheAbove:o,onUserInputChanged:w,promptText:(J==null?void 0:J.otherOptionPlaceholder)||"Please specify",text:(N=p[k])==null?void 0:N.userText,useMobileStyling:l,value:V},G)}),!!m&&e.u("div",{className:"ul-card__min-select-counter",children:[M(p),"/",t.minSelect]})]}),H&&e.u(v.LongformSubmitButton,{handleSubmit:z,isSubmitDisabled:S(p)})]}),!b&&e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:S(p),onClick:z,children:e.getButtonText(t)})})})]})})]},s)},Oe=n=>{const{questionId:i,type:d,next:r,options:t}=n,{setFocusedQuestionId:s}=e.useConfig(g=>({setFocusedQuestionId:g.setFocusedQuestionId}));return e.u(Ce,{...n,onSubmit:(g,y)=>{var I;const c=Object.entries(g).find(([,a])=>a.isSelected)||[void 0,void 0],[h,l]=c,b=t.find(a=>`${a.id}`===h);!((I=b==null?void 0:b.optionProperties)!=null&&I.allowsTextEntry)||l!=null&&l.userText&&l.userText.trim()!==""||s(i);const u=l!=null&&l.userText?{[h]:{userText:l.userText}}:null;r({value:b&&h?{[h]:b.value}:{},secondaryValue:u,questionId:i,type:d},y)}})},Ae=n=>{const{questionId:i,type:d,next:r}=n;return e.u(Ce,{...n,onSubmit:(t,s)=>{const g=Object.entries(t).reduce((c,[h,l])=>(c[h]=l.isSelected,c),{}),y=Object.entries(t).reduce((c,[h,l])=>{if(!l.userText)return c;const b=c||{};return b[h]={userText:l.userText},b},null);r({value:g,secondaryValue:y,questionId:i,type:d},s)}})},He=({className:n,labels:i,message:d,properties:r,next:t,questionId:s,type:g})=>{const[y,c]=e.h(null),{border:h,useMobileStyling:l,viewDocument:b,isLongFormSurvey:u,focusedQuestionId:I}=e.useConfig(x=>({border:x.border,useMobileStyling:x.useMobileStyling,viewDocument:x.viewDocument,isLongFormSurvey:ee.isLongFormSurvey(x.studyType),focusedQuestionId:x.focusedQuestionId})),a=u&&I===s,f=i&&i.left,p=i&&i.right;return e.u("form",{className:e.cc(n,"ul-card--nps","fade-in-transition",u&&!a&&"ul-card--unfocused"),children:[e.u(v.Header,{isRequired:u&&(r==null?void 0:r.required),message:d,properties:r}),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",l),e.getClasses(`nps-number-${C}`,l)),id:`option-${C}`,onClick:q=>{u&&(q.preventDefault(),q.stopPropagation(),c(C)),t({value:C,questionId:s,type:g},!0)},onKeyDown:q=>{var E,M;const L=b.querySelectorAll("button.nps-number");q.key==="ArrowRight"?(E=L[C+1])==null||E.focus():q.key==="ArrowLeft"?(M=L[C-1])==null||M.focus():q.key!=="Enter"&&q.key!==" "||(u&&(q.preventDefault(),q.stopPropagation(),c(C)),t({value:C,questionId:s,type:g},!0))},onPointerDown:q=>{q.currentTarget.style.zIndex="2",q.currentTarget.style.borderColor=h},onPointerLeave:q=>{q.currentTarget.style.zIndex="auto"},style:y===C?{backgroundColor:h,color:"#fff"}:void 0,tabIndex:0,children:C},C))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:f}),e.u("span",{children:p})]})]}),!r.required&&!u&&e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-vertical-centered-container",children:e.u(v.Button,{onClick:x=>{x.preventDefault(),x.stopPropagation(),t({value:null,questionId:s,type:g},!0)},children:e.getButtonText(r)})})})]})]},s)},$e=n=>{const{className:i,message:d,next:r,properties:t,questionId:s,type:g,showIndividualSubmit:y=!1,onSubmitButtonClick:c}=n,h=g==="aidynamicfollowup"||g==="aidynamicstandalone",l=h?n.loading:void 0,{border:b,useMobileStyling:u,update:I,isLongFormSurvey:a,focusedQuestionId:f,setFocusedQuestionId:p,isPreview:x}=e.useConfig(w=>({border:w.border,useMobileStyling:w.useMobileStyling,update:w.update,isLongFormSurvey:ee.isLongFormSurvey(w.studyType),focusedQuestionId:w.focusedQuestionId,setFocusedQuestionId:w.setFocusedQuestionId,isPreview:w.isPreview})),[C,q]=e.h(""),L=e._(null),E=a&&f===s;e.p(()=>{var w,O;a&&!x&&(E?(w=L.current)==null||w.focus():(O=L.current)==null||O.blur())},[a,E,x]);const M=C.trim(),U=t.required===!0&&!M,m=v.useAutoSize(L,()=>I()),S=w=>{w.preventDefault(),w.stopPropagation();const O=M.length>0,z=!t.required||O;r({value:C,questionId:s,type:g},z),c&&c(O)},B=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";if((l===e.DynamicQuestionLoadingStates.failure||l===void 0)&&h)return e.u(e.g,{});const P=l===e.DynamicQuestionLoadingStates.inFlight,H=P?"Preparing your next question":d;return e.u("form",{className:e.cc(i,"ul-card-text","fade-in-transition",a&&!E&&"ul-card--unfocused"),id:"text-form",onClick:()=>{a&&f!==s&&p(s)},children:[e.u(v.Header,{isRequired:a&&(t==null?void 0:t.required),message:H,properties:t}),e.u(v.MobileEmbedView,{properties:t,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":B,className:e.cc(P&&"ul-card-text__input__loading",e.getClasses("ul-card-text__input",u)),"data-gramm":"false",disabled:P,maxLength:5e3,name:"text",onBlur:w=>{w.currentTarget.style.borderColor=ee.DEFAULT_BORDER_COLOR},onChange:w=>{const{value:O}=w.currentTarget;if(m(),w.preventDefault(),w.stopPropagation(),q(O),a){const z=O.trim().length>0;r({value:O,questionId:s,type:g},z)}},onFocus:w=>{w.currentTarget.style.borderColor=b,p(s)},placeholder:B,ref:L,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(v.Html,{className:"footer",html:t.footerHtml}),y&&e.u(v.LongformSubmitButton,{handleSubmit:S,isSubmitDisabled:U}),e.u(v.QuestionBodyFooterContainer,{children:!a&&e.u(v.Button,{disabled:U||P,onClick:S,children:e.getButtonText(t)})})]})})})]},s)},ce=1,ke=2,Te=3,le=n=>n.type==="av_permission",ve=n=>n.type==="screen_permission",_e=(n,i)=>n===void 0?ce:n?((d,r)=>!(le(r)?r.permissionDescriptors:[]).includes("camera")||d.getVideoTracks().length>0)(n,i)?Te:ce:ke,ye={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ne=e.create(n=>({...ye,reset:()=>{n(ye)},updatePage:i=>{n(i)}}));function pe({currentPage:n,pages:i}){const{avStream:d,recordingMediaTypes:r,updatePage:t}=ne.getState(),{recorderEventEmitter:s}=e.useConfig.getState();s.emit("av.permission",{"permission.descriptors":n.permissionDescriptors,"stream.ready":(g,y)=>{if(d===g)return;let c=n;if(g&&!n.permissionDescriptors.includes("camera")){const h=i.indexOf(n),l=y!=null&&y.active?h+2:h+1;y!=null&&y.active&&r&&s.emit("begin.recording",{"recording.media.types":r,"start.recording.callback":b=>t({mediaRecordingUids:b})}),c=i[l]}t({currentPage:c,avStream:g})}})}function me({status:n}){const{nextQuestion:i,passthroughData:d,mediaRecordingUids:r,reset:t}=ne.getState(),{recorderEventEmitter:s,handleUploadUpdate:g,index:y}=e.useConfig.getState(),c={value:{taskStatus:n},type:"recordedtask",questionId:(d==null?void 0:d.questionId)||1};d&&s.emit("finish.task",{"begin.callback":h=>{g({mediaRecordingUid:h,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(h,l)=>{g({mediaRecordingUid:h,progressPct:l.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":h=>{h&&g({mediaRecordingUid:h,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":d,"current.index":y,"task.response":c,"task.complete.callback":h=>{c.value.taskDurationMillisecond=h,r&&(c.value.mediaRecordingUids=r),t(),i(c)}})}function ge({pages:n,setIsRequestingPermission:i}){const{recorderEventEmitter:d,eventEmitFn:r}=e.useConfig.getState(),{updatePage:t,currentPage:s,recordingMediaTypes:g,screenPermissionRequested:y}=ne.getState();if(!s)return;const c=n.indexOf(s);switch(s.type){case"av_permission":{const h=y?c+2:c+1;return y&&g&&d.emit("begin.recording",{"recording.media.types":g,"start.recording.callback":l=>{t({mediaRecordingUids:l})}}),void t({currentPage:n[h]})}case"screen_permission":return void d.emit("screen.permission",{"screen.permission.requested":i,"stream.ready.callback":(h,l)=>{const b=l?n[c+1]:s;l&&g&&d.emit("begin.recording",{"recording.media.types":g,"start.recording.callback":u=>{t({captureStream:l,mediaRecordingUids:u})}}),t({currentPage:b,screenPermissionRequested:!0,captureStream:l})}});case"start_task":return r("recorded.task.start"),d.emit("recorded.task.start"),d.emit("start.task"),void t({currentPage:n[c+1],screenPermissionRequested:!0});case"complete_task":return}}const we="ul-permission-graphics-container",Ie="ul-permission-body",Ne=e.cc(we,"ul_recorded-task-inset-spacing"),ue=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),Le=({richTextBody:n})=>e.u(v.Html,{className:"ul-rich-text-body",html:n,id:"ul-task-detail-container"}),de=({required:n,skipButtonText:i,bottom:d=!1})=>n?null:e.u(v.Button,{className:e.cc(d&&"ul-skip-button-below","ul-button-inactive"),onClick:me.bind(null,{status:"abandoned"}),children:i||"Skip"}),he=n=>{const{avStream:i,captureStream:d,recordingMediaTypes:r,updatePage:t}=ne.getState(),s=(r==null?void 0:r.includes("audio"))||(r==null?void 0:r.includes("video"));e.p(()=>{const g=setInterval(()=>{s&&i&&!i.active?t({avStream:null,currentPage:n[0]}):d&&d.active||t({captureStream:void 0,currentPage:n[s?1:0]})},1e3);return()=>clearInterval(g)},[i,d,s,n,r,t])},Ue=({content:n,pages:i,required:d})=>{const{buttonText:r,skipButtonText:t,taskDetail:s}=n;return he(i),e.u("div",{className:"ul-task-page",children:[s&&e.u(Le,{richTextBody:s}),e.u("div",{className:ue,children:[e.u(v.Button,{onClick:ge.bind(null,{pages:i}),children:r}),e.u(de,{required:d,skipButtonText:t})]})]},"start-task")},Ve=({content:n,pages:i,properties:d})=>{const{buttonText:r,skipButtonText:t}=n;return he(i),e.u("div",{className:"ul-task-page",children:[n.taskDetail&&e.u(Le,{richTextBody:n.taskDetail}),e.u(v.MobileEmbedView,{properties:d,children:e.u("div",{className:ue,children:[e.u(v.Button,{className:"ul-complete-task-button",onClick:me.bind(null,{status:"completed"}),children:r}),e.u(v.Button,{className:e.cc("ul-button-inactive"),onClick:me.bind(null,{status:"given.up"}),children:t})]})})]},"complete-task")},We=({content:n,pages:i,required:d})=>{const{buttonText:r,skipButtonText:t}=n,[s]=e.useConfig(c=>[c.tabTitle]),[g,y]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ne,children:[e.u("p",{style:{marginTop:"auto"},children:n.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:Ie,children:s})})]}),e.u("div",{className:d?"":ue,children:[e.u(v.Button,{disabled:g,onClick:ge.bind(null,{pages:i,setIsRequestingPermission:y}),children:r}),e.u(de,{required:d,skipButtonText:t})]})]})},je=({content:n})=>e.u(v.Html,{className:e.cc(we,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:n.svg},"ul-permission-request-graphic"),Ge=({content:n,pages:i,required:d})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:t,skipButtonText:s,tryAgainButtonText:g}=n,y=le(i[0])?i[0]:null;return e.p(()=>{const c=setInterval(()=>{y!==null&&pe({currentPage:y,pages:i})},1e3);return()=>clearInterval(c)},[y,i]),y?e.u("div",{children:[e.u("div",{className:Ne,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:r}),e.u("span",{className:Ie,children:t})]})}),e.u("div",{className:ue,children:[e.u(v.Button,{onClick:pe.bind(null,{currentPage:y,pages:i}),children:g}),e.u(de,{required:d,skipButtonText:s})]})]}):null},Ze=({stream:n})=>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=n||null)}}),ze=({content:n,pages:i,required:d})=>{const{skipButtonText:r}=n,{avStream:t}=ne.getState();return he(i),e.u("div",{children:[e.u(Ze,{stream:t}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(v.Button,{onClick:ge.bind(null,{pages:i}),children:n.buttonText}),e.u(de,{bottom:!0,required:d,skipButtonText:r})]})]})},Ye=({properties:n})=>{const{pages:i,required:d}=n,{avStream:r,currentPage:t}=ne.getState();if(t===void 0)return null;switch(t==null?void 0:t.type){case"av_permission":{const s=_e(r,t);return s===ce?e.u(je,{content:t}):s===ke?e.u(Ge,{content:t,pages:i,required:d}):e.u(ze,{content:t,pages:i,required:d})}case"screen_permission":return e.u(We,{content:t,pages:i,required:d});case"start_task":return e.u(Ue,{content:t,pages:i,required:d});case"complete_task":return e.u(Ve,{content:t,pages:i,properties:n});default:return null}},Ke=({className:n,properties:i,next:d,questionId:r})=>{const t=e.useConfig(),{surveyId:s,responseGroupUid:g,userId:y,update:c}=t,h=ne(),{screenPermissionRequested:l}=h,b=ne(p=>p.avStream);let u=ne(p=>p.currentPage);u||(u=function({pages:p,userId:x,responseGroupUid:C,surveyId:q,questionId:L,next:E}){const{updatePage:M}=ne.getState(),{eventEmitFn:U,recorderEventEmitter:m}=e.useConfig.getState(),S={questionId:L,surveyId:q,visitorId:x,responseGroupUid:C};let B=0;m.emit("recorded.task.permission.screen"),U("recorded.task.permission.screen"),m.emit("permission.status",{"permission.status.callback":(H,w,O,z)=>{const Y=p[B],{type:k}=Y,Q=["screen"];if(le(Y)){const{permissionDescriptors:V}=Y,J=V==null?void 0:V.includes("microphone"),G=V==null?void 0:V.includes("camera");J&&Q.push("audio"),G&&Q.push("video"),(H!=null&&H.active&&!G||H!=null&&H.active&&w)&&B++}ve(p[B])&&O&&(B++,m.emit("begin.recording",{"recording.media.types":Q,"start.recording.callback":V=>M({mediaRecordingUids:V})})),M({currentPage:p[B],avStream:H,screenPermissionRequested:O,nextQuestion:E,type:k,passthroughData:S,recordingMediaTypes:Q,captureStream:z})}});const P=p[B];return P.type==="av_permission"&&pe({currentPage:P,pages:p}),P}({questionId:r,surveyId:s,next:p=>{d(p,!0)},pages:i.pages,responseGroupUid:g,userId:y}));let I=u.headline,a=u.captionText;const f=_e(b,u);return ve(u)&&l&&(I=u.permissionDeniedHeadline,a=u.permissionDeniedCaptionText),le(u)&&f===Te&&(I=u.permissionGrantedHeadline,a=u.permissionGrantedCaptionText),e.p(()=>{c()},[c]),e.u("div",{className:e.cc(n,"ul-center-horizontally","fade-in-transition"),children:[e.u(v.Header,{isRequired:i==null?void 0:i.required,message:I,properties:{captionText:a}}),e.u(v.QuestionBodyWrapper,{children:e.u(Ye,{properties:i})})]})},Xe=({richTextBody:n,plaintextBody:i})=>n?e.u(v.Html,{className:"ul-rich-text-body",html:n,id:"ul-card__text-url-body-container"}):i?e.u("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(i?i.split(/\n\s*\n/g):[]).map((d,r)=>e.u("p",{children:d},r))}):null,Je=({className:n,message:i,next:d,properties:r,questionId:t,type:s})=>{const{visitorAttributes:g,isLongFormSurvey:y}=e.useConfig(b=>({visitorAttributes:b.visitorAttributes,isLongFormSurvey:ee.isLongFormSurvey(b.studyType)})),c=(b,u=!1)=>{d({value:u?{skipped:!0}:void 0,questionId:t,type:s},!0)},h=v.getAttributedUrl(r&&r.buttonUrl,g),l=y&&r.promptActionType===e.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(n,"ul-card__text-url-prompt","fade-in-transition"),children:[e.u(v.Header,{isRequired:y&&(r==null?void 0:r.required),message:i,properties:{questionHtml:r.questionHtml}}),e.u(v.QuestionBodyWrapper,{children:e.u(Xe,{plaintextBody:r==null?void 0:r.body,richTextBody:r==null?void 0:r.richTextBody})}),e.u(v.MobileEmbedView,{properties:r,children:!l&&e.u(v.QuestionBodyFooterContainer,{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:h,id:"ul-card-text__button",onClick:c,onKeyPress:b=>{b.key!=="Enter"&&b.key!==" "||d({value:void 0,questionId:t,type:s},!0)},rel:"noreferrer",role:h?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(r)}),r.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:b=>c(0,!0),children:e.getSkipButtonText(r)})]})})})]},t)},et=({className:n,questionId:i})=>{const{border:d,destroy:r,endCard:t,forceBrandedLogo:s,update:g}=e.useConfig(h=>({border:h.border,destroy:h.destroy,endCard:h.endCard,forceBrandedLogo:h.forceBrandedLogo,update:h.update}));e.p(()=>{setTimeout(()=>{r(ee.APP_ID)},s?4e3:2e3)},[r,s]);const y=t&&t.subheader?e.u("p",{className:"ul-caption",children:t.subheader}):null,c=t&&t.headline?t.headline:"";return e.p(()=>{g()},[g]),e.u("div",{className:e.cc(n,"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:d,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:d,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:c}),y]})})},i)},tt=({className:n})=>{const{uploadProgress:i}=e.useConfig(s=>({uploadProgress:s.uploadProgress}));let d,r;Object.values(i).filter(s=>s.isSubmitted).length>1?(d="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(d="Your response is processing",r="Please keep this tab open until your response is fully processed.");const t=Math.round(Math.min(99,...Object.values(i).filter(s=>s.isSubmitted).map(s=>s.progressPct||0)));return e.u("div",{className:e.cc(n,"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:`${d} (${t}% complete)`}),e.u("p",{className:"ul-caption",children:r})]})},qe=e.F$1(void 0),rt=({value:n,children:i})=>e.u(qe.Provider,{value:n,children:i}),nt=({isRightLabel:n,isLeftLabel:i})=>n?e.MaxDiffChoice.RIGHT:i?e.MaxDiffChoice.LEFT:null,it="Best",st="Worst",ot=({className:n,labels:i,message:d,properties:r,options:t,questionId:s,type:g,next:y})=>{var L,E,M,U;const[c,h]=e.h(t.map((m,S)=>({...m,label:m.label===""?`Item ${S+1}`:m.label,isRightLabel:!1,isLeftLabel:!1}))),l=(()=>{const m=e.q(qe);if(m===void 0)throw new Error("usePreviousResponses must be used within a PreviousResponsesProvider");return m})(),b={padding:"24px",display:"flex",cursor:"pointer",width:"auto"},[u,I]=e.h(!1);e.p(()=>{const m=c.findIndex(Y=>Y.isRightLabel),S=c.findIndex(Y=>Y.isLeftLabel),B=m!==-1&&S!==-1;I(B);const P=!r.required||r.required&&B,H=c.map(Y=>({id:Y.id,option:Y.label,selected:nt(Y)})),w=Math.floor(s),O=Object.keys(l).filter(Y=>Y.startsWith(w.toString())).map(Number).sort((Y,k)=>Y-k).at(-1),z=[];if(typeof O=="number"){const Y=l[O],k=JSON.parse(Y);z.push(...k)}z.push(H),setTimeout(()=>{y({value:z,questionId:s,type:g},P,B),I(!1)},B?500:0)},[c]);const{border:a,useMobileStyling:f,enableCspTrustedTypes:p}=e.useConfig(m=>({border:m.border,useMobileStyling:m.useMobileStyling,enableCspTrustedTypes:m.enableCspTrustedTypes})),x=(m,S)=>()=>{u||h(B=>((P,H,w)=>P.map(O=>O.id===H?{...O,isRightLabel:w===e.MaxDiffChoice.RIGHT,isLeftLabel:w===e.MaxDiffChoice.LEFT}:w===e.MaxDiffChoice.RIGHT&&O.isRightLabel||w===e.MaxDiffChoice.LEFT&&O.isLeftLabel?{...O,isRightLabel:!1,isLeftLabel:!1}:O))(B,m,S))},C=(L=r.ratingIcons)==null?void 0:L[0].svg,q=(E=r.ratingIcons)==null?void 0:E[1].svg;return e.u("form",{className:e.cc(n,"ul-card-maxdiff","fade-in-transition"),children:[e.u(v.Header,{isRequired:r==null?void 0:r.required,message:d,properties:r}),e.u(v.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--maxdiff__question-inner-container",children:[e.u("div",{className:"ul-card-maxdiff__label",children:(i==null?void 0:i.left)||((M=r==null?void 0:r.labels)==null?void 0:M.left)||it}),e.u("div",{children:" "}),e.u("div",{className:"ul-card-maxdiff__label",children:(i==null?void 0:i.right)||((U=r==null?void 0:r.labels)==null?void 0:U.right)||st}),c.map(({id:m,label:S,isLeftLabel:B,isRightLabel:P})=>e.u(e.g,{children:[e.u("div",{className:"ul-card-maxdiff__option-control "+(q?"smiley":""),children:q?e.u(fe,{ariaPressed:B,className:B?"ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected good":"ul-card-maxdiff__option-btn",enableCspTrustedTypes:p,html:q,id:`smiley-good-${m}`,onClick:x(m,e.MaxDiffChoice.LEFT)}):e.u(v.Option,{allowTextEntry:!1,ariaLabel:`bestLabel-${S}`,border:a,choiceStyle:b,error:!1,id:`${m}`,isRadio:!0,isSelected:B,onUserInputChanged:x(m,e.MaxDiffChoice.LEFT),useMobileStyling:f})}),e.u("div",{className:"ul-card-maxdiff__option-label",children:S}),e.u("div",{className:"ul-card-maxdiff__option-control "+(C?"smiley":""),children:C?e.u(fe,{ariaPressed:P,className:P?"ul-card-maxdiff__option-btn ul-card-maxdiff__option-selected bad":"ul-card-maxdiff__option-btn",enableCspTrustedTypes:p,html:C,id:`smiley-bad-${m}`,onClick:x(m,e.MaxDiffChoice.RIGHT)}):e.u(v.Option,{allowTextEntry:!1,ariaLabel:`worstLabel-${S}`,border:a,choiceStyle:b,error:!1,id:`${m}`,isRadio:!0,isSelected:P,onUserInputChanged:x(m,e.MaxDiffChoice.RIGHT),useMobileStyling:f})})]}))]})})]},s)},fe=({enableCspTrustedTypes:n,ariaPressed:i,className:d,html:r,id:t,onClick:s})=>{const g=e.F(()=>ee.getHtml(r,n),[n,r]);return e.u("span",{"aria-pressed":i,className:d,dangerouslySetInnerHTML:{__html:g},id:t,onClick:s,tabIndex:0,type:"button"})},at=({className:n,labels:i,message:d,next:r,properties:t,questionId:s,type:g,onSubmitButtonClick:y,options:c,showIndividualSubmit:h=!1})=>{const l=e._(null),b=e._(0),u=e._(0),I=e._(null),a=e._(!1),f=e._([]),[p,x]=e.h(()=>(t==null?void 0:t.required)===!0),[C,q]=e.h(!1),[L,E]=e.h(()=>c.map(_=>({..._,rank:null}))),M=e.F(()=>Array.from({length:c.length},(_,$)=>$+1),[c.length]),{isLongFormSurvey:U,focusedQuestionId:m,setFocusedQuestionId:S,useMobileStyling:B,isPreview:P,headers:H}=e.useConfig(_=>({useMobileStyling:_.useMobileStyling,isLongFormSurvey:ee.isLongFormSurvey(_.studyType),focusedQuestionId:_.focusedQuestionId,setFocusedQuestionId:_.setFocusedQuestionId,isPreview:_.isPreview,headers:_.headers})),w=(H==null?void 0:H["userleap-platform"])==="android",O=B&&!P&&!w,z=!O&&!w,Y=U&&m===s,k=_=>{_.preventDefault(),T(L),y&&y(C)},Q=(_,$)=>{E(A=>{const R=parseInt($),W=A.map(Z=>({...Z}));W.some(Z=>Z.rank==null)&&W.forEach((Z,oe)=>Z.rank=oe+1);const te=W.findIndex(Z=>Z.id===_);if(te===-1)return A;const X=W[te].rank;return R<X?W.forEach(Z=>{Z.id!==_&&Z.rank>=R&&Z.rank<X&&(Z.rank=Z.rank+1)}):R>X&&W.forEach(Z=>{Z.id!==_&&Z.rank>X&&Z.rank<=R&&(Z.rank=Z.rank-1)}),W[te].rank=R,W.sort((Z,oe)=>Z.rank-oe.rank),N(W),W})},V=(_,$)=>{for(let A=0;A<f.current.length;A++){const R=f.current[A];if(!R||R===I.current)continue;const W=R.getBoundingClientRect();if(_>=W.left&&_<=W.right&&$>=W.top&&$<=W.bottom)return{element:R,index:A}}return null},J=_=>$=>{if(!O)return;$.preventDefault(),$.stopPropagation(),a.current=!0,l.current=_;const A=$.touches[0];b.current=A.clientY,u.current=A.clientY;const R=$.currentTarget.closest(".ul-card-rank__option");R&&(I.current=R,R.classList.add("is-dragging"))},G=_=>{if(!O||!a.current||l.current===null)return;_.preventDefault(),_.stopPropagation();const $=_.touches[0];u.current=$.clientY;const A=u.current-b.current;I.current&&(I.current.style.transform=`translateY(${A}px)`,I.current.style.zIndex="1000"),f.current.forEach(W=>{W&&W!==I.current&&W.classList.remove("is-drop-target")});const R=V($.clientX,$.clientY);R&&R.element.classList.add("is-drop-target")},re=_=>{if(!O||!a.current||l.current===null)return;_.preventDefault(),_.stopPropagation();const $=_.changedTouches[0],A=V($.clientX,$.clientY);I.current&&(I.current.style.transform="",I.current.style.zIndex="",I.current.classList.remove("is-dragging")),f.current.forEach(R=>{R&&R.classList.remove("is-drop-target")}),A&&A.index!==l.current&&o(l.current,A.index),l.current=null,I.current=null,a.current=!1},o=(_,$)=>{E(A=>{const R=A.map(te=>({...te})),[W]=R.splice(_,1);return R.splice($,0,W),R.forEach((te,X)=>{te.rank=X+1}),N(R),R})},T=_=>{const $={};_.reduce((A,R)=>(A[R.id]=R.rank,A),$),r({value:$,questionId:s,type:g},!0)},N=_=>{x(!1),q(!0),U&&T(_)},{left:F,right:D}=i,j=c.length,K=_=>{_.preventDefault(),_.currentTarget.classList.add("is-drop-target")},ie=_=>{_.currentTarget.classList.remove("is-drop-target")},se=_=>{l.current=null,_.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(n,"ul-card-rank","fade-in-transition",U&&!Y&&"ul-card--unfocused"),onClick:U&&!Y?()=>{S(s)}:void 0,onSubmit:k,children:[e.u(v.Header,{isRequired:t==null?void 0:t.required,message:d,properties:t}),e.u(v.MobileEmbedView,{properties:t,children:w?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:L.map(({id:_,label:$,rank:A})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${$}`,className:e.cc("ul-card-rank__select",A==null&&"ul-card-rank__select--placeholder"),name:`rank[${_}]`,onChange:R=>Q(_,R.currentTarget.value),value:A??"",children:[A==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),M.map(R=>e.u("option",{className:"ul-card-rank__select-option",value:R,children:R},`${R}-${s}`))]}),e.u("span",{children:$})]},_))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[j," - ",D]})})]}),h&&e.u(v.LongformSubmitButton,{handleSubmit:k,isSubmitDisabled:p})]}),!U&&e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:p,children:e.getButtonText(t)})})})]}):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:w?void 0:_=>{_.preventDefault(),_.dataTransfer&&(_.dataTransfer.dropEffect="move")},children:L.map(({id:_,label:$,rank:A},R)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!z||void 0,onDragEnd:z?se:void 0,onDragEnter:z?K:void 0,onDragLeave:z?ie:void 0,onDragStart:z?(te=R,X=>{l.current=te,X.dataTransfer&&(X.dataTransfer.effectAllowed="move",X.dataTransfer.setData("text/plain",String(te)),X.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:z?(W=R,X=>{var oe,be;X.preventDefault(),X.currentTarget.classList.remove("is-drop-target");const Z=l.current;l.current=null,(be=(oe=X.currentTarget.closest(".ul-card-rank__list"))==null?void 0:oe.querySelector(".is-dragging"))==null||be.classList.remove("is-dragging"),Z!=null&&Z!==W&&o(Z,W)}):void 0,ref:X=>f.current[R]=X,children:[e.u("select",{"aria-label":`Rank for ${$}`,className:e.cc("ul-card-rank__select",A==null&&"ul-card-rank__select--placeholder"),name:`rank[${_}]`,onChange:X=>Q(_,X.currentTarget.value),value:A??"",children:[A==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),M.map(X=>e.u("option",{className:"ul-card-rank__select-option",value:X,children:X},`${X}-${s}`))]}),e.u("span",{children:$}),!w&&e.u("button",{"aria-label":`Drag ${$} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:O?re:void 0,onTouchMove:O?G:void 0,onTouchStart:O?J(R):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"})})})]},_);var W,te})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[j," - ",D]})})]}),h&&e.u(v.LongformSubmitButton,{handleSubmit:k,isSubmitDisabled:p})]}),!U&&e.u(v.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(v.Button,{disabled:p,children:e.getButtonText(t)})})})]})})]},s)},lt=new Set(["aidynamicfollowup","aidynamicstandalone","open","matrix","multipleselect","multiplechoice","rankorder"]),Se=({cardInstance:n,moveToNextQuestion:i,showIndividualSubmit:d,submitQuestion:r,updateCardValues:t,allResponsesArray:s})=>{const{isLongFormSurvey:g,createDynamicFollowupQuestion:y,cards:c,surveyVisitorAttributes:h}=e.useConfig(C=>({isLongFormSurvey:ee.isLongFormSurvey(C.studyType),createDynamicFollowupQuestion:C.createDynamicFollowupQuestion,cards:C.cards,surveyVisitorAttributes:C.surveyVisitorAttributes}));if(!n)return null;const{name:l,type:b,props:u,childId:I}=n,a=d&&lt.has(b),f=u==null?void 0:u.displayLogic;if(f!=null&&f.length&&!e.someDisplayLogicOptionMatches({displayLogic:f,allResponses:s,cards:c,surveyVisitorAttributes:h??{}}))return null;const p={className:"ul-card",next:(C,q,L=!0)=>r(C,q&&L),questionId:l,type:b,showIndividualSubmit:d,...a?{next:(C,q)=>{t(C.questionId,C,q??!0)},onSubmitButtonClick:(C=!1)=>{I?C?(i(l),y({parentQuestionId:l})):i(I):i(l)}}:{}},x=(()=>{switch(b){case"consentlegal":return e.u(Be,{...p,...u});case"likert":return e.u(Re,{...p,...u});case"matrix":return e.u(Ee,{...p,...u});case"maxdiff":return e.u(ot,{...p,...u});case"multiplechoice":return e.u(Oe,{...p,...u});case"multipleselect":return e.u(Ae,{...p,...u});case"nps":return e.u(He,{...p,...u});case"open":case"aidynamicfollowup":case"aidynamicstandalone":return e.u($e,{...p,type:n.type,...u});case"rankorder":return e.u(at,{...p,...u});case"recordedtask":return e.u(Ke,{...p,...u});case"texturlprompt":return e.u(Je,{...p,...u});case"thanks":return e.u(et,{...p,...u});case"uploading":return e.u(tt,{...p,...u});default:return null}})();return x?g?e.u("div",{className:"ul-card-scroll-wrapper",children:x},l):x:null},ut=({isSubmitDisabled:n=!1,onSubmit:i,buttonText:d})=>{var I;const{cards:r,forceBrandedLogo:t,index:s,marketingUrl:g,showSurveyBrand:y,slugName:c,surveyId:h,useMobileStyling:l}=e.useConfig(a=>({cards:a.cards,forceBrandedLogo:a.forceBrandedLogo,index:a.index,marketingUrl:a.marketingUrl,showSurveyBrand:a.showSurveyBrand,slugName:a.slugName,surveyId:a.surveyId,useMobileStyling:a.useMobileStyling})),b=((I=r[s])==null?void 0:I.type)==="thanks",u=e.buildMarketingUrl({marketingUrl:g,slugName:c,surveyId:h,forceBrandedLogo:t});return e.u("footer",{className:e.cc("long-form-question-footer-container",l&&"long-form-question-footer-container--mobile",b&&"long-form-question-footer-container-center"),children:[b&&t?e.u(e.ThankYouLink,{marketingUrlLink:u}):e.u("div",{className:"long-form-question-footer-container-logo",children:y?e.u(e.SprigBrandLogo,{forceBrandedLogo:t,marketingUrlLink:u}):null}),!b&&e.u("div",{className:e.cc("ul-card__button-wrapper","ul-card-vertical__button-wrapper","long-form-question-footer-container-actions"),children:e.u(v.Button,{className:e.cc("long-form-button",n&&"sprig-button-disabled"),disabled:n,onClick:i,children:e.u("span",{className:"long-form-button-text-container",children:d??e.u(e.Arrow,{stroke:"white"})})})})]})},dt=new Set(["thanks","uploading"]),xe="Questions with Display Logic do not show in side-by-side previews.";exports.PageCard=({cards:n,next:i,previousResponses:d})=>{var re;const r=e._(null),[t,s]=e.h({}),[g,y]=e.h({}),{isLongFormSurvey:c,focusedQuestionId:h,setFocusedQuestionId:l,createDynamicFollowupQuestion:b,allResponses:u,cardIndexByName:I,surveyVisitorAttributes:a,cards:f,createDynamicStandaloneQuestion:p,isPreview:x,update:C}=e.useConfig(o=>({isLongFormSurvey:ee.isLongFormSurvey(o.studyType),focusedQuestionId:o.focusedQuestionId,setFocusedQuestionId:o.setFocusedQuestionId,createDynamicFollowupQuestion:o.createDynamicFollowupQuestion,allResponses:o.allResponses,cardIndexByName:o.cardIndexByName,surveyVisitorAttributes:o.surveyVisitorAttributes,cards:o.cards,createDynamicStandaloneQuestion:o.createDynamicStandaloneQuestion,isPreview:o.isPreview,update:o.update})),q=e.F(()=>({...d,...e.buildReadableResponseMap(n.map(o=>{var T,N;return{...o,value:((T=t[o.name])==null?void 0:T.value)??null,secondaryValue:((N=t[o.name])==null?void 0:N.secondaryValue)??null}}))}),[d,t,n]);v.useSetAllResponsesRaw(q);const L=e.pipeReadableResponsesIntoCards(n,q),E=e.F(()=>e.buildResponsesArrayForDisplayLogic({storeAllResponses:u,cards:n,cardValues:t,cardIndexByName:I}),[u,n,t,I]),M=e.F(()=>{const o=new Set;return n.forEach(T=>{var F;const N=(F=T.props)==null?void 0:F.displayLogic;if(!N||N.length===0)return void o.add(T.name);e.someDisplayLogicOptionMatches({displayLogic:N,allResponses:E,cards:f,surveyVisitorAttributes:a??{}})&&o.add(T.name)}),o},[n,E,a,f]),U=(({isPreview:o,cards:T,displayedCardNames:N})=>{var j;if(!o||N.size>0)return!1;const F=T.filter(K=>!dt.has(K.type));if(F.length!==1)return!1;const D=(j=F[0].props)==null?void 0:j.displayLogic;return!!(D!=null&&D.length)})({isPreview:!!x,cards:n,displayedCardNames:M});e.p(()=>{U&&requestAnimationFrame(()=>{C()})},[U,C]),e.p(()=>{n.some(o=>{if(o.type==="aidynamicstandalone"&&o.props&&M.has(o.name)){if(o.props.loading===e.DynamicQuestionLoadingStates.inFlight)return!0;if(o.props.loading===void 0)return p({questionId:o.name}),!0}return!1})},[n,p,M]);const m=e._(null);e.p(()=>{const o=M,T=m.current;if(T!==null)for(const N of T)o.has(N)||(s(F=>{const D={...F};return delete D[N],D}),y(F=>{const D={...F};return delete D[N],D}));m.current=new Set(o)},[M]);const S=e._(null),B=e._(!1),P=e._(null),H=e.T(o=>{var D,j;B.current=!0;const T=n.findIndex(K=>K.name===o);if(!c||o===null||T===-1)return void(B.current=!1);const N=(D=S.current)==null?void 0:D.querySelectorAll(".ul-card-scroll-wrapper")[T],F=(j=S.current)==null?void 0:j.closest(".ul-card-main-content");if(N&&F){if(N&&F){const K=N.getBoundingClientRect(),ie=F.getBoundingClientRect(),se=K.top-ie.top+F.scrollTop,_=se+K.height/2,$=window.innerHeight-157;let A;K.height>=$?A=se:A=_-F.clientHeight/2;const R=F.clientHeight,W=F.scrollHeight-R,te=Math.max(0,Math.min(A,W));F.scrollTo({top:te,behavior:"smooth"}),setTimeout(()=>{B.current=!1},500)}}else B.current=!1},[c,n]);function w(o,T){return o.filter(N=>M.has(N.name)).map(N=>{const F=T[N.name],D=L.find(j=>j.name===N.name);return{...F,questionText:D?e.getProcessedQuestionText(D):void 0}})}e.p(()=>{h!==null&&n.findIndex(o=>o.name===h)!==-1||l(n[0].name)},[n,h,l]);const O=o=>{if(!c)return;let T=n.findIndex(N=>N.name===o)+1;for(;T<n.length&&!M.has(n[T].name);)T++;T<n.length?l(n[T].name):l(o)};e.p(()=>{c&&h!==null&&(P.current!==h?H(h):P.current=null)},[h,c,H]);const z=e.T(()=>{var ie,se;if(B.current)return;const o=(ie=S.current)==null?void 0:ie.closest(".ul-card-main-content");if(!o)return;const T=(se=S.current)==null?void 0:se.querySelectorAll(".ul-card-scroll-wrapper");if(!T||T.length===0)return;const N=o.getBoundingClientRect(),F=N.top+N.height/2;let D=0,j=1/0;T.forEach((_,$)=>{const A=_.getBoundingClientRect(),R=A.top+A.height/2,W=Math.abs(F-R);W<j&&(j=W,D=$)});const K=n[D];P.current=K.name,l(K.name)},[n,l]);e.p(()=>{var T;if(!c)return;const o=((T=S.current)==null?void 0:T.closest(".ul-card__container"))||null;return o&&o.addEventListener("scroll",z,{passive:!0}),()=>{o&&o.removeEventListener("scroll",z)}},[z,c]);const Y=e.F(()=>n.every(o=>{var T;return!M.has(o.name)||!(!(o!=null&&o.props)||!("properties"in o.props)||((T=o.props.properties)==null?void 0:T.required)!==!1)||g[o.name]}),[g,n,M]),k=async(o,T,N)=>{return y(D=>({...D,[o]:N})),await(F=D=>({...D,[o]:T}),new Promise(D=>{s(j=>{const K=F(j);return D(K),K})}));var F};e.p(()=>{var F;if(!c)return;const o=r.current,T=(F=n==null?void 0:n[0])==null?void 0:F.groupId;r.current=T;const N={};if(n.forEach(D=>{var j,K;e.appCardHasPropertiesWithRequired(D)&&(D.props.properties.required||(N[D.name]={value:((j=t[D.name])==null?void 0:j.value)??null,secondaryValue:((K=t[D.name])==null?void 0:K.secondaryValue)??null,questionId:D.name,type:D.type}))}),o==null||o!==T)s(N),y({});else{s(j=>({...j,...N}));const D=n.reduce((j,K)=>{var ie;return K.type==="aidynamicfollowup"&&((ie=K.props)==null?void 0:ie.loading)===null&&(j[K.name]=!0),j},{});y(j=>({...j,...D}))}},[n,c]);const Q=async(o,T)=>{const N=L.find(F=>F.name===o.questionId);if(c){const F=await k(o.questionId,o,T),D=V(o.type),j=J(o.type);if(D&&(N!=null&&N.groupId&&e.triggerFollowUpQuestionGeneration({displayCard:N,response:o,createDynamicFollowupQuestion:b}),O(o.questionId)),j&&T){const K=w(n,F);i(K)}}else{const F={...o,questionText:N?e.getProcessedQuestionText(N):void 0};e.triggerFollowUpQuestionGeneration({displayCard:N,response:o,createDynamicFollowupQuestion:b}),i([F])}},V=o=>new Set(["nps","likert","multiplechoice"]).has(o),J=o=>new Set(["videovoice","consentlegal","texturlprompt","maxdiff"]).has(o),G=((re=n[0])==null?void 0:re.type)==="thanks";return c?e.u("div",{className:"ul-card-list-container--longform","data-testid":"ui-container",ref:S,children:U?e.u("div",{className:"ul-display-logic-preview-message","data-testid":"display-logic-preview-message",children:xe}):e.u(rt,{value:d,children:[L.map((o,T)=>e.u(Se,{allResponsesArray:E,cardInstance:o,moveToNextQuestion:O,showIndividualSubmit:n.length>1&&T<n.length-1,submitQuestion:Q,updateCardValues:k},(o==null?void 0:o.name)||T)),!G&&e.u(ut,{isSubmitDisabled:!Y,onSubmit:function(){const o=w(n,t);if((L==null?void 0:L.length)===1&&(o==null?void 0:o.length)===1){const T=L[0],N=o[0];e.triggerFollowUpQuestionGeneration({displayCard:T,response:N,createDynamicFollowupQuestion:b})}i(o)}})]})}):e.u(e.g,{children:[e.u("div",{"data-testid":"ui-container",style:{display:"none"}}),U?e.u("div",{className:"ul-display-logic-preview-message","data-testid":"display-logic-preview-message",children:xe}):L.map((o,T)=>e.u(Se,{allResponsesArray:E,cardInstance:o,moveToNextQuestion:O,showIndividualSubmit:!1,submitQuestion:Q,updateCardValues:k},(o==null?void 0:o.name)||T))]})};