@opengovsg/confetti 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -150,12 +150,16 @@ Choose the component that best fits your use case:
150
150
 
151
151
  ## Locale
152
152
 
153
+ Requires `@opengovsg/confetti` `0.8.2` or later. Older versions keep the
154
+ English survey — they do not fail to load.
155
+
153
156
  Pass `locale` to show a translated survey. Author translations in the Confetti
154
157
  dashboard (English is always the source; Chinese, Malay, and Tamil are
155
158
  optional). Untranslated fields fall back to English.
156
159
 
157
- `useResolveLocale` maps a BCP-47 tag (or the browser's language preferences)
158
- to `'en' | 'zh' | 'ms' | 'ta'`:
160
+ The widget does not read the browser language on its own. Use
161
+ `useResolveLocale` to map a BCP-47 tag (or the browser's language
162
+ preferences) to `'en' | 'zh' | 'ms' | 'ta'`:
159
163
 
160
164
  ```tsx
161
165
  import { PopoverConfetti, useResolveLocale } from '@opengovsg/confetti'
@@ -174,8 +178,9 @@ function Feedback() {
174
178
  ```
175
179
 
176
180
  Pass `preferred` when the host app already knows the locale (for example
177
- next-intl), and `explicit` for an override that should win even when it does
178
- not match a Confetti locale:
181
+ next-intl). Pass `explicit` for an override that wins even when it does not
182
+ match a Confetti locale — including an empty string, which falls back to
183
+ English instead of `preferred`:
179
184
 
180
185
  ```tsx
181
186
  const locale = useResolveLocale({
@@ -184,6 +189,16 @@ const locale = useResolveLocale({
184
189
  })
185
190
  ```
186
191
 
192
+ To always show one language, pass `locale` directly and skip the hook:
193
+
194
+ ```tsx
195
+ <PopoverConfetti
196
+ surveyId="your-survey-id"
197
+ publishableKey="your-publishable-key"
198
+ locale="zh"
199
+ />
200
+ ```
201
+
187
202
  | Value | Language |
188
203
  | ----- | ----------------- |
189
204
  | `en` | English (default) |
@@ -196,7 +211,9 @@ placeholders, and validation errors — still localises for the given locale.
196
211
  Omit `locale`, or pass `'en'`, to keep the English survey.
197
212
 
