@opengovsg/confetti 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +0,0 @@
1
- import{i as e,r as t,t as n}from"./internals-Dzl6abGJ.js";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,useTimeout as m}from"usehooks-ts";import{z as h}from"zod/v4/mini";import g from"ky";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import b from"clsx";import x,{flushSync as S}from"react-dom";const C=h.object({type:h.literal(`next`)}),w=h.object({type:h.literal(`end`)}),T=h.object({type:h.literal(`jump`),target:h.number({error:`Target question is required`})}),E=h.discriminatedUnion(`type`,[C,T,w]),D=h.object({type:h.literal(`value`),value:h.union([h.string().check(h.trim(),h.minLength(1,{error:`Value is required`})),h.number({error:`Value is required`})])}),O=h.object({type:h.literal(`binary-operator`),operator:h.union([h.literal(`equal`),h.literal(`not-equal`),h.literal(`greater`),h.literal(`greater-or-equal`),h.literal(`less`),h.literal(`less-or-equal`),h.literal(`contains`),h.literal(`not-contains`)]),value:D,target:E}),k=h.object({type:h.literal(`switch`),cases:h.array(O),default:E}),ee=h.object({type:h.literal(`always`),target:E}),te=h.discriminatedUnion(`type`,[ee,k]),ne=h.string().check(h.trim(),h.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),A=h.optional(h.string().check(h.trim(),h.maxLength(50))),re=h.object({value:h.string().check(h.trim(),h.minLength(1,{error:`Value is required`})),description:h.optional(h.string().check(h.trim()))}),ie=h.nullable(h.object({label:h.string().check(h.trim(),h.minLength(1,{error:`Value is required`})),max:h.number(),description:h.optional(h.string().check(h.trim()))})),ae=h.optional(h.boolean()),oe=h.object({type:h.literal(`rating`),buttonLabel:A,shouldAutoProgress:ae,scale:h.number().check(h.minimum(2),h.maximum(10)),labels:h.optional(h.object({lower:h.optional(h.pipe(h.string().check(h.trim()),h.transform(e=>e===``?void 0:e))),upper:h.optional(h.pipe(h.string().check(h.trim()),h.transform(e=>e===``?void 0:e)))})),display:h.optional(h.literal([`star`,`emoji`,`number`]))}),se=h.object({type:h.literal(`open-ended`),placeholder:h.optional(h.string()),buttonLabel:A,max:h.number()}),ce=h.object({type:h.literal(`single-select`),shouldAutoProgress:ae,options:h.array(re),buttonLabel:A,editable:ie}),le=h.object({type:h.literal(`multi-select`),buttonLabel:A,options:h.array(re),editable:ie,max:h.optional(h.number()),display:h.optional(h.literal([`checkbox`,`tag`]))}),ue=h.object({type:h.literal(`statement`),buttonLabel:A,buttonUrl:h.optional(ne)}),de=h.object({type:h.literal(`bug-report`),placeholder:h.optional(h.string()),buttonLabel:A,enableScreenshot:h.boolean(),enableRecording:h.boolean(),detailsLabel:h.string().check(h.trim(),h.minLength(1,{error:`Label is required`}),h.maxLength(128)),detailsPlaceholder:h.optional(h.string()),redactClasses:h.optional(h.array(h.string()))}),fe=h.discriminatedUnion(`type`,[oe,ce,se,le,ue,de]),pe=`__CONFETTI_CHECKBOX_Others`,me=`__CONFETTI_RADIO_Others`,he=h.optional(h.catchall(h.partial(h.looseObject({userAgent:h.string().check(h.trim(),h.maxLength(1e3)),screenResolution:h.string().check(h.trim(),h.maxLength(100)),viewportSize:h.string().check(h.trim(),h.maxLength(100)),pageUrl:h.string(),pageTitle:h.string().check(h.trim(),h.maxLength(1e3)),referrer:h.string(),datadogTraceId:h.optional(h.string()),datadogSessionId:h.optional(h.string()),datadogSessionReplayLink:h.optional(h.string())})),h.optional(h.string())));h.cuid2();const ge=h.looseObject({type:h.literal([0,1,2,3,4,5,6]),data:h.unknown(),timestamp:h.number(),delay:h.optional(h.number())});h.array(ge);const _e=h.array(ge),ve=h.string().check(h.refine(e=>{try{return _e.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),ye=h.string().check(h.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),be=e=>h.object({title:h.string().check(h.trim(),...e?[h.minLength(1,{error:`Title is required`})]:[],h.maxLength(256)),description:h.optional(h.string().check(h.trim(),h.maxLength(4096))),screenshotDataUrl:h.optional(ye),recordingEventsJson:h.optional(ve),metadata:he}),xe=be(!0),Se=(e,{required:t})=>be(t),Ce=e=>h.number().check(h.int(),h.minimum(1),h.maximum(e)),we=({scale:e},{required:t})=>{let n=Ce(e);return t?n:h.optional(n)},Te=({maxLength:e},{required:t})=>h.string().check(h.trim(),...t?[h.minLength(1,{error:`This field is required`})]:[],h.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),Ee=(e,t)=>h.string().check(h.trim(),...t?[h.minLength(1,{error:`This field is required`})]:[],h.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),h.refine(e=>e!==me,{error:`Please fill out the free text field`})),De=({maxLength:e},{required:t})=>{let n=Ee(e,t);return t?n:h.optional(n)},Oe=({maxSelected:e,maxLength:t},{required:n})=>h.array(h.string().check(h.trim(),...n?[h.minLength(1,{error:`This field is required`})]:[],h.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),h.refine(e=>e!==pe,{error:`Please fill out the free text field`}))).check(...n?[h.minLength(1,{error:`Please select at least one option`})]:[],h.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),ke=()=>h.optional(h.string()),Ae=h.cuid2(),je=h.object({title:h.string().check(h.trim()),description:h.string().check(h.trim()),buttonText:h.string().check(h.trim())}),Me=h.object({title:h.string(),description:h.nullable(h.string()),questions:h.array(h.object({id:h.string(),title:h.string(),description:h.nullable(h.string()),position:h.number(),required:h.boolean(),properties:fe,routingLogic:te})),confirmation:je});h.object({surveyId:Ae,responseId:h.union([h.cuid2(),h.uuid()])});const Ne=h.catch(h.partial(h.object({type:h.enum([`embedded`,`popover`,`modal`]),version:h.string().check(h.trim(),h.minLength(1),h.maxLength(50))})),{});h.object({respondent:h.string().check(h.trim(),h.minLength(1),h.maxLength(2048)),data:h.record(h.string(),h.union([h.string().check(h.trim(),h.maxLength(2048)),h.number(),h.array(h.string().check(h.trim(),h.maxLength(2048))).check(h.maxLength(1024)),xe])),metadata:h.record(h.string().check(h.trim(),h.maxLength(1e3)),h.string().check(h.trim(),h.maxLength(1e3))),telemetry:h.optional(Ne)}),h.object({surveyId:Ae,respondent:h.string().check(h.trim(),h.minLength(1),h.maxLength(2048))}),h.object({surveyId:Ae,respondent:h.string().check(h.trim(),h.minLength(1),h.maxLength(2048))}),h.object({surveyId:Ae});const Pe=h.object({lastRespondedAt:h.nullable(h.union([h.iso.datetime(),h.date()])),lastViewedAt:h.nullable(h.union([h.iso.datetime(),h.date()])),lastDismissedAt:h.nullable(h.union([h.iso.datetime(),h.date()]))});h.object({type:h.enum([`view`,`dismiss`])});const Fe=g.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4}),Ie=i(null),Le=({type:e,children:t})=>{let n=l(()=>({type:e}),[e]);return v(Ie.Provider,{value:n,children:t})},Re=()=>s(Ie),ze=i(null),Be=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:s,alwaysRenderChildren:u})=>{let m=Re(),h=d(!1),[g,_]=f(),[y,b]=f(!1),[x,S]=f(null),[C,w]=f(null),[T,E]=p(`cfti:${t}:respondent`,``);c(()=>{T||E(crypto.randomUUID())},[T,E]);let D=l(()=>r||T,[r,T]),O=l(()=>{let e={headers:{"x-cfti-pk":n}};return s&&(e.prefixUrl=s),Fe.extend(e)},[s,n]),k=o(async()=>{if(!D)return;let e=await O.get(`v1/cfti/${t}/respondent/${D}`).json(),n=Pe.safeParse(e);n.success&&(S(n.data.lastRespondedAt?new Date(n.data.lastRespondedAt):null),w(n.data.lastDismissedAt?new Date(n.data.lastDismissedAt):null))},[O,D,t]);c(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&k()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[k]),c(()=>{(async()=>{h.current=!1,b(!1),_(void 0),S(null),w(null);try{let e=await O.get(`v1/cfti/${t}`).json(),n=Me.safeParse(e);if(!n.success)return;_(n.data),await k()}catch{}finally{b(!0)}})()},[O,k,t]);let ee=o(async({answers:e})=>{let n=crypto.randomUUID();await O.put(`v1/cfti/${t}/response/${n}`,{json:{respondent:D,data:e,metadata:i,telemetry:{...m!==null&&{type:m.type},version:`0.3.2`}}})},[O,i,D,t,m]),te=o(()=>{u||_(void 0),O.post(`v1/cfti/${t}/respondent/${D}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[u,O,D,t]),ne=l(()=>y?a===void 0?!0:typeof a==`boolean`?a:a({lastRespondedAt:x,lastDismissedAt:C}):!1,[y,a,x,C]);c(()=>{h.current||ne&&g&&D&&(h.current=!0,O.post(`v1/cfti/${t}/respondent/${D}/event`,{json:{type:`view`}}).catch(()=>{}))},[O,ne,D,g,t]);let A=ne&&!!g;return!u&&!A?null:v(ze.Provider,{value:{submit:ee,dismiss:te,surveyId:t,survey:g,metadata:i,isVisible:A},children:e})},Ve=e=>s(ze)?v(_,{children:e.children}):v(Be,{...e,surveyId:e.surveyId,publishableKey:e.publishableKey}),He=()=>{let e=s(ze);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},Ue=i(null);i(null),i(null),i(null),i(null);const We=i({});i(null);const Ge=i(null);function Ke(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 qe(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function j(e){let t=null;return()=>(t??=e(),t)}const Je=j(function(){return qe(/^Mac/i)}),Ye=j(function(){return qe(/^iPhone/i)}),Xe=j(function(){return qe(/^iPad/i)||Je()&&navigator.maxTouchPoints>1}),Ze=j(function(){return Ye()||Xe()}),Qe=j(function(){return Ke(/AppleWebKit/i)&&!$e()}),$e=j(function(){return Ke(/Chrome/i)}),et=j(function(){return Ke(/Android/i)}),tt=j(function(){return Ke(/Firefox/i)});function nt(e){if(it())e.focus({preventScroll:!0});else{let t=at(e);e.focus(),ot(t)}}let rt=null;function it(){if(rt==null){rt=!1;try{document.createElement(`div`).focus({get preventScroll(){return rt=!0,!0}})}catch{}}return rt}function at(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 ot(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function M(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;tt()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(Je()?r=!0:i=!0);let s=Qe()&&Je()&&!Xe()?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});M.isOpening=n,nt(e),e.dispatchEvent(s),M.isOpening=!1}M.isOpening=!1;const N=typeof document<`u`?r.useLayoutEffect:()=>{},st={prefix:String(Math.round(Math.random()*1e10)),current:0},ct=r.createContext(st),lt=r.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let ut=new WeakMap;function dt(e=!1){let t=s(ct),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=ut.get(e);n==null?ut.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,ut.delete(e))}n.current=++t.current}return n.current}function ft(e){let t=s(ct),n=dt(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function pt(e){let t=r.useId(),[n]=f(vt()),i=n?`react-aria`:`react-aria${st.prefix}`;return e||`${i}-${t}`}const mt=typeof r.useId==`function`?pt:ft;function ht(){return!1}function gt(){return!0}function _t(e){return()=>{}}function vt(){return typeof r.useSyncExternalStore==`function`?r.useSyncExternalStore(_t,ht,gt):s(lt)}function yt(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 N(()=>{r.current=t,i.current&&a.current()}),[t,o(e=>{i.current=e(r.current),a.current()},[a])]}let bt=!!(typeof window<`u`&&window.document&&window.document.createElement),xt=new Map,St;typeof FinalizationRegistry<`u`&&(St=new FinalizationRegistry(e=>{xt.delete(e)}));function Ct(e){let[t,n]=f(e),r=d(null),i=mt(t),a=d(null);if(St&&St.register(a,i),bt){let e=xt.get(i);e&&!e.includes(r)?e.push(r):xt.set(i,[r])}return N(()=>{let e=i;return()=>{St&&St.unregister(a),xt.delete(e)}},[i]),c(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function wt(e,t){if(e===t)return e;let n=xt.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=xt.get(t);return r?(r.forEach(t=>t.current=e),e):t}function Tt(e=[]){let t=Ct(),[n,r]=yt(t),i=o(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return N(i,[t,i,...e]),n}function Et(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const P=e=>e?.ownerDocument??document,F=e=>e&&`window`in e&&e.window===e?e:P(e).defaultView||window;function Dt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Ot(e){return Dt(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function I(){return!1}function L(e,t){if(!I())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:Ot(n)?n.host:n.parentNode}return!1}const R=(e=document)=>{if(!I())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function z(e){if(I()&&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 kt(e){if(!e)return!1;let t=e.getRootNode(),n=F(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}var At=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(!L(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 L(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 jt(e,t,n,r){return I()?new At(e,t,n,r):e.createTreeWalker(t,n,r)}function Mt(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=Nt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():Nt(e[n],null)})}}}function Nt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function B(...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]=Et(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=b(n,i):e===`id`&&n&&i?t.id=wt(n,i):e===`ref`&&n&&i?t.ref=Mt(n,i):t[e]=i===void 0?n:i}}return t}const Pt=new Set([`id`]),Ft=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),It=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),Lt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Rt=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(`.`)),zt=/^(data-.*)$/;function V(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)&&(Pt.has(t)||n&&Ft.has(t)||r&&It.has(t)||i&&Lt.has(t)||a&&(Rt.has(t)||t.endsWith(`Capture`)&&Rt.has(t.slice(0,-7)))||o?.has(t)||zt.test(t))&&(s[t]=e[t]);return s}let H=new Map,Bt=new Set;function Vt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=z(t);if(!e(t)||!r)return;let i=H.get(r);i||(i=new Set,H.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=z(t);if(!e(t)||!r)return;let i=H.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),H.delete(r)),H.size===0)){for(let e of Bt)e();Bt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Vt):Vt());function Ht(){for(let[e]of H)`isConnected`in e&&!e.isConnected&&H.delete(e)}function Ut(e){requestAnimationFrame(()=>{Ht(),H.size===0?e():Bt.add(e)})}function Wt(){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 Gt(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=Ct(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 Kt(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 qt=r.useInsertionEffect??N;function Jt(e){let t=d(null);return qt(()=>{t.current=e},[e]),o((...e)=>{let n=t.current;return n?.(...e)},[])}function Yt(e,t){N(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Xt(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 Zt(e,t){let n=e;for(Xt(n,t)&&(n=n.parentElement);n&&!Xt(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 $t(e){return e instanceof HTMLInputElement&&!Qt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let U=typeof document<`u`&&window.visualViewport;function en(){let e=vt(),[t,n]=f(()=>e?{width:0,height:0}:tn());return c(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{U&&U.scale>1||e(tn())},r,i=t=>{U&&U.scale>1||$t(z(t))&&(r=requestAnimationFrame(()=>{let t=R();(!t||!$t(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(tn()),Ze()&&window.addEventListener(`blur`,i,!0),U?U.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(r),Ze()&&window.removeEventListener(`blur`,i,!0),U?U.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function tn(){return{width:U?Math.min(U.width*U.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:U?U.height*U.scale:document.documentElement.clientHeight}}function nn(e){return e.pointerType===``&&e.isTrusted?!0:et()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function rn(e){return!et()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function an(e,t=!0){let[n,r]=f(!0),i=n&&t;return N(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),sn(e,i,o(()=>r(!1),[])),i}function on(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 sn(e,i,o(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function sn(e,t,n){N(()=>{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||S(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const cn=typeof Element<`u`&&`checkVisibility`in Element.prototype;function ln(e){let t=F(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function un(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 dn(e,t){return cn?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&ln(e)&&un(e,t)&&(!e.parentElement||dn(e.parentElement,e))}const fn=[`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`],pn=fn.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;fn.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const mn=fn.join(`:not([hidden]):not([tabindex="-1"]),`);function hn(e,t){return e.matches(pn)&&!_n(e)&&(t?.skipVisibilityCheck||dn(e))}function gn(e){return e.matches(mn)&&dn(e)&&!_n(e)}function _n(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function vn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let yn=new WeakMap;function bn(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return vn(t);if(yn.has(t))return yn.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof F(n).HTMLMetaElement&&(n.nonce||n.content)||vn(t)||void 0;return r!==void 0&&yn.set(t,r),r}const xn=Symbol(`default`);function Sn({values:e,children:t}){for(let[n,i]of e)t=r.createElement(n.Provider,{value:i},t);return t}function Cn(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s,render:c}=e;return l(()=>{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 wn(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function Tn(e,t){let n=s(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||xn;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 En(e,t,n){let{ref:r,...i}=Tn(n,e.slot)||{},a=Kt(l(()=>Mt(t,r),[t,r])),o=B(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 Dn(e=!0){let[t,n]=f(e),r=d(!1),i=o(e=>{r.current=!0,n(!!e)},[]);return N(()=>{r.current||n(!1)},[]),[i,t]}function On(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function kn(e,t,n){let{render:i,...a}=t,o=d(null),s=l(()=>Mt(n,o),[n,o]);N(()=>{},[e,i]);let c={...a,ref:s};return i?i(c,void 0):r.createElement(e,c)}const An={},jn=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let n=An[t];return n||(n=a(kn.bind(null,t)),An[t]=n),n}}),Mn=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Nn(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let Pn=new WeakMap,W=[];function Fn(e,t){let n=F(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&Mn,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(I())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(L(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=jt(P(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=Pn.get(e)??0;c(e)&&t===0||(t===0&&l(e,!0),s.add(e),Pn.set(e,t+1))};W.length&&W[W.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=>L(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Nn(e)?o.add(e):e instanceof Element&&d(e);if(I()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});p.observe(i,{childList:!0,subtree:!0});let m=new Set;if(I())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=>L(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Nn(e)?o.add(e):e instanceof Element&&d(e);if(I()){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 W.push(h),()=>{if(p.disconnect(),I())for(let e of m)e.disconnect();for(let e of s){let t=Pn.get(e);t!=null&&(t===1?(l(e,!1),Pn.delete(e)):Pn.set(e,t-1))}h===W[W.length-1]?(W.pop(),W.length&&W[W.length-1].observe()):W.splice(W.indexOf(h),1)}}const In=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Ln=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Rn(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 In.has(t.script)}let t=e.split(`-`)[0];return Ln.has(t)}const zn=Symbol.for(`react-aria.i18n.locale`);function Bn(){let e=typeof window<`u`&&window[zn]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Rn(e)?`rtl`:`ltr`}}let Vn=Bn(),Hn=new Set;function Un(){Vn=Bn();for(let e of Hn)e(Vn)}function Wn(){let e=vt(),[t,n]=f(Vn);return c(()=>(Hn.size===0&&window.addEventListener(`languagechange`,Un),Hn.add(n),()=>{Hn.delete(n),Hn.size===0&&window.removeEventListener(`languagechange`,Un)}),[]),e?{locale:typeof window<`u`&&window[zn]||`en-US`,direction:`ltr`}:t}const Gn=r.createContext(null);function Kn(){let e=Wn();return s(Gn)||e}const qn=Symbol.for(`react-aria.i18n.locale`),Jn=Symbol.for(`react-aria.i18n.strings`);let Yn;var Xn=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=Zn(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[qn];if(Yn===void 0){let t=window[Jn];if(!t)return null;for(let r in Yn={},t)Yn[r]=new e({[n]:t[r]},n)}let r=Yn?.[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 Zn(e,t,n=`en-US`){if(t[e])return t[e];let r=Qn(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function Qn(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const $n=new Map,er=new Map;var tr=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=$n.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),$n.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=er.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),er.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const nr=new WeakMap;function rr(e){let t=nr.get(e);return t||(t=new Xn(e),nr.set(e,t)),t}function ir(e,t){return t&&Xn.getGlobalDictionaryForPackage(t)||rr(e)}function ar(e,t){let{locale:n}=Kn(),r=ir(e,t);return l(()=>new tr(n,r),[n,r])}function or(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function sr(e,t){Object.defineProperty(e,`target`,{value:t}),Object.defineProperty(e,`currentTarget`,{value:t})}function cr(e){let t=d({isFocused:!1,observer:null});return N(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),o(n=>{let r=z(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=or(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===R()?null:R();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 lr=!1;function ur(e){for(;e&&!hn(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=F(e),n=t.document.activeElement;if(!n||n===e)return;lr=!0;let r=!1,i=e=>{(z(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(z(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,nt(n),c()))},o=t=>{(z(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(z(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,nt(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),lr=!1,r=!1},l=requestAnimationFrame(c);return c}let dr=`default`,fr=``,pr=new WeakMap;function mr(e){if(Ze()){if(dr===`default`){let t=P(e);fr=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}dr=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;pr.set(e,e.style[t]),e.style[t]=`none`}}function hr(e){if(Ze()){if(dr!==`disabled`)return;dr=`restoring`,setTimeout(()=>{Ut(()=>{if(dr===`restoring`){let t=P(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=fr||``),fr=``,dr=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&pr.has(e)){let t=pr.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),pr.delete(e)}}const gr=r.createContext({register:()=>{}});gr.displayName=`PressResponderContext`;function _r(e){let t=s(gr);if(t){let{register:n,ref:r,...i}=t;e=B(i,e),n()}return Yt(t,e.ref),e}var vr=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 yr=Symbol(`linkClicked`),br=`react-aria-pressable-style`,xr=`data-react-aria-pressable`;function Sr(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}=_r(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}=Wt(),w=o((e,t)=>{let i=x.current;if(u||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new vr(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[u,r,n]),T=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 vr(`pressend`,r,e);i(t),s=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!u){let n=new vr(`press`,r,e);t(n),s&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,s},[u,i,n,t]),E=Jt(T),D=Jt(o((e,t)=>{let n=x.current;if(u)return!1;if(a){n.isTriggeringEvent=!0;let r=new vr(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[u,a])),O=o(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(G(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||hr(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,T]),k=Jt(O),ee=o(e=>{h&&O(e)},[h,O]),te=o(e=>{u||s?.(e)},[u,s]),ne=o((e,t)=>{if(!u&&s){let n=new MouseEvent(`click`,e);sr(n,t),s(or(n))}},[u,s]),A=l(()=>{let e=x.current,t={onKeyDown(t){if(wr(t.nativeEvent,t.currentTarget)&&L(t.currentTarget,z(t))){Er(z(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=w(t,`keyboard`));let i=t.currentTarget;S(P(t.currentTarget),`keyup`,Et(t=>{wr(t,i)&&!t.repeat&&L(i,z(t))&&e.target&&D(G(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&Je()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!L(t.currentTarget,z(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!M.isOpening){let n=!0;if(u&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||nn(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);te(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(G(t.currentTarget,t),r),a=E(G(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,te(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&wr(t,e.target)){Er(z(t),t.key)&&t.preventDefault();let n=z(t),r=L(e.target,n);E(G(e.target,t),`keyboard`,r),r&&ne(t,e.target),C(),t.key!==`Enter`&&Cr(e.target)&&L(e.target,n)&&!t[yr]&&(t[yr]=!0,M(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||!L(t.currentTarget,z(t)))return;if(rn(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||mr(e.target),i=w(t,e.pointerType);let a=z(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(P(t.currentTarget),`pointerup`,n,!1),S(P(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(L(t.currentTarget,z(t))&&t.button===0){if(m){let n=ur(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!L(t.currentTarget,z(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(G(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(G(e.target,t),e.pointerType,!1),ee(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(L(e.target,z(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?k(t):(nt(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=>{L(e.currentTarget,z(e))&&k(e)}}return t},[S,u,m,C,g,ee,w,te,ne]);return c(()=>{if(!_)return;let e=P(_.current);if(!e||!e.head||e.getElementById(br))return;let t=e.createElement(`style`);t.id=br;let n=bn(e);n&&(t.nonce=n),t.textContent=`
2
- @layer {
3
- [${xr}] {
4
- touch-action: pan-x pan-y pinch-zoom;
5
- }
6
- }
7
- `.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||hr(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:B(v,A,{[xr]:!0})}}function Cr(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function wr(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof F(i).HTMLInputElement&&!Or(i,n)||i instanceof F(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Cr(i))&&n!==`Enter`)}function G(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 Tr(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Cr(e)}function Er(e,t){return e instanceof HTMLInputElement?!Or(e,t):Tr(e)}const Dr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Or(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Dr.has(e.type)}let K=null;const kr=new Set;let Ar=new Map,jr=!1,Mr=!1;const Nr={Tab:!0,Escape:!0};function Pr(e,t){for(let n of kr)n(e,t)}function Fr(e){return!(e.metaKey||!Je()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Ir(e){jr=!0,!M.isOpening&&Fr(e)&&(K=`keyboard`,Pr(`keyboard`,e))}function Lr(e){K=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(jr=!0,Pr(`pointer`,e))}function Rr(e){!M.isOpening&&nn(e)&&(jr=!0,K=`virtual`)}function zr(e){let t=F(z(e)),n=P(z(e));z(e)===t||z(e)===n||lr||!e.isTrusted||(!jr&&!Mr&&(K=`virtual`,Pr(`virtual`,e)),jr=!1,Mr=!1)}function Br(){lr||(jr=!1,Mr=!0)}function Vr(e){if(typeof window>`u`||typeof document>`u`)return;let t=F(e),n=P(e);if(Ar.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){jr=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Ir,!0),n.addEventListener(`keyup`,Ir,!0),n.addEventListener(`click`,Rr,!0),t.addEventListener(`focus`,zr,!0),t.addEventListener(`blur`,Br,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Lr,!0),n.addEventListener(`pointermove`,Lr,!0),n.addEventListener(`pointerup`,Lr,!0)),t.addEventListener(`beforeunload`,()=>{Hr(e)},{once:!0}),Ar.set(t,{focus:r})}const Hr=(e,t)=>{let n=F(e),r=P(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Ar.has(n)&&(n.HTMLElement.prototype.focus=Ar.get(n).focus,r.removeEventListener(`keydown`,Ir,!0),r.removeEventListener(`keyup`,Ir,!0),r.removeEventListener(`click`,Rr,!0),n.removeEventListener(`focus`,zr,!0),n.removeEventListener(`blur`,Br,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Lr,!0),r.removeEventListener(`pointermove`,Lr,!0),r.removeEventListener(`pointerup`,Lr,!0)),Ar.delete(n))};function Ur(e){let t=P(e),n;return t.readyState===`loading`?(n=()=>{Vr(e)},t.addEventListener(`DOMContentLoaded`,n)):Vr(e),()=>Hr(e,n)}typeof document<`u`&&Ur();function Wr(){return K!==`pointer`}function Gr(){return K}function Kr(e){K=e,Pr(e,null)}const qr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Jr(e,t,n){let r=n?z(n):void 0,i=P(r),a=F(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=R(i);return e=e||u instanceof o&&!qr.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!Nr[n.key])}function Yr(e,t,n){Vr(),c(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Jr(!!n?.isTextInput,t,r)&&e(Wr())};return kr.add(t),()=>{kr.delete(t)}},t)}function Xr(e){if(!e.isConnected)return;let t=P(e);if(Gr()===`virtual`){let n=R(t);Ut(()=>{let r=R(t);(r===n||r===t.body)&&e.isConnected&&nt(e)})}else nt(e)}const Zr=r.createContext(null),Qr=`react-aria-focus-scope-restore`;let q=null;function $r(e){let{children:t,contain:n,restoreFocus:i,autoFocus:a}=e,o=d(null),u=d(null),f=d([]),{parentNode:p}=s(Zr)||{},m=l(()=>new _i({scopeRef:f}),[f]);N(()=>{let e=p||Q.root;if(Q.getTreeNode(e.scopeRef)&&q&&!ci(q,e.scopeRef)){let t=Q.getTreeNode(q);t&&(e=t)}e.addChild(m),Q.addNode(m)},[m,p]),N(()=>{let e=Q.getTreeNode(f);e&&(e.contain=!!n)},[n]),N(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==u.current;)t.push(e),e.addEventListener(Qr,n),e=e.nextSibling;return f.current=t,()=>{for(let e of t)e.removeEventListener(Qr,n)}},[t]),fi(f,i,n),ai(f,n),mi(f,i,n),di(f,a),c(()=>{let e=R(P(f.current?f.current[0]:void 0)),t=null;if(J(e,f.current)){for(let n of Q.traverse())n.scopeRef&&J(e,n.scopeRef.current)&&(t=n);t===Q.getTreeNode(f)&&(q=t.scopeRef)}},[f]),N(()=>()=>{let e=Q.getTreeNode(f)?.parent?.scopeRef??null;(f===q||ci(f,q))&&(!e||Q.getTreeNode(e))&&(q=e),Q.removeTreeNode(f)},[f]);let h=l(()=>ei(f),[]),g=l(()=>({focusManager:h,parentNode:m}),[m,h]);return r.createElement(Zr.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 ei(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||R(P(n[0]??void 0)),c=n[0].previousElementSibling,l=Z(ti(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||R(P(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=Z(ti(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(ti(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(ti(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&X(o,!0),o}}}function ti(e){return e[0].parentElement}function ni(e){let t=Q.getTreeNode(q);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function ri(e){if(!e.form)return Array.from(P(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=F(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ii(e){if(e.checked)return!0;let t=ri(e);return t.length>0&&!t.some(e=>e.checked)}function ai(e,t){let n=d(void 0),r=d(void 0);N(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=P(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!ni(e)||t.isComposing)return;let n=R(a),r=e.current;if(!r||!J(n,r))return;let i=Z(ti(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 F(o).HTMLInputElement&&o.select())},s=t=>{(!q||ci(q,e))&&J(z(t),e.current)?(q=e,n.current=z(t)):ni(e)&&!Y(z(t),e)?n.current?n.current.focus():q&&q.current&&ui(q.current):ni(e)&&(n.current=z(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=Gr(),i=(r===`virtual`||r===null)&&et()&&$e(),o=R(a);if(!i&&o&&ni(e)&&!Y(o,e)){q=e;let r=z(t);r&&r.isConnected?(n.current=r,n.current?.focus()):q.current&&ui(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]),N(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function oi(e){return Y(e)}function J(e,t){return!e||!t?!1:t.some(t=>L(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 si(e){return Y(e,q)}function ci(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{Xr(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function li(e,t=!0){let n=e[0].previousElementSibling,r=ti(e),i=Z(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=ti(e),i=Z(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function ui(e,t=!0){X(li(e,t))}function di(e,t){let n=r.useRef(t);c(()=>{n.current&&(q=e,!J(R(P(e.current?e.current[0]:void 0)),q.current)&&e.current&&ui(e.current)),n.current=!1},[e])}function fi(e,t,n){N(()=>{if(t||n)return;let r=e.current,i=P(r?r[0]:void 0),a=t=>{let n=z(t);J(n,e.current)?q=e:oi(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 pi(e){let t=Q.getTreeNode(q);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function mi(e,t,n){let r=d(typeof document<`u`?R(P(e.current?e.current[0]:void 0)):null);N(()=>{let r=e.current,i=P(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!q||ci(q,e))&&J(R(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]),N(()=>{let r=P(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!ni(e)||t.isComposing)return;let n=r.activeElement;if(!Y(n,e)||!pi(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):oi(a)?X(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),N(()=>{let n=P(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=R(n);if(t&&i&&(a&&Y(a,e)||a===n.body&&pi(e))){let t=Q.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){hi(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Q.getTreeNode(n.scopeRef)){hi(li(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function hi(e){e.dispatchEvent(new CustomEvent(Qr,{bubbles:!0,cancelable:!0}))&&X(e)}function Z(e,t,n){let r=t?.tabbable?gn:hn,i=P(e?.nodeType===Node.ELEMENT_NODE?e:null),a=jt(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return L(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!ii(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 gi=class e{constructor(){this.fastMap=new Map,this.root=new _i({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 _i({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}},_i=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 gi;function vi(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(z(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=cr(a),c=o(e=>{let t=z(e),r=P(t),a=r?R(r):R();t===e.currentTarget&&t===a&&(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 yi(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 bi(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:yi(e.onKeyDown),onKeyUp:yi(e.onKeyUp)}}}let xi=r.createContext(null);function Si(e){let t=s(xi)||{};Yt(t,e);let{ref:n,...r}=t;return r}function Ci(e,t){let{focusProps:n}=vi(e),{keyboardProps:r}=bi(e),i=B(n,r),a=Si(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&Xr(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:B({...i,tabIndex:l},o)}}const wi=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function Ti(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;wi(()=>{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])]}function Ei(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=Wt(),l=o(e=>{L(e.currentTarget,z(e))&&a.current.isFocusWithin&&!L(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=cr(l),f=o(e=>{if(!L(e.currentTarget,z(e)))return;let t=z(e),n=P(t),o=R(n);if(!a.current.isFocusWithin&&o===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let t=e.currentTarget;s(n,`focus`,e=>{let r=z(e);if(a.current.isFocusWithin&&!L(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});sr(e,t),l(or(e))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}function Di(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||Wr()}),[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,i.current.isFocusVisible=Wr(),s(e),u()},[u]);Yr(e=>{i.current.isFocusVisible=e,u()},[n,a],{enabled:a,isTextInput:n});let{focusProps:m}=vi({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=Ei({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}function Oi({children:e}){let t=l(()=>({register:()=>{}}),[]);return r.createElement(gr.Provider,{value:t},e)}let ki=!1,Ai=0;function ji(){ki=!0,setTimeout(()=>{ki=!1},500)}function Mi(e){e.pointerType===`touch`&&ji()}function Ni(){let e=P(null);if(e!==void 0)return Ai===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,Mi),Ai++,()=>{Ai--,!(Ai>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,Mi)}}function Pi(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(Ni,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=Wt(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!L(e.currentTarget,z(e)))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(P(z(e)),`pointerover`,e=>{s.isHovered&&s.target&&!L(s.target,z(e))&&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=>{ki&&t.pointerType===`mouse`||e(t,t.pointerType)},c.onPointerLeave=e=>{!i&&L(e.currentTarget,z(e))&&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 Fi(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=d({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=Jt(e=>{n&&Ii(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=Jt(e=>{n&&n(e)});c(()=>{let e=a.current;if(r)return;let n=t.current,i=P(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Ii(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 Ii(e,t){if(e.button>0)return!1;let n=z(e);if(n){let e=n.ownerDocument;if(!e||!L(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 Li=i(!1);function Ri(e){let t=(t,n)=>s(Li)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function zi(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}=Sr({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Ci(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=B(y,_,V(e,{labelable:!0}));return{isPressed:v,buttonProps:B(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}const Bi={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 Vi(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=Ei({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Bi,...t}:Bi,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Hi(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Vi(e);return r.createElement(n,B(o,s),t)}const Ui=i({});function Wi(){return s(Ui)??{}}const Gi=r.createContext(null);function Ki(e){let t=vt(),{portalContainer:n=t?null:document.body,isExiting:i}=e,[a,o]=f(!1),s=l(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Wi();if(!e.portalContainer&&c&&(n=c()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=r.createElement($r,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},u)),u=r.createElement(Gi.Provider,{value:s},r.createElement(Oi,null,u)),x.createPortal(u,n)}function qi(){let e=s(Gi)?.setContain;N(()=>{e?.(!0)},[e])}function Ji(e,t){let{role:n=`dialog`}=e,r=Tt();r=e[`aria-label`]?void 0:r;let i=d(!1);return c(()=>{if(t.current&&!kt(t.current)){Xr(t.current);let e=setTimeout(()=>{(R()===t.current||R()===document.body)&&(i.current=!0,t.current&&(t.current.blur(),Xr(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),qi(),d(!1),c(()=>{}),{dialogProps:{...V(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}var Yi={};Yi={dismiss:`تجاهل`};var Xi={};Xi={dismiss:`Отхвърляне`};var Zi={};Zi={dismiss:`Odstranit`};var Qi={};Qi={dismiss:`Luk`};var $i={};$i={dismiss:`Schließen`};var ea={};ea={dismiss:`Απόρριψη`};var ta={};ta={dismiss:`Dismiss`};var na={};na={dismiss:`Descartar`};var ra={};ra={dismiss:`Lõpeta`};var ia={};ia={dismiss:`Hylkää`};var aa={};aa={dismiss:`Rejeter`};var oa={};oa={dismiss:`התעלם`};var sa={};sa={dismiss:`Odbaci`};var ca={};ca={dismiss:`Elutasítás`};var la={};la={dismiss:`Ignora`};var ua={};ua={dismiss:`閉じる`};var da={};da={dismiss:`무시`};var fa={};fa={dismiss:`Atmesti`};var pa={};pa={dismiss:`Nerādīt`};var ma={};ma={dismiss:`Lukk`};var ha={};ha={dismiss:`Negeren`};var ga={};ga={dismiss:`Zignoruj`};var _a={};_a={dismiss:`Descartar`};var va={};va={dismiss:`Dispensar`};var ya={};ya={dismiss:`Revocare`};var ba={};ba={dismiss:`Пропустить`};var xa={};xa={dismiss:`Zrušiť`};var Sa={};Sa={dismiss:`Opusti`};var Ca={};Ca={dismiss:`Odbaci`};var wa={};wa={dismiss:`Avvisa`};var Ta={};Ta={dismiss:`Kapat`};var Ea={};Ea={dismiss:`Скасувати`};var Da={};Da={dismiss:`取消`};var Oa={};Oa={dismiss:`關閉`};var ka={};ka={"ar-AE":Yi,"bg-BG":Xi,"cs-CZ":Zi,"da-DK":Qi,"de-DE":$i,"el-GR":ea,"en-US":ta,"es-ES":na,"et-EE":ra,"fi-FI":ia,"fr-FR":aa,"he-IL":oa,"hr-HR":sa,"hu-HU":ca,"it-IT":la,"ja-JP":ua,"ko-KR":da,"lt-LT":fa,"lv-LV":pa,"nb-NO":ma,"nl-NL":ha,"pl-PL":ga,"pt-BR":_a,"pt-PT":va,"ro-RO":ya,"ru-RU":ba,"sk-SK":xa,"sl-SI":Sa,"sr-SP":Ca,"sv-SE":wa,"tr-TR":Ta,"uk-UA":Ea,"zh-CN":Da,"zh-TW":Oa};function Aa(e){return e&&e.__esModule?e.default:e}function ja(e){let{onDismiss:t,...n}=e,i=Gt(n,ar(Aa(ka),`@react-aria/overlays`).format(`dismiss`)),a=()=>{t&&t()};return r.createElement(Hi,null,r.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}const $=[];function Ma(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,l=d(void 0);c(()=>{if(i&&!$.includes(t))return $.push(t),()=>{let e=$.indexOf(t);e>=0&&$.splice(e,1)}},[i,t]);let u=()=>{$[$.length-1]===t&&n&&n()},f=e=>{let n=$[$.length-1];l.current=n,(!s||s(z(e)))&&n===t&&e.stopPropagation()},p=e=>{(!s||s(z(e)))&&($[$.length-1]===t&&e.stopPropagation(),l.current===t&&u()),l.current=void 0},m=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),u())};Fi({ref:t,onInteractOutside:a&&i?p:void 0,onInteractOutsideStart:f});let{focusWithinProps:h}=Ei({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||si(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:m,...h},underlayProps:{}}}const Na=typeof document<`u`&&window.visualViewport;let Pa=0,Fa;function Ia(e={}){let{isDisabled:t}=e;N(()=>{if(!t)return Pa++,Pa===1&&(Fa=Ze()?Ra():La()),()=>{Pa--,Pa===0&&Fa()}},[t])}function La(){let e=window.innerWidth-document.documentElement.clientWidth;return Et(e>0&&(`scrollbarGutter`in document.documentElement.style?za(document.documentElement,`scrollbarGutter`,`stable`):za(document.documentElement,`paddingRight`,`${e}px`)),za(document.documentElement,`overflow`,`hidden`))}function Ra(){let e=za(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=z(e);t=Xt(r)?r:Zt(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=bn();a&&(i.nonce=a),i.textContent=`@layer {
8
- * {
9
- overscroll-behavior: contain;
10
- }
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=z(e),n=e.relatedTarget;n&&$t(n)?(n.focus({preventScroll:!0}),Va(n,$t(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=R(),n=t!=null&&$t(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Va(this,n)};let l=Et(Ba(document,`touchstart`,r,{passive:!1,capture:!0}),Ba(document,`touchmove`,o,{passive:!1,capture:!0}),Ba(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function za(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ba(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Va(e,t){t||!Na?Ha(e):Na.addEventListener(`resize`,()=>Ha(e),{once:!0})}function Ha(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Zt(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;Na&&(n=Math.min(n,Na.offsetTop+Na.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 Ua(e,t,n){let{overlayProps:r,underlayProps:i}=Ma({...e,isOpen:t.isOpen,onClose:t.close},n);return Ia({isDisabled:!t.isOpen}),qi(),c(()=>{if(t.isOpen&&n.current)return Fn([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:B(r),underlayProps:i}}const Wa=i({}),Ga=Ri(function(e,t){[e,t]=En(e,t,Wa);let{elementType:n=`label`,...i}=e,a=jn[n];return r.createElement(a,{className:`react-aria-Label`,...i,ref:t})}),Ka=i(null),qa=7e3;let Ja=null;function Ya(e,t=`assertive`,n=qa){Ja?Ja.announce(e,t,n):(Ja=new Xa,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?Ja.announce(e,t,n):setTimeout(()=>{Ja?.isAttached()&&Ja?.announce(e,t,n)},100))}var Xa=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=qa){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 Za=i({}),Qa=Ri(function(e,t){[e,t]=En(e,t,Za);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=zi(e,t);a=eo(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=Di(e),{hoverProps:f,isHovered:p}=Pi({...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=Cn({...e,values:m,defaultClassName:`react-aria-Button`}),g=Ct(a.id),_=Ct(),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)&&Ya(e,`assertive`),y.current=i},[i,l,v,g]);let b=V(e,{global:!0});return delete b.onClick,r.createElement(jn.button,{...B(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(Ka.Provider,{value:{id:_}},h.children))}),$a=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function eo(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!$a.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}function to(e){let[t,n]=Ti(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])}}const no=i(null),ro=i(null),io=a(function(e,t){let n=e[`aria-labelledby`];[e,t]=En(e,t,no);let{dialogProps:i,titleProps:a}=Ji({...e,"aria-labelledby":n},t),o=s(ro);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let c=Cn({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),l=V(e,{global:!0});return r.createElement(jn.section,{...B(l,c,i),render:e.render,ref:t,slot:e.slot||void 0},r.createElement(Sn,{values:[[We,{slots:{[xn]:{},title:{...a,level:2}}}],[Za,{slots:{[xn]:{},close:{onPress:()=>o?.close()}}}]]},c.children))}),ao=i(null),oo=i(null),so=a(function(e,t){if(s(oo))return r.createElement(fo,{...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(lo,{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},r.createElement(fo,{...m,modalRef:t},l))});function co(e,t){[e,t]=En(e,t,ao);let n=s(ro),i=to(e),a=e.isOpen!=null||e.defaultOpen!=null||!n?i:n,o=Kt(t),c=d(null),l=on(o,a.isOpen),u=on(c,a.isOpen),f=l||u||e.isExiting||!1,p=vt();return!a.isOpen&&!f||p?null:r.createElement(uo,{...e,state:a,isExiting:f,overlayRef:o,modalRef:c})}const lo=a(co);function uo({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Ua(t,i,n),s=an(t.overlayRef)||t.isEntering||!1,c=Cn({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=en(),u;if(typeof document<`u`){let e=Xt(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(Ki,{isExiting:t.isExiting,portalContainer:e},r.createElement(jn.div,{...B(V(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},r.createElement(Sn,{values:[[oo,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[ro,i]]},c.children)))}function fo(e){let{modalProps:t,modalRef:n,isExiting:i,isDismissable:a}=s(oo),o=s(ro),c=Kt(l(()=>Mt(e.modalRef,n),[e.modalRef,n])),u=an(c),d=Cn({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:o}});return r.createElement(jn.div,{...B(V(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 po=()=>{let[n,r]=f(!1);return c(()=>{let n=t=>{let n=e.safeParse(t);n.error||r(n.data.detail.isRecording)};return document.addEventListener(t,n),()=>{document.removeEventListener(t,n)}},[]),n},mo=({className:e,iconClassName:t,onClose:n})=>po()?null:v(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:v(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:v(`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`})})}),ho=({children:e,classNames:t,isDismissable:r,onDismiss:i,closeOnFinishMs:a})=>{let{survey:o,surveyId:s,dismiss:c}=He(),[l,u]=f(!1);return m(()=>{o&&c()},l?a:null),y(io,{"aria-label":`Survey`,id:`${s}-popover`,className:b(`confetti-modal-dialog ${n}`,t?.dialog),children:[r&&v(mo,{className:b(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),i?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},go=({children:e,classNames:t,onDismiss:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=He();return v(lo,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(await o(),r?.())},className:b(`confetti-modal-overlay ${n}`,t?.overlay),children:v(so,{className:b(`confetti-modal ${n}`,t?.modal),children:v(ho,{classNames:t,isDismissable:i,onDismiss:r,closeOnFinishMs:a,children:e})})})};export{V as A,ze as B,wn as C,Jt as D,Tn as E,Tt as F,Oe as G,He as H,Ct as I,De as J,Te as K,N as L,Mt as M,z as N,Kt as O,F as P,ne as Q,Ge as R,Dn as S,On as T,Le as U,Ve as V,Se as W,pe as X,ke as Y,me as Z,Sr as _,Qa as a,En as b,Hi as c,Di as d,Ei as f,Kr as g,Z as h,po as i,B as j,Gt as k,Ri as l,Ci as m,ho as n,Wa as o,Ti as p,we as q,mo as r,Ga as s,go as t,Pi as u,Kn as v,jn as w,Cn as x,Sn as y,Ue as z};