freemium-survey-components 2.0.407 → 2.0.409
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/lib/index.cjs.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/types/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.cjs.js
CHANGED
|
@@ -36,4 +36,4 @@ const i$=(e,t,n,a,o=!0)=>{const i=[];let r=t;const c=Math.min(e.byteLength,t+n-1
|
|
|
36
36
|
* FilePondPluginFileValidateType 1.2.9
|
|
37
37
|
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
|
38
38
|
* Please visit https://pqina.nl/filepond/ for details.
|
|
39
|
-
*/;const E3=({addFilter:e,utils:t})=>{const{Type:n,isString:a,replaceInString:o,guesstimateMimeType:i,getExtensionFromFilename:r,getFilenameFromURL:c}=t,s=(e,t)=>e.some((e=>{return/\*$/.test(e)?(n=e,(/^[^/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n})),l=(e,t,n)=>{if(0===t.length)return!0;const o=(e=>{let t="";if(a(e)){const n=c(e),a=r(n);a&&(t=i(a))}else t=e.type;return t})(e);return n?new Promise(((a,i)=>{n(e,o).then((e=>{s(t,e)?a():i()})).catch(i)})):s(t,o)};return e("SET_ATTRIBUTE_TO_OPTION_MAP",(e=>Object.assign(e,{accept:"acceptedFileTypes"}))),e("ALLOW_HOPPER_ITEM",((e,{query:t})=>!t("GET_ALLOW_FILE_TYPE_VALIDATION")||l(e,t("GET_ACCEPTED_FILE_TYPES")))),e("LOAD_FILE",((e,{query:t})=>new Promise(((n,a)=>{if(!t("GET_ALLOW_FILE_TYPE_VALIDATION"))return void n(e);const i=t("GET_ACCEPTED_FILE_TYPES"),r=t("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),c=l(e,i,r),s=()=>{const e=i.map((e=>t=>null!==e[t]&&(e[t]||t))(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter((e=>!1!==e)),n=e.filter(((t,n)=>e.indexOf(t)===n));a({status:{main:t("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:o(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:n.join(", "),allButLastType:n.slice(0,-1).join(", "),lastType:n[n.length-1]})}})};if("boolean"==typeof c)return c?n(e):s();c.then((()=>{n(e)})).catch(s)})))),{options:{allowFileTypeValidation:[!0,n.BOOLEAN],acceptedFileTypes:[[],n.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",n.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",n.STRING],fileValidateTypeLabelExpectedTypesMap:[{},n.OBJECT],fileValidateTypeDetectType:[null,n.FUNCTION]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:E3}));M.registerPlugin(S3,E3,o$,k3),e3(t3,a3,n3,o3);const T3=t.forwardRef((({onClick:e,maxFileSize:a=16,visible:o=!0,supportedFileFormats:i,translationVariables:r,fileErrors:c},s)=>{const[l,p]=t.useState(!1),u=r?.drop_your_file?r?.drop_your_file:n.createElement(n.Fragment,null,"Drop your file here, or Browse");return n.createElement("div",{ref:s,className:"file-upload-container "+(c?.current?.main?"errored":""),onClick:e,style:{visibility:o?"visible":"hidden"},onDragOver:e=>{e.preventDefault(),e.target.classList.add("push-backward")}}," ",n.createElement(I,{name:"file-upload-icon"}),"string"!=typeof u?n.createElement("p",null,u):n.createElement("p",{className:"drop-your-file-container",dangerouslySetInnerHTML:{__html:u}}),n.createElement("p",{className:"max-size"},((e,t,n)=>{if(n&&e&&t)return e.replace(t,n)})(r?.max_file_size,"{{max_file_size}}",String(a))||`Maximum file size : ${a} MB`),n.createElement("p",{className:"support file-formats"},r?.supported_file_formats||"Supported file formats: "," ",(i=i.join(", ")).trim()?n.createElement(n.Fragment,null,l?i:i.slice(0,20)," ",n.createElement("span",{onClick:()=>p(!l),style:{color:"#2C5CC5",textDecoration:"underline",cursor:"pointer"}},l?r?.show_less||"Show less":r?.show_more||"Show more")):"No formats selected"),n.createElement("div",{className:"filepond--drip"}))})),N3=({question:e,onChangeHandler:a,onFileUpload:o,setErrors:i,translationVariables:r,surveyServAssetUrl:c,value:s,preview:l})=>{const[p,u]=t.useState([]),[d,b]=t.useState([]),z=t.useRef(),m=e.type_info?.file_field?.max_file_size||10,h=t.useRef(null),f=t.useRef(),[O,A]=t.useState(!1);let v=!1;n.useEffect((()=>{const t=localStorage.getItem(`uploadedFile-${e?.name}`),n=t?JSON.parse(t):"";n?.source&&(n.options={...n.options,file:{name:s,size:n.fileSize}},s&&u([n]))}),[]);const g=async(t,n)=>{try{if(v)return;if(f.current&&Dn(h.current)||t){const i=t??f.current.getFiles()?.[0]?.file;if(i&&o){v=!0;const t=await o(i.type,i.size,i.name,e);if(n&&n(!0,50,100),t.startsWith("http")&&c){const n=await fetch(t,{method:"PUT",headers:{"Content-Type":i.type,"Content-Disposition":"attachment"},body:i}),o=new URL(t),r=`${c}${o.pathname}`;if(!n.ok)throw console.error("Error uploading file"),new Error("Error uploading file");localStorage.setItem(`uploadedFile-${e?.name}`,JSON.stringify({source:r,options:{type:"local"},fileSize:f.current.getFiles()?.[0]?.fileSize})),a(i.name)}else a(l?"dummy":null),console.error("Error fetching pre-signed url");v=!1}}}catch(e){throw console.error("error in uploading file",e,"stringified error",JSON.stringify(e)),new Error("Error uploading file")}};return n.useEffect((()=>{(()=>{const t=e.type_info?.file_field?.allowed_file_types,n=Object.keys(N).map((e=>{if((t||[]).includes(e))return N[e].concat(",")})).join(" ").trim().slice(0,-1);b(n.split(", "))})()}),[]),n.createElement(n.Fragment,null,n.createElement(M.FilePond,{ref:f,files:p,labelFileProcessing:r?.uploading_text??"Uploading..",labelFileProcessingComplete:r?.upload_complete??"Upload complete",labelMaxFileSizeExceeded:r?.file_too_large??"The file is too large and cannot be uploaded.",labelMaxFileSize:"",labelTapToCancel:"",labelTapToUndo:"",labelFileTypeNotAllowed:r?.invalid_type??"The file mismatch. Retry by uploading the supported file type.",fileValidateTypeLabelExpectedTypes:"",beforeAddFile:e=>(h.current?.main&&(h.current=null,i({}),u([e]),A(!0)),!0),onremovefile:()=>{O?A(!1):(u([]),i({}),h.current=null,a(null))},allowReplace:!0,server:{process:async(e,t,n,a,o,i)=>{i(!0,0,100);try{await g(t,i),i(!0,100,100),a(t.name)}catch(e){o("An error occurred during upload")}}},onpreparefile:(e,t)=>{const n=new FileReader;n.onloadend=()=>{const t=n.result??"",a=new Blob([t],{type:e.fileType}),o=new File([a],e.filename,{type:e.fileType});g(o)},n.readAsArrayBuffer(t)},onerror:t=>{h.current=t,i({[e.name]:t})},required:!0,credits:!1,allowFileTypeValidation:!0,acceptedFileTypes:d,fileValidateTypeDetectType:(e,t)=>new Promise(((t,n)=>{const a=e.name.split(".");t(`.${a[a.length-1].toLowerCase()}`)})),imageEditor:{legacyDataToImageState:SQ,createEditor:b3,imageReader:[Z2,{}],imageWriter:[K2,{}],imageProcessor:vj,imageEditorAfterWriteImage:({src:e,dest:t,imageState:n})=>new Promise(((a,o)=>{vj(e,{imageReader:Z2(),imageWriter:K2({targetSize:{width:128,height:15,fit:"cover"}}),imageState:n}).then((n=>{a([{name:"input_",file:e},{name:"output_",file:t},{name:"thumb_",file:n.dest}])})).catch(o)})),editorOptions:{utils:["crop","finetune","filter","annotate"],imageOrienter:Q2(),shapePreprocessor:M3(),...i3,...r3,...J2,locale:{...c3,...l3,...u3,...p3,...d3,...s3}}},allowFileSizeValidation:!0,maxFileSize:`${m}MB`,onupdatefiles:e=>{z.current?.classList.remove("push-backward"),e.length&&u(e)},maxFiles:1,name:`${e.id}-files`}),n.createElement(T3,{ref:z,onClick:e=>{const t=e.target;"path"!==t?.tagName&&"P"!==t?.tagName&&(!t?.className||t?.className instanceof SVGAnimatedString||t.className.includes("format-type-toggler"))||f.current.browse()},fileErrors:h,visible:Boolean(!p.length||h.current?.main),maxFileSize:m,translationVariables:{...r,tTimeZones:[{id:"",offset:"",timeZone:""}]},supportedFileFormats:d}),h?.current?.main&&n.createElement("div",{className:"file-error"},n.createElement(I,{name:"info"}),n.createElement("span",null,`${h?.current?.main}\n ${h.current?.sub}`)))},P3=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"NUMBER":return"number";default:return"text"}},$3=({question:e,autoFocusDelay:t,onChangeHandler:a,surveyStyle:o,formValues:i,fieldErrors:r,translationVariables:c,language:s,isQuestionBgDark:l,isMobile:p,isWidget:u,widgetStyle:d})=>{const b=e.type_info?.form_fields?.layout,M=e.type_info?.form_fields?.fields;return n.createElement("div",{className:`fsc-form-field-container layout-${(p||u&&"compact"===d?"VERTICAL":b??"VERTICAL").toLowerCase()}`.trim()},M?.map(((p,u)=>{const d="NUMBER"===p?.type||"PHONE"===p.type?18:256;return n.createElement("div",{className:"fsc-form-field",key:p.id},"DATE"!==p?.type&&"DATE_TIME"!==p?.type?n.createElement(n.Fragment,null,"PHONE"===p.type?n.createElement(da,{key:u,surveyLayout:o??"card",setFocus:0===u&&"standard"!==o,autoFocusDelay:t,label:p?.label||"",type:"tel",isRequired:!!p.required,showCount:!0,maxLength:d,value:p.id&&i[e.name]?.[p.id]||"",onChangeHandler:(t,n)=>{p.id&&a({...i[e.name]??{},[p.id]:t||null},!0)},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:"",translationVariables:c}):n.createElement(ra,{isQuestionBgDark:l,key:u,setFocus:0===u&&"standard"!==o,autoFocusDelay:t,onKeyDown:e=>{"PHONE"===p?.type&&ea(e),"NUMBER"===p?.type&&Jn(e)},showCount:!0,maxLength:d,placeholder:"NUMBER"===p?.type?"0":void 0,label:p?.label||"",type:P3(p?.type??"TEXT"),isRequired:!!p.required,value:p.id?i[e.name]?.[p.id]??"":"",onChange:t=>{p.id&&a({...i[e.name]??{},[p.id]:t.target.value.slice(0,d)||null})},onBlur:t=>{if(p.id){const n=i[e.name]?.[p.id],o=t.target.value.slice(0,d);(_n(n)||Dn(n))&&(_n(o)||Dn(o))||a?.({...i[e.name]??{},[p.id]:o||null},!1)}},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:""})):n.createElement(n.Fragment,null,"DATE_TIME"===p?.type?n.createElement(sq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,useAmPm:!e.type_info?.meta?.time_format,showTimezoneSelect:!1,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c}):n.createElement(cq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c})))})))};var B3="rovingFocusGroup.onEntryFocus",_3={bubbles:!1,cancelable:!0},H3="RovingFocusGroup",[D3,I3,V3]=Ce(H3),[X3,j3]=Q(H3,[V3]),[F3,U3]=X3(H3),G3=t.forwardRef(((e,t)=>a.jsx(D3.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(D3.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Y3,{...e,ref:t})})})));G3.displayName=H3;var Y3=t.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:p,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...b}=e,M=t.useRef(null),z=K(n,M),m=ke(c),[h=null,f]=ne({prop:s,defaultProp:l,onChange:p}),[O,A]=t.useState(!1),v=te(u),g=I3(o),y=t.useRef(!1),[q,W]=t.useState(0);return t.useEffect((()=>{const e=M.current;if(e)return e.addEventListener(B3,v),()=>e.removeEventListener(B3,v)}),[v]),a.jsx(F3,{scope:o,orientation:i,dir:m,loop:r,currentTabStopId:h,onItemFocus:t.useCallback((e=>f(e)),[f]),onItemShiftTab:t.useCallback((()=>A(!0)),[]),onFocusableItemAdd:t.useCallback((()=>W((e=>e+1))),[]),onFocusableItemRemove:t.useCallback((()=>W((e=>e-1))),[]),children:a.jsx(be.div,{tabIndex:O||0===q?-1:0,"data-orientation":i,...b,ref:z,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,(()=>{y.current=!0})),onFocus:ee(e.onFocus,(e=>{const t=!y.current;if(e.target===e.currentTarget&&t&&!O){const t=new CustomEvent(B3,_3);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=g().filter((e=>e.focusable));J3([e.find((e=>e.active)),e.find((e=>e.id===h)),...e].filter(Boolean).map((e=>e.ref.current)),d)}}y.current=!1})),onBlur:ee(e.onBlur,(()=>A(!1)))})})})),Z3="RovingFocusGroupItem",K3=t.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:c,...s}=e,l=et(),p=c||l,u=U3(Z3,o),d=u.currentTabStopId===p,b=I3(o),{onFocusableItemAdd:M,onFocusableItemRemove:z}=u;return t.useEffect((()=>{if(i)return M(),()=>z()}),[i,M,z]),a.jsx(D3.ItemSlot,{scope:o,id:p,focusable:i,active:r,children:a.jsx(be.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:n,onMouseDown:ee(e.onMouseDown,(e=>{i?u.onItemFocus(p):e.preventDefault()})),onFocus:ee(e.onFocus,(()=>u.onItemFocus(p))),onKeyDown:ee(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)?void 0:Q3[a]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=b().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const a=n.indexOf(e.currentTarget);n=u.loop?function(e,t){return e.map(((n,a)=>e[(t+a)%e.length]))}(n,a+1):n.slice(a+1)}setTimeout((()=>J3(n)))}}))})})}));K3.displayName=Z3;var Q3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function J3(e,t=!1){const n=document.activeElement;for(const a of e){if(a===n)return;if(a.focus({preventScroll:t}),document.activeElement!==n)return}}var e5=G3,t5=K3,n5="Radio",[a5,o5]=Q(n5),[i5,r5]=a5(n5),c5=t.forwardRef(((e,n)=>{const{__scopeRadio:o,name:i,checked:r=!1,required:c,disabled:s,value:l="on",onCheck:p,form:u,...d}=e,[b,M]=t.useState(null),z=K(n,(e=>M(e))),m=t.useRef(!1),h=!b||(u||!!b.closest("form"));return a.jsxs(i5,{scope:o,checked:r,disabled:s,children:[a.jsx(be.button,{type:"button",role:"radio","aria-checked":r,"data-state":u5(r),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:z,onClick:ee(e.onClick,(e=>{r||p?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())}))}),h&&a.jsx(p5,{control:b,bubbles:!m.current,name:i,value:l,checked:r,required:c,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})}));c5.displayName=n5;var s5="RadioIndicator",l5=t.forwardRef(((e,t)=>{const{__scopeRadio:n,forceMount:o,...i}=e,r=r5(s5,n);return a.jsx(re,{present:o||r.checked,children:a.jsx(be.span,{"data-state":u5(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:t})})}));l5.displayName=s5;var p5=e=>{const{control:n,checked:o,bubbles:i=!0,...r}=e,c=t.useRef(null),s=ae(o),l=ie(n);return t.useEffect((()=>{const e=c.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==o&&n){const t=new Event("click",{bubbles:i});n.call(e,o),e.dispatchEvent(t)}}),[s,o,i]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:o,...r,tabIndex:-1,ref:c,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function u5(e){return e?"checked":"unchecked"}var d5=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b5="RadioGroup",[M5,z5]=Q(b5,[j3,o5]),m5=j3(),h5=o5(),[f5,O5]=M5(b5),A5=t.forwardRef(((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:i,value:r,required:c=!1,disabled:s=!1,orientation:l,dir:p,loop:u=!0,onValueChange:d,...b}=e,M=m5(n),z=ke(p),[m,h]=ne({prop:r,defaultProp:i,onChange:d});return a.jsx(f5,{scope:n,name:o,required:c,disabled:s,value:m,onValueChange:h,children:a.jsx(e5,{asChild:!0,...M,orientation:l,dir:z,loop:u,children:a.jsx(be.div,{role:"radiogroup","aria-required":c,"aria-orientation":l,"data-disabled":s?"":void 0,dir:z,...b,ref:t})})})}));A5.displayName=b5;var v5="RadioGroupItem",g5=t.forwardRef(((e,n)=>{const{__scopeRadioGroup:o,disabled:i,...r}=e,c=O5(v5,o),s=c.disabled||i,l=m5(o),p=h5(o),u=t.useRef(null),d=K(n,u),b=c.value===r.value,M=t.useRef(!1);return t.useEffect((()=>{const e=e=>{d5.includes(e.key)&&(M.current=!0)},t=()=>M.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}}),[]),a.jsx(t5,{asChild:!0,...l,focusable:!s,active:b,children:a.jsx(c5,{disabled:s,required:c.required,checked:b,...p,...r,name:c.name,ref:d,onCheck:()=>c.onValueChange(r.value),onKeyDown:ee((e=>{"Enter"===e.key&&e.preventDefault()})),onFocus:ee(r.onFocus,(()=>{M.current&&u.current?.click()}))})})}));g5.displayName=v5;var y5=t.forwardRef(((e,t)=>{const{__scopeRadioGroup:n,...o}=e,i=h5(n);return a.jsx(l5,{...i,...o,ref:t})}));y5.displayName="RadioGroupIndicator";var q5=A5,W5=g5,w5=y5;const R5=e=>{const{checked:t,className:a,disabled:o,id:i,isRequired:r,label:c,name:s,readOnly:l,onChange:p,...u}=e;return n.createElement(q5,{className:`fsc-radio ${a??""}`.trim(),name:s,"aria-label":c||"Radio button",value:t?"default":"",required:r,disabled:o,"aria-readonly":l,onValueChange:e=>{p?.(!t,e)},...u},n.createElement("div",{className:"fsc-radio-container"},n.createElement(W5,{checked:t,"aria-checked":t,className:"fsc-radio-item",disabled:o,"aria-readonly":l,id:i,value:"default"},n.createElement(w5,{className:"fsc-radio-indicator"})),c&&n.createElement("label",{htmlFor:i,className:"fsc-radio-label"},c,c&&r&&n.createElement("span",null,"*"))))},L5=e=>{const{type_info:{matrix_properties:t},onChangeHandler:a,value:o}=e;return n.createElement("div",{className:"matrix-container","data-test-input":"matrix"},n.createElement("table",{className:"st-mt-table"},n.createElement("thead",{className:"st-mt-thead"},n.createElement("tr",{className:"st-mt-tr"},n.createElement("th",{className:"m-s-b-s-q-m-s-th-empty st-mt-th"}),t?.rating_labels?.map(((e,t)=>e.is_active?n.createElement("th",{key:e.id,className:"m-s-b-s-q-m-s-th st-mt-th"},n.createElement("div",{className:"m-s-b-s-q-m-s-th-div"},e.text)):null)))),n.createElement("tbody",{className:"st-mt-tbody"},t?.statements?.map(((e,i)=>e.is_active?n.createElement("tr",{key:e.id,className:"m-s-b-s-q-m-s-tr-hover st-mt-tr"},n.createElement("td",{className:"m-s-b-s-q-m-s-input st-mt-td"},e.text),t?.rating_labels?.map(((r,c)=>{if(!r.is_active)return null;const s=o?.find((t=>t?.statement_id===e?.id));return n.createElement("td",{key:r.id,className:"m-s-b-s-q-m-s-switch st-mt-td"},"SINGLE_ANSWER"===t?.type&&n.createElement(R5,{key:r.id||`${i}-key-${c}`,name:`q-m-s-radio-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:()=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e?.statement_id===s?.statement_id?{...s,rating_labels:[{id:r.id||"",text:r?.text||""}]}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])},label:""}),"MULTIPLE_ANSWERS"===t?.type&&n.createElement(Re,{key:r.id||`${i}-key-${c}`,name:`q-m-s-checkbox-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:t=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e.statement_id===s.statement_id?{...s,rating_labels:t?[...s.rating_labels||[],{id:r.id||"",text:r?.text||""}]:(s.rating_labels||[]).filter((e=>e?.id!==r.id))}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])}}))}))):null)))))},C5=e=>{const{type_info:{matrix_properties:t},onChangeHandler:a,name:o,isMobile:i,isReverseAnimation:r,statementIndex:c,value:s,widgetStyle:l,language:p="en"}=e,u=n.useMemo((()=>(t?.statements||[]).find(((e,t)=>t===c))),[t?.statements,c]),d=n.useMemo((()=>s?.find((e=>e?.statement_id===u?.id))),[u,s]);return n.createElement("div",{className:"matrix-wd-container","data-test-input":"matrix"},n.createElement("div",{className:"matrix-st-count"},`${c+1}/${(t?.statements||[]).length}`),n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{key:`${u?.id??""}`,initial:{opacity:0,x:Vn(p,r)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(p,r)},transition:{duration:.2}},n.createElement("div",{className:"matrix-st-text"},u?.text),n.createElement("div",{className:`matrix-st-labels wd-style-${l} ${i?"mt-mobile":""}`.trim()},"MULTIPLE_ANSWERS"===t?.type&&n.createElement(EP,{name:o??"",onChangeHandler:e=>{if(u?.id){const n=d?.statement_id?[...s||[]].map((n=>n.statement_id===d.statement_id?{...d,rating_labels:e.map((e=>{const n=t?.rating_labels?.find((t=>t.id===e));return{id:e,text:n?.text||""}}))}:n)):[...s||[],{statement_id:u.id,rating_labels:e.map((e=>{const n=t?.rating_labels?.find((t=>t.id===e));return{id:e,text:n?.text||""}}))}];a(n)}},saveOthersValue:()=>{},options:(t?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),values:(d?.rating_labels??[]).map((e=>e.id??"")),autoFocusDelay:0,othersValue:""}),"SINGLE_ANSWER"===t?.type&&n.createElement(aS,{name:o??"",language:p||"en",onChangeHandler:e=>{const n=t?.rating_labels?.find((t=>t.id===e));u?.id&&e&&a(d?.statement_id?[...s||[]].map((t=>t?.statement_id===d?.statement_id?{...d,rating_labels:[{id:e||"",text:n?.text||""}]}:t)):[...s||[],{statement_id:u.id,rating_labels:[{id:e,text:n?.text||""}]}])},saveOthersValue:()=>{},options:(t?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),value:d?.rating_labels?.[0]?.id??"",othersValue:""})))))},x5=({question:e,autoFocusDelay:t,setFocus:a,formValues:o,surveyLayout:i,onChangeHandler:r,isQuestionBgDark:c})=>{const s=e?.type_info?.number_field?.decimal,l=e?.type_info?.number_field?.decimal_point,p=s?2===l?"0.01":"0.1":"1",u=o[e.name],[d,b]=n.useState(u);n.useEffect((()=>{d&&!u&&b(u)}),[u]);const{maxLength:M,maxNumber:z}=n.useMemo((()=>{const e=s?16:18;var t;return{maxLength:e,maxNumber:(t=e)>=16?10n**BigInt(t)-1n:10**t-1}}),[s]),m=e=>{s&&!_n(l)&&(e.split(".")?.[1]?.length??0)>(l??0)||r(e?Hn(e,s||!1):"",!1)};return n.createElement("div",{className:"responsive-input-field"},n.createElement(ra,{autoFocusDelay:t,isRequired:!!e.required,type:"number",step:p,placeholder:e?.type_info?.meta?.placeholder??s?"0.0"+(2===l?"0":""):"0",onKeyDown:e=>{const{key:t,keyCode:n,which:a,code:o}=e;if(["e","E"].includes(t)&&e.currentTarget.value&&e.preventDefault(),"."===t&&s||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||["Backspace","Shift","Tab","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","-","+","e","E"].includes(t))return;if(["e","E"].includes(t))return;const i=void 0===a?n??o:a;String.fromCharCode(i).match(/^[0-9]+$/)||e.preventDefault()},..."card"===i?{value:u??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??"");BigInt(t)<=z&&e.target.value.length<=M&&m(e.target.value)}}:{value:d??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??""),n=e.target.value.split(".")[1]??"";if(n.length>(l??0))return;const a=BigInt(t);a<=z&&e.target.value.length<=M&&b(`${a}${_n(n)||Dn(n)?"":`.${n}`}`)},onBlur:()=>{return e=d,void((_n(u)||Dn(u))&&(_n(d)||Dn(d))||d===u||m(e));var e}},setFocus:a,showCount:!0,max:`${z}`,maxLength:M,isQuestionBgDark:c}))},k5=({question:e,questionCommentOnchangeHandler:t,commentsMeta:a,setFocus:o,isQuestionBgDark:i,isCommentsEnabled:r})=>{const[c,s]=n.useState(a?.toString());return r?n.createElement(nS,null,n.createElement(Kk.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},transition:{duration:.3,ease:"easeInOut"},exit:{height:0,opacity:0},className:"question-comments"},n.createElement(DN,{showCount:!0,maxLength:1500,rows:2,isRequired:!!e.required,placeholder:e?.type_info?.comment_placeholder??"Enter your comment",onChange:n=>{const a=n.target.value||"";s(a),t?.(e.name,a)},value:a||c,setFocus:!0,isQuestionBgDark:i,"aria-label":e.name}))):null},S5=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"URL":return"url";default:return"text"}},E5=e=>{switch(e){case"PHONE":return"phone";case"EMAIL":return"email";case"URL":return"url";default:return""}},T5=({question:e,autoFocusDelay:t,formValues:a,onChangeHandler:o,textboxErrors:i,surveyLayout:r,setFocus:c,onKeyDownHandler:s,translationVariables:l,isQuestionBgDark:p})=>{const u=e?.type_info?.text_field?.text_type,d=a[e.name],[b,M]=n.useState(d);return n.useEffect((()=>{b&&!d&&M(d)}),[d]),n.createElement("div",{className:"responsive-input-field"},"PHONE"===u?n.createElement(da,{startAdornment:n.createElement(I,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:E5(u)}),type:S5(u),setFocus:c,autoFocusDelay:t,label:"",isRequired:!!e.required,value:d,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",onChangeHandler:o,maxLength:18,showCount:!0,onKeyDownHandler:s,surveyLayout:r,translationVariables:l}):n.createElement(ra,{startAdornment:u&&"TEXT"!==u&&n.createElement(I,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:E5(u)}),type:S5(u),setFocus:c,autoFocusDelay:t,showCount:!0,label:"",onKeyDown:s,isRequired:!!e.required,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",..."card"===r?{value:d??"",onChange:e=>o(e.target.value)}:{onBlur:e=>{(_n(d)||Dn(d))&&(_n(b)||Dn(b))||b===d||o?.(e.target.value,!0)},value:b??"",onChange:e=>M(e.target.value)},maxLength:50,isQuestionBgDark:p}))},N5=({surveyLanguage:e,language:t="en",question:a,formValues:o,othersMeta:i,onChangeHandler:r,saveOthersValue:c,autoFocusDelay:s,isFinalQn:l,isWidget:p,isMobile:u,initialPivotAnswer:d,initialQuestionAnswer:b,isInitialTransition:M,formQuestionErrors:z,dateQuestionErrors:m,contactFormErrors:h,activeIndexOfRenderedStatement:f={},textboxQuestionErrors:O,isReverseAnimation:A,fileUploadErrors:v,preview:g,onFileUpload:y,widgetStyle:q="default",setErrors:W,translationVariables:w,surveyServAssetUrl:R,setFocus:L,block:C,onKeyDown:x,surveyStyle:k,isQuestionBgDark:S})=>{const E=a?.type_info?.question_comment,T=a?.type_info?.footer_text&&a.type_info.meta?.question_hint?n.createElement("div",{className:"footer question-hint ss-question-hint",role:"note",dangerouslySetInnerHTML:{__html:a?.type_info?.footer_text}}):n.createElement(n.Fragment,null),N=o[a.name],[P,$]=n.useState(N);switch(n.useEffect((()=>{P&&!N&&$(N)}),[N]),a?.type_info?.question_type){case"MATRIX_RATING_SCALE":return n.createElement(n.Fragment,null,p||u?n.createElement(C5,{language:t,name:a.name,isReverseAnimation:A,type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},isMobile:u,value:o[a.name]||[],statementIndex:f[a.name]??0,widgetStyle:q}):n.createElement(L5,{type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},value:o[a.name]||[]}),T);case"RANGE":return n.createElement(n.Fragment,null,n.createElement(rS,{question:a,onChangeHandler:r,isWidget:p,isMobile:u,widgetStyle:q,value:o[a.name],initialPivotAnswer:d,isInitialTransition:M}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"CHECKBOX":case"MULTI_SELECT":return n.createElement(n.Fragment,null,n.createElement(EP,{name:a.name,values:o[a.name],othersValue:i[a.name],options:a?.choices||[],onChangeHandler:r,saveOthersValue:c,isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),othersRequired:!!a?.type_info.meta?.othersRequired,autoFocusDelay:s,translationVariables:w,othersInputPlaceholder:a?.type_info?.comment_placeholder}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"RADIO":case"DROPDOWN":return n.createElement(n.Fragment,null,n.createElement(aS,{autoFocusDelay:s,name:a.name,onChangeHandler:r,initialQuestionAnswer:b,displayFormat:a?.type_info?.meta?.display_format||"LIST",saveOthersValue:c,options:a?.choices||[],value:o[a.name],othersValue:i[a.name],isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),language:t||"en",othersRequired:!!a?.type_info.meta?.othersRequired,isFinalQn:l,translationVariables:w,isQuestionBgDark:S,othersInputPlaceholder:a?.type_info?.comment_placeholder}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"TEXT":return n.createElement(n.Fragment,null,n.createElement(T5,{question:a,autoFocusDelay:s,formValues:o,onChangeHandler:r,textboxErrors:O||"",setFocus:L,onKeyDownHandler:x,surveyLayout:k??"card",translationVariables:w,isQuestionBgDark:S}),T);case"NUMBER":return n.createElement(n.Fragment,null,n.createElement(x5,{question:a,autoFocusDelay:s,formValues:o,setFocus:L,onChangeHandler:r,surveyLayout:k??"card",isQuestionBgDark:S}),T);case"FORM_FIELD":return n.createElement(n.Fragment,null,n.createElement($3,{widgetStyle:q,question:a,isWidget:p,isMobile:u,surveyStyle:k,isRequired:!!a.required,autoFocusDelay:s,translationVariables:w,onChangeHandler:(e,t)=>{r(e,"card"!==k&&t)},formValues:o,fieldErrors:z?.[a.name]||{},language:t||"en",isQuestionBgDark:S}),T);case"CONTACT_FORM":return n.createElement(n.Fragment,null,n.createElement(NP,{question:a,setFocus:L,autoFocusDelay:s,onChangeHandler:r,translationVariables:w,formValues:o,fieldErrors:h?.[a.name]||{},language:t||"en",isQuestionBgDark:S}),T);case"PARAGRAPH":return n.createElement(n.Fragment,null,n.createElement(DN,{showCount:!0,maxLength:1500,autoFocusDelay:s,isRequired:!!a.required,placeholder:a?.type_info?.meta?.placeholder??"",..."card"===k?{value:N??"",onChange:e=>r(e.target.value)}:{onBlur:e=>{(_n(N)||Dn(N))&&(_n(P)||Dn(P))||P===N||r?.(e.target.value,!0)},value:P??"",onChange:e=>$(e.target.value)},setFocus:L,isQuestionBgDark:S,"aria-label":a.name}),T);case"BOOLEAN":return n.createElement(n.Fragment,null,n.createElement(F,{type_info:a?.type_info,onSelect:r,value:o[a.name]}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"MESSAGE":return T;case"CONSENT":return n.createElement(n.Fragment,null,n.createElement(TP,{question:a,onChange:r,value:o[a.name]}),T);case"SLIDER":const e=a?.type_info.meta?.slider;return n.createElement(n.Fragment,null,n.createElement(HN,{defaultValue:[o[a.name]??e?.opening_position],isRequired:!!a.required,dir:In(t)?"rtl":"ltr",answer:o[a.name],min:e?.min,max:e?.max,onValueChange:([e],t)=>r(e,"card"!==k&&t),isInput:e?.numerical_input_box,gridLines:e?.grid_lines,stopAtGrid:e?.stop_at_grid_lines,allowDecimals:e?.allow_decimal,decimalPoints:e?.decimal_points,isMobile:u||"compact"===q}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"RANK_ORDER":const{others_meta:v,...C}=o;return n.createElement(n.Fragment,null,n.createElement(VT,{valueItems:C[a.name],items:a?.choices||[],onReorder:(e,t)=>r(e,"card"!==k&&t)}),T);case"DATE_TIME":return n.createElement(n.Fragment,null,"DATE_TIME"===a.type_info.meta?.question_format?n.createElement(sq,{id:a.id??"",name:a.name??"",type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,useAmPm:!a.type_info.meta?.time_format,showTimezoneSelect:!!a.type_info.meta?.time_zone,onChange:(e,t)=>{r(e,"card"!==k&&t)},setErrors:e=>{W((t=>({...t,dateQuestionErrors:e})))},fieldErrors:m?.[a.name]??[],value:o[a.name]||"",translationVariables:w,language:t||"en",isQuestionBgDark:S,isWidget:p}):n.createElement(cq,{allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,onChange:e=>{r(e,!1)},value:o[a.name]||"",translationVariables:w,language:t||"en",fieldErrors:m?.[a.name]??[],isQuestionBgDark:S,isWidget:p}),T);case"FILE":return n.createElement(N3,{setErrors:e=>{W({formQuestionErrors:z,textboxQuestionErrors:O,contactFormErrors:h,fileUploadErrors:e,dateQuestionErrors:m})},preview:g,onChangeHandler:r,question:a,onFileUpload:y,value:o[a.name]||"",translationVariables:w,surveyServAssetUrl:R});default:return console.error(`Question type ${a?.type_info?.question_type} not found`),null}},P5=({surveyServAssetUrl:e,thankYouQuestion:a,preview:o,placeholders:i,canResubmit:r,resetSurvey:c,navigateToStart:s,isMobile:l,allowMultipleSubmission:p,pivot:u,answers:d,questions:b,rangeToRender:M,translationVariables:z})=>{const{redirectUrl:m,redirectDelay:h,show_custom_button:f,show_review_links:O,show_social_links:A,image_url:v}=a?.type_info?.meta??{},[g,y]=t.useState(h??10),[q,W]=n.useState(!1);return t.useEffect((()=>{if(!o&&m){const e=setInterval((()=>y((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=m??""),0)))),1e3);return()=>{clearInterval(e),W(!1)}}return()=>{W(!1)}}),[]),n.createElement("div",{className:"question-container ss-question-container thankyou"},v&&n.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:v,alt:"thankyou_logo"}),n.createElement(n.Fragment,null,jn(a)),n.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:Un({questionText:a.text,placeholders:i,npsRating:Gn({theme:"nps",answers:d,questions:b})??"",npsRatingLabel:Yn({theme:"nps",answers:d,questions:b}),csatRating:Gn({theme:"csat",answers:d,questions:b})??"",csatRatingLabel:Yn({theme:"csat",answers:d,questions:b}),cesRating:Gn({theme:"ces",answers:d,questions:b})??"",cesRatingLabel:Yn({theme:"ces",answers:d,questions:b}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:o})}}),(r||p)&&n.createElement("div",{className:("wrap-up-actions "+(l?"mobile":"")).trim()},r&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),s()},"aria-label":z?.edit_response||"Edit your response"},n.createElement(I,{name:"edit"}),z?.edit_response||"Edit your response"),p&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),c()},"aria-label":z?.another_response||"Submit another response"},n.createElement(I,{name:"reload"}),z?.another_response||"Submit another response")),m&&n.createElement("div",{className:"redirection-container"},n.createElement("div",{className:"redirection-text"},Qn(g,z?.redirect_msg),n.createElement("br",null)),n.createElement("a",{className:"link",href:m},m)),(f||O||A)&&n.createElement(SP,{show_custom_button:f,show_review_links:O,show_social_links:A,surveyServAssetUrl:e}))},$5=({activeIndexOfRenderedStatement:e,navigateToPreviousBlock:t,canDisplayDisableButtonParams:a,navigateToNextBlock:o,translationVariables:i,setAnimationInProgress:r,animationInProgress:c,question:s})=>n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:c||MP("navigation-prev",a),className:"navigation-button ss-navigation-button",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),q),t()},title:s.name&&(e?.[s.name]??0)>0?i?.prev_statement||"go to previous statement":i?.prev_question||"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||MP("navigation-next",a),title:i?.next_question||"Go to next question",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),q),o()}},n.createElement(I,{name:"arrow-next"}))),B5=e=>{const{initialStatementHasAnswer:a,answers:o,renderedBlocks:i,blocks:r,activeIndexOfBlocks:c,activeIndexOfRenderedStatement:s={},activeIndexOfRenderedBlocks:l,saveFormValues:p,onSubmitHandler:u,skipBlock:d,skipStatement:b,survey:M,navigateToNextBlock:z,navigateToPreviousBlock:m,isInitialTransition:h,initialPivotAnswer:f,translationVariables:O,navigateToNextStatement:A,canDisplayDisableButtonParams:v,formQuestionErrors:g,dateQuestionErrors:y,textboxQuestionErrors:W,contactFormErrors:w,questions:R,pages:L,buttonRef:C,isReverseAnimation:x,isSubmitting:k}=e,[S,E]=t.useState(!1),{question:N}=i[l],P={...v,isSubmitting:k},$=N?.type_info?.meta?.display_format,B=YN({blocks:r,activeIndexOfBlocks:c,renderedBlocks:i,activeIndexOfRenderedBlocks:l,questions:R});return n.createElement(n.Fragment,null,(lP("message",P)||lP("consent",P))&&n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{key:N.name??"",id:`consent-buttons-${N.name??""}`,className:"question-consent-buttons ss-consent-action-buttons",initial:{opacity:0,x:Vn(e.language,x)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(e.language,x)},transition:{duration:.2}},lP("consent",P)&&"BUTTON"===$&&T.map((e=>n.createElement(G,{key:l+String(e.recordAs),onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),p(i[l],e.recordAs,!0)},disabled:S||MP("consent",P),variant:_n(o.formValues?.[N.name])||o.formValues?.[N.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(o.formValues?.[N.name]===e.recordAs?"selected":"")).trim()},N?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue))),lP("message",P)&&n.createElement(G,{onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),B?u("COMPLETE"):d()},disabled:S||MP("message",P),className:"message-button ss-action-message-button"},N?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"))),(lP("navigation",P)||lP("next",P)||lP("next-statement",P)||lP("submit",P)||lP("skip",P)||lP("skip-statement",P))&&n.createElement("div",{className:"question-footer ss-question-footer-container"},lP("navigation",P)?n.createElement($5,{animationInProgress:S,setAnimationInProgress:E,answers:o,canDisplayDisableButtonParams:P,activeIndexOfBlocks:c,activeIndexOfRenderedBlocks:l,renderedBlocks:i,initialStatementHasAnswer:a,blocks:r,activeIndexOfRenderedStatement:s,navigateToNextBlock:z,navigateToPreviousBlock:m,translationVariables:O,pages:L,question:N}):n.createElement("div",null),n.createElement("div",{className:"action-buttons ss-action-buttons"},lP("skip",P)&&n.createElement(G,{className:"skip-button ss-action-skip-button",onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),d()},variant:"secondary","aria-label":"skip question",disabled:S||k},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),lP("skip-statement",P)&&n.createElement(G,{className:"skip-button ss-action-skip-button",onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),b()},"aria-label":"skip statement",variant:"secondary",disabled:S||k},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),lP("next",P)&&n.createElement(G,{ref:C,onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),0!==l||!h||"RANGE"!==N.type_info?.question_type&&"BOOLEAN"!==N.type_info?.question_type||N.type_info?.question_comment||void 0===f?p(i[l],"CHECKBOX"===N?.type_info?.meta?.display_format&&"CONSENT"===N?.type_info?.question_type?o.formValues[N.name]??!1:o.formValues[N.name],!0):p(i[l],f,!0)},disabled:S||MP("next",P),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),lP("next-statement",P)&&n.createElement(G,{ref:C,onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),A?.(N.name)},disabled:S||!!MP("next-statement",P),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),lP("submit",P)&&n.createElement("div",{className:"submit ss-action-submit-button"},n.createElement(G,{ref:C,disabled:S||MP("submit",P),onClick:()=>{Dn(y?.[N.name])&&Dn(g?.[N.name])&&Dn(W?.[N.name])&&Dn(w?.[N.name])&&(E(!0),setTimeout((()=>{E(!1)}),q),u("COMPLETE"))}},M?.meta?.action_button?.submit||O?.actionButtonText?.submit||O?.submit_survey||"Submit")))))},_5=e=>{const{blocks:a,pages:o,activePage:i,renderedBlocks:r,activeBlock:c,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:l,isSurveyCompleted:p,isReverseAnimation:u,saveFormValues:d,saveOthersValue:b,skipBlock:M,skipStatement:z,onSubmitHandler:m,navigateToNextBlock:h,navigateToPreviousBlock:f,answers:O,questions:A,pivot:v,isInitialTransition:g,resetSurvey:y,activeIndexOfRenderedStatement:q,navigateToNextStatement:W,navigateToPreviousStatement:w,navigateToStart:R,translationVariables:L,initialStatementHasAnswer:C,dateQuestionErrors:x,formQuestionErrors:k,textboxQuestionErrors:S,contactFormErrors:E,fileUploadErrors:T,setErrors:N,expanded:P,setExpanded:$,isQuestionBgDark:B,isSubmitting:_}=RP(e);aa("Card",{...e,answers:O,activePage:i,activeBlock:c,renderedBlocks:r,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:l,activeIndexOfRenderedStatement:q});const H=t.useRef(null),D=Dn(O.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[I,V]=t.useState(D),X=n.useMemo((()=>Fn(v?.question)),[v?.question]),j=t.useMemo((()=>a.filter((({name:e},t,n)=>!eP({nextBlockName:e||"",blocks:n,questions:A}))).length),[a,A]);t.useEffect((()=>{c&&e.onBlockChange?.(c,i)}),[c,e]),t.useEffect((()=>{e.survey.theme&&Zn(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),t.useEffect((()=>{e.getSurveyProgress?.({totalBlocks:j,isSurveyCompleted:p,noOfAnswers:s})}),[j,p,s]);const F={answers:O,blocks:a,blockIndex:l,activeIndexOfBlocks:s,initialStatementHasAnswer:C,activeIndexOfRenderedBlocks:l,activeIndexOfRenderedStatement:q,renderedBlocks:r,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:g,questions:A,pages:o,activeIndexOfSet:0,branchSeparatePage:!1};return c&&c.question?n.createElement("div",{className:`freemium-survey-components card-survey-style ${In(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""}`.trim(),id:"freemium-survey"},n.createElement("div",{className:("question-holder "+(I?"prompt":"")).trim()},!p&&!I&&!e.isWidget&&o.length>0&&i?.page_id&&n.createElement(LP,{expanded:P,id:i.page_id,setExpanded:$,activePage:i,translationVariables:L}),n.createElement("div",{className:"questions ss-questions"},p?n.createElement(P5,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:ZN({pivotQn:v?.question,pivotQnAnswer:v?.answer,block:tP({activeBlock:c,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:O,questions:A,activeIndexOfBlocks:s,renderedBlocks:r,contactData:e.contactData,surveyLayout:"card",pages:o}),questions:A}),canResubmit:e.canResubmit,allowMultipleSubmission:e.allowMultipleSubmission,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",R):R()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",y):y()},preview:!!e.preview,placeholders:e.placeholders,isMobile:e.isMobile,pivot:v,rangeToRender:X,translationVariables:L,answers:O}):n.createElement(n.Fragment,null,!I&&e.isWidget&&o.length>0&&i?.page_id&&n.createElement(LP,{expanded:P,id:i.page_id,setExpanded:$,activePage:i,translationVariables:L}),n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{id:`${c.question.name}`,className:"question-container ss-question-container","data-test-question-name":c.question.name,key:`${c.question.name}`,initial:{opacity:0,x:Vn(e.language,u)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(e.language,u)},transition:{duration:.2}},I&&e.survey.prompt_settings?n.createElement(xP,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&V(!1)},placeholders:e.placeholders,isPreview:!!e.preview}):n.createElement(n.Fragment,null,n.createElement("div",{className:("question-text ss-question-text "+(c.required?"required":"")).trim(),dangerouslySetInnerHTML:{__html:Un({questionText:c?.question.text,placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:O,questions:A})??"",npsRatingLabel:Yn({theme:"nps",answers:O,questions:A}),csatRating:Gn({theme:"csat",answers:O,questions:A})??"",csatRatingLabel:Yn({theme:"csat",answers:O,questions:A}),cesRating:Gn({theme:"ces",answers:O,questions:A})??"",cesRatingLabel:Yn({theme:"ces",answers:O,questions:A}),preference:v?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${l}`,role:"heading","aria-level":1}),n.createElement(N5,{setFocus:!0,onKeyDown:e=>{"Enter"===e.key&&H.current&&H.current.click()},isReverseAnimation:u,preview:!!e.preview,surveyServAssetUrl:e.surveyServAssetUrl,setErrors:N,onFileUpload:e.onFileUpload,language:e.language||"en",surveyStyle:e.surveyStyle,surveyLanguage:e.survey.language,block:c,question:c.question,isFinalQn:YN({blocks:a,activeIndexOfBlocks:s,renderedBlocks:r,activeIndexOfRenderedBlocks:l,questions:A}),formValues:O.formValues,othersMeta:O.others,autoFocusDelay:"standard"===e.surveyStyle?350:0,activeIndexOfRenderedStatement:q,saveOthersValue:b,onChangeHandler:(e,t)=>{d(c,e,t)},isMobile:!!e.isMobile,initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,isInitialTransition:g,formQuestionErrors:k,dateQuestionErrors:x,textboxQuestionErrors:S,fileUploadErrors:T,contactFormErrors:E,translationVariables:L,isQuestionBgDark:B})))),!I&&n.createElement(B5,{isWidget:!1,language:e.language||"en",isReverseAnimation:u,surveyStyle:e.surveyStyle,canDisplayDisableButtonParams:F,answers:O,renderedBlocks:r,blocks:a,pages:o,activeIndexOfRenderedStatement:q,buttonRef:H,survey:e.survey,initialStatementHasAnswer:C,navigateToNextStatement:W,navigateToPreviousStatement:w,activeIndexOfRenderedBlocks:l,activeIndexOfBlocks:s,saveFormValues:d,skipBlock:M,skipStatement:z,onSubmitHandler:m,navigateToPreviousBlock:f,navigateToNextBlock:h,isInitialTransition:g,initialPivotAnswer:e.initialPivotAnswer,isMobile:!!e.isMobile,translationVariables:L,formQuestionErrors:k,dateQuestionErrors:x,textboxQuestionErrors:S,fileUploadErrors:T,contactFormErrors:E,questions:A,isSubmitting:_})))),!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)?n.createElement(pa,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??kP}):null):null},H5=e=>{const a=!!e.survey.meta?.branch_separate_page,o=e.survey.question_details?.questions||[],i=e.contactData||{},r=e.translationVariables||{},c=t.useRef({}),[s,l]=t.useState(e.survey?.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),[p,u]=t.useState({formQuestionErrors:{},textboxQuestionErrors:{},fileUploadErrors:{},contactFormErrors:{},dateQuestionErrors:{}}),[d,b]=t.useState(!1),[M,z]=t.useState(0),[m,h]=t.useState(e.survey.pages??[]),[f,O]=t.useState(m?.[0]),[A,v]=t.useState(!1),g=t.useMemo((()=>fP({pages:m,blocks:s,questions:o,initialPivotAnswer:e.initialPivotAnswer,responses:e.answers,answerStatus:e.answerStatus||"PARTIAL",branchSeparatePage:a,surveyLayout:"standard",contactData:i})),[s,o,e.answers]),[y,q]=t.useState(g.renderedBlocks),[w,R]=t.useState(g.activeIndexOfRenderedBlocks),[L,C]=t.useState(0),[x,k]=t.useState(g.activeIndexOfRenderedStatement),S=t.useRef(g.pivot),E=t.useRef(g.isInitialTransition),[T,N]=t.useState(""),[P,$]=t.useState(g.answers),B=t.useRef(((g.isConsideredCompleted||"PARTIAL"===e.answerStatus)&&e.canResubmit)??!1),[_,H]=t.useState(!1),D=y[w],I=n.useMemo((()=>y.length>0?s?.findIndex((e=>e.name===y[w]?.name)):0),[w]),V=t.useMemo((()=>{const t=e.survey.theme?.palette?.question_background;return!!t&&oa(t)}),[e.survey.theme?.palette?.question_background]);t.useEffect((()=>{e.survey.updated_at!==T&&(aa("useEffect",{updated_at:e.survey.updated_at,props:e}),h(e.survey.pages??[]),l(e.survey.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),O(e.survey.pages?.[0]),N(e.survey.updated_at??""))}),[e.survey.updated_at]),t.useEffect((()=>{aa("useEffect",{renderedBlocks:y,pages:m,activeIndexOfRenderedBlocks:w,props:e});const t=y?.[w]?.page_id,n=m.find((e=>e.page_id===t));m.length>0&&t&&n?.page_id&&O(n),void 0!==y?.[w]?.orderOfSet&&a&&C(y?.[w]?.orderOfSet)}),[y,m,w]),t.useEffect((()=>{aa("useEffect",{blocks:s,initialPivotAnswer:e.initialPivotAnswer,props:e});let t={...P};if(g.isConsideredCompleted&&E.current&&e.canResubmit)return;const{others_meta:n,...r}=e.answers||{};S.current={...S.current,question:FN({questions:o,blocks:s})};const l=o.find((e=>e.name===s?.[0]?.question_name||e.name===s?.[0]?.question_names?.[0]))??S.current.question;if(Dn(r)||void 0===e.initialPivotAnswer||r[l.name]===e.initialPivotAnswer||(t={...P,formValues:{...P.formValues,[l.name]:e.initialPivotAnswer},moveToNextPage:!0}),void 0!==e.initialPivotAnswer){const n=UN(S.current.question,e.initialPivotAnswer);S.current={...S.current,answer:"BOOLEAN"===l?.type_info?.question_type?Boolean(n):n},t={...P,formValues:{...P.formValues,[l.name]:S.current.answer},moveToNextPage:!1}}else void 0!==e.initialQuestionAnswer&&(t={...P,formValues:{...P.formValues,[l.name]:e.initialQuestionAnswer},moveToNextPage:!1});$(t);const p=ZN({pivotQn:S.current.question,pivotQnAnswer:S.current.answer,block:s[0],questions:o}),u=mP({activeBlock:{...s[0],question:p},blocks:s,questions:o,answers:t,pages:m,renderedBlocks:y,contactData:i,surveyLayout:"standard",initialTransition:!0,isEditResponse:B.current,branchSeparatePage:a}),d=[{...s[0],question:p},...u];if(q(a?ia(d,c):d),(e=>{if(null==e||0===Object.keys(e).length)return!0;const t=Object.keys(e).filter((e=>""!==e&&!_n(e)&&"others_meta"!==e));return t.every((t=>!e[t]))&&(!e.others_meta||0===Object.keys(e.others_meta).length)})({others_meta:{},...t.formValues})||E.current)R(s.findIndex((e=>d[0].name===e.name))),C(0);else{const e=d?.[d.length-1];R(d.findIndex((t=>t.name===e?.name))),a&&C(e?.orderOfSet!==L?e?.orderOfSet:0)}k({})}),[s,e.initialPivotAnswer,M]);const X=(e,t)=>{if(e===1/0)return;const n=s?.[e];let r=S.current?.question;n?.display_logic?.some((e=>"BASED_ON_RATING_GROUP"===e.logic_type))&&(r=FN({questions:o,blocks:s,displayLogic:n?.display_logic}));const l=ZN({pivotQn:r??S.current?.question,pivotQnAnswer:P?.formValues[r?.name]??S.current?.answer,block:n,questions:o}),p=zP({renderedBlocks:y,activeIndexOfRenderedBlocks:w}),u=s?.[e],d=mP({activeBlock:{...u,question:l},answers:P,blocks:s,questions:o,pages:m,renderedBlocks:y,contactData:i,surveyLayout:"standard",isEditResponse:B.current,branchSeparatePage:a}),b=[...p,...l?.name?[{...u,question:l}]:[],...d];k((e=>{const t={...e};return b.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const M=a?ia(b,c):b;q(M),t||R(p.length)};t.useEffect((()=>{if(aa("useEffect",{answers:P,blocks:s,props:e}),!(g.isConsideredCompleted&&E.current&&e.canResubmit)&&(!Dn(P.formValues)||P.moveToNextPage)&&s&&j(D,P.commitDirtyValue))if(sP({blocks:s,activeIndexOfBlocks:I,renderedBlocks:y,activeIndexOfRenderedBlocks:w,answers:P,questions:o,activePage:f,pages:m,surveyLayout:"standard"})){if(void 0!==e.initialPivotAnswer&&1===y.length&&E.current&&!P.commitDirtyValue);else if(P.commitDirtyValue){const t=iP({renderedBlocks:y,activeBlock:D,blocks:s,activeIndexOfBlocks:I,answers:P,questions:o,contactData:i,pages:m,surveyLayout:"standard",isDisplayBlock:!0});if(t!==1/0)E.current||!D.question.type_info?.question_type||D.question.type_info?.question_comment||["FORM_FIELD","MULTI_SELECT","RANK_ORDER"].includes(D.question.type_info?.question_type)?F():(e=>{e!==1/0&&setTimeout((()=>{const t=ZN({pivotQn:S.current?.question,pivotQnAnswer:S.current?.answer,block:s?.[e],questions:o});if(t?.name){const e=document?.querySelector(`.question-container.standard-card-${t.name}`),n=document?.querySelector(`.question-container.standard-card-${t.name} input`),a=document?.querySelector(`.question-container.standard-card-${t.name} textarea`);e?.scrollIntoView({behavior:"smooth",block:"center",inline:"start"}),setTimeout((()=>{n?.focus(),a?.focus()}),W)}F()}),0)})(t),(!P.moveToNextPage&&!a&&t&&t>0&&s[t-1]?.page_id===s[t]?.page_id||P.moveToNextPage&&a)&&X(t,!P.moveToNextPage&&!a);else{lP("submit",{answers:P,blocks:s,blockIndex:0,activeIndexOfBlocks:I,initialStatementHasAnswer:G,activeIndexOfRenderedBlocks:w,activeIndexOfRenderedStatement:x,renderedBlocks:y,activePage:f,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:E.current,questions:o,pages:m,contactData:e.contactData,activeIndexOfSet:L,branchSeparatePage:a,isSubmitting:A})||F("COMPLETE")}}}else("MATRIX_RATING_SCALE"===D?.question?.type_info?.question_type||P.commitDirtyValue)&&F()}),[P,s]);const j=(e,t)=>{if(e?.question_name)switch(e.question?.type_info?.question_type){case"DATE_TIME":return!t||vP({answer:P.formValues?.[e.question_name]||"",errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"FORM_FIELD":return AP({fields:e.question?.type_info?.form_fields?.fields,answers:P.formValues?.[e.question_name]||{},errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"TEXT":return gP({type:e.question?.type_info?.text_field?.text_type,answer:P.formValues?.[e.question_name]||"",errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"CONTACT_FORM":return yP({fields:e.question?.type_info?.contact_form?.fields,answers:P.formValues?.[e.question_name]||{},errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"FILE":return qP({errors:p.fileUploadErrors})||!e.required}return!0},F=(t="PARTIAL")=>{let n=()=>{},a=0;if(y.some(((e,t)=>(a=t,!j(e,!0)))))return void R(a);let r={...P.formValues};if("COMPLETE"===t){v(!0),n=()=>{v(!1),H(!0),B.current=!1};r=WP({pages:m,answers:{...P,formValues:r},blocks:s,questions:o,contactData:i,surveyLayout:"standard"})}e.onSubmit({...r,others_meta:P.others},n,t,B.current?"EDIT":"CREATE")},U=e=>{k((t=>({...t,[e]:(_n(t[e])?0:t[e])+1})))},G=n.useMemo((()=>{if("MATRIX_RATING_SCALE"!==D?.question?.type_info?.question_type)return!1;const e=D?.question?.type_info?.matrix_properties?.statements||[],t=e?.[x?.[D?.question.name]]??0,n=(P.formValues[D?.question.name]||[]).find((e=>e.statement_id===t?.id));return(n?.rating_labels||[]).length>0}),[x,w]),Y=()=>{const e=m.findIndex((e=>e.page_id===f?.page_id));let t=1,n=m?.[e+t];for(;!y.map((e=>e.page_id)).includes(n?.page_id)&&e+t<m.length;)n=m?.[e+ ++t];const a=y.find((e=>e.page_id===n?.page_id));n?.page_id&&O(n),"number"==typeof a?.orderOfSet&&C(a.orderOfSet);const o=y.findIndex((e=>e.page_id===n?.page_id));-1!==o&&R(o)},Z=()=>{const e=m.findIndex((e=>e.page_id===f?.page_id));let t=1,n=m?.[e-t];for(;!y.map((e=>e.page_id)).includes(n?.page_id)&&t>=0;)n=m?.[e-++t];const a=[...y];let o=a.pop();for(;o?.page_id!==n.page_id;)o=a.pop();n?.page_id&&O(n),"number"==typeof o.orderOfSet&&C(o.orderOfSet)};return{blocks:s,pages:m,navigateToNextSet:()=>{const e=y.find((e=>e.orderOfSet===L+1));if(e){a&&void 0!==e?.orderOfSet&&C(e?.orderOfSet);const t=m.find((t=>t.page_id===e?.page_id));t?.page_id&&O(t),$((e=>({...e,moveToNextPage:!0})))}else Y()},navigateToPreviousSet:()=>{const e=y.find((e=>e.orderOfSet===L-1));if(e){a&&void 0!==e?.orderOfSet&&C((e=>e-1));const t=m.find((t=>t.page_id===e?.page_id));t?.page_id&&O(t)}else Z()},activePage:f,questions:o,renderedBlocks:y,initialStatementHasAnswer:G,activeBlock:D,activeIndexOfBlocks:I,activeIndexOfRenderedBlocks:w,activeIndexOfRenderedStatement:x,navigateToNextStatement:U,navigateToPreviousStatement:e=>{k((t=>({...t,[e]:(_n(t[e])?0:t[e])-1})))},isInitialTransition:E.current,isSurveyCompleted:_,pivot:S.current,answers:P,translationVariables:r,...p,setErrors:u,saveFormValues:(e,t,n=!1,a=w)=>{if(A)return;E.current=!1,e.question.name===S.current?.question.name&&(S.current={...S.current,answer:"BOOLEAN"===S.current?.question?.type_info?.question_type?Boolean(t):t}),a!==w&&R(a);const o={...P,formValues:{...P.formValues,[e.question.name]:"BOOLEAN"===e.question?.type_info?.question_type?Boolean(t):t},commitDirtyValue:n,moveToNextPage:!1};hP((({renderedBlocks:e,activeIndexOfRenderedBlocks:t})=>zP({renderedBlocks:e,activeIndexOfRenderedBlocks:t}).map((({question:e})=>e)))({renderedBlocks:y,activeIndexOfRenderedBlocks:a}),o),B.current&&(e.category??[]).length>0&&(e.category?.forEach((e=>{e.question_name&&(o.formValues[e.question_name]=null)})),o.formValues[e.question.name]=t),$(o);const i=y[a];"SINGLE_ANSWER"===i.question.type_info?.matrix_properties?.type&&(x?.[i.question.name]??0)<(i.question?.type_info?.matrix_properties?.statements||[]).length-1&&setTimeout((()=>{U?.(i.question.name)}),0)},saveOthersValue:(e,t,n=w)=>{if(n!==w&&R(n),null===t){const t={...P.others};delete t[e],$({...P,commitDirtyValue:!1,others:t,moveToNextPage:!1})}else $({...P,commitDirtyValue:!1,others:{...P.others,[e]:t},moveToNextPage:!1})},clearRadioSelection:e=>{R(e);const t=y[e].question;t.type_info?.pivot_question&&(S.current={question:t,answer:void 0}),delete P.formValues[t.name],delete P.others[t.name],"DATE_TIME"===t.type_info?.question_type&&p.dateQuestionErrors?.[t.name]&&u((e=>{const n={...e.dateQuestionErrors};return delete n[t.name],{...e,dateQuestionErrors:n}}));const n=(({renderedBlocks:e,answers:t})=>{const n=e.reduce(((e,n)=>(n?.question?.name&&void 0!==t.formValues[n.question.name]&&(e[n.question.name]=t.formValues[n.question.name]),e)),{});return{...t,formValues:n}})({renderedBlocks:y,answers:P}),r={...n,formValues:{...n.formValues},moveToNextPage:!1,commitDirtyValue:!1},l=mP({activeBlock:y[e],blocks:s,questions:o,answers:r,pages:m,renderedBlocks:y,contactData:i,surveyLayout:"standard",isEditResponse:B.current,branchSeparatePage:a});k((e=>{const t={...e};return l.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const d=[...y.slice(0,e+1),...l];q(a?ia(d,c):d),$(r)},onSubmitHandler:F,navigateToStart:()=>{B.current=!0,H(!1),k({}),R(0),a&&("number"==typeof y?.[0].orderOfSet?C(y?.[0].orderOfSet):C(0))},isValidQuestion:j,resetSurvey:()=>{H(!1),z((e=>e+1)),$({formValues:{},others:{},commitDirtyValue:!1,moveToNextPage:!1}),wP(localStorage)},moveToNextPage:e=>{const t={};e&&m.length>0&&y.forEach((e=>{f?.page_id!==e.page_id||a&&L!==e.orderOfSet||"MESSAGE"===e.question.type_info?.question_type||(t[e.question.name]=null)})),Dn(P.formValues??{})&&m.length>0&&y.forEach((e=>{f?.page_id!==e.page_id||a&&L!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(t[e.question.name]=null)}));const n=y.filter((e=>f?.page_id===e?.page_id)),o=n[n.length-1],i=y.findIndex((e=>e.name===o?.name));w!==i&&R(i),setTimeout((()=>{$((e=>({...e,formValues:{...e.formValues,...t},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},moveToNextSet:e=>{let t=0;if(y.some(((e,n)=>(t=n,!j(e,!0)))))return void R(t);const n={};y.forEach((t=>{f?.page_id!==t.page_id||a&&L!==t.orderOfSet||!e&&void 0!==P.formValues[t.question.name]||(n[t.question.name]=null)})),Dn(P.formValues??{})&&m.length>0&&y.forEach((e=>{f?.page_id!==e.page_id||a&&L!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(n[e.question.name]=null)}));const o=y.filter((e=>f?.page_id===e?.page_id&&(!a||L===e.orderOfSet))),i=o[o.length-1],r=y.findIndex((e=>e.name===i?.name));R(r),setTimeout((()=>{$((e=>({...e,formValues:{...e.formValues,...n},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},setIsSubmitting:v,isSubmitting:A,expanded:d,setExpanded:b,activeIndexOfSet:L,setActiveRenderedBlockIndex:R,isQuestionBgDark:V}},D5=["next","next-statement","next-page","next-set","skip","skip-statement","skip-page","skip-set","submit","navigation","set-navigation","clear-selection","message","consent","navigation-prev","navigation-next","navigation-page-prev","navigation-page-next","previous-matrix-statement","next-matrix-statement","navigation-set-prev","navigation-set-next"],I5=({translationVariables:e,canDisplayDisableButtonParams:t,navigateToNextSet:a,navigateToPreviousSet:o})=>n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:MP("navigation-set-prev",t),className:"navigation-button ss-navigation-button",onClick:o,title:e?.prev_question??"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:MP("navigation-set-next",t),title:e?.next_question||"Go to next question",onClick:a},n.createElement(I,{name:"arrow-next"}))),V5=({surveyServAssetUrl:e,thankYouQuestion:a,preview:o,placeholders:i,canResubmit:r,allowMultipleSubmission:c,navigateToStart:s,resetSurvey:l,isMobile:p,pivot:u,answers:d,questions:b,rangeToRender:M,translationVariables:z})=>{const{redirectUrl:m,redirectDelay:h,image_url:f,show_custom_button:O,show_review_links:A,show_social_links:v}=a?.type_info?.meta??{},[g,y]=t.useState(h??10),[q,W]=n.useState(!1);return t.useEffect((()=>{if(!o&&m){const e=setInterval((()=>y((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=m??""),0)))),1e3);return()=>{clearInterval(e),W(!1)}}return()=>{W(!1)}}),[]),n.createElement("div",{className:"thankyou-container"},n.createElement("div",{className:"question-container ss-question-container thankyou"},f&&n.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:f,alt:"thankyou_logo"}),n.createElement(n.Fragment,null,jn(a)),n.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:Un({questionText:a.text,placeholders:i,npsRating:Gn({theme:"nps",answers:d,questions:b})??"",npsRatingLabel:Yn({theme:"nps",answers:d,questions:b}),csatRating:Gn({theme:"csat",answers:d,questions:b})??"",csatRatingLabel:Yn({theme:"csat",answers:d,questions:b}),cesRating:Gn({theme:"ces",answers:d,questions:b})??"",cesRatingLabel:Yn({theme:"ces",answers:d,questions:b}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:o})}}),(r||c)&&n.createElement("div",{className:("wrap-up-actions "+(p?"mobile":"")).trim()},r&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),s()}},n.createElement(I,{name:"edit"}),z?.edit_response||"Edit your response"),c&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),l()}},n.createElement(I,{name:"reload"}),z?.another_response||"Submit another response")),m&&n.createElement(n.Fragment,null,n.createElement("div",{className:"redirection-text"},Qn(g,z?.redirect_msg),n.createElement("br",null)),n.createElement("a",{className:"link",href:m},m)),n.createElement(SP,{show_custom_button:O,show_review_links:A,show_social_links:v,surveyServAssetUrl:e})))},X5=e=>{const{blockIndex:t,renderedBlocks:a,activeIndexOfRenderedBlocks:o,translationVariables:i,saveFormValues:r,answers:c,clearRadioSelection:s,canDisplayDisableButtonParams:l,navigateToNextStatement:p,navigateToPreviousStatement:u,isSubmitting:d,isMobile:b}=e,M={};D5.forEach((e=>{M[e]=!!lP(e,l)}));const z=a[t??o],{question:m}=z,h=m?.type_info?.meta?.display_format;return M?.consent||M?.["previous-matrix-statement"]||M?.["next-matrix-statement"]||M?.["clear-selection"]||M?.message?n.createElement("div",{className:"question-footer ss-question-footer-container"},n.createElement("div",null,(M?.["previous-matrix-statement"]||M?.["next-matrix-statement"])&&"MATRIX_RATING_SCALE"===m?.type_info?.question_type&&n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:MP("previous-matrix-statement",l),className:"navigation-button ss-navigation-button",onClick:()=>{u(m.name)},title:i?.prev_question??"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:MP("next-matrix-statement",l),title:i?.next_question||"Go to next question",onClick:()=>{p(m.name)}},n.createElement(I,{name:"arrow-next"})))),n.createElement("div",{className:("action-buttons ss-action-buttons "+(M.consent?"question-consent-buttons ss-consent-action-buttons":"")).trim()},M?.["clear-selection"]&&n.createElement(G,{className:"sec-button",variant:"secondary",onClick:()=>s(t),disabled:d},e?.survey?.meta?.action_button?.clear_selection||i?.actionButtonText?.clear_selection||i?.clear_selection||"Clear selection"),b&&"MATRIX_RATING_SCALE"===m.type_info?.question_type&&"MULTIPLE_ANSWERS"===m?.type_info?.matrix_properties?.type&&M?.["next-matrix-statement"]&&n.createElement(G,{disabled:MP("next-matrix-statement",l),className:"primary-button",variant:"primary",onClick:()=>{p(m.name)}},e?.survey?.meta?.action_button?.next||i?.actionButtonText?.next||i?.next||"Next"),M?.consent&&"BUTTON"===h&&T.map((e=>n.createElement(G,{key:o+String(e.recordAs),onClick:()=>{r(z,e.recordAs,!1,t)},disabled:MP("consent",l),variant:_n(c.formValues?.[m.name])||c.formValues?.[m.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(c.formValues?.[m.name]===e.recordAs?"selected":"")).trim()},m?.type_info?.scale_properties?.labels?.values?.[e.id]??e.defaultValue))))):null},j5=e=>{const{pages:a,activePage:o,navigateToNextSet:i,navigateToPreviousSet:r,isInitialTransition:c,blocks:s,renderedBlocks:l,activeBlock:p,activeIndexOfBlocks:u,activeIndexOfRenderedBlocks:d,isSurveyCompleted:b,translationVariables:M,saveFormValues:z,saveOthersValue:m,clearRadioSelection:h,onSubmitHandler:f,answers:O,questions:A,resetSurvey:v,initialStatementHasAnswer:g,navigateToStart:y,activeIndexOfRenderedStatement:q,navigateToNextStatement:W,navigateToPreviousStatement:w,pivot:R,formQuestionErrors:L,dateQuestionErrors:C,textboxQuestionErrors:x,contactFormErrors:k,fileUploadErrors:S,setErrors:E,isSubmitting:T,setIsSubmitting:N,moveToNextSet:P,expanded:$,setExpanded:B,activeIndexOfSet:_,isValidQuestion:H,setActiveRenderedBlockIndex:D,isQuestionBgDark:I}=H5(e);aa("Standard",{...e,answers:O,activePage:o,activeBlock:p,renderedBlocks:l,activeIndexOfSet:_,activeIndexOfBlocks:u,activeIndexOfRenderedBlocks:d,activeIndexOfRenderedStatement:q});const V=!!e.survey.meta?.branch_separate_page,X=t.useRef(null),j=t.useRef({}),F=t.useRef(null),U=t.useMemo((()=>Fn(R?.question)),[R?.question]),Y=t.useMemo((()=>s.filter((({name:e},t,n)=>!eP({nextBlockName:e||"",blocks:n,questions:A}))).length),[s,A]),Z=Dn(O.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[K,Q]=t.useState(Z),J=l.filter((e=>o?.page_id===e?.page_id));if(t.useEffect((()=>{const t=Object.values(O.formValues).filter((e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&e.length>0||"object"==typeof e&&null!==e&&Object.keys(e).length>0)).length;e.getSurveyProgress?.({totalBlocks:Y,isSurveyCompleted:b,noOfAnswers:b||t>Y?Y:t})}),[Y,O,b]),t.useEffect((()=>{e.survey.theme&&Zn(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),t.useEffect((()=>{setTimeout((()=>{F.current&&Object.keys(O.formValues).length&&F.current?.scrollIntoView({inline:"start",block:"start",behavior:"smooth"})}),0),p&&e.onBlockChange?.(p,o)}),[o?.page_id]),!p||!p.question)return null;const{question:ee}=l[d],te={answers:O,blocks:s,blockIndex:0,activeIndexOfBlocks:u,initialStatementHasAnswer:g,activeIndexOfRenderedBlocks:d,activeIndexOfRenderedStatement:q,renderedBlocks:l,activePage:o,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:c,questions:A,pages:a,contactData:e.contactData,activeIndexOfSet:_,branchSeparatePage:V,isSubmitting:T,secBtnTxt:e.secBtnTxt},ne={};D5.forEach((e=>{ne[e]=!!lP(e,te)}));const ae=l[l.length-1];return n.createElement("div",{className:`freemium-survey-components ${In(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""} standard-survey-style`,id:"freemium-survey",ref:F},K&&e.survey.prompt_settings?n.createElement("div",{className:"questions ss-questions"},n.createElement("div",{className:"question-container ss-question-container"},n.createElement(xP,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&Q(!1)},placeholders:e.placeholders,isPreview:!!e.preview}))):n.createElement(n.Fragment,null,b?n.createElement(V5,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:ZN({pivotQn:R?.question,pivotQnAnswer:R?.answer,block:tP({activeBlock:ae,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:O,questions:A,activeIndexOfBlocks:s.findIndex((e=>e.name===ae.name)),renderedBlocks:l,contactData:e.contactData,surveyLayout:"standard",pages:a}),questions:A}),answers:O,preview:!!e.preview,placeholders:e.placeholders,pivot:{...R,question:R?.question||{name:""},answer:R?.answer},rangeToRender:U,canResubmit:e.canResubmit,isMobile:e.isMobile,allowMultipleSubmission:e.allowMultipleSubmission,translationVariables:M,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",(()=>{N(!1),y()})):(N(!1),y())},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",(()=>{N(!1),v()})):(N(!1),v())}}):n.createElement(n.Fragment,null,a.length>0&&o?.page_id&&n.createElement(LP,{expanded:$,id:o.page_id,setExpanded:B,activePage:o,translationVariables:M}),n.createElement("div",{className:("questions "+(e?.secBtnTxt?"sec-btn":"")).trim()},l.map(((t,i)=>{if(a.length>0&&o?.page_id!==t?.page_id||e.survey.meta?.branch_separate_page&&t.orderOfSet!==_)return null;const r=J.findIndex((e=>e.name===t.name)),b=iP({renderedBlocks:l,activeBlock:p,blocks:s,activeIndexOfBlocks:u,answers:O,questions:A,contactData:e.contactData,pages:a,surveyLayout:"standard"});return n.createElement(Kk.div,{id:t.question.name,key:t.question.name,ref:X,className:`question-container ss-question-container standard-card-${t.question.name}`,"data-test-question-name":p.question.name,initial:{opacity:0},animate:{opacity:1,x:0},exit:{opacity:0},transition:{duration:.2,delay:r?r/15:0},..."MULTI_SELECT"===p.question.type_info?.question_type&&b!==1/0&&-1!==b&&void 0!==O.formValues?.[t.question.name]&&j.current[t.question.name]!==O.formValues?.[t.question.name]?{onMouseLeave:()=>{z(t,O.formValues?.[t.question.name],!0,i),j.current[t.question.name]=O.formValues?.[t.question.name]}}:{}},n.createElement("div",{className:`question-text ss-question-text ${t.required?"required":""} ${0===i?"nps":""}`.trim(),dangerouslySetInnerHTML:{__html:Un({questionText:t.question.text,placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:O,questions:A})??"",npsRatingLabel:Yn({theme:"nps",answers:O,questions:A}),csatRating:Gn({theme:"csat",answers:O,questions:A})??"",csatRatingLabel:Yn({theme:"csat",answers:O,questions:A}),cesRating:Gn({theme:"ces",answers:O,questions:A})??"",cesRatingLabel:Yn({theme:"ces",answers:O,questions:A}),preference:R?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${i}`,role:"heading","aria-level":1}),n.createElement(N5,{surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:S,setErrors:E,onFileUpload:e.onFileUpload,block:t,preview:!!e.preview,surveyLanguage:e.survey.language,language:e.language||"en",question:t.question,surveyStyle:e.surveyStyle,isFinalQn:YN({blocks:s,activeIndexOfBlocks:u,renderedBlocks:l,activeIndexOfRenderedBlocks:d,questions:A}),formValues:O.formValues,othersMeta:O.others,isMobile:!!e.isMobile,autoFocusDelay:20,activeIndexOfRenderedStatement:q,saveOthersValue:(e,t)=>{m(e,t,i)},onChangeHandler:(e,n)=>{const a=t.question.type_info?.question_type;z(t,e,!!a&&["RANGE","DROPDOWN","BOOLEAN"].includes(a)||n,i)},initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,formQuestionErrors:L,dateQuestionErrors:C,textboxQuestionErrors:x,contactFormErrors:k,translationVariables:M,isQuestionBgDark:I}),"MESSAGE"!==t.question.type_info?.question_type&&n.createElement(X5,{canDisplayDisableButtonParams:{...te,blockIndex:i},language:e.language||"en",isWidget:!1,surveyStyle:e.surveyStyle,answers:O,renderedBlocks:l,blocks:s,pages:a,survey:e.survey,blockIndex:i,isInitialTransition:c,activeIndexOfRenderedBlocks:d,initialStatementHasAnswer:g,navigateToNextStatement:W,navigateToPreviousStatement:w,activeIndexOfRenderedStatement:q,activeIndexOfBlocks:u,saveFormValues:z,isMobile:!!e.isMobile,clearRadioSelection:h,initialPivotAnswer:e.initialPivotAnswer,translationVariables:M,formQuestionErrors:L,dateQuestionErrors:C,textboxQuestionErrors:x,contactFormErrors:k,fileUploadErrors:S,questions:A,isSubmitting:T}))}))),n.createElement("div",{className:"page-actions"},n.createElement("div",null,ne["set-navigation"]&&n.createElement(I5,{answers:O,canDisplayDisableButtonParams:te,activeIndexOfBlocks:u,pages:a,activeIndexOfRenderedBlocks:d,renderedBlocks:l,initialStatementHasAnswer:g,blocks:s,activeIndexOfRenderedStatement:q,translationVariables:M,navigateToPreviousSet:r,navigateToNextSet:i})),n.createElement("div",{className:"page-action-buttons ss-page-action-buttons"},e?.secBtnTxt&&n.createElement(G,{variant:"secondary",onClick:()=>{e?.handleSecondaryAction?.({answers:O.formValues,survey:e.survey})},"aria-label":"secondary-action",disabled:T},e.secBtnTxt),ne["skip-set"]&&n.createElement(G,{variant:"secondary",onClick:()=>{P(!0)},"aria-label":"skip set",disabled:T},e?.survey?.meta?.action_button?.skip||M?.actionButtonText?.skip||M?.skip||"Skip"),ne?.["next-set"]&&n.createElement(G,{onClick:()=>{P()},disabled:!!MP("next-set",te),className:"next-set"},e?.survey?.meta?.action_button?.next||M?.actionButtonText?.next||M?.next||"Next"),ne.submit&&!ne?.["next-set"]&&n.createElement(G,{disabled:!!MP("submit",te),onClick:()=>{let e=0;l.some(((t,n)=>(e=n,!H(t,!0))))?D(e):Dn(C?.[ee.name])&&Dn(L?.[ee.name])&&Dn(x?.[ee.name])&&Dn(S?.[ee.name])&&Dn(k?.[ee.name])&&f("COMPLETE")}},e?.survey?.meta?.action_button?.submit||M?.actionButtonText?.submit||M?.submit_survey||"Submit"))))),!e.secBtnTxt&&!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)&&n.createElement(pa,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??kP}))},F5=e=>n.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},n.createElement("g",{clipPath:"url(#clip0_8207_70478)"},n.createElement("rect",{width:"10",height:"10",fill:"white",fillOpacity:"0.01"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.62499 3.19375C8.62499 3.4 8.79374 3.56875 8.99999 3.56875C9.20624 3.56875 9.37499 3.4 9.37499 3.19375V1C9.37499 0.79375 9.20624 0.625 8.99999 0.625H6.80624C6.59999 0.625 6.43124 0.79375 6.43124 1C6.43124 1.20625 6.59999 1.375 6.80624 1.375H8.09377L5.66876 3.80001C5.52501 3.95001 5.52501 4.18751 5.66876 4.33126C5.73751 4.40626 5.83751 4.44376 5.93126 4.44376V4.45001C6.02501 4.45001 6.11876 4.41251 6.19376 4.33751L8.62499 1.90628V3.19375ZM1 9.37501H1.00738H3.19375C3.4 9.37501 3.56875 9.20626 3.56875 9.00001C3.56875 8.79376 3.4 8.62501 3.19375 8.62501H1.90626L4.3375 6.19376C4.48125 6.04376 4.48125 5.80626 4.3375 5.66251C4.1875 5.51876 3.95 5.51876 3.80625 5.66251L1.375 8.09376V6.80626C1.375 6.60001 1.20625 6.43126 1 6.43126C0.79375 6.43126 0.625 6.60001 0.625 6.80626V9.00001C0.625 9.20626 0.79375 9.37501 1 9.37501Z",fill:"#264966"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_8207_70478"},n.createElement("rect",{width:"10",height:"10",fill:"white"})))),U5=e=>n.createElement("svg",{width:"8",height:"2",viewBox:"0 0 8 2",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},n.createElement("path",{d:"M7.3 1.4H0.7C0.313401 1.4 0 1.0866 0 0.699999C0 0.3134 0.313401 0 0.7 0H7.3C7.6866 0 8 0.3134 8 0.699999C8 1.0866 7.6866 1.4 7.3 1.4Z",fill:"#264966"})),G5=({surveyServAssetUrl:e,thankYouQuestion:a,placeholders:o,canResubmit:i,navigateToStart:r,resetSurvey:c,widgetStyle:s,allowMultipleSubmission:l,pivot:p,rangeToRender:u,answers:d,questions:b,translationVariables:M,isQuestionBgDark:z})=>{const{show_custom_button:m,show_review_links:h,show_social_links:f,image_url:O}=a?.type_info?.meta??{},[A,v]=n.useState(!1);return t.useEffect((()=>()=>{v(!1)}),[]),n.createElement("div",{className:"question-container ss-question-container thankyou"},O&&n.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:O,alt:"thankyou_logo"}),n.createElement("div",{className:O?"heading":"heading thankyou-image"},n.createElement(n.Fragment,null,jn(a))),n.createElement("div",{className:O?"text ss-thankyou-message":"text ss-thankyou-message thankyou-image",dangerouslySetInnerHTML:{__html:Un({questionText:a.text,placeholders:o,npsRating:Gn({theme:"nps",answers:d,questions:b})??"",npsRatingLabel:Yn({theme:"nps",answers:d,questions:b}),csatRating:Gn({theme:"csat",answers:d,questions:b})??"",csatRatingLabel:Yn({theme:"csat",answers:d,questions:b}),cesRating:Gn({theme:"ces",answers:d,questions:b})??"",cesRatingLabel:Yn({theme:"ces",answers:d,questions:b}),preference:p?.question.type_info?.scale_properties?.labels?.preference})}}),(i||l)&&n.createElement("div",{className:`wrap-up-actions ${O?"":"thank-you-image"} ${"compact"===s?"mobile":""}`.trim()},i&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),r()}},n.createElement(I,{name:"edit"}),M?.edit_response||"Edit your response"),l&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),c()}},n.createElement(I,{name:"reload"}),M?.another_response||"Submit another response")),n.createElement(SP,{show_custom_button:m,show_review_links:h,show_social_links:f,surveyServAssetUrl:e}))},Y5=({translationVariables:e,activeIndexOfRenderedStatement:t,navigateToPreviousBlock:a,navigateToNextBlock:o,question:i,canDisplayDisableButtonParams:r,animationInProgress:c,setAnimationInProgress:s})=>n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:c||!!MP("navigation-prev",r),className:"navigation-button ss-navigation-button",onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),q),a()},title:i.name&&(t?.[i.name]??0)>0?e?.prev_statement||"go to previous statement":e?.prev_question||"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||!!MP("navigation-next",r),onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),q),o()},title:e?.next_question||"go to next question"},n.createElement(I,{name:"arrow-next"}))),Z5=e=>{const{widgetStyle:a,answers:o,initialStatementHasAnswer:i,renderedBlocks:r,blocks:c,activeIndexOfBlocks:s,navigateToNextStatement:l,activeIndexOfRenderedBlocks:p,translationVariables:u,saveFormValues:d,activeIndexOfRenderedStatement:b={},onSubmitHandler:M,skipBlock:z,skipStatement:m,navigateToNextBlock:h,navigateToPreviousBlock:f,formQuestionErrors:O,dateQuestionErrors:A,textboxQuestionErrors:v,fileUploadErrors:g,contactFormErrors:y,canDisplayDisableButtonParams:W,pages:w,setFooterElementRef:R,isSubmitting:L}=e,[C,x]=t.useState(!1),{question:k}=r[p],S=k?.type_info?.question_type,E={...W,isSubmitting:L},N=(e=!1)=>{const t=e?[...T].reverse():[...T];return lP("consent",E)&&"BUTTON"===$&&t.map((e=>n.createElement(G,{key:p+String(e.id),onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),d(r[p],e.recordAs,!0)},disabled:C||MP("consent",E),variant:_n(o.formValues?.[k.name])||o.formValues?.[k.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(o.formValues?.[k.name]===e.recordAs?"selected":"")).trim()},k?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue)))},P="compact"===a&&(lP("navigation",E)&&lP("skip",E)||"CONSENT"===S||"MESSAGE"===S),$=k?.type_info?.meta?.display_format;return n.createElement(n.Fragment,null,(lP("navigation",E)||lP("next",E)||lP("next-statement",E)||lP("consent",E)||lP("submit",E)||lP("skip",E)||lP("skip-statement",E)||lP("message",E))&&n.createElement("div",{className:"question-footer ss-question-footer-container",ref:e=>e?R?.(e):null},P?n.createElement("div",{className:"compact-footer-container"},lP("next",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),d(r[p],"CHECKBOX"===k?.type_info?.meta?.display_format&&"CONSENT"===k?.type_info?.question_type?o.formValues[k.name]??!1:o.formValues[k.name],!0)},disabled:C||!!MP("next",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.next||"Next"),lP("message",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},disabled:C||MP("message",E),className:"message-button ss-action-message-button"},k?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"),lP("submit",E)&&n.createElement("div",{className:"submit ss-action-submit-button"},n.createElement(G,{disabled:C||!!MP("submit",E),onClick:()=>{Dn(A?.[k.name])&&Dn(O?.[k.name])&&Dn(v?.[k.name])&&Dn(g?.[k.name])&&Dn(y?.[k.name])&&(x(!0),setTimeout((()=>{x(!1)}),q),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||u?.actionButtonText?.submit||u?.submit_survey||"Submit")),lP("next-statement",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),l?.(k.name)},disabled:C||!!MP("next-statement",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.actionButtonText?.next||u?.next||"Next"),N(),n.createElement("div",{className:"compact-footer-layout"},n.createElement(Y5,{animationInProgress:C,setAnimationInProgress:x,answers:o,canDisplayDisableButtonParams:E,pages:w,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:p,renderedBlocks:r,initialStatementHasAnswer:i,blocks:c,activeIndexOfRenderedStatement:b,question:k,translationVariables:u,navigateToNextBlock:h,navigateToPreviousBlock:f}),"MESSAGE"!==S&&!c[s].required&&n.createElement(G,{className:"skip-button ss-action-skip-button",onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},variant:"secondary","aria-label":"skip question",disabled:C},e?.survey?.meta?.action_button?.skip||u?.actionButtonText?.skip||u?.skip||"Skip"))):n.createElement(n.Fragment,null,lP("navigation",E)?n.createElement(Y5,{animationInProgress:C,setAnimationInProgress:x,answers:o,pages:w,canDisplayDisableButtonParams:E,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:p,activeIndexOfRenderedStatement:b,renderedBlocks:r,blocks:c,question:k,initialStatementHasAnswer:i,translationVariables:u,navigateToNextBlock:h,navigateToPreviousBlock:f}):n.createElement("div",null),n.createElement("div",{className:"action-buttons ss-action-buttons"},lP("skip",E)&&n.createElement(G,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},"aria-label":"skip question",disabled:C},e?.survey?.meta?.action_button?.skip||u?.actionButtonText?.skip||u?.skip||"Skip"),lP("skip-statement",E)&&n.createElement(G,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),m()},"aria-label":"skip statement",disabled:C},e?.survey?.meta?.action_button?.skip||u?.actionButtonText?.skip||u?.skip||"Skip"),N(!0),lP("next",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),d(r[p],"CHECKBOX"===k?.type_info?.meta?.display_format&&"CONSENT"===k?.type_info?.question_type?o.formValues[k.name]??!1:o.formValues[k.name],!0)},disabled:C||!!MP("next",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.actionButtonText?.next||u?.next||"Next"),lP("next-statement",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),l?.(k.name)},disabled:C||!!MP("next-statement",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.actionButtonText?.next||u?.next||"Next"),lP("submit",E)&&n.createElement("div",{className:"submit ss-action-submit-button"},n.createElement(G,{disabled:C||!!MP("submit",E),onClick:()=>{Dn(A?.[k.name])&&Dn(O?.[k.name])&&Dn(v?.[k.name])&&Dn(g?.[k.name])&&Dn(y?.[k.name])&&(x(!0),setTimeout((()=>{x(!1)}),q),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||u?.actionButtonText?.submit||u?.submit_survey||"Submit")),lP("message",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},disabled:C||MP("message",E),className:"next-button ss-action-next-button"},k?.type_info?.scale_properties?.labels?.values?.[0]||"Begin")))))},K5=e=>{const{pages:a,activePage:o,blocks:i,renderedBlocks:r,activeBlock:c,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:l,isSurveyCompleted:p,isReverseAnimation:u,translationVariables:d,saveFormValues:b,saveOthersValue:M,skipBlock:z,skipStatement:m,initialStatementHasAnswer:h,onSubmitHandler:f,navigateToNextBlock:O,activeIndexOfRenderedStatement:A,navigateToNextStatement:v,navigateToPreviousStatement:g,navigateToPreviousBlock:y,answers:q,questions:W,resetSurvey:w,navigateToStart:L,pivot:C,formQuestionErrors:x,dateQuestionErrors:k,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:T,setErrors:N,expanded:P,setExpanded:$,isQuestionBgDark:B,isSubmitting:_}=RP({...e,isWidget:!0});aa("Widget",{...e,renderedBlocks:r,activeIndexOfBlocks:s,answers:q,activeIndexOfRenderedBlocks:l,activeBlock:c});const[H,D]=t.useState(null),[I,V]=t.useState(null),[X,j]=t.useState(null),[F,U]=t.useState(0),G=n.useMemo((()=>Fn(C?.question)),[C?.question]),Y=Dn(q.formValues)&&e.survey.prompt_settings?.is_enabled,[Z,K]=t.useState(Y),Q=t.useRef(Y?-1:l),J=()=>{if(null===H||!H||"undefined"==typeof window||"undefined"==typeof document)return;const t=Math.max(document?.documentElement.clientHeight||0,window.innerHeight||0)-(I?.scrollHeight??0)-(X?.scrollHeight??0)-164,n=Math.min(H?.scrollHeight,Math.min(R[e.widgetStyle],t));F!==n&&U(n)};t.useEffect((()=>{setTimeout((()=>{J()}),0)}),[Z,p,H,A[c?.question?.name],l,X,P,x,Object.keys(k),Object.keys(S),Object.keys(E),Object.keys(T)]),t.useEffect((()=>{"MATRIX_RATING_SCALE"===c?.question?.type_info?.question_type&&setTimeout((()=>{J()}),0)}),[A[c?.question?.name]]),t.useEffect((()=>{e.loadAsNewSurvey&&e.handleAction&&e.handleAction("RE_SUBMIT",w)}),[]),t.useEffect((()=>{e.setCurrentSurveyState?.({question:r[l]?.question,npsScore:C?.answer})}),[l,C?.answer]),t.useEffect((()=>{l!==Q.current&&(Q.current=-1)}),[l]);const ee={answers:q,blocks:i,blockIndex:l,activeIndexOfBlocks:s,initialStatementHasAnswer:h,activeIndexOfRenderedBlocks:l,activeIndexOfRenderedStatement:A,renderedBlocks:r,isMobile:!!e.isMobile,surveyStyle:"card",isWidget:!0,questions:W,pages:a,contactData:e.contactData,activeIndexOfSet:0,branchSeparatePage:!1};if(!c||!c?.question)return null;const te=p?i.length:s+(p?1:0),ne=p?100:(te>0?100/i.length:0)*te;return n.createElement("div",{className:`freemium-survey-components widget-survey-components\n ${e.widgetStyle}-style`.trim(),id:"freemium-survey"},p||Z||!e.survey.meta?.progress_bar?null:n.createElement("div",{className:"widget-progressbar"},n.createElement("div",{className:"progress-completion"},ne.toFixed(),"%"),n.createElement(lq,{totalSteps:i.length,completedSteps:s+(p?1:0),isWidget:!0})),!Z&&!e.minimized&&a.length>0&&o?.page_id&&!p&&n.createElement(LP,{ref:e=>e?j(e):null,expanded:P,id:o.page_id,setExpanded:$,activePage:o,translationVariables:d}),n.createElement("div",{className:"questions ss-questions",style:{...Y&&Z||Q.current===l?{transition:"none"}:{}}},n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{id:`${c.question.name}`,className:`question-container ss-question-container ${p?"thankyou":""} ${Z?"prompt-container":""}`.trim(),"data-test-question-name":c.question.name,key:`${c.question.name}`,initial:{opacity:0,x:Vn(e.language,u)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(e.language,u)},transition:{duration:.2}},n.createElement("div",{className:"animation-container",style:{height:e.minimized?0:F>0&&!P?`${F}px`:"auto"}},n.createElement("div",{className:"scroll-container",ref:e=>e?D(e):null},Z&&e.survey.prompt_settings?n.createElement(xP,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt(t),1===t&&K(!1)},placeholders:e.placeholders}):n.createElement(n.Fragment,null,p?n.createElement(G5,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:ZN({pivotQn:C?.question,pivotQnAnswer:C?.answer,block:tP({activeBlock:c,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:q,questions:W,activeIndexOfBlocks:s,renderedBlocks:r,contactData:e.contactData,surveyLayout:"card",pages:a}),questions:W}),placeholders:e.placeholders,canResubmit:e.canResubmit,widgetStyle:e.widgetStyle,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",L):L()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",w):w()},allowMultipleSubmission:e.allowMultipleSubmission,pivot:C,rangeToRender:G,translationVariables:d,isQuestionBgDark:B,answers:q}):n.createElement(n.Fragment,null,n.createElement("div",{className:`question-text ss-question-text ${!c.question.type_info?.pivot_question&&c.required?"required":""} ${"RANGE"===c?.question?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:Un({questionText:c?.question.text,placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:q,questions:W})??"",npsRatingLabel:Yn({theme:"nps",answers:q,questions:W}),csatRating:Gn({theme:"csat",answers:q,questions:W})??"",csatRatingLabel:Yn({theme:"csat",answers:q,questions:W}),cesRating:Gn({theme:"ces",answers:q,questions:W})??"",cesRatingLabel:Yn({theme:"ces",answers:q,questions:W}),preference:C?.question.type_info?.scale_properties?.labels?.preference})},"aria-label":`question-${l}`,role:"heading","aria-level":1}),"MESSAGE"!==c.question.type_info?.question_type&&n.createElement("div",{className:"question-wrapper",onTransitionEndCapture:e=>e.stopPropagation()},n.createElement(N5,{setFocus:!0,surveyStyle:"card",isReverseAnimation:u,language:e?.language||"en",surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:E,setErrors:N,onFileUpload:e.onFileUpload,surveyLanguage:e.survey.language,block:c,question:c.question,isFinalQn:YN({blocks:i,activeIndexOfBlocks:s,renderedBlocks:r,activeIndexOfRenderedBlocks:l,questions:W}),formValues:q.formValues,widgetStyle:e.widgetStyle,isMobile:!1,othersMeta:q.others,autoFocusDelay:0,activeIndexOfRenderedStatement:A,isWidget:!0,saveOthersValue:(e,t)=>{M(e,t),setTimeout((()=>{J()}),0)},onChangeHandler:e=>{setTimeout((()=>{J()}),0),b(c,e)},formQuestionErrors:x,dateQuestionErrors:k,textboxQuestionErrors:S,contactFormErrors:T,translationVariables:d,isQuestionBgDark:B})))))))),!p&&!Z&&n.createElement(Z5,{pages:a,isWidget:!0,language:e.language||"en",widgetStyle:e.widgetStyle,setFooterElementRef:V,surveyStyle:"standard",answers:q,survey:e.survey,canDisplayDisableButtonParams:{...ee,blockIndex:l,activeIndexOfRenderedBlocks:l},isMobile:!1,renderedBlocks:r,initialStatementHasAnswer:h,activeIndexOfRenderedStatement:A,blocks:i,activeIndexOfRenderedBlocks:l,navigateToNextStatement:v,navigateToPreviousStatement:g,activeIndexOfBlocks:s,translationVariables:d,saveFormValues:b,skipBlock:z,skipStatement:m,onSubmitHandler:f,navigateToPreviousBlock:y,navigateToNextBlock:O,formQuestionErrors:x,dateQuestionErrors:k,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:T,questions:W,isSubmitting:_})))},Q5={default:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},compact:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},cozy:{width:582,11:12,10:12,9:12,8:12,7:18,6:22,5:28,4:32,3:36}},J5=({language:e="en",survey:a,preview:o,placeholders:i,contactData:r,overRideComponent:c,onSubmit:s,onDismiss:l,onClose:p,isMobile:u,surveyType:d,unsubscribeUrl:b,isSurveyCompleted:M,children:z=null,answerStatus:m,loadSurveyCollapsed:h=!1,handleAction:f,answers:O,onAnsweringPrompt:A,allowMultipleSubmission:v,loadAsNewSurvey:g,canResubmit:y,translationVariables:q,surveyServAssetUrl:W,footerProps:w,surveyPoweredBy:R,onFileUpload:C,isQuestionBgDark:x,hideMinimize:k,collector:S})=>{const E=a.question_details?.questions||[],[T,N]=t.useState(),[P,$]=t.useState(!1),[B,_]=t.useState(h),[H,D]=t.useState(!1),{theme:I}=a,[V,X]=t.useState(null),j=n.useMemo((()=>((e=[])=>{const t=e.sort(((e,t)=>Number(e.order)-Number(t.order)));return t.find((e=>!e.is_deleted))??t[0]})(a.blocks||[])),[a.blocks]),F=j?.question_name?j?.question_name??"":j?.category?.[0].question_name??"",U=E.find((e=>e.name===F)),Y=()=>{$(!0),setTimeout((()=>{p?.()}),300)},Z=t.useRef(null);function K(e){const t=document?.getElementById("freshworks-survey-widget");if(t&&e?.channel_info?.web_in_app_channel_info?.backdrop_enabled)try{const a=(n=e?.channel_info?.web_in_app_channel_info?.backdrop_color,Object.entries({...L,backgroundColor:n}).map((([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${t}`)).join("; "));t.style.cssText=a}catch(e){console.error("Error applying styles to widgetElement:",e)}var n}return n.useEffect((()=>{const e=document?.documentElement;if(!e||!a.question_details?.questions)return;let t=0;(a.question_details.questions??[]).forEach((e=>{const n=Fn(e);"RANGE"===e.type_info?.question_type&&n.length>t&&(t=n.length)}));const n=42*t+Q5[d][t]*(t-1);e.style.setProperty("--fsc-max-range-question-width",Math.min(Q5[d].width,n)+"px")}),[a,d]),n.useEffect((()=>{I&&(Zn(I,W??""),D(oa(I.palette?.footer_background??I.palette?.survey_background??kP)))}),[I,W]),n.useEffect((()=>{K(S)}),[S]),n.createElement("div",{id:"freshworks-survey-widget"},a.theme?.advanced?.additional_css&&n.createElement("style",null,a.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),n.createElement("div",{className:`surveyserv-widget-container ${In(e||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${u?"widget-mobile":""} ${d}-container-style ${B?"minimized":""}`,id:"surveyserv-widget-container"},n.createElement("header",{id:"surveyserv-widget-header",className:("widget-header "+(B?"minimized":"")).trim()},B?n.createElement("span",{className:"header-content minimized",dangerouslySetInnerHTML:{__html:Un({questionText:(!T&&a.prompt_settings?.is_enabled?a.prompt_settings.text:V?.question?.text)??ta(U?.text||""),placeholders:{...i,"{{nps.rating}}":String(V?.npsScore??"")}})}}):n.createElement("div",null),n.createElement("div",{className:"icons"},!M&&!k&&n.createElement(G,{onClick:()=>{_((e=>!e))},variant:"secondary",className:"icon minimize-btn",title:B?q?.maximize||"Maximize widget":q?.minimize||"Minimize widget"},B?n.createElement(F5,null):n.createElement(U5,null)),n.createElement(G,{ref:Z,onClick:()=>{M?Y():l()},variant:"secondary",title:q?.dismiss||"Dismiss widget",className:"icon minimize-btn"},n.createElement(IN,null)))),z,n.createElement("main",{className:("widget-main "+(B?"minimized":"")).trim()},c?n.createElement(n.Fragment,null,c):n.createElement(K5,{surveyServAssetUrl:W,answers:O,minimized:B,widgetStyle:d,answerStatus:m,language:e||"en",survey:a,placeholders:i,isMobile:!!u,contactData:r,onFileUpload:C,allowMultipleSubmission:v,loadAsNewSurvey:g,canResubmit:y,onSubmit:s,setCurrentSurveyState:X,widgetHeaderQuerySelector:B?void 0:"#surveyserv-widget-header",onAnsweringPrompt:e=>{A?.(e),N(e),0==e&&Dn(a.prompt_settings?.declined_message)&&Y()},handleAction:f,translationVariables:q})),(R||b||!!w?.showFWBranding)&&n.createElement("footer",{className:`widget-footer ${B?"minimized":""} survey-footer-${H?"dark":"light"}`.trim()},n.createElement("div",null,b&&!B&&n.createElement("a",{href:b,target:"_blank",rel:"noopener noreferrer",onClick:e=>{o&&e.preventDefault(),e.stopPropagation(),Y()}},q?.unsubscribe||"Unsubscribe")),!!w?.showFWBranding&&n.createElement("div",{className:"footer-text"},n.createElement(la,{surveyPoweredBy:R,isDark:H})))))},e4=e=>{const{survey:t,answers:a}=XN(e.survey,e.answers);return aa("WebInAppContainer",{...e,survey:t,answers:a}),n.createElement(J5,{...e,survey:t,answers:a})},t4=e=>{const[t,a]=n.useState(!1),[o,i]=n.useState(!1);return n.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&(a(window.matchMedia("(max-width: 550px)").matches),"cozy"===e.surveyType&&i(window.matchMedia("(max-width: 1080px)").matches))}),[]),aa("WebInAppSurvey",{...e,isMobile:t,isDefault:o}),e.isLoading?n.createElement("div",{id:"freshworks-survey-widget"},n.createElement("div",{className:`surveyserv-widget-container ${In(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${t?"widget-mobile":""} ${e.surveyType}-container-style`,id:"surveyserv-widget-container"},n.createElement("header",{id:"surveyserv-widget-header",className:"widget-header".trim()},n.createElement("div",null),n.createElement(G,{onClick:()=>{setTimeout((()=>{e?.onClose?.()}),300)},variant:"secondary",title:e.translationVariables?.dismiss||"Dismiss widget",className:"icon minimize-btn"},n.createElement(IN,null))),n.createElement("main",{className:"widget-main widget-loader".trim()},e.overRideComponent??n.createElement(ua,null)))):n.createElement(n.Fragment,null,e?.survey?.id?n.createElement(e4,{...e,isMobile:t,surveyType:t?"compact":o?"default":e.surveyType}):null)},n4=e=>{const{question:t,surveyStyle:a,language:o,onAnswer:i,translationVariables:r,surveyServAssetUrl:c,block:s,theme:l}=e,[p,u]=n.useState(!!e.isMobile);return n.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&u(window.matchMedia("(max-width: 550px)").matches||!!e.isMobile)}),[]),n.useEffect((()=>{l&&Zn(l,c??"")}),[l,c]),aa("QuestionPreview",{...e,isMobile:p}),n.createElement(n.Fragment,null,l?.advanced?.additional_css&&n.createElement("style",null,l?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),n.createElement("div",{className:`freemium-survey-components question-preview ${a}-survey-style ${In(o||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${p?"mobile-preview":""}`.trim(),id:"freemium-survey"},n.createElement("div",{className:"question-holder"},n.createElement("div",{className:"questions ss-questions"},n.createElement(Kk.div,{id:`${t.name}`,className:"question-container ss-question-container","data-test-question-name":t.name,key:`${t.name}`,initial:{opacity:0,x:Vn(o,!1)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(o,!1)},transition:{duration:.2}},n.createElement("div",{className:`question-text ss-question-text ${s.required?"required":""} ${"RANGE"===t?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:Un({questionText:t.text,placeholders:{},npsRating:"",npsRatingLabel:"",csatRating:"",csatRatingLabel:"",cesRating:"",cesRatingLabel:"",preference:t.type_info?.scale_properties?.labels?.preference})},"aria-label":"question-0",role:"heading","aria-level":1}),n.createElement(N5,{surveyStyle:a,language:e?.language||"en",surveyServAssetUrl:c,surveyLanguage:e?.language,block:s,question:t,formValues:{},isMobile:p,othersMeta:{},saveOthersValue:(e,t)=>{},onChangeHandler:e=>{i?.({value:e,block:s,question:t})},translationVariables:r??{},activeIndexOfRenderedStatement:{},autoFocusDelay:0,contactFormErrors:{},dateQuestionErrors:{},fileUploadErrors:{},formQuestionErrors:{},textboxQuestionErrors:{},setErrors:()=>{}}))))))},{entries:a4,setPrototypeOf:o4,isFrozen:i4,getPrototypeOf:r4,getOwnPropertyDescriptor:c4}=Object;let{freeze:s4,seal:l4,create:p4}=Object,{apply:u4,construct:d4}="undefined"!=typeof Reflect&&Reflect;s4||(s4=function(e){return e}),l4||(l4=function(e){return e}),u4||(u4=function(e,t,n){return e.apply(t,n)}),d4||(d4=function(e,t){return new e(...t)});const b4=L4(Array.prototype.forEach),M4=L4(Array.prototype.lastIndexOf),z4=L4(Array.prototype.pop),m4=L4(Array.prototype.push),h4=L4(Array.prototype.splice),f4=L4(String.prototype.toLowerCase),O4=L4(String.prototype.toString),A4=L4(String.prototype.match),v4=L4(String.prototype.replace),g4=L4(String.prototype.indexOf),y4=L4(String.prototype.trim),q4=L4(Object.prototype.hasOwnProperty),W4=L4(RegExp.prototype.test),w4=(R4=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d4(R4,t)});var R4;function L4(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return u4(e,t,a)}}function C4(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f4;o4&&o4(e,null);let a=t.length;for(;a--;){let o=t[a];if("string"==typeof o){const e=n(o);e!==o&&(i4(t)||(t[a]=e),o=e)}e[o]=!0}return e}function x4(e){for(let t=0;t<e.length;t++){q4(e,t)||(e[t]=null)}return e}function k4(e){const t=p4(null);for(const[n,a]of a4(e)){q4(e,n)&&(Array.isArray(a)?t[n]=x4(a):a&&"object"==typeof a&&a.constructor===Object?t[n]=k4(a):t[n]=a)}return t}function S4(e,t){for(;null!==e;){const n=c4(e,t);if(n){if(n.get)return L4(n.get);if("function"==typeof n.value)return L4(n.value)}e=r4(e)}return function(){return null}}const E4=s4(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T4=s4(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N4=s4(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P4=s4(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),$4=s4(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),B4=s4(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_4=s4(["#text"]),H4=s4(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),D4=s4(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),I4=s4(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),V4=s4(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X4=l4(/\{\{[\w\W]*|[\w\W]*\}\}/gm),j4=l4(/<%[\w\W]*|[\w\W]*%>/gm),F4=l4(/\$\{[\w\W]*/gm),U4=l4(/^data-[\-\w.\u00B7-\uFFFF]+$/),G4=l4(/^aria-[\-\w]+$/),Y4=l4(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Z4=l4(/^(?:\w+script|data):/i),K4=l4(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Q4=l4(/^html$/i),J4=l4(/^[a-z][.\w]*(-[.\w]+)+$/i);var e6=Object.freeze({__proto__:null,ARIA_ATTR:G4,ATTR_WHITESPACE:K4,CUSTOM_ELEMENT:J4,DATA_ATTR:U4,DOCTYPE_NAME:Q4,ERB_EXPR:j4,IS_ALLOWED_URI:Y4,IS_SCRIPT_OR_DATA:Z4,MUSTACHE_EXPR:X4,TMPLIT_EXPR:F4});const t6=1,n6=3,a6=7,o6=8,i6=9,r6=function(){return"undefined"==typeof window?null:window};var c6=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r6();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==i6||!t.Element)return n.isSupported=!1,n;let{document:a}=t;const o=a,i=o.currentScript,{DocumentFragment:r,HTMLTemplateElement:c,Node:s,Element:l,NodeFilter:p,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:b,trustedTypes:M}=t,z=l.prototype,m=S4(z,"cloneNode"),h=S4(z,"remove"),f=S4(z,"nextSibling"),O=S4(z,"childNodes"),A=S4(z,"parentNode");if("function"==typeof c){const e=a.createElement("template");e.content&&e.content.ownerDocument&&(a=e.content.ownerDocument)}let v,g="";const{implementation:y,createNodeIterator:q,createDocumentFragment:W,getElementsByTagName:w}=a,{importNode:R}=o;let L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a4&&"function"==typeof A&&y&&void 0!==y.createHTMLDocument;const{MUSTACHE_EXPR:C,ERB_EXPR:x,TMPLIT_EXPR:k,DATA_ATTR:S,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:P}=e6;let{IS_ALLOWED_URI:$}=e6,B=null;const _=C4({},[...E4,...T4,...N4,...$4,..._4]);let H=null;const D=C4({},[...H4,...D4,...I4,...V4]);let I=Object.seal(p4(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,X=null,j=!0,F=!0,U=!1,G=!0,Y=!1,Z=!0,K=!1,Q=!1,J=!1,ee=!1,te=!1,ne=!1,ae=!0,oe=!1,ie=!0,re=!1,ce={},se=null;const le=C4({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pe=null;const ue=C4({},["audio","video","img","source","image","track"]);let de=null;const be=C4({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Me="http://www.w3.org/1998/Math/MathML",ze="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let he=me,fe=!1,Oe=null;const Ae=C4({},[Me,ze,me],O4);let ve=C4({},["mi","mo","mn","ms","mtext"]),ge=C4({},["annotation-xml"]);const ye=C4({},["title","style","font","a","script"]);let qe=null;const We=["application/xhtml+xml","text/html"];let we=null,Re=null;const Le=a.createElement("form"),Ce=function(e){return e instanceof RegExp||e instanceof Function},xe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Re||Re!==e){if(e&&"object"==typeof e||(e={}),e=k4(e),qe=-1===We.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===qe?O4:f4,B=q4(e,"ALLOWED_TAGS")?C4({},e.ALLOWED_TAGS,we):_,H=q4(e,"ALLOWED_ATTR")?C4({},e.ALLOWED_ATTR,we):D,Oe=q4(e,"ALLOWED_NAMESPACES")?C4({},e.ALLOWED_NAMESPACES,O4):Ae,de=q4(e,"ADD_URI_SAFE_ATTR")?C4(k4(be),e.ADD_URI_SAFE_ATTR,we):be,pe=q4(e,"ADD_DATA_URI_TAGS")?C4(k4(ue),e.ADD_DATA_URI_TAGS,we):ue,se=q4(e,"FORBID_CONTENTS")?C4({},e.FORBID_CONTENTS,we):le,V=q4(e,"FORBID_TAGS")?C4({},e.FORBID_TAGS,we):k4({}),X=q4(e,"FORBID_ATTR")?C4({},e.FORBID_ATTR,we):k4({}),ce=!!q4(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,F=!1!==e.ALLOW_DATA_ATTR,U=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ae=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,$=e.ALLOWED_URI_REGEXP||Y4,he=e.NAMESPACE||me,ve=e.MATHML_TEXT_INTEGRATION_POINTS||ve,ge=e.HTML_INTEGRATION_POINTS||ge,I=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(I.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(I.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(I.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(F=!1),te&&(ee=!0),ce&&(B=C4({},_4),H=[],!0===ce.html&&(C4(B,E4),C4(H,H4)),!0===ce.svg&&(C4(B,T4),C4(H,D4),C4(H,V4)),!0===ce.svgFilters&&(C4(B,N4),C4(H,D4),C4(H,V4)),!0===ce.mathMl&&(C4(B,$4),C4(H,I4),C4(H,V4))),e.ADD_TAGS&&(B===_&&(B=k4(B)),C4(B,e.ADD_TAGS,we)),e.ADD_ATTR&&(H===D&&(H=k4(H)),C4(H,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&C4(de,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===le&&(se=k4(se)),C4(se,e.FORBID_CONTENTS,we)),ie&&(B["#text"]=!0),K&&C4(B,["html","head","body"]),B.table&&(C4(B,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w4('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w4('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,g=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(n=t.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(M,i)),null!==v&&"string"==typeof g&&(g=v.createHTML(""));s4&&s4(e),Re=e}},ke=C4({},[...T4,...N4,...P4]),Se=C4({},[...$4,...B4]),Ee=function(e){m4(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){h(e)}},Te=function(e,t){try{m4(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){m4(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ee(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=A4(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===qe&&he===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(he===me)try{t=(new b).parseFromString(o,qe)}catch(e){}if(!t||!t.documentElement){t=y.createDocument(he,"template",null);try{t.documentElement.innerHTML=fe?g:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),he===me?w.call(t,K?"html":"body")[0]:K?t.documentElement:i},Pe=function(e){return q.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},$e=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof s&&e instanceof s};function _e(e,t,a){b4(e,(e=>{e.call(n,t,a,Re)}))}const He=function(e){let t=null;if(_e(L.beforeSanitizeElements,e,null),$e(e))return Ee(e),!0;const a=we(e.nodeName);if(_e(L.uponSanitizeElement,e,{tagName:a,allowedTags:B}),Z&&e.hasChildNodes()&&!Be(e.firstElementChild)&&W4(/<[/\w!]/g,e.innerHTML)&&W4(/<[/\w!]/g,e.textContent))return Ee(e),!0;if(e.nodeType===a6)return Ee(e),!0;if(Z&&e.nodeType===o6&&W4(/<[/\w]/g,e.data))return Ee(e),!0;if(!B[a]||V[a]){if(!V[a]&&Ie(a)){if(I.tagNameCheck instanceof RegExp&&W4(I.tagNameCheck,a))return!1;if(I.tagNameCheck instanceof Function&&I.tagNameCheck(a))return!1}if(ie&&!se[a]){const t=A(e)||e.parentNode,n=O(e)||e.childNodes;if(n&&t){for(let a=n.length-1;a>=0;--a){const o=m(n[a],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,f(e))}}}return Ee(e),!0}return e instanceof l&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const n=f4(e.tagName),a=f4(t.tagName);return!!Oe[e.namespaceURI]&&(e.namespaceURI===ze?t.namespaceURI===me?"svg"===n:t.namespaceURI===Me?"svg"===n&&("annotation-xml"===a||ve[a]):Boolean(ke[n]):e.namespaceURI===Me?t.namespaceURI===me?"math"===n:t.namespaceURI===ze?"math"===n&&ge[a]:Boolean(Se[n]):e.namespaceURI===me?!(t.namespaceURI===ze&&!ge[a])&&!(t.namespaceURI===Me&&!ve[a])&&!Se[n]&&(ye[n]||!ke[n]):!("application/xhtml+xml"!==qe||!Oe[e.namespaceURI]))}(e)?(Ee(e),!0):"noscript"!==a&&"noembed"!==a&&"noframes"!==a||!W4(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===n6&&(t=e.textContent,b4([C,x,k],(e=>{t=v4(t,e," ")})),e.textContent!==t&&(m4(n.removed,{element:e.cloneNode()}),e.textContent=t)),_e(L.afterSanitizeElements,e,null),!1):(Ee(e),!0)},De=function(e,t,n){if(ae&&("id"===t||"name"===t)&&(n in a||n in Le))return!1;if(F&&!X[t]&&W4(S,t));else if(j&&W4(E,t));else if(!H[t]||X[t]){if(!(Ie(e)&&(I.tagNameCheck instanceof RegExp&&W4(I.tagNameCheck,e)||I.tagNameCheck instanceof Function&&I.tagNameCheck(e))&&(I.attributeNameCheck instanceof RegExp&&W4(I.attributeNameCheck,t)||I.attributeNameCheck instanceof Function&&I.attributeNameCheck(t))||"is"===t&&I.allowCustomizedBuiltInElements&&(I.tagNameCheck instanceof RegExp&&W4(I.tagNameCheck,n)||I.tagNameCheck instanceof Function&&I.tagNameCheck(n))))return!1}else if(de[t]);else if(W4($,v4(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==g4(n,"data:")||!pe[e]){if(U&&!W4(T,v4(n,N,"")));else if(n)return!1}else;return!0},Ie=function(e){return"annotation-xml"!==e&&A4(e,P)},Ve=function(e){_e(L.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||$e(e))return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:r,namespaceURI:c,value:s}=i,l=we(r),p=s;let u="value"===r?p:y4(p);if(a.attrName=l,a.attrValue=u,a.keepAttr=!0,a.forceKeepAttr=void 0,_e(L.uponSanitizeAttribute,e,a),u=a.attrValue,!oe||"id"!==l&&"name"!==l||(Te(r,e),u="user-content-"+u),Z&&W4(/((--!?|])>)|<\/(style|title)/i,u)){Te(r,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){Te(r,e);continue}if(!G&&W4(/\/>/i,u)){Te(r,e);continue}Y&&b4([C,x,k],(e=>{u=v4(u,e," ")}));const d=we(e.nodeName);if(De(d,l,u)){if(v&&"object"==typeof M&&"function"==typeof M.getAttributeType)if(c);else switch(M.getAttributeType(d,l)){case"TrustedHTML":u=v.createHTML(u);break;case"TrustedScriptURL":u=v.createScriptURL(u)}if(u!==p)try{c?e.setAttributeNS(c,r,u):e.setAttribute(r,u),$e(e)?Ee(e):z4(n.removed)}catch(t){Te(r,e)}}else Te(r,e)}_e(L.afterSanitizeAttributes,e,null)},Xe=function e(t){let n=null;const a=Pe(t);for(_e(L.beforeSanitizeShadowDOM,t,null);n=a.nextNode();)_e(L.uponSanitizeShadowNode,n,null),He(n),Ve(n),n.content instanceof r&&e(n.content);_e(L.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null,i=null,c=null,l=null;if(fe=!e,fe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw w4("toString is not a function");if("string"!=typeof(e=e.toString()))throw w4("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Q||xe(t),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=we(e.nodeName);if(!B[t]||V[t])throw w4("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)a=Ne("\x3c!----\x3e"),i=a.ownerDocument.importNode(e,!0),i.nodeType===t6&&"BODY"===i.nodeName||"HTML"===i.nodeName?a=i:a.appendChild(i);else{if(!ee&&!Y&&!K&&-1===e.indexOf("<"))return v&&ne?v.createHTML(e):e;if(a=Ne(e),!a)return ee?null:ne?g:""}a&&J&&Ee(a.firstChild);const p=Pe(re?e:a);for(;c=p.nextNode();)He(c),Ve(c),c.content instanceof r&&Xe(c.content);if(re)return e;if(ee){if(te)for(l=W.call(a.ownerDocument);a.firstChild;)l.appendChild(a.firstChild);else l=a;return(H.shadowroot||H.shadowrootmode)&&(l=R.call(o,l,!0)),l}let u=K?a.outerHTML:a.innerHTML;return K&&B["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&W4(Q4,a.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+u),Y&&b4([C,x,k],(e=>{u=v4(u,e," ")})),v&&ne?v.createHTML(u):u},n.setConfig=function(){xe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},n.clearConfig=function(){Re=null,Q=!1},n.isValidAttribute=function(e,t,n){Re||xe({});const a=we(e),o=we(t);return De(a,o,n)},n.addHook=function(e,t){"function"==typeof t&&m4(L[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=M4(L[e],t);return-1===n?void 0:h4(L[e],n,1)[0]}return z4(L[e])},n.removeHooks=function(e){L[e]=[]},n.removeAllHooks=function(){L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const s6=({children:e,title:t,closeModal:a,isModalOpen:o})=>n.createElement(p.CSSTransition,{in:o,unmountOnExit:!0,timeout:500,classNames:"fade",key:t},n.createElement("div",{className:"options-popup",style:{}},n.createElement("header",null,n.createElement("button",{onClick:a,className:"close"},n.createElement(IN,null)),n.createElement("h4",null,t)),n.createElement("main",{className:"fsc-range-main"},e),n.createElement("footer",null,"Tab an item to select it"))),l6=({question:e,saveFormValues:a})=>{const[o,i]=t.useState(!1),{range:r}=e?.type_info?.scale_properties||{},c=Number(r?.[0]?.min),s=Number(r?.[r.length-1]?.max),l="descending"===e?.type_info?.scale_properties?.order,p=[...e?.type_info?.scale_properties?.labels?.values||[]],u=e?.type_info?.scale_properties?.labels?.preference;l&&p.reverse();const d=t.useRef(Array.from({length:s+(0===c?1:0)},((e,t)=>l?s-t:t+c)));return d.current.length<=3?n.createElement("ul",{className:`choices ${("THUMBS"===e?.type_info?.type_variant||"all"!==e?.type_info?.scale_properties?.labels?.preference)&&"one-line"}`},d.current.map(((t,o)=>"THUMBS"===e?.type_info?.type_variant?n.createElement("li",{className:"choice range-choice",key:`thumbs-${t}-${o}`},n.createElement("button",{onClick:()=>{a(t)}},n.createElement(I,{name:t?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===e?.type_info?.scale_properties?.labels?.preference&&e?.type_info?.scale_properties?.labels?.values?.[t])):n.createElement("li",{className:"choice range-choice",key:`choice-${t}-${o}`},n.createElement("button",{onClick:()=>{a(t)}},n.createElement("span",{className:"star-rating-wrapper"},Array.from({length:t},((e,t)=>n.createElement(I,{name:"whatsapp-star",id:`choice-${t}`})))," ","all"===u||"edges"===u&&(0===o||o===p.length-1)?p[t-1]:null)))))):n.createElement(n.Fragment,null,n.createElement("button",{onClick:()=>i(!0),className:"choices-button choice"},n.createElement(I,{name:"whatsapp-choices"}),"Rate Support"),n.createElement(s6,{title:"Rate Support",isModalOpen:o,closeModal:()=>i(!1)},d.current.map(((e,t)=>n.createElement("div",{className:"option-row"},n.createElement("button",{onClick:()=>{a(e),i(!1)}},n.createElement("span",{className:"star-rating-wrapper"},Array.from({length:e},((e,t)=>n.createElement(I,{name:"whatsapp-star",id:`qus-${t}`})))," ","all"===u||"edges"===u&&(0===t||t===p.length-1)?p[e-1]:null)))))))},p6=({question:e,saveFormValues:a,type:o})=>{const[i,r]=t.useState(!1);return n.createElement(n.Fragment,null,n.createElement("button",{onClick:()=>r(!0),className:"choices-button choice"},n.createElement(I,{name:"whatsapp-choices"}),"Select answer"),n.createElement(s6,{title:"Select a choice",isModalOpen:i,closeModal:()=>r(!1)},n.createElement("ul",{className:`choices multi-choice ${o}`},e.choices.map(((e,t)=>n.createElement("li",{className:"choice",style:{boxShadow:"none"},key:`${e}-${t}`},n.createElement("button",{onClick:()=>{a(e.id),r(!1)}},e.value)))))))},u6=e=>{const a=t.useRef(null);return((e,n)=>{t.useEffect((()=>{if(e){e.style.height="0px";const t=e.scrollHeight;e.style.height=t+"px"}}),[e,n])})(a.current,String(e.value)??""),t.useEffect((()=>{e.autoFocus&&a.current?.focus()}),[e.autoFocus]),n.createElement("div",{className:"textarea-container"},n.createElement("textarea",{placeholder:"Type a message",ref:a,rows:1,onChange:e.onChange,value:e.value}),n.createElement("button",{onClick:()=>{e.onSubmit(),a.current&&(a.current.value="")}},n.createElement(I,{name:"whatsapp-send"})))},d6=({text:e,placeholders:t,pivot:a,rangeToRender:o,questions:i,answers:r})=>n.createElement("div",{className:"question-text-container"},n.createElement("div",{className:"question-text ss-question-text",dangerouslySetInnerHTML:{__html:Un({questionText:e,placeholders:t,npsRating:Gn({theme:"nps",answers:r,questions:i})??"",npsRatingLabel:Yn({theme:"nps",answers:r,questions:i}),csatRating:Gn({theme:"csat",answers:r,questions:i})??"",csatRatingLabel:Yn({theme:"csat",answers:r,questions:i}),cesRating:Gn({theme:"ces",answers:r,questions:i})??"",cesRatingLabel:Yn({theme:"ces",answers:r,questions:i}),preference:a?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0})},role:"heading","aria-level":1})),b6=({block:e,saveFormValues:t,type:a,translationVariables:o,language:i})=>{const{question_type:r}=e.question?.type_info;switch(r){case"RANGE":return n.createElement(l6,{question:e.question,saveFormValues:e=>t(e,!0)});case"DROPDOWN":case"MULTI_CHOICE":case"MULTI_SELECT":return n.createElement(p6,{dir:In(i||"en")?"rtl":"ltr",question:e.question,saveFormValues:e=>t(e,!0),type:a,translationVariables:o});case"PARAGRAPH":case"INPUT":return null;default:return console.error(`Question type ${r} not supported`),null}},M6=({config:e,placeholders:a,onSelect:o,promptAccepted:i,type:r})=>{const c=t.useMemo((()=>e.reverse_order?e.choices?.reverse():e.choices),[e]);return n.createElement(n.Fragment,null,n.createElement("div",{className:"question-container ss-question-container "+(null==i?"active":"")},n.createElement(d6,{text:e.text,placeholders:a}),n.createElement("ul",{className:"choices one-line"},c?.map(((e,t)=>n.createElement("li",{className:"choice",key:`prompt-${e}-${t}`},n.createElement("button",{className:"action",onClick:()=>{o(Number(e.id))}},n.createElement(I,{name:Number(e.id)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),e.value)))))),void 0!==i&&n.createElement("div",{className:"answers-container"},n.createElement("div",{className:"answers"},"whatsapp"===r&&n.createElement("div",{className:"reply-block"},n.createElement("p",{className:"user"},"Acme.inc"),n.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:Un({questionText:e.text,placeholders:a})}})),n.createElement("div",{className:"answer-text"},n.createElement(I,{name:Number(i)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),c.find((e=>e.id==i))?.value))),!1===i&&e.is_declined&&e.declined_message&&n.createElement("div",{className:"question-container ss-question-container"},n.createElement(d6,{text:e.declined_message,placeholders:a})))},z6=e=>{const{activeBlock:a,activeIndexOfBlocks:o,activeIndexOfRenderedBlocks:i,answers:r,saveFormValues:c,blocks:s,questions:l,renderedBlocks:p,onSubmitHandler:u,isSurveyCompleted:d,pivot:b}=RP(e),{type:M="whatsapp"}=e,{question_type:z}=a?.question.type_info??{},m=n.useMemo((()=>Fn(b?.question)),[b?.question]),h=t.useRef(null),[f,A]=t.useState(void 0),v=YN({blocks:s,activeIndexOfBlocks:o,renderedBlocks:p,activeIndexOfRenderedBlocks:i,questions:l});return t.useEffect((()=>{h.current&&h.current.scroll({top:1e4,behavior:"smooth"})}),[a,r,d]),a&&a.question?n.createElement("div",{className:`${M} whatsapp-container`},n.createElement("div",{className:"msg-container"},n.createElement("div",{className:"scroll-wrapper",ref:h},e.survey.prompt_settings?n.createElement(M6,{config:e.survey.prompt_settings,onSelect:e=>{A(1===e)},promptAccepted:f,placeholders:e.placeholders,type:M}):null,!e.survey.prompt_settings||f?p.map(((t,z)=>{const h=t.question.type_info?.scale_properties?.labels?.preference,f=t.question.type_info?.scale_properties?.labels?.values||[];return n.createElement(n.Fragment,null,n.createElement("div",{className:"question-container ss-question-container "+(d||z!==p.length-1?"":"active")},n.createElement(d6,{text:t.question.text,placeholders:e.placeholders,pivot:b,rangeToRender:m}),n.createElement(b6,{language:e.language||"en",block:t,placeholders:e.placeholders,saveFormValues:(e,n)=>{c(t,e,n),setTimeout((()=>{!0===n&&YN({blocks:s,activeIndexOfBlocks:o,renderedBlocks:p,activeIndexOfRenderedBlocks:i,questions:l})&&u("COMPLETE")}))},type:M})),t.name===a.name&&!r.commitDirtyValue||O.isNil(r.formValues[t.question.name])?null:n.createElement("div",{className:"answers-container"},n.createElement("div",{className:"answers"},"THUMBS"===t.question.type_info?.type_variant?n.createElement(n.Fragment,null,"whatsapp"===M&&n.createElement("div",{className:"reply-block"},n.createElement("p",{className:"user"},"Acme.inc"),n.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:c6.sanitize(Un({questionText:t.question.text||"",placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:r,questions:l})??"",npsRatingLabel:Yn({theme:"nps",answers:r,questions:l}),csatRating:Gn({theme:"csat",answers:r,questions:l})??"",csatRatingLabel:Yn({theme:"csat",answers:r,questions:l}),cesRating:Gn({theme:"ces",answers:r,questions:l})??"",cesRatingLabel:Yn({theme:"ces",answers:r,questions:l}),preference:b?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),n.createElement("div",{className:"answer-text"},n.createElement(I,{name:Number(r.formValues[t.question.name])?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===t.question.type_info?.scale_properties?.labels?.preference&&t.question.type_info?.scale_properties?.labels?.values?.[Number(r.formValues[t.question.name])])):"EMOJI"===t.question.type_info?.type_variant||"STAR"===t.question.type_info?.type_variant?n.createElement(n.Fragment,null,"whatsapp"===M&&r.formValues[t.question.name]&&n.createElement("div",{className:"reply-block"},n.createElement("p",{className:"user"},"Acme.inc"),n.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:c6.sanitize(Un({questionText:t.question.text||"",placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:r,questions:l})??"",npsRatingLabel:Yn({theme:"nps",answers:r,questions:l}),csatRating:Gn({theme:"csat",answers:r,questions:l})??"",csatRatingLabel:Yn({theme:"csat",answers:r,questions:l}),cesRating:Gn({theme:"ces",answers:r,questions:l})??"",cesRatingLabel:Yn({theme:"ces",answers:r,questions:l}),preference:b?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),n.createElement("div",{className:"answer-text"},n.createElement("div",{className:"star-rating-wrapper"},Array.from({length:Number(r.formValues[t.question.name])},((e,t)=>n.createElement(I,{name:"whatsapp-star",id:`ans-${t}`})))," ","all"===h||"edges"===h&&(1===r.formValues[t.question.name]||r.formValues[t.question.name]===f.length)?f[Number(r.formValues[t.question.name])-1]:null))):"DROPDOWN"===t.question.type_info?.question_type||"MULTI_SELECT"===t.question.type_info?.question_type?n.createElement(n.Fragment,null,t.question.choices?.find((e=>e.id===r.formValues[t.question.name]))?.value||r.formValues[t.question.name]?.toString()):n.createElement(n.Fragment,null,r.formValues[t.question.name]?.toString()))))})):null,d&&n.createElement("div",{className:"question-container ss-question-container",id:"new"},n.createElement(d6,{text:ZN({pivotQn:b?.question,pivotQnAnswer:b?.answer,block:e.survey.blocks?.find((e=>"TY"===e.name)),questions:l})?.text,placeholders:e.placeholders,pivot:b,rangeToRender:m})))),n.createElement(u6,{onChange:e=>{"PARAGRAPH"!==z||d||c(a,e.target.value)},value:"PARAGRAPH"===z&&!d&&r.formValues[a.question.name]?r.formValues[a.question.name]:"",activeBlock:!0,autoFocus:"PARAGRAPH"===z,onSubmit:()=>{c(a,r?.formValues?.[a.question.name],!0),v&&u("COMPLETE")}})):null},m6=e=>{const{survey:a,previewConfig:o}=e,[i,r]=t.useState(!1),[c,s]=t.useState(!1),[l,p]=t.useState({others_meta:{}}),{block:u,question:d,agentName:b,userName:M}=n.useMemo((()=>{const e=a.blocks.find((e=>!e.is_deleted)),t=a.question_details?.questions?.find((t=>t.name===e?.question_name||e?.category?.map((e=>e.question_name)).includes(t.name)));return{block:e,question:t,agentName:o?.agent?.firstName||o?.agent?.lastName?`${o?.agent?.firstName??""} ${o?.agent?.lastName??""}`.trim():"John Doe",userName:o?.user?.firstName||o?.user?.lastName?`${o?.user?.firstName??""} ${o?.user?.lastName??""}`.trim():"Hartmann"}}),[o?.agent?.firstName,o?.agent?.lastName,o?.user?.firstName,o?.user?.lastName,a.blocks,a.question_details?.questions]);return u?.name&&d?.name?n.createElement("div",{className:"web-chat-channel"},n.createElement("div",{className:"wc-header"},n.createElement("div",{className:"wc-h-action-button"},n.createElement(I,{name:"arrow-left"})),n.createElement("div",{className:"wc-h-info"},n.createElement("div",{className:"wc-h-info-main wc-wrap-text"},o?.topicName??"Instant support"),n.createElement("div",{className:"wc-h-info-sub wc-wrap-text"},o?.topicDescription??"Typically responds in 5 mins")),n.createElement("div",{className:"wc-h-action-button"},n.createElement(I,{name:"close"}))),n.createElement("div",{className:"wc-body"},n.createElement("div",{className:"wc-body-scroll-container"},n.createElement("div",{className:"wc-agent-details"},n.createElement("div",{className:"wc-icon"},o?.agent?.imageUrl?n.createElement("img",{src:o?.agent?.imageUrl,alt:b,className:"wc-a-avatar"}):b?.slice(0,1)),n.createElement("div",{className:"wc-a-info"},n.createElement("div",{className:"wc-a-i-name wc-break-text"},b),n.createElement("div",{className:"wc-a-i-designation wc-break-text"},o?.agent?.designation??"Sr. Customer support agent"))),n.createElement("div",{className:"wc-agent-chat-wrapper"},n.createElement("div",{className:"wc-icon"},o?.user?.imageUrl?n.createElement("img",{src:o?.user?.imageUrl,alt:M,className:"wc-a-avatar"}):M?.slice(0,1)),n.createElement("div",{className:"w-a-c-container"},n.createElement("div",{className:"wc-a-s-name wc-break-text"},M),n.createElement("div",{className:"wc-a-survey-wrapper"},n.createElement(n4,{block:u,question:d,surveyStyle:"card",onAnswer:e=>{p({...e.question.name?{[e.question.name]:e.value}:{},others_meta:{}}),r(!0)},isMobile:!0,theme:e.survey.theme??{},language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables})),n.createElement("div",{className:"wc-a-timestamp wc-break-text"},o?.timeString??(new Date).toLocaleTimeString())))),n.createElement("div",{className:"wc-footer"},n.createElement("div",{className:"w-f-link wc-wrap-text"},o?.actionText??"Continue chat"))),n.createElement("div",{className:"web-chat-survey-preview"},i&&n.createElement(t4,{answers:l,answerStatus:"PARTIAL",language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables,preview:!0,isSurveyCompleted:c,onAnsweringPrompt:e=>{},onDismiss:()=>{r(!1)},onClose:()=>{r(!1)},onSubmit:(e,t,n)=>{"COMPLETE"===n&&(s(!0),setTimeout((()=>{t()}),0))},isMobile:!0,placeholders:{},survey:e.survey,surveyType:"compact"}))):null};var h6=Object.freeze({__proto__:null,allPathsLoader:function(e,t){return Bo(void 0,void 0,void 0,(function(){return _o(this,(function(n){switch(n.label){case 0:return[4,Promise.resolve().then((function(){return Fi}))];case 1:return[2,(0,n.sent().getIconPaths)(e,t)]}}))}))}}),f6=Object.freeze({__proto__:null,splitPathsBySizeLoader:function(e,t){return Bo(void 0,void 0,void 0,(function(){var n,a;return _o(this,(function(o){switch(o.label){case 0:return n=_i(e),t!==Di.STANDARD?[3,2]:[4,Promise.resolve().then((function(){return Ii}))];case 1:return a=o.sent(),[3,4];case 2:return[4,Promise.resolve().then((function(){return Vi}))];case 3:a=o.sent(),o.label=4;case 4:return[2,a[n]]}}))}))}});exports.ALL_FONTS=B,exports.Binary=F,exports.Button=G,exports.ChannelPreview=e=>{aa("ChannelPreview",e);const{survey:t,answers:a}=XN(e.survey,e.answers);return n.useEffect((()=>{const t=document?.documentElement;!_n(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),n.useEffect((()=>{t.theme&&Zn(t.theme,e.surveyServAssetUrl??"")}),[t.theme,e.surveyServAssetUrl]),"chat"===e.channel?n.createElement(m6,{...e,survey:t,answers:a}):"whatsapp"===e.channel?n.createElement(z6,{...e,survey:t,answers:a}):"instagram"===e.channel?n.createElement(z6,{type:"instagram",...e,survey:t,answers:a}):(console.error(`Channel ${e.channel} not supported`),null)},exports.Checkbox=Re,exports.DEFAULT_FONT=$,exports.DatePicker=cq,exports.DateTimePicker=sq,exports.Dropdown=ca,exports.FONT_SIZE_OPTIONS=_,exports.Input=ra,exports.Loader=ua,exports.PhoneNumberInput=da,exports.ProgressBar=lq,exports.QuestionPreview=n4,exports.RadioGroup=aS,exports.Range=rS,exports.RankOrder=VT,exports.Slider=HN,exports.Survey=e=>{const{survey:t,answers:a}=XN(e.survey,e.answers),[o,i]=n.useState(!1);return n.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&"undefined"!=typeof sessionStorage&&sessionStorage&&sessionStorage.clear&&(aa("Survey matchMedia",{innerHeight:window.innerHeight,innerWidth:window.innerWidth}),i(window.matchMedia("(max-width: 550px)").matches),wP(localStorage))}),[]),n.useEffect((()=>{const t=document?.documentElement;!_n(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),aa("Survey",{...e,survey:t,isMobile:o,answers:a}),n.createElement(n.Fragment,null,t.theme?.advanced?.additional_css&&n.createElement("style",null,t.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),"standard"===e.surveyStyle?n.createElement(j5,{...e,answers:a,survey:t,isMobile:o||!!e.isMobile,initialQuestionAnswer:e.initialQuestionAnswer}):n.createElement(_5,{...e,answers:a,survey:t,isMobile:o||!!e.isMobile,surveyStyle:"card",initialQuestionAnswer:e.initialQuestionAnswer}))},exports.SurveyFooter=pa,exports.SurveyProgress=({isSurveyCompleted:e,totalBlocks:t,completedText:a,noOfAnswers:o})=>{const i=e?100:(o||0)/(t||1)*100;return n.createElement("div",{className:"survey-progress ss-survey-progress"},n.createElement("span",{className:"progress-completion"},i.toFixed(),"% "),a||"survey completed",n.createElement(lq,{totalSteps:t,completedSteps:e?t:o}))},exports.TextArea=DN,exports.WebInAppSurvey=t4;
|
|
39
|
+
*/;const E3=({addFilter:e,utils:t})=>{const{Type:n,isString:a,replaceInString:o,guesstimateMimeType:i,getExtensionFromFilename:r,getFilenameFromURL:c}=t,s=(e,t)=>e.some((e=>{return/\*$/.test(e)?(n=e,(/^[^/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n})),l=(e,t,n)=>{if(0===t.length)return!0;const o=(e=>{let t="";if(a(e)){const n=c(e),a=r(n);a&&(t=i(a))}else t=e.type;return t})(e);return n?new Promise(((a,i)=>{n(e,o).then((e=>{s(t,e)?a():i()})).catch(i)})):s(t,o)};return e("SET_ATTRIBUTE_TO_OPTION_MAP",(e=>Object.assign(e,{accept:"acceptedFileTypes"}))),e("ALLOW_HOPPER_ITEM",((e,{query:t})=>!t("GET_ALLOW_FILE_TYPE_VALIDATION")||l(e,t("GET_ACCEPTED_FILE_TYPES")))),e("LOAD_FILE",((e,{query:t})=>new Promise(((n,a)=>{if(!t("GET_ALLOW_FILE_TYPE_VALIDATION"))return void n(e);const i=t("GET_ACCEPTED_FILE_TYPES"),r=t("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),c=l(e,i,r),s=()=>{const e=i.map((e=>t=>null!==e[t]&&(e[t]||t))(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter((e=>!1!==e)),n=e.filter(((t,n)=>e.indexOf(t)===n));a({status:{main:t("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:o(t("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:n.join(", "),allButLastType:n.slice(0,-1).join(", "),lastType:n[n.length-1]})}})};if("boolean"==typeof c)return c?n(e):s();c.then((()=>{n(e)})).catch(s)})))),{options:{allowFileTypeValidation:[!0,n.BOOLEAN],acceptedFileTypes:[[],n.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",n.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",n.STRING],fileValidateTypeLabelExpectedTypesMap:[{},n.OBJECT],fileValidateTypeDetectType:[null,n.FUNCTION]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:E3}));M.registerPlugin(S3,E3,o$,k3),e3(t3,a3,n3,o3);const T3=t.forwardRef((({onClick:e,maxFileSize:a=16,visible:o=!0,supportedFileFormats:i,translationVariables:r,fileErrors:c},s)=>{const[l,p]=t.useState(!1),u=r?.drop_your_file?r?.drop_your_file:n.createElement(n.Fragment,null,"Drop your file here, or Browse");return n.createElement("div",{ref:s,className:"file-upload-container "+(c?.current?.main?"errored":""),onClick:e,style:{visibility:o?"visible":"hidden"},onDragOver:e=>{e.preventDefault(),e.target.classList.add("push-backward")}}," ",n.createElement(I,{name:"file-upload-icon"}),"string"!=typeof u?n.createElement("p",null,u):n.createElement("p",{className:"drop-your-file-container",dangerouslySetInnerHTML:{__html:u}}),n.createElement("p",{className:"max-size"},((e,t,n)=>{if(n&&e&&t)return e.replace(t,n)})(r?.max_file_size,"{{max_file_size}}",String(a))||`Maximum file size : ${a} MB`),n.createElement("p",{className:"support file-formats"},r?.supported_file_formats||"Supported file formats: "," ",(i=i.join(", ")).trim()?n.createElement(n.Fragment,null,l?i:i.slice(0,20)," ",n.createElement("span",{onClick:()=>p(!l),style:{color:"#2C5CC5",textDecoration:"underline",cursor:"pointer"}},l?r?.show_less||"Show less":r?.show_more||"Show more")):"No formats selected"),n.createElement("div",{className:"filepond--drip"}))})),N3=({question:e,onChangeHandler:a,onFileUpload:o,setErrors:i,translationVariables:r,surveyServAssetUrl:c,value:s,preview:l})=>{const[p,u]=t.useState([]),[d,b]=t.useState([]),z=t.useRef(),m=e.type_info?.file_field?.max_file_size||10,h=t.useRef(null),f=t.useRef(),[O,A]=t.useState(!1);let v=!1;n.useEffect((()=>{const t=localStorage.getItem(`uploadedFile-${e?.name}`),n=t?JSON.parse(t):"";n?.source&&(n.options={...n.options,file:{name:s,size:n.fileSize}},s&&u([n]))}),[]);const g=async(t,n)=>{try{if(v)return;if(f.current&&Dn(h.current)||t){const i=t??f.current.getFiles()?.[0]?.file;if(i&&o){v=!0;const t=await o(i.type,i.size,i.name,e);if(n&&n(!0,50,100),t.startsWith("http")&&c){const n=await fetch(t,{method:"PUT",headers:{"Content-Type":i.type,"Content-Disposition":"attachment"},body:i}),o=new URL(t),r=`${c}${o.pathname}`;if(!n.ok)throw console.error("Error uploading file"),new Error("Error uploading file");localStorage.setItem(`uploadedFile-${e?.name}`,JSON.stringify({source:r,options:{type:"local"},fileSize:f.current.getFiles()?.[0]?.fileSize})),a(i.name)}else a(l?"dummy":null),console.error("Error fetching pre-signed url");v=!1}}}catch(e){throw console.error("error in uploading file",e,"stringified error",JSON.stringify(e)),new Error("Error uploading file")}};return n.useEffect((()=>{(()=>{const t=e.type_info?.file_field?.allowed_file_types,n=Object.keys(N).map((e=>{if((t||[]).includes(e))return N[e].concat(",")})).join(" ").trim().slice(0,-1);b(n.split(", "))})()}),[]),n.createElement(n.Fragment,null,n.createElement(M.FilePond,{ref:f,files:p,labelFileProcessing:r?.uploading_text??"Uploading..",labelFileProcessingComplete:r?.upload_complete??"Upload complete",labelMaxFileSizeExceeded:r?.file_too_large??"The file is too large and cannot be uploaded.",labelMaxFileSize:"",labelTapToCancel:"",labelTapToUndo:"",labelFileTypeNotAllowed:r?.invalid_type??"The file mismatch. Retry by uploading the supported file type.",fileValidateTypeLabelExpectedTypes:"",beforeAddFile:e=>(h.current?.main&&(h.current=null,i({}),u([e]),A(!0)),!0),onremovefile:()=>{O?A(!1):(u([]),i({}),h.current=null,a(null))},allowReplace:!0,server:{process:async(e,t,n,a,o,i)=>{i(!0,0,100);try{await g(t,i),i(!0,100,100),a(t.name)}catch(e){o("An error occurred during upload")}}},onpreparefile:(e,t)=>{const n=new FileReader;n.onloadend=()=>{const t=n.result??"",a=new Blob([t],{type:e.fileType}),o=new File([a],e.filename,{type:e.fileType});g(o)},n.readAsArrayBuffer(t)},onerror:t=>{h.current=t,i({[e.name]:t})},required:!0,credits:!1,allowFileTypeValidation:!0,acceptedFileTypes:d,fileValidateTypeDetectType:(e,t)=>new Promise(((t,n)=>{const a=e.name.split(".");t(`.${a[a.length-1].toLowerCase()}`)})),imageEditor:{legacyDataToImageState:SQ,createEditor:b3,imageReader:[Z2,{}],imageWriter:[K2,{}],imageProcessor:vj,imageEditorAfterWriteImage:({src:e,dest:t,imageState:n})=>new Promise(((a,o)=>{vj(e,{imageReader:Z2(),imageWriter:K2({targetSize:{width:128,height:15,fit:"cover"}}),imageState:n}).then((n=>{a([{name:"input_",file:e},{name:"output_",file:t},{name:"thumb_",file:n.dest}])})).catch(o)})),editorOptions:{utils:["crop","finetune","filter","annotate"],imageOrienter:Q2(),shapePreprocessor:M3(),...i3,...r3,...J2,locale:{...c3,...l3,...u3,...p3,...d3,...s3}}},allowFileSizeValidation:!0,maxFileSize:`${m}MB`,onupdatefiles:e=>{z.current?.classList.remove("push-backward"),e.length&&u(e)},maxFiles:1,name:`${e.id}-files`}),n.createElement(T3,{ref:z,onClick:e=>{const t=e.target;"path"!==t?.tagName&&"P"!==t?.tagName&&(!t?.className||t?.className instanceof SVGAnimatedString||t.className.includes("format-type-toggler"))||f.current.browse()},fileErrors:h,visible:Boolean(!p.length||h.current?.main),maxFileSize:m,translationVariables:{...r,tTimeZones:[{id:"",offset:"",timeZone:""}]},supportedFileFormats:d}),h?.current?.main&&n.createElement("div",{className:"file-error"},n.createElement(I,{name:"info"}),n.createElement("span",null,`${h?.current?.main}\n ${h.current?.sub}`)))},P3=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"NUMBER":return"number";default:return"text"}},$3=({question:e,autoFocusDelay:t,onChangeHandler:a,surveyStyle:o,formValues:i,fieldErrors:r,translationVariables:c,language:s,isQuestionBgDark:l,isMobile:p,isWidget:u,widgetStyle:d})=>{const b=e.type_info?.form_fields?.layout,M=e.type_info?.form_fields?.fields;return n.createElement("div",{className:`fsc-form-field-container layout-${(p||u&&"compact"===d?"VERTICAL":b??"VERTICAL").toLowerCase()}`.trim()},M?.map(((p,u)=>{const d="NUMBER"===p?.type||"PHONE"===p.type?18:256;return n.createElement("div",{className:"fsc-form-field",key:p.id},"DATE"!==p?.type&&"DATE_TIME"!==p?.type?n.createElement(n.Fragment,null,"PHONE"===p.type?n.createElement(da,{key:u,surveyLayout:o??"card",setFocus:0===u&&"standard"!==o,autoFocusDelay:t,label:p?.label||"",type:"tel",isRequired:!!p.required,showCount:!0,maxLength:d,value:p.id&&i[e.name]?.[p.id]||"",onChangeHandler:(t,n)=>{p.id&&a({...i[e.name]??{},[p.id]:t||null},!0)},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:"",translationVariables:c}):n.createElement(ra,{isQuestionBgDark:l,key:u,setFocus:0===u&&"standard"!==o,autoFocusDelay:t,onKeyDown:e=>{"PHONE"===p?.type&&ea(e),"NUMBER"===p?.type&&Jn(e)},showCount:!0,maxLength:d,placeholder:"NUMBER"===p?.type?"0":void 0,label:p?.label||"",type:P3(p?.type??"TEXT"),isRequired:!!p.required,value:p.id?i[e.name]?.[p.id]??"":"",onChange:t=>{p.id&&a({...i[e.name]??{},[p.id]:t.target.value.slice(0,d)||null})},onBlur:t=>{if(p.id){const n=i[e.name]?.[p.id],o=t.target.value.slice(0,d);(_n(n)||Dn(n))&&(_n(o)||Dn(o))||a?.({...i[e.name]??{},[p.id]:o||null},!1)}},isErrored:!(!p.id||!i?.[e.name]?.[p.id])&&!!r?.[p?.id||""],errorText:p.id&&i[e.name]?.[p.id]?r?.[p?.id]:""})):n.createElement(n.Fragment,null,"DATE_TIME"===p?.type?n.createElement(sq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,useAmPm:!e.type_info?.meta?.time_format,showTimezoneSelect:!1,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c}):n.createElement(cq,{id:p.id??"",name:e.name??"",label:p?.label??"",isRequired:!!p.required,allowOnlyFuture:!!e.type_info?.meta?.allow_future_date,language:s,onChange:t=>{a({...i[e.name]??{},...p.id&&{[p.id]:t}},!0)},value:p?.id&&i[e?.name]?.[p?.id],type:"FORM_FIELD",translationVariables:c})))})))};var B3="rovingFocusGroup.onEntryFocus",_3={bubbles:!1,cancelable:!0},H3="RovingFocusGroup",[D3,I3,V3]=Ce(H3),[X3,j3]=Q(H3,[V3]),[F3,U3]=X3(H3),G3=t.forwardRef(((e,t)=>a.jsx(D3.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(D3.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Y3,{...e,ref:t})})})));G3.displayName=H3;var Y3=t.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:c,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:p,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...b}=e,M=t.useRef(null),z=K(n,M),m=ke(c),[h=null,f]=ne({prop:s,defaultProp:l,onChange:p}),[O,A]=t.useState(!1),v=te(u),g=I3(o),y=t.useRef(!1),[q,W]=t.useState(0);return t.useEffect((()=>{const e=M.current;if(e)return e.addEventListener(B3,v),()=>e.removeEventListener(B3,v)}),[v]),a.jsx(F3,{scope:o,orientation:i,dir:m,loop:r,currentTabStopId:h,onItemFocus:t.useCallback((e=>f(e)),[f]),onItemShiftTab:t.useCallback((()=>A(!0)),[]),onFocusableItemAdd:t.useCallback((()=>W((e=>e+1))),[]),onFocusableItemRemove:t.useCallback((()=>W((e=>e-1))),[]),children:a.jsx(be.div,{tabIndex:O||0===q?-1:0,"data-orientation":i,...b,ref:z,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,(()=>{y.current=!0})),onFocus:ee(e.onFocus,(e=>{const t=!y.current;if(e.target===e.currentTarget&&t&&!O){const t=new CustomEvent(B3,_3);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=g().filter((e=>e.focusable));J3([e.find((e=>e.active)),e.find((e=>e.id===h)),...e].filter(Boolean).map((e=>e.ref.current)),d)}}y.current=!1})),onBlur:ee(e.onBlur,(()=>A(!1)))})})})),Z3="RovingFocusGroupItem",K3=t.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:c,...s}=e,l=et(),p=c||l,u=U3(Z3,o),d=u.currentTabStopId===p,b=I3(o),{onFocusableItemAdd:M,onFocusableItemRemove:z}=u;return t.useEffect((()=>{if(i)return M(),()=>z()}),[i,M,z]),a.jsx(D3.ItemSlot,{scope:o,id:p,focusable:i,active:r,children:a.jsx(be.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:n,onMouseDown:ee(e.onMouseDown,(e=>{i?u.onItemFocus(p):e.preventDefault()})),onFocus:ee(e.onFocus,(()=>u.onItemFocus(p))),onKeyDown:ee(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)?void 0:Q3[a]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=b().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();const a=n.indexOf(e.currentTarget);n=u.loop?function(e,t){return e.map(((n,a)=>e[(t+a)%e.length]))}(n,a+1):n.slice(a+1)}setTimeout((()=>J3(n)))}}))})})}));K3.displayName=Z3;var Q3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function J3(e,t=!1){const n=document.activeElement;for(const a of e){if(a===n)return;if(a.focus({preventScroll:t}),document.activeElement!==n)return}}var e5=G3,t5=K3,n5="Radio",[a5,o5]=Q(n5),[i5,r5]=a5(n5),c5=t.forwardRef(((e,n)=>{const{__scopeRadio:o,name:i,checked:r=!1,required:c,disabled:s,value:l="on",onCheck:p,form:u,...d}=e,[b,M]=t.useState(null),z=K(n,(e=>M(e))),m=t.useRef(!1),h=!b||(u||!!b.closest("form"));return a.jsxs(i5,{scope:o,checked:r,disabled:s,children:[a.jsx(be.button,{type:"button",role:"radio","aria-checked":r,"data-state":u5(r),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:z,onClick:ee(e.onClick,(e=>{r||p?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())}))}),h&&a.jsx(p5,{control:b,bubbles:!m.current,name:i,value:l,checked:r,required:c,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})}));c5.displayName=n5;var s5="RadioIndicator",l5=t.forwardRef(((e,t)=>{const{__scopeRadio:n,forceMount:o,...i}=e,r=r5(s5,n);return a.jsx(re,{present:o||r.checked,children:a.jsx(be.span,{"data-state":u5(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:t})})}));l5.displayName=s5;var p5=e=>{const{control:n,checked:o,bubbles:i=!0,...r}=e,c=t.useRef(null),s=ae(o),l=ie(n);return t.useEffect((()=>{const e=c.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==o&&n){const t=new Event("click",{bubbles:i});n.call(e,o),e.dispatchEvent(t)}}),[s,o,i]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:o,...r,tabIndex:-1,ref:c,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function u5(e){return e?"checked":"unchecked"}var d5=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b5="RadioGroup",[M5,z5]=Q(b5,[j3,o5]),m5=j3(),h5=o5(),[f5,O5]=M5(b5),A5=t.forwardRef(((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:i,value:r,required:c=!1,disabled:s=!1,orientation:l,dir:p,loop:u=!0,onValueChange:d,...b}=e,M=m5(n),z=ke(p),[m,h]=ne({prop:r,defaultProp:i,onChange:d});return a.jsx(f5,{scope:n,name:o,required:c,disabled:s,value:m,onValueChange:h,children:a.jsx(e5,{asChild:!0,...M,orientation:l,dir:z,loop:u,children:a.jsx(be.div,{role:"radiogroup","aria-required":c,"aria-orientation":l,"data-disabled":s?"":void 0,dir:z,...b,ref:t})})})}));A5.displayName=b5;var v5="RadioGroupItem",g5=t.forwardRef(((e,n)=>{const{__scopeRadioGroup:o,disabled:i,...r}=e,c=O5(v5,o),s=c.disabled||i,l=m5(o),p=h5(o),u=t.useRef(null),d=K(n,u),b=c.value===r.value,M=t.useRef(!1);return t.useEffect((()=>{const e=e=>{d5.includes(e.key)&&(M.current=!0)},t=()=>M.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}}),[]),a.jsx(t5,{asChild:!0,...l,focusable:!s,active:b,children:a.jsx(c5,{disabled:s,required:c.required,checked:b,...p,...r,name:c.name,ref:d,onCheck:()=>c.onValueChange(r.value),onKeyDown:ee((e=>{"Enter"===e.key&&e.preventDefault()})),onFocus:ee(r.onFocus,(()=>{M.current&&u.current?.click()}))})})}));g5.displayName=v5;var y5=t.forwardRef(((e,t)=>{const{__scopeRadioGroup:n,...o}=e,i=h5(n);return a.jsx(l5,{...i,...o,ref:t})}));y5.displayName="RadioGroupIndicator";var q5=A5,W5=g5,w5=y5;const R5=e=>{const{checked:t,className:a,disabled:o,id:i,isRequired:r,label:c,name:s,readOnly:l,onChange:p,...u}=e;return n.createElement(q5,{className:`fsc-radio ${a??""}`.trim(),name:s,"aria-label":c||"Radio button",value:t?"default":"",required:r,disabled:o,"aria-readonly":l,onValueChange:e=>{p?.(!t,e)},...u},n.createElement("div",{className:"fsc-radio-container"},n.createElement(W5,{checked:t,"aria-checked":t,className:"fsc-radio-item",disabled:o,"aria-readonly":l,id:i,value:"default"},n.createElement(w5,{className:"fsc-radio-indicator"})),c&&n.createElement("label",{htmlFor:i,className:"fsc-radio-label"},c,c&&r&&n.createElement("span",null,"*"))))},L5=e=>{const{type_info:{matrix_properties:t},onChangeHandler:a,value:o}=e;return n.createElement("div",{className:"matrix-container","data-test-input":"matrix"},n.createElement("table",{className:"st-mt-table"},n.createElement("thead",{className:"st-mt-thead"},n.createElement("tr",{className:"st-mt-tr"},n.createElement("th",{className:"m-s-b-s-q-m-s-th-empty st-mt-th"}),t?.rating_labels?.map(((e,t)=>e.is_active?n.createElement("th",{key:e.id,className:"m-s-b-s-q-m-s-th st-mt-th"},n.createElement("div",{className:"m-s-b-s-q-m-s-th-div"},e.text)):null)))),n.createElement("tbody",{className:"st-mt-tbody"},t?.statements?.map(((e,i)=>e.is_active?n.createElement("tr",{key:e.id,className:"m-s-b-s-q-m-s-tr-hover st-mt-tr"},n.createElement("td",{className:"m-s-b-s-q-m-s-input st-mt-td"},e.text),t?.rating_labels?.map(((r,c)=>{if(!r.is_active)return null;const s=o?.find((t=>t?.statement_id===e?.id));return n.createElement("td",{key:r.id,className:"m-s-b-s-q-m-s-switch st-mt-td"},"SINGLE_ANSWER"===t?.type&&n.createElement(R5,{key:r.id||`${i}-key-${c}`,name:`q-m-s-radio-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:()=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e?.statement_id===s?.statement_id?{...s,rating_labels:[{id:r.id||"",text:r?.text||""}]}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])},label:""}),"MULTIPLE_ANSWERS"===t?.type&&n.createElement(Re,{key:r.id||`${i}-key-${c}`,name:`q-m-s-checkbox-${i}-key-${c}`,checked:!!s?.rating_labels?.find((e=>e?.id===r?.id)),id:r.id??"",onChange:t=>{e?.id&&r?.id&&a(s?.statement_id?[...o||[]].map((e=>e.statement_id===s.statement_id?{...s,rating_labels:t?[...s.rating_labels||[],{id:r.id||"",text:r?.text||""}]:(s.rating_labels||[]).filter((e=>e?.id!==r.id))}:e)):[...o||[],{statement_id:e.id,rating_labels:[{id:r.id,text:r?.text||""}]}])}}))}))):null)))))},C5=e=>{const{type_info:{matrix_properties:t},onChangeHandler:a,name:o,isMobile:i,isReverseAnimation:r,statementIndex:c,value:s,widgetStyle:l,language:p="en"}=e,u=n.useMemo((()=>(t?.statements||[]).find(((e,t)=>t===c))),[t?.statements,c]),d=n.useMemo((()=>s?.find((e=>e?.statement_id===u?.id))),[u,s]);return n.createElement("div",{className:"matrix-wd-container","data-test-input":"matrix"},n.createElement("div",{className:"matrix-st-count"},`${c+1}/${(t?.statements||[]).length}`),n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{key:`${u?.id??""}`,initial:{opacity:0,x:Vn(p,r)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(p,r)},transition:{duration:.2}},n.createElement("div",{className:"matrix-st-text"},u?.text),n.createElement("div",{className:`matrix-st-labels wd-style-${l} ${i?"mt-mobile":""}`.trim()},"MULTIPLE_ANSWERS"===t?.type&&n.createElement(EP,{name:o??"",onChangeHandler:e=>{if(u?.id){const n=d?.statement_id?[...s||[]].map((n=>n.statement_id===d.statement_id?{...d,rating_labels:e.map((e=>{const n=t?.rating_labels?.find((t=>t.id===e));return{id:e,text:n?.text||""}}))}:n)):[...s||[],{statement_id:u.id,rating_labels:e.map((e=>{const n=t?.rating_labels?.find((t=>t.id===e));return{id:e,text:n?.text||""}}))}];a(n)}},saveOthersValue:()=>{},options:(t?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),values:(d?.rating_labels??[]).map((e=>e.id??"")),autoFocusDelay:0,othersValue:""}),"SINGLE_ANSWER"===t?.type&&n.createElement(aS,{name:o??"",language:p||"en",onChangeHandler:e=>{const n=t?.rating_labels?.find((t=>t.id===e));u?.id&&e&&a(d?.statement_id?[...s||[]].map((t=>t?.statement_id===d?.statement_id?{...d,rating_labels:[{id:e||"",text:n?.text||""}]}:t)):[...s||[],{statement_id:u.id,rating_labels:[{id:e,text:n?.text||""}]}])},saveOthersValue:()=>{},options:(t?.rating_labels??[]).map((e=>({id:e.id,value:e.text}))),value:d?.rating_labels?.[0]?.id??"",othersValue:""})))))},x5=({question:e,autoFocusDelay:t,setFocus:a,formValues:o,surveyLayout:i,onChangeHandler:r,isQuestionBgDark:c})=>{const s=e?.type_info?.number_field?.decimal,l=e?.type_info?.number_field?.decimal_point,p=s?2===l?"0.01":"0.1":"1",u=o[e.name],[d,b]=n.useState(u);n.useEffect((()=>{d&&!u&&b(u)}),[u]);const{maxLength:M,maxNumber:z}=n.useMemo((()=>{const e=s?16:18;var t;return{maxLength:e,maxNumber:(t=e)>=16?10n**BigInt(t)-1n:10**t-1}}),[s]),m=e=>{s&&!_n(l)&&(e.split(".")?.[1]?.length??0)>(l??0)||r(e?Hn(e,s||!1):"",!1)};return n.createElement("div",{className:"responsive-input-field"},n.createElement(ra,{autoFocusDelay:t,isRequired:!!e.required,type:"number",step:p,placeholder:e?.type_info?.meta?.placeholder??s?"0.0"+(2===l?"0":""):"0",onKeyDown:e=>{const{key:t,keyCode:n,which:a,code:o}=e;if(["e","E"].includes(t)&&e.currentTarget.value&&e.preventDefault(),"."===t&&s||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||["Backspace","Shift","Tab","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","-","+","e","E"].includes(t))return;if(["e","E"].includes(t))return;const i=void 0===a?n??o:a;String.fromCharCode(i).match(/^[0-9]+$/)||e.preventDefault()},..."card"===i?{value:u??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??"");BigInt(t)<=z&&e.target.value.length<=M&&m(e.target.value)}}:{value:d??"",onChange:e=>{if(e.target.value.includes("e+"))return;const t=BigInt(e.target.value.split(".")[0]??""),n=e.target.value.split(".")[1]??"";if(n.length>(l??0))return;const a=BigInt(t);a<=z&&e.target.value.length<=M&&b(`${a}${_n(n)||Dn(n)?"":`.${n}`}`)},onBlur:()=>{return e=d,void((_n(u)||Dn(u))&&(_n(d)||Dn(d))||d===u||m(e));var e}},setFocus:a,showCount:!0,max:`${z}`,maxLength:M,isQuestionBgDark:c}))},k5=({question:e,questionCommentOnchangeHandler:t,commentsMeta:a,setFocus:o,isQuestionBgDark:i,isCommentsEnabled:r})=>{const[c,s]=n.useState(a?.toString());return r?n.createElement(nS,null,n.createElement(Kk.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},transition:{duration:.3,ease:"easeInOut"},exit:{height:0,opacity:0},className:"question-comments"},n.createElement(DN,{showCount:!0,maxLength:1500,rows:2,isRequired:!!e.required,placeholder:e?.type_info?.comment_placeholder??"Enter your comment",onChange:n=>{const a=n.target.value||"";s(a),t?.(e.name,a)},value:a||c,setFocus:!0,isQuestionBgDark:i,"aria-label":e.name}))):null},S5=e=>{switch(e){case"EMAIL":return"email";case"PHONE":return"tel";case"URL":return"url";default:return"text"}},E5=e=>{switch(e){case"PHONE":return"phone";case"EMAIL":return"email";case"URL":return"url";default:return""}},T5=({question:e,autoFocusDelay:t,formValues:a,onChangeHandler:o,textboxErrors:i,surveyLayout:r,setFocus:c,onKeyDownHandler:s,translationVariables:l,isQuestionBgDark:p})=>{const u=e?.type_info?.text_field?.text_type,d=a[e.name],[b,M]=n.useState(d);return n.useEffect((()=>{b&&!d&&M(d)}),[d]),n.createElement("div",{className:"responsive-input-field"},"PHONE"===u?n.createElement(da,{startAdornment:n.createElement(I,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:E5(u)}),type:S5(u),setFocus:c,autoFocusDelay:t,label:"",isRequired:!!e.required,value:d,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",onChangeHandler:o,maxLength:18,showCount:!0,onKeyDownHandler:s,surveyLayout:r,translationVariables:l}):n.createElement(ra,{startAdornment:u&&"TEXT"!==u&&n.createElement(I,{fill:"var(--choices-answers-color, var(--question-text-color, var(--default-question-text-color)))",name:E5(u)}),type:S5(u),setFocus:c,autoFocusDelay:t,showCount:!0,label:"",onKeyDown:s,isRequired:!!e.required,isErrored:!!i[e.name],errorText:i[e.name]||"",placeholder:e?.type_info?.meta?.placeholder??"",..."card"===r?{value:d??"",onChange:e=>o(e.target.value)}:{onBlur:e=>{(_n(d)||Dn(d))&&(_n(b)||Dn(b))||b===d||o?.(e.target.value,!0)},value:b??"",onChange:e=>M(e.target.value)},maxLength:50,isQuestionBgDark:p}))},N5=({surveyLanguage:e,language:t="en",question:a,formValues:o,othersMeta:i,onChangeHandler:r,saveOthersValue:c,autoFocusDelay:s,isFinalQn:l,isWidget:p,isMobile:u,initialPivotAnswer:d,initialQuestionAnswer:b,isInitialTransition:M,formQuestionErrors:z,dateQuestionErrors:m,contactFormErrors:h,activeIndexOfRenderedStatement:f={},textboxQuestionErrors:O,isReverseAnimation:A,fileUploadErrors:v,preview:g,onFileUpload:y,widgetStyle:q="default",setErrors:W,translationVariables:w,surveyServAssetUrl:R,setFocus:L,block:C,onKeyDown:x,surveyStyle:k,isQuestionBgDark:S})=>{const E=a?.type_info?.question_comment,T=a?.type_info?.footer_text&&a.type_info.meta?.question_hint?n.createElement("div",{className:"footer question-hint ss-question-hint",role:"note",dangerouslySetInnerHTML:{__html:a?.type_info?.footer_text}}):n.createElement(n.Fragment,null),N=o[a.name],[P,$]=n.useState(N);switch(n.useEffect((()=>{P&&!N&&$(N)}),[N]),a?.type_info?.question_type){case"MATRIX_RATING_SCALE":return n.createElement(n.Fragment,null,p||u?n.createElement(C5,{language:t,name:a.name,isReverseAnimation:A,type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},isMobile:u,value:o[a.name]||[],statementIndex:f[a.name]??0,widgetStyle:q}):n.createElement(L5,{type_info:a?.type_info||{},onChangeHandler:e=>{r(e?.filter((e=>(e.rating_labels||[]).length>0)))},value:o[a.name]||[]}),T);case"RANGE":return n.createElement(n.Fragment,null,n.createElement(rS,{question:a,onChangeHandler:r,isWidget:p,isMobile:u,widgetStyle:q,value:o[a.name],initialPivotAnswer:d,isInitialTransition:M}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"CHECKBOX":case"MULTI_SELECT":return n.createElement(n.Fragment,null,n.createElement(EP,{name:a.name,values:o[a.name],othersValue:i[a.name],options:a?.choices||[],onChangeHandler:r,saveOthersValue:c,isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),othersRequired:!!a?.type_info.meta?.othersRequired,autoFocusDelay:s,translationVariables:w,othersInputPlaceholder:a?.type_info?.comment_placeholder}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"RADIO":case"DROPDOWN":return n.createElement(n.Fragment,null,n.createElement(aS,{autoFocusDelay:s,name:a.name,onChangeHandler:r,initialQuestionAnswer:b,displayFormat:a?.type_info?.meta?.display_format||"LIST",saveOthersValue:c,options:a?.choices||[],value:o[a.name],othersValue:i[a.name],isOthersOption:!!(a?.choices||[]).find((e=>e.meta?.is_others)),language:t||"en",othersRequired:!!a?.type_info.meta?.othersRequired,isFinalQn:l,translationVariables:w,isQuestionBgDark:S,othersInputPlaceholder:a?.type_info?.comment_placeholder}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"TEXT":return n.createElement(n.Fragment,null,n.createElement(T5,{question:a,autoFocusDelay:s,formValues:o,onChangeHandler:r,textboxErrors:O||"",setFocus:L,onKeyDownHandler:x,surveyLayout:k??"card",translationVariables:w,isQuestionBgDark:S}),T);case"NUMBER":return n.createElement(n.Fragment,null,n.createElement(x5,{question:a,autoFocusDelay:s,formValues:o,setFocus:L,onChangeHandler:r,surveyLayout:k??"card",isQuestionBgDark:S}),T);case"FORM_FIELD":return n.createElement(n.Fragment,null,n.createElement($3,{widgetStyle:q,question:a,isWidget:p,isMobile:u,surveyStyle:k,isRequired:!!a.required,autoFocusDelay:s,translationVariables:w,onChangeHandler:(e,t)=>{r(e,"card"!==k&&t)},formValues:o,fieldErrors:z?.[a.name]||{},language:t||"en",isQuestionBgDark:S}),T);case"CONTACT_FORM":return n.createElement(n.Fragment,null,n.createElement(NP,{question:a,setFocus:L,autoFocusDelay:s,onChangeHandler:r,translationVariables:w,formValues:o,fieldErrors:h?.[a.name]||{},language:t||"en",isQuestionBgDark:S}),T);case"PARAGRAPH":return n.createElement(n.Fragment,null,n.createElement(DN,{showCount:!0,maxLength:1500,autoFocusDelay:s,isRequired:!!a.required,placeholder:a?.type_info?.meta?.placeholder??"",..."card"===k?{value:N??"",onChange:e=>r(e.target.value)}:{onBlur:e=>{(_n(N)||Dn(N))&&(_n(P)||Dn(P))||P===N||r?.(e.target.value,!0)},value:P??"",onChange:e=>$(e.target.value)},setFocus:L,isQuestionBgDark:S,"aria-label":a.name}),T);case"BOOLEAN":return n.createElement(n.Fragment,null,n.createElement(F,{type_info:a?.type_info,onSelect:r,value:o[a.name]}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"MESSAGE":return T;case"CONSENT":return n.createElement(n.Fragment,null,n.createElement(TP,{question:a,onChange:r,value:o[a.name]}),T);case"SLIDER":const e=a?.type_info.meta?.slider;return n.createElement(n.Fragment,null,n.createElement(HN,{defaultValue:[o[a.name]??e?.opening_position],isRequired:!!a.required,dir:In(t)?"rtl":"ltr",answer:o[a.name],min:e?.min,max:e?.max,onValueChange:([e],t)=>r(e,"card"!==k&&t),isInput:e?.numerical_input_box,gridLines:e?.grid_lines,stopAtGrid:e?.stop_at_grid_lines,allowDecimals:e?.allow_decimal,decimalPoints:e?.decimal_points,isMobile:u||"compact"===q}),E&&null!=o[a.name]&&n.createElement(k5,{question:a,questionCommentOnchangeHandler:c,commentsMeta:i?.[a?.name],surveyStyle:k,setFocus:L,isQuestionBgDark:S,isCommentsEnabled:E}),T);case"RANK_ORDER":const{others_meta:v,...C}=o;return n.createElement(n.Fragment,null,n.createElement(VT,{valueItems:C[a.name],items:a?.choices||[],onReorder:(e,t)=>r(e,"card"!==k&&t)}),T);case"DATE_TIME":return n.createElement(n.Fragment,null,"DATE_TIME"===a.type_info.meta?.question_format?n.createElement(sq,{id:a.id??"",name:a.name??"",type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,useAmPm:!a.type_info.meta?.time_format,showTimezoneSelect:!!a.type_info.meta?.time_zone,onChange:(e,t)=>{r(e,"card"!==k&&t)},setErrors:e=>{W((t=>({...t,dateQuestionErrors:e})))},fieldErrors:m?.[a.name]??[],value:o[a.name]||"",translationVariables:w,language:t||"en",isQuestionBgDark:S,isWidget:p}):n.createElement(cq,{allowOnlyFuture:a.type_info.meta?.allow_future_date||!1,type:"QUESTION",displayFormat:a.type_info.meta?.format??void 0,onChange:e=>{r(e,!1)},value:o[a.name]||"",translationVariables:w,language:t||"en",fieldErrors:m?.[a.name]??[],isQuestionBgDark:S,isWidget:p}),T);case"FILE":return n.createElement(N3,{setErrors:e=>{W({formQuestionErrors:z,textboxQuestionErrors:O,contactFormErrors:h,fileUploadErrors:e,dateQuestionErrors:m})},preview:g,onChangeHandler:r,question:a,onFileUpload:y,value:o[a.name]||"",translationVariables:w,surveyServAssetUrl:R});default:return console.error(`Question type ${a?.type_info?.question_type} not found`),null}},P5=({surveyServAssetUrl:e,thankYouQuestion:a,preview:o,placeholders:i,canResubmit:r,resetSurvey:c,navigateToStart:s,isMobile:l,allowMultipleSubmission:p,pivot:u,answers:d,questions:b,rangeToRender:M,translationVariables:z})=>{const{redirectUrl:m,redirectDelay:h,show_custom_button:f,show_review_links:O,show_social_links:A,image_url:v}=a?.type_info?.meta??{},[g,y]=t.useState(h??10),[q,W]=n.useState(!1);return t.useEffect((()=>{if(!o&&m){const e=setInterval((()=>y((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=m??""),0)))),1e3);return()=>{clearInterval(e),W(!1)}}return()=>{W(!1)}}),[]),n.createElement("div",{className:"question-container ss-question-container thankyou"},v&&n.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:v,alt:"thankyou_logo"}),n.createElement(n.Fragment,null,jn(a)),n.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:Un({questionText:a.text,placeholders:i,npsRating:Gn({theme:"nps",answers:d,questions:b})??"",npsRatingLabel:Yn({theme:"nps",answers:d,questions:b}),csatRating:Gn({theme:"csat",answers:d,questions:b})??"",csatRatingLabel:Yn({theme:"csat",answers:d,questions:b}),cesRating:Gn({theme:"ces",answers:d,questions:b})??"",cesRatingLabel:Yn({theme:"ces",answers:d,questions:b}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:o})}}),(r||p)&&n.createElement("div",{className:("wrap-up-actions "+(l?"mobile":"")).trim()},r&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),s()},"aria-label":z?.edit_response||"Edit your response"},n.createElement(I,{name:"edit"}),z?.edit_response||"Edit your response"),p&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),c()},"aria-label":z?.another_response||"Submit another response"},n.createElement(I,{name:"reload"}),z?.another_response||"Submit another response")),m&&n.createElement("div",{className:"redirection-container"},n.createElement("div",{className:"redirection-text"},Qn(g,z?.redirect_msg),n.createElement("br",null)),n.createElement("a",{className:"link",href:m},m)),(f||O||A)&&n.createElement(SP,{show_custom_button:f,show_review_links:O,show_social_links:A,surveyServAssetUrl:e}))},$5=({activeIndexOfRenderedStatement:e,navigateToPreviousBlock:t,canDisplayDisableButtonParams:a,navigateToNextBlock:o,translationVariables:i,setAnimationInProgress:r,animationInProgress:c,question:s})=>n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:c||MP("navigation-prev",a),className:"navigation-button ss-navigation-button",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),q),t()},title:s.name&&(e?.[s.name]??0)>0?i?.prev_statement||"go to previous statement":i?.prev_question||"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||MP("navigation-next",a),title:i?.next_question||"Go to next question",onClick:()=>{r(!0),setTimeout((()=>{r(!1)}),q),o()}},n.createElement(I,{name:"arrow-next"}))),B5=e=>{const{initialStatementHasAnswer:a,answers:o,renderedBlocks:i,blocks:r,activeIndexOfBlocks:c,activeIndexOfRenderedStatement:s={},activeIndexOfRenderedBlocks:l,saveFormValues:p,onSubmitHandler:u,skipBlock:d,skipStatement:b,survey:M,navigateToNextBlock:z,navigateToPreviousBlock:m,isInitialTransition:h,initialPivotAnswer:f,translationVariables:O,navigateToNextStatement:A,canDisplayDisableButtonParams:v,formQuestionErrors:g,dateQuestionErrors:y,textboxQuestionErrors:W,contactFormErrors:w,questions:R,pages:L,buttonRef:C,isReverseAnimation:x,isSubmitting:k}=e,[S,E]=t.useState(!1),{question:N}=i[l],P={...v,isSubmitting:k},$=N?.type_info?.meta?.display_format,B=YN({blocks:r,activeIndexOfBlocks:c,renderedBlocks:i,activeIndexOfRenderedBlocks:l,questions:R});return n.createElement(n.Fragment,null,(lP("message",P)||lP("consent",P))&&n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{key:N.name??"",id:`consent-buttons-${N.name??""}`,className:"question-consent-buttons ss-consent-action-buttons",initial:{opacity:0,x:Vn(e.language,x)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(e.language,x)},transition:{duration:.2}},lP("consent",P)&&"BUTTON"===$&&T.map((e=>n.createElement(G,{key:l+String(e.recordAs),onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),p(i[l],e.recordAs,!0)},disabled:S||MP("consent",P),variant:_n(o.formValues?.[N.name])||o.formValues?.[N.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(o.formValues?.[N.name]===e.recordAs?"selected":"")).trim()},N?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue))),lP("message",P)&&n.createElement(G,{onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),B?u("COMPLETE"):d()},disabled:S||MP("message",P),className:"message-button ss-action-message-button"},N?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"))),(lP("navigation",P)||lP("next",P)||lP("next-statement",P)||lP("submit",P)||lP("skip",P)||lP("skip-statement",P))&&n.createElement("div",{className:"question-footer ss-question-footer-container"},lP("navigation",P)?n.createElement($5,{animationInProgress:S,setAnimationInProgress:E,answers:o,canDisplayDisableButtonParams:P,activeIndexOfBlocks:c,activeIndexOfRenderedBlocks:l,renderedBlocks:i,initialStatementHasAnswer:a,blocks:r,activeIndexOfRenderedStatement:s,navigateToNextBlock:z,navigateToPreviousBlock:m,translationVariables:O,pages:L,question:N}):n.createElement("div",null),n.createElement("div",{className:"action-buttons ss-action-buttons"},lP("skip",P)&&n.createElement(G,{className:"skip-button ss-action-skip-button",onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),d()},variant:"secondary","aria-label":"skip question",disabled:S||k},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),lP("skip-statement",P)&&n.createElement(G,{className:"skip-button ss-action-skip-button",onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),b()},"aria-label":"skip statement",variant:"secondary",disabled:S||k},e?.survey?.meta?.action_button?.skip||O?.actionButtonText?.skip||O?.skip||"Skip"),lP("next",P)&&n.createElement(G,{ref:C,onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),0!==l||!h||"RANGE"!==N.type_info?.question_type&&"BOOLEAN"!==N.type_info?.question_type||N.type_info?.question_comment||void 0===f?p(i[l],"CHECKBOX"===N?.type_info?.meta?.display_format&&"CONSENT"===N?.type_info?.question_type?o.formValues[N.name]??!1:o.formValues[N.name],!0):p(i[l],f,!0)},disabled:S||MP("next",P),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),lP("next-statement",P)&&n.createElement(G,{ref:C,onClick:()=>{E(!0),setTimeout((()=>{E(!1)}),q),A?.(N.name)},disabled:S||!!MP("next-statement",P),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||O?.actionButtonText?.next||O?.next||"Next"),lP("submit",P)&&n.createElement("div",{className:"submit ss-action-submit-button"},n.createElement(G,{ref:C,disabled:S||MP("submit",P),onClick:()=>{Dn(y?.[N.name])&&Dn(g?.[N.name])&&Dn(W?.[N.name])&&Dn(w?.[N.name])&&(E(!0),setTimeout((()=>{E(!1)}),q),u("COMPLETE"))}},M?.meta?.action_button?.submit||O?.actionButtonText?.submit||O?.submit_survey||"Submit")))))},_5=e=>{const{blocks:a,pages:o,activePage:i,renderedBlocks:r,activeBlock:c,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:l,isSurveyCompleted:p,isReverseAnimation:u,saveFormValues:d,saveOthersValue:b,skipBlock:M,skipStatement:z,onSubmitHandler:m,navigateToNextBlock:h,navigateToPreviousBlock:f,answers:O,questions:A,pivot:v,isInitialTransition:g,resetSurvey:y,activeIndexOfRenderedStatement:q,navigateToNextStatement:W,navigateToPreviousStatement:w,navigateToStart:R,translationVariables:L,initialStatementHasAnswer:C,dateQuestionErrors:x,formQuestionErrors:k,textboxQuestionErrors:S,contactFormErrors:E,fileUploadErrors:T,setErrors:N,expanded:P,setExpanded:$,isQuestionBgDark:B,isSubmitting:_}=RP(e);aa("Card",{...e,answers:O,activePage:i,activeBlock:c,renderedBlocks:r,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:l,activeIndexOfRenderedStatement:q});const H=t.useRef(null),D=Dn(O.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[I,V]=t.useState(D),X=n.useMemo((()=>Fn(v?.question)),[v?.question]),j=t.useMemo((()=>a.filter((({name:e},t,n)=>!eP({nextBlockName:e||"",blocks:n,questions:A}))).length),[a,A]);t.useEffect((()=>{c&&e.onBlockChange?.(c,i)}),[c,e]),t.useEffect((()=>{e.survey.theme&&Zn(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),t.useEffect((()=>{e.getSurveyProgress?.({totalBlocks:j,isSurveyCompleted:p,noOfAnswers:s})}),[j,p,s]);const F={answers:O,blocks:a,blockIndex:l,activeIndexOfBlocks:s,initialStatementHasAnswer:C,activeIndexOfRenderedBlocks:l,activeIndexOfRenderedStatement:q,renderedBlocks:r,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:g,questions:A,pages:o,activeIndexOfSet:0,branchSeparatePage:!1};return c&&c.question?n.createElement("div",{className:`freemium-survey-components card-survey-style ${In(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""}`.trim(),id:"freemium-survey"},n.createElement("div",{className:("question-holder "+(I?"prompt":"")).trim()},!p&&!I&&!e.isWidget&&o.length>0&&i?.page_id&&n.createElement(LP,{expanded:P,id:i.page_id,setExpanded:$,activePage:i,translationVariables:L}),n.createElement("div",{className:"questions ss-questions"},p?n.createElement(P5,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:ZN({pivotQn:v?.question,pivotQnAnswer:v?.answer,block:tP({activeBlock:c,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:O,questions:A,activeIndexOfBlocks:s,renderedBlocks:r,contactData:e.contactData,surveyLayout:"card",pages:o}),questions:A}),canResubmit:e.canResubmit,allowMultipleSubmission:e.allowMultipleSubmission,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",R):R()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",y):y()},preview:!!e.preview,placeholders:e.placeholders,isMobile:e.isMobile,pivot:v,rangeToRender:X,translationVariables:L,answers:O}):n.createElement(n.Fragment,null,!I&&e.isWidget&&o.length>0&&i?.page_id&&n.createElement(LP,{expanded:P,id:i.page_id,setExpanded:$,activePage:i,translationVariables:L}),n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{id:`${c.question.name}`,className:"question-container ss-question-container","data-test-question-name":c.question.name,key:`${c.question.name}`,initial:{opacity:0,x:Vn(e.language,u)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(e.language,u)},transition:{duration:.2}},I&&e.survey.prompt_settings?n.createElement(xP,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&V(!1)},placeholders:e.placeholders,isPreview:!!e.preview}):n.createElement(n.Fragment,null,n.createElement("div",{className:("question-text ss-question-text "+(c.required?"required":"")).trim(),dangerouslySetInnerHTML:{__html:Un({questionText:c?.question.text,placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:O,questions:A})??"",npsRatingLabel:Yn({theme:"nps",answers:O,questions:A}),csatRating:Gn({theme:"csat",answers:O,questions:A})??"",csatRatingLabel:Yn({theme:"csat",answers:O,questions:A}),cesRating:Gn({theme:"ces",answers:O,questions:A})??"",cesRatingLabel:Yn({theme:"ces",answers:O,questions:A}),preference:v?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${l}`,role:"heading","aria-level":1}),n.createElement(N5,{setFocus:!0,onKeyDown:e=>{"Enter"===e.key&&H.current&&H.current.click()},isReverseAnimation:u,preview:!!e.preview,surveyServAssetUrl:e.surveyServAssetUrl,setErrors:N,onFileUpload:e.onFileUpload,language:e.language||"en",surveyStyle:e.surveyStyle,surveyLanguage:e.survey.language,block:c,question:c.question,isFinalQn:YN({blocks:a,activeIndexOfBlocks:s,renderedBlocks:r,activeIndexOfRenderedBlocks:l,questions:A}),formValues:O.formValues,othersMeta:O.others,autoFocusDelay:"standard"===e.surveyStyle?350:0,activeIndexOfRenderedStatement:q,saveOthersValue:b,onChangeHandler:(e,t)=>{d(c,e,t)},isMobile:!!e.isMobile,initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,isInitialTransition:g,formQuestionErrors:k,dateQuestionErrors:x,textboxQuestionErrors:S,fileUploadErrors:T,contactFormErrors:E,translationVariables:L,isQuestionBgDark:B})))),!I&&n.createElement(B5,{isWidget:!1,language:e.language||"en",isReverseAnimation:u,surveyStyle:e.surveyStyle,canDisplayDisableButtonParams:F,answers:O,renderedBlocks:r,blocks:a,pages:o,activeIndexOfRenderedStatement:q,buttonRef:H,survey:e.survey,initialStatementHasAnswer:C,navigateToNextStatement:W,navigateToPreviousStatement:w,activeIndexOfRenderedBlocks:l,activeIndexOfBlocks:s,saveFormValues:d,skipBlock:M,skipStatement:z,onSubmitHandler:m,navigateToPreviousBlock:f,navigateToNextBlock:h,isInitialTransition:g,initialPivotAnswer:e.initialPivotAnswer,isMobile:!!e.isMobile,translationVariables:L,formQuestionErrors:k,dateQuestionErrors:x,textboxQuestionErrors:S,fileUploadErrors:T,contactFormErrors:E,questions:A,isSubmitting:_})))),!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)?n.createElement(pa,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??kP}):null):null},H5=e=>{const a=!!e.survey.meta?.branch_separate_page,o=e.survey.question_details?.questions||[],i=e.contactData||{},r=e.translationVariables||{},c=t.useRef({}),[s,l]=t.useState(e.survey?.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),[p,u]=t.useState({formQuestionErrors:{},textboxQuestionErrors:{},fileUploadErrors:{},contactFormErrors:{},dateQuestionErrors:{}}),[d,b]=t.useState(!1),[M,z]=t.useState(0),[m,h]=t.useState(e.survey.pages??[]),[f,O]=t.useState(m?.[0]),[A,v]=t.useState(!1),g=t.useMemo((()=>fP({pages:m,blocks:s,questions:o,initialPivotAnswer:e.initialPivotAnswer,responses:e.answers,answerStatus:e.answerStatus||"PARTIAL",branchSeparatePage:a,surveyLayout:"standard",contactData:i})),[s,o,e.answers]),[y,q]=t.useState(g.renderedBlocks),[w,R]=t.useState(g.activeIndexOfRenderedBlocks),[L,C]=t.useState(0),[x,k]=t.useState(g.activeIndexOfRenderedStatement),S=t.useRef(g.pivot),E=t.useRef(g.isInitialTransition),[T,N]=t.useState(""),[P,$]=t.useState(g.answers),B=t.useRef(((g.isConsideredCompleted||"PARTIAL"===e.answerStatus)&&e.canResubmit)??!1),[_,H]=t.useState(!1),D=y[w],I=n.useMemo((()=>y.length>0?s?.findIndex((e=>e.name===y[w]?.name)):0),[w]),V=t.useMemo((()=>{const t=e.survey.theme?.palette?.question_background;return!!t&&oa(t)}),[e.survey.theme?.palette?.question_background]);t.useEffect((()=>{e.survey.updated_at!==T&&(aa("useEffect",{updated_at:e.survey.updated_at,props:e}),h(e.survey.pages??[]),l(e.survey.blocks?.filter((e=>"TY"!==e.name&&!e.is_deleted))),O(e.survey.pages?.[0]),N(e.survey.updated_at??""))}),[e.survey.updated_at]),t.useEffect((()=>{aa("useEffect",{renderedBlocks:y,pages:m,activeIndexOfRenderedBlocks:w,props:e});const t=y?.[w]?.page_id,n=m.find((e=>e.page_id===t));m.length>0&&t&&n?.page_id&&O(n),void 0!==y?.[w]?.orderOfSet&&a&&C(y?.[w]?.orderOfSet)}),[y,m,w]),t.useEffect((()=>{aa("useEffect",{blocks:s,initialPivotAnswer:e.initialPivotAnswer,props:e});let t={...P};if(g.isConsideredCompleted&&E.current&&e.canResubmit)return;const{others_meta:n,...r}=e.answers||{};S.current={...S.current,question:FN({questions:o,blocks:s})};const l=o.find((e=>e.name===s?.[0]?.question_name||e.name===s?.[0]?.question_names?.[0]))??S.current.question;if(Dn(r)||void 0===e.initialPivotAnswer||r[l.name]===e.initialPivotAnswer||(t={...P,formValues:{...P.formValues,[l.name]:e.initialPivotAnswer},moveToNextPage:!0}),void 0!==e.initialPivotAnswer){const n=UN(S.current.question,e.initialPivotAnswer);S.current={...S.current,answer:"BOOLEAN"===l?.type_info?.question_type?Boolean(n):n},t={...P,formValues:{...P.formValues,[l.name]:S.current.answer},moveToNextPage:!1}}else void 0!==e.initialQuestionAnswer&&(t={...P,formValues:{...P.formValues,[l.name]:e.initialQuestionAnswer},moveToNextPage:!1});$(t);const p=ZN({pivotQn:S.current.question,pivotQnAnswer:S.current.answer,block:s[0],questions:o}),u=mP({activeBlock:{...s[0],question:p},blocks:s,questions:o,answers:t,pages:m,renderedBlocks:y,contactData:i,surveyLayout:"standard",initialTransition:!0,isEditResponse:B.current,branchSeparatePage:a}),d=[{...s[0],question:p},...u];if(q(a?ia(d,c):d),(e=>{if(null==e||0===Object.keys(e).length)return!0;const t=Object.keys(e).filter((e=>""!==e&&!_n(e)&&"others_meta"!==e));return t.every((t=>!e[t]))&&(!e.others_meta||0===Object.keys(e.others_meta).length)})({others_meta:{},...t.formValues})||E.current)R(s.findIndex((e=>d[0].name===e.name))),C(0);else{const e=d?.[d.length-1];R(d.findIndex((t=>t.name===e?.name))),a&&C(e?.orderOfSet!==L?e?.orderOfSet:0)}k({})}),[s,e.initialPivotAnswer,M]);t.useEffect((()=>{if(aa("useEffect",{answers:P,blocks:s,props:e}),!(g.isConsideredCompleted&&E.current&&e.canResubmit)&&(!Dn(P.formValues)||P.moveToNextPage)&&s&&X(D,P.commitDirtyValue))if(sP({blocks:s,activeIndexOfBlocks:I,renderedBlocks:y,activeIndexOfRenderedBlocks:w,answers:P,questions:o,activePage:f,pages:m,surveyLayout:"standard"})){if(void 0!==e.initialPivotAnswer&&1===y.length&&E.current&&!P.commitDirtyValue);else if(P.commitDirtyValue){const t=iP({renderedBlocks:y,activeBlock:D,blocks:s,activeIndexOfBlocks:I,answers:P,questions:o,contactData:i,pages:m,surveyLayout:"standard",isDisplayBlock:!0});if(t!==1/0)E.current||!D.question.type_info?.question_type||D.question.type_info?.question_comment||["FORM_FIELD","MULTI_SELECT","RANK_ORDER"].includes(D.question.type_info?.question_type)?j():(e=>{e!==1/0&&setTimeout((()=>{const t=ZN({pivotQn:S.current?.question,pivotQnAnswer:S.current?.answer,block:s?.[e],questions:o});if(t?.name){const e=document?.querySelector(`.question-container.standard-card-${t.name}`),n=document?.querySelector(`.question-container.standard-card-${t.name} input`),a=document?.querySelector(`.question-container.standard-card-${t.name} textarea`);e?.scrollIntoView({behavior:"smooth",block:"center",inline:"start"}),setTimeout((()=>{n?.focus(),a?.focus()}),W)}j()}),0)})(t),(!P.moveToNextPage&&!a&&t&&t>0&&s[t-1]?.page_id===s[t]?.page_id||P.moveToNextPage)&&((e,t)=>{if(e===1/0)return;const n=s?.[e];let r=S.current?.question;n?.display_logic?.some((e=>"BASED_ON_RATING_GROUP"===e.logic_type))&&(r=FN({questions:o,blocks:s,displayLogic:n?.display_logic}));const l=ZN({pivotQn:r??S.current?.question,pivotQnAnswer:P?.formValues[r?.name]??S.current?.answer,block:n,questions:o}),p=zP({renderedBlocks:y,activeIndexOfRenderedBlocks:w}),u=s?.[e],d=mP({activeBlock:{...u,question:l},answers:P,blocks:s,questions:o,pages:m,renderedBlocks:y,contactData:i,surveyLayout:"standard",isEditResponse:B.current,branchSeparatePage:a}),b=[...p,...l?.name?[{...u,question:l}]:[],...d];k((e=>{const t={...e};return b.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const M=a?ia(b,c):b;q(M),t||R(p.length)})(t,!P.moveToNextPage&&!a);else{lP("submit",{answers:P,blocks:s,blockIndex:0,activeIndexOfBlocks:I,initialStatementHasAnswer:U,activeIndexOfRenderedBlocks:w,activeIndexOfRenderedStatement:x,renderedBlocks:y,activePage:f,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:E.current,questions:o,pages:m,contactData:e.contactData,activeIndexOfSet:L,branchSeparatePage:a,isSubmitting:A})||j("COMPLETE")}}}else("MATRIX_RATING_SCALE"===D?.question?.type_info?.question_type||P.commitDirtyValue)&&j()}),[P,s]);const X=(e,t)=>{if(e?.question_name)switch(e.question?.type_info?.question_type){case"DATE_TIME":return!t||vP({answer:P.formValues?.[e.question_name]||"",errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"FORM_FIELD":return AP({fields:e.question?.type_info?.form_fields?.fields,answers:P.formValues?.[e.question_name]||{},errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"TEXT":return gP({type:e.question?.type_info?.text_field?.text_type,answer:P.formValues?.[e.question_name]||"",errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"CONTACT_FORM":return yP({fields:e.question?.type_info?.contact_form?.fields,answers:P.formValues?.[e.question_name]||{},errorSetter:u,questionName:e.question_name,errors:p,translationVariables:r});case"FILE":return qP({errors:p.fileUploadErrors})||!e.required}return!0},j=(t="PARTIAL")=>{let n=()=>{},a=0;if(y.some(((e,t)=>(a=t,!X(e,!0)))))return void R(a);let r={...P.formValues};if("COMPLETE"===t){v(!0),n=()=>{v(!1),H(!0),B.current=!1};r=WP({pages:m,answers:{...P,formValues:r},blocks:s,questions:o,contactData:i,surveyLayout:"standard"})}e.onSubmit({...r,others_meta:P.others},n,t,B.current?"EDIT":"CREATE")},F=e=>{k((t=>({...t,[e]:(_n(t[e])?0:t[e])+1})))},U=n.useMemo((()=>{if("MATRIX_RATING_SCALE"!==D?.question?.type_info?.question_type)return!1;const e=D?.question?.type_info?.matrix_properties?.statements||[],t=e?.[x?.[D?.question.name]]??0,n=(P.formValues[D?.question.name]||[]).find((e=>e.statement_id===t?.id));return(n?.rating_labels||[]).length>0}),[x,w]),G=()=>{const e=m.findIndex((e=>e.page_id===f?.page_id));let t=1,n=m?.[e+t];for(;!y.map((e=>e.page_id)).includes(n?.page_id)&&e+t<m.length;)n=m?.[e+ ++t];const a=y.find((e=>e.page_id===n?.page_id));n?.page_id&&O(n),"number"==typeof a?.orderOfSet&&C(a.orderOfSet);const o=y.findIndex((e=>e.page_id===n?.page_id));-1!==o&&R(o)},Y=()=>{const e=m.findIndex((e=>e.page_id===f?.page_id));let t=1,n=m?.[e-t];for(;!y.map((e=>e.page_id)).includes(n?.page_id)&&t>=0;)n=m?.[e-++t];const a=[...y];let o=a.pop();for(;o?.page_id!==n.page_id;)o=a.pop();n?.page_id&&O(n),"number"==typeof o.orderOfSet&&C(o.orderOfSet)};return{blocks:s,pages:m,navigateToNextSet:()=>{const e=y.find((e=>e.orderOfSet===L+1));if(e){a&&void 0!==e?.orderOfSet&&C(e?.orderOfSet);const t=m.find((t=>t.page_id===e?.page_id));t?.page_id&&O(t),$((e=>({...e,moveToNextPage:!0})))}else G()},navigateToPreviousSet:()=>{const e=y.find((e=>e.orderOfSet===L-1));if(e){a&&void 0!==e?.orderOfSet&&C((e=>e-1));const t=m.find((t=>t.page_id===e?.page_id));t?.page_id&&O(t)}else Y()},activePage:f,questions:o,renderedBlocks:y,initialStatementHasAnswer:U,activeBlock:D,activeIndexOfBlocks:I,activeIndexOfRenderedBlocks:w,activeIndexOfRenderedStatement:x,navigateToNextStatement:F,navigateToPreviousStatement:e=>{k((t=>({...t,[e]:(_n(t[e])?0:t[e])-1})))},isInitialTransition:E.current,isSurveyCompleted:_,pivot:S.current,answers:P,translationVariables:r,...p,setErrors:u,saveFormValues:(e,t,n=!1,a=w)=>{if(A)return;E.current=!1,e.question.name===S.current?.question.name&&(S.current={...S.current,answer:"BOOLEAN"===S.current?.question?.type_info?.question_type?Boolean(t):t}),a!==w&&R(a);const o={...P,formValues:{...P.formValues,[e.question.name]:"BOOLEAN"===e.question?.type_info?.question_type?Boolean(t):t},commitDirtyValue:n,moveToNextPage:!1};hP((({renderedBlocks:e,activeIndexOfRenderedBlocks:t})=>zP({renderedBlocks:e,activeIndexOfRenderedBlocks:t}).map((({question:e})=>e)))({renderedBlocks:y,activeIndexOfRenderedBlocks:a}),o),B.current&&(e.category??[]).length>0&&(e.category?.forEach((e=>{e.question_name&&(o.formValues[e.question_name]=null)})),o.formValues[e.question.name]=t),$(o);const i=y[a];"SINGLE_ANSWER"===i.question.type_info?.matrix_properties?.type&&(x?.[i.question.name]??0)<(i.question?.type_info?.matrix_properties?.statements||[]).length-1&&setTimeout((()=>{F?.(i.question.name)}),0)},saveOthersValue:(e,t,n=w)=>{if(n!==w&&R(n),null===t){const t={...P.others};delete t[e],$({...P,commitDirtyValue:!1,others:t,moveToNextPage:!1})}else $({...P,commitDirtyValue:!1,others:{...P.others,[e]:t},moveToNextPage:!1})},clearRadioSelection:e=>{R(e);const t=y[e].question;t.type_info?.pivot_question&&(S.current={question:t,answer:void 0}),delete P.formValues[t.name],delete P.others[t.name],"DATE_TIME"===t.type_info?.question_type&&p.dateQuestionErrors?.[t.name]&&u((e=>{const n={...e.dateQuestionErrors};return delete n[t.name],{...e,dateQuestionErrors:n}}));const n=(({renderedBlocks:e,answers:t})=>{const n=e.reduce(((e,n)=>(n?.question?.name&&void 0!==t.formValues[n.question.name]&&(e[n.question.name]=t.formValues[n.question.name]),e)),{});return{...t,formValues:n}})({renderedBlocks:y,answers:P}),r={...n,formValues:{...n.formValues},moveToNextPage:!1,commitDirtyValue:!1},l=mP({activeBlock:y[e],blocks:s,questions:o,answers:r,pages:m,renderedBlocks:y,contactData:i,surveyLayout:"standard",isEditResponse:B.current,branchSeparatePage:a});k((e=>{const t={...e};return l.forEach((e=>{"MATRIX_RATING_SCALE"===e.question.type_info?.question_type&&(t[e.question.name]=0)})),t}));const d=[...y.slice(0,e+1),...l];q(a?ia(d,c):d),$(r)},onSubmitHandler:j,navigateToStart:()=>{B.current=!0,H(!1),k({}),R(0),a&&("number"==typeof y?.[0].orderOfSet?C(y?.[0].orderOfSet):C(0))},isValidQuestion:X,resetSurvey:()=>{H(!1),z((e=>e+1)),$({formValues:{},others:{},commitDirtyValue:!1,moveToNextPage:!1}),wP(localStorage)},moveToNextPage:e=>{const t={};e&&m.length>0&&y.forEach((e=>{f?.page_id!==e.page_id||a&&L!==e.orderOfSet||"MESSAGE"===e.question.type_info?.question_type||(t[e.question.name]=null)})),Dn(P.formValues??{})&&m.length>0&&y.forEach((e=>{f?.page_id!==e.page_id||a&&L!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(t[e.question.name]=null)}));const n=y.filter((e=>f?.page_id===e?.page_id)),o=n[n.length-1],i=y.findIndex((e=>e.name===o?.name));w!==i&&R(i),setTimeout((()=>{$((e=>({...e,formValues:{...e.formValues,...t},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},moveToNextSet:e=>{let t=0;if(y.some(((e,n)=>(t=n,!X(e,!0)))))return void R(t);const n={};y.forEach((t=>{f?.page_id!==t.page_id||a&&L!==t.orderOfSet||!e&&void 0!==P.formValues[t.question.name]||(n[t.question.name]=null)})),Dn(P.formValues??{})&&m.length>0&&y.forEach((e=>{f?.page_id!==e.page_id||a&&L!==e.orderOfSet||"MESSAGE"!==e.question.type_info?.question_type||(n[e.question.name]=null)}));const o=y.filter((e=>f?.page_id===e?.page_id&&(!a||L===e.orderOfSet))),i=o[o.length-1],r=y.findIndex((e=>e.name===i?.name));R(r),setTimeout((()=>{$((e=>({...e,formValues:{...e.formValues,...n},commitDirtyValue:!0,moveToNextPage:!0})))}),0)},setIsSubmitting:v,isSubmitting:A,expanded:d,setExpanded:b,activeIndexOfSet:L,setActiveRenderedBlockIndex:R,isQuestionBgDark:V}},D5=["next","next-statement","next-page","next-set","skip","skip-statement","skip-page","skip-set","submit","navigation","set-navigation","clear-selection","message","consent","navigation-prev","navigation-next","navigation-page-prev","navigation-page-next","previous-matrix-statement","next-matrix-statement","navigation-set-prev","navigation-set-next"],I5=({translationVariables:e,canDisplayDisableButtonParams:t,navigateToNextSet:a,navigateToPreviousSet:o})=>n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:MP("navigation-set-prev",t),className:"navigation-button ss-navigation-button",onClick:o,title:e?.prev_question??"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:MP("navigation-set-next",t),title:e?.next_question||"Go to next question",onClick:a},n.createElement(I,{name:"arrow-next"}))),V5=({surveyServAssetUrl:e,thankYouQuestion:a,preview:o,placeholders:i,canResubmit:r,allowMultipleSubmission:c,navigateToStart:s,resetSurvey:l,isMobile:p,pivot:u,answers:d,questions:b,rangeToRender:M,translationVariables:z})=>{const{redirectUrl:m,redirectDelay:h,image_url:f,show_custom_button:O,show_review_links:A,show_social_links:v}=a?.type_info?.meta??{},[g,y]=t.useState(h??10),[q,W]=n.useState(!1);return t.useEffect((()=>{if(!o&&m){const e=setInterval((()=>y((e=>e>1?e-1:("undefined"!=typeof window&&(window.location.href=m??""),0)))),1e3);return()=>{clearInterval(e),W(!1)}}return()=>{W(!1)}}),[]),n.createElement("div",{className:"thankyou-container"},n.createElement("div",{className:"question-container ss-question-container thankyou"},f&&n.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:f,alt:"thankyou_logo"}),n.createElement(n.Fragment,null,jn(a)),n.createElement("div",{className:"text ss-thankyou-message",dangerouslySetInnerHTML:{__html:Un({questionText:a.text,placeholders:i,npsRating:Gn({theme:"nps",answers:d,questions:b})??"",npsRatingLabel:Yn({theme:"nps",answers:d,questions:b}),csatRating:Gn({theme:"csat",answers:d,questions:b})??"",csatRatingLabel:Yn({theme:"csat",answers:d,questions:b}),cesRating:Gn({theme:"ces",answers:d,questions:b})??"",cesRatingLabel:Yn({theme:"ces",answers:d,questions:b}),preference:u?.question.type_info?.scale_properties?.labels?.preference,isPreview:o})}}),(r||c)&&n.createElement("div",{className:("wrap-up-actions "+(p?"mobile":"")).trim()},r&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),s()}},n.createElement(I,{name:"edit"}),z?.edit_response||"Edit your response"),c&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:q,onClick:()=>{W(!0),l()}},n.createElement(I,{name:"reload"}),z?.another_response||"Submit another response")),m&&n.createElement(n.Fragment,null,n.createElement("div",{className:"redirection-text"},Qn(g,z?.redirect_msg),n.createElement("br",null)),n.createElement("a",{className:"link",href:m},m)),n.createElement(SP,{show_custom_button:O,show_review_links:A,show_social_links:v,surveyServAssetUrl:e})))},X5=e=>{const{blockIndex:t,renderedBlocks:a,activeIndexOfRenderedBlocks:o,translationVariables:i,saveFormValues:r,answers:c,clearRadioSelection:s,canDisplayDisableButtonParams:l,navigateToNextStatement:p,navigateToPreviousStatement:u,isSubmitting:d,isMobile:b}=e,M={};D5.forEach((e=>{M[e]=!!lP(e,l)}));const z=a[t??o],{question:m}=z,h=m?.type_info?.meta?.display_format;return M?.consent||M?.["previous-matrix-statement"]||M?.["next-matrix-statement"]||M?.["clear-selection"]||M?.message?n.createElement("div",{className:"question-footer ss-question-footer-container"},n.createElement("div",null,(M?.["previous-matrix-statement"]||M?.["next-matrix-statement"])&&"MATRIX_RATING_SCALE"===m?.type_info?.question_type&&n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:MP("previous-matrix-statement",l),className:"navigation-button ss-navigation-button",onClick:()=>{u(m.name)},title:i?.prev_question??"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:MP("next-matrix-statement",l),title:i?.next_question||"Go to next question",onClick:()=>{p(m.name)}},n.createElement(I,{name:"arrow-next"})))),n.createElement("div",{className:("action-buttons ss-action-buttons "+(M.consent?"question-consent-buttons ss-consent-action-buttons":"")).trim()},M?.["clear-selection"]&&n.createElement(G,{className:"sec-button",variant:"secondary",onClick:()=>s(t),disabled:d},e?.survey?.meta?.action_button?.clear_selection||i?.actionButtonText?.clear_selection||i?.clear_selection||"Clear selection"),b&&"MATRIX_RATING_SCALE"===m.type_info?.question_type&&"MULTIPLE_ANSWERS"===m?.type_info?.matrix_properties?.type&&M?.["next-matrix-statement"]&&n.createElement(G,{disabled:MP("next-matrix-statement",l),className:"primary-button",variant:"primary",onClick:()=>{p(m.name)}},e?.survey?.meta?.action_button?.next||i?.actionButtonText?.next||i?.next||"Next"),M?.consent&&"BUTTON"===h&&T.map((e=>n.createElement(G,{key:o+String(e.recordAs),onClick:()=>{r(z,e.recordAs,!1,t)},disabled:MP("consent",l),variant:_n(c.formValues?.[m.name])||c.formValues?.[m.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(c.formValues?.[m.name]===e.recordAs?"selected":"")).trim()},m?.type_info?.scale_properties?.labels?.values?.[e.id]??e.defaultValue))))):null},j5=e=>{const{pages:a,activePage:o,navigateToNextSet:i,navigateToPreviousSet:r,isInitialTransition:c,blocks:s,renderedBlocks:l,activeBlock:p,activeIndexOfBlocks:u,activeIndexOfRenderedBlocks:d,isSurveyCompleted:b,translationVariables:M,saveFormValues:z,saveOthersValue:m,clearRadioSelection:h,onSubmitHandler:f,answers:O,questions:A,resetSurvey:v,initialStatementHasAnswer:g,navigateToStart:y,activeIndexOfRenderedStatement:q,navigateToNextStatement:W,navigateToPreviousStatement:w,pivot:R,formQuestionErrors:L,dateQuestionErrors:C,textboxQuestionErrors:x,contactFormErrors:k,fileUploadErrors:S,setErrors:E,isSubmitting:T,setIsSubmitting:N,moveToNextSet:P,expanded:$,setExpanded:B,activeIndexOfSet:_,isValidQuestion:H,setActiveRenderedBlockIndex:D,isQuestionBgDark:I}=H5(e);aa("Standard",{...e,answers:O,activePage:o,activeBlock:p,renderedBlocks:l,activeIndexOfSet:_,activeIndexOfBlocks:u,activeIndexOfRenderedBlocks:d,activeIndexOfRenderedStatement:q});const V=!!e.survey.meta?.branch_separate_page,X=t.useRef(null),j=t.useRef({}),F=t.useRef(null),U=t.useMemo((()=>Fn(R?.question)),[R?.question]),Y=t.useMemo((()=>s.filter((({name:e},t,n)=>!eP({nextBlockName:e||"",blocks:n,questions:A}))).length),[s,A]),Z=Dn(O.formValues)&&e.survey.prompt_settings?.is_enabled&&e.preview,[K,Q]=t.useState(Z),J=l.filter((e=>o?.page_id===e?.page_id));if(t.useEffect((()=>{const t=Object.values(O.formValues).filter((e=>"string"==typeof e&&""!==e.trim()||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)&&e.length>0||"object"==typeof e&&null!==e&&Object.keys(e).length>0)).length;e.getSurveyProgress?.({totalBlocks:Y,isSurveyCompleted:b,noOfAnswers:b||t>Y?Y:t})}),[Y,O,b]),t.useEffect((()=>{e.survey.theme&&Zn(e.survey.theme,e.surveyServAssetUrl??"")}),[e.survey.theme,e.surveyServAssetUrl]),t.useEffect((()=>{setTimeout((()=>{F.current&&Object.keys(O.formValues).length&&F.current?.scrollIntoView({inline:"start",block:"start",behavior:"smooth"})}),0),p&&e.onBlockChange?.(p,o)}),[o?.page_id]),!p||!p.question)return null;const{question:ee}=l[d],te={answers:O,blocks:s,blockIndex:0,activeIndexOfBlocks:u,initialStatementHasAnswer:g,activeIndexOfRenderedBlocks:d,activeIndexOfRenderedStatement:q,renderedBlocks:l,activePage:o,isMobile:!!e.isMobile,surveyStyle:e.surveyStyle,isWidget:!!e.isWidget,initialPivotAnswer:e.initialPivotAnswer,isInitialTransition:c,questions:A,pages:a,contactData:e.contactData,activeIndexOfSet:_,branchSeparatePage:V,isSubmitting:T,secBtnTxt:e.secBtnTxt},ne={};D5.forEach((e=>{ne[e]=!!lP(e,te)}));const ae=l[l.length-1];return n.createElement("div",{className:`freemium-survey-components ${In(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${e.isMobile?"mobile-preview":""} standard-survey-style`,id:"freemium-survey",ref:F},K&&e.survey.prompt_settings?n.createElement("div",{className:"questions ss-questions"},n.createElement("div",{className:"question-container ss-question-container"},n.createElement(xP,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt?.(t),1===t&&Q(!1)},placeholders:e.placeholders,isPreview:!!e.preview}))):n.createElement(n.Fragment,null,b?n.createElement(V5,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:ZN({pivotQn:R?.question,pivotQnAnswer:R?.answer,block:tP({activeBlock:ae,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:O,questions:A,activeIndexOfBlocks:s.findIndex((e=>e.name===ae.name)),renderedBlocks:l,contactData:e.contactData,surveyLayout:"standard",pages:a}),questions:A}),answers:O,preview:!!e.preview,placeholders:e.placeholders,pivot:{...R,question:R?.question||{name:""},answer:R?.answer},rangeToRender:U,canResubmit:e.canResubmit,isMobile:e.isMobile,allowMultipleSubmission:e.allowMultipleSubmission,translationVariables:M,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",(()=>{N(!1),y()})):(N(!1),y())},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",(()=>{N(!1),v()})):(N(!1),v())}}):n.createElement(n.Fragment,null,a.length>0&&o?.page_id&&n.createElement(LP,{expanded:$,id:o.page_id,setExpanded:B,activePage:o,translationVariables:M}),n.createElement("div",{className:("questions "+(e?.secBtnTxt?"sec-btn":"")).trim()},l.map(((t,i)=>{if(a.length>0&&o?.page_id!==t?.page_id||e.survey.meta?.branch_separate_page&&t.orderOfSet!==_)return null;const r=J.findIndex((e=>e.name===t.name)),b=iP({renderedBlocks:l,activeBlock:p,blocks:s,activeIndexOfBlocks:u,answers:O,questions:A,contactData:e.contactData,pages:a,surveyLayout:"standard"});return n.createElement(Kk.div,{id:t.question.name,key:t.question.name,ref:X,className:`question-container ss-question-container standard-card-${t.question.name}`,"data-test-question-name":p.question.name,initial:{opacity:0},animate:{opacity:1,x:0},exit:{opacity:0},transition:{duration:.2,delay:r?r/15:0},..."MULTI_SELECT"===p.question.type_info?.question_type&&b!==1/0&&-1!==b&&void 0!==O.formValues?.[t.question.name]&&j.current[t.question.name]!==O.formValues?.[t.question.name]?{onMouseLeave:()=>{z(t,O.formValues?.[t.question.name],!0,i),j.current[t.question.name]=O.formValues?.[t.question.name]}}:{}},n.createElement("div",{className:`question-text ss-question-text ${t.required?"required":""} ${0===i?"nps":""}`.trim(),dangerouslySetInnerHTML:{__html:Un({questionText:t.question.text,placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:O,questions:A})??"",npsRatingLabel:Yn({theme:"nps",answers:O,questions:A}),csatRating:Gn({theme:"csat",answers:O,questions:A})??"",csatRatingLabel:Yn({theme:"csat",answers:O,questions:A}),cesRating:Gn({theme:"ces",answers:O,questions:A})??"",cesRatingLabel:Yn({theme:"ces",answers:O,questions:A}),preference:R?.question.type_info?.scale_properties?.labels?.preference,isPreview:!!e.preview})},"aria-label":`question-${i}`,role:"heading","aria-level":1}),n.createElement(N5,{surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:S,setErrors:E,onFileUpload:e.onFileUpload,block:t,preview:!!e.preview,surveyLanguage:e.survey.language,language:e.language||"en",question:t.question,surveyStyle:e.surveyStyle,isFinalQn:YN({blocks:s,activeIndexOfBlocks:u,renderedBlocks:l,activeIndexOfRenderedBlocks:d,questions:A}),formValues:O.formValues,othersMeta:O.others,isMobile:!!e.isMobile,autoFocusDelay:20,activeIndexOfRenderedStatement:q,saveOthersValue:(e,t)=>{m(e,t,i)},onChangeHandler:(e,n)=>{const a=t.question.type_info?.question_type;z(t,e,!!a&&["RANGE","DROPDOWN","BOOLEAN"].includes(a)||n,i)},initialPivotAnswer:e.initialPivotAnswer,initialQuestionAnswer:e.initialQuestionAnswer,formQuestionErrors:L,dateQuestionErrors:C,textboxQuestionErrors:x,contactFormErrors:k,translationVariables:M,isQuestionBgDark:I}),"MESSAGE"!==t.question.type_info?.question_type&&n.createElement(X5,{canDisplayDisableButtonParams:{...te,blockIndex:i},language:e.language||"en",isWidget:!1,surveyStyle:e.surveyStyle,answers:O,renderedBlocks:l,blocks:s,pages:a,survey:e.survey,blockIndex:i,isInitialTransition:c,activeIndexOfRenderedBlocks:d,initialStatementHasAnswer:g,navigateToNextStatement:W,navigateToPreviousStatement:w,activeIndexOfRenderedStatement:q,activeIndexOfBlocks:u,saveFormValues:z,isMobile:!!e.isMobile,clearRadioSelection:h,initialPivotAnswer:e.initialPivotAnswer,translationVariables:M,formQuestionErrors:L,dateQuestionErrors:C,textboxQuestionErrors:x,contactFormErrors:k,fileUploadErrors:S,questions:A,isSubmitting:T}))}))),n.createElement("div",{className:"page-actions"},n.createElement("div",null,ne["set-navigation"]&&n.createElement(I5,{answers:O,canDisplayDisableButtonParams:te,activeIndexOfBlocks:u,pages:a,activeIndexOfRenderedBlocks:d,renderedBlocks:l,initialStatementHasAnswer:g,blocks:s,activeIndexOfRenderedStatement:q,translationVariables:M,navigateToPreviousSet:r,navigateToNextSet:i})),n.createElement("div",{className:"page-action-buttons ss-page-action-buttons"},e?.secBtnTxt&&n.createElement(G,{variant:"secondary",onClick:()=>{e?.handleSecondaryAction?.({answers:O.formValues,survey:e.survey})},"aria-label":"secondary-action",disabled:T},e.secBtnTxt),ne["skip-set"]&&n.createElement(G,{variant:"secondary",onClick:()=>{P(!0)},"aria-label":"skip set",disabled:T},e?.survey?.meta?.action_button?.skip||M?.actionButtonText?.skip||M?.skip||"Skip"),ne?.["next-set"]&&n.createElement(G,{onClick:()=>{P()},disabled:!!MP("next-set",te),className:"next-set"},e?.survey?.meta?.action_button?.next||M?.actionButtonText?.next||M?.next||"Next"),ne.submit&&!ne?.["next-set"]&&n.createElement(G,{disabled:!!MP("submit",te),onClick:()=>{let e=0;l.some(((t,n)=>(e=n,!H(t,!0))))?D(e):Dn(C?.[ee.name])&&Dn(L?.[ee.name])&&Dn(x?.[ee.name])&&Dn(S?.[ee.name])&&Dn(k?.[ee.name])&&f("COMPLETE")}},e?.survey?.meta?.action_button?.submit||M?.actionButtonText?.submit||M?.submit_survey||"Submit"))))),!e.secBtnTxt&&!e.footerProps?.hideFooter&&(e?.footerProps?.languageDDComponent||e?.footerProps?.showFWBranding||e.footerProps?.footerContent)&&n.createElement(pa,{...e.footerProps,surveyStyle:e.surveyStyle,bgColor:e.survey.theme?.palette?.footer_background??e.survey.theme?.palette?.survey_background??kP}))},F5=e=>n.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},n.createElement("g",{clipPath:"url(#clip0_8207_70478)"},n.createElement("rect",{width:"10",height:"10",fill:"white",fillOpacity:"0.01"}),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.62499 3.19375C8.62499 3.4 8.79374 3.56875 8.99999 3.56875C9.20624 3.56875 9.37499 3.4 9.37499 3.19375V1C9.37499 0.79375 9.20624 0.625 8.99999 0.625H6.80624C6.59999 0.625 6.43124 0.79375 6.43124 1C6.43124 1.20625 6.59999 1.375 6.80624 1.375H8.09377L5.66876 3.80001C5.52501 3.95001 5.52501 4.18751 5.66876 4.33126C5.73751 4.40626 5.83751 4.44376 5.93126 4.44376V4.45001C6.02501 4.45001 6.11876 4.41251 6.19376 4.33751L8.62499 1.90628V3.19375ZM1 9.37501H1.00738H3.19375C3.4 9.37501 3.56875 9.20626 3.56875 9.00001C3.56875 8.79376 3.4 8.62501 3.19375 8.62501H1.90626L4.3375 6.19376C4.48125 6.04376 4.48125 5.80626 4.3375 5.66251C4.1875 5.51876 3.95 5.51876 3.80625 5.66251L1.375 8.09376V6.80626C1.375 6.60001 1.20625 6.43126 1 6.43126C0.79375 6.43126 0.625 6.60001 0.625 6.80626V9.00001C0.625 9.20626 0.79375 9.37501 1 9.37501Z",fill:"#264966"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_8207_70478"},n.createElement("rect",{width:"10",height:"10",fill:"white"})))),U5=e=>n.createElement("svg",{width:"8",height:"2",viewBox:"0 0 8 2",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},n.createElement("path",{d:"M7.3 1.4H0.7C0.313401 1.4 0 1.0866 0 0.699999C0 0.3134 0.313401 0 0.7 0H7.3C7.6866 0 8 0.3134 8 0.699999C8 1.0866 7.6866 1.4 7.3 1.4Z",fill:"#264966"})),G5=({surveyServAssetUrl:e,thankYouQuestion:a,placeholders:o,canResubmit:i,navigateToStart:r,resetSurvey:c,widgetStyle:s,allowMultipleSubmission:l,pivot:p,rangeToRender:u,answers:d,questions:b,translationVariables:M,isQuestionBgDark:z})=>{const{show_custom_button:m,show_review_links:h,show_social_links:f,image_url:O}=a?.type_info?.meta??{},[A,v]=n.useState(!1);return t.useEffect((()=>()=>{v(!1)}),[]),n.createElement("div",{className:"question-container ss-question-container thankyou"},O&&n.createElement("img",{className:"thankyou-logo-img ss-thankyou-logo",src:O,alt:"thankyou_logo"}),n.createElement("div",{className:O?"heading":"heading thankyou-image"},n.createElement(n.Fragment,null,jn(a))),n.createElement("div",{className:O?"text ss-thankyou-message":"text ss-thankyou-message thankyou-image",dangerouslySetInnerHTML:{__html:Un({questionText:a.text,placeholders:o,npsRating:Gn({theme:"nps",answers:d,questions:b})??"",npsRatingLabel:Yn({theme:"nps",answers:d,questions:b}),csatRating:Gn({theme:"csat",answers:d,questions:b})??"",csatRatingLabel:Yn({theme:"csat",answers:d,questions:b}),cesRating:Gn({theme:"ces",answers:d,questions:b})??"",cesRatingLabel:Yn({theme:"ces",answers:d,questions:b}),preference:p?.question.type_info?.scale_properties?.labels?.preference})}}),(i||l)&&n.createElement("div",{className:`wrap-up-actions ${O?"":"thank-you-image"} ${"compact"===s?"mobile":""}`.trim()},i&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),r()}},n.createElement(I,{name:"edit"}),M?.edit_response||"Edit your response"),l&&n.createElement("button",{className:"action-button",tabIndex:0,disabled:A,onClick:()=>{v(!0),c()}},n.createElement(I,{name:"reload"}),M?.another_response||"Submit another response")),n.createElement(SP,{show_custom_button:m,show_review_links:h,show_social_links:f,surveyServAssetUrl:e}))},Y5=({translationVariables:e,activeIndexOfRenderedStatement:t,navigateToPreviousBlock:a,navigateToNextBlock:o,question:i,canDisplayDisableButtonParams:r,animationInProgress:c,setAnimationInProgress:s})=>n.createElement("div",{className:"freemium-survey-step-navigation ss-navigation-buttons","data-navigation-element":"1"},n.createElement("button",{disabled:c||!!MP("navigation-prev",r),className:"navigation-button ss-navigation-button",onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),q),a()},title:i.name&&(t?.[i.name]??0)>0?e?.prev_statement||"go to previous statement":e?.prev_question||"go to previous question"},n.createElement(I,{name:"arrow-previous"})),n.createElement("button",{className:"navigation-button ss-navigation-button",disabled:c||!!MP("navigation-next",r),onClick:()=>{s(!0),setTimeout((()=>{s(!1)}),q),o()},title:e?.next_question||"go to next question"},n.createElement(I,{name:"arrow-next"}))),Z5=e=>{const{widgetStyle:a,answers:o,initialStatementHasAnswer:i,renderedBlocks:r,blocks:c,activeIndexOfBlocks:s,navigateToNextStatement:l,activeIndexOfRenderedBlocks:p,translationVariables:u,saveFormValues:d,activeIndexOfRenderedStatement:b={},onSubmitHandler:M,skipBlock:z,skipStatement:m,navigateToNextBlock:h,navigateToPreviousBlock:f,formQuestionErrors:O,dateQuestionErrors:A,textboxQuestionErrors:v,fileUploadErrors:g,contactFormErrors:y,canDisplayDisableButtonParams:W,pages:w,setFooterElementRef:R,isSubmitting:L}=e,[C,x]=t.useState(!1),{question:k}=r[p],S=k?.type_info?.question_type,E={...W,isSubmitting:L},N=(e=!1)=>{const t=e?[...T].reverse():[...T];return lP("consent",E)&&"BUTTON"===$&&t.map((e=>n.createElement(G,{key:p+String(e.id),onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),d(r[p],e.recordAs,!0)},disabled:C||MP("consent",E),variant:_n(o.formValues?.[k.name])||o.formValues?.[k.name]===e.recordAs?"primary":"secondary",className:("consent-button ss-action-consent-button "+(o.formValues?.[k.name]===e.recordAs?"selected":"")).trim()},k?.type_info?.scale_properties?.labels?.values?.[e.id]||e.defaultValue)))},P="compact"===a&&(lP("navigation",E)&&lP("skip",E)||"CONSENT"===S||"MESSAGE"===S),$=k?.type_info?.meta?.display_format;return n.createElement(n.Fragment,null,(lP("navigation",E)||lP("next",E)||lP("next-statement",E)||lP("consent",E)||lP("submit",E)||lP("skip",E)||lP("skip-statement",E)||lP("message",E))&&n.createElement("div",{className:"question-footer ss-question-footer-container",ref:e=>e?R?.(e):null},P?n.createElement("div",{className:"compact-footer-container"},lP("next",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),d(r[p],"CHECKBOX"===k?.type_info?.meta?.display_format&&"CONSENT"===k?.type_info?.question_type?o.formValues[k.name]??!1:o.formValues[k.name],!0)},disabled:C||!!MP("next",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.next||"Next"),lP("message",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},disabled:C||MP("message",E),className:"message-button ss-action-message-button"},k?.type_info?.scale_properties?.labels?.values?.[0]||"Begin"),lP("submit",E)&&n.createElement("div",{className:"submit ss-action-submit-button"},n.createElement(G,{disabled:C||!!MP("submit",E),onClick:()=>{Dn(A?.[k.name])&&Dn(O?.[k.name])&&Dn(v?.[k.name])&&Dn(g?.[k.name])&&Dn(y?.[k.name])&&(x(!0),setTimeout((()=>{x(!1)}),q),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||u?.actionButtonText?.submit||u?.submit_survey||"Submit")),lP("next-statement",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),l?.(k.name)},disabled:C||!!MP("next-statement",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.actionButtonText?.next||u?.next||"Next"),N(),n.createElement("div",{className:"compact-footer-layout"},n.createElement(Y5,{animationInProgress:C,setAnimationInProgress:x,answers:o,canDisplayDisableButtonParams:E,pages:w,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:p,renderedBlocks:r,initialStatementHasAnswer:i,blocks:c,activeIndexOfRenderedStatement:b,question:k,translationVariables:u,navigateToNextBlock:h,navigateToPreviousBlock:f}),"MESSAGE"!==S&&!c[s].required&&n.createElement(G,{className:"skip-button ss-action-skip-button",onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},variant:"secondary","aria-label":"skip question",disabled:C},e?.survey?.meta?.action_button?.skip||u?.actionButtonText?.skip||u?.skip||"Skip"))):n.createElement(n.Fragment,null,lP("navigation",E)?n.createElement(Y5,{animationInProgress:C,setAnimationInProgress:x,answers:o,pages:w,canDisplayDisableButtonParams:E,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:p,activeIndexOfRenderedStatement:b,renderedBlocks:r,blocks:c,question:k,initialStatementHasAnswer:i,translationVariables:u,navigateToNextBlock:h,navigateToPreviousBlock:f}):n.createElement("div",null),n.createElement("div",{className:"action-buttons ss-action-buttons"},lP("skip",E)&&n.createElement(G,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},"aria-label":"skip question",disabled:C},e?.survey?.meta?.action_button?.skip||u?.actionButtonText?.skip||u?.skip||"Skip"),lP("skip-statement",E)&&n.createElement(G,{className:"skip-button ss-action-skip-button",variant:"secondary",onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),m()},"aria-label":"skip statement",disabled:C},e?.survey?.meta?.action_button?.skip||u?.actionButtonText?.skip||u?.skip||"Skip"),N(!0),lP("next",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),d(r[p],"CHECKBOX"===k?.type_info?.meta?.display_format&&"CONSENT"===k?.type_info?.question_type?o.formValues[k.name]??!1:o.formValues[k.name],!0)},disabled:C||!!MP("next",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.actionButtonText?.next||u?.next||"Next"),lP("next-statement",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),l?.(k.name)},disabled:C||!!MP("next-statement",E),className:"next-button ss-action-next-button"},e?.survey?.meta?.action_button?.next||u?.actionButtonText?.next||u?.next||"Next"),lP("submit",E)&&n.createElement("div",{className:"submit ss-action-submit-button"},n.createElement(G,{disabled:C||!!MP("submit",E),onClick:()=>{Dn(A?.[k.name])&&Dn(O?.[k.name])&&Dn(v?.[k.name])&&Dn(g?.[k.name])&&Dn(y?.[k.name])&&(x(!0),setTimeout((()=>{x(!1)}),q),M("COMPLETE"))}},e?.survey?.meta?.action_button?.submit||u?.actionButtonText?.submit||u?.submit_survey||"Submit")),lP("message",E)&&n.createElement(G,{onClick:()=>{x(!0),setTimeout((()=>{x(!1)}),q),z()},disabled:C||MP("message",E),className:"next-button ss-action-next-button"},k?.type_info?.scale_properties?.labels?.values?.[0]||"Begin")))))},K5=e=>{const{pages:a,activePage:o,blocks:i,renderedBlocks:r,activeBlock:c,activeIndexOfBlocks:s,activeIndexOfRenderedBlocks:l,isSurveyCompleted:p,isReverseAnimation:u,translationVariables:d,saveFormValues:b,saveOthersValue:M,skipBlock:z,skipStatement:m,initialStatementHasAnswer:h,onSubmitHandler:f,navigateToNextBlock:O,activeIndexOfRenderedStatement:A,navigateToNextStatement:v,navigateToPreviousStatement:g,navigateToPreviousBlock:y,answers:q,questions:W,resetSurvey:w,navigateToStart:L,pivot:C,formQuestionErrors:x,dateQuestionErrors:k,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:T,setErrors:N,expanded:P,setExpanded:$,isQuestionBgDark:B,isSubmitting:_}=RP({...e,isWidget:!0});aa("Widget",{...e,renderedBlocks:r,activeIndexOfBlocks:s,answers:q,activeIndexOfRenderedBlocks:l,activeBlock:c});const[H,D]=t.useState(null),[I,V]=t.useState(null),[X,j]=t.useState(null),[F,U]=t.useState(0),G=n.useMemo((()=>Fn(C?.question)),[C?.question]),Y=Dn(q.formValues)&&e.survey.prompt_settings?.is_enabled,[Z,K]=t.useState(Y),Q=t.useRef(Y?-1:l),J=()=>{if(null===H||!H||"undefined"==typeof window||"undefined"==typeof document)return;const t=Math.max(document?.documentElement.clientHeight||0,window.innerHeight||0)-(I?.scrollHeight??0)-(X?.scrollHeight??0)-164,n=Math.min(H?.scrollHeight,Math.min(R[e.widgetStyle],t));F!==n&&U(n)};t.useEffect((()=>{setTimeout((()=>{J()}),0)}),[Z,p,H,A[c?.question?.name],l,X,P,x,Object.keys(k),Object.keys(S),Object.keys(E),Object.keys(T)]),t.useEffect((()=>{"MATRIX_RATING_SCALE"===c?.question?.type_info?.question_type&&setTimeout((()=>{J()}),0)}),[A[c?.question?.name]]),t.useEffect((()=>{e.loadAsNewSurvey&&e.handleAction&&e.handleAction("RE_SUBMIT",w)}),[]),t.useEffect((()=>{e.setCurrentSurveyState?.({question:r[l]?.question,npsScore:C?.answer})}),[l,C?.answer]),t.useEffect((()=>{l!==Q.current&&(Q.current=-1)}),[l]);const ee={answers:q,blocks:i,blockIndex:l,activeIndexOfBlocks:s,initialStatementHasAnswer:h,activeIndexOfRenderedBlocks:l,activeIndexOfRenderedStatement:A,renderedBlocks:r,isMobile:!!e.isMobile,surveyStyle:"card",isWidget:!0,questions:W,pages:a,contactData:e.contactData,activeIndexOfSet:0,branchSeparatePage:!1};if(!c||!c?.question)return null;const te=p?i.length:s+(p?1:0),ne=p?100:(te>0?100/i.length:0)*te;return n.createElement("div",{className:`freemium-survey-components widget-survey-components\n ${e.widgetStyle}-style`.trim(),id:"freemium-survey"},p||Z||!e.survey.meta?.progress_bar?null:n.createElement("div",{className:"widget-progressbar"},n.createElement("div",{className:"progress-completion"},ne.toFixed(),"%"),n.createElement(lq,{totalSteps:i.length,completedSteps:s+(p?1:0),isWidget:!0})),!Z&&!e.minimized&&a.length>0&&o?.page_id&&!p&&n.createElement(LP,{ref:e=>e?j(e):null,expanded:P,id:o.page_id,setExpanded:$,activePage:o,translationVariables:d}),n.createElement("div",{className:"questions ss-questions",style:{...Y&&Z||Q.current===l?{transition:"none"}:{}}},n.createElement(nS,{exitBeforeEnter:!0},n.createElement(Kk.div,{id:`${c.question.name}`,className:`question-container ss-question-container ${p?"thankyou":""} ${Z?"prompt-container":""}`.trim(),"data-test-question-name":c.question.name,key:`${c.question.name}`,initial:{opacity:0,x:Vn(e.language,u)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(e.language,u)},transition:{duration:.2}},n.createElement("div",{className:"animation-container",style:{height:e.minimized?0:F>0&&!P?`${F}px`:"auto"}},n.createElement("div",{className:"scroll-container",ref:e=>e?D(e):null},Z&&e.survey.prompt_settings?n.createElement(xP,{config:e.survey.prompt_settings,onSelect:t=>{e.onAnsweringPrompt(t),1===t&&K(!1)},placeholders:e.placeholders}):n.createElement(n.Fragment,null,p?n.createElement(G5,{surveyServAssetUrl:e.surveyServAssetUrl??"",thankYouQuestion:ZN({pivotQn:C?.question,pivotQnAnswer:C?.answer,block:tP({activeBlock:c,blocks:e.survey.blocks?.filter((e=>!e.is_deleted)),answers:q,questions:W,activeIndexOfBlocks:s,renderedBlocks:r,contactData:e.contactData,surveyLayout:"card",pages:a}),questions:W}),placeholders:e.placeholders,canResubmit:e.canResubmit,widgetStyle:e.widgetStyle,navigateToStart:()=>{e.handleAction?e.handleAction("EDIT_RESPONSE",L):L()},resetSurvey:()=>{e.handleAction?e.handleAction("RE_SUBMIT",w):w()},allowMultipleSubmission:e.allowMultipleSubmission,pivot:C,rangeToRender:G,translationVariables:d,isQuestionBgDark:B,answers:q}):n.createElement(n.Fragment,null,n.createElement("div",{className:`question-text ss-question-text ${!c.question.type_info?.pivot_question&&c.required?"required":""} ${"RANGE"===c?.question?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:Un({questionText:c?.question.text,placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:q,questions:W})??"",npsRatingLabel:Yn({theme:"nps",answers:q,questions:W}),csatRating:Gn({theme:"csat",answers:q,questions:W})??"",csatRatingLabel:Yn({theme:"csat",answers:q,questions:W}),cesRating:Gn({theme:"ces",answers:q,questions:W})??"",cesRatingLabel:Yn({theme:"ces",answers:q,questions:W}),preference:C?.question.type_info?.scale_properties?.labels?.preference})},"aria-label":`question-${l}`,role:"heading","aria-level":1}),"MESSAGE"!==c.question.type_info?.question_type&&n.createElement("div",{className:"question-wrapper",onTransitionEndCapture:e=>e.stopPropagation()},n.createElement(N5,{setFocus:!0,surveyStyle:"card",isReverseAnimation:u,language:e?.language||"en",surveyServAssetUrl:e.surveyServAssetUrl,fileUploadErrors:E,setErrors:N,onFileUpload:e.onFileUpload,surveyLanguage:e.survey.language,block:c,question:c.question,isFinalQn:YN({blocks:i,activeIndexOfBlocks:s,renderedBlocks:r,activeIndexOfRenderedBlocks:l,questions:W}),formValues:q.formValues,widgetStyle:e.widgetStyle,isMobile:!1,othersMeta:q.others,autoFocusDelay:0,activeIndexOfRenderedStatement:A,isWidget:!0,saveOthersValue:(e,t)=>{M(e,t),setTimeout((()=>{J()}),0)},onChangeHandler:e=>{setTimeout((()=>{J()}),0),b(c,e)},formQuestionErrors:x,dateQuestionErrors:k,textboxQuestionErrors:S,contactFormErrors:T,translationVariables:d,isQuestionBgDark:B})))))))),!p&&!Z&&n.createElement(Z5,{pages:a,isWidget:!0,language:e.language||"en",widgetStyle:e.widgetStyle,setFooterElementRef:V,surveyStyle:"standard",answers:q,survey:e.survey,canDisplayDisableButtonParams:{...ee,blockIndex:l,activeIndexOfRenderedBlocks:l},isMobile:!1,renderedBlocks:r,initialStatementHasAnswer:h,activeIndexOfRenderedStatement:A,blocks:i,activeIndexOfRenderedBlocks:l,navigateToNextStatement:v,navigateToPreviousStatement:g,activeIndexOfBlocks:s,translationVariables:d,saveFormValues:b,skipBlock:z,skipStatement:m,onSubmitHandler:f,navigateToPreviousBlock:y,navigateToNextBlock:O,formQuestionErrors:x,dateQuestionErrors:k,textboxQuestionErrors:S,fileUploadErrors:E,contactFormErrors:T,questions:W,isSubmitting:_})))},Q5={default:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},compact:{width:522,11:6,10:6,9:8,8:8,7:18,6:22,5:28,4:32,3:36},cozy:{width:582,11:12,10:12,9:12,8:12,7:18,6:22,5:28,4:32,3:36}},J5=({language:e="en",survey:a,preview:o,placeholders:i,contactData:r,overRideComponent:c,onSubmit:s,onDismiss:l,onClose:p,isMobile:u,surveyType:d,unsubscribeUrl:b,isSurveyCompleted:M,children:z=null,answerStatus:m,loadSurveyCollapsed:h=!1,handleAction:f,answers:O,onAnsweringPrompt:A,allowMultipleSubmission:v,loadAsNewSurvey:g,canResubmit:y,translationVariables:q,surveyServAssetUrl:W,footerProps:w,surveyPoweredBy:R,onFileUpload:C,isQuestionBgDark:x,hideMinimize:k,collector:S})=>{const E=a.question_details?.questions||[],[T,N]=t.useState(),[P,$]=t.useState(!1),[B,_]=t.useState(h),[H,D]=t.useState(!1),{theme:I}=a,[V,X]=t.useState(null),j=n.useMemo((()=>((e=[])=>{const t=e.sort(((e,t)=>Number(e.order)-Number(t.order)));return t.find((e=>!e.is_deleted))??t[0]})(a.blocks||[])),[a.blocks]),F=j?.question_name?j?.question_name??"":j?.category?.[0].question_name??"",U=E.find((e=>e.name===F)),Y=()=>{$(!0),setTimeout((()=>{p?.()}),300)},Z=t.useRef(null);function K(e){const t=document?.getElementById("freshworks-survey-widget");if(t&&e?.channel_info?.web_in_app_channel_info?.backdrop_enabled)try{const a=(n=e?.channel_info?.web_in_app_channel_info?.backdrop_color,Object.entries({...L,backgroundColor:n}).map((([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${t}`)).join("; "));t.style.cssText=a}catch(e){console.error("Error applying styles to widgetElement:",e)}var n}return n.useEffect((()=>{const e=document?.documentElement;if(!e||!a.question_details?.questions)return;let t=0;(a.question_details.questions??[]).forEach((e=>{const n=Fn(e);"RANGE"===e.type_info?.question_type&&n.length>t&&(t=n.length)}));const n=42*t+Q5[d][t]*(t-1);e.style.setProperty("--fsc-max-range-question-width",Math.min(Q5[d].width,n)+"px")}),[a,d]),n.useEffect((()=>{I&&(Zn(I,W??""),D(oa(I.palette?.footer_background??I.palette?.survey_background??kP)))}),[I,W]),n.useEffect((()=>{K(S)}),[S]),n.createElement("div",{id:"freshworks-survey-widget"},a.theme?.advanced?.additional_css&&n.createElement("style",null,a.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),n.createElement("div",{className:`surveyserv-widget-container ${In(e||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${u?"widget-mobile":""} ${d}-container-style ${B?"minimized":""}`,id:"surveyserv-widget-container"},n.createElement("header",{id:"surveyserv-widget-header",className:("widget-header "+(B?"minimized":"")).trim()},B?n.createElement("span",{className:"header-content minimized",dangerouslySetInnerHTML:{__html:Un({questionText:(!T&&a.prompt_settings?.is_enabled?a.prompt_settings.text:V?.question?.text)??ta(U?.text||""),placeholders:{...i,"{{nps.rating}}":String(V?.npsScore??"")}})}}):n.createElement("div",null),n.createElement("div",{className:"icons"},!M&&!k&&n.createElement(G,{onClick:()=>{_((e=>!e))},variant:"secondary",className:"icon minimize-btn",title:B?q?.maximize||"Maximize widget":q?.minimize||"Minimize widget"},B?n.createElement(F5,null):n.createElement(U5,null)),n.createElement(G,{ref:Z,onClick:()=>{M?Y():l()},variant:"secondary",title:q?.dismiss||"Dismiss widget",className:"icon minimize-btn"},n.createElement(IN,null)))),z,n.createElement("main",{className:("widget-main "+(B?"minimized":"")).trim()},c?n.createElement(n.Fragment,null,c):n.createElement(K5,{surveyServAssetUrl:W,answers:O,minimized:B,widgetStyle:d,answerStatus:m,language:e||"en",survey:a,placeholders:i,isMobile:!!u,contactData:r,onFileUpload:C,allowMultipleSubmission:v,loadAsNewSurvey:g,canResubmit:y,onSubmit:s,setCurrentSurveyState:X,widgetHeaderQuerySelector:B?void 0:"#surveyserv-widget-header",onAnsweringPrompt:e=>{A?.(e),N(e),0==e&&Dn(a.prompt_settings?.declined_message)&&Y()},handleAction:f,translationVariables:q})),(R||b||!!w?.showFWBranding)&&n.createElement("footer",{className:`widget-footer ${B?"minimized":""} survey-footer-${H?"dark":"light"}`.trim()},n.createElement("div",null,b&&!B&&n.createElement("a",{href:b,target:"_blank",rel:"noopener noreferrer",onClick:e=>{o&&e.preventDefault(),e.stopPropagation(),Y()}},q?.unsubscribe||"Unsubscribe")),!!w?.showFWBranding&&n.createElement("div",{className:"footer-text"},n.createElement(la,{surveyPoweredBy:R,isDark:H})))))},e4=e=>{const{survey:t,answers:a}=XN(e.survey,e.answers);return aa("WebInAppContainer",{...e,survey:t,answers:a}),n.createElement(J5,{...e,survey:t,answers:a})},t4=e=>{const[t,a]=n.useState(!1),[o,i]=n.useState(!1);return n.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&(a(window.matchMedia("(max-width: 550px)").matches),"cozy"===e.surveyType&&i(window.matchMedia("(max-width: 1080px)").matches))}),[]),aa("WebInAppSurvey",{...e,isMobile:t,isDefault:o}),e.isLoading?n.createElement("div",{id:"freshworks-survey-widget"},n.createElement("div",{className:`surveyserv-widget-container ${In(e.language||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${t?"widget-mobile":""} ${e.surveyType}-container-style`,id:"surveyserv-widget-container"},n.createElement("header",{id:"surveyserv-widget-header",className:"widget-header".trim()},n.createElement("div",null),n.createElement(G,{onClick:()=>{setTimeout((()=>{e?.onClose?.()}),300)},variant:"secondary",title:e.translationVariables?.dismiss||"Dismiss widget",className:"icon minimize-btn"},n.createElement(IN,null))),n.createElement("main",{className:"widget-main widget-loader".trim()},e.overRideComponent??n.createElement(ua,null)))):n.createElement(n.Fragment,null,e?.survey?.id?n.createElement(e4,{...e,isMobile:t,surveyType:t?"compact":o?"default":e.surveyType}):null)},n4=e=>{const{question:t,surveyStyle:a,language:o,onAnswer:i,translationVariables:r,surveyServAssetUrl:c,block:s,theme:l}=e,[p,u]=n.useState(!!e.isMobile);return n.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&u(window.matchMedia("(max-width: 550px)").matches||!!e.isMobile)}),[]),n.useEffect((()=>{l&&Zn(l,c??"")}),[l,c]),aa("QuestionPreview",{...e,isMobile:p}),n.createElement(n.Fragment,null,l?.advanced?.additional_css&&n.createElement("style",null,l?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),n.createElement("div",{className:`freemium-survey-components question-preview ${a}-survey-style ${In(o||"en")?"freemium-survey-rtl":"freemium-survey-ltr"} ${p?"mobile-preview":""}`.trim(),id:"freemium-survey"},n.createElement("div",{className:"question-holder"},n.createElement("div",{className:"questions ss-questions"},n.createElement(Kk.div,{id:`${t.name}`,className:"question-container ss-question-container","data-test-question-name":t.name,key:`${t.name}`,initial:{opacity:0,x:Vn(o,!1)},animate:{opacity:1,x:0},exit:{opacity:0,x:Xn(o,!1)},transition:{duration:.2}},n.createElement("div",{className:`question-text ss-question-text ${s.required?"required":""} ${"RANGE"===t?.type_info?.question_type?"range-question-text":""}`.trim(),dangerouslySetInnerHTML:{__html:Un({questionText:t.text,placeholders:{},npsRating:"",npsRatingLabel:"",csatRating:"",csatRatingLabel:"",cesRating:"",cesRatingLabel:"",preference:t.type_info?.scale_properties?.labels?.preference})},"aria-label":"question-0",role:"heading","aria-level":1}),n.createElement(N5,{surveyStyle:a,language:e?.language||"en",surveyServAssetUrl:c,surveyLanguage:e?.language,block:s,question:t,formValues:{},isMobile:p,othersMeta:{},saveOthersValue:(e,t)=>{},onChangeHandler:e=>{i?.({value:e,block:s,question:t})},translationVariables:r??{},activeIndexOfRenderedStatement:{},autoFocusDelay:0,contactFormErrors:{},dateQuestionErrors:{},fileUploadErrors:{},formQuestionErrors:{},textboxQuestionErrors:{},setErrors:()=>{}}))))))},{entries:a4,setPrototypeOf:o4,isFrozen:i4,getPrototypeOf:r4,getOwnPropertyDescriptor:c4}=Object;let{freeze:s4,seal:l4,create:p4}=Object,{apply:u4,construct:d4}="undefined"!=typeof Reflect&&Reflect;s4||(s4=function(e){return e}),l4||(l4=function(e){return e}),u4||(u4=function(e,t,n){return e.apply(t,n)}),d4||(d4=function(e,t){return new e(...t)});const b4=L4(Array.prototype.forEach),M4=L4(Array.prototype.lastIndexOf),z4=L4(Array.prototype.pop),m4=L4(Array.prototype.push),h4=L4(Array.prototype.splice),f4=L4(String.prototype.toLowerCase),O4=L4(String.prototype.toString),A4=L4(String.prototype.match),v4=L4(String.prototype.replace),g4=L4(String.prototype.indexOf),y4=L4(String.prototype.trim),q4=L4(Object.prototype.hasOwnProperty),W4=L4(RegExp.prototype.test),w4=(R4=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d4(R4,t)});var R4;function L4(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return u4(e,t,a)}}function C4(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f4;o4&&o4(e,null);let a=t.length;for(;a--;){let o=t[a];if("string"==typeof o){const e=n(o);e!==o&&(i4(t)||(t[a]=e),o=e)}e[o]=!0}return e}function x4(e){for(let t=0;t<e.length;t++){q4(e,t)||(e[t]=null)}return e}function k4(e){const t=p4(null);for(const[n,a]of a4(e)){q4(e,n)&&(Array.isArray(a)?t[n]=x4(a):a&&"object"==typeof a&&a.constructor===Object?t[n]=k4(a):t[n]=a)}return t}function S4(e,t){for(;null!==e;){const n=c4(e,t);if(n){if(n.get)return L4(n.get);if("function"==typeof n.value)return L4(n.value)}e=r4(e)}return function(){return null}}const E4=s4(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T4=s4(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N4=s4(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P4=s4(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),$4=s4(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),B4=s4(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_4=s4(["#text"]),H4=s4(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),D4=s4(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),I4=s4(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),V4=s4(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),X4=l4(/\{\{[\w\W]*|[\w\W]*\}\}/gm),j4=l4(/<%[\w\W]*|[\w\W]*%>/gm),F4=l4(/\$\{[\w\W]*/gm),U4=l4(/^data-[\-\w.\u00B7-\uFFFF]+$/),G4=l4(/^aria-[\-\w]+$/),Y4=l4(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Z4=l4(/^(?:\w+script|data):/i),K4=l4(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Q4=l4(/^html$/i),J4=l4(/^[a-z][.\w]*(-[.\w]+)+$/i);var e6=Object.freeze({__proto__:null,ARIA_ATTR:G4,ATTR_WHITESPACE:K4,CUSTOM_ELEMENT:J4,DATA_ATTR:U4,DOCTYPE_NAME:Q4,ERB_EXPR:j4,IS_ALLOWED_URI:Y4,IS_SCRIPT_OR_DATA:Z4,MUSTACHE_EXPR:X4,TMPLIT_EXPR:F4});const t6=1,n6=3,a6=7,o6=8,i6=9,r6=function(){return"undefined"==typeof window?null:window};var c6=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r6();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==i6||!t.Element)return n.isSupported=!1,n;let{document:a}=t;const o=a,i=o.currentScript,{DocumentFragment:r,HTMLTemplateElement:c,Node:s,Element:l,NodeFilter:p,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:b,trustedTypes:M}=t,z=l.prototype,m=S4(z,"cloneNode"),h=S4(z,"remove"),f=S4(z,"nextSibling"),O=S4(z,"childNodes"),A=S4(z,"parentNode");if("function"==typeof c){const e=a.createElement("template");e.content&&e.content.ownerDocument&&(a=e.content.ownerDocument)}let v,g="";const{implementation:y,createNodeIterator:q,createDocumentFragment:W,getElementsByTagName:w}=a,{importNode:R}=o;let L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a4&&"function"==typeof A&&y&&void 0!==y.createHTMLDocument;const{MUSTACHE_EXPR:C,ERB_EXPR:x,TMPLIT_EXPR:k,DATA_ATTR:S,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:P}=e6;let{IS_ALLOWED_URI:$}=e6,B=null;const _=C4({},[...E4,...T4,...N4,...$4,..._4]);let H=null;const D=C4({},[...H4,...D4,...I4,...V4]);let I=Object.seal(p4(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,X=null,j=!0,F=!0,U=!1,G=!0,Y=!1,Z=!0,K=!1,Q=!1,J=!1,ee=!1,te=!1,ne=!1,ae=!0,oe=!1,ie=!0,re=!1,ce={},se=null;const le=C4({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pe=null;const ue=C4({},["audio","video","img","source","image","track"]);let de=null;const be=C4({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Me="http://www.w3.org/1998/Math/MathML",ze="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let he=me,fe=!1,Oe=null;const Ae=C4({},[Me,ze,me],O4);let ve=C4({},["mi","mo","mn","ms","mtext"]),ge=C4({},["annotation-xml"]);const ye=C4({},["title","style","font","a","script"]);let qe=null;const We=["application/xhtml+xml","text/html"];let we=null,Re=null;const Le=a.createElement("form"),Ce=function(e){return e instanceof RegExp||e instanceof Function},xe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Re||Re!==e){if(e&&"object"==typeof e||(e={}),e=k4(e),qe=-1===We.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===qe?O4:f4,B=q4(e,"ALLOWED_TAGS")?C4({},e.ALLOWED_TAGS,we):_,H=q4(e,"ALLOWED_ATTR")?C4({},e.ALLOWED_ATTR,we):D,Oe=q4(e,"ALLOWED_NAMESPACES")?C4({},e.ALLOWED_NAMESPACES,O4):Ae,de=q4(e,"ADD_URI_SAFE_ATTR")?C4(k4(be),e.ADD_URI_SAFE_ATTR,we):be,pe=q4(e,"ADD_DATA_URI_TAGS")?C4(k4(ue),e.ADD_DATA_URI_TAGS,we):ue,se=q4(e,"FORBID_CONTENTS")?C4({},e.FORBID_CONTENTS,we):le,V=q4(e,"FORBID_TAGS")?C4({},e.FORBID_TAGS,we):k4({}),X=q4(e,"FORBID_ATTR")?C4({},e.FORBID_ATTR,we):k4({}),ce=!!q4(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,F=!1!==e.ALLOW_DATA_ATTR,U=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ae=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,$=e.ALLOWED_URI_REGEXP||Y4,he=e.NAMESPACE||me,ve=e.MATHML_TEXT_INTEGRATION_POINTS||ve,ge=e.HTML_INTEGRATION_POINTS||ge,I=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(I.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ce(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(I.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(I.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(F=!1),te&&(ee=!0),ce&&(B=C4({},_4),H=[],!0===ce.html&&(C4(B,E4),C4(H,H4)),!0===ce.svg&&(C4(B,T4),C4(H,D4),C4(H,V4)),!0===ce.svgFilters&&(C4(B,N4),C4(H,D4),C4(H,V4)),!0===ce.mathMl&&(C4(B,$4),C4(H,I4),C4(H,V4))),e.ADD_TAGS&&(B===_&&(B=k4(B)),C4(B,e.ADD_TAGS,we)),e.ADD_ATTR&&(H===D&&(H=k4(H)),C4(H,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&C4(de,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(se===le&&(se=k4(se)),C4(se,e.FORBID_CONTENTS,we)),ie&&(B["#text"]=!0),K&&C4(B,["html","head","body"]),B.table&&(C4(B,["tbody"]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w4('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w4('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,g=v.createHTML("")}else void 0===v&&(v=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(n=t.getAttribute(a));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(M,i)),null!==v&&"string"==typeof g&&(g=v.createHTML(""));s4&&s4(e),Re=e}},ke=C4({},[...T4,...N4,...P4]),Se=C4({},[...$4,...B4]),Ee=function(e){m4(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){h(e)}},Te=function(e,t){try{m4(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){m4(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ee(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ne=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=A4(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===qe&&he===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=v?v.createHTML(e):e;if(he===me)try{t=(new b).parseFromString(o,qe)}catch(e){}if(!t||!t.documentElement){t=y.createDocument(he,"template",null);try{t.documentElement.innerHTML=fe?g:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),he===me?w.call(t,K?"html":"body")[0]:K?t.documentElement:i},Pe=function(e){return q.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},$e=function(e){return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof s&&e instanceof s};function _e(e,t,a){b4(e,(e=>{e.call(n,t,a,Re)}))}const He=function(e){let t=null;if(_e(L.beforeSanitizeElements,e,null),$e(e))return Ee(e),!0;const a=we(e.nodeName);if(_e(L.uponSanitizeElement,e,{tagName:a,allowedTags:B}),Z&&e.hasChildNodes()&&!Be(e.firstElementChild)&&W4(/<[/\w!]/g,e.innerHTML)&&W4(/<[/\w!]/g,e.textContent))return Ee(e),!0;if(e.nodeType===a6)return Ee(e),!0;if(Z&&e.nodeType===o6&&W4(/<[/\w]/g,e.data))return Ee(e),!0;if(!B[a]||V[a]){if(!V[a]&&Ie(a)){if(I.tagNameCheck instanceof RegExp&&W4(I.tagNameCheck,a))return!1;if(I.tagNameCheck instanceof Function&&I.tagNameCheck(a))return!1}if(ie&&!se[a]){const t=A(e)||e.parentNode,n=O(e)||e.childNodes;if(n&&t){for(let a=n.length-1;a>=0;--a){const o=m(n[a],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,f(e))}}}return Ee(e),!0}return e instanceof l&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const n=f4(e.tagName),a=f4(t.tagName);return!!Oe[e.namespaceURI]&&(e.namespaceURI===ze?t.namespaceURI===me?"svg"===n:t.namespaceURI===Me?"svg"===n&&("annotation-xml"===a||ve[a]):Boolean(ke[n]):e.namespaceURI===Me?t.namespaceURI===me?"math"===n:t.namespaceURI===ze?"math"===n&&ge[a]:Boolean(Se[n]):e.namespaceURI===me?!(t.namespaceURI===ze&&!ge[a])&&!(t.namespaceURI===Me&&!ve[a])&&!Se[n]&&(ye[n]||!ke[n]):!("application/xhtml+xml"!==qe||!Oe[e.namespaceURI]))}(e)?(Ee(e),!0):"noscript"!==a&&"noembed"!==a&&"noframes"!==a||!W4(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===n6&&(t=e.textContent,b4([C,x,k],(e=>{t=v4(t,e," ")})),e.textContent!==t&&(m4(n.removed,{element:e.cloneNode()}),e.textContent=t)),_e(L.afterSanitizeElements,e,null),!1):(Ee(e),!0)},De=function(e,t,n){if(ae&&("id"===t||"name"===t)&&(n in a||n in Le))return!1;if(F&&!X[t]&&W4(S,t));else if(j&&W4(E,t));else if(!H[t]||X[t]){if(!(Ie(e)&&(I.tagNameCheck instanceof RegExp&&W4(I.tagNameCheck,e)||I.tagNameCheck instanceof Function&&I.tagNameCheck(e))&&(I.attributeNameCheck instanceof RegExp&&W4(I.attributeNameCheck,t)||I.attributeNameCheck instanceof Function&&I.attributeNameCheck(t))||"is"===t&&I.allowCustomizedBuiltInElements&&(I.tagNameCheck instanceof RegExp&&W4(I.tagNameCheck,n)||I.tagNameCheck instanceof Function&&I.tagNameCheck(n))))return!1}else if(de[t]);else if(W4($,v4(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==g4(n,"data:")||!pe[e]){if(U&&!W4(T,v4(n,N,"")));else if(n)return!1}else;return!0},Ie=function(e){return"annotation-xml"!==e&&A4(e,P)},Ve=function(e){_e(L.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||$e(e))return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:r,namespaceURI:c,value:s}=i,l=we(r),p=s;let u="value"===r?p:y4(p);if(a.attrName=l,a.attrValue=u,a.keepAttr=!0,a.forceKeepAttr=void 0,_e(L.uponSanitizeAttribute,e,a),u=a.attrValue,!oe||"id"!==l&&"name"!==l||(Te(r,e),u="user-content-"+u),Z&&W4(/((--!?|])>)|<\/(style|title)/i,u)){Te(r,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){Te(r,e);continue}if(!G&&W4(/\/>/i,u)){Te(r,e);continue}Y&&b4([C,x,k],(e=>{u=v4(u,e," ")}));const d=we(e.nodeName);if(De(d,l,u)){if(v&&"object"==typeof M&&"function"==typeof M.getAttributeType)if(c);else switch(M.getAttributeType(d,l)){case"TrustedHTML":u=v.createHTML(u);break;case"TrustedScriptURL":u=v.createScriptURL(u)}if(u!==p)try{c?e.setAttributeNS(c,r,u):e.setAttribute(r,u),$e(e)?Ee(e):z4(n.removed)}catch(t){Te(r,e)}}else Te(r,e)}_e(L.afterSanitizeAttributes,e,null)},Xe=function e(t){let n=null;const a=Pe(t);for(_e(L.beforeSanitizeShadowDOM,t,null);n=a.nextNode();)_e(L.uponSanitizeShadowNode,n,null),He(n),Ve(n),n.content instanceof r&&e(n.content);_e(L.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null,i=null,c=null,l=null;if(fe=!e,fe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw w4("toString is not a function");if("string"!=typeof(e=e.toString()))throw w4("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Q||xe(t),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=we(e.nodeName);if(!B[t]||V[t])throw w4("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)a=Ne("\x3c!----\x3e"),i=a.ownerDocument.importNode(e,!0),i.nodeType===t6&&"BODY"===i.nodeName||"HTML"===i.nodeName?a=i:a.appendChild(i);else{if(!ee&&!Y&&!K&&-1===e.indexOf("<"))return v&&ne?v.createHTML(e):e;if(a=Ne(e),!a)return ee?null:ne?g:""}a&&J&&Ee(a.firstChild);const p=Pe(re?e:a);for(;c=p.nextNode();)He(c),Ve(c),c.content instanceof r&&Xe(c.content);if(re)return e;if(ee){if(te)for(l=W.call(a.ownerDocument);a.firstChild;)l.appendChild(a.firstChild);else l=a;return(H.shadowroot||H.shadowrootmode)&&(l=R.call(o,l,!0)),l}let u=K?a.outerHTML:a.innerHTML;return K&&B["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&W4(Q4,a.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+u),Y&&b4([C,x,k],(e=>{u=v4(u,e," ")})),v&&ne?v.createHTML(u):u},n.setConfig=function(){xe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Q=!0},n.clearConfig=function(){Re=null,Q=!1},n.isValidAttribute=function(e,t,n){Re||xe({});const a=we(e),o=we(t);return De(a,o,n)},n.addHook=function(e,t){"function"==typeof t&&m4(L[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=M4(L[e],t);return-1===n?void 0:h4(L[e],n,1)[0]}return z4(L[e])},n.removeHooks=function(e){L[e]=[]},n.removeAllHooks=function(){L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const s6=({children:e,title:t,closeModal:a,isModalOpen:o})=>n.createElement(p.CSSTransition,{in:o,unmountOnExit:!0,timeout:500,classNames:"fade",key:t},n.createElement("div",{className:"options-popup",style:{}},n.createElement("header",null,n.createElement("button",{onClick:a,className:"close"},n.createElement(IN,null)),n.createElement("h4",null,t)),n.createElement("main",{className:"fsc-range-main"},e),n.createElement("footer",null,"Tab an item to select it"))),l6=({question:e,saveFormValues:a})=>{const[o,i]=t.useState(!1),{range:r}=e?.type_info?.scale_properties||{},c=Number(r?.[0]?.min),s=Number(r?.[r.length-1]?.max),l="descending"===e?.type_info?.scale_properties?.order,p=[...e?.type_info?.scale_properties?.labels?.values||[]],u=e?.type_info?.scale_properties?.labels?.preference;l&&p.reverse();const d=t.useRef(Array.from({length:s+(0===c?1:0)},((e,t)=>l?s-t:t+c)));return d.current.length<=3?n.createElement("ul",{className:`choices ${("THUMBS"===e?.type_info?.type_variant||"all"!==e?.type_info?.scale_properties?.labels?.preference)&&"one-line"}`},d.current.map(((t,o)=>"THUMBS"===e?.type_info?.type_variant?n.createElement("li",{className:"choice range-choice",key:`thumbs-${t}-${o}`},n.createElement("button",{onClick:()=>{a(t)}},n.createElement(I,{name:t?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===e?.type_info?.scale_properties?.labels?.preference&&e?.type_info?.scale_properties?.labels?.values?.[t])):n.createElement("li",{className:"choice range-choice",key:`choice-${t}-${o}`},n.createElement("button",{onClick:()=>{a(t)}},n.createElement("span",{className:"star-rating-wrapper"},Array.from({length:t},((e,t)=>n.createElement(I,{name:"whatsapp-star",id:`choice-${t}`})))," ","all"===u||"edges"===u&&(0===o||o===p.length-1)?p[t-1]:null)))))):n.createElement(n.Fragment,null,n.createElement("button",{onClick:()=>i(!0),className:"choices-button choice"},n.createElement(I,{name:"whatsapp-choices"}),"Rate Support"),n.createElement(s6,{title:"Rate Support",isModalOpen:o,closeModal:()=>i(!1)},d.current.map(((e,t)=>n.createElement("div",{className:"option-row"},n.createElement("button",{onClick:()=>{a(e),i(!1)}},n.createElement("span",{className:"star-rating-wrapper"},Array.from({length:e},((e,t)=>n.createElement(I,{name:"whatsapp-star",id:`qus-${t}`})))," ","all"===u||"edges"===u&&(0===t||t===p.length-1)?p[e-1]:null)))))))},p6=({question:e,saveFormValues:a,type:o})=>{const[i,r]=t.useState(!1);return n.createElement(n.Fragment,null,n.createElement("button",{onClick:()=>r(!0),className:"choices-button choice"},n.createElement(I,{name:"whatsapp-choices"}),"Select answer"),n.createElement(s6,{title:"Select a choice",isModalOpen:i,closeModal:()=>r(!1)},n.createElement("ul",{className:`choices multi-choice ${o}`},e.choices.map(((e,t)=>n.createElement("li",{className:"choice",style:{boxShadow:"none"},key:`${e}-${t}`},n.createElement("button",{onClick:()=>{a(e.id),r(!1)}},e.value)))))))},u6=e=>{const a=t.useRef(null);return((e,n)=>{t.useEffect((()=>{if(e){e.style.height="0px";const t=e.scrollHeight;e.style.height=t+"px"}}),[e,n])})(a.current,String(e.value)??""),t.useEffect((()=>{e.autoFocus&&a.current?.focus()}),[e.autoFocus]),n.createElement("div",{className:"textarea-container"},n.createElement("textarea",{placeholder:"Type a message",ref:a,rows:1,onChange:e.onChange,value:e.value}),n.createElement("button",{onClick:()=>{e.onSubmit(),a.current&&(a.current.value="")}},n.createElement(I,{name:"whatsapp-send"})))},d6=({text:e,placeholders:t,pivot:a,rangeToRender:o,questions:i,answers:r})=>n.createElement("div",{className:"question-text-container"},n.createElement("div",{className:"question-text ss-question-text",dangerouslySetInnerHTML:{__html:Un({questionText:e,placeholders:t,npsRating:Gn({theme:"nps",answers:r,questions:i})??"",npsRatingLabel:Yn({theme:"nps",answers:r,questions:i}),csatRating:Gn({theme:"csat",answers:r,questions:i})??"",csatRatingLabel:Yn({theme:"csat",answers:r,questions:i}),cesRating:Gn({theme:"ces",answers:r,questions:i})??"",cesRatingLabel:Yn({theme:"ces",answers:r,questions:i}),preference:a?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0})},role:"heading","aria-level":1})),b6=({block:e,saveFormValues:t,type:a,translationVariables:o,language:i})=>{const{question_type:r}=e.question?.type_info;switch(r){case"RANGE":return n.createElement(l6,{question:e.question,saveFormValues:e=>t(e,!0)});case"DROPDOWN":case"MULTI_CHOICE":case"MULTI_SELECT":return n.createElement(p6,{dir:In(i||"en")?"rtl":"ltr",question:e.question,saveFormValues:e=>t(e,!0),type:a,translationVariables:o});case"PARAGRAPH":case"INPUT":return null;default:return console.error(`Question type ${r} not supported`),null}},M6=({config:e,placeholders:a,onSelect:o,promptAccepted:i,type:r})=>{const c=t.useMemo((()=>e.reverse_order?e.choices?.reverse():e.choices),[e]);return n.createElement(n.Fragment,null,n.createElement("div",{className:"question-container ss-question-container "+(null==i?"active":"")},n.createElement(d6,{text:e.text,placeholders:a}),n.createElement("ul",{className:"choices one-line"},c?.map(((e,t)=>n.createElement("li",{className:"choice",key:`prompt-${e}-${t}`},n.createElement("button",{className:"action",onClick:()=>{o(Number(e.id))}},n.createElement(I,{name:Number(e.id)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),e.value)))))),void 0!==i&&n.createElement("div",{className:"answers-container"},n.createElement("div",{className:"answers"},"whatsapp"===r&&n.createElement("div",{className:"reply-block"},n.createElement("p",{className:"user"},"Acme.inc"),n.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:Un({questionText:e.text,placeholders:a})}})),n.createElement("div",{className:"answer-text"},n.createElement(I,{name:Number(i)?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),c.find((e=>e.id==i))?.value))),!1===i&&e.is_declined&&e.declined_message&&n.createElement("div",{className:"question-container ss-question-container"},n.createElement(d6,{text:e.declined_message,placeholders:a})))},z6=e=>{const{activeBlock:a,activeIndexOfBlocks:o,activeIndexOfRenderedBlocks:i,answers:r,saveFormValues:c,blocks:s,questions:l,renderedBlocks:p,onSubmitHandler:u,isSurveyCompleted:d,pivot:b}=RP(e),{type:M="whatsapp"}=e,{question_type:z}=a?.question.type_info??{},m=n.useMemo((()=>Fn(b?.question)),[b?.question]),h=t.useRef(null),[f,A]=t.useState(void 0),v=YN({blocks:s,activeIndexOfBlocks:o,renderedBlocks:p,activeIndexOfRenderedBlocks:i,questions:l});return t.useEffect((()=>{h.current&&h.current.scroll({top:1e4,behavior:"smooth"})}),[a,r,d]),a&&a.question?n.createElement("div",{className:`${M} whatsapp-container`},n.createElement("div",{className:"msg-container"},n.createElement("div",{className:"scroll-wrapper",ref:h},e.survey.prompt_settings?n.createElement(M6,{config:e.survey.prompt_settings,onSelect:e=>{A(1===e)},promptAccepted:f,placeholders:e.placeholders,type:M}):null,!e.survey.prompt_settings||f?p.map(((t,z)=>{const h=t.question.type_info?.scale_properties?.labels?.preference,f=t.question.type_info?.scale_properties?.labels?.values||[];return n.createElement(n.Fragment,null,n.createElement("div",{className:"question-container ss-question-container "+(d||z!==p.length-1?"":"active")},n.createElement(d6,{text:t.question.text,placeholders:e.placeholders,pivot:b,rangeToRender:m}),n.createElement(b6,{language:e.language||"en",block:t,placeholders:e.placeholders,saveFormValues:(e,n)=>{c(t,e,n),setTimeout((()=>{!0===n&&YN({blocks:s,activeIndexOfBlocks:o,renderedBlocks:p,activeIndexOfRenderedBlocks:i,questions:l})&&u("COMPLETE")}))},type:M})),t.name===a.name&&!r.commitDirtyValue||O.isNil(r.formValues[t.question.name])?null:n.createElement("div",{className:"answers-container"},n.createElement("div",{className:"answers"},"THUMBS"===t.question.type_info?.type_variant?n.createElement(n.Fragment,null,"whatsapp"===M&&n.createElement("div",{className:"reply-block"},n.createElement("p",{className:"user"},"Acme.inc"),n.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:c6.sanitize(Un({questionText:t.question.text||"",placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:r,questions:l})??"",npsRatingLabel:Yn({theme:"nps",answers:r,questions:l}),csatRating:Gn({theme:"csat",answers:r,questions:l})??"",csatRatingLabel:Yn({theme:"csat",answers:r,questions:l}),cesRating:Gn({theme:"ces",answers:r,questions:l})??"",cesRatingLabel:Yn({theme:"ces",answers:r,questions:l}),preference:b?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),n.createElement("div",{className:"answer-text"},n.createElement(I,{name:Number(r.formValues[t.question.name])?"whatsapp-thumbs-up":"whatsapp-thumbs-down"}),"all"===t.question.type_info?.scale_properties?.labels?.preference&&t.question.type_info?.scale_properties?.labels?.values?.[Number(r.formValues[t.question.name])])):"EMOJI"===t.question.type_info?.type_variant||"STAR"===t.question.type_info?.type_variant?n.createElement(n.Fragment,null,"whatsapp"===M&&r.formValues[t.question.name]&&n.createElement("div",{className:"reply-block"},n.createElement("p",{className:"user"},"Acme.inc"),n.createElement("p",{className:"question",dangerouslySetInnerHTML:{__html:c6.sanitize(Un({questionText:t.question.text||"",placeholders:e.placeholders,npsRating:Gn({theme:"nps",answers:r,questions:l})??"",npsRatingLabel:Yn({theme:"nps",answers:r,questions:l}),csatRating:Gn({theme:"csat",answers:r,questions:l})??"",csatRatingLabel:Yn({theme:"csat",answers:r,questions:l}),cesRating:Gn({theme:"ces",answers:r,questions:l})??"",cesRatingLabel:Yn({theme:"ces",answers:r,questions:l}),preference:b?.question.type_info?.scale_properties?.labels?.preference,isPreview:!0}))}})),n.createElement("div",{className:"answer-text"},n.createElement("div",{className:"star-rating-wrapper"},Array.from({length:Number(r.formValues[t.question.name])},((e,t)=>n.createElement(I,{name:"whatsapp-star",id:`ans-${t}`})))," ","all"===h||"edges"===h&&(1===r.formValues[t.question.name]||r.formValues[t.question.name]===f.length)?f[Number(r.formValues[t.question.name])-1]:null))):"DROPDOWN"===t.question.type_info?.question_type||"MULTI_SELECT"===t.question.type_info?.question_type?n.createElement(n.Fragment,null,t.question.choices?.find((e=>e.id===r.formValues[t.question.name]))?.value||r.formValues[t.question.name]?.toString()):n.createElement(n.Fragment,null,r.formValues[t.question.name]?.toString()))))})):null,d&&n.createElement("div",{className:"question-container ss-question-container",id:"new"},n.createElement(d6,{text:ZN({pivotQn:b?.question,pivotQnAnswer:b?.answer,block:e.survey.blocks?.find((e=>"TY"===e.name)),questions:l})?.text,placeholders:e.placeholders,pivot:b,rangeToRender:m})))),n.createElement(u6,{onChange:e=>{"PARAGRAPH"!==z||d||c(a,e.target.value)},value:"PARAGRAPH"===z&&!d&&r.formValues[a.question.name]?r.formValues[a.question.name]:"",activeBlock:!0,autoFocus:"PARAGRAPH"===z,onSubmit:()=>{c(a,r?.formValues?.[a.question.name],!0),v&&u("COMPLETE")}})):null},m6=e=>{const{survey:a,previewConfig:o}=e,[i,r]=t.useState(!1),[c,s]=t.useState(!1),[l,p]=t.useState({others_meta:{}}),{block:u,question:d,agentName:b,userName:M}=n.useMemo((()=>{const e=a.blocks.find((e=>!e.is_deleted)),t=a.question_details?.questions?.find((t=>t.name===e?.question_name||e?.category?.map((e=>e.question_name)).includes(t.name)));return{block:e,question:t,agentName:o?.agent?.firstName||o?.agent?.lastName?`${o?.agent?.firstName??""} ${o?.agent?.lastName??""}`.trim():"John Doe",userName:o?.user?.firstName||o?.user?.lastName?`${o?.user?.firstName??""} ${o?.user?.lastName??""}`.trim():"Hartmann"}}),[o?.agent?.firstName,o?.agent?.lastName,o?.user?.firstName,o?.user?.lastName,a.blocks,a.question_details?.questions]);return u?.name&&d?.name?n.createElement("div",{className:"web-chat-channel"},n.createElement("div",{className:"wc-header"},n.createElement("div",{className:"wc-h-action-button"},n.createElement(I,{name:"arrow-left"})),n.createElement("div",{className:"wc-h-info"},n.createElement("div",{className:"wc-h-info-main wc-wrap-text"},o?.topicName??"Instant support"),n.createElement("div",{className:"wc-h-info-sub wc-wrap-text"},o?.topicDescription??"Typically responds in 5 mins")),n.createElement("div",{className:"wc-h-action-button"},n.createElement(I,{name:"close"}))),n.createElement("div",{className:"wc-body"},n.createElement("div",{className:"wc-body-scroll-container"},n.createElement("div",{className:"wc-agent-details"},n.createElement("div",{className:"wc-icon"},o?.agent?.imageUrl?n.createElement("img",{src:o?.agent?.imageUrl,alt:b,className:"wc-a-avatar"}):b?.slice(0,1)),n.createElement("div",{className:"wc-a-info"},n.createElement("div",{className:"wc-a-i-name wc-break-text"},b),n.createElement("div",{className:"wc-a-i-designation wc-break-text"},o?.agent?.designation??"Sr. Customer support agent"))),n.createElement("div",{className:"wc-agent-chat-wrapper"},n.createElement("div",{className:"wc-icon"},o?.user?.imageUrl?n.createElement("img",{src:o?.user?.imageUrl,alt:M,className:"wc-a-avatar"}):M?.slice(0,1)),n.createElement("div",{className:"w-a-c-container"},n.createElement("div",{className:"wc-a-s-name wc-break-text"},M),n.createElement("div",{className:"wc-a-survey-wrapper"},n.createElement(n4,{block:u,question:d,surveyStyle:"card",onAnswer:e=>{p({...e.question.name?{[e.question.name]:e.value}:{},others_meta:{}}),r(!0)},isMobile:!0,theme:e.survey.theme??{},language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables})),n.createElement("div",{className:"wc-a-timestamp wc-break-text"},o?.timeString??(new Date).toLocaleTimeString())))),n.createElement("div",{className:"wc-footer"},n.createElement("div",{className:"w-f-link wc-wrap-text"},o?.actionText??"Continue chat"))),n.createElement("div",{className:"web-chat-survey-preview"},i&&n.createElement(t4,{answers:l,answerStatus:"PARTIAL",language:e.language,surveyServAssetUrl:e.surveyServAssetUrl,translationVariables:e.translationVariables,preview:!0,isSurveyCompleted:c,onAnsweringPrompt:e=>{},onDismiss:()=>{r(!1)},onClose:()=>{r(!1)},onSubmit:(e,t,n)=>{"COMPLETE"===n&&(s(!0),setTimeout((()=>{t()}),0))},isMobile:!0,placeholders:{},survey:e.survey,surveyType:"compact"}))):null};var h6=Object.freeze({__proto__:null,allPathsLoader:function(e,t){return Bo(void 0,void 0,void 0,(function(){return _o(this,(function(n){switch(n.label){case 0:return[4,Promise.resolve().then((function(){return Fi}))];case 1:return[2,(0,n.sent().getIconPaths)(e,t)]}}))}))}}),f6=Object.freeze({__proto__:null,splitPathsBySizeLoader:function(e,t){return Bo(void 0,void 0,void 0,(function(){var n,a;return _o(this,(function(o){switch(o.label){case 0:return n=_i(e),t!==Di.STANDARD?[3,2]:[4,Promise.resolve().then((function(){return Ii}))];case 1:return a=o.sent(),[3,4];case 2:return[4,Promise.resolve().then((function(){return Vi}))];case 3:a=o.sent(),o.label=4;case 4:return[2,a[n]]}}))}))}});exports.ALL_FONTS=B,exports.Binary=F,exports.Button=G,exports.ChannelPreview=e=>{aa("ChannelPreview",e);const{survey:t,answers:a}=XN(e.survey,e.answers);return n.useEffect((()=>{const t=document?.documentElement;!_n(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),n.useEffect((()=>{t.theme&&Zn(t.theme,e.surveyServAssetUrl??"")}),[t.theme,e.surveyServAssetUrl]),"chat"===e.channel?n.createElement(m6,{...e,survey:t,answers:a}):"whatsapp"===e.channel?n.createElement(z6,{...e,survey:t,answers:a}):"instagram"===e.channel?n.createElement(z6,{type:"instagram",...e,survey:t,answers:a}):(console.error(`Channel ${e.channel} not supported`),null)},exports.Checkbox=Re,exports.DEFAULT_FONT=$,exports.DatePicker=cq,exports.DateTimePicker=sq,exports.Dropdown=ca,exports.FONT_SIZE_OPTIONS=_,exports.Input=ra,exports.Loader=ua,exports.PhoneNumberInput=da,exports.ProgressBar=lq,exports.QuestionPreview=n4,exports.RadioGroup=aS,exports.Range=rS,exports.RankOrder=VT,exports.Slider=HN,exports.Survey=e=>{const{survey:t,answers:a}=XN(e.survey,e.answers),[o,i]=n.useState(!1);return n.useEffect((()=>{"undefined"!=typeof window&&window&&window.matchMedia&&"undefined"!=typeof sessionStorage&&sessionStorage&&sessionStorage.clear&&(aa("Survey matchMedia",{innerHeight:window.innerHeight,innerWidth:window.innerWidth}),i(window.matchMedia("(max-width: 550px)").matches),wP(localStorage))}),[]),n.useEffect((()=>{const t=document?.documentElement;!_n(e.surveyServAssetUrl)&&t&&setTimeout((()=>{t.style.setProperty("--fsc-whatsapp-bg",`url(${e.surveyServAssetUrl}/survey/whatsapp-bg.svg)`),t.style.setProperty("--fsc-instagram-bg",`url(${e.surveyServAssetUrl}/survey/instagram-bg.svg)`)}),0)}),[e.surveyServAssetUrl]),aa("Survey",{...e,survey:t,isMobile:o,answers:a}),n.createElement(n.Fragment,null,t.theme?.advanced?.additional_css&&n.createElement("style",null,t.theme?.advanced?.additional_css?.replaceAll("\n","")?.replaceAll("!important","").replaceAll(/;/g," !important;")),"standard"===e.surveyStyle?n.createElement(j5,{...e,answers:a,survey:t,isMobile:o||!!e.isMobile,initialQuestionAnswer:e.initialQuestionAnswer}):n.createElement(_5,{...e,answers:a,survey:t,isMobile:o||!!e.isMobile,surveyStyle:"card",initialQuestionAnswer:e.initialQuestionAnswer}))},exports.SurveyFooter=pa,exports.SurveyProgress=({isSurveyCompleted:e,totalBlocks:t,completedText:a,noOfAnswers:o})=>{const i=e?100:(o||0)/(t||1)*100;return n.createElement("div",{className:"survey-progress ss-survey-progress"},n.createElement("span",{className:"progress-completion"},i.toFixed(),"% "),a||"survey completed",n.createElement(lq,{totalSteps:t,completedSteps:e?t:o}))},exports.TextArea=DN,exports.WebInAppSurvey=t4;
|