198
213
  The same prop is accepted on the [static](#static-components) components and
199
- on the [building-block](#building-blocks) primitives.
214
+ on the [building-block](#building-blocks) primitives. Import
215
+ `useResolveLocale` from `@opengovsg/confetti` in those setups too. See the
216
+ [translations guide](https://docs.confetti.gov.sg/docs/surveys/translations).
200
217
 
201
218
  ## Static Components
202
219
 
@@ -1,4 +1,4 @@
1
- import { a as MultiSelectAnswer, i as BugReportAnswer, n as Locale, o as RatingAnswer, s as SingleSelectAnswer, t as PublicGetSurveyOutput } from "./index-DODfg3Bc.js";
1
+ import { a as BugReportAnswer, c as SingleSelectAnswer, n as PublicGetSurveyOutput, o as MultiSelectAnswer, r as Locale, s as RatingAnswer, t as PublicPutResponseOutput } from "./index-BgEIWUUt.js";
2
2
  import { PropsWithChildren, ReactNode } from "react";
3
3
 
4
4
  //#region src/core/types.d.ts
@@ -76,7 +76,7 @@ interface Finishable {
76
76
  * Callback is invoked after the survey response is submitted and the
77
77
  * submission network call settles.
78
78
  */
79
- onFinished?: () => void;
79
+ onFinished?: (result?: PublicPutResponseOutput) => void;
80
80
  }
81
81
  interface Closable {
82
82
  /**
@@ -174,7 +174,7 @@ interface SurveyContextValue {
174
174
  answers
175
175
  }: {
176
176
  answers: Record<Question$1['id'], Answer>;
177
- }) => Promise<void>;
177
+ }) => Promise<PublicPutResponseOutput | void>;
178
178
  dismiss: () => Promise<void> | void;
179
179
  survey: PublicGetSurveyOutput | undefined;
180
180
  }
@@ -1 +1 @@
1
- import{n as e}from"./Button-LiaNjkvk.js";import{t}from"./src-Cg5yexLG.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};
1
+ import{n as e}from"./Button-LiaNjkvk.js";import{t}from"./src-D7lX72kz.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-B4MnmgtJ.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{c as M,d as ee,f as te,h as ne,l as re,m as ie,o as ae,p as oe,s as se,u as ce}from"./src-D7lX72kz.js";import{a as le,n as ue,o as de,r as fe,t as pe}from"./internals-C8EZCPMe.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-CftztDnr.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`&&se(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)=>ce({scale:e},t),"open-ended":({max:e},t)=>re({maxLength:e},t),"single-select":({editable:e},t)=>ee({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>M({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>te(),"bug-report":(e,t)=>ae({},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})=>{Promise.resolve(s({answers:e})).then(e=>r?.(e??void 0),()=>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(oe),e}),[v,y]=H(()=>h!==void 0&&u?h:``),b=V(null),x=V(null),S=B(()=>{let e=g.indexOf(oe);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.label??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?ie: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.label??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=ne.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,4 +1,4 @@
1
- import { n as Locale } from "./index-DODfg3Bc.js";
1
+ import { r as Locale } from "./index-BgEIWUUt.js";
2
2
 
3
3
  //#region src/components/container/ModalContainer.d.ts
4
4
  interface ModalContainerProps {
@@ -0,0 +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{i as me,n as he,r as ge}from"./src-D7lX72kz.js";import{i as _e,r as ve,t as ye}from"./internals-C8EZCPMe.js";import b,{createContext as x,forwardRef as be,useCallback as S,useContext as C,useEffect as w,useMemo as T,useReducer as xe,useRef as E,useState as D}from"react";import{useTimeout as Se}from"usehooks-ts";import{z as O}from"zod";import{Fragment as Ce,jsx as k,jsxs as we}from"react/jsx-runtime";import A from"clsx";import Te,{flushSync as Ee}from"react-dom";const De=x(null);x(null),x(null),x(null),x(null);const Oe=x({});x(null);const ke=x(null);var Ae=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 je(e,t,n,r){return p()?new Ae(e,t,n,r):e.createTreeWalker(t,n,r)}function Me(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 Ne(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 Pe=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!Pe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Fe(){let e=t(),[n,r]=D(()=>e?{width:0,height:0}:Ie());return w(()=>{let e=e=>{r(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(Ie())},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(Ie()),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 Ie(){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 Le(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]),ze(e,i,S(()=>r(!1),[])),i}function Re(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 ze(e,i,S(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function ze(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||Ee(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const Be=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Ve(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let P=new WeakMap,F=[];function He(t,n){let r=c(t?.[0]),i=n instanceof r.Element?{root:n}:n,o=i?.root??document.body,s=i?.shouldUseInert&&Be,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=je(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)&&Ve(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)&&Ve(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 Ue=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),We=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Ge(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 Ue.has(t.script)}let t=e.split(`-`)[0];return We.has(t)}const Ke=Symbol.for(`react-aria.i18n.locale`);function qe(){let e=typeof window<`u`&&window[Ke]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Ge(e)?`rtl`:`ltr`}}let Je=qe(),I=new Set;function Ye(){Je=qe();for(let e of I)e(Je)}function Xe(){let e=t(),[n,r]=D(Je);return w(()=>(I.size===0&&window.addEventListener(`languagechange`,Ye),I.add(r),()=>{I.delete(r),I.size===0&&window.removeEventListener(`languagechange`,Ye)}),[]),e?{locale:typeof window<`u`&&window[Ke]||`en-US`,direction:`ltr`}:n}const Ze=b.createContext(null);function Qe(){let e=Xe();return C(Ze)||e}const $e=Symbol.for(`react-aria.i18n.locale`),et=Symbol.for(`react-aria.i18n.strings`);let L;var tt=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=nt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[$e];if(L===void 0){let t=window[et];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 nt(e,t,n=`en-US`){if(t[e])return t[e];let r=rt(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function rt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const it=new Map,at=new Map;var ot=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=it.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),it.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=at.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),at.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const st=new WeakMap;function ct(e){let t=st.get(e);return t||(t=new tt(e),st.set(e,t)),t}function lt(e,t){return t&&tt.getGlobalDictionaryForPackage(t)||ct(e)}function ut(e,t){let{locale:n}=Qe(),r=lt(e,t);return T(()=>new ot(n,r),[n,r])}const dt=b.createContext(null),ft=`react-aria-focus-scope-restore`;let R=null;function pt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=E(null),s=E(null),c=E([]),{parentNode:l}=C(dt)||{},d=T(()=>new Ot({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(ft,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(ft,n)}},[t]),Ct(c,r,n),_t(c,n),Tt(c,r,n),St(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(()=>mt(c),[]),p=T(()=>({focusManager:f,parentNode:d}),[d,f]);return b.createElement(dt.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 mt(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 ht(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 gt(e){if(e.checked)return!0;let t=ht(e);return t.length>0&&!t.some(e=>e.checked)}function _t(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&&xt(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&&xt(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 vt(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 yt(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 bt(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 xt(e,t=!0){W(bt(e,t))}function St(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&&xt(e.current)),n.current=!1},[e])}function Ct(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:vt(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 wt(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Tt(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)||!wt(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):vt(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&&wt(e))){let t=K.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Et(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&K.getTreeNode(n.scopeRef)){Et(bt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Et(e){e.dispatchEvent(new CustomEvent(ft,{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=je(s,t||s,NodeFilter.SHOW_ELEMENT,{acceptNode(t){return e(r?.from,t)||r?.tabbable&&t.tagName===`INPUT`&&t.getAttribute(`type`)===`radio`&&(!gt(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 Dt=class e{constructor(){this.fastMap=new Map,this.root=new Ot({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 Ot({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}},Ot=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 Dt;const kt=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function At(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;kt(()=>{a.current=c});let[,l]=xe(()=>({}),{});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 jt({children:e}){let t=T(()=>({register:()=>{}}),[]);return b.createElement(te.Provider,{value:t},e)}function Mt(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,o=E({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=g(e=>{n&&Nt(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&&Nt(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 Nt(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 Pt={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 Ft(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?{...Pt,...t}:Pt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function It(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=Ft(e);return b.createElement(n,f(a,o),t)}const Lt=x({});function Rt(){return C(Lt)??{}}const zt=b.createContext(null);function Bt(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}=Rt();if(!e.portalContainer&&c&&(r=c()),!r)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(pt,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},l)),l=b.createElement(zt.Provider,{value:s},b.createElement(jt,null,l)),Te.createPortal(l,r)}function Vt(){let e=C(zt)?.setContain;v(()=>{e?.(!0)},[e])}function Ht(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]),Vt(),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 Ut={};Ut={dismiss:`تجاهل`};var Wt={};Wt={dismiss:`Отхвърляне`};var Gt={};Gt={dismiss:`Odstranit`};var Kt={};Kt={dismiss:`Luk`};var qt={};qt={dismiss:`Schließen`};var Jt={};Jt={dismiss:`Απόρριψη`};var Yt={};Yt={dismiss:`Dismiss`};var Xt={};Xt={dismiss:`Descartar`};var Zt={};Zt={dismiss:`Lõpeta`};var Qt={};Qt={dismiss:`Hylkää`};var $t={};$t={dismiss:`Rejeter`};var en={};en={dismiss:`התעלם`};var tn={};tn={dismiss:`Odbaci`};var nn={};nn={dismiss:`Elutasítás`};var rn={};rn={dismiss:`Ignora`};var an={};an={dismiss:`閉じる`};var on={};on={dismiss:`무시`};var sn={};sn={dismiss:`Atmesti`};var cn={};cn={dismiss:`Nerādīt`};var ln={};ln={dismiss:`Lukk`};var un={};un={dismiss:`Negeren`};var dn={};dn={dismiss:`Zignoruj`};var fn={};fn={dismiss:`Descartar`};var pn={};pn={dismiss:`Dispensar`};var mn={};mn={dismiss:`Revocare`};var hn={};hn={dismiss:`Пропустить`};var gn={};gn={dismiss:`Zrušiť`};var _n={};_n={dismiss:`Opusti`};var vn={};vn={dismiss:`Odbaci`};var yn={};yn={dismiss:`Avvisa`};var bn={};bn={dismiss:`Kapat`};var xn={};xn={dismiss:`Скасувати`};var Sn={};Sn={dismiss:`取消`};var Cn={};Cn={dismiss:`關閉`};var wn={};wn={"ar-AE":Ut,"bg-BG":Wt,"cs-CZ":Gt,"da-DK":Kt,"de-DE":qt,"el-GR":Jt,"en-US":Yt,"es-ES":Xt,"et-EE":Zt,"fi-FI":Qt,"fr-FR":$t,"he-IL":en,"hr-HR":tn,"hu-HU":nn,"it-IT":rn,"ja-JP":an,"ko-KR":on,"lt-LT":sn,"lv-LV":cn,"nb-NO":ln,"nl-NL":un,"pl-PL":dn,"pt-BR":fn,"pt-PT":pn,"ro-RO":mn,"ru-RU":hn,"sk-SK":gn,"sl-SI":_n,"sr-SP":vn,"sv-SE":yn,"tr-TR":bn,"uk-UA":xn,"zh-CN":Sn,"zh-TW":Cn};function Tn(e){return e&&e.__esModule?e.default:e}function En(e){let{onDismiss:t,...n}=e,r=Me(n,ut(Tn(wn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(It,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const q=[];function Dn(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())};Mt({ref:t,onInteractOutside:a&&i?f:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=se({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||yt(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const J=typeof document<`u`&&window.visualViewport;let Y=0,On;function kn(e={}){let{isDisabled:t}=e;v(()=>{if(!t)return Y++,Y===1&&(On=y()?jn():An()),()=>{Y--,Y===0&&On()}},[t])}function An(){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 jn(){let e=X(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=d(e);t=j(r)?r:Ne(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
+ * {
3
+ overscroll-behavior: contain;
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}),Nn(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)&&Nn(this,n)};let f=l(Mn(document,`touchstart`,r,{passive:!1,capture:!0}),Mn(document,`touchmove`,o,{passive:!1,capture:!0}),Mn(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 Mn(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Nn(e,t){t||!J?Pn(e):J.addEventListener(`resize`,()=>Pn(e),{once:!0})}function Pn(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Ne(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 Fn(e,t,n){let{overlayProps:r,underlayProps:i}=Dn({...e,isOpen:t.isOpen,onClose:t.close},n);return kn({isDisabled:!t.isOpen}),Vt(),w(()=>{if(t.isOpen&&n.current)return He([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:f(r),underlayProps:i}}function In(e){let[t,n]=At(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 Ln=x(null),Z=x(null),Rn=be(function(e,t){let n=e[`aria-labelledby`];[e,t]=oe(e,t,Ln);let{dialogProps:i,titleProps:a}=Ht({...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:[[Oe,{slots:{[ue]:{},title:{...a,level:2}}}],[le,{slots:{[ue]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),zn=x(null),Bn=x(null),Vn=be(function(e,t){if(C(Bn))return b.createElement(Gn,{...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(Un,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Gn,{...f,modalRef:t},s))});function Hn(e,n){[e,n]=oe(e,n,zn);let r=C(Z),a=In(e),o=e.isOpen!=null||e.defaultOpen!=null||!r?a:r,s=i(n),c=E(null),l=Re(s,o.isOpen),u=Re(c,o.isOpen),d=l||u||e.isExiting||!1,f=t();return!o.isOpen&&!d||f?null:b.createElement(Wn,{...e,state:o,isExiting:d,overlayRef:s,modalRef:c})}const Un=be(Hn);function Wn({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Fn(t,i,n),s=Le(t.overlayRef)||t.isEntering||!1,c=ne({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Fe(),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(Bt,{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:[[Bn,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Z,i]]},c.children)))}function Gn(e){let{modalProps:t,modalRef:n,isExiting:a,isDismissable:o}=C(Bn),s=C(Z),c=i(T(()=>ie(e.modalRef,n),[e.modalRef,n])),l=Le(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(En,{onDismiss:s.close}),u.children)}const Kn={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} விருப்பங்களைத் தேர்ந்தெடுக்கவும்`}},qn=(e=`en`)=>Kn[e],Jn=/^Please enter less than (\d+) characters$/,Yn=/^Please select less than (\d+) options$/,Xn=(e,t)=>{let n=qn(t),r=e.match(Jn);if(r)return n.maxLength.replace(`{max}`,r[1]??``);let i=e.match(Yn);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 Zn(e,t){let n=e.issues[0];return Xn(n?.message??`Invalid input`,t)}function Qn(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}const $n=[`id`,`email`,`name`],er=e=>O.custom(t=>typeof t==`object`&&!!t&&typeof Reflect.get(t,e)==`function`),tr=er(`get_distinct_id`),nr=er(`get_session_id`),rr=er(`getUser`),ir=er(`getInternalContext`),ar=O.string(),or=O.record(O.string(),O.unknown()),sr=O.object({session_id:O.string().optional()}),cr=(e,t)=>{if(typeof window>`u`)return;let n=t.safeParse(Reflect.get(window,e));return n.success?n.data:void 0},lr=()=>{try{let e=cr(`posthog`,tr);if(!e)return;let t=ar.safeParse(e.get_distinct_id());return t.success?t.data:void 0}catch{return}},ur=()=>{try{let e=cr(`posthog`,nr);if(!e)return;let t=ar.safeParse(e.get_session_id());return t.success?t.data:void 0}catch{return}},dr=()=>{try{let e=cr(`DD_RUM`,rr);if(!e)return;let t=or.safeParse(e.getUser());return!t.success||Object.keys(t.data).length===0?void 0:t.data}catch{return}},fr=()=>{try{let e=cr(`DD_RUM`,ir);if(!e)return;let t=sr.safeParse(e.getInternalContext());return t.success?t.data.session_id:void 0}catch{return}},pr=e=>{let t={...e},n=dr(),r;if(n)try{r=JSON.stringify(n)}catch{r=void 0}let i=[[`posthog_distinct_id`,lr()],[`posthog_session_id`,ur()],[`datadog_rum_user`,r],[`datadog_rum_session_id`,fr()],...$n.map(e=>[`datadog_rum_user_${e}`,Qn(n?.[e])])];for(let[e,n]of i)Object.prototype.hasOwnProperty.call(t,e)||n===void 0||n.trim()===``||(t[e]=n);return t},mr=(e,t=!1)=>t?pr(e):e,hr=x({}),gr=()=>C(hr),_r=x({}),vr=({type:e,children:t})=>{let n=T(()=>({type:e}),[e]);return k(_r.Provider,{value:n,children:t})},yr=()=>C(_r),br=x(null),xr=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},autoInjectAnalyticsMetadata:a=!1,locale:s,apiBaseUrl:c})=>{let{type:l}=yr(),u=gr(),d=u.version??`0.9.0`,f=u.build,p=o({publishableKey:n,apiBaseUrl:c}),m=E(void 0),[h,g]=D(),_=h?.client===p&&h.surveyId===t?h.data:void 0;w(()=>{let e=new AbortController;return(async()=>{try{let n=`api/v1/cfti/${t}${s?`?locale=${s}`:``}`,r=await p.get(n,{signal:e.signal}).json(),i=me.safeParse(r);if(!i.success||e.signal.aborted)return;g({client:p,surveyId:t,data:i.data})}catch{}})(),()=>e.abort()},[p,s,t]);let v=S(async({answers:e})=>{let n=crypto.randomUUID(),o=ge({metadata:mr(i,a)}),s=await p.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:o.metadata,warnings:o.warnings,telemetry:{...l!==void 0&&{type:l},version:d,...f&&{build:f}}}}).json();return he.parse({...s,createdAt:new Date(s.createdAt)})},[a,f,p,i,r,t,d,l]),y=S(()=>{p.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[p,r,t]);return w(()=>{let e=m.current;e?.client===p&&e.surveyId===t&&e.respondent===r||_&&r&&(m.current={client:p,surveyId:t,respondent:r},p.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[p,r,_,t]),_?k(br.Provider,{value:{submit:v,dismiss:y,surveyId:t,survey:_,metadata:i},children:e}):null},Sr=e=>C(br)?k(Ce,{children:e.children}):k(xr,{...e}),Cr=()=>{let e=C(br);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},wr={en:{skip:`Skip`,next:`Next`,back:`Back`,submit:`Submit`,submitAnotherResponse:`Submit another response`,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:`提交`,submitAnotherResponse:`提交另一份回复`,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`,submitAnotherResponse:`Hantar respons lain`,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:`சமர்ப்பிக்கவும்`,submitAnotherResponse:`மற்றொரு பதிலைச் சமர்ப்பிக்கவும்`,other:`மற்றவை`,dismiss:`மூடு`,close:`மூடு`,optional:`(கட்டாயமில்லை)`,startTyping:`தட்டச்சு செய்யத் தொடங்கவும்...`,feedbackSubmitted:`கருத்து சமர்ப்பிக்கப்பட்டது!`,surveyDialog:`கருத்துக்கணிப்பு`,unsupportedQuestionType:`ஆதரிக்கப்படாத கேள்வி வகை`,bugReportTitlePlaceholder:`சிக்கலின் சுருக்கமான விளக்கம்`,bugReportDetailsPlaceholder:`சிக்கல் எப்படி ஏற்பட்டது, நீங்கள் என்ன எதிர்பார்த்தீர்கள், மேலும் என்ன நடந்தது என்பதை விவரிக்கவும்`,attachments:`இணைப்புகள்`,capturing:`ஸ்கிரீன்ஷாட் எடுக்கப்படுகிறது...`,screenshot:`ஸ்கிரீன்ஷாட்`,screenshotPreview:`ஸ்கிரீன்ஷாட் முன்னோட்டம்`,removeScreenshot:`ஸ்கிரீன்ஷாட்டை அகற்று`,loadingRecordingPreview:`பதிவு முன்னோட்டம் தயாராகிறது...`,removeRecording:`பதிவை அகற்று`,record:`பதிவுசெய்`,captureError:`ஸ்கிரீன்ஷாட் எடுக்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,recordingError:`பதிவைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`}},Q=(e=`en`)=>wr[e],Tr=(e,t,n)=>e===wr.en[t]?Q(n)[t]:e,$=(e,t,n)=>!e||e===wr.en[t]?Q(n)[t]:e,Er=(e,t)=>Tr(e,`other`,t),Dr=(e,t)=>$(e,`close`,t),Or=(e,t)=>$(e,`feedbackSubmitted`,t),kr=(e,t)=>$(e,`bugReportTitlePlaceholder`,t),Ar=(e,t)=>$(e,`bugReportDetailsPlaceholder`,t),jr=()=>{let[e,t]=D(!1);return w(()=>{let e=e=>{let n=_e.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(ve,e),()=>{document.removeEventListener(ve,e)}},[]),e},Mr=({className:e,iconClassName:t,onClose:n,locale:r})=>jr()?null:k(`button`,{type:`button`,className:e,"aria-label":Q(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}=Cr(),[f,p]=D(!1);return Se(()=>{l&&i?.()},f?a:null),we(Rn,{"aria-label":Q(c).surveyDialog,id:`${u}-popover`,className:A(`confetti-modal-dialog ${ye}`,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}=Cr(),[c,l]=D(!1);return k(Un,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(c||(await s(),n?.()),r?.())},className:A(`confetti-modal-overlay ${ye}`,t?.overlay),children:k(Vn,{className:A(`confetti-modal ${ye}`,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{De as S,At as _,Q as a,Me as b,Dr as c,br as d,Sr as f,It as g,Zn as h,jr as i,Or as l,vr as m,Nr as n,Ar as o,Cr as p,Mr as r,kr as s,Pr as t,Er as u,G as v,ke as x,Qe as y};
@@ -1,2 +1,2 @@
1
- import { r as ModalContent } from "./ModalContainer-QddeK25W.js";
1
+ import { r as ModalContent } from "./ModalContainer-BoP8D8gv.js";
2
2
  export { ModalContent as UnstableModalContent };
@@ -1 +1 @@
1
- import{n as e}from"./ModalContainer-fwJ97Uo-.js";export{e as UnstableModalContent};
1
+ import{n as e}from"./ModalContainer-CftztDnr.js";export{e as UnstableModalContent};
@@ -1,6 +1,6 @@
1
- import { c as MultiSelectQuestionProperties, d as StatementQuestionProperties, f as TextQuestionProperties, l as RatingQuestionProperties, n as Locale, u as SingleSelectQuestionProperties } from "./index-DODfg3Bc.js";
2
- import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-QddeK25W.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-CWPpRhr1.js";
1
+ import { d as SingleSelectQuestionProperties, f as StatementQuestionProperties, l as MultiSelectQuestionProperties, p as TextQuestionProperties, r as Locale, u as RatingQuestionProperties } from "./index-BgEIWUUt.js";
2
+ import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-BoP8D8gv.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-B1RcqeaN.js";
4
4
  import { HTMLAttributes, JSX, PropsWithChildren, SVGProps } from "react";
5
5
 
6
6
  //#region src/components/container/PopoverContainer.d.ts
@@ -1 +1 @@
1
- import{n as e,t}from"./DefaultConfettiTrigger-9WLnJcVv.js";import{d as n,f as r,p as i,r as a,t as o}from"./ModalContainer-fwJ97Uo-.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-p80c52cK.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};
1
+ import{n as e,t}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{d as n,f as r,p as i,r as a,t as o}from"./ModalContainer-CftztDnr.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-DP5SVLPA.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};
@@ -263,4 +263,37 @@ declare const publicGetSurveyOutputSchema: z.ZodObject<{
263
263
  }, z.core.$strip>;
264
264
  type PublicGetSurveyOutput = z.infer<typeof publicGetSurveyOutputSchema>;
265
265
  //#endregion
266
- export { MultiSelectAnswer as a, MultiSelectQuestionProperties as c, StatementQuestionProperties as d, TextQuestionProperties as f, BugReportAnswer as i, RatingQuestionProperties as l, Locale as n, RatingAnswer as o, BinaryOperatorCondition as p, RoutableAnswer as r, SingleSelectAnswer as s, PublicGetSurveyOutput as t, SingleSelectQuestionProperties as u };
266
+ //#region ../validators/dist/response.d.ts
267
+ declare const responseWarningsSchema: z.ZodObject<{
268
+ metadata: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
269
+ code: z.ZodLiteral<"metadata_value_truncated">;
270
+ key: z.ZodString;
271
+ }, z.core.$strict>, z.ZodObject<{
272
+ code: z.ZodLiteral<"metadata_value_invalid">;
273
+ key: z.ZodString;
274
+ }, z.core.$strict>, z.ZodObject<{
275
+ code: z.ZodLiteral<"metadata_key_invalid">;
276
+ position: z.ZodNumber;
277
+ }, z.core.$strict>, z.ZodObject<{
278
+ code: z.ZodLiteral<"metadata_key_duplicate">;
279
+ key: z.ZodString;
280
+ }, z.core.$strict>, z.ZodObject<{
281
+ code: z.ZodLiteral<"metadata_entry_limit">;
282
+ droppedCount: z.ZodNumber;
283
+ }, z.core.$strict>, z.ZodObject<{
284
+ code: z.ZodLiteral<"metadata_container_invalid">;
285
+ }, z.core.$strict>, z.ZodObject<{
286
+ code: z.ZodLiteral<"metadata_warning_details_omitted">;
287
+ count: z.ZodNumber;
288
+ }, z.core.$strict>, z.ZodObject<{
289
+ code: z.ZodLiteral<"metadata_warning_report_invalid">;
290
+ }, z.core.$strict>], "code">>;
291
+ }, z.core.$strict>;
292
+ type ResponseWarnings = z.infer<typeof responseWarningsSchema>;
293
+ interface PublicPutResponseOutput {
294
+ id: string;
295
+ createdAt: Date;
296
+ warnings?: ResponseWarnings;
297
+ }
298
+ //#endregion
299
+ export { BugReportAnswer as a, SingleSelectAnswer as c, SingleSelectQuestionProperties as d, StatementQuestionProperties as f, RoutableAnswer as i, MultiSelectQuestionProperties as l, BinaryOperatorCondition as m, PublicGetSurveyOutput as n, MultiSelectAnswer as o, TextQuestionProperties as p, Locale as r, RatingAnswer as s, PublicPutResponseOutput as t, RatingQuestionProperties as u };
package/build/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as Locale } from "./index-DODfg3Bc.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-CWPpRhr1.js";
1
+ import { r as Locale } from "./index-BgEIWUUt.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-B1RcqeaN.js";
3
3
 
4
4
  //#region src/contracts/api.d.ts
5
5
  type Template = 'TriggerPopover' | 'Popover' | 'Modal' | 'Embedded' | 'Stepper';
package/build/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,o as n,r,s as i,t as a}from"./DefaultConfettiTrigger-9WLnJcVv.js";import{G as o}from"./Button-LiaNjkvk.js";import{i as s}from"./src-Cg5yexLG.js";import{useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{ErrorBoundary as p}from"react-error-boundary";import{useLocalStorage as m,useSessionStorage as h}from"usehooks-ts";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`confetti:ready`,b=`https://confetti.gov.sg`,x={promise:null,channel:null,url:null};function S(){x.promise=null,x.channel=null,x.url=null}function C(){x.promise=null}function w(e){return new URL(``,e).href}function T(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function E(e=`stable`,t=b){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(x.promise)return x.channel===e?x.url===n?x.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(x.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(x.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?x.url!==null&&x.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${x.url} to ${n} on the same page`)):j(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=O(n,e);return x.channel=e,x.url=n,x.promise=i,i}function D(e=`stable`,t=b){if(typeof window>`u`)return Promise.resolve();let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return k(n,e)}async function O(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([k(e,t),A(e,t)])]);return clearTimeout(r),C(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),S(),e}}function k(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=T(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 A(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}j(e).then(n,r)};if(window.addEventListener(y,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=T(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(y,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 j(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 M(e){let t=d(null),n=d(null),r=d(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,l(()=>{if(!e.element)return;let o=!1;return E(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]),l(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function N(e){let[t,n]=f(null);return M({...e,element:t}),_(p,{fallback:_(g,{}),children:_(`div`,{ref:n,"data-confetti-mount":!0})})}function P(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.2`},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=_(N,{template:`Embedded`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function F(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.2`},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?_(p,{fallback:_(g,{}),children:_(N,{template:`Modal`,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:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.2`},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?_(p,{fallback:_(g,{}),children:_(N,{template:`Popover`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function L(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.8.2`},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=_(N,{template:`Stepper`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function R(s){let m=e({surveyId:s.surveyId,override:s.respondent}),h=o({publishableKey:s.publishableKey,apiBaseUrl:s.proxyUrl}),{isAvailable:y,isSettled:b}=r({client:h,surveyId:s.surveyId}),{state:x,isSettled:S}=t({client:h,surveyId:s.surveyId,respondent:m,enabled:i(s.isSurveyVisible)}),[C,w]=f(!1),T=b&&y&&S&&C&&n(x,s.isSurveyVisible),[E,O]=f(!1),[k,A]=f(!1),{onError:j,channel:M,proxyUrl:P}=s,F=d(j);l(()=>{F.current=j},[j]),l(()=>{if(!(b&&y))return;let e=!1;return D(M,P).then(()=>{e||w(!0)}).catch(e=>F.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[b,y,M,P]);let I=T&&E,L=c(()=>O(!0),[]),R=s.onFinished,z=u(()=>({surveyId:s.surveyId,publishableKey:s.publishableKey,respondent:m,locale:s.locale,metadata:s.metadata,autoInjectAnalyticsMetadata:s.autoInjectAnalyticsMetadata,apiBaseUrl:s.proxyUrl,telemetry:{version:`0.8.2`},isOpen:E,onFinished:()=>{A(!0),R?.()},onClose:()=>{O(!1)},onDismiss:()=>{O(!1)},options:s.options}),[s.surveyId,s.publishableKey,m,s.locale,s.metadata,s.autoInjectAnalyticsMetadata,s.proxyUrl,s.options,E,R]);return T?v(p,{fallback:_(g,{}),children:[s.trigger?s.trigger({onClick:L,isOpen:E,isSubmitted:k}):_(a,{onClick:L,isWidgetOpen:E}),I?_(N,{template:`TriggerPopover`,channel:s.channel,scriptBaseUrl:s.proxyUrl,onError:s.onError,props:z}):null]}):null}function z(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function B(e){return e.split(`,`).map(e=>{let[t,...n]=e.split(`;`),r=n.map(e=>e.trim()).find(e=>e.startsWith(`q=`)),i=r?Number(r.slice(2)):1;return{tag:z(t??``),quality:i}}).filter(({quality:e})=>e>0).sort((e,t)=>t.quality-e.quality)}function V(e,t){for(let{tag:n}of B(e)){let e=t.find(e=>e===n);if(e)return e}}function H({preferred:e,explicit:t,available:n=s,base:r=`en`}={}){let i=t??e;return(i?V(i,n):void 0)??r}function U(){if(!(typeof navigator>`u`))return navigator.languages.length>0?navigator.languages.join(`,`):navigator.language}const W=({preferred:e,explicit:t}={})=>H({preferred:e??U(),explicit:t,available:s,base:`en`});function G({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 K=({delay:e})=>{let[t,n]=f(!1),r=u(()=>e,[]);return l(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},q=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},J=({visits:e,respondent:t})=>{let[n,r]=h(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},Y=({threshold:e})=>{let[t,n]=f(()=>typeof window>`u`?!1:window.scrollY>=e);return l(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{P as EmbeddedConfetti,F as ModalConfetti,I as PopoverConfetti,L as StepperConfetti,R as TriggerPopoverConfetti,W as useResolveLocale,G as useRespondentState,K as useVisibleAfterDelay,q as useVisibleAfterPageVisits,Y as useVisibleAfterScroll,J as useVisibleAfterSessionPageVisits};
1
+ import{a as e,i as t,o as n,r,s as i,t as a}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{G as o}from"./Button-LiaNjkvk.js";import{a as s}from"./src-D7lX72kz.js";import{useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{ErrorBoundary as p}from"react-error-boundary";import{useLocalStorage as m,useSessionStorage as h}from"usehooks-ts";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`confetti:ready`,b=`https://confetti.gov.sg`,x={promise:null,channel:null,url:null};function S(){x.promise=null,x.channel=null,x.url=null}function C(){x.promise=null}function w(e){return new URL(``,e).href}function T(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function E(e=`stable`,t=b){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(x.promise)return x.channel===e?x.url===n?x.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(x.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(x.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?x.url!==null&&x.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${x.url} to ${n} on the same page`)):j(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=O(n,e);return x.channel=e,x.url=n,x.promise=i,i}function D(e=`stable`,t=b){if(typeof window>`u`)return Promise.resolve();let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return k(n,e)}async function O(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([k(e,t),A(e,t)])]);return clearTimeout(r),C(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),S(),e}}function k(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=T(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 A(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}j(e).then(n,r)};if(window.addEventListener(y,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=T(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(y,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 j(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 M(e){let t=d(null),n=d(null),r=d(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,l(()=>{if(!e.element)return;let o=!1;return E(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]),l(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function N(e){let[t,n]=f(null);return M({...e,element:t}),_(p,{fallback:_(g,{}),children:_(`div`,{ref:n,"data-confetti-mount":!0})})}function P(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.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=_(N,{template:`Embedded`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function F(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.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?_(p,{fallback:_(g,{}),children:_(N,{template:`Modal`,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:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.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?_(p,{fallback:_(g,{}),children:_(N,{template:`Popover`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function L(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.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=_(N,{template:`Stepper`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function R(s){let m=e({surveyId:s.surveyId,override:s.respondent}),h=o({publishableKey:s.publishableKey,apiBaseUrl:s.proxyUrl}),{isAvailable:y,isSettled:b}=r({client:h,surveyId:s.surveyId}),{state:x,isSettled:S}=t({client:h,surveyId:s.surveyId,respondent:m,enabled:i(s.isSurveyVisible)}),[C,w]=f(!1),T=b&&y&&S&&C&&n(x,s.isSurveyVisible),[E,O]=f(!1),[k,A]=f(!1),{onError:j,channel:M,proxyUrl:P}=s,F=d(j);l(()=>{F.current=j},[j]),l(()=>{if(!(b&&y))return;let e=!1;return D(M,P).then(()=>{e||w(!0)}).catch(e=>F.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[b,y,M,P]);let I=T&&E,L=c(()=>O(!0),[]),R=s.onFinished,z=u(()=>({surveyId:s.surveyId,publishableKey:s.publishableKey,respondent:m,locale:s.locale,metadata:s.metadata,autoInjectAnalyticsMetadata:s.autoInjectAnalyticsMetadata,apiBaseUrl:s.proxyUrl,telemetry:{version:`0.9.0`},isOpen:E,onFinished:e=>{A(!0),R?.(e)},onClose:()=>{O(!1)},onDismiss:()=>{O(!1)},options:s.options}),[s.surveyId,s.publishableKey,m,s.locale,s.metadata,s.autoInjectAnalyticsMetadata,s.proxyUrl,s.options,E,R]);return T?v(p,{fallback:_(g,{}),children:[s.trigger?s.trigger({onClick:L,isOpen:E,isSubmitted:k}):_(a,{onClick:L,isWidgetOpen:E}),I?_(N,{template:`TriggerPopover`,channel:s.channel,scriptBaseUrl:s.proxyUrl,onError:s.onError,props:z}):null]}):null}function z(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function B(e){return e.split(`,`).map(e=>{let[t,...n]=e.split(`;`),r=n.map(e=>e.trim()).find(e=>e.startsWith(`q=`)),i=r?Number(r.slice(2)):1;return{tag:z(t??``),quality:i}}).filter(({quality:e})=>e>0).sort((e,t)=>t.quality-e.quality)}function V(e,t){for(let{tag:n}of B(e)){let e=t.find(e=>e===n);if(e)return e}}function H({preferred:e,explicit:t,available:n=s,base:r=`en`}={}){let i=t??e;return(i?V(i,n):void 0)??r}function U(){if(!(typeof navigator>`u`))return navigator.languages.length>0?navigator.languages.join(`,`):navigator.language}const W=({preferred:e,explicit:t}={})=>H({preferred:e??U(),explicit:t,available:s,base:`en`});function G({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 K=({delay:e})=>{let[t,n]=f(!1),r=u(()=>e,[]);return l(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},q=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},J=({visits:e,respondent:t})=>{let[n,r]=h(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},Y=({threshold:e})=>{let[t,n]=f(()=>typeof window>`u`?!1:window.scrollY>=e);return l(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{P as EmbeddedConfetti,F as ModalConfetti,I as PopoverConfetti,L as StepperConfetti,R as TriggerPopoverConfetti,W as useResolveLocale,G as useRespondentState,K as useVisibleAfterDelay,q as useVisibleAfterPageVisits,Y as useVisibleAfterScroll,J as useVisibleAfterSessionPageVisits};
@@ -1 +1 @@
1
- import"./src-Cg5yexLG.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-D7lX72kz.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 { p as BinaryOperatorCondition, r as RoutableAnswer } from "./index-DODfg3Bc.js";
1
+ import { i as RoutableAnswer, m as BinaryOperatorCondition } from "./index-BgEIWUUt.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-CayVHvqI.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-C8EZCPMe.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]),a=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`})])}),o=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:a,target:i}),s=e.object({type:e.literal(`switch`),cases:e.array(o),default:i}),c=e.object({type:e.literal(`always`),target:i}),ee=e.discriminatedUnion(`type`,[c,s]),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))),te=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),label:e.optional(e.string()),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),d=e.array(te).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)}})),f=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()))})),p=e.optional(e.boolean()),ne=e.object({type:e.literal(`rating`),buttonLabel:u,shouldAutoProgress:p,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`]))}),re=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u,max:e.number()}),ie=e.object({type:e.literal(`single-select`),shouldAutoProgress:p,options:d,buttonLabel:u,editable:f}),ae=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:d,editable:f,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),oe=e.object({type:e.literal(`statement`),buttonLabel:u,buttonUrl:e.optional(l)}),se=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()))}),ce=e.discriminatedUnion(`type`,[ne,ie,re,ae,oe,se]),m=e=>e.trim()===``?void 0:e,h=e.string().transform(m).optional(),g=e.string().check(e.maxLength(50)).transform(m).optional(),le=e.string().check(e.maxLength(128)).transform(m).optional(),_=e.object({label:h,description:h}),v=e.optional(e.object({label:h,description:h})),y=e.object({type:e.literal(`rating`),buttonLabel:g,labels:e.optional(e.object({lower:h,upper:h}))}),ue=e.object({type:e.literal(`open-ended`),placeholder:h,buttonLabel:g}),de=e.object({type:e.literal(`single-select`),buttonLabel:g,options:e.optional(e.record(e.string(),_)),editable:v}),fe=e.object({type:e.literal(`multi-select`),buttonLabel:g,options:e.optional(e.record(e.string(),_)),editable:v}),pe=e.object({type:e.literal(`statement`),buttonLabel:g}),me=e.object({type:e.literal(`bug-report`),placeholder:h,buttonLabel:g,detailsLabel:le,detailsPlaceholder:h}),he=e.discriminatedUnion(`type`,[y,ue,de,fe,pe,me]),b=`__CONFETTI_CHECKBOX_Others`,x=`__CONFETTI_RADIO_Others`,ge=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 S=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(S);const C=e.array(S),w=e.string().check(e.refine(e=>{try{return C.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),T=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),E=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(T),recordingEventsJson:e.optional(w),metadata:ge});E(!0);const D=E(!1),O=(e,{required:t})=>E(t),k=e=>{if(!e)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0}catch{return!1}},A=e=>!e.title.trim()&&!e.description?.trim()&&!e.screenshotDataUrl&&!k(e.recordingEventsJson),j=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),M=({scale:t},{required:n})=>{let r=j(t);return n?r:e.optional(r)},N=({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`})),P=(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!==x,{error:`Please fill out the free text field`})),F=({maxLength:t},{required:n})=>{let r=P(t,n);return n?r:e.optional(r)},I=({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!==b,{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`})),L=()=>e.optional(e.string()),R=[`en`,`zh`,`ms`,`ta`],z=e.enum(R),B=e.cuid2(),_e=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),V=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:ce,routingLogic:ee}),H=e.object({title:h,description:h,backButtonLabel:g,confirmation:e.optional(e.object({title:h,description:h,buttonText:h}))});e.partialRecord(z,H);const ve=e.object({title:h,description:h,properties:e.optional(he)});e.partialRecord(z,ve);const ye=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(V),confirmation:_e,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({locale:e.optional(z)}),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 U=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(U),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:B});const be=V;e.object({data:e.object({...U.shape,questions:e.array(be)})}),e.object({surveyId:B,responseId:e.union([e.cuid2(),e.uuid()])});const xe=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(),{}),W=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)),D])),G=1e3,K=e.string().check(e.trim(),e.maxLength(G)),Se=e.record(K,K),q=e.string().trim().min(1).max(G),J=e.discriminatedUnion(`code`,[e.object({code:e.literal(`metadata_value_truncated`),key:q}).strict(),e.object({code:e.literal(`metadata_value_invalid`),key:q}).strict(),e.object({code:e.literal(`metadata_key_invalid`),position:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_key_duplicate`),key:q}).strict(),e.object({code:e.literal(`metadata_entry_limit`),droppedCount:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_container_invalid`)}).strict(),e.object({code:e.literal(`metadata_warning_details_omitted`),count:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_warning_report_invalid`)}).strict()]),Ce=e.object({metadata:e.array(J).min(1).max(20)}).strict(),we=e.object({metadata:e.array(J).min(1)}).strict(),Y=(e,t)=>Math.min(2**53-1,e+t),X=e=>{let t=[],n=0;for(let r of e)r.code===`metadata_warning_details_omitted`?n=Y(n,r.count):t.push(r);let r=n>0||t.length>20?19:20,i=t.slice(0,r);return n=Y(n,t.length-i.length),n>0?[...i,{code:`metadata_warning_details_omitted`,count:n}]:i},Te=e=>{let t=X(e);return t.length>0?{metadata:t}:void 0},Ee=e=>{if(e===void 0)return[];let t=we.safeParse(e);return t.success?X(t.data.metadata):[{code:`metadata_warning_report_invalid`}]},De=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Reflect.getPrototypeOf(e);return t===Object.prototype||t===null},Oe=e=>{if(e===void 0)return{metadata:{},warnings:[]};if(!De(e))return{metadata:{},warnings:[{code:`metadata_container_invalid`}]};let t=new Map,n=[],r=0;for(let[i,[a,o]]of Object.entries(e).entries()){let e=a.trim();if(e.length===0||e.length>1e3){n.push({code:`metadata_key_invalid`,position:i+1});continue}if(typeof o!=`string`){n.push({code:`metadata_value_invalid`,key:e});continue}if(t.has(e)){n.push({code:`metadata_key_duplicate`,key:e});continue}if(t.size>=20){r+=1;continue}let s=o.trim(),c=s.length>1e3?`${s.slice(0,G-11)}[truncated]`:s;c!==s&&n.push({code:`metadata_value_truncated`,key:e}),t.set(e,c)}return r>0&&n.push({code:`metadata_entry_limit`,droppedCount:r}),{metadata:Object.fromEntries(t),warnings:X(n)}},Z=({metadata:e,warnings:t})=>{let n=Oe(e);return{metadata:n.metadata,warnings:Te([...n.warnings,...Ee(t)])}};Se.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:W,metadata:e.unknown().optional(),warnings:e.unknown().optional(),telemetry:e.optional(xe)}).transform(e=>{let{metadata:t,warnings:n,...r}=e,{metadata:i,warnings:a}=Z({metadata:t,warnings:n});return{...r,metadata:i,...a&&{warnings:a}}});const ke=e.object({id:e.string(),createdAt:e.date(),warnings:e.optional(Ce)});e.object({surveyId:B,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:B,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:B});const Ae=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:B}),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 je=e.object({id:e.string(),respondent:e.string(),data:W,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(je),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{R as a,I as c,F as d,L as f,l as h,ye as i,N as l,x as m,ke as n,O as o,b as p,Z as r,A as s,Ae as t,M as u};
package/build/static.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as Locale } from "./index-DODfg3Bc.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-CWPpRhr1.js";
1
+ import { r as Locale, t as PublicPutResponseOutput } from "./index-BgEIWUUt.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-B1RcqeaN.js";
3
3
 
4
4
  //#region src/templates/EmbeddedConfettiContent.d.ts
5
5
  interface EmbeddedConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
@@ -77,7 +77,7 @@ interface TriggerChildProps extends Pick<ConfettiTriggerProps, 'surveyId' | 'pub
77
77
  * Invoked when the user completes the survey. Marks the trigger button as
78
78
  * submitted, then calls the trigger-level `onFinished`.
79
79
  */
80
- onFinished: () => void;
80
+ onFinished: (result?: PublicPutResponseOutput) => void;
81
81
  /**
82
82
  * Invoked on every close path: the close button, the close-on-finish timer,
83
83
  * and the Thank-You button. Collapses the popover back to the trigger
package/build/static.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./DefaultConfettiTrigger-9WLnJcVv.js";import{f as t,m as n,t as r}from"./ModalContainer-fwJ97Uo-.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-p80c52cK.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,locale:r,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,locale:d,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,locale:f,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,locale:n,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};
1
+ import{t as e}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{f as t,m as n,t as r}from"./ModalContainer-CftztDnr.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-DP5SVLPA.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,locale:r,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,locale:d,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:e=>{t(),c?.(e)},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,locale:f,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:e=>{t(),c?.(e)},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,locale:n,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:e=>{s(!0),n?.(e)},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.8.2",
3
+ "version": "0.9.0",
4
4
  "sideEffects": false,
5
5
  "description": "Widgets for Confetti",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -93,9 +93,9 @@
93
93
  "react-aria-components": "1.16.0",
94
94
  "tsdown": "0.22.1",
95
95
  "typescript": "^7.0.2",
96
- "@confetti/tsconfig": "0.0.0",
96
+ "@confetti/common": "0.0.0",
97
97
  "@confetti/validators": "0.0.0",
98
- "@confetti/common": "0.0.0"
98
+ "@confetti/tsconfig": "0.0.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build:css": "postcss ./src/confetti.css -o ./build/confetti.css",
@@ -1 +0,0 @@
1
- import{a as e,i as t,o as n,r,s as i}from"./DefaultConfettiTrigger-9WLnJcVv.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,l as re,m as ie,o as ae,p as oe,s as se,u as ce}from"./src-Cg5yexLG.js";import{a as le,n as ue,o as de,r as fe,t as pe}from"./internals-CayVHvqI.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-fwJ97Uo-.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`&&ae(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)=>re({scale:e},t),"open-ended":({max:e},t)=>ee({maxLength:e},t),"single-select":({editable:e},t)=>ce({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>se({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>te(),"bug-report":(e,t)=>M({},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(ne),e}),[v,y]=H(()=>h!==void 0&&u?h:``),b=V(null),x=V(null),S=B(()=>{let e=g.indexOf(ne);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.label??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?oe: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.label??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=ie.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,5 +0,0 @@
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-Cg5yexLG.js";import{i as ge,r as _e,t as ve}from"./internals-CayVHvqI.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
- * {
3
- overscroll-behavior: contain;
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)}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,locale:s,apiBaseUrl:c})=>{let{type:l}=vr(),u=hr(),d=u.version??`0.8.2`,f=u.build,p=o({publishableKey:n,apiBaseUrl:c}),m=E(void 0),[h,g]=D(),_=h?.client===p&&h.surveyId===t?h.data:void 0;w(()=>{let e=new AbortController;return(async()=>{try{let n=`api/v1/cfti/${t}${s?`?locale=${s}`:``}`,r=await p.get(n,{signal:e.signal}).json(),i=he.safeParse(r);if(!i.success||e.signal.aborted)return;g({client:p,surveyId:t,data:i.data})}catch{}})(),()=>e.abort()},[p,s,t]);let v=S(async({answers:e})=>{let n=crypto.randomUUID(),o=pr(i,a);await p.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:o,telemetry:{...l!==void 0&&{type:l},version:d,...f&&{build:f}}}})},[a,f,p,i,r,t,d,l]),y=S(()=>{p.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[p,r,t]);return w(()=>{let e=m.current;e?.client===p&&e.surveyId===t&&e.respondent===r||_&&r&&(m.current={client:p,surveyId:t,respondent:r},p.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[p,r,_,t]),_?k(yr.Provider,{value:{submit:v,dismiss:y,surveyId:t,survey:_,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`,submitAnotherResponse:`Submit another response`,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:`提交`,submitAnotherResponse:`提交另一份回复`,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`,submitAnotherResponse:`Hantar respons lain`,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:`சமர்ப்பிக்கவும்`,submitAnotherResponse:`மற்றொரு பதிலைச் சமர்ப்பிக்கவும்`,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 +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`})])}),te=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}),ne=e.object({type:e.literal(`switch`),cases:e.array(te),default:i}),re=e.object({type:e.literal(`always`),target:i}),a=e.discriminatedUnion(`type`,[re,ne]),o=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),s=e.optional(e.string().check(e.trim(),e.maxLength(50))),ie=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),label:e.optional(e.string()),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),c=e.array(ie).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)}})),l=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()))})),u=e.optional(e.boolean()),d=e.object({type:e.literal(`rating`),buttonLabel:s,shouldAutoProgress:u,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`]))}),ae=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:s,max:e.number()}),oe=e.object({type:e.literal(`single-select`),shouldAutoProgress:u,options:c,buttonLabel:s,editable:l}),f=e.object({type:e.literal(`multi-select`),buttonLabel:s,options:c,editable:l,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),p=e.object({type:e.literal(`statement`),buttonLabel:s,buttonUrl:e.optional(o)}),m=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:s,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()))}),se=e.discriminatedUnion(`type`,[d,oe,ae,f,p,m]),h=e=>e.trim()===``?void 0:e,g=e.string().transform(h).optional(),_=e.string().check(e.maxLength(50)).transform(h).optional(),ce=e.string().check(e.maxLength(128)).transform(h).optional(),v=e.object({label:g,description:g}),y=e.optional(e.object({label:g,description:g})),le=e.object({type:e.literal(`rating`),buttonLabel:_,labels:e.optional(e.object({lower:g,upper:g}))}),b=e.object({type:e.literal(`open-ended`),placeholder:g,buttonLabel:_}),x=e.object({type:e.literal(`single-select`),buttonLabel:_,options:e.optional(e.record(e.string(),v)),editable:y}),S=e.object({type:e.literal(`multi-select`),buttonLabel:_,options:e.optional(e.record(e.string(),v)),editable:y}),C=e.object({type:e.literal(`statement`),buttonLabel:_}),w=e.object({type:e.literal(`bug-report`),placeholder:g,buttonLabel:_,detailsLabel:ce,detailsPlaceholder:g}),T=e.discriminatedUnion(`type`,[le,b,x,S,C,w]),E=`__CONFETTI_CHECKBOX_Others`,D=`__CONFETTI_RADIO_Others`,O=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 k=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(k);const A=e.array(k),j=e.string().check(e.refine(e=>{try{return A.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),M=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),N=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(M),recordingEventsJson:e.optional(j),metadata:O});N(!0);const P=N(!1),F=(e,{required:t})=>N(t),I=e=>{if(!e)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0}catch{return!1}},L=e=>!e.title.trim()&&!e.description?.trim()&&!e.screenshotDataUrl&&!I(e.recordingEventsJson),R=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),ue=({scale:t},{required:n})=>{let r=R(t);return n?r:e.optional(r)},z=({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`})),B=(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!==D,{error:`Please fill out the free text field`})),V=({maxLength:t},{required:n})=>{let r=B(t,n);return n?r:e.optional(r)},H=({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!==E,{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`})),U=()=>e.optional(e.string()),W=[`en`,`zh`,`ms`,`ta`],G=e.enum(W),K=e.cuid2(),de=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),q=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:se,routingLogic:a}),fe=e.object({title:g,description:g,backButtonLabel:_,confirmation:e.optional(e.object({title:g,description:g,buttonText:g}))});e.partialRecord(G,fe);const pe=e.object({title:g,description:g,properties:e.optional(T)});e.partialRecord(G,pe);const me=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(q),confirmation:de,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({locale:e.optional(G)}),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:K});const Y=q;e.object({data:e.object({...J.shape,questions:e.array(Y)})}),e.object({surveyId:K,responseId:e.union([e.cuid2(),e.uuid()])});const he=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(),{}),X=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)),P])),Z=e.string().check(e.trim(),e.maxLength(1e3)),ge=e.record(Z,Z).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:X,metadata:ge,telemetry:e.optional(he)}),e.object({id:e.string(),createdAt:e.date()}),e.object({surveyId:K,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:K,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:K});const _e=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:K}),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 ve=e.object({id:e.string(),respondent:e.string(),data:X,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(ve),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{F as a,z as c,U as d,E as f,W as i,ue as l,o as m,Z as n,L as o,D as p,me as r,H as s,_e as t,V as u};