@opengovsg/confetti 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Button-CKL29na5.js +7 -0
- package/build/{Confetti-Ch8bCyn_.d.ts → Confetti-DSoOgKU5.d.ts} +1 -1
- package/build/{DefaultConfettiTrigger-qiD0c65-.js → DefaultConfettiTrigger-B0_iX1RM.js} +1 -1
- package/build/Embed-BJcGr0sB.js +1 -0
- package/build/{ModalContainer-DnTgSV6A.d.ts → ModalContainer-BX7AxPDq.d.ts} +1 -1
- package/build/ModalContainer-DcF9hn27.js +5 -0
- package/build/{RecordingReplayer-DNYXhses.js → RecordingReplayer-D1vUPmxV.js} +2 -2
- package/build/client-internals.d.ts +1 -1
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +3 -3
- package/build/components.js +1 -1
- package/build/{index-DLqC_qk3.d.ts → index-C6cGD5WB.d.ts} +3 -13
- package/build/index.d.ts +2 -2
- package/build/index.js +1 -1
- package/build/internals-BCQiNSvA.js +1 -0
- package/build/internals.d.ts +1 -1
- package/build/internals.js +1 -1
- package/build/src-DvVD5FzZ.js +1 -0
- package/build/static.d.ts +2 -2
- package/build/static.js +1 -1
- package/package.json +9 -6
- package/build/Button-B2r-VRNX.js +0 -7
- package/build/Embed-B37tSunS.js +0 -1
- package/build/ModalContainer-DlskMgoM.js +0 -5
- package/build/internals-Cx8YbMEK.js +0 -1
- package/build/src-xi3Tt2Zs.js +0 -1
|
@@ -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(()=>d.extend({headers:{"x-cfti-pk":e},...t?{prefixUrl:t}:{}}),[t,e])}function p(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const m=typeof document<`u`?e.useLayoutEffect:()=>{},h={prefix:String(Math.round(Math.random()*1e10)),current:0},g=e.createContext(h),_=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let v=new WeakMap;function y(t=!1){let n=i(g),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=v.get(t);e==null?v.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,v.delete(t))}r.current=++n.current}return r.current}function b(e){let t=i(g),n=y(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function ee(t){let n=e.useId(),[r]=c(T()),i=r?`react-aria`:`react-aria${h.prefix}`;return t||`${i}-${n}`}const x=typeof e.useId==`function`?ee:b;function S(){return!1}function C(){return!0}function w(e){return()=>{}}function T(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore(w,S,C):i(_)}function E(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 m(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let D=!!(typeof window<`u`&&window.document&&window.document.createElement),O=new Map,k;typeof FinalizationRegistry<`u`&&(k=new FinalizationRegistry(e=>{O.delete(e)}));let A=new WeakMap;function j(e){let[t,n]=c(e),r=s(null),i=x(t),o=s(null),l=A.get(o);if(k&&l!==i&&(l!=null&&k.unregister(o),k.register(o,i,o),A.set(o,i)),D){let e=O.get(i);e&&!e.includes(r)?e.push(r):O.set(i,[r])}return m(()=>{let e=i;return()=>{k&&(k.unregister(o),A.delete(o)),O.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function te(e,t){if(e===t)return e;let n=O.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=O.get(t);return r?(r.forEach(t=>t.current=e),e):t}function ne(e=[]){let t=j(),[n,i]=E(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return m(a,[t,a,...e]),n}function M(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=re(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():re(e[n],null)})}}}function re(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function N(...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]=p(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=u(n,i):e===`id`&&n&&i?t.id=te(n,i):e===`ref`&&n&&i?t.ref=M(n,i):t[e]=i===void 0?n:i}}return t}function ie(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 ae=Symbol(`default`);function oe({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function se(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 ce(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function le(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||ae;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 ue(e,t,n){let{ref:r,...i}=le(n,e.slot)||{},a=ie(o(()=>M(t,r),[t,r])),s=N(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 de(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return m(()=>{i.current||n(!1)},[]),[a,t]}function fe(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function pe(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>M(r,c),[r,c]);m(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const me={},he=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=me[t];return r||(r=n(pe.bind(null,t)),me[t]=r),r}}),P=e=>_e(e)?e.document:ve(e)?e:e?.ownerDocument??(typeof document<`u`?document:void 0),F=e=>P(e)?.defaultView??(typeof window<`u`?window:void 0);function ge(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function _e(e){return typeof e==`object`&&!!e&&`window`in e&&e.window===e}function ve(e){return ge(e)&&e.nodeType===9}function ye(e){return ge(e)&&e.nodeType===11&&`host`in e}function be(e,t,n,r){if(n==null||e==null)return()=>{};let i=Array.isArray(e)?e:[e];for(let e of i)e.addEventListener(t,n,r);return()=>{for(let e of i)e.removeEventListener(t,n,r)}}function xe(e,t,n,r){if(e==null)return()=>{};let i=[],a=Array.isArray(e)?e:[e];for(let e of a){let a=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);e.style.setProperty(t,n,r),i.unshift(()=>{a?e.style.setProperty(t,a,o):e.style.removeProperty(t)})}return()=>{for(let e of i)e()}}function Se(){return!1}function I(e,t){if(!Se())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=typeof n.assignedElements!=`function`&&n.assignedSlot?.parentNode?n.assignedSlot.parentNode:ye(n)?n.host:n.parentNode}return!1}const L=(e=document)=>{if(!Se())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function R(e){if(Se()&&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 Ce(e){if(!e)return!1;let t=e.getRootNode(),n=F(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}function z(e){if(Te())e.focus({preventScroll:!0});else{let t=Ee(e);e.focus(),De(t)}}let we=null;function Te(){if(we==null){we=!1;try{document.createElement(`div`).focus({get preventScroll(){return we=!0,!0}})}catch{}}return we}function Ee(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 De(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}const Oe=typeof Element<`u`&&`checkVisibility`in Element.prototype;function ke(e){let t=F(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}=F(e),{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function Ae(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 je(e,t){return Oe?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&ke(e)&&Ae(e,t)&&(!e.parentElement||je(e.parentElement,e))}const Me=[`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`],Ne=Me.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;Me.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const Pe=Me.join(`:not([hidden]):not([tabindex="-1"]),`);function Fe(e,t){return e.matches(Ne)&&!Le(e)&&(t?.skipVisibilityCheck||je(e))}function Ie(e){return e.matches(Pe)&&je(e)&&!Le(e)}function Le(e){let t=e;for(;t!=null;){if(t instanceof F(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Re(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ze(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Be(e){let t=s({isFocused:!1,observer:null});return m(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=R(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=Re(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===L()?null:L();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 B=!1;function Ve(e){for(;e&&!Fe(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=L(F(e).document);if(!t||t===e)return;let n=e?.getRootNode(),r=n!=null&&ye(n)?n:F(e),i=t=>t===e||t!=null&&I(e,t),a=e=>e===t||t!=null&&e!=null&&I(t,e);B=!0;let o=!1,s=e=>{(a(R(e))||o)&&e.stopImmediatePropagation()},c=n=>{(a(R(n))||o)&&(n.stopImmediatePropagation(),!e&&!o&&(o=!0,z(t),d()))},l=e=>{(i(R(e))||o)&&e.stopImmediatePropagation()},u=e=>{(i(R(e))||o)&&(e.stopImmediatePropagation(),o||(o=!0,z(t),d()))};r.addEventListener(`blur`,s,!0),r.addEventListener(`focusout`,c,!0),r.addEventListener(`focusin`,u,!0),r.addEventListener(`focus`,l,!0);let d=()=>{cancelAnimationFrame(f),r.removeEventListener(`blur`,s,!0),r.removeEventListener(`focusout`,c,!0),r.removeEventListener(`focusin`,u,!0),r.removeEventListener(`focus`,l,!0),B=!1,o=!1},f=requestAnimationFrame(d);return d}function He(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 Ue(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function V(e){let t=null;return()=>(t??=e(),t)}const H=V(function(){return Ue(/^Mac/i)}),We=V(function(){return Ue(/^iPhone/i)}),Ge=V(function(){return Ue(/^iPad/i)||H()&&navigator.maxTouchPoints>1}),U=V(function(){return We()||Ge()}),W=V(function(){return He(/AppleWebKit/i)&&(U()||!Ke())}),Ke=V(function(){return He(/Chrome|CriOS|CrMo/i)}),qe=V(function(){return He(/Android/i)}),Je=V(function(){return He(/(Firefox|FxiOS)/i)});function Ye(e){return e.pointerType===``&&e.isTrusted?!0:qe()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Xe(e){return!qe()&&e.width===0&&e.height===0||qe()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function G(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;!W()&&Je()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(H()?r=!0:i=!0);let s=W()&&H()&&!Ge()?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});G.isOpening=n,z(e),e.dispatchEvent(s),G.isOpening=!1}G.isOpening=!1;let K=null;const Ze=new Set;let q=new Map,J=!1,Qe=!1;const $e={Tab:!0,Escape:!0};function et(e,t){for(let n of Ze)n(e,t)}function tt(e){return!(e.metaKey||!H()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function nt(e){J=!0,!G.isOpening&&tt(e)&&(K=`keyboard`,et(`keyboard`,e))}function Y(e){K=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(J=!0,et(`pointer`,e))}function rt(e){!G.isOpening&&Ye(e)&&(J=!0,K=`virtual`)}function it(e){if(B)return;let t=R(e),n=F(t),r=P(t);if(t===n){Qe=!0;return}t===r||!e.isTrusted||(!J&&!Qe&&(K=`virtual`,et(`virtual`,e)),J=!1,Qe=!1)}function at(){B||(J=!1,Qe=!0)}function ot(e){if(typeof window>`u`||typeof document>`u`)return;let t=F(e),n=P(e);if(q.get(t))return;let r=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){J=!0,r.apply(this,arguments)}}),n.addEventListener(`keydown`,nt,!0),n.addEventListener(`keyup`,nt,!0),n.addEventListener(`click`,rt,!0),t.addEventListener(`focus`,it,!0),t.addEventListener(`blur`,at,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Y,!0),n.addEventListener(`pointermove`,Y,!0),n.addEventListener(`pointerup`,Y,!0)),t.addEventListener(`beforeunload`,()=>{st(e)},{once:!0}),q.set(t,{focus:r})}const st=(e,t)=>{let n=F(e),r=P(e);t&&r.removeEventListener(`DOMContentLoaded`,t),q.has(n)&&(Reflect.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:q.get(n).focus}),r.removeEventListener(`keydown`,nt,!0),r.removeEventListener(`keyup`,nt,!0),r.removeEventListener(`click`,rt,!0),n.removeEventListener(`focus`,it,!0),n.removeEventListener(`blur`,at,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Y,!0),r.removeEventListener(`pointermove`,Y,!0),r.removeEventListener(`pointerup`,Y,!0)),q.delete(n))};function ct(e){let t=P(e),n;return t.readyState===`loading`?(n=()=>{ot(e)},t.addEventListener(`DOMContentLoaded`,n)):ot(e),()=>st(e,n)}typeof document<`u`&&ct();function lt(){return K!==`pointer`}function ut(){return K}function dt(e){K=e,et(e,null)}const ft=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function pt(e,t,n){let r=n?R(n):void 0,i=P(r),a=F(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=L(i);return e=e||u instanceof o&&!ft.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!$e[n.key])}function mt(e,t,n){ot(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{pt(!!n?.isTextInput,t,r)&&e(lt())};return Ze.add(t),()=>{Ze.delete(t)}},t)}const ht=e.useInsertionEffect??m;function gt(e){let t=s(null);return ht(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}let X=new Map,_t=new Set;function vt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=R(t);if(!e(t)||!r)return;let i=X.get(r);i||(i=new Set,X.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=R(t);if(!e(t)||!r)return;let i=X.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),X.delete(r)),X.size===0)){for(let e of _t)e();_t.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,vt):vt());function yt(){for(let[e]of X)`isConnected`in e&&!e.isConnected&&X.delete(e)}function bt(e){requestAnimationFrame(()=>{yt(),X.size===0?e():_t.add(e)})}function xt(e){if(!e.isConnected)return;let t=P(e);if(ut()===`virtual`){let n=L(t);bt(()=>{let r=L(t);(r===n||r===t.body)&&e.isConnected&&z(e)})}else z(e)}function St(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(R(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=Be(o),c=r(e=>{let t=R(e),r=P(t),i=r?L(r):L();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 Ct(e){if(e)return t=>{let n=!0;e({...t,preventDefault(){t.preventDefault()},isDefaultPrevented(){return t.isDefaultPrevented()},stopPropagation(){n=!0},continuePropagation(){n=!1,typeof t.continuePropagation==`function`&&t.continuePropagation()},isPropagationStopped(){return n}}),n&&!(typeof t.isPropagationStopped==`function`&&t.isPropagationStopped())&&t.stopPropagation()}}const wt=new Set([`shift`,`alt`,`control`,`meta`,`mod`]),Tt=[`Alt`,`Control`,`Meta`,`Shift`];function Et(e){let t=new Set;return e.alt&&t.add(`Alt`),e.shift&&t.add(`Shift`),e.ctrl&&t.add(`Control`),e.meta&&t.add(`Meta`),e.mod&&t.add(H()?`Meta`:`Control`),t}function Dt(e){let t=new Set;return e.altKey&&t.add(`Alt`),e.ctrlKey&&t.add(`Control`),e.metaKey&&t.add(`Meta`),e.shiftKey&&t.add(`Shift`),t}function Ot(e){return Tt.filter(t=>e.has(t))}function kt(e){let t=e.split(`+`).reduce((e,t)=>{let n=t.toLowerCase();return wt.has(n)?n===`shift`?e.shift=!0:n===`alt`?e.alt=!0:n===`control`?e.ctrl=!0:n===`meta`?e.meta=!0:n===`mod`&&(e.mod=!0):e.key=t,e},{shift:!1,alt:!1,ctrl:!1,meta:!1,mod:!1,key:``});if(t.key===``)throw Error(`Invalid keyboard shortcut: "${e}". Must include exactly one non-modifier key (e.g. "a", "Enter", "ArrowDown"). Combine any of Shift, Alt, Ctrl, Meta, and Mod.`);return t}function At(e){return e.toLowerCase()}const jt={space:` `,esc:`escape`,del:`delete`,ins:`insert`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,pageup:`pageup`,pagedown:`pagedown`};function Mt(e){let t=At(e);return jt[t]??t}function Nt(e){let t=Ot(Et(e)),n=Mt(e.key);return t.length>0?`${t.join(`+`)}+${n}`:n}function Pt(e){let t=Ot(Dt(e)),n=At(e.key);return(t.length>0?`${t.join(`+`)}+`:``)+n}function Ft(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=kt(n);t.set(Nt(e),r)}return e=>{let n=Pt(e),r=t.get(n),i=r?.(e);i===void 0&&r!==void 0?i={shouldContinuePropagation:!1,shouldPreventDefault:!0}:typeof i==`boolean`&&(i={shouldContinuePropagation:!i,shouldPreventDefault:i}),i?.shouldPreventDefault&&e.preventDefault(),(!r||i?.shouldContinuePropagation)&&e.continuePropagation()}}function It(e){let{shortcuts:t,allowRepeats:n=!1,allowComposing:r=!1}=e,i,a;if(t){let o=Ft(t),s=Ct(e=>{if(!I(e.currentTarget,R(e))){e.continuePropagation();return}if(e.nativeEvent?.repeat&&!n||e.nativeEvent?.isComposing&&!r){e.continuePropagation();return}o(e)}),c=Ct(e=>{if(!I(e.currentTarget,R(e))){e.continuePropagation();return}if(e.nativeEvent?.repeat&&!n||e.nativeEvent?.isComposing&&!r){e.continuePropagation();return}e.continuePropagation()});i=e.onKeyDown?p(e.onKeyDown,s):s,a=e.onKeyUp?p(e.onKeyUp,c):c}else i=Ct(e.onKeyDown),a=Ct(e.onKeyUp);return{keyboardProps:e.isDisabled?{}:{onKeyDown:i,onKeyUp:a}}}function Lt(e,t){m(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}let Rt=e.createContext(null);function zt(e){let t=i(Rt)||{};Lt(t,e);let{ref:n,...r}=t;return r}function Bt(e,t){let{focusProps:n}=St(e),{keyboardProps:r}=It(e),i=N(n,r),o=zt(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&xt(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:N({...i,tabIndex:u},c)}}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 Vt=t(!1);function Ht(e){let t=(t,n)=>i(Vt)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}const Ut=new Set([`id`]),Wt=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Gt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),Kt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),qt=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(`.`)),Jt=/^(data-.*)$/;function Yt(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)&&(Ut.has(t)||n&&Wt.has(t)||r&&Gt.has(t)||i&&Kt.has(t)||a&&(qt.has(t)||t.endsWith(`Capture`)&&qt.has(t.slice(0,-7)))||o?.has(t)||Jt.test(t))&&(s[t]=e[t]);return s}let Z=`default`,Xt=``,Zt=new WeakMap;function Qt(e){if(U()&&W()){if(Z==="default"){let t=P(e);Xt=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}Z=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;Zt.set(e,e.style[t]),e.style[t]=`none`}}function $t(e){if(U()&&W()){if(Z!==`disabled`)return;Z=`restoring`,setTimeout(()=>{bt(()=>{if(Z===`restoring`){let t=P(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=Xt||``),Xt=``,Z=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Zt.has(e)){let t=Zt.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),Zt.delete(e)}}function en(e,t){let n=F(t),r=P(t);if(r==null||n==null)return;let i,a=`meta[name="${CSS.escape(e)}"], meta[property="${CSS.escape(e)}"]`,o=r.querySelector(a);return o&&o instanceof n.HTMLMetaElement&&(e===`csp-nonce`&&o.nonce&&(i??=o.nonce||void 0),o.content&&(i??=o.content||void 0)),e===`csp-nonce`&&(i??=n.__webpack_nonce__||globalThis.__webpack_nonce__||void 0),i}let tn=new WeakMap;function nn(e){let t=P(e),n=tn.get(t);return n??=en(`csp-nonce`,t),n!==void 0&&tn.set(t,n),n}const rn=e.createContext({register:()=>{}});rn.displayName=`PressResponderContext`;function an(){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 on(e){let t=i(rn);if(t){let{register:n,ref:r,...i}=t;e=N(i,e),n()}return Lt(t,e.ref),e}var sn=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}};const cn=Symbol(`linkClicked`),ln=`react-aria-pressable-style`,un=`data-react-aria-pressable`;function dn(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:m,preventFocusOnPress:h,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:_,ref:v,...y}=on(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:C}=an(),w=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new sn(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,ee(!0),a},[f,i,n]),T=r((e,r,i=!0)=>{let a=x.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let o=!0;if(l){let t=new sn(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),ee(!1),t&&i&&!f){let n=new sn(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),E=gt(T),D=gt(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new sn(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),O=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(Q(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),_||$t(t.target);for(let e of t.disposables)e();t.disposables=[]}},[_,C,T]),k=gt(O);a(()=>{f&&x.current.isPressed&&k({currentTarget:x.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[f]);let A=r(e=>{g&&O(e)},[g,O]),j=r(e=>{f||d?.(e)},[f,d]),te=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);ze(n,t),d(Re(n))}},[f,d]),ne=o(()=>{let e=x.current,t={onKeyDown(t){if(pn(t.nativeEvent,t.currentTarget)&&I(t.currentTarget,R(t))){hn(R(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=w(t,`keyboard`));let i=t.currentTarget;S(P(t.currentTarget),`keyup`,p(t=>{pn(t,i)&&!t.repeat&&I(i,R(t))&&e.target&&D(Q(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&H()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!I(t.currentTarget,R(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!G.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ye(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);j(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(Q(t.currentTarget,t),r),a=E(Q(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,j(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&pn(t,e.target)){hn(R(t),t.key)&&t.preventDefault();let n=R(t),r=I(e.target,n);E(Q(e.target,t),`keyboard`,r),r&&te(t,e.target),C(),t.key!==`Enter`&&fn(e.target)&&I(e.target,n)&&!t[cn]&&(t[cn]=!0,G(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||!I(t.currentTarget,R(t)))return;if(Xe(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,_||Qt(e.target),i=w(t,e.pointerType);let a=R(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(P(t.currentTarget),`pointerup`,n,!1),S(P(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(I(t.currentTarget,R(t))&&t.button===0){if(h){let n=Ve(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!I(t.currentTarget,R(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&D(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(Q(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(Q(e.target,t),e.pointerType,!1),A(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(I(e.target,R(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?k(t):(z(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else k(t);e.isOverTarget=!1}},r=e=>{k(e)};t.onDragStart=e=>{I(e.currentTarget,R(e))&&k(e)}}return t},[S,f,h,C,_,A,w,j,te]);return a(()=>{if(!v)return;let e=P(v.current);if(!e||!e.head||e.getElementById(ln))return;let t=e.createElement(`style`);t.id=ln;let n=nn(e);n&&(t.nonce=n),t.textContent=`
|
|
2
|
+
@layer {
|
|
3
|
+
[${un}] {
|
|
4
|
+
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
`.trim(),e.head.prepend(t)},[v]),a(()=>{let e=x.current;return()=>{_||$t(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[_]),{isPressed:m||b,pressProps:N(y,ne,{[un]:!0})}}function fn(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function pn(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof F(i).HTMLInputElement&&!_n(i,n)||i instanceof F(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&fn(i))&&n!==`Enter`)}function Q(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function mn(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!fn(e)}function hn(e,t){return H()&&t===`Enter`?!1:e instanceof HTMLInputElement?t===`Enter`&&(e.type===`checkbox`||e.type===`radio`)?!1:!_n(e,t):mn(e)}const gn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function _n(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:gn.has(e.type)}function vn(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=an(),u=r(e=>{I(e.currentTarget,R(e))&&o.current.isFocusWithin&&!I(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=Be(u),f=r(e=>{if(!I(e.currentTarget,R(e)))return;let t=R(e),n=P(t),r=L(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=R(e);if(o.current.isFocusWithin&&!I(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});ze(e,t);let i=Re(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 yn(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||lt()}),[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=lt(),l(e),f()},[f]);mt(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=St({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=vn({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let bn=!1,xn=0;function Sn(){bn=!0,setTimeout(()=>{bn=!1},500)}function Cn(e){e.pointerType===`touch`&&Sn()}function wn(){let e=P(null);if(e!==void 0)return xn===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,Cn),xn++,()=>{xn--,!(xn>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,Cn)}}function Tn(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(wn,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=an(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!I(e.currentTarget,R(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(P(R(e)),`pointerover`,e=>{d.isHovered&&d.target&&!I(d.target,R(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=>{bn&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&I(e.currentTarget,R(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}}const En=t(null),Dn=7e3;let $=null;function On(e,t=`assertive`,n=Dn){$?$.announce(e,t,n):($=new kn,(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 kn=class{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))}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){if(!this.node)return;let r=document.createElement(`div`);typeof e==`object`?(r.setAttribute(`role`,`img`),r.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):r.textContent=e,t===`assertive`?this.assertiveLog?.appendChild(r):this.politeLog?.appendChild(r),e!==``&&setTimeout(()=>{r.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}};function An(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=dn({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Bt(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=N(y,_,Yt(e,{labelable:!0}));return{isPressed:v,buttonProps:N(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 jn=t({}),Mn=Ht(function(t,n){[t,n]=ue(t,n,jn);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=An(t,n);o=Pn(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=yn(t),{hoverProps:f,isHovered:p}=Tn({...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=se({...t,values:m,defaultClassName:`react-aria-Button`}),g=j(o.id),_=j(),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)&&On(e,`assertive`),y.current=i},[i,u,v,g]);let b=Yt(t,{global:!0});return delete b.onClick,e.createElement(he.button,{...N(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(En.Provider,{value:{id:_}},h.children))}),Nn=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function Pn(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!Nn.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{ye as A,he as B,Ie as C,R as D,L as E,ue as F,M as G,le as H,se as I,T as J,ne as K,de as L,F as M,be as N,Se as O,oe as P,ce as R,Fe as S,Ce as T,ie as U,fe as V,N as W,p as X,m as Y,f as Z,dt as _,vn as a,qe as b,nn as c,Bt as d,Rt as f,ut as g,gt as h,yn as i,P as j,xe as k,Yt as l,xt as m,Mn as n,dn as o,It as p,j as q,Tn as r,rn as s,jn as t,Ht as u,Ke as v,I as w,U as x,W as y,ae as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BugReportAnswer, c as SingleSelectAnswer, n as PublicGetSurveyOutput, o as MultiSelectAnswer, r as Locale, s as RatingAnswer, t as PublicPutResponseOutput } from "./index-
|
|
1
|
+
import { a as BugReportAnswer, c as SingleSelectAnswer, n as PublicGetSurveyOutput, o as MultiSelectAnswer, r as Locale, s as RatingAnswer, t as PublicPutResponseOutput } from "./index-C6cGD5WB.js";
|
|
2
2
|
import { PropsWithChildren, ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/core/types.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./Button-
|
|
1
|
+
import{n as e}from"./Button-CKL29na5.js";import{t}from"./src-DvVD5FzZ.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l(e){return typeof e!=`boolean`}function u({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const d={lastRespondedAt:null,lastDismissedAt:null};async function f({client:e,surveyId:n,respondent:r,signal:i}){try{let a=await e.get(`api/v1/cfti/${encodeURIComponent(n)}/respondent/${encodeURIComponent(r)}`,{signal:i}).json(),o=t.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),d)}catch{return d}}function p({client:e,surveyId:t,respondent:i,enabled:a=!0}){let[o,s]=r(d),[c,l]=r(()=>!a),[u,p]=r({client:e,surveyId:t,respondent:i,enabled:a});return(u.client!==e||u.surveyId!==t||u.respondent!==i||u.enabled!==a)&&(p({client:e,surveyId:t,respondent:i,enabled:a}),s(d),l(!a)),n(()=>{if(!a||!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;f({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(s(e),l(!0))})};r();let o=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,o),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,o)}},[e,t,i,a]),{state:o,isSettled:c}}function m({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${encodeURIComponent(t)}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>n.abort()},[e,t]),{isAvailable:i,isSettled:o}}const h=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),g=({onClick:t,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(e,{onPress:t,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(h,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{u as a,p as i,h as n,c as o,m as r,l as s,g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,o as n,r,s as i}from"./DefaultConfettiTrigger-B0_iX1RM.js";import{B as a,D as o,F as s,G as c,H as l,I as u,K as d,L as f,M as p,P as m,R as h,U as g,V as _,W as v,Y as y,Z as b,_ as x,a as S,d as C,h as w,i as T,l as E,n as D,o as O,p as k,q as A,r as j,u as M}from"./Button-CKL29na5.js";import{c as N,l as ee,o as te,s as ne,u as re}from"./src-DvVD5FzZ.js";import{a as ie,n as ae,o as oe,r as se,t as ce}from"./internals-BCQiNSvA.js";import{S as le,_ as ue,a as P,b as de,c as fe,g as pe,h as me,i as he,l as ge,o as _e,p as ve,r as ye,s as be,u as xe,v as F,x as Se,y as Ce}from"./ModalContainer-DcF9hn27.js";import I,{Suspense as we,cloneElement as Te,createContext as L,forwardRef as R,isValidElement as Ee,lazy as De,useCallback as z,useContext as B,useEffect as V,useMemo as H,useRef as U,useState as W}from"react";import{useTimeout as Oe}from"usehooks-ts";import{Fragment as G,jsx as K,jsxs as q}from"react/jsx-runtime";import J from"clsx";import"react-dom";const ke=L(null),Ae=L({}),Y=M(function(e,t){[e,t]=s(e,t,Ae);let{elementType:n=`label`,...r}=e,i=a[n];return I.createElement(i,{className:`react-aria-Label`,...r,ref:t})});function je(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=le({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}const X=L(null),Z=R(function(e,t){return B(X)?.isInvalid?I.createElement(Me,{...e,ref:t}):null}),Me=R((e,t)=>{let n=B(X),{elementType:r,...i}=e,a=E(i,{global:!0}),o=u({...i,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return o.children==null?null:I.createElement(F,{slot:`errorMessage`,elementType:r,...a,...o,ref:t})}),Ne={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Pe={...Ne,customError:!0,valid:!1},Q={isInvalid:!1,validationDetails:Ne,validationErrors:[]},Fe=L({}),Ie=`__reactAriaFormValidationState`;function Le(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Ie];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:Pe},l=H(()=>!o||i==null?null:Ve(Be(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=B(Fe),d=H(()=>r?Array.isArray(r)?r.flatMap(e=>ze(u[e])):ze(u[r]):[],[u,r]),[f,p]=W(u),[m,h]=W(!1);u!==f&&(p(u),h(!1));let g=H(()=>Ve(m?[]:d),[m,d]),_=U(Q),[v,y]=W(Q),b=U(Q),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;He(e,b.current)||(b.current=e,y(e))},[S,C]=W(!1);return V(x),{realtimeValidation:c||g||l||a||Q,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=Q;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:Pe}: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={...Ne};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}}const We=L(null),Ge=new WeakMap;function Ke(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=je(e),s=d([!!t,!!n,r,i]),c=d([!!t,!!n,r,i]);return o=v(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function qe(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:a=`aria`}=e,{isInvalid:o,validationErrors:s,validationDetails:c}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:d,errorMessageProps:f}=Ke({...e,labelElementType:`span`,isInvalid:o,errorMessage:e.errorMessage||s});Ge.set(t,{name:r,form:i,descriptionId:d.id,errorMessageId:f.id,validationBehavior:a});let p=E(e,{labelable:!0}),{focusWithinProps:m}=S({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:v(p,{role:`group`,"aria-disabled":n||void 0,...u,...m}),labelProps:l,descriptionProps:d,errorMessageProps:f,isInvalid:o,validationErrors:s,validationDetails:c}}function Je(e,t,n){let r=w(e=>{n&&!e.defaultPrevented&&n(t)});V(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Ye(e,t,n){let{validationBehavior:r,focus:i}=e;y(()=>{if(r===`native`&&n?.current&&`setCustomValidity`in n.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Ze(n.current))}});let a=U(!1),s=w(()=>{a.current||t.resetValidation()}),c=w(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Qe(r)===n.current&&(i?i():n.current?.focus(),x(`keyboard`)),e.preventDefault()}),l=w(()=>{t.commitValidation()});V(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&o(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,c),e.addEventListener(`change`,l),t?.addEventListener(`reset`,s),()=>{e.removeEventListener(`invalid`,c),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,s),t&&(t.reset=r)}},[n,r])}function Xe(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function Ze(e){return{isInvalid:!e.validity.valid,validationDetails:Xe(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Qe(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}function $e(e=!0){let[t,n]=W(e),r=U(!1),i=z(e=>{r.current=!0,n(!!e)},[]);return y(()=>{r.current||n(!1)},[]),[i,t]}function et(e=!0){let t=A(),[n,r]=$e(e);return{id:r?t:void 0,ref:n}}function tt(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:a,name:s,form:c,children:l,isRequired:u,validationBehavior:d=`aria`,"aria-label":f,"aria-labelledby":p,"aria-describedby":m,onPressStart:h,onPressEnd:g,onPressChange:_,onPress:y,onPressUp:b,onClick:x}=e,S=Le({...e,value:t.isSelected}),{isInvalid:w,validationErrors:T,validationDetails:D}=S.displayValidation;Ye(e,S,n);let k=e=>{e.stopPropagation(),t.setSelected(o(e).checked)},{pressProps:A,isPressed:j}=O({onPressStart:h,onPressEnd:g,onPressChange:_,onPress:y,onPressUp:b,onClick:x,isDisabled:r}),[M,N]=W(!1),{pressProps:ee}=O({onPressStart(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}h?.(e),_?.(!0),N(!0)},onPressEnd(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}g?.(e),_?.(!1),N(!1)},onPressUp(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}b?.(e)},onClick:x,onPress(r){if(r.pointerType===`keyboard`||r.pointerType===`virtual`){r.continuePropagation();return}y?.(r),t.toggle(),n.current?.focus();let{[Ie]:i}=e,{commitValidation:a}=i||S;a()},isDisabled:r||i}),{focusableProps:te}=C(e,n),ne=v(A,te),re=E(e,{labelable:!0});Je(n,t.defaultSelected,t.setSelected);let ie=et(),ae=et();return{labelProps:v(ee,{onClick:e=>e.preventDefault()}),inputProps:v(re,{checked:t.isSelected,"aria-required":u&&d===`aria`||void 0,required:u&&d===`native`,"aria-invalid":w||e.validationState===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,"aria-describedby":[ie.id,ae.id,m].filter(Boolean).join(` `)||void 0,onChange:k,disabled:r,...a==null?{}:{value:a},name:s,form:c,type:`checkbox`,...ne}),descriptionProps:ie,errorMessageProps:ae,isSelected:t.isSelected,isPressed:j||M,isDisabled:r,isReadOnly:i,isInvalid:w||e.validationState===`invalid`,validationErrors:T,validationDetails:D}}function nt(e,t,n){let{labelProps:r,inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:c,isDisabled:l,isReadOnly:u,isInvalid:d,validationErrors:f,validationDetails:p}=tt(e,t,n),{isIndeterminate:m}=e;return V(()=>{n.current&&(n.current.indeterminate=!!m)}),{labelProps:v(r,H(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:c,isDisabled:l,isReadOnly:u,isInvalid:d,validationErrors:f,validationDetails:p}}function rt(e={}){let{isReadOnly:t}=e,[n,r]=de(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=W(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function it(e,t,n){let r=rt({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=Ge.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=Le({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=U(Q),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};V(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=nt({...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,[Ie]:{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":[m.inputProps[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}function at(e={}){let[t,n]=de(e.value,e.defaultValue||[],e.onChange),[r]=W(t),i=!!e.isRequired&&t.length===0,a=U(new Map),o=Le({...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}}const ot=L(null),st=L(null),ct=L(null),lt=R(function(e,t){[e,t]=s(e,t,st);let{validationBehavior:n}=l(We)||{},r=e.validationBehavior??n??`native`,i=at({...e,validationBehavior:r}),[o,c]=f(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:d,labelProps:p,descriptionProps:h,errorMessageProps:g,..._}=qe({...e,label:c,validationBehavior:r},i),y=u({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),b=E(e,{global:!0});return I.createElement(a.div,{...v(b,y,d),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},I.createElement(m,{values:[[ct,i],[Ae,{...p,ref:o,elementType:`span`}],[Ce,{slots:{description:h,errorMessage:g}}],[X,_]]},y.children))}),ut=L(null);function dt(e,t){let{validationBehavior:n}=l(We)||{},r=e.validationBehavior??n??`native`,i=B(ct),a=g(H(()=>c(t,e.inputRef===void 0?null:e.inputRef),[t,e.inputRef])),o={..._(e),children:typeof e.children==`function`||e.children,value:e.value,validationBehavior:r};return[i?it(o,i,a):nt(o,rt(e),a),a]}const ft=R(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=s(r,t,ot);let[i,a]=dt(e,n);return I.createElement(ut.Provider,{value:{...i,inputRef:a,defaultClassName:`react-aria-Checkbox`,isIndeterminate:e.isIndeterminate,isRequired:e.isRequired}},I.createElement(pt,{...e,ref:t}))}),pt=R(function(e,t){let{labelProps:n,inputProps:r,isSelected:i,isDisabled:o,isReadOnly:s,isPressed:c,isInvalid:l,inputRef:d,defaultClassName:f,isIndeterminate:p,isRequired:m}=B(ut),{isFocused:h,isFocusVisible:g,focusProps:_}=T(),y=o||s,{hoverProps:b,isHovered:x}=j({...e,isDisabled:y}),S=u({...e,defaultClassName:f,values:{isSelected:i,isIndeterminate:p||!1,isPressed:c,isHovered:x,isFocused:h,isFocusVisible:g,isDisabled:o,isReadOnly:s,isInvalid:l,isRequired:m||!1}}),C=E(e,{global:!0});return delete C.id,delete C.onClick,I.createElement(a.label,{...v(C,n,b,S),ref:t,slot:e.slot||void 0,"data-selected":i||void 0,"data-indeterminate":p||void 0,"data-pressed":c||void 0,"data-hovered":x||void 0,"data-focused":h||void 0,"data-focus-visible":g||void 0,"data-disabled":o||void 0,"data-readonly":s||void 0,"data-invalid":l||void 0,"data-required":m||void 0},I.createElement(ue,{elementType:`span`},I.createElement(`input`,{...v(r,_),ref:d})),S.children)}),mt=L({}),ht=L({});let gt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const _t=M(function(e,t){[e,t]=s(e,t,ht);let{hoverProps:n,isHovered:r}=j({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:o,focusProps:c}=T({isTextInput:!0,autoFocus:e.autoFocus}),l=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,d=u({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:l},defaultClassName:`react-aria-Input`});return I.createElement(a.input,{...v(gt(e),c,n),...d,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":l||void 0})});function vt(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:a=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=de(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=C(e,t),f=Le({...e,value:l}),{isInvalid:p,validationErrors:m,validationDetails:h}=f.displayValidation,{labelProps:g,fieldProps:_,descriptionProps:y,errorMessageProps:b}=Ke({...e,isInvalid:p,errorMessage:e.errorMessage||m}),x=E(e,{labelable:!0}),S={type:s,pattern:e.pattern},[w]=W(l);return Je(t,e.defaultValue??w,u),Ye(e,f,t),{labelProps:g,inputProps:v(x,n===`input`?S:void 0,{disabled:r,readOnly:a,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":p||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:l,onChange:e=>u(o(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(I.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...d,..._}),descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:h}}const yt=L(null);function bt(e){let t=U({});return I.createElement(yt.Provider,{value:t},e.children)}const xt=new WeakMap;function St(e,t,n){let{value:r,children:i,"aria-label":a,"aria-labelledby":o,onPressStart:s,onPressEnd:c,onPressChange:l,onPress:u,onPressUp:d,onClick:f}=e,p=e.isDisabled||t.isDisabled,m=t.selectedValue===r,h=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:g,isPressed:_}=O({onPressStart:s,onPressEnd:c,onPressChange:l,onPress:u,onPressUp:d,onClick:f,isDisabled:p}),{pressProps:y,isPressed:b}=O({onPressStart:s,onPressEnd:c,onPressChange:l,onPressUp:d,onClick:f,isDisabled:p,onPress(e){u?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=C(v(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=v(g,x),w=E(e,{labelable:!0}),T=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(T=0):t.selectedValue===r&&(T=0),p&&(T=void 0);let{name:D,form:k,descriptionId:A,errorMessageId:j,validationBehavior:M}=xt.get(t);Je(n,t.defaultSelectedValue,t.setSelectedValue),Ye({validationBehavior:M},t,n);let N=et();return{labelProps:v(y,H(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:v(w,{...S,type:`radio`,name:D,form:k,tabIndex:T,disabled:p,required:t.isRequired&&M===`native`,checked:m,value:r,onChange:h,"aria-describedby":[e[`aria-describedby`],N.id,t.isInvalid?j:null,A].filter(Boolean).join(` `)||void 0}),descriptionProps:N,isDisabled:p,isSelected:m,isPressed:_||b}}function Ct(e,t){let{name:n,form:r,isReadOnly:i,isRequired:a,isDisabled:s,orientation:c=`vertical`,validationBehavior:l=`aria`}=e,{direction:u}=Se(),{isInvalid:d,validationErrors:f,validationDetails:m}=t.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:_,errorMessageProps:y}=Ke({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||f}),b=E(e,{labelable:!0}),{focusWithinProps:x}=S({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});function C(e,n){let r=pe(n.currentTarget,{from:o(n),accept:e=>e instanceof p(e).HTMLInputElement&&e.type===`radio`}),i;return e===`next`?(i=r.nextNode(),i||=(r.currentNode=n.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=n.currentTarget,r.lastChild())),i?(i.focus(),t.setSelectedValue(i.value),!0):!1}let{keyboardProps:w}=k({shortcuts:{ArrowRight:e=>C(u===`rtl`&&c!==`vertical`?`prev`:`next`,e),ArrowLeft:e=>C(u===`rtl`&&c!==`vertical`?`next`:`prev`,e),ArrowDown:e=>C(`next`,e),ArrowUp:e=>C(`prev`,e)},allowRepeats:!0}),T=A(n);return xt.set(t,{name:T,form:r,descriptionId:_.id,errorMessageId:y.id,validationBehavior:l}),{radioGroupProps:v(b,{role:`radiogroup`,...w,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":a||void 0,"aria-disabled":s||void 0,"aria-orientation":c,...g,...x}),labelProps:h,descriptionProps:_,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:m}}let wt=Math.round(Math.random()*1e10),Tt=0;function Et(e){let t=H(()=>e.name||`radio-group-${wt}-${++Tt}`,[e.name]),[n,r]=de(e.value,e.defaultValue??null,e.onChange),[i]=W(n),[a,o]=W(null),s=Le({...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 Dt=L(null),Ot=L(null),kt=L(null),At=R(function(e,t){[e,t]=s(e,t,Dt);let{validationBehavior:n}=l(We)||{},r=e.validationBehavior??n??`native`,i=Et({...e,validationBehavior:r}),[o,c]=f(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:d,labelProps:p,descriptionProps:h,errorMessageProps:g,..._}=Ct({...e,label:c,validationBehavior:r},i),y=u({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),b=E(e,{global:!0});return I.createElement(a.div,{...v(b,y,d),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},I.createElement(m,{values:[[kt,i],[Ae,{...p,ref:o,elementType:`span`}],[Ce,{slots:{description:h,errorMessage:g}}],[X,_]]},I.createElement(bt,null,y.children)))}),jt=R(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=s(r,t,Ot);let i=I.useContext(kt),a=g(H(()=>c(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),o=St({..._(e),children:typeof e.children==`function`||e.children},i,a);return I.createElement(Mt.Provider,{value:{...o,inputRef:a,defaultClassName:`react-aria-Radio`}},I.createElement(Nt,{...e,ref:t}))}),Mt=L(null),Nt=R(function(e,t){let{labelProps:n,inputProps:r,isSelected:i,isDisabled:o,isPressed:s,defaultClassName:c,inputRef:l}=B(Mt),d=I.useContext(kt),{isFocused:f,isFocusVisible:p,focusProps:m}=T(),h=o||d.isReadOnly,{hoverProps:g,isHovered:_}=j({...e,isDisabled:h}),y=u({...e,defaultClassName:c,values:{isSelected:i,isPressed:s,isHovered:_,isFocused:f,isFocusVisible:p,isDisabled:o,isReadOnly:d.isReadOnly,isInvalid:d.isInvalid,isRequired:d.isRequired}}),b=E(e,{global:!0});return delete b.id,delete b.onClick,I.createElement(a.label,{...v(b,n,g,y),ref:t,"data-selected":i||void 0,"data-pressed":s||void 0,"data-hovered":_||void 0,"data-focused":f||void 0,"data-focus-visible":p||void 0,"data-disabled":o||void 0,"data-readonly":d.isReadOnly||void 0,"data-invalid":d.isInvalid||void 0,"data-required":d.isRequired||void 0},I.createElement(ue,{elementType:`span`},I.createElement(`input`,{...v(r,m),ref:l})),y.children)}),Pt=L({});let Ft=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const It=R(function(e,t){[e,t]=s(e,t,Pt);let{hoverProps:n,isHovered:r}=j(e),{isFocused:i,isFocusVisible:o,focusProps:c}=T({isTextInput:!0,autoFocus:e.autoFocus}),l=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,d=u({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:l},defaultClassName:`react-aria-TextArea`});return I.createElement(a.textarea,{...v(Ft(e),c,n),...d,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":l||void 0})}),Lt=L(null),Rt=M(function(e,t){[e,t]=s(e,t,Lt);let{validationBehavior:n}=l(We)||{},r=e.validationBehavior??n??`native`,i=U(null);[e,i]=s(e,i,ke);let[o,c]=f(!e[`aria-label`]&&!e[`aria-labelledby`]),[d,p]=W(`input`),{labelProps:h,inputProps:g,descriptionProps:v,errorMessageProps:y,...b}=vt({..._(e),inputElementType:d,label:c,validationBehavior:r},i),x=z(e=>{i.current=e,e&&p(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),S=u({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:b.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),C=E(e,{global:!0});return delete C.id,I.createElement(a.div,{...C,...S,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":b.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},I.createElement(m,{values:[[Ae,{...h,ref:o}],[ht,{...g,ref:x}],[Pt,{...g,ref:x}],[mt,{role:`presentation`,isInvalid:b.isInvalid,isDisabled:e.isDisabled||!1}],[Ce,{slots:{description:v,errorMessage:y}}],[X,b]]},S.children))}),$=e=>Array.isArray(e)?e.length===0:typeof e==`object`?ne(e):e===void 0||e===``,zt=({answer:e,defaultAnswer:t})=>{if(!$(e)||!$(t))return e},Bt=({routingLogic:e,answer:t,required:n,isLastQuestion:r})=>{if(e.type!==`always`&&$(t)&&n)return!0;let i=e.type===`always`?e.target:$(t)?e.default:e.cases.find(e=>ie({answer:t,condition:e}))?.target??e.default;return i.type===`jump`||i.type===`next`&&!r},Vt=({originalQuestions:e=[],answers:t,errors:n,pointer:r=-1})=>{let i=[...e].sort((e,t)=>e.position-t.position),a=r>=0?i[r]:void 0,o=oe(i,t,{forceReachableIds:a?[a.id]:void 0}),s=i.map(e=>{let t=n[e.id];return{...e,...t?{error:t}:{},visible: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}},Ht=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t,n])=>!!e.find(e=>e.id===t)?.visible&&n!==null)),Ut={},Wt=({questions:e,answers:t,errors:n,locale:r})=>{let i={};for(let a of e){if(!a.visible||!a.required||t[a.id]!==void 0||n[a.id])continue;let e=te(a.properties,{required:a.required}).safeParse(void 0);e.success||(i[a.id]=me(e.error,r))}return i},Gt=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()},Kt=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i,locale:a})=>{let{survey:o,submit:s}=ve(),[c,l]=W({}),[u,d]=W({}),[f,p]=W(null),m=H(()=>Vt({originalQuestions:o?.questions,answers:c,errors:u,pointer:e}),[o?.questions,c,u,e]),h=e??f??m.currentIndex,g=H(()=>!!o?.isBackNavigationAllowed&&h>0&&m.questions.slice(0,h).some(e=>!!e.visible),[o?.isBackNavigationAllowed,m.questions,h]),_=z((e,t)=>{let n=m.questions.find(t=>t.id===e)?.required??!1,r=$(t);l(i=>{if(n&&r){if(!(e in i))return i;let t={...i};return delete t[e],t}let a=!n&&r?null:t;return i[e]===a?i:{...i,[e]:a}})},[m.questions]),v=z(()=>{o?.isBackNavigationAllowed&&p(t=>{let n=t??e??m.currentIndex;for(let e=n-1;e>=0;e--)if(m.questions[e]?.visible)return e;return t})},[o?.isBackNavigationAllowed,m.questions,m.currentIndex,e]),[y,b]=W(0),x=y>0,S=U(null),[C,w]=W(!1);V(()=>{y===0||!S.current||Gt(S.current)},[y]);let T=z(({answers:e})=>{Promise.resolve(s({answers:e})).then(e=>r?.(e??void 0),()=>r?.())},[r,s]),E=z(()=>{let e=Object.fromEntries(Object.entries(u).filter(([e])=>!!m.questions.find(t=>t.id===e)?.visible)),t=Wt({questions:m.questions,answers:c,errors:e,locale:a}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&d(e=>({...e,...t})),b(e=>e+1),!1;let i=Ht({questions:m.questions,answers:c});return T({answers:i}),w(!0),n?.(),!0},[c,u,m.questions,T,n,a]),D=z(({question:r,answer:i})=>{let s=m.questions.at(r);if(!s)return{error:`Question index is invalid`};let h=te(s.properties,{required:s.required}).safeParse(i);if(!h.success){let e=me(h.error,a);return d(t=>t[s.id]===e?t:{...t,[s.id]:e}),l(e=>{if(!(s.id in e))return e;let t={...e};return delete t[s.id],t}),{error:e}}d(e=>{if(!e[s.id])return e;let t={...e};return delete t[s.id],t});let g=$(i),_=!s.required&&g?null:i,v={...c},y=v[s.id]!==_;v[s.id]=_;let b=Vt({originalQuestions:o?.questions,answers:v,errors:u,pointer:e});y&&l(v);let x=b.questions.findIndex((e,t)=>t>r&&!!e.visible);if(f!==null&&x!==-1)return p(x),{next:x};if(p(null),b.questions.every(({visible:e,id:t})=>!e||v[t]!==void 0)&&t){let e=Ht({questions:b.questions,answers:v});T({answers:e}),w(!0),n?.()}return{next:b.currentIndex}},[m.questions,c,o?.questions,u,t,e,f,T,n,a]);return m.questions.length===0?K(G,{}):K(`div`,{ref:S,className:`confetti ${ce}`,"data-show-errors":x||void 0,children:i({questions:m.questions,current:h,answers:c,update:D,back:v,canGoBack:g,backButtonLabel:o?.backButtonLabel??void 0,saveAnswer:_,submit:E,isSubmitted:C,errors:x?u:Ut})})},qt=L(null);function Jt({children:a,surveyId:o,publishableKey:s,apiBaseUrl:c,respondent:l,isSurveyVisible:u}){let d=e({surveyId:o,override:l}),f=b({publishableKey:s,apiBaseUrl:c}),{isAvailable:p,isSettled:m}=r({client:f,surveyId:o}),{state:h,isSettled:g}=t({client:f,surveyId:o,respondent:d,enabled:i(u)}),_=H(()=>({respondent:d}),[d]);return!d||!m||!g||!p||!n(h,u)?null:K(qt.Provider,{value:_,children:a})}function Yt(e){return B(qt)?K(G,{children:e.children}):K(Jt,{...e})}function Xt(){let e=B(qt);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const Zt=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3,locale:o})=>{let{surveyId:s,survey:c,dismiss:l}=ve(),[u,d]=W(!1),[f,p]=W(!1),[m,h]=W(!1),[g,_]=W(!1);return Oe(()=>{c&&i?.()},f&&!(m||g)?a:null),q(`div`,{className:J(`confetti-dialog ${ce}`,t?.dialog),id:`${s}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),h(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),h(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),_(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||_(!1)},children:[K(ye,{className:J(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:o,onClose:async()=>{u||(await l(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>d(!0),setIsFinished:()=>p(!0)}):e]})},Qt=({maskAllInputs:e,initialEventsJson:t,locale:n}={})=>{let[r,i]=W(()=>t??null),[a,o]=W(!1),[s,c]=W(null),[l,u]=W(30),d=U(null),f=U(null),p=U(null),m=U([]);V(()=>{let e=new CustomEvent(se,{detail:{isRecording:a}});document.dispatchEvent(e)},[a]);let h=z(()=>{f.current&&=(clearInterval(f.current),null),p.current&&=(clearTimeout(p.current),null),d.current=null,u(30)},[]),g=z(()=>{d.current?.(),h(),o(!1),i(JSON.stringify(m.current))},[h]);return{recordingEventsJson:r,isRecording:a,recordingError:s,remainingSeconds:l,startRecording:z(async()=>{o(!0),c(null),i(null),m.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);d.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{m.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=30;u(n),f.current=setInterval(()=>{--n,u(n)},1e3),p.current=setTimeout(g,3e4)}catch{c(P(n).recordingError),o(!1),h()}},[e,g,h,n]),stopRecording:g,clear:z(()=>{h(),o(!1),i(null),c(null),m.current=[]},[h])}},$t=e=>e.replace(/\S/g,`*`),en=e=>`*`.repeat(e.length),tn=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):tn(n,t)},nn=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,en(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=en(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=en(t.textContent)},rn=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${ae}`)){tn(e,e=>{e.data=$t(e.data)}),nn(e);for(let t of e.querySelectorAll(`input, textarea, select`))nn(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))nn(e)}}}),an=({maskAllInputs:e,initialDataUrl:t,locale:n}={})=>{let[r,i]=W(()=>t??null),[a,o]=W(!1),[s,c]=W(null);return{screenshotDataUrl:r,isCapturing:a,captureError:s,capture:z(async()=>{o(!0),c(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),n=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${ce}`],excludeMode:`hide`,plugins:[rn({maskInputs:!!e})],fast:!1})).toCanvas(),r=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*r),n.width),o=Math.min(Math.round(window.innerHeight*r),n.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(n,0,0,a,o,0,0,a,o),i(s.toDataURL(`image/png`))}catch{c(P(n).captureError)}finally{o(!1)}},[e,n]),clear:z(()=>{i(null),c(null)},[])}},on=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[K(`circle`,{cx:`12`,cy:`12`,r:`10`}),K(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),sn=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[K(`path`,{d:`M10 11v6`}),K(`path`,{d:`M14 11v6`}),K(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),K(`path`,{d:`M3 6h18`}),K(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function cn(){if(!window.DD_RUM||typeof window.DD_RUM?.getInternalContext!=`function`||typeof window.DD_RUM?.getSessionReplayLink!=`function`)return null;try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}}function ln(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=cn();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 un=De(()=>import(`./RecordingReplayer-D1vUPmxV.js`)),dn=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c,defaultAnswer:l,locale:u})=>{let d=P(u),f=H(()=>ln(),[]),p=l&&typeof l==`object`&&`title`in l?l:void 0,[m,h]=W(()=>p?.title??``),[g,_]=W(()=>p?.description??``),{screenshotDataUrl:v,isCapturing:y,captureError:b,capture:x,clear:S}=an({maskAllInputs:c,initialDataUrl:p?.screenshotDataUrl,locale:u}),{recordingEventsJson:C,isRecording:w,recordingError:T,remainingSeconds:E,startRecording:O,stopRecording:k,clear:A}=Qt({maskAllInputs:c,initialEventsJson:p?.recordingEventsJson,locale:u}),j=H(()=>({title:m,...g?{description:g}:{},...v?{screenshotDataUrl:v}:{},...C?{recordingEventsJson:C}:{},metadata:f}),[g,f,C,v,m]);V(()=>{i(j)},[j,i]),V(()=>k,[k]);let M=H(()=>C?JSON.parse(C):[],[C]);return K(G,{children:w?q(D,{className:J(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:k,children:[K(on,{}),q(`span`,{children:[30-E,`s /`,` `,30,`s`]})]}):q(`div`,{className:J(`cf-bug-report`,s?.base),children:[q(Rt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:m,onChange:h,className:J(`cf-question`,s?.question),children:[q(`div`,{className:J(`cf-header`,s?.header),children:[q(Y,{className:J(`cf-title`,s?.title),children:[t,!a&&q(`span`,{className:J(`cf-label-optional`,s?.optionalLabel),children:[` `,d.optional]})]}),n&&K(F,{slot:`description`,className:J(`cf-description`,s?.description),children:n})]}),K(_t,{placeholder:be(r.placeholder,u),className:J(`cf-input`,s?.input)}),K(Z,{className:J(`cf-error`,s?.error),children:o})]}),q(Rt,{name:`${e}-description`,value:g,onChange:_,className:J(`cf-question`,s?.question),children:[K(Y,{className:J(`cf-title`,s?.title),children:r.detailsLabel}),K(It,{placeholder:_e(r.detailsPlaceholder,u),className:J(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?q(`section`,{className:J(`cf-question`,s?.question),children:[K(Y,{className:J(`cf-title`,s?.title),children:d.attachments}),q(`div`,{className:J(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&q(`div`,{className:J(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[v?q(`div`,{className:J(`cf-bug-report-media-preview`,s?.mediaPreview),children:[K(`img`,{src:v,alt:d.screenshotPreview,className:J(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),K(`div`,{className:J(`cf-bug-report-media-actions`,s?.mediaActions),children:K(D,{className:J(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:S,"aria-label":d.removeScreenshot,children:K(sn,{})})})]}):K(D,{className:J(`cf-bug-report-button`,s?.button),onPress:x,isDisabled:y,children:y?d.capturing:d.screenshot}),b&&K(`div`,{className:J(`cf-error`,s?.error),children:b})]}),r.enableRecording&&q(`div`,{className:J(`cf-bug-report-recording-section`,s?.recordingSection),children:[M.length>0?q(`div`,{className:J(`cf-bug-report-media-preview`,s?.mediaPreview),children:[K(we,{fallback:K(`span`,{className:J(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":d.loadingRecordingPreview}),children:K(un,{events:M})}),K(`div`,{className:J(`cf-bug-report-media-actions`,s?.mediaActions),children:K(D,{className:J(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:A,"aria-label":d.removeRecording,children:K(sn,{})})})]}):K(D,{className:J(`cf-bug-report-button`,s?.button),onPress:O,children:d.record}),T&&K(`div`,{className:J(`cf-error`,s?.error),children:T})]})]})]}):null]})})},fn=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let[u,d]=W(()=>typeof c==`string`?c:``);return V(()=>{i(u)},[i,u]),q(Rt,{isRequired:o,isInvalid:!!s,name:e,className:J(`cf-question`,a?.question),value:u,onChange:e=>{d(e),i(e)},children:[q(`div`,{className:J(`cf-header`,a?.header),children:[q(Y,{className:J(`cf-title`,a?.title),children:[t,!o&&q(`span`,{className:J(`cf-label-optional`,a?.optionalLabel),children:[` `,P(l).optional]})]}),n&&K(F,{slot:`description`,className:J(`cf-description`,a?.description),children:n})]}),K(It,{className:J(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||P(l).startTyping}),K(Z,{className:J(`cf-error`,a?.error),children:s})]})},pn=({children:e,classNames:t,description:n,...r})=>K(ft,{...r,children:({isIndeterminate:r})=>q(G,{children:[q(`div`,{className:J(`cf-choice-label`,t?.label),children:[K(`div`,{className:J(`cf-checkbox-indicator`,t?.indicator),children:K(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:J(`cf-checkbox-indicator-svg`,t?.svg),children:r?K(`rect`,{x:1,y:7.5,width:16,height:3}):K(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&K(`span`,{className:J(`cf-choice-description`,t?.choiceDescription),children:n})]})}),mn=({children:e,classNames:t,...n})=>K(ft,{...n,children:K(`div`,{className:J(`cf-tag-label`,t?.tagLabel),children:e})}),hn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=xe(n.editable?.label,l),f=n.display===`tag`,p=Array.isArray(c)?c:[],m=new Set(n.options.map(e=>e.value)),h=p.find(e=>!m.has(e)),[g,_]=W(()=>{let e=p.filter(e=>m.has(e));return h!==void 0&&u&&e.push(N),e}),[v,y]=W(()=>h!==void 0&&u?h:``),b=U(null),x=U(null),S=e=>{!x.current||!e||requestAnimationFrame(()=>{x.current?.focus()})},C=H(()=>{let e=g.indexOf(N);if(e===-1)return g;let t=[...g];return t[e]=v||`__CONFETTI_CHECKBOX_Others`,t},[v,g]),w=f?mn:pn;return V(()=>{i(C)},[i,C]),K(lt,{isRequired:o,isInvalid:!!s,name:a,value:g,onChange:_,className:J(`cf-question`,r?.question),children:({state:i})=>q(G,{children:[q(`div`,{className:J(`cf-header`,r?.header),children:[q(Y,{className:J(`cf-title`,r?.title),children:[e,!o&&q(`span`,{className:J(`cf-label-optional`,r?.optionalLabel),children:[` `,P(l).optional]})]}),t&&K(F,{slot:`description`,className:J(`cf-description`,r?.description),children:t})]}),q(`div`,{className:J(`cf-response-choices`,f&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>K(w,{className:J(`cf-choice`,f&&[`cf-tag`,r?.tag],!f&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.label??e.value},t)),u&&(f?q(G,{children:[K(mn,{inputRef:b,onChange:S,className:J(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:d}),K(_t,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:v,onChange:e=>{y(e.target.value)},ref:x,className:J(`cf-input cf-tag-input`,r?.othersInput)})]}):q(`div`,{className:J(`cf-choice cf-others-choice`,r?.othersChoice),children:[K(pn,{inputRef:b,onChange:S,className:J(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:d}),K(_t,{value:v,onChange:e=>{y(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:x,onFocus:()=>{b.current?.checked===!1&&b.current.click()},className:J(`cf-input`,r?.othersInput)})]}))]}),K(Z,{className:J(`cf-error`,r?.error),children:s})]})})},gn=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),_n=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),vn=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),yn=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),bn=e=>q(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[K(`circle`,{cx:12,cy:12,r:10}),K(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),xn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:K(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),Sn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:K(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),Cn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return K(`div`,{className:J(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=r&&i<=r;return K(jt,{className:J(`cf-rating-star`,n?.ratingStar),value:String(i),"data-filled":a?`true`:void 0,children:K(a?Sn:xn,{})},t)})})},wn=({properties:e,classNames:t})=>K(`div`,{className:J(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1;return K(jt,{className:J(`cf-rating-number`,t?.ratingNumber),value:String(r),children:r},n)})}),Tn=[gn,vn,yn,bn,_n],En=[vn,yn,bn],Dn=({properties:e,classNames:t,state:n})=>e.scale===3||e.scale===5?K(`div`,{className:J(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,r)=>{let i=r+1,a=e.scale===5?Tn[r]:En[r];return K(jt,{className:J(`cf-rating-emoji`,t?.ratingEmoji),value:String(i),children:a&&K(a,{})},r)})}):K(wn,{properties:e,classNames:t,state:n}),On=e=>{switch(e.properties.display??`star`){case`emoji`:return K(Dn,{...e});case`number`:return K(wn,{...e});case`star`:return K(Cn,{...e})}},kn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s,defaultAnswer:c,locale:l})=>{let[u,d]=W(()=>typeof c==`number`?String(c):null),f=u?Number(u):void 0;return V(()=>{i(f)},[i,f]),K(At,{isRequired:s,isInvalid:!!o,name:a,className:J(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>q(G,{children:[q(`div`,{className:J(`cf-header`,r?.header),children:[q(Y,{className:J(`cf-title`,r?.title),children:[t,!s&&q(`span`,{className:J(`cf-label-optional`,r?.optionalLabel),children:[` `,P(l).optional]})]}),n&&K(F,{slot:`description`,className:J(`cf-description`,r?.description),children:n})]}),q(`div`,{className:J(`cf-rating-section`,r?.ratingSection),children:[K(On,{state:i,properties:e,classNames:r}),q(`div`,{className:J(`cf-rating-text`,r?.ratingText),children:[K(`span`,{className:J(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),K(`span`,{className:J(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),K(Z,{className:J(`cf-error`,r?.error),children:o})]})})},An=({classNames:e,className:t,description:n,...r})=>K(jt,{...r,className:J(t,e?.radio),children:h(r.children,t=>q(G,{children:[q(`div`,{className:J(`cf-choice-label`,e?.label),children:[K(`div`,{className:J(`cf-radio-indicator`,e?.indicator)}),t]}),n&&K(`span`,{className:J(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),jn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=xe(n.editable?.label,l),f=typeof c==`string`?c:null,p=f!==null&&n.options.some(e=>e.value===f),[m,h]=W(()=>f===null?null:p?f:u?ee:null),[g,_]=W(()=>f!==null&&!p&&u?f:``),v=U(null),y=U(null),b=m===`__CONFETTI_RADIO_Others`?g||`__CONFETTI_RADIO_Others`:m??void 0;return V(()=>{i(b)},[i,b]),K(At,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{h(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{y.current?.focus()})},value:m,className:J(`cf-question`,r?.question),children:({state:i})=>q(G,{children:[q(`div`,{className:J(`cf-header`,r?.header),children:[q(Y,{className:J(`cf-title`,r?.title),children:[e,!o&&q(`span`,{className:J(`cf-label-optional`,r?.optionalLabel),children:[` `,P(l).optional]})]}),t&&K(F,{slot:`description`,className:J(`cf-description`,r?.description),children:t})]}),q(`div`,{className:J(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>K(An,{classNames:{indicator:r?.indicator,radio:J(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.label??e.value},t)),u&&q(`div`,{className:J(`cf-choice cf-others-choice`,r?.othersChoice),children:[K(An,{inputRef:v,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:J(`cf-radio`,r?.radio)},description:n.editable?.description,children:d}),K(_t,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:y,value:g,onChange:e=>_(e.target.value),onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:J(`cf-input`,r?.othersInput)})]})]}),K(Z,{className:J(`cf-error`,r?.error),children:s})]})})},Mn=({properties:e,title:t,description:n,classNames:r})=>K(`div`,{className:J(`cf-question`,r?.question),children:q(`div`,{className:J(`cf-header`,r?.header),children:[t&&K(`div`,{className:J(`cf-title`,r?.title),children:t}),n&&K(`div`,{className:J(`cf-description`,r?.description),children:n})]})}),Nn=({question:e,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a})=>{switch(e.properties.type){case`rating`:return K(kn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`open-ended`:return K(fn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`single-select`:return K(jn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`multi-select`:return K(hn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`statement`:return K(Mn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return K(dn,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a},e.id)}return K(`div`,{children:P(a).unsupportedQuestionType},e.id)},Pn=({title:e,description:t,classNames:n,onClose:r,locale:i})=>{let{survey:a}=ve();if(!a)return null;let o=t||a.confirmation.description;return q(G,{children:[K(`div`,{className:J(`cf-question`,n?.question),children:q(`div`,{className:J(`cf-header`,n?.header),children:[K(Y,{className:J(`cf-title`,n?.title),children:e||ge(a.confirmation.title,i)}),o&&K(F,{slot:`description`,className:J(`cf-description`,n?.description),children:o})]})}),K(D,{className:`cf-submit-button`,onPress:()=>{r?.()},children:fe(a.confirmation.buttonText,i)})]})},Fn=({onPress:e,children:t,locale:n})=>he()?null:K(D,{className:`cf-back-button`,onPress:e,children:t===void 0?P(n).back:t}),In=({question:e,answer:t,isLastQuestion:n,locale:r})=>{if(e.properties.buttonLabel)return e.properties.buttonLabel;let i=P(r);return Bt({routingLogic:e.routingLogic,answer:t,required:e.required,isLastQuestion:n})?!e.required&&$(t)?i.skip:i.next:i.submit},Ln=({onPress:e,isDisabled:t,children:n,locale:r})=>he()?null:K(D,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n===void 0?P(r).submit:n}),Rn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},zn=({onSubmit:e,children:t,question:n,isLastQuestion:r,defaultAnswer:i,backButton:a,saveAnswer:o,locale:s})=>{let c=he(),[l,u]=W(i??Rn(n.properties.type)),d=H(()=>te(n.properties,{required:n.required}),[n.properties,n.required]),f=H(()=>{let e=d.safeParse(l);if(!e.success)return me(e.error,s)},[l,d,s]),p=In({question:n,answer:l,isLastQuestion:r,locale:s}),m=z(()=>{if(n.properties.type===`statement`){if(n.properties.buttonUrl&&typeof window<`u`){let e=re.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0)}return e(l)},[l,e,n.properties]),h=!$(i),g=(n.properties.type===`rating`||n.properties.type===`single-select`)&&!!n.properties.shouldAutoProgress&&!h,_=z(t=>{u(t),g&&!$(t)&&d.safeParse(t).success&&e(t)},[g,d,e]),v=H(()=>Ee(a)?Te(a,{onPress:()=>{let e=zt({answer:l,defaultAnswer:i});e!==void 0&&o?.(e),a.props.onPress?.()}}):a,[a,l,i,o]);return q(G,{children:[t({onChange:_,question:n,error:f,defaultAnswer:i}),!c&&q(`div`,{className:`cf-button-row`,children:[v,(!g||!n.required)&&K(Ln,{isDisabled:!!f,onPress:m,children:p})]})]})},Bn=({onSubmit:e,children:t,locale:n})=>q(G,{children:[t,K(Ln,{onPress:e,locale:n})]});export{Nn as a,kn as c,Zt as d,qt as f,Kt as h,Pn as i,hn as l,Xt as m,zn as n,Mn as o,Yt as p,Fn as r,jn as s,Bn as t,fn 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,I as s,J as c,K as l,M as u,N as d,O as f,P as p,S as m,T as h,U as g,W as _,X as v,Y as y,Z as ee,a as te,b as ne,c as re,f as ie,g as ae,h as oe,j as b,k as x,l as S,m as se,p as ce,q as le,s as ue,t as de,u as fe,v as pe,w as C,x as me,y as he,z as ge}from"./Button-CKL29na5.js";import{i as _e,n as ve,r as ye}from"./src-DvVD5FzZ.js";import{i as be,r as xe,t as Se}from"./internals-BCQiNSvA.js";import w,{createContext as T,forwardRef as Ce,useCallback as E,useContext as D,useEffect as O,useMemo as k,useReducer as we,useRef as A,useState as j}from"react";import{useTimeout as Te}from"usehooks-ts";import{z as M}from"zod";import{Fragment as Ee,jsx as N,jsxs as De}from"react/jsx-runtime";import Oe from"clsx";import ke,{flushSync as Ae}from"react-dom";const je=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function P(e){return e instanceof HTMLInputElement&&!je.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Me(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=le(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}}const Ne=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Pe=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Fe(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 Ne.has(t.script)}let t=e.split(`-`)[0];return Pe.has(t)}const Ie=Symbol.for(`react-aria.i18n.locale`);function Le(){let e=typeof window<`u`&&window[Ie]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Fe(e)?`rtl`:`ltr`}}let Re=Le(),F=new Set;function ze(){Re=Le();for(let e of F)e(Re)}function Be(){let e=c(),[t,n]=j(Re);return O(()=>(F.size===0&&window.addEventListener(`languagechange`,ze),F.add(n),()=>{F.delete(n),F.size===0&&window.removeEventListener(`languagechange`,ze)}),[]),e?{locale:typeof window<`u`&&window[Ie]||`en-US`,direction:`ltr`}:t}const Ve=w.createContext(null);function He(){let e=Be();return D(Ve)||e}const Ue=Symbol.for(`react-aria.i18n.locale`),We=Symbol.for(`react-aria.i18n.strings`);let I;var Ge=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=Ke(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Ue];if(I===void 0){let t=window[We];if(!t)return null;I={};for(let r in t)I[r]=new e({[n]:t[r]},n)}let r=I?.[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 Ke(e,t,n=`en-US`){if(t[e])return t[e];let r=qe(e),i=Je(e);if(i&&t[`${r}-${i}`])return t[`${r}-${i}`];if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function qe(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}function Je(e){if(Intl.Locale)return new Intl.Locale(e).script}const Ye=new Map,Xe=new Map;var Ze=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=Ye.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),Ye.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=Xe.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),Xe.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const Qe=new WeakMap;function $e(e){let t=Qe.get(e);return t||(t=new Ge(e),Qe.set(e,t)),t}function et(e,t){return t&&Ge.getGlobalDictionaryForPackage(t)||$e(e)}function tt(e,t){let{locale:n}=He(),r=et(e,t);return k(()=>new Ze(n,r),[n,r])}const nt=typeof document<`u`?w.useInsertionEffect??w.useLayoutEffect:()=>{};function rt(e,t,n){let[r,i]=j(e||t),a=A(r),o=A(e!==void 0),s=e!==void 0;O(()=>{o.current,o.current=s},[s]);let c=s?e:r;nt(()=>{a.current=c});let[,l]=we(()=>({}),{});return[c,E((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])]}const it=T({}),at=T({}),ot=fe(function(e,n){[e,n]=a(e,n,at);let{elementType:r=`span`,...i}=e,o=t[r];return w.createElement(o,{className:`react-aria-Text`,...i,ref:n})});function L(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 st(e,t){let n=e;for(L(n,t)&&(n=n.parentElement);n&&!L(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const ct={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 lt(e={}){let{style:t,isFocusable:n}=e,[r,i]=j(!1),{focusWithinProps:a}=te({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=k(()=>r?t:t?{...ct,...t}:ct,[r]);return{visuallyHiddenProps:{...a,style:o}}}function ut(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=lt(e);return w.createElement(n,_(a,o),t)}var dt=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(e){if(!C(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return C(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,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 ft(e,t,n,r){return f()?new dt(e,t,n,r):e.createTreeWalker(t,n,r)}const pt=w.createContext(null),mt=`react-aria-focus-scope-restore`;let R=null;function ht(e){let{children:t,contain:n,restoreFocus:r,autoFocus:a}=e,o=A(null),s=A(null),c=A([]),{parentNode:l}=D(pt)||{},u=k(()=>new jt({scopeRef:c}),[c]);y(()=>{let e=l||G.root;if(G.getTreeNode(e.scopeRef)&&R&&!St(R,e.scopeRef)){let t=G.getTreeNode(R);t&&(e=t)}e.addChild(u),G.addNode(u)},[u,l]),y(()=>{let e=G.getTreeNode(c);e&&(e.contain=!!n)},[n]),y(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(mt,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(mt,n)}},[t]),Et(c,r,n),yt(c,n),Ot(c,r,n),Tt(c,a),O(()=>{let e=i(b(c.current?c.current[0]:void 0)),t=null;if(V(e,c.current)){for(let n of G.traverse())n.scopeRef&&V(e,n.scopeRef.current)&&(t=n);t===G.getTreeNode(c)&&(R=t.scopeRef)}},[c]),y(()=>()=>{let e=G.getTreeNode(c)?.parent?.scopeRef??null;(c===R||St(c,R))&&(!e||G.getTreeNode(e))&&(R=e),G.removeTreeNode(c)},[c]);let d=k(()=>gt(c),[]),f=k(()=>({focusManager:d,parentNode:u}),[u,d]);return w.createElement(pt.Provider,{value:f},w.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,w.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function gt(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:a,wrap:o,accept:s}=t,c=r||i(b(n[0]??void 0)),l=n[0].previousElementSibling,u=W(z(n),{tabbable:a,accept:s},n);u.currentNode=V(c,n)?c:l;let d=u.nextNode();return!d&&o&&(u.currentNode=l,d=u.nextNode()),d&&U(d,!0),d},focusPrevious(t={}){let n=e.current,{from:r,tabbable:a,wrap:o,accept:s}=t,c=r||i(b(n[0]??void 0)),l=n[n.length-1].nextElementSibling,u=W(z(n),{tabbable:a,accept:s},n);u.currentNode=V(c,n)?c:l;let d=u.previousNode();return!d&&o&&(u.currentNode=l,d=u.previousNode()),d&&U(d,!0),d},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=W(z(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&U(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=W(z(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&U(o,!0),o}}}function z(e){return e[0].parentElement}function B(e){let t=G.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function _t(e){if(!e.form)return Array.from(b(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=u(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function vt(e){if(e.checked)return!0;let t=_t(e);return t.length>0&&!t.some(e=>e.checked)}function yt(e,t){let n=A(void 0),a=A(void 0);y(()=>{let o=e.current;if(!t){a.current&&=(cancelAnimationFrame(a.current),void 0);return}let s=b(o?o[0]:void 0),c=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=i(s),r=e.current;if(!r||!V(n,r))return;let a=W(z(r),{tabbable:!0},r);if(!n)return;a.currentNode=n;let o=t.shiftKey?a.previousNode():a.nextNode();o||=(a.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?a.previousNode():a.nextNode()),t.preventDefault(),o&&(U(o,!0),o instanceof u(o).HTMLInputElement&&o.select())},l=t=>{(!R||St(R,e))&&V(r(t),e.current)?(R=e,n.current=r(t)):B(e)&&!H(r(t),e)?n.current?U(n.current):R&&R.current&&wt(R.current):B(e)&&(n.current=r(t))},d=t=>{a.current&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{let a=ae(),o=(a===`virtual`||a===null)&&ne()&&pe(),c=i(s);if(!o&&c&&B(e)&&!H(c,e)){R=e;let i=r(t);i&&i.isConnected?(n.current=i,U(n.current)):R.current&&wt(R.current)}})};return s.addEventListener(`keydown`,c,!1),s.addEventListener(`focusin`,l,!1),o?.forEach(e=>e.addEventListener(`focusin`,l,!1)),o?.forEach(e=>e.addEventListener(`focusout`,d,!1)),()=>{s.removeEventListener(`keydown`,c,!1),s.removeEventListener(`focusin`,l,!1),o?.forEach(e=>e.removeEventListener(`focusin`,l,!1)),o?.forEach(e=>e.removeEventListener(`focusout`,d,!1))}},[e,t]),y(()=>()=>{a.current&&cancelAnimationFrame(a.current)},[a])}function bt(e){return H(e)}function V(e,t){return!e||!t?!1:t.some(t=>C(t,e))}function H(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of G.traverse(G.getTreeNode(t)))if(n&&V(e,n.current))return!0;return!1}function xt(e){return H(e,R)}function St(e,t){let n=G.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function U(e,t=!1){if(e!=null&&!t)try{se(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Ct(e,t=!0){let n=e[0].previousElementSibling,r=z(e),i=W(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=z(e),i=W(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function wt(e,t=!0){U(Ct(e,t))}function Tt(e,t){let n=w.useRef(t);O(()=>{n.current&&(R=e,!V(i(b(e.current?e.current[0]:void 0)),R.current)&&e.current&&wt(e.current)),n.current=!1},[e])}function Et(e,t,n){y(()=>{if(t||n)return;let i=e.current,a=b(i?i[0]:void 0),o=t=>{let n=r(t);V(n,e.current)?R=e:bt(n)||(R=null)};return a.addEventListener(`focusin`,o,!1),i?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{a.removeEventListener(`focusin`,o,!1),i?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function Dt(e){let t=G.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Ot(e,t,n){let r=A(typeof document<`u`?i(b(e.current?e.current[0]:void 0)):null);y(()=>{let r=e.current,a=b(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!R||St(R,e))&&V(i(a),e.current)&&(R=e)};return a.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{a.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),y(()=>{let r=b(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=r.activeElement;if(!H(n,e)||!Dt(e))return;let i=G.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=W(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!H(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(H(s,e));t.preventDefault(),t.stopPropagation(),s?U(s,!0):bt(a)?U(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),y(()=>{let n=b(e.current?e.current[0]:void 0);if(!t)return;let a=G.getTreeNode(e);if(a)return a.nodeToRestore=r.current??void 0,()=>{let r=G.getTreeNode(e);if(!r)return;let a=r.nodeToRestore,o=i(n);if(t&&a&&(o&&H(o,e)||o===n.body&&Dt(e))){let t=G.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){kt(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&G.getTreeNode(n.scopeRef)){let e=Ct(n.scopeRef.current,!0);if(e){kt(e);return}}n=n.parent}}})}}},[e,t])}function kt(e){e.dispatchEvent(new CustomEvent(mt,{bubbles:!0,cancelable:!0}))&&U(e)}function W(e,t,r){let i=t?.tabbable?n:m,a=b(e?.nodeType===Node.ELEMENT_NODE?e:null),o=ft(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return C(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!vt(e)||o.currentNode.tagName===`INPUT`&&o.currentNode.type===`radio`&&o.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:i(e)&&(!r||V(e,r))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(o.currentNode=t.from),o}var At=class e{constructor(){this.fastMap=new Map,this.root=new jt({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 jt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&V(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},jt=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 G=new At;const Mt=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Nt(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let K=new WeakMap,q=[];function Pt(t,n){let r=u(t?.[0]),i=n instanceof r.Element?{root:n}:n,a=i?.root??document.body,o=i?.shouldUseInert&&Mt,s=new Set(t),c=new Set,l=e=>o&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,d=(e,t)=>{o&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},p=new Set;if(f()){let n=a.getRootNode();for(let r of t){let t=r.getRootNode();for(;e(t)&&t!==n;)p.add(t),t=t.host.getRootNode()}}let m=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))s.add(t);let t=e=>{if(c.has(e)||s.has(e)||e.parentElement&&c.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of s)if(C(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=ft(b(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&h(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)h(e),e=n.nextNode()}},h=e=>{let t=K.get(e)??0;l(e)&&t===0||(t===0&&d(e,!0),c.add(e),K.set(e,t+1))};q.length&&q[q.length-1].disconnect(),m(a);let g=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...s,...c].some(e=>C(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Nt(e)?s.add(e):e instanceof Element&&m(e);if(f()){for(let e of p)if(!e.isConnected){g.disconnect();break}}}});g.observe(a,{childList:!0,subtree:!0});let _=new Set;if(f())for(let e of p){let t=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...s,...c].some(e=>C(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Nt(e)?s.add(e):e instanceof Element&&m(e);if(f()){for(let e of p)if(!e.isConnected){g.disconnect();break}}}});t.observe(e,{childList:!0,subtree:!0}),_.add(t)}let v={visibleNodes:s,hiddenNodes:c,observe(){g.observe(a,{childList:!0,subtree:!0})},disconnect(){g.disconnect()}};return q.push(v),()=>{if(g.disconnect(),f())for(let e of _)e.disconnect();for(let e of c){let t=K.get(e);t!=null&&(t===1?(d(e,!1),K.delete(e)):K.set(e,t-1))}v===q[q.length-1]?(q.pop(),q.length&&q[q.length-1].observe()):q.splice(q.indexOf(v),1)}}function Ft(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=A({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=oe(e=>{n&&It(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=oe(e=>{n&&n(e)});O(()=>{let e=a.current;if(r)return;let n=t.current,i=b(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&It(n,t)&&s(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,o,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,o,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function It(e,t){if(e.button>0)return!1;let n=r(e);if(n){let e=n.ownerDocument;if(!e||!C(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}const J=[];function Lt(e,t){let{onClose:n,shouldCloseOnBlur:i,isOpen:a,isDismissable:o=!1,isKeyboardDismissDisabled:s=!1,shouldCloseOnInteractOutside:c}=e,l=A(void 0);O(()=>{if(a&&!J.includes(t))return J.push(t),()=>{let e=J.indexOf(t);e>=0&&J.splice(e,1)}},[a,t]);let u=()=>{J[J.length-1]===t&&n&&n()},d=e=>{let n=J[J.length-1];l.current=n,(!c||c(r(e)))&&n===t&&e.stopPropagation()},f=e=>{(!c||c(r(e)))&&(J[J.length-1]===t&&e.stopPropagation(),l.current===t&&u()),l.current=void 0},{keyboardProps:p}=ce({shortcuts:{Escape:()=>{if(!s){u();return}return!1}}});Ft({ref:t,onInteractOutside:o&&a?f:void 0,onInteractOutsideStart:d});let{focusWithinProps:m}=te({isDisabled:!i,onBlurWithin:e=>{!e.relatedTarget||xt(e.relatedTarget)||(!c||c(e.relatedTarget))&&n?.()}});return{overlayProps:{...p,...m},underlayProps:{}}}const Y=typeof document<`u`&&window.visualViewport;let X=0,Rt;function zt(e={}){let{isDisabled:t}=e;y(()=>{if(!t)return X++,X===1&&(Rt=me()&&he()?Vt():Bt()),()=>{X--,X===0&&Rt()}},[t])}function Bt(){let e=window.innerWidth-document.documentElement.clientWidth;return v(e>0&&(`scrollbarGutter`in document.documentElement.style?x(document.documentElement,`scrollbar-gutter`,`stable`):x(document.documentElement,`padding-right`,`${e}px`)),x(document.documentElement,`overflow`,`hidden`))}function Vt(){let e=x(document.documentElement,`overflow`,`hidden`),t,n=!1,a=e=>{let i=r(e);t=L(i)?i:st(i,!0),n=!1;let a=i.ownerDocument.defaultView.getSelection();a&&!a.isCollapsed&&a.containsNode(i,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in i&&`selectionEnd`in i&&i.selectionStart<i.selectionEnd&&i.ownerDocument.activeElement===i&&(n=!0)},o=document.createElement(`style`),s=re();s&&(o.nonce=s),o.textContent=`@layer {
|
|
2
|
+
* {
|
|
3
|
+
overscroll-behavior: contain;
|
|
4
|
+
}
|
|
5
|
+
}`,document.head.prepend(o);let c=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()}},l=e=>{let t=r(e),n=e.relatedTarget;n&&P(n)?(n.focus({preventScroll:!0}),Ht(n,P(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},u=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(e){let t=i(),n=t!=null&&P(t);u.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Ht(this,n)}});let f=v(d(document,`touchstart`,a,{passive:!1,capture:!0}),d(document,`touchmove`,c,{passive:!1,capture:!0}),d(document,`blur`,l,!0));return()=>{e(),f(),o.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:u})}}function Ht(e,t){t||!Y?Ut(e):Y.addEventListener(`resize`,()=>Ut(e),{once:!0})}function Ut(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=st(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}}var Wt={};Wt={dismiss:`تجاهل`};var Gt={};Gt={dismiss:`Отхвърляне`};var Kt={};Kt={dismiss:`Odstranit`};var qt={};qt={dismiss:`Luk`};var Jt={};Jt={dismiss:`Schließen`};var Yt={};Yt={dismiss:`Απόρριψη`};var Xt={};Xt={dismiss:`Dismiss`};var Zt={};Zt={dismiss:`Descartar`};var Qt={};Qt={dismiss:`Lõpeta`};var $t={};$t={dismiss:`Hylkää`};var en={};en={dismiss:`Rejeter`};var tn={};tn={dismiss:`התעלם`};var nn={};nn={dismiss:`Odbaci`};var rn={};rn={dismiss:`Elutasítás`};var an={};an={dismiss:`Ignora`};var on={};on={dismiss:`閉じる`};var sn={};sn={dismiss:`무시`};var cn={};cn={dismiss:`Atmesti`};var ln={};ln={dismiss:`Nerādīt`};var un={};un={dismiss:`Lukk`};var dn={};dn={dismiss:`Negeren`};var fn={};fn={dismiss:`Zignoruj`};var pn={};pn={dismiss:`Descartar`};var mn={};mn={dismiss:`Dispensar`};var hn={};hn={dismiss:`Revocare`};var gn={};gn={dismiss:`Пропустить`};var _n={};_n={dismiss:`Zrušiť`};var vn={};vn={dismiss:`Opusti`};var yn={};yn={dismiss:`Odbaci`};var bn={};bn={dismiss:`Avvisa`};var xn={};xn={dismiss:`Kapat`};var Sn={};Sn={dismiss:`Скасувати`};var Cn={};Cn={dismiss:`取消`};var wn={};wn={dismiss:`關閉`};var Tn={};Tn={"ar-AE":Wt,"bg-BG":Gt,"cs-CZ":Kt,"da-DK":qt,"de-DE":Jt,"el-GR":Yt,"en-US":Xt,"es-ES":Zt,"et-EE":Qt,"fi-FI":$t,"fr-FR":en,"he-IL":tn,"hr-HR":nn,"hu-HU":rn,"it-IT":an,"ja-JP":on,"ko-KR":sn,"lt-LT":cn,"lv-LV":ln,"nb-NO":un,"nl-NL":dn,"pl-PL":fn,"pt-BR":pn,"pt-PT":mn,"ro-RO":hn,"ru-RU":gn,"sk-SK":_n,"sl-SI":vn,"sr-SP":yn,"sv-SE":bn,"tr-TR":xn,"uk-UA":Sn,"zh-CN":Cn,"zh-TW":wn};function En(e){return e&&e.__esModule?e.default:e}function Dn(e){let{onDismiss:t,...n}=e,r=Me(n,tt(En(Tn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return w.createElement(ut,null,w.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}function On({children:e}){let t=k(()=>({register:()=>{}}),[]);return w.createElement(ue.Provider,{value:t},e)}const kn=T({});function An(){return D(kn)??{}}const jn=w.createContext(null);function Mn(e){let t=c(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[i,a]=j(!1),o=k(()=>({contain:i,setContain:a}),[i,a]),{getContainer:s}=An();if(!e.portalContainer&&s&&(n=s()),!n)return null;let l=e.children;return e.disableFocusManagement||(l=w.createElement(ht,{restoreFocus:!0,contain:(e.shouldContainFocus||i)&&!r},l)),l=w.createElement(jn.Provider,{value:o},w.createElement(On,null,w.createElement(ie.Provider,{value:null},l))),ke.createPortal(l,n)}function Nn(){let e=D(jn)?.setContain;y(()=>{e?.(!0)},[e])}function Pn(e){let[t,n]=rt(e.isOpen,e.defaultOpen||!1,e.onOpenChange),[r,i]=j(null);return{isOpen:t,setOpen:n,open:E(()=>{n(!0)},[n]),close:E(()=>{n(!1)},[n]),toggle:E(()=>{n(!t)},[n,t]),point:r,setPoint:i}}function Fn(e,t=!0){let[n,r]=j(!0),i=n&&t;return y(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),Ln(e,i,E(()=>r(!1),[])),i}function In(e,t){let[n,r]=j(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return Ln(e,i,E(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function Ln(e,t,n){y(()=>{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||Ae(()=>{n()})}),()=>{r=!0}}},[e,t,n])}function Rn(e,t){let{role:n=`dialog`}=e,r=l();r=e[`aria-label`]?void 0:r;let a=l();a=n===`alertdialog`&&!e[`aria-describedby`]?a:void 0;let o=A(!1);O(()=>{if(t.current&&!h(t.current)){se(t.current);let e=setTimeout(()=>{(i()===t.current||i()===document.body)&&(o.current=!0,t.current&&(t.current.blur(),se(t.current)),o.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Nn(),A(!1),O(()=>{});let s=e[`aria-describedby`]??a;return{dialogProps:{...S(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]??r,"aria-describedby":s,onBlur:e=>{o.current&&e.stopPropagation()}},titleProps:{id:r},contentProps:{id:a}}}const zn=T(null),Bn=T(null),Vn=Ce(function(e,n){let r=e[`aria-labelledby`];[e,n]=a(e,n,zn);let{dialogProps:i,titleProps:o,contentProps:c}=Rn({...e,"aria-labelledby":r},n),l=D(Bn);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let u=s({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:l?.close||(()=>{})}}),d=S(e,{global:!0});return w.createElement(t.section,{..._(d,u,i),render:e.render,ref:n,slot:e.slot||void 0},w.createElement(p,{values:[[it,{slots:{[ge]:{},title:{...o,level:2}}}],[at,{slots:{[ge]:{},description:c}}],[de,{slots:{[ge]:{},close:{onPress:()=>l?.close()}}}]]},u.children))});function Hn(e,t,n){let{overlayProps:r,underlayProps:i}=Lt({...e,isOpen:t.isOpen,onClose:t.close},n);return zt({isDisabled:!t.isOpen}),Nn(),O(()=>{if(t.isOpen&&n.current)return Pt([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:_(r),underlayProps:i}}let Z=typeof document<`u`&&window.visualViewport;function Un(){let e=c(),[t,n]=j(()=>e?{width:0,height:0}:Wn());return O(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{Z&&Z.scale>1||e(Wn())},a,o=t=>{Z&&Z.scale>1||P(r(t))&&(a=requestAnimationFrame(()=>{let t=i();(!t||!P(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(Wn()),me()&&he()&&window.addEventListener(`blur`,o,!0),Z?Z.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(a),me()&&he()&&window.removeEventListener(`blur`,o,!0),Z?Z.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function Wn(){return{width:Z?Math.min(Z.width*Z.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:Z?Z.height*Z.scale:document.documentElement.clientHeight}}const Gn=T(null),Kn=T(null),qn=Ce(function(e,t){if(D(Kn))return w.createElement(Zn,{...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 w.createElement(Yn,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},w.createElement(Zn,{...f,modalRef:t},s))});function Jn(e,t){[e,t]=a(e,t,Gn);let n=D(Bn),r=Pn(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,o=g(t),s=A(null),l=In(o,i.isOpen),u=In(s,i.isOpen),d=l||u||e.isExiting||!1,f=c();return!i.isOpen&&!d||f?null:w.createElement(Xn,{...e,state:i,isExiting:d,overlayRef:o,modalRef:s})}const Yn=Ce(Jn);function Xn({UNSTABLE_portalContainer:e,...n}){let r=n.modalRef,{state:i}=n,{modalProps:a,underlayProps:o}=Hn(n,i,r),c=Fn(n.overlayRef)||n.isEntering||!1,l=s({...n,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:c,isExiting:n.isExiting,state:i}}),u=Un(),d,f;if(typeof document<`u`){let e=L(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().width%1,n=e.getBoundingClientRect().height%1;d=e.scrollWidth-t,f=e.scrollHeight-n}let m={...l.style,"--visual-viewport-width":u.width+`px`,"--visual-viewport-height":u.height+`px`,"--page-width":d===void 0?void 0:d+`px`,"--page-height":f===void 0?void 0:f+`px`};return w.createElement(Mn,{isExiting:n.isExiting,portalContainer:e},w.createElement(t.div,{..._(S(n,{global:!0}),o),...l,style:m,ref:n.overlayRef,"data-entering":c||void 0,"data-exiting":n.isExiting||void 0},w.createElement(p,{values:[[Kn,{modalProps:a,modalRef:r,isExiting:n.isExiting,isDismissable:n.isDismissable}],[Bn,i]]},l.children)))}function Zn(e){let{modalProps:n,modalRef:r,isExiting:i,isDismissable:a}=D(Kn),c=D(Bn),l=g(k(()=>o(e.modalRef,r),[e.modalRef,r])),u=Fn(l),d=s({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:c}});return w.createElement(t.div,{..._(S(e,{global:!0}),n),...d,ref:l,"data-entering":u||void 0,"data-exiting":i||void 0},a&&w.createElement(Dn,{onDismiss:c.close}),d.children)}const Qn={en:{required:`This field is required`,selectOption:`Please select an option`,fillFreeText:`Please fill out the free text field`,selectAtLeastOne:`Please select at least one option`,selectRating:`Please select a rating`,titleRequired:`Title is required`,invalidImage:`Invalid image data URL`,invalidRecording:`Invalid recording events`,invalidInput:`Invalid input`,maxLength:`Please enter less than {max} characters`,maxSelected:`Please select less than {max} options`},zh:{required:`此字段为必填项`,selectOption:`请选择一个选项`,fillFreeText:`请填写文本框`,selectAtLeastOne:`请至少选择一个选项`,selectRating:`请选择评分`,titleRequired:`标题为必填项`,invalidImage:`图片数据网址无效`,invalidRecording:`录制事件无效`,invalidInput:`输入无效`,maxLength:`请输入少于 {max} 个字符`,maxSelected:`请选择少于 {max} 个选项`},ms:{required:`Ruangan ini diperlukan`,selectOption:`Sila pilih satu pilihan`,fillFreeText:`Sila isikan ruangan teks`,selectAtLeastOne:`Sila pilih sekurang-kurangnya satu pilihan`,selectRating:`Sila pilih penilaian`,titleRequired:`Tajuk diperlukan`,invalidImage:`URL data imej tidak sah`,invalidRecording:`Acara rakaman tidak sah`,invalidInput:`Masukan tidak sah`,maxLength:`Sila masukkan kurang daripada {max} aksara`,maxSelected:`Sila pilih kurang daripada {max} pilihan`},ta:{required:`இந்தப் புலம் தேவை`,selectOption:`ஒரு விருப்பத்தைத் தேர்ந்தெடுக்கவும்`,fillFreeText:`உரைப் புலத்தில் விவரங்களை உள்ளிடவும்`,selectAtLeastOne:`குறைந்தது ஒரு விருப்பத்தையாவது தேர்ந்தெடுக்கவும்`,selectRating:`மதிப்பீட்டைத் தேர்ந்தெடுக்கவும்`,titleRequired:`தலைப்பு தேவை`,invalidImage:`படத்தின் URL தவறானது`,invalidRecording:`தவறான பதிவு நிகழ்வுகள்`,invalidInput:`தவறான உள்ளீடு`,maxLength:`{max} எழுத்துகளுக்கு மிகாமல் உள்ளிடவும்`,maxSelected:`அதிகபட்சம் {max} விருப்பங்களைத் தேர்ந்தெடுக்கவும்`}},$n=/^Please enter less than (\d+) characters$/,er=/^Please select less than (\d+) options$/,tr=(e,t=`en`)=>{let n=Qn[t],r=e.match($n);if(r)return n.maxLength.replace(`{max}`,r[1]??``);let i=e.match(er);if(i)return n.maxSelected.replace(`{max}`,i[1]??``);switch(e){case`This field is required`:return n.required;case`Please select an option`:return n.selectOption;case`Please fill out the free text field`:return n.fillFreeText;case`Please select at least one option`:return n.selectAtLeastOne;case`Please select a rating`:return n.selectRating;case`Title is required`:return n.titleRequired;case`Invalid image data URL`:return n.invalidImage;case`Invalid recording events`:return n.invalidRecording;case`Invalid input`:return n.invalidInput;default:return e}};function nr(e,t){let n=e.issues[0];return tr(n?.message??`Invalid input`,t)}function rr(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}const ir=[`id`,`email`,`name`],ar=e=>M.custom(t=>typeof t==`object`&&!!t&&typeof Reflect.get(t,e)==`function`),or=ar(`get_distinct_id`),sr=ar(`get_session_id`),cr=ar(`getUser`),lr=ar(`getInternalContext`),ur=M.string(),dr=M.record(M.string(),M.unknown()),fr=M.object({session_id:M.string().optional()}),pr=(e,t)=>{if(!(typeof window>`u`))return t.safeParse(Reflect.get(window,e)).data},mr=()=>{try{let e=pr(`posthog`,or);return ur.safeParse(e?.get_distinct_id()).data}catch{return}},hr=()=>{try{let e=pr(`posthog`,sr);return ur.safeParse(e?.get_session_id()).data}catch{return}},gr=()=>{try{let e=pr(`DD_RUM`,cr),t=dr.safeParse(e?.getUser());return!t.success||Object.keys(t.data).length===0?void 0:t.data}catch{return}},_r=()=>{try{let e=pr(`DD_RUM`,lr);return fr.safeParse(e?.getInternalContext()).data?.session_id}catch{return}},vr=e=>{let t={...e},n=gr(),r;try{r=JSON.stringify(n)}catch{r=void 0}let i=[[`posthog_distinct_id`,mr()],[`posthog_session_id`,hr()],[`datadog_rum_user`,r],[`datadog_rum_session_id`,_r()],...ir.map(e=>[`datadog_rum_user_${e}`,rr(n?.[e])])];for(let[e,n]of i)Object.prototype.hasOwnProperty.call(t,e)||n===void 0||n.trim()===``||(t[e]=n);return t},yr=(e,t=!1)=>t?vr(e):e,br=T({}),xr=()=>D(br),Sr=T({}),Cr=({type:e,children:t})=>{let n=k(()=>({type:e}),[e]);return N(Sr.Provider,{value:n,children:t})},wr=()=>D(Sr),Tr=T(null),Er=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},autoInjectAnalyticsMetadata:a=!1,locale:o,apiBaseUrl:s})=>{let{type:c}=wr(),l=xr(),u=l.version??`0.9.4`,d=l.build,f=ee({publishableKey:n,apiBaseUrl:s}),p=A(void 0),[m,h]=j(),g=m?.client===f&&m.surveyId===t?m.data:void 0;O(()=>{let e=new AbortController;return(async()=>{try{let n=`api/v1/cfti/${encodeURIComponent(t)}${o?`?locale=${encodeURIComponent(o)}`:``}`,r=await f.get(n,{signal:e.signal}).json(),i=_e.safeParse(r);if(!i.success||e.signal.aborted)return;h({client:f,surveyId:t,data:i.data})}catch{}})(),()=>e.abort()},[f,o,t]);let _=E(async({answers:e})=>{let n=crypto.randomUUID(),o=ye({metadata:yr(i,a)}),s=await f.put(`api/v1/cfti/${encodeURIComponent(t)}/response/${encodeURIComponent(n)}`,{json:{respondent:r,data:e,metadata:o.metadata,warnings:o.warnings,telemetry:{...c!==void 0&&{type:c},version:u,...d&&{build:d}}}}).json();return ve.parse({...s,createdAt:new Date(s.createdAt)})},[a,d,f,i,r,t,u,c]),v=E(()=>{f.post(`api/v1/cfti/${encodeURIComponent(t)}/respondent/${encodeURIComponent(r)}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[f,r,t]);return O(()=>{let e=p.current;e?.client===f&&e.surveyId===t&&e.respondent===r||g&&r&&(p.current={client:f,surveyId:t,respondent:r},f.post(`api/v1/cfti/${encodeURIComponent(t)}/respondent/${encodeURIComponent(r)}/event`,{json:{type:`view`}}).catch(()=>{}))},[f,r,g,t]),g?N(Tr.Provider,{value:{submit:_,dismiss:v,surveyId:t,survey:g,metadata:i},children:e}):null},Dr=e=>D(Tr)?N(Ee,{children:e.children}):N(Er,{...e}),Or=()=>{let e=D(Tr);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},kr={en:{skip:`Skip`,next:`Next`,back:`Back`,submit:`Submit`,submitAnotherResponse:`Submit another response`,other:`Other`,dismiss:`Dismiss`,close:`Close`,optional:`(optional)`,startTyping:`Start typing...`,feedbackSubmitted:`Feedback submitted!`,surveyDialog:`Survey`,unsupportedQuestionType:`Unsupported question type`,bugReportTitlePlaceholder:`Brief description of the issue`,bugReportDetailsPlaceholder:`Steps to reproduce, expected vs actual behavior, etc.`,attachments:`Attachments`,capturing:`Capturing...`,screenshot:`Screenshot`,screenshotPreview:`Screenshot preview`,removeScreenshot:`Remove screenshot`,loadingRecordingPreview:`Loading recording preview...`,removeRecording:`Remove recording`,record:`Record`,captureError:`Failed to capture screenshot. Please try again.`,recordingError:`Failed to start recording. Please try again.`},zh:{skip:`跳过`,next:`下一步`,back:`上一步`,submit:`提交`,submitAnotherResponse:`提交另一份回复`,other:`其他`,dismiss:`忽略`,close:`关闭`,optional:`(选填)`,startTyping:`开始输入…`,feedbackSubmitted:`反馈已提交!`,surveyDialog:`调查对话框`,unsupportedQuestionType:`不支持的问题类型`,bugReportTitlePlaceholder:`在此输入问题标题`,bugReportDetailsPlaceholder:`在此输入问题内容`,attachments:`附件`,capturing:`截屏中…`,screenshot:`截图`,screenshotPreview:`截图预览`,removeScreenshot:`移除截图`,loadingRecordingPreview:`录像加载中…`,removeRecording:`移除录像`,record:`录制`,captureError:`截图失败,请重试。`,recordingError:`录制启动失败,请重试。`},ms:{skip:`Langkau`,next:`Seterusnya`,back:`Kembali`,submit:`Hantar`,submitAnotherResponse:`Hantar respons lain`,other:`Lain-lain`,dismiss:`Tutup`,close:`Tutup`,optional:`(Pilihan)`,startTyping:`Mula menaip...`,feedbackSubmitted:`Maklum balas dihantar!`,surveyDialog:`Tinjauan`,unsupportedQuestionType:`Jenis soalan tidak disokong`,bugReportTitlePlaceholder:`Penerangan ringkas tentang isu`,bugReportDetailsPlaceholder:`Langkah untuk mengulang semula, tingkah laku dijangka berbanding sebenar, dll.`,attachments:`Lampiran`,capturing:`Sedang menangkap...`,screenshot:`Tangkapan skrin`,screenshotPreview:`Pratonton tangkapan skrin`,removeScreenshot:`Alih keluar tangkapan skrin`,loadingRecordingPreview:`Memuatkan pratonton rakaman...`,removeRecording:`Alih keluar rakaman`,record:`Rakam`,captureError:`Gagal menangkap tangkapan skrin. Sila cuba lagi.`,recordingError:`Gagal memulakan rakaman. Sila cuba lagi.`},ta:{skip:`தவிர்க்கவும்`,next:`அடுத்து`,back:`பின்செல்`,submit:`சமர்ப்பிக்கவும்`,submitAnotherResponse:`மற்றொரு பதிலைச் சமர்ப்பிக்கவும்`,other:`மற்றவை`,dismiss:`மூடு`,close:`மூடு`,optional:`(கட்டாயமில்லை)`,startTyping:`தட்டச்சு செய்யத் தொடங்கவும்...`,feedbackSubmitted:`கருத்து சமர்ப்பிக்கப்பட்டது!`,surveyDialog:`கருத்துக்கணிப்பு`,unsupportedQuestionType:`ஆதரிக்கப்படாத கேள்வி வகை`,bugReportTitlePlaceholder:`சிக்கலின் சுருக்கமான விளக்கம்`,bugReportDetailsPlaceholder:`சிக்கல் எப்படி ஏற்பட்டது, நீங்கள் என்ன எதிர்பார்த்தீர்கள், மேலும் என்ன நடந்தது என்பதை விவரிக்கவும்`,attachments:`இணைப்புகள்`,capturing:`ஸ்கிரீன்ஷாட் எடுக்கப்படுகிறது...`,screenshot:`ஸ்கிரீன்ஷாட்`,screenshotPreview:`ஸ்கிரீன்ஷாட் முன்னோட்டம்`,removeScreenshot:`ஸ்கிரீன்ஷாட்டை அகற்று`,loadingRecordingPreview:`பதிவு முன்னோட்டம் தயாராகிறது...`,removeRecording:`பதிவை அகற்று`,record:`பதிவுசெய்`,captureError:`ஸ்கிரீன்ஷாட் எடுக்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,recordingError:`பதிவைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`}},Q=(e=`en`)=>kr[e],$=(e,t,n)=>!e||e===kr.en[t]?Q(n)[t]:e,Ar=(e,t)=>e===kr.en.other?Q(t).other:e,jr=(e,t)=>$(e,`close`,t),Mr=(e,t)=>$(e,`feedbackSubmitted`,t),Nr=(e,t)=>$(e,`bugReportTitlePlaceholder`,t),Pr=(e,t)=>$(e,`bugReportDetailsPlaceholder`,t),Fr=()=>{let[e,t]=j(!1);return O(()=>{let e=e=>{let n=be.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(xe,e),()=>document.removeEventListener(xe,e)},[]),e},Ir=({className:e,iconClassName:t,onClose:n,locale:r})=>Fr()?null:N(`button`,{type:`button`,className:e,"aria-label":Q(r).dismiss,onClick:n,children:N(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:N(`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`})})}),Lr=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s,locale:c})=>{let{survey:l,surveyId:u,dismiss:d}=Or(),[f,p]=j(!1);return Te(()=>{l&&i?.()},f?a:null),De(Vn,{"aria-label":Q(c).surveyDialog,id:`${u}-popover`,className:Oe(`confetti-modal-dialog ${Se}`,t?.dialog),children:[n&&N(Ir,{className:Oe(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:c,onClose:async()=>{!o&&!f&&(await d(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>p(!0)}):e]})},Rr=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3,locale:o})=>{let{dismiss:s}=Or(),[c,l]=j(!1);return N(Yn,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(c||(await s(),n?.()),r?.())},className:Oe(`confetti-modal-overlay ${Se}`,t?.overlay),children:N(qn,{className:Oe(`confetti-modal ${Se}`,t?.modal),children:N(Lr,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:c,onSubmitted:()=>l(!0),locale:o,children:e})})})};export{Me as S,ut as _,Q as a,rt as b,jr as c,Tr as d,Dr as f,W as g,nr as h,Fr as i,Mr as l,Cr as m,Lr as n,Pr as o,Or as p,Ir as r,Nr as s,Rr as t,Ar as u,ot as v,He as x,at as y};
|