@opengovsg/confetti 0.3.2 → 0.3.3
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/build/{ModalContainer-D7lgJ6Vl.d.ts → ModalContainer-BT1Bys9H.d.ts} +2 -4
- package/build/ModalContainer-DiVIAVi2.js +11 -0
- package/build/{RecordingReplayer-CKYzAfYD.js → RecordingReplayer-BvU_CHwb.js} +8 -8
- package/build/client-internals.d.ts +1 -1
- package/build/client-internals.js +1 -1
- package/build/index.d.ts +34 -30
- package/build/index.js +1 -1
- package/build/internals.d.ts +1 -2
- package/build/internals.js +1 -1
- package/build/{record-CeeyzJpB.js → record-BZwNFiEW.js} +16 -16
- package/build/{snapdom-VnBlM9vL.js → snapdom-BQZEILL6.js} +2 -2
- package/build/{types-JeyKtT3p.d.ts → types-CJY8TUUa.d.ts} +4 -5
- package/package.json +15 -9
- package/build/ModalContainer-b9Zgg8fN.js +0 -11
- /package/build/{internals-Dzl6abGJ.js → internals-B5GhpjgM.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as ModalContent } from "./ModalContainer-
|
|
1
|
+
import { r as ModalContent } from "./ModalContainer-BT1Bys9H.js";
|
|
2
2
|
export { ModalContent as UnstableModalContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./ModalContainer-
|
|
1
|
+
import{n as e}from"./ModalContainer-DiVIAVi2.js";export{e as UnstableModalContent};
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-
|
|
2
|
-
import { a as MultiSelectQuestionProperties, c as StatementQuestionProperties, i as PublicGetSurveyOutput, l as TextQuestionProperties, n as ConfettiState, o as RatingQuestionProperties, r as Question, s as SingleSelectQuestionProperties, t as Answer } from "./types-
|
|
3
|
-
import * as react0 from "react";
|
|
1
|
+
import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-BT1Bys9H.js";
|
|
2
|
+
import { a as MultiSelectQuestionProperties, c as StatementQuestionProperties, i as PublicGetSurveyOutput, l as TextQuestionProperties, n as ConfettiState, o as RatingQuestionProperties, r as Question, s as SingleSelectQuestionProperties, t as Answer } from "./types-CJY8TUUa.js";
|
|
4
3
|
import { HTMLAttributes, PropsWithChildren, SVGProps } from "react";
|
|
5
|
-
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
6
4
|
|
|
7
5
|
//#region src/core/ConfettiController.d.ts
|
|
8
6
|
interface ConfettiControllerProps {
|
|
@@ -20,7 +18,16 @@ declare const ConfettiController: ({
|
|
|
20
18
|
shouldAutoSubmit,
|
|
21
19
|
onFinished,
|
|
22
20
|
children
|
|
23
|
-
}: ConfettiControllerProps) =>
|
|
21
|
+
}: ConfettiControllerProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/contracts/state.d.ts
|
|
24
|
+
interface ConfettiRespondentState {
|
|
25
|
+
lastRespondedAt: Date | null;
|
|
26
|
+
lastDismissedAt: Date | null;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/core/logic/is-visible.d.ts
|
|
30
|
+
type IsSurveyVisible = boolean | ((s: ConfettiRespondentState) => boolean) | undefined;
|
|
24
31
|
//#endregion
|
|
25
32
|
//#region src/core/ConfettiProvider.d.ts
|
|
26
33
|
interface ConfettiContextValue {
|
|
@@ -35,7 +42,7 @@ interface ConfettiContextValue {
|
|
|
35
42
|
survey: PublicGetSurveyOutput | undefined;
|
|
36
43
|
isVisible: boolean;
|
|
37
44
|
}
|
|
38
|
-
declare const ConfettiContext:
|
|
45
|
+
declare const ConfettiContext: import("react").Context<ConfettiContextValue | null>;
|
|
39
46
|
interface ConfettiProviderProps {
|
|
40
47
|
children: React.ReactNode;
|
|
41
48
|
surveyId: string;
|
|
@@ -43,13 +50,10 @@ interface ConfettiProviderProps {
|
|
|
43
50
|
respondent?: string;
|
|
44
51
|
metadata?: Record<string, string>;
|
|
45
52
|
apiBaseUrl?: string;
|
|
46
|
-
isSurveyVisible?:
|
|
47
|
-
lastRespondedAt: Date | null;
|
|
48
|
-
lastDismissedAt: Date | null;
|
|
49
|
-
}) => boolean);
|
|
53
|
+
isSurveyVisible?: IsSurveyVisible;
|
|
50
54
|
alwaysRenderChildren?: boolean;
|
|
51
55
|
}
|
|
52
|
-
declare const ConfettiProvider: (props: ConfettiProviderProps) =>
|
|
56
|
+
declare const ConfettiProvider: (props: ConfettiProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
57
|
declare const useConfetti: () => ConfettiContextValue;
|
|
54
58
|
//#endregion
|
|
55
59
|
//#region src/components/questions/types.d.ts
|
|
@@ -79,7 +83,7 @@ declare const Confetti: ({
|
|
|
79
83
|
onFinished,
|
|
80
84
|
shouldAutoSubmit,
|
|
81
85
|
...props
|
|
82
|
-
}: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) =>
|
|
86
|
+
}: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) => import("react/jsx-runtime").JSX.Element;
|
|
83
87
|
//#endregion
|
|
84
88
|
//#region src/components/ThankYouMessage.d.ts
|
|
85
89
|
interface ThankYouMessageProps {
|
|
@@ -96,7 +100,7 @@ declare const ThankYouMessage: ({
|
|
|
96
100
|
title,
|
|
97
101
|
description,
|
|
98
102
|
classNames
|
|
99
|
-
}: ThankYouMessageProps) =>
|
|
103
|
+
}: ThankYouMessageProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
100
104
|
//#endregion
|
|
101
105
|
//#region src/components/container/PopoverContainer.d.ts
|
|
102
106
|
interface PopoverContainerProps {
|
|
@@ -118,7 +122,7 @@ declare const PopoverContainer: ({
|
|
|
118
122
|
containerProps,
|
|
119
123
|
onDismiss,
|
|
120
124
|
closeOnFinishMs
|
|
121
|
-
}: PopoverContainerProps) =>
|
|
125
|
+
}: PopoverContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
122
126
|
//#endregion
|
|
123
127
|
//#region src/components/questions/factory.d.ts
|
|
124
128
|
interface SurveyQuestionFactoryProps extends BugReportOptions {
|
|
@@ -131,7 +135,7 @@ declare const SurveyQuestionFactory: ({
|
|
|
131
135
|
onChange,
|
|
132
136
|
error,
|
|
133
137
|
maskAllInputs
|
|
134
|
-
}: SurveyQuestionFactoryProps) =>
|
|
138
|
+
}: SurveyQuestionFactoryProps) => import("react/jsx-runtime").JSX.Element;
|
|
135
139
|
//#endregion
|
|
136
140
|
//#region src/components/questions/Rating.d.ts
|
|
137
141
|
interface RatingProps extends BaseFieldProps {
|
|
@@ -165,7 +169,7 @@ declare const Rating: ({
|
|
|
165
169
|
id,
|
|
166
170
|
error,
|
|
167
171
|
required
|
|
168
|
-
}: RatingProps) =>
|
|
172
|
+
}: RatingProps) => import("react/jsx-runtime").JSX.Element;
|
|
169
173
|
//#endregion
|
|
170
174
|
//#region src/components/questions/FreeText.d.ts
|
|
171
175
|
interface FreeTextProps extends BaseFieldProps {
|
|
@@ -189,7 +193,7 @@ declare const FreeText: ({
|
|
|
189
193
|
classNames,
|
|
190
194
|
required,
|
|
191
195
|
error
|
|
192
|
-
}: FreeTextProps) =>
|
|
196
|
+
}: FreeTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
193
197
|
//#endregion
|
|
194
198
|
//#region src/components/questions/SingleChoice.d.ts
|
|
195
199
|
interface SingleChoiceProps extends BaseFieldProps {
|
|
@@ -219,7 +223,7 @@ declare const SingleChoice: ({
|
|
|
219
223
|
id,
|
|
220
224
|
required,
|
|
221
225
|
error
|
|
222
|
-
}: SingleChoiceProps) =>
|
|
226
|
+
}: SingleChoiceProps) => import("react/jsx-runtime").JSX.Element;
|
|
223
227
|
//#endregion
|
|
224
228
|
//#region src/components/questions/MultiChoice.d.ts
|
|
225
229
|
interface MultiChoiceProps extends BaseFieldProps {
|
|
@@ -252,7 +256,7 @@ declare const MultiChoice: ({
|
|
|
252
256
|
id,
|
|
253
257
|
required,
|
|
254
258
|
error
|
|
255
|
-
}: MultiChoiceProps) =>
|
|
259
|
+
}: MultiChoiceProps) => import("react/jsx-runtime").JSX.Element;
|
|
256
260
|
//#endregion
|
|
257
261
|
//#region src/components/questions/Statement.d.ts
|
|
258
262
|
interface StatementProps extends BaseFieldProps {
|
|
@@ -270,7 +274,7 @@ declare const Statement: ({
|
|
|
270
274
|
title,
|
|
271
275
|
description,
|
|
272
276
|
classNames
|
|
273
|
-
}: StatementProps) =>
|
|
277
|
+
}: StatementProps) => import("react/jsx-runtime").JSX.Element;
|
|
274
278
|
//#endregion
|
|
275
279
|
//#region src/components/presentation/Flow.d.ts
|
|
276
280
|
type ChildField = (_: {
|
|
@@ -289,7 +293,7 @@ declare const Flow: ({
|
|
|
289
293
|
children,
|
|
290
294
|
question,
|
|
291
295
|
isLastQuestion
|
|
292
|
-
}: FlowProps) =>
|
|
296
|
+
}: FlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
293
297
|
//#endregion
|
|
294
298
|
//#region src/components/presentation/Embed.d.ts
|
|
295
299
|
declare const Embed: ({
|
|
@@ -299,7 +303,7 @@ declare const Embed: ({
|
|
|
299
303
|
}: PropsWithChildren<{
|
|
300
304
|
isCompleted: boolean;
|
|
301
305
|
onSubmit: () => void;
|
|
302
|
-
}>) =>
|
|
306
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
303
307
|
//#endregion
|
|
304
308
|
//#region src/components/CloseButton.d.ts
|
|
305
309
|
interface CloseButtonProps {
|
|
@@ -311,10 +315,10 @@ declare const CloseButton: ({
|
|
|
311
315
|
className,
|
|
312
316
|
iconClassName,
|
|
313
317
|
onClose
|
|
314
|
-
}: CloseButtonProps) =>
|
|
318
|
+
}: CloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
315
319
|
//#endregion
|
|
316
320
|
//#region src/components/trigger/ConfettiTriggerIcon.d.ts
|
|
317
|
-
declare const ConfettiTriggerIcon: (props: SVGProps<SVGSVGElement>) =>
|
|
321
|
+
declare const ConfettiTriggerIcon: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
318
322
|
//#endregion
|
|
319
323
|
//#region src/components/trigger/DefaultConfettiTrigger.d.ts
|
|
320
324
|
interface DefaultConfettiTriggerProps {
|
|
@@ -333,7 +337,7 @@ declare const DefaultConfettiTrigger: ({
|
|
|
333
337
|
isWidgetOpen,
|
|
334
338
|
classNames,
|
|
335
339
|
label
|
|
336
|
-
}: DefaultConfettiTriggerProps) =>
|
|
340
|
+
}: DefaultConfettiTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
337
341
|
//#endregion
|
|
338
342
|
//#region src/templates/ConfettiTrigger.d.ts
|
|
339
343
|
interface TriggerRenderProps {
|
|
@@ -354,10 +358,10 @@ declare const ConfettiTrigger: ({
|
|
|
354
358
|
trigger,
|
|
355
359
|
children,
|
|
356
360
|
...providerProps
|
|
357
|
-
}: ConfettiTriggerProps) =>
|
|
361
|
+
}: ConfettiTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
358
362
|
//#endregion
|
|
359
363
|
//#region src/templates/EmbeddedConfetti.d.ts
|
|
360
|
-
declare const EmbeddedConfetti: (props: ConfettiProps) =>
|
|
364
|
+
declare const EmbeddedConfetti: (props: ConfettiProps) => import("react/jsx-runtime").JSX.Element;
|
|
361
365
|
//#endregion
|
|
362
366
|
//#region src/templates/ModalConfetti.d.ts
|
|
363
367
|
interface ModalConfettiProps extends ConfettiProps {
|
|
@@ -370,7 +374,7 @@ declare const ModalConfetti: ({
|
|
|
370
374
|
closeOnFinishMs,
|
|
371
375
|
isDismissable,
|
|
372
376
|
...props
|
|
373
|
-
}: ModalConfettiProps) =>
|
|
377
|
+
}: ModalConfettiProps) => import("react/jsx-runtime").JSX.Element;
|
|
374
378
|
//#endregion
|
|
375
379
|
//#region src/templates/PopoverConfetti.d.ts
|
|
376
380
|
interface PopoverConfettiProps extends ConfettiProps {
|
|
@@ -390,10 +394,10 @@ declare const PopoverConfetti: ({
|
|
|
390
394
|
onDismiss,
|
|
391
395
|
closeOnFinishMs,
|
|
392
396
|
...props
|
|
393
|
-
}: PopoverConfettiProps) =>
|
|
397
|
+
}: PopoverConfettiProps) => import("react/jsx-runtime").JSX.Element;
|
|
394
398
|
//#endregion
|
|
395
399
|
//#region src/templates/StepperConfetti.d.ts
|
|
396
|
-
declare const StepperConfetti: (props: ConfettiProps) =>
|
|
400
|
+
declare const StepperConfetti: (props: ConfettiProps) => import("react/jsx-runtime").JSX.Element;
|
|
397
401
|
//#endregion
|
|
398
402
|
//#region src/hooks/useVisibleAfterDelay.d.ts
|
|
399
403
|
interface UseVisibleAfterDelayOptions {
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./internals-Dzl6abGJ.js";import{A as a,B as o,C as s,D as c,E as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as E,W as D,X as O,Y as ee,Z as k,_ as A,a as j,b as M,c as te,d as ne,f as re,g as ie,h as ae,i as oe,j as N,k as se,l as ce,m as le,o as ue,p as de,q as fe,r as pe,s as P,t as me,u as he,v as ge,w as F,x as I,y as _e,z as ve}from"./ModalContainer-b9Zgg8fN.js";import{ErrorBoundary as ye}from"react-error-boundary";import L,{Suspense as be,createContext as R,forwardRef as z,lazy as xe,useCallback as B,useContext as Se,useEffect as V,useMemo as H,useRef as U,useState as W}from"react";import{useLocalStorage as Ce,useSessionStorage as we,useTimeout as Te}from"usehooks-ts";import{Fragment as G,jsx as K,jsxs as q}from"react/jsx-runtime";import J from"clsx";import{flushSync as Ee}from"react-dom";function De(e){return e.issues[0]?.message??`Invalid input`}const Y={rating:({scale:e},t)=>fe({scale:e},t),"open-ended":({max:e},t)=>h({maxLength:e},t),"single-select":({editable:e},t)=>m({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>d({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>ee(),"bug-report":(e,t)=>D({},t)},Oe=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Y[n];return r(e,t)}case`open-ended`:{let r=Y[n];return r(e,t)}case`single-select`:{let r=Y[n];return r(e,t)}case`multi-select`:{let r=Y[n];return r(e,t)}case`statement`:{let r=Y[n];return r(e,t)}case`bug-report`:{let r=Y[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},ke=({originalQuestions:e,answers:t,errors:r,pointer:i=-1})=>{if(!e)return{questions:[],currentIndex:-1};let a=e.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},n=r[e.id];return n&&(t.error=n),{...t,visible:!1}});for(let e=0;e<a.length;e++){let r=a[e];if(!r)continue;let o=n({index:e,questions:a,answers:t});r.visible=i===e||o}let o=a.findIndex((e,n)=>n>i&&e.visible&&t[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},Ae=({questions:e,answers:t})=>{let n=je({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},je=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Me=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Ne=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:a,submit:o}=f(),[s,c]=W({}),[l,u]=W({}),d=H(()=>ke({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),p=H(()=>!!d.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,d.questions]),[m,h]=W(!1),g=B(({answers:e})=>{o({answers:e}).finally(()=>{n?.()})},[n,o]),_=B(()=>{g({answers:Ae({questions:d.questions,answers:s})}),h(!0)},[s,d.questions,g]),v=B(({question:n,answer:r})=>{let i=d.questions.at(n);if(!i)return{error:`Question index is invalid`};let o=Oe(i.properties,{required:i.required}).safeParse(r);if(!o.success){let e=De(o.error);return u(t=>{if(t[i.id]===e)return t;let n={...t};return n[i.id]=e,n}),c(e=>{if(!(i.id in e))return e;let t={...e};return delete t[i.id],t}),{error:e}}u(e=>{if(!e[i.id])return e;let t={...e};return delete t[i.id],t});let f=!i.required&&!r?null:r,p={...s};if(p[i.id]===f)return{next:ke({originalQuestions:a?.questions,answers:p,errors:l,pointer:e}).currentIndex};p[i.id]=f;let m=ke({originalQuestions:a?.questions,answers:p,errors:l,pointer:e});return p=je({questions:m.questions,answers:p}),c(p),u(Me({questions:m.questions,errors:l})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>p[e]!==void 0)&&t&&(g({answers:Ae({questions:m.questions,answers:p})}),h(!0)),{next:m.currentIndex}},[d.questions,s,a?.questions,l,t,e,g]);return d.questions.length===0?K(G,{}):K(`div`,{className:`confetti ${i}`,children:r({questions:d.questions,current:e??d.currentIndex,update:v,isCompleted:p,submit:_,isSubmitted:m,errors:l})})},Pe=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>K(ye,{fallback:K(G,{}),children:K(E,{...r,children:K(Ne,{shouldAutoSubmit:n,onFinished:t,children:e})})});function Fe(e,t,n){let r=c(e=>{n&&!e.defaultPrevented&&n(t)});V(()=>{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=p(t);let o=p(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=se({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=u([!!t,!!n,r,i]),c=u([!!t,!!n,r,i]);return o=N(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;g(()=>{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=U(!1),o=c(()=>{a.current||t.resetValidation()}),s=c(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ve(r)===n.current&&(i?i():n.current?.focus(),ie(`keyboard`)),e.preventDefault()}),l=c(()=>{t.commitValidation()});V(()=>{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`&&v(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function 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},X={isInvalid:!1,validationDetails:He,validationErrors:[]},We=R({}),Ge=`__reactAriaFormValidationState`;function Z(e){if(e[Ge]){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=H(()=>!o||i==null?null:Ye(Je(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=Se(We),d=H(()=>r?Array.isArray(r)?r.flatMap(e=>qe(u[e])):qe(u[r]):[],[u,r]),[f,p]=W(u),[m,h]=W(!1);u!==f&&(p(u),h(!1));let g=H(()=>Ye(m?[]:d),[m,d]),_=U(X),[v,y]=W(X),b=U(X),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Xe(e,b.current)||(b.current=e,y(e))},[S,C]=W(!1);return V(x),{realtimeValidation:c||g||l||a||X,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=X;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?!0:!!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);for(let e in n||=i.isInvalid,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,[l,u]=de(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=le(e,t),f=Z({...e,value:l}),{isInvalid:p,validationErrors:m,validationDetails:h}=f.displayValidation,{labelProps:g,fieldProps:_,descriptionProps:y,errorMessageProps:b}=Le({...e,isInvalid:p,errorMessage:e.errorMessage||m}),x=a(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=W(l);return Fe(t,e.defaultValue??C,u),Re(e,f,t),{labelProps:g,inputProps:N(x,n===`input`?S:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":p||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:l,onChange:e=>u(v(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(L.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,...d,..._}),descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:h}}function $e(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:l,"aria-label":u,"aria-labelledby":d,validationState:f=`valid`,isInvalid:p,onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:y,onClick:b}=e,x=e=>{e.stopPropagation(),t.setSelected(v(e).checked)},{pressProps:S,isPressed:C}=A({onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:y,onClick:b,isDisabled:r}),{pressProps:w,isPressed:T}=A({onPressStart:m,onPressEnd:h,onPressChange:g,onPressUp:y,onClick:b,onPress(e){_?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:E}=le(e,n),D=N(S,E),O=a(e,{labelable:!0});return Fe(n,t.defaultSelected,t.setSelected),{labelProps:N(w,{onClick:e=>e.preventDefault()}),inputProps:N(O,{"aria-invalid":p||f===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:x,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...D}),isSelected:t.isSelected,isPressed:C||T,isDisabled:r,isReadOnly:i,isInvalid:p||f===`invalid`}}function et(e,t,n){let r=Z({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f}=$e({...e,isInvalid:i},t,n);Re(e,r,n);let{isIndeterminate:p,isRequired:m,validationBehavior:h=`aria`}=e;V(()=>{n.current&&(n.current.indeterminate=!!p)});let{pressProps:g}=A({isDisabled:d||f,onPress(){let{[Ge]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:N(s,g,H(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":m&&h===`aria`||void 0,required:m&&h===`native`},isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f,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:u,fieldProps:d,descriptionProps:f,errorMessageProps:p}=Le({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});tt.set(t,{name:r,form:i,descriptionId:f.id,errorMessageId:p.id,validationBehavior:o});let m=a(e,{labelable:!0}),{focusWithinProps:h}=re({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:N(m,{role:`group`,"aria-disabled":n||void 0,...d,...h}),labelProps:u,descriptionProps:f,errorMessageProps:p,isInvalid:s,validationErrors:c,validationDetails:l}}function rt(e={}){let{isReadOnly:t}=e,[n,r]=de(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=W(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}=Z({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=U(X),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};V(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:u,onPress:d,onPressUp:f,onClick:p}=e,m=e.isDisabled||t.isDisabled,h=t.selectedValue===r,g=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:_,isPressed:v}=A({onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=A({onPressStart:c,onPressEnd:l,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){d?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=le(N(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=N(_,x),C=a(e,{labelable:!0}),w=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(w=0):t.selectedValue===r&&(w=0),m&&(w=void 0);let{name:T,form:E,descriptionId:D,errorMessageId:O,validationBehavior:ee}=at.get(t);return Fe(n,t.defaultSelectedValue,t.setSelectedValue),Re({validationBehavior:ee},t,n),{labelProps:N(y,H(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:N(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&ee===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?O:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function st(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:c=`vertical`,validationBehavior:l=`aria`}=e,{direction:u}=ge(),{isInvalid:d,validationErrors:f,validationDetails:m}=t.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:_,errorMessageProps:y}=Le({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||f}),x=a(e,{labelable:!0}),{focusWithinProps:S}=re({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=u===`rtl`&&c!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=u===`rtl`&&c!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=ae(e.currentTarget,{from:v(e),accept:e=>e instanceof b(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))},w=p(n);return at.set(t,{name:w,form:r,descriptionId:_.id,errorMessageId:y.id,validationBehavior:l}),{radioGroupProps:N(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":c,...g,...S}),labelProps:h,descriptionProps:_,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:m}}const ct=R({}),Q=z(function(e,t){[e,t]=M(e,t,ct);let{elementType:n=`span`,...r}=e,i=F[n];return L.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function lt(e={}){let[t,n]=de(e.value,e.defaultValue||[],e.onChange),[r]=W(t),i=!!e.isRequired&&t.length===0,a=U(new Map),o=Z({...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 ut=Math.round(Math.random()*1e10),dt=0;function ft(e){let t=H(()=>e.name||`radio-group-${ut}-${++dt}`,[e.name]),[n,r]=de(e.value,e.defaultValue??null,e.onChange),[i]=W(n),[a,o]=W(null),s=Z({...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 pt=R(null),mt=z(function(e,t){return Se(pt)?.isInvalid?L.createElement(ht,{...e,ref:t}):null}),ht=z((e,t)=>{let n=Se(pt),r=a(e,{global:!0}),i=I({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:L.createElement(Q,{slot:`errorMessage`,...r,...i,ref:t})}),gt=R(null),_t=R(null),vt=R(null),yt=z(function(e,t){[e,t]=M(e,t,_t);let{validationBehavior:n}=l(gt)||{},r=e.validationBehavior??n??`native`,i=lt({...e,validationBehavior:r}),[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=nt({...e,label:s,validationBehavior:r},i),m=I({...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 L.createElement(F.div,{...N(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},L.createElement(_e,{values:[[vt,i],[ue,{...u,ref:o,elementType:`span`}],[ct,{slots:{description:d,errorMessage:f}}],[pt,p]]},m.children))}),bt=z(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=M(r,t,ve);let{validationBehavior:i}=l(gt)||{},o=e.validationBehavior??i??`native`,s=Se(vt),c=y(H(()=>_(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:u,inputProps:d,isSelected:f,isDisabled:p,isReadOnly:m,isPressed:h,isInvalid:g}=s?it({...w(e),value:e.value,children:typeof e.children==`function`?!0:e.children},s,c):et({...w(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},rt(e),c),{isFocused:v,isFocusVisible:b,focusProps:x}=ne(),S=p||m,{hoverProps:C,isHovered:T}=he({...e,isDisabled:S}),E=I({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:f,isIndeterminate:e.isIndeterminate||!1,isPressed:h,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:p,isReadOnly:m,isInvalid:g,isRequired:e.isRequired||!1}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,L.createElement(F.label,{...N(D,u,C,E),ref:t,slot:e.slot||void 0,"data-selected":f||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":h||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":p||void 0,"data-readonly":m||void 0,"data-invalid":g||void 0,"data-required":e.isRequired||void 0},L.createElement(te,{elementType:`span`},L.createElement(`input`,{...N(d,x),ref:c})),E.children)}),xt=R({}),St=R({});let Ct=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const wt=ce(function(e,t){[e,t]=M(e,t,St);let{hoverProps:n,isHovered:r}=he({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=ne({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=I({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return L.createElement(F.input,{...N(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=R(null);function Et(e){let t=U({});return L.createElement(Tt.Provider,{value:t},e.children)}const Dt=R({isSelected:!1}),Ot=R(null),kt=R(null),At=R(null),jt=z(function(e,t){[e,t]=M(e,t,Ot);let{validationBehavior:n}=l(gt)||{},r=e.validationBehavior??n??`native`,i=ft({...e,validationBehavior:r}),[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=st({...e,label:s,validationBehavior:r},i),m=I({...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 L.createElement(F.div,{...N(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},L.createElement(_e,{values:[[At,i],[ue,{...u,ref:o,elementType:`span`}],[ct,{slots:{description:d,errorMessage:f}}],[pt,p]]},L.createElement(Et,null,m.children)))}),Mt=z(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=M(r,t,kt);let i=L.useContext(At),o=y(H(()=>_(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:l,isDisabled:u,isPressed:d}=ot({...w(e),children:typeof e.children==`function`?!0:e.children},i,o),{isFocused:f,isFocusVisible:p,focusProps:m}=ne(),h=u||i.isReadOnly,{hoverProps:g,isHovered:v}=he({...e,isDisabled:h}),b=I({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:l,isPressed:d,isHovered:v,isFocused:f,isFocusVisible:p,isDisabled:u,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),x=a(e,{global:!0});return delete x.id,delete x.onClick,L.createElement(F.label,{...N(x,s,g,b),ref:t,"data-selected":l||void 0,"data-pressed":d||void 0,"data-hovered":v||void 0,"data-focused":f||void 0,"data-focus-visible":p||void 0,"data-disabled":u||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},L.createElement(te,{elementType:`span`},L.createElement(`input`,{...N(c,m),ref:o})),L.createElement(Dt.Provider,{value:{isSelected:l}},b.children))}),Nt=R({});let Pt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ft=z(function(e,t){[e,t]=M(e,t,Nt);let{hoverProps:n,isHovered:r}=he(e),{isFocused:i,isFocusVisible:a,focusProps:o}=ne({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=I({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return L.createElement(F.textarea,{...N(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=R(null),Lt=ce(function(e,t){[e,t]=M(e,t,It);let{validationBehavior:n}=l(gt)||{},r=e.validationBehavior??n??`native`,i=U(null);[e,i]=M(e,i,S);let[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,u]=W(`input`),{labelProps:d,inputProps:f,descriptionProps:p,errorMessageProps:m,...h}=Qe({...w(e),inputElementType:c,label:s,validationBehavior:r},i),g=B(e=>{i.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=I({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:h.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),v=a(e,{global:!0});return delete v.id,L.createElement(F.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":h.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},L.createElement(_e,{values:[[ue,{...d,ref:o}],[St,{...f,ref:g}],[Nt,{...f,ref:g}],[xt,{role:`presentation`,isInvalid:h.isInvalid,isDisabled:e.isDisabled||!1}],[ct,{slots:{description:p,errorMessage:m}}],[pt,h]]},_.children))}),Rt=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=f();if(!r)return null;let a=t||r.confirmation.description;return q(G,{children:[K(`div`,{className:J(`cf-question`,n?.question),children:q(`div`,{className:J(`cf-header`,n?.header),children:[K(P,{className:J(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&K(Q,{slot:`description`,className:J(`cf-description`,n?.description),children:a})]})}),K(j,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},zt=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=f(),[l,u]=W(!1),[d,p]=W(!1),[m,h]=W(!1);return Te(()=>{s&&c()},l&&!(d||m)?a:null),q(`div`,{className:J(`confetti-dialog ${i}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),p(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),p(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),h(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||h(!1)},children:[K(pe,{className:J(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},Bt=3e4;Bt/1e3;const Vt=({maskAllInputs:e}={})=>{let[n,a]=W(null),[o,s]=W(!1),[c,l]=W(null),[u,d]=W(30),f=U(null),p=U(null),m=U(null),h=U([]);V(()=>{let e=new CustomEvent(r,{detail:{isRecording:o}});document.dispatchEvent(e)},[o]);let g=B(()=>{p.current&&=(clearInterval(p.current),null),m.current&&=(clearTimeout(m.current),null),f.current=null,d(Bt/1e3)},[]),_=B(()=>{f.current?.(),g(),s(!1),a(JSON.stringify(h.current))},[g]);return{recordingEventsJson:n,isRecording:o,recordingError:c,remainingSeconds:u,startRecording:B(async()=>{s(!0),l(null),a(null),h.current=[];try{let{record:n}=await import(`./record-CeeyzJpB.js`);f.current=n({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=>{h.current.push(e)},blockClass:i,maskTextClass:t,maskAllInputs:e})??null;let r=Bt/1e3;d(r),p.current=setInterval(()=>{--r,d(r)},1e3),m.current=setTimeout(()=>{_()},Bt)}catch{l(`Failed to start recording. Please try again.`),s(!1),g()}},[e,_,g]),stopRecording:_,clear:B(()=>{g(),s(!1),a(null),l(null),h.current=[]},[g])}},Ht=e=>e.replace(/\S/g,`*`),Ut=e=>`*`.repeat(e.length),Wt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):Wt(n,t)},Gt=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,Ut(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=Ut(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=Ut(t.textContent)},Kt=({maskInputs:e})=>({name:`cfti-redact`,afterClone:n=>{let{clone:r}=n;if(r instanceof HTMLElement){for(let e of r.querySelectorAll(`.${t}`)){Wt(e,e=>{e.data=Ht(e.data)}),Gt(e);for(let t of e.querySelectorAll(`input, textarea, select`))Gt(t)}if(e)for(let e of r.querySelectorAll(`input, textarea, select`))Gt(e)}}}),qt=({maskAllInputs:e}={})=>{let[t,n]=W(null),[r,a]=W(!1),[o,s]=W(null);return{screenshotDataUrl:t,isCapturing:r,captureError:o,capture:B(async()=>{a(!0),s(null);try{let{snapdom:t}=await import(`./snapdom-VnBlM9vL.js`),r=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${i}`],excludeMode:`hide`,plugins:[Kt({maskInputs:!!e})],fast:!1})).toCanvas(),a=window.devicePixelRatio||1,o=Math.min(Math.round(window.innerWidth*a),r.width),s=Math.min(Math.round(window.innerHeight*a),r.height),c=document.createElement(`canvas`);c.width=o,c.height=s;let l=c.getContext(`2d`);if(!l)throw Error(`Failed to get 2D context for cropping`);l.drawImage(r,0,0,o,s,0,0,o,s),n(c.toDataURL(`image/png`))}catch{s(`Failed to capture screenshot. Please try again.`)}finally{a(!1)}},[e]),clear:B(()=>{n(null),s(null)},[])}},Jt=e=>q(`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:[K(`circle`,{cx:`12`,cy:`12`,r:`10`}),K(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),Yt=e=>q(`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:[K(`path`,{d:`M10 11v6`}),K(`path`,{d:`M14 11v6`}),K(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),K(`path`,{d:`M3 6h18`}),K(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function Xt(){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 Zt(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=Xt();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 Qt=xe(()=>import(`./RecordingReplayer-CKYzAfYD.js`)),$t=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c})=>{let l=H(()=>Zt(),[]),[u,d]=W(``),[f,p]=W(``),{screenshotDataUrl:m,isCapturing:h,captureError:g,capture:_,clear:v}=qt({maskAllInputs:c}),{recordingEventsJson:y,isRecording:b,recordingError:x,remainingSeconds:S,startRecording:C,stopRecording:w,clear:T}=Vt({maskAllInputs:c}),E=H(()=>({title:u,...f?{description:f}:{},...m?{screenshotDataUrl:m}:{},...y?{recordingEventsJson:y}:{},metadata:l}),[f,l,y,m,u]);V(()=>{i(E)},[E,i]),V(()=>()=>{w()},[w]);let D=H(()=>y?JSON.parse(y):[],[y]);return K(G,{children:b?q(j,{className:J(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:w,children:[K(Jt,{}),q(`span`,{children:[30-S,`s /`,` `,30,`s`]})]}):q(`div`,{className:J(`cf-bug-report`,s?.base),children:[q(Lt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:u,onChange:d,className:J(`cf-question`,s?.question),children:[q(`div`,{className:J(`cf-header`,s?.header),children:[q(P,{className:J(`cf-title`,s?.title),children:[t,!a&&q(`span`,{className:J(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&K(Q,{slot:`description`,className:J(`cf-description`,s?.description),children:n})]}),K(wt,{placeholder:r.placeholder||`Brief description of the issue`,className:J(`cf-input`,s?.input)})]}),q(Lt,{name:`${e}-description`,value:f,onChange:p,className:J(`cf-question`,s?.question),children:[K(P,{className:J(`cf-title`,s?.title),children:r.detailsLabel}),K(Ft,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:J(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?q(`section`,{className:J(`cf-question`,s?.question),children:[K(P,{className:J(`cf-title`,s?.title),children:`Attachments`}),q(`div`,{className:J(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&q(`div`,{className:J(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[m?q(`div`,{className:J(`cf-bug-report-media-preview`,s?.mediaPreview),children:[K(`img`,{src:m,alt:`Screenshot preview`,className:J(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),K(`div`,{className:J(`cf-bug-report-media-actions`,s?.mediaActions),children:K(j,{className:J(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:v,"aria-label":`Remove screenshot`,children:K(Yt,{})})})]}):K(j,{className:J(`cf-bug-report-button`,s?.button),onPress:_,isDisabled:h,children:h?`Capturing...`:`Screenshot`}),g&&K(`div`,{className:J(`cf-error`,s?.error),children:g})]}),r.enableRecording&&q(`div`,{className:J(`cf-bug-report-recording-section`,s?.recordingSection),children:[D.length>0?q(`div`,{className:J(`cf-bug-report-media-preview`,s?.mediaPreview),children:[K(be,{fallback:K(`span`,{className:J(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:K(Qt,{events:D})}),K(`div`,{className:J(`cf-bug-report-media-actions`,s?.mediaActions),children:K(j,{className:J(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:T,"aria-label":`Remove recording`,children:K(Yt,{})})})]}):K(j,{className:J(`cf-bug-report-button`,s?.button),onPress:C,children:`Record`}),x&&K(`div`,{className:J(`cf-error`,s?.error),children:x})]})]})]}):null,K(mt,{className:J(`cf-error`,s?.error),children:o})]})})},en=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[c,l]=W(``);return V(()=>{i(c)},[i,c]),q(Lt,{isRequired:o,isInvalid:!!s,name:e,className:J(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[q(`div`,{className:J(`cf-header`,a?.header),children:[q(P,{className:J(`cf-title`,a?.title),children:[t,!o&&q(`span`,{className:J(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&K(Q,{slot:`description`,className:J(`cf-description`,a?.description),children:n})]}),K(Ft,{className:J(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),K(mt,{className:J(`cf-error`,a?.error),children:s})]})},tn=({children:e,classNames:t,description:n,...r})=>K(bt,{...r,children:({isIndeterminate:r})=>q(G,{children:[q(`div`,{className:J(`cf-choice-label`,t?.label),children:[K(`div`,{className:J(`cf-checkbox-indicator`,t?.indicator),children:K(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:J(`cf-checkbox-indicator-svg`,t?.svg),children:r?K(`rect`,{x:1,y:7.5,width:16,height:3}):K(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&K(`span`,{className:J(`cf-choice-description`,t?.choiceDescription),children:n})]})}),nn=({children:e,classNames:t,...n})=>K(bt,{...n,children:K(`div`,{className:J(`cf-tag-label`,t?.tagLabel),children:e})}),rn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let c=!!n.editable,l=n.display??`checkbox`,[u,d]=W([]),[f,p]=W(``),m=U(null),h=U(null),g=H(()=>{let e=u.indexOf(O);if(e===-1)return u;let t=[...u];return t[e]=f||O,t},[f,u]),_=l===`tag`;return V(()=>{i(g)},[i,g]),K(yt,{isRequired:o,isInvalid:!!s,name:a,value:u,onChange:d,className:J(`cf-question`,r?.question),children:({state:i})=>q(G,{children:[q(`div`,{className:J(`cf-header`,r?.header),children:[q(P,{className:J(`cf-title`,r?.title),children:[e,!o&&q(`span`,{className:J(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&K(Q,{slot:`description`,className:J(`cf-description`,r?.description),children:t})]}),q(`div`,{className:J(`cf-response-choices`,l===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>K(_?nn:tn,{className:J(`cf-choice`,_&&[`cf-tag`,r?.tag],!_&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),c&&(_?q(G,{children:[K(nn,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:J(`cf-choice cf-tag`,r?.tag),value:O,children:n.editable?.label}),K(wt,{"data-visible":i.value.includes(O)||void 0,value:f,onChange:e=>{p(e.target.value)},ref:h,className:J(`cf-input cf-tag-input`,r?.othersInput)})]}):q(`div`,{className:J(`cf-choice cf-others-choice`,r?.othersChoice),children:[K(tn,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:J(`cf-checkbox`,r?.checkbox),value:O,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),K(wt,{value:f,onChange:e=>{p(e.target.value)},tabIndex:i.value.includes(O)?0:-1,ref:h,onFocus:()=>{m.current?.checked===!1&&m.current.click()},className:J(`cf-input`,r?.othersInput)})]}))]}),K(mt,{className:J(`cf-error`,r?.error),children:s})]})})},an=e=>q(`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:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),on=e=>q(`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:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),sn=e=>q(`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:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),cn=e=>q(`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:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),ln=e=>q(`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:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),un=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:K(`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`})}),dn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:K(`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`})}),fn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return K(`div`,{className:J(`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 K(Mt,{className:J(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:K(o?dn:un,{})},t)})})},pn=({properties:e,classNames:t})=>K(`div`,{className:J(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return K(Mt,{className:J(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),mn=({properties:e,classNames:t,state:n})=>{let r=H(()=>[an,sn,cn,ln,on],[]),i=H(()=>[sn,cn,ln],[]);return H(()=>e.scale===3||e.scale===5,[e.scale])?K(`div`,{className:J(`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 K(Mt,{className:J(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&K(c,{})},a)})}):K(pn,{properties:e,classNames:t,state:n})},hn=e=>{switch(e.properties.display??`star`){case`emoji`:return K(mn,{...e});case`number`:return K(pn,{...e});case`star`:return K(fn,{...e})}},gn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=W(null),u=H(()=>c?Number(c):void 0,[c]);return V(()=>{i(u)},[i,u]),K(jt,{isRequired:s,isInvalid:!!o,name:a,className:J(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>q(G,{children:[q(`div`,{className:J(`cf-header`,r?.header),children:[q(P,{className:J(`cf-title`,r?.title),children:[t,!s&&q(`span`,{className:J(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&K(Q,{slot:`description`,className:J(`cf-description`,r?.description),children:n})]}),q(`div`,{className:J(`cf-rating-section`,r?.ratingSection),children:[K(hn,{state:i,properties:e,classNames:r}),q(`div`,{className:J(`cf-rating-text`,r?.ratingText),children:[K(`span`,{className:J(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),K(`span`,{className:J(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),K(mt,{className:J(`cf-error`,r?.error),children:o})]})})},_n=({classNames:e,className:t,description:n,...r})=>K(Mt,{...r,className:J(t,e?.radio),children:s(r.children,t=>q(G,{children:[q(`div`,{className:J(`cf-choice-label`,e?.label),children:[K(`div`,{className:J(`cf-radio-indicator`,e?.indicator)}),t]}),n&&K(`span`,{className:J(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),vn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=W(null),[u,d]=W(``),f=!!n.editable,p=U(null),m=U(null),h=H(()=>c===k?u||k:c??void 0,[u,c]);return V(()=>{i(h)},[i,h]),K(jt,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===k&&requestAnimationFrame(()=>{m.current&&m.current.focus()})},value:c,className:J(`cf-question`,r?.question),children:({state:i})=>q(G,{children:[q(`div`,{className:J(`cf-header`,r?.header),children:[q(P,{className:J(`cf-title`,r?.title),children:[e,!o&&q(`span`,{className:J(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&K(Q,{slot:`description`,className:J(`cf-description`,r?.description),children:t})]}),q(`div`,{className:J(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>K(_n,{classNames:{indicator:r?.indicator,radio:J(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),f&&q(`div`,{className:J(`cf-choice cf-others-choice`,r?.othersChoice),children:[K(_n,{inputRef:p,value:k,classNames:{indicator:r?.indicator,radio:J(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),K(wt,{tabIndex:i.selectedValue===k?0:-1,ref:m,value:u,onChange:e=>d(e.target.value),onFocus:()=>{p.current?.checked===!1&&p.current.click()},className:J(`cf-input`,r?.othersInput)})]})]}),K(mt,{className:J(`cf-error`,r?.error),children:s})]})})},yn=({properties:e,title:t,description:n,classNames:r})=>K(`div`,{className:J(`cf-question`,r?.question),children:q(`div`,{className:J(`cf-header`,r?.header),children:[t&&K(`div`,{className:J(`cf-title`,r?.title),children:t}),n&&K(`div`,{className:J(`cf-description`,r?.description),children:n})]})}),$=({question:e,onChange:t,error:n,maskAllInputs:r})=>{switch(e.properties.type){case`rating`:return K(gn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return K(en,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return K(vn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return K(rn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return K(yn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return K($t,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r},e.id)}return K(`div`,{children:`Unsupported question type`},e.id)},bn=({onPress:e,isDisabled:t,children:n=`Submit`})=>oe()?null:K(j,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),xn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},Sn=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),Cn=({onSubmit:t,children:n,question:r,isLastQuestion:i})=>{let[a,o]=W(xn(r.properties.type)),s=H(()=>Oe(r.properties,{required:r.required}),[r.properties,r.required]),c=H(()=>{let e=s.safeParse(a);if(!e.success)return De(e.error)},[a,s]),l=H(()=>{let t=r.routingLogic;if(t.type!==`always`&&!Sn(a)&&r.required)return!0;let n=t.type===`always`?t.target:t.cases.find(t=>e({answer:a,condition:t}))?.target??t.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),u=H(()=>r.properties.buttonLabel?r.properties.buttonLabel:l?!r.required&&!Sn(a)?`Skip`:`Next`:`Submit`,[a,l,r.properties.buttonLabel,r.required]),d=B(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=x.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return t(void 0);default:return t(a)}},[a,t,r.properties]),f=H(()=>{switch(r.properties.type){case`rating`:case`single-select`:return!!r.properties.shouldAutoProgress;default:return!1}},[r.properties]);return q(G,{children:[n({onChange:B(e=>{o(e),f&&Sn(e)&&s.safeParse(e).success&&t(e)},[f,s,t]),question:r,error:c}),(!f||!r.required)&&K(bn,{isDisabled:!!c,onPress:d,children:u})]})},wn=({isCompleted:e,onSubmit:t,children:n})=>q(G,{children:[n,e&&K(bn,{onPress:t})]}),Tn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:q(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[K(`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`}),K(`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`}),K(`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`}),K(`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`})]})}),En=({onClick:e,isWidgetOpen:t,classNames:n,label:r=`Help us improve`})=>t?null:q(j,{onPress:e,className:J(`confetti-trigger`,n?.trigger),children:[K(`span`,{className:J(`confetti-trigger-icon-wrapper`,n?.iconWrapper),"aria-hidden":!0,children:K(Tn,{className:J(`confetti-trigger-icon`,n?.icon),width:24})}),K(`span`,{className:J(`confetti-trigger-label`,n?.label),children:r})]}),Dn=({trigger:e,children:t,publishableKey:n,surveyId:r})=>{let i=f(),[a,s]=W(!1),[c,l]=W(!1);if(!i.isVisible)return null;let u=()=>{s(!1)};return q(G,{children:[e({onClick:()=>s(!0),isWidgetOpen:a,hasSubmitted:c}),a&&K(o.Provider,{value:{...i,dismiss:()=>{i.dismiss(),u()},submit:async e=>{let t=await i.submit(e);return l(!0),t}},children:t({onDismiss:u,surveyId:r,publishableKey:n})})]})},On=({trigger:e=e=>K(En,{...e}),children:t,...n})=>K(ye,{fallback:K(G,{}),children:K(E,{...n,alwaysRenderChildren:!0,children:K(Dn,{trigger:e,surveyId:n.surveyId,publishableKey:n.publishableKey,children:t})})}),kn=e=>K(ye,{fallback:K(G,{}),children:K(T,{type:`embedded`,children:K(Pe,{...e,shouldAutoSubmit:!1,children:({questions:t,update:n,isCompleted:r,submit:i,isSubmitted:a,errors:o})=>a?K(Rt,{}):K(wn,{onSubmit:i,isCompleted:r,children:t.filter(({visible:e})=>!!e).map(t=>K($,{question:t,error:o[t.id]||``,maskAllInputs:e.options?.bugReport?.maskAllInputs,onChange:e=>n({question:t.position,answer:e})},t.position))})})})}),An=({onDismiss:e,closeOnFinishMs:t,isDismissable:n,...r})=>K(ye,{fallback:K(G,{}),children:K(T,{type:`modal`,children:K(E,{...r,children:K(me,{onDismiss:e,closeOnFinishMs:t,isDismissable:n,children:({setIsFinished:e})=>K(Ne,{...r,shouldAutoSubmit:!1,onFinished:()=>{e(),r.onFinished?.()},children:({questions:e,update:t,isCompleted:n,errors:i,submit:a,isSubmitted:o})=>o?K(Rt,{}):K(wn,{onSubmit:a,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>K($,{question:e,error:i[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),jn=({onDismiss:e,closeOnFinishMs:t,...n})=>K(ye,{fallback:K(G,{}),children:K(T,{type:`popover`,children:K(E,{...n,children:K(zt,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>K(Ne,{shouldAutoSubmit:!0,...n,onFinished:()=>{e(),n.onFinished?.()},children:({current:e,questions:t,update:r,isSubmitted:i})=>{let a=e===t.length-1;if(i)return K(Rt,{});let o=t[e];return o?K(Cn,{isLastQuestion:a,question:o,onSubmit:t=>r({question:e,answer:t}),children:e=>K($,{maskAllInputs:n.options?.bugReport?.maskAllInputs,...e})}):K(G,{})}})})})})}),Mn=e=>K(Pe,{...e,shouldAutoSubmit:!0,children:({current:t,questions:n,update:r,isSubmitted:i})=>{let a=t===n.length-1;if(i)return K(Rt,{});let o=n[t];return o?K(Cn,{isLastQuestion:a,question:o,onSubmit:e=>r({question:t,answer:e}),children:t=>K($,{maskAllInputs:e.options?.bugReport?.maskAllInputs,...t})}):K(G,{})}}),Nn=({delay:e})=>{let[t,n]=W(!1),r=H(()=>e,[]);return V(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},Pn=({visits:e,respondent:t})=>{let[n,r]=Ce(`cfti:${H(()=>window.location.pathname,[])}:visits:${t??``}`,0);return V(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:B(()=>r(0),[r])}},Fn=({visits:e,respondent:t})=>{let[n,r]=we(`cfti:${H(()=>window.location.pathname,[])}:visits:${t??``}`,0);return V(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:B(()=>r(0),[r])}},In=({threshold:e})=>{let[t,n]=W(()=>typeof window>`u`?!1:window.scrollY>=e);return V(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{pe as CloseButton,Pe as Confetti,o as ConfettiContext,Ne as ConfettiController,E as ConfettiProvider,On as ConfettiTrigger,Tn as ConfettiTriggerIcon,En as DefaultConfettiTrigger,wn as Embed,kn as EmbeddedConfetti,Cn as Flow,en as FreeText,An as ModalConfetti,me as ModalContainer,rn as MultiChoice,jn as PopoverConfetti,zt as PopoverContainer,gn as Rating,vn as SingleChoice,yn as Statement,Mn as StepperConfetti,$ as SurveyQuestionFactory,Rt as ThankYouMessage,f as useConfetti,Nn as useVisibleAfterDelay,Pn as useVisibleAfterPageVisits,In as useVisibleAfterScroll,Fn as useVisibleAfterSessionPageVisits};
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./internals-B5GhpjgM.js";import{A as a,B as o,C as s,D as c,E as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as E,W as D,X as ee,Y as te,_ as O,a as k,b as A,c as ne,d as re,f as ie,g as ae,h as oe,i as se,j,k as ce,l as le,m as ue,o as de,p as fe,q as pe,r as me,s as M,t as he,u as ge,v as _e,w as N,x as P,y as ve,z as ye}from"./ModalContainer-DiVIAVi2.js";import{ErrorBoundary as F}from"react-error-boundary";import I,{Suspense as be,createContext as L,forwardRef as R,lazy as xe,useCallback as z,useContext as Se,useEffect as B,useMemo as V,useRef as H,useState as U}from"react";import{useLocalStorage as Ce,useSessionStorage as we,useTimeout as Te}from"usehooks-ts";import{Fragment as W,jsx as G,jsxs as K}from"react/jsx-runtime";import q from"clsx";import"react-dom";function Ee(e){return e.issues[0]?.message??`Invalid input`}const J={rating:({scale:e},t)=>pe({scale:e},t),"open-ended":({max:e},t)=>h({maxLength:e},t),"single-select":({editable:e},t)=>m({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>d({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>te(),"bug-report":(e,t)=>D({},t)},De=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=J[n];return r(e,t)}case`open-ended`:{let r=J[n];return r(e,t)}case`single-select`:{let r=J[n];return r(e,t)}case`multi-select`:{let r=J[n];return r(e,t)}case`statement`:{let r=J[n];return r(e,t)}case`bug-report`:{let r=J[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Oe=({originalQuestions:e,answers:t,errors:r,pointer:i=-1})=>{if(!e)return{questions:[],currentIndex:-1};let a=e.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},n=r[e.id];return n&&(t.error=n),{...t,visible:!1}});for(let e=0;e<a.length;e++){let r=a[e];if(!r)continue;let o=n({index:e,questions:a,answers:t});r.visible=i===e||o}let o=a.findIndex((e,n)=>n>i&&e.visible&&t[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},ke=({questions:e,answers:t})=>{let n=Ae({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Ae=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),je=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Me=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:a,submit:o}=f(),[s,c]=U({}),[l,u]=U({}),d=V(()=>Oe({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),p=V(()=>!!d.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,d.questions]),[m,h]=U(!1),g=z(({answers:e})=>{o({answers:e}).finally(()=>{n?.()})},[n,o]),_=z(()=>{g({answers:ke({questions:d.questions,answers:s})}),h(!0)},[s,d.questions,g]),v=z(({question:n,answer:r})=>{let i=d.questions.at(n);if(!i)return{error:`Question index is invalid`};let o=De(i.properties,{required:i.required}).safeParse(r);if(!o.success){let e=Ee(o.error);return u(t=>{if(t[i.id]===e)return t;let n={...t};return n[i.id]=e,n}),c(e=>{if(!(i.id in e))return e;let t={...e};return delete t[i.id],t}),{error:e}}u(e=>{if(!e[i.id])return e;let t={...e};return delete t[i.id],t});let f=!i.required&&!r?null:r,p={...s};if(p[i.id]===f)return{next:Oe({originalQuestions:a?.questions,answers:p,errors:l,pointer:e}).currentIndex};p[i.id]=f;let m=Oe({originalQuestions:a?.questions,answers:p,errors:l,pointer:e});return p=Ae({questions:m.questions,answers:p}),c(p),u(je({questions:m.questions,errors:l})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>p[e]!==void 0)&&t&&(g({answers:ke({questions:m.questions,answers:p})}),h(!0)),{next:m.currentIndex}},[d.questions,s,a?.questions,l,t,e,g]);return d.questions.length===0?G(W,{}):G(`div`,{className:`confetti ${i}`,children:r({questions:d.questions,current:e??d.currentIndex,update:v,isCompleted:p,submit:_,isSubmitted:m,errors:l})})},Ne=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>G(F,{fallback:G(W,{}),children:G(E,{...r,children:G(Me,{shouldAutoSubmit:n,onFinished:t,children:e})})});function Pe(e,t,n){let r=c(e=>{n&&!e.defaultPrevented&&n(t)});B(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Fe(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=p(t);let o=p(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=ce({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Ie(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Fe(e),s=u([!!t,!!n,r,i]),c=u([!!t,!!n,r,i]);return o=j(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function Le(e,t,n){let{validationBehavior:r,focus:i}=e;g(()=>{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(ze(n.current))}});let a=H(!1),o=c(()=>{a.current||t.resetValidation()}),s=c(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Be(r)===n.current&&(i?i():n.current?.focus(),ae(`keyboard`)),e.preventDefault()}),l=c(()=>{t.commitValidation()});B(()=>{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`&&v(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function Re(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 ze(e){return{isInvalid:!e.validity.valid,validationDetails:Re(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Be(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 Ve={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},He={...Ve,customError:!0,valid:!1},Y={isInvalid:!1,validationDetails:Ve,validationErrors:[]},Ue=L({}),We=`__reactAriaFormValidationState`;function X(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[We];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ge(e)}function Ge(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:He},l=V(()=>!o||i==null?null:Je(qe(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=Se(Ue),d=V(()=>r?Array.isArray(r)?r.flatMap(e=>Ke(u[e])):Ke(u[r]):[],[u,r]),[f,p]=U(u),[m,h]=U(!1);u!==f&&(p(u),h(!1));let g=V(()=>Je(m?[]:d),[m,d]),_=H(Y),[v,y]=U(Y),b=H(Y),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Ye(e,b.current)||(b.current=e,y(e))},[S,C]=U(!1);return B(x),{realtimeValidation:c||g||l||a||Y,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Ye(v,e)?y(e):_.current=e},resetValidation(){let e=Y;Ye(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function Ke(e){return e?Array.isArray(e)?e:[e]:[]}function qe(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Ke(n)}return[]}function Je(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:He}:null}function Ye(e,t){return e===t?!0:!!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 Xe(...e){let t=new Set,n=!1,r={...Ve};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 Ze(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=fe(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=ue(e,t),f=X({...e,value:l}),{isInvalid:p,validationErrors:m,validationDetails:h}=f.displayValidation,{labelProps:g,fieldProps:_,descriptionProps:y,errorMessageProps:b}=Ie({...e,isInvalid:p,errorMessage:e.errorMessage||m}),x=a(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=U(l);return Pe(t,e.defaultValue??C,u),Le(e,f,t),{labelProps:g,inputProps:j(x,n===`input`?S:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":p||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:l,onChange:e=>u(v(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(I.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,...d,..._}),descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:h}}function Qe(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:l,"aria-label":u,"aria-labelledby":d,validationState:f=`valid`,isInvalid:p,onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:y,onClick:b}=e,x=e=>{e.stopPropagation(),t.setSelected(v(e).checked)},{pressProps:S,isPressed:C}=O({onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:y,onClick:b,isDisabled:r}),{pressProps:w,isPressed:T}=O({onPressStart:m,onPressEnd:h,onPressChange:g,onPressUp:y,onClick:b,onPress(e){_?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:E}=ue(e,n),D=j(S,E),ee=a(e,{labelable:!0});return Pe(n,t.defaultSelected,t.setSelected),{labelProps:j(w,{onClick:e=>e.preventDefault()}),inputProps:j(ee,{"aria-invalid":p||f===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:x,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...D}),isSelected:t.isSelected,isPressed:C||T,isDisabled:r,isReadOnly:i,isInvalid:p||f===`invalid`}}function $e(e,t,n){let r=X({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f}=Qe({...e,isInvalid:i},t,n);Le(e,r,n);let{isIndeterminate:p,isRequired:m,validationBehavior:h=`aria`}=e;B(()=>{n.current&&(n.current.indeterminate=!!p)});let{pressProps:g}=O({isDisabled:d||f,onPress(){let{[We]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:j(s,g,V(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":m&&h===`aria`||void 0,required:m&&h===`native`},isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f,isInvalid:i,validationErrors:a,validationDetails:o}}const et=new WeakMap;function tt(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:l}=t.displayValidation,{labelProps:u,fieldProps:d,descriptionProps:f,errorMessageProps:p}=Ie({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});et.set(t,{name:r,form:i,descriptionId:f.id,errorMessageId:p.id,validationBehavior:o});let m=a(e,{labelable:!0}),{focusWithinProps:h}=ie({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:j(m,{role:`group`,"aria-disabled":n||void 0,...d,...h}),labelProps:u,descriptionProps:f,errorMessageProps:p,isInvalid:s,validationErrors:c,validationDetails:l}}function nt(e={}){let{isReadOnly:t}=e,[n,r]=fe(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=U(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function rt(e,t,n){let r=nt({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}=et.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=X({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=H(Y),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};B(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=$e({...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,[We]:{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 it=new WeakMap;function at(e,t,n){let{value:r,children:i,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p}=e,m=e.isDisabled||t.isDisabled,h=t.selectedValue===r,g=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:_,isPressed:v}=O({onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=O({onPressStart:c,onPressEnd:l,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){d?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=ue(j(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=j(_,x),C=a(e,{labelable:!0}),w=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(w=0):t.selectedValue===r&&(w=0),m&&(w=void 0);let{name:T,form:E,descriptionId:D,errorMessageId:ee,validationBehavior:te}=it.get(t);return Pe(n,t.defaultSelectedValue,t.setSelectedValue),Le({validationBehavior:te},t,n),{labelProps:j(y,V(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:j(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&te===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?ee:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function ot(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:c=`vertical`,validationBehavior:l=`aria`}=e,{direction:u}=_e(),{isInvalid:d,validationErrors:f,validationDetails:m}=t.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:_,errorMessageProps:y}=Ie({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||f}),x=a(e,{labelable:!0}),{focusWithinProps:S}=ie({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=u===`rtl`&&c!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=u===`rtl`&&c!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=oe(e.currentTarget,{from:v(e),accept:e=>e instanceof b(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))},w=p(n);return it.set(t,{name:w,form:r,descriptionId:_.id,errorMessageId:y.id,validationBehavior:l}),{radioGroupProps:j(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":c,...g,...S}),labelProps:h,descriptionProps:_,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:m}}const st=L({}),Z=R(function(e,t){[e,t]=A(e,t,st);let{elementType:n=`span`,...r}=e,i=N[n];return I.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function ct(e={}){let[t,n]=fe(e.value,e.defaultValue||[],e.onChange),[r]=U(t),i=!!e.isRequired&&t.length===0,a=H(new Map),o=X({...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(Xe(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let lt=Math.round(Math.random()*1e10),ut=0;function dt(e){let t=V(()=>e.name||`radio-group-${lt}-${++ut}`,[e.name]),[n,r]=fe(e.value,e.defaultValue??null,e.onChange),[i]=U(n),[a,o]=U(null),s=X({...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 Q=L(null),$=R(function(e,t){return Se(Q)?.isInvalid?I.createElement(ft,{...e,ref:t}):null}),ft=R((e,t)=>{let n=Se(Q),r=a(e,{global:!0}),i=P({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:I.createElement(Z,{slot:`errorMessage`,...r,...i,ref:t})}),pt=L(null),mt=L(null),ht=L(null),gt=R(function(e,t){[e,t]=A(e,t,mt);let{validationBehavior:n}=l(pt)||{},r=e.validationBehavior??n??`native`,i=ct({...e,validationBehavior:r}),[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=tt({...e,label:s,validationBehavior:r},i),m=P({...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 I.createElement(N.div,{...j(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},I.createElement(ve,{values:[[ht,i],[de,{...u,ref:o,elementType:`span`}],[st,{slots:{description:d,errorMessage:f}}],[Q,p]]},m.children))}),_t=R(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=A(r,t,ye);let{validationBehavior:i}=l(pt)||{},o=e.validationBehavior??i??`native`,s=Se(ht),c=y(V(()=>_(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:u,inputProps:d,isSelected:f,isDisabled:p,isReadOnly:m,isPressed:h,isInvalid:g}=s?rt({...w(e),value:e.value,children:typeof e.children==`function`?!0:e.children},s,c):$e({...w(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},nt(e),c),{isFocused:v,isFocusVisible:b,focusProps:x}=re(),S=p||m,{hoverProps:C,isHovered:T}=ge({...e,isDisabled:S}),E=P({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:f,isIndeterminate:e.isIndeterminate||!1,isPressed:h,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:p,isReadOnly:m,isInvalid:g,isRequired:e.isRequired||!1}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,I.createElement(N.label,{...j(D,u,C,E),ref:t,slot:e.slot||void 0,"data-selected":f||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":h||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":p||void 0,"data-readonly":m||void 0,"data-invalid":g||void 0,"data-required":e.isRequired||void 0},I.createElement(ne,{elementType:`span`},I.createElement(`input`,{...j(d,x),ref:c})),E.children)}),vt=L({}),yt=L({});let bt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const xt=le(function(e,t){[e,t]=A(e,t,yt);let{hoverProps:n,isHovered:r}=ge({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=re({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=P({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return I.createElement(N.input,{...j(bt(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})}),St=L(null);function Ct(e){let t=H({});return I.createElement(St.Provider,{value:t},e.children)}const wt=L({isSelected:!1}),Tt=L(null),Et=L(null),Dt=L(null),Ot=R(function(e,t){[e,t]=A(e,t,Tt);let{validationBehavior:n}=l(pt)||{},r=e.validationBehavior??n??`native`,i=dt({...e,validationBehavior:r}),[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=ot({...e,label:s,validationBehavior:r},i),m=P({...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 I.createElement(N.div,{...j(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},I.createElement(ve,{values:[[Dt,i],[de,{...u,ref:o,elementType:`span`}],[st,{slots:{description:d,errorMessage:f}}],[Q,p]]},I.createElement(Ct,null,m.children)))}),kt=R(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=A(r,t,Et);let i=I.useContext(Dt),o=y(V(()=>_(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:l,isDisabled:u,isPressed:d}=at({...w(e),children:typeof e.children==`function`?!0:e.children},i,o),{isFocused:f,isFocusVisible:p,focusProps:m}=re(),h=u||i.isReadOnly,{hoverProps:g,isHovered:v}=ge({...e,isDisabled:h}),b=P({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:l,isPressed:d,isHovered:v,isFocused:f,isFocusVisible:p,isDisabled:u,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),x=a(e,{global:!0});return delete x.id,delete x.onClick,I.createElement(N.label,{...j(x,s,g,b),ref:t,"data-selected":l||void 0,"data-pressed":d||void 0,"data-hovered":v||void 0,"data-focused":f||void 0,"data-focus-visible":p||void 0,"data-disabled":u||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},I.createElement(ne,{elementType:`span`},I.createElement(`input`,{...j(c,m),ref:o})),I.createElement(wt.Provider,{value:{isSelected:l}},b.children))}),At=L({});let jt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Mt=R(function(e,t){[e,t]=A(e,t,At);let{hoverProps:n,isHovered:r}=ge(e),{isFocused:i,isFocusVisible:a,focusProps:o}=re({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=P({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return I.createElement(N.textarea,{...j(jt(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})}),Nt=L(null),Pt=le(function(e,t){[e,t]=A(e,t,Nt);let{validationBehavior:n}=l(pt)||{},r=e.validationBehavior??n??`native`,i=H(null);[e,i]=A(e,i,S);let[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,u]=U(`input`),{labelProps:d,inputProps:f,descriptionProps:p,errorMessageProps:m,...h}=Ze({...w(e),inputElementType:c,label:s,validationBehavior:r},i),g=z(e=>{i.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=P({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:h.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),v=a(e,{global:!0});return delete v.id,I.createElement(N.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":h.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},I.createElement(ve,{values:[[de,{...d,ref:o}],[yt,{...f,ref:g}],[At,{...f,ref:g}],[vt,{role:`presentation`,isInvalid:h.isInvalid,isDisabled:e.isDisabled||!1}],[st,{slots:{description:p,errorMessage:m}}],[Q,h]]},_.children))}),Ft=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=f();if(!r)return null;let a=t||r.confirmation.description;return K(W,{children:[G(`div`,{className:q(`cf-question`,n?.question),children:K(`div`,{className:q(`cf-header`,n?.header),children:[G(M,{className:q(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&G(Z,{slot:`description`,className:q(`cf-description`,n?.description),children:a})]})}),G(k,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},It=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=f(),[l,u]=U(!1),[d,p]=U(!1),[m,h]=U(!1);return Te(()=>{s&&c()},l&&!(d||m)?a:null),K(`div`,{className:q(`confetti-dialog ${i}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),p(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),p(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),h(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||h(!1)},children:[G(me,{className:q(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},Lt=3e4,Rt=({maskAllInputs:e}={})=>{let[t,n]=U(null),[i,a]=U(!1),[o,s]=U(null),[c,l]=U(30),u=H(null),d=H(null),f=H(null),p=H([]);B(()=>{let e=new CustomEvent(r,{detail:{isRecording:i}});document.dispatchEvent(e)},[i]);let m=z(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null),u.current=null,l(Lt/1e3)},[]),h=z(()=>{u.current?.(),m(),a(!1),n(JSON.stringify(p.current))},[m]);return{recordingEventsJson:t,isRecording:i,recordingError:o,remainingSeconds:c,startRecording:z(async()=>{a(!0),s(null),n(null),p.current=[];try{let{record:t}=await import(`./record-BZwNFiEW.js`);u.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{p.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=Lt/1e3;l(n),d.current=setInterval(()=>{--n,l(n)},1e3),f.current=setTimeout(()=>{h()},Lt)}catch{s(`Failed to start recording. Please try again.`),a(!1),m()}},[e,h,m]),stopRecording:h,clear:z(()=>{m(),a(!1),n(null),s(null),p.current=[]},[m])}},zt=e=>e.replace(/\S/g,`*`),Bt=e=>`*`.repeat(e.length),Vt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):Vt(n,t)},Ht=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,Bt(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=Bt(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=Bt(t.textContent)},Ut=({maskInputs:e})=>({name:`cfti-redact`,afterClone:n=>{let{clone:r}=n;if(r instanceof HTMLElement){for(let e of r.querySelectorAll(`.${t}`)){Vt(e,e=>{e.data=zt(e.data)}),Ht(e);for(let t of e.querySelectorAll(`input, textarea, select`))Ht(t)}if(e)for(let e of r.querySelectorAll(`input, textarea, select`))Ht(e)}}}),Wt=({maskAllInputs:e}={})=>{let[t,n]=U(null),[r,a]=U(!1),[o,s]=U(null);return{screenshotDataUrl:t,isCapturing:r,captureError:o,capture:z(async()=>{a(!0),s(null);try{let{snapdom:t}=await import(`./snapdom-BQZEILL6.js`),r=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${i}`],excludeMode:`hide`,plugins:[Ut({maskInputs:!!e})],fast:!1})).toCanvas(),a=window.devicePixelRatio||1,o=Math.min(Math.round(window.innerWidth*a),r.width),s=Math.min(Math.round(window.innerHeight*a),r.height),c=document.createElement(`canvas`);c.width=o,c.height=s;let l=c.getContext(`2d`);if(!l)throw Error(`Failed to get 2D context for cropping`);l.drawImage(r,0,0,o,s,0,0,o,s),n(c.toDataURL(`image/png`))}catch{s(`Failed to capture screenshot. Please try again.`)}finally{a(!1)}},[e]),clear:z(()=>{n(null),s(null)},[])}},Gt=e=>K(`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:[G(`circle`,{cx:`12`,cy:`12`,r:`10`}),G(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),Kt=e=>K(`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:[G(`path`,{d:`M10 11v6`}),G(`path`,{d:`M14 11v6`}),G(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),G(`path`,{d:`M3 6h18`}),G(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function qt(){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 Jt(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=qt();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 Yt=xe(()=>import(`./RecordingReplayer-BvU_CHwb.js`)),Xt=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c})=>{let l=V(()=>Jt(),[]),[u,d]=U(``),[f,p]=U(``),{screenshotDataUrl:m,isCapturing:h,captureError:g,capture:_,clear:v}=Wt({maskAllInputs:c}),{recordingEventsJson:y,isRecording:b,recordingError:x,remainingSeconds:S,startRecording:C,stopRecording:w,clear:T}=Rt({maskAllInputs:c}),E=V(()=>({title:u,...f?{description:f}:{},...m?{screenshotDataUrl:m}:{},...y?{recordingEventsJson:y}:{},metadata:l}),[f,l,y,m,u]);B(()=>{i(E)},[E,i]),B(()=>()=>{w()},[w]);let D=V(()=>y?JSON.parse(y):[],[y]);return G(W,{children:b?K(k,{className:q(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:w,children:[G(Gt,{}),K(`span`,{children:[30-S,`s /`,` `,30,`s`]})]}):K(`div`,{className:q(`cf-bug-report`,s?.base),children:[K(Pt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:u,onChange:d,className:q(`cf-question`,s?.question),children:[K(`div`,{className:q(`cf-header`,s?.header),children:[K(M,{className:q(`cf-title`,s?.title),children:[t,!a&&K(`span`,{className:q(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,s?.description),children:n})]}),G(xt,{placeholder:r.placeholder||`Brief description of the issue`,className:q(`cf-input`,s?.input)})]}),K(Pt,{name:`${e}-description`,value:f,onChange:p,className:q(`cf-question`,s?.question),children:[G(M,{className:q(`cf-title`,s?.title),children:r.detailsLabel}),G(Mt,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:q(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?K(`section`,{className:q(`cf-question`,s?.question),children:[G(M,{className:q(`cf-title`,s?.title),children:`Attachments`}),K(`div`,{className:q(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&K(`div`,{className:q(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[m?K(`div`,{className:q(`cf-bug-report-media-preview`,s?.mediaPreview),children:[G(`img`,{src:m,alt:`Screenshot preview`,className:q(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),G(`div`,{className:q(`cf-bug-report-media-actions`,s?.mediaActions),children:G(k,{className:q(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:v,"aria-label":`Remove screenshot`,children:G(Kt,{})})})]}):G(k,{className:q(`cf-bug-report-button`,s?.button),onPress:_,isDisabled:h,children:h?`Capturing...`:`Screenshot`}),g&&G(`div`,{className:q(`cf-error`,s?.error),children:g})]}),r.enableRecording&&K(`div`,{className:q(`cf-bug-report-recording-section`,s?.recordingSection),children:[D.length>0?K(`div`,{className:q(`cf-bug-report-media-preview`,s?.mediaPreview),children:[G(be,{fallback:G(`span`,{className:q(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:G(Yt,{events:D})}),G(`div`,{className:q(`cf-bug-report-media-actions`,s?.mediaActions),children:G(k,{className:q(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:T,"aria-label":`Remove recording`,children:G(Kt,{})})})]}):G(k,{className:q(`cf-bug-report-button`,s?.button),onPress:C,children:`Record`}),x&&G(`div`,{className:q(`cf-error`,s?.error),children:x})]})]})]}):null,G($,{className:q(`cf-error`,s?.error),children:o})]})})},Zt=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[c,l]=U(``);return B(()=>{i(c)},[i,c]),K(Pt,{isRequired:o,isInvalid:!!s,name:e,className:q(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[K(`div`,{className:q(`cf-header`,a?.header),children:[K(M,{className:q(`cf-title`,a?.title),children:[t,!o&&K(`span`,{className:q(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,a?.description),children:n})]}),G(Mt,{className:q(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),G($,{className:q(`cf-error`,a?.error),children:s})]})},Qt=({children:e,classNames:t,description:n,...r})=>G(_t,{...r,children:({isIndeterminate:r})=>K(W,{children:[K(`div`,{className:q(`cf-choice-label`,t?.label),children:[G(`div`,{className:q(`cf-checkbox-indicator`,t?.indicator),children:G(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:q(`cf-checkbox-indicator-svg`,t?.svg),children:r?G(`rect`,{x:1,y:7.5,width:16,height:3}):G(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&G(`span`,{className:q(`cf-choice-description`,t?.choiceDescription),children:n})]})}),$t=({children:e,classNames:t,...n})=>G(_t,{...n,children:G(`div`,{className:q(`cf-tag-label`,t?.tagLabel),children:e})}),en=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let c=!!n.editable,l=n.display??`checkbox`,[u,d]=U([]),[f,p]=U(``),m=H(null),h=H(null),g=V(()=>{let e=u.indexOf(ee);if(e===-1)return u;let t=[...u];return t[e]=f||`__CONFETTI_CHECKBOX_Others`,t},[f,u]),_=l===`tag`;return B(()=>{i(g)},[i,g]),G(gt,{isRequired:o,isInvalid:!!s,name:a,value:u,onChange:d,className:q(`cf-question`,r?.question),children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(M,{className:q(`cf-title`,r?.title),children:[e,!o&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:t})]}),K(`div`,{className:q(`cf-response-choices`,l===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>G(_?$t:Qt,{className:q(`cf-choice`,_&&[`cf-tag`,r?.tag],!_&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),c&&(_?K(W,{children:[G($t,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:q(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),G(xt,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:f,onChange:e=>{p(e.target.value)},ref:h,className:q(`cf-input cf-tag-input`,r?.othersInput)})]}):K(`div`,{className:q(`cf-choice cf-others-choice`,r?.othersChoice),children:[G(Qt,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:q(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),G(xt,{value:f,onChange:e=>{p(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:h,onFocus:()=>{m.current?.checked===!1&&m.current.click()},className:q(`cf-input`,r?.othersInput)})]}))]}),G($,{className:q(`cf-error`,r?.error),children:s})]})})},tn=e=>K(`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:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),nn=e=>K(`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:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),rn=e=>K(`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:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),an=e=>K(`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:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),on=e=>K(`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:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),sn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:G(`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`})}),cn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:G(`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`})}),ln=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return G(`div`,{className:q(`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 G(kt,{className:q(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:G(o?cn:sn,{})},t)})})},un=({properties:e,classNames:t})=>G(`div`,{className:q(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return G(kt,{className:q(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),dn=({properties:e,classNames:t,state:n})=>{let r=V(()=>[tn,rn,an,on,nn],[]),i=V(()=>[rn,an,on],[]);return V(()=>e.scale===3||e.scale===5,[e.scale])?G(`div`,{className:q(`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 G(kt,{className:q(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&G(c,{})},a)})}):G(un,{properties:e,classNames:t,state:n})},fn=e=>{switch(e.properties.display??`star`){case`emoji`:return G(dn,{...e});case`number`:return G(un,{...e});case`star`:return G(ln,{...e})}},pn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=U(null),u=V(()=>c?Number(c):void 0,[c]);return B(()=>{i(u)},[i,u]),G(Ot,{isRequired:s,isInvalid:!!o,name:a,className:q(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(M,{className:q(`cf-title`,r?.title),children:[t,!s&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:n})]}),K(`div`,{className:q(`cf-rating-section`,r?.ratingSection),children:[G(fn,{state:i,properties:e,classNames:r}),K(`div`,{className:q(`cf-rating-text`,r?.ratingText),children:[G(`span`,{className:q(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),G(`span`,{className:q(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),G($,{className:q(`cf-error`,r?.error),children:o})]})})},mn=({classNames:e,className:t,description:n,...r})=>G(kt,{...r,className:q(t,e?.radio),children:s(r.children,t=>K(W,{children:[K(`div`,{className:q(`cf-choice-label`,e?.label),children:[G(`div`,{className:q(`cf-radio-indicator`,e?.indicator)}),t]}),n&&G(`span`,{className:q(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),hn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=U(null),[u,d]=U(``),f=!!n.editable,p=H(null),m=H(null),h=V(()=>c===`__CONFETTI_RADIO_Others`?u||`__CONFETTI_RADIO_Others`:c??void 0,[u,c]);return B(()=>{i(h)},[i,h]),G(Ot,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{m.current&&m.current.focus()})},value:c,className:q(`cf-question`,r?.question),children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(M,{className:q(`cf-title`,r?.title),children:[e,!o&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:t})]}),K(`div`,{className:q(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>G(mn,{classNames:{indicator:r?.indicator,radio:q(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),f&&K(`div`,{className:q(`cf-choice cf-others-choice`,r?.othersChoice),children:[G(mn,{inputRef:p,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:q(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),G(xt,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:m,value:u,onChange:e=>d(e.target.value),onFocus:()=>{p.current?.checked===!1&&p.current.click()},className:q(`cf-input`,r?.othersInput)})]})]}),G($,{className:q(`cf-error`,r?.error),children:s})]})})},gn=({properties:e,title:t,description:n,classNames:r})=>G(`div`,{className:q(`cf-question`,r?.question),children:K(`div`,{className:q(`cf-header`,r?.header),children:[t&&G(`div`,{className:q(`cf-title`,r?.title),children:t}),n&&G(`div`,{className:q(`cf-description`,r?.description),children:n})]})}),_n=({question:e,onChange:t,error:n,maskAllInputs:r})=>{switch(e.properties.type){case`rating`:return G(pn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return G(Zt,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return G(hn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return G(en,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return G(gn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return G(Xt,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r},e.id)}return G(`div`,{children:`Unsupported question type`},e.id)},vn=({onPress:e,isDisabled:t,children:n=`Submit`})=>se()?null:G(k,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),yn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},bn=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),xn=({onSubmit:t,children:n,question:r,isLastQuestion:i})=>{let[a,o]=U(yn(r.properties.type)),s=V(()=>De(r.properties,{required:r.required}),[r.properties,r.required]),c=V(()=>{let e=s.safeParse(a);if(!e.success)return Ee(e.error)},[a,s]),l=V(()=>{let t=r.routingLogic;if(t.type!==`always`&&!bn(a)&&r.required)return!0;let n=t.type===`always`?t.target:t.cases.find(t=>e({answer:a,condition:t}))?.target??t.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),u=V(()=>r.properties.buttonLabel?r.properties.buttonLabel:l?!r.required&&!bn(a)?`Skip`:`Next`:`Submit`,[a,l,r.properties.buttonLabel,r.required]),d=z(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=x.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return t(void 0);default:return t(a)}},[a,t,r.properties]),f=V(()=>{switch(r.properties.type){case`rating`:case`single-select`:return!!r.properties.shouldAutoProgress;default:return!1}},[r.properties]);return K(W,{children:[n({onChange:z(e=>{o(e),f&&bn(e)&&s.safeParse(e).success&&t(e)},[f,s,t]),question:r,error:c}),(!f||!r.required)&&G(vn,{isDisabled:!!c,onPress:d,children:u})]})},Sn=({isCompleted:e,onSubmit:t,children:n})=>K(W,{children:[n,e&&G(vn,{onPress:t})]}),Cn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:K(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[G(`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`}),G(`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`}),G(`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`}),G(`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`})]})}),wn=({onClick:e,isWidgetOpen:t,classNames:n,label:r=`Help us improve`})=>t?null:K(k,{onPress:e,className:q(`confetti-trigger`,n?.trigger),children:[G(`span`,{className:q(`confetti-trigger-icon-wrapper`,n?.iconWrapper),"aria-hidden":!0,children:G(Cn,{className:q(`confetti-trigger-icon`,n?.icon),width:24})}),G(`span`,{className:q(`confetti-trigger-label`,n?.label),children:r})]}),Tn=({trigger:e,children:t,publishableKey:n,surveyId:r})=>{let i=f(),[a,s]=U(!1),[c,l]=U(!1);if(!i.isVisible)return null;let u=()=>{s(!1)};return K(W,{children:[e({onClick:()=>s(!0),isWidgetOpen:a,hasSubmitted:c}),a&&G(o.Provider,{value:{...i,dismiss:()=>{i.dismiss(),u()},submit:async e=>{let t=await i.submit(e);return l(!0),t}},children:t({onDismiss:u,surveyId:r,publishableKey:n})})]})},En=({trigger:e=e=>G(wn,{...e}),children:t,...n})=>G(F,{fallback:G(W,{}),children:G(E,{...n,alwaysRenderChildren:!0,children:G(Tn,{trigger:e,surveyId:n.surveyId,publishableKey:n.publishableKey,children:t})})}),Dn=e=>G(F,{fallback:G(W,{}),children:G(T,{type:`embedded`,children:G(Ne,{...e,shouldAutoSubmit:!1,children:({questions:t,update:n,isCompleted:r,submit:i,isSubmitted:a,errors:o})=>a?G(Ft,{}):G(Sn,{onSubmit:i,isCompleted:r,children:t.filter(({visible:e})=>!!e).map(t=>G(_n,{question:t,error:o[t.id]||``,maskAllInputs:e.options?.bugReport?.maskAllInputs,onChange:e=>n({question:t.position,answer:e})},t.position))})})})}),On=({onDismiss:e,closeOnFinishMs:t,isDismissable:n,...r})=>G(F,{fallback:G(W,{}),children:G(T,{type:`modal`,children:G(E,{...r,children:G(he,{onDismiss:e,closeOnFinishMs:t,isDismissable:n,children:({setIsFinished:e})=>G(Me,{...r,shouldAutoSubmit:!1,onFinished:()=>{e(),r.onFinished?.()},children:({questions:e,update:t,isCompleted:n,errors:i,submit:a,isSubmitted:o})=>o?G(Ft,{}):G(Sn,{onSubmit:a,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>G(_n,{question:e,error:i[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),kn=({onDismiss:e,closeOnFinishMs:t,...n})=>G(F,{fallback:G(W,{}),children:G(T,{type:`popover`,children:G(E,{...n,children:G(It,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>G(Me,{shouldAutoSubmit:!0,...n,onFinished:()=>{e(),n.onFinished?.()},children:({current:e,questions:t,update:r,isSubmitted:i})=>{let a=e===t.length-1;if(i)return G(Ft,{});let o=t[e];return o?G(xn,{isLastQuestion:a,question:o,onSubmit:t=>r({question:e,answer:t}),children:e=>G(_n,{maskAllInputs:n.options?.bugReport?.maskAllInputs,...e})},o.id):G(W,{})}})})})})}),An=e=>G(Ne,{...e,shouldAutoSubmit:!0,children:({current:t,questions:n,update:r,isSubmitted:i})=>{let a=t===n.length-1;if(i)return G(Ft,{});let o=n[t];return o?G(xn,{isLastQuestion:a,question:o,onSubmit:e=>r({question:t,answer:e}),children:t=>G(_n,{maskAllInputs:e.options?.bugReport?.maskAllInputs,...t})},o.id):G(W,{})}}),jn=({delay:e})=>{let[t,n]=U(!1),r=V(()=>e,[]);return B(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},Mn=({visits:e,respondent:t})=>{let[n,r]=Ce(`cfti:${V(()=>window.location.pathname,[])}:visits:${t??``}`,0);return B(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:z(()=>r(0),[r])}},Nn=({visits:e,respondent:t})=>{let[n,r]=we(`cfti:${V(()=>window.location.pathname,[])}:visits:${t??``}`,0);return B(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:z(()=>r(0),[r])}},Pn=({threshold:e})=>{let[t,n]=U(()=>typeof window>`u`?!1:window.scrollY>=e);return B(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{me as CloseButton,Ne as Confetti,o as ConfettiContext,Me as ConfettiController,E as ConfettiProvider,En as ConfettiTrigger,Cn as ConfettiTriggerIcon,wn as DefaultConfettiTrigger,Sn as Embed,Dn as EmbeddedConfetti,xn as Flow,Zt as FreeText,On as ModalConfetti,he as ModalContainer,en as MultiChoice,kn as PopoverConfetti,It as PopoverContainer,pn as Rating,hn as SingleChoice,gn as Statement,An as StepperConfetti,_n as SurveyQuestionFactory,Ft as ThankYouMessage,f as useConfetti,jn as useVisibleAfterDelay,Mn as useVisibleAfterPageVisits,Pn as useVisibleAfterScroll,Nn as useVisibleAfterSessionPageVisits};
|
package/build/internals.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { t as Answer, u as BinaryOperatorCondition } from "./types-
|
|
1
|
+
import { t as Answer, u as BinaryOperatorCondition } from "./types-CJY8TUUa.js";
|
|
2
2
|
import { z } from "zod/mini";
|
|
3
3
|
|
|
4
4
|
//#region src/core/logic/routing.d.ts
|
|
5
|
-
|
|
6
5
|
declare const evaluateCondition: ({
|
|
7
6
|
answer,
|
|
8
7
|
condition
|
package/build/internals.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as i}from"./internals-
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./internals-B5GhpjgM.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};
|