@opengovsg/confetti 0.7.5 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { a as RatingAnswer, i as MultiSelectAnswer, o as SingleSelectAnswer, r as BugReportAnswer, t as PublicGetSurveyOutput } from "./index-CER9nZlw.js";
1
+ import { a as MultiSelectAnswer, i as BugReportAnswer, n as PublicGetSurveyOutput, o as RatingAnswer, s as SingleSelectAnswer, t as Locale } from "./index-BBwAZoO2.js";
2
2
  import { PropsWithChildren, ReactNode } from "react";
3
3
 
4
4
  //#region src/core/types.d.ts
@@ -142,13 +142,19 @@ interface ConfettiControllerProps extends Finishable {
142
142
  * `onFinished` which fires after it.
143
143
  */
144
144
  onSubmitted?: () => void;
145
+ /**
146
+ * Locale for resolving default validation error messages that have no
147
+ * author-written value to translate. Defaults to English.
148
+ */
149
+ locale?: Locale;
145
150
  }
146
151
  declare const ConfettiController: ({
147
152
  current: currentProp,
148
153
  shouldAutoSubmit,
149
154
  onSubmitted,
150
155
  onFinished,
151
- children
156
+ children,
157
+ locale
152
158
  }: ConfettiControllerProps) => import("react").JSX.Element;
153
159
  //#endregion
154
160
  //#region src/contracts/state.d.ts
@@ -233,7 +239,8 @@ type WithVisibilityControl<P> = Omit<P, 'respondent'> & {
233
239
  * Gates whether the survey renders for this respondent. Pass `false` to hide
234
240
  * it, or a predicate that receives the respondent state and returns whether
235
241
  * to show it. When omitted, the survey shows whenever it is available for the
236
- * respondent.
242
+ * respondent. A boolean skips the respondent-state fetch; a callback still
243
+ * fetches history so the predicate can read it.
237
244
  */
238
245
  isSurveyVisible?: IsSurveyVisible;
239
246
  };
@@ -264,7 +271,8 @@ interface RespondentVisibilityProviderProps extends PropsWithChildren<Pick<Surve
264
271
  * Gates whether the survey renders for this respondent. Pass `false` to hide
265
272
  * it, or a predicate that receives the respondent state and returns whether
266
273
  * to show it. When omitted, the survey shows whenever it is available for the
267
- * respondent.
274
+ * respondent. A boolean skips the respondent-state fetch; a callback still
275
+ * fetches history so the predicate can read it.
268
276
  */
269
277
  isSurveyVisible?: IsSurveyVisible;
270
278
  }
