@opengovsg/confetti 0.6.1 → 0.7.1
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 +30 -0
- package/build/Button-LiaNjkvk.js +7 -0
- package/build/{Confetti-fis-IO5o.d.ts → Confetti-De4vjrHr.d.ts} +133 -3
- package/build/DefaultConfettiTrigger-DRQBj9sz.js +1 -0
- package/build/Embed-C2iGQW0a.js +1 -0
- package/build/ModalContainer-Du6BhvXW.js +5 -0
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +49 -9
- package/build/components.js +1 -1
- package/build/confetti.css +2 -2
- package/build/{types-NMQZur7D.d.ts → index-CER9nZlw.d.ts} +15 -102
- package/build/index.d.ts +45 -3
- package/build/index.js +1 -1
- package/build/internals-DYTVPK_r.js +1 -0
- package/build/internals.d.ts +2 -2
- package/build/internals.js +1 -1
- package/build/src-BewqzpwC.js +1 -0
- package/build/static.d.ts +1 -2
- package/build/static.js +1 -1
- package/package.json +2 -2
- package/build/Button-uM2fAs2N.js +0 -7
- package/build/DefaultConfettiTrigger-CxIyRNHv.js +0 -1
- package/build/Embed-Db5yO1Sk.js +0 -1
- package/build/ModalContainer-7p9nPFPf.js +0 -5
- package/build/internals-Cn5wlavT.js +0 -1
package/README.md
CHANGED
|
@@ -71,6 +71,21 @@ and stylesheet from `{proxyUrl}/widget/v1/...`. Use this to route widget
|
|
|
71
71
|
traffic through your own origin, for example when your CSP disallows third
|
|
72
72
|
party hosts.
|
|
73
73
|
|
|
74
|
+
Confetti Cloud teams can provision a managed proxy from **Team settings**.
|
|
75
|
+
Create the DNS-only CNAME shown there and wait for it to become live, then pass
|
|
76
|
+
the resulting URL:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<PopoverConfetti
|
|
80
|
+
proxyUrl="https://c.example.gov.sg"
|
|
81
|
+
surveyId="..."
|
|
82
|
+
publishableKey="cfti_pk_..."
|
|
83
|
+
/>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
When using a managed proxy, use that origin for all three CSP directives shown
|
|
87
|
+
above instead of `https://confetti.gov.sg`.
|
|
88
|
+
|
|
74
89
|
## Template Components
|
|
75
90
|
|
|
76
91
|
Choose the component that best fits your use case:
|
|
@@ -148,6 +163,21 @@ import { useVisibleAfterSessionPageVisits } from '@opengovsg/confetti'
|
|
|
148
163
|
const { isVisible, reset } = useVisibleAfterSessionPageVisits({ visits: 3 })
|
|
149
164
|
```
|
|
150
165
|
|
|
166
|
+
### useRespondentState
|
|
167
|
+
|
|
168
|
+
Read a respondent's response and dismissal times without mounting a template.
|
|
169
|
+
`respondent` is required (this hook does not generate an anonymous id).
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
import { useRespondentState } from '@opengovsg/confetti'
|
|
173
|
+
|
|
174
|
+
const respondentState = useRespondentState({
|
|
175
|
+
surveyId: '<your-survey-id>',
|
|
176
|
+
publishableKey: '<your-publishable-key>',
|
|
177
|
+
respondent: '<user-id>',
|
|
178
|
+
})
|
|
179
|
+
```
|
|
180
|
+
|
|
151
181
|
## Building Blocks
|
|
152
182
|
|
|
153
183
|
The lower-level primitives that power the [template components](#template-components) are published from the `@opengovsg/confetti/components` subpath. Reach for these to compose your own survey UI.
|
|
@@ -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 u from"clsx";import"react-dom";const d=l.create({prefixUrl:`https://confetti.gov.sg`,retry:{limit:3,methods:[`get`,`head`]},timeout:6e4});function f({publishableKey:e,apiBaseUrl:t}){return o(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),d.extend(n)},[t,e])}function p(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 m(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function h(e){let t=null;return()=>(t??=e(),t)}const g=h(function(){return m(/^Mac/i)}),_=h(function(){return m(/^iPhone/i)}),v=h(function(){return m(/^iPad/i)||g()&&navigator.maxTouchPoints>1}),y=h(function(){return _()||v()}),b=h(function(){return p(/AppleWebKit/i)&&!ee()}),ee=h(function(){return p(/Chrome/i)}),x=h(function(){return p(/Android/i)}),S=h(function(){return p(/Firefox/i)});function C(e){if(T())e.focus({preventScroll:!0});else{let t=E(e);e.focus(),D(t)}}let w=null;function T(){if(w==null){w=!1;try{document.createElement(`div`).focus({get preventScroll(){return w=!0,!0}})}catch{}}return w}function E(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 D(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function O(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;S()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(g()?r=!0:i=!0);let s=b()&&g()&&!v()?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});O.isOpening=n,C(e),e.dispatchEvent(s),O.isOpening=!1}O.isOpening=!1;const k=typeof document<`u`?e.useLayoutEffect:()=>{},A={prefix:String(Math.round(Math.random()*1e10)),current:0},j=e.createContext(A),te=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let M=new WeakMap;function ne(t=!1){let n=i(j),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=M.get(t);e==null?M.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,M.delete(t))}r.current=++n.current}return r.current}function re(e){let t=i(j),n=ne(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function ie(t){let n=e.useId(),[r]=c(le()),i=r?`react-aria`:`react-aria${A.prefix}`;return t||`${i}-${n}`}const ae=typeof e.useId==`function`?ie:re;function oe(){return!1}function se(){return!0}function ce(e){return()=>{}}function le(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore(ce,oe,se):i(te)}function ue(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 k(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let de=!!(typeof window<`u`&&window.document&&window.document.createElement),N=new Map,P;typeof FinalizationRegistry<`u`&&(P=new FinalizationRegistry(e=>{N.delete(e)}));function fe(e){let[t,n]=c(e),r=s(null),i=ae(t),o=s(null);if(P&&P.register(o,i),de){let e=N.get(i);e&&!e.includes(r)?e.push(r):N.set(i,[r])}return k(()=>{let e=i;return()=>{P&&P.unregister(o),N.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function pe(e,t){if(e===t)return e;let n=N.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=N.get(t);return r?(r.forEach(t=>t.current=e),e):t}function me(e=[]){let t=fe(),[n,i]=ue(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return k(a,[t,a,...e]),n}function he(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const F=e=>e?.ownerDocument??document,I=e=>e&&`window`in e&&e.window===e?e:F(e).defaultView||window;function ge(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function _e(e){return ge(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function L(){return!1}function R(e,t){if(!L())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:_e(n)?n.host:n.parentNode}return!1}const z=(e=document)=>{if(!L())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function B(e){if(L()&&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 ve(e){if(!e)return!1;let t=e.getRootNode(),n=I(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}function ye(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=be(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():be(e[n],null)})}}}function be(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function V(...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]=he(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=u(n,i):e===`id`&&n&&i?t.id=pe(n,i):e===`ref`&&n&&i?t.ref=ye(n,i):t[e]=i===void 0?n:i}}return t}const xe=new Set([`id`]),Se=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Ce=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),we=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Te=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(`.`)),Ee=/^(data-.*)$/;function De(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)&&(xe.has(t)||n&&Se.has(t)||r&&Ce.has(t)||i&&we.has(t)||a&&(Te.has(t)||t.endsWith(`Capture`)&&Te.has(t.slice(0,-7)))||o?.has(t)||Ee.test(t))&&(s[t]=e[t]);return s}let H=new Map,Oe=new Set;function ke(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=B(t);if(!e(t)||!r)return;let i=H.get(r);i||(i=new Set,H.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=B(t);if(!e(t)||!r)return;let i=H.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),H.delete(r)),H.size===0)){for(let e of Oe)e();Oe.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,ke):ke());function Ae(){for(let[e]of H)`isConnected`in e&&!e.isConnected&&H.delete(e)}function je(e){requestAnimationFrame(()=>{Ae(),H.size===0?e():Oe.add(e)})}function Me(){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 Ne(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 Pe=e.useInsertionEffect??k;function U(e){let t=s(null);return Pe(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}function Fe(e,t){k(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Ie(e){return e.pointerType===``&&e.isTrusted?!0:x()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Le(e){return!x()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}const Re=typeof Element<`u`&&`checkVisibility`in Element.prototype;function ze(e){let t=I(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 Be(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 Ve(e,t){return Re?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&ze(e)&&Be(e,t)&&(!e.parentElement||Ve(e.parentElement,e))}const He=[`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`],Ue=He.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;He.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const We=He.join(`:not([hidden]):not([tabindex="-1"]),`);function Ge(e,t){return e.matches(Ue)&&!qe(e)&&(t?.skipVisibilityCheck||Ve(e))}function Ke(e){return e.matches(We)&&Ve(e)&&!qe(e)}function qe(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Je(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let Ye=new WeakMap;function Xe(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Je(t);if(Ye.has(t))return Ye.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof I(n).HTMLMetaElement&&(n.nonce||n.content)||Je(t)||void 0;return r!==void 0&&Ye.set(t,r),r}const Ze=Symbol(`default`);function Qe({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function $e(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 et(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function tt(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Ze;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 nt(e,t,n){let{ref:r,...i}=tt(n,e.slot)||{},a=Ne(o(()=>ye(t,r),[t,r])),s=V(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 rt(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return k(()=>{i.current||n(!1)},[]),[a,t]}function it(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function at(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>ye(r,c),[r,c]);k(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const ot={},st=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=ot[t];return r||(r=n(at.bind(null,t)),ot[t]=r),r}});function ct(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function lt(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function ut(e){let t=s({isFocused:!1,observer:null});return k(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=B(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=ct(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===z()?null:z();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 W=!1;function dt(e){for(;e&&!Ge(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=I(e),n=t.document.activeElement;if(!n||n===e)return;W=!0;let r=!1,i=e=>{(B(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(B(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,C(n),c()))},o=t=>{(B(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(B(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,C(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),W=!1,r=!1},l=requestAnimationFrame(c);return c}let G=`default`,ft=``,K=new WeakMap;function pt(e){if(y()){if(G==="default"){let t=F(e);ft=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}G=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;K.set(e,e.style[t]),e.style[t]=`none`}}function mt(e){if(y()){if(G!==`disabled`)return;G=`restoring`,setTimeout(()=>{je(()=>{if(G===`restoring`){let t=F(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=ft||``),ft=``,G=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&K.has(e)){let t=K.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),K.delete(e)}}const ht=e.createContext({register:()=>{}});ht.displayName=`PressResponderContext`;function gt(e){let t=i(ht);if(t){let{register:n,ref:r,...i}=t;e=V(i,e),n()}return Fe(t,e.ref),e}var q=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 _t=Symbol(`linkClicked`),vt=`react-aria-pressable-style`,yt=`data-react-aria-pressable`;function bt(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:_,ref:v,...y}=gt(e),[b,ee]=c(!1),x=s({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:w}=Me(),T=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new q(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,ee(!0),a},[f,i,n]),E=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 q(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),ee(!1),t&&i&&!f){let n=new q(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),D=U(E),k=U(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new q(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),A=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&E(J(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,w(),_||mt(t.target);for(let e of t.disposables)e();t.disposables=[]}},[_,w,E]),j=U(A),te=r(e=>{h&&A(e)},[h,A]),M=r(e=>{f||d?.(e)},[f,d]),ne=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);lt(n,t),d(ct(n))}},[f,d]),re=o(()=>{let e=x.current,t={onKeyDown(t){if(St(t.nativeEvent,t.currentTarget)&&R(t.currentTarget,B(t))){wt(B(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=T(t,`keyboard`));let i=t.currentTarget;S(F(t.currentTarget),`keyup`,he(t=>{St(t,i)&&!t.repeat&&R(i,B(t))&&e.target&&k(J(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&g()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!R(t.currentTarget,B(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!O.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ie(t.nativeEvent))){let e=T(t,`virtual`),r=k(t,`virtual`),i=D(t,`virtual`);M(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=k(J(t.currentTarget,t),r),a=D(J(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,M(t),j(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&St(t,e.target)){wt(B(t),t.key)&&t.preventDefault();let n=B(t),r=R(e.target,n);D(J(e.target,t),`keyboard`,r),r&&ne(t,e.target),w(),t.key!==`Enter`&&xt(e.target)&&R(e.target,n)&&!t[_t]&&(t[_t]=!0,O(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||!R(t.currentTarget,B(t)))return;if(Le(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,_||pt(e.target),i=T(t,e.pointerType);let a=B(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(F(t.currentTarget),`pointerup`,n,!1),S(F(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(R(t.currentTarget,B(t))&&t.button===0){if(m){let n=dt(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!R(t.currentTarget,B(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&k(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,T(J(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,D(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(R(e.target,B(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?j(t):(C(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else j(t);e.isOverTarget=!1}},r=e=>{j(e)};t.onDragStart=e=>{R(e.currentTarget,B(e))&&j(e)}}return t},[S,f,m,w,_,te,T,M,ne]);return a(()=>{if(!v)return;let e=F(v.current);if(!e||!e.head||e.getElementById(vt))return;let t=e.createElement(`style`);t.id=vt;let n=Xe(e);n&&(t.nonce=n),t.textContent=`
|
|
2
|
+
@layer {
|
|
3
|
+
[${yt}] {
|
|
4
|
+
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
`.trim(),e.head.prepend(t)},[v]),a(()=>{let e=x.current;return()=>{_||mt(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[_]),{isPressed:p||b,pressProps:V(y,re,{[yt]:!0})}}function xt(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function St(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof I(i).HTMLInputElement&&!Et(i,n)||i instanceof I(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&xt(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 Ct(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!xt(e)}function wt(e,t){return e instanceof HTMLInputElement?!Et(e,t):Ct(e)}const Tt=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Et(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Tt.has(e.type)}let Y=null;const Dt=new Set;let X=new Map,Z=!1,Ot=!1;const kt={Tab:!0,Escape:!0};function At(e,t){for(let n of Dt)n(e,t)}function jt(e){return!(e.metaKey||!g()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Mt(e){Z=!0,!O.isOpening&&jt(e)&&(Y=`keyboard`,At(`keyboard`,e))}function Q(e){Y=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(Z=!0,At(`pointer`,e))}function Nt(e){!O.isOpening&&Ie(e)&&(Z=!0,Y=`virtual`)}function Pt(e){let t=I(B(e)),n=F(B(e));B(e)===t||B(e)===n||W||!e.isTrusted||(!Z&&!Ot&&(Y=`virtual`,At(`virtual`,e)),Z=!1,Ot=!1)}function Ft(){W||(Z=!1,Ot=!0)}function It(e){if(typeof window>`u`||typeof document>`u`)return;let t=I(e),n=F(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`,Mt,!0),n.addEventListener(`keyup`,Mt,!0),n.addEventListener(`click`,Nt,!0),t.addEventListener(`focus`,Pt,!0),t.addEventListener(`blur`,Ft,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Q,!0),n.addEventListener(`pointermove`,Q,!0),n.addEventListener(`pointerup`,Q,!0)),t.addEventListener(`beforeunload`,()=>{Lt(e)},{once:!0}),X.set(t,{focus:r})}const Lt=(e,t)=>{let n=I(e),r=F(e);t&&r.removeEventListener(`DOMContentLoaded`,t),X.has(n)&&(n.HTMLElement.prototype.focus=X.get(n).focus,r.removeEventListener(`keydown`,Mt,!0),r.removeEventListener(`keyup`,Mt,!0),r.removeEventListener(`click`,Nt,!0),n.removeEventListener(`focus`,Pt,!0),n.removeEventListener(`blur`,Ft,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Q,!0),r.removeEventListener(`pointermove`,Q,!0),r.removeEventListener(`pointerup`,Q,!0)),X.delete(n))};function Rt(e){let t=F(e),n;return t.readyState===`loading`?(n=()=>{It(e)},t.addEventListener(`DOMContentLoaded`,n)):It(e),()=>Lt(e,n)}typeof document<`u`&&Rt();function zt(){return Y!==`pointer`}function Bt(){return Y}function Vt(e){Y=e,At(e,null)}const Ht=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Ut(e,t,n){let r=n?B(n):void 0,i=F(r),a=I(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=z(i);return e=e||u instanceof o&&!Ht.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!kt[n.key])}function Wt(e,t,n){It(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Ut(!!n?.isTextInput,t,r)&&e(zt())};return Dt.add(t),()=>{Dt.delete(t)}},t)}function Gt(e){if(!e.isConnected)return;let t=F(e);if(Bt()===`virtual`){let n=z(t);je(()=>{let r=z(t);(r===n||r===t.body)&&e.isConnected&&C(e)})}else C(e)}function Kt(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(B(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=ut(o),c=r(e=>{let t=B(e),r=F(t),i=r?z(r):z();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 qt(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 Jt(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:qt(e.onKeyDown),onKeyUp:qt(e.onKeyUp)}}}let Yt=e.createContext(null);function Xt(e){let t=i(Yt)||{};Fe(t,e);let{ref:n,...r}=t;return r}function Zt(e,t){let{focusProps:n}=Kt(e),{keyboardProps:r}=Jt(e),i=V(n,r),o=Xt(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&Gt(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:V({...i,tabIndex:u},c)}}function Qt(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=Me(),u=r(e=>{R(e.currentTarget,B(e))&&o.current.isFocusWithin&&!R(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=ut(u),f=r(e=>{if(!R(e.currentTarget,B(e)))return;let t=B(e),n=F(t),r=z(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=B(e);if(o.current.isFocusWithin&&!R(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});lt(e,t);let i=ct(e);u(i)}},{capture:!0})}},[i,a,d,c,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:u}}}function $t(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||zt()}),[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=zt(),l(e),f()},[f]);Wt(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=Kt({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=Qt({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let en=!1,tn=0;function nn(){en=!0,setTimeout(()=>{en=!1},500)}function rn(e){e.pointerType===`touch`&&nn()}function an(){let e=F(null);if(e!==void 0)return tn===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,rn),tn++,()=>{tn--,!(tn>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,rn)}}function on(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(an,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=Me(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!R(e.currentTarget,B(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(F(B(e)),`pointerover`,e=>{d.isHovered&&d.target&&!R(d.target,B(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=>{en&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&R(e.currentTarget,B(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 sn=t(!1);function cn(e){let t=(t,n)=>i(sn)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}function ln(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}=bt({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Zt(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=V(y,_,De(e,{labelable:!0}));return{isPressed:v,buttonProps:V(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 un=t(null),dn=7e3;let $=null;function fn(e,t=`assertive`,n=dn){$?$.announce(e,t,n):($=new pn,(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 pn=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=dn){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 mn=t({}),hn=cn(function(t,n){[t,n]=nt(t,n,mn);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=ln(t,n);o=_n(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=$t(t),{hoverProps:f,isHovered:p}=on({...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=$e({...t,values:m,defaultClassName:`react-aria-Button`}),g=fe(o.id),_=fe(),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)&&fn(e,`assertive`),y.current=i},[i,u,v,g]);let b=De(t,{global:!0});return delete b.onClick,e.createElement(st.button,{...V(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(un.Provider,{value:{id:_}},h.children))}),gn=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function _n(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!gn.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{R as A,le as B,Ge as C,De as D,Ne as E,F,f as G,ee as H,I,he as L,z as M,B as N,V as O,L as P,me as R,Xe as S,U as T,x as U,k as V,y as W,et as _,$t as a,it as b,Gt as c,bt as d,ht as f,rt as g,$e as h,on as i,ve as j,ye as k,Bt as l,nt as m,hn as n,Qt as o,Qe as p,cn as r,Zt as s,mn as t,Vt as u,Ze as v,Ke as w,tt as x,st as y,fe as z};
|
|
@@ -1,6 +1,130 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
1
|
+
import { a as RatingAnswer, i as MultiSelectAnswer, o as SingleSelectAnswer, r as BugReportAnswer, t as PublicGetSurveyOutput } from "./index-CER9nZlw.js";
|
|
2
|
+
import { PropsWithChildren, ReactNode } from "react";
|
|
3
3
|
|
|
4
|
+
//#region src/core/types.d.ts
|
|
5
|
+
type Question$1 = {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
} & PublicGetSurveyOutput['questions'][number];
|
|
9
|
+
type Answer = BugReportAnswer | RatingAnswer | MultiSelectAnswer | SingleSelectAnswer;
|
|
10
|
+
interface ConfettiState {
|
|
11
|
+
questions: Question$1[];
|
|
12
|
+
current: number;
|
|
13
|
+
/**
|
|
14
|
+
* All answers entered so far, keyed by question id, including answers to
|
|
15
|
+
* questions that are momentarily unreachable after a reroute. Lets a flow
|
|
16
|
+
* template seed a revisited question with its prior input on back-navigation.
|
|
17
|
+
*/
|
|
18
|
+
answers: Record<Question$1['id'], Answer | null>;
|
|
19
|
+
update: ({
|
|
20
|
+
question,
|
|
21
|
+
answer
|
|
22
|
+
}: {
|
|
23
|
+
question: number;
|
|
24
|
+
answer: Answer;
|
|
25
|
+
}) => {
|
|
26
|
+
next?: number;
|
|
27
|
+
error?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Steps back to the previous reachable question by position. A no-op when
|
|
31
|
+
* already at the first reachable question. Wired up by the one-question-at-a-
|
|
32
|
+
* time templates (stepper and popover); the embedded and modal templates
|
|
33
|
+
* render every question at once, so back-navigation does not apply.
|
|
34
|
+
*/
|
|
35
|
+
back: () => void;
|
|
36
|
+
/** Whether a previous reachable question exists to step back to. */
|
|
37
|
+
canGoBack: boolean;
|
|
38
|
+
/** Custom label for the Back button. Falls back to `BackButton`'s own default when unset. */
|
|
39
|
+
backButtonLabel: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Records a question's in-progress answer without validating, navigating,
|
|
42
|
+
* or auto-submitting — unlike `update`, a plain draft-save. Lets a flow
|
|
43
|
+
* template preserve what the respondent typed when they leave via Back
|
|
44
|
+
* rather than Next/Submit, so revisiting the question later still shows it.
|
|
45
|
+
*/
|
|
46
|
+
saveAnswer: (question: Question$1['id'], answer: Answer) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Submits the survey, or, when a visible question is unanswered or invalid,
|
|
49
|
+
* refuses and reveals the blocking errors through `errors`. Render an
|
|
50
|
+
* always-enabled submit control and let this decide.
|
|
51
|
+
*
|
|
52
|
+
* Returns whether the submission was accepted. Anything that should only
|
|
53
|
+
* happen on a real submission — navigation, analytics — must be gated on
|
|
54
|
+
* this rather than assuming the press went through.
|
|
55
|
+
*/
|
|
56
|
+
submit: () => boolean;
|
|
57
|
+
isSubmitted: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Blocking errors keyed by question id. Empty until the first submit
|
|
60
|
+
* attempt, then updated live as answers change.
|
|
61
|
+
*/
|
|
62
|
+
errors: Record<Question$1['id'], string>;
|
|
63
|
+
}
|
|
64
|
+
interface Proxyable {
|
|
65
|
+
/**
|
|
66
|
+
* Origin of the proxy that forwards Confetti API requests. The hosted
|
|
67
|
+
* templates also load the widget bundle and stylesheet from it.
|
|
68
|
+
*/
|
|
69
|
+
proxyUrl?: string;
|
|
70
|
+
}
|
|
71
|
+
type WithProxyable<T> = Omit<T, 'apiBaseUrl'> & Proxyable;
|
|
72
|
+
interface Finishable {
|
|
73
|
+
/**
|
|
74
|
+
* Callback is invoked after the survey response is submitted and the
|
|
75
|
+
* submission network call settles.
|
|
76
|
+
*/
|
|
77
|
+
onFinished?: () => void;
|
|
78
|
+
}
|
|
79
|
+
interface Closable {
|
|
80
|
+
/**
|
|
81
|
+
* Callback is invoked whenever the survey closes, regardless of how it was closed.
|
|
82
|
+
*/
|
|
83
|
+
onClose?: () => void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Wraps the rendered survey in a consumer-provided container. Receives an
|
|
87
|
+
* object holding the survey node and returns the wrapped tree. The object
|
|
88
|
+
* shape leaves room to pass extra render data in the future.
|
|
89
|
+
*/
|
|
90
|
+
type ConfettiContainer = (props: {
|
|
91
|
+
survey: ReactNode;
|
|
92
|
+
}) => ReactNode;
|
|
93
|
+
interface Containable {
|
|
94
|
+
/**
|
|
95
|
+
* Wraps the rendered survey in a consumer-provided container for theming.
|
|
96
|
+
* Only invoked once the survey passes its visibility gates, so the container
|
|
97
|
+
* never renders while the survey is hidden, and unmounts when the survey
|
|
98
|
+
* closes.
|
|
99
|
+
*
|
|
100
|
+
* Prefer an inline function. To carry state or animation, render your own
|
|
101
|
+
* component inside it: `container={({ survey }) => <BrandShell>{survey}</BrandShell>}`.
|
|
102
|
+
*/
|
|
103
|
+
container?: ConfettiContainer;
|
|
104
|
+
}
|
|
105
|
+
interface Dismissable extends Closable {
|
|
106
|
+
/**
|
|
107
|
+
* The widget will automatically close this many milliseconds
|
|
108
|
+
* after the survey is finished.
|
|
109
|
+
* Set to `null` to disable automatic closing.
|
|
110
|
+
* @default 3000
|
|
111
|
+
*/
|
|
112
|
+
closeOnFinishMs?: number | null;
|
|
113
|
+
/**
|
|
114
|
+
* Callback is invoked when the user dismisses the survey before submitting.
|
|
115
|
+
* Closing after submission is not a dismissal and does not invoke this.
|
|
116
|
+
*/
|
|
117
|
+
onDismiss?: () => void;
|
|
118
|
+
}
|
|
119
|
+
interface OptionallyDismissable extends Dismissable {
|
|
120
|
+
/**
|
|
121
|
+
* Allows the user to dismiss the modal via the close button and the
|
|
122
|
+
* overlay.
|
|
123
|
+
* @default true
|
|
124
|
+
*/
|
|
125
|
+
isDismissable?: boolean;
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
4
128
|
//#region src/core/ConfettiController.d.ts
|
|
5
129
|
interface ConfettiControllerProps extends Finishable {
|
|
6
130
|
children: (props: ConfettiState) => React.ReactElement;
|
|
@@ -163,6 +287,12 @@ interface BaseFieldProps {
|
|
|
163
287
|
required?: boolean;
|
|
164
288
|
onChange: (answer: Answer) => void;
|
|
165
289
|
error?: string;
|
|
290
|
+
/**
|
|
291
|
+
* Prior answer used to seed the field's initial state, so a question
|
|
292
|
+
* revisited via back-navigation shows the respondent's earlier input rather
|
|
293
|
+
* than an empty field. Undefined for a first visit.
|
|
294
|
+
*/
|
|
295
|
+
defaultAnswer?: Answer;
|
|
166
296
|
}
|
|
167
297
|
//#endregion
|
|
168
298
|
//#region src/components/questions/BugReport/BugReport.d.ts
|
|
@@ -202,4 +332,4 @@ declare const Confetti: ({
|
|
|
202
332
|
...props
|
|
203
333
|
}: ConfettiProps) => import("react").JSX.Element;
|
|
204
334
|
//#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 };
|
|
335
|
+
export { WithProxyable as A, ConfettiState as C, OptionallyDismissable as D, Finishable as E, Proxyable as O, ConfettiContainer as S, Dismissable as T, useSurvey as _, BaseFieldProps as a, Answer as b, ConfettiProviderProps as c, RespondentVisibilityProviderProps as d, WithVisibilityControl as f, SurveyProviderProps as g, SurveyProvider as h, BugReportOptions as i, Question$1 as k, 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, Containable as w, Closable as x, ConfettiControllerProps as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./Button-LiaNjkvk.js";import{t}from"./src-BewqzpwC.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-DRQBj9sz.js";import{D as i,E as a,G as o,I as s,N as c,O as l,R as u,T as d,V as f,_ as p,a as m,b as h,d as g,g as _,h as v,i as y,k as b,m as x,n as S,o as C,p as w,r as T,s as E,u as D,x as O,y as k,z as A}from"./Button-LiaNjkvk.js";import{a as j,c as M,d as ee,i as te,l as ne,o as re,r as ie,s as ae,u as oe}from"./src-BewqzpwC.js";import{a as se,n as ce,o as le,r as ue,t as de}from"./internals-DYTVPK_r.js";import{d as fe,f as pe,h as me,i as he,l as ge,m as _e,p as ve,r as ye,s as be,u as xe}from"./ModalContainer-Du6BhvXW.js";import N,{Suspense as Se,cloneElement as Ce,createContext as P,forwardRef as F,isValidElement as we,lazy as Te,useCallback as I,useContext as L,useEffect as R,useMemo as z,useRef as B,useState as V}from"react";import{useTimeout as Ee}from"usehooks-ts";import{Fragment as H,jsx as U,jsxs as W}from"react/jsx-runtime";import G from"clsx";import"react-dom";function De(e,t,n){let r=d(e=>{n&&!e.defaultPrevented&&n(t)});R(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Oe(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=A(t);let o=A(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=ve({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function ke(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Oe(e),s=u([!!t,!!n,r,i]),c=u([!!t,!!n,r,i]);return o=l(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function Ae(e,t,n){let{validationBehavior:r,focus:i}=e;f(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Me(n.current))}});let a=B(!1),o=d(()=>{a.current||t.resetValidation()}),s=d(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ne(r)===n.current&&(i?i():n.current?.focus(),D(`keyboard`)),e.preventDefault()}),l=d(()=>{t.commitValidation()});R(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&c(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function je(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 Me(e){return{isInvalid:!e.validity.valid,validationDetails:je(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Ne(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 Pe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Fe={...Pe,customError:!0,valid:!1},K={isInvalid:!1,validationDetails:Pe,validationErrors:[]},Ie=P({}),Le=`__reactAriaFormValidationState`;function q(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Le];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Re(e)}function Re(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:Fe},l=z(()=>!o||i==null?null:Ve(Be(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=L(Ie),d=z(()=>r?Array.isArray(r)?r.flatMap(e=>ze(u[e])):ze(u[r]):[],[u,r]),[f,p]=V(u),[m,h]=V(!1);u!==f&&(p(u),h(!1));let g=z(()=>Ve(m?[]:d),[m,d]),_=B(K),[v,y]=V(K),b=B(K),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;He(e,b.current)||(b.current=e,y(e))},[S,C]=V(!1);return R(x),{realtimeValidation:c||g||l||a||K,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!He(v,e)?y(e):_.current=e},resetValidation(){let e=K;He(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function ze(e){return e?Array.isArray(e)?e:[e]:[]}function Be(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return ze(n)}return[]}function Ve(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Fe}:null}function He(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Ue(...e){let t=new Set,n=!1,r={...Pe};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 We(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:a=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:u=`aria`}=e,[d,f]=xe(e.value,e.defaultValue||``,e.onChange),{focusableProps:p}=E(e,t),m=q({...e,value:d}),{isInvalid:h,validationErrors:g,validationDetails:_}=m.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=ke({...e,isInvalid:h,errorMessage:e.errorMessage||g}),S=i(e,{labelable:!0}),C={type:s,pattern:e.pattern},[w]=V(d);return De(t,e.defaultValue??w,f),Ae(e,m,t),{labelProps:v,inputProps:l(S,n===`input`?C:void 0,{disabled:r,readOnly:o,required:a&&u===`native`,"aria-required":a&&u===`aria`||void 0,"aria-invalid":h||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:d,onChange:e=>f(c(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(N.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...p,...y}),descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_}}function Ge(e,t,n){let{isDisabled:r=!1,isReadOnly:a=!1,value:o,name:s,form:u,children:d,"aria-label":f,"aria-labelledby":p,validationState:m=`valid`,isInvalid:h,onPressStart:_,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S}=e,C=e=>{e.stopPropagation(),t.setSelected(c(e).checked)},{pressProps:w,isPressed:T}=g({onPressStart:_,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S,isDisabled:r}),{pressProps:D,isPressed:O}=g({onPressStart:_,onPressEnd:v,onPressChange:y,onPressUp:x,onClick:S,onPress(e){b?.(e),t.toggle(),n.current?.focus()},isDisabled:r||a}),{focusableProps:k}=E(e,n),A=l(w,k),j=i(e,{labelable:!0});return De(n,t.defaultSelected,t.setSelected),{labelProps:l(D,{onClick:e=>e.preventDefault()}),inputProps:l(j,{"aria-invalid":h||m===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":a||void 0,onChange:C,disabled:r,...o==null?{}:{value:o},name:s,form:u,type:`checkbox`,...A}),isSelected:t.isSelected,isPressed:T||O,isDisabled:r,isReadOnly:a,isInvalid:h||m===`invalid`}}function Ke(e,t,n){let r=q({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:u,isPressed:d,isDisabled:f,isReadOnly:p}=Ge({...e,isInvalid:i},t,n);Ae(e,r,n);let{isIndeterminate:m,isRequired:h,validationBehavior:_=`aria`}=e;R(()=>{n.current&&(n.current.indeterminate=!!m)});let{pressProps:v}=g({isDisabled:f||p,onPress(){let{[Le]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:l(s,v,z(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:u,"aria-required":h&&_===`aria`||void 0,required:h&&_===`native`},isSelected:u,isPressed:d,isDisabled:f,isReadOnly:p,isInvalid:i,validationErrors:a,validationDetails:o}}const qe=new WeakMap;function Je(e,t){let{isDisabled:n,name:r,form:a,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:u}=t.displayValidation,{labelProps:d,fieldProps:f,descriptionProps:p,errorMessageProps:m}=ke({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});qe.set(t,{name:r,form:a,descriptionId:p.id,errorMessageId:m.id,validationBehavior:o});let h=i(e,{labelable:!0}),{focusWithinProps:g}=C({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:l(h,{role:`group`,"aria-disabled":n||void 0,...f,...g}),labelProps:d,descriptionProps:p,errorMessageProps:m,isInvalid:s,validationErrors:c,validationDetails:u}}function Ye(e={}){let{isReadOnly:t}=e,[n,r]=xe(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=V(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function Xe(e,t,n){let r=Ye({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}=qe.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=q({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=B(K),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};R(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=Ke({...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,[Le]:{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 Ze=new WeakMap;function Qe(e,t,n){let{value:r,children:a,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:u,onPressChange:d,onPress:f,onPressUp:p,onClick:m}=e,h=e.isDisabled||t.isDisabled,_=t.selectedValue===r,v=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:y,isPressed:b}=g({onPressStart:c,onPressEnd:u,onPressChange:d,onPress:f,onPressUp:p,onClick:m,isDisabled:h}),{pressProps:x,isPressed:S}=g({onPressStart:c,onPressEnd:u,onPressChange:d,onPressUp:p,onClick:m,isDisabled:h,onPress(e){f?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:C}=E(l(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),w=l(y,C),T=i(e,{labelable:!0}),D=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(D=0):t.selectedValue===r&&(D=0),h&&(D=void 0);let{name:O,form:k,descriptionId:A,errorMessageId:j,validationBehavior:M}=Ze.get(t);return De(n,t.defaultSelectedValue,t.setSelectedValue),Ae({validationBehavior:M},t,n),{labelProps:l(x,z(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:l(T,{...w,type:`radio`,name:O,form:k,tabIndex:D,disabled:h,required:t.isRequired&&M===`native`,checked:_,value:r,onChange:v,"aria-describedby":[e[`aria-describedby`],t.isInvalid?j:null,A].filter(Boolean).join(` `)||void 0}),isDisabled:h,isSelected:_,isPressed:b||S}}function $e(e,t){let{name:n,form:r,isReadOnly:a,isRequired:o,isDisabled:u,orientation:d=`vertical`,validationBehavior:f=`aria`}=e,{direction:p}=pe(),{isInvalid:m,validationErrors:h,validationDetails:g}=t.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=ke({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||h}),x=i(e,{labelable:!0}),{focusWithinProps:S}=C({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),w=e=>{let n;switch(e.key){case`ArrowRight`:n=p===`rtl`&&d!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=p===`rtl`&&d!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=fe(e.currentTarget,{from:c(e),accept:e=>e instanceof s(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},T=A(n);return Ze.set(t,{name:T,form:r,descriptionId:y.id,errorMessageId:b.id,validationBehavior:f}),{radioGroupProps:l(x,{role:`radiogroup`,onKeyDown:w,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":a||void 0,"aria-required":o||void 0,"aria-disabled":u||void 0,"aria-orientation":d,...v,...S}),labelProps:_,descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}const et=P({}),J=T(function(e,t){[e,t]=x(e,t,et);let{elementType:n=`label`,...r}=e,i=k[n];return N.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),tt=P({}),Y=F(function(e,t){[e,t]=x(e,t,tt);let{elementType:n=`span`,...r}=e,i=k[n];return N.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function nt(e={}){let[t,n]=xe(e.value,e.defaultValue||[],e.onChange),[r]=V(t),i=!!e.isRequired&&t.length===0,a=B(new Map),o=q({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Ue(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let rt=Math.round(Math.random()*1e10),it=0;function at(e){let t=z(()=>e.name||`radio-group-${rt}-${++it}`,[e.name]),[n,r]=xe(e.value,e.defaultValue??null,e.onChange),[i]=V(n),[a,o]=V(null),s=q({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const X=P(null),Z=F(function(e,t){return L(X)?.isInvalid?N.createElement(ot,{...e,ref:t}):null}),ot=F((e,t)=>{let n=L(X),r=i(e,{global:!0}),a=v({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return a.children==null?null:N.createElement(Y,{slot:`errorMessage`,...r,...a,ref:t})}),st=P(null),ct=P(null),lt=P(null),ut=F(function(e,t){[e,t]=x(e,t,ct);let{validationBehavior:n}=O(st)||{},r=e.validationBehavior??n??`native`,a=nt({...e,validationBehavior:r}),[o,s]=_(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=Je({...e,label:s,validationBehavior:r},a),m=v({...e,values:{isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-CheckboxGroup`}),h=i(e,{global:!0});return N.createElement(k.div,{...l(h,m,c),ref:t,slot:e.slot||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},N.createElement(w,{values:[[lt,a],[et,{...u,ref:o,elementType:`span`}],[tt,{slots:{description:d,errorMessage:f}}],[X,p]]},m.children))}),dt=F(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=x(r,t,me);let{validationBehavior:o}=O(st)||{},s=e.validationBehavior??o??`native`,c=L(lt),u=a(z(()=>b(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:g,isReadOnly:_,isPressed:S,isInvalid:C}=c?Xe({...h(e),value:e.value,children:typeof e.children==`function`||e.children},c,u):Ke({...h(e),children:typeof e.children==`function`||e.children,validationBehavior:s},Ye(e),u),{isFocused:w,isFocusVisible:T,focusProps:E}=m(),D=g||_,{hoverProps:A,isHovered:j}=y({...e,isDisabled:D}),M=v({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:S,isHovered:j,isFocused:w,isFocusVisible:T,isDisabled:g,isReadOnly:_,isInvalid:C,isRequired:e.isRequired||!1}}),ee=i(e,{global:!0});return delete ee.id,delete ee.onClick,N.createElement(k.label,{...l(ee,d,A,M),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":S||void 0,"data-hovered":j||void 0,"data-focused":w||void 0,"data-focus-visible":T||void 0,"data-disabled":g||void 0,"data-readonly":_||void 0,"data-invalid":C||void 0,"data-required":e.isRequired||void 0},N.createElement(ge,{elementType:`span`},N.createElement(`input`,{...l(f,E),ref:u})),M.children)}),ft=P({}),pt=P({});let mt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const ht=T(function(e,t){[e,t]=x(e,t,pt);let{hoverProps:n,isHovered:r}=y({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=m({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=v({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return N.createElement(k.input,{...l(mt(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),gt=P(null);function _t(e){let t=B({});return N.createElement(gt.Provider,{value:t},e.children)}const vt=P({isSelected:!1}),yt=P(null),bt=P(null),xt=P(null),St=F(function(e,t){[e,t]=x(e,t,yt);let{validationBehavior:n}=O(st)||{},r=e.validationBehavior??n??`native`,a=at({...e,validationBehavior:r}),[o,s]=_(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=$e({...e,label:s,validationBehavior:r},a),m=v({...e,values:{orientation:e.orientation||`vertical`,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:a.isRequired,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-RadioGroup`}),h=i(e,{global:!0});return N.createElement(k.div,{...l(h,m,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":a.isRequired||void 0},N.createElement(w,{values:[[xt,a],[et,{...u,ref:o,elementType:`span`}],[tt,{slots:{description:d,errorMessage:f}}],[X,p]]},N.createElement(_t,null,m.children)))}),Ct=F(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=x(r,t,bt);let o=N.useContext(xt),s=a(z(()=>b(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:c,inputProps:u,isSelected:d,isDisabled:f,isPressed:p}=Qe({...h(e),children:typeof e.children==`function`||e.children},o,s),{isFocused:g,isFocusVisible:_,focusProps:S}=m(),C=f||o.isReadOnly,{hoverProps:w,isHovered:T}=y({...e,isDisabled:C}),E=v({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:d,isPressed:p,isHovered:T,isFocused:g,isFocusVisible:_,isDisabled:f,isReadOnly:o.isReadOnly,isInvalid:o.isInvalid,isRequired:o.isRequired}}),D=i(e,{global:!0});return delete D.id,delete D.onClick,N.createElement(k.label,{...l(D,c,w,E),ref:t,"data-selected":d||void 0,"data-pressed":p||void 0,"data-hovered":T||void 0,"data-focused":g||void 0,"data-focus-visible":_||void 0,"data-disabled":f||void 0,"data-readonly":o.isReadOnly||void 0,"data-invalid":o.isInvalid||void 0,"data-required":o.isRequired||void 0},N.createElement(ge,{elementType:`span`},N.createElement(`input`,{...l(u,S),ref:s})),N.createElement(vt.Provider,{value:{isSelected:d}},E.children))}),wt=P({});let Tt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Et=F(function(e,t){[e,t]=x(e,t,wt);let{hoverProps:n,isHovered:r}=y(e),{isFocused:i,isFocusVisible:a,focusProps:o}=m({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=v({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return N.createElement(k.textarea,{...l(Tt(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),Dt=P(null),Ot=T(function(e,t){[e,t]=x(e,t,Dt);let{validationBehavior:n}=O(st)||{},r=e.validationBehavior??n??`native`,a=B(null);[e,a]=x(e,a,_e);let[o,s]=_(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=V(`input`),{labelProps:u,inputProps:d,descriptionProps:f,errorMessageProps:p,...m}=We({...h(e),inputElementType:c,label:s,validationBehavior:r},a),g=I(e=>{a.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[a]),y=v({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:m.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=i(e,{global:!0});return delete b.id,N.createElement(k.div,{...b,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":m.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},N.createElement(w,{values:[[et,{...u,ref:o}],[pt,{...d,ref:g}],[wt,{...d,ref:g}],[ft,{role:`presentation`,isInvalid:m.isInvalid,isDisabled:e.isDisabled||!1}],[tt,{slots:{description:f,errorMessage:p}}],[X,m]]},y.children))});function kt(e){return e.issues[0]?.message??`Invalid input`}const At=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=[...e].sort((e,t)=>e.position-t.position),a=r>=0?i[r]:void 0,o=le(i,t,{forceReachableIds:a?[a.id]:void 0}),s=i.map((e,t)=>{let i={...e},a=n[e.id];return a&&(i.error=a),{...i,visible:r===t||o.has(e.id)}}),c=s.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return c===-1&&(c=s.findLastIndex(e=>!!e.visible)),{questions:s,currentIndex:c}},Q={rating:({scale:e},t)=>re({scale:e},t),"open-ended":({max:e},t)=>j({maxLength:e},t),"single-select":({editable:e},t)=>ae({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>te({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>M(),"bug-report":(e,t)=>ie({},t)},jt=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Q[n];return r(e,t)}case`open-ended`:{let r=Q[n];return r(e,t)}case`single-select`:{let r=Q[n];return r(e,t)}case`multi-select`:{let r=Q[n];return r(e,t)}case`statement`:{let r=Q[n];return r(e,t)}case`bug-report`:{let r=Q[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Mt=({questions:e,answers:t})=>{let n=Nt({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Nt=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Pt=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Ft={},It=({questions:e,answers:t,errors:n})=>{let r={};for(let i of e){if(!i.visible||!i.required||t[i.id]!==void 0||n[i.id])continue;let e=jt(i.properties,{required:i.required}).safeParse(void 0);e.success||(r[i.id]=kt(e.error))}return r},Lt=e=>{let t=e.querySelector(`[data-invalid]`);if(!t)return;let n=t.getAttribute(`role`);if(n===`radiogroup`||n===`group`){t.tabIndex=-1,t.focus();return}t.querySelector(`textarea, input`)?.focus()},Rt=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i})=>{let{survey:a,submit:o}=be(),[s,c]=V({}),[l,u]=V({}),[d,f]=V(null),p=z(()=>At({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),m=e??d??p.currentIndex,h=z(()=>!!a?.isBackNavigationAllowed&&m>0&&p.questions.slice(0,m).some(e=>!!e.visible),[a?.isBackNavigationAllowed,p.questions,m]),g=I((e,t)=>{c(n=>n[e]===t?n:{...n,[e]:t})},[]),_=I(()=>{a?.isBackNavigationAllowed&&f(t=>{let n=t??e??p.currentIndex;for(let e=n-1;e>=0;e--)if(p.questions[e]?.visible)return e;return t})},[a?.isBackNavigationAllowed,p.questions,p.currentIndex,e]),[v,y]=V(0),b=v>0,x=B(null),[S,C]=V(!1);R(()=>{v===0||!x.current||Lt(x.current)},[v]);let w=I(({answers:e})=>{o({answers:e}).finally(()=>{r?.()})},[r,o]),T=I(()=>{let e=Pt({questions:p.questions,errors:l}),t=It({questions:p.questions,answers:s,errors:e}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&u(e=>({...e,...t})),y(e=>e+1),!1;let i=Mt({questions:p.questions,answers:s});return w({answers:i}),C(!0),n?.(),!0},[s,l,p.questions,w,n]),E=I(({question:r,answer:i})=>{let o=p.questions.at(r);if(!o)return{error:`Question index is invalid`};let m=jt(o.properties,{required:o.required}).safeParse(i);if(!m.success){let e=kt(m.error);return u(t=>{if(t[o.id]===e)return t;let n={...t};return n[o.id]=e,n}),c(e=>{if(!(o.id in e))return e;let t={...e};return delete t[o.id],t}),{error:e}}u(e=>{if(!e[o.id])return e;let t={...e};return delete t[o.id],t});let h=!o.required&&!i?null:i,g={...s},_=g[o.id]!==h;g[o.id]=h;let v=At({originalQuestions:a?.questions,answers:g,errors:l,pointer:e});_&&c(g);let y=v.questions.findIndex((e,t)=>t>r&&!!e.visible);if(d!==null&&y!==-1)return f(y),{next:y};if(f(null),v.questions.filter(({visible:e})=>!!e).every(({id:e})=>g[e]!==void 0)&&t){let e=Mt({questions:v.questions,answers:g});w({answers:e}),C(!0),n?.()}return{next:v.currentIndex}},[p.questions,s,a?.questions,l,t,e,d,w,n]);return p.questions.length===0?U(H,{}):U(`div`,{ref:x,className:`confetti ${de}`,"data-show-errors":b||void 0,children:i({questions:p.questions,current:m,answers:s,update:E,back:_,canGoBack:h,backButtonLabel:a?.backButtonLabel??void 0,saveAnswer:g,submit:T,isSubmitted:S,errors:b?l:Ft})})},zt=P(null);function Bt({children:i,surveyId:a,publishableKey:s,apiBaseUrl:c,respondent:l,isSurveyVisible:u}){let d=e({surveyId:a,override:l}),f=o({publishableKey:s,apiBaseUrl:c}),{isAvailable:p,isSettled:m}=r({client:f,surveyId:a}),{state:h,isSettled:g}=t({client:f,surveyId:a,respondent:d}),_=z(()=>({respondent:d}),[d]);return!d||!m||!g||!p||!n(h,u)?null:U(zt.Provider,{value:_,children:i})}function Vt(e){return L(zt)?U(H,{children:e.children}):U(Bt,{...e})}function Ht(){let e=L(zt);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const Ut=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=be(),[l,u]=V(!1),[d,f]=V(!1),[p,m]=V(!1),[h,g]=V(!1);return Ee(()=>{s&&i?.()},d&&!(p||h)?a:null),W(`div`,{className:G(`confetti-dialog ${de}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),m(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),m(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),g(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[U(ye,{className:G(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{l||(await c(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>u(!0),setIsFinished:()=>f(!0)}):e]})},Wt=3e4,Gt=({maskAllInputs:e,initialEventsJson:t}={})=>{let[n,r]=V(()=>t??null),[i,a]=V(!1),[o,s]=V(null),[c,l]=V(30),u=B(null),d=B(null),f=B(null),p=B([]);R(()=>{let e=new CustomEvent(ue,{detail:{isRecording:i}});document.dispatchEvent(e)},[i]);let m=I(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null),u.current=null,l(Wt/1e3)},[]),h=I(()=>{u.current?.(),m(),a(!1),r(JSON.stringify(p.current))},[m]);return{recordingEventsJson:n,isRecording:i,recordingError:o,remainingSeconds:c,startRecording:I(async()=>{a(!0),s(null),r(null),p.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);u.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{p.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=Wt/1e3;l(n),d.current=setInterval(()=>{--n,l(n)},1e3),f.current=setTimeout(()=>{h()},Wt)}catch{s(`Failed to start recording. Please try again.`),a(!1),m()}},[e,h,m]),stopRecording:h,clear:I(()=>{m(),a(!1),r(null),s(null),p.current=[]},[m])}},Kt=e=>e.replace(/\S/g,`*`),qt=e=>`*`.repeat(e.length),Jt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):Jt(n,t)},Yt=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,qt(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=qt(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=qt(t.textContent)},Xt=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${ce}`)){Jt(e,e=>{e.data=Kt(e.data)}),Yt(e);for(let t of e.querySelectorAll(`input, textarea, select`))Yt(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))Yt(e)}}}),Zt=({maskAllInputs:e,initialDataUrl:t}={})=>{let[n,r]=V(()=>t??null),[i,a]=V(!1),[o,s]=V(null);return{screenshotDataUrl:n,isCapturing:i,captureError:o,capture:I(async()=>{a(!0),s(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),n=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${de}`],excludeMode:`hide`,plugins:[Xt({maskInputs:!!e})],fast:!1})).toCanvas(),i=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*i),n.width),o=Math.min(Math.round(window.innerHeight*i),n.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(n,0,0,a,o,0,0,a,o),r(s.toDataURL(`image/png`))}catch{s(`Failed to capture screenshot. Please try again.`)}finally{a(!1)}},[e]),clear:I(()=>{r(null),s(null)},[])}},Qt=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[U(`circle`,{cx:`12`,cy:`12`,r:`10`}),U(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),$t=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[U(`path`,{d:`M10 11v6`}),U(`path`,{d:`M14 11v6`}),U(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),U(`path`,{d:`M3 6h18`}),U(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function en(){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 tn(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=en();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 nn=Te(()=>import(`./RecordingReplayer-DNYXhses.js`)),rn=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c,defaultAnswer:l})=>{let u=z(()=>tn(),[]),d=l&&typeof l==`object`&&`title`in l?l:void 0,[f,p]=V(()=>d?.title??``),[m,h]=V(()=>d?.description??``),{screenshotDataUrl:g,isCapturing:_,captureError:v,capture:y,clear:b}=Zt({maskAllInputs:c,initialDataUrl:d?.screenshotDataUrl}),{recordingEventsJson:x,isRecording:C,recordingError:w,remainingSeconds:T,startRecording:E,stopRecording:D,clear:O}=Gt({maskAllInputs:c,initialEventsJson:d?.recordingEventsJson}),k=z(()=>({title:f,...m?{description:m}:{},...g?{screenshotDataUrl:g}:{},...x?{recordingEventsJson:x}:{},metadata:u}),[m,u,x,g,f]);R(()=>{i(k)},[k,i]),R(()=>()=>{D()},[D]);let A=z(()=>x?JSON.parse(x):[],[x]);return U(H,{children:C?W(S,{className:G(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:D,children:[U(Qt,{}),W(`span`,{children:[30-T,`s /`,` `,30,`s`]})]}):W(`div`,{className:G(`cf-bug-report`,s?.base),children:[W(Ot,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:f,onChange:p,className:G(`cf-question`,s?.question),children:[W(`div`,{className:G(`cf-header`,s?.header),children:[W(J,{className:G(`cf-title`,s?.title),children:[t,!a&&W(`span`,{className:G(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,s?.description),children:n})]}),U(ht,{placeholder:r.placeholder||`Brief description of the issue`,className:G(`cf-input`,s?.input)}),U(Z,{className:G(`cf-error`,s?.error),children:o})]}),W(Ot,{name:`${e}-description`,value:m,onChange:h,className:G(`cf-question`,s?.question),children:[U(J,{className:G(`cf-title`,s?.title),children:r.detailsLabel}),U(Et,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:G(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?W(`section`,{className:G(`cf-question`,s?.question),children:[U(J,{className:G(`cf-title`,s?.title),children:`Attachments`}),W(`div`,{className:G(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&W(`div`,{className:G(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[g?W(`div`,{className:G(`cf-bug-report-media-preview`,s?.mediaPreview),children:[U(`img`,{src:g,alt:`Screenshot preview`,className:G(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),U(`div`,{className:G(`cf-bug-report-media-actions`,s?.mediaActions),children:U(S,{className:G(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:b,"aria-label":`Remove screenshot`,children:U($t,{})})})]}):U(S,{className:G(`cf-bug-report-button`,s?.button),onPress:y,isDisabled:_,children:_?`Capturing...`:`Screenshot`}),v&&U(`div`,{className:G(`cf-error`,s?.error),children:v})]}),r.enableRecording&&W(`div`,{className:G(`cf-bug-report-recording-section`,s?.recordingSection),children:[A.length>0?W(`div`,{className:G(`cf-bug-report-media-preview`,s?.mediaPreview),children:[U(Se,{fallback:U(`span`,{className:G(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:U(nn,{events:A})}),U(`div`,{className:G(`cf-bug-report-media-actions`,s?.mediaActions),children:U(S,{className:G(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:O,"aria-label":`Remove recording`,children:U($t,{})})})]}):U(S,{className:G(`cf-bug-report-button`,s?.button),onPress:E,children:`Record`}),w&&U(`div`,{className:G(`cf-error`,s?.error),children:w})]})]})]}):null]})})},an=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s,defaultAnswer:c})=>{let[l,u]=V(()=>typeof c==`string`?c:``);return R(()=>{i(l)},[i,l]),W(Ot,{isRequired:o,isInvalid:!!s,name:e,className:G(`cf-question`,a?.question),value:l,onChange:e=>{u(e),i(e)},children:[W(`div`,{className:G(`cf-header`,a?.header),children:[W(J,{className:G(`cf-title`,a?.title),children:[t,!o&&W(`span`,{className:G(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,a?.description),children:n})]}),U(Et,{className:G(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),U(Z,{className:G(`cf-error`,a?.error),children:s})]})},on=({children:e,classNames:t,description:n,...r})=>U(dt,{...r,children:({isIndeterminate:r})=>W(H,{children:[W(`div`,{className:G(`cf-choice-label`,t?.label),children:[U(`div`,{className:G(`cf-checkbox-indicator`,t?.indicator),children:U(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:G(`cf-checkbox-indicator-svg`,t?.svg),children:r?U(`rect`,{x:1,y:7.5,width:16,height:3}):U(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&U(`span`,{className:G(`cf-choice-description`,t?.choiceDescription),children:n})]})}),sn=({children:e,classNames:t,...n})=>U(dt,{...n,children:U(`div`,{className:G(`cf-tag-label`,t?.tagLabel),children:e})}),cn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c})=>{let l=!!n.editable,u=n.display??`checkbox`,d=Array.isArray(c)?c:[],f=new Set(n.options.map(e=>e.value)),p=d.find(e=>!f.has(e)),[m,h]=V(()=>{let e=d.filter(e=>f.has(e));return p!==void 0&&l&&e.push(ne),e}),[g,_]=V(()=>p!==void 0&&l?p:``),v=B(null),y=B(null),b=z(()=>{let e=m.indexOf(ne);if(e===-1)return m;let t=[...m];return t[e]=g||`__CONFETTI_CHECKBOX_Others`,t},[g,m]),x=u===`tag`;return R(()=>{i(b)},[i,b]),U(ut,{isRequired:o,isInvalid:!!s,name:a,value:m,onChange:h,className:G(`cf-question`,r?.question),children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[e,!o&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:t})]}),W(`div`,{className:G(`cf-response-choices`,u===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>U(x?sn:on,{className:G(`cf-choice`,x&&[`cf-tag`,r?.tag],!x&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),l&&(x?W(H,{children:[U(sn,{inputRef:v,onChange:e=>{y.current&&e&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},className:G(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),U(ht,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:g,onChange:e=>{_(e.target.value)},ref:y,className:G(`cf-input cf-tag-input`,r?.othersInput)})]}):W(`div`,{className:G(`cf-choice cf-others-choice`,r?.othersChoice),children:[U(on,{inputRef:v,onChange:e=>{y.current&&e&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},className:G(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),U(ht,{value:g,onChange:e=>{_(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:y,onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:G(`cf-input`,r?.othersInput)})]}))]}),U(Z,{className:G(`cf-error`,r?.error),children:s})]})})},ln=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),un=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),dn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),fn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),pn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),mn=e=>U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:U(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),hn=e=>U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:U(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),gn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return U(`div`,{className:G(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return U(Ct,{className:G(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:U(o?hn:mn,{})},t)})})},_n=({properties:e,classNames:t})=>U(`div`,{className:G(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return U(Ct,{className:G(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),vn=({properties:e,classNames:t,state:n})=>{let r=z(()=>[ln,dn,fn,pn,un],[]),i=z(()=>[dn,fn,pn],[]);return z(()=>e.scale===3||e.scale===5,[e.scale])?U(`div`,{className:G(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return U(Ct,{className:G(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&U(c,{})},a)})}):U(_n,{properties:e,classNames:t,state:n})},yn=e=>{switch(e.properties.display??`star`){case`emoji`:return U(vn,{...e});case`number`:return U(_n,{...e});case`star`:return U(gn,{...e})}},bn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s,defaultAnswer:c})=>{let[l,u]=V(()=>typeof c==`number`?String(c):null),d=z(()=>l?Number(l):void 0,[l]);return R(()=>{i(d)},[i,d]),U(St,{isRequired:s,isInvalid:!!o,name:a,className:G(`cf-question`,r?.question),value:l,onChange:u,children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[t,!s&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:n})]}),W(`div`,{className:G(`cf-rating-section`,r?.ratingSection),children:[U(yn,{state:i,properties:e,classNames:r}),W(`div`,{className:G(`cf-rating-text`,r?.ratingText),children:[U(`span`,{className:G(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),U(`span`,{className:G(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),U(Z,{className:G(`cf-error`,r?.error),children:o})]})})},xn=({classNames:e,className:t,description:n,...r})=>U(Ct,{...r,className:G(t,e?.radio),children:p(r.children,t=>W(H,{children:[W(`div`,{className:G(`cf-choice-label`,e?.label),children:[U(`div`,{className:G(`cf-radio-indicator`,e?.indicator)}),t]}),n&&U(`span`,{className:G(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Sn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c})=>{let l=!!n.editable,u=typeof c==`string`?c:null,d=u!==null&&n.options.some(e=>e.value===u),[f,p]=V(()=>u===null?null:d?u:l?oe:null),[m,h]=V(()=>u!==null&&!d&&l?u:``),g=B(null),_=B(null),v=z(()=>f===`__CONFETTI_RADIO_Others`?m||`__CONFETTI_RADIO_Others`:f??void 0,[m,f]);return R(()=>{i(v)},[i,v]),U(St,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{p(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{_.current&&_.current.focus()})},value:f,className:G(`cf-question`,r?.question),children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[e,!o&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:t})]}),W(`div`,{className:G(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>U(xn,{classNames:{indicator:r?.indicator,radio:G(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),l&&W(`div`,{className:G(`cf-choice cf-others-choice`,r?.othersChoice),children:[U(xn,{inputRef:g,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:G(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),U(ht,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:_,value:m,onChange:e=>h(e.target.value),onFocus:()=>{g.current?.checked===!1&&g.current.click()},className:G(`cf-input`,r?.othersInput)})]})]}),U(Z,{className:G(`cf-error`,r?.error),children:s})]})})},Cn=({properties:e,title:t,description:n,classNames:r})=>U(`div`,{className:G(`cf-question`,r?.question),children:W(`div`,{className:G(`cf-header`,r?.header),children:[t&&U(`div`,{className:G(`cf-title`,r?.title),children:t}),n&&U(`div`,{className:G(`cf-description`,r?.description),children:n})]})}),wn=({question:e,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i})=>{switch(e.properties.type){case`rating`:return U(bn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`open-ended`:return U(an,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`single-select`:return U(Sn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`multi-select`:return U(cn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i},e.id);case`statement`:return U(Cn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return U(rn,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i},e.id)}return U(`div`,{children:`Unsupported question type`},e.id)},Tn=({title:e,description:t,classNames:n,onClose:r})=>{let{survey:i}=be();if(!i)return null;let a=t||i.confirmation.description;return W(H,{children:[U(`div`,{className:G(`cf-question`,n?.question),children:W(`div`,{className:G(`cf-header`,n?.header),children:[U(J,{className:G(`cf-title`,n?.title),children:e||i.confirmation.title||`Feedback submitted!`}),a&&U(Y,{slot:`description`,className:G(`cf-description`,n?.description),children:a})]})}),U(S,{className:`cf-submit-button`,onPress:()=>{r?.()},children:i.confirmation.buttonText||`Close`})]})},En=({onPress:e,children:t=`Back`})=>he()?null:U(S,{className:`cf-back-button`,onPress:e,children:t}),Dn=({onPress:e,isDisabled:t,children:n=`Submit`})=>he()?null:U(S,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),On=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},$=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),kn=({onSubmit:e,children:t,question:n,isLastQuestion:r,defaultAnswer:i,backButton:a,saveAnswer:o})=>{let s=he(),[c,l]=V(i??On(n.properties.type)),u=z(()=>jt(n.properties,{required:n.required}),[n.properties,n.required]),d=z(()=>{let e=u.safeParse(c);if(!e.success)return kt(e.error)},[c,u]),f=z(()=>{let e=n.routingLogic;if(e.type!==`always`&&!$(c)&&n.required)return!0;let t=e.type===`always`?e.target:e.cases.find(e=>se({answer:c,condition:e}))?.target??e.default;return t.type===`end`?!1:t.type!==`next`||!r},[c,r,n.required,n.routingLogic]),p=z(()=>n.properties.buttonLabel?n.properties.buttonLabel:f?!n.required&&!$(c)?`Skip`:`Next`:`Submit`,[c,f,n.properties.buttonLabel,n.required]),m=I(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=ee.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(c)}},[c,e,n.properties]),h=$(i),g=z(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties])&&!h,_=I(t=>{l(t),g&&$(t)&&u.safeParse(t).success&&e(t)},[g,u,e]),v=z(()=>{if(!a||!we(a))return a;let e=a;return Ce(e,{onPress:()=>{$(c)&&o?.(c),e.props.onPress?.()}})},[a,c,o]);return W(H,{children:[t({onChange:_,question:n,error:d,defaultAnswer:i}),!s&&W(`div`,{className:`cf-button-row`,children:[v,(!g||!n.required)&&U(Dn,{isDisabled:!!d,onPress:m,children:p})]})]})},An=({onSubmit:e,children:t})=>W(H,{children:[t,U(Dn,{onPress:e})]});export{wn as a,bn as c,Ut as d,zt as f,Rt as h,Tn as i,cn as l,Ht as m,kn as n,Cn as o,Vt as p,En as r,Sn as s,An as t,an as u};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,c as ee,f as te,h as ne,j as re,k as ie,l as ae,m as oe,o as se,p as ce,t as le,v as ue,w as de,y as fe,z as pe}from"./Button-LiaNjkvk.js";import{n as me}from"./src-BewqzpwC.js";import{i as he,r as ge,t as _e}from"./internals-DYTVPK_r.js";import b,{createContext as x,forwardRef as S,useCallback as C,useContext as w,useEffect as T,useMemo as E,useReducer as ve,useRef as D,useState as O}from"react";import{useTimeout as ye}from"usehooks-ts";import{Fragment as be,jsx as k,jsxs as xe}from"react/jsx-runtime";import A from"clsx";import Se,{flushSync as Ce}from"react-dom";const we=x(null);x(null),x(null),x(null),x(null);const Te=x({});x(null);const Ee=x(null);var De=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(t){if(!e(this.root,t))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let n=[],r=t,i=t;for(this._currentNode=t;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=r,t=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});n.push(t),t.currentNode=i,this._currentSetFor.add(t),r=i=e.host}else r=r.parentNode;let a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});n.push(a),a.currentNode=i,this._currentSetFor.add(a),this._walkerStack=n}get doc(){return this._doc}firstChild(){let t=this.currentNode,n=this.nextNode();return e(t,n)?(n&&(this.currentNode=n),n):(this.currentNode=t,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Oe(e,t,n,r){return p()?new De(e,t,n,r):e.createTreeWalker(t,n,r)}function ke(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=pe(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function j(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Ae(e,t){let n=e;for(j(n,t)&&(n=n.parentElement);n&&!j(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const je=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!je.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Me(){let e=t(),[n,r]=O(()=>e?{width:0,height:0}:P());return T(()=>{let e=e=>{r(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(P())},n,i=t=>{N&&N.scale>1||M(d(t))&&(n=requestAnimationFrame(()=>{let t=u();(!t||!M(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(P()),y()&&window.addEventListener(`blur`,i,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(n),y()&&window.removeEventListener(`blur`,i,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),n}function P(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function Ne(e,t=!0){let[n,r]=O(!0),i=n&&t;return v(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),Fe(e,i,C(()=>r(!1),[])),i}function Pe(e,t){let[n,r]=O(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return Fe(e,i,C(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function Fe(e,t,n){v(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Ce(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const Ie=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Le(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let F=new WeakMap,I=[];function Re(t,n){let r=c(t?.[0]),i=n instanceof r.Element?{root:n}:n,o=i?.root??document.body,s=i?.shouldUseInert&&Ie,l=new Set(t),u=new Set,d=e=>s&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{s&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},m=new Set;if(p())for(let e of t){let t=e;for(;t&&t!==o;){let e=t.getRootNode();`shadowRoot`in e&&m.add(e.shadowRoot),t=e.parentNode}}let h=t=>{for(let e of t.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))l.add(e);let n=t=>{if(u.has(t)||l.has(t)||t.parentElement&&u.has(t.parentElement)&&t.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let n of l)if(e(t,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=Oe(a(t),t,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(t);if(i===NodeFilter.FILTER_ACCEPT&&g(t),i!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;e!=null;)g(e),e=r.nextNode()}},g=e=>{let t=F.get(e)??0;d(e)&&t===0||(t===0&&f(e,!0),u.add(e),F.set(e,t+1))};I.length&&I[I.length-1].disconnect(),h(o);let _=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Le(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});_.observe(o,{childList:!0,subtree:!0});let v=new Set;if(p())for(let t of m){let n=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Le(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});n.observe(t,{childList:!0,subtree:!0}),v.add(n)}let y={visibleNodes:l,hiddenNodes:u,observe(){_.observe(o,{childList:!0,subtree:!0})},disconnect(){_.disconnect()}};return I.push(y),()=>{if(_.disconnect(),p())for(let e of v)e.disconnect();for(let e of u){let t=F.get(e);t!=null&&(t===1?(f(e,!1),F.delete(e)):F.set(e,t-1))}y===I[I.length-1]?(I.pop(),I.length&&I[I.length-1].observe()):I.splice(I.indexOf(y),1)}}const ze=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Be=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Ve(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return ze.has(t.script)}let t=e.split(`-`)[0];return Be.has(t)}const He=Symbol.for(`react-aria.i18n.locale`);function Ue(){let e=typeof window<`u`&&window[He]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Ve(e)?`rtl`:`ltr`}}let We=Ue(),L=new Set;function Ge(){We=Ue();for(let e of L)e(We)}function Ke(){let e=t(),[n,r]=O(We);return T(()=>(L.size===0&&window.addEventListener(`languagechange`,Ge),L.add(r),()=>{L.delete(r),L.size===0&&window.removeEventListener(`languagechange`,Ge)}),[]),e?{locale:typeof window<`u`&&window[He]||`en-US`,direction:`ltr`}:n}const qe=b.createContext(null);function Je(){let e=Ke();return w(qe)||e}const Ye=Symbol.for(`react-aria.i18n.locale`),Xe=Symbol.for(`react-aria.i18n.strings`);let R;var Ze=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=Qe(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Ye];if(R===void 0){let t=window[Xe];if(!t)return null;R={};for(let r in t)R[r]=new e({[n]:t[r]},n)}let r=R?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function Qe(e,t,n=`en-US`){if(t[e])return t[e];let r=$e(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function $e(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const et=new Map,tt=new Map;var nt=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=et.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),et.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=tt.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),tt.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const rt=new WeakMap;function it(e){let t=rt.get(e);return t||(t=new Ze(e),rt.set(e,t)),t}function at(e,t){return t&&Ze.getGlobalDictionaryForPackage(t)||it(e)}function ot(e,t){let{locale:n}=Je(),r=at(e,t);return E(()=>new nt(n,r),[n,r])}const st=b.createContext(null),ct=`react-aria-focus-scope-restore`;let z=null;function lt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=D(null),s=D(null),c=D([]),{parentNode:l}=w(st)||{},d=E(()=>new wt({scopeRef:c}),[c]);v(()=>{let e=l||q.root;if(q.getTreeNode(e.scopeRef)&&z&&!W(z,e.scopeRef)){let t=q.getTreeNode(z);t&&(e=t)}e.addChild(d),q.addNode(d)},[d,l]),v(()=>{let e=q.getTreeNode(c);e&&(e.contain=!!n)},[n]),v(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(ct,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(ct,n)}},[t]),yt(c,r,n),pt(c,n),xt(c,r,n),vt(c,i),T(()=>{let e=u(a(c.current?c.current[0]:void 0)),t=null;if(H(e,c.current)){for(let n of q.traverse())n.scopeRef&&H(e,n.scopeRef.current)&&(t=n);t===q.getTreeNode(c)&&(z=t.scopeRef)}},[c]),v(()=>()=>{let e=q.getTreeNode(c)?.parent?.scopeRef??null;(c===z||W(c,z))&&(!e||q.getTreeNode(e))&&(z=e),q.removeTreeNode(c)},[c]);let f=E(()=>ut(c),[]),p=E(()=>({focusManager:f,parentNode:d}),[d,f]);return b.createElement(st.Provider,{value:p},b.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,b.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function ut(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[0].previousElementSibling,d=K(B(n),{tabbable:i,accept:s},n);d.currentNode=H(c,n)?c:l;let f=d.nextNode();return!f&&o&&(d.currentNode=l,f=d.nextNode()),f&&G(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[n.length-1].nextElementSibling,d=K(B(n),{tabbable:i,accept:s},n);d.currentNode=H(c,n)?c:l;let f=d.previousNode();return!f&&o&&(d.currentNode=l,f=d.previousNode()),f&&G(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=K(B(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&G(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=K(B(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&G(o,!0),o}}}function B(e){return e[0].parentElement}function V(e){let t=q.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function dt(e){if(!e.form)return Array.from(a(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=c(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ft(e){if(e.checked)return!0;let t=dt(e);return t.length>0&&!t.some(e=>e.checked)}function pt(e,t){let n=D(void 0),r=D(void 0);v(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let o=a(i?i[0]:void 0),l=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!V(e)||t.isComposing)return;let n=u(o),r=e.current;if(!r||!H(n,r))return;let i=K(B(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let a=t.shiftKey?i.previousNode():i.nextNode();a||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&(G(a,!0),a instanceof c(a).HTMLInputElement&&a.select())},f=t=>{(!z||W(z,e))&&H(d(t),e.current)?(z=e,n.current=d(t)):V(e)&&!U(d(t),e)?n.current?n.current.focus():z&&z.current&&_t(z.current):V(e)&&(n.current=d(t))},p=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ae(),i=(r===`virtual`||r===null)&&_()&&s(),a=u(o);if(!i&&a&&V(e)&&!U(a,e)){z=e;let r=d(t);r&&r.isConnected?(n.current=r,n.current?.focus()):z.current&&_t(z.current)}})};return o.addEventListener(`keydown`,l,!1),o.addEventListener(`focusin`,f,!1),i?.forEach(e=>e.addEventListener(`focusin`,f,!1)),i?.forEach(e=>e.addEventListener(`focusout`,p,!1)),()=>{o.removeEventListener(`keydown`,l,!1),o.removeEventListener(`focusin`,f,!1),i?.forEach(e=>e.removeEventListener(`focusin`,f,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,p,!1))}},[e,t]),v(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function mt(e){return U(e)}function H(t,n){return!t||!n?!1:n.some(n=>e(n,t))}function U(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of q.traverse(q.getTreeNode(t)))if(n&&H(e,n.current))return!0;return!1}function ht(e){return U(e,z)}function W(e,t){let n=q.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function G(e,t=!1){if(e!=null&&!t)try{ee(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function gt(e,t=!0){let n=e[0].previousElementSibling,r=B(e),i=K(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=B(e),i=K(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function _t(e,t=!0){G(gt(e,t))}function vt(e,t){let n=b.useRef(t);T(()=>{n.current&&(z=e,!H(u(a(e.current?e.current[0]:void 0)),z.current)&&e.current&&_t(e.current)),n.current=!1},[e])}function yt(e,t,n){v(()=>{if(t||n)return;let r=e.current,i=a(r?r[0]:void 0),o=t=>{let n=d(t);H(n,e.current)?z=e:mt(n)||(z=null)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function bt(e){let t=q.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function xt(e,t,n){let r=D(typeof document<`u`?u(a(e.current?e.current[0]:void 0)):null);v(()=>{let r=e.current,i=a(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!z||W(z,e))&&H(u(i),e.current)&&(z=e)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),v(()=>{let r=a(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!V(e)||t.isComposing)return;let n=r.activeElement;if(!U(n,e)||!bt(e))return;let i=q.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=K(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!U(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(U(s,e));t.preventDefault(),t.stopPropagation(),s?G(s,!0):mt(a)?G(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),v(()=>{let n=a(e.current?e.current[0]:void 0);if(!t)return;let i=q.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=q.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=u(n);if(t&&i&&(a&&U(a,e)||a===n.body&&bt(e))){let t=q.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){St(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&q.getTreeNode(n.scopeRef)){St(gt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function St(e){e.dispatchEvent(new CustomEvent(ct,{bubbles:!0,cancelable:!0}))&&G(e)}function K(t,r,i){let o=r?.tabbable?de:n,s=a(t?.nodeType===Node.ELEMENT_NODE?t:null),c=Oe(s,t||s,NodeFilter.SHOW_ELEMENT,{acceptNode(t){return e(r?.from,t)||r?.tabbable&&t.tagName===`INPUT`&&t.getAttribute(`type`)===`radio`&&(!ft(t)||c.currentNode.tagName===`INPUT`&&c.currentNode.type===`radio`&&c.currentNode.name===t.name)?NodeFilter.FILTER_REJECT:o(t)&&(!i||H(t,i))&&(!r?.accept||r.accept(t))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return r?.from&&(c.currentNode=r.from),c}var Ct=class e{constructor(){this.fastMap=new Map,this.root=new wt({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new wt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&H(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},wt=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let q=new Ct;const Tt=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function Et(e,t,n){let[r,i]=O(e||t),a=D(r),o=D(e!==void 0),s=e!==void 0;T(()=>{o.current,o.current=s},[s]);let c=s?e:r;Tt(()=>{a.current=c});let[,l]=ve(()=>({}),{});return[c,C((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}function Dt({children:e}){let t=E(()=>({register:()=>{}}),[]);return b.createElement(te.Provider,{value:t},e)}function Ot(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,o=D({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=g(e=>{n&&kt(e,t)&&(i&&i(e),o.current.isPointerDown=!0)}),c=g(e=>{n&&n(e)});T(()=>{let e=o.current;if(r)return;let n=t.current,i=a(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&kt(n,t)&&c(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,s,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,s,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function kt(t,n){if(t.button>0)return!1;let r=d(t);if(r){let t=r.ownerDocument;if(!t||!e(t.documentElement,r)||r.closest(`[data-react-aria-top-layer]`))return!1}return n.current?!t.composedPath().includes(n.current):!1}const At={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function jt(e={}){let{style:t,isFocusable:n}=e,[r,i]=O(!1),{focusWithinProps:a}=se({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=E(()=>r?t:t?{...At,...t}:At,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Mt(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=jt(e);return b.createElement(n,f(a,o),t)}const Nt=x({});function Pt(){return w(Nt)??{}}const Ft=b.createContext(null);function It(e){let n=t(),{portalContainer:r=n?null:document.body,isExiting:i}=e,[a,o]=O(!1),s=E(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Pt();if(!e.portalContainer&&c&&(r=c()),!r)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(lt,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},l)),l=b.createElement(Ft.Provider,{value:s},b.createElement(Dt,null,l)),Se.createPortal(l,r)}function Lt(){let e=w(Ft)?.setContain;v(()=>{e?.(!0)},[e])}function Rt(e,t){let{role:n=`dialog`}=e,i=m();i=e[`aria-label`]?void 0:i;let a=D(!1);return T(()=>{if(t.current&&!re(t.current)){ee(t.current);let e=setTimeout(()=>{(u()===t.current||u()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),ee(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Lt(),D(!1),T(()=>{}),{dialogProps:{...r(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}var zt={};zt={dismiss:`تجاهل`};var Bt={};Bt={dismiss:`Отхвърляне`};var Vt={};Vt={dismiss:`Odstranit`};var Ht={};Ht={dismiss:`Luk`};var Ut={};Ut={dismiss:`Schließen`};var Wt={};Wt={dismiss:`Απόρριψη`};var Gt={};Gt={dismiss:`Dismiss`};var Kt={};Kt={dismiss:`Descartar`};var qt={};qt={dismiss:`Lõpeta`};var Jt={};Jt={dismiss:`Hylkää`};var Yt={};Yt={dismiss:`Rejeter`};var Xt={};Xt={dismiss:`התעלם`};var Zt={};Zt={dismiss:`Odbaci`};var Qt={};Qt={dismiss:`Elutasítás`};var $t={};$t={dismiss:`Ignora`};var en={};en={dismiss:`閉じる`};var tn={};tn={dismiss:`무시`};var nn={};nn={dismiss:`Atmesti`};var rn={};rn={dismiss:`Nerādīt`};var an={};an={dismiss:`Lukk`};var on={};on={dismiss:`Negeren`};var sn={};sn={dismiss:`Zignoruj`};var cn={};cn={dismiss:`Descartar`};var ln={};ln={dismiss:`Dispensar`};var un={};un={dismiss:`Revocare`};var dn={};dn={dismiss:`Пропустить`};var fn={};fn={dismiss:`Zrušiť`};var pn={};pn={dismiss:`Opusti`};var mn={};mn={dismiss:`Odbaci`};var hn={};hn={dismiss:`Avvisa`};var gn={};gn={dismiss:`Kapat`};var _n={};_n={dismiss:`Скасувати`};var vn={};vn={dismiss:`取消`};var yn={};yn={dismiss:`關閉`};var bn={};bn={"ar-AE":zt,"bg-BG":Bt,"cs-CZ":Vt,"da-DK":Ht,"de-DE":Ut,"el-GR":Wt,"en-US":Gt,"es-ES":Kt,"et-EE":qt,"fi-FI":Jt,"fr-FR":Yt,"he-IL":Xt,"hr-HR":Zt,"hu-HU":Qt,"it-IT":$t,"ja-JP":en,"ko-KR":tn,"lt-LT":nn,"lv-LV":rn,"nb-NO":an,"nl-NL":on,"pl-PL":sn,"pt-BR":cn,"pt-PT":ln,"ro-RO":un,"ru-RU":dn,"sk-SK":fn,"sl-SI":pn,"sr-SP":mn,"sv-SE":hn,"tr-TR":gn,"uk-UA":_n,"zh-CN":vn,"zh-TW":yn};function xn(e){return e&&e.__esModule?e.default:e}function Sn(e){let{onDismiss:t,...n}=e,r=ke(n,ot(xn(bn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(Mt,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const J=[];function Cn(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=D(void 0);T(()=>{if(i&&!J.includes(t))return J.push(t),()=>{let e=J.indexOf(t);e>=0&&J.splice(e,1)}},[i,t]);let l=()=>{J[J.length-1]===t&&n&&n()},u=e=>{let n=J[J.length-1];c.current=n,(!s||s(d(e)))&&n===t&&e.stopPropagation()},f=e=>{(!s||s(d(e)))&&(J[J.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},p=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};Ot({ref:t,onInteractOutside:a&&i?f:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=se({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||ht(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const Y=typeof document<`u`&&window.visualViewport;let X=0,wn;function Tn(e={}){let{isDisabled:t}=e;v(()=>{if(!t)return X++,X===1&&(wn=y()?Dn():En()),()=>{X--,X===0&&wn()}},[t])}function En(){let e=window.innerWidth-document.documentElement.clientWidth;return l(e>0&&(`scrollbarGutter`in document.documentElement.style?Z(document.documentElement,`scrollbarGutter`,`stable`):Z(document.documentElement,`paddingRight`,`${e}px`)),Z(document.documentElement,`overflow`,`hidden`))}function Dn(){let e=Z(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=d(e);t=j(r)?r:Ae(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=h();a&&(i.nonce=a),i.textContent=`@layer {
|
|
2
|
+
* {
|
|
3
|
+
overscroll-behavior: contain;
|
|
4
|
+
}
|
|
5
|
+
}`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=d(e),n=e.relatedTarget;n&&M(n)?(n.focus({preventScroll:!0}),kn(n,M(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=u(),n=t!=null&&M(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&kn(this,n)};let f=l(On(document,`touchstart`,r,{passive:!1,capture:!0}),On(document,`touchmove`,o,{passive:!1,capture:!0}),On(document,`blur`,s,!0));return()=>{e(),f(),i.remove(),HTMLElement.prototype.focus=c}}function Z(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function On(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function kn(e,t){t||!Y?An(e):Y.addEventListener(`resize`,()=>An(e),{once:!0})}function An(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Ae(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;Y&&(n=Math.min(n,Y.offsetTop+Y.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function jn(e,t,n){let{overlayProps:r,underlayProps:i}=Cn({...e,isOpen:t.isOpen,onClose:t.close},n);return Tn({isDisabled:!t.isOpen}),Lt(),T(()=>{if(t.isOpen&&n.current)return Re([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:f(r),underlayProps:i}}function Mn(e){let[t,n]=Et(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:C(()=>{n(!0)},[n]),close:C(()=>{n(!1)},[n]),toggle:C(()=>{n(!t)},[n,t])}}const Nn=x(null),Q=x(null),Pn=S(function(e,t){let n=e[`aria-labelledby`];[e,t]=oe(e,t,Nn);let{dialogProps:i,titleProps:a}=Rt({...e,"aria-labelledby":n},t),o=w(Q);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let s=ne({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=r(e,{global:!0});return b.createElement(fe.section,{...f(c,s,i),render:e.render,ref:t,slot:e.slot||void 0},b.createElement(ce,{values:[[Te,{slots:{[ue]:{},title:{...a,level:2}}}],[le,{slots:{[ue]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),Fn=x(null),In=x(null),Ln=S(function(e,t){if(w(In))return b.createElement(Vn,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return b.createElement(zn,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Vn,{...f,modalRef:t},s))});function Rn(e,n){[e,n]=oe(e,n,Fn);let r=w(Q),a=Mn(e),o=e.isOpen!=null||e.defaultOpen!=null||!r?a:r,s=i(n),c=D(null),l=Pe(s,o.isOpen),u=Pe(c,o.isOpen),d=l||u||e.isExiting||!1,f=t();return!o.isOpen&&!d||f?null:b.createElement(Bn,{...e,state:o,isExiting:d,overlayRef:s,modalRef:c})}const zn=S(Rn);function Bn({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=jn(t,i,n),s=Ne(t.overlayRef)||t.isEntering||!1,c=ne({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Me(),u;if(typeof document<`u`){let e=j(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return b.createElement(It,{isExiting:t.isExiting,portalContainer:e},b.createElement(fe.div,{...f(r(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},b.createElement(ce,{values:[[In,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Q,i]]},c.children)))}function Vn(e){let{modalProps:t,modalRef:n,isExiting:a,isDismissable:o}=w(In),s=w(Q),c=i(E(()=>ie(e.modalRef,n),[e.modalRef,n])),l=Ne(c),u=ne({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:l,isExiting:a,state:s}});return b.createElement(fe.div,{...f(r(e,{global:!0}),t),...u,ref:c,"data-entering":l||void 0,"data-exiting":a||void 0},o&&b.createElement(Sn,{onDismiss:s.close}),u.children)}const Hn=x({}),Un=()=>w(Hn),Wn=x({}),Gn=({type:e,children:t})=>{let n=E(()=>({type:e}),[e]);return k(Wn.Provider,{value:n,children:t})},Kn=()=>w(Wn),$=x(null),qn=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},apiBaseUrl:a})=>{let{type:s}=Kn(),c=Un(),l=c.version??`0.7.1`,u=c.build,d=D(!1),[f,p]=O(),m=o({publishableKey:n,apiBaseUrl:a});T(()=>{(async()=>{d.current=!1,p(void 0);try{let e=await m.get(`api/v1/cfti/${t}`).json(),n=me.safeParse(e);if(!n.success)return;p(n.data)}catch{}})()},[m,t]);let h=C(async({answers:e})=>{let n=crypto.randomUUID();await m.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:i,telemetry:{...s!==void 0&&{type:s},version:l,...u&&{build:u}}}})},[u,m,i,r,t,l,s]),g=C(()=>{m.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[m,r,t]);return T(()=>{d.current||f&&r&&(d.current=!0,m.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[m,r,f,t]),f?k($.Provider,{value:{submit:h,dismiss:g,surveyId:t,survey:f,metadata:i},children:e}):null},Jn=e=>w($)?k(be,{children:e.children}):k(qn,{...e}),Yn=()=>{let e=w($);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},Xn=()=>{let[e,t]=O(!1);return T(()=>{let e=e=>{let n=he.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(ge,e),()=>{document.removeEventListener(ge,e)}},[]),e},Zn=({className:e,iconClassName:t,onClose:n})=>Xn()?null:k(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:k(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Qn=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s})=>{let{survey:c,surveyId:l,dismiss:u}=Yn(),[d,f]=O(!1);return ye(()=>{c&&i?.()},d?a:null),xe(Pn,{"aria-label":`Survey`,id:`${l}-popover`,className:A(`confetti-modal-dialog ${_e}`,t?.dialog),children:[n&&k(Zn,{className:A(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{!o&&!d&&(await u(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>f(!0)}):e]})},$n=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=Yn(),[s,c]=O(!1);return k(zn,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(s||(await o(),n?.()),r?.())},className:A(`confetti-modal-overlay ${_e}`,t?.overlay),children:k(Ln,{className:A(`confetti-modal ${_e}`,t?.modal),children:k(Qn,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:s,onSubmitted:()=>c(!0),children:e})})})};export{$ as a,Gn as c,K as d,Je as f,we as h,Xn as i,Mt as l,Ee as m,Qn as n,Jn as o,ke as p,Zn as r,Yn as s,$n as t,Et as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./ModalContainer-
|
|
1
|
+
import{n as e}from"./ModalContainer-Du6BhvXW.js";export{e as UnstableModalContent};
|