@opengovsg/confetti 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import{n as e,t}from"./routing-ZHrE7mgA.js";import{ErrorBoundary as n}from"react-error-boundary";import r,{createContext as i,forwardRef as a,useCallback as o,useContext as s,useEffect as c,useMemo as l,useReducer as u,useRef as d,useState as f}from"react";import{useLocalStorage as p,useSessionStorage as m,useTimeout as h}from"usehooks-ts";import{z as g}from"zod/v4/mini";import _ from"ky";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import x from"clsx";import S,{flushSync as C}from"react-dom";function w(e){return e.issues[0]?.message??`Invalid input`}const T=g.object({type:g.literal(`next`)}),E=g.object({type:g.literal(`end`)}),D=g.object({type:g.literal(`jump`),target:g.number({error:`Target question is required`})}),O=g.discriminatedUnion(`type`,[T,D,E]),ee=g.object({type:g.literal(`value`),value:g.union([g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),g.number({error:`Value is required`})])}),k=g.object({type:g.literal(`binary-operator`),operator:g.union([g.literal(`equal`),g.literal(`not-equal`),g.literal(`greater`),g.literal(`greater-or-equal`),g.literal(`less`),g.literal(`less-or-equal`),g.literal(`contains`),g.literal(`not-contains`)]),value:ee,target:O}),te=g.object({type:g.literal(`switch`),cases:g.array(k),default:O}),ne=g.object({type:g.literal(`always`),target:O}),re=g.discriminatedUnion(`type`,[ne,te]),ie=g.string().check(g.trim(),g.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),ae=g.optional(g.string().check(g.trim(),g.maxLength(50))),oe=g.object({value:g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),description:g.optional(g.string().check(g.trim()))}),se=g.nullable(g.object({label:g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),max:g.number(),description:g.optional(g.string().check(g.trim()))})),ce=g.optional(g.boolean()),le=g.object({type:g.literal(`rating`),buttonLabel:ae,shouldAutoProgress:ce,scale:g.number().check(g.minimum(2),g.maximum(10)),labels:g.optional(g.object({lower:g.optional(g.pipe(g.string().check(g.trim()),g.transform(e=>e===``?void 0:e))),upper:g.optional(g.pipe(g.string().check(g.trim()),g.transform(e=>e===``?void 0:e)))})),display:g.optional(g.literal([`star`,`emoji`,`number`]))}),ue=g.object({type:g.literal(`open-ended`),placeholder:g.optional(g.string()),buttonLabel:ae,max:g.number()}),de=g.object({type:g.literal(`single-select`),shouldAutoProgress:ce,options:g.array(oe),buttonLabel:ae,editable:se}),fe=g.object({type:g.literal(`multi-select`),buttonLabel:ae,options:g.array(oe),editable:se,max:g.optional(g.number()),display:g.optional(g.literal([`checkbox`,`tag`]))}),pe=g.object({type:g.literal(`statement`),buttonLabel:ae,buttonUrl:g.optional(ie)}),me=g.discriminatedUnion(`type`,[le,de,ue,fe,pe]),A=`__CONFETTI_CHECKBOX_Others`,he=`__CONFETTI_RADIO_Others`,ge=e=>g.number().check(g.int(),g.minimum(1),g.maximum(e)),_e=({scale:e},{required:t})=>{let n=ge(e);return t?n:g.optional(n)},ve=({maxLength:e},{required:t})=>g.string().check(g.trim(),...t?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ye=(e,t)=>g.string().check(g.trim(),...t?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),g.refine(e=>e!==he,{error:`Please fill out the free text field`})),be=({maxLength:e},{required:t})=>{let n=ye(e,t);return t?n:g.optional(n)},xe=({maxSelected:e,maxLength:t},{required:n})=>g.array(g.string().check(g.trim(),...n?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),g.refine(e=>e!==A,{error:`Please fill out the free text field`}))).check(...n?[g.minLength(1,{error:`Please select at least one option`})]:[],g.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Se=()=>g.optional(g.string()),Ce=g.object({title:g.string().check(g.trim()),description:g.string().check(g.trim()),buttonText:g.string().check(g.trim())}),we=g.object({title:g.string(),description:g.nullable(g.string()),questions:g.array(g.object({id:g.string(),title:g.string(),description:g.nullable(g.string()),position:g.number(),required:g.boolean(),properties:me,routingLogic:re})),confirmation:Ce});g.object({surveyId:g.cuid2(),responseId:g.union([g.cuid2(),g.uuid()])}),g.object({respondent:g.string().check(g.trim(),g.minLength(1),g.maxLength(2048)),data:g.record(g.string(),g.union([g.string().check(g.trim(),g.maxLength(2048)),g.number(),g.array(g.string().check(g.trim(),g.maxLength(2048))).check(g.maxLength(1024))])),metadata:g.record(g.string().check(g.trim(),g.maxLength(1e3)),g.string().check(g.trim(),g.maxLength(1e3)))}),g.object({surveyId:g.cuid2(),respondent:g.string().check(g.trim(),g.minLength(1),g.maxLength(2048))}),g.object({surveyId:g.cuid2(),respondent:g.string().check(g.trim(),g.minLength(1),g.maxLength(2048))}),g.object({surveyId:g.cuid2()});const Te=g.object({lastRespondedAt:g.nullable(g.union([g.iso.datetime(),g.date()])),lastViewedAt:g.nullable(g.union([g.iso.datetime(),g.date()])),lastDismissedAt:g.nullable(g.union([g.iso.datetime(),g.date()]))});g.object({type:g.enum([`view`,`dismiss`])});const Ee=_.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4}),De=i(null),Oe=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:s})=>{let u=d(!1),[m,h]=f(),[g,_]=f(!1),[v,b]=f(null),[x,S]=f(null),[C,w]=p(`cfti:${t}:respondent`,``);c(()=>{C||w(crypto.randomUUID())},[C,w]);let T=l(()=>r||C,[r,C]),E=l(()=>{let e={headers:{"x-cfti-pk":n}};return s&&(e.prefixUrl=s),Ee.extend(e)},[s,n]),D=o(async()=>{if(!T)return;let e=await E.get(`v1/cfti/${t}/respondent/${T}`).json(),n=Te.safeParse(e);n.success&&(b(n.data.lastRespondedAt?new Date(n.data.lastRespondedAt):null),S(n.data.lastDismissedAt?new Date(n.data.lastDismissedAt):null))},[E,T,t]);c(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&D()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[D]),c(()=>{(async()=>{u.current=!1,_(!1),h(void 0),b(null),S(null);try{let e=await E.get(`v1/cfti/${t}`).json(),n=we.safeParse(e);if(!n.success)return;h(n.data),await D()}catch{}finally{_(!0)}})()},[E,D,t]);let O=o(async({answers:e})=>{let n=crypto.randomUUID();await E.put(`v1/cfti/${t}/response/${n}`,{json:{respondent:T,data:e,metadata:i}})},[E,i,T,t]),ee=o(()=>{h(void 0),E.post(`v1/cfti/${t}/respondent/${T}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[E,T,t]),k=l(()=>g?a===void 0?!0:typeof a==`boolean`?a:a({lastRespondedAt:v,lastDismissedAt:x}):!1,[g,a,v,x]);return c(()=>{u.current||k&&m&&T&&(u.current=!0,E.post(`v1/cfti/${t}/respondent/${T}/event`,{json:{type:`view`}}).catch(()=>{}))},[E,k,T,m,t]),!k||!m?null:y(De.Provider,{value:{submit:O,dismiss:ee,surveyId:t,survey:m,metadata:i},children:e})},ke=()=>{let e=s(De);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},Ae={rating:({scale:e},t)=>_e({scale:e},t),"open-ended":({max:e},t)=>ve({maxLength:e},t),"single-select":({editable:e},t)=>be({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>xe({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>Se()},je=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Ae[n];return r(e,t)}case`open-ended`:{let r=Ae[n];return r(e,t)}case`single-select`:{let r=Ae[n];return r(e,t)}case`multi-select`:{let r=Ae[n];return r(e,t)}case`statement`:{let r=Ae[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Me=({originalQuestions:t,answers:n,errors:r,pointer:i=-1})=>{if(!t)return{questions:[],currentIndex:-1};let a=t.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},n=r[e.id];return n&&(t.error=n),{...t,visible:!1}});for(let t=0;t<a.length;t++){let r=a[t];if(!r)continue;let o=e({index:t,questions:a,answers:n});r.visible=i===t||o}let o=a.findIndex((e,t)=>t>i&&e.visible&&n[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},Ne=({questions:e,answers:t})=>{let n=Pe({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Pe=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Fe=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Ie=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:i,submit:a}=ke(),[s,c]=f({}),[u,d]=f({}),p=l(()=>Me({originalQuestions:i?.questions,answers:s,errors:u,pointer:e}),[i?.questions,s,u,e]),m=l(()=>!!p.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,p.questions]),[h,g]=f(!1),_=o(({answers:e})=>{a({answers:e}).finally(()=>{n?.()})},[n,a]),b=o(()=>{_({answers:Ne({questions:p.questions,answers:s})}),g(!0)},[s,p.questions,_]),x=o(({question:n,answer:r})=>{let a=p.questions.at(n);if(!a)return{error:`Question index is invalid`};let o=je(a.properties,{required:a.required}).safeParse(r);if(!o.success){let e=w(o.error);return d(t=>{if(t[a.id]===e)return t;let n={...t};return n[a.id]=e,n}),c(e=>{if(!(a.id in e))return e;let t={...e};return delete t[a.id],t}),{error:e}}d(e=>{if(!e[a.id])return e;let t={...e};return delete t[a.id],t});let l=!a.required&&!r?null:r,f={...s};if(f[a.id]===l)return{next:Me({originalQuestions:i?.questions,answers:f,errors:u,pointer:e}).currentIndex};f[a.id]=l;let m=Me({originalQuestions:i?.questions,answers:f,errors:u,pointer:e});return f=Pe({questions:m.questions,answers:f}),c(f),d(Fe({questions:m.questions,errors:u})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>f[e]!==void 0)&&t&&(_({answers:Ne({questions:m.questions,answers:f})}),g(!0)),{next:m.currentIndex}},[p.questions,s,i?.questions,u,t,e,_]);return p.questions.length===0?y(v,{}):y(`div`,{className:`confetti`,children:r({questions:p.questions,current:e??p.currentIndex,update:x,isCompleted:m,submit:b,isSubmitted:h,errors:u})})},Le=({children:e,onFinished:t,shouldAutoSubmit:r,...i})=>y(n,{fallback:y(v,{}),children:y(Oe,{...i,children:y(Ie,{shouldAutoSubmit:r,onFinished:t,children:e})})}),Re=i(null);i(null),i(null),i(null),i(null);const ze=i({});i(null);const Be=i(null),j=typeof document<`u`?r.useLayoutEffect:()=>{};function Ve(e){let[t,n]=f(e),r=d(t),i=d(null),a=d(()=>{if(!i.current)return;let e=i.current.next();if(e.done){i.current=null;return}r.current===e.value?a.current():n(e.value)});return j(()=>{r.current=t,i.current&&a.current()}),[t,o(e=>{i.current=e(r.current),a.current()},[a])]}const He={prefix:String(Math.round(Math.random()*1e10)),current:0},Ue=r.createContext(He),We=r.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let Ge=new WeakMap;function Ke(e=!1){let t=s(Ue),n=d(null);if(n.current===null&&!e){let e=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let n=Ge.get(e);n==null?Ge.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,Ge.delete(e))}n.current=++t.current}return n.current}function qe(e){let t=s(Ue),n=Ke(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function Je(e){let t=r.useId(),[n]=f($e()),i=n?`react-aria`:`react-aria${He.prefix}`;return e||`${i}-${t}`}const Ye=typeof r.useId==`function`?Je:qe;function Xe(){return!1}function Ze(){return!0}function Qe(e){return()=>{}}function $e(){return typeof r.useSyncExternalStore==`function`?r.useSyncExternalStore(Qe,Xe,Ze):s(We)}let et=!!(typeof window<`u`&&window.document&&window.document.createElement),tt=new Map,nt;typeof FinalizationRegistry<`u`&&(nt=new FinalizationRegistry(e=>{tt.delete(e)}));function rt(e){let[t,n]=f(e),r=d(null),i=Ye(t),a=d(null);if(nt&&nt.register(a,i),et){let e=tt.get(i);e&&!e.includes(r)?e.push(r):tt.set(i,[r])}return j(()=>{let e=i;return()=>{nt&&nt.unregister(a),tt.delete(e)}},[i]),c(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function it(e,t){if(e===t)return e;let n=tt.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=tt.get(t);return r?(r.forEach(t=>t.current=e),e):t}function at(e=[]){let t=rt(),[n,r]=Ve(t),i=o(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return j(i,[t,i,...e]),n}function ot(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const M=e=>e?.ownerDocument??document,N=e=>e&&`window`in e&&e.window===e?e:M(e).defaultView||window;function st(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ct(e){return st(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function lt(){return!1}function P(e,t){if(!lt())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:ct(n)?n.host:n.parentNode}return!1}const F=(e=document)=>{if(!lt())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function I(e){return lt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}var ut=class{get currentNode(){return this._currentNode}set currentNode(e){if(!P(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 P(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}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);if(this.filter?.acceptNode)return this.filter.acceptNode(e);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)}}};function dt(e,t,n,r){return lt()?new ut(e,t,n,r):e.createTreeWalker(t,n,r)}function L(...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]=ot(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=x(n,i):e===`id`&&n&&i?t.id=it(n,i):t[e]=i===void 0?n:i}}return t}function ft(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=pt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():pt(e[n],null)})}}}function pt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}const mt=new Set([`id`]),ht=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),gt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),_t=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),vt=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(`.`)),yt=/^(data-.*)$/;function R(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)&&(mt.has(t)||n&&ht.has(t)||r&&gt.has(t)||i&&_t.has(t)||a&&(vt.has(t)||t.endsWith(`Capture`)&&vt.has(t.slice(0,-7)))||o?.has(t)||yt.test(t))&&(s[t]=e[t]);return s}function bt(e){if(St())e.focus({preventScroll:!0});else{let t=Ct(e);e.focus(),wt(t)}}let xt=null;function St(){if(xt==null){xt=!1;try{document.createElement(`div`).focus({get preventScroll(){return xt=!0,!0}})}catch{}}return xt}function Ct(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 wt(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function Tt(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 Et(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function z(e){let t=null;return()=>(t??=e(),t)}const Dt=z(function(){return Et(/^Mac/i)}),Ot=z(function(){return Et(/^iPhone/i)}),kt=z(function(){return Et(/^iPad/i)||Dt()&&navigator.maxTouchPoints>1}),At=z(function(){return Ot()||kt()}),jt=z(function(){return Tt(/AppleWebKit/i)&&!Mt()}),Mt=z(function(){return Tt(/Chrome/i)}),Nt=z(function(){return Tt(/Android/i)}),Pt=z(function(){return Tt(/Firefox/i)});function Ft(e,t,n=!0){var r;let{metaKey:i,ctrlKey:a,altKey:o,shiftKey:s}=t;Pt()&&(r=window.event)!=null&&r.type?.startsWith(`key`)&&e.target===`_blank`&&(Dt()?i=!0:a=!0);let c=jt()&&Dt()&&!kt()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:i,ctrlKey:a,altKey:o,shiftKey:s}):new MouseEvent(`click`,{metaKey:i,ctrlKey:a,altKey:o,shiftKey:s,detail:1,bubbles:!0,cancelable:!0});Ft.isOpening=n,bt(e),e.dispatchEvent(c),Ft.isOpening=!1}Ft.isOpening=!1;let B=new Map,It=new Set;function Lt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{if(!e(t)||!t.target)return;let r=B.get(t.target);r||(r=new Set,B.set(t.target,r),t.target.addEventListener(`transitioncancel`,n,{once:!0})),r.add(t.propertyName)},n=t=>{if(!e(t)||!t.target)return;let r=B.get(t.target);if(r&&(r.delete(t.propertyName),r.size===0&&(t.target.removeEventListener(`transitioncancel`,n),B.delete(t.target)),B.size===0)){for(let e of It)e();It.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Lt):Lt());function Rt(){for(let[e]of B)`isConnected`in e&&!e.isConnected&&B.delete(e)}function zt(e){requestAnimationFrame(()=>{Rt(),B.size===0?e():It.add(e)})}function Bt(){let e=d(new Map),t=o((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=o((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=o(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return c(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Vt(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=rt(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function Ht(e){let t=d(null),n=d(void 0),r=o(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 l(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=r(e))}}),[r])}const Ut=r.useInsertionEffect??j;function V(e){let t=d(null);return Ut(()=>{t.current=e},[e]),o((...e)=>{let n=t.current;return n?.(...e)},[])}function Wt(e,t){j(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Gt(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return r&&t&&(r=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),r}function Kt(e,t){let n=e;for(Gt(n,t)&&(n=n.parentElement);n&&!Gt(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const qt=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Jt(e){return e instanceof HTMLInputElement&&!qt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let H=typeof document<`u`&&window.visualViewport;function Yt(){let e=$e(),[t,n]=f(()=>e?{width:0,height:0}:Xt());return c(()=>{let e=()=>{H&&H.scale>1||n(e=>{let t=Xt();return t.width===e.width&&t.height===e.height?e:t})},t,r=e=>{H&&H.scale>1||Jt(e.target)&&(t=requestAnimationFrame(()=>{(!document.activeElement||!Jt(document.activeElement))&&n(e=>{let t={width:window.innerWidth,height:window.innerHeight};return t.width===e.width&&t.height===e.height?e:t})}))};return window.addEventListener(`blur`,r,!0),H?H.addEventListener(`resize`,e):window.addEventListener(`resize`,e),()=>{cancelAnimationFrame(t),window.removeEventListener(`blur`,r,!0),H?H.removeEventListener(`resize`,e):window.removeEventListener(`resize`,e)}},[]),t}function Xt(){return{width:H?H.width*H.scale:window.innerWidth,height:H?H.height*H.scale:window.innerHeight}}function Zt(e){return e.pointerType===``&&e.isTrusted?!0:Nt()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Qt(e){return!Nt()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function $t(e,t,n){let r=V(()=>{n&&n(t)});c(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function en(e,t=!0){let[n,r]=f(!0),i=n&&t;return j(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),nn(e,i,o(()=>r(!1),[])),i}function tn(e,t){let[n,r]=f(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return nn(e,i,o(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function nn(e,t,n){j(()=>{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.all(t.map(e=>e.finished)).then(()=>{r||C(()=>{n()})}).catch(()=>{}),()=>{r=!0}}},[e,t,n])}const rn=typeof Element<`u`&&`checkVisibility`in Element.prototype;function an(e){let t=N(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function on(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 sn(e,t){return rn?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&an(e)&&on(e,t)&&(!e.parentElement||sn(e.parentElement,e))}const cn=[`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`],ln=cn.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;cn.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const un=cn.join(`:not([hidden]):not([tabindex="-1"]),`);function dn(e){return e.matches(ln)&&sn(e)&&!pn(e)}function fn(e){return e.matches(un)&&sn(e)&&!pn(e)}function pn(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const mn=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function hn(e,t,n){let[r,i]=f(e||t),a=d(r),s=d(e!==void 0),l=e!==void 0;c(()=>{s.current,s.current=l},[l]);let p=l?e:r;mn(()=>{a.current=p});let[,m]=u(()=>({}),{});return[p,o((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),m(),n?.(r,...t))},[n])]}const gn=Symbol(`default`);function _n({values:e,children:t}){for(let[n,i]of e)t=r.createElement(n.Provider,{value:i},t);return t}function U(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s}=e;return l(()=>{let e,c,l;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,c=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,l=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:c||o?{...o,...c}:void 0,children:l??a,"data-rac":``}},[t,n,r,i,a,o,s])}function vn(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function yn(e,t){let n=s(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||gn;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 W(e,t,n){let{ref:r,...i}=yn(n,e.slot)||{},a=Ht(l(()=>ft(t,r),[t,r])),o=L(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?o.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}}:o.style={...i.style,...e.style}),[o,a]}function bn(e=!0){let[t,n]=f(e),r=d(!1),i=o(e=>{r.current=!0,n(!!e)},[]);return j(()=>{r.current||n(!1)},[]),[i,t]}function xn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}const Sn=7e3;let Cn=null;function wn(e,t=`assertive`,n=Sn){Cn?Cn.announce(e,t,n):(Cn=new Tn,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?Cn.announce(e,t,n):setTimeout(()=>{Cn?.isAttached()&&Cn?.announce(e,t,n)},100))}var Tn=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=Sn){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const En=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Dn=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function On(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 En.has(t.script)}let t=e.split(`-`)[0];return Dn.has(t)}const kn=Symbol.for(`react-aria.i18n.locale`);function An(){let e=typeof window<`u`&&window[kn]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:On(e)?`rtl`:`ltr`}}let jn=An(),Mn=new Set;function Nn(){jn=An();for(let e of Mn)e(jn)}function Pn(){let e=$e(),[t,n]=f(jn);return c(()=>(Mn.size===0&&window.addEventListener(`languagechange`,Nn),Mn.add(n),()=>{Mn.delete(n),Mn.size===0&&window.removeEventListener(`languagechange`,Nn)}),[]),e?{locale:typeof window<`u`&&window[kn]||`en-US`,direction:`ltr`}:t}const Fn=r.createContext(null);function In(){let e=Pn();return s(Fn)||e}const Ln=Symbol.for(`react-aria.i18n.locale`),Rn=Symbol.for(`react-aria.i18n.strings`);let zn;var Bn=class e{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=Vn(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Ln];if(zn===void 0){let t=window[Rn];if(!t)return null;for(let r in zn={},t)zn[r]=new e({[n]:t[r]},n)}let r=zn?.[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}constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}};function Vn(e,t,n=`en-US`){if(t[e])return t[e];let r=Hn(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function Hn(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const Un=new Map,Wn=new Map;var Gn=class{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=Un.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),Un.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=Wn.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),Wn.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}constructor(e,t){this.locale=e,this.strings=t}};const Kn=new WeakMap;function qn(e){let t=Kn.get(e);return t||(t=new Bn(e),Kn.set(e,t)),t}function Jn(e,t){return t&&Bn.getGlobalDictionaryForPackage(t)||qn(e)}function Yn(e,t){let{locale:n}=In(),r=Jn(e,t);return l(()=>new Gn(n,r),[n,r])}function Xn(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function Zn(e,t,n){Xn(e,t),t.set(e,n)}function Qn(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function $n(e,t){Object.defineProperty(e,`target`,{value:t}),Object.defineProperty(e,`currentTarget`,{value:t})}function er(e){let t=d({isFocused:!1,observer:null});return j(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),o(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=n.target;r.addEventListener(`focusout`,n=>{if(t.current.isFocused=!1,r.disabled){let t=Qn(n);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;(e=t.current.observer)==null||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:n})),r.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let tr=!1;function nr(e){for(;e&&!dn(e);)e=e.parentElement;let t=N(e),n=t.document.activeElement;if(!n||n===e)return;tr=!0;let r=!1,i=e=>{(e.target===n||r)&&e.stopImmediatePropagation()},a=t=>{(t.target===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,bt(n),c()))},o=t=>{(t.target===e||r)&&t.stopImmediatePropagation()},s=t=>{(t.target===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,bt(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),tr=!1,r=!1},l=requestAnimationFrame(c);return c}let rr=`default`,ir=``,ar=new WeakMap;function or(e){if(At()){if(rr===`default`){let t=M(e);ir=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}rr=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;ar.set(e,e.style[t]),e.style[t]=`none`}}function sr(e){if(At()){if(rr!==`disabled`)return;rr=`restoring`,setTimeout(()=>{zt(()=>{if(rr===`restoring`){let t=M(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=ir||``),ir=``,rr=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&ar.has(e)){let t=ar.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),ar.delete(e)}}const cr=r.createContext({register:()=>{}});cr.displayName=`PressResponderContext`;function lr(e,t){return t.get?t.get.call(e):t.value}function ur(e,t,n){if(!t.has(e))throw TypeError(`attempted to `+n+` private field on non-instance`);return t.get(e)}function dr(e,t){return lr(e,ur(e,t,`get`))}function fr(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw TypeError(`attempted to set read only private field`);t.value=n}}function pr(e,t,n){return fr(e,ur(e,t,`set`),n),n}function mr(e){let t=s(cr);if(t){let{register:n,...r}=t;e=L(r,e),n()}return Wt(t,e.ref),e}var hr=new WeakMap,gr=class{continuePropagation(){pr(this,hr,!1)}get shouldStopPropagation(){return dr(this,hr)}constructor(e,t,n,r){Zn(this,hr,{writable:!0,value:void 0}),pr(this,hr,!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}};const _r=Symbol(`linkClicked`),vr=`react-aria-pressable-style`,yr=`data-react-aria-pressable`;function br(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:a,onClick:s,isDisabled:u,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=mr(e),[y,b]=f(!1),x=d({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C,removeGlobalListener:w}=Bt(),T=o((e,t)=>{let i=x.current;if(u||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new gr(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[u,r,n]),E=o((e,r,a=!0)=>{let o=x.current;if(!o.didFirePressStart)return!1;o.didFirePressStart=!1,o.isTriggeringEvent=!0;let s=!0;if(i){let t=new gr(`pressend`,r,e);i(t),s=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!u){let n=new gr(`press`,r,e);t(n),s&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,s},[u,i,n,t]),D=V(E),O=o((e,t)=>{let n=x.current;if(u)return!1;if(a){n.isTriggeringEvent=!0;let r=new gr(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[u,a]),ee=V(O),k=o(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&E(Cr(t.target,e),t.pointerType,!1),t.isPressed=!1,le(null),t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||sr(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,E]),te=V(k),ne=o(e=>{h&&k(e)},[h,k]),re=o(e=>{u||s?.(e)},[u,s]),ie=o((e,t)=>{if(!u&&s){let n=new MouseEvent(`click`,e);$n(n,t),s(Qn(n))}},[u,s]),ae=V(ie),[oe,se]=f(!1);j(()=>{let e=x.current;if(oe){let t=t=>{if(e.isPressed&&e.target&&Sr(t,e.target)){var n;Tr(I(t),t.key)&&t.preventDefault();let r=I(t),i=P(e.target,I(t));D(Cr(e.target,t),`keyboard`,i),i&&ae(t,e.target),C(),t.key!==`Enter`&&xr(e.target)&&P(e.target,r)&&!t[_r]&&(t[_r]=!0,Ft(e.target,t,!1)),e.isPressed=!1,se(!1),(n=e.metaKeyEvents)==null||n.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){var r;let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())(r=e.target)==null||r.dispatchEvent(new KeyboardEvent(`keyup`,n))}},n=e.target,r=ot(t=>{n&&Sr(t,n)&&!t.repeat&&P(n,I(t))&&e.target&&ee(Cr(e.target,t),`keyboard`)},t);return S(M(e.target),`keyup`,r,!0),()=>{w(M(e.target),`keyup`,r,!0)}}},[oe,S,C,w]);let[ce,le]=f(null);j(()=>{let e=x.current;if(ce===`pointer`){let t=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(P(e.target,I(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?te(t):(bt(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else te(t);e.isOverTarget=!1}},n=e=>{te(e)};return S(M(e.target),`pointerup`,t,!1),S(M(e.target),`pointercancel`,n,!1),()=>{w(M(e.target),`pointerup`,t,!1),w(M(e.target),`pointercancel`,n,!1)}}},[ce,S,w]);let ue=l(()=>{let e=x.current,t={onKeyDown(t){if(Sr(t.nativeEvent,t.currentTarget)&&P(t.currentTarget,I(t.nativeEvent))){var n;Tr(I(t.nativeEvent),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,se(!0),e.pointerType=`keyboard`,r=T(t,`keyboard`)),r&&t.stopPropagation(),t.metaKey&&Dt()&&((n=e.metaKeyEvents)==null||n.set(t.key,t.nativeEvent))}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!P(t.currentTarget,I(t.nativeEvent)))&&t&&t.button===0&&!e.isTriggeringEvent&&!Ft.isOpening){let n=!0;if(u&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Zt(t.nativeEvent))){let e=T(t,`virtual`),r=O(t,`virtual`),i=E(t,`virtual`);re(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=O(Cr(t.currentTarget,t),r),a=E(Cr(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,re(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}};return typeof PointerEvent<`u`&&(t.onPointerDown=t=>{if(t.button!==0||!P(t.currentTarget,I(t.nativeEvent)))return;if(Qt(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let n=!0;if(!e.isPressed){e.isPressed=!0,le(`pointer`),e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||or(e.target),n=T(t,e.pointerType);let r=I(t.nativeEvent);`releasePointerCapture`in r&&r.releasePointerCapture(t.pointerId)}n&&t.stopPropagation()},t.onMouseDown=t=>{if(P(t.currentTarget,I(t.nativeEvent))&&t.button===0){if(m){let n=nr(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!P(t.currentTarget,I(t.nativeEvent))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&O(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,T(Cr(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(Cr(e.target,t),e.pointerType,!1),ne(t))},t.onDragStart=e=>{P(e.currentTarget,I(e.nativeEvent))&&k(e)}),t},[u,m,C,g,k,ne,E,T,O,re,ie]);return c(()=>{if(!_)return;let e=M(_.current);if(!e||!e.head||e.getElementById(vr))return;let t=e.createElement(`style`);t.id=vr,t.textContent=`
1
+ import{i as e,n as t,r as n,t as r}from"./internals-ZuuqmWaa.js";import{ErrorBoundary as i}from"react-error-boundary";import a,{Suspense as o,createContext as s,forwardRef as c,lazy as l,useCallback as u,useContext as d,useEffect as f,useMemo as p,useReducer as m,useRef as h,useState as g}from"react";import{useLocalStorage as _,useSessionStorage as v,useTimeout as y}from"usehooks-ts";import{z as b}from"zod/v4/mini";import x from"ky";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import T from"clsx";import E,{flushSync as D}from"react-dom";function O(e){return e.issues[0]?.message??`Invalid input`}const k=b.object({type:b.literal(`next`)}),A=b.object({type:b.literal(`end`)}),ee=b.object({type:b.literal(`jump`),target:b.number({error:`Target question is required`})}),te=b.discriminatedUnion(`type`,[k,ee,A]),ne=b.object({type:b.literal(`value`),value:b.union([b.string().check(b.trim(),b.minLength(1,{error:`Value is required`})),b.number({error:`Value is required`})])}),re=b.object({type:b.literal(`binary-operator`),operator:b.union([b.literal(`equal`),b.literal(`not-equal`),b.literal(`greater`),b.literal(`greater-or-equal`),b.literal(`less`),b.literal(`less-or-equal`),b.literal(`contains`),b.literal(`not-contains`)]),value:ne,target:te}),ie=b.object({type:b.literal(`switch`),cases:b.array(re),default:te}),ae=b.object({type:b.literal(`always`),target:te}),oe=b.discriminatedUnion(`type`,[ae,ie]),se=b.string().check(b.trim(),b.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),ce=b.optional(b.string().check(b.trim(),b.maxLength(50))),le=b.object({value:b.string().check(b.trim(),b.minLength(1,{error:`Value is required`})),description:b.optional(b.string().check(b.trim()))}),ue=b.nullable(b.object({label:b.string().check(b.trim(),b.minLength(1,{error:`Value is required`})),max:b.number(),description:b.optional(b.string().check(b.trim()))})),de=b.optional(b.boolean()),fe=b.object({type:b.literal(`rating`),buttonLabel:ce,shouldAutoProgress:de,scale:b.number().check(b.minimum(2),b.maximum(10)),labels:b.optional(b.object({lower:b.optional(b.pipe(b.string().check(b.trim()),b.transform(e=>e===``?void 0:e))),upper:b.optional(b.pipe(b.string().check(b.trim()),b.transform(e=>e===``?void 0:e)))})),display:b.optional(b.literal([`star`,`emoji`,`number`]))}),pe=b.object({type:b.literal(`open-ended`),placeholder:b.optional(b.string()),buttonLabel:ce,max:b.number()}),me=b.object({type:b.literal(`single-select`),shouldAutoProgress:de,options:b.array(le),buttonLabel:ce,editable:ue}),he=b.object({type:b.literal(`multi-select`),buttonLabel:ce,options:b.array(le),editable:ue,max:b.optional(b.number()),display:b.optional(b.literal([`checkbox`,`tag`]))}),ge=b.object({type:b.literal(`statement`),buttonLabel:ce,buttonUrl:b.optional(se)}),_e=b.object({type:b.literal(`bug-report`),placeholder:b.optional(b.string()),buttonLabel:ce,enableScreenshot:b.boolean(),enableRecording:b.boolean(),detailsLabel:b.string().check(b.trim(),b.minLength(1,{error:`Label is required`}),b.maxLength(128)),detailsPlaceholder:b.optional(b.string()),redactClasses:b.array(b.string())}),ve=b.discriminatedUnion(`type`,[fe,me,pe,he,ge,_e]),ye=`__CONFETTI_CHECKBOX_Others`,be=`__CONFETTI_RADIO_Others`,xe=b.optional(b.catchall(b.partial(b.looseObject({userAgent:b.string().check(b.trim(),b.maxLength(1e3)),screenResolution:b.string().check(b.trim(),b.maxLength(100)),viewportSize:b.string().check(b.trim(),b.maxLength(100)),pageUrl:b.string(),pageTitle:b.string().check(b.trim(),b.maxLength(1e3)),referrer:b.string(),datadogTraceId:b.optional(b.string()),datadogSessionId:b.optional(b.string()),datadogSessionReplayLink:b.optional(b.string())})),b.optional(b.string())));b.cuid2();const Se=b.looseObject({type:b.literal([0,1,2,3,4,5,6]),data:b.unknown(),timestamp:b.number(),delay:b.optional(b.number())});b.array(Se);const Ce=b.array(Se),we=b.string().check(b.refine(e=>{try{return Ce.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),Te=b.string().check(b.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),Ee=e=>b.object({title:b.string().check(b.trim(),...e?[b.minLength(1,{error:`Title is required`})]:[],b.maxLength(256)),description:b.optional(b.string().check(b.trim(),b.maxLength(4096))),screenshotDataUrl:b.optional(Te),recordingEventsJson:b.optional(we),metadata:xe}),De=Ee(!0),Oe=(e,{required:t})=>Ee(t),ke=e=>b.number().check(b.int(),b.minimum(1),b.maximum(e)),Ae=({scale:e},{required:t})=>{let n=ke(e);return t?n:b.optional(n)},je=({maxLength:e},{required:t})=>b.string().check(b.trim(),...t?[b.minLength(1,{error:`This field is required`})]:[],b.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),Me=(e,t)=>b.string().check(b.trim(),...t?[b.minLength(1,{error:`This field is required`})]:[],b.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),b.refine(e=>e!==be,{error:`Please fill out the free text field`})),Ne=({maxLength:e},{required:t})=>{let n=Me(e,t);return t?n:b.optional(n)},Pe=({maxSelected:e,maxLength:t},{required:n})=>b.array(b.string().check(b.trim(),...n?[b.minLength(1,{error:`This field is required`})]:[],b.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),b.refine(e=>e!==ye,{error:`Please fill out the free text field`}))).check(...n?[b.minLength(1,{error:`Please select at least one option`})]:[],b.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Fe=()=>b.optional(b.string()),Ie=b.object({title:b.string().check(b.trim()),description:b.string().check(b.trim()),buttonText:b.string().check(b.trim())}),Le=b.object({title:b.string(),description:b.nullable(b.string()),questions:b.array(b.object({id:b.string(),title:b.string(),description:b.nullable(b.string()),position:b.number(),required:b.boolean(),properties:ve,routingLogic:oe})),confirmation:Ie});b.object({surveyId:b.cuid2(),responseId:b.union([b.cuid2(),b.uuid()])}),b.object({respondent:b.string().check(b.trim(),b.minLength(1),b.maxLength(2048)),data:b.record(b.string(),b.union([b.string().check(b.trim(),b.maxLength(2048)),b.number(),b.array(b.string().check(b.trim(),b.maxLength(2048))).check(b.maxLength(1024)),De])),metadata:b.record(b.string().check(b.trim(),b.maxLength(1e3)),b.string().check(b.trim(),b.maxLength(1e3)))}),b.object({surveyId:b.cuid2(),respondent:b.string().check(b.trim(),b.minLength(1),b.maxLength(2048))}),b.object({surveyId:b.cuid2(),respondent:b.string().check(b.trim(),b.minLength(1),b.maxLength(2048))}),b.object({surveyId:b.cuid2()});const Re=b.object({lastRespondedAt:b.nullable(b.union([b.iso.datetime(),b.date()])),lastViewedAt:b.nullable(b.union([b.iso.datetime(),b.date()])),lastDismissedAt:b.nullable(b.union([b.iso.datetime(),b.date()]))});b.object({type:b.enum([`view`,`dismiss`])});const ze=x.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4}),Be=s(null),Ve=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:o})=>{let s=h(!1),[c,l]=g(),[d,m]=g(!1),[v,y]=g(null),[b,x]=g(null),[S,w]=_(`cfti:${t}:respondent`,``);f(()=>{S||w(crypto.randomUUID())},[S,w]);let T=p(()=>r||S,[r,S]),E=p(()=>{let e={headers:{"x-cfti-pk":n}};return o&&(e.prefixUrl=o),ze.extend(e)},[o,n]),D=u(async()=>{if(!T)return;let e=await E.get(`v1/cfti/${t}/respondent/${T}`).json(),n=Re.safeParse(e);n.success&&(y(n.data.lastRespondedAt?new Date(n.data.lastRespondedAt):null),x(n.data.lastDismissedAt?new Date(n.data.lastDismissedAt):null))},[E,T,t]);f(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&D()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[D]),f(()=>{(async()=>{s.current=!1,m(!1),l(void 0),y(null),x(null);try{let e=await E.get(`v1/cfti/${t}`).json(),n=Le.safeParse(e);if(!n.success)return;l(n.data),await D()}catch{}finally{m(!0)}})()},[E,D,t]);let O=u(async({answers:e})=>{let n=crypto.randomUUID();await E.put(`v1/cfti/${t}/response/${n}`,{json:{respondent:T,data:e,metadata:i}})},[E,i,T,t]),k=u(()=>{l(void 0),E.post(`v1/cfti/${t}/respondent/${T}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[E,T,t]),A=p(()=>d?a===void 0?!0:typeof a==`boolean`?a:a({lastRespondedAt:v,lastDismissedAt:b}):!1,[d,a,v,b]);return f(()=>{s.current||A&&c&&T&&(s.current=!0,E.post(`v1/cfti/${t}/respondent/${T}/event`,{json:{type:`view`}}).catch(()=>{}))},[E,A,T,c,t]),!A||!c?null:C(Be.Provider,{value:{submit:O,dismiss:k,surveyId:t,survey:c,metadata:i},children:e})},He=()=>{let e=d(Be);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},Ue={rating:({scale:e},t)=>Ae({scale:e},t),"open-ended":({max:e},t)=>je({maxLength:e},t),"single-select":({editable:e},t)=>Ne({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>Pe({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>Fe(),"bug-report":(e,t)=>Oe({},t)},We=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Ue[n];return r(e,t)}case`open-ended`:{let r=Ue[n];return r(e,t)}case`single-select`:{let r=Ue[n];return r(e,t)}case`multi-select`:{let r=Ue[n];return r(e,t)}case`statement`:{let r=Ue[n];return r(e,t)}case`bug-report`:{let r=Ue[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Ge=({originalQuestions:t,answers:n,errors:r,pointer:i=-1})=>{if(!t)return{questions:[],currentIndex:-1};let a=t.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},n=r[e.id];return n&&(t.error=n),{...t,visible:!1}});for(let t=0;t<a.length;t++){let r=a[t];if(!r)continue;let o=e({index:t,questions:a,answers:n});r.visible=i===t||o}let o=a.findIndex((e,t)=>t>i&&e.visible&&n[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},Ke=({questions:e,answers:t})=>{let n=qe({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},qe=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Je=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Ye=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:i,submit:a}=He(),[o,s]=g({}),[c,l]=g({}),d=p(()=>Ge({originalQuestions:i?.questions,answers:o,errors:c,pointer:e}),[i?.questions,o,c,e]),f=p(()=>!!d.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>o[e]!==void 0),[o,d.questions]),[m,h]=g(!1),_=u(({answers:e})=>{a({answers:e}).finally(()=>{n?.()})},[n,a]),v=u(()=>{_({answers:Ke({questions:d.questions,answers:o})}),h(!0)},[o,d.questions,_]),y=u(({question:n,answer:r})=>{let a=d.questions.at(n);if(!a)return{error:`Question index is invalid`};let u=We(a.properties,{required:a.required}).safeParse(r);if(!u.success){let e=O(u.error);return l(t=>{if(t[a.id]===e)return t;let n={...t};return n[a.id]=e,n}),s(e=>{if(!(a.id in e))return e;let t={...e};return delete t[a.id],t}),{error:e}}l(e=>{if(!e[a.id])return e;let t={...e};return delete t[a.id],t});let f=!a.required&&!r?null:r,p={...o};if(p[a.id]===f)return{next:Ge({originalQuestions:i?.questions,answers:p,errors:c,pointer:e}).currentIndex};p[a.id]=f;let m=Ge({originalQuestions:i?.questions,answers:p,errors:c,pointer:e});return p=qe({questions:m.questions,answers:p}),s(p),l(Je({questions:m.questions,errors:c})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>p[e]!==void 0)&&t&&(_({answers:Ke({questions:m.questions,answers:p})}),h(!0)),{next:m.currentIndex}},[d.questions,o,i?.questions,c,t,e,_]);return d.questions.length===0?C(S,{}):C(`div`,{className:`confetti`,children:r({questions:d.questions,current:e??d.currentIndex,update:y,isCompleted:f,submit:v,isSubmitted:m,errors:c})})},Xe=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>C(i,{fallback:C(S,{}),children:C(Ve,{...r,children:C(Ye,{shouldAutoSubmit:n,onFinished:t,children:e})})}),Ze=s(null);s(null),s(null),s(null),s(null);const Qe=s({});s(null);const $e=s(null);function et(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 tt(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function nt(e){let t=null;return()=>(t??=e(),t)}const rt=nt(function(){return tt(/^Mac/i)}),it=nt(function(){return tt(/^iPhone/i)}),at=nt(function(){return tt(/^iPad/i)||rt()&&navigator.maxTouchPoints>1}),ot=nt(function(){return it()||at()}),st=nt(function(){return et(/AppleWebKit/i)&&!ct()}),ct=nt(function(){return et(/Chrome/i)}),lt=nt(function(){return et(/Android/i)}),ut=nt(function(){return et(/Firefox/i)});function dt(e){if(pt())e.focus({preventScroll:!0});else{let t=mt(e);e.focus(),ht(t)}}let ft=null;function pt(){if(ft==null){ft=!1;try{document.createElement(`div`).focus({get preventScroll(){return ft=!0,!0}})}catch{}}return ft}function mt(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 ht(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function gt(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;ut()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(rt()?r=!0:i=!0);let s=st()&&rt()&&!at()?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});gt.isOpening=n,dt(e),e.dispatchEvent(s),gt.isOpening=!1}gt.isOpening=!1;const j=typeof document<`u`?a.useLayoutEffect:()=>{},_t={prefix:String(Math.round(Math.random()*1e10)),current:0},vt=a.createContext(_t),yt=a.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let bt=new WeakMap;function xt(e=!1){let t=d(vt),n=h(null);if(n.current===null&&!e){let e=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let n=bt.get(e);n==null?bt.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,bt.delete(e))}n.current=++t.current}return n.current}function St(e){let t=d(vt),n=xt(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function Ct(e){let t=a.useId(),[n]=g(Ot()),r=n?`react-aria`:`react-aria${_t.prefix}`;return e||`${r}-${t}`}const wt=typeof a.useId==`function`?Ct:St;function Tt(){return!1}function Et(){return!0}function Dt(e){return()=>{}}function Ot(){return typeof a.useSyncExternalStore==`function`?a.useSyncExternalStore(Dt,Tt,Et):d(yt)}function kt(e){let[t,n]=g(e),r=h(t),i=h(null),a=h(()=>{if(!i.current)return;let e=i.current.next();if(e.done){i.current=null;return}r.current===e.value?a.current():n(e.value)});return j(()=>{r.current=t,i.current&&a.current()}),[t,u(e=>{i.current=e(r.current),a.current()},[a])]}let At=!!(typeof window<`u`&&window.document&&window.document.createElement),jt=new Map,Mt;typeof FinalizationRegistry<`u`&&(Mt=new FinalizationRegistry(e=>{jt.delete(e)}));function Nt(e){let[t,n]=g(e),r=h(null),i=wt(t),a=h(null);if(Mt&&Mt.register(a,i),At){let e=jt.get(i);e&&!e.includes(r)?e.push(r):jt.set(i,[r])}return j(()=>{let e=i;return()=>{Mt&&Mt.unregister(a),jt.delete(e)}},[i]),f(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function Pt(e,t){if(e===t)return e;let n=jt.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=jt.get(t);return r?(r.forEach(t=>t.current=e),e):t}function Ft(e=[]){let t=Nt(),[n,r]=kt(t),i=u(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return j(i,[t,i,...e]),n}function It(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const M=e=>e?.ownerDocument??document,N=e=>e&&`window`in e&&e.window===e?e:M(e).defaultView||window;function Lt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Rt(e){return Lt(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function P(){return!1}function F(e,t){if(!P())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:Rt(n)?n.host:n.parentNode}return!1}const I=(e=document)=>{if(!P())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function L(e){if(P()&&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 zt(e){if(!e)return!1;let t=e.getRootNode(),n=N(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}var Bt=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(!F(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 F(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 Vt(e,t,n,r){return P()?new Bt(e,t,n,r):e.createTreeWalker(t,n,r)}function Ht(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=Ut(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():Ut(e[n],null)})}}}function Ut(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function R(...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]=It(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=T(n,i):e===`id`&&n&&i?t.id=Pt(n,i):e===`ref`&&n&&i?t.ref=Ht(n,i):t[e]=i===void 0?n:i}}return t}const Wt=new Set([`id`]),Gt=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Kt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),qt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Jt=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(`.`)),Yt=/^(data-.*)$/;function z(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)&&(Wt.has(t)||n&&Gt.has(t)||r&&Kt.has(t)||i&&qt.has(t)||a&&(Jt.has(t)||t.endsWith(`Capture`)&&Jt.has(t.slice(0,-7)))||o?.has(t)||Yt.test(t))&&(s[t]=e[t]);return s}let B=new Map,Xt=new Set;function Zt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=L(t);if(!e(t)||!r)return;let i=B.get(r);i||(i=new Set,B.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=L(t);if(!e(t)||!r)return;let i=B.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),B.delete(r)),B.size===0)){for(let e of Xt)e();Xt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Zt):Zt());function Qt(){for(let[e]of B)`isConnected`in e&&!e.isConnected&&B.delete(e)}function $t(e){requestAnimationFrame(()=>{Qt(),B.size===0?e():Xt.add(e)})}function en(){let e=h(new Map),t=u((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=u((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=u(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return f(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function tn(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=Nt(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function nn(e){let t=h(null),n=h(void 0),r=u(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 p(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=r(e))}}),[r])}const rn=a.useInsertionEffect??j;function V(e){let t=h(null);return rn(()=>{t.current=e},[e]),u((...e)=>{let n=t.current;return n?.(...e)},[])}function an(e,t){j(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function on(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 sn(e,t){let n=e;for(on(n,t)&&(n=n.parentElement);n&&!on(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const cn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ln(e){return e instanceof HTMLInputElement&&!cn.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let H=typeof document<`u`&&window.visualViewport;function un(){let e=Ot(),[t,n]=g(()=>e?{width:0,height:0}:dn());return f(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{H&&H.scale>1||e(dn())},r,i=t=>{H&&H.scale>1||ln(L(t))&&(r=requestAnimationFrame(()=>{let t=I();(!t||!ln(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(dn()),ot()&&window.addEventListener(`blur`,i,!0),H?H.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(r),ot()&&window.removeEventListener(`blur`,i,!0),H?H.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function dn(){return{width:H?Math.min(H.width*H.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:H?H.height*H.scale:document.documentElement.clientHeight}}function fn(e){return e.pointerType===``&&e.isTrusted?!0:lt()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function pn(e){return!lt()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function mn(e,t,n){let r=V(e=>{n&&!e.defaultPrevented&&n(t)});f(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function hn(e,t=!0){let[n,r]=g(!0),i=n&&t;return j(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),_n(e,i,u(()=>r(!1),[])),i}function gn(e,t){let[n,r]=g(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return _n(e,i,u(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function _n(e,t,n){j(()=>{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||D(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const vn=typeof Element<`u`&&`checkVisibility`in Element.prototype;function yn(e){let t=N(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function bn(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 xn(e,t){return vn?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&yn(e)&&bn(e,t)&&(!e.parentElement||xn(e.parentElement,e))}const Sn=[`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`],Cn=Sn.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;Sn.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const wn=Sn.join(`:not([hidden]):not([tabindex="-1"]),`);function Tn(e,t){return e.matches(Cn)&&!Dn(e)&&(t?.skipVisibilityCheck||xn(e))}function En(e){return e.matches(wn)&&xn(e)&&!Dn(e)}function Dn(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function On(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let kn=new WeakMap;function An(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return On(t);if(kn.has(t))return kn.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof N(n).HTMLMetaElement&&(n.nonce||n.content)||On(t)||void 0;return r!==void 0&&kn.set(t,r),r}const jn=Symbol(`default`);function Mn({values:e,children:t}){for(let[n,r]of e)t=a.createElement(n.Provider,{value:r},t);return t}function U(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s,render:c}=e;return p(()=>{let e,l,u;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,l=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,u=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:l||o?{...o,...l}:void 0,children:u??a,"data-rac":``,render:c?e=>c(e,s):void 0}},[t,n,r,i,a,o,s,c])}function Nn(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function Pn(e,t){let n=d(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||jn;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 W(e,t,n){let{ref:r,...i}=Pn(n,e.slot)||{},a=nn(p(()=>Ht(t,r),[t,r])),o=R(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?o.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}}:o.style={...i.style,...e.style}),[o,a]}function Fn(e=!0){let[t,n]=g(e),r=h(!1),i=u(e=>{r.current=!0,n(!!e)},[]);return j(()=>{r.current||n(!1)},[]),[i,t]}function In(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function Ln(e,t,n){let{render:r,...i}=t,o=h(null),s=p(()=>Ht(n,o),[n,o]);j(()=>{},[e,r]);let c={...i,ref:s};return r?r(c,void 0):a.createElement(e,c)}const Rn={},G=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let n=Rn[t];return n||(n=c(Ln.bind(null,t)),Rn[t]=n),n}}),zn=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Bn(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let Vn=new WeakMap,K=[];function Hn(e,t){let n=N(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&zn,o=new Set(e),s=new Set,c=e=>a&&e instanceof n.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,l=(e,t)=>{a&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof n.HTMLElement&&(e.inert=!1))},u=new Set;if(P())for(let t of e){let e=t;for(;e&&e!==i;){let t=e.getRootNode();`shadowRoot`in t&&u.add(t.shadowRoot),e=t.parentNode}}let d=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))o.add(t);let t=e=>{if(s.has(e)||o.has(e)||e.parentElement&&s.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of o)if(F(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=Vt(M(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&f(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)f(e),e=n.nextNode()}},f=e=>{let t=Vn.get(e)??0;c(e)&&t===0||(t===0&&l(e,!0),s.add(e),Vn.set(e,t+1))};K.length&&K[K.length-1].disconnect(),d(i);let p=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...s].some(e=>F(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Bn(e)?o.add(e):e instanceof Element&&d(e);if(P()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});p.observe(i,{childList:!0,subtree:!0});let m=new Set;if(P())for(let e of u){let t=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...s].some(e=>F(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Bn(e)?o.add(e):e instanceof Element&&d(e);if(P()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});t.observe(e,{childList:!0,subtree:!0}),m.add(t)}let h={visibleNodes:o,hiddenNodes:s,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}};return K.push(h),()=>{if(p.disconnect(),P())for(let e of m)e.disconnect();for(let e of s){let t=Vn.get(e);t!=null&&(t===1?(l(e,!1),Vn.delete(e)):Vn.set(e,t-1))}h===K[K.length-1]?(K.pop(),K.length&&K[K.length-1].observe()):K.splice(K.indexOf(h),1)}}const Un=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Wn=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Gn(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 Un.has(t.script)}let t=e.split(`-`)[0];return Wn.has(t)}const Kn=Symbol.for(`react-aria.i18n.locale`);function qn(){let e=typeof window<`u`&&window[Kn]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Gn(e)?`rtl`:`ltr`}}let Jn=qn(),Yn=new Set;function Xn(){Jn=qn();for(let e of Yn)e(Jn)}function Zn(){let e=Ot(),[t,n]=g(Jn);return f(()=>(Yn.size===0&&window.addEventListener(`languagechange`,Xn),Yn.add(n),()=>{Yn.delete(n),Yn.size===0&&window.removeEventListener(`languagechange`,Xn)}),[]),e?{locale:typeof window<`u`&&window[Kn]||`en-US`,direction:`ltr`}:t}const Qn=a.createContext(null);function $n(){let e=Zn();return d(Qn)||e}const er=Symbol.for(`react-aria.i18n.locale`),tr=Symbol.for(`react-aria.i18n.strings`);let nr;var rr=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=ir(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[er];if(nr===void 0){let t=window[tr];if(!t)return null;for(let r in nr={},t)nr[r]=new e({[n]:t[r]},n)}let r=nr?.[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 ir(e,t,n=`en-US`){if(t[e])return t[e];let r=ar(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function ar(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const or=new Map,sr=new Map;var cr=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=or.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),or.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=sr.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),sr.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const lr=new WeakMap;function ur(e){let t=lr.get(e);return t||(t=new rr(e),lr.set(e,t)),t}function dr(e,t){return t&&rr.getGlobalDictionaryForPackage(t)||ur(e)}function fr(e,t){let{locale:n}=$n(),r=dr(e,t);return p(()=>new cr(n,r),[n,r])}function pr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function mr(e,t){Object.defineProperty(e,`target`,{value:t}),Object.defineProperty(e,`currentTarget`,{value:t})}function hr(e){let t=h({isFocused:!1,observer:null});return j(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),u(n=>{let r=L(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=pr(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===I()?null:I();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 gr=!1;function _r(e){for(;e&&!Tn(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=N(e),n=t.document.activeElement;if(!n||n===e)return;gr=!0;let r=!1,i=e=>{(L(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(L(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,dt(n),c()))},o=t=>{(L(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(L(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,dt(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),gr=!1,r=!1},l=requestAnimationFrame(c);return c}let vr=`default`,yr=``,br=new WeakMap;function xr(e){if(ot()){if(vr===`default`){let t=M(e);yr=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}vr=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;br.set(e,e.style[t]),e.style[t]=`none`}}function Sr(e){if(ot()){if(vr!==`disabled`)return;vr=`restoring`,setTimeout(()=>{$t(()=>{if(vr===`restoring`){let t=M(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=yr||``),yr=``,vr=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&br.has(e)){let t=br.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),br.delete(e)}}const Cr=a.createContext({register:()=>{}});Cr.displayName=`PressResponderContext`;function wr(e){let t=d(Cr);if(t){let{register:n,ref:r,...i}=t;e=R(i,e),n()}return an(t,e.ref),e}var Tr=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 Er=Symbol(`linkClicked`),Dr=`react-aria-pressable-style`,Or=`data-react-aria-pressable`;function kr(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:a,onClick:o,isDisabled:s,isPressed:c,preventFocusOnPress:l,shouldCancelOnPointerExit:d,allowTextSelectionOnPress:m,ref:_,...v}=wr(e),[y,b]=g(!1),x=h({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=en(),w=u((e,t)=>{let i=x.current;if(s||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new Tr(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[s,r,n]),T=u((e,r,a=!0)=>{let o=x.current;if(!o.didFirePressStart)return!1;o.didFirePressStart=!1,o.isTriggeringEvent=!0;let c=!0;if(i){let t=new Tr(`pressend`,r,e);i(t),c=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!s){let n=new Tr(`press`,r,e);t(n),c&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,c},[s,i,n,t]),E=V(T),D=V(u((e,t)=>{let n=x.current;if(s)return!1;if(a){n.isTriggeringEvent=!0;let r=new Tr(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[s,a])),O=u(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(Mr(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),m||Sr(t.target);for(let e of t.disposables)e();t.disposables=[]}},[m,C,T]),k=V(O),A=u(e=>{d&&O(e)},[d,O]),ee=u(e=>{s||o?.(e)},[s,o]),te=u((e,t)=>{if(!s&&o){let n=new MouseEvent(`click`,e);mr(n,t),o(pr(n))}},[s,o]),ne=p(()=>{let e=x.current,t={onKeyDown(t){if(jr(t.nativeEvent,t.currentTarget)&&F(t.currentTarget,L(t))){Pr(L(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(M(t.currentTarget),`keyup`,It(t=>{jr(t,i)&&!t.repeat&&F(i,L(t))&&e.target&&D(Mr(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&rt()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!F(t.currentTarget,L(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!gt.isOpening){let n=!0;if(s&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||fn(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);ee(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(Mr(t.currentTarget,t),r),a=E(Mr(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,ee(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&jr(t,e.target)){Pr(L(t),t.key)&&t.preventDefault();let n=L(t),r=F(e.target,n);E(Mr(e.target,t),`keyboard`,r),r&&te(t,e.target),C(),t.key!==`Enter`&&Ar(e.target)&&F(e.target,n)&&!t[Er]&&(t[Er]=!0,gt(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||!F(t.currentTarget,L(t)))return;if(pn(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,m||xr(e.target),i=w(t,e.pointerType);let a=L(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(M(t.currentTarget),`pointerup`,n,!1),S(M(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(F(t.currentTarget,L(t))&&t.button===0){if(l){let n=_r(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!F(t.currentTarget,L(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(Mr(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(Mr(e.target,t),e.pointerType,!1),A(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(F(e.target,L(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?k(t):(dt(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=>{F(e.currentTarget,L(e))&&k(e)}}return t},[S,s,l,C,m,A,w,ee,te]);return f(()=>{if(!_)return;let e=M(_.current);if(!e||!e.head||e.getElementById(Dr))return;let t=e.createElement(`style`);t.id=Dr;let n=An(e);n&&(t.nonce=n),t.textContent=`
2
2
  @layer {
3
- [${yr}] {
3
+ [${Or}] {
4
4
  touch-action: pan-x pan-y pinch-zoom;
5
5
  }
6
6
  }
7
- `.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||sr(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:L(v,ue,{[yr]:!0})}}function xr(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Sr(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof N(i).HTMLInputElement&&!Dr(i,n)||i instanceof N(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&xr(i))&&n!==`Enter`)}function Cr(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}}function wr(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!xr(e)}function Tr(e,t){return e instanceof HTMLInputElement?!Dr(e,t):wr(e)}const Er=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Dr(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Er.has(e.type)}let G=null,Or=new Set,kr=new Map,Ar=!1,jr=!1;const Mr={Tab:!0,Escape:!0};function Nr(e,t){for(let n of Or)n(e,t)}function Pr(e){return!(e.metaKey||!Dt()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Fr(e){Ar=!0,!Ft.isOpening&&Pr(e)&&(G=`keyboard`,Nr(`keyboard`,e))}function Ir(e){G=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(Ar=!0,Nr(`pointer`,e))}function Lr(e){!Ft.isOpening&&Zt(e)&&(Ar=!0,G=`virtual`)}function Rr(e){e.target===window||e.target===document||tr||!e.isTrusted||(!Ar&&!jr&&(G=`virtual`,Nr(`virtual`,e)),Ar=!1,jr=!1)}function zr(){tr||(Ar=!1,jr=!0)}function Br(e){if(typeof window>`u`||typeof document>`u`||kr.get(N(e)))return;let t=N(e),n=M(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ar=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Fr,!0),n.addEventListener(`keyup`,Fr,!0),n.addEventListener(`click`,Lr,!0),t.addEventListener(`focus`,Rr,!0),t.addEventListener(`blur`,zr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Ir,!0),n.addEventListener(`pointermove`,Ir,!0),n.addEventListener(`pointerup`,Ir,!0)),t.addEventListener(`beforeunload`,()=>{Vr(e)},{once:!0}),kr.set(t,{focus:r})}const Vr=(e,t)=>{let n=N(e),r=M(e);t&&r.removeEventListener(`DOMContentLoaded`,t),kr.has(n)&&(n.HTMLElement.prototype.focus=kr.get(n).focus,r.removeEventListener(`keydown`,Fr,!0),r.removeEventListener(`keyup`,Fr,!0),r.removeEventListener(`click`,Lr,!0),n.removeEventListener(`focus`,Rr,!0),n.removeEventListener(`blur`,zr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Ir,!0),r.removeEventListener(`pointermove`,Ir,!0),r.removeEventListener(`pointerup`,Ir,!0)),kr.delete(n))};function Hr(e){let t=M(e),n;return t.readyState===`loading`?(n=()=>{Br(e)},t.addEventListener(`DOMContentLoaded`,n)):Br(e),()=>Vr(e,n)}typeof document<`u`&&Hr();function Ur(){return G!==`pointer`}function Wr(){return G}function Gr(e){G=e,Nr(e,null)}const Kr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function qr(e,t,n){let r=M(n?.target),i=typeof window<`u`?N(n?.target).HTMLInputElement:HTMLInputElement,a=typeof window<`u`?N(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<`u`?N(n?.target).HTMLElement:HTMLElement,s=typeof window<`u`?N(n?.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof i&&!Kr.has(r.activeElement.type)||r.activeElement instanceof a||r.activeElement instanceof o&&r.activeElement.isContentEditable,!(e&&t===`keyboard`&&n instanceof s&&!Mr[n.key])}function Jr(e,t,n){Br(),c(()=>{let t=(t,r)=>{qr(!!n?.isTextInput,t,r)&&e(Ur())};return Or.add(t),()=>{Or.delete(t)}},t)}function Yr(e){let t=M(e);if(Wr()===`virtual`){let n=F(t);zt(()=>{let r=F(t);(r===n||r===t.body)&&e.isConnected&&bt(e)})}else bt(e)}function Xr(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(e.target===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=er(a),c=o(e=>{let t=M(e.target),r=t?F(t):F();e.target===e.currentTarget&&r===I(e.nativeEvent)&&(n&&n(e),i&&i(!0),s(e))},[i,n,s]);return{focusProps:{onFocus:!t&&(n||i||r)?c:void 0,onBlur:!t&&(r||i)?a:void 0}}}function Zr(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function Qr(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Zr(e.onKeyDown),onKeyUp:Zr(e.onKeyUp)}}}let $r=r.createContext(null);function ei(e){let t=s($r)||{};Wt(t,e);let{ref:n,...r}=t;return r}function ti(e,t){let{focusProps:n}=Xr(e),{keyboardProps:r}=Qr(e),i=L(n,r),a=ei(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&Yr(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:L({...i,tabIndex:l},o)}}function ni({children:e}){let t=l(()=>({register:()=>{}}),[]);return r.createElement(cr.Provider,{value:t},e)}function ri(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=Bt(),l=o(e=>{e.currentTarget.contains(e.target)&&a.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=er(l),f=o(e=>{if(!e.currentTarget.contains(e.target))return;let t=M(e.target),n=F(t);if(!a.current.isFocusWithin&&n===I(e.nativeEvent)){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let n=e.currentTarget;s(t,`focus`,e=>{if(a.current.isFocusWithin&&!P(n,e.target)){let r=new t.defaultView.FocusEvent(`blur`,{relatedTarget:e.target});$n(r,n),l(Qn(r))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}let ii=!1,ai=0;function oi(){ii=!0,setTimeout(()=>{ii=!1},50)}function si(e){e.pointerType===`touch`&&oi()}function ci(){if(!(typeof document>`u`))return ai===0&&typeof PointerEvent<`u`&&document.addEventListener(`pointerup`,si),ai++,()=>{ai--,!(ai>0)&&typeof PointerEvent<`u`&&document.removeEventListener(`pointerup`,si)}}function li(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=f(!1),s=d({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;c(ci,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=Bt(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!e.currentTarget.contains(e.target))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(M(e.target),`pointerover`,e=>{s.isHovered&&s.target&&!P(s.target,e.target)&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:c,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,!(t===`touch`||!s.isHovered||!i)&&(s.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},c={};return typeof PointerEvent<`u`&&(c.onPointerEnter=t=>{ii&&t.pointerType===`mouse`||e(t,t.pointerType)},c.onPointerLeave=e=>{!i&&e.currentTarget.contains(e.target)&&a(e,e.pointerType)}),{hoverProps:c,triggerHoverEnd:a}},[t,n,r,i,s,u,p]);return c(()=>{i&&h({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:m,isHovered:a}}function ui(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=d({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=V(e=>{n&&di(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=V(e=>{n&&n(e)});c(()=>{let e=a.current;if(r)return;let n=t.current,i=M(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&di(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 di(e,t){if(e.button>0)return!1;if(e.target){let t=e.target.ownerDocument;if(!t||!t.documentElement.contains(e.target)||e.target.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}const fi=r.createContext(null),pi=`react-aria-focus-scope-restore`;let K=null;function mi(e){let{children:t,contain:n,restoreFocus:i,autoFocus:a}=e,o=d(null),u=d(null),f=d([]),{parentNode:p}=s(fi)||{},m=l(()=>new ji({scopeRef:f}),[f]);j(()=>{let e=p||Z.root;if(Z.getTreeNode(e.scopeRef)&&K&&!Si(K,e.scopeRef)){let t=Z.getTreeNode(K);t&&(e=t)}e.addChild(m),Z.addNode(m)},[m,p]),j(()=>{let e=Z.getTreeNode(f);e&&(e.contain=!!n)},[n]),j(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==u.current;)t.push(e),e.addEventListener(pi,n),e=e.nextSibling;return f.current=t,()=>{for(let e of t)e.removeEventListener(pi,n)}},[t]),Ei(f,i,n),yi(f,n),Oi(f,i,n),Ti(f,a),c(()=>{let e=F(M(f.current?f.current[0]:void 0)),t=null;if(q(e,f.current)){for(let n of Z.traverse())n.scopeRef&&q(e,n.scopeRef.current)&&(t=n);t===Z.getTreeNode(f)&&(K=t.scopeRef)}},[f]),j(()=>()=>{let e=Z.getTreeNode(f)?.parent?.scopeRef??null;(f===K||Si(f,K))&&(!e||Z.getTreeNode(e))&&(K=e),Z.removeTreeNode(f)},[f]);let h=l(()=>hi(f),[]),g=l(()=>({focusManager:h,parentNode:m}),[m,h]);return r.createElement(fi.Provider,{value:g},r.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,r.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:u}))}function hi(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(M(n[0]??void 0)),c=n[0].previousElementSibling,l=X(gi(n),{tabbable:i,accept:o},n);l.currentNode=q(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&Y(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(M(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=X(gi(n),{tabbable:i,accept:o},n);l.currentNode=q(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&Y(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(gi(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&Y(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(gi(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&Y(o,!0),o}}}function gi(e){return e[0].parentElement}function _i(e){let t=Z.getTreeNode(K);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function vi(e){if(e.checked)return!0;let t=[];return t=e.form?[...e.form?.elements?.namedItem(e.name)??[]]:[...M(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(e=>!e.form),t?!t.some(e=>e.checked):!1}function yi(e,t){let n=d(void 0),r=d(void 0);j(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=M(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!_i(e)||t.isComposing)return;let n=F(a),r=e.current;if(!r||!q(n,r))return;let i=X(gi(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&Y(o,!0)},s=t=>{(!K||Si(K,e))&&q(I(t),e.current)?(K=e,n.current=I(t)):_i(e)&&!J(I(t),e)?n.current?n.current.focus():K&&K.current&&wi(K.current):_i(e)&&(n.current=I(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=Wr(),i=(r===`virtual`||r===null)&&Nt()&&Mt(),o=F(a);if(!i&&o&&_i(e)&&!J(o,e)){K=e;let r=I(t);if(r&&r.isConnected){var s;n.current=r,(s=n.current)==null||s.focus()}else K.current&&wi(K.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),j(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function bi(e){return J(e)}function q(e,t){return!e||!t?!1:t.some(t=>t.contains(e))}function J(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of Z.traverse(Z.getTreeNode(t)))if(n&&q(e,n.current))return!0;return!1}function xi(e){return J(e,K)}function Si(e,t){let n=Z.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function Y(e,t=!1){if(e!=null&&!t)try{Yr(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Ci(e,t=!0){let n=e[0].previousElementSibling,r=gi(e),i=X(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=gi(e),i=X(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function wi(e,t=!0){Y(Ci(e,t))}function Ti(e,t){let n=r.useRef(t);c(()=>{n.current&&(K=e,!q(F(M(e.current?e.current[0]:void 0)),K.current)&&e.current&&wi(e.current)),n.current=!1},[e])}function Ei(e,t,n){j(()=>{if(t||n)return;let r=e.current,i=M(r?r[0]:void 0),a=t=>{let n=I(t);q(n,e.current)?K=e:bi(n)||(K=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function Di(e){let t=Z.getTreeNode(K);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Oi(e,t,n){let r=d(typeof document<`u`?F(M(e.current?e.current[0]:void 0)):null);j(()=>{let r=e.current,i=M(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!K||Si(K,e))&&q(F(i),e.current)&&(K=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),j(()=>{let r=M(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!_i(e)||t.isComposing)return;let n=r.activeElement;if(!J(n,e)||!Di(e))return;let i=Z.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=X(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||!J(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(J(s,e));t.preventDefault(),t.stopPropagation(),s?Y(s,!0):bi(a)?Y(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),j(()=>{let n=M(e.current?e.current[0]:void 0);if(!t)return;let i=Z.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=Z.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=F(n);if(t&&i&&(a&&J(a,e)||a===n.body&&Di(e))){let t=Z.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){ki(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Z.getTreeNode(n.scopeRef)){ki(Ci(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function ki(e){e.dispatchEvent(new CustomEvent(pi,{bubbles:!0,cancelable:!0}))&&Y(e)}function X(e,t,n){let r=t?.tabbable?fn:dn,i=M(e?.nodeType===Node.ELEMENT_NODE?e:null),a=dt(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return t!=null&&t.from?.contains(e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!vi(e)||a.currentNode.tagName===`INPUT`&&a.currentNode.type===`radio`&&a.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||q(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}var Ai=class e{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 ji({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&&q(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}constructor(){this.fastMap=new Map,this.root=new ji({scopeRef:null}),this.fastMap.set(null,this.root)}},ji=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}};let Z=new Ai;function Mi(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||Ur()}),[a,s]=f(!1),[c,l]=f(()=>i.current.isFocused&&i.current.isFocusVisible),u=o(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),p=o(e=>{i.current.isFocused=e,s(e),u()},[u]);Jr(e=>{i.current.isFocusVisible=e,u()},[],{isTextInput:n});let{focusProps:m}=Xr({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=ri({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}const Q=[];function Ni(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e;c(()=>{if(i&&!Q.includes(t))return Q.push(t),()=>{let e=Q.indexOf(t);e>=0&&Q.splice(e,1)}},[i,t]);let l=()=>{Q[Q.length-1]===t&&n&&n()},u=e=>{(!s||s(e.target))&&Q[Q.length-1]===t&&(e.stopPropagation(),e.preventDefault())},d=e=>{(!s||s(e.target))&&(Q[Q.length-1]===t&&(e.stopPropagation(),e.preventDefault()),l())},f=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};ui({ref:t,onInteractOutside:a&&i?d:void 0,onInteractOutsideStart:u});let{focusWithinProps:p}=ri({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||xi(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}}),m=e=>{e.target===e.currentTarget&&e.preventDefault()};return{overlayProps:{onKeyDown:f,...p},underlayProps:{onPointerDown:m}}}const Pi=typeof document<`u`&&window.visualViewport;let Fi=0,Ii;function Li(e={}){let{isDisabled:t}=e;j(()=>{if(!t)return Fi++,Fi===1&&(Ii=At()?zi():Ri()),()=>{Fi--,Fi===0&&Ii()}},[t])}function Ri(){let e=window.innerWidth-document.documentElement.clientWidth;return ot(e>0&&(`scrollbarGutter`in document.documentElement.style?Bi(document.documentElement,`scrollbarGutter`,`stable`):Bi(document.documentElement,`paddingRight`,`${e}px`)),Bi(document.documentElement,`overflow`,`hidden`))}function zi(){let e,t=!1,n=n=>{let r=n.target;e=Gt(r)?r:Kt(r,!0),t=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(t=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(t=!0)},r=document.createElement(`style`);r.textContent=`@layer {
7
+ `.trim(),e.head.prepend(t)},[_]),f(()=>{let e=x.current;return()=>{m||Sr(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[m]),{isPressed:c||y,pressProps:R(v,ne,{[Or]:!0})}}function Ar(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function jr(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof N(i).HTMLInputElement&&!Ir(i,n)||i instanceof N(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Ar(i))&&n!==`Enter`)}function Mr(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 Nr(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Ar(e)}function Pr(e,t){return e instanceof HTMLInputElement?!Ir(e,t):Nr(e)}const Fr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Ir(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Fr.has(e.type)}let Lr=null;const Rr=new Set;let zr=new Map,Br=!1,Vr=!1;const Hr={Tab:!0,Escape:!0};function Ur(e,t){for(let n of Rr)n(e,t)}function Wr(e){return!(e.metaKey||!rt()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Gr(e){Br=!0,!gt.isOpening&&Wr(e)&&(Lr=`keyboard`,Ur(`keyboard`,e))}function Kr(e){Lr=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(Br=!0,Ur(`pointer`,e))}function qr(e){!gt.isOpening&&fn(e)&&(Br=!0,Lr=`virtual`)}function Jr(e){let t=N(L(e)),n=M(L(e));L(e)===t||L(e)===n||gr||!e.isTrusted||(!Br&&!Vr&&(Lr=`virtual`,Ur(`virtual`,e)),Br=!1,Vr=!1)}function Yr(){gr||(Br=!1,Vr=!0)}function Xr(e){if(typeof window>`u`||typeof document>`u`)return;let t=N(e),n=M(e);if(zr.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Br=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Gr,!0),n.addEventListener(`keyup`,Gr,!0),n.addEventListener(`click`,qr,!0),t.addEventListener(`focus`,Jr,!0),t.addEventListener(`blur`,Yr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Kr,!0),n.addEventListener(`pointermove`,Kr,!0),n.addEventListener(`pointerup`,Kr,!0)),t.addEventListener(`beforeunload`,()=>{Zr(e)},{once:!0}),zr.set(t,{focus:r})}const Zr=(e,t)=>{let n=N(e),r=M(e);t&&r.removeEventListener(`DOMContentLoaded`,t),zr.has(n)&&(n.HTMLElement.prototype.focus=zr.get(n).focus,r.removeEventListener(`keydown`,Gr,!0),r.removeEventListener(`keyup`,Gr,!0),r.removeEventListener(`click`,qr,!0),n.removeEventListener(`focus`,Jr,!0),n.removeEventListener(`blur`,Yr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Kr,!0),r.removeEventListener(`pointermove`,Kr,!0),r.removeEventListener(`pointerup`,Kr,!0)),zr.delete(n))};function Qr(e){let t=M(e),n;return t.readyState===`loading`?(n=()=>{Xr(e)},t.addEventListener(`DOMContentLoaded`,n)):Xr(e),()=>Zr(e,n)}typeof document<`u`&&Qr();function $r(){return Lr!==`pointer`}function ei(){return Lr}function ti(e){Lr=e,Ur(e,null)}const ni=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ri(e,t,n){let r=n?L(n):void 0,i=M(r),a=N(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=I(i);return e=e||u instanceof o&&!ni.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!Hr[n.key])}function ii(e,t,n){Xr(),f(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{ri(!!n?.isTextInput,t,r)&&e($r())};return Rr.add(t),()=>{Rr.delete(t)}},t)}function ai(e){if(!e.isConnected)return;let t=M(e);if(ei()===`virtual`){let n=I(t);$t(()=>{let r=I(t);(r===n||r===t.body)&&e.isConnected&&dt(e)})}else dt(e)}const oi=a.createContext(null),si=`react-aria-focus-scope-restore`;let q=null;function ci(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=h(null),s=h(null),c=h([]),{parentNode:l}=d(oi)||{},u=p(()=>new Ei({scopeRef:c}),[c]);j(()=>{let e=l||Q.root;if(Q.getTreeNode(e.scopeRef)&&q&&!_i(q,e.scopeRef)){let t=Q.getTreeNode(q);t&&(e=t)}e.addChild(u),Q.addNode(u)},[u,l]),j(()=>{let e=Q.getTreeNode(c);e&&(e.contain=!!n)},[n]),j(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(si,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(si,n)}},[t]),xi(c,r,n),mi(c,n),Ci(c,r,n),bi(c,i),f(()=>{let e=I(M(c.current?c.current[0]:void 0)),t=null;if(J(e,c.current)){for(let n of Q.traverse())n.scopeRef&&J(e,n.scopeRef.current)&&(t=n);t===Q.getTreeNode(c)&&(q=t.scopeRef)}},[c]),j(()=>()=>{let e=Q.getTreeNode(c)?.parent?.scopeRef??null;(c===q||_i(c,q))&&(!e||Q.getTreeNode(e))&&(q=e),Q.removeTreeNode(c)},[c]);let m=p(()=>li(c),[]),g=p(()=>({focusManager:m,parentNode:u}),[u,m]);return a.createElement(oi.Provider,{value:g},a.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,a.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function li(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||I(M(n[0]??void 0)),c=n[0].previousElementSibling,l=Z(ui(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&X(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||I(M(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=Z(ui(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&X(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Z(ui(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&X(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Z(ui(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&X(o,!0),o}}}function ui(e){return e[0].parentElement}function di(e){let t=Q.getTreeNode(q);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function fi(e){if(!e.form)return Array.from(M(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=N(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function pi(e){if(e.checked)return!0;let t=fi(e);return t.length>0&&!t.some(e=>e.checked)}function mi(e,t){let n=h(void 0),r=h(void 0);j(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=M(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!di(e)||t.isComposing)return;let n=I(a),r=e.current;if(!r||!J(n,r))return;let i=Z(ui(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&(X(o,!0),o instanceof N(o).HTMLInputElement&&o.select())},s=t=>{(!q||_i(q,e))&&J(L(t),e.current)?(q=e,n.current=L(t)):di(e)&&!Y(L(t),e)?n.current?n.current.focus():q&&q.current&&yi(q.current):di(e)&&(n.current=L(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ei(),i=(r===`virtual`||r===null)&&lt()&&ct(),o=I(a);if(!i&&o&&di(e)&&!Y(o,e)){q=e;let r=L(t);r&&r.isConnected?(n.current=r,n.current?.focus()):q.current&&yi(q.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),j(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function hi(e){return Y(e)}function J(e,t){return!e||!t?!1:t.some(t=>F(t,e))}function Y(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of Q.traverse(Q.getTreeNode(t)))if(n&&J(e,n.current))return!0;return!1}function gi(e){return Y(e,q)}function _i(e,t){let n=Q.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function X(e,t=!1){if(e!=null&&!t)try{ai(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function vi(e,t=!0){let n=e[0].previousElementSibling,r=ui(e),i=Z(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=ui(e),i=Z(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function yi(e,t=!0){X(vi(e,t))}function bi(e,t){let n=a.useRef(t);f(()=>{n.current&&(q=e,!J(I(M(e.current?e.current[0]:void 0)),q.current)&&e.current&&yi(e.current)),n.current=!1},[e])}function xi(e,t,n){j(()=>{if(t||n)return;let r=e.current,i=M(r?r[0]:void 0),a=t=>{let n=L(t);J(n,e.current)?q=e:hi(n)||(q=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function Si(e){let t=Q.getTreeNode(q);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Ci(e,t,n){let r=h(typeof document<`u`?I(M(e.current?e.current[0]:void 0)):null);j(()=>{let r=e.current,i=M(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!q||_i(q,e))&&J(I(i),e.current)&&(q=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),j(()=>{let r=M(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!di(e)||t.isComposing)return;let n=r.activeElement;if(!Y(n,e)||!Si(e))return;let i=Q.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=Z(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||!Y(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(Y(s,e));t.preventDefault(),t.stopPropagation(),s?X(s,!0):hi(a)?X(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),j(()=>{let n=M(e.current?e.current[0]:void 0);if(!t)return;let i=Q.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=Q.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=I(n);if(t&&i&&(a&&Y(a,e)||a===n.body&&Si(e))){let t=Q.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){wi(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Q.getTreeNode(n.scopeRef)){wi(vi(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function wi(e){e.dispatchEvent(new CustomEvent(si,{bubbles:!0,cancelable:!0}))&&X(e)}function Z(e,t,n){let r=t?.tabbable?En:Tn,i=M(e?.nodeType===Node.ELEMENT_NODE?e:null),a=Vt(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return F(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!pi(e)||a.currentNode.tagName===`INPUT`&&a.currentNode.type===`radio`&&a.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||J(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}var Ti=class e{constructor(){this.fastMap=new Map,this.root=new Ei({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 Ei({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&&J(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}},Ei=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let Q=new Ti;function Di(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=Nt(t);let o=Nt(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=tn({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Oi(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Di(e),s=Ft([!!t,!!n,r,i]),c=Ft([!!t,!!n,r,i]);return o=R(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function ki(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=u(e=>{if(L(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),o=hr(a),s=u(e=>{let t=L(e),r=M(t),a=r?I(r):I();t===e.currentTarget&&t===a&&(n&&n(e),i&&i(!0),o(e))},[i,n,o]);return{focusProps:{onFocus:!t&&(n||i||r)?s:void 0,onBlur:!t&&(r||i)?a:void 0}}}function Ai(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function ji(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Ai(e.onKeyDown),onKeyUp:Ai(e.onKeyUp)}}}let Mi=a.createContext(null);function Ni(e){let t=d(Mi)||{};an(t,e);let{ref:n,...r}=t;return r}function Pi(e,t){let{focusProps:n}=ki(e),{keyboardProps:r}=ji(e),i=R(n,r),a=Ni(t),o=e.isDisabled?{}:a,s=h(e.autoFocus);f(()=>{s.current&&t.current&&ai(t.current),s.current=!1},[t]);let c=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(c=void 0),{focusableProps:R({...i,tabIndex:c},o)}}function Fi(e,t,n){let{validationBehavior:r,focus:i}=e;j(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Li(n.current))}});let a=h(!1),o=V(()=>{a.current||t.resetValidation()}),s=V(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ri(r)===n.current&&(i?i():n.current?.focus(),ti(`keyboard`)),e.preventDefault()}),c=V(()=>{t.commitValidation()});f(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&L(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,c),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,c),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function Ii(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 Li(e){return{isInvalid:!e.validity.valid,validationDetails:Ii(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Ri(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}const zi=typeof document<`u`?a.useInsertionEffect??a.useLayoutEffect:()=>{};function Bi(e,t,n){let[r,i]=g(e||t),a=h(r),o=h(e!==void 0),s=e!==void 0;f(()=>{o.current,o.current=s},[s]);let c=s?e:r;zi(()=>{a.current=c});let[,l]=m(()=>({}),{});return[c,u((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 Vi={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Hi={...Vi,customError:!0,valid:!1},Ui={isInvalid:!1,validationDetails:Vi,validationErrors:[]},Wi=s({}),Gi=`__reactAriaFormValidationState`;function Ki(e){if(e[Gi]){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Gi];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return qi(e)}function qi(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:Hi},l=p(()=>!o||i==null?null:Xi(Yi(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=d(Wi),m=p(()=>r?Array.isArray(r)?r.flatMap(e=>Ji(u[e])):Ji(u[r]):[],[u,r]),[_,v]=g(u),[y,b]=g(!1);u!==_&&(v(u),b(!1));let x=p(()=>Xi(y?[]:m),[y,m]),S=h(Ui),[C,w]=g(Ui),T=h(Ui),E=()=>{if(!D)return;O(!1);let e=l||a||S.current;Zi(e,T.current)||(T.current=e,w(e))},[D,O]=g(!1);return f(E),{realtimeValidation:c||x||l||a||Ui,displayValidation:s===`native`?c||x||C:c||x||l||a||C,updateValidation(e){s===`aria`&&!Zi(C,e)?w(e):S.current=e},resetValidation(){let e=Ui;Zi(e,T.current)||(T.current=e,w(e)),s===`native`&&O(!1),b(!0)},commitValidation(){s===`native`&&O(!0),b(!0)}}}function Ji(e){return e?Array.isArray(e)?e:[e]:[]}function Yi(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Ji(n)}return[]}function Xi(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Hi}:null}function Zi(e,t){return e===t?!0:!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Qi(...e){let t=new Set,n=!1,r={...Vi};for(let i of e){for(let e of i.validationErrors)t.add(e);for(let e in n||=i.isInvalid,r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function $i(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=Bi(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=Pi(e,t),f=Ki({...e,value:l}),{isInvalid:p,validationErrors:m,validationDetails:h}=f.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Oi({...e,isInvalid:p,errorMessage:e.errorMessage||m}),x=z(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=g(l);return mn(t,e.defaultValue??C,u),Fi(e,f,t),{labelProps:_,inputProps:R(x,n===`input`?S:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":p||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:l,onChange:e=>u(L(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(a.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,...v}),descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:h}}function ea(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=h({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=en(),c=u(e=>{F(e.currentTarget,L(e))&&a.current.isFocusWithin&&!F(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,s(),n&&n(e),i&&i(!1))},[n,i,a,s]),l=hr(c),d=u(e=>{if(!F(e.currentTarget,L(e)))return;let t=L(e),n=M(t),s=I(n);if(!a.current.isFocusWithin&&s===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,l(e);let t=e.currentTarget;o(n,`focus`,e=>{let r=L(e);if(a.current.isFocusWithin&&!F(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});mr(e,t),c(pr(e))}},{capture:!0})}},[r,i,l,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:c}}}function ta(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=h({isFocused:!1,isFocusVisible:t||$r()}),[a,o]=g(!1),[s,c]=g(()=>i.current.isFocused&&i.current.isFocusVisible),l=u(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),d=u(e=>{i.current.isFocused=e,i.current.isFocusVisible=$r(),o(e),l()},[l]);ii(e=>{i.current.isFocusVisible=e,l()},[n,a],{enabled:a,isTextInput:n});let{focusProps:f}=ki({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=ea({isDisabled:!r,onFocusWithinChange:d});return{isFocused:a,isFocusVisible:s,focusProps:r?p:f}}function na({children:e}){let t=p(()=>({register:()=>{}}),[]);return a.createElement(Cr.Provider,{value:t},e)}let ra=!1,ia=0;function aa(){ra=!0,setTimeout(()=>{ra=!1},500)}function oa(e){e.pointerType===`touch`&&aa()}function sa(){let e=M(null);if(e!==void 0)return ia===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,oa),ia++,()=>{ia--,!(ia>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,oa)}}function ca(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=g(!1),s=h({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;f(sa,[]);let{addGlobalListener:c,removeAllGlobalListeners:l}=en(),{hoverProps:u,triggerHoverEnd:d}=p(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!F(e.currentTarget,L(e)))return;s.isHovered=!0;let l=e.currentTarget;s.target=l,c(M(L(e)),`pointerover`,e=>{s.isHovered&&s.target&&!F(s.target,L(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:l,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,!(t===`touch`||!s.isHovered||!i)&&(s.isHovered=!1,l(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},u={};return typeof PointerEvent<`u`&&(u.onPointerEnter=t=>{ra&&t.pointerType===`mouse`||e(t,t.pointerType)},u.onPointerLeave=e=>{!i&&F(e.currentTarget,L(e))&&a(e,e.pointerType)}),{hoverProps:u,triggerHoverEnd:a}},[t,n,r,i,s,c,l]);return f(()=>{i&&d({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:u,isHovered:a}}function la(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=h({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=V(e=>{n&&ua(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=V(e=>{n&&n(e)});f(()=>{let e=a.current;if(r)return;let n=t.current,i=M(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&ua(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 ua(e,t){if(e.button>0)return!1;let n=L(e);if(n){let e=n.ownerDocument;if(!e||!F(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}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 da=s(!1);function fa(e){let t=(t,n)=>d(da)?null:e(t,n);return t.displayName=e.displayName||e.name,c(t)}function pa(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}=kr({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Pi(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=R(y,_,z(e,{labelable:!0}));return{isPressed:v,buttonProps:R(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`]})}}function ma(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:a,name:o,form:s,children:c,"aria-label":l,"aria-labelledby":u,validationState:d=`valid`,isInvalid:f,onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v}=e,y=e=>{e.stopPropagation(),t.setSelected(L(e).checked)},{pressProps:b,isPressed:x}=kr({onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v,isDisabled:r}),{pressProps:S,isPressed:C}=kr({onPressStart:p,onPressEnd:m,onPressChange:h,onPressUp:_,onClick:v,onPress(e){g?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:w}=Pi(e,n),T=R(b,w),E=z(e,{labelable:!0});return mn(n,t.defaultSelected,t.setSelected),{labelProps:R(S,{onClick:e=>e.preventDefault()}),inputProps:R(E,{"aria-invalid":f||d===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:y,disabled:r,...a==null?{}:{value:a},name:o,form:s,type:`checkbox`,...T}),isSelected:t.isSelected,isPressed:x||C,isDisabled:r,isReadOnly:i,isInvalid:f||d===`invalid`}}function ha(e,t,n){let r=Ki({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:u,isDisabled:d,isReadOnly:m}=ma({...e,isInvalid:i},t,n);Fi(e,r,n);let{isIndeterminate:h,isRequired:g,validationBehavior:_=`aria`}=e;f(()=>{n.current&&(n.current.indeterminate=!!h)});let{pressProps:v}=kr({isDisabled:d||m,onPress(){let{[Gi]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:R(s,v,p(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":g&&_===`aria`||void 0,required:g&&_===`native`},isSelected:l,isPressed:u,isDisabled:d,isReadOnly:m,isInvalid:i,validationErrors:a,validationDetails:o}}const ga=new WeakMap;function _a(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}=Oi({...e,labelElementType:`span`,isInvalid:o,errorMessage:e.errorMessage||s});ga.set(t,{name:r,form:i,descriptionId:d.id,errorMessageId:f.id,validationBehavior:a});let p=z(e,{labelable:!0}),{focusWithinProps:m}=ea({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:R(p,{role:`group`,"aria-disabled":n||void 0,...u,...m}),labelProps:l,descriptionProps:d,errorMessageProps:f,isInvalid:o,validationErrors:s,validationDetails:c}}function va(e={}){let{isReadOnly:t}=e,[n,r]=Bi(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=g(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function ya(e,t,n){let r=va({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}=ga.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=Ki({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=h(Ui),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};f(d);let p=t.realtimeValidation.isInvalid?t.realtimeValidation:l,m=c===`native`?t.displayValidation:p,g=ha({...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,[Gi]:{realtimeValidation:p,displayValidation:m,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...g,inputProps:{...g.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const ba={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 xa(e={}){let{style:t,isFocusable:n}=e,[r,i]=g(!1),{focusWithinProps:a}=ea({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=p(()=>r?t:t?{...ba,...t}:ba,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Sa(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...o}=e,{visuallyHiddenProps:s}=xa(e);return a.createElement(n,R(o,s),t)}const Ca=s({});function wa(){return d(Ca)??{}}const Ta=a.createContext(null);function Ea(e){let t=Ot(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[i,o]=g(!1),s=p(()=>({contain:i,setContain:o}),[i,o]),{getContainer:c}=wa();if(!e.portalContainer&&c&&(n=c()),!n)return null;let l=e.children;return e.disableFocusManagement||(l=a.createElement(ci,{restoreFocus:!0,contain:(e.shouldContainFocus||i)&&!r},l)),l=a.createElement(Ta.Provider,{value:s},a.createElement(na,null,l)),E.createPortal(l,n)}function Da(){let e=d(Ta)?.setContain;j(()=>{e?.(!0)},[e])}function Oa(e,t){let{role:n=`dialog`}=e,r=Ft();r=e[`aria-label`]?void 0:r;let i=h(!1);return f(()=>{if(t.current&&!zt(t.current)){ai(t.current);let e=setTimeout(()=>{(I()===t.current||I()===document.body)&&(i.current=!0,t.current&&(t.current.blur(),ai(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Da(),h(!1),f(()=>{}),{dialogProps:{...z(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}var ka={};ka={dismiss:`تجاهل`};var Aa={};Aa={dismiss:`Отхвърляне`};var ja={};ja={dismiss:`Odstranit`};var Ma={};Ma={dismiss:`Luk`};var Na={};Na={dismiss:`Schließen`};var Pa={};Pa={dismiss:`Απόρριψη`};var Fa={};Fa={dismiss:`Dismiss`};var Ia={};Ia={dismiss:`Descartar`};var La={};La={dismiss:`Lõpeta`};var Ra={};Ra={dismiss:`Hylkää`};var za={};za={dismiss:`Rejeter`};var Ba={};Ba={dismiss:`התעלם`};var Va={};Va={dismiss:`Odbaci`};var Ha={};Ha={dismiss:`Elutasítás`};var Ua={};Ua={dismiss:`Ignora`};var Wa={};Wa={dismiss:`閉じる`};var Ga={};Ga={dismiss:`무시`};var Ka={};Ka={dismiss:`Atmesti`};var qa={};qa={dismiss:`Nerādīt`};var Ja={};Ja={dismiss:`Lukk`};var Ya={};Ya={dismiss:`Negeren`};var Xa={};Xa={dismiss:`Zignoruj`};var Za={};Za={dismiss:`Descartar`};var Qa={};Qa={dismiss:`Dispensar`};var $a={};$a={dismiss:`Revocare`};var eo={};eo={dismiss:`Пропустить`};var to={};to={dismiss:`Zrušiť`};var no={};no={dismiss:`Opusti`};var ro={};ro={dismiss:`Odbaci`};var io={};io={dismiss:`Avvisa`};var ao={};ao={dismiss:`Kapat`};var oo={};oo={dismiss:`Скасувати`};var so={};so={dismiss:`取消`};var co={};co={dismiss:`關閉`};var lo={};lo={"ar-AE":ka,"bg-BG":Aa,"cs-CZ":ja,"da-DK":Ma,"de-DE":Na,"el-GR":Pa,"en-US":Fa,"es-ES":Ia,"et-EE":La,"fi-FI":Ra,"fr-FR":za,"he-IL":Ba,"hr-HR":Va,"hu-HU":Ha,"it-IT":Ua,"ja-JP":Wa,"ko-KR":Ga,"lt-LT":Ka,"lv-LV":qa,"nb-NO":Ja,"nl-NL":Ya,"pl-PL":Xa,"pt-BR":Za,"pt-PT":Qa,"ro-RO":$a,"ru-RU":eo,"sk-SK":to,"sl-SI":no,"sr-SP":ro,"sv-SE":io,"tr-TR":ao,"uk-UA":oo,"zh-CN":so,"zh-TW":co};function uo(e){return e&&e.__esModule?e.default:e}function fo(e){let{onDismiss:t,...n}=e,r=tn(n,fr(uo(lo),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return a.createElement(Sa,null,a.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const $=[];function po(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=h(void 0);f(()=>{if(i&&!$.includes(t))return $.push(t),()=>{let e=$.indexOf(t);e>=0&&$.splice(e,1)}},[i,t]);let l=()=>{$[$.length-1]===t&&n&&n()},u=e=>{let n=$[$.length-1];c.current=n,(!s||s(L(e)))&&n===t&&e.stopPropagation()},d=e=>{(!s||s(L(e)))&&($[$.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},p=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};la({ref:t,onInteractOutside:a&&i?d:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=ea({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||gi(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const mo=typeof document<`u`&&window.visualViewport;let ho=0,go;function _o(e={}){let{isDisabled:t}=e;j(()=>{if(!t)return ho++,ho===1&&(go=ot()?yo():vo()),()=>{ho--,ho===0&&go()}},[t])}function vo(){let e=window.innerWidth-document.documentElement.clientWidth;return It(e>0&&(`scrollbarGutter`in document.documentElement.style?bo(document.documentElement,`scrollbarGutter`,`stable`):bo(document.documentElement,`paddingRight`,`${e}px`)),bo(document.documentElement,`overflow`,`hidden`))}function yo(){let e=bo(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=L(e);t=on(r)?r:sn(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=An();a&&(i.nonce=a),i.textContent=`@layer {
8
8
  * {
9
9
  overscroll-behavior: contain;
10
10
  }
11
- }`,document.head.prepend(r);let i=n=>{if(!(n.touches.length===2||t)){if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&n.preventDefault()}},a=e=>{let t=e.target,n=e.relatedTarget;n&&Jt(n)?(n.focus({preventScroll:!0}),Hi(n,Jt(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},o=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=document.activeElement!=null&&Jt(document.activeElement);o.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Hi(this,t)};let s=ot(Vi(document,`touchstart`,n,{passive:!1,capture:!0}),Vi(document,`touchmove`,i,{passive:!1,capture:!0}),Vi(document,`blur`,a,!0));return()=>{s(),r.remove(),HTMLElement.prototype.focus=o}}function Bi(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Vi(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Hi(e,t){t||!Pi?Ui(e):Pi.addEventListener(`resize`,()=>Ui(e),{once:!0})}function Ui(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Kt(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;Pi&&(n=Math.min(n,Pi.offsetTop+Pi.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}}const Wi=i({});function Gi(){return s(Wi)??{}}var Ki={};Ki={dismiss:`تجاهل`};var qi={};qi={dismiss:`Отхвърляне`};var Ji={};Ji={dismiss:`Odstranit`};var Yi={};Yi={dismiss:`Luk`};var Xi={};Xi={dismiss:`Schließen`};var Zi={};Zi={dismiss:`Απόρριψη`};var Qi={};Qi={dismiss:`Dismiss`};var $i={};$i={dismiss:`Descartar`};var ea={};ea={dismiss:`Lõpeta`};var ta={};ta={dismiss:`Hylkää`};var na={};na={dismiss:`Rejeter`};var ra={};ra={dismiss:`התעלם`};var ia={};ia={dismiss:`Odbaci`};var aa={};aa={dismiss:`Elutasítás`};var oa={};oa={dismiss:`Ignora`};var sa={};sa={dismiss:`閉じる`};var ca={};ca={dismiss:`무시`};var la={};la={dismiss:`Atmesti`};var ua={};ua={dismiss:`Nerādīt`};var da={};da={dismiss:`Lukk`};var fa={};fa={dismiss:`Negeren`};var pa={};pa={dismiss:`Zignoruj`};var ma={};ma={dismiss:`Descartar`};var ha={};ha={dismiss:`Dispensar`};var ga={};ga={dismiss:`Revocare`};var _a={};_a={dismiss:`Пропустить`};var va={};va={dismiss:`Zrušiť`};var ya={};ya={dismiss:`Opusti`};var ba={};ba={dismiss:`Odbaci`};var xa={};xa={dismiss:`Avvisa`};var Sa={};Sa={dismiss:`Kapat`};var Ca={};Ca={dismiss:`Скасувати`};var wa={};wa={dismiss:`取消`};var Ta={};Ta={dismiss:`關閉`};var Ea={};Ea={"ar-AE":Ki,"bg-BG":qi,"cs-CZ":Ji,"da-DK":Yi,"de-DE":Xi,"el-GR":Zi,"en-US":Qi,"es-ES":$i,"et-EE":ea,"fi-FI":ta,"fr-FR":na,"he-IL":ra,"hr-HR":ia,"hu-HU":aa,"it-IT":oa,"ja-JP":sa,"ko-KR":ca,"lt-LT":la,"lv-LV":ua,"nb-NO":da,"nl-NL":fa,"pl-PL":pa,"pt-BR":ma,"pt-PT":ha,"ro-RO":ga,"ru-RU":_a,"sk-SK":va,"sl-SI":ya,"sr-SP":ba,"sv-SE":xa,"tr-TR":Sa,"uk-UA":Ca,"zh-CN":wa,"zh-TW":Ta};const Da={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 Oa(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=ri({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Da,...t}:Da,[r]);return{visuallyHiddenProps:{...a,style:o}}}function ka(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Oa(e);return r.createElement(n,L(o,s),t)}function Aa(e){return e&&e.__esModule?e.default:e}function ja(e){let{onDismiss:t,...n}=e,i=Vt(n,Yn(Aa(Ea),`@react-aria/overlays`).format(`dismiss`)),a=()=>{t&&t()};return r.createElement(ka,null,r.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}const Ma=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;let Na=new WeakMap,$=[];function Pa(e,t){let n=N(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&Ma,o=new Set(e),s=new Set,c=e=>a&&e instanceof n.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,l=(e,t)=>{a&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof n.HTMLElement&&(e.inert=!1))},u=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))o.add(t);let t=e=>{if(s.has(e)||o.has(e)||e.parentElement&&s.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of o)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&d(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)d(e),e=n.nextNode()}},d=e=>{let t=Na.get(e)??0;c(e)&&t===0||(t===0&&l(e,!0),s.add(e),Na.set(e,t+1))};$.length&&$[$.length-1].disconnect(),u(i);let f=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`&&![...o,...s].some(e=>e.contains(t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&(e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer===`true`)?o.add(e):e instanceof Element&&u(e)});f.observe(i,{childList:!0,subtree:!0});let p={visibleNodes:o,hiddenNodes:s,observe(){f.observe(i,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}};return $.push(p),()=>{f.disconnect();for(let e of s){let t=Na.get(e);t!=null&&(t===1?(l(e,!1),Na.delete(e)):Na.set(e,t-1))}p===$[$.length-1]?($.pop(),$.length&&$[$.length-1].observe()):$.splice($.indexOf(p),1)}}const Fa=r.createContext(null);function Ia(e){let t=$e(),{portalContainer:n=t?null:document.body,isExiting:i}=e,[a,o]=f(!1),s=l(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Gi();if(!e.portalContainer&&c&&(n=c()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=r.createElement(mi,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},u)),u=r.createElement(Fa.Provider,{value:s},r.createElement(ni,null,u)),S.createPortal(u,n)}function La(){let e=s(Fa)?.setContain;j(()=>{e?.(!0)},[e])}function Ra(e,t,n){let{overlayProps:r,underlayProps:i}=Ni({...e,isOpen:t.isOpen,onClose:t.close},n);return Li({isDisabled:!t.isOpen}),La(),c(()=>{if(t.isOpen&&n.current)return Pa([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:L(r),underlayProps:i}}function za(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=rt(t);let o=rt(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=Vt({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Ba(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=za(e),s=at([!!t,!!n,r,i]),c=at([!!t,!!n,r,i]);return o=L(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}const Va={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Ha={...Va,customError:!0,valid:!1},Ua={isInvalid:!1,validationDetails:Va,validationErrors:[]},Wa=i({}),Ga=`__formValidationState`+Date.now();function Ka(e){if(e[Ga]){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Ga];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return qa(e)}function qa(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:u=`aria`}=e;n&&(t||=n===`invalid`);let p=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Ha},m=l(()=>!o||i==null?null:Xa(Ya(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let h=s(Wa),g=l(()=>r?Array.isArray(r)?r.flatMap(e=>Ja(h[e])):Ja(h[r]):[],[h,r]),[_,v]=f(h),[y,b]=f(!1);h!==_&&(v(h),b(!1));let x=l(()=>Xa(y?[]:g),[y,g]),S=d(Ua),[C,w]=f(Ua),T=d(Ua),E=()=>{if(!D)return;O(!1);let e=m||a||S.current;Za(e,T.current)||(T.current=e,w(e))},[D,O]=f(!1);return c(E),{realtimeValidation:p||x||m||a||Ua,displayValidation:u===`native`?p||x||C:p||x||m||a||C,updateValidation(e){u===`aria`&&!Za(C,e)?w(e):S.current=e},resetValidation(){let e=Ua;Za(e,T.current)||(T.current=e,w(e)),u===`native`&&O(!1),b(!0)},commitValidation(){u===`native`&&O(!0),b(!0)}}}function Ja(e){return e?Array.isArray(e)?e:[e]:[]}function Ya(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Ja(n)}return[]}function Xa(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Ha}:null}function Za(e,t){return e===t?!0:!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Qa(...e){let t=new Set,n=!1,r={...Va};for(let o of e){var i,a;for(let e of o.validationErrors)t.add(e);for(let e in n||=o.isInvalid,r)(i=r)[a=e]||(i[a]=o.validationDetails[e])}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function $a(e,t,n){let{validationBehavior:r,focus:i}=e;j(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(to(n.current))}});let a=d(!1),o=V(()=>{a.current||t.resetValidation()}),s=V(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;if(!e.defaultPrevented&&n&&r&&no(r)===n.current){var a;i?i():(a=n.current)==null||a.focus(),Gr(`keyboard`)}e.preventDefault()}),l=V(()=>{t.commitValidation()});c(()=>{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`&&window.event.target instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function eo(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 to(e){return{isInvalid:!e.validity.valid,validationDetails:eo(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function no(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(!n.validity.valid)return n}return null}function ro(e,t){let{inputElementType:n=`input`,isDisabled:i=!1,isRequired:a=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=hn(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=ti(e,t),p=Ka({...e,value:l}),{isInvalid:m,validationErrors:h,validationDetails:g}=p.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Ba({...e,isInvalid:m,errorMessage:e.errorMessage||h}),x=R(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=f(l);return $t(t,e.defaultValue??C,u),$a(e,p,t),{labelProps:_,inputProps:L(x,n===`input`?S:void 0,{disabled:i,readOnly:o,required:a&&c===`native`,"aria-required":a&&c===`aria`||void 0,"aria-invalid":m||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:l,onChange:e=>u(e.target.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(r.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,...v}),descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}if(typeof HTMLTemplateElement<`u`){let e=Object.getOwnPropertyDescriptor(Node.prototype,`firstChild`).get;Object.defineProperty(HTMLTemplateElement.prototype,`firstChild`,{configurable:!0,enumerable:!0,get:function(){return this.dataset.reactAriaHidden?this.content.firstChild:e.call(this)}})}const io=i(!1);function ao(e){let t=(t,n)=>s(io)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function oo(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}=br({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=ti(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=L(y,_,R(e,{labelable:!0}));return{isPressed:v,buttonProps:L(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`]})}}function so(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:a,name:o,form:s,children:c,"aria-label":l,"aria-labelledby":u,validationState:d=`valid`,isInvalid:f,onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v}=e,y=e=>{e.stopPropagation(),t.setSelected(e.target.checked)},{pressProps:b,isPressed:x}=br({onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v,isDisabled:r}),{pressProps:S,isPressed:C}=br({onPressStart:p,onPressEnd:m,onPressChange:h,onPressUp:_,onClick:v,onPress(e){var r;g?.(e),t.toggle(),(r=n.current)==null||r.focus()},isDisabled:r||i}),{focusableProps:w}=ti(e,n),T=L(b,w),E=R(e,{labelable:!0});return $t(n,t.defaultSelected,t.setSelected),{labelProps:L(S,{onClick:e=>e.preventDefault()}),inputProps:L(E,{"aria-invalid":f||d===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:y,disabled:r,...a==null?{}:{value:a},name:o,form:s,type:`checkbox`,...T}),isSelected:t.isSelected,isPressed:x||C,isDisabled:r,isReadOnly:i,isInvalid:f||d===`invalid`}}function co(e,t,n){let r=Ka({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:u,isSelected:d,isPressed:f,isDisabled:p,isReadOnly:m}=so({...e,isInvalid:i},t,n);$a(e,r,n);let{isIndeterminate:h,isRequired:g,validationBehavior:_=`aria`}=e;c(()=>{n.current&&(n.current.indeterminate=!!h)});let{pressProps:v}=br({isDisabled:p||m,onPress(){let{[Ga]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:L(s,v,l(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...u,checked:d,"aria-required":g&&_===`aria`||void 0,required:g&&_===`native`},isSelected:d,isPressed:f,isDisabled:p,isReadOnly:m,isInvalid:i,validationErrors:a,validationDetails:o}}const lo=new WeakMap;function uo(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}=Ba({...e,labelElementType:`span`,isInvalid:o,errorMessage:e.errorMessage||s});lo.set(t,{name:r,form:i,descriptionId:d.id,errorMessageId:f.id,validationBehavior:a});let p=R(e,{labelable:!0}),{focusWithinProps:m}=ri({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:L(p,{role:`group`,"aria-disabled":n||void 0,...u,...m}),labelProps:l,descriptionProps:d,errorMessageProps:f,isInvalid:o,validationErrors:s,validationDetails:c}}function fo(e={}){let{isReadOnly:t}=e,[n,r]=hn(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=f(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function po(e,t,n){let r=fo({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:l}=lo.get(t);l=e.validationBehavior??l;let{realtimeValidation:u}=Ka({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),f=d(Ua),p=()=>{t.setInvalid(e.value,u.isInvalid?u:f.current)};c(p);let m=t.realtimeValidation.isInvalid?t.realtimeValidation:u,h=l===`native`?t.displayValidation:m,g=co({...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:l,[Ga]:{realtimeValidation:m,displayValidation:h,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){f.current=e,p()}}},r,n);return{...g,inputProps:{...g.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}function mo(e,t){let{role:n=`dialog`}=e,r=at();r=e[`aria-label`]?void 0:r;let i=d(!1);return c(()=>{if(t.current&&!t.current.contains(document.activeElement)){Yr(t.current);let e=setTimeout(()=>{(document.activeElement===t.current||document.activeElement===document.body)&&(i.current=!0,t.current&&(t.current.blur(),Yr(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),La(),{dialogProps:{...R(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}const ho=new WeakMap;function go(e,t,n){let{value:r,children:i,"aria-label":a,"aria-labelledby":o,onPressStart:s,onPressEnd:c,onPressChange:u,onPress:d,onPressUp:f,onClick:p}=e,m=e.isDisabled||t.isDisabled,h=t.selectedValue===r,g=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:_,isPressed:v}=br({onPressStart:s,onPressEnd:c,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=br({onPressStart:s,onPressEnd:c,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){var i;d?.(e),t.setSelectedValue(r),(i=n.current)==null||i.focus()}}),{focusableProps:x}=ti(L(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=L(_,x),C=R(e,{labelable:!0}),w=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(w=0):t.selectedValue===r&&(w=0),m&&(w=void 0);let{name:T,form:E,descriptionId:D,errorMessageId:O,validationBehavior:ee}=ho.get(t);return $t(n,t.defaultSelectedValue,t.setSelectedValue),$a({validationBehavior:ee},t,n),{labelProps:L(y,l(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:L(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&ee===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?O:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function _o(e,t){let{name:n,form:r,isReadOnly:i,isRequired:a,isDisabled:o,orientation:s=`vertical`,validationBehavior:c=`aria`}=e,{direction:l}=In(),{isInvalid:u,validationErrors:d,validationDetails:f}=t.displayValidation,{labelProps:p,fieldProps:m,descriptionProps:h,errorMessageProps:g}=Ba({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||d}),_=R(e,{labelable:!0}),{focusWithinProps:v}=ri({onBlurWithin(n){var r;(r=e.onBlur)==null||r.call(e,n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),y=e=>{let n;switch(e.key){case`ArrowRight`:n=l===`rtl`&&s!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=l===`rtl`&&s!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=X(e.currentTarget,{from:e.target,accept:e=>e instanceof N(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},b=rt(n);return ho.set(t,{name:b,form:r,descriptionId:h.id,errorMessageId:g.id,validationBehavior:c}),{radioGroupProps:L(_,{role:`radiogroup`,onKeyDown:y,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":a||void 0,"aria-disabled":o||void 0,"aria-orientation":s,...m,...v}),labelProps:p,descriptionProps:h,errorMessageProps:g,isInvalid:u,validationErrors:d,validationDetails:f}}const vo=i({}),yo=ao(function(e,t){[e,t]=W(e,t,vo);let{elementType:n=`label`,...i}=e;return r.createElement(n,{className:`react-aria-Label`,...i,ref:t})}),bo=i(null),xo=i({}),So=ao(function(e,t){[e,t]=W(e,t,xo);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=oo(e,t);a=Co(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=Mi(e),{hoverProps:f,isHovered:p}=li({...e,isDisabled:e.isDisabled||i}),m={isHovered:p,isPressed:(n.isPressed||o)&&!i,isFocused:l,isFocusVisible:u,isDisabled:e.isDisabled||!1,isPending:i??!1},h=U({...e,values:m,defaultClassName:`react-aria-Button`}),g=rt(a.id),_=rt(),v=a[`aria-labelledby`];i&&(v?v=`${v} ${_}`:a[`aria-label`]&&(v=`${g} ${_}`));let y=d(i);c(()=>{let e={"aria-labelledby":v||g};(!y.current&&l&&i||y.current&&l&&!i)&&wn(e,`assertive`),y.current=i},[i,l,v,g]);let b=R(e,{global:!0});return delete b.onClick,r.createElement(`button`,{...L(b,h,a,s,f),type:a.type===`submit`&&i?`button`:a.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":i?`true`:a[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":l||void 0,"data-pending":i||void 0,"data-focus-visible":u||void 0},r.createElement(bo.Provider,{value:{id:_}},h.children))});function Co(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!(t.includes(`Focus`)||t.includes(`Blur`))&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}const wo=i({}),To=a(function(e,t){[e,t]=W(e,t,wo);let{elementType:n=`span`,...i}=e;return r.createElement(n,{className:`react-aria-Text`,...i,ref:t})});function Eo(e={}){let[t,n]=hn(e.value,e.defaultValue||[],e.onChange),[r]=f(t),i=!!e.isRequired&&t.length===0,a=d(new Map),o=Ka({...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(Qa(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}function Do(e){let[t,n]=hn(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:o(()=>{n(!0)},[n]),close:o(()=>{n(!1)},[n]),toggle:o(()=>{n(!t)},[n,t])}}let Oo=Math.round(Math.random()*1e10),ko=0;function Ao(e){let t=l(()=>e.name||`radio-group-${Oo}-${++ko}`,[e.name]),[n,r]=hn(e.value,e.defaultValue??null,e.onChange),[i]=f(n),[a,o]=f(null),s=Ka({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},u=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||(u?`invalid`:null),isInvalid:u}}const jo=i(null),Mo=a(function(e,t){return s(jo)?.isInvalid?r.createElement(No,{...e,ref:t}):null}),No=a((e,t)=>{let n=s(jo),i=R(e,{global:!0}),a=U({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return a.children==null?null:r.createElement(To,{slot:`errorMessage`,...i,...a,ref:t})}),Po=i(null),Fo=i(null),Io=i(null),Lo=a(function(e,t){[e,t]=W(e,t,Fo);let{validationBehavior:n}=yn(Po)||{},i=e.validationBehavior??n??`native`,a=Eo({...e,validationBehavior:i}),[o,s]=bn(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=uo({...e,label:s,validationBehavior:i},a),p=U({...e,values:{isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-CheckboxGroup`}),m=R(e,{global:!0});return r.createElement(`div`,{...L(m,p,c),ref:t,slot:e.slot||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},r.createElement(_n,{values:[[Io,a],[vo,{...l,ref:o,elementType:`span`}],[wo,{slots:{description:u,errorMessage:d}}],[jo,f]]},p.children))}),Ro=a(function(e,t){let{inputRef:n=null,...i}=e;[e,t]=W(i,t,Re);let{validationBehavior:a}=yn(Po)||{},o=e.validationBehavior??a??`native`,c=s(Io),u=Ht(l(()=>ft(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:m,isReadOnly:h,isPressed:g,isInvalid:_}=c?po({...xn(e),value:e.value,children:typeof e.children==`function`?!0:e.children},c,u):co({...xn(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},fo(e),u),{isFocused:v,isFocusVisible:y,focusProps:b}=Mi(),x=m||h,{hoverProps:S,isHovered:C}=li({...e,isDisabled:x}),w=U({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:g,isHovered:C,isFocused:v,isFocusVisible:y,isDisabled:m,isReadOnly:h,isInvalid:_,isRequired:e.isRequired||!1}}),T=R(e,{global:!0});return delete T.id,delete T.onClick,r.createElement(`label`,{...L(T,d,S,w),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":g||void 0,"data-hovered":C||void 0,"data-focused":v||void 0,"data-focus-visible":y||void 0,"data-disabled":m||void 0,"data-readonly":h||void 0,"data-invalid":_||void 0,"data-required":e.isRequired||void 0},r.createElement(ka,{elementType:`span`},r.createElement(`input`,{...L(f,b),ref:u})),w.children)}),zo=i({}),Bo=i({});let Vo=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ho=ao(function(e,t){[e,t]=W(e,t,Bo);let{hoverProps:n,isHovered:i}=li({...e,isDisabled:e.disabled}),{isFocused:a,isFocusVisible:o,focusProps:s}=Mi({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=U({...e,values:{isHovered:i,isFocused:a,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-Input`});return r.createElement(`input`,{...L(Vo(e),s,n),...l,ref:t,"data-focused":a||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),Uo=i(null);function Wo(e){let t=d({});return r.createElement(Uo.Provider,{value:t},e.children)}const Go=i({isSelected:!1}),Ko=i(null),qo=i(null),Jo=a(function(e,t){let n=e[`aria-labelledby`];[e,t]=W(e,t,Ko);let{dialogProps:i,titleProps:a}=mo({...e,"aria-labelledby":n},t),o=s(qo);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let c=U({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),l=R(e,{global:!0});return r.createElement(`section`,{...L(l,c,i),ref:t,slot:e.slot||void 0},r.createElement(_n,{values:[[ze,{slots:{[gn]:{},title:{...a,level:2}}}],[xo,{slots:{[gn]:{},close:{onPress:()=>o?.close()}}}]]},c.children))}),Yo=i(null),Xo=i(null),Zo=a(function(e,t){if(s(Xo))return r.createElement(ts,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,children:l,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p,...m}=e;return r.createElement($o,{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},r.createElement(ts,{...m,modalRef:t},l))});function Qo(e,t){[e,t]=W(e,t,Yo);let n=s(qo),i=Do(e),a=e.isOpen!=null||e.defaultOpen!=null||!n?i:n,o=Ht(t),c=d(null),l=tn(o,a.isOpen),u=tn(c,a.isOpen),f=l||u||e.isExiting||!1,p=$e();return!a.isOpen&&!f||p?null:r.createElement(es,{...e,state:a,isExiting:f,overlayRef:o,modalRef:c})}const $o=a(Qo);function es({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Ra(t,i,n),s=en(t.overlayRef)||t.isEntering||!1,c=U({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Yt(),u;if(typeof document<`u`){let e=Gt(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return r.createElement(Ia,{isExiting:t.isExiting,portalContainer:e},r.createElement(`div`,{...L(R(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},r.createElement(_n,{values:[[Xo,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[qo,i]]},c.children)))}function ts(e){let{modalProps:t,modalRef:n,isExiting:i,isDismissable:a}=s(Xo),o=s(qo),c=Ht(l(()=>ft(e.modalRef,n),[e.modalRef,n])),u=en(c),d=U({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:o}});return r.createElement(`div`,{...L(R(e,{global:!0}),t),...d,ref:c,"data-entering":u||void 0,"data-exiting":i||void 0},a&&r.createElement(ja,{onDismiss:o.close}),d.children)}const ns=i(null),rs=i(null),is=i(null),as=a(function(e,t){[e,t]=W(e,t,ns);let{validationBehavior:n}=yn(Po)||{},i=e.validationBehavior??n??`native`,a=Ao({...e,validationBehavior:i}),[o,s]=bn(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=_o({...e,label:s,validationBehavior:i},a),p=U({...e,values:{orientation:e.orientation||`vertical`,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:a.isRequired,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-RadioGroup`}),m=R(e,{global:!0});return r.createElement(`div`,{...L(m,p,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":a.isRequired||void 0},r.createElement(_n,{values:[[is,a],[vo,{...l,ref:o,elementType:`span`}],[wo,{slots:{description:u,errorMessage:d}}],[jo,f]]},r.createElement(Wo,null,p.children)))}),os=a(function(e,t){let{inputRef:n=null,...i}=e;[e,t]=W(i,t,rs);let a=r.useContext(is),o=Ht(l(()=>ft(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:u,isDisabled:d,isPressed:f}=go({...xn(e),children:typeof e.children==`function`?!0:e.children},a,o),{isFocused:p,isFocusVisible:m,focusProps:h}=Mi(),g=d||a.isReadOnly,{hoverProps:_,isHovered:v}=li({...e,isDisabled:g}),y=U({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:u,isPressed:f,isHovered:v,isFocused:p,isFocusVisible:m,isDisabled:d,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isRequired:a.isRequired}}),b=R(e,{global:!0});return delete b.id,delete b.onClick,r.createElement(`label`,{...L(b,s,_,y),ref:t,"data-selected":u||void 0,"data-pressed":f||void 0,"data-hovered":v||void 0,"data-focused":p||void 0,"data-focus-visible":m||void 0,"data-disabled":d||void 0,"data-readonly":a.isReadOnly||void 0,"data-invalid":a.isInvalid||void 0,"data-required":a.isRequired||void 0},r.createElement(ka,{elementType:`span`},r.createElement(`input`,{...L(c,h),ref:o})),r.createElement(Go.Provider,{value:{isSelected:u}},y.children))}),ss=i({});let cs=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const ls=a(function(e,t){[e,t]=W(e,t,ss);let{hoverProps:n,isHovered:i}=li(e),{isFocused:a,isFocusVisible:o,focusProps:s}=Mi({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=U({...e,values:{isHovered:i,isFocused:a,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return r.createElement(`textarea`,{...L(cs(e),s,n),...l,ref:t,"data-focused":a||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),us=i(null),ds=ao(function(e,t){[e,t]=W(e,t,us);let{validationBehavior:n}=yn(Po)||{},i=e.validationBehavior??n??`native`,a=d(null);[e,a]=W(e,a,Be);let[s,c]=bn(!e[`aria-label`]&&!e[`aria-labelledby`]),[l,u]=f(`input`),{labelProps:p,inputProps:m,descriptionProps:h,errorMessageProps:g,..._}=ro({...xn(e),inputElementType:l,label:c,validationBehavior:i},a),v=o(e=>{a.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[a]),y=U({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:_.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=R(e,{global:!0});return delete b.id,r.createElement(`div`,{...b,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":_.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},r.createElement(_n,{values:[[vo,{...p,ref:s}],[Bo,{...m,ref:v}],[ss,{...m,ref:v}],[zo,{role:`presentation`,isInvalid:_.isInvalid,isDisabled:e.isDisabled||!1}],[wo,{slots:{description:h,errorMessage:g}}],[jo,_]]},y.children))}),fs=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=ke();if(!r)return null;let a=t||r.confirmation.description;return b(v,{children:[y(`div`,{className:x(`cf-question`,n?.question),children:b(`div`,{className:x(`cf-header`,n?.header),children:[y(yo,{className:x(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&y(To,{slot:`description`,className:x(`cf-description`,n?.description),children:a})]})}),y(So,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},ps=({className:e,iconClassName:t,onClose:n})=>y(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:y(`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`})})}),ms=({children:e,classNames:t,onDismiss:n,isDismissable:r=!0,closeOnFinishMs:i=3e3})=>{let{survey:a,surveyId:o,dismiss:s}=ke(),[c,l]=f(!1);return h(()=>{a&&s()},c?i:null),y($o,{isOpen:!0,isDismissable:r,isKeyboardDismissDisabled:!r,onOpenChange:async e=>{e||(await s(),n?.())},className:x(`confetti-modal-overlay`,t?.overlay),children:y(Zo,{className:x(`confetti-modal`,t?.modal),children:b(Jo,{"aria-label":`Survey`,id:`${o}-popover`,className:x(`confetti-modal-dialog`,t?.dialog),children:[r&&y(ps,{className:x(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await s(),n?.()}}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})})})},hs=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:i=3e3})=>{let{surveyId:a,survey:o,dismiss:s}=ke(),[c,l]=f(!1);return h(()=>{o&&s()},c?i:null),b(`div`,{className:x(`confetti-dialog`,t?.dialog),id:`${a}-popover`,...n,children:[y(ps,{className:x(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await s(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})},gs=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[l,u]=f(``);return c(()=>{i(l)},[i,l]),b(ds,{isRequired:o,isInvalid:!!s,name:e,className:x(`cf-question`,a?.question),value:l,onChange:e=>{u(e),i(e)},children:[b(`div`,{className:x(`cf-header`,a?.header),children:[b(yo,{className:x(`cf-title`,a?.title),children:[t,!o&&b(`span`,{className:x(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&y(To,{slot:`description`,className:x(`cf-description`,a?.description),children:n})]}),y(ls,{className:x(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),y(Mo,{className:x(`cf-error`,a?.error),children:s})]})},_s=({children:e,classNames:t,description:n,...r})=>y(Ro,{...r,children:({isIndeterminate:r})=>b(v,{children:[b(`div`,{className:x(`cf-choice-label`,t?.label),children:[y(`div`,{className:x(`cf-checkbox-indicator`,t?.indicator),children:y(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:x(`cf-checkbox-indicator-svg`,t?.svg),children:r?y(`rect`,{x:1,y:7.5,width:16,height:3}):y(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&y(`span`,{className:x(`cf-choice-description`,t?.choiceDescription),children:n})]})}),vs=({children:e,classNames:t,...n})=>y(Ro,{...n,children:y(`div`,{className:x(`cf-tag-label`,t?.tagLabel),children:e})}),ys=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let u=!!n.editable,p=n.display??`checkbox`,[m,h]=f([]),[g,_]=f(``),S=d(null),C=d(null),w=l(()=>{let e=m.indexOf(A);if(e===-1)return m;let t=[...m];return t[e]=g||A,t},[g,m]),T=p===`tag`;return c(()=>{i(w)},[i,w]),y(Lo,{isRequired:o,isInvalid:!!s,name:a,value:m,onChange:h,className:x(`cf-question`,r?.question),children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(yo,{className:x(`cf-title`,r?.title),children:[e,!o&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&y(To,{slot:`description`,className:x(`cf-description`,r?.description),children:t})]}),b(`div`,{className:x(`cf-response-choices`,p===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>y(T?vs:_s,{className:x(`cf-choice`,T&&[`cf-tag`,r?.tag],!T&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),u&&(T?b(v,{children:[y(vs,{inputRef:S,onChange:e=>{C.current&&e&&requestAnimationFrame(()=>{C.current&&C.current.focus()})},className:x(`cf-choice cf-tag`,r?.tag),value:A,children:n.editable?.label}),y(Ho,{"data-visible":i.value.includes(A)||void 0,value:g,onChange:e=>{_(e.target.value)},ref:C,className:x(`cf-input cf-tag-input`,r?.othersInput)})]}):b(`div`,{className:x(`cf-choice cf-others-choice`,r?.othersChoice),children:[y(_s,{inputRef:S,onChange:e=>{C.current&&e&&requestAnimationFrame(()=>{C.current&&C.current.focus()})},className:x(`cf-checkbox`,r?.checkbox),value:A,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),y(Ho,{value:g,onChange:e=>{_(e.target.value)},tabIndex:i.value.includes(A)?0:-1,ref:C,onFocus:()=>{S.current?.checked===!1&&S.current.click()},className:x(`cf-input`,r?.othersInput)})]}))]}),y(Mo,{className:x(`cf-error`,r?.error),children:s})]})})},bs=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),xs=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),Ss=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),Cs=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),ws=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),Ts=e=>y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:y(`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`})}),Es=e=>y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:y(`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`})}),Ds=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return y(`div`,{className:x(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return y(os,{className:x(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:y(o?Es:Ts,{})},t)})})},Os=({properties:e,classNames:t})=>y(`div`,{className:x(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return y(os,{className:x(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),ks=({properties:e,classNames:t,state:n})=>{let r=l(()=>[bs,Ss,Cs,ws,xs],[]),i=l(()=>[Ss,Cs,ws],[]);return l(()=>e.scale===3||e.scale===5,[e.scale])?y(`div`,{className:x(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return y(os,{className:x(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&y(c,{})},a)})}):y(Os,{properties:e,classNames:t,state:n})},As=e=>{switch(e.properties.display??`star`){case`emoji`:return y(ks,{...e});case`number`:return y(Os,{...e});case`star`:return y(Ds,{...e})}},js=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[u,d]=f(null),p=l(()=>u?Number(u):void 0,[u]);return c(()=>{i(p)},[i,p]),y(as,{isRequired:s,isInvalid:!!o,name:a,className:x(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(yo,{className:x(`cf-title`,r?.title),children:[t,!s&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&y(To,{slot:`description`,className:x(`cf-description`,r?.description),children:n})]}),b(`div`,{className:x(`cf-rating-section`,r?.ratingSection),children:[y(As,{state:i,properties:e,classNames:r}),b(`div`,{className:x(`cf-rating-text`,r?.ratingText),children:[y(`span`,{className:x(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),y(`span`,{className:x(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),y(Mo,{className:x(`cf-error`,r?.error),children:o})]})})},Ms=({classNames:e,className:t,description:n,...r})=>y(os,{...r,className:x(t,e?.radio),children:vn(r.children,t=>b(v,{children:[b(`div`,{className:x(`cf-choice-label`,e?.label),children:[y(`div`,{className:x(`cf-radio-indicator`,e?.indicator)}),t]}),n&&y(`span`,{className:x(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Ns=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[u,p]=f(null),[m,h]=f(``),g=!!n.editable,_=d(null),S=d(null),C=l(()=>u===he?m||he:u??void 0,[m,u]);return c(()=>{i(C)},[i,C]),y(as,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{p(e),e===he&&requestAnimationFrame(()=>{S.current&&S.current.focus()})},value:u,className:x(`cf-question`,r?.question),children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(yo,{className:x(`cf-title`,r?.title),children:[e,!o&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&y(To,{slot:`description`,className:x(`cf-description`,r?.description),children:t})]}),b(`div`,{className:x(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>y(Ms,{classNames:{indicator:r?.indicator,radio:x(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),g&&b(`div`,{className:x(`cf-choice cf-others-choice`,r?.othersChoice),children:[y(Ms,{inputRef:_,value:he,classNames:{indicator:r?.indicator,radio:x(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),y(Ho,{tabIndex:i.selectedValue===he?0:-1,ref:S,value:m,onChange:e=>h(e.target.value),onFocus:()=>{_.current?.checked===!1&&_.current.click()},className:x(`cf-input`,r?.othersInput)})]})]}),y(Mo,{className:x(`cf-error`,r?.error),children:s})]})})},Ps=({properties:e,title:t,description:n,classNames:r})=>y(`div`,{className:x(`cf-question`,r?.question),children:b(`div`,{className:x(`cf-header`,r?.header),children:[t&&y(`div`,{className:x(`cf-title`,r?.title),children:t}),n&&y(`div`,{className:x(`cf-description`,r?.description),children:n})]})}),Fs=({question:e,onChange:t,error:n})=>{switch(e.properties.type){case`rating`:return y(js,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return y(gs,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return y(Ns,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return y(ys,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return y(Ps,{...e,properties:e.properties,onChange:t,error:n},e.id)}return y(`div`,{children:`Unsupported question type`},e.id)},Is=({onPress:e,isDisabled:t,children:n=`Submit`})=>y(So,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),Ls=e=>{switch(e){case`multi-select`:return[];case`statement`:return;default:return``}},Rs=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),zs=({onSubmit:e,children:n,question:r,isLastQuestion:i})=>{let[a,s]=f(Ls(r.properties.type)),c=l(()=>je(r.properties,{required:r.required}),[r.properties,r.required]),u=l(()=>{let e=c.safeParse(a);if(!e.success)return w(e.error)},[a,c]),d=l(()=>{let e=r.routingLogic;if(e.type!==`always`&&!Rs(a)&&r.required)return!0;let n=e.type===`always`?e.target:e.cases.find(e=>t({answer:a,condition:e}))?.target??e.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),p=l(()=>r.properties.buttonLabel?r.properties.buttonLabel:d?!r.required&&!Rs(a)?`Skip`:`Next`:`Submit`,[a,d,r.properties.buttonLabel,r.required]),m=o(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=ie.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(a)}},[a,e,r.properties]),h=l(()=>{switch(r.properties.type){case`rating`:case`single-select`:return!!r.properties.shouldAutoProgress;default:return!1}},[r.properties]);return b(v,{children:[n({onChange:o(t=>{s(t),h&&Rs(t)&&c.safeParse(t).success&&e(t)},[h,c,e]),question:r,error:u}),(!h||!r.required)&&y(Is,{isDisabled:!!u,onPress:m,children:p})]})},Bs=({isCompleted:e,onSubmit:t,children:n})=>b(v,{children:[n,e&&y(Is,{onPress:t})]}),Vs=e=>y(Le,{...e,shouldAutoSubmit:!1,children:({questions:e,update:t,isCompleted:n,submit:r,isSubmitted:i,errors:a})=>i?y(fs,{}):y(Bs,{onSubmit:r,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>y(Fs,{question:e,error:a[e.id]||``,onChange:n=>t({question:e.position,answer:n})},e.position))})}),Hs=({onDismiss:e,closeOnFinishMs:t,isDismissable:r,...i})=>y(n,{fallback:y(v,{}),children:y(Oe,{...i,children:y(ms,{onDismiss:e,closeOnFinishMs:t,isDismissable:r,children:({setIsFinished:e})=>y(Ie,{...i,shouldAutoSubmit:!1,onFinished:()=>{e(),i.onFinished?.()},children:({questions:e,update:t,isCompleted:n,errors:r,submit:i,isSubmitted:a})=>a?y(fs,{}):y(Bs,{onSubmit:i,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>y(Fs,{question:e,error:r[e.id]||``,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})}),Us=({onDismiss:e,closeOnFinishMs:t,...r})=>y(n,{fallback:y(v,{}),children:y(Oe,{...r,children:y(hs,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>y(Ie,{shouldAutoSubmit:!0,...r,onFinished:()=>{e(),r.onFinished?.()},children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return y(fs,{});let a=t[e];return a?y(zs,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>y(Fs,{...e})}):y(v,{})}})})})}),Ws=e=>y(Le,{...e,shouldAutoSubmit:!0,children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return y(fs,{});let a=t[e];return a?y(zs,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>y(Fs,{...e})}):y(v,{})}}),Gs=({delay:e})=>{let[t,n]=f(!1),r=l(()=>e,[]);return c(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},Ks=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},qs=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},Js=({threshold:e})=>{let[t,n]=f(()=>typeof window>`u`?!1:window.scrollY>=e);return c(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{Le as Confetti,De as ConfettiContext,Ie as ConfettiController,Oe as ConfettiProvider,Bs as Embed,Vs as EmbeddedConfetti,zs as Flow,gs as FreeText,Hs as ModalConfetti,ms as ModalContainer,ys as MultiChoice,Us as PopoverConfetti,hs as PopoverContainer,js as Rating,Ns as SingleChoice,Ps as Statement,Ws as StepperConfetti,Fs as SurveyQuestionFactory,fs as ThankYouMessage,ke as useConfetti,Gs as useVisibleAfterDelay,Ks as useVisibleAfterPageVisits,Js as useVisibleAfterScroll,qs as useVisibleAfterSessionPageVisits};
11
+ }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=L(e),n=e.relatedTarget;n&&ln(n)?(n.focus({preventScroll:!0}),So(n,ln(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=I(),n=t!=null&&ln(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&So(this,n)};let l=It(xo(document,`touchstart`,r,{passive:!1,capture:!0}),xo(document,`touchmove`,o,{passive:!1,capture:!0}),xo(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function bo(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function xo(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function So(e,t){t||!mo?Co(e):mo.addEventListener(`resize`,()=>Co(e),{once:!0})}function Co(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=sn(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;mo&&(n=Math.min(n,mo.offsetTop+mo.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function wo(e,t,n){let{overlayProps:r,underlayProps:i}=po({...e,isOpen:t.isOpen,onClose:t.close},n);return _o({isDisabled:!t.isOpen}),Da(),f(()=>{if(t.isOpen&&n.current)return Hn([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:R(r),underlayProps:i}}const To=new WeakMap;function Eo(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,m=e.isDisabled||t.isDisabled,h=t.selectedValue===r,g=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:_,isPressed:v}=kr({onPressStart:s,onPressEnd:c,onPressChange:l,onPress:u,onPressUp:d,onClick:f,isDisabled:m}),{pressProps:y,isPressed:b}=kr({onPressStart:s,onPressEnd:c,onPressChange:l,onPressUp:d,onClick:f,isDisabled:m,onPress(e){u?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=Pi(R(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=R(_,x),C=z(e,{labelable:!0}),w=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(w=0):t.selectedValue===r&&(w=0),m&&(w=void 0);let{name:T,form:E,descriptionId:D,errorMessageId:O,validationBehavior:k}=To.get(t);return mn(n,t.defaultSelectedValue,t.setSelectedValue),Fi({validationBehavior:k},t,n),{labelProps:R(y,p(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:R(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&k===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?O:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function Do(e,t){let{name:n,form:r,isReadOnly:i,isRequired:a,isDisabled:o,orientation:s=`vertical`,validationBehavior:c=`aria`}=e,{direction:l}=$n(),{isInvalid:u,validationErrors:d,validationDetails:f}=t.displayValidation,{labelProps:p,fieldProps:m,descriptionProps:h,errorMessageProps:g}=Oi({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||d}),_=z(e,{labelable:!0}),{focusWithinProps:v}=ea({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),y=e=>{let n;switch(e.key){case`ArrowRight`:n=l===`rtl`&&s!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=l===`rtl`&&s!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=Z(e.currentTarget,{from:L(e),accept:e=>e instanceof N(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},b=Nt(n);return To.set(t,{name:b,form:r,descriptionId:h.id,errorMessageId:g.id,validationBehavior:c}),{radioGroupProps:R(_,{role:`radiogroup`,onKeyDown:y,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":a||void 0,"aria-disabled":o||void 0,"aria-orientation":s,...m,...v}),labelProps:p,descriptionProps:h,errorMessageProps:g,isInvalid:u,validationErrors:d,validationDetails:f}}const Oo=s({}),ko=fa(function(e,t){[e,t]=W(e,t,Oo);let{elementType:n=`label`,...r}=e,i=G[n];return a.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),Ao=s(null),jo=7e3;let Mo=null;function No(e,t=`assertive`,n=jo){Mo?Mo.announce(e,t,n):(Mo=new Po,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?Mo.announce(e,t,n):setTimeout(()=>{Mo?.isAttached()&&Mo?.announce(e,t,n)},100))}var Po=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=jo){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const Fo=s({}),Io=fa(function(e,t){[e,t]=W(e,t,Fo);let n=e,{isPending:r}=n,{buttonProps:i,isPressed:o}=pa(e,t);i=Ro(i,r);let{focusProps:s,isFocused:c,isFocusVisible:l}=ta(e),{hoverProps:u,isHovered:d}=ca({...e,isDisabled:e.isDisabled||r}),p={isHovered:d,isPressed:(n.isPressed||o)&&!r,isFocused:c,isFocusVisible:l,isDisabled:e.isDisabled||!1,isPending:r??!1},m=U({...e,values:p,defaultClassName:`react-aria-Button`}),g=Nt(i.id),_=Nt(),v=i[`aria-labelledby`];r&&(v?v=`${v} ${_}`:i[`aria-label`]&&(v=`${g} ${_}`));let y=h(r);f(()=>{let e={"aria-labelledby":v||g};(!y.current&&c&&r||y.current&&c&&!r)&&No(e,`assertive`),y.current=r},[r,c,v,g]);let b=z(e,{global:!0});return delete b.onClick,a.createElement(G.button,{...R(b,m,i,s,u),type:i.type===`submit`&&r?`button`:i.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":r?`true`:i[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":p.isPressed||void 0,"data-hovered":d||void 0,"data-focused":c||void 0,"data-pending":r||void 0,"data-focus-visible":l||void 0},a.createElement(Ao.Provider,{value:{id:_}},m.children))}),Lo=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function Ro(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!Lo.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}const zo=s({}),Bo=c(function(e,t){[e,t]=W(e,t,zo);let{elementType:n=`span`,...r}=e,i=G[n];return a.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function Vo(e={}){let[t,n]=Bi(e.value,e.defaultValue||[],e.onChange),[r]=g(t),i=!!e.isRequired&&t.length===0,a=h(new Map),o=Ki({...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(Qi(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}function Ho(e){let[t,n]=Bi(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:u(()=>{n(!0)},[n]),close:u(()=>{n(!1)},[n]),toggle:u(()=>{n(!t)},[n,t])}}let Uo=Math.round(Math.random()*1e10),Wo=0;function Go(e){let t=p(()=>e.name||`radio-group-${Uo}-${++Wo}`,[e.name]),[n,r]=Bi(e.value,e.defaultValue??null,e.onChange),[i]=g(n),[a,o]=g(null),s=Ki({...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 Ko=s(null),qo=c(function(e,t){return d(Ko)?.isInvalid?a.createElement(Jo,{...e,ref:t}):null}),Jo=c((e,t)=>{let n=d(Ko),r=z(e,{global:!0}),i=U({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:a.createElement(Bo,{slot:`errorMessage`,...r,...i,ref:t})}),Yo=s(null),Xo=s(null),Zo=s(null),Qo=c(function(e,t){[e,t]=W(e,t,Xo);let{validationBehavior:n}=Pn(Yo)||{},r=e.validationBehavior??n??`native`,i=Vo({...e,validationBehavior:r}),[o,s]=Fn(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=_a({...e,label:s,validationBehavior:r},i),p=U({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),m=z(e,{global:!0});return a.createElement(G.div,{...R(m,p,c),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},a.createElement(Mn,{values:[[Zo,i],[Oo,{...l,ref:o,elementType:`span`}],[zo,{slots:{description:u,errorMessage:d}}],[Ko,f]]},p.children))}),$o=c(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=W(r,t,Ze);let{validationBehavior:i}=Pn(Yo)||{},o=e.validationBehavior??i??`native`,s=d(Zo),c=nn(p(()=>Ht(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:l,inputProps:u,isSelected:f,isDisabled:m,isReadOnly:h,isPressed:g,isInvalid:_}=s?ya({...In(e),value:e.value,children:typeof e.children==`function`?!0:e.children},s,c):ha({...In(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},va(e),c),{isFocused:v,isFocusVisible:y,focusProps:b}=ta(),x=m||h,{hoverProps:S,isHovered:C}=ca({...e,isDisabled:x}),w=U({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:f,isIndeterminate:e.isIndeterminate||!1,isPressed:g,isHovered:C,isFocused:v,isFocusVisible:y,isDisabled:m,isReadOnly:h,isInvalid:_,isRequired:e.isRequired||!1}}),T=z(e,{global:!0});return delete T.id,delete T.onClick,a.createElement(G.label,{...R(T,l,S,w),ref:t,slot:e.slot||void 0,"data-selected":f||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":g||void 0,"data-hovered":C||void 0,"data-focused":v||void 0,"data-focus-visible":y||void 0,"data-disabled":m||void 0,"data-readonly":h||void 0,"data-invalid":_||void 0,"data-required":e.isRequired||void 0},a.createElement(Sa,{elementType:`span`},a.createElement(`input`,{...R(u,b),ref:c})),w.children)}),es=s({}),ts=s({});let ns=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const rs=fa(function(e,t){[e,t]=W(e,t,ts);let{hoverProps:n,isHovered:r}=ca({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:o,focusProps:s}=ta({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=U({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-Input`});return a.createElement(G.input,{...R(ns(e),s,n),...l,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),is=s(null);function as(e){let t=h({});return a.createElement(is.Provider,{value:t},e.children)}const os=s({isSelected:!1}),ss=s(null),cs=s(null),ls=c(function(e,t){let n=e[`aria-labelledby`];[e,t]=W(e,t,ss);let{dialogProps:r,titleProps:i}=Oa({...e,"aria-labelledby":n},t),o=d(cs);!r[`aria-label`]&&!r[`aria-labelledby`]&&e[`aria-labelledby`]&&(r[`aria-labelledby`]=e[`aria-labelledby`]);let s=U({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=z(e,{global:!0});return a.createElement(G.section,{...R(c,s,r),render:e.render,ref:t,slot:e.slot||void 0},a.createElement(Mn,{values:[[Qe,{slots:{[jn]:{},title:{...i,level:2}}}],[Fo,{slots:{[jn]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),us=s(null),ds=s(null),fs=c(function(e,t){if(d(ds))return a.createElement(gs,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:o,onOpenChange:s,children:c,isEntering:l,isExiting:u,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p,...m}=e;return a.createElement(ms,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:o,onOpenChange:s,isEntering:l,isExiting:u,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},a.createElement(gs,{...m,modalRef:t},c))});function ps(e,t){[e,t]=W(e,t,us);let n=d(cs),r=Ho(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,o=nn(t),s=h(null),c=gn(o,i.isOpen),l=gn(s,i.isOpen),u=c||l||e.isExiting||!1,f=Ot();return!i.isOpen&&!u||f?null:a.createElement(hs,{...e,state:i,isExiting:u,overlayRef:o,modalRef:s})}const ms=c(ps);function hs({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:r}=t,{modalProps:i,underlayProps:o}=wo(t,r,n),s=hn(t.overlayRef)||t.isEntering||!1,c=U({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:r}}),l=un(),u;if(typeof document<`u`){let e=on(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return a.createElement(Ea,{isExiting:t.isExiting,portalContainer:e},a.createElement(G.div,{...R(z(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},a.createElement(Mn,{values:[[ds,{modalProps:i,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[cs,r]]},c.children)))}function gs(e){let{modalProps:t,modalRef:n,isExiting:r,isDismissable:i}=d(ds),o=d(cs),s=nn(p(()=>Ht(e.modalRef,n),[e.modalRef,n])),c=hn(s),l=U({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:c,isExiting:r,state:o}});return a.createElement(G.div,{...R(z(e,{global:!0}),t),...l,ref:s,"data-entering":c||void 0,"data-exiting":r||void 0},i&&a.createElement(fo,{onDismiss:o.close}),l.children)}const _s=s(null),vs=s(null),ys=s(null),bs=c(function(e,t){[e,t]=W(e,t,_s);let{validationBehavior:n}=Pn(Yo)||{},r=e.validationBehavior??n??`native`,i=Go({...e,validationBehavior:r}),[o,s]=Fn(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=Do({...e,label:s,validationBehavior:r},i),p=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`}),m=z(e,{global:!0});return a.createElement(G.div,{...R(m,p,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},a.createElement(Mn,{values:[[ys,i],[Oo,{...l,ref:o,elementType:`span`}],[zo,{slots:{description:u,errorMessage:d}}],[Ko,f]]},a.createElement(as,null,p.children)))}),xs=c(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=W(r,t,vs);let i=a.useContext(ys),o=nn(p(()=>Ht(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:l,isDisabled:u,isPressed:d}=Eo({...In(e),children:typeof e.children==`function`?!0:e.children},i,o),{isFocused:f,isFocusVisible:m,focusProps:h}=ta(),g=u||i.isReadOnly,{hoverProps:_,isHovered:v}=ca({...e,isDisabled:g}),y=U({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:l,isPressed:d,isHovered:v,isFocused:f,isFocusVisible:m,isDisabled:u,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),b=z(e,{global:!0});return delete b.id,delete b.onClick,a.createElement(G.label,{...R(b,s,_,y),ref:t,"data-selected":l||void 0,"data-pressed":d||void 0,"data-hovered":v||void 0,"data-focused":f||void 0,"data-focus-visible":m||void 0,"data-disabled":u||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},a.createElement(Sa,{elementType:`span`},a.createElement(`input`,{...R(c,h),ref:o})),a.createElement(os.Provider,{value:{isSelected:l}},y.children))}),Ss=s({});let Cs=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const ws=c(function(e,t){[e,t]=W(e,t,Ss);let{hoverProps:n,isHovered:r}=ca(e),{isFocused:i,isFocusVisible:o,focusProps:s}=ta({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=U({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return a.createElement(G.textarea,{...R(Cs(e),s,n),...l,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),Ts=s(null),Es=fa(function(e,t){[e,t]=W(e,t,Ts);let{validationBehavior:n}=Pn(Yo)||{},r=e.validationBehavior??n??`native`,i=h(null);[e,i]=W(e,i,$e);let[o,s]=Fn(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=g(`input`),{labelProps:d,inputProps:f,descriptionProps:p,errorMessageProps:m,..._}=$i({...In(e),inputElementType:c,label:s,validationBehavior:r},i),v=u(e=>{i.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),y=U({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:_.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=z(e,{global:!0});return delete b.id,a.createElement(G.div,{...b,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":_.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},a.createElement(Mn,{values:[[Oo,{...d,ref:o}],[ts,{...f,ref:v}],[Ss,{...f,ref:v}],[es,{role:`presentation`,isInvalid:_.isInvalid,isDisabled:e.isDisabled||!1}],[zo,{slots:{description:p,errorMessage:m}}],[Ko,_]]},y.children))}),Ds=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=He();if(!r)return null;let a=t||r.confirmation.description;return w(S,{children:[C(`div`,{className:T(`cf-question`,n?.question),children:w(`div`,{className:T(`cf-header`,n?.header),children:[C(ko,{className:T(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&C(Bo,{slot:`description`,className:T(`cf-description`,n?.description),children:a})]})}),C(Io,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},Os=()=>{let[e,n]=g(!1);return f(()=>{let e=e=>{let r=t.safeParse(e);r.error||n(r.data.detail.isRecording)};return document.addEventListener(r,e),()=>{document.removeEventListener(r,e)}},[]),e},ks=({className:e,iconClassName:t,onClose:n})=>Os()?null:C(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:C(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:C(`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`})})}),As=({children:e,classNames:t,onDismiss:n,isDismissable:r=!0,closeOnFinishMs:i=3e3})=>{let{survey:a,surveyId:o,dismiss:s}=He(),[c,l]=g(!1);return y(()=>{a&&s()},c?i:null),C(ms,{isOpen:!0,isDismissable:r,isKeyboardDismissDisabled:!r,onOpenChange:async e=>{e||(await s(),n?.())},className:T(`confetti-modal-overlay`,t?.overlay),children:C(fs,{className:T(`confetti-modal`,t?.modal),children:w(ls,{"aria-label":`Survey`,id:`${o}-popover`,className:T(`confetti-modal-dialog`,t?.dialog),children:[r&&C(ks,{className:T(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await s(),n?.()}}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})})})},js=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:i=3e3})=>{let{surveyId:a,survey:o,dismiss:s}=He(),[c,l]=g(!1),[u,d]=g(!1),[f,p]=g(!1);return y(()=>{o&&s()},c&&!(u||f)?i:null),w(`div`,{className:T(`confetti-dialog`,t?.dialog),id:`${a}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),d(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),d(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),p(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||p(!1)},children:[C(ks,{className:T(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await s(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})},Ms=3e4;Ms/1e3;const Ns=({redactClasses:e=[]}={})=>{let[t,n]=g(null),[i,a]=g(!1),[o,s]=g(null),[c,l]=g(30),d=h(null),p=h(null),m=h(null),_=h([]);f(()=>{let e=new CustomEvent(r,{detail:{isRecording:i}});document.dispatchEvent(e)},[i]);let v=u(()=>{p.current&&=(clearInterval(p.current),null),m.current&&=(clearTimeout(m.current),null),d.current=null,l(Ms/1e3)},[]),y=u(()=>{d.current?.(),v(),a(!1),n(JSON.stringify(_.current))},[v]);return{recordingEventsJson:t,isRecording:i,recordingError:o,remainingSeconds:c,startRecording:u(async()=>{a(!0),s(null),n(null),_.current=[];try{let{record:t}=await import(`./record-CQ3hStii.js`),n=e[0];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=>{_.current.push(e)},...n?{blockClass:n}:{}})??null;let r=Ms/1e3;l(r),p.current=setInterval(()=>{--r,l(r)},1e3),m.current=setTimeout(()=>{y()},Ms)}catch{s(`Failed to start recording. Please try again.`),a(!1),v()}},[e,y,v]),stopRecording:y,clear:u(()=>{v(),a(!1),n(null),s(null),_.current=[]},[v])}},Ps=({redactClasses:e=[]}={})=>{let[t,n]=g(null),[r,i]=g(!1),[a,o]=g(null);return{screenshotDataUrl:t,isCapturing:r,captureError:a,capture:u(async()=>{i(!0),o(null);try{let t=(await import(`./html2canvas-pro.esm-BSw77ylm.js`)).default;n((await t(document.body,{logging:!1,ignoreElements:t=>e.some(e=>t.classList.contains(e))})).toDataURL(`image/png`))}catch{o(`Failed to capture screenshot. Please try again.`)}finally{i(!1)}},[e]),clear:u(()=>{n(null),o(null)},[])}},Fs=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[C(`circle`,{cx:`12`,cy:`12`,r:`10`}),C(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),Is=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[C(`path`,{d:`M10 11v6`}),C(`path`,{d:`M14 11v6`}),C(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),C(`path`,{d:`M3 6h18`}),C(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function Ls(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function Rs(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=Ls();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 zs=l(()=>import(`./RecordingReplayer-9_E5sMQo.js`)),Bs=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:s})=>{let c=p(()=>Rs(),[]),[l,u]=g(``),[d,m]=g(``),{screenshotDataUrl:h,isCapturing:_,captureError:v,capture:y,clear:b}=Ps({redactClasses:r.redactClasses}),{recordingEventsJson:x,isRecording:E,recordingError:D,remainingSeconds:O,startRecording:k,stopRecording:A,clear:ee}=Ns({redactClasses:r.redactClasses}),te=p(()=>({title:l,...d?{description:d}:{},...h?{screenshotDataUrl:h}:{},...x?{recordingEventsJson:x}:{},metadata:c}),[d,c,x,h,l]);f(()=>{i(te)},[te,i]),f(()=>()=>{A()},[A]);let ne=p(()=>x?JSON.parse(x):[],[x]);return C(S,{children:E?w(Io,{className:`cf-bug-report-button cf-bug-report-record-button`,onPress:A,children:[C(Fs,{}),w(`span`,{children:[30-O,`s /`,` `,30,`s`]})]}):w(`div`,{className:T(`cf-bug-report`),children:[w(Es,{isRequired:a,isInvalid:!!s,name:`${e}-title`,value:l,onChange:u,className:`cf-question`,children:[w(`div`,{className:`cf-header`,children:[w(ko,{className:`cf-title`,children:[t,!a&&C(`span`,{className:`cf-label-optional`,children:` (optional)`})]}),n&&C(Bo,{slot:`description`,className:`cf-description`,children:n})]}),C(rs,{placeholder:r.placeholder||`Brief description of the issue`,className:`cf-input`})]}),w(Es,{name:`${e}-description`,value:d,onChange:m,className:`cf-question`,children:[C(ko,{className:`cf-title`,children:r.detailsLabel}),C(ws,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:`cf-textarea`,rows:4})]}),r.enableScreenshot||r.enableRecording?w(`section`,{className:`cf-question`,children:[C(ko,{className:`cf-title`,children:`Attachments`}),w(`div`,{className:`cf-bug-report-actions`,children:[r.enableScreenshot&&w(`div`,{className:`cf-bug-report-screenshot-section`,children:[h?w(`div`,{className:`cf-bug-report-media-preview`,children:[C(`img`,{src:h,alt:`Screenshot preview`,className:`cf-bug-report-screenshot-img`}),C(`div`,{className:`cf-bug-report-media-actions`,children:C(Io,{className:`cf-bug-report-button cf-bug-report-button-action`,onPress:b,"aria-label":`Remove screenshot`,children:C(Is,{})})})]}):C(Io,{className:`cf-bug-report-button`,onPress:y,isDisabled:_,children:_?`Capturing...`:`Screenshot`}),v&&C(`div`,{className:`cf-error`,children:v})]}),r.enableRecording&&w(`div`,{className:`cf-bug-report-recording-section`,children:[ne.length>0?w(`div`,{className:`cf-bug-report-media-preview`,children:[C(o,{fallback:C(`span`,{className:`cf-bug-report-player-loading`,"aria-label":`Loading recording preview...`}),children:C(zs,{events:ne})}),C(`div`,{className:`cf-bug-report-media-actions`,children:C(Io,{className:`cf-bug-report-button cf-bug-report-button-action`,onPress:ee,"aria-label":`Remove recording`,children:C(Is,{})})})]}):C(Io,{className:`cf-bug-report-button`,onPress:k,children:`Record`}),D&&C(`div`,{className:`cf-error`,children:D})]})]})]}):null,C(qo,{className:`cf-error`,children:s})]})})},Vs=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[c,l]=g(``);return f(()=>{i(c)},[i,c]),w(Es,{isRequired:o,isInvalid:!!s,name:e,className:T(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[w(`div`,{className:T(`cf-header`,a?.header),children:[w(ko,{className:T(`cf-title`,a?.title),children:[t,!o&&w(`span`,{className:T(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&C(Bo,{slot:`description`,className:T(`cf-description`,a?.description),children:n})]}),C(ws,{className:T(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),C(qo,{className:T(`cf-error`,a?.error),children:s})]})},Hs=({children:e,classNames:t,description:n,...r})=>C($o,{...r,children:({isIndeterminate:r})=>w(S,{children:[w(`div`,{className:T(`cf-choice-label`,t?.label),children:[C(`div`,{className:T(`cf-checkbox-indicator`,t?.indicator),children:C(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:T(`cf-checkbox-indicator-svg`,t?.svg),children:r?C(`rect`,{x:1,y:7.5,width:16,height:3}):C(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&C(`span`,{className:T(`cf-choice-description`,t?.choiceDescription),children:n})]})}),Us=({children:e,classNames:t,...n})=>C($o,{...n,children:C(`div`,{className:T(`cf-tag-label`,t?.tagLabel),children:e})}),Ws=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let c=!!n.editable,l=n.display??`checkbox`,[u,d]=g([]),[m,_]=g(``),v=h(null),y=h(null),b=p(()=>{let e=u.indexOf(ye);if(e===-1)return u;let t=[...u];return t[e]=m||ye,t},[m,u]),x=l===`tag`;return f(()=>{i(b)},[i,b]),C(Qo,{isRequired:o,isInvalid:!!s,name:a,value:u,onChange:d,className:T(`cf-question`,r?.question),children:({state:i})=>w(S,{children:[w(`div`,{className:T(`cf-header`,r?.header),children:[w(ko,{className:T(`cf-title`,r?.title),children:[e,!o&&w(`span`,{className:T(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&C(Bo,{slot:`description`,className:T(`cf-description`,r?.description),children:t})]}),w(`div`,{className:T(`cf-response-choices`,l===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>C(x?Us:Hs,{className:T(`cf-choice`,x&&[`cf-tag`,r?.tag],!x&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),c&&(x?w(S,{children:[C(Us,{inputRef:v,onChange:e=>{y.current&&e&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},className:T(`cf-choice cf-tag`,r?.tag),value:ye,children:n.editable?.label}),C(rs,{"data-visible":i.value.includes(ye)||void 0,value:m,onChange:e=>{_(e.target.value)},ref:y,className:T(`cf-input cf-tag-input`,r?.othersInput)})]}):w(`div`,{className:T(`cf-choice cf-others-choice`,r?.othersChoice),children:[C(Hs,{inputRef:v,onChange:e=>{y.current&&e&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},className:T(`cf-checkbox`,r?.checkbox),value:ye,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),C(rs,{value:m,onChange:e=>{_(e.target.value)},tabIndex:i.value.includes(ye)?0:-1,ref:y,onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:T(`cf-input`,r?.othersInput)})]}))]}),C(qo,{className:T(`cf-error`,r?.error),children:s})]})})},Gs=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[C(`circle`,{cx:12,cy:12,r:10}),C(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),Ks=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[C(`circle`,{cx:12,cy:12,r:10}),C(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),qs=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[C(`circle`,{cx:12,cy:12,r:10}),C(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),Js=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[C(`circle`,{cx:12,cy:12,r:10}),C(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),Ys=e=>w(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[C(`circle`,{cx:12,cy:12,r:10}),C(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),Xs=e=>C(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:C(`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`})}),Zs=e=>C(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:C(`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`})}),Qs=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return C(`div`,{className:T(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return C(xs,{className:T(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:C(o?Zs:Xs,{})},t)})})},$s=({properties:e,classNames:t})=>C(`div`,{className:T(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return C(xs,{className:T(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),ec=({properties:e,classNames:t,state:n})=>{let r=p(()=>[Gs,qs,Js,Ys,Ks],[]),i=p(()=>[qs,Js,Ys],[]);return p(()=>e.scale===3||e.scale===5,[e.scale])?C(`div`,{className:T(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return C(xs,{className:T(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&C(c,{})},a)})}):C($s,{properties:e,classNames:t,state:n})},tc=e=>{switch(e.properties.display??`star`){case`emoji`:return C(ec,{...e});case`number`:return C($s,{...e});case`star`:return C(Qs,{...e})}},nc=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=g(null),u=p(()=>c?Number(c):void 0,[c]);return f(()=>{i(u)},[i,u]),C(bs,{isRequired:s,isInvalid:!!o,name:a,className:T(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>w(S,{children:[w(`div`,{className:T(`cf-header`,r?.header),children:[w(ko,{className:T(`cf-title`,r?.title),children:[t,!s&&w(`span`,{className:T(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&C(Bo,{slot:`description`,className:T(`cf-description`,r?.description),children:n})]}),w(`div`,{className:T(`cf-rating-section`,r?.ratingSection),children:[C(tc,{state:i,properties:e,classNames:r}),w(`div`,{className:T(`cf-rating-text`,r?.ratingText),children:[C(`span`,{className:T(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),C(`span`,{className:T(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),C(qo,{className:T(`cf-error`,r?.error),children:o})]})})},rc=({classNames:e,className:t,description:n,...r})=>C(xs,{...r,className:T(t,e?.radio),children:Nn(r.children,t=>w(S,{children:[w(`div`,{className:T(`cf-choice-label`,e?.label),children:[C(`div`,{className:T(`cf-radio-indicator`,e?.indicator)}),t]}),n&&C(`span`,{className:T(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),ic=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=g(null),[u,d]=g(``),m=!!n.editable,_=h(null),v=h(null),y=p(()=>c===be?u||be:c??void 0,[u,c]);return f(()=>{i(y)},[i,y]),C(bs,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===be&&requestAnimationFrame(()=>{v.current&&v.current.focus()})},value:c,className:T(`cf-question`,r?.question),children:({state:i})=>w(S,{children:[w(`div`,{className:T(`cf-header`,r?.header),children:[w(ko,{className:T(`cf-title`,r?.title),children:[e,!o&&w(`span`,{className:T(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&C(Bo,{slot:`description`,className:T(`cf-description`,r?.description),children:t})]}),w(`div`,{className:T(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>C(rc,{classNames:{indicator:r?.indicator,radio:T(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),m&&w(`div`,{className:T(`cf-choice cf-others-choice`,r?.othersChoice),children:[C(rc,{inputRef:_,value:be,classNames:{indicator:r?.indicator,radio:T(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),C(rs,{tabIndex:i.selectedValue===be?0:-1,ref:v,value:u,onChange:e=>d(e.target.value),onFocus:()=>{_.current?.checked===!1&&_.current.click()},className:T(`cf-input`,r?.othersInput)})]})]}),C(qo,{className:T(`cf-error`,r?.error),children:s})]})})},ac=({properties:e,title:t,description:n,classNames:r})=>C(`div`,{className:T(`cf-question`,r?.question),children:w(`div`,{className:T(`cf-header`,r?.header),children:[t&&C(`div`,{className:T(`cf-title`,r?.title),children:t}),n&&C(`div`,{className:T(`cf-description`,r?.description),children:n})]})}),oc=({question:e,onChange:t,error:n})=>{switch(e.properties.type){case`rating`:return C(nc,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return C(Vs,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return C(ic,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return C(Ws,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return C(ac,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return C(Bs,{...e,properties:e.properties,onChange:t,error:n},e.id)}return C(`div`,{children:`Unsupported question type`},e.id)},sc=({onPress:e,isDisabled:t,children:n=`Submit`})=>Os()?null:C(Io,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),cc=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},lc=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),uc=({onSubmit:e,children:t,question:r,isLastQuestion:i})=>{let[a,o]=g(cc(r.properties.type)),s=p(()=>We(r.properties,{required:r.required}),[r.properties,r.required]),c=p(()=>{let e=s.safeParse(a);if(!e.success)return O(e.error)},[a,s]),l=p(()=>{let e=r.routingLogic;if(e.type!==`always`&&!lc(a)&&r.required)return!0;let t=e.type===`always`?e.target:e.cases.find(e=>n({answer:a,condition:e}))?.target??e.default;return t.type===`end`?!1:t.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),d=p(()=>r.properties.buttonLabel?r.properties.buttonLabel:l?!r.required&&!lc(a)?`Skip`:`Next`:`Submit`,[a,l,r.properties.buttonLabel,r.required]),f=u(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=se.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(a)}},[a,e,r.properties]),m=p(()=>{switch(r.properties.type){case`rating`:case`single-select`:return!!r.properties.shouldAutoProgress;default:return!1}},[r.properties]);return w(S,{children:[t({onChange:u(t=>{o(t),m&&lc(t)&&s.safeParse(t).success&&e(t)},[m,s,e]),question:r,error:c}),(!m||!r.required)&&C(sc,{isDisabled:!!c,onPress:f,children:d})]})},dc=({isCompleted:e,onSubmit:t,children:n})=>w(S,{children:[n,e&&C(sc,{onPress:t})]}),fc=e=>C(Xe,{...e,shouldAutoSubmit:!1,children:({questions:e,update:t,isCompleted:n,submit:r,isSubmitted:i,errors:a})=>i?C(Ds,{}):C(dc,{onSubmit:r,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>C(oc,{question:e,error:a[e.id]||``,onChange:n=>t({question:e.position,answer:n})},e.position))})}),pc=({onDismiss:e,closeOnFinishMs:t,isDismissable:n,...r})=>C(i,{fallback:C(S,{}),children:C(Ve,{...r,children:C(As,{onDismiss:e,closeOnFinishMs:t,isDismissable:n,children:({setIsFinished:e})=>C(Ye,{...r,shouldAutoSubmit:!1,onFinished:()=>{e(),r.onFinished?.()},children:({questions:e,update:t,isCompleted:n,errors:r,submit:i,isSubmitted:a})=>a?C(Ds,{}):C(dc,{onSubmit:i,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>C(oc,{question:e,error:r[e.id]||``,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})}),mc=({onDismiss:e,closeOnFinishMs:t,...n})=>C(i,{fallback:C(S,{}),children:C(Ve,{...n,children:C(js,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>C(Ye,{shouldAutoSubmit:!0,...n,onFinished:()=>{e(),n.onFinished?.()},children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return C(Ds,{});let a=t[e];return a?C(uc,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>C(oc,{...e})}):C(S,{})}})})})}),hc=e=>C(Xe,{...e,shouldAutoSubmit:!0,children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return C(Ds,{});let a=t[e];return a?C(uc,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>C(oc,{...e})}):C(S,{})}}),gc=({delay:e})=>{let[t,n]=g(!1),r=p(()=>e,[]);return f(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},_c=({visits:e,respondent:t})=>{let[n,r]=_(`cfti:${p(()=>window.location.pathname,[])}:visits:${t??``}`,0);return f(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:u(()=>r(0),[r])}},vc=({visits:e,respondent:t})=>{let[n,r]=v(`cfti:${p(()=>window.location.pathname,[])}:visits:${t??``}`,0);return f(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:u(()=>r(0),[r])}},yc=({threshold:e})=>{let[t,n]=g(()=>typeof window>`u`?!1:window.scrollY>=e);return f(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{Xe as Confetti,Be as ConfettiContext,Ye as ConfettiController,Ve as ConfettiProvider,dc as Embed,fc as EmbeddedConfetti,uc as Flow,Vs as FreeText,pc as ModalConfetti,As as ModalContainer,Ws as MultiChoice,mc as PopoverConfetti,js as PopoverContainer,nc as Rating,ic as SingleChoice,ac as Statement,hc as StepperConfetti,oc as SurveyQuestionFactory,Ds as ThankYouMessage,He as useConfetti,gc as useVisibleAfterDelay,_c as useVisibleAfterPageVisits,yc as useVisibleAfterScroll,vc as useVisibleAfterSessionPageVisits};