@@ -0,0 +1 @@
1
+ import{n as e}from"./Button-LiaNjkvk.js";import{t}from"./src-tvLZOC2M.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l(e){return typeof e!=`boolean`}function u({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const d={lastRespondedAt:null,lastDismissedAt:null};async function f({client:e,surveyId:n,respondent:r,signal:i}){try{let a=await e.get(`api/v1/cfti/${n}/respondent/${r}`,{signal:i}).json(),o=t.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),d)}catch{return d}}function p({client:e,surveyId:t,respondent:i,enabled:a=!0}){let[o,s]=r(d),[c,l]=r(()=>!a),[u,p]=r({client:e,surveyId:t,respondent:i,enabled:a});return(u.client!==e||u.surveyId!==t||u.respondent!==i||u.enabled!==a)&&(p({client:e,surveyId:t,respondent:i,enabled:a}),s(d),l(!a)),n(()=>{if(!a||!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;f({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(s(e),l(!0))})};r();let o=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,o),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,o)}},[e,t,i,a]),{state:o,isSettled:c}}function m({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${t}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const h=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),g=({onClick:t,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(e,{onPress:t,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(h,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{u as a,p as i,h as n,c as o,m as r,l as s,g as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,o as n,r,s as i}from"./DefaultConfettiTrigger-CN5hBUrU.js";import{D as a,E as o,G as s,I as c,N as l,O as u,R as d,T as f,V as p,_ as m,a as h,b as g,d as _,g as v,h as y,i as b,k as x,m as S,n as C,o as w,p as T,r as E,s as D,u as O,x as k,y as A,z as j}from"./Button-LiaNjkvk.js";import{a as M,c as ee,d as te,f as ne,i as re,l as ie,o as ae,p as oe,s as se,u as ce}from"./src-tvLZOC2M.js";import{a as le,n as ue,o as de,r as fe,t as pe}from"./internals-wbzqfeGS.js";import{S as me,_ as he,a as N,b as ge,c as _e,g as ve,h as ye,i as be,l as xe,o as Se,p as Ce,r as we,s as Te,u as Ee,v as De,x as Oe,y as ke}from"./ModalContainer-CtsM2uHt.js";import P,{Suspense as Ae,cloneElement as je,createContext as F,forwardRef as I,isValidElement as Me,lazy as Ne,useCallback as L,useContext as R,useEffect as z,useMemo as B,useRef as V,useState as H}from"react";import{useTimeout as Pe}from"usehooks-ts";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"clsx";import"react-dom";function Fe(e,t,n){let r=f(e=>{n&&!e.defaultPrevented&&n(t)});z(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Ie(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=j(t);let o=j(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=ge({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Le(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Ie(e),s=d([!!t,!!n,r,i]),c=d([!!t,!!n,r,i]);return o=u(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function Re(e,t,n){let{validationBehavior:r,focus:i}=e;p(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Be(n.current))}});let a=V(!1),o=f(()=>{a.current||t.resetValidation()}),s=f(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ve(r)===n.current&&(i?i():n.current?.focus(),O(`keyboard`)),e.preventDefault()}),c=f(()=>{t.commitValidation()});z(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&l(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,c),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,c),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function ze(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function Be(e){return{isInvalid:!e.validity.valid,validationDetails:ze(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Ve(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}const He={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Ue={...He,customError:!0,valid:!1},q={isInvalid:!1,validationDetails:He,validationErrors:[]},We=F({}),Ge=`__reactAriaFormValidationState`;function J(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Ge];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ke(e)}function Ke(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Ue},l=B(()=>!o||i==null?null:Ye(Je(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=R(We),d=B(()=>r?Array.isArray(r)?r.flatMap(e=>qe(u[e])):qe(u[r]):[],[u,r]),[f,p]=H(u),[m,h]=H(!1);u!==f&&(p(u),h(!1));let g=B(()=>Ye(m?[]:d),[m,d]),_=V(q),[v,y]=H(q),b=V(q),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Xe(e,b.current)||(b.current=e,y(e))},[S,C]=H(!1);return z(x),{realtimeValidation:c||g||l||a||q,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Xe(v,e)?y(e):_.current=e},resetValidation(){let e=q;Xe(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function qe(e){return e?Array.isArray(e)?e:[e]:[]}function Je(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return qe(n)}return[]}function Ye(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Ue}:null}function Xe(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Ze(...e){let t=new Set,n=!1,r={...He};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function Qe(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[d,f]=he(e.value,e.defaultValue||``,e.onChange),{focusableProps:p}=D(e,t),m=J({...e,value:d}),{isInvalid:h,validationErrors:g,validationDetails:_}=m.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=Le({...e,isInvalid:h,errorMessage:e.errorMessage||g}),S=a(e,{labelable:!0}),C={type:s,pattern:e.pattern},[w]=H(d);return Fe(t,e.defaultValue??w,f),Re(e,m,t),{labelProps:v,inputProps:u(S,n===`input`?C:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":h||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:d,onChange:e=>f(l(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(P.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...p,...y}),descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_}}function $e(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:d,"aria-label":f,"aria-labelledby":p,validationState:m=`valid`,isInvalid:h,onPressStart:g,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S}=e,C=e=>{e.stopPropagation(),t.setSelected(l(e).checked)},{pressProps:w,isPressed:T}=_({onPressStart:g,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S,isDisabled:r}),{pressProps:E,isPressed:O}=_({onPressStart:g,onPressEnd:v,onPressChange:y,onPressUp:x,onClick:S,onPress(e){b?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:k}=D(e,n),A=u(w,k),j=a(e,{labelable:!0});return Fe(n,t.defaultSelected,t.setSelected),{labelProps:u(E,{onClick:e=>e.preventDefault()}),inputProps:u(j,{"aria-invalid":h||m===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:C,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...A}),isSelected:t.isSelected,isPressed:T||O,isDisabled:r,isReadOnly:i,isInvalid:h||m===`invalid`}}function et(e,t,n){let r=J({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:d,isDisabled:f,isReadOnly:p}=$e({...e,isInvalid:i},t,n);Re(e,r,n);let{isIndeterminate:m,isRequired:h,validationBehavior:g=`aria`}=e;z(()=>{n.current&&(n.current.indeterminate=!!m)});let{pressProps:v}=_({isDisabled:f||p,onPress(){let{[Ge]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:u(s,v,B(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":h&&g===`aria`||void 0,required:h&&g===`native`},isSelected:l,isPressed:d,isDisabled:f,isReadOnly:p,isInvalid:i,validationErrors:a,validationDetails:o}}const tt=new WeakMap;function nt(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:l}=t.displayValidation,{labelProps:d,fieldProps:f,descriptionProps:p,errorMessageProps:m}=Le({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});tt.set(t,{name:r,form:i,descriptionId:p.id,errorMessageId:m.id,validationBehavior:o});let h=a(e,{labelable:!0}),{focusWithinProps:g}=w({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:u(h,{role:`group`,"aria-disabled":n||void 0,...f,...g}),labelProps:d,descriptionProps:p,errorMessageProps:m,isInvalid:s,validationErrors:c,validationDetails:l}}function rt(e={}){let{isReadOnly:t}=e,[n,r]=he(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=H(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function it(e,t,n){let r=rt({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=tt.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=J({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=V(q),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};z(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=et({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[Ge]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const at=new WeakMap;function ot(e,t,n){let{value:r,children:i,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:l,onPressChange:d,onPress:f,onPressUp:p,onClick:m}=e,h=e.isDisabled||t.isDisabled,g=t.selectedValue===r,v=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:y,isPressed:b}=_({onPressStart:c,onPressEnd:l,onPressChange:d,onPress:f,onPressUp:p,onClick:m,isDisabled:h}),{pressProps:x,isPressed:S}=_({onPressStart:c,onPressEnd:l,onPressChange:d,onPressUp:p,onClick:m,isDisabled:h,onPress(e){f?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:C}=D(u(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),w=u(y,C),T=a(e,{labelable:!0}),E=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(E=0):t.selectedValue===r&&(E=0),h&&(E=void 0);let{name:O,form:k,descriptionId:A,errorMessageId:j,validationBehavior:M}=at.get(t);return Fe(n,t.defaultSelectedValue,t.setSelectedValue),Re({validationBehavior:M},t,n),{labelProps:u(x,B(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:u(T,{...w,type:`radio`,name:O,form:k,tabIndex:E,disabled:h,required:t.isRequired&&M===`native`,checked:g,value:r,onChange:v,"aria-describedby":[e[`aria-describedby`],t.isInvalid?j:null,A].filter(Boolean).join(` `)||void 0}),isDisabled:h,isSelected:g,isPressed:b||S}}function st(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:d=`vertical`,validationBehavior:f=`aria`}=e,{direction:p}=ke(),{isInvalid:m,validationErrors:h,validationDetails:g}=t.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Le({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||h}),x=a(e,{labelable:!0}),{focusWithinProps:S}=w({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),C=e=>{let n;switch(e.key){case`ArrowRight`:n=p===`rtl`&&d!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=p===`rtl`&&d!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=De(e.currentTarget,{from:l(e),accept:e=>e instanceof c(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},T=j(n);return at.set(t,{name:T,form:r,descriptionId:y.id,errorMessageId:b.id,validationBehavior:f}),{radioGroupProps:u(x,{role:`radiogroup`,onKeyDown:C,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":o||void 0,"aria-disabled":s||void 0,"aria-orientation":d,...v,...S}),labelProps:_,descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}const ct=F({}),Y=E(function(e,t){[e,t]=S(e,t,ct);let{elementType:n=`label`,...r}=e,i=A[n];return P.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),lt=F({}),X=I(function(e,t){[e,t]=S(e,t,lt);let{elementType:n=`span`,...r}=e,i=A[n];return P.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function ut(e={}){let[t,n]=he(e.value,e.defaultValue||[],e.onChange),[r]=H(t),i=!!e.isRequired&&t.length===0,a=V(new Map),o=J({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Ze(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let dt=Math.round(Math.random()*1e10),ft=0;function pt(e){let t=B(()=>e.name||`radio-group-${dt}-${++ft}`,[e.name]),[n,r]=he(e.value,e.defaultValue??null,e.onChange),[i]=H(n),[a,o]=H(null),s=J({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const Z=F(null),mt=I(function(e,t){return R(Z)?.isInvalid?P.createElement(ht,{...e,ref:t}):null}),ht=I((e,t)=>{let n=R(Z),r=a(e,{global:!0}),i=y({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:P.createElement(X,{slot:`errorMessage`,...r,...i,ref:t})}),gt=F(null),_t=F(null),vt=F(null),yt=I(function(e,t){[e,t]=S(e,t,_t);let{validationBehavior:n}=k(gt)||{},r=e.validationBehavior??n??`native`,i=ut({...e,validationBehavior:r}),[o,s]=v(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:d,errorMessageProps:f,...p}=nt({...e,label:s,validationBehavior:r},i),m=y({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),h=a(e,{global:!0});return P.createElement(A.div,{...u(h,m,c),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},P.createElement(T,{values:[[vt,i],[ct,{...l,ref:o,elementType:`span`}],[lt,{slots:{description:d,errorMessage:f}}],[Z,p]]},m.children))}),bt=I(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=S(r,t,me);let{validationBehavior:i}=k(gt)||{},s=e.validationBehavior??i??`native`,c=R(vt),l=o(B(()=>x(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:m,isReadOnly:_,isPressed:v,isInvalid:C}=c?it({...g(e),value:e.value,children:typeof e.children==`function`||e.children},c,l):et({...g(e),children:typeof e.children==`function`||e.children,validationBehavior:s},rt(e),l),{isFocused:w,isFocusVisible:T,focusProps:E}=h(),D=m||_,{hoverProps:O,isHovered:j}=b({...e,isDisabled:D}),M=y({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:v,isHovered:j,isFocused:w,isFocusVisible:T,isDisabled:m,isReadOnly:_,isInvalid:C,isRequired:e.isRequired||!1}}),ee=a(e,{global:!0});return delete ee.id,delete ee.onClick,P.createElement(A.label,{...u(ee,d,O,M),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":v||void 0,"data-hovered":j||void 0,"data-focused":w||void 0,"data-focus-visible":T||void 0,"data-disabled":m||void 0,"data-readonly":_||void 0,"data-invalid":C||void 0,"data-required":e.isRequired||void 0},P.createElement(ve,{elementType:`span`},P.createElement(`input`,{...u(f,E),ref:l})),M.children)}),xt=F({}),St=F({});let Ct=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const wt=E(function(e,t){[e,t]=S(e,t,St);let{hoverProps:n,isHovered:r}=b({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=h({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=y({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return P.createElement(A.input,{...u(Ct(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),Tt=F(null);function Et(e){let t=V({});return P.createElement(Tt.Provider,{value:t},e.children)}const Dt=F({isSelected:!1}),Ot=F(null),kt=F(null),At=F(null),jt=I(function(e,t){[e,t]=S(e,t,Ot);let{validationBehavior:n}=k(gt)||{},r=e.validationBehavior??n??`native`,i=pt({...e,validationBehavior:r}),[o,s]=v(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:d,errorMessageProps:f,...p}=st({...e,label:s,validationBehavior:r},i),m=y({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),h=a(e,{global:!0});return P.createElement(A.div,{...u(h,m,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},P.createElement(T,{values:[[At,i],[ct,{...l,ref:o,elementType:`span`}],[lt,{slots:{description:d,errorMessage:f}}],[Z,p]]},P.createElement(Et,null,m.children)))}),Mt=I(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=S(r,t,kt);let i=P.useContext(At),s=o(B(()=>x(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:c,inputProps:l,isSelected:d,isDisabled:f,isPressed:p}=ot({...g(e),children:typeof e.children==`function`||e.children},i,s),{isFocused:m,isFocusVisible:_,focusProps:v}=h(),C=f||i.isReadOnly,{hoverProps:w,isHovered:T}=b({...e,isDisabled:C}),E=y({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:d,isPressed:p,isHovered:T,isFocused:m,isFocusVisible:_,isDisabled:f,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,P.createElement(A.label,{...u(D,c,w,E),ref:t,"data-selected":d||void 0,"data-pressed":p||void 0,"data-hovered":T||void 0,"data-focused":m||void 0,"data-focus-visible":_||void 0,"data-disabled":f||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},P.createElement(ve,{elementType:`span`},P.createElement(`input`,{...u(l,v),ref:s})),P.createElement(Dt.Provider,{value:{isSelected:d}},E.children))}),Nt=F({});let Pt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ft=I(function(e,t){[e,t]=S(e,t,Nt);let{hoverProps:n,isHovered:r}=b(e),{isFocused:i,isFocusVisible:a,focusProps:o}=h({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=y({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return P.createElement(A.textarea,{...u(Pt(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),It=F(null),Lt=E(function(e,t){[e,t]=S(e,t,It);let{validationBehavior:n}=k(gt)||{},r=e.validationBehavior??n??`native`,i=V(null);[e,i]=S(e,i,Oe);let[o,s]=v(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=H(`input`),{labelProps:u,inputProps:d,descriptionProps:f,errorMessageProps:p,...m}=Qe({...g(e),inputElementType:c,label:s,validationBehavior:r},i),h=L(e=>{i.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=y({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:m.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=a(e,{global:!0});return delete b.id,P.createElement(A.div,{...b,..._,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":m.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},P.createElement(T,{values:[[ct,{...u,ref:o}],[St,{...d,ref:h}],[Nt,{...d,ref:h}],[xt,{role:`presentation`,isInvalid:m.isInvalid,isDisabled:e.isDisabled||!1}],[lt,{slots:{description:f,errorMessage:p}}],[Z,m]]},_.children))}),Q=e=>e===void 0||e===``||Array.isArray(e)&&e.length===0||!Array.isArray(e)&&typeof e==`object`&&M(e),Rt=({answer:e,defaultAnswer:t})=>{if(!Q(e)||!Q(t))return e},zt=(e,t)=>e.type===`end`?!1:e.type!==`next`||!t,Bt=({routingLogic:e,answer:t,required:n,isLastQuestion:r})=>{if(e.type!==`always`&&Q(t)&&n)return!0;let i=e.type===`always`?e.target:Q(t)?e.default:e.cases.find(e=>le({answer:t,condition:e}))?.target??e.default;return zt(i,r)},Vt=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=[...e].sort((e,t)=>e.position-t.position),a=r>=0?i[r]:void 0,o=de(i,t,{forceReachableIds:a?[a.id]:void 0}),s=i.map((e,t)=>{let i={...e},a=n[e.id];return a&&(i.error=a),{...i,visible:r===t||o.has(e.id)}}),c=s.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return c===-1&&(c=s.findLastIndex(e=>!!e.visible)),{questions:s,currentIndex:c}},$={rating:({scale:e},t)=>ee({scale:e},t),"open-ended":({max:e},t)=>se({maxLength:e},t),"single-select":({editable:e},t)=>ie({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>ae({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>ce(),"bug-report":(e,t)=>re({},t)},Ht=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=$[n];return r(e,t)}case`open-ended`:{let r=$[n];return r(e,t)}case`single-select`:{let r=$[n];return r(e,t)}case`multi-select`:{let r=$[n];return r(e,t)}case`statement`:{let r=$[n];return r(e,t)}case`bug-report`:{let r=$[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Ut=({questions:e,answers:t})=>{let n=Wt({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Wt=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Gt=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Kt={},qt=({questions:e,answers:t,errors:n,locale:r})=>{let i={};for(let a of e){if(!a.visible||!a.required||t[a.id]!==void 0||n[a.id])continue;let e=Ht(a.properties,{required:a.required}).safeParse(void 0);e.success||(i[a.id]=ye(e.error,r))}return i},Jt=e=>{let t=e.querySelector(`[data-invalid]`);if(!t)return;let n=t.getAttribute(`role`);if(n===`radiogroup`||n===`group`){t.tabIndex=-1,t.focus();return}t.querySelector(`textarea, input`)?.focus()},Yt=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i,locale:a})=>{let{survey:o,submit:s}=Ce(),[c,l]=H({}),[u,d]=H({}),[f,p]=H(null),m=B(()=>Vt({originalQuestions:o?.questions,answers:c,errors:u,pointer:e}),[o?.questions,c,u,e]),h=e??f??m.currentIndex,g=B(()=>!!o?.isBackNavigationAllowed&&h>0&&m.questions.slice(0,h).some(e=>!!e.visible),[o?.isBackNavigationAllowed,m.questions,h]),_=L((e,t)=>{let n=m.questions.find(t=>t.id===e)?.required??!1,r=Q(t);l(i=>{if(!n&&r)return i[e]===null?i:{...i,[e]:null};if(n&&r){if(!(e in i))return i;let t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}})},[m.questions]),v=L(()=>{o?.isBackNavigationAllowed&&p(t=>{let n=t??e??m.currentIndex;for(let e=n-1;e>=0;e--)if(m.questions[e]?.visible)return e;return t})},[o?.isBackNavigationAllowed,m.questions,m.currentIndex,e]),[y,b]=H(0),x=y>0,S=V(null),[C,w]=H(!1);z(()=>{y===0||!S.current||Jt(S.current)},[y]);let T=L(({answers:e})=>{s({answers:e}).finally(()=>{r?.()})},[r,s]),E=L(()=>{let e=Gt({questions:m.questions,errors:u}),t=qt({questions:m.questions,answers:c,errors:e,locale:a}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&d(e=>({...e,...t})),b(e=>e+1),!1;let i=Ut({questions:m.questions,answers:c});return T({answers:i}),w(!0),n?.(),!0},[c,u,m.questions,T,n,a]),D=L(({question:r,answer:i})=>{let s=m.questions.at(r);if(!s)return{error:`Question index is invalid`};let h=Ht(s.properties,{required:s.required}).safeParse(i);if(!h.success){let e=ye(h.error,a);return d(t=>{if(t[s.id]===e)return t;let n={...t};return n[s.id]=e,n}),l(e=>{if(!(s.id in e))return e;let t={...e};return delete t[s.id],t}),{error:e}}d(e=>{if(!e[s.id])return e;let t={...e};return delete t[s.id],t});let g=Q(i),_=!s.required&&g?null:i,v={...c},y=v[s.id]!==_;v[s.id]=_;let b=Vt({originalQuestions:o?.questions,answers:v,errors:u,pointer:e});y&&l(v);let x=b.questions.findIndex((e,t)=>t>r&&!!e.visible);if(f!==null&&x!==-1)return p(x),{next:x};if(p(null),b.questions.filter(({visible:e})=>!!e).every(({id:e})=>v[e]!==void 0)&&t){let e=Ut({questions:b.questions,answers:v});T({answers:e}),w(!0),n?.()}return{next:b.currentIndex}},[m.questions,c,o?.questions,u,t,e,f,T,n,a]);return m.questions.length===0?W(U,{}):W(`div`,{ref:S,className:`confetti ${pe}`,"data-show-errors":x||void 0,children:i({questions:m.questions,current:h,answers:c,update:D,back:v,canGoBack:g,backButtonLabel:o?.backButtonLabel??void 0,saveAnswer:_,submit:E,isSubmitted:C,errors:x?u:Kt})})},Xt=F(null);function Zt({children:a,surveyId:o,publishableKey:c,apiBaseUrl:l,respondent:u,isSurveyVisible:d}){let f=e({surveyId:o,override:u}),p=s({publishableKey:c,apiBaseUrl:l}),{isAvailable:m,isSettled:h}=r({client:p,surveyId:o}),{state:g,isSettled:_}=t({client:p,surveyId:o,respondent:f,enabled:i(d)}),v=B(()=>({respondent:f}),[f]);return!f||!h||!_||!m||!n(g,d)?null:W(Xt.Provider,{value:v,children:a})}function Qt(e){return R(Xt)?W(U,{children:e.children}):W(Zt,{...e})}function $t(){let e=R(Xt);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const en=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3,locale:o})=>{let{surveyId:s,survey:c,dismiss:l}=Ce(),[u,d]=H(!1),[f,p]=H(!1),[m,h]=H(!1),[g,_]=H(!1);return Pe(()=>{c&&i?.()},f&&!(m||g)?a:null),G(`div`,{className:K(`confetti-dialog ${pe}`,t?.dialog),id:`${s}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),h(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),h(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),_(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||_(!1)},children:[W(we,{className:K(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:o,onClose:async()=>{u||(await l(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>d(!0),setIsFinished:()=>p(!0)}):e]})},tn=3e4,nn=({maskAllInputs:e,initialEventsJson:t,locale:n}={})=>{let[r,i]=H(()=>t??null),[a,o]=H(!1),[s,c]=H(null),[l,u]=H(30),d=V(null),f=V(null),p=V(null),m=V([]);z(()=>{let e=new CustomEvent(fe,{detail:{isRecording:a}});document.dispatchEvent(e)},[a]);let h=L(()=>{f.current&&=(clearInterval(f.current),null),p.current&&=(clearTimeout(p.current),null),d.current=null,u(tn/1e3)},[]),g=L(()=>{d.current?.(),h(),o(!1),i(JSON.stringify(m.current))},[h]);return{recordingEventsJson:r,isRecording:a,recordingError:s,remainingSeconds:l,startRecording:L(async()=>{o(!0),c(null),i(null),m.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);d.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{m.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=tn/1e3;u(n),f.current=setInterval(()=>{--n,u(n)},1e3),p.current=setTimeout(()=>{g()},tn)}catch{c(N(n).recordingError),o(!1),h()}},[e,g,h,n]),stopRecording:g,clear:L(()=>{h(),o(!1),i(null),c(null),m.current=[]},[h])}},rn=e=>e.replace(/\S/g,`*`),an=e=>`*`.repeat(e.length),on=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):on(n,t)},sn=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,an(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=an(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=an(t.textContent)},cn=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${ue}`)){on(e,e=>{e.data=rn(e.data)}),sn(e);for(let t of e.querySelectorAll(`input, textarea, select`))sn(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))sn(e)}}}),ln=({maskAllInputs:e,initialDataUrl:t,locale:n}={})=>{let[r,i]=H(()=>t??null),[a,o]=H(!1),[s,c]=H(null);return{screenshotDataUrl:r,isCapturing:a,captureError:s,capture:L(async()=>{o(!0),c(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),n=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${pe}`],excludeMode:`hide`,plugins:[cn({maskInputs:!!e})],fast:!1})).toCanvas(),r=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*r),n.width),o=Math.min(Math.round(window.innerHeight*r),n.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(n,0,0,a,o,0,0,a,o),i(s.toDataURL(`image/png`))}catch{c(N(n).captureError)}finally{o(!1)}},[e,n]),clear:L(()=>{i(null),c(null)},[])}},un=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`circle`,{cx:`12`,cy:`12`,r:`10`}),W(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),dn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`path`,{d:`M10 11v6`}),W(`path`,{d:`M14 11v6`}),W(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),W(`path`,{d:`M3 6h18`}),W(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function fn(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function pn(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=fn();return{userAgent:e.userAgent,screenResolution:`${t.width}x${t.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,language:e.language,timestamp:new Date().toISOString(),datadogTraceId:n?.traceId,datadogSessionId:n?.sessionId,datadogSessionReplayLink:n?.sessionReplayLink}}const mn=Ne(()=>import(`./RecordingReplayer-DNYXhses.js`)),hn=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c,defaultAnswer:l,locale:u})=>{let d=B(()=>pn(),[]),f=l&&typeof l==`object`&&`title`in l?l:void 0,[p,m]=H(()=>f?.title??``),[h,g]=H(()=>f?.description??``),{screenshotDataUrl:_,isCapturing:v,captureError:y,capture:b,clear:x}=ln({maskAllInputs:c,initialDataUrl:f?.screenshotDataUrl,locale:u}),{recordingEventsJson:S,isRecording:w,recordingError:T,remainingSeconds:E,startRecording:D,stopRecording:O,clear:k}=nn({maskAllInputs:c,initialEventsJson:f?.recordingEventsJson,locale:u}),A=B(()=>({title:p,...h?{description:h}:{},..._?{screenshotDataUrl:_}:{},...S?{recordingEventsJson:S}:{},metadata:d}),[h,d,S,_,p]);z(()=>{i(A)},[A,i]),z(()=>()=>{O()},[O]);let j=B(()=>S?JSON.parse(S):[],[S]);return W(U,{children:w?G(C,{className:K(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:O,children:[W(un,{}),G(`span`,{children:[30-E,`s /`,` `,30,`s`]})]}):G(`div`,{className:K(`cf-bug-report`,s?.base),children:[G(Lt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:p,onChange:m,className:K(`cf-question`,s?.question),children:[G(`div`,{className:K(`cf-header`,s?.header),children:[G(Y,{className:K(`cf-title`,s?.title),children:[t,!a&&G(`span`,{className:K(`cf-label-optional`,s?.optionalLabel),children:[` `,N(u).optional]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,s?.description),children:n})]}),W(wt,{placeholder:Te(r.placeholder,u),className:K(`cf-input`,s?.input)}),W(mt,{className:K(`cf-error`,s?.error),children:o})]}),G(Lt,{name:`${e}-description`,value:h,onChange:g,className:K(`cf-question`,s?.question),children:[W(Y,{className:K(`cf-title`,s?.title),children:r.detailsLabel}),W(Ft,{placeholder:Se(r.detailsPlaceholder,u),className:K(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?G(`section`,{className:K(`cf-question`,s?.question),children:[W(Y,{className:K(`cf-title`,s?.title),children:N(u).attachments}),G(`div`,{className:K(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&G(`div`,{className:K(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[_?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(`img`,{src:_,alt:N(u).screenshotPreview,className:K(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(C,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:x,"aria-label":N(u).removeScreenshot,children:W(dn,{})})})]}):W(C,{className:K(`cf-bug-report-button`,s?.button),onPress:b,isDisabled:v,children:v?N(u).capturing:N(u).screenshot}),y&&W(`div`,{className:K(`cf-error`,s?.error),children:y})]}),r.enableRecording&&G(`div`,{className:K(`cf-bug-report-recording-section`,s?.recordingSection),children:[j.length>0?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(Ae,{fallback:W(`span`,{className:K(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":N(u).loadingRecordingPreview}),children:W(mn,{events:j})}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(C,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:k,"aria-label":N(u).removeRecording,children:W(dn,{})})})]}):W(C,{className:K(`cf-bug-report-button`,s?.button),onPress:D,children:N(u).record}),T&&W(`div`,{className:K(`cf-error`,s?.error),children:T})]})]})]}):null]})})},gn=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let[u,d]=H(()=>typeof c==`string`?c:``);return z(()=>{i(u)},[i,u]),G(Lt,{isRequired:o,isInvalid:!!s,name:e,className:K(`cf-question`,a?.question),value:u,onChange:e=>{d(e),i(e)},children:[G(`div`,{className:K(`cf-header`,a?.header),children:[G(Y,{className:K(`cf-title`,a?.title),children:[t,!o&&G(`span`,{className:K(`cf-label-optional`,a?.optionalLabel),children:[` `,N(l).optional]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,a?.description),children:n})]}),W(Ft,{className:K(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||N(l).startTyping}),W(mt,{className:K(`cf-error`,a?.error),children:s})]})},_n=({children:e,classNames:t,description:n,...r})=>W(bt,{...r,children:({isIndeterminate:r})=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,t?.label),children:[W(`div`,{className:K(`cf-checkbox-indicator`,t?.indicator),children:W(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:K(`cf-checkbox-indicator-svg`,t?.svg),children:r?W(`rect`,{x:1,y:7.5,width:16,height:3}):W(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&W(`span`,{className:K(`cf-choice-description`,t?.choiceDescription),children:n})]})}),vn=({children:e,classNames:t,...n})=>W(bt,{...n,children:W(`div`,{className:K(`cf-tag-label`,t?.tagLabel),children:e})}),yn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=Ee(n.editable?.label,l),f=n.display??`checkbox`,p=Array.isArray(c)?c:[],m=new Set(n.options.map(e=>e.value)),h=p.find(e=>!m.has(e)),[g,_]=H(()=>{let e=p.filter(e=>m.has(e));return h!==void 0&&u&&e.push(te),e}),[v,y]=H(()=>h!==void 0&&u?h:``),b=V(null),x=V(null),S=B(()=>{let e=g.indexOf(te);if(e===-1)return g;let t=[...g];return t[e]=v||`__CONFETTI_CHECKBOX_Others`,t},[v,g]),C=f===`tag`;return z(()=>{i(S)},[i,S]),W(yt,{isRequired:o,isInvalid:!!s,name:a,value:g,onChange:_,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(Y,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,N(l).optional]})]}),t&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,f===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>W(C?vn:_n,{className:K(`cf-choice`,C&&[`cf-tag`,r?.tag],!C&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),u&&(C?G(U,{children:[W(vn,{inputRef:b,onChange:e=>{x.current&&e&&requestAnimationFrame(()=>{x.current&&x.current.focus()})},className:K(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:d}),W(wt,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:v,onChange:e=>{y(e.target.value)},ref:x,className:K(`cf-input cf-tag-input`,r?.othersInput)})]}):G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(_n,{inputRef:b,onChange:e=>{x.current&&e&&requestAnimationFrame(()=>{x.current&&x.current.focus()})},className:K(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:d}),W(wt,{value:v,onChange:e=>{y(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:x,onFocus:()=>{b.current?.checked===!1&&b.current.click()},className:K(`cf-input`,r?.othersInput)})]}))]}),W(mt,{className:K(`cf-error`,r?.error),children:s})]})})},bn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),xn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),Sn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),Cn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),wn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),Tn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:W(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),En=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:W(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),Dn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return W(`div`,{className:K(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return W(Mt,{className:K(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:W(o?En:Tn,{})},t)})})},On=({properties:e,classNames:t})=>W(`div`,{className:K(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return W(Mt,{className:K(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),kn=({properties:e,classNames:t,state:n})=>{let r=B(()=>[bn,Sn,Cn,wn,xn],[]),i=B(()=>[Sn,Cn,wn],[]);return B(()=>e.scale===3||e.scale===5,[e.scale])?W(`div`,{className:K(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return W(Mt,{className:K(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&W(c,{})},a)})}):W(On,{properties:e,classNames:t,state:n})},An=e=>{switch(e.properties.display??`star`){case`emoji`:return W(kn,{...e});case`number`:return W(On,{...e});case`star`:return W(Dn,{...e})}},jn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s,defaultAnswer:c,locale:l})=>{let[u,d]=H(()=>typeof c==`number`?String(c):null),f=B(()=>u?Number(u):void 0,[u]);return z(()=>{i(f)},[i,f]),W(jt,{isRequired:s,isInvalid:!!o,name:a,className:K(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(Y,{className:K(`cf-title`,r?.title),children:[t,!s&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,N(l).optional]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:n})]}),G(`div`,{className:K(`cf-rating-section`,r?.ratingSection),children:[W(An,{state:i,properties:e,classNames:r}),G(`div`,{className:K(`cf-rating-text`,r?.ratingText),children:[W(`span`,{className:K(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),W(`span`,{className:K(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),W(mt,{className:K(`cf-error`,r?.error),children:o})]})})},Mn=({classNames:e,className:t,description:n,...r})=>W(Mt,{...r,className:K(t,e?.radio),children:m(r.children,t=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,e?.label),children:[W(`div`,{className:K(`cf-radio-indicator`,e?.indicator)}),t]}),n&&W(`span`,{className:K(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Nn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=Ee(n.editable?.label,l),f=typeof c==`string`?c:null,p=f!==null&&n.options.some(e=>e.value===f),[m,h]=H(()=>f===null?null:p?f:u?ne:null),[g,_]=H(()=>f!==null&&!p&&u?f:``),v=V(null),y=V(null),b=B(()=>m===`__CONFETTI_RADIO_Others`?g||`__CONFETTI_RADIO_Others`:m??void 0,[g,m]);return z(()=>{i(b)},[i,b]),W(jt,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{h(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},value:m,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(Y,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,N(l).optional]})]}),t&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>W(Mn,{classNames:{indicator:r?.indicator,radio:K(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),u&&G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(Mn,{inputRef:v,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:K(`cf-radio`,r?.radio)},description:n.editable?.description,children:d}),W(wt,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:y,value:g,onChange:e=>_(e.target.value),onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:K(`cf-input`,r?.othersInput)})]})]}),W(mt,{className:K(`cf-error`,r?.error),children:s})]})})},Pn=({properties:e,title:t,description:n,classNames:r})=>W(`div`,{className:K(`cf-question`,r?.question),children:G(`div`,{className:K(`cf-header`,r?.header),children:[t&&W(`div`,{className:K(`cf-title`,r?.title),children:t}),n&&W(`div`,{className:K(`cf-description`,r?.description),children:n})]})}),Fn=({question:e,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a})=>{switch(e.properties.type){case`rating`:return W(jn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`open-ended`:return W(gn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`single-select`:return W(Nn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`multi-select`:return W(yn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`statement`:return W(Pn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return W(hn,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a},e.id)}return W(`div`,{children:N(a).unsupportedQuestionType},e.id)},In=({title:e,description:t,classNames:n,onClose:r,locale:i})=>{let{survey:a}=Ce();if(!a)return null;let o=t||a.confirmation.description;return G(U,{children:[W(`div`,{className:K(`cf-question`,n?.question),children:G(`div`,{className:K(`cf-header`,n?.header),children:[W(Y,{className:K(`cf-title`,n?.title),children:e||xe(a.confirmation.title,i)}),o&&W(X,{slot:`description`,className:K(`cf-description`,n?.description),children:o})]})}),W(C,{className:`cf-submit-button`,onPress:()=>{r?.()},children:_e(a.confirmation.buttonText,i)})]})},Ln=({onPress:e,children:t,locale:n})=>be()?null:W(C,{className:`cf-back-button`,onPress:e,children:t===void 0?N(n).back:t}),Rn=({question:e,answer:t,isLastQuestion:n,locale:r})=>{if(e.properties.buttonLabel)return e.properties.buttonLabel;let i=N(r);return Bt({routingLogic:e.routingLogic,answer:t,required:e.required,isLastQuestion:n})?!e.required&&Q(t)?i.skip:i.next:i.submit},zn=({onPress:e,isDisabled:t,children:n,locale:r})=>be()?null:W(C,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n===void 0?N(r).submit:n}),Bn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},Vn=e=>!Q(e),Hn=({onSubmit:e,children:t,question:n,isLastQuestion:r,defaultAnswer:i,backButton:a,saveAnswer:o,locale:s})=>{let c=be(),[l,u]=H(i??Bn(n.properties.type)),d=B(()=>Ht(n.properties,{required:n.required}),[n.properties,n.required]),f=B(()=>{let e=d.safeParse(l);if(!e.success)return ye(e.error,s)},[l,d,s]),p=B(()=>Rn({question:n,answer:l,isLastQuestion:r,locale:s}),[l,r,s,n]),m=L(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=oe.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(l)}},[l,e,n.properties]),h=Vn(i),g=B(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties])&&!h,_=L(t=>{u(t),g&&Vn(t)&&d.safeParse(t).success&&e(t)},[g,d,e]),v=B(()=>{if(!a||!Me(a))return a;let e=a;return je(e,{onPress:()=>{let t=Rt({answer:l,defaultAnswer:i});t!==void 0&&o?.(t),e.props.onPress?.()}})},[a,l,i,o]);return G(U,{children:[t({onChange:_,question:n,error:f,defaultAnswer:i}),!c&&G(`div`,{className:`cf-button-row`,children:[v,(!g||!n.required)&&W(zn,{isDisabled:!!f,onPress:m,children:p})]})]})},Un=({onSubmit:e,children:t,locale:n})=>G(U,{children:[t,W(zn,{onPress:e,locale:n})]});export{Fn as a,jn as c,en as d,Xt as f,Yt as h,In as i,yn as l,$t as m,Hn as n,Pn as o,Qt as p,Ln as r,Nn as s,Un as t,gn as u};
@@ -1,3 +1,5 @@
1
+ import { t as Locale } from "./index-BBwAZoO2.js";
2
+
1
3
  //#region src/components/container/ModalContainer.d.ts
2
4
  interface ModalContainerProps {
3
5
  closeOnFinishMs?: number | null;
@@ -9,6 +11,11 @@ interface ModalContainerProps {
9
11
  closeButton?: string;
10
12
  icon?: string;
11
13
  };
14
+ /**
15
+ * Locale for resolving the close button's "Dismiss" aria-label. Defaults
16
+ * to English.
17
+ */
18
+ locale?: Locale;
12
19
  /**
13
20
  * Invoked when the user dismisses the survey via the close button or the
14
21
  * overlay before submitting. Not invoked on auto-close after finish, on the
@@ -51,7 +58,8 @@ declare const ModalContent: ({
51
58
  onClose,
52
59
  closeOnFinishMs,
53
60
  isSubmitted,
54
- onSubmitted
61
+ onSubmitted,
62
+ locale
55
63
  }: ModalContentProps) => import("react").JSX.Element;
56
64
  declare const ModalContainer: ({
57
65
  children,
@@ -59,7 +67,8 @@ declare const ModalContainer: ({
59
67
  onDismiss,
60
68
  onClose,
61
69
  isDismissable,
62
- closeOnFinishMs
70
+ closeOnFinishMs,
71
+ locale
63
72
  }: ModalContainerProps) => import("react").JSX.Element;
64
73
  //#endregion
65
74
  export { ModalContainerProps as n, ModalContent as r, ModalContainer as t };
@@ -1,5 +1,5 @@
1
- import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,c as ee,f as te,h as ne,j as re,k as ie,l as ae,m as oe,o as se,p as ce,t as le,v as ue,w as de,y as fe,z as pe}from"./Button-LiaNjkvk.js";import{n as me,r as he}from"./src-DKk1GrYu.js";import{i as ge,r as _e,t as ve}from"./internals-BzehCtEV.js";import b,{createContext as x,forwardRef as ye,useCallback as S,useContext as C,useEffect as w,useMemo as T,useReducer as be,useRef as E,useState as D}from"react";import{useTimeout as xe}from"usehooks-ts";import{z as O}from"zod";import{Fragment as Se,jsx as k,jsxs as Ce}from"react/jsx-runtime";import A from"clsx";import we,{flushSync as Te}from"react-dom";const Ee=x(null);x(null),x(null),x(null),x(null);const De=x({});x(null);const Oe=x(null);var ke=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(t){if(!e(this.root,t))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let n=[],r=t,i=t;for(this._currentNode=t;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=r,t=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});n.push(t),t.currentNode=i,this._currentSetFor.add(t),r=i=e.host}else r=r.parentNode;let a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});n.push(a),a.currentNode=i,this._currentSetFor.add(a),this._walkerStack=n}get doc(){return this._doc}firstChild(){let t=this.currentNode,n=this.nextNode();return e(t,n)?(n&&(this.currentNode=n),n):(this.currentNode=t,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Ae(e,t,n,r){return p()?new ke(e,t,n,r):e.createTreeWalker(t,n,r)}function je(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=pe(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function j(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Me(e,t){let n=e;for(j(n,t)&&(n=n.parentElement);n&&!j(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const Ne=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!Ne.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Pe(){let e=t(),[n,r]=D(()=>e?{width:0,height:0}:Fe());return w(()=>{let e=e=>{r(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(Fe())},n,i=t=>{N&&N.scale>1||M(d(t))&&(n=requestAnimationFrame(()=>{let t=u();(!t||!M(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(Fe()),y()&&window.addEventListener(`blur`,i,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(n),y()&&window.removeEventListener(`blur`,i,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),n}function Fe(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function Ie(e,t=!0){let[n,r]=D(!0),i=n&&t;return v(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),Re(e,i,S(()=>r(!1),[])),i}function Le(e,t){let[n,r]=D(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return Re(e,i,S(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function Re(e,t,n){v(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Te(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const ze=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Be(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let P=new WeakMap,F=[];function Ve(t,n){let r=c(t?.[0]),i=n instanceof r.Element?{root:n}:n,o=i?.root??document.body,s=i?.shouldUseInert&&ze,l=new Set(t),u=new Set,d=e=>s&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{s&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},m=new Set;if(p())for(let e of t){let t=e;for(;t&&t!==o;){let e=t.getRootNode();`shadowRoot`in e&&m.add(e.shadowRoot),t=e.parentNode}}let h=t=>{for(let e of t.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))l.add(e);let n=t=>{if(u.has(t)||l.has(t)||t.parentElement&&u.has(t.parentElement)&&t.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let n of l)if(e(t,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=Ae(a(t),t,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(t);if(i===NodeFilter.FILTER_ACCEPT&&g(t),i!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;e!=null;)g(e),e=r.nextNode()}},g=e=>{let t=P.get(e)??0;d(e)&&t===0||(t===0&&f(e,!0),u.add(e),P.set(e,t+1))};F.length&&F[F.length-1].disconnect(),h(o);let _=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Be(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});_.observe(o,{childList:!0,subtree:!0});let v=new Set;if(p())for(let t of m){let n=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Be(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});n.observe(t,{childList:!0,subtree:!0}),v.add(n)}let y={visibleNodes:l,hiddenNodes:u,observe(){_.observe(o,{childList:!0,subtree:!0})},disconnect(){_.disconnect()}};return F.push(y),()=>{if(_.disconnect(),p())for(let e of v)e.disconnect();for(let e of u){let t=P.get(e);t!=null&&(t===1?(f(e,!1),P.delete(e)):P.set(e,t-1))}y===F[F.length-1]?(F.pop(),F.length&&F[F.length-1].observe()):F.splice(F.indexOf(y),1)}}const He=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Ue=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function We(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return He.has(t.script)}let t=e.split(`-`)[0];return Ue.has(t)}const Ge=Symbol.for(`react-aria.i18n.locale`);function Ke(){let e=typeof window<`u`&&window[Ge]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:We(e)?`rtl`:`ltr`}}let qe=Ke(),I=new Set;function Je(){qe=Ke();for(let e of I)e(qe)}function Ye(){let e=t(),[n,r]=D(qe);return w(()=>(I.size===0&&window.addEventListener(`languagechange`,Je),I.add(r),()=>{I.delete(r),I.size===0&&window.removeEventListener(`languagechange`,Je)}),[]),e?{locale:typeof window<`u`&&window[Ge]||`en-US`,direction:`ltr`}:n}const Xe=b.createContext(null);function Ze(){let e=Ye();return C(Xe)||e}const Qe=Symbol.for(`react-aria.i18n.locale`),$e=Symbol.for(`react-aria.i18n.strings`);let L;var et=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=tt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Qe];if(L===void 0){let t=window[$e];if(!t)return null;L={};for(let r in t)L[r]=new e({[n]:t[r]},n)}let r=L?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function tt(e,t,n=`en-US`){if(t[e])return t[e];let r=nt(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function nt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const rt=new Map,it=new Map;var at=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=rt.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),rt.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=it.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),it.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const ot=new WeakMap;function st(e){let t=ot.get(e);return t||(t=new et(e),ot.set(e,t)),t}function ct(e,t){return t&&et.getGlobalDictionaryForPackage(t)||st(e)}function lt(e,t){let{locale:n}=Ze(),r=ct(e,t);return T(()=>new at(n,r),[n,r])}const ut=b.createContext(null),dt=`react-aria-focus-scope-restore`;let R=null;function ft(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=E(null),s=E(null),c=E([]),{parentNode:l}=C(ut)||{},d=T(()=>new Dt({scopeRef:c}),[c]);v(()=>{let e=l||K.root;if(K.getTreeNode(e.scopeRef)&&R&&!U(R,e.scopeRef)){let t=K.getTreeNode(R);t&&(e=t)}e.addChild(d),K.addNode(d)},[d,l]),v(()=>{let e=K.getTreeNode(c);e&&(e.contain=!!n)},[n]),v(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(dt,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(dt,n)}},[t]),St(c,r,n),gt(c,n),wt(c,r,n),xt(c,i),w(()=>{let e=u(a(c.current?c.current[0]:void 0)),t=null;if(V(e,c.current)){for(let n of K.traverse())n.scopeRef&&V(e,n.scopeRef.current)&&(t=n);t===K.getTreeNode(c)&&(R=t.scopeRef)}},[c]),v(()=>()=>{let e=K.getTreeNode(c)?.parent?.scopeRef??null;(c===R||U(c,R))&&(!e||K.getTreeNode(e))&&(R=e),K.removeTreeNode(c)},[c]);let f=T(()=>pt(c),[]),p=T(()=>({focusManager:f,parentNode:d}),[d,f]);return b.createElement(ut.Provider,{value:p},b.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,b.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function pt(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[0].previousElementSibling,d=G(z(n),{tabbable:i,accept:s},n);d.currentNode=V(c,n)?c:l;let f=d.nextNode();return!f&&o&&(d.currentNode=l,f=d.nextNode()),f&&W(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[n.length-1].nextElementSibling,d=G(z(n),{tabbable:i,accept:s},n);d.currentNode=V(c,n)?c:l;let f=d.previousNode();return!f&&o&&(d.currentNode=l,f=d.previousNode()),f&&W(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=G(z(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&W(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=G(z(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&W(o,!0),o}}}function z(e){return e[0].parentElement}function B(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function mt(e){if(!e.form)return Array.from(a(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=c(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ht(e){if(e.checked)return!0;let t=mt(e);return t.length>0&&!t.some(e=>e.checked)}function gt(e,t){let n=E(void 0),r=E(void 0);v(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let o=a(i?i[0]:void 0),l=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=u(o),r=e.current;if(!r||!V(n,r))return;let i=G(z(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let a=t.shiftKey?i.previousNode():i.nextNode();a||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&(W(a,!0),a instanceof c(a).HTMLInputElement&&a.select())},f=t=>{(!R||U(R,e))&&V(d(t),e.current)?(R=e,n.current=d(t)):B(e)&&!H(d(t),e)?n.current?n.current.focus():R&&R.current&&bt(R.current):B(e)&&(n.current=d(t))},p=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ae(),i=(r===`virtual`||r===null)&&_()&&s(),a=u(o);if(!i&&a&&B(e)&&!H(a,e)){R=e;let r=d(t);r&&r.isConnected?(n.current=r,n.current?.focus()):R.current&&bt(R.current)}})};return o.addEventListener(`keydown`,l,!1),o.addEventListener(`focusin`,f,!1),i?.forEach(e=>e.addEventListener(`focusin`,f,!1)),i?.forEach(e=>e.addEventListener(`focusout`,p,!1)),()=>{o.removeEventListener(`keydown`,l,!1),o.removeEventListener(`focusin`,f,!1),i?.forEach(e=>e.removeEventListener(`focusin`,f,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,p,!1))}},[e,t]),v(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function _t(e){return H(e)}function V(t,n){return!t||!n?!1:n.some(n=>e(n,t))}function H(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of K.traverse(K.getTreeNode(t)))if(n&&V(e,n.current))return!0;return!1}function vt(e){return H(e,R)}function U(e,t){let n=K.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function W(e,t=!1){if(e!=null&&!t)try{ee(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function yt(e,t=!0){let n=e[0].previousElementSibling,r=z(e),i=G(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=z(e),i=G(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function bt(e,t=!0){W(yt(e,t))}function xt(e,t){let n=b.useRef(t);w(()=>{n.current&&(R=e,!V(u(a(e.current?e.current[0]:void 0)),R.current)&&e.current&&bt(e.current)),n.current=!1},[e])}function St(e,t,n){v(()=>{if(t||n)return;let r=e.current,i=a(r?r[0]:void 0),o=t=>{let n=d(t);V(n,e.current)?R=e:_t(n)||(R=null)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function Ct(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function wt(e,t,n){let r=E(typeof document<`u`?u(a(e.current?e.current[0]:void 0)):null);v(()=>{let r=e.current,i=a(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!R||U(R,e))&&V(u(i),e.current)&&(R=e)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),v(()=>{let r=a(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=r.activeElement;if(!H(n,e)||!Ct(e))return;let i=K.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=G(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!H(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(H(s,e));t.preventDefault(),t.stopPropagation(),s?W(s,!0):_t(a)?W(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),v(()=>{let n=a(e.current?e.current[0]:void 0);if(!t)return;let i=K.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=K.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=u(n);if(t&&i&&(a&&H(a,e)||a===n.body&&Ct(e))){let t=K.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Tt(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&K.getTreeNode(n.scopeRef)){Tt(yt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Tt(e){e.dispatchEvent(new CustomEvent(dt,{bubbles:!0,cancelable:!0}))&&W(e)}function G(t,r,i){let o=r?.tabbable?de:n,s=a(t?.nodeType===Node.ELEMENT_NODE?t:null),c=Ae(s,t||s,NodeFilter.SHOW_ELEMENT,{acceptNode(t){return e(r?.from,t)||r?.tabbable&&t.tagName===`INPUT`&&t.getAttribute(`type`)===`radio`&&(!ht(t)||c.currentNode.tagName===`INPUT`&&c.currentNode.type===`radio`&&c.currentNode.name===t.name)?NodeFilter.FILTER_REJECT:o(t)&&(!i||V(t,i))&&(!r?.accept||r.accept(t))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return r?.from&&(c.currentNode=r.from),c}var Et=class e{constructor(){this.fastMap=new Map,this.root=new Dt({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Dt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&V(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Dt=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let K=new Et;const Ot=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function kt(e,t,n){let[r,i]=D(e||t),a=E(r),o=E(e!==void 0),s=e!==void 0;w(()=>{o.current,o.current=s},[s]);let c=s?e:r;Ot(()=>{a.current=c});let[,l]=be(()=>({}),{});return[c,S((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}function At({children:e}){let t=T(()=>({register:()=>{}}),[]);return b.createElement(te.Provider,{value:t},e)}function jt(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,o=E({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=g(e=>{n&&Mt(e,t)&&(i&&i(e),o.current.isPointerDown=!0)}),c=g(e=>{n&&n(e)});w(()=>{let e=o.current;if(r)return;let n=t.current,i=a(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Mt(n,t)&&c(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,s,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,s,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function Mt(t,n){if(t.button>0)return!1;let r=d(t);if(r){let t=r.ownerDocument;if(!t||!e(t.documentElement,r)||r.closest(`[data-react-aria-top-layer]`))return!1}return n.current?!t.composedPath().includes(n.current):!1}const Nt={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function Pt(e={}){let{style:t,isFocusable:n}=e,[r,i]=D(!1),{focusWithinProps:a}=se({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=T(()=>r?t:t?{...Nt,...t}:Nt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Ft(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=Pt(e);return b.createElement(n,f(a,o),t)}const It=x({});function Lt(){return C(It)??{}}const Rt=b.createContext(null);function zt(e){let n=t(),{portalContainer:r=n?null:document.body,isExiting:i}=e,[a,o]=D(!1),s=T(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Lt();if(!e.portalContainer&&c&&(r=c()),!r)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(ft,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},l)),l=b.createElement(Rt.Provider,{value:s},b.createElement(At,null,l)),we.createPortal(l,r)}function Bt(){let e=C(Rt)?.setContain;v(()=>{e?.(!0)},[e])}function Vt(e,t){let{role:n=`dialog`}=e,i=m();i=e[`aria-label`]?void 0:i;let a=E(!1);return w(()=>{if(t.current&&!re(t.current)){ee(t.current);let e=setTimeout(()=>{(u()===t.current||u()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),ee(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Bt(),E(!1),w(()=>{}),{dialogProps:{...r(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}var Ht={};Ht={dismiss:`تجاهل`};var Ut={};Ut={dismiss:`Отхвърляне`};var Wt={};Wt={dismiss:`Odstranit`};var Gt={};Gt={dismiss:`Luk`};var Kt={};Kt={dismiss:`Schließen`};var qt={};qt={dismiss:`Απόρριψη`};var Jt={};Jt={dismiss:`Dismiss`};var Yt={};Yt={dismiss:`Descartar`};var Xt={};Xt={dismiss:`Lõpeta`};var Zt={};Zt={dismiss:`Hylkää`};var Qt={};Qt={dismiss:`Rejeter`};var $t={};$t={dismiss:`התעלם`};var en={};en={dismiss:`Odbaci`};var tn={};tn={dismiss:`Elutasítás`};var nn={};nn={dismiss:`Ignora`};var rn={};rn={dismiss:`閉じる`};var an={};an={dismiss:`무시`};var on={};on={dismiss:`Atmesti`};var sn={};sn={dismiss:`Nerādīt`};var cn={};cn={dismiss:`Lukk`};var ln={};ln={dismiss:`Negeren`};var un={};un={dismiss:`Zignoruj`};var dn={};dn={dismiss:`Descartar`};var fn={};fn={dismiss:`Dispensar`};var pn={};pn={dismiss:`Revocare`};var mn={};mn={dismiss:`Пропустить`};var hn={};hn={dismiss:`Zrušiť`};var gn={};gn={dismiss:`Opusti`};var _n={};_n={dismiss:`Odbaci`};var vn={};vn={dismiss:`Avvisa`};var yn={};yn={dismiss:`Kapat`};var bn={};bn={dismiss:`Скасувати`};var xn={};xn={dismiss:`取消`};var Sn={};Sn={dismiss:`關閉`};var Cn={};Cn={"ar-AE":Ht,"bg-BG":Ut,"cs-CZ":Wt,"da-DK":Gt,"de-DE":Kt,"el-GR":qt,"en-US":Jt,"es-ES":Yt,"et-EE":Xt,"fi-FI":Zt,"fr-FR":Qt,"he-IL":$t,"hr-HR":en,"hu-HU":tn,"it-IT":nn,"ja-JP":rn,"ko-KR":an,"lt-LT":on,"lv-LV":sn,"nb-NO":cn,"nl-NL":ln,"pl-PL":un,"pt-BR":dn,"pt-PT":fn,"ro-RO":pn,"ru-RU":mn,"sk-SK":hn,"sl-SI":gn,"sr-SP":_n,"sv-SE":vn,"tr-TR":yn,"uk-UA":bn,"zh-CN":xn,"zh-TW":Sn};function wn(e){return e&&e.__esModule?e.default:e}function Tn(e){let{onDismiss:t,...n}=e,r=je(n,lt(wn(Cn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(Ft,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const q=[];function En(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=E(void 0);w(()=>{if(i&&!q.includes(t))return q.push(t),()=>{let e=q.indexOf(t);e>=0&&q.splice(e,1)}},[i,t]);let l=()=>{q[q.length-1]===t&&n&&n()},u=e=>{let n=q[q.length-1];c.current=n,(!s||s(d(e)))&&n===t&&e.stopPropagation()},f=e=>{(!s||s(d(e)))&&(q[q.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},p=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};jt({ref:t,onInteractOutside:a&&i?f:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=se({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||vt(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const J=typeof document<`u`&&window.visualViewport;let Y=0,Dn;function On(e={}){let{isDisabled:t}=e;v(()=>{if(!t)return Y++,Y===1&&(Dn=y()?An():kn()),()=>{Y--,Y===0&&Dn()}},[t])}function kn(){let e=window.innerWidth-document.documentElement.clientWidth;return l(e>0&&(`scrollbarGutter`in document.documentElement.style?X(document.documentElement,`scrollbarGutter`,`stable`):X(document.documentElement,`paddingRight`,`${e}px`)),X(document.documentElement,`overflow`,`hidden`))}function An(){let e=X(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=d(e);t=j(r)?r:Me(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=h();a&&(i.nonce=a),i.textContent=`@layer {
1
+ import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,c as ee,f as te,h as ne,j as re,k as ie,l as ae,m as oe,o as se,p as ce,t as le,v as ue,w as de,y as fe,z as pe}from"./Button-LiaNjkvk.js";import{n as me,r as he}from"./src-tvLZOC2M.js";import{i as ge,r as _e,t as ve}from"./internals-wbzqfeGS.js";import b,{createContext as x,forwardRef as ye,useCallback as S,useContext as C,useEffect as w,useMemo as T,useReducer as be,useRef as E,useState as D}from"react";import{useTimeout as xe}from"usehooks-ts";import{z as O}from"zod";import{Fragment as Se,jsx as k,jsxs as Ce}from"react/jsx-runtime";import A from"clsx";import we,{flushSync as Te}from"react-dom";const Ee=x(null);x(null),x(null),x(null),x(null);const De=x({});x(null);const Oe=x(null);var ke=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(t){if(!e(this.root,t))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let n=[],r=t,i=t;for(this._currentNode=t;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=r,t=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});n.push(t),t.currentNode=i,this._currentSetFor.add(t),r=i=e.host}else r=r.parentNode;let a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});n.push(a),a.currentNode=i,this._currentSetFor.add(a),this._walkerStack=n}get doc(){return this._doc}firstChild(){let t=this.currentNode,n=this.nextNode();return e(t,n)?(n&&(this.currentNode=n),n):(this.currentNode=t,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Ae(e,t,n,r){return p()?new ke(e,t,n,r):e.createTreeWalker(t,n,r)}function je(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=pe(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function j(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Me(e,t){let n=e;for(j(n,t)&&(n=n.parentElement);n&&!j(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const Ne=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!Ne.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Pe(){let e=t(),[n,r]=D(()=>e?{width:0,height:0}:Fe());return w(()=>{let e=e=>{r(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(Fe())},n,i=t=>{N&&N.scale>1||M(d(t))&&(n=requestAnimationFrame(()=>{let t=u();(!t||!M(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(Fe()),y()&&window.addEventListener(`blur`,i,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(n),y()&&window.removeEventListener(`blur`,i,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),n}function Fe(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function Ie(e,t=!0){let[n,r]=D(!0),i=n&&t;return v(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),Re(e,i,S(()=>r(!1),[])),i}function Le(e,t){let[n,r]=D(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return Re(e,i,S(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function Re(e,t,n){v(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Te(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const ze=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Be(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let P=new WeakMap,F=[];function Ve(t,n){let r=c(t?.[0]),i=n instanceof r.Element?{root:n}:n,o=i?.root??document.body,s=i?.shouldUseInert&&ze,l=new Set(t),u=new Set,d=e=>s&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{s&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},m=new Set;if(p())for(let e of t){let t=e;for(;t&&t!==o;){let e=t.getRootNode();`shadowRoot`in e&&m.add(e.shadowRoot),t=e.parentNode}}let h=t=>{for(let e of t.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))l.add(e);let n=t=>{if(u.has(t)||l.has(t)||t.parentElement&&u.has(t.parentElement)&&t.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let n of l)if(e(t,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=Ae(a(t),t,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(t);if(i===NodeFilter.FILTER_ACCEPT&&g(t),i!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;e!=null;)g(e),e=r.nextNode()}},g=e=>{let t=P.get(e)??0;d(e)&&t===0||(t===0&&f(e,!0),u.add(e),P.set(e,t+1))};F.length&&F[F.length-1].disconnect(),h(o);let _=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Be(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});_.observe(o,{childList:!0,subtree:!0});let v=new Set;if(p())for(let t of m){let n=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Be(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});n.observe(t,{childList:!0,subtree:!0}),v.add(n)}let y={visibleNodes:l,hiddenNodes:u,observe(){_.observe(o,{childList:!0,subtree:!0})},disconnect(){_.disconnect()}};return F.push(y),()=>{if(_.disconnect(),p())for(let e of v)e.disconnect();for(let e of u){let t=P.get(e);t!=null&&(t===1?(f(e,!1),P.delete(e)):P.set(e,t-1))}y===F[F.length-1]?(F.pop(),F.length&&F[F.length-1].observe()):F.splice(F.indexOf(y),1)}}const He=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Ue=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function We(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return He.has(t.script)}let t=e.split(`-`)[0];return Ue.has(t)}const Ge=Symbol.for(`react-aria.i18n.locale`);function Ke(){let e=typeof window<`u`&&window[Ge]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:We(e)?`rtl`:`ltr`}}let qe=Ke(),I=new Set;function Je(){qe=Ke();for(let e of I)e(qe)}function Ye(){let e=t(),[n,r]=D(qe);return w(()=>(I.size===0&&window.addEventListener(`languagechange`,Je),I.add(r),()=>{I.delete(r),I.size===0&&window.removeEventListener(`languagechange`,Je)}),[]),e?{locale:typeof window<`u`&&window[Ge]||`en-US`,direction:`ltr`}:n}const Xe=b.createContext(null);function Ze(){let e=Ye();return C(Xe)||e}const Qe=Symbol.for(`react-aria.i18n.locale`),$e=Symbol.for(`react-aria.i18n.strings`);let L;var et=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=tt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Qe];if(L===void 0){let t=window[$e];if(!t)return null;L={};for(let r in t)L[r]=new e({[n]:t[r]},n)}let r=L?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function tt(e,t,n=`en-US`){if(t[e])return t[e];let r=nt(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function nt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const rt=new Map,it=new Map;var at=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=rt.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),rt.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=it.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),it.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const ot=new WeakMap;function st(e){let t=ot.get(e);return t||(t=new et(e),ot.set(e,t)),t}function ct(e,t){return t&&et.getGlobalDictionaryForPackage(t)||st(e)}function lt(e,t){let{locale:n}=Ze(),r=ct(e,t);return T(()=>new at(n,r),[n,r])}const ut=b.createContext(null),dt=`react-aria-focus-scope-restore`;let R=null;function ft(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=E(null),s=E(null),c=E([]),{parentNode:l}=C(ut)||{},d=T(()=>new Dt({scopeRef:c}),[c]);v(()=>{let e=l||K.root;if(K.getTreeNode(e.scopeRef)&&R&&!U(R,e.scopeRef)){let t=K.getTreeNode(R);t&&(e=t)}e.addChild(d),K.addNode(d)},[d,l]),v(()=>{let e=K.getTreeNode(c);e&&(e.contain=!!n)},[n]),v(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(dt,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(dt,n)}},[t]),St(c,r,n),gt(c,n),wt(c,r,n),xt(c,i),w(()=>{let e=u(a(c.current?c.current[0]:void 0)),t=null;if(V(e,c.current)){for(let n of K.traverse())n.scopeRef&&V(e,n.scopeRef.current)&&(t=n);t===K.getTreeNode(c)&&(R=t.scopeRef)}},[c]),v(()=>()=>{let e=K.getTreeNode(c)?.parent?.scopeRef??null;(c===R||U(c,R))&&(!e||K.getTreeNode(e))&&(R=e),K.removeTreeNode(c)},[c]);let f=T(()=>pt(c),[]),p=T(()=>({focusManager:f,parentNode:d}),[d,f]);return b.createElement(ut.Provider,{value:p},b.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,b.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function pt(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[0].previousElementSibling,d=G(z(n),{tabbable:i,accept:s},n);d.currentNode=V(c,n)?c:l;let f=d.nextNode();return!f&&o&&(d.currentNode=l,f=d.nextNode()),f&&W(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[n.length-1].nextElementSibling,d=G(z(n),{tabbable:i,accept:s},n);d.currentNode=V(c,n)?c:l;let f=d.previousNode();return!f&&o&&(d.currentNode=l,f=d.previousNode()),f&&W(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=G(z(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&W(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=G(z(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&W(o,!0),o}}}function z(e){return e[0].parentElement}function B(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function mt(e){if(!e.form)return Array.from(a(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=c(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ht(e){if(e.checked)return!0;let t=mt(e);return t.length>0&&!t.some(e=>e.checked)}function gt(e,t){let n=E(void 0),r=E(void 0);v(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let o=a(i?i[0]:void 0),l=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=u(o),r=e.current;if(!r||!V(n,r))return;let i=G(z(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let a=t.shiftKey?i.previousNode():i.nextNode();a||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&(W(a,!0),a instanceof c(a).HTMLInputElement&&a.select())},f=t=>{(!R||U(R,e))&&V(d(t),e.current)?(R=e,n.current=d(t)):B(e)&&!H(d(t),e)?n.current?n.current.focus():R&&R.current&&bt(R.current):B(e)&&(n.current=d(t))},p=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ae(),i=(r===`virtual`||r===null)&&_()&&s(),a=u(o);if(!i&&a&&B(e)&&!H(a,e)){R=e;let r=d(t);r&&r.isConnected?(n.current=r,n.current?.focus()):R.current&&bt(R.current)}})};return o.addEventListener(`keydown`,l,!1),o.addEventListener(`focusin`,f,!1),i?.forEach(e=>e.addEventListener(`focusin`,f,!1)),i?.forEach(e=>e.addEventListener(`focusout`,p,!1)),()=>{o.removeEventListener(`keydown`,l,!1),o.removeEventListener(`focusin`,f,!1),i?.forEach(e=>e.removeEventListener(`focusin`,f,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,p,!1))}},[e,t]),v(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function _t(e){return H(e)}function V(t,n){return!t||!n?!1:n.some(n=>e(n,t))}function H(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of K.traverse(K.getTreeNode(t)))if(n&&V(e,n.current))return!0;return!1}function vt(e){return H(e,R)}function U(e,t){let n=K.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function W(e,t=!1){if(e!=null&&!t)try{ee(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function yt(e,t=!0){let n=e[0].previousElementSibling,r=z(e),i=G(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=z(e),i=G(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function bt(e,t=!0){W(yt(e,t))}function xt(e,t){let n=b.useRef(t);w(()=>{n.current&&(R=e,!V(u(a(e.current?e.current[0]:void 0)),R.current)&&e.current&&bt(e.current)),n.current=!1},[e])}function St(e,t,n){v(()=>{if(t||n)return;let r=e.current,i=a(r?r[0]:void 0),o=t=>{let n=d(t);V(n,e.current)?R=e:_t(n)||(R=null)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function Ct(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function wt(e,t,n){let r=E(typeof document<`u`?u(a(e.current?e.current[0]:void 0)):null);v(()=>{let r=e.current,i=a(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!R||U(R,e))&&V(u(i),e.current)&&(R=e)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),v(()=>{let r=a(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=r.activeElement;if(!H(n,e)||!Ct(e))return;let i=K.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=G(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!H(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(H(s,e));t.preventDefault(),t.stopPropagation(),s?W(s,!0):_t(a)?W(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),v(()=>{let n=a(e.current?e.current[0]:void 0);if(!t)return;let i=K.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=K.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=u(n);if(t&&i&&(a&&H(a,e)||a===n.body&&Ct(e))){let t=K.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Tt(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&K.getTreeNode(n.scopeRef)){Tt(yt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Tt(e){e.dispatchEvent(new CustomEvent(dt,{bubbles:!0,cancelable:!0}))&&W(e)}function G(t,r,i){let o=r?.tabbable?de:n,s=a(t?.nodeType===Node.ELEMENT_NODE?t:null),c=Ae(s,t||s,NodeFilter.SHOW_ELEMENT,{acceptNode(t){return e(r?.from,t)||r?.tabbable&&t.tagName===`INPUT`&&t.getAttribute(`type`)===`radio`&&(!ht(t)||c.currentNode.tagName===`INPUT`&&c.currentNode.type===`radio`&&c.currentNode.name===t.name)?NodeFilter.FILTER_REJECT:o(t)&&(!i||V(t,i))&&(!r?.accept||r.accept(t))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return r?.from&&(c.currentNode=r.from),c}var Et=class e{constructor(){this.fastMap=new Map,this.root=new Dt({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Dt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&V(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Dt=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let K=new Et;const Ot=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function kt(e,t,n){let[r,i]=D(e||t),a=E(r),o=E(e!==void 0),s=e!==void 0;w(()=>{o.current,o.current=s},[s]);let c=s?e:r;Ot(()=>{a.current=c});let[,l]=be(()=>({}),{});return[c,S((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}function At({children:e}){let t=T(()=>({register:()=>{}}),[]);return b.createElement(te.Provider,{value:t},e)}function jt(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,o=E({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=g(e=>{n&&Mt(e,t)&&(i&&i(e),o.current.isPointerDown=!0)}),c=g(e=>{n&&n(e)});w(()=>{let e=o.current;if(r)return;let n=t.current,i=a(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Mt(n,t)&&c(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,s,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,s,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function Mt(t,n){if(t.button>0)return!1;let r=d(t);if(r){let t=r.ownerDocument;if(!t||!e(t.documentElement,r)||r.closest(`[data-react-aria-top-layer]`))return!1}return n.current?!t.composedPath().includes(n.current):!1}const Nt={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function Pt(e={}){let{style:t,isFocusable:n}=e,[r,i]=D(!1),{focusWithinProps:a}=se({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=T(()=>r?t:t?{...Nt,...t}:Nt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Ft(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=Pt(e);return b.createElement(n,f(a,o),t)}const It=x({});function Lt(){return C(It)??{}}const Rt=b.createContext(null);function zt(e){let n=t(),{portalContainer:r=n?null:document.body,isExiting:i}=e,[a,o]=D(!1),s=T(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Lt();if(!e.portalContainer&&c&&(r=c()),!r)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(ft,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},l)),l=b.createElement(Rt.Provider,{value:s},b.createElement(At,null,l)),we.createPortal(l,r)}function Bt(){let e=C(Rt)?.setContain;v(()=>{e?.(!0)},[e])}function Vt(e,t){let{role:n=`dialog`}=e,i=m();i=e[`aria-label`]?void 0:i;let a=E(!1);return w(()=>{if(t.current&&!re(t.current)){ee(t.current);let e=setTimeout(()=>{(u()===t.current||u()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),ee(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Bt(),E(!1),w(()=>{}),{dialogProps:{...r(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}var Ht={};Ht={dismiss:`تجاهل`};var Ut={};Ut={dismiss:`Отхвърляне`};var Wt={};Wt={dismiss:`Odstranit`};var Gt={};Gt={dismiss:`Luk`};var Kt={};Kt={dismiss:`Schließen`};var qt={};qt={dismiss:`Απόρριψη`};var Jt={};Jt={dismiss:`Dismiss`};var Yt={};Yt={dismiss:`Descartar`};var Xt={};Xt={dismiss:`Lõpeta`};var Zt={};Zt={dismiss:`Hylkää`};var Qt={};Qt={dismiss:`Rejeter`};var $t={};$t={dismiss:`התעלם`};var en={};en={dismiss:`Odbaci`};var tn={};tn={dismiss:`Elutasítás`};var nn={};nn={dismiss:`Ignora`};var rn={};rn={dismiss:`閉じる`};var an={};an={dismiss:`무시`};var on={};on={dismiss:`Atmesti`};var sn={};sn={dismiss:`Nerādīt`};var cn={};cn={dismiss:`Lukk`};var ln={};ln={dismiss:`Negeren`};var un={};un={dismiss:`Zignoruj`};var dn={};dn={dismiss:`Descartar`};var fn={};fn={dismiss:`Dispensar`};var pn={};pn={dismiss:`Revocare`};var mn={};mn={dismiss:`Пропустить`};var hn={};hn={dismiss:`Zrušiť`};var gn={};gn={dismiss:`Opusti`};var _n={};_n={dismiss:`Odbaci`};var vn={};vn={dismiss:`Avvisa`};var yn={};yn={dismiss:`Kapat`};var bn={};bn={dismiss:`Скасувати`};var xn={};xn={dismiss:`取消`};var Sn={};Sn={dismiss:`關閉`};var Cn={};Cn={"ar-AE":Ht,"bg-BG":Ut,"cs-CZ":Wt,"da-DK":Gt,"de-DE":Kt,"el-GR":qt,"en-US":Jt,"es-ES":Yt,"et-EE":Xt,"fi-FI":Zt,"fr-FR":Qt,"he-IL":$t,"hr-HR":en,"hu-HU":tn,"it-IT":nn,"ja-JP":rn,"ko-KR":an,"lt-LT":on,"lv-LV":sn,"nb-NO":cn,"nl-NL":ln,"pl-PL":un,"pt-BR":dn,"pt-PT":fn,"ro-RO":pn,"ru-RU":mn,"sk-SK":hn,"sl-SI":gn,"sr-SP":_n,"sv-SE":vn,"tr-TR":yn,"uk-UA":bn,"zh-CN":xn,"zh-TW":Sn};function wn(e){return e&&e.__esModule?e.default:e}function Tn(e){let{onDismiss:t,...n}=e,r=je(n,lt(wn(Cn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(Ft,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const q=[];function En(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=E(void 0);w(()=>{if(i&&!q.includes(t))return q.push(t),()=>{let e=q.indexOf(t);e>=0&&q.splice(e,1)}},[i,t]);let l=()=>{q[q.length-1]===t&&n&&n()},u=e=>{let n=q[q.length-1];c.current=n,(!s||s(d(e)))&&n===t&&e.stopPropagation()},f=e=>{(!s||s(d(e)))&&(q[q.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},p=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};jt({ref:t,onInteractOutside:a&&i?f:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=se({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||vt(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const J=typeof document<`u`&&window.visualViewport;let Y=0,Dn;function On(e={}){let{isDisabled:t}=e;v(()=>{if(!t)return Y++,Y===1&&(Dn=y()?An():kn()),()=>{Y--,Y===0&&Dn()}},[t])}function kn(){let e=window.innerWidth-document.documentElement.clientWidth;return l(e>0&&(`scrollbarGutter`in document.documentElement.style?X(document.documentElement,`scrollbarGutter`,`stable`):X(document.documentElement,`paddingRight`,`${e}px`)),X(document.documentElement,`overflow`,`hidden`))}function An(){let e=X(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=d(e);t=j(r)?r:Me(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=h();a&&(i.nonce=a),i.textContent=`@layer {
2
2
  * {
3
3
  overscroll-behavior: contain;
4
4
  }
5
- }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=d(e),n=e.relatedTarget;n&&M(n)?(n.focus({preventScroll:!0}),Mn(n,M(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=u(),n=t!=null&&M(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Mn(this,n)};let f=l(jn(document,`touchstart`,r,{passive:!1,capture:!0}),jn(document,`touchmove`,o,{passive:!1,capture:!0}),jn(document,`blur`,s,!0));return()=>{e(),f(),i.remove(),HTMLElement.prototype.focus=c}}function X(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function jn(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Mn(e,t){t||!J?Nn(e):J.addEventListener(`resize`,()=>Nn(e),{once:!0})}function Nn(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Me(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;J&&(n=Math.min(n,J.offsetTop+J.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function Pn(e,t,n){let{overlayProps:r,underlayProps:i}=En({...e,isOpen:t.isOpen,onClose:t.close},n);return On({isDisabled:!t.isOpen}),Bt(),w(()=>{if(t.isOpen&&n.current)return Ve([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:f(r),underlayProps:i}}function Fn(e){let[t,n]=kt(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:S(()=>{n(!0)},[n]),close:S(()=>{n(!1)},[n]),toggle:S(()=>{n(!t)},[n,t])}}const In=x(null),Z=x(null),Ln=ye(function(e,t){let n=e[`aria-labelledby`];[e,t]=oe(e,t,In);let{dialogProps:i,titleProps:a}=Vt({...e,"aria-labelledby":n},t),o=C(Z);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let s=ne({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=r(e,{global:!0});return b.createElement(fe.section,{...f(c,s,i),render:e.render,ref:t,slot:e.slot||void 0},b.createElement(ce,{values:[[De,{slots:{[ue]:{},title:{...a,level:2}}}],[le,{slots:{[ue]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),Rn=x(null),zn=x(null),Bn=ye(function(e,t){if(C(zn))return b.createElement(Wn,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return b.createElement(Hn,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Wn,{...f,modalRef:t},s))});function Vn(e,n){[e,n]=oe(e,n,Rn);let r=C(Z),a=Fn(e),o=e.isOpen!=null||e.defaultOpen!=null||!r?a:r,s=i(n),c=E(null),l=Le(s,o.isOpen),u=Le(c,o.isOpen),d=l||u||e.isExiting||!1,f=t();return!o.isOpen&&!d||f?null:b.createElement(Un,{...e,state:o,isExiting:d,overlayRef:s,modalRef:c})}const Hn=ye(Vn);function Un({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Pn(t,i,n),s=Ie(t.overlayRef)||t.isEntering||!1,c=ne({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Pe(),u;if(typeof document<`u`){let e=j(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return b.createElement(zt,{isExiting:t.isExiting,portalContainer:e},b.createElement(fe.div,{...f(r(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},b.createElement(ce,{values:[[zn,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Z,i]]},c.children)))}function Wn(e){let{modalProps:t,modalRef:n,isExiting:a,isDismissable:o}=C(zn),s=C(Z),c=i(T(()=>ie(e.modalRef,n),[e.modalRef,n])),l=Ie(c),u=ne({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:l,isExiting:a,state:s}});return b.createElement(fe.div,{...f(r(e,{global:!0}),t),...u,ref:c,"data-entering":l||void 0,"data-exiting":a||void 0},o&&b.createElement(Tn,{onDismiss:s.close}),u.children)}function Gn(e){return e.issues[0]?.message??`Invalid input`}function Kn(e){return e!=null&&(typeof e!=`string`||e.trim()!==``)}function qn(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}const Jn=[`id`,`email`,`name`],Q=e=>O.custom(t=>typeof t==`object`&&!!t&&typeof Reflect.get(t,e)==`function`),Yn=Q(`get_distinct_id`),Xn=Q(`get_session_id`),Zn=Q(`getUser`),Qn=Q(`getInternalContext`),$n=O.string(),er=O.record(O.string(),O.unknown()),tr=O.object({session_id:O.string().optional()}),$=(e,t)=>{if(typeof window>`u`)return;let n=t.safeParse(Reflect.get(window,e));return n.success?n.data:void 0},nr=()=>{try{let e=$(`posthog`,Yn);if(!e)return;let t=$n.safeParse(e.get_distinct_id());return t.success?t.data:void 0}catch{return}},rr=()=>{try{let e=$(`posthog`,Xn);if(!e)return;let t=$n.safeParse(e.get_session_id());return t.success?t.data:void 0}catch{return}},ir=()=>{try{let e=$(`DD_RUM`,Zn);if(!e)return;let t=er.safeParse(e.getUser());return!t.success||Object.keys(t.data).length===0?void 0:t.data}catch{return}},ar=()=>{try{let e=$(`DD_RUM`,Qn);if(!e)return;let t=tr.safeParse(e.getInternalContext());return t.success?t.data.session_id:void 0}catch{return}},or=e=>{let t={...e};if(Object.keys(t).length>=20)return t;let n=ir(),r;if(n)try{r=JSON.stringify(n)}catch{r=void 0}let i=[[`posthog_distinct_id`,nr()],[`posthog_session_id`,rr()],[`datadog_rum_user`,r],[`datadog_rum_session_id`,ar()],...Jn.map(e=>[`datadog_rum_user_${e}`,qn(n?.[e])])];for(let[e,n]of i){if(Object.keys(t).length>=20)break;if(Object.prototype.hasOwnProperty.call(t,e)||!Kn(n))continue;let r=me.safeParse(e),i=me.safeParse(n);!r.success||!i.success||(t[r.data]=i.data)}return t},sr=(e,t=!1)=>t?or(e):e,cr=x({}),lr=()=>C(cr),ur=x({}),dr=({type:e,children:t})=>{let n=T(()=>({type:e}),[e]);return k(ur.Provider,{value:n,children:t})},fr=()=>C(ur),pr=x(null),mr=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},autoInjectAnalyticsMetadata:a=!1,apiBaseUrl:s})=>{let{type:c}=fr(),l=lr(),u=l.version??`0.7.5`,d=l.build,f=E(!1),[p,m]=D(),h=o({publishableKey:n,apiBaseUrl:s});w(()=>{(async()=>{f.current=!1,m(void 0);try{let e=await h.get(`api/v1/cfti/${t}`).json(),n=he.safeParse(e);if(!n.success)return;m(n.data)}catch{}})()},[h,t]);let g=S(async({answers:e})=>{let n=crypto.randomUUID(),o=sr(i,a);await h.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:o,telemetry:{...c!==void 0&&{type:c},version:u,...d&&{build:d}}}})},[a,d,h,i,r,t,u,c]),_=S(()=>{h.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[h,r,t]);return w(()=>{f.current||p&&r&&(f.current=!0,h.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[h,r,p,t]),p?k(pr.Provider,{value:{submit:g,dismiss:_,surveyId:t,survey:p,metadata:i},children:e}):null},hr=e=>C(pr)?k(Se,{children:e.children}):k(mr,{...e}),gr=()=>{let e=C(pr);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},_r=()=>{let[e,t]=D(!1);return w(()=>{let e=e=>{let n=ge.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(_e,e),()=>{document.removeEventListener(_e,e)}},[]),e},vr=({className:e,iconClassName:t,onClose:n})=>_r()?null:k(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:k(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),yr=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s})=>{let{survey:c,surveyId:l,dismiss:u}=gr(),[d,f]=D(!1);return xe(()=>{c&&i?.()},d?a:null),Ce(Ln,{"aria-label":`Survey`,id:`${l}-popover`,className:A(`confetti-modal-dialog ${ve}`,t?.dialog),children:[n&&k(vr,{className:A(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{!o&&!d&&(await u(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>f(!0)}):e]})},br=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=gr(),[s,c]=D(!1);return k(Hn,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(s||(await o(),n?.()),r?.())},className:A(`confetti-modal-overlay ${ve}`,t?.overlay),children:k(Bn,{className:A(`confetti-modal ${ve}`,t?.modal),children:k(yr,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:s,onSubmitted:()=>c(!0),children:e})})})};export{pr as a,dr as c,kt as d,G as f,Ee as g,Oe as h,_r as i,Gn as l,je as m,yr as n,hr as o,Ze as p,vr as r,gr as s,br as t,Ft as u};
5
+ }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=d(e),n=e.relatedTarget;n&&M(n)?(n.focus({preventScroll:!0}),Mn(n,M(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=u(),n=t!=null&&M(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Mn(this,n)};let f=l(jn(document,`touchstart`,r,{passive:!1,capture:!0}),jn(document,`touchmove`,o,{passive:!1,capture:!0}),jn(document,`blur`,s,!0));return()=>{e(),f(),i.remove(),HTMLElement.prototype.focus=c}}function X(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function jn(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Mn(e,t){t||!J?Nn(e):J.addEventListener(`resize`,()=>Nn(e),{once:!0})}function Nn(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Me(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;J&&(n=Math.min(n,J.offsetTop+J.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function Pn(e,t,n){let{overlayProps:r,underlayProps:i}=En({...e,isOpen:t.isOpen,onClose:t.close},n);return On({isDisabled:!t.isOpen}),Bt(),w(()=>{if(t.isOpen&&n.current)return Ve([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:f(r),underlayProps:i}}function Fn(e){let[t,n]=kt(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:S(()=>{n(!0)},[n]),close:S(()=>{n(!1)},[n]),toggle:S(()=>{n(!t)},[n,t])}}const In=x(null),Z=x(null),Ln=ye(function(e,t){let n=e[`aria-labelledby`];[e,t]=oe(e,t,In);let{dialogProps:i,titleProps:a}=Vt({...e,"aria-labelledby":n},t),o=C(Z);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let s=ne({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=r(e,{global:!0});return b.createElement(fe.section,{...f(c,s,i),render:e.render,ref:t,slot:e.slot||void 0},b.createElement(ce,{values:[[De,{slots:{[ue]:{},title:{...a,level:2}}}],[le,{slots:{[ue]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),Rn=x(null),zn=x(null),Bn=ye(function(e,t){if(C(zn))return b.createElement(Wn,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return b.createElement(Hn,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Wn,{...f,modalRef:t},s))});function Vn(e,n){[e,n]=oe(e,n,Rn);let r=C(Z),a=Fn(e),o=e.isOpen!=null||e.defaultOpen!=null||!r?a:r,s=i(n),c=E(null),l=Le(s,o.isOpen),u=Le(c,o.isOpen),d=l||u||e.isExiting||!1,f=t();return!o.isOpen&&!d||f?null:b.createElement(Un,{...e,state:o,isExiting:d,overlayRef:s,modalRef:c})}const Hn=ye(Vn);function Un({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Pn(t,i,n),s=Ie(t.overlayRef)||t.isEntering||!1,c=ne({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Pe(),u;if(typeof document<`u`){let e=j(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return b.createElement(zt,{isExiting:t.isExiting,portalContainer:e},b.createElement(fe.div,{...f(r(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},b.createElement(ce,{values:[[zn,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Z,i]]},c.children)))}function Wn(e){let{modalProps:t,modalRef:n,isExiting:a,isDismissable:o}=C(zn),s=C(Z),c=i(T(()=>ie(e.modalRef,n),[e.modalRef,n])),l=Ie(c),u=ne({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:l,isExiting:a,state:s}});return b.createElement(fe.div,{...f(r(e,{global:!0}),t),...u,ref:c,"data-entering":l||void 0,"data-exiting":a||void 0},o&&b.createElement(Tn,{onDismiss:s.close}),u.children)}const Gn={en:{required:`This field is required`,selectOption:`Please select an option`,fillFreeText:`Please fill out the free text field`,selectAtLeastOne:`Please select at least one option`,selectRating:`Please select a rating`,titleRequired:`Title is required`,invalidImage:`Invalid image data URL`,invalidRecording:`Invalid recording events`,invalidInput:`Invalid input`,maxLength:`Please enter less than {max} characters`,maxSelected:`Please select less than {max} options`},zh:{required:`此字段为必填项`,selectOption:`请选择一个选项`,fillFreeText:`请填写文本框`,selectAtLeastOne:`请至少选择一个选项`,selectRating:`请选择评分`,titleRequired:`标题为必填项`,invalidImage:`图片数据网址无效`,invalidRecording:`录制事件无效`,invalidInput:`输入无效`,maxLength:`请输入少于 {max} 个字符`,maxSelected:`请选择少于 {max} 个选项`},ms:{required:`Ruangan ini diperlukan`,selectOption:`Sila pilih satu pilihan`,fillFreeText:`Sila isikan ruangan teks`,selectAtLeastOne:`Sila pilih sekurang-kurangnya satu pilihan`,selectRating:`Sila pilih penilaian`,titleRequired:`Tajuk diperlukan`,invalidImage:`URL data imej tidak sah`,invalidRecording:`Acara rakaman tidak sah`,invalidInput:`Masukan tidak sah`,maxLength:`Sila masukkan kurang daripada {max} aksara`,maxSelected:`Sila pilih kurang daripada {max} pilihan`},ta:{required:`இந்தப் புலம் தேவை`,selectOption:`ஒரு விருப்பத்தைத் தேர்ந்தெடுக்கவும்`,fillFreeText:`உரைப் புலத்தில் விவரங்களை உள்ளிடவும்`,selectAtLeastOne:`குறைந்தது ஒரு விருப்பத்தையாவது தேர்ந்தெடுக்கவும்`,selectRating:`மதிப்பீட்டைத் தேர்ந்தெடுக்கவும்`,titleRequired:`தலைப்பு தேவை`,invalidImage:`படத்தின் URL தவறானது`,invalidRecording:`தவறான பதிவு நிகழ்வுகள்`,invalidInput:`தவறான உள்ளீடு`,maxLength:`{max} எழுத்துகளுக்கு மிகாமல் உள்ளிடவும்`,maxSelected:`அதிகபட்சம் {max} விருப்பங்களைத் தேர்ந்தெடுக்கவும்`}},Kn=(e=`en`)=>Gn[e],qn=/^Please enter less than (\d+) characters$/,Jn=/^Please select less than (\d+) options$/,Yn=(e,t)=>{let n=Kn(t),r=e.match(qn);if(r)return n.maxLength.replace(`{max}`,r[1]??``);let i=e.match(Jn);if(i)return n.maxSelected.replace(`{max}`,i[1]??``);switch(e){case`This field is required`:return n.required;case`Please select an option`:return n.selectOption;case`Please fill out the free text field`:return n.fillFreeText;case`Please select at least one option`:return n.selectAtLeastOne;case`Please select a rating`:return n.selectRating;case`Title is required`:return n.titleRequired;case`Invalid image data URL`:return n.invalidImage;case`Invalid recording events`:return n.invalidRecording;case`Invalid input`:return n.invalidInput;default:return e}};function Xn(e,t){let n=e.issues[0];return Yn(n?.message??`Invalid input`,t)}function Zn(e){return e!=null&&(typeof e!=`string`||e.trim()!==``)}function Qn(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}const $n=[`id`,`email`,`name`],Q=e=>O.custom(t=>typeof t==`object`&&!!t&&typeof Reflect.get(t,e)==`function`),er=Q(`get_distinct_id`),tr=Q(`get_session_id`),nr=Q(`getUser`),rr=Q(`getInternalContext`),ir=O.string(),ar=O.record(O.string(),O.unknown()),or=O.object({session_id:O.string().optional()}),sr=(e,t)=>{if(typeof window>`u`)return;let n=t.safeParse(Reflect.get(window,e));return n.success?n.data:void 0},cr=()=>{try{let e=sr(`posthog`,er);if(!e)return;let t=ir.safeParse(e.get_distinct_id());return t.success?t.data:void 0}catch{return}},lr=()=>{try{let e=sr(`posthog`,tr);if(!e)return;let t=ir.safeParse(e.get_session_id());return t.success?t.data:void 0}catch{return}},ur=()=>{try{let e=sr(`DD_RUM`,nr);if(!e)return;let t=ar.safeParse(e.getUser());return!t.success||Object.keys(t.data).length===0?void 0:t.data}catch{return}},dr=()=>{try{let e=sr(`DD_RUM`,rr);if(!e)return;let t=or.safeParse(e.getInternalContext());return t.success?t.data.session_id:void 0}catch{return}},fr=e=>{let t={...e};if(Object.keys(t).length>=20)return t;let n=ur(),r;if(n)try{r=JSON.stringify(n)}catch{r=void 0}let i=[[`posthog_distinct_id`,cr()],[`posthog_session_id`,lr()],[`datadog_rum_user`,r],[`datadog_rum_session_id`,dr()],...$n.map(e=>[`datadog_rum_user_${e}`,Qn(n?.[e])])];for(let[e,n]of i){if(Object.keys(t).length>=20)break;if(Object.prototype.hasOwnProperty.call(t,e)||!Zn(n))continue;let r=me.safeParse(e),i=me.safeParse(n);!r.success||!i.success||(t[r.data]=i.data)}return t},pr=(e,t=!1)=>t?fr(e):e,mr=x({}),hr=()=>C(mr),gr=x({}),_r=({type:e,children:t})=>{let n=T(()=>({type:e}),[e]);return k(gr.Provider,{value:n,children:t})},vr=()=>C(gr),yr=x(null),br=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},autoInjectAnalyticsMetadata:a=!1,apiBaseUrl:s})=>{let{type:c}=vr(),l=hr(),u=l.version??`0.8.0`,d=l.build,f=E(!1),[p,m]=D(),h=o({publishableKey:n,apiBaseUrl:s});w(()=>{(async()=>{f.current=!1,m(void 0);try{let e=await h.get(`api/v1/cfti/${t}`).json(),n=he.safeParse(e);if(!n.success)return;m(n.data)}catch{}})()},[h,t]);let g=S(async({answers:e})=>{let n=crypto.randomUUID(),o=pr(i,a);await h.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:o,telemetry:{...c!==void 0&&{type:c},version:u,...d&&{build:d}}}})},[a,d,h,i,r,t,u,c]),_=S(()=>{h.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[h,r,t]);return w(()=>{f.current||p&&r&&(f.current=!0,h.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[h,r,p,t]),p?k(yr.Provider,{value:{submit:g,dismiss:_,surveyId:t,survey:p,metadata:i},children:e}):null},xr=e=>C(yr)?k(Se,{children:e.children}):k(br,{...e}),Sr=()=>{let e=C(yr);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},Cr={en:{skip:`Skip`,next:`Next`,back:`Back`,submit:`Submit`,other:`Other`,dismiss:`Dismiss`,close:`Close`,optional:`(optional)`,startTyping:`Start typing...`,feedbackSubmitted:`Feedback submitted!`,surveyDialog:`Survey`,unsupportedQuestionType:`Unsupported question type`,bugReportTitlePlaceholder:`Brief description of the issue`,bugReportDetailsPlaceholder:`Steps to reproduce, expected vs actual behavior, etc.`,attachments:`Attachments`,capturing:`Capturing...`,screenshot:`Screenshot`,screenshotPreview:`Screenshot preview`,removeScreenshot:`Remove screenshot`,loadingRecordingPreview:`Loading recording preview...`,removeRecording:`Remove recording`,record:`Record`,captureError:`Failed to capture screenshot. Please try again.`,recordingError:`Failed to start recording. Please try again.`},zh:{skip:`跳过`,next:`下一步`,back:`上一步`,submit:`提交`,other:`其他`,dismiss:`忽略`,close:`关闭`,optional:`(选填)`,startTyping:`开始输入…`,feedbackSubmitted:`反馈已提交!`,surveyDialog:`调查对话框`,unsupportedQuestionType:`不支持的问题类型`,bugReportTitlePlaceholder:`在此输入问题标题`,bugReportDetailsPlaceholder:`在此输入问题内容`,attachments:`附件`,capturing:`截屏中…`,screenshot:`截图`,screenshotPreview:`截图预览`,removeScreenshot:`移除截图`,loadingRecordingPreview:`录像加载中…`,removeRecording:`移除录像`,record:`录制`,captureError:`截图失败,请重试。`,recordingError:`录制启动失败,请重试。`},ms:{skip:`Langkau`,next:`Seterusnya`,back:`Kembali`,submit:`Hantar`,other:`Lain-lain`,dismiss:`Tutup`,close:`Tutup`,optional:`(Pilihan)`,startTyping:`Mula menaip...`,feedbackSubmitted:`Maklum balas dihantar!`,surveyDialog:`Tinjauan`,unsupportedQuestionType:`Jenis soalan tidak disokong`,bugReportTitlePlaceholder:`Penerangan ringkas tentang isu`,bugReportDetailsPlaceholder:`Langkah untuk mengulang semula, tingkah laku dijangka berbanding sebenar, dll.`,attachments:`Lampiran`,capturing:`Sedang menangkap...`,screenshot:`Tangkapan skrin`,screenshotPreview:`Pratonton tangkapan skrin`,removeScreenshot:`Alih keluar tangkapan skrin`,loadingRecordingPreview:`Memuatkan pratonton rakaman...`,removeRecording:`Alih keluar rakaman`,record:`Rakam`,captureError:`Gagal menangkap tangkapan skrin. Sila cuba lagi.`,recordingError:`Gagal memulakan rakaman. Sila cuba lagi.`},ta:{skip:`தவிர்க்கவும்`,next:`அடுத்து`,back:`பின்செல்`,submit:`சமர்ப்பிக்கவும்`,other:`மற்றவை`,dismiss:`மூடு`,close:`மூடு`,optional:`(கட்டாயமில்லை)`,startTyping:`தட்டச்சு செய்யத் தொடங்கவும்...`,feedbackSubmitted:`கருத்து சமர்ப்பிக்கப்பட்டது!`,surveyDialog:`கருத்துக்கணிப்பு`,unsupportedQuestionType:`ஆதரிக்கப்படாத கேள்வி வகை`,bugReportTitlePlaceholder:`சிக்கலின் சுருக்கமான விளக்கம்`,bugReportDetailsPlaceholder:`சிக்கல் எப்படி ஏற்பட்டது, நீங்கள் என்ன எதிர்பார்த்தீர்கள், மேலும் என்ன நடந்தது என்பதை விவரிக்கவும்`,attachments:`இணைப்புகள்`,capturing:`ஸ்கிரீன்ஷாட் எடுக்கப்படுகிறது...`,screenshot:`ஸ்கிரீன்ஷாட்`,screenshotPreview:`ஸ்கிரீன்ஷாட் முன்னோட்டம்`,removeScreenshot:`ஸ்கிரீன்ஷாட்டை அகற்று`,loadingRecordingPreview:`பதிவு முன்னோட்டம் தயாராகிறது...`,removeRecording:`பதிவை அகற்று`,record:`பதிவுசெய்`,captureError:`ஸ்கிரீன்ஷாட் எடுக்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,recordingError:`பதிவைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`}},$=(e=`en`)=>Cr[e],wr=(e,t,n)=>e===Cr.en[t]?$(n)[t]:e,Tr=(e,t,n)=>!e||e===Cr.en[t]?$(n)[t]:e,Er=(e,t)=>wr(e,`other`,t),Dr=(e,t)=>Tr(e,`close`,t),Or=(e,t)=>Tr(e,`feedbackSubmitted`,t),kr=(e,t)=>Tr(e,`bugReportTitlePlaceholder`,t),Ar=(e,t)=>Tr(e,`bugReportDetailsPlaceholder`,t),jr=()=>{let[e,t]=D(!1);return w(()=>{let e=e=>{let n=ge.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(_e,e),()=>{document.removeEventListener(_e,e)}},[]),e},Mr=({className:e,iconClassName:t,onClose:n,locale:r})=>jr()?null:k(`button`,{type:`button`,className:e,"aria-label":$(r).dismiss,onClick:n,children:k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:k(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Nr=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s,locale:c})=>{let{survey:l,surveyId:u,dismiss:d}=Sr(),[f,p]=D(!1);return xe(()=>{l&&i?.()},f?a:null),Ce(Ln,{"aria-label":$(c).surveyDialog,id:`${u}-popover`,className:A(`confetti-modal-dialog ${ve}`,t?.dialog),children:[n&&k(Mr,{className:A(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:c,onClose:async()=>{!o&&!f&&(await d(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>p(!0)}):e]})},Pr=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3,locale:o})=>{let{dismiss:s}=Sr(),[c,l]=D(!1);return k(Hn,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(c||(await s(),n?.()),r?.())},className:A(`confetti-modal-overlay ${ve}`,t?.overlay),children:k(Bn,{className:A(`confetti-modal ${ve}`,t?.modal),children:k(Nr,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:c,onSubmitted:()=>l(!0),locale:o,children:e})})})};export{Ee as S,kt as _,$ as a,je as b,Dr as c,yr as d,xr as f,Ft as g,Xn as h,jr as i,Or as l,_r as m,Nr as n,Ar as o,Sr as p,Mr as r,kr as s,Pr as t,Er as u,G as v,Oe as x,Ze as y};
@@ -1,2 +1,2 @@
1
- import { r as ModalContent } from "./ModalContainer-CbbuRuFl.js";
1
+ import { r as ModalContent } from "./ModalContainer-CfhXeJPb.js";
2
2
  export { ModalContent as UnstableModalContent };
@@ -1 +1 @@
1
- import{n as e}from"./ModalContainer-BmgfXemR.js";export{e as UnstableModalContent};
1
+ import{n as e}from"./ModalContainer-CtsM2uHt.js";export{e as UnstableModalContent};
@@ -1,6 +1,6 @@
1
- import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-CbbuRuFl.js";
2
- import { c as RatingQuestionProperties, d as TextQuestionProperties, l as SingleSelectQuestionProperties, s as MultiSelectQuestionProperties, u as StatementQuestionProperties } from "./index-CER9nZlw.js";
3
- import { C as ConfettiState, _ as useSurvey, a as BaseFieldProps, b as Answer, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, k as Question, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-CK34OURL.js";
1
+ import { c as MultiSelectQuestionProperties, d as StatementQuestionProperties, f as TextQuestionProperties, l as RatingQuestionProperties, t as Locale, u as SingleSelectQuestionProperties } from "./index-BBwAZoO2.js";
2
+ import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-CfhXeJPb.js";
3
+ import { C as ConfettiState, _ as useSurvey, a as BaseFieldProps, b as Answer, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, k as Question, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-DuMdcx8z.js";
4
4
  import { HTMLAttributes, JSX, PropsWithChildren, SVGProps } from "react";
5
5
 
6
6
  //#region src/components/container/PopoverContainer.d.ts
@@ -11,6 +11,11 @@ interface PopoverContainerProps {
11
11
  closeButton?: string;
12
12
  icon?: string;
13
13
  };
14
+ /**
15
+ * Locale for resolving the close button's "Dismiss" aria-label. Defaults
16
+ * to English.
17
+ */
18
+ locale?: Locale;
14
19
  /**
15
20
  * Invoked when the user dismisses the survey via the close button before
16
21
  * submitting. Not invoked on auto-close after finish, on the Thank-You
@@ -35,7 +40,8 @@ declare const PopoverContainer: ({
35
40
  containerProps,
36
41
  onDismiss,
37
42
  onClose,
38
- closeOnFinishMs
43
+ closeOnFinishMs,
44
+ locale
39
45
  }: PopoverContainerProps) => import("react").JSX.Element;
40
46
  //#endregion
41
47
  //#region src/components/CloseButton.d.ts
@@ -43,11 +49,17 @@ interface CloseButtonProps {
43
49
  className?: string;
44
50
  iconClassName?: string;
45
51
  onClose: () => void;
52
+ /**
53
+ * Locale for resolving the close button's "Dismiss" aria-label. Defaults
54
+ * to English.
55
+ */
56
+ locale?: Locale;
46
57
  }
47
58
  declare const CloseButton: ({
48
59
  className,
49
60
  iconClassName,
50
- onClose
61
+ onClose,
62
+ locale
51
63
  }: CloseButtonProps) => import("react").JSX.Element | null;
52
64
  //#endregion
53
65
  //#region src/components/questions/factory.d.ts
@@ -56,18 +68,32 @@ interface SurveyQuestionFactoryProps extends BugReportOptions {
56
68
  onChange: (answer: Answer) => void;
57
69
  error?: string;
58
70
  defaultAnswer?: Answer;
71
+ /**
72
+ * Locale for resolving default text that has no author-written value to
73
+ * translate: the "(optional)" suffix (all question types), the "Other"
74
+ * choice label (single/multi-select), and the placeholder/section/
75
+ * capture-chrome text on bug-report questions. Statement has no
76
+ * locale-driven default text. Defaults to English.
77
+ */
78
+ locale?: Locale;
59
79
  }
60
80
  declare const SurveyQuestionFactory: ({
61
81
  question,
62
82
  onChange,
63
83
  error,
64
84
  maskAllInputs,
65
- defaultAnswer
85
+ defaultAnswer,
86
+ locale
66
87
  }: SurveyQuestionFactoryProps) => import("react").JSX.Element;
67
88
  //#endregion
68
89
  //#region src/components/questions/Rating.d.ts
69
90
  interface RatingProps extends BaseFieldProps {
70
91
  properties: RatingQuestionProperties;
92
+ /**
93
+ * Locale for resolving the default "(optional)" label that has no
94
+ * author-written value to translate. Defaults to English.
95
+ */
96
+ locale?: Locale;
71
97
  classNames?: {
72
98
  question?: string;
73
99
  header?: string;
@@ -97,12 +123,19 @@ declare const Rating: ({
97
123
  id,
98
124
  error,
99
125
  required,
100
- defaultAnswer
126
+ defaultAnswer,
127
+ locale
101
128
  }: RatingProps) => JSX.Element;
102
129
  //#endregion
103
130
  //#region src/components/questions/FreeText.d.ts
104
131
  interface FreeTextProps extends BaseFieldProps {
105
132
  properties: TextQuestionProperties;
133
+ /**
134
+ * Locale for resolving default "(optional)" and "Start typing..."
135
+ * placeholder text that has no author-written value to translate.
136
+ * Defaults to English.
137
+ */
138
+ locale?: Locale;
106
139
  classNames?: {
107
140
  question?: string;
108
141
  header?: string;
@@ -122,12 +155,19 @@ declare const FreeText: ({
122
155
  classNames,
123
156
  required,
124
157
  error,
125
- defaultAnswer
158
+ defaultAnswer,
159
+ locale
126
160
  }: FreeTextProps) => import("react").JSX.Element;
127
161
  //#endregion
128
162
  //#region src/components/questions/SingleChoice.d.ts
129
163
  interface SingleChoiceProps extends BaseFieldProps {
130
164
  properties: SingleSelectQuestionProperties;
165
+ /**
166
+ * Locale for resolving the default "Other" choice label when the author
167
+ * left it at its literal seeded default. Defaults to English; a
168
+ * customised label is always rendered verbatim.
169
+ */
170
+ locale?: Locale;
131
171
  classNames?: {
132
172
  question?: string;
133
173
  header?: string;
@@ -153,12 +193,19 @@ declare const SingleChoice: ({
153
193
  id,
154
194
  required,
155
195
  error,
156
- defaultAnswer
196
+ defaultAnswer,
197
+ locale
157
198
  }: SingleChoiceProps) => import("react").JSX.Element;
158
199
  //#endregion
159
200
  //#region src/components/questions/MultiChoice.d.ts
160
201
  interface MultiChoiceProps extends BaseFieldProps {
161
202
  properties: MultiSelectQuestionProperties;
203
+ /**
204
+ * Locale for resolving the default "Other" choice label when the author
205
+ * left it at its literal seeded default. Defaults to English; a
206
+ * customised label is always rendered verbatim.
207
+ */
208
+ locale?: Locale;
162
209
  classNames?: {
163
210
  question?: string;
164
211
  header?: string;
@@ -187,7 +234,8 @@ declare const MultiChoice: ({
187
234
  id,
188
235
  required,
189
236
  error,
190
- defaultAnswer
237
+ defaultAnswer,
238
+ locale
191
239
  }: MultiChoiceProps) => import("react").JSX.Element;
192
240
  //#endregion
193
241
  //#region src/components/questions/Statement.d.ts
@@ -219,22 +267,36 @@ interface ThankYouMessageProps {
219
267
  description?: string;
220
268
  };
221
269
  onClose?: () => void;
270
+ /**
271
+ * Locale for resolving default text with no author-written value to
272
+ * translate: the "Feedback submitted!" title fallback and the "Close"
273
+ * button text when the survey's confirmation screen has no custom button
274
+ * text. Defaults to English.
275
+ */
276
+ locale?: Locale;
222
277
  }
223
278
  declare const ThankYouMessage: ({
224
279
  title,
225
280
  description,
226
281
  classNames,
227
- onClose
282
+ onClose,
283
+ locale
228
284
  }: ThankYouMessageProps) => import("react").JSX.Element | null;
229
285
  //#endregion
230
286
  //#region src/components/BackButton.d.ts
231
287
  interface BackButtonProps {
232
288
  onPress: () => void;
233
289
  children?: React.ReactNode;
290
+ /**
291
+ * Locale for resolving the default "Back" word when no custom label is
292
+ * set. Defaults to English; a custom label is always rendered verbatim.
293
+ */
294
+ locale?: Locale;
234
295
  }
235
296
  declare const BackButton: ({
236
297
  onPress,
237
- children
298
+ children,
299
+ locale
238
300
  }: BackButtonProps) => import("react").JSX.Element | null;
239
301
  //#endregion
240
302
  //#region src/components/presentation/Flow.d.ts
@@ -270,6 +332,12 @@ interface FlowProps {
270
332
  * previously committed answer still flushes so the stale value is not kept.
271
333
  */
272
334
  saveAnswer?: (answer: Answer) => void;
335
+ /**
336
+ * Locale for resolving the fallback Skip/Next/Submit button word when the
337
+ * question has no explicit `buttonLabel`. Defaults to English; an explicit
338
+ * `buttonLabel` is never localized.
339
+ */
340
+ locale?: Locale;
273
341
  }
274
342
  declare const Flow: ({
275
343
  onSubmit,
@@ -278,12 +346,17 @@ declare const Flow: ({
278
346
  isLastQuestion,
279
347
  defaultAnswer,
280
348
  backButton,
281
- saveAnswer
349
+ saveAnswer,
350
+ locale
282
351
  }: FlowProps) => import("react").JSX.Element;
283
352
  //#endregion
284
353
  //#region src/components/presentation/Embed.d.ts
285
354
  type EmbedProps = PropsWithChildren<{
286
355
  onSubmit: () => void;
356
+ /**
357
+ * Locale for resolving the default "Submit" word. Defaults to English.
358
+ */
359
+ locale?: Locale;
287
360
  }>;
288
361
  /**
289
362
  * All questions at once behind a single submit button. The button stays
@@ -295,7 +368,8 @@ type EmbedProps = PropsWithChildren<{
295
368
  */
296
369
  declare const Embed: ({
297
370
  onSubmit,
298
- children
371
+ children,
372
+ locale
299
373
  }: EmbedProps) => import("react").JSX.Element;
300
374
  //#endregion
301
375
  //#region src/components/trigger/ConfettiTriggerIcon.d.ts
@@ -1 +1 @@
1
- import{n as e,t}from"./DefaultConfettiTrigger-CqpZGyoA.js";import{a as n,o as r,r as i,s as a,t as o}from"./ModalContainer-BmgfXemR.js";import{a as s,c,d as l,f as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./Embed-CQISAOtU.js";import{ErrorBoundary as S}from"react-error-boundary";import{Fragment as C,jsx as w}from"react/jsx-runtime";const T=({children:e,respondent:t,isSurveyVisible:n,...i})=>{let{respondent:a}=m();return w(r,{...i,respondent:a,children:e})},E=({children:e,...t})=>w(_,{...t,children:w(T,{...t,children:e})}),D=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>w(S,{fallback:w(C,{}),children:w(E,{...r,children:w(d,{shouldAutoSubmit:n,onFinished:t,children:e})})});export{v as BackButton,i as CloseButton,D as Confetti,d as ConfettiController,E as ConfettiProvider,e as ConfettiTriggerIcon,t as DefaultConfettiTrigger,b as Embed,h as Flow,x as FreeText,o as ModalContainer,p as MultiChoice,l as PopoverContainer,c as Rating,u as RespondentVisibilityContext,_ as RespondentVisibilityProvider,y as SingleChoice,g as Statement,n as SurveyContext,r as SurveyProvider,s as SurveyQuestionFactory,f as ThankYouMessage,m as useRespondentVisibility,a as useSurvey};
1
+ import{n as e,t}from"./DefaultConfettiTrigger-CN5hBUrU.js";import{d as n,f as r,p as i,r as a,t as o}from"./ModalContainer-CtsM2uHt.js";import{a as s,c,d as l,f as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./Embed-BJujRUNU.js";import{ErrorBoundary as S}from"react-error-boundary";import{Fragment as C,jsx as w}from"react/jsx-runtime";const T=({children:e,respondent:t,isSurveyVisible:n,...i})=>{let{respondent:a}=m();return w(r,{...i,respondent:a,children:e})},E=({children:e,...t})=>w(_,{...t,children:w(T,{...t,children:e})}),D=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>w(S,{fallback:w(C,{}),children:w(E,{...r,children:w(d,{shouldAutoSubmit:n,onFinished:t,children:e})})});export{v as BackButton,a as CloseButton,D as Confetti,d as ConfettiController,E as ConfettiProvider,e as ConfettiTriggerIcon,t as DefaultConfettiTrigger,b as Embed,h as Flow,x as FreeText,o as ModalContainer,p as MultiChoice,l as PopoverContainer,c as Rating,u as RespondentVisibilityContext,_ as RespondentVisibilityProvider,y as SingleChoice,g as Statement,n as SurveyContext,r as SurveyProvider,s as SurveyQuestionFactory,f as ThankYouMessage,m as useRespondentVisibility,i as useSurvey};
@@ -255,4 +255,8 @@ declare const publicGetSurveyOutputSchema: z.ZodObject<{
255
255
  }, z.core.$strip>;
256
256
  type PublicGetSurveyOutput = z.infer<typeof publicGetSurveyOutputSchema>;
257
257
  //#endregion
258
- export { RatingAnswer as a, RatingQuestionProperties as c, TextQuestionProperties as d, BinaryOperatorCondition as f, MultiSelectAnswer as i, SingleSelectQuestionProperties as l, RoutableAnswer as n, SingleSelectAnswer as o, BugReportAnswer as r, MultiSelectQuestionProperties as s, PublicGetSurveyOutput as t, StatementQuestionProperties as u };
258
+ //#region ../validators/dist/locale.d.ts
259
+ declare const LOCALES: readonly ['en', 'zh', 'ms', 'ta'];
260
+ type Locale = (typeof LOCALES)[number];
261
+ //#endregion
262
+ export { MultiSelectAnswer as a, MultiSelectQuestionProperties as c, StatementQuestionProperties as d, TextQuestionProperties as f, BugReportAnswer as i, RatingQuestionProperties as l, PublicGetSurveyOutput as n, RatingAnswer as o, BinaryOperatorCondition as p, RoutableAnswer as r, SingleSelectAnswer as s, Locale as t, SingleSelectQuestionProperties as u };
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { D as OptionallyDismissable, E as Finishable, O as Proxyable, S as ConfettiContainer, T as Dismissable, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-CK34OURL.js";
1
+ import { t as Locale } from "./index-BBwAZoO2.js";
2
+ import { D as OptionallyDismissable, E as Finishable, O as Proxyable, S as ConfettiContainer, T as Dismissable, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-DuMdcx8z.js";
2
3
 
3
4
  //#region src/contracts/api.d.ts
4
5
  type Template = 'TriggerPopover' | 'Popover' | 'Modal' | 'Embedded' | 'Stepper';
@@ -9,6 +10,11 @@ interface MountPropsBase extends Finishable {
9
10
  surveyId: string;
10
11
  publishableKey: string;
11
12
  respondent: string;
13
+ /**
14
+ * Locale for resolving default button/choice/validation text that has no
15
+ * author-written value to translate. Defaults to English.
16
+ */
17
+ locale?: Locale;
12
18
  metadata?: Record<string, string>;
13
19
  autoInjectAnalyticsMetadata?: boolean;
14
20
  apiBaseUrl?: string;
@@ -71,19 +77,43 @@ interface HostedLoaderProps extends Proxyable {
71
77
  }
72
78
  //#endregion
73
79
  //#region src/hosted/EmbeddedConfetti.d.ts
74
- interface EmbeddedConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, Closable, Containable {}
80
+ interface EmbeddedConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, Closable, Containable {
81
+ /**
82
+ * Locale for resolving default button/choice/validation text that has no
83
+ * author-written value to translate. Defaults to English.
84
+ */
85
+ locale?: Locale;
86
+ }
75
87
  declare function EmbeddedConfetti(props: EmbeddedConfettiProps): import("react").JSX.Element | null;
76
88
  //#endregion
77
89
  //#region src/hosted/ModalConfetti.d.ts
78
- interface ModalConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, OptionallyDismissable {}
90
+ interface ModalConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, OptionallyDismissable {
91
+ /**
92
+ * Locale for resolving default button/choice/validation text that has no
93
+ * author-written value to translate. Defaults to English.
94
+ */
95
+ locale?: Locale;
96
+ }
79
97
  declare function ModalConfetti(props: ModalConfettiProps): import("react").JSX.Element | null;
80
98
  //#endregion
81
99
  //#region src/hosted/PopoverConfetti.d.ts
82
- interface PopoverConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, Dismissable {}
100
+ interface PopoverConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, Dismissable {
101
+ /**
102
+ * Locale for resolving default button/choice/validation text that has no
103
+ * author-written value to translate. Defaults to English.
104
+ */
105
+ locale?: Locale;
106
+ }
83
107
  declare function PopoverConfetti(props: PopoverConfettiProps): import("react").JSX.Element | null;
84
108
  //#endregion
85
109
  //#region src/hosted/StepperConfetti.d.ts
86
- interface StepperConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, Closable, Containable {}
110
+ interface StepperConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUrl'>, HostedLoaderProps, Closable, Containable {
111
+ /**
112
+ * Locale for resolving default button/choice/validation text that has no
113
+ * author-written value to translate. Defaults to English.
114
+ */
115
+ locale?: Locale;
116
+ }
87
117
  declare function StepperConfetti(props: StepperConfettiProps): import("react").JSX.Element | null;
88
118
  //#endregion
89
119
  //#region src/hosted/TriggerPopoverConfetti.d.ts
@@ -101,6 +131,11 @@ interface TriggerPopoverConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUr
101
131
  * the open and submitted state. Defaults to the built-in trigger button.
102
132
  */
103
133
  trigger?: (renderProps: TriggerRenderProps) => React.ReactNode;
134
+ /**
135
+ * Locale for resolving default button/choice/validation text that has no
136
+ * author-written value to translate. Defaults to English.
137
+ */
138
+ locale?: Locale;
104
139
  }
105
140
  declare function TriggerPopoverConfetti(props: TriggerPopoverConfettiProps): import("react").JSX.Element | null;
106
141
  //#endregion
package/build/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,o as n,r,t as i}from"./DefaultConfettiTrigger-CqpZGyoA.js";import{G as a}from"./Button-LiaNjkvk.js";import{useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{ErrorBoundary as d}from"react-error-boundary";import{useLocalStorage as f,useSessionStorage as p}from"usehooks-ts";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=`confetti:ready`,v=`https://confetti.gov.sg`,y={promise:null,channel:null,url:null};function b(){y.promise=null,y.channel=null,y.url=null}function x(){y.promise=null}function S(e){return new URL(``,e).href}function C(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function w(e=`stable`,t=v){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(y.promise)return y.channel===e?y.url===n?y.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(y.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(y.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?y.url!==null&&y.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${y.url} to ${n} on the same page`)):k(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=E(n,e);return y.channel=e,y.url=n,y.promise=i,i}function T(e=`stable`,t=v){if(typeof window>`u`)return Promise.resolve();let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return D(n,e)}async function E(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([D(e,t),O(e,t)])]);return clearTimeout(r),x(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),b(),e}}function D(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=C(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function O(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}k(e).then(n,r)};if(window.addEventListener(_,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=C(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(_,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function k(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function A(e){let t=l(null),n=l(null),r=l(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,s(()=>{if(!e.element)return;let o=!1;return w(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),s(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function j(e){let[t,n]=u(null);return A({...e,element:t}),h(d,{fallback:h(m,{}),children:h(`div`,{ref:n,"data-confetti-mount":!0})})}function M(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,autoInjectAnalyticsMetadata:i.autoInjectAnalyticsMetadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.5`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.autoInjectAnalyticsMetadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Embedded`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function N(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,autoInjectAnalyticsMetadata:i.autoInjectAnalyticsMetadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.5`},closeOnFinishMs:i.closeOnFinishMs,isDismissable:i.isDismissable,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.autoInjectAnalyticsMetadata,i.proxyUrl,i.closeOnFinishMs,i.isDismissable,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Modal`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function P(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,autoInjectAnalyticsMetadata:i.autoInjectAnalyticsMetadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.5`},closeOnFinishMs:i.closeOnFinishMs,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.autoInjectAnalyticsMetadata,i.proxyUrl,i.closeOnFinishMs,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Popover`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function F(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,autoInjectAnalyticsMetadata:i.autoInjectAnalyticsMetadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.5`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.autoInjectAnalyticsMetadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Stepper`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function I(f){let p=e({surveyId:f.surveyId,override:f.respondent}),_=a({publishableKey:f.publishableKey,apiBaseUrl:f.proxyUrl}),{isAvailable:v,isSettled:y}=r({client:_,surveyId:f.surveyId}),{state:b,isSettled:x}=t({client:_,surveyId:f.surveyId,respondent:p}),[S,C]=u(!1),w=y&&v&&x&&S&&n(b,f.isSurveyVisible),[E,D]=u(!1),[O,k]=u(!1),{onError:A,channel:M,proxyUrl:N}=f,P=l(A);s(()=>{P.current=A},[A]),s(()=>{if(!(y&&v))return;let e=!1;return T(M,N).then(()=>{e||C(!0)}).catch(e=>P.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[y,v,M,N]);let F=w&&E,I=o(()=>D(!0),[]),L=f.onFinished,R=c(()=>({surveyId:f.surveyId,publishableKey:f.publishableKey,respondent:p,metadata:f.metadata,autoInjectAnalyticsMetadata:f.autoInjectAnalyticsMetadata,apiBaseUrl:f.proxyUrl,telemetry:{version:`0.7.5`},isOpen:E,onFinished:()=>{k(!0),L?.()},onClose:()=>{D(!1)},onDismiss:()=>{D(!1)},options:f.options}),[f.surveyId,f.publishableKey,p,f.metadata,f.autoInjectAnalyticsMetadata,f.proxyUrl,f.options,E,L]);return w?g(d,{fallback:h(m,{}),children:[f.trigger?f.trigger({onClick:I,isOpen:E,isSubmitted:O}):h(i,{onClick:I,isWidgetOpen:E}),F?h(j,{template:`TriggerPopover`,channel:f.channel,scriptBaseUrl:f.proxyUrl,onError:f.onError,props:R}):null]}):null}function L({surveyId:e,publishableKey:n,respondent:i,proxyUrl:o}){let s=a({publishableKey:n,apiBaseUrl:o}),{isAvailable:c,isSettled:l}=r({client:s,surveyId:e}),{state:u,isSettled:d}=t({client:s,surveyId:e,respondent:i});if(!i)return null;if(!(!l||!d))return c?{lastRespondedAt:u.lastRespondedAt?new Date(u.lastRespondedAt):null,lastDismissedAt:u.lastDismissedAt?new Date(u.lastDismissedAt):null}:null}const R=({delay:e})=>{let[t,n]=u(!1),r=c(()=>e,[]);return s(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},z=({visits:e,respondent:t})=>{let[n,r]=f(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},B=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},V=({threshold:e})=>{let[t,n]=u(()=>typeof window>`u`?!1:window.scrollY>=e);return s(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{M as EmbeddedConfetti,N as ModalConfetti,P as PopoverConfetti,F as StepperConfetti,I as TriggerPopoverConfetti,L as useRespondentState,R as useVisibleAfterDelay,z as useVisibleAfterPageVisits,V as useVisibleAfterScroll,B as useVisibleAfterSessionPageVisits};
1
+ import{a as e,i as t,o as n,r,s as i,t as a}from"./DefaultConfettiTrigger-CN5hBUrU.js";import{G as o}from"./Button-LiaNjkvk.js";import{useCallback as s,useEffect as c,useMemo as l,useRef as u,useState as d}from"react";import{ErrorBoundary as f}from"react-error-boundary";import{useLocalStorage as p,useSessionStorage as m}from"usehooks-ts";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=`confetti:ready`,y=`https://confetti.gov.sg`,b={promise:null,channel:null,url:null};function x(){b.promise=null,b.channel=null,b.url=null}function S(){b.promise=null}function C(e){return new URL(``,e).href}function w(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function T(e=`stable`,t=y){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=C(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(b.promise)return b.channel===e?b.url===n?b.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(b.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(b.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?b.url!==null&&b.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${b.url} to ${n} on the same page`)):A(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=D(n,e);return b.channel=e,b.url=n,b.promise=i,i}function E(e=`stable`,t=y){if(typeof window>`u`)return Promise.resolve();let n;try{n=C(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return O(n,e)}async function D(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([O(e,t),k(e,t)])]);return clearTimeout(r),S(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),x(),e}}function O(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=w(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function k(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}A(e).then(n,r)};if(window.addEventListener(v,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=w(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(v,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function A(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function j(e){let t=u(null),n=u(null),r=u(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,c(()=>{if(!e.element)return;let o=!1;return T(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),c(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function M(e){let[t,n]=d(null);return j({...e,element:t}),g(f,{fallback:g(h,{}),children:g(`div`,{ref:n,"data-confetti-mount":!0})})}function N(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:u,isSettled:p}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:_}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=d(!1),x=p&&u&&_&&v&&!y,S=a.onFinished,C=a.onClose,w=l(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.0`},onFinished:S,onClose:()=>{b(!0),C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.options,S,C]);if(!x)return null;let T=g(M,{template:`Embedded`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return g(f,{fallback:g(h,{}),children:a.container?a.container({survey:T}):T})}function P(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:u,isSettled:p}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:_}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=d(!1),x=p&&u&&_&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=l(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.0`},closeOnFinishMs:a.closeOnFinishMs,isDismissable:a.isDismissable,onFinished:S,onClose:()=>{b(!0),w?.()},onDismiss:()=>{C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.closeOnFinishMs,a.isDismissable,a.options,S,C,w]);return x?g(f,{fallback:g(h,{}),children:g(M,{template:`Modal`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function F(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:u,isSettled:p}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:_}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=d(!1),x=p&&u&&_&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=l(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.0`},closeOnFinishMs:a.closeOnFinishMs,onFinished:S,onClose:()=>{b(!0),w?.()},onDismiss:()=>{C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.closeOnFinishMs,a.options,S,C,w]);return x?g(f,{fallback:g(h,{}),children:g(M,{template:`Popover`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function I(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:u,isSettled:p}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:_}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=d(!1),x=p&&u&&_&&v&&!y,S=a.onFinished,C=a.onClose,w=l(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.0`},onFinished:S,onClose:()=>{b(!0),C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.options,S,C]);if(!x)return null;let T=g(M,{template:`Stepper`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return g(f,{fallback:g(h,{}),children:a.container?a.container({survey:T}):T})}function L(p){let m=e({surveyId:p.surveyId,override:p.respondent}),v=o({publishableKey:p.publishableKey,apiBaseUrl:p.proxyUrl}),{isAvailable:y,isSettled:b}=r({client:v,surveyId:p.surveyId}),{state:x,isSettled:S}=t({client:v,surveyId:p.surveyId,respondent:m,enabled:i(p.isSurveyVisible)}),[C,w]=d(!1),T=b&&y&&S&&C&&n(x,p.isSurveyVisible),[D,O]=d(!1),[k,A]=d(!1),{onError:j,channel:N,proxyUrl:P}=p,F=u(j);c(()=>{F.current=j},[j]),c(()=>{if(!(b&&y))return;let e=!1;return E(N,P).then(()=>{e||w(!0)}).catch(e=>F.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[b,y,N,P]);let I=T&&D,L=s(()=>O(!0),[]),R=p.onFinished,z=l(()=>({surveyId:p.surveyId,publishableKey:p.publishableKey,respondent:m,locale:p.locale,metadata:p.metadata,autoInjectAnalyticsMetadata:p.autoInjectAnalyticsMetadata,apiBaseUrl:p.proxyUrl,telemetry:{version:`0.8.0`},isOpen:D,onFinished:()=>{A(!0),R?.()},onClose:()=>{O(!1)},onDismiss:()=>{O(!1)},options:p.options}),[p.surveyId,p.publishableKey,m,p.locale,p.metadata,p.autoInjectAnalyticsMetadata,p.proxyUrl,p.options,D,R]);return T?_(f,{fallback:g(h,{}),children:[p.trigger?p.trigger({onClick:L,isOpen:D,isSubmitted:k}):g(a,{onClick:L,isWidgetOpen:D}),I?g(M,{template:`TriggerPopover`,channel:p.channel,scriptBaseUrl:p.proxyUrl,onError:p.onError,props:z}):null]}):null}function R({surveyId:e,publishableKey:n,respondent:i,proxyUrl:a}){let s=o({publishableKey:n,apiBaseUrl:a}),{isAvailable:c,isSettled:l}=r({client:s,surveyId:e}),{state:u,isSettled:d}=t({client:s,surveyId:e,respondent:i});if(!i)return null;if(!(!l||!d))return c?{lastRespondedAt:u.lastRespondedAt?new Date(u.lastRespondedAt):null,lastDismissedAt:u.lastDismissedAt?new Date(u.lastDismissedAt):null}:null}const z=({delay:e})=>{let[t,n]=d(!1),r=l(()=>e,[]);return c(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},B=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:s(()=>r(0),[r])}},V=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:s(()=>r(0),[r])}},H=({threshold:e})=>{let[t,n]=d(()=>typeof window>`u`?!1:window.scrollY>=e);return c(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{N as EmbeddedConfetti,P as ModalConfetti,F as PopoverConfetti,I as StepperConfetti,L as TriggerPopoverConfetti,R as useRespondentState,z as useVisibleAfterDelay,B as useVisibleAfterPageVisits,H as useVisibleAfterScroll,V as useVisibleAfterSessionPageVisits};
@@ -1 +1 @@
1
- import"./src-DKk1GrYu.js";import{z as e}from"zod";const t=e=>e.value,n=({answer:e,condition:n})=>{let r=t(n.value);switch(n.operator){case`equal`:return e===r;case`not-equal`:return e!==r;case`greater`:return typeof e==`number`&&typeof r==`number`&&e>r;case`greater-or-equal`:return typeof e==`number`&&typeof r==`number`&&e>=r;case`less`:return typeof e==`number`&&typeof r==`number`&&e<r;case`less-or-equal`:return typeof e==`number`&&typeof r==`number`&&e<=r;case`contains`:return Array.isArray(e)&&typeof r==`string`&&e.includes(r);case`not-contains`:return Array.isArray(e)&&typeof r==`string`&&!e.includes(r)}},r=({position:e,value:t})=>{switch(t.type){case`next`:return e+1;case`jump`:return t.target;case`end`:return null}},i=e=>e==null||Array.isArray(e)&&e.length===0,a=({position:e,question:t,answer:a})=>{let o=t.routingLogic;if(o.type===`always`)return r({position:e,value:o.target});if(i(a)&&t.required)return null;let s=i(a)?void 0:o.cases.find(e=>n({answer:a,condition:e}));return r(s?{position:e,value:s.target}:{position:e,value:o.default})},o=(e,t,{forceReachableIds:n}={})=>{let r=[...e].sort((e,t)=>e.position-t.position),i=new Set,o=new Set(n);for(let e=0;e<r.length;e++){let n=r[e];if(n){if(e===0||o.has(n.id)){i.add(n.id);continue}for(let o=0;o<e;o++){let s=r[o];if(!(!s||!i.has(s.id))&&a({position:o,question:s,answer:t[s.id]})===e){i.add(n.id);break}}}}return i},s=n,c=`cfti-mask`,l=`cfti-block`,u=`__confetti_bug_report_recording_event`,d=e.object({detail:e.object({isRecording:e.boolean()})});export{s as a,d as i,c as n,o,u as r,l as t};
1
+ import"./src-tvLZOC2M.js";import{z as e}from"zod";const t=e=>e.value,n=({answer:e,condition:n})=>{let r=t(n.value);switch(n.operator){case`equal`:return e===r;case`not-equal`:return e!==r;case`greater`:return typeof e==`number`&&typeof r==`number`&&e>r;case`greater-or-equal`:return typeof e==`number`&&typeof r==`number`&&e>=r;case`less`:return typeof e==`number`&&typeof r==`number`&&e<r;case`less-or-equal`:return typeof e==`number`&&typeof r==`number`&&e<=r;case`contains`:return Array.isArray(e)&&typeof r==`string`&&e.includes(r);case`not-contains`:return Array.isArray(e)&&typeof r==`string`&&!e.includes(r)}},r=({position:e,value:t})=>{switch(t.type){case`next`:return e+1;case`jump`:return t.target;case`end`:return null}},i=e=>e==null||Array.isArray(e)&&e.length===0,a=({position:e,question:t,answer:a})=>{let o=t.routingLogic;if(o.type===`always`)return r({position:e,value:o.target});if(i(a)&&t.required)return null;let s=i(a)?void 0:o.cases.find(e=>n({answer:a,condition:e}));return r(s?{position:e,value:s.target}:{position:e,value:o.default})},o=(e,t,{forceReachableIds:n}={})=>{let r=[...e].sort((e,t)=>e.position-t.position),i=new Set,o=new Set(n);for(let e=0;e<r.length;e++){let n=r[e];if(n){if(e===0||o.has(n.id)){i.add(n.id);continue}for(let o=0;o<e;o++){let s=r[o];if(!(!s||!i.has(s.id))&&a({position:o,question:s,answer:t[s.id]})===e){i.add(n.id);break}}}}return i},s=n,c=`cfti-mask`,l=`cfti-block`,u=`__confetti_bug_report_recording_event`,d=e.object({detail:e.object({isRecording:e.boolean()})});export{s as a,d as i,c as n,o,u as r,l as t};
@@ -1,4 +1,4 @@
1
- import { f as BinaryOperatorCondition, n as RoutableAnswer } from "./index-CER9nZlw.js";
1
+ import { p as BinaryOperatorCondition, r as RoutableAnswer } from "./index-BBwAZoO2.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/core/logic/routing.d.ts
@@ -1 +1 @@
1
- import{a as e,i as t,n,r,t as i}from"./internals-BzehCtEV.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
1
+ import{a as e,i as t,n,r,t as i}from"./internals-wbzqfeGS.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=e.object({type:e.literal(`next`)}),n=e.object({type:e.literal(`end`)}),r=e.object({type:e.literal(`jump`),target:e.number({error:`Target question is required`})}),i=e.discriminatedUnion(`type`,[t,r,n]),ee=e.object({type:e.literal(`value`),value:e.union([e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),e.number({error:`Value is required`})])}),a=e.object({type:e.literal(`binary-operator`),operator:e.union([e.literal(`equal`),e.literal(`not-equal`),e.literal(`greater`),e.literal(`greater-or-equal`),e.literal(`less`),e.literal(`less-or-equal`),e.literal(`contains`),e.literal(`not-contains`)]),value:ee,target:i}),o=e.object({type:e.literal(`switch`),cases:e.array(a),default:i}),s=e.object({type:e.literal(`always`),target:i}),c=e.discriminatedUnion(`type`,[s,o]),l=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),u=e.optional(e.string().check(e.trim(),e.maxLength(50))),d=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),f=e.array(d).check(e.superRefine((e,t)=>{let n=new Set;for(let r of e)if(r.translationId!==void 0){if(n.has(r.translationId)){t.addIssue({code:`custom`,message:`Option translation ids must be unique within a question`});return}n.add(r.translationId)}})),p=e.nullable(e.object({label:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),max:e.number(),description:e.optional(e.string().check(e.trim()))})),m=e.optional(e.boolean()),h=e.object({type:e.literal(`rating`),buttonLabel:u,shouldAutoProgress:m,scale:e.number().check(e.gte(2),e.lte(10)),labels:e.optional(e.object({lower:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e))),upper:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e)))})),display:e.optional(e.literal([`star`,`emoji`,`number`]))}),g=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u,max:e.number()}),te=e.object({type:e.literal(`single-select`),shouldAutoProgress:m,options:f,buttonLabel:u,editable:p}),ne=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:f,editable:p,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),re=e.object({type:e.literal(`statement`),buttonLabel:u,buttonUrl:e.optional(l)}),ie=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,enableScreenshot:e.boolean(),enableRecording:e.boolean(),detailsLabel:e.string().check(e.trim(),e.minLength(1,{error:`Label is required`}),e.maxLength(128)),detailsPlaceholder:e.optional(e.string()),redactClasses:e.optional(e.array(e.string()))}),ae=e.discriminatedUnion(`type`,[h,te,g,ne,re,ie]),_=e.object({label:e.optional(e.string()),description:e.optional(e.string())}),v=e.object({type:e.literal(`rating`),buttonLabel:u,labels:e.optional(e.object({lower:e.optional(e.string()),upper:e.optional(e.string())}))}),y=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u}),b=e.object({type:e.literal(`single-select`),buttonLabel:u,options:e.optional(e.record(e.string(),_))}),x=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:e.optional(e.record(e.string(),_))}),S=e.object({type:e.literal(`statement`),buttonLabel:u}),C=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,detailsLabel:e.optional(e.string()),detailsPlaceholder:e.optional(e.string())}),w=e.discriminatedUnion(`type`,[v,y,b,x,S,C]),T=`__CONFETTI_CHECKBOX_Others`,E=`__CONFETTI_RADIO_Others`,D=e.optional(e.looseObject({userAgent:e.string().check(e.trim(),e.maxLength(1e3)),screenResolution:e.string().check(e.trim(),e.maxLength(100)),viewportSize:e.string().check(e.trim(),e.maxLength(100)),pageUrl:e.string(),pageTitle:e.string().check(e.trim(),e.maxLength(1e3)),referrer:e.string(),datadogTraceId:e.optional(e.string()),datadogSessionId:e.optional(e.string()),datadogSessionReplayLink:e.optional(e.string())}).partial().catchall(e.optional(e.string())));e.cuid2();const O=e.looseObject({type:e.literal([0,1,2,3,4,5,6]),data:e.unknown(),timestamp:e.number(),delay:e.optional(e.number())});e.array(O);const k=e.array(O),A=e.string().check(e.refine(e=>{try{return k.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),j=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),M=t=>e.object({title:e.string().check(e.trim(),...t?[e.minLength(1,{error:`Title is required`})]:[],e.maxLength(256)),description:e.optional(e.string().check(e.trim(),e.maxLength(4096))),screenshotDataUrl:e.optional(j),recordingEventsJson:e.optional(A),metadata:D});M(!0);const N=M(!1),P=(e,{required:t})=>M(t),F=e=>{if(!e)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0}catch{return!1}},I=e=>!e.title.trim()&&!e.description?.trim()&&!e.screenshotDataUrl&&!F(e.recordingEventsJson),L=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),oe=({scale:t},{required:n})=>{let r=L(t);return n?r:e.optional(r)},R=({maxLength:t},{required:n})=>e.string().check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),z=(t,n)=>e.string({error:`Please select an option`}).check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==E,{error:`Please fill out the free text field`})),B=({maxLength:t},{required:n})=>{let r=z(t,n);return n?r:e.optional(r)},V=({maxSelected:t,maxLength:n},{required:r})=>e.array(e.string().check(e.trim(),...r?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(n??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==T,{error:`Please fill out the free text field`}))).check(...r?[e.minLength(1,{error:`Please select at least one option`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),H=()=>e.optional(e.string()),U=e.enum([`en`,`zh`,`ms`,`ta`]),W=e.cuid2(),G=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),K=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:ae,routingLogic:c}),q=e.object({title:e.optional(e.string()),description:e.optional(e.string()),confirmation:e.optional(e.object({title:e.optional(e.string()),description:e.optional(e.string()),buttonText:e.optional(e.string())}))});e.partialRecord(U,q);const se=e.object({title:e.optional(e.string()),description:e.optional(e.string()),properties:e.optional(w)});e.partialRecord(U,se);const ce=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(K),confirmation:G,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const J=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),status:e.enum([`active`,`inactive`]),createdAt:e.date(),updatedAt:e.date()});e.object({data:e.array(J),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:W});const le=K;e.object({data:e.object({...J.shape,questions:e.array(le)})}),e.object({surveyId:W,responseId:e.union([e.cuid2(),e.uuid()])});const ue=e.catch(e.object({type:e.enum([`embedded`,`popover`,`modal`]),version:e.string().check(e.trim(),e.minLength(1),e.maxLength(50)),build:e.string().check(e.trim(),e.minLength(1),e.maxLength(50))}).partial(),{}),Y=e.record(e.string(),e.union([e.string().check(e.trim(),e.maxLength(2048)),e.number(),e.array(e.string().check(e.trim(),e.maxLength(2048))).check(e.maxLength(1024)),N])),X=e.string().check(e.trim(),e.maxLength(1e3)),de=e.record(X,X).check(e.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`));e.object({respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048)),data:Y,metadata:de,telemetry:e.optional(ue)}),e.object({id:e.string(),createdAt:e.date()}),e.object({surveyId:W,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:W,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:W});const Z=e.object({lastRespondedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastViewedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastDismissedAt:e.nullable(e.union([e.iso.datetime(),e.date()]))});e.object({type:e.enum([`view`,`dismiss`])}),e.object({}),e.object({surveyId:W}),e.object({respondent:e.optional(e.string().check(e.trim(),e.minLength(1),e.maxLength(255))),after:e.optional(e.iso.datetime({offset:!0,local:!0})),before:e.optional(e.iso.datetime({offset:!0,local:!0})),cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const fe=e.object({id:e.string(),respondent:e.string(),data:Y,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(fe),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})});const Q=e.number().check(e.int(),e.gte(0));e.object({data:e.object({totalViews:Q,uniqueViewers:Q,totalDismissals:Q,uniqueDismissers:Q,totalResponses:Q,uniqueResponders:Q})}),e.object({questionIds:e.array(e.string()).check(e.minLength(1)),timeRange:e.union([e.enum([`last-7-days`,`last-30-days`]),e.string().check(e.regex(/^q[1-4]-\d{4}$/)),e.string().check(e.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const $=e.record(e.string(),e.record(e.string(),e.number()));e.object({data:e.object({current:$,previousQuarter:e.nullable($)})});export{I as a,oe as c,T as d,E as f,P as i,B as l,X as n,V as o,l as p,ce as r,R as s,Z as t,H as u};
package/build/static.d.ts CHANGED
@@ -1,8 +1,14 @@
1
- import { A as WithProxyable, D as OptionallyDismissable, S as ConfettiContainer, T as Dismissable, d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-CK34OURL.js";
1
+ import { t as Locale } from "./index-BBwAZoO2.js";
2
+ import { A as WithProxyable, D as OptionallyDismissable, S as ConfettiContainer, T as Dismissable, d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-DuMdcx8z.js";
2
3
 
3
4
  //#region src/templates/EmbeddedConfettiContent.d.ts
4
5
  interface EmbeddedConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
5
6
  respondent: string;
7
+ /**
8
+ * Locale for resolving default Other/Submit/Close labels that have no
9
+ * author-written value to translate. Defaults to English.
10
+ */
11
+ locale?: Locale;
6
12
  }
7
13
  //#endregion
8
14
  //#region src/static/EmbeddedConfetti.d.ts
@@ -12,6 +18,11 @@ declare function EmbeddedConfetti(props: EmbeddedConfettiProps): import("react")
12
18
  //#region src/templates/ModalConfettiContent.d.ts
13
19
  interface ModalConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, OptionallyDismissable {
14
20
  respondent: string;
21
+ /**
22
+ * Locale for resolving default Other/Dismiss/Submit/Close labels that
23
+ * have no author-written value to translate. Defaults to English.
24
+ */
25
+ locale?: Locale;
15
26
  }
16
27
  //#endregion
17
28
  //#region src/static/ModalConfetti.d.ts
@@ -21,6 +32,12 @@ declare function ModalConfetti(props: ModalConfettiProps): import("react").JSX.E
21
32
  //#region src/templates/PopoverConfettiContent.d.ts
22
33
  interface PopoverConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Dismissable {
23
34
  respondent: string;
35
+ /**
36
+ * Locale for resolving default Next/Skip/Submit/Back/Dismiss/Close
37
+ * labels that have no author-written value to translate. Defaults to
38
+ * English.
39
+ */
40
+ locale?: Locale;
24
41
  }
25
42
  //#endregion
26
43
  //#region src/static/PopoverConfetti.d.ts
@@ -30,6 +47,11 @@ declare function PopoverConfetti(props: PopoverConfettiProps): import("react").J
30
47
  //#region src/templates/StepperConfettiContent.d.ts
31
48
  interface StepperConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
32
49
  respondent: string;
50
+ /**
51
+ * Locale for resolving default Next/Skip/Submit/Back/Close labels that
52
+ * have no author-written value to translate. Defaults to English.
53
+ */
54
+ locale?: Locale;
33
55
  }
34
56
  //#endregion
35
57
  //#region src/static/StepperConfetti.d.ts
package/build/static.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./DefaultConfettiTrigger-CqpZGyoA.js";import{c as t,o as n,t as r}from"./ModalContainer-BmgfXemR.js";import{a as i,d as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f}from"./Embed-CQISAOtU.js";import{useState as p}from"react";import{ErrorBoundary as m}from"react-error-boundary";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=({onClose:e,...r})=>g(m,{fallback:g(h,{}),children:g(t,{type:`embedded`,children:g(n,{...r,children:g(o,{...r,shouldAutoSubmit:!1,children:({questions:t,update:n,submit:a,isSubmitted:o,errors:c,answers:l})=>o?g(s,{onClose:e}):g(f,{onSubmit:a,children:t.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:l[e.id]??void 0,error:c[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:t=>n({question:e.position,answer:t})},e.id))})})})})}),y=e=>{let{respondent:t}=c();return g(v,{...e,respondent:t})};function b(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(y,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const x=({onDismiss:e,onClose:a,onFinished:c,closeOnFinishMs:l,isDismissable:u,...d})=>g(m,{fallback:g(h,{}),children:g(t,{type:`modal`,children:g(n,{...d,children:g(r,{onDismiss:e,onClose:a,closeOnFinishMs:l,isDismissable:u,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...d,shouldAutoSubmit:!1,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o,answers:c})=>o?g(s,{onClose:a}):g(f,{onSubmit:r,children:e.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:c[e.id]??void 0,error:n[e.id]||``,maskAllInputs:d.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.id))})})})})})}),S=e=>{let{respondent:t}=c();return g(x,{...e,respondent:t})};function C(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(S,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const w=({onDismiss:e,onClose:r,onFinished:c,closeOnFinishMs:u,...f})=>g(m,{fallback:g(h,{}),children:g(t,{type:`popover`,children:g(n,{...f,children:g(a,{onDismiss:e,onClose:r,closeOnFinishMs:u,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...f,shouldAutoSubmit:!0,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({current:e,questions:t,answers:n,update:a,back:o,canGoBack:c,backButtonLabel:u,saveAnswer:p,isSubmitted:m})=>{let _=e===t.length-1;if(m)return g(s,{onClose:r});let v=t[e];return v?g(l,{isLastQuestion:_,question:v,defaultAnswer:n[v.id]??void 0,backButton:c?g(d,{onPress:o,children:u}):void 0,saveAnswer:e=>p(v.id,e),onSubmit:t=>a({question:e,answer:t}),children:e=>g(i,{maskAllInputs:f.options?.bugReport?.maskAllInputs,...e})},v.id):g(h,{})}})})})})}),T=e=>{let{respondent:t}=c();return g(w,{...e,respondent:t})};function E(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(T,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const D=({onClose:e,...t})=>g(m,{fallback:g(h,{}),children:g(n,{...t,children:g(o,{...t,shouldAutoSubmit:!0,children:({current:n,questions:r,answers:a,update:o,back:c,canGoBack:u,backButtonLabel:f,saveAnswer:p,isSubmitted:m})=>{let _=n===r.length-1;if(m)return g(s,{onClose:e});let v=r[n];return v?g(l,{isLastQuestion:_,question:v,defaultAnswer:a[v.id]??void 0,backButton:u?g(d,{onPress:c,children:f}):void 0,saveAnswer:e=>p(v.id,e),onSubmit:e=>o({question:n,answer:e}),children:e=>g(i,{maskAllInputs:t.options?.bugReport?.maskAllInputs,...e})},v.id):g(h,{})}})})}),O=e=>{let{respondent:t}=c();return g(D,{...e,respondent:t})};function k(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(O,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const A=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=p(!1),[o,s]=p(!1);return _(h,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:()=>{s(!0),n?.()},onClose:()=>a(!1)})]})},j=({trigger:t=t=>g(e,{...t}),children:n,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,proxyUrl:s,...c})=>g(m,{fallback:g(h,{}),children:g(u,{...c,apiBaseUrl:s,children:g(A,{trigger:t,surveyId:c.surveyId,publishableKey:c.publishableKey,proxyUrl:s,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,children:n})})});export{j as ConfettiTrigger,b as EmbeddedConfetti,C as ModalConfetti,E as PopoverConfetti,k as StepperConfetti};
1
+ import{t as e}from"./DefaultConfettiTrigger-CN5hBUrU.js";import{f as t,m as n,t as r}from"./ModalContainer-CtsM2uHt.js";import{a as i,d as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f}from"./Embed-BJujRUNU.js";import{useState as p}from"react";import{ErrorBoundary as m}from"react-error-boundary";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=({onClose:e,locale:r,...a})=>g(m,{fallback:g(h,{}),children:g(n,{type:`embedded`,children:g(t,{...a,children:g(o,{...a,shouldAutoSubmit:!1,locale:r,children:({questions:t,update:n,submit:o,isSubmitted:c,errors:l,answers:u})=>c?g(s,{onClose:e,locale:r}):g(f,{onSubmit:o,locale:r,children:t.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:u[e.id]??void 0,error:l[e.id]||``,maskAllInputs:a.options?.bugReport?.maskAllInputs,locale:r,onChange:t=>n({question:e.position,answer:t})},e.id))})})})})}),y=e=>{let{respondent:t}=c();return g(v,{...e,respondent:t})};function b(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(y,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const x=({onDismiss:e,onClose:a,onFinished:c,closeOnFinishMs:l,isDismissable:u,locale:d,...p})=>g(m,{fallback:g(h,{}),children:g(n,{type:`modal`,children:g(t,{...p,children:g(r,{onDismiss:e,onClose:a,closeOnFinishMs:l,isDismissable:u,locale:d,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...p,shouldAutoSubmit:!1,locale:d,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o,answers:c})=>o?g(s,{onClose:a,locale:d}):g(f,{onSubmit:r,locale:d,children:e.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:c[e.id]??void 0,error:n[e.id]||``,maskAllInputs:p.options?.bugReport?.maskAllInputs,locale:d,onChange:n=>t({question:e.position,answer:n})},e.id))})})})})})}),S=e=>{let{respondent:t}=c();return g(x,{...e,respondent:t})};function C(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(S,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const w=({onDismiss:e,onClose:r,onFinished:c,closeOnFinishMs:u,locale:f,...p})=>g(m,{fallback:g(h,{}),children:g(n,{type:`popover`,children:g(t,{...p,children:g(a,{onDismiss:e,onClose:r,closeOnFinishMs:u,locale:f,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...p,shouldAutoSubmit:!0,locale:f,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({current:e,questions:t,answers:n,update:a,back:o,canGoBack:c,backButtonLabel:u,saveAnswer:m,isSubmitted:_})=>{let v=e===t.length-1;if(_)return g(s,{onClose:r,locale:f});let y=t[e];return y?g(l,{isLastQuestion:v,question:y,defaultAnswer:n[y.id]??void 0,backButton:c?g(d,{onPress:o,locale:f,children:u}):void 0,locale:f,saveAnswer:e=>m(y.id,e),onSubmit:t=>a({question:e,answer:t}),children:e=>g(i,{maskAllInputs:p.options?.bugReport?.maskAllInputs,locale:f,...e})},y.id):g(h,{})}})})})})}),T=e=>{let{respondent:t}=c();return g(w,{...e,respondent:t})};function E(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(T,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const D=({onClose:e,locale:n,...r})=>g(m,{fallback:g(h,{}),children:g(t,{...r,children:g(o,{...r,shouldAutoSubmit:!0,locale:n,children:({current:t,questions:a,answers:o,update:c,back:u,canGoBack:f,backButtonLabel:p,saveAnswer:m,isSubmitted:_})=>{let v=t===a.length-1;if(_)return g(s,{onClose:e,locale:n});let y=a[t];return y?g(l,{isLastQuestion:v,question:y,defaultAnswer:o[y.id]??void 0,backButton:f?g(d,{onPress:u,locale:n,children:p}):void 0,locale:n,saveAnswer:e=>m(y.id,e),onSubmit:e=>c({question:t,answer:e}),children:e=>g(i,{maskAllInputs:r.options?.bugReport?.maskAllInputs,locale:n,...e})},y.id):g(h,{})}})})}),O=e=>{let{respondent:t}=c();return g(D,{...e,respondent:t})};function k(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(O,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const A=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=p(!1),[o,s]=p(!1);return _(h,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:()=>{s(!0),n?.()},onClose:()=>a(!1)})]})},j=({trigger:t=t=>g(e,{...t}),children:n,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,proxyUrl:s,...c})=>g(m,{fallback:g(h,{}),children:g(u,{...c,apiBaseUrl:s,children:g(A,{trigger:t,surveyId:c.surveyId,publishableKey:c.publishableKey,proxyUrl:s,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,children:n})})});export{j as ConfettiTrigger,b as EmbeddedConfetti,C as ModalConfetti,E as PopoverConfetti,k as StepperConfetti};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/confetti",
3
- "version": "0.7.5",
3
+ "version": "0.8.0",
4
4
  "sideEffects": false,
5
5
  "description": "Widgets for Confetti",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -1 +0,0 @@
1
- import{n as e}from"./Button-LiaNjkvk.js";import{t}from"./src-DKk1GrYu.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const u={lastRespondedAt:null,lastDismissedAt:null};async function d({client:e,surveyId:n,respondent:r,signal:i}){try{let a=await e.get(`api/v1/cfti/${n}/respondent/${r}`,{signal:i}).json(),o=t.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),u)}catch{return u}}function f({client:e,surveyId:t,respondent:i}){let[a,o]=r(u),[s,c]=r(!1),[l,f]=r({client:e,surveyId:t,respondent:i});return(l.client!==e||l.surveyId!==t||l.respondent!==i)&&(f({client:e,surveyId:t,respondent:i}),o(u),c(!1)),n(()=>{if(!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;d({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(o(e),c(!0))})};r();let a=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,a),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,a)}},[e,t,i]),{state:a,isSettled:s}}function p({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${t}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const m=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),h=({onClick:t,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(e,{onPress:t,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(m,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{l as a,f as i,m as n,c as o,p as r,h as t};
@@ -1 +0,0 @@
1
- import{a as e,i as t,o as n,r}from"./DefaultConfettiTrigger-CqpZGyoA.js";import{D as i,E as a,G as o,I as s,N as c,O as l,R as u,T as d,V as f,_ as p,a as m,b as h,d as g,g as _,h as v,i as y,k as b,m as x,n as S,o as C,p as w,r as T,s as E,u as D,x as O,y as k,z as A}from"./Button-LiaNjkvk.js";import{a as j,c as M,d as ee,f as te,i as ne,l as re,o as ie,s as ae,u as oe}from"./src-DKk1GrYu.js";import{a as se,n as ce,o as le,r as ue,t as de}from"./internals-BzehCtEV.js";import{d as fe,f as pe,g as me,h as he,i as ge,l as _e,m as ve,p as ye,r as be,s as xe,u as Se}from"./ModalContainer-BmgfXemR.js";import N,{Suspense as Ce,cloneElement as we,createContext as P,forwardRef as F,isValidElement as Te,lazy as Ee,useCallback as I,useContext as L,useEffect as R,useMemo as z,useRef as B,useState as V}from"react";import{useTimeout as De}from"usehooks-ts";import{Fragment as H,jsx as U,jsxs as W}from"react/jsx-runtime";import G from"clsx";import"react-dom";function Oe(e,t,n){let r=d(e=>{n&&!e.defaultPrevented&&n(t)});R(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function ke(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=A(t);let o=A(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=ve({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Ae(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=ke(e),s=u([!!t,!!n,r,i]),c=u([!!t,!!n,r,i]);return o=l(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function je(e,t,n){let{validationBehavior:r,focus:i}=e;f(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Ne(n.current))}});let a=B(!1),o=d(()=>{a.current||t.resetValidation()}),s=d(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Pe(r)===n.current&&(i?i():n.current?.focus(),D(`keyboard`)),e.preventDefault()}),l=d(()=>{t.commitValidation()});R(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&c(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function Me(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function Ne(e){return{isInvalid:!e.validity.valid,validationDetails:Me(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Pe(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}const Fe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Ie={...Fe,customError:!0,valid:!1},K={isInvalid:!1,validationDetails:Fe,validationErrors:[]},Le=P({}),Re=`__reactAriaFormValidationState`;function q(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Re];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return ze(e)}function ze(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Ie},l=z(()=>!o||i==null?null:He(Ve(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=L(Le),d=z(()=>r?Array.isArray(r)?r.flatMap(e=>Be(u[e])):Be(u[r]):[],[u,r]),[f,p]=V(u),[m,h]=V(!1);u!==f&&(p(u),h(!1));let g=z(()=>He(m?[]:d),[m,d]),_=B(K),[v,y]=V(K),b=B(K),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Ue(e,b.current)||(b.current=e,y(e))},[S,C]=V(!1);return R(x),{realtimeValidation:c||g||l||a||K,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Ue(v,e)?y(e):_.current=e},resetValidation(){let e=K;Ue(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function Be(e){return e?Array.isArray(e)?e:[e]:[]}function Ve(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Be(n)}return[]}function He(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Ie}:null}function Ue(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function We(...e){let t=new Set,n=!1,r={...Fe};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function Ge(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:a=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:u=`aria`}=e,[d,f]=fe(e.value,e.defaultValue||``,e.onChange),{focusableProps:p}=E(e,t),m=q({...e,value:d}),{isInvalid:h,validationErrors:g,validationDetails:_}=m.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=Ae({...e,isInvalid:h,errorMessage:e.errorMessage||g}),S=i(e,{labelable:!0}),C={type:s,pattern:e.pattern},[w]=V(d);return Oe(t,e.defaultValue??w,f),je(e,m,t),{labelProps:v,inputProps:l(S,n===`input`?C:void 0,{disabled:r,readOnly:o,required:a&&u===`native`,"aria-required":a&&u===`aria`||void 0,"aria-invalid":h||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:d,onChange:e=>f(c(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(N.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...p,...y}),descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_}}function Ke(e,t,n){let{isDisabled:r=!1,isReadOnly:a=!1,value:o,name:s,form:u,children:d,"aria-label":f,"aria-labelledby":p,validationState:m=`valid`,isInvalid:h,onPressStart:_,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S}=e,C=e=>{e.stopPropagation(),t.setSelected(c(e).checked)},{pressProps:w,isPressed:T}=g({onPressStart:_,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S,isDisabled:r}),{pressProps:D,isPressed:O}=g({onPressStart:_,onPressEnd:v,onPressChange:y,onPressUp:x,onClick:S,onPress(e){b?.(e),t.toggle(),n.current?.focus()},isDisabled:r||a}),{focusableProps:k}=E(e,n),A=l(w,k),j=i(e,{labelable:!0});return Oe(n,t.defaultSelected,t.setSelected),{labelProps:l(D,{onClick:e=>e.preventDefault()}),inputProps:l(j,{"aria-invalid":h||m===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":a||void 0,onChange:C,disabled:r,...o==null?{}:{value:o},name:s,form:u,type:`checkbox`,...A}),isSelected:t.isSelected,isPressed:T||O,isDisabled:r,isReadOnly:a,isInvalid:h||m===`invalid`}}function qe(e,t,n){let r=q({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:u,isPressed:d,isDisabled:f,isReadOnly:p}=Ke({...e,isInvalid:i},t,n);je(e,r,n);let{isIndeterminate:m,isRequired:h,validationBehavior:_=`aria`}=e;R(()=>{n.current&&(n.current.indeterminate=!!m)});let{pressProps:v}=g({isDisabled:f||p,onPress(){let{[Re]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:l(s,v,z(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:u,"aria-required":h&&_===`aria`||void 0,required:h&&_===`native`},isSelected:u,isPressed:d,isDisabled:f,isReadOnly:p,isInvalid:i,validationErrors:a,validationDetails:o}}const Je=new WeakMap;function Ye(e,t){let{isDisabled:n,name:r,form:a,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:u}=t.displayValidation,{labelProps:d,fieldProps:f,descriptionProps:p,errorMessageProps:m}=Ae({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});Je.set(t,{name:r,form:a,descriptionId:p.id,errorMessageId:m.id,validationBehavior:o});let h=i(e,{labelable:!0}),{focusWithinProps:g}=C({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:l(h,{role:`group`,"aria-disabled":n||void 0,...f,...g}),labelProps:d,descriptionProps:p,errorMessageProps:m,isInvalid:s,validationErrors:c,validationDetails:u}}function Xe(e={}){let{isReadOnly:t}=e,[n,r]=fe(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=V(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function Ze(e,t,n){let r=Xe({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=Je.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=q({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=B(K),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};R(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=qe({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[Re]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const Qe=new WeakMap;function $e(e,t,n){let{value:r,children:a,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:u,onPressChange:d,onPress:f,onPressUp:p,onClick:m}=e,h=e.isDisabled||t.isDisabled,_=t.selectedValue===r,v=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:y,isPressed:b}=g({onPressStart:c,onPressEnd:u,onPressChange:d,onPress:f,onPressUp:p,onClick:m,isDisabled:h}),{pressProps:x,isPressed:S}=g({onPressStart:c,onPressEnd:u,onPressChange:d,onPressUp:p,onClick:m,isDisabled:h,onPress(e){f?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:C}=E(l(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),w=l(y,C),T=i(e,{labelable:!0}),D=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(D=0):t.selectedValue===r&&(D=0),h&&(D=void 0);let{name:O,form:k,descriptionId:A,errorMessageId:j,validationBehavior:M}=Qe.get(t);return Oe(n,t.defaultSelectedValue,t.setSelectedValue),je({validationBehavior:M},t,n),{labelProps:l(x,z(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:l(T,{...w,type:`radio`,name:O,form:k,tabIndex:D,disabled:h,required:t.isRequired&&M===`native`,checked:_,value:r,onChange:v,"aria-describedby":[e[`aria-describedby`],t.isInvalid?j:null,A].filter(Boolean).join(` `)||void 0}),isDisabled:h,isSelected:_,isPressed:b||S}}function et(e,t){let{name:n,form:r,isReadOnly:a,isRequired:o,isDisabled:u,orientation:d=`vertical`,validationBehavior:f=`aria`}=e,{direction:p}=ye(),{isInvalid:m,validationErrors:h,validationDetails:g}=t.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Ae({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||h}),x=i(e,{labelable:!0}),{focusWithinProps:S}=C({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),w=e=>{let n;switch(e.key){case`ArrowRight`:n=p===`rtl`&&d!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=p===`rtl`&&d!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=pe(e.currentTarget,{from:c(e),accept:e=>e instanceof s(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},T=A(n);return Qe.set(t,{name:T,form:r,descriptionId:y.id,errorMessageId:b.id,validationBehavior:f}),{radioGroupProps:l(x,{role:`radiogroup`,onKeyDown:w,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":a||void 0,"aria-required":o||void 0,"aria-disabled":u||void 0,"aria-orientation":d,...v,...S}),labelProps:_,descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}const tt=P({}),J=T(function(e,t){[e,t]=x(e,t,tt);let{elementType:n=`label`,...r}=e,i=k[n];return N.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),nt=P({}),Y=F(function(e,t){[e,t]=x(e,t,nt);let{elementType:n=`span`,...r}=e,i=k[n];return N.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function rt(e={}){let[t,n]=fe(e.value,e.defaultValue||[],e.onChange),[r]=V(t),i=!!e.isRequired&&t.length===0,a=B(new Map),o=q({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(We(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let it=Math.round(Math.random()*1e10),at=0;function ot(e){let t=z(()=>e.name||`radio-group-${it}-${++at}`,[e.name]),[n,r]=fe(e.value,e.defaultValue??null,e.onChange),[i]=V(n),[a,o]=V(null),s=q({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const X=P(null),Z=F(function(e,t){return L(X)?.isInvalid?N.createElement(st,{...e,ref:t}):null}),st=F((e,t)=>{let n=L(X),r=i(e,{global:!0}),a=v({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return a.children==null?null:N.createElement(Y,{slot:`errorMessage`,...r,...a,ref:t})}),ct=P(null),lt=P(null),ut=P(null),dt=F(function(e,t){[e,t]=x(e,t,lt);let{validationBehavior:n}=O(ct)||{},r=e.validationBehavior??n??`native`,a=rt({...e,validationBehavior:r}),[o,s]=_(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=Ye({...e,label:s,validationBehavior:r},a),m=v({...e,values:{isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-CheckboxGroup`}),h=i(e,{global:!0});return N.createElement(k.div,{...l(h,m,c),ref:t,slot:e.slot||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},N.createElement(w,{values:[[ut,a],[tt,{...u,ref:o,elementType:`span`}],[nt,{slots:{description:d,errorMessage:f}}],[X,p]]},m.children))}),ft=F(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=x(r,t,me);let{validationBehavior:o}=O(ct)||{},s=e.validationBehavior??o??`native`,c=L(ut),u=a(z(()=>b(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:g,isReadOnly:_,isPressed:S,isInvalid:C}=c?Ze({...h(e),value:e.value,children:typeof e.children==`function`||e.children},c,u):qe({...h(e),children:typeof e.children==`function`||e.children,validationBehavior:s},Xe(e),u),{isFocused:w,isFocusVisible:T,focusProps:E}=m(),D=g||_,{hoverProps:A,isHovered:j}=y({...e,isDisabled:D}),M=v({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:S,isHovered:j,isFocused:w,isFocusVisible:T,isDisabled:g,isReadOnly:_,isInvalid:C,isRequired:e.isRequired||!1}}),ee=i(e,{global:!0});return delete ee.id,delete ee.onClick,N.createElement(k.label,{...l(ee,d,A,M),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":S||void 0,"data-hovered":j||void 0,"data-focused":w||void 0,"data-focus-visible":T||void 0,"data-disabled":g||void 0,"data-readonly":_||void 0,"data-invalid":C||void 0,"data-required":e.isRequired||void 0},N.createElement(Se,{elementType:`span`},N.createElement(`input`,{...l(f,E),ref:u})),M.children)}),pt=P({}),mt=P({});let ht=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const gt=T(function(e,t){[e,t]=x(e,t,mt);let{hoverProps:n,isHovered:r}=y({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=m({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=v({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return N.createElement(k.input,{...l(ht(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),_t=P(null);function vt(e){let t=B({});return N.createElement(_t.Provider,{value:t},e.children)}const yt=P({isSelected:!1}),bt=P(null),xt=P(null),St=P(null),Ct=F(function(e,t){[e,t]=x(e,t,bt);let{validationBehavior:n}=O(ct)||{},r=e.validationBehavior??n??`native`,a=ot({...e,validationBehavior:r}),[o,s]=_(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=et({...e,label:s,validationBehavior:r},a),m=v({...e,values:{orientation:e.orientation||`vertical`,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:a.isRequired,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-RadioGroup`}),h=i(e,{global:!0});return N.createElement(k.div,{...l(h,m,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":a.isRequired||void 0},N.createElement(w,{values:[[St,a],[tt,{...u,ref:o,elementType:`span`}],[nt,{slots:{description:d,errorMessage:f}}],[X,p]]},N.createElement(vt,null,m.children)))}),wt=F(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=x(r,t,xt);let o=N.useContext(St),s=a(z(()=>b(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:c,inputProps:u,isSelected:d,isDisabled:f,isPressed:p}=$e({...h(e),children:typeof e.children==`function`||e.children},o,s),{isFocused:g,isFocusVisible:_,focusProps:S}=m(),C=f||o.isReadOnly,{hoverProps:w,isHovered:T}=y({...e,isDisabled:C}),E=v({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:d,isPressed:p,isHovered:T,isFocused:g,isFocusVisible:_,isDisabled:f,isReadOnly:o.isReadOnly,isInvalid:o.isInvalid,isRequired:o.isRequired}}),D=i(e,{global:!0});return delete D.id,delete D.onClick,N.createElement(k.label,{...l(D,c,w,E),ref:t,"data-selected":d||void 0,"data-pressed":p||void 0,"data-hovered":T||void 0,"data-focused":g||void 0,"data-focus-visible":_||void 0,"data-disabled":f||void 0,"data-readonly":o.isReadOnly||void 0,"data-invalid":o.isInvalid||void 0,"data-required":o.isRequired||void 0},N.createElement(Se,{elementType:`span`},N.createElement(`input`,{...l(u,S),ref:s})),N.createElement(yt.Provider,{value:{isSelected:d}},E.children))}),Tt=P({});let Et=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Dt=F(function(e,t){[e,t]=x(e,t,Tt);let{hoverProps:n,isHovered:r}=y(e),{isFocused:i,isFocusVisible:a,focusProps:o}=m({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=v({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return N.createElement(k.textarea,{...l(Et(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),Ot=P(null),kt=T(function(e,t){[e,t]=x(e,t,Ot);let{validationBehavior:n}=O(ct)||{},r=e.validationBehavior??n??`native`,a=B(null);[e,a]=x(e,a,he);let[o,s]=_(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=V(`input`),{labelProps:u,inputProps:d,descriptionProps:f,errorMessageProps:p,...m}=Ge({...h(e),inputElementType:c,label:s,validationBehavior:r},a),g=I(e=>{a.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[a]),y=v({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:m.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=i(e,{global:!0});return delete b.id,N.createElement(k.div,{...b,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":m.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},N.createElement(w,{values:[[tt,{...u,ref:o}],[mt,{...d,ref:g}],[Tt,{...d,ref:g}],[pt,{role:`presentation`,isInvalid:m.isInvalid,isDisabled:e.isDisabled||!1}],[nt,{slots:{description:f,errorMessage:p}}],[X,m]]},y.children))}),Q=e=>e===void 0||e===``||Array.isArray(e)&&e.length===0,At=({answer:e,defaultAnswer:t})=>{if(!Q(e)||!Q(t))return e},jt=(e,t)=>e.type===`end`?!1:e.type!==`next`||!t,Mt=({routingLogic:e,answer:t,required:n,isLastQuestion:r})=>{if(e.type!==`always`&&Q(t)&&n)return!0;let i=e.type===`always`?e.target:Q(t)?e.default:e.cases.find(e=>se({answer:t,condition:e}))?.target??e.default;return jt(i,r)},Nt=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=[...e].sort((e,t)=>e.position-t.position),a=r>=0?i[r]:void 0,o=le(i,t,{forceReachableIds:a?[a.id]:void 0}),s=i.map((e,t)=>{let i={...e},a=n[e.id];return a&&(i.error=a),{...i,visible:r===t||o.has(e.id)}}),c=s.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return c===-1&&(c=s.findLastIndex(e=>!!e.visible)),{questions:s,currentIndex:c}},$={rating:({scale:e},t)=>ae({scale:e},t),"open-ended":({max:e},t)=>ie({maxLength:e},t),"single-select":({editable:e},t)=>M({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>j({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>re(),"bug-report":(e,t)=>ne({},t)},Pt=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=$[n];return r(e,t)}case`open-ended`:{let r=$[n];return r(e,t)}case`single-select`:{let r=$[n];return r(e,t)}case`multi-select`:{let r=$[n];return r(e,t)}case`statement`:{let r=$[n];return r(e,t)}case`bug-report`:{let r=$[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Ft=({questions:e,answers:t})=>{let n=It({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},It=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Lt=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Rt={},zt=({questions:e,answers:t,errors:n})=>{let r={};for(let i of e){if(!i.visible||!i.required||t[i.id]!==void 0||n[i.id])continue;let e=Pt(i.properties,{required:i.required}).safeParse(void 0);e.success||(r[i.id]=_e(e.error))}return r},Bt=e=>{let t=e.querySelector(`[data-invalid]`);if(!t)return;let n=t.getAttribute(`role`);if(n===`radiogroup`||n===`group`){t.tabIndex=-1,t.focus();return}t.querySelector(`textarea, input`)?.focus()},Vt=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i})=>{let{survey:a,submit:o}=xe(),[s,c]=V({}),[l,u]=V({}),[d,f]=V(null),p=z(()=>Nt({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),m=e??d??p.currentIndex,h=z(()=>!!a?.isBackNavigationAllowed&&m>0&&p.questions.slice(0,m).some(e=>!!e.visible),[a?.isBackNavigationAllowed,p.questions,m]),g=I((e,t)=>{let n=p.questions.find(t=>t.id===e)?.required??!1,r=Q(t);c(i=>{if(!n&&r)return i[e]===null?i:{...i,[e]:null};if(n&&r){if(!(e in i))return i;let t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}})},[p.questions]),_=I(()=>{a?.isBackNavigationAllowed&&f(t=>{let n=t??e??p.currentIndex;for(let e=n-1;e>=0;e--)if(p.questions[e]?.visible)return e;return t})},[a?.isBackNavigationAllowed,p.questions,p.currentIndex,e]),[v,y]=V(0),b=v>0,x=B(null),[S,C]=V(!1);R(()=>{v===0||!x.current||Bt(x.current)},[v]);let w=I(({answers:e})=>{o({answers:e}).finally(()=>{r?.()})},[r,o]),T=I(()=>{let e=Lt({questions:p.questions,errors:l}),t=zt({questions:p.questions,answers:s,errors:e}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&u(e=>({...e,...t})),y(e=>e+1),!1;let i=Ft({questions:p.questions,answers:s});return w({answers:i}),C(!0),n?.(),!0},[s,l,p.questions,w,n]),E=I(({question:r,answer:i})=>{let o=p.questions.at(r);if(!o)return{error:`Question index is invalid`};let m=Pt(o.properties,{required:o.required}).safeParse(i);if(!m.success){let e=_e(m.error);return u(t=>{if(t[o.id]===e)return t;let n={...t};return n[o.id]=e,n}),c(e=>{if(!(o.id in e))return e;let t={...e};return delete t[o.id],t}),{error:e}}u(e=>{if(!e[o.id])return e;let t={...e};return delete t[o.id],t});let h=!i||Array.isArray(i)&&i.length===0,g=!o.required&&h?null:i,_={...s},v=_[o.id]!==g;_[o.id]=g;let y=Nt({originalQuestions:a?.questions,answers:_,errors:l,pointer:e});v&&c(_);let b=y.questions.findIndex((e,t)=>t>r&&!!e.visible);if(d!==null&&b!==-1)return f(b),{next:b};if(f(null),y.questions.filter(({visible:e})=>!!e).every(({id:e})=>_[e]!==void 0)&&t){let e=Ft({questions:y.questions,answers:_});w({answers:e}),C(!0),n?.()}return{next:y.currentIndex}},[p.questions,s,a?.questions,l,t,e,d,w,n]);return p.questions.length===0?U(H,{}):U(`div`,{ref:x,className:`confetti ${de}`,"data-show-errors":b||void 0,children:i({questions:p.questions,current:m,answers:s,update:E,back:_,canGoBack:h,backButtonLabel:a?.backButtonLabel??void 0,saveAnswer:g,submit:T,isSubmitted:S,errors:b?l:Rt})})},Ht=P(null);function Ut({children:i,surveyId:a,publishableKey:s,apiBaseUrl:c,respondent:l,isSurveyVisible:u}){let d=e({surveyId:a,override:l}),f=o({publishableKey:s,apiBaseUrl:c}),{isAvailable:p,isSettled:m}=r({client:f,surveyId:a}),{state:h,isSettled:g}=t({client:f,surveyId:a,respondent:d}),_=z(()=>({respondent:d}),[d]);return!d||!m||!g||!p||!n(h,u)?null:U(Ht.Provider,{value:_,children:i})}function Wt(e){return L(Ht)?U(H,{children:e.children}):U(Ut,{...e})}function Gt(){let e=L(Ht);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const Kt=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=xe(),[l,u]=V(!1),[d,f]=V(!1),[p,m]=V(!1),[h,g]=V(!1);return De(()=>{s&&i?.()},d&&!(p||h)?a:null),W(`div`,{className:G(`confetti-dialog ${de}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),m(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),m(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),g(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[U(be,{className:G(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{l||(await c(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>u(!0),setIsFinished:()=>f(!0)}):e]})},qt=3e4,Jt=({maskAllInputs:e,initialEventsJson:t}={})=>{let[n,r]=V(()=>t??null),[i,a]=V(!1),[o,s]=V(null),[c,l]=V(30),u=B(null),d=B(null),f=B(null),p=B([]);R(()=>{let e=new CustomEvent(ue,{detail:{isRecording:i}});document.dispatchEvent(e)},[i]);let m=I(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null),u.current=null,l(qt/1e3)},[]),h=I(()=>{u.current?.(),m(),a(!1),r(JSON.stringify(p.current))},[m]);return{recordingEventsJson:n,isRecording:i,recordingError:o,remainingSeconds:c,startRecording:I(async()=>{a(!0),s(null),r(null),p.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);u.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{p.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=qt/1e3;l(n),d.current=setInterval(()=>{--n,l(n)},1e3),f.current=setTimeout(()=>{h()},qt)}catch{s(`Failed to start recording. Please try again.`),a(!1),m()}},[e,h,m]),stopRecording:h,clear:I(()=>{m(),a(!1),r(null),s(null),p.current=[]},[m])}},Yt=e=>e.replace(/\S/g,`*`),Xt=e=>`*`.repeat(e.length),Zt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):Zt(n,t)},Qt=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,Xt(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=Xt(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=Xt(t.textContent)},$t=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${ce}`)){Zt(e,e=>{e.data=Yt(e.data)}),Qt(e);for(let t of e.querySelectorAll(`input, textarea, select`))Qt(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))Qt(e)}}}),en=({maskAllInputs:e,initialDataUrl:t}={})=>{let[n,r]=V(()=>t??null),[i,a]=V(!1),[o,s]=V(null);return{screenshotDataUrl:n,isCapturing:i,captureError:o,capture:I(async()=>{a(!0),s(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),n=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${de}`],excludeMode:`hide`,plugins:[$t({maskInputs:!!e})],fast:!1})).toCanvas(),i=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*i),n.width),o=Math.min(Math.round(window.innerHeight*i),n.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(n,0,0,a,o,0,0,a,o),r(s.toDataURL(`image/png`))}catch{s(`Failed to capture screenshot. Please try again.`)}finally{a(!1)}},[e]),clear:I(()=>{r(null),s(null)},[])}},tn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[U(`circle`,{cx:`12`,cy:`12`,r:`10`}),U(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),nn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[U(`path`,{d:`M10 11v6`}),U(`path`,{d:`M14 11v6`}),U(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),U(`path`,{d:`M3 6h18`}),U(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function rn(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function an(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=rn();return{userAgent:e.userAgent,screenResolution:`${t.width}x${t.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,language:e.language,timestamp:new Date().toISOString(),datadogTraceId:n?.traceId,datadogSessionId:n?.sessionId,datadogSessionReplayLink:n?.sessionReplayLink}}const on=Ee(()=>import(`./RecordingReplayer-DNYXhses.js`)),sn=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c,defaultAnswer:l})=>{let u=z(()=>an(),[]),d=l&&typeof l==`object`&&`title`in l?l:void 0,[f,p]=V(()=>d?.title??``),[m,h]=V(()=>d?.description??``),{screenshotDataUrl:g,isCapturing:_,captureError:v,capture:y,clear:b}=en({maskAllInputs:c,initialDataUrl:d?.screenshotDataUrl}),{recordingEventsJson:x,isRecording:C,recordingError:w,remainingSeconds:T,startRecording:E,stopRecording:D,clear:O}=Jt({maskAllInputs:c,initialEventsJson:d?.recordingEventsJson}),k=z(()=>({title:f,...m?{description:m}:{},...g?{screenshotDataUrl:g}:{},...x?{recordingEventsJson:x}:{},metadata:u}),[m,u,x,g,f]);R(()=>{i(k)},[k,i]),R(()=>()=>{D()},[D]);let A=z(()=>x?JSON.parse(x):[],[x]);return U(H,{children:C?W(S,{className:G(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:D,children:[U(tn,{}),W(`span`,{children:[30-T,`s /`,` `,30,`s`]})]}):W(`div`,{className:G(`cf-bug-report`,s?.base),children:[W(kt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:f,onChange:p,className:G(`cf-question`,s?.question),children:[W(`div`,{className:G(`cf-header`,s?.header),children:[W(J,{className:G(`cf-title`,s?.title),children:[t,!a&&W(`span`,{className:G(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,s?.description),children:n})]}),U(gt,{placeholder:r.placeholder||`Brief description of the issue`,className:G(`cf-input`,s?.input)}),U(Z,{className:G(`cf-error`,s?.error),children:o})]}),W(kt,{name:`${e}-description`,value:m,onChange:h,className:G(`cf-question`,s?.question),children:[U(J,{className:G(`cf-title`,s?.title),children:r.detailsLabel}),U(Dt,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:G(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?W(`section`,{className:G(`cf-question`,s?.question),children:[U(J,{className:G(`cf-title`,s?.title),children:`Attachments`}),W(`div`,{className:G(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&W(`div`,{className:G(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[g?W(`div`,{className:G(`cf-bug-report-media-preview`,s?.mediaPreview),children:[U(`img`,{src:g,alt:`Screenshot preview`,className:G(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),U(`div`,{className:G(`cf-bug-report-media-actions`,s?.mediaActions),children:U(S,{className:G(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:b,"aria-label":`Remove screenshot`,children:U(nn,{})})})]}):U(S,{className:G(`cf-bug-report-button`,s?.button),onPress:y,isDisabled:_,children:_?`Capturing...`:`Screenshot`}),v&&U(`div`,{className:G(`cf-error`,s?.error),children:v})]}),r.enableRecording&&W(`div`,{className:G(`cf-bug-report-recording-section`,s?.recordingSection),children:[A.length>0?W(`div`,{className:G(`cf-bug-report-media-preview`,s?.mediaPreview),children:[U(Ce,{fallback:U(`span`,{className:G(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:U(on,{events:A})}),U(`div`,{className:G(`cf-bug-report-media-actions`,s?.mediaActions),children:U(S,{className:G(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:O,"aria-label":`Remove recording`,children:U(nn,{})})})]}):U(S,{className:G(`cf-bug-report-button`,s?.button),onPress:E,children:`Record`}),w&&U(`div`,{className:G(`cf-error`,s?.error),children:w})]})]})]}):null]})})},cn=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s,defaultAnswer:c})=>{let[l,u]=V(()=>typeof c==`string`?c:``);return R(()=>{i(l)},[i,l]),W(kt,{isRequired:o,isInvalid:!!s,name:e,className:G(`cf-question`,a?.question),value:l,onChange:e=>{u(e),i(e)},children:[W(`div`,{className:G(`cf-header`,a?.header),children:[W(J,{className:G(`cf-title`,a?.title),children:[t,!o&&W(`span`,{className:G(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,a?.description),children:n})]}),U(Dt,{className:G(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),U(Z,{className:G(`cf-error`,a?.error),children:s})]})},ln=({children:e,classNames:t,description:n,...r})=>U(ft,{...r,children:({isIndeterminate:r})=>W(H,{children:[W(`div`,{className:G(`cf-choice-label`,t?.label),children:[U(`div`,{className:G(`cf-checkbox-indicator`,t?.indicator),children:U(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:G(`cf-checkbox-indicator-svg`,t?.svg),children:r?U(`rect`,{x:1,y:7.5,width:16,height:3}):U(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&U(`span`,{className:G(`cf-choice-description`,t?.choiceDescription),children:n})]})}),un=({children:e,classNames:t,...n})=>U(ft,{...n,children:U(`div`,{className:G(`cf-tag-label`,t?.tagLabel),children:e})}),dn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c})=>{let l=!!n.editable,u=n.display??`checkbox`,d=Array.isArray(c)?c:[],f=new Set(n.options.map(e=>e.value)),p=d.find(e=>!f.has(e)),[m,h]=V(()=>{let e=d.filter(e=>f.has(e));return p!==void 0&&l&&e.push(oe),e}),[g,_]=V(()=>p!==void 0&&l?p:``),v=B(null),y=B(null),b=z(()=>{let e=m.indexOf(oe);if(e===-1)return m;let t=[...m];return t[e]=g||`__CONFETTI_CHECKBOX_Others`,t},[g,m]),x=u===`tag`;return R(()=>{i(b)},[i,b]),U(dt,{isRequired:o,isInvalid:!!s,name:a,value:m,onChange:h,className:G(`cf-question`,r?.question),children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[e,!o&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:t})]}),W(`div`,{className:G(`cf-response-choices`,u===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>U(x?un:ln,{className:G(`cf-choice`,x&&[`cf-tag`,r?.tag],!x&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),l&&(x?W(H,{children:[U(un,{inputRef:v,onChange:e=>{y.current&&e&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},className:G(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),U(gt,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:g,onChange:e=>{_(e.target.value)},ref:y,className:G(`cf-input cf-tag-input`,r?.othersInput)})]}):W(`div`,{className:G(`cf-choice cf-others-choice`,r?.othersChoice),children:[U(ln,{inputRef:v,onChange:e=>{y.current&&e&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},className:G(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),U(gt,{value:g,onChange:e=>{_(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:y,onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:G(`cf-input`,r?.othersInput)})]}))]}),U(Z,{className:G(`cf-error`,r?.error),children:s})]})})},fn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),pn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),mn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),hn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),gn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),_n=e=>U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:U(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),vn=e=>U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:U(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),yn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return U(`div`,{className:G(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return U(wt,{className:G(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:U(o?vn:_n,{})},t)})})},bn=({properties:e,classNames:t})=>U(`div`,{className:G(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return U(wt,{className:G(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),xn=({properties:e,classNames:t,state:n})=>{let r=z(()=>[fn,mn,hn,gn,pn],[]),i=z(()=>[mn,hn,gn],[]);return z(()=>e.scale===3||e.scale===5,[e.scale])?U(`div`,{className:G(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return U(wt,{className:G(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&U(c,{})},a)})}):U(bn,{properties:e,classNames:t,state:n})},Sn=e=>{switch(e.properties.display??`star`){case`emoji`:return U(xn,{...e});case`number`:return U(bn,{...e});case`star`:return U(yn,{...e})}},Cn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s,defaultAnswer:c})=>{let[l,u]=V(()=>typeof c==`number`?String(c):null),d=z(()=>l?Number(l):void 0,[l]);return R(()=>{i(d)},[i,d]),U(Ct,{isRequired:s,isInvalid:!!o,name:a,className:G(`cf-question`,r?.question),value:l,onChange:u,children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[t,!s&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:n})]}),W(`div`,{className:G(`cf-rating-section`,r?.ratingSection),children:[U(Sn,{state:i,properties:e,classNames:r}),W(`div`,{className:G(`cf-rating-text`,r?.ratingText),children:[U(`span`,{className:G(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),U(`span`,{className:G(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),U(Z,{className:G(`cf-error`,r?.error),children:o})]})})},wn=({classNames:e,className:t,description:n,...r})=>U(wt,{...r,className:G(t,e?.radio),children:p(r.children,t=>W(H,{children:[W(`div`,{className:G(`cf-choice-label`,e?.label),children:[U(`div`,{className:G(`cf-radio-indicator`,e?.indicator)}),t]}),n&&U(`span`,{className:G(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Tn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c})=>{let l=!!n.editable,u=typeof c==`string`?c:null,d=u!==null&&n.options.some(e=>e.value===u),[f,p]=V(()=>u===null?null:d?u:l?ee:null),[m,h]=V(()=>u!==null&&!d&&l?u:``),g=B(null),_=B(null),v=z(()=>f===`__CONFETTI_RADIO_Others`?m||`__CONFETTI_RADIO_Others`:f??void 0,[m,f]);return R(()=>{i(v)},[i,v]),U(Ct,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{p(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{_.current&&_.current.focus()})},value:f,className:G(`cf-question`,r?.question),children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[e,!o&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:t})]}),W(`div`,{className:G(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>U(wn,{classNames:{indicator:r?.indicator,radio:G(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),l&&W(`div`,{className:G(`cf-choice cf-others-choice`,r?.othersChoice),children:[U(wn,{inputRef:g,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:G(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),U(gt,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:_,value:m,onChange:e=>h(e.target.value),onFocus:()=>{g.current?.checked===!1&&g.current.click()},className:G(`cf-input`,r?.othersInput)})]})]}),U(Z,{className:G(`cf-error`,r?.error),children:s})]})})},En=({properties:e,title:t,description:n,classNames:r})=>U(`div`,{className:G(`cf-question`,r?.question),children:W(`div`,{className:G(`cf-header`,r?.header),children:[t&&U(`div`,{className:G(`cf-title`,r?.title),children:t}),n&&U(`div`,{className:G(`cf-description`,r?.description),children:n})]})}),Dn=({question:e,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i})=>{switch(e.properties.type){case`rating`:return U(Cn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`open-ended`:return U(cn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`single-select`:return U(Tn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`multi-select`:return U(dn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`statement`:return U(En,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return U(sn,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i},e.id)}return U(`div`,{children:`Unsupported question type`},e.id)},On=({title:e,description:t,classNames:n,onClose:r})=>{let{survey:i}=xe();if(!i)return null;let a=t||i.confirmation.description;return W(H,{children:[U(`div`,{className:G(`cf-question`,n?.question),children:W(`div`,{className:G(`cf-header`,n?.header),children:[U(J,{className:G(`cf-title`,n?.title),children:e||i.confirmation.title||`Feedback submitted!`}),a&&U(Y,{slot:`description`,className:G(`cf-description`,n?.description),children:a})]})}),U(S,{className:`cf-submit-button`,onPress:()=>{r?.()},children:i.confirmation.buttonText||`Close`})]})},kn=({onPress:e,children:t=`Back`})=>ge()?null:U(S,{className:`cf-back-button`,onPress:e,children:t}),An=({onPress:e,isDisabled:t,children:n=`Submit`})=>ge()?null:U(S,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),jn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},Mn=e=>!Q(e),Nn=({onSubmit:e,children:t,question:n,isLastQuestion:r,defaultAnswer:i,backButton:a,saveAnswer:o})=>{let s=ge(),[c,l]=V(i??jn(n.properties.type)),u=z(()=>Pt(n.properties,{required:n.required}),[n.properties,n.required]),d=z(()=>{let e=u.safeParse(c);if(!e.success)return _e(e.error)},[c,u]),f=z(()=>Mt({routingLogic:n.routingLogic,answer:c,required:n.required,isLastQuestion:r}),[c,r,n.required,n.routingLogic]),p=z(()=>n.properties.buttonLabel?n.properties.buttonLabel:f?!n.required&&!Mn(c)?`Skip`:`Next`:`Submit`,[c,f,n.properties.buttonLabel,n.required]),m=I(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=te.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(c)}},[c,e,n.properties]),h=Mn(i),g=z(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties])&&!h,_=I(t=>{l(t),g&&Mn(t)&&u.safeParse(t).success&&e(t)},[g,u,e]),v=z(()=>{if(!a||!Te(a))return a;let e=a;return we(e,{onPress:()=>{let t=At({answer:c,defaultAnswer:i});t!==void 0&&o?.(t),e.props.onPress?.()}})},[a,c,i,o]);return W(H,{children:[t({onChange:_,question:n,error:d,defaultAnswer:i}),!s&&W(`div`,{className:`cf-button-row`,children:[v,(!g||!n.required)&&U(An,{isDisabled:!!d,onPress:m,children:p})]})]})},Pn=({onSubmit:e,children:t})=>W(H,{children:[t,U(An,{onPress:e})]});export{Dn as a,Cn as c,Kt as d,Ht as f,Vt as h,On as i,dn as l,Gt as m,Nn as n,En as o,Wt as p,kn as r,Tn as s,Pn as t,cn as u};
@@ -1 +0,0 @@
1
- import{z as e}from"zod";const t=e.object({type:e.literal(`next`)}),n=e.object({type:e.literal(`end`)}),r=e.object({type:e.literal(`jump`),target:e.number({error:`Target question is required`})}),i=e.discriminatedUnion(`type`,[t,r,n]),ee=e.object({type:e.literal(`value`),value:e.union([e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),e.number({error:`Value is required`})])}),a=e.object({type:e.literal(`binary-operator`),operator:e.union([e.literal(`equal`),e.literal(`not-equal`),e.literal(`greater`),e.literal(`greater-or-equal`),e.literal(`less`),e.literal(`less-or-equal`),e.literal(`contains`),e.literal(`not-contains`)]),value:ee,target:i}),o=e.object({type:e.literal(`switch`),cases:e.array(a),default:i}),s=e.object({type:e.literal(`always`),target:i}),c=e.discriminatedUnion(`type`,[s,o]),l=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),u=e.optional(e.string().check(e.trim(),e.maxLength(50))),d=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),f=e.array(d).check(e.superRefine((e,t)=>{let n=new Set;for(let r of e)if(r.translationId!==void 0){if(n.has(r.translationId)){t.addIssue({code:`custom`,message:`Option translation ids must be unique within a question`});return}n.add(r.translationId)}})),p=e.nullable(e.object({label:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),max:e.number(),description:e.optional(e.string().check(e.trim()))})),m=e.optional(e.boolean()),h=e.object({type:e.literal(`rating`),buttonLabel:u,shouldAutoProgress:m,scale:e.number().check(e.gte(2),e.lte(10)),labels:e.optional(e.object({lower:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e))),upper:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e)))})),display:e.optional(e.literal([`star`,`emoji`,`number`]))}),g=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u,max:e.number()}),te=e.object({type:e.literal(`single-select`),shouldAutoProgress:m,options:f,buttonLabel:u,editable:p}),ne=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:f,editable:p,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),re=e.object({type:e.literal(`statement`),buttonLabel:u,buttonUrl:e.optional(l)}),ie=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,enableScreenshot:e.boolean(),enableRecording:e.boolean(),detailsLabel:e.string().check(e.trim(),e.minLength(1,{error:`Label is required`}),e.maxLength(128)),detailsPlaceholder:e.optional(e.string()),redactClasses:e.optional(e.array(e.string()))}),ae=e.discriminatedUnion(`type`,[h,te,g,ne,re,ie]),_=e.object({label:e.optional(e.string()),description:e.optional(e.string())}),v=e.object({type:e.literal(`rating`),buttonLabel:u,labels:e.optional(e.object({lower:e.optional(e.string()),upper:e.optional(e.string())}))}),y=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u}),b=e.object({type:e.literal(`single-select`),buttonLabel:u,options:e.optional(e.record(e.string(),_))}),x=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:e.optional(e.record(e.string(),_))}),S=e.object({type:e.literal(`statement`),buttonLabel:u}),C=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,detailsLabel:e.optional(e.string()),detailsPlaceholder:e.optional(e.string())}),w=e.discriminatedUnion(`type`,[v,y,b,x,S,C]),T=`__CONFETTI_CHECKBOX_Others`,E=`__CONFETTI_RADIO_Others`,D=e.optional(e.looseObject({userAgent:e.string().check(e.trim(),e.maxLength(1e3)),screenResolution:e.string().check(e.trim(),e.maxLength(100)),viewportSize:e.string().check(e.trim(),e.maxLength(100)),pageUrl:e.string(),pageTitle:e.string().check(e.trim(),e.maxLength(1e3)),referrer:e.string(),datadogTraceId:e.optional(e.string()),datadogSessionId:e.optional(e.string()),datadogSessionReplayLink:e.optional(e.string())}).partial().catchall(e.optional(e.string())));e.cuid2();const O=e.looseObject({type:e.literal([0,1,2,3,4,5,6]),data:e.unknown(),timestamp:e.number(),delay:e.optional(e.number())});e.array(O);const k=e.array(O),A=e.string().check(e.refine(e=>{try{return k.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),j=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),M=t=>e.object({title:e.string().check(e.trim(),...t?[e.minLength(1,{error:`Title is required`})]:[],e.maxLength(256)),description:e.optional(e.string().check(e.trim(),e.maxLength(4096))),screenshotDataUrl:e.optional(j),recordingEventsJson:e.optional(A),metadata:D}),N=M(!0),P=(e,{required:t})=>M(t),F=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),I=({scale:t},{required:n})=>{let r=F(t);return n?r:e.optional(r)},L=({maxLength:t},{required:n})=>e.string().check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),oe=(t,n)=>e.string({error:`Please select an option`}).check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==E,{error:`Please fill out the free text field`})),R=({maxLength:t},{required:n})=>{let r=oe(t,n);return n?r:e.optional(r)},z=({maxSelected:t,maxLength:n},{required:r})=>e.array(e.string().check(e.trim(),...r?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(n??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==T,{error:`Please fill out the free text field`}))).check(...r?[e.minLength(1,{error:`Please select at least one option`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),B=()=>e.optional(e.string()),V=e.enum([`en`,`zh`,`ms`,`ta`]),H=e.cuid2(),U=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),W=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:ae,routingLogic:c}),G=e.object({title:e.optional(e.string()),description:e.optional(e.string()),confirmation:e.optional(e.object({title:e.optional(e.string()),description:e.optional(e.string()),buttonText:e.optional(e.string())}))});e.partialRecord(V,G);const K=e.object({title:e.optional(e.string()),description:e.optional(e.string()),properties:e.optional(w)});e.partialRecord(V,K);const q=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(W),confirmation:U,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const J=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),status:e.enum([`active`,`inactive`]),createdAt:e.date(),updatedAt:e.date()});e.object({data:e.array(J),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:H});const se=W;e.object({data:e.object({...J.shape,questions:e.array(se)})}),e.object({surveyId:H,responseId:e.union([e.cuid2(),e.uuid()])});const ce=e.catch(e.object({type:e.enum([`embedded`,`popover`,`modal`]),version:e.string().check(e.trim(),e.minLength(1),e.maxLength(50)),build:e.string().check(e.trim(),e.minLength(1),e.maxLength(50))}).partial(),{}),Y=e.record(e.string(),e.union([e.string().check(e.trim(),e.maxLength(2048)),e.number(),e.array(e.string().check(e.trim(),e.maxLength(2048))).check(e.maxLength(1024)),N])),X=e.string().check(e.trim(),e.maxLength(1e3)),Z=e.record(X,X).check(e.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`));e.object({respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048)),data:Y,metadata:Z,telemetry:e.optional(ce)}),e.object({id:e.string(),createdAt:e.date()}),e.object({surveyId:H,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:H,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:H});const le=e.object({lastRespondedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastViewedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastDismissedAt:e.nullable(e.union([e.iso.datetime(),e.date()]))});e.object({type:e.enum([`view`,`dismiss`])}),e.object({}),e.object({surveyId:H}),e.object({respondent:e.optional(e.string().check(e.trim(),e.minLength(1),e.maxLength(255))),after:e.optional(e.iso.datetime({offset:!0,local:!0})),before:e.optional(e.iso.datetime({offset:!0,local:!0})),cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const ue=e.object({id:e.string(),respondent:e.string(),data:Y,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(ue),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})});const Q=e.number().check(e.int(),e.gte(0));e.object({data:e.object({totalViews:Q,uniqueViewers:Q,totalDismissals:Q,uniqueDismissers:Q,totalResponses:Q,uniqueResponders:Q})}),e.object({questionIds:e.array(e.string()).check(e.minLength(1)),timeRange:e.union([e.enum([`last-7-days`,`last-30-days`]),e.string().check(e.regex(/^q[1-4]-\d{4}$/)),e.string().check(e.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const $=e.record(e.string(),e.record(e.string(),e.number()));e.object({data:e.object({current:$,previousQuarter:e.nullable($)})});export{z as a,R as c,E as d,l as f,P as i,B as l,X as n,L as o,q as r,I as s,le as t,T as u};