@opengovsg/confetti 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,13 +27,7 @@ npm install react@^18.2.0
27
27
 
28
28
  ## Quick Start
29
29
 
30
- 1. Import the CSS file in your application entry point:
31
-
32
- ```tsx
33
- import '@opengovsg/confetti/confetti.css'
34
- ```
35
-
36
- 2. Add the widget to your page:
30
+ 1. Add the widget to your page:
37
31
 
38
32
  ```tsx
39
33
  import { PopoverConfetti } from '@opengovsg/confetti'
@@ -51,24 +45,61 @@ function App() {
51
45
  }
52
46
  ```
53
47
 
48
+ The template components load their script bundle and stylesheet from the
49
+ Confetti CDN at runtime, so there's **no CSS to import** — including the
50
+ host-rendered trigger button, which `TriggerPopoverConfetti` styles itself. (The
51
+ lower-level [`@opengovsg/confetti/components`](#building-blocks) primitives and
52
+ the `@opengovsg/confetti/static` opt-out surface render in your own bundle and
53
+ still require `import '@opengovsg/confetti/confetti.css'`.)
54
+
54
55
  > **Note:** You'll need the survey ID and publishable key from your Confetti dashboard. Make sure to whitelist your domain in your team settings.
55
56
 
56
- 3. Add Confetti to your CSP headers:
57
+ 2. Add Confetti to your CSP headers. The widget loads its script and stylesheet from the CDN and calls the API, so allowlist all three:
57
58
 
58
59
  ```
60
+ script-src https://confetti.gov.sg;
61
+ style-src https://confetti.gov.sg;
59
62
  connect-src https://confetti.gov.sg;
60
63
  ```
61
64
 
65
+ ### Proxying requests
66
+
67
+ Every template component accepts an optional `proxyUrl`. When set, the widget
68
+ sends its API requests to `{proxyUrl}/api/v1/cfti/...` instead of
69
+ `https://confetti.gov.sg`, and the CDN-backed shells also load their script
70
+ and stylesheet from `{proxyUrl}/widget/v1/...`. Use this to route widget
71
+ traffic through your own origin, for example when your CSP disallows third
72
+ party hosts.
73
+
62
74
  ## Template Components
63
75
 
64
76
  Choose the component that best fits your use case:
65
77
 
66
- | Component | Use Case | Behavior |
67
- | ------------------ | --------------------------------- | ------------------------------------------------------------ |
68
- | `EmbeddedConfetti` | Inline surveys, feedback sections | Shows questions in an inline manner with a submit button |
69
- | `ModalConfetti` | Interruptive, centered surveys | Centered modal overlay, step-by-step questions, auto-submits |
70
- | `PopoverConfetti` | Floating feedback widgets | Dismissible popover, step-by-step questions, auto-submits |
71
- | `StepperConfetti` | Guided surveys | One question at a time, auto-submits after last question |
78
+ | Component | Use Case | Behavior |
79
+ | ------------------------ | --------------------------------- | ------------------------------------------------------------------------------------- |
80
+ | `EmbeddedConfetti` | Inline surveys, feedback sections | Shows questions in an inline manner with a submit button |
81
+ | `ModalConfetti` | Interruptive, centered surveys | Centered modal overlay, step-by-step questions, auto-submits |
82
+ | `PopoverConfetti` | Floating feedback widgets | Dismissible popover, step-by-step questions, auto-submits |
83
+ | `TriggerPopoverConfetti` | Feedback launcher button | Renders a trigger button that opens a dismissible popover survey on click; reopenable |
84
+ | `StepperConfetti` | Guided surveys | One question at a time, auto-submits after last question |
85
+
86
+ ## Static Components
87
+
88
+ The `@opengovsg/confetti/static` subpath ships self-contained builds of the
89
+ same template components (`EmbeddedConfetti`, `ModalConfetti`,
90
+ `PopoverConfetti`, `StepperConfetti`) plus the `ConfettiTrigger` composition
91
+ helper. They render entirely from your own bundle with no runtime CDN
92
+ dependency, so survey rendering updates only reach your site when you upgrade
93
+ the package.
94
+
95
+ ```tsx
96
+ import '@opengovsg/confetti/confetti.css'
97
+
98
+ import { PopoverConfetti } from '@opengovsg/confetti/static'
99
+ ```
100
+
101
+ Unlike the CDN-backed shells, the static components require the stylesheet
102
+ import shown above.
72
103
 
73
104
  ## Visibility Hooks
74
105
 
@@ -123,9 +154,16 @@ The lower-level primitives that power the [template components](#template-compon
123
154
 
124
155
  ```tsx
125
156
  import {
126
- ConfettiContext,
127
157
  ConfettiController,
128
158
  ConfettiProvider,
129
- useConfetti,
159
+ SurveyContext,
160
+ useSurvey,
130
161
  } from '@opengovsg/confetti/components'
131
162
  ```
163
+
164
+ Unlike the template components, these primitives render in your own bundle, so
165
+ import the stylesheet once in your app entry point:
166
+
167
+ ```tsx
168
+ import '@opengovsg/confetti/confetti.css'
169
+ ```
@@ -0,0 +1,7 @@
1
+ import e,{createContext as t,forwardRef as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"ky";import{z as u}from"zod/v4/mini";import d from"clsx";import"react-dom";const f=l.create({prefixUrl:`https://confetti.gov.sg`,retry:{limit:3,methods:[`get`,`head`]},timeout:6e4});function p({publishableKey:e,apiBaseUrl:t}){return o(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),f.extend(n)},[t,e])}const m=u.object({type:u.literal(`next`)}),h=u.object({type:u.literal(`end`)}),g=u.object({type:u.literal(`jump`),target:u.number({error:`Target question is required`})}),_=u.discriminatedUnion(`type`,[m,g,h]),v=u.object({type:u.literal(`value`),value:u.union([u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),u.number({error:`Value is required`})])}),y=u.object({type:u.literal(`binary-operator`),operator:u.union([u.literal(`equal`),u.literal(`not-equal`),u.literal(`greater`),u.literal(`greater-or-equal`),u.literal(`less`),u.literal(`less-or-equal`),u.literal(`contains`),u.literal(`not-contains`)]),value:v,target:_}),b=u.object({type:u.literal(`switch`),cases:u.array(y),default:_}),x=u.object({type:u.literal(`always`),target:_}),S=u.discriminatedUnion(`type`,[x,b]),C=u.string().check(u.trim(),u.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),w=u.optional(u.string().check(u.trim(),u.maxLength(50))),T=u.object({value:u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),description:u.optional(u.string().check(u.trim()))}),E=u.nullable(u.object({label:u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),max:u.number(),description:u.optional(u.string().check(u.trim()))})),D=u.optional(u.boolean()),ee=u.object({type:u.literal(`rating`),buttonLabel:w,shouldAutoProgress:D,scale:u.number().check(u.minimum(2),u.maximum(10)),labels:u.optional(u.object({lower:u.optional(u.pipe(u.string().check(u.trim()),u.transform(e=>e===``?void 0:e))),upper:u.optional(u.pipe(u.string().check(u.trim()),u.transform(e=>e===``?void 0:e)))})),display:u.optional(u.literal([`star`,`emoji`,`number`]))}),O=u.object({type:u.literal(`open-ended`),placeholder:u.optional(u.string()),buttonLabel:w,max:u.number()}),te=u.object({type:u.literal(`single-select`),shouldAutoProgress:D,options:u.array(T),buttonLabel:w,editable:E}),k=u.object({type:u.literal(`multi-select`),buttonLabel:w,options:u.array(T),editable:E,max:u.optional(u.number()),display:u.optional(u.literal([`checkbox`,`tag`]))}),ne=u.object({type:u.literal(`statement`),buttonLabel:w,buttonUrl:u.optional(C)}),re=u.object({type:u.literal(`bug-report`),placeholder:u.optional(u.string()),buttonLabel:w,enableScreenshot:u.boolean(),enableRecording:u.boolean(),detailsLabel:u.string().check(u.trim(),u.minLength(1,{error:`Label is required`}),u.maxLength(128)),detailsPlaceholder:u.optional(u.string()),redactClasses:u.optional(u.array(u.string()))}),ie=u.discriminatedUnion(`type`,[ee,te,O,k,ne,re]),ae=`__CONFETTI_CHECKBOX_Others`,oe=`__CONFETTI_RADIO_Others`,se=u.optional(u.catchall(u.partial(u.looseObject({userAgent:u.string().check(u.trim(),u.maxLength(1e3)),screenResolution:u.string().check(u.trim(),u.maxLength(100)),viewportSize:u.string().check(u.trim(),u.maxLength(100)),pageUrl:u.string(),pageTitle:u.string().check(u.trim(),u.maxLength(1e3)),referrer:u.string(),datadogTraceId:u.optional(u.string()),datadogSessionId:u.optional(u.string()),datadogSessionReplayLink:u.optional(u.string())})),u.optional(u.string())));u.cuid2();const ce=u.looseObject({type:u.literal([0,1,2,3,4,5,6]),data:u.unknown(),timestamp:u.number(),delay:u.optional(u.number())});u.array(ce);const le=u.array(ce),ue=u.string().check(u.refine(e=>{try{return le.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),de=u.string().check(u.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),fe=e=>u.object({title:u.string().check(u.trim(),...e?[u.minLength(1,{error:`Title is required`})]:[],u.maxLength(256)),description:u.optional(u.string().check(u.trim(),u.maxLength(4096))),screenshotDataUrl:u.optional(de),recordingEventsJson:u.optional(ue),metadata:se}),pe=fe(!0),me=(e,{required:t})=>fe(t),he=e=>u.number().check(u.int(),u.minimum(1),u.maximum(e)),ge=({scale:e},{required:t})=>{let n=he(e);return t?n:u.optional(n)},_e=({maxLength:e},{required:t})=>u.string().check(u.trim(),...t?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ve=(e,t)=>u.string().check(u.trim(),...t?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),u.refine(e=>e!==oe,{error:`Please fill out the free text field`})),ye=({maxLength:e},{required:t})=>{let n=ve(e,t);return t?n:u.optional(n)},be=({maxSelected:e,maxLength:t},{required:n})=>u.array(u.string().check(u.trim(),...n?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),u.refine(e=>e!==ae,{error:`Please fill out the free text field`}))).check(...n?[u.minLength(1,{error:`Please select at least one option`})]:[],u.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),xe=()=>u.optional(u.string()),Se=u.cuid2(),Ce=u.object({title:u.string().check(u.trim()),description:u.string().check(u.trim()),buttonText:u.string().check(u.trim())}),we=u.object({title:u.string(),description:u.nullable(u.string()),questions:u.array(u.object({id:u.string(),title:u.string(),description:u.nullable(u.string()),position:u.number(),required:u.boolean(),properties:ie,routingLogic:S})),confirmation:Ce});u.object({surveyId:Se,responseId:u.union([u.cuid2(),u.uuid()])});const Te=u.catch(u.partial(u.object({type:u.enum([`embedded`,`popover`,`modal`]),version:u.string().check(u.trim(),u.minLength(1),u.maxLength(50)),build:u.string().check(u.trim(),u.minLength(1),u.maxLength(50))})),{});u.object({respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048)),data:u.record(u.string(),u.union([u.string().check(u.trim(),u.maxLength(2048)),u.number(),u.array(u.string().check(u.trim(),u.maxLength(2048))).check(u.maxLength(1024)),pe])),metadata:u.record(u.string().check(u.trim(),u.maxLength(1e3)),u.string().check(u.trim(),u.maxLength(1e3))),telemetry:u.optional(Te)}),u.object({surveyId:Se,respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048))}),u.object({surveyId:Se,respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048))}),u.object({surveyId:Se});const Ee=u.object({lastRespondedAt:u.nullable(u.union([u.iso.datetime(),u.date()])),lastViewedAt:u.nullable(u.union([u.iso.datetime(),u.date()])),lastDismissedAt:u.nullable(u.union([u.iso.datetime(),u.date()]))});u.object({type:u.enum([`view`,`dismiss`])});function De(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Oe(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function A(e){let t=null;return()=>(t??=e(),t)}const j=A(function(){return Oe(/^Mac/i)}),ke=A(function(){return Oe(/^iPhone/i)}),Ae=A(function(){return Oe(/^iPad/i)||j()&&navigator.maxTouchPoints>1}),je=A(function(){return ke()||Ae()}),Me=A(function(){return De(/AppleWebKit/i)&&!Ne()}),Ne=A(function(){return De(/Chrome/i)}),Pe=A(function(){return De(/Android/i)}),Fe=A(function(){return De(/Firefox/i)});function M(e){if(Ie())e.focus({preventScroll:!0});else{let t=Le(e);e.focus(),Re(t)}}let N=null;function Ie(){if(N==null){N=!1;try{document.createElement(`div`).focus({get preventScroll(){return N=!0,!0}})}catch{}}return N}function Le(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function Re(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function P(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;Fe()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(j()?r=!0:i=!0);let s=Me()&&j()&&!Ae()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});P.isOpening=n,M(e),e.dispatchEvent(s),P.isOpening=!1}P.isOpening=!1;const F=typeof document<`u`?e.useLayoutEffect:()=>{},ze={prefix:String(Math.round(Math.random()*1e10)),current:0},Be=e.createContext(ze),Ve=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let He=new WeakMap;function Ue(t=!1){let n=i(Be),r=s(null);if(r.current===null&&!t){let t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(t){let e=He.get(t);e==null?He.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,He.delete(t))}r.current=++n.current}return r.current}function We(e){let t=i(Be),n=Ue(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function Ge(t){let n=e.useId(),[r]=c(Xe()),i=r?`react-aria`:`react-aria${ze.prefix}`;return t||`${i}-${n}`}const Ke=typeof e.useId==`function`?Ge:We;function qe(){return!1}function Je(){return!0}function Ye(e){return()=>{}}function Xe(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore(Ye,qe,Je):i(Ve)}function Ze(e){let[t,n]=c(e),i=s(t),a=s(null),o=s(()=>{if(!a.current)return;let e=a.current.next();if(e.done){a.current=null;return}i.current===e.value?o.current():n(e.value)});return F(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let Qe=!!(typeof window<`u`&&window.document&&window.document.createElement),I=new Map,L;typeof FinalizationRegistry<`u`&&(L=new FinalizationRegistry(e=>{I.delete(e)}));function $e(e){let[t,n]=c(e),r=s(null),i=Ke(t),o=s(null);if(L&&L.register(o,i),Qe){let e=I.get(i);e&&!e.includes(r)?e.push(r):I.set(i,[r])}return F(()=>{let e=i;return()=>{L&&L.unregister(o),I.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function et(e,t){if(e===t)return e;let n=I.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=I.get(t);return r?(r.forEach(t=>t.current=e),e):t}function tt(e=[]){let t=$e(),[n,i]=Ze(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return F(a,[t,a,...e]),n}function nt(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const R=e=>e?.ownerDocument??document,z=e=>e&&`window`in e&&e.window===e?e:R(e).defaultView||window;function rt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function it(e){return rt(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function B(){return!1}function V(e,t){if(!B())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:it(n)?n.host:n.parentNode}return!1}const H=(e=document)=>{if(!B())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function U(e){if(B()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function at(e){if(!e)return!1;let t=e.getRootNode(),n=z(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}function W(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=ot(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():ot(e[n],null)})}}}function ot(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function G(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=nt(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=d(n,i):e===`id`&&n&&i?t.id=et(n,i):e===`ref`&&n&&i?t.ref=W(n,i):t[e]=i===void 0?n:i}}return t}const st=new Set([`id`]),ct=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),lt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),ut=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),dt=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),ft=/^(data-.*)$/;function pt(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(st.has(t)||n&&ct.has(t)||r&&lt.has(t)||i&&ut.has(t)||a&&(dt.has(t)||t.endsWith(`Capture`)&&dt.has(t.slice(0,-7)))||o?.has(t)||ft.test(t))&&(s[t]=e[t]);return s}let K=new Map,mt=new Set;function ht(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=U(t);if(!e(t)||!r)return;let i=K.get(r);i||(i=new Set,K.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=U(t);if(!e(t)||!r)return;let i=K.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),K.delete(r)),K.size===0)){for(let e of mt)e();mt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,ht):ht());function gt(){for(let[e]of K)`isConnected`in e&&!e.isConnected&&K.delete(e)}function _t(e){requestAnimationFrame(()=>{gt(),K.size===0?e():mt.add(e)})}function vt(){let e=s(new Map),t=r((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=r((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),i=r(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a(()=>i,[i]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:i}}function yt(e){let t=s(null),n=s(void 0),i=r(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}else if(e)return e.current=t,()=>{e.current=null}},[e]);return o(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=i(e))}}),[i])}const bt=e.useInsertionEffect??F;function xt(e){let t=s(null);return bt(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}function St(e,t){F(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Ct(e){return e.pointerType===``&&e.isTrusted?!0:Pe()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function wt(e){return!Pe()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}const Tt=typeof Element<`u`&&`checkVisibility`in Element.prototype;function Et(e){let t=z(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function Dt(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function Ot(e,t){return Tt?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&Et(e)&&Dt(e,t)&&(!e.parentElement||Ot(e.parentElement,e))}const kt=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable^="false"])`,`permission`],At=kt.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;kt.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const jt=kt.join(`:not([hidden]):not([tabindex="-1"]),`);function Mt(e,t){return e.matches(At)&&!Pt(e)&&(t?.skipVisibilityCheck||Ot(e))}function Nt(e){return e.matches(jt)&&Ot(e)&&!Pt(e)}function Pt(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Ft(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let It=new WeakMap;function Lt(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Ft(t);if(It.has(t))return It.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof z(n).HTMLMetaElement&&(n.nonce||n.content)||Ft(t)||void 0;return r!==void 0&&It.set(t,r),r}const Rt=Symbol(`default`);function zt({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function Bt(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:s,values:c,render:l}=e;return o(()=>{let e,o,u;return e=typeof t==`function`?t({...c,defaultClassName:i}):t,o=typeof n==`function`?n({...c,defaultStyle:s||{}}):n,u=typeof r==`function`?r({...c,defaultChildren:a}):r??a,{className:e??i,style:o||s?{...s,...o}:void 0,children:u??a,"data-rac":``,render:l?e=>l(e,c):void 0}},[t,n,r,i,a,s,c,l])}function Vt(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function Ht(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Rt;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:`A slot prop is required.`;throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function Ut(e,t,n){let{ref:r,...i}=Ht(n,e.slot)||{},a=yt(o(()=>W(t,r),[t,r])),s=G(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?s.style=t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:s.style={...i.style,...e.style}),[s,a]}function Wt(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return F(()=>{i.current||n(!1)},[]),[a,t]}function Gt(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function Kt(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>W(r,c),[r,c]);F(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const qt={},Jt=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=qt[t];return r||(r=n(Kt.bind(null,t)),qt[t]=r),r}});function Yt(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Xt(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Zt(e){let t=s({isFocused:!1,observer:null});return F(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=U(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=Yt(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===H()?null:H();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let Qt=!1;function $t(e){for(;e&&!Mt(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=z(e),n=t.document.activeElement;if(!n||n===e)return;Qt=!0;let r=!1,i=e=>{(U(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(U(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,M(n),c()))},o=t=>{(U(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(U(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,M(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),Qt=!1,r=!1},l=requestAnimationFrame(c);return c}let q=`default`,en=``,tn=new WeakMap;function nn(e){if(je()){if(q==="default"){let t=R(e);en=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}q=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;tn.set(e,e.style[t]),e.style[t]=`none`}}function rn(e){if(je()){if(q!==`disabled`)return;q=`restoring`,setTimeout(()=>{_t(()=>{if(q===`restoring`){let t=R(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=en||``),en=``,q=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&tn.has(e)){let t=tn.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),tn.delete(e)}}const an=e.createContext({register:()=>{}});an.displayName=`PressResponderContext`;function on(e){let t=i(an);if(t){let{register:n,ref:r,...i}=t;e=G(i,e),n()}return St(t,e.ref),e}var sn=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}};const cn=Symbol(`linkClicked`),ln=`react-aria-pressable-style`,un=`data-react-aria-pressable`;function dn(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=on(e),[y,b]=c(!1),x=s({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=vt(),w=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new sn(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,b(!0),a},[f,i,n]),T=r((e,r,i=!0)=>{let a=x.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let o=!0;if(l){let t=new sn(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&i&&!f){let n=new sn(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),E=xt(T),D=xt(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new sn(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),ee=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(J(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||rn(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,T]),O=xt(ee),te=r(e=>{h&&ee(e)},[h,ee]),k=r(e=>{f||d?.(e)},[f,d]),ne=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);Xt(n,t),d(Yt(n))}},[f,d]),re=o(()=>{let e=x.current,t={onKeyDown(t){if(pn(t.nativeEvent,t.currentTarget)&&V(t.currentTarget,U(t))){hn(U(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=w(t,`keyboard`));let i=t.currentTarget;S(R(t.currentTarget),`keyup`,nt(t=>{pn(t,i)&&!t.repeat&&V(i,U(t))&&e.target&&D(J(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&j()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!V(t.currentTarget,U(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!P.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ct(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);k(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(J(t.currentTarget,t),r),a=E(J(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,k(t),O(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&pn(t,e.target)){hn(U(t),t.key)&&t.preventDefault();let n=U(t),r=V(e.target,n);E(J(e.target,t),`keyboard`,r),r&&ne(t,e.target),C(),t.key!==`Enter`&&fn(e.target)&&V(e.target,n)&&!t[cn]&&(t[cn]=!0,P(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())e.target?.dispatchEvent(new KeyboardEvent(`keyup`,n))}};if(typeof PointerEvent<`u`){t.onPointerDown=t=>{if(t.button!==0||!V(t.currentTarget,U(t)))return;if(wt(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||nn(e.target),i=w(t,e.pointerType);let a=U(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(R(t.currentTarget),`pointerup`,n,!1),S(R(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(V(t.currentTarget,U(t))&&t.button===0){if(m){let n=$t(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!V(t.currentTarget,U(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&D(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(J(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(J(e.target,t),e.pointerType,!1),te(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(V(e.target,U(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?O(t):(M(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else O(t);e.isOverTarget=!1}},r=e=>{O(e)};t.onDragStart=e=>{V(e.currentTarget,U(e))&&O(e)}}return t},[S,f,m,C,g,te,w,k,ne]);return a(()=>{if(!_)return;let e=R(_.current);if(!e||!e.head||e.getElementById(ln))return;let t=e.createElement(`style`);t.id=ln;let n=Lt(e);n&&(t.nonce=n),t.textContent=`
2
+ @layer {
3
+ [${un}] {
4
+ touch-action: pan-x pan-y pinch-zoom;
5
+ }
6
+ }
7
+ `.trim(),e.head.prepend(t)},[_]),a(()=>{let e=x.current;return()=>{g||rn(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:G(v,re,{[un]:!0})}}function fn(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function pn(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof z(i).HTMLInputElement&&!_n(i,n)||i instanceof z(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&fn(i))&&n!==`Enter`)}function J(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function mn(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!fn(e)}function hn(e,t){return e instanceof HTMLInputElement?!_n(e,t):mn(e)}const gn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function _n(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:gn.has(e.type)}let Y=null;const vn=new Set;let X=new Map,Z=!1,yn=!1;const bn={Tab:!0,Escape:!0};function xn(e,t){for(let n of vn)n(e,t)}function Sn(e){return!(e.metaKey||!j()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Cn(e){Z=!0,!P.isOpening&&Sn(e)&&(Y=`keyboard`,xn(`keyboard`,e))}function Q(e){Y=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(Z=!0,xn(`pointer`,e))}function wn(e){!P.isOpening&&Ct(e)&&(Z=!0,Y=`virtual`)}function Tn(e){let t=z(U(e)),n=R(U(e));U(e)===t||U(e)===n||Qt||!e.isTrusted||(!Z&&!yn&&(Y=`virtual`,xn(`virtual`,e)),Z=!1,yn=!1)}function En(){Qt||(Z=!1,yn=!0)}function Dn(e){if(typeof window>`u`||typeof document>`u`)return;let t=z(e),n=R(e);if(X.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Z=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Cn,!0),n.addEventListener(`keyup`,Cn,!0),n.addEventListener(`click`,wn,!0),t.addEventListener(`focus`,Tn,!0),t.addEventListener(`blur`,En,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Q,!0),n.addEventListener(`pointermove`,Q,!0),n.addEventListener(`pointerup`,Q,!0)),t.addEventListener(`beforeunload`,()=>{On(e)},{once:!0}),X.set(t,{focus:r})}const On=(e,t)=>{let n=z(e),r=R(e);t&&r.removeEventListener(`DOMContentLoaded`,t),X.has(n)&&(n.HTMLElement.prototype.focus=X.get(n).focus,r.removeEventListener(`keydown`,Cn,!0),r.removeEventListener(`keyup`,Cn,!0),r.removeEventListener(`click`,wn,!0),n.removeEventListener(`focus`,Tn,!0),n.removeEventListener(`blur`,En,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Q,!0),r.removeEventListener(`pointermove`,Q,!0),r.removeEventListener(`pointerup`,Q,!0)),X.delete(n))};function kn(e){let t=R(e),n;return t.readyState===`loading`?(n=()=>{Dn(e)},t.addEventListener(`DOMContentLoaded`,n)):Dn(e),()=>On(e,n)}typeof document<`u`&&kn();function An(){return Y!==`pointer`}function jn(){return Y}function Mn(e){Y=e,xn(e,null)}const Nn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Pn(e,t,n){let r=n?U(n):void 0,i=R(r),a=z(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=H(i);return e=e||u instanceof o&&!Nn.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!bn[n.key])}function Fn(e,t,n){Dn(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Pn(!!n?.isTextInput,t,r)&&e(An())};return vn.add(t),()=>{vn.delete(t)}},t)}function In(e){if(!e.isConnected)return;let t=R(e);if(jn()===`virtual`){let n=H(t);_t(()=>{let r=H(t);(r===n||r===t.body)&&e.isConnected&&M(e)})}else M(e)}function Ln(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(U(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=Zt(o),c=r(e=>{let t=U(e),r=R(t),i=r?H(r):H();t===e.currentTarget&&t===i&&(n&&n(e),a&&a(!0),s(e))},[a,n,s]);return{focusProps:{onFocus:!t&&(n||a||i)?c:void 0,onBlur:!t&&(i||a)?o:void 0}}}function Rn(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function zn(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Rn(e.onKeyDown),onKeyUp:Rn(e.onKeyUp)}}}let Bn=e.createContext(null);function Vn(e){let t=i(Bn)||{};St(t,e);let{ref:n,...r}=t;return r}function Hn(e,t){let{focusProps:n}=Ln(e),{keyboardProps:r}=zn(e),i=G(n,r),o=Vn(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&In(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:G({...i,tabIndex:u},c)}}function Un(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=vt(),u=r(e=>{V(e.currentTarget,U(e))&&o.current.isFocusWithin&&!V(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=Zt(u),f=r(e=>{if(!V(e.currentTarget,U(e)))return;let t=U(e),n=R(t),r=H(n);if(!o.current.isFocusWithin&&r===t){i&&i(e),a&&a(!0),o.current.isFocusWithin=!0,d(e);let t=e.currentTarget;c(n,`focus`,e=>{let r=U(e);if(o.current.isFocusWithin&&!V(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});Xt(e,t),u(Yt(e))}},{capture:!0})}},[i,a,d,c,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:u}}}function Wn(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||An()}),[o,l]=c(!1),[u,d]=c(()=>a.current.isFocused&&a.current.isFocusVisible),f=r(()=>d(a.current.isFocused&&a.current.isFocusVisible),[]),p=r(e=>{a.current.isFocused=e,a.current.isFocusVisible=An(),l(e),f()},[f]);Fn(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=Ln({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=Un({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let Gn=!1,Kn=0;function qn(){Gn=!0,setTimeout(()=>{Gn=!1},500)}function Jn(e){e.pointerType===`touch`&&qn()}function Yn(){let e=R(null);if(e!==void 0)return Kn===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,Jn),Kn++,()=>{Kn--,!(Kn>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,Jn)}}function Xn(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[l,u]=c(!1),d=s({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;a(Yn,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=vt(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!V(e.currentTarget,U(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(R(U(e)),`pointerover`,e=>{d.isHovered&&d.target&&!V(d.target,U(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:o,pointerType:r}),n&&n(!0),u(!0)},a=(e,t)=>{let i=d.target;d.pointerType=``,d.target=null,!(t===`touch`||!d.isHovered||!i)&&(d.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),u(!1))},o={};return typeof PointerEvent<`u`&&(o.onPointerEnter=t=>{Gn&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&V(e.currentTarget,U(e))&&a(e,e.pointerType)}),{hoverProps:o,triggerHoverEnd:a}},[t,n,r,i,d,f,p]);return a(()=>{i&&h({currentTarget:d.target},d.pointerType)},[i]),{hoverProps:m,isHovered:l}}typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const Zn=t(!1);function Qn(e){let t=(t,n)=>i(Zn)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}function $n(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=dn({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Hn(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=G(y,_,pt(e,{labelable:!0}));return{isPressed:v,buttonProps:G(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}const er=t({}),tr=Qn(function(t,n){[t,n]=Ut(t,n,er);let{elementType:r=`label`,...i}=t,a=Jt[r];return e.createElement(a,{className:`react-aria-Label`,...i,ref:n})}),nr=t(null),rr=7e3;let $=null;function ir(e,t=`assertive`,n=rr){$?$.announce(e,t,n):($=new ar,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var ar=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=rr){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const or=t({}),sr=Qn(function(t,n){[t,n]=Ut(t,n,or);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=$n(t,n);o=lr(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=Wn(t),{hoverProps:f,isHovered:p}=Xn({...t,isDisabled:t.isDisabled||i}),m={isHovered:p,isPressed:(r.isPressed||c)&&!i,isFocused:u,isFocusVisible:d,isDisabled:t.isDisabled||!1,isPending:i??!1},h=Bt({...t,values:m,defaultClassName:`react-aria-Button`}),g=$e(o.id),_=$e(),v=o[`aria-labelledby`];i&&(v?v=`${v} ${_}`:o[`aria-label`]&&(v=`${g} ${_}`));let y=s(i);a(()=>{let e={"aria-labelledby":v||g};(!y.current&&u&&i||y.current&&u&&!i)&&ir(e,`assertive`),y.current=i},[i,u,v,g]);let b=pt(t,{global:!0});return delete b.onClick,e.createElement(Jt.button,{...G(b,h,o,l,f),type:o.type===`submit`&&i?`button`:o.type,id:g,ref:n,"aria-labelledby":v,slot:t.slot||void 0,"aria-disabled":i?`true`:o[`aria-disabled`],"data-disabled":t.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":u||void 0,"data-pending":i||void 0,"data-focus-visible":d||void 0},e.createElement(nr.Provider,{value:{id:_}},h.children))}),cr=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function lr(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!cr.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{ye as $,G as A,tt as B,Ht as C,xt as D,Nt as E,U as F,Pe as G,Xe as H,B as I,we as J,je as K,R as L,V as M,at as N,yt as O,H as P,ge as Q,z as R,Gt as S,Mt as T,F as U,$e as V,Ne as W,be as X,me as Y,_e as Z,Bt as _,Qn as a,Rt as b,Un as c,jn as d,xe as et,Mn as f,Ut as g,zt as h,tr as i,p as it,W as j,pt as k,Hn as l,an as m,sr as n,oe as nt,Xn as o,dn as p,Ee as q,er as r,C as rt,Wn as s,or as t,ae as tt,In as u,Wt as v,Lt as w,Jt as x,Vt as y,nt as z};
@@ -0,0 +1,205 @@
1
+ import { a as Finishable, c as Question$1, r as ConfettiState, t as Answer, u as PublicGetSurveyOutput } from "./types-Sf4fgrFJ.js";
2
+ import { PropsWithChildren } from "react";
3
+
4
+ //#region src/core/ConfettiController.d.ts
5
+ interface ConfettiControllerProps extends Finishable {
6
+ children: (props: ConfettiState) => React.ReactElement;
7
+ /**
8
+ * Control the current question index that is being displayed.
9
+ * If not provided, the component will manage it internally.
10
+ */
11
+ current?: number;
12
+ shouldAutoSubmit?: boolean;
13
+ /**
14
+ * Invoked synchronously when the user submits and the Thank-You view is
15
+ * shown. Fires before the submission network call settles, unlike
16
+ * `onFinished` which fires after it.
17
+ */
18
+ onSubmitted?: () => void;
19
+ }
20
+ declare const ConfettiController: ({
21
+ current: currentProp,
22
+ shouldAutoSubmit,
23
+ onSubmitted,
24
+ onFinished,
25
+ children
26
+ }: ConfettiControllerProps) => import("react").JSX.Element;
27
+ //#endregion
28
+ //#region src/contracts/state.d.ts
29
+ interface ConfettiRespondentState {
30
+ lastRespondedAt: Date | null;
31
+ lastDismissedAt: Date | null;
32
+ }
33
+ //#endregion
34
+ //#region src/core/logic/is-visible.d.ts
35
+ type IsSurveyVisible = boolean | ((s: ConfettiRespondentState) => boolean) | undefined;
36
+ //#endregion
37
+ //#region src/core/SurveyProvider.d.ts
38
+ interface SurveyContextValue {
39
+ surveyId: string;
40
+ metadata: Record<string, string>;
41
+ submit: ({
42
+ answers
43
+ }: {
44
+ answers: Record<Question$1['id'], Answer>;
45
+ }) => Promise<void>;
46
+ dismiss: () => Promise<void> | void;
47
+ survey: PublicGetSurveyOutput | undefined;
48
+ }
49
+ /**
50
+ * Carries the fetched survey and the submit and dismiss actions. Provide a
51
+ * value directly to render building blocks against a preloaded survey. A
52
+ * SurveyProvider mounted beneath an existing value reuses it instead of
53
+ * fetching.
54
+ */
55
+ declare const SurveyContext: import("react").Context<SurveyContextValue | null>;
56
+ interface SurveyProviderProps extends PropsWithChildren {
57
+ /** Identifier of the published survey to load. */
58
+ surveyId: string;
59
+ /** Publishable API key that authorises read access to the survey. */
60
+ publishableKey: string;
61
+ /**
62
+ * Identifies who the survey is shown to and tracked against. The widget
63
+ * tracks a respondent's response and dismissal history, which
64
+ * `isSurveyVisible` receives, so the value chosen sets how narrowly the
65
+ * survey is targeted. Pass a stable user identifier to target a person,
66
+ * an event identifier on its own to target an event, or a composite such
67
+ * as `{User ID}-{Event ID}` to target a person for a specific event.
68
+ */
69
+ respondent: string;
70
+ /**
71
+ * Arbitrary key value pairs stored alongside the response. Use it to attach
72
+ * application, environment, or user context.
73
+ */
74
+ metadata?: Record<string, string>;
75
+ apiBaseUrl?: string;
76
+ }
77
+ /**
78
+ * Fetches the survey, records the view event, and provides SurveyContext to
79
+ * the building blocks beneath it.
80
+ */
81
+ declare const SurveyProvider: (props: SurveyProviderProps) => import("react").JSX.Element;
82
+ /**
83
+ * Returns the current survey context value. Must be used beneath a
84
+ * SurveyProvider or a directly provided SurveyContext.
85
+ */
86
+ declare const useSurvey: () => SurveyContextValue;
87
+ //#endregion
88
+ //#region src/core/RespondentVisibilityProvider.d.ts
89
+ type WithVisibilityControl<P> = Omit<P, 'respondent'> & {
90
+ /**
91
+ * Identifies who the survey is shown to and tracked against. The widget
92
+ * tracks a respondent's response and dismissal history, which
93
+ * `isSurveyVisible` receives, so the value chosen sets how narrowly the
94
+ * survey is targeted. Pass a stable user identifier to target a person,
95
+ * an event identifier on its own to target an event, or a composite such
96
+ * as `{User ID}-{Event ID}` to target a person for a specific event.
97
+ * When omitted, the widget generates and persists an identifier
98
+ * so the same visitor is recognised across visits to this survey.
99
+ */
100
+ respondent?: string;
101
+ /**
102
+ * Gates whether the survey renders for this respondent. Pass `false` to hide
103
+ * it, or a predicate that receives the respondent state and returns whether
104
+ * to show it. When omitted, the survey shows whenever it is available for the
105
+ * respondent.
106
+ */
107
+ isSurveyVisible?: IsSurveyVisible;
108
+ };
109
+ interface RespondentVisibilityContextValue {
110
+ respondent: string;
111
+ }
112
+ /**
113
+ * Providing this context makes a nested RespondentVisibilityProvider (and the
114
+ * components composed from it, such as ConfettiTrigger) reuse the given
115
+ * respondent instead of resolving one and fetching availability and
116
+ * respondent state. Pair it with SurveyContext to render building blocks
117
+ * against a preloaded survey.
118
+ */
119
+ declare const RespondentVisibilityContext: import("react").Context<RespondentVisibilityContextValue | null>;
120
+ interface RespondentVisibilityProviderProps extends PropsWithChildren<Pick<SurveyProviderProps, 'surveyId' | 'publishableKey' | 'apiBaseUrl'>> {
121
+ /**
122
+ * Identifies who the survey is shown to and tracked against. The widget
123
+ * tracks a respondent's response and dismissal history, which
124
+ * `isSurveyVisible` receives, so the value chosen sets how narrowly the
125
+ * survey is targeted. Pass a stable user identifier to target a person,
126
+ * an event identifier on its own to target an event, or a composite such
127
+ * as `{User ID}-{Event ID}` to target a person for a specific event.
128
+ * When omitted, the widget generates and persists an identifier
129
+ * so the same visitor is recognised across visits to this survey.
130
+ */
131
+ respondent?: string;
132
+ /**
133
+ * Gates whether the survey renders for this respondent. Pass `false` to hide
134
+ * it, or a predicate that receives the respondent state and returns whether
135
+ * to show it. When omitted, the survey shows whenever it is available for the
136
+ * respondent.
137
+ */
138
+ isSurveyVisible?: IsSurveyVisible;
139
+ }
140
+ /**
141
+ * Resolves the respondent, probes survey availability, and renders children
142
+ * only once the survey is confirmed visible for that respondent.
143
+ */
144
+ declare function RespondentVisibilityProvider(props: RespondentVisibilityProviderProps): import("react").JSX.Element;
145
+ /**
146
+ * Returns the respondent resolved by the nearest RespondentVisibilityProvider.
147
+ */
148
+ declare function useRespondentVisibility(): RespondentVisibilityContextValue;
149
+ //#endregion
150
+ //#region src/core/ConfettiProvider.d.ts
151
+ type ConfettiProviderProps = WithVisibilityControl<SurveyProviderProps>;
152
+ declare const ConfettiProvider: ({
153
+ children,
154
+ ...rest
155
+ }: ConfettiProviderProps) => import("react").JSX.Element;
156
+ //#endregion
157
+ //#region src/components/questions/types.d.ts
158
+ type Question = PublicGetSurveyOutput['questions'][number];
159
+ interface BaseFieldProps {
160
+ id: string;
161
+ title: string | null | undefined;
162
+ description?: string | null | undefined;
163
+ required?: boolean;
164
+ onChange: (answer: Answer) => void;
165
+ error?: string;
166
+ }
167
+ //#endregion
168
+ //#region src/components/questions/BugReport/BugReport.d.ts
169
+ interface BugReportOptions {
170
+ /**
171
+ * Masks the text of every input in the screenshot and the session recording
172
+ * captured by the bug-report question, keeping sensitive values out of the
173
+ * submitted report.
174
+ */
175
+ maskAllInputs?: boolean;
176
+ }
177
+ //#endregion
178
+ //#region src/components/Confetti.d.ts
179
+ /**
180
+ * Survey configuration shared by every Confetti surface: the `Confetti`
181
+ * build-your-own component, the hosted shells, the static shells, and the
182
+ * content templates. It excludes the controller-level knobs (`children` and
183
+ * `shouldAutoSubmit`) that only apply when you drive `ConfettiController`
184
+ * yourself, so the fixed-layout shells and templates extend this rather than
185
+ * `ConfettiProps`.
186
+ */
187
+ interface BaseConfettiProps extends Omit<ConfettiProviderProps, 'children'>, Finishable {
188
+ /** Optional feature configuration for the survey surface. */
189
+ options?: {
190
+ /** Configures the built-in bug-report question type. */bugReport?: BugReportOptions;
191
+ };
192
+ }
193
+ /**
194
+ * The full set of props accepted by the `Confetti` component: the shared survey
195
+ * config plus the controller knobs it forwards to `ConfettiController`.
196
+ */
197
+ interface ConfettiProps extends BaseConfettiProps, Pick<ConfettiControllerProps, 'children' | 'shouldAutoSubmit'> {}
198
+ declare const Confetti: ({
199
+ children,
200
+ onFinished,
201
+ shouldAutoSubmit,
202
+ ...props
203
+ }: ConfettiProps) => import("react").JSX.Element;
204
+ //#endregion
205
+ export { useSurvey as _, BaseFieldProps as a, ConfettiProviderProps as c, RespondentVisibilityProviderProps as d, WithVisibilityControl as f, SurveyProviderProps as g, SurveyProvider as h, BugReportOptions as i, RespondentVisibilityContext as l, SurveyContext as m, Confetti as n, Question as o, useRespondentVisibility as p, ConfettiProps as r, ConfettiProvider as s, BaseConfettiProps as t, RespondentVisibilityProvider as u, ConfettiController as v, ConfettiControllerProps as y };
@@ -0,0 +1 @@
1
+ import{n as e,q as t}from"./Button-giwEer5K.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const u={lastRespondedAt:null,lastDismissedAt:null};async function d({client:e,surveyId:n,respondent:r,signal:i}){try{let a=await e.get(`api/v1/cfti/${n}/respondent/${r}`,{signal:i}).json(),o=t.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),u)}catch{return u}}function f({client:e,surveyId:t,respondent:i}){let[a,o]=r(u),[s,c]=r(!1),[l,f]=r({client:e,surveyId:t,respondent:i});return(l.client!==e||l.surveyId!==t||l.respondent!==i)&&(f({client:e,surveyId:t,respondent:i}),o(u),c(!1)),n(()=>{if(!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;d({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(o(e),c(!0))})};r();let a=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,a),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,a)}},[e,t,i]),{state:a,isSettled:s}}function p({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${t}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const m=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),h=({onClick:t,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(e,{onPress:t,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(m,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{l as a,f as i,m as n,c as o,p as r,h as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,o as n,r}from"./DefaultConfettiTrigger-DFJBQ35H.js";import{$ as i,A as a,B as o,C as s,D as c,F as l,O as u,Q as d,R as f,S as p,U as m,V as h,X as g,Y as _,Z as v,_ as y,a as b,c as x,et as S,f as C,g as w,h as T,i as E,it as D,j as O,k,l as A,n as j,o as ee,p as M,r as te,rt as ne,s as re,tt as ie,v as ae,x as N,y as oe}from"./Button-giwEer5K.js";import{d as se,f as ce,h as le,i as ue,l as de,m as fe,p as pe,r as me,s as he,u as ge}from"./ModalContainer-q2SR0m5h.js";import{a as _e,n as ve,o as ye,r as be,t as xe}from"./internals-B5GhpjgM.js";import P,{Suspense as Se,createContext as F,forwardRef as I,lazy as Ce,useCallback as L,useContext as R,useEffect as z,useMemo as B,useRef as V,useState as H}from"react";import{useTimeout as we}from"usehooks-ts";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"clsx";import"react-dom";function Te(e,t,n){let r=c(e=>{n&&!e.defaultPrevented&&n(t)});z(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Ee(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=h(t);let o=h(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=pe({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function De(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:s,fieldProps:c}=Ee(e),l=o([!!t,!!n,r,i]),u=o([!!t,!!n,r,i]);return c=a(c,{"aria-describedby":[l,u,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:s,fieldProps:c,descriptionProps:{id:l},errorMessageProps:{id:u}}}function Oe(e,t,n){let{validationBehavior:r,focus:i}=e;m(()=>{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(Ae(n.current))}});let a=V(!1),o=c(()=>{a.current||t.resetValidation()}),s=c(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&je(r)===n.current&&(i?i():n.current?.focus(),C(`keyboard`)),e.preventDefault()}),u=c(()=>{t.commitValidation()});z(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&l(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,u),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,u),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function ke(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 Ae(e){return{isInvalid:!e.validity.valid,validationDetails:ke(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function je(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 Me={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Ne={...Me,customError:!0,valid:!1},q={isInvalid:!1,validationDetails:Me,validationErrors:[]},Pe=F({}),Fe=`__reactAriaFormValidationState`;function J(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Fe];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ie(e)}function Ie(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:Ne},l=B(()=>!o||i==null?null:ze(Re(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=R(Pe),d=B(()=>r?Array.isArray(r)?r.flatMap(e=>Le(u[e])):Le(u[r]):[],[u,r]),[f,p]=H(u),[m,h]=H(!1);u!==f&&(p(u),h(!1));let g=B(()=>ze(m?[]:d),[m,d]),_=V(q),[v,y]=H(q),b=V(q),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Be(e,b.current)||(b.current=e,y(e))},[S,C]=H(!1);return z(x),{realtimeValidation:c||g||l||a||q,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Be(v,e)?y(e):_.current=e},resetValidation(){let e=q;Be(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function Le(e){return e?Array.isArray(e)?e:[e]:[]}function Re(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Le(n)}return[]}function ze(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Ne}:null}function Be(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 Ve(...e){let t=new Set,n=!1,r={...Me};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 He(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[u,d]=ge(e.value,e.defaultValue||``,e.onChange),{focusableProps:f}=A(e,t),p=J({...e,value:u}),{isInvalid:m,validationErrors:h,validationDetails:g}=p.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=De({...e,isInvalid:m,errorMessage:e.errorMessage||h}),x=k(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=H(u);return Te(t,e.defaultValue??C,d),Oe(e,p,t),{labelProps:_,inputProps:a(x,n===`input`?S:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":m||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:u,onChange:e=>d(l(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(P.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...f,...v}),descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}function Ue(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:u,"aria-label":d,"aria-labelledby":f,validationState:p=`valid`,isInvalid:m,onPressStart:h,onPressEnd:g,onPressChange:_,onPress:v,onPressUp:y,onClick:b}=e,x=e=>{e.stopPropagation(),t.setSelected(l(e).checked)},{pressProps:S,isPressed:C}=M({onPressStart:h,onPressEnd:g,onPressChange:_,onPress:v,onPressUp:y,onClick:b,isDisabled:r}),{pressProps:w,isPressed:T}=M({onPressStart:h,onPressEnd:g,onPressChange:_,onPressUp:y,onClick:b,onPress(e){v?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:E}=A(e,n),D=a(S,E),O=k(e,{labelable:!0});return Te(n,t.defaultSelected,t.setSelected),{labelProps:a(w,{onClick:e=>e.preventDefault()}),inputProps:a(O,{"aria-invalid":m||p===`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:m||p===`invalid`}}function We(e,t,n){let r=J({...e,value:t.isSelected}),{isInvalid:i,validationErrors:o,validationDetails:s}=r.displayValidation,{labelProps:c,inputProps:l,isSelected:u,isPressed:d,isDisabled:f,isReadOnly:p}=Ue({...e,isInvalid:i},t,n);Oe(e,r,n);let{isIndeterminate:m,isRequired:h,validationBehavior:g=`aria`}=e;z(()=>{n.current&&(n.current.indeterminate=!!m)});let{pressProps:_}=M({isDisabled:f||p,onPress(){let{[Fe]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:a(c,_,B(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...l,checked:u,"aria-required":h&&g===`aria`||void 0,required:h&&g===`native`},isSelected:u,isPressed:d,isDisabled:f,isReadOnly:p,isInvalid:i,validationErrors:o,validationDetails:s}}const Ge=new WeakMap;function Ke(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}=De({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});Ge.set(t,{name:r,form:i,descriptionId:f.id,errorMessageId:p.id,validationBehavior:o});let m=k(e,{labelable:!0}),{focusWithinProps:h}=x({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:a(m,{role:`group`,"aria-disabled":n||void 0,...d,...h}),labelProps:u,descriptionProps:f,errorMessageProps:p,isInvalid:s,validationErrors:c,validationDetails:l}}function qe(e={}){let{isReadOnly:t}=e,[n,r]=ge(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=H(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function Je(e,t,n){let r=qe({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}=Ge.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=J({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=V(q),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};z(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=We({...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,[Fe]:{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 Ye=new WeakMap;function Xe(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}=M({onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=M({onPressStart:c,onPressEnd:l,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){d?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=A(a(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=a(_,x),C=k(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:j}=Ye.get(t);return Te(n,t.defaultSelectedValue,t.setSelectedValue),Oe({validationBehavior:j},t,n),{labelProps:a(y,B(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:a(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&j===`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 Ze(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:c=`vertical`,validationBehavior:u=`aria`}=e,{direction:d}=ce(),{isInvalid:p,validationErrors:m,validationDetails:g}=t.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=De({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||m}),S=k(e,{labelable:!0}),{focusWithinProps:C}=x({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),w=e=>{let n;switch(e.key){case`ArrowRight`:n=d===`rtl`&&c!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=d===`rtl`&&c!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=se(e.currentTarget,{from:l(e),accept:e=>e instanceof f(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},T=h(n);return Ye.set(t,{name:T,form:r,descriptionId:y.id,errorMessageId:b.id,validationBehavior:u}),{radioGroupProps:a(S,{role:`radiogroup`,onKeyDown:w,"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,...v,...C}),labelProps:_,descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:g}}const Qe=F({}),Y=I(function(e,t){[e,t]=w(e,t,Qe);let{elementType:n=`span`,...r}=e,i=N[n];return P.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function $e(e={}){let[t,n]=ge(e.value,e.defaultValue||[],e.onChange),[r]=H(t),i=!!e.isRequired&&t.length===0,a=V(new Map),o=J({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Ve(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let et=Math.round(Math.random()*1e10),tt=0;function nt(e){let t=B(()=>e.name||`radio-group-${et}-${++tt}`,[e.name]),[n,r]=ge(e.value,e.defaultValue??null,e.onChange),[i]=H(n),[a,o]=H(null),s=J({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const X=F(null),Z=I(function(e,t){return R(X)?.isInvalid?P.createElement(rt,{...e,ref:t}):null}),rt=I((e,t)=>{let n=R(X),r=k(e,{global:!0}),i=y({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:P.createElement(Y,{slot:`errorMessage`,...r,...i,ref:t})}),Q=F(null),it=F(null),at=F(null),ot=I(function(e,t){[e,t]=w(e,t,it);let{validationBehavior:n}=s(Q)||{},r=e.validationBehavior??n??`native`,i=$e({...e,validationBehavior:r}),[o,c]=ae(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:l,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=Ke({...e,label:c,validationBehavior:r},i),m=y({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),h=k(e,{global:!0});return P.createElement(N.div,{...a(h,m,l),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},P.createElement(T,{values:[[at,i],[te,{...u,ref:o,elementType:`span`}],[Qe,{slots:{description:d,errorMessage:f}}],[X,p]]},m.children))}),st=I(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=w(r,t,le);let{validationBehavior:i}=s(Q)||{},o=e.validationBehavior??i??`native`,c=R(at),l=u(B(()=>O(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:m,isDisabled:h,isReadOnly:g,isPressed:_,isInvalid:v}=c?Je({...p(e),value:e.value,children:typeof e.children==`function`?!0:e.children},c,l):We({...p(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},qe(e),l),{isFocused:b,isFocusVisible:x,focusProps:S}=re(),C=h||g,{hoverProps:T,isHovered:E}=ee({...e,isDisabled:C}),D=y({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:m,isIndeterminate:e.isIndeterminate||!1,isPressed:_,isHovered:E,isFocused:b,isFocusVisible:x,isDisabled:h,isReadOnly:g,isInvalid:v,isRequired:e.isRequired||!1}}),A=k(e,{global:!0});return delete A.id,delete A.onClick,P.createElement(N.label,{...a(A,d,T,D),ref:t,slot:e.slot||void 0,"data-selected":m||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":_||void 0,"data-hovered":E||void 0,"data-focused":b||void 0,"data-focus-visible":x||void 0,"data-disabled":h||void 0,"data-readonly":g||void 0,"data-invalid":v||void 0,"data-required":e.isRequired||void 0},P.createElement(de,{elementType:`span`},P.createElement(`input`,{...a(f,S),ref:l})),D.children)}),ct=F({}),lt=F({});let ut=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const dt=b(function(e,t){[e,t]=w(e,t,lt);let{hoverProps:n,isHovered:r}=ee({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:o,focusProps:s}=re({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=y({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-Input`});return P.createElement(N.input,{...a(ut(e),s,n),...l,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),ft=F(null);function pt(e){let t=V({});return P.createElement(ft.Provider,{value:t},e.children)}const mt=F({isSelected:!1}),ht=F(null),gt=F(null),_t=F(null),vt=I(function(e,t){[e,t]=w(e,t,ht);let{validationBehavior:n}=s(Q)||{},r=e.validationBehavior??n??`native`,i=nt({...e,validationBehavior:r}),[o,c]=ae(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:l,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=Ze({...e,label:c,validationBehavior:r},i),m=y({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),h=k(e,{global:!0});return P.createElement(N.div,{...a(h,m,l),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},P.createElement(T,{values:[[_t,i],[te,{...u,ref:o,elementType:`span`}],[Qe,{slots:{description:d,errorMessage:f}}],[X,p]]},P.createElement(pt,null,m.children)))}),yt=I(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=w(r,t,gt);let i=P.useContext(_t),o=u(B(()=>O(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:l,isDisabled:d,isPressed:f}=Xe({...p(e),children:typeof e.children==`function`?!0:e.children},i,o),{isFocused:m,isFocusVisible:h,focusProps:g}=re(),_=d||i.isReadOnly,{hoverProps:v,isHovered:b}=ee({...e,isDisabled:_}),x=y({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:l,isPressed:f,isHovered:b,isFocused:m,isFocusVisible:h,isDisabled:d,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),S=k(e,{global:!0});return delete S.id,delete S.onClick,P.createElement(N.label,{...a(S,s,v,x),ref:t,"data-selected":l||void 0,"data-pressed":f||void 0,"data-hovered":b||void 0,"data-focused":m||void 0,"data-focus-visible":h||void 0,"data-disabled":d||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},P.createElement(de,{elementType:`span`},P.createElement(`input`,{...a(c,g),ref:o})),P.createElement(mt.Provider,{value:{isSelected:l}},x.children))}),bt=F({});let xt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const St=I(function(e,t){[e,t]=w(e,t,bt);let{hoverProps:n,isHovered:r}=ee(e),{isFocused:i,isFocusVisible:o,focusProps:s}=re({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=y({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return P.createElement(N.textarea,{...a(xt(e),s,n),...l,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),Ct=F(null),wt=b(function(e,t){[e,t]=w(e,t,Ct);let{validationBehavior:n}=s(Q)||{},r=e.validationBehavior??n??`native`,i=V(null);[e,i]=w(e,i,fe);let[a,o]=ae(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=H(`input`),{labelProps:u,inputProps:d,descriptionProps:f,errorMessageProps:m,...h}=He({...p(e),inputElementType:c,label:o,validationBehavior:r},i),g=L(e=>{i.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=y({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:h.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),v=k(e,{global:!0});return delete v.id,P.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},P.createElement(T,{values:[[te,{...u,ref:a}],[lt,{...d,ref:g}],[bt,{...d,ref:g}],[ct,{role:`presentation`,isInvalid:h.isInvalid,isDisabled:e.isDisabled||!1}],[Qe,{slots:{description:f,errorMessage:m}}],[X,h]]},_.children))});function Tt(e){return e.issues[0]?.message??`Invalid input`}const $={rating:({scale:e},t)=>d({scale:e},t),"open-ended":({max:e},t)=>v({maxLength:e},t),"single-select":({editable:e},t)=>i({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>g({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>S(),"bug-report":(e,t)=>_({},t)},Et=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=$[n];return r(e,t)}case`open-ended`:{let r=$[n];return r(e,t)}case`single-select`:{let r=$[n];return r(e,t)}case`multi-select`:{let r=$[n];return r(e,t)}case`statement`:{let r=$[n];return r(e,t)}case`bug-report`:{let r=$[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Dt=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=e.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},r=n[e.id];return r&&(t.error=r),{...t,visible:!1}});for(let e=0;e<i.length;e++){let n=i[e];if(!n)continue;let a=ye({index:e,questions:i,answers:t});n.visible=r===e||a}let a=i.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return a===-1&&(a=i.findLastIndex(e=>!!e.visible)),{questions:i,currentIndex:a}},Ot=({questions:e,answers:t})=>{let n=kt({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},kt=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),At=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),jt=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i})=>{let{survey:a,submit:o}=he(),[s,c]=H({}),[l,u]=H({}),d=B(()=>Dt({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),f=B(()=>!!d.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,d.questions]),[p,m]=H(!1),h=L(({answers:e})=>{o({answers:e}).finally(()=>{r?.()})},[r,o]),g=L(()=>{h({answers:Ot({questions:d.questions,answers:s})}),m(!0),n?.()},[s,d.questions,h,n]),_=L(({question:r,answer:i})=>{let o=d.questions.at(r);if(!o)return{error:`Question index is invalid`};let f=Et(o.properties,{required:o.required}).safeParse(i);if(!f.success){let e=Tt(f.error);return u(t=>{if(t[o.id]===e)return t;let n={...t};return n[o.id]=e,n}),c(e=>{if(!(o.id in e))return e;let t={...e};return delete t[o.id],t}),{error:e}}u(e=>{if(!e[o.id])return e;let t={...e};return delete t[o.id],t});let p=!o.required&&!i?null:i,g={...s};if(g[o.id]===p)return{next:Dt({originalQuestions:a?.questions,answers:g,errors:l,pointer:e}).currentIndex};g[o.id]=p;let _=Dt({originalQuestions:a?.questions,answers:g,errors:l,pointer:e});return g=kt({questions:_.questions,answers:g}),c(g),u(At({questions:_.questions,errors:l})),_.questions.filter(({visible:e})=>!!e).every(({id:e})=>g[e]!==void 0)&&t&&(h({answers:Ot({questions:_.questions,answers:g})}),m(!0),n?.()),{next:_.currentIndex}},[d.questions,s,a?.questions,l,t,e,h,n]);return d.questions.length===0?W(U,{}):W(`div`,{className:`confetti ${xe}`,children:i({questions:d.questions,current:e??d.currentIndex,update:_,isCompleted:f,submit:g,isSubmitted:p,errors:l})})},Mt=F(null);function Nt({children:i,surveyId:a,publishableKey:o,apiBaseUrl:s,respondent:c,isSurveyVisible:l}){let u=e({surveyId:a,override:c}),d=D({publishableKey:o,apiBaseUrl:s}),{isAvailable:f,isSettled:p}=r({client:d,surveyId:a}),{state:m,isSettled:h}=t({client:d,surveyId:a,respondent:u}),g=B(()=>({respondent:u}),[u]);return!u||!p||!h||!f||!n(m,l)?null:W(Mt.Provider,{value:g,children:i})}function Pt(e){return R(Mt)?W(U,{children:e.children}):W(Nt,{...e})}function Ft(){let e=R(Mt);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const It=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=he(),[l,u]=H(!1),[d,f]=H(!1),[p,m]=H(!1),[h,g]=H(!1);return we(()=>{s&&i?.()},d&&!(p||h)?a:null),G(`div`,{className:K(`confetti-dialog ${xe}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),m(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),m(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),g(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[W(me,{className:K(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{l||(await c(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>u(!0),setIsFinished:()=>f(!0)}):e]})},Lt=3e4,Rt=({maskAllInputs:e}={})=>{let[t,n]=H(null),[r,i]=H(!1),[a,o]=H(null),[s,c]=H(30),l=V(null),u=V(null),d=V(null),f=V([]);z(()=>{let e=new CustomEvent(be,{detail:{isRecording:r}});document.dispatchEvent(e)},[r]);let p=L(()=>{u.current&&=(clearInterval(u.current),null),d.current&&=(clearTimeout(d.current),null),l.current=null,c(Lt/1e3)},[]),m=L(()=>{l.current?.(),p(),i(!1),n(JSON.stringify(f.current))},[p]);return{recordingEventsJson:t,isRecording:r,recordingError:a,remainingSeconds:s,startRecording:L(async()=>{i(!0),o(null),n(null),f.current=[];try{let{record:t}=await import(`./record-BZwNFiEW.js`);l.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=>{f.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=Lt/1e3;c(n),u.current=setInterval(()=>{--n,c(n)},1e3),d.current=setTimeout(()=>{m()},Lt)}catch{o(`Failed to start recording. Please try again.`),i(!1),p()}},[e,m,p]),stopRecording:m,clear:L(()=>{p(),i(!1),n(null),o(null),f.current=[]},[p])}},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:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${ve}`)){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 n.querySelectorAll(`input, textarea, select`))Ht(e)}}}),Wt=({maskAllInputs:e}={})=>{let[t,n]=H(null),[r,i]=H(!1),[a,o]=H(null);return{screenshotDataUrl:t,isCapturing:r,captureError:a,capture:L(async()=>{i(!0),o(null);try{let{snapdom:t}=await import(`./snapdom-BQZEILL6.js`),r=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${xe}`],excludeMode:`hide`,plugins:[Ut({maskInputs:!!e})],fast:!1})).toCanvas(),i=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*i),r.width),o=Math.min(Math.round(window.innerHeight*i),r.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(r,0,0,a,o,0,0,a,o),n(s.toDataURL(`image/png`))}catch{o(`Failed to capture screenshot. Please try again.`)}finally{i(!1)}},[e]),clear:L(()=>{n(null),o(null)},[])}},Gt=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`circle`,{cx:`12`,cy:`12`,r:`10`}),W(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),Kt=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`path`,{d:`M10 11v6`}),W(`path`,{d:`M14 11v6`}),W(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),W(`path`,{d:`M3 6h18`}),W(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function 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=Ce(()=>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=B(()=>Jt(),[]),[u,d]=H(``),[f,p]=H(``),{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}),D=B(()=>({title:u,...f?{description:f}:{},...m?{screenshotDataUrl:m}:{},...y?{recordingEventsJson:y}:{},metadata:l}),[f,l,y,m,u]);z(()=>{i(D)},[D,i]),z(()=>()=>{w()},[w]);let O=B(()=>y?JSON.parse(y):[],[y]);return W(U,{children:b?G(j,{className:K(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:w,children:[W(Gt,{}),G(`span`,{children:[30-S,`s /`,` `,30,`s`]})]}):G(`div`,{className:K(`cf-bug-report`,s?.base),children:[G(wt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:u,onChange:d,className:K(`cf-question`,s?.question),children:[G(`div`,{className:K(`cf-header`,s?.header),children:[G(E,{className:K(`cf-title`,s?.title),children:[t,!a&&G(`span`,{className:K(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&W(Y,{slot:`description`,className:K(`cf-description`,s?.description),children:n})]}),W(dt,{placeholder:r.placeholder||`Brief description of the issue`,className:K(`cf-input`,s?.input)})]}),G(wt,{name:`${e}-description`,value:f,onChange:p,className:K(`cf-question`,s?.question),children:[W(E,{className:K(`cf-title`,s?.title),children:r.detailsLabel}),W(St,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:K(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?G(`section`,{className:K(`cf-question`,s?.question),children:[W(E,{className:K(`cf-title`,s?.title),children:`Attachments`}),G(`div`,{className:K(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&G(`div`,{className:K(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[m?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(`img`,{src:m,alt:`Screenshot preview`,className:K(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(j,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:v,"aria-label":`Remove screenshot`,children:W(Kt,{})})})]}):W(j,{className:K(`cf-bug-report-button`,s?.button),onPress:_,isDisabled:h,children:h?`Capturing...`:`Screenshot`}),g&&W(`div`,{className:K(`cf-error`,s?.error),children:g})]}),r.enableRecording&&G(`div`,{className:K(`cf-bug-report-recording-section`,s?.recordingSection),children:[O.length>0?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(Se,{fallback:W(`span`,{className:K(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:W(Yt,{events:O})}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(j,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:T,"aria-label":`Remove recording`,children:W(Kt,{})})})]}):W(j,{className:K(`cf-bug-report-button`,s?.button),onPress:C,children:`Record`}),x&&W(`div`,{className:K(`cf-error`,s?.error),children:x})]})]})]}):null,W(Z,{className:K(`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]=H(``);return z(()=>{i(c)},[i,c]),G(wt,{isRequired:o,isInvalid:!!s,name:e,className:K(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[G(`div`,{className:K(`cf-header`,a?.header),children:[G(E,{className:K(`cf-title`,a?.title),children:[t,!o&&G(`span`,{className:K(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&W(Y,{slot:`description`,className:K(`cf-description`,a?.description),children:n})]}),W(St,{className:K(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),W(Z,{className:K(`cf-error`,a?.error),children:s})]})},Qt=({children:e,classNames:t,description:n,...r})=>W(st,{...r,children:({isIndeterminate:r})=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,t?.label),children:[W(`div`,{className:K(`cf-checkbox-indicator`,t?.indicator),children:W(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:K(`cf-checkbox-indicator-svg`,t?.svg),children:r?W(`rect`,{x:1,y:7.5,width:16,height:3}):W(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&W(`span`,{className:K(`cf-choice-description`,t?.choiceDescription),children:n})]})}),$t=({children:e,classNames:t,...n})=>W(st,{...n,children:W(`div`,{className:K(`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]=H([]),[f,p]=H(``),m=V(null),h=V(null),g=B(()=>{let e=u.indexOf(ie);if(e===-1)return u;let t=[...u];return t[e]=f||`__CONFETTI_CHECKBOX_Others`,t},[f,u]),_=l===`tag`;return z(()=>{i(g)},[i,g]),W(ot,{isRequired:o,isInvalid:!!s,name:a,value:u,onChange:d,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(E,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&W(Y,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,l===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>W(_?$t:Qt,{className:K(`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&&(_?G(U,{children:[W($t,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:K(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),W(dt,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:f,onChange:e=>{p(e.target.value)},ref:h,className:K(`cf-input cf-tag-input`,r?.othersInput)})]}):G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(Qt,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:K(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),W(dt,{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:K(`cf-input`,r?.othersInput)})]}))]}),W(Z,{className:K(`cf-error`,r?.error),children:s})]})})},tn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),nn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),rn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),an=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),on=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),sn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:W(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),cn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:W(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),ln=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return W(`div`,{className:K(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return W(yt,{className:K(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:W(o?cn:sn,{})},t)})})},un=({properties:e,classNames:t})=>W(`div`,{className:K(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return W(yt,{className:K(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),dn=({properties:e,classNames:t,state:n})=>{let r=B(()=>[tn,rn,an,on,nn],[]),i=B(()=>[rn,an,on],[]);return B(()=>e.scale===3||e.scale===5,[e.scale])?W(`div`,{className:K(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return W(yt,{className:K(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&W(c,{})},a)})}):W(un,{properties:e,classNames:t,state:n})},fn=e=>{switch(e.properties.display??`star`){case`emoji`:return W(dn,{...e});case`number`:return W(un,{...e});case`star`:return W(ln,{...e})}},pn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=H(null),u=B(()=>c?Number(c):void 0,[c]);return z(()=>{i(u)},[i,u]),W(vt,{isRequired:s,isInvalid:!!o,name:a,className:K(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(E,{className:K(`cf-title`,r?.title),children:[t,!s&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&W(Y,{slot:`description`,className:K(`cf-description`,r?.description),children:n})]}),G(`div`,{className:K(`cf-rating-section`,r?.ratingSection),children:[W(fn,{state:i,properties:e,classNames:r}),G(`div`,{className:K(`cf-rating-text`,r?.ratingText),children:[W(`span`,{className:K(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),W(`span`,{className:K(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),W(Z,{className:K(`cf-error`,r?.error),children:o})]})})},mn=({classNames:e,className:t,description:n,...r})=>W(yt,{...r,className:K(t,e?.radio),children:oe(r.children,t=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,e?.label),children:[W(`div`,{className:K(`cf-radio-indicator`,e?.indicator)}),t]}),n&&W(`span`,{className:K(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),hn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=H(null),[u,d]=H(``),f=!!n.editable,p=V(null),m=V(null),h=B(()=>c===`__CONFETTI_RADIO_Others`?u||`__CONFETTI_RADIO_Others`:c??void 0,[u,c]);return z(()=>{i(h)},[i,h]),W(vt,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{m.current&&m.current.focus()})},value:c,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(E,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&W(Y,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>W(mn,{classNames:{indicator:r?.indicator,radio:K(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),f&&G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(mn,{inputRef:p,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:K(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),W(dt,{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:K(`cf-input`,r?.othersInput)})]})]}),W(Z,{className:K(`cf-error`,r?.error),children:s})]})})},gn=({properties:e,title:t,description:n,classNames:r})=>W(`div`,{className:K(`cf-question`,r?.question),children:G(`div`,{className:K(`cf-header`,r?.header),children:[t&&W(`div`,{className:K(`cf-title`,r?.title),children:t}),n&&W(`div`,{className:K(`cf-description`,r?.description),children:n})]})}),_n=({question:e,onChange:t,error:n,maskAllInputs:r})=>{switch(e.properties.type){case`rating`:return W(pn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return W(Zt,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return W(hn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return W(en,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return W(gn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return W(Xt,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r},e.id)}return W(`div`,{children:`Unsupported question type`},e.id)},vn=({title:e,description:t,classNames:n,onClose:r})=>{let{survey:i}=he();if(!i)return null;let a=t||i.confirmation.description;return G(U,{children:[W(`div`,{className:K(`cf-question`,n?.question),children:G(`div`,{className:K(`cf-header`,n?.header),children:[W(E,{className:K(`cf-title`,n?.title),children:e||i.confirmation.title||`Feedback submitted!`}),a&&W(Y,{slot:`description`,className:K(`cf-description`,n?.description),children:a})]})}),W(j,{className:`cf-submit-button`,onPress:()=>{r?.()},children:i.confirmation.buttonText||`Close`})]})},yn=({onPress:e,isDisabled:t,children:n=`Submit`})=>ue()?null:W(j,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),bn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},xn=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),Sn=({onSubmit:e,children:t,question:n,isLastQuestion:r})=>{let[i,a]=H(bn(n.properties.type)),o=B(()=>Et(n.properties,{required:n.required}),[n.properties,n.required]),s=B(()=>{let e=o.safeParse(i);if(!e.success)return Tt(e.error)},[i,o]),c=B(()=>{let e=n.routingLogic;if(e.type!==`always`&&!xn(i)&&n.required)return!0;let t=e.type===`always`?e.target:e.cases.find(e=>_e({answer:i,condition:e}))?.target??e.default;return t.type===`end`?!1:t.type===`next`?!r:!0},[i,r,n.required,n.routingLogic]),l=B(()=>n.properties.buttonLabel?n.properties.buttonLabel:c?!n.required&&!xn(i)?`Skip`:`Next`:`Submit`,[i,c,n.properties.buttonLabel,n.required]),u=L(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=ne.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(i)}},[i,e,n.properties]),d=B(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties]);return G(U,{children:[t({onChange:L(t=>{a(t),d&&xn(t)&&o.safeParse(t).success&&e(t)},[d,o,e]),question:n,error:s}),(!d||!n.required)&&W(yn,{isDisabled:!!s,onPress:u,children:l})]})},Cn=({isCompleted:e,onSubmit:t,children:n})=>G(U,{children:[n,e&&W(yn,{onPress:t})]});export{gn as a,en as c,Mt as d,Pt as f,_n as i,Zt as l,jt as m,Sn as n,hn as o,Ft as p,vn as r,pn as s,Cn as t,It as u};
@@ -0,0 +1,65 @@
1
+ //#region src/components/container/ModalContainer.d.ts
2
+ interface ModalContainerProps {
3
+ closeOnFinishMs?: number | null;
4
+ isDismissable?: boolean;
5
+ classNames?: {
6
+ overlay?: string;
7
+ modal?: string;
8
+ dialog?: string;
9
+ closeButton?: string;
10
+ icon?: string;
11
+ };
12
+ /**
13
+ * Invoked when the user dismisses the survey via the close button or the
14
+ * overlay before submitting. Not invoked on auto-close after finish, on the
15
+ * Thank-You button, or on any close after submission, all of which close a
16
+ * completed survey rather than dismiss it.
17
+ */
18
+ onDismiss?: () => void;
19
+ /**
20
+ * Invoked on every close path: the close button, the overlay, the
21
+ * close-on-finish timer, and the Thank-You button. Lets the owning wrapper
22
+ * tear the widget down.
23
+ */
24
+ onClose?: () => void;
25
+ children: React.ReactNode | ((props: {
26
+ setIsSubmitted: () => void;
27
+ setIsFinished: () => void;
28
+ }) => React.ReactNode);
29
+ }
30
+ type ModalContentProps = ModalContainerProps & Required<Pick<ModalContainerProps, 'closeOnFinishMs' | 'isDismissable'>> & {
31
+ /**
32
+ * Submitted flag owned by ModalContainer so its overlay handler can tell a
33
+ * post-submission close apart from a dismissal. Standalone consumers may
34
+ * omit it, in which case closes count as dismissals until the render
35
+ * prop's `setIsFinished` reports the submission has settled.
36
+ */
37
+ isSubmitted?: boolean;
38
+ /**
39
+ * Invoked when the survey content reports submission through the render
40
+ * prop's `setIsSubmitted`. Fires when the Thank-You view is shown, before
41
+ * the submission network call settles. When omitted, the render prop's
42
+ * `setIsSubmitted` is a silent no-op, so `isSubmitted` never flips.
43
+ */
44
+ onSubmitted?: () => void;
45
+ };
46
+ declare const ModalContent: ({
47
+ children,
48
+ classNames,
49
+ isDismissable,
50
+ onDismiss,
51
+ onClose,
52
+ closeOnFinishMs,
53
+ isSubmitted,
54
+ onSubmitted
55
+ }: ModalContentProps) => import("react").JSX.Element;
56
+ declare const ModalContainer: ({
57
+ children,
58
+ classNames,
59
+ onDismiss,
60
+ onClose,
61
+ isDismissable,
62
+ closeOnFinishMs
63
+ }: ModalContainerProps) => import("react").JSX.Element;
64
+ //#endregion
65
+ export { ModalContainerProps as n, ModalContent as r, ModalContainer as t };