@memori.ai/ui 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +36 -6
- package/dist/index.d.ts +21 -2
- package/dist/memori-ai-ui.cjs.js +11 -11
- package/dist/memori-ai-ui.cjs.js.map +1 -1
- package/dist/memori-ai-ui.css +1 -1
- package/dist/memori-ai-ui.es.js +1686 -1624
- package/dist/memori-ai-ui.es.js.map +1 -1
- package/package.json +1 -1
package/dist/memori-ai-ui.cjs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";var Kc=Object.defineProperty;var zc=(e,t,n)=>t in e?Kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ce=(e,t,n)=>zc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react"),T=require("react/jsx-runtime"),ye=require("classnames"),Ue=require("lucide-react"),Gc=require("react-dom"),Yc=require("react-i18next"),Ve=require("@base-ui/react");function ys(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=ys(be),ct=ys(Gc);function Un(){return typeof window<"u"}function Rt(e){return Ar(e)?(e.nodeName||"").toLowerCase():"#document"}function Ae(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dt(e){var t;return(t=(Ar(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ar(e){return Un()?e instanceof Node||e instanceof Ae(e).Node:!1}function we(e){return Un()?e instanceof Element||e instanceof Ae(e).Element:!1}function Pe(e){return Un()?e instanceof HTMLElement||e instanceof Ae(e).HTMLElement:!1}function br(e){return!Un()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ae(e).ShadowRoot}const qc=new Set(["inline","contents"]);function _t(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qc.has(o)}const Xc=new Set(["table","td","th"]);function Jc(e){return Xc.has(Rt(e))}const Zc=[":popover-open",":modal"];function Wn(e){return Zc.some(t=>{try{return e.matches(t)}catch{return!1}})}const Qc=["transform","translate","scale","rotate","perspective"],ea=["transform","translate","scale","rotate","perspective","filter"],ta=["paint","layout","strict","content"];function Lr(e){const t=Kn(),n=we(e)?Qe(e):e;return Qc.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ea.some(r=>(n.willChange||"").includes(r))||ta.some(r=>(n.contain||"").includes(r))}function na(e){let t=ft(e);for(;Pe(t)&&!at(t);){if(Lr(t))return t;if(Wn(t))return null;t=ft(t)}return null}function Kn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ra=new Set(["html","body","#document"]);function at(e){return ra.has(Rt(e))}function Qe(e){return Ae(e).getComputedStyle(e)}function zn(e){return we(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Rt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||br(e)&&e.host||dt(e);return br(t)?t.host:t}function vs(e){const t=ft(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pe(t)&&_t(t)?t:vs(t)}function vt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vs(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Ae(o);if(s){const i=yr(c);return t.concat(c,c.visualViewport||[],_t(o)?o:[],i&&n?vt(i):[])}return t.concat(o,vt(o,[],n))}function yr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ye(e){return e?.ownerDocument||document}const Co={};function et(e,t){const n=l.useRef(Co);return n.current===Co&&(n.current=e(t)),n}const tr=l[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],oa=tr&&tr!==l.useLayoutEffect?tr:e=>e();function X(e){const t=et(sa).current;return t.next=e,oa(t.effect),t.trampoline}function sa(){const e={next:void 0,callback:ia,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function ia(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}let Oo=0;function ca(e){return Oo+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Oo}`}const aa=[];function Fr(e){l.useEffect(e,aa)}const Zt=0;class pt{constructor(){Ce(this,"currentId",Zt);Ce(this,"clear",()=>{this.currentId!==Zt&&(clearTimeout(this.currentId),this.currentId=Zt)});Ce(this,"disposeEffect",()=>this.clear)}static create(){return new pt}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zt,n()},t)}isStarted(){return this.currentId!==Zt}}function tt(){const e=et(pt.create).current;return Fr(e.disposeEffect),e}const Yt=typeof navigator<"u",nr=da(),Es=ma(),xs=pa(),la=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),ua=nr.platform==="MacIntel"&&nr.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(nr.platform),ws=Yt&&/apple/i.test(navigator.vendor),vr=Yt&&/android/i.test(Es)||/android/i.test(xs),fa=Yt&&Es.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Rs=xs.includes("jsdom/");function da(){if(!Yt)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function pa(){if(!Yt)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function ma(){if(!Yt)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Er="data-base-ui-focusable",Ss="active",Cs="selected",Os="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Et="ArrowLeft",xt="ArrowRight",Vr="ArrowUp",un="ArrowDown";function Ge(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function me(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&br(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Le(e){return"composedPath"in e?e.composedPath()[0]:e.target}function st(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function ga(e){return e.matches("html,body")}function _e(e){return e?.ownerDocument||document}function jr(e){return Pe(e)&&e.matches(Os)}function xr(e){return e?e.getAttribute("role")==="combobox"&&jr(e):!1}function In(e){if(!e||Rs)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Pn(e){return e?e.hasAttribute(Er)?e:e.querySelector(`[${Er}]`)||e:null}function It(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...It(e,o.id,n)])}function To(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function He(e){e.preventDefault(),e.stopPropagation()}function ha(e){return"nativeEvent"in e}function Ts(e){return e.mozInputSource===0&&e.isTrusted?!0:vr&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ns(e){return Rs?!1:!vr&&e.width===0&&e.height===0||vr&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function $t(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Ms(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Fe(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const ba=["top","right","bottom","left"],Ht=Math.min,qe=Math.max,Dn=Math.round,Ft=Math.floor,lt=e=>({x:e,y:e}),ya={left:"right",right:"left",bottom:"top",top:"bottom"},va={start:"end",end:"start"};function wr(e,t,n){return qe(e,Ht(t,n))}function mt(e,t){return typeof e=="function"?e(t):e}function Ze(e){return e.split("-")[0]}function St(e){return e.split("-")[1]}function Br(e){return e==="x"?"y":"x"}function $r(e){return e==="y"?"height":"width"}const Ea=new Set(["top","bottom"]);function rt(e){return Ea.has(Ze(e))?"y":"x"}function Hr(e){return Br(rt(e))}function xa(e,t,n){n===void 0&&(n=!1);const r=St(e),o=Hr(e),s=$r(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=_n(c)),[c,_n(c)]}function wa(e){const t=_n(e);return[Rr(e),t,Rr(t)]}function Rr(e){return e.replace(/start|end/g,t=>va[t])}const No=["left","right"],Mo=["right","left"],Ra=["top","bottom"],Sa=["bottom","top"];function Ca(e,t,n){switch(e){case"top":case"bottom":return n?t?Mo:No:t?No:Mo;case"left":case"right":return t?Ra:Sa;default:return[]}}function Oa(e,t,n,r){const o=St(e);let s=Ca(Ze(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Rr)))),s}function _n(e){return e.replace(/left|right|bottom|top/g,t=>ya[t])}function Ta(e){return{top:0,right:0,bottom:0,left:0,...e}}function Is(e){return typeof e!="number"?Ta(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function gn(e,t,n){return Math.floor(e/t)!==n}function tn(e,t){return t<0||t>=e.current.length}function rr(e,t){return $e(e,{disabledIndices:t})}function Io(e,t){return $e(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function $e(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&nn(e,s,r));return s}function Na(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:c,minIndex:i,maxIndex:u,prevIndex:a,stopEvent:d=!1}){let f=a;const p=[],m={};let g=!1;{let y=null,v=-1;e.current.forEach((w,E)=>{if(w==null)return;const b=w.closest('[role="row"]');b&&(g=!0),(b!==y||v===-1)&&(y=b,v+=1,p[v]=[]),p[v].push(E),m[E]=v})}const h=g&&p.length>0&&p.some(y=>y.length!==s);function x(y){if(!h||a===-1)return;const v=m[a];if(v==null)return;const w=p[v].indexOf(a);let E=y==="up"?v-1:v+1;r&&(E<0?E=p.length-1:E>=p.length&&(E=0));const b=new Set;for(;E>=0&&E<p.length&&!b.has(E);){b.add(E);const R=p[E];if(R.length===0){E=y==="up"?E-1:E+1;continue}const C=Math.min(w,R.length-1);for(let N=C;N>=0;N-=1){const _=R[N];if(!nn(e,_,c))return _}E=y==="up"?E-1:E+1,r&&(E<0?E=p.length-1:E>=p.length&&(E=0))}}if(t.key===Vr){const y=x("up");if(y!==void 0)d&&He(t),f=y;else{if(d&&He(t),a===-1)f=u;else if(f=$e(e,{startingIndex:f,amount:s,decrement:!0,disabledIndices:c}),r&&(a-s<i||f<0)){const v=a%s,w=u%s,E=u-(w-v);w===v?f=u:f=w>v?E:E-s}tn(e,f)&&(f=a)}}if(t.key===un){const y=x("down");y!==void 0?(d&&He(t),f=y):(d&&He(t),a===-1?f=i:(f=$e(e,{startingIndex:a,amount:s,disabledIndices:c}),r&&a+s>u&&(f=$e(e,{startingIndex:a%s-s,amount:s,disabledIndices:c}))),tn(e,f)&&(f=a))}if(n==="both"){const y=Ft(a/s);t.key===(o?Et:xt)&&(d&&He(t),a%s!==s-1?(f=$e(e,{startingIndex:a,disabledIndices:c}),r&&gn(f,s,y)&&(f=$e(e,{startingIndex:a-a%s-1,disabledIndices:c}))):r&&(f=$e(e,{startingIndex:a-a%s-1,disabledIndices:c})),gn(f,s,y)&&(f=a)),t.key===(o?xt:Et)&&(d&&He(t),a%s!==0?(f=$e(e,{startingIndex:a,decrement:!0,disabledIndices:c}),r&&gn(f,s,y)&&(f=$e(e,{startingIndex:a+(s-a%s),decrement:!0,disabledIndices:c}))):r&&(f=$e(e,{startingIndex:a+(s-a%s),decrement:!0,disabledIndices:c})),gn(f,s,y)&&(f=a));const v=Ft(u/s)===y;tn(e,f)&&(r&&v?f=t.key===(o?xt:Et)?u:$e(e,{startingIndex:a-a%s-1,disabledIndices:c}):f=a)}return f}function Ma(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:c},i)=>{if(s>t&&process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`[Floating UI]: Invalid grid - item width at index ${i} is greater than grid columns`:Fe(29,i));let u=!1;for(n&&(o=0);!u;){const a=[];for(let d=0;d<s;d+=1)for(let f=0;f<c;f+=1)a.push(o+d+f*t);o%t+s<=t&&a.every(d=>r[d]==null)?(a.forEach(d=>{r[d]=i}),u=!0):o+=1}}),[...r]}function Ia(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),c=t[e];switch(o){case"tl":return s;case"tr":return c?s+c.width-1:s;case"bl":return c?s+(c.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Pa(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function nn(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}/*!
|
|
1
|
+
"use strict";var Kc=Object.defineProperty;var zc=(e,t,n)=>t in e?Kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ce=(e,t,n)=>zc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react"),T=require("react/jsx-runtime"),ye=require("classnames"),Ue=require("lucide-react"),Gc=require("react-dom"),Yc=require("react-i18next"),Ve=require("@base-ui/react");function vs(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const f=vs(be),ct=vs(Gc);function Un(){return typeof window<"u"}function Rt(e){return Lr(e)?(e.nodeName||"").toLowerCase():"#document"}function Ae(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dt(e){var t;return(t=(Lr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lr(e){return Un()?e instanceof Node||e instanceof Ae(e).Node:!1}function we(e){return Un()?e instanceof Element||e instanceof Ae(e).Element:!1}function Pe(e){return Un()?e instanceof HTMLElement||e instanceof Ae(e).HTMLElement:!1}function br(e){return!Un()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ae(e).ShadowRoot}const qc=new Set(["inline","contents"]);function kt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qc.has(o)}const Xc=new Set(["table","td","th"]);function Jc(e){return Xc.has(Rt(e))}const Zc=[":popover-open",":modal"];function Wn(e){return Zc.some(t=>{try{return e.matches(t)}catch{return!1}})}const Qc=["transform","translate","scale","rotate","perspective"],ea=["transform","translate","scale","rotate","perspective","filter"],ta=["paint","layout","strict","content"];function Fr(e){const t=Kn(),n=we(e)?Qe(e):e;return Qc.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ea.some(r=>(n.willChange||"").includes(r))||ta.some(r=>(n.contain||"").includes(r))}function na(e){let t=ft(e);for(;Pe(t)&&!at(t);){if(Fr(t))return t;if(Wn(t))return null;t=ft(t)}return null}function Kn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ra=new Set(["html","body","#document"]);function at(e){return ra.has(Rt(e))}function Qe(e){return Ae(e).getComputedStyle(e)}function zn(e){return we(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Rt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||br(e)&&e.host||dt(e);return br(t)?t.host:t}function Es(e){const t=ft(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pe(t)&&kt(t)?t:Es(t)}function vt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Es(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Ae(o);if(s){const i=yr(c);return t.concat(c,c.visualViewport||[],kt(o)?o:[],i&&n?vt(i):[])}return t.concat(o,vt(o,[],n))}function yr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ye(e){return e?.ownerDocument||document}const Oo={};function et(e,t){const n=f.useRef(Oo);return n.current===Oo&&(n.current=e(t)),n}const tr=f[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],oa=tr&&tr!==f.useLayoutEffect?tr:e=>e();function X(e){const t=et(sa).current;return t.next=e,oa(t.effect),t.trampoline}function sa(){const e={next:void 0,callback:ia,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function ia(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}let To=0;function ca(e){return To+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${To}`}const aa=[];function Vr(e){f.useEffect(e,aa)}const Zt=0;class pt{constructor(){Ce(this,"currentId",Zt);Ce(this,"clear",()=>{this.currentId!==Zt&&(clearTimeout(this.currentId),this.currentId=Zt)});Ce(this,"disposeEffect",()=>this.clear)}static create(){return new pt}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zt,n()},t)}isStarted(){return this.currentId!==Zt}}function tt(){const e=et(pt.create).current;return Vr(e.disposeEffect),e}const Yt=typeof navigator<"u",nr=da(),xs=ma(),ws=pa(),la=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),ua=nr.platform==="MacIntel"&&nr.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(nr.platform),Rs=Yt&&/apple/i.test(navigator.vendor),vr=Yt&&/android/i.test(xs)||/android/i.test(ws),fa=Yt&&xs.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Ss=ws.includes("jsdom/");function da(){if(!Yt)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function pa(){if(!Yt)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function ma(){if(!Yt)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Er="data-base-ui-focusable",Cs="active",Os="selected",Ts="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Et="ArrowLeft",xt="ArrowRight",jr="ArrowUp",un="ArrowDown";function Ge(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function me(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&br(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Le(e){return"composedPath"in e?e.composedPath()[0]:e.target}function st(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function ga(e){return e.matches("html,body")}function _e(e){return e?.ownerDocument||document}function Br(e){return Pe(e)&&e.matches(Ts)}function xr(e){return e?e.getAttribute("role")==="combobox"&&Br(e):!1}function In(e){if(!e||Ss)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Pn(e){return e?e.hasAttribute(Er)?e:e.querySelector(`[${Er}]`)||e:null}function It(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...It(e,o.id,n)])}function No(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function He(e){e.preventDefault(),e.stopPropagation()}function ha(e){return"nativeEvent"in e}function Ns(e){return e.mozInputSource===0&&e.isTrusted?!0:vr&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ms(e){return Ss?!1:!vr&&e.width===0&&e.height===0||vr&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Ht(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Is(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Fe(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const ba=["top","right","bottom","left"],Ut=Math.min,qe=Math.max,Dn=Math.round,Vt=Math.floor,lt=e=>({x:e,y:e}),ya={left:"right",right:"left",bottom:"top",top:"bottom"},va={start:"end",end:"start"};function wr(e,t,n){return qe(e,Ut(t,n))}function mt(e,t){return typeof e=="function"?e(t):e}function Ze(e){return e.split("-")[0]}function St(e){return e.split("-")[1]}function $r(e){return e==="x"?"y":"x"}function Hr(e){return e==="y"?"height":"width"}const Ea=new Set(["top","bottom"]);function rt(e){return Ea.has(Ze(e))?"y":"x"}function Ur(e){return $r(rt(e))}function xa(e,t,n){n===void 0&&(n=!1);const r=St(e),o=Ur(e),s=Hr(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=_n(c)),[c,_n(c)]}function wa(e){const t=_n(e);return[Rr(e),t,Rr(t)]}function Rr(e){return e.replace(/start|end/g,t=>va[t])}const Mo=["left","right"],Io=["right","left"],Ra=["top","bottom"],Sa=["bottom","top"];function Ca(e,t,n){switch(e){case"top":case"bottom":return n?t?Io:Mo:t?Mo:Io;case"left":case"right":return t?Ra:Sa;default:return[]}}function Oa(e,t,n,r){const o=St(e);let s=Ca(Ze(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Rr)))),s}function _n(e){return e.replace(/left|right|bottom|top/g,t=>ya[t])}function Ta(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ps(e){return typeof e!="number"?Ta(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function gn(e,t,n){return Math.floor(e/t)!==n}function tn(e,t){return t<0||t>=e.current.length}function rr(e,t){return $e(e,{disabledIndices:t})}function Po(e,t){return $e(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function $e(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&nn(e,s,r));return s}function Na(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:c,minIndex:i,maxIndex:u,prevIndex:a,stopEvent:d=!1}){let l=a;const p=[],m={};let g=!1;{let y=null,v=-1;e.current.forEach((w,x)=>{if(w==null)return;const b=w.closest('[role="row"]');b&&(g=!0),(b!==y||v===-1)&&(y=b,v+=1,p[v]=[]),p[v].push(x),m[x]=v})}const h=g&&p.length>0&&p.some(y=>y.length!==s);function E(y){if(!h||a===-1)return;const v=m[a];if(v==null)return;const w=p[v].indexOf(a);let x=y==="up"?v-1:v+1;r&&(x<0?x=p.length-1:x>=p.length&&(x=0));const b=new Set;for(;x>=0&&x<p.length&&!b.has(x);){b.add(x);const R=p[x];if(R.length===0){x=y==="up"?x-1:x+1;continue}const C=Math.min(w,R.length-1);for(let N=C;N>=0;N-=1){const _=R[N];if(!nn(e,_,c))return _}x=y==="up"?x-1:x+1,r&&(x<0?x=p.length-1:x>=p.length&&(x=0))}}if(t.key===jr){const y=E("up");if(y!==void 0)d&&He(t),l=y;else{if(d&&He(t),a===-1)l=u;else if(l=$e(e,{startingIndex:l,amount:s,decrement:!0,disabledIndices:c}),r&&(a-s<i||l<0)){const v=a%s,w=u%s,x=u-(w-v);w===v?l=u:l=w>v?x:x-s}tn(e,l)&&(l=a)}}if(t.key===un){const y=E("down");y!==void 0?(d&&He(t),l=y):(d&&He(t),a===-1?l=i:(l=$e(e,{startingIndex:a,amount:s,disabledIndices:c}),r&&a+s>u&&(l=$e(e,{startingIndex:a%s-s,amount:s,disabledIndices:c}))),tn(e,l)&&(l=a))}if(n==="both"){const y=Vt(a/s);t.key===(o?Et:xt)&&(d&&He(t),a%s!==s-1?(l=$e(e,{startingIndex:a,disabledIndices:c}),r&&gn(l,s,y)&&(l=$e(e,{startingIndex:a-a%s-1,disabledIndices:c}))):r&&(l=$e(e,{startingIndex:a-a%s-1,disabledIndices:c})),gn(l,s,y)&&(l=a)),t.key===(o?xt:Et)&&(d&&He(t),a%s!==0?(l=$e(e,{startingIndex:a,decrement:!0,disabledIndices:c}),r&&gn(l,s,y)&&(l=$e(e,{startingIndex:a+(s-a%s),decrement:!0,disabledIndices:c}))):r&&(l=$e(e,{startingIndex:a+(s-a%s),decrement:!0,disabledIndices:c})),gn(l,s,y)&&(l=a));const v=Vt(u/s)===y;tn(e,l)&&(r&&v?l=t.key===(o?xt:Et)?u:$e(e,{startingIndex:a-a%s-1,disabledIndices:c}):l=a)}return l}function Ma(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:c},i)=>{if(s>t&&process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV!=="production"?`[Floating UI]: Invalid grid - item width at index ${i} is greater than grid columns`:Fe(29,i));let u=!1;for(n&&(o=0);!u;){const a=[];for(let d=0;d<s;d+=1)for(let l=0;l<c;l+=1)a.push(o+d+l*t);o%t+s<=t&&a.every(d=>r[d]==null)?(a.forEach(d=>{r[d]=i}),u=!0):o+=1}}),[...r]}function Ia(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),c=t[e];switch(o){case"tl":return s;case"tr":return c?s+c.width-1:s;case"bl":return c?s+(c.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Pa(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function nn(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}/*!
|
|
2
2
|
* tabbable 6.4.0
|
|
3
3
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
4
|
-
*/var Da=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],An=Da.join(","),Ps=typeof Element>"u",Ut=Ps?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ln=!Ps&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Fn=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",c=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Fn(t.parentNode));return c},_a=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Ds=function(t,n,r){if(Fn(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(An));return n&&Ut.call(t,An)&&o.unshift(t),o=o.filter(r),o},Vn=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var c=s.shift();if(!Fn(c,!1))if(c.tagName==="SLOT"){var i=c.assignedElements(),u=i.length?i:c.children,a=Vn(u,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:c,candidates:a})}else{var d=Ut.call(c,An);d&&r.filter(c)&&(n||!t.includes(c))&&o.push(c);var f=c.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(c),p=!Fn(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(f&&p){var m=Vn(f===!0?c.children:f.children,!0,r);r.flatten?o.push.apply(o,m):o.push({scopeParent:c,candidates:m})}else s.unshift.apply(s,c.children)}}return o},_s=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ks=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||_a(t))&&!_s(t)?0:t.tabIndex},ka=function(t,n){var r=ks(t);return r<0&&n&&!_s(t)?0:r},Aa=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},As=function(t){return t.tagName==="INPUT"},La=function(t){return As(t)&&t.type==="hidden"},Fa=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Va=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},ja=function(t){if(!t.name)return!0;var n=t.form||Ln(t),r=function(i){return n.querySelectorAll('input[type="radio"][name="'+i+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(c){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",c.message),!1}var s=Va(o,t.form);return!s||s===t},Ba=function(t){return As(t)&&t.type==="radio"},$a=function(t){return Ba(t)&&!ja(t)},Ha=function(t){var n,r=t&&Ln(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var c,i,u;for(s=!!((c=o)!==null&&c!==void 0&&(i=c.ownerDocument)!==null&&i!==void 0&&i.contains(o)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!s&&o;){var a,d,f;r=Ln(o),o=(a=r)===null||a===void 0?void 0:a.host,s=!!((d=o)!==null&&d!==void 0&&(f=d.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Po=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Ua=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var c=Ut.call(t,"details>summary:first-of-type"),i=c?t.parentElement:t;if(Ut.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var u=t;t;){var a=t.parentElement,d=Ln(t);if(a&&!a.shadowRoot&&o(a)===!0)return Po(t);t.assignedSlot?t=t.assignedSlot:!a&&d!==t.ownerDocument?t=d.host:t=a}t=u}if(Ha(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Po(t);return!1},Wa=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Ut.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},Sr=function(t,n){return!(n.disabled||La(n)||Ua(n,t)||Fa(n)||Wa(n))},Cr=function(t,n){return!($a(n)||ks(n)<0||!Sr(t,n))},Ka=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ls=function(t){var n=[],r=[];return t.forEach(function(o,s){var c=!!o.scopeParent,i=c?o.scopeParent:o,u=ka(i,c),a=c?Ls(o.candidates):i;u===0?c?n.push.apply(n,a):n.push(i):r.push({documentOrder:s,tabIndex:u,item:o,isScope:c,content:a})}),r.sort(Aa).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},fn=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Vn([t],n.includeContainer,{filter:Cr.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ka}):r=Ds(t,n.includeContainer,Cr.bind(null,n)),Ls(r)},za=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Vn([t],n.includeContainer,{filter:Sr.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Ds(t,n.includeContainer,Sr.bind(null,n)),r},Fs=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Ut.call(t,An)===!1?!1:Cr(n,t)};const qt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Vs(e,t){const n=fn(e,qt()),r=n.length;if(r===0)return;const o=Ge(_e(e)),s=n.indexOf(o),c=s===-1?t===1?0:r-1:s+t;return n[c]}function Ur(e){return Vs(_e(e).body,1)||e}function js(e){return Vs(_e(e).body,-1)||e}function Bs(e,t){if(!e)return null;const n=fn(_e(e).body,qt()),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function Ga(e){return Bs(e,1)}function Ya(e){return Bs(e,-1)}function Vt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!me(n,r)}function qa(e){fn(e,qt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Do(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Gn=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(Gn.displayName="ToastContext");function Wr(){const e=l.useContext(Gn);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":Fe(73));return e}function or(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}const $s=function(t){const{children:n,timeout:r=5e3,limit:o=3,toastManager:s}=t,[c,i]=l.useState([]),[u,a]=l.useState(!1),[d,f]=l.useState(!1),[p,m]=l.useState(null);c.length===0&&(u&&a(!1),d&&f(!1));const g=u||d,h=l.useRef(new Map),x=l.useRef(null),y=l.useRef(!0),v=l.useRef(!1);function w(S){const D=Ge(Ye(x.current));if(!x.current||!me(x.current,D)||!In(D))return;const M=c.findIndex(O=>O.id===S);let P=null,k=M+1;for(;k<c.length;){if(c[k].transitionStatus!=="ending"){P=c[k];break}k+=1}if(!P)for(k=M-1;k>=0;){if(c[k].transitionStatus!=="ending"){P=c[k];break}k-=1}P?P.ref?.current?.focus():p?.focus({preventScroll:!0})}const E=X(()=>{v.current||(v.current=!0,h.current.forEach(S=>{if(S.timeout){S.timeout.clear();const D=Date.now()-S.start,M=S.delay-D;S.remaining=M>0?M:0}}))}),b=X(()=>{v.current&&(v.current=!1,h.current.forEach((S,D)=>{S.remaining=S.remaining>0?S.remaining:S.delay,S.timeout??(S.timeout=pt.create()),S.timeout.start(S.remaining,()=>{h.current.delete(D),S.callback()}),S.start=Date.now()}))}),R=X(S=>{i(P=>{const k=P.map(F=>F.id===S?{...F,transitionStatus:"ending",height:0}:F),O=k.filter(F=>F.transitionStatus!=="ending");return k.map(F=>{if(F.transitionStatus==="ending")return F;const V=O.indexOf(F)>=o;return{...F,limited:V}})});const D=h.current.get(S);D&&D.timeout&&(D.timeout.clear(),h.current.delete(S)),c.find(P=>P.id===S)?.onClose?.(),w(S),c.length===1&&(a(!1),f(!1))}),C=X(S=>{i(M=>M.filter(P=>P.id!==S)),c.find(M=>M.id===S)?.onRemove?.()}),N=X((S,D,M)=>{const P=Date.now(),k=y.current&&!u&&!d,O=k?pt.create():void 0;O?.start(D,()=>{h.current.delete(S),M()}),h.current.set(S,{timeout:O,start:k?P:0,delay:D,remaining:D,callback:M})}),_=X(S=>{const D=S.id||ca("toast"),M={...S,id:D,transitionStatus:"starting"};i(k=>{const O=[M,...k],F=O.filter(V=>V.transitionStatus!=="ending");if(F.length>o){const V=F.length-o,U=F.slice(-V);return O.map(ee=>U.some(H=>H.id===ee.id)?{...ee,limited:!0}:{...ee,limited:!1})}return O.map(V=>({...V,limited:!1}))});const P=M.timeout??r;return M.type!=="loading"&&P>0&&N(D,P,()=>R(D)),(u||d||!y.current)&&E(),D}),L=X((S,D)=>{i(M=>M.map(P=>P.id===S?{...P,...D}:P))}),j=X((S,D)=>{const M=or(D.loading),P=_({...M,type:"loading"}),k=S.then(O=>{const F=or(D.success,O);L(P,{...F,type:"success"});const V=F.timeout??r;return V>0&&N(P,V,()=>R(P)),(u||d||!y.current)&&E(),O}).catch(O=>{const F=or(D.error,O);L(P,{...F,type:"error"});const V=F.timeout??r;return V>0&&N(P,V,()=>R(P)),(u||d||!y.current)&&E(),Promise.reject(O)});return{}.hasOwnProperty.call(D,"setPromise")&&D.setPromise(k),k});l.useEffect(function(){return s?s[" subscribe"](({action:M,options:P})=>{const k=P.id;M==="promise"&&P.promise?j(P.promise,P):M==="update"&&k?L(k,P):M==="close"&&k?R(k):_(P)}):void 0},[_,L,N,r,s,j,R]);const I=l.useMemo(()=>({toasts:c,setToasts:i,hovering:u,setHovering:a,focused:d,setFocused:f,expanded:g,add:_,close:R,remove:C,update:L,promise:j,pauseTimers:E,resumeTimers:b,prevFocusElement:p,setPrevFocusElement:m,viewportRef:x,scheduleTimer:N,windowFocusedRef:y}),[_,R,d,u,g,E,p,j,C,b,N,c,L]);return T.jsx(Gn.Provider,{value:I,children:n})};process.env.NODE_ENV!=="production"&&($s.displayName="ToastProvider");const Kr={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},Xa=()=>{},J=typeof document<"u"?l.useLayoutEffect:Xa,ut=l.forwardRef(function(t,n){const[r,o]=l.useState();J(()=>{ws&&o("button")},[]);const s={tabIndex:0,role:r};return T.jsx("span",{...t,ref:n,style:Kr,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(ut.displayName="FocusGuard");const Hs=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(Hs.displayName="ToastViewportContext");function Pt(e,t,n,r){const o=et(Us).current;return Za(o,e,t,n,r)&&Ws(o,[e,t,n,r]),o.callback}function Ja(e){const t=et(Us).current;return Qa(t,e)&&Ws(t,e),t.callback}function Us(){return{callback:null,cleanup:null,refs:[]}}function Za(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Qa(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Ws(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=s(n);typeof c=="function"&&(r[o]=c);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=r[o];typeof c=="function"?c():s(null);break}case"object":{s.current=null;break}}}}}}}const el=parseInt(l.version,10);function zr(e){return el>=e}function _o(e){if(!l.isValidElement(e))return null;const t=e,n=t.props;return(zr(19)?n?.ref:t.ref)??null}function Or(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function tl(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function nl(e,t){return typeof e=="function"?e(t):e}function rl(e,t){return typeof e=="function"?e(t):e}const rn={};function cn(e,t,n,r,o){let s={...Tr(e,rn)};return t&&(s=On(s,t)),n&&(s=On(s,n)),r&&(s=On(s,r)),s}function ol(e){if(e.length===0)return rn;if(e.length===1)return Tr(e[0],rn);let t={...Tr(e[0],rn)};for(let n=1;n<e.length;n+=1)t=On(t,e[n]);return t}function On(e,t){return Ks(t)?t(e):sl(e,t)}function sl(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Or(e.style,r);break}case"className":{e[n]=zs(e.className,r);break}default:il(n,r)?e[n]=cl(e[n],r):e[n]=r}}return e}function il(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Ks(e){return typeof e=="function"}function Tr(e,t){return Ks(e)?e(t):e??rn}function cl(e,t){return t?e?n=>{if(al(n)){const o=n;Nr(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function Nr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function zs(e,t){return t?e?t+" "+e:t:e}function al(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Xe(){}const jn=Object.freeze([]),ke=Object.freeze({}),ll=500,ul=500,fl={style:{transition:"none"}},dl="data-base-ui-click-trigger",pl={fallbackAxisSide:"none"},ml={fallbackAxisSide:"end"},gl={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Te(e,t,n={}){const r=t.render,o=hl(t,n);if(n.enabled===!1)return null;const s=n.state??ke;return bl(e,r,o,s)}function hl(e,t={}){const{className:n,style:r,render:o}=e,{state:s=ke,ref:c,props:i,stateAttributesMapping:u,enabled:a=!0}=t,d=a?nl(n,s):void 0,f=a?rl(r,s):void 0,p=a?tl(s,u):ke,m=a?Or(p,Array.isArray(i)?ol(i):i)??ke:ke;return typeof document<"u"&&(a?Array.isArray(c)?m.ref=Ja([m.ref,_o(o),...c]):m.ref=Pt(m.ref,_o(o),c):Pt(null,null)),a?(d!==void 0&&(m.className=zs(m.className,d)),f!==void 0&&(m.style=Or(m.style,f)),m):ke}function bl(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=cn(n,t.props);return o.ref=n.ref,l.cloneElement(t,o)}if(e&&typeof e=="string")return yl(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":Fe(8))}function yl(e,t){return e==="button"?be.createElement("button",{type:"button",...t,key:t.key}):e==="img"?be.createElement("img",{alt:"",...t,key:t.key}):l.createElement(e,t)}let vl=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Gs=l.forwardRef(function(t,n){const{render:r,className:o,children:s,...c}=t,{toasts:i,pauseTimers:u,resumeTimers:a,setHovering:d,setFocused:f,viewportRef:p,windowFocusedRef:m,prevFocusElement:g,setPrevFocusElement:h,expanded:x,focused:y}=Wr(),v=l.useRef(!1),w=l.useRef(!1),E=i.length,b=i[0]?.height??0,R=l.useMemo(()=>i.some(O=>O.transitionStatus==="ending"),[i]);l.useEffect(()=>{if(!p.current)return;function O(V){E!==0&&V.key==="F6"&&V.target!==p.current&&(V.preventDefault(),h(Ge(Ye(p.current))),p.current?.focus({preventScroll:!0}),u(),f(!0))}const F=Ae(p.current);return F.addEventListener("keydown",O),()=>{F.removeEventListener("keydown",O)}},[u,f,h,E,p]),l.useEffect(()=>{if(!p.current||!E)return;const O=Ae(p.current);function F(U){U.target===O&&(m.current=!1,u())}function V(U){if(U.relatedTarget||U.target===O)return;const ee=Le(U),H=Ge(Ye(p.current));(!me(p.current,ee)||!In(H))&&a(),setTimeout(()=>{m.current=!0})}return O.addEventListener("blur",F,!0),O.addEventListener("focus",V,!0),()=>{O.removeEventListener("blur",F,!0),O.removeEventListener("focus",V,!0)}},[u,a,p,m,f,E]),l.useEffect(()=>{const O=p.current;if(!O||E===0)return;const F=Ye(O);function V(U){if(U.pointerType!=="touch")return;const ee=Le(U);me(O,ee)||(a(),d(!1),f(!1))}return F.addEventListener("pointerdown",V,!0),()=>{F.removeEventListener("pointerdown",V,!0)}},[E,a,f,d,p]);function C(O){p.current&&(v.current=!0,O.relatedTarget===p.current?i[0]?.ref?.current?.focus():g?.focus({preventScroll:!0}))}function N(O){O.key==="Tab"&&O.shiftKey&&O.target===p.current&&(O.preventDefault(),g?.focus({preventScroll:!0}),a())}l.useEffect(()=>{!m.current||R||!w.current||(a(),d(!1),w.current=!1)},[R,a,d,m]);function _(){u(),d(!0),w.current=!1}function L(){i.some(O=>O.transitionStatus==="ending")?w.current=!0:(a(),d(!1))}function j(){if(v.current){v.current=!1;return}y||In(Ye(p.current).activeElement)&&(f(!0),u())}function I(O){!y||me(p.current,O.relatedTarget)||(f(!1),a())}const S={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:_,onMouseMove:_,onMouseLeave:L,onFocus:j,onBlur:I,onKeyDown:N,onClick:j},D=l.useMemo(()=>({expanded:x}),[x]),M=Te("div",t,{ref:[n,p],state:D,props:[S,{style:{[vl.frontmostHeight]:b?`${b}px`:void 0}},c,{children:T.jsxs(l.Fragment,{children:[E>0&&g&&T.jsx(ut,{onFocus:C}),s,E>0&&g&&T.jsx(ut,{onFocus:C})]})}]}),P=l.useMemo(()=>({viewportRef:p}),[p]),k=l.useMemo(()=>i.filter(O=>O.priority==="high"),[i]);return T.jsxs(Hs.Provider,{value:P,children:[E>0&&g&&T.jsx(ut,{onFocus:C}),M,!y&&k.length>0&&T.jsx("div",{style:Kr,children:k.map(O=>T.jsxs("div",{role:"alert","aria-atomic":!0,children:[T.jsx("div",{children:O.title}),T.jsx("div",{children:O.description})]},O.id))})]})});process.env.NODE_ENV!=="production"&&(Gs.displayName="ToastViewport");function Gr(e){return zr(19)?e:e?"true":void 0}const Yr=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(Yr.displayName="ToastRootContext");function an(){const e=l.useContext(Yr);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":Fe(66));return e}let Wt=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const El={[Wt.startingStyle]:""},xl={[Wt.endingStyle]:""},kt={transitionStatus(e){return e==="starting"?El:e==="ending"?xl:null}};function je(e){const t=et(wl,e).current;return t.next=e,J(t.effect),t}function wl(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const hn=null;let ko=globalThis.requestAnimationFrame;class Rl{constructor(){Ce(this,"callbacks",[]);Ce(this,"callbacksCount",0);Ce(this,"nextId",1);Ce(this,"startId",1);Ce(this,"isScheduled",!1);Ce(this,"tick",t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)})}request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV==="test"&&ko!==requestAnimationFrame&&(ko=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const bn=new Rl;class Ie{constructor(){Ce(this,"currentId",hn);Ce(this,"cancel",()=>{this.currentId!==hn&&(bn.cancel(this.currentId),this.currentId=hn)});Ce(this,"disposeEffect",()=>this.cancel)}static create(){return new Ie}static request(t){return bn.request(t)}static cancel(t){return bn.cancel(t)}request(t){this.cancel(),this.currentId=bn.request(()=>{this.currentId=hn,t()})}}function dn(){const e=et(Ie.create).current;return Fr(e.disposeEffect),e}function Mt(e){return e==null?e:"current"in e?e.current:e}function Ys(e,t=!1,n=!0){const r=dn();return X((o,s=null)=>{r.cancel();const c=Mt(e);c!=null&&(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():r.request(()=>{function i(){c&&Promise.all(c.getAnimations().map(u=>u.finished)).then(()=>{s!=null&&s.aborted||ct.flushSync(o)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;ct.flushSync(o)}else c.getAnimations().length>0&&c.getAnimations().some(u=>u.pending||u.playState!=="finished")&&i()})}t?r.request(i):i()}))})}function pn(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=je(n),c=X(o),i=Ys(r,n);l.useEffect(()=>{t&&i(()=>{n===s.current&&c()})},[t,n,c,i,s])}let Nt=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const Sl={...kt,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Qt=40,Cl=10,bt=.5,Ol=1;function Ao(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function Tl(e){const n=window.getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const c=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(c){const i=c[1].split(", ").map(parseFloat);i.length===6?(r=i[4],o=i[5],s=Math.sqrt(i[0]*i[0]+i[1]*i[1])):i.length===16&&(r=i[12],o=i[13],s=i[0])}}return{x:r,y:o,scale:s}}const qs=l.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:c=["down","right"],...i}=t,u=r.positionerProps?.anchor!==void 0;let a=[];u||(a=Array.isArray(c)?c:[c]);const d=a.length>0,{toasts:f,focused:p,close:m,remove:g,setToasts:h,pauseTimers:x,expanded:y,setHovering:v}=Wr(),[w,E]=l.useState(void 0),[b,R]=l.useState(!1),[C,N]=l.useState(!1),[_,L]=l.useState(!1),[j,I]=l.useState({x:0,y:0}),[S,D]=l.useState({x:0,y:0,scale:1}),[M,P]=l.useState(),[k,O]=l.useState(),[F,V]=l.useState(null),U=l.useRef(null),ee=l.useRef({x:0,y:0}),H=l.useRef({x:0,y:0,scale:1}),ue=l.useRef(void 0),ge=l.useRef(0),te=l.useRef(!1),G=l.useRef({x:0,y:0}),q=l.useRef(!1),de=l.useMemo(()=>f.indexOf(r),[r,f]),ne=l.useMemo(()=>f.filter($=>$.transitionStatus!=="ending").indexOf(r),[r,f]),A=l.useMemo(()=>f.slice(0,f.indexOf(r)).reduce(($,B)=>$+(B.height||0),0),[f,r]);pn({open:r.transitionStatus!=="ending",ref:U,onComplete(){r.transitionStatus==="ending"&&g(r.id)}});const Q=X(($=!1)=>{const B=U.current;if(!B)return;const oe=B.style.height;B.style.height="auto";const le=B.offsetHeight;B.style.height=oe;function fe(){h(xe=>xe.map(Se=>Se.id===r.id?{...Se,ref:U,height:le,transitionStatus:void 0}:Se))}$?ct.flushSync(fe):fe()});J(Q,[Q]);function Z($,B){let oe=$,le=B;return!a.includes("left")&&!a.includes("right")?oe=$>0?$**bt:-(Math.abs($)**bt):(!a.includes("right")&&$>0&&(oe=$**bt),!a.includes("left")&&$<0&&(oe=-(Math.abs($)**bt))),!a.includes("up")&&!a.includes("down")?le=B>0?B**bt:-(Math.abs(B)**bt):(!a.includes("down")&&B>0&&(le=B**bt),!a.includes("up")&&B<0&&(le=-(Math.abs(B)**bt))),{x:oe,y:le}}function Re($){if($.button!==0)return;$.pointerType==="touch"&&x();const B=Le($.nativeEvent);if(!(B&&B.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(te.current=!1,ue.current=void 0,ge.current=0,ee.current={x:$.clientX,y:$.clientY},G.current=ee.current,U.current){const le=Tl(U.current);H.current=le,D(le),I({x:le.x,y:le.y})}v(!0),R(!0),N(!1),V(null),q.current=!0,U.current?.setPointerCapture($.pointerId)}}function se($){if(!b)return;$.preventDefault(),q.current&&(ee.current={x:$.clientX,y:$.clientY},q.current=!1);const{clientY:B,clientX:oe,movementX:le,movementY:fe}=$;(fe<0&&B>G.current.y||fe>0&&B<G.current.y)&&(G.current={x:G.current.x,y:B}),(le<0&&oe>G.current.x||le>0&&oe<G.current.x)&&(G.current={x:oe,y:G.current.y});const xe=oe-ee.current.x,Se=B-ee.current.y,ze=B-G.current.y,We=oe-G.current.x;if(!C&&Math.sqrt(xe*xe+Se*Se)>=Ol&&(N(!0),F===null)){const Ne=a.includes("left")||a.includes("right"),Ke=a.includes("up")||a.includes("down");if(Ne&&Ke){const Be=Math.abs(xe),ot=Math.abs(Se);V(Be>ot?"horizontal":"vertical")}}let Me;if(!ue.current)F==="vertical"?Se>0?Me="down":Se<0&&(Me="up"):F==="horizontal"?xe>0?Me="right":xe<0&&(Me="left"):Math.abs(xe)>=Math.abs(Se)?Me=xe>0?"right":"left":Me=Se>0?"down":"up",Me&&a.includes(Me)&&(ue.current=Me,ge.current=Ao(Me,xe,Se),E(Me));else{const Oe=ue.current,Ne=Ao(Oe,We,ze);Ne>Qt?(te.current=!1,E(Oe)):!(a.includes("left")&&a.includes("right"))&&!(a.includes("up")&&a.includes("down"))&&ge.current-Ne>=Cl&&(te.current=!0)}const pe=Z(xe,Se);let Ee=H.current.x,De=H.current.y;F==="horizontal"?(a.includes("left")||a.includes("right"))&&(Ee+=pe.x):(F==="vertical"||(a.includes("left")||a.includes("right"))&&(Ee+=pe.x),(a.includes("up")||a.includes("down"))&&(De+=pe.y)),I({x:Ee,y:De})}function z($){if(!b)return;if(R(!1),N(!1),V(null),U.current?.releasePointerCapture($.pointerId),te.current){I({x:S.x,y:S.y}),E(void 0);return}let B=!1;const oe=j.x-S.x,le=j.y-S.y;let fe;for(const xe of a){switch(xe){case"right":oe>Qt&&(B=!0,fe="right");break;case"left":oe<-Qt&&(B=!0,fe="left");break;case"down":le>Qt&&(B=!0,fe="down");break;case"up":le<-Qt&&(B=!0,fe="up");break}if(B)break}B?(E(fe),L(!0),m(r.id)):(I({x:S.x,y:S.y}),E(void 0))}function W($){if($.key==="Escape"){if(!U.current||!me(U.current,Ge(Ye(U.current))))return;m(r.id)}}l.useEffect(()=>{if(!d)return;const $=U.current;if(!$)return;function B(oe){me($,oe.target)&&oe.preventDefault()}return $.addEventListener("touchmove",B,{passive:!1}),()=>{$.removeEventListener("touchmove",B)}},[d]);function ie(){if(!b&&j.x===S.x&&j.y===S.y&&!_)return{[Nt.swipeMovementX]:"0px",[Nt.swipeMovementY]:"0px"};const $=j.x-S.x,B=j.y-S.y;return{transition:b?"none":void 0,transform:b?`translateX(${j.x}px) translateY(${j.y}px) scale(${S.scale})`:void 0,[Nt.swipeMovementX]:`${$}px`,[Nt.swipeMovementY]:`${B}px`}}const re=r.priority==="high",he={role:re?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":M,"aria-describedby":k,"aria-hidden":re&&!p?!0:void 0,onPointerDown:d?Re:void 0,onPointerMove:d?se:void 0,onPointerUp:d?z:void 0,onKeyDown:W,inert:Gr(r.limited),style:{...ie(),[Nt.index]:r.transitionStatus==="ending"?de:ne,[Nt.offsetY]:`${A}px`,[Nt.height]:r.height?`${r.height}px`:void 0}},K=l.useMemo(()=>({rootRef:U,toast:r,titleId:M,setTitleId:P,descriptionId:k,setDescriptionId:O,swiping:b,swipeDirection:w,recalculateHeight:Q,index:de,visibleIndex:ne,expanded:y}),[r,M,k,b,w,Q,de,ne,y]),ae=l.useMemo(()=>({transitionStatus:r.transitionStatus,expanded:y,limited:r.limited||!1,type:r.type,swiping:K.swiping,swipeDirection:K.swipeDirection}),[y,r.transitionStatus,r.limited,r.type,K.swiping,K.swipeDirection]),Y=Te("div",t,{ref:[n,K.rootRef],state:ae,stateAttributesMapping:Sl,props:[he,i]});return T.jsx(Yr.Provider,{value:K,children:Y})});process.env.NODE_ENV!=="production"&&(qs.displayName="ToastRoot");const Nl={...l};let Lo=0;function Ml(e,t="mui"){const[n,r]=l.useState(e),o=e||n;return l.useEffect(()=>{n==null&&(Lo+=1,r(`${t}-${Lo}`))},[n,t]),o}const Fo=Nl.useId;function gt(e,t){if(Fo!==void 0){const n=Fo();return e??(t?`${t}-${n}`:n)}return Ml(e,t)}const Xs=l.forwardRef(function(t,n){const{render:r,className:o,id:s,children:c,...i}=t,{toast:u}=an(),a=c??u.description,d=!!a,f=gt(s),{setDescriptionId:p}=an();J(()=>{if(d)return p(f),()=>{p(void 0)}},[d,f,p]);const m=l.useMemo(()=>({type:u.type}),[u.type]),g=Te("p",t,{ref:n,state:m,props:{...i,id:f,children:a}});return d?g:null});process.env.NODE_ENV!=="production"&&(Xs.displayName="ToastDescription");const Js=l.forwardRef(function(t,n){const{render:r,className:o,id:s,children:c,...i}=t,{toast:u}=an(),a=c??u.title,d=!!a,f=gt(s),{setTitleId:p}=an();J(()=>{if(d)return p(f),()=>{p(void 0)}},[d,f,p]);const m=l.useMemo(()=>({type:u.type}),[u.type]),g=Te("h2",t,{ref:n,state:m,props:{...i,id:f,children:a}});return d?g:null});process.env.NODE_ENV!=="production"&&(Js.displayName="ToastTitle");let Mr;process.env.NODE_ENV!=="production"&&(Mr=new Set);function Vo(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Mr.has(t)||(Mr.add(t),console.error(`Base UI: ${t}`))}}const Zs=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(Zs.displayName="CompositeRootContext");function qr(e=!1){const t=l.useContext(Zs);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":Fe(16));return t}function Il(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,c=r&&t!==!1,i=r&&t===!1;return{props:l.useMemo(()=>{const a={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(a.tabIndex=o,!s&&n&&(a.tabIndex=t?o:-1)),(s&&(t||c)||!s&&n)&&(a["aria-disabled"]=n),s&&(!t||i)&&(a.disabled=n),a},[r,n,t,c,i,s,o])}}function Xt(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=l.useRef(null),c=qr(!0)!==void 0,i=X(()=>{const p=s.current;return!!(p?.tagName==="A"&&p?.href)}),{props:u}=Il({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&l.useEffect(()=>{if(!s.current)return;const p=s.current.tagName==="BUTTON";o?p||Vo("A component that acts as a button was not rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is a real <button>, or set the `nativeButton` prop on the component to `false`."):p&&Vo("A component that acts as a button was rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is not a real <button>, or set the `nativeButton` prop on the component to `true`.")},[o]);const a=l.useCallback(()=>{const p=s.current;Pl(p)&&c&&t&&u.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,u.disabled,c]);J(a,[a]);const d=l.useCallback((p={})=>{const{onClick:m,onMouseDown:g,onKeyUp:h,onKeyDown:x,onPointerDown:y,...v}=p;return cn({type:o?"button":void 0,onClick(E){if(t){E.preventDefault();return}m?.(E)},onMouseDown(E){t||g?.(E)},onKeyDown(E){if(t||(Nr(E),x?.(E)),E.baseUIHandlerPrevented)return;const b=E.target===E.currentTarget&&!o&&!i()&&!t,R=E.key==="Enter",C=E.key===" ";b&&((C||R)&&E.preventDefault(),R&&m?.(E))},onKeyUp(E){t||(Nr(E),h?.(E)),!E.baseUIHandlerPrevented&&E.target===E.currentTarget&&!o&&!t&&E.key===" "&&m?.(E)},onPointerDown(E){if(t){E.preventDefault();return}y?.(E)}},o?void 0:{role:"button"},u,v)},[t,u,o,i]),f=X(p=>{s.current=p,a()});return{getButtonProps:d,buttonRef:f}}function Pl(e){return Pe(e)&&e.tagName==="BUTTON"}const Qs=l.forwardRef(function(t,n){const{render:r,className:o,disabled:s,nativeButton:c=!0,...i}=t,{close:u,expanded:a}=Wr(),{toast:d}=an(),[f,p]=l.useState(!1),{getButtonProps:m,buttonRef:g}=Xt({disabled:s,native:c}),h=l.useMemo(()=>({type:d.type}),[d.type]);return Te("button",t,{ref:[n,g],state:h,props:[{"aria-hidden":!a&&!f,onClick(){u(d.id)},onFocus(){p(!0)},onBlur(){p(!1)}},i,m]})});process.env.NODE_ENV!=="production"&&(Qs.displayName="ToastClose");function ei(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Xr{constructor(){Ce(this,"nodesRef",{current:[]});Ce(this,"events",ei())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Jr=l.createContext(null);process.env.NODE_ENV!=="production"&&(Jr.displayName="FloatingNodeContext");const Zr=l.createContext(null);process.env.NODE_ENV!=="production"&&(Zr.displayName="FloatingTreeContext");const ht=()=>l.useContext(Jr)?.id||null,Ct=e=>{const t=l.useContext(Zr);return e??t};function ti(e){const t=gt(),n=Ct(e),r=ht();return J(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function Dl(e){const{children:t,id:n}=e,r=ht();return T.jsx(Jr.Provider,{value:l.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function _l(e){const{children:t,externalTree:n}=e,r=et(()=>n??new Xr).current;return T.jsx(Zr.Provider,{value:r,children:t})}const Qr="none",wt="trigger-press",Je="trigger-hover",Bn="trigger-focus",eo="outside-press",ni="item-press",kl="close-press",Kt="focus-out",to="escape-key",Tn="list-navigation",Al="cancel-open",en="sibling-open",ri="imperative-action";function ve(e,t,n,r){let o=!1,s=!1;const c=ke;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...c}}function zt(e){return`data-base-ui-${e}`}function sr(e,t,n){if(n&&!$t(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}let jo=0;function Nn(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(jo);const s=()=>e?.focus({preventScroll:n});o?s():jo=requestAnimationFrame(s)}const jt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Bo(e){return e==="inert"?jt.inert:e==="aria-hidden"?jt["aria-hidden"]:jt.none}let yn=new WeakSet,vn={},ir=0;const oi=e=>e&&(e.host||oi(e.parentNode)),Ll=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=oi(n);return e.contains(r)?r:null}).filter(n=>n!=null);function Fl(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,c=Ll(t,e),i=new Set,u=new Set(c),a=[];vn[o]||(vn[o]=new WeakMap);const d=vn[o];c.forEach(f),p(t),i.clear();function f(m){!m||i.has(m)||(i.add(m),m.parentNode&&f(m.parentNode))}function p(m){!m||u.has(m)||[].forEach.call(m.children,g=>{if(Rt(g)!=="script")if(i.has(g))p(g);else{const h=s?g.getAttribute(s):null,x=h!==null&&h!=="false",y=Bo(s),v=(y.get(g)||0)+1,w=(d.get(g)||0)+1;y.set(g,v),d.set(g,w),a.push(g),v===1&&x&&yn.add(g),w===1&&g.setAttribute(o,""),!x&&s&&g.setAttribute(s,s==="inert"?"":"true")}})}return ir+=1,()=>{a.forEach(m=>{const g=Bo(s),x=(g.get(m)||0)-1,y=(d.get(m)||0)-1;g.set(m,x),d.set(m,y),x||(!yn.has(m)&&s&&m.removeAttribute(s),yn.delete(m)),y||m.removeAttribute(o)}),ir-=1,ir||(jt.inert=new WeakMap,jt["aria-hidden"]=new WeakMap,jt.none=new WeakMap,yn=new WeakSet,vn={})}}function Vl(e,t=!1,n=!1){const r=_e(e[0]).body;return Fl(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const no=l.createContext(null);process.env.NODE_ENV!=="production"&&(no.displayName="PortalContext");const si=()=>l.useContext(no),jl=zt("portal");function Bl(e={}){const{ref:t,container:n,componentProps:r=ke,elementProps:o,elementState:s}=e,c=gt(),u=si()?.portalNode,[a,d]=l.useState(null),[f,p]=l.useState(null),m=l.useRef(null);J(()=>{if(n===null){m.current&&(m.current=null,p(null),d(null));return}if(c==null)return;const x=(n&&(Ar(n)?n:n.current))??u??document.body;if(x==null){m.current&&(m.current=null,p(null),d(null));return}m.current!==x&&(m.current=x,p(null),d(x))},[n,u,c]);const g=Te("div",r,{ref:[t,p],state:s,props:[{id:c,[jl]:""},o]});return{portalNode:f,portalSubtree:a&&g?ct.createPortal(g,a):null}}const ro=l.forwardRef(function(t,n){const{children:r,container:o,className:s,render:c,renderGuards:i,...u}=t,{portalNode:a,portalSubtree:d}=Bl({container:o,ref:n,componentProps:t,elementProps:u}),f=l.useRef(null),p=l.useRef(null),m=l.useRef(null),g=l.useRef(null),[h,x]=l.useState(null),y=h?.modal,v=h?.open,w=typeof i=="boolean"?i:!!h&&!h.modal&&h.open&&!!a;l.useEffect(()=>{if(!a||y)return;function b(R){a&&Vt(R)&&(R.type==="focusin"?Do:qa)(a)}return a.addEventListener("focusin",b,!0),a.addEventListener("focusout",b,!0),()=>{a.removeEventListener("focusin",b,!0),a.removeEventListener("focusout",b,!0)}},[a,y]),l.useEffect(()=>{!a||v||Do(a)},[v,a]);const E=l.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:g,portalNode:a,setFocusManagerState:x}),[a]);return T.jsxs(l.Fragment,{children:[d,T.jsxs(no.Provider,{value:E,children:[w&&a&&T.jsx(ut,{"data-type":"outside",ref:f,onFocus:b=>{if(Vt(b,a))m.current?.focus();else{const R=h?h.domReference:null;js(R)?.focus()}}}),w&&a&&T.jsx("span",{"aria-owns":a.id,style:gl}),a&&ct.createPortal(r,a),w&&a&&T.jsx(ut,{"data-type":"outside",ref:p,onFocus:b=>{if(Vt(b,a))g.current?.focus();else{const R=h?h.domReference:null;Ur(R)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,ve(Kt,b.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(ro.displayName="FloatingPortal");function $l(e,t){const n=Ae(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const $o=20;let yt=[];function oo(){yt=yt.filter(e=>e.isConnected)}function Hl(e){oo(),e&&Rt(e)!=="body"&&(yt.push(e),yt.length>$o&&(yt=yt.slice(-$o)))}function cr(){return oo(),yt[yt.length-1]}function Ul(e){if(!e)return null;const t=qt();return Fs(e,t)?e:fn(e,t)[0]||e}function Wl(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Qe(e).display!=="none"}function Ho(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=qt(),o=za(e,n).filter(c=>{const i=c.getAttribute("data-tabindex")||"";return Fs(c,n)||c.hasAttribute("data-tabindex")&&!i.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ii(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],initialFocus:s=!0,returnFocus:c=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:a=!0,openInteractionType:d="",getInsideElements:f=()=>[],nextFocusableElement:p,previousFocusableElement:m,beforeContentFocusGuardRef:g,externalTree:h}=e,x="rootStore"in t?t.rootStore:t,y=x.useState("open"),v=x.useState("domReferenceElement"),w=x.useState("floatingElement"),{events:E,dataRef:b}=x.context,R=X(()=>b.current.floatingContext?.nodeId),C=X(f),N=s===!1,_=xr(v)&&N,L=je(o),j=je(s),I=je(c),S=je(d),D=Ct(h),M=si(),P=l.useRef(null),k=l.useRef(null),O=l.useRef(!1),F=l.useRef(!1),V=l.useRef(!1),U=l.useRef(-1),ee=l.useRef(""),H=l.useRef(""),ue=tt(),ge=tt(),te=dn(),G=M!=null,q=Pn(w),de=X((z=q)=>z?fn(z,qt()):[]),ne=X(z=>{const W=de(z);return L.current.map(()=>W).filter(Boolean).flat()});l.useEffect(()=>{if(r||!u)return;function z(ie){ie.key==="Tab"&&me(q,Ge(_e(q)))&&de().length===0&&!_&&He(ie)}const W=_e(q);return W.addEventListener("keydown",z),()=>{W.removeEventListener("keydown",z)}},[r,v,q,u,L,_,de,ne]),l.useEffect(()=>{if(r||!w)return;function z(W){const ie=Le(W),he=de().indexOf(ie);he!==-1&&(U.current=he)}return w.addEventListener("focusin",z),()=>{w.removeEventListener("focusin",z)}},[r,w,de]),l.useEffect(()=>{if(r||!y)return;const z=_e(q);function W(){V.current=!1}function ie(he){const K=Le(he),ae=me(w,K)||me(v,K)||me(M?.portalNode,K);V.current=!ae,H.current=he.pointerType||"keyboard"}function re(){H.current="keyboard"}return z.addEventListener("pointerdown",ie,!0),z.addEventListener("pointerup",W,!0),z.addEventListener("pointercancel",W,!0),z.addEventListener("keydown",re,!0),()=>{z.removeEventListener("pointerdown",ie,!0),z.removeEventListener("pointerup",W,!0),z.removeEventListener("pointercancel",W,!0),z.removeEventListener("keydown",re,!0)}},[r,w,v,q,y,M]),l.useEffect(()=>{if(r||!a)return;function z(){F.current=!0,ge.start(0,()=>{F.current=!1})}function W(K){const ae=K.relatedTarget,Y=K.currentTarget,$=Le(K);queueMicrotask(()=>{const B=R(),oe=x.context.triggerElements,le=!(me(v,ae)||me(w,ae)||me(ae,w)||me(M?.portalNode,ae)||ae!=null&&oe.hasElement(ae)||oe.hasMatchingElement(fe=>me(fe,ae))||ae?.hasAttribute(zt("focus-guard"))||D&&(It(D.nodesRef.current,B).find(fe=>me(fe.context?.elements.floating,ae)||me(fe.context?.elements.domReference,ae))||To(D.nodesRef.current,B).find(fe=>[fe.context?.elements.floating,Pn(fe.context?.elements.floating)].includes(ae)||fe.context?.elements.domReference===ae)));if(Y===v&&q&&Ho(q,L),i&&Y!==v&&!Wl($)&&Ge(_e(q))===_e(q).body){if(Pe(q)&&(q.focus(),i==="popup")){te.request(()=>{q.focus()});return}const fe=U.current,xe=de(),Se=xe[fe]||xe[xe.length-1]||q;Pe(Se)&&Se.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(_||!u)&&ae&&le&&!F.current&&(_||ae!==cr())&&(O.current=!0,x.setOpen(!1,ve(Kt,K)))})}function ie(){V.current||(b.current.insideReactTree=!0,ue.start(0,()=>{b.current.insideReactTree=!1}))}const re=Pe(v)?v:null,he=[];if(!(!w&&!re))return re&&(re.addEventListener("focusout",W),re.addEventListener("pointerdown",z),he.push(()=>{re.removeEventListener("focusout",W),re.removeEventListener("pointerdown",z)})),w&&(w.addEventListener("focusout",W),M&&(w.addEventListener("focusout",ie,!0),he.push(()=>{w.removeEventListener("focusout",ie,!0)})),he.push(()=>{w.removeEventListener("focusout",W)})),()=>{he.forEach(K=>{K()})}},[r,v,w,q,u,D,M,x,a,i,de,_,R,L,b,ue,ge,te]);const A=l.useRef(null),Q=l.useRef(null),Z=Pt(A,g,M?.beforeInsideRef),Re=Pt(Q,M?.afterInsideRef);l.useEffect(()=>{if(r||!w||!y)return;const z=Array.from(M?.portalNode?.querySelectorAll(`[${zt("portal")}]`)||[]),ie=(D?To(D.nodesRef.current,R()):[]).find(K=>xr(K.context?.elements.domReference||null))?.context?.elements.domReference,re=[w,ie,...z,...C(),P.current,k.current,A.current,Q.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,Mt(m),Mt(p),_?v:null].filter(K=>K!=null),he=Vl(re,u||_);return()=>{he()}},[y,r,v,w,u,L,M,_,D,R,C,p,m]),J(()=>{if(!y||r||!Pe(q))return;const z=_e(q),W=Ge(z);queueMicrotask(()=>{const ie=ne(q),re=j.current,he=typeof re=="function"?re(S.current||""):re;if(he===void 0||he===!1)return;let K;he===!0||he===null?K=ie[0]||q:K=Mt(he),K=K||ie[0]||q,!me(q,W)&&Nn(K,{preventScroll:K===q})})},[r,y,q,N,ne,j,S]),J(()=>{if(r||!q)return;const z=_e(q),W=Ge(z);Hl(W);function ie(K){if(K.open||(ee.current=$l(K.nativeEvent,H.current)),K.reason===Je&&K.nativeEvent.type==="mouseleave"&&(O.current=!0),K.reason===eo)if(K.nested)O.current=!1;else if(Ts(K.nativeEvent)||Ns(K.nativeEvent))O.current=!1;else{let ae=!1;document.createElement("div").focus({get preventScroll(){return ae=!0,!1}}),ae?O.current=!1:O.current=!0}}E.on("openchange",ie);const re=z.createElement("span");re.setAttribute("tabindex","-1"),re.setAttribute("aria-hidden","true"),Object.assign(re.style,Kr),G&&v&&v.insertAdjacentElement("afterend",re);function he(){const K=I.current;let ae=typeof K=="function"?K(ee.current):K;if(ae===void 0||ae===!1)return null;if(ae===null&&(ae=!0),typeof ae=="boolean"){const $=v||cr();return $&&$.isConnected?$:re}const Y=v||cr()||re;return Mt(ae)||Y}return()=>{E.off("openchange",ie);const K=Ge(z),ae=me(w,K)||D&&It(D.nodesRef.current,R(),!1).some($=>me($.context?.elements.floating,K)),Y=he();queueMicrotask(()=>{const $=Ul(Y),B=typeof I.current!="boolean";I.current&&!O.current&&Pe($)&&(!(!B&&$!==K&&K!==z.body)||ae)&&$.focus({preventScroll:!0}),re.remove()})}},[r,w,q,I,b,E,D,G,v,R]),l.useEffect(()=>{queueMicrotask(()=>{O.current=!1})},[r]),l.useEffect(()=>{if(r||!y)return;function z(ie){Le(ie)?.closest(`[${dl}]`)&&(F.current=!0)}const W=_e(q);return W.addEventListener("pointerdown",z,!0),()=>{W.removeEventListener("pointerdown",z,!0)}},[r,y,q]),J(()=>{if(!r&&M)return M.setFocusManagerState({modal:u,closeOnFocusOut:a,open:y,onOpenChange:x.setOpen,domReference:v}),()=>{M.setFocusManagerState(null)}},[r,M,u,y,x,a,v]),J(()=>{if(!(r||!q))return Ho(q,L),()=>{queueMicrotask(oo)}},[r,q,L]);const se=!r&&(u?!_:!0)&&(G||u);return T.jsxs(l.Fragment,{children:[se&&T.jsx(ut,{"data-type":"inside",ref:Z,onFocus:z=>{if(u){const W=ne();Nn(W[W.length-1])}else M?.portalNode&&(O.current=!1,Vt(z,M.portalNode)?Ur(v)?.focus():Mt(m??M.beforeOutsideRef)?.focus())}}),n,se&&T.jsx(ut,{"data-type":"inside",ref:Re,onFocus:z=>{u?Nn(ne()[0]):M?.portalNode&&(a&&(O.current=!0),Vt(z,M.portalNode)?js(v)?.focus():Mt(p??M.afterOutsideRef)?.focus())}})]})}function Kl(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:c=!0,ignoreMouse:i=!1,stickIfOpen:u=!0,touchOpenDelay:a=0}=t,d=l.useRef(void 0),f=dn(),p=tt(),m=l.useMemo(()=>({onPointerDown(g){d.current=g.pointerType},onMouseDown(g){const h=d.current,x=g.nativeEvent,y=n.select("open");if(g.button!==0||s==="click"||$t(h,!0)&&i)return;const v=r.current.openEvent,w=v?.type,E=n.select("domReferenceElement")!==g.currentTarget,b=y&&E||!(y&&c&&(!(v&&u)||w==="click"||w==="mousedown"));if(jr(x.target)){const C=ve(wt,x,x.target);b&&h==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,C)}):n.setOpen(b,C);return}const R=g.currentTarget;f.request(()=>{const C=ve(wt,x,R);b&&h==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,C)}):n.setOpen(b,C)})},onClick(g){if(s==="mousedown-only")return;const h=d.current;if(s==="mousedown"&&h){d.current=void 0;return}if($t(h,!0)&&i)return;const x=n.select("open"),y=r.current.openEvent,v=n.select("domReferenceElement")!==g.currentTarget,w=x&&v||!(x&&c&&(!(y&&u)||Ms(y))),E=ve(wt,g.nativeEvent,g.currentTarget);w&&h==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,E)}):n.setOpen(w,E)},onKeyDown(){d.current=void 0}}),[r,s,i,n,u,c,f,p,a]);return l.useMemo(()=>o?{reference:m}:ke,[o,m])}function Uo(e,t,n){let{reference:r,floating:o}=e;const s=rt(t),c=Hr(t),i=$r(c),u=Ze(t),a=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[i]/2-o[i]/2;let m;switch(u){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(St(t)){case"start":m[c]-=p*(n&&a?-1:1);break;case"end":m[c]+=p*(n&&a?-1:1);break}return m}const zl=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,i=s.filter(Boolean),u=await(c.isRTL==null?void 0:c.isRTL(t));let a=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Uo(a,r,u),p=r,m={},g=0;for(let h=0;h<i.length;h++){const{name:x,fn:y}=i[h],{x:v,y:w,data:E,reset:b}=await y({x:d,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:a,platform:c,elements:{reference:e,floating:t}});d=v??d,f=w??f,m={...m,[x]:{...m[x],...E}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(a=b.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:d,y:f}=Uo(a,p,u)),h=-1)}return{x:d,y:f,placement:p,strategy:o,middlewareData:m}};async function ln(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:i,strategy:u}=e,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=mt(t,e),g=Is(m),x=i[p?f==="floating"?"reference":"floating":f],y=kn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:a,rootBoundary:d,strategy:u})),v=f==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),E=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},b=kn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:w,strategy:u}):v);return{top:(y.top-b.top+g.top)/E.y,bottom:(b.bottom-y.bottom+g.bottom)/E.y,left:(y.left-b.left+g.left)/E.x,right:(b.right-y.right+g.right)/E.x}}const Gl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:c,initialPlacement:i,platform:u,elements:a}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...x}=mt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ze(o),v=rt(i),w=Ze(i)===i,E=await(u.isRTL==null?void 0:u.isRTL(a.floating)),b=p||(w||!h?[_n(i)]:wa(i)),R=g!=="none";!p&&R&&b.push(...Oa(i,h,g,E));const C=[i,...b],N=await ln(t,x),_=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&_.push(N[y]),f){const D=xa(o,c,E);_.push(N[D[0]],N[D[1]])}if(L=[...L,{placement:o,overflows:_}],!_.every(D=>D<=0)){var j,I;const D=(((j=s.flip)==null?void 0:j.index)||0)+1,M=C[D];if(M&&(!(f==="alignment"?v!==rt(M):!1)||L.every(O=>rt(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:D,overflows:L},reset:{placement:M}};let P=(I=L.filter(k=>k.overflows[0]<=0).sort((k,O)=>k.overflows[1]-O.overflows[1])[0])==null?void 0:I.placement;if(!P)switch(m){case"bestFit":{var S;const k=(S=L.filter(O=>{if(R){const F=rt(O.placement);return F===v||F==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(F=>F>0).reduce((F,V)=>F+V,0)]).sort((O,F)=>O[1]-F[1])[0])==null?void 0:S[0];k&&(P=k);break}case"initialPlacement":P=i;break}if(o!==P)return{reset:{placement:P}}}return{}}}};function Wo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ko(e){return ba.some(t=>e[t]>=0)}const Yl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=mt(e,t);switch(r){case"referenceHidden":{const s=await ln(t,{...o,elementContext:"reference"}),c=Wo(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ko(c)}}}case"escaped":{const s=await ln(t,{...o,altBoundary:!0}),c=Wo(s,n.floating);return{data:{escapedOffsets:c,escaped:Ko(c)}}}default:return{}}}}},ci=new Set(["left","top"]);async function ql(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Ze(n),i=St(n),u=rt(n)==="y",a=ci.has(c)?-1:1,d=s&&u?-1:1,f=mt(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return i&&typeof g=="number"&&(m=i==="end"?g*-1:g),u?{x:m*d,y:p*a}:{x:p*a,y:m*d}}const Xl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:i}=t,u=await ql(t,e);return c===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:c}}}}},Jl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:i={fn:x=>{let{x:y,y:v}=x;return{x:y,y:v}}},...u}=mt(e,t),a={x:n,y:r},d=await ln(t,u),f=rt(Ze(o)),p=Br(f);let m=a[p],g=a[f];if(s){const x=p==="y"?"top":"left",y=p==="y"?"bottom":"right",v=m+d[x],w=m-d[y];m=wr(v,m,w)}if(c){const x=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=g+d[x],w=g-d[y];g=wr(v,g,w)}const h=i.fn({...t,[p]:m,[f]:g});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[p]:s,[f]:c}}}}}},Zl=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:c}=t,{offset:i=0,mainAxis:u=!0,crossAxis:a=!0}=mt(e,t),d={x:n,y:r},f=rt(o),p=Br(f);let m=d[p],g=d[f];const h=mt(i,t),x=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const w=p==="y"?"height":"width",E=s.reference[p]-s.floating[w]+x.mainAxis,b=s.reference[p]+s.reference[w]-x.mainAxis;m<E?m=E:m>b&&(m=b)}if(a){var y,v;const w=p==="y"?"width":"height",E=ci.has(Ze(o)),b=s.reference[f]-s.floating[w]+(E&&((y=c.offset)==null?void 0:y[f])||0)+(E?0:x.crossAxis),R=s.reference[f]+s.reference[w]+(E?0:((v=c.offset)==null?void 0:v[f])||0)-(E?x.crossAxis:0);g<b?g=b:g>R&&(g=R)}return{[p]:m,[f]:g}}}},Ql=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:i}=t,{apply:u=()=>{},...a}=mt(e,t),d=await ln(t,a),f=Ze(o),p=St(o),m=rt(o)==="y",{width:g,height:h}=s.floating;let x,y;f==="top"||f==="bottom"?(x=f,y=p===(await(c.isRTL==null?void 0:c.isRTL(i.floating))?"start":"end")?"left":"right"):(y=f,x=p==="end"?"top":"bottom");const v=h-d.top-d.bottom,w=g-d.left-d.right,E=Ht(h-d[x],v),b=Ht(g-d[y],w),R=!t.middlewareData.shift;let C=E,N=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),R&&!p){const L=qe(d.left,0),j=qe(d.right,0),I=qe(d.top,0),S=qe(d.bottom,0);m?N=g-2*(L!==0||j!==0?L+j:qe(d.left,d.right)):C=h-2*(I!==0||S!==0?I+S:qe(d.top,d.bottom))}await u({...t,availableWidth:N,availableHeight:C});const _=await c.getDimensions(i.floating);return g!==_.width||h!==_.height?{reset:{rects:!0}}:{}}}};function ai(e){const t=Qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Pe(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,i=Dn(n)!==s||Dn(r)!==c;return i&&(n=s,r=c),{width:n,height:r,$:i}}function so(e){return we(e)?e:e.contextElement}function Bt(e){const t=so(e);if(!Pe(t))return lt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ai(t);let c=(s?Dn(n.width):n.width)/r,i=(s?Dn(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!i||!Number.isFinite(i))&&(i=1),{x:c,y:i}}const eu=lt(0);function li(e){const t=Ae(e);return!Kn()||!t.visualViewport?eu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ae(e)?!1:t}function Dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=so(e);let c=lt(1);t&&(r?we(r)&&(c=Bt(r)):c=Bt(e));const i=tu(s,n,r)?li(s):lt(0);let u=(o.left+i.x)/c.x,a=(o.top+i.y)/c.y,d=o.width/c.x,f=o.height/c.y;if(s){const p=Ae(s),m=r&&we(r)?Ae(r):r;let g=p,h=yr(g);for(;h&&r&&m!==g;){const x=Bt(h),y=h.getBoundingClientRect(),v=Qe(h),w=y.left+(h.clientLeft+parseFloat(v.paddingLeft))*x.x,E=y.top+(h.clientTop+parseFloat(v.paddingTop))*x.y;u*=x.x,a*=x.y,d*=x.x,f*=x.y,u+=w,a+=E,g=Ae(h),h=yr(g)}}return kn({width:d,height:f,x:u,y:a})}function Yn(e,t){const n=zn(e).scrollLeft;return t?t.left+n:Dt(dt(e)).left+n}function ui(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Yn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function nu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=dt(r),i=t?Wn(t.floating):!1;if(r===c||i&&s)return n;let u={scrollLeft:0,scrollTop:0},a=lt(1);const d=lt(0),f=Pe(r);if((f||!f&&!s)&&((Rt(r)!=="body"||_t(c))&&(u=zn(r)),Pe(r))){const m=Dt(r);a=Bt(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}const p=c&&!f&&!s?ui(c,u):lt(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-u.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-u.scrollTop*a.y+d.y+p.y}}function ru(e){return Array.from(e.getClientRects())}function ou(e){const t=dt(e),n=zn(e),r=e.ownerDocument.body,o=qe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=qe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Yn(e);const i=-n.scrollTop;return Qe(r).direction==="rtl"&&(c+=qe(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:i}}const zo=25;function su(e,t){const n=Ae(e),r=dt(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,i=0,u=0;if(o){s=o.width,c=o.height;const d=Kn();(!d||d&&t==="fixed")&&(i=o.offsetLeft,u=o.offsetTop)}const a=Yn(r);if(a<=0){const d=r.ownerDocument,f=d.body,p=getComputedStyle(f),m=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-m);g<=zo&&(s-=g)}else a<=zo&&(s+=a);return{width:s,height:c,x:i,y:u}}const iu=new Set(["absolute","fixed"]);function cu(e,t){const n=Dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Pe(e)?Bt(e):lt(1),c=e.clientWidth*s.x,i=e.clientHeight*s.y,u=o*s.x,a=r*s.y;return{width:c,height:i,x:u,y:a}}function Go(e,t,n){let r;if(t==="viewport")r=su(e,n);else if(t==="document")r=ou(dt(e));else if(we(t))r=cu(t,n);else{const o=li(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return kn(r)}function fi(e,t){const n=ft(e);return n===t||!we(n)||at(n)?!1:Qe(n).position==="fixed"||fi(n,t)}function au(e,t){const n=t.get(e);if(n)return n;let r=vt(e,[],!1).filter(i=>we(i)&&Rt(i)!=="body"),o=null;const s=Qe(e).position==="fixed";let c=s?ft(e):e;for(;we(c)&&!at(c);){const i=Qe(c),u=Lr(c);!u&&i.position==="fixed"&&(o=null),(s?!u&&!o:!u&&i.position==="static"&&!!o&&iu.has(o.position)||_t(c)&&!u&&fi(e,c))?r=r.filter(d=>d!==c):o=i,c=ft(c)}return t.set(e,r),r}function lu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Wn(t)?[]:au(t,this._c):[].concat(n),r],i=c[0],u=c.reduce((a,d)=>{const f=Go(t,d,o);return a.top=qe(f.top,a.top),a.right=Ht(f.right,a.right),a.bottom=Ht(f.bottom,a.bottom),a.left=qe(f.left,a.left),a},Go(t,i,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function uu(e){const{width:t,height:n}=ai(e);return{width:t,height:n}}function fu(e,t,n){const r=Pe(t),o=dt(t),s=n==="fixed",c=Dt(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const u=lt(0);function a(){u.x=Yn(o)}if(r||!r&&!s)if((Rt(t)!=="body"||_t(o))&&(i=zn(t)),r){const m=Dt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&a();s&&!r&&o&&a();const d=o&&!r&&!s?ui(o,i):lt(0),f=c.left+i.scrollLeft-u.x-d.x,p=c.top+i.scrollTop-u.y-d.y;return{x:f,y:p,width:c.width,height:c.height}}function ar(e){return Qe(e).position==="static"}function Yo(e,t){if(!Pe(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dt(e)===n&&(n=n.ownerDocument.body),n}function di(e,t){const n=Ae(e);if(Wn(e))return n;if(!Pe(e)){let o=ft(e);for(;o&&!at(o);){if(we(o)&&!ar(o))return o;o=ft(o)}return n}let r=Yo(e,t);for(;r&&Jc(r)&&ar(r);)r=Yo(r,t);return r&&at(r)&&ar(r)&&!Lr(r)?n:r||na(e)||n}const du=async function(e){const t=this.getOffsetParent||di,n=this.getDimensions,r=await n(e.floating);return{reference:fu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pu(e){return Qe(e).direction==="rtl"}const mu={convertOffsetParentRelativeRectToViewportRelativeRect:nu,getDocumentElement:dt,getClippingRect:lu,getOffsetParent:di,getElementRects:du,getClientRects:ru,getDimensions:uu,getScale:Bt,isElement:we,isRTL:pu};function pi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gu(e,t){let n=null,r;const o=dt(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function c(i,u){i===void 0&&(i=!1),u===void 0&&(u=1),s();const a=e.getBoundingClientRect(),{left:d,top:f,width:p,height:m}=a;if(i||t(),!p||!m)return;const g=Ft(f),h=Ft(o.clientWidth-(d+p)),x=Ft(o.clientHeight-(f+m)),y=Ft(d),w={rootMargin:-g+"px "+-h+"px "+-x+"px "+-y+"px",threshold:qe(0,Ht(1,u))||1};let E=!0;function b(R){const C=R[0].intersectionRatio;if(C!==u){if(!E)return c();C?c(!1,C):r=setTimeout(()=>{c(!1,1e-7)},1e3)}C===1&&!pi(a,e.getBoundingClientRect())&&c(),E=!1}try{n=new IntersectionObserver(b,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return c(!0),s}function qo(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,a=so(e),d=o||s?[...a?vt(a):[],...vt(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=a&&i?gu(a,n):null;let p=-1,m=null;c&&(m=new ResizeObserver(y=>{let[v]=y;v&&v.target===a&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),a&&!u&&m.observe(a),m.observe(t));let g,h=u?Dt(e):null;u&&x();function x(){const y=Dt(e);h&&!pi(h,y)&&n(),h=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(y=m)==null||y.disconnect(),m=null,u&&cancelAnimationFrame(g)}}const hu=Xl,bu=Jl,yu=Gl,vu=Ql,Eu=Yl,xu=Zl,wu=(e,t,n)=>{const r=new Map,o={platform:mu,...n},s={...o.platform,_c:r};return zl(e,t,{...o,platform:s})};var Ru=typeof document<"u",Su=function(){},Mn=Ru?be.useLayoutEffect:Su;function $n(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!$n(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!$n(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xo(e,t){const n=mi(e);return Math.round(t*n)/n}function lr(e){const t=l.useRef(e);return Mn(()=>{t.current=e}),t}function Cu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:i=!0,whileElementsMounted:u,open:a}=e,[d,f]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=l.useState(r);$n(p,r)||m(r);const[g,h]=l.useState(null),[x,y]=l.useState(null),v=l.useCallback(O=>{O!==R.current&&(R.current=O,h(O))},[]),w=l.useCallback(O=>{O!==C.current&&(C.current=O,y(O))},[]),E=s||g,b=c||x,R=l.useRef(null),C=l.useRef(null),N=l.useRef(d),_=u!=null,L=lr(u),j=lr(o),I=lr(a),S=l.useCallback(()=>{if(!R.current||!C.current)return;const O={placement:t,strategy:n,middleware:p};j.current&&(O.platform=j.current),wu(R.current,C.current,O).then(F=>{const V={...F,isPositioned:I.current!==!1};D.current&&!$n(N.current,V)&&(N.current=V,ct.flushSync(()=>{f(V)}))})},[p,t,n,j,I]);Mn(()=>{a===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,f(O=>({...O,isPositioned:!1})))},[a]);const D=l.useRef(!1);Mn(()=>(D.current=!0,()=>{D.current=!1}),[]),Mn(()=>{if(E&&(R.current=E),b&&(C.current=b),E&&b){if(L.current)return L.current(E,b,S);S()}},[E,b,S,L,_]);const M=l.useMemo(()=>({reference:R,floating:C,setReference:v,setFloating:w}),[v,w]),P=l.useMemo(()=>({reference:E,floating:b}),[E,b]),k=l.useMemo(()=>{const O={position:n,left:0,top:0};if(!P.floating)return O;const F=Xo(P.floating,d.x),V=Xo(P.floating,d.y);return i?{...O,transform:"translate("+F+"px, "+V+"px)",...mi(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:V}},[n,i,P.floating,d.x,d.y]);return l.useMemo(()=>({...d,update:S,refs:M,elements:P,floatingStyles:k}),[d,S,M,P,k])}const Ou=(e,t)=>({...hu(e),options:[e,t]}),Tu=(e,t)=>({...bu(e),options:[e,t]}),Nu=(e,t)=>({...xu(e),options:[e,t]}),Mu=(e,t)=>({...yu(e),options:[e,t]}),Iu=(e,t)=>({...vu(e),options:[e,t]}),Pu=(e,t)=>({...Eu(e),options:[e,t]}),Du={intentional:"onClick",sloppy:"onPointerDown"};function _u(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gi(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),c=n.useState("domReferenceElement"),{onOpenChange:i,dataRef:u}=n.context,{enabled:a=!0,escapeKey:d=!0,outsidePress:f=!0,outsidePressEvent:p="sloppy",referencePress:m=!1,referencePressEvent:g="sloppy",ancestorScroll:h=!1,bubbles:x,externalTree:y}=t,v=Ct(y),w=X(typeof f=="function"?f:()=>!1),E=typeof f=="function"?w:f,b=l.useRef(!1),{escapeKey:R,outsidePress:C}=_u(x),N=l.useRef(null),_=tt(),L=tt(),j=X(()=>{L.clear(),u.current.insideReactTree=!1}),I=l.useRef(!1),S=l.useRef(""),D=X(A=>{S.current=A.pointerType}),M=X(()=>{const A=S.current,Q=A==="pen"||!A?"mouse":A,Z=typeof p=="function"?p():p;return typeof Z=="string"?Z:Z[Q]}),P=X(A=>{if(!r||!a||!d||A.key!=="Escape"||I.current)return;const Q=u.current.floatingContext?.nodeId,Z=v?It(v.nodesRef.current,Q):[];if(!R&&Z.length>0){let z=!0;if(Z.forEach(W=>{W.context?.open&&!W.context.dataRef.current.__escapeKeyBubbles&&(z=!1)}),!z)return}const Re=ha(A)?A.nativeEvent:A,se=ve(to,Re);n.setOpen(!1,se),!R&&!se.isPropagationAllowed&&A.stopPropagation()}),k=X(A=>{const Q=M();return Q==="intentional"&&A.type!=="click"||Q==="sloppy"&&A.type==="click"}),O=X(()=>{u.current.insideReactTree=!0,L.start(0,j)}),F=X((A,Q=!1)=>{if(k(A)){j();return}if(u.current.insideReactTree){j();return}if(M()==="intentional"&&Q||typeof E=="function"&&!E(A))return;const Z=Le(A),Re=`[${zt("inert")}]`,se=_e(n.select("floatingElement")).querySelectorAll(Re),z=n.context.triggerElements;if(Z&&(z.hasElement(Z)||z.hasMatchingElement(K=>me(K,Z))))return;let W=we(Z)?Z:null;for(;W&&!at(W);){const K=ft(W);if(at(K)||!we(K))break;W=K}if(se.length&&we(Z)&&!ga(Z)&&!me(Z,n.select("floatingElement"))&&Array.from(se).every(K=>!me(W,K)))return;if(Pe(Z)&&!("touches"in A)){const K=at(Z),ae=Qe(Z),Y=/auto|scroll/,$=K||Y.test(ae.overflowX),B=K||Y.test(ae.overflowY),oe=$&&Z.clientWidth>0&&Z.scrollWidth>Z.clientWidth,le=B&&Z.clientHeight>0&&Z.scrollHeight>Z.clientHeight,fe=ae.direction==="rtl",xe=le&&(fe?A.offsetX<=Z.offsetWidth-Z.clientWidth:A.offsetX>Z.clientWidth),Se=oe&&A.offsetY>Z.clientHeight;if(xe||Se)return}const ie=u.current.floatingContext?.nodeId,re=v&&It(v.nodesRef.current,ie).some(K=>st(A,K.context?.elements.floating));if(st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement"))||re)return;const he=v?It(v.nodesRef.current,ie):[];if(he.length>0){let K=!0;if(he.forEach(ae=>{ae.context?.open&&!ae.context.dataRef.current.__outsidePressBubbles&&(K=!1)}),!K)return}n.setOpen(!1,ve(eo,A)),j()}),V=X(A=>{M()!=="sloppy"||A.pointerType==="touch"||!n.select("open")||!a||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement"))||F(A)}),U=X(A=>{if(M()!=="sloppy"||!n.select("open")||!a||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement")))return;const Q=A.touches[0];Q&&(N.current={startTime:Date.now(),startX:Q.clientX,startY:Q.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},_.start(1e3,()=>{N.current&&(N.current.dismissOnTouchEnd=!1,N.current.dismissOnMouseDown=!1)}))}),ee=X(A=>{const Q=Le(A);function Z(){U(A),Q?.removeEventListener(A.type,Z)}Q?.addEventListener(A.type,Z)}),H=X(A=>{const Q=b.current;if(b.current=!1,_.clear(),A.type==="mousedown"&&N.current&&!N.current.dismissOnMouseDown)return;const Z=Le(A);function Re(){A.type==="pointerdown"?V(A):F(A,Q),Z?.removeEventListener(A.type,Re)}Z?.addEventListener(A.type,Re)}),ue=X(A=>{if(M()!=="sloppy"||!N.current||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement")))return;const Q=A.touches[0];if(!Q)return;const Z=Math.abs(Q.clientX-N.current.startX),Re=Math.abs(Q.clientY-N.current.startY),se=Math.sqrt(Z*Z+Re*Re);se>5&&(N.current.dismissOnTouchEnd=!0),se>10&&(F(A),_.clear(),N.current=null)}),ge=X(A=>{const Q=Le(A);function Z(){ue(A),Q?.removeEventListener(A.type,Z)}Q?.addEventListener(A.type,Z)}),te=X(A=>{M()!=="sloppy"||!N.current||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement"))||(N.current.dismissOnTouchEnd&&F(A),_.clear(),N.current=null)}),G=X(A=>{const Q=Le(A);function Z(){te(A),Q?.removeEventListener(A.type,Z)}Q?.addEventListener(A.type,Z)});l.useEffect(()=>{if(!r||!a)return;u.current.__escapeKeyBubbles=R,u.current.__outsidePressBubbles=C;const A=new pt;function Q(W){n.setOpen(!1,ve(Qr,W))}function Z(){A.clear(),I.current=!0}function Re(){A.start(Kn()?5:0,()=>{I.current=!1})}const se=_e(o);se.addEventListener("pointerdown",D,!0),d&&(se.addEventListener("keydown",P),se.addEventListener("compositionstart",Z),se.addEventListener("compositionend",Re)),E&&(se.addEventListener("click",H,!0),se.addEventListener("pointerdown",H,!0),se.addEventListener("touchstart",ee,!0),se.addEventListener("touchmove",ge,!0),se.addEventListener("touchend",G,!0),se.addEventListener("mousedown",H,!0));let z=[];return h&&(we(c)&&(z=vt(c)),we(o)&&(z=z.concat(vt(o))),!we(s)&&s&&s.contextElement&&(z=z.concat(vt(s.contextElement)))),z=z.filter(W=>W!==se.defaultView?.visualViewport),z.forEach(W=>{W.addEventListener("scroll",Q,{passive:!0})}),()=>{se.removeEventListener("pointerdown",D,!0),d&&(se.removeEventListener("keydown",P),se.removeEventListener("compositionstart",Z),se.removeEventListener("compositionend",Re)),E&&(se.removeEventListener("click",H,!0),se.removeEventListener("pointerdown",H,!0),se.removeEventListener("touchstart",ee,!0),se.removeEventListener("touchmove",ge,!0),se.removeEventListener("touchend",G,!0),se.removeEventListener("mousedown",H,!0)),z.forEach(W=>{W.removeEventListener("scroll",Q)}),A.clear()}},[u,o,s,c,d,E,r,i,h,a,R,C,P,F,H,V,ee,ge,G,D,n]),l.useEffect(j,[E,j]);const q=l.useMemo(()=>({onKeyDown:P,...m&&{[Du[g]]:A=>{n.setOpen(!1,ve(wt,A.nativeEvent))},...g!=="intentional"&&{onClick(A){n.setOpen(!1,ve(wt,A.nativeEvent))}}}}),[P,n,m,g]),de=X(A=>{const Q=Le(A.nativeEvent);!me(n.select("floatingElement"),Q)||A.button!==0||(b.current=!0)}),ne=l.useMemo(()=>({onKeyDown:P,onPointerDown:de,onMouseDown:de,onMouseUp:de,onClickCapture:O,onMouseDownCapture:O,onPointerDownCapture:O,onMouseUpCapture:O,onTouchEndCapture:O,onTouchMoveCapture:O}),[P,de,O]);return l.useMemo(()=>a?{reference:q,floating:ne,trigger:q}:{},[a,q,ne])}var ku=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(s){({stack:o}=s)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
4
|
+
*/var Da=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],An=Da.join(","),Ds=typeof Element>"u",Wt=Ds?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ln=!Ds&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Fn=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",c=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Fn(t.parentNode));return c},_a=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},_s=function(t,n,r){if(Fn(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(An));return n&&Wt.call(t,An)&&o.unshift(t),o=o.filter(r),o},Vn=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var c=s.shift();if(!Fn(c,!1))if(c.tagName==="SLOT"){var i=c.assignedElements(),u=i.length?i:c.children,a=Vn(u,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:c,candidates:a})}else{var d=Wt.call(c,An);d&&r.filter(c)&&(n||!t.includes(c))&&o.push(c);var l=c.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(c),p=!Fn(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(l&&p){var m=Vn(l===!0?c.children:l.children,!0,r);r.flatten?o.push.apply(o,m):o.push({scopeParent:c,candidates:m})}else s.unshift.apply(s,c.children)}}return o},ks=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},As=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||_a(t))&&!ks(t)?0:t.tabIndex},ka=function(t,n){var r=As(t);return r<0&&n&&!ks(t)?0:r},Aa=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Ls=function(t){return t.tagName==="INPUT"},La=function(t){return Ls(t)&&t.type==="hidden"},Fa=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Va=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},ja=function(t){if(!t.name)return!0;var n=t.form||Ln(t),r=function(i){return n.querySelectorAll('input[type="radio"][name="'+i+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(c){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",c.message),!1}var s=Va(o,t.form);return!s||s===t},Ba=function(t){return Ls(t)&&t.type==="radio"},$a=function(t){return Ba(t)&&!ja(t)},Ha=function(t){var n,r=t&&Ln(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var c,i,u;for(s=!!((c=o)!==null&&c!==void 0&&(i=c.ownerDocument)!==null&&i!==void 0&&i.contains(o)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!s&&o;){var a,d,l;r=Ln(o),o=(a=r)===null||a===void 0?void 0:a.host,s=!!((d=o)!==null&&d!==void 0&&(l=d.ownerDocument)!==null&&l!==void 0&&l.contains(o))}}return s},Do=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Ua=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var c=Wt.call(t,"details>summary:first-of-type"),i=c?t.parentElement:t;if(Wt.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var u=t;t;){var a=t.parentElement,d=Ln(t);if(a&&!a.shadowRoot&&o(a)===!0)return Do(t);t.assignedSlot?t=t.assignedSlot:!a&&d!==t.ownerDocument?t=d.host:t=a}t=u}if(Ha(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Do(t);return!1},Wa=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Wt.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},Sr=function(t,n){return!(n.disabled||La(n)||Ua(n,t)||Fa(n)||Wa(n))},Cr=function(t,n){return!($a(n)||As(n)<0||!Sr(t,n))},Ka=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Fs=function(t){var n=[],r=[];return t.forEach(function(o,s){var c=!!o.scopeParent,i=c?o.scopeParent:o,u=ka(i,c),a=c?Fs(o.candidates):i;u===0?c?n.push.apply(n,a):n.push(i):r.push({documentOrder:s,tabIndex:u,item:o,isScope:c,content:a})}),r.sort(Aa).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},fn=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Vn([t],n.includeContainer,{filter:Cr.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ka}):r=_s(t,n.includeContainer,Cr.bind(null,n)),Fs(r)},za=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Vn([t],n.includeContainer,{filter:Sr.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=_s(t,n.includeContainer,Sr.bind(null,n)),r},Vs=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Wt.call(t,An)===!1?!1:Cr(n,t)};const qt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function js(e,t){const n=fn(e,qt()),r=n.length;if(r===0)return;const o=Ge(_e(e)),s=n.indexOf(o),c=s===-1?t===1?0:r-1:s+t;return n[c]}function Wr(e){return js(_e(e).body,1)||e}function Bs(e){return js(_e(e).body,-1)||e}function $s(e,t){if(!e)return null;const n=fn(_e(e).body,qt()),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function Ga(e){return $s(e,1)}function Ya(e){return $s(e,-1)}function jt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!me(n,r)}function qa(e){fn(e,qt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function _o(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Gn=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Gn.displayName="ToastContext");function Kr(){const e=f.useContext(Gn);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":Fe(73));return e}function or(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}const Hs=function(t){const{children:n,timeout:r=5e3,limit:o=3,toastManager:s}=t,[c,i]=f.useState([]),[u,a]=f.useState(!1),[d,l]=f.useState(!1),[p,m]=f.useState(null);c.length===0&&(u&&a(!1),d&&l(!1));const g=u||d,h=f.useRef(new Map),E=f.useRef(null),y=f.useRef(!0),v=f.useRef(!1);function w(S){const D=Ge(Ye(E.current));if(!E.current||!me(E.current,D)||!In(D))return;const M=c.findIndex(O=>O.id===S);let P=null,k=M+1;for(;k<c.length;){if(c[k].transitionStatus!=="ending"){P=c[k];break}k+=1}if(!P)for(k=M-1;k>=0;){if(c[k].transitionStatus!=="ending"){P=c[k];break}k-=1}P?P.ref?.current?.focus():p?.focus({preventScroll:!0})}const x=X(()=>{v.current||(v.current=!0,h.current.forEach(S=>{if(S.timeout){S.timeout.clear();const D=Date.now()-S.start,M=S.delay-D;S.remaining=M>0?M:0}}))}),b=X(()=>{v.current&&(v.current=!1,h.current.forEach((S,D)=>{S.remaining=S.remaining>0?S.remaining:S.delay,S.timeout??(S.timeout=pt.create()),S.timeout.start(S.remaining,()=>{h.current.delete(D),S.callback()}),S.start=Date.now()}))}),R=X(S=>{i(P=>{const k=P.map(F=>F.id===S?{...F,transitionStatus:"ending",height:0}:F),O=k.filter(F=>F.transitionStatus!=="ending");return k.map(F=>{if(F.transitionStatus==="ending")return F;const V=O.indexOf(F)>=o;return{...F,limited:V}})});const D=h.current.get(S);D&&D.timeout&&(D.timeout.clear(),h.current.delete(S)),c.find(P=>P.id===S)?.onClose?.(),w(S),c.length===1&&(a(!1),l(!1))}),C=X(S=>{i(M=>M.filter(P=>P.id!==S)),c.find(M=>M.id===S)?.onRemove?.()}),N=X((S,D,M)=>{const P=Date.now(),k=y.current&&!u&&!d,O=k?pt.create():void 0;O?.start(D,()=>{h.current.delete(S),M()}),h.current.set(S,{timeout:O,start:k?P:0,delay:D,remaining:D,callback:M})}),_=X(S=>{const D=S.id||ca("toast"),M={...S,id:D,transitionStatus:"starting"};i(k=>{const O=[M,...k],F=O.filter(V=>V.transitionStatus!=="ending");if(F.length>o){const V=F.length-o,U=F.slice(-V);return O.map(ee=>U.some(H=>H.id===ee.id)?{...ee,limited:!0}:{...ee,limited:!1})}return O.map(V=>({...V,limited:!1}))});const P=M.timeout??r;return M.type!=="loading"&&P>0&&N(D,P,()=>R(D)),(u||d||!y.current)&&x(),D}),L=X((S,D)=>{i(M=>M.map(P=>P.id===S?{...P,...D}:P))}),j=X((S,D)=>{const M=or(D.loading),P=_({...M,type:"loading"}),k=S.then(O=>{const F=or(D.success,O);L(P,{...F,type:"success"});const V=F.timeout??r;return V>0&&N(P,V,()=>R(P)),(u||d||!y.current)&&x(),O}).catch(O=>{const F=or(D.error,O);L(P,{...F,type:"error"});const V=F.timeout??r;return V>0&&N(P,V,()=>R(P)),(u||d||!y.current)&&x(),Promise.reject(O)});return{}.hasOwnProperty.call(D,"setPromise")&&D.setPromise(k),k});f.useEffect(function(){return s?s[" subscribe"](({action:M,options:P})=>{const k=P.id;M==="promise"&&P.promise?j(P.promise,P):M==="update"&&k?L(k,P):M==="close"&&k?R(k):_(P)}):void 0},[_,L,N,r,s,j,R]);const I=f.useMemo(()=>({toasts:c,setToasts:i,hovering:u,setHovering:a,focused:d,setFocused:l,expanded:g,add:_,close:R,remove:C,update:L,promise:j,pauseTimers:x,resumeTimers:b,prevFocusElement:p,setPrevFocusElement:m,viewportRef:E,scheduleTimer:N,windowFocusedRef:y}),[_,R,d,u,g,x,p,j,C,b,N,c,L]);return T.jsx(Gn.Provider,{value:I,children:n})};process.env.NODE_ENV!=="production"&&(Hs.displayName="ToastProvider");const zr={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},Xa=()=>{},J=typeof document<"u"?f.useLayoutEffect:Xa,ut=f.forwardRef(function(t,n){const[r,o]=f.useState();J(()=>{Rs&&o("button")},[]);const s={tabIndex:0,role:r};return T.jsx("span",{...t,ref:n,style:zr,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(ut.displayName="FocusGuard");const Us=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Us.displayName="ToastViewportContext");function Pt(e,t,n,r){const o=et(Ws).current;return Za(o,e,t,n,r)&&Ks(o,[e,t,n,r]),o.callback}function Ja(e){const t=et(Ws).current;return Qa(t,e)&&Ks(t,e),t.callback}function Ws(){return{callback:null,cleanup:null,refs:[]}}function Za(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Qa(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Ks(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=s(n);typeof c=="function"&&(r[o]=c);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const c=r[o];typeof c=="function"?c():s(null);break}case"object":{s.current=null;break}}}}}}}const el=parseInt(f.version,10);function Gr(e){return el>=e}function ko(e){if(!f.isValidElement(e))return null;const t=e,n=t.props;return(Gr(19)?n?.ref:t.ref)??null}function Or(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function tl(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function nl(e,t){return typeof e=="function"?e(t):e}function rl(e,t){return typeof e=="function"?e(t):e}const rn={};function cn(e,t,n,r,o){let s={...Tr(e,rn)};return t&&(s=On(s,t)),n&&(s=On(s,n)),r&&(s=On(s,r)),s}function ol(e){if(e.length===0)return rn;if(e.length===1)return Tr(e[0],rn);let t={...Tr(e[0],rn)};for(let n=1;n<e.length;n+=1)t=On(t,e[n]);return t}function On(e,t){return zs(t)?t(e):sl(e,t)}function sl(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Or(e.style,r);break}case"className":{e[n]=Gs(e.className,r);break}default:il(n,r)?e[n]=cl(e[n],r):e[n]=r}}return e}function il(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function zs(e){return typeof e=="function"}function Tr(e,t){return zs(e)?e(t):e??rn}function cl(e,t){return t?e?n=>{if(al(n)){const o=n;Nr(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function Nr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Gs(e,t){return t?e?t+" "+e:t:e}function al(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Xe(){}const jn=Object.freeze([]),ke=Object.freeze({}),ll=500,ul=500,fl={style:{transition:"none"}},dl="data-base-ui-click-trigger",pl={fallbackAxisSide:"none"},ml={fallbackAxisSide:"end"},gl={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Te(e,t,n={}){const r=t.render,o=hl(t,n);if(n.enabled===!1)return null;const s=n.state??ke;return bl(e,r,o,s)}function hl(e,t={}){const{className:n,style:r,render:o}=e,{state:s=ke,ref:c,props:i,stateAttributesMapping:u,enabled:a=!0}=t,d=a?nl(n,s):void 0,l=a?rl(r,s):void 0,p=a?tl(s,u):ke,m=a?Or(p,Array.isArray(i)?ol(i):i)??ke:ke;return typeof document<"u"&&(a?Array.isArray(c)?m.ref=Ja([m.ref,ko(o),...c]):m.ref=Pt(m.ref,ko(o),c):Pt(null,null)),a?(d!==void 0&&(m.className=Gs(m.className,d)),l!==void 0&&(m.style=Or(m.style,l)),m):ke}function bl(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=cn(n,t.props);return o.ref=n.ref,f.cloneElement(t,o)}if(e&&typeof e=="string")return yl(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":Fe(8))}function yl(e,t){return e==="button"?be.createElement("button",{type:"button",...t,key:t.key}):e==="img"?be.createElement("img",{alt:"",...t,key:t.key}):f.createElement(e,t)}let vl=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Ys=f.forwardRef(function(t,n){const{render:r,className:o,children:s,...c}=t,{toasts:i,pauseTimers:u,resumeTimers:a,setHovering:d,setFocused:l,viewportRef:p,windowFocusedRef:m,prevFocusElement:g,setPrevFocusElement:h,expanded:E,focused:y}=Kr(),v=f.useRef(!1),w=f.useRef(!1),x=i.length,b=i[0]?.height??0,R=f.useMemo(()=>i.some(O=>O.transitionStatus==="ending"),[i]);f.useEffect(()=>{if(!p.current)return;function O(V){x!==0&&V.key==="F6"&&V.target!==p.current&&(V.preventDefault(),h(Ge(Ye(p.current))),p.current?.focus({preventScroll:!0}),u(),l(!0))}const F=Ae(p.current);return F.addEventListener("keydown",O),()=>{F.removeEventListener("keydown",O)}},[u,l,h,x,p]),f.useEffect(()=>{if(!p.current||!x)return;const O=Ae(p.current);function F(U){U.target===O&&(m.current=!1,u())}function V(U){if(U.relatedTarget||U.target===O)return;const ee=Le(U),H=Ge(Ye(p.current));(!me(p.current,ee)||!In(H))&&a(),setTimeout(()=>{m.current=!0})}return O.addEventListener("blur",F,!0),O.addEventListener("focus",V,!0),()=>{O.removeEventListener("blur",F,!0),O.removeEventListener("focus",V,!0)}},[u,a,p,m,l,x]),f.useEffect(()=>{const O=p.current;if(!O||x===0)return;const F=Ye(O);function V(U){if(U.pointerType!=="touch")return;const ee=Le(U);me(O,ee)||(a(),d(!1),l(!1))}return F.addEventListener("pointerdown",V,!0),()=>{F.removeEventListener("pointerdown",V,!0)}},[x,a,l,d,p]);function C(O){p.current&&(v.current=!0,O.relatedTarget===p.current?i[0]?.ref?.current?.focus():g?.focus({preventScroll:!0}))}function N(O){O.key==="Tab"&&O.shiftKey&&O.target===p.current&&(O.preventDefault(),g?.focus({preventScroll:!0}),a())}f.useEffect(()=>{!m.current||R||!w.current||(a(),d(!1),w.current=!1)},[R,a,d,m]);function _(){u(),d(!0),w.current=!1}function L(){i.some(O=>O.transitionStatus==="ending")?w.current=!0:(a(),d(!1))}function j(){if(v.current){v.current=!1;return}y||In(Ye(p.current).activeElement)&&(l(!0),u())}function I(O){!y||me(p.current,O.relatedTarget)||(l(!1),a())}const S={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:_,onMouseMove:_,onMouseLeave:L,onFocus:j,onBlur:I,onKeyDown:N,onClick:j},D=f.useMemo(()=>({expanded:E}),[E]),M=Te("div",t,{ref:[n,p],state:D,props:[S,{style:{[vl.frontmostHeight]:b?`${b}px`:void 0}},c,{children:T.jsxs(f.Fragment,{children:[x>0&&g&&T.jsx(ut,{onFocus:C}),s,x>0&&g&&T.jsx(ut,{onFocus:C})]})}]}),P=f.useMemo(()=>({viewportRef:p}),[p]),k=f.useMemo(()=>i.filter(O=>O.priority==="high"),[i]);return T.jsxs(Us.Provider,{value:P,children:[x>0&&g&&T.jsx(ut,{onFocus:C}),M,!y&&k.length>0&&T.jsx("div",{style:zr,children:k.map(O=>T.jsxs("div",{role:"alert","aria-atomic":!0,children:[T.jsx("div",{children:O.title}),T.jsx("div",{children:O.description})]},O.id))})]})});process.env.NODE_ENV!=="production"&&(Ys.displayName="ToastViewport");function Yr(e){return Gr(19)?e:e?"true":void 0}const qr=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(qr.displayName="ToastRootContext");function an(){const e=f.useContext(qr);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":Fe(66));return e}let Kt=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const El={[Kt.startingStyle]:""},xl={[Kt.endingStyle]:""},At={transitionStatus(e){return e==="starting"?El:e==="ending"?xl:null}};function je(e){const t=et(wl,e).current;return t.next=e,J(t.effect),t}function wl(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const hn=null;let Ao=globalThis.requestAnimationFrame;class Rl{constructor(){Ce(this,"callbacks",[]);Ce(this,"callbacksCount",0);Ce(this,"nextId",1);Ce(this,"startId",1);Ce(this,"isScheduled",!1);Ce(this,"tick",t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)})}request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV==="test"&&Ao!==requestAnimationFrame&&(Ao=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const bn=new Rl;class Ie{constructor(){Ce(this,"currentId",hn);Ce(this,"cancel",()=>{this.currentId!==hn&&(bn.cancel(this.currentId),this.currentId=hn)});Ce(this,"disposeEffect",()=>this.cancel)}static create(){return new Ie}static request(t){return bn.request(t)}static cancel(t){return bn.cancel(t)}request(t){this.cancel(),this.currentId=bn.request(()=>{this.currentId=hn,t()})}}function dn(){const e=et(Ie.create).current;return Vr(e.disposeEffect),e}function Mt(e){return e==null?e:"current"in e?e.current:e}function qs(e,t=!1,n=!0){const r=dn();return X((o,s=null)=>{r.cancel();const c=Mt(e);c!=null&&(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():r.request(()=>{function i(){c&&Promise.all(c.getAnimations().map(u=>u.finished)).then(()=>{s!=null&&s.aborted||ct.flushSync(o)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;ct.flushSync(o)}else c.getAnimations().length>0&&c.getAnimations().some(u=>u.pending||u.playState!=="finished")&&i()})}t?r.request(i):i()}))})}function pn(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=je(n),c=X(o),i=qs(r,n);f.useEffect(()=>{t&&i(()=>{n===s.current&&c()})},[t,n,c,i,s])}let Nt=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const Sl={...At,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Qt=40,Cl=10,bt=.5,Ol=1;function Lo(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function Tl(e){const n=window.getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const c=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(c){const i=c[1].split(", ").map(parseFloat);i.length===6?(r=i[4],o=i[5],s=Math.sqrt(i[0]*i[0]+i[1]*i[1])):i.length===16&&(r=i[12],o=i[13],s=i[0])}}return{x:r,y:o,scale:s}}const Xs=f.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:c=["down","right"],...i}=t,u=r.positionerProps?.anchor!==void 0;let a=[];u||(a=Array.isArray(c)?c:[c]);const d=a.length>0,{toasts:l,focused:p,close:m,remove:g,setToasts:h,pauseTimers:E,expanded:y,setHovering:v}=Kr(),[w,x]=f.useState(void 0),[b,R]=f.useState(!1),[C,N]=f.useState(!1),[_,L]=f.useState(!1),[j,I]=f.useState({x:0,y:0}),[S,D]=f.useState({x:0,y:0,scale:1}),[M,P]=f.useState(),[k,O]=f.useState(),[F,V]=f.useState(null),U=f.useRef(null),ee=f.useRef({x:0,y:0}),H=f.useRef({x:0,y:0,scale:1}),ue=f.useRef(void 0),ge=f.useRef(0),te=f.useRef(!1),G=f.useRef({x:0,y:0}),q=f.useRef(!1),de=f.useMemo(()=>l.indexOf(r),[r,l]),ne=f.useMemo(()=>l.filter($=>$.transitionStatus!=="ending").indexOf(r),[r,l]),A=f.useMemo(()=>l.slice(0,l.indexOf(r)).reduce(($,B)=>$+(B.height||0),0),[l,r]);pn({open:r.transitionStatus!=="ending",ref:U,onComplete(){r.transitionStatus==="ending"&&g(r.id)}});const Q=X(($=!1)=>{const B=U.current;if(!B)return;const oe=B.style.height;B.style.height="auto";const le=B.offsetHeight;B.style.height=oe;function fe(){h(xe=>xe.map(Se=>Se.id===r.id?{...Se,ref:U,height:le,transitionStatus:void 0}:Se))}$?ct.flushSync(fe):fe()});J(Q,[Q]);function Z($,B){let oe=$,le=B;return!a.includes("left")&&!a.includes("right")?oe=$>0?$**bt:-(Math.abs($)**bt):(!a.includes("right")&&$>0&&(oe=$**bt),!a.includes("left")&&$<0&&(oe=-(Math.abs($)**bt))),!a.includes("up")&&!a.includes("down")?le=B>0?B**bt:-(Math.abs(B)**bt):(!a.includes("down")&&B>0&&(le=B**bt),!a.includes("up")&&B<0&&(le=-(Math.abs(B)**bt))),{x:oe,y:le}}function Re($){if($.button!==0)return;$.pointerType==="touch"&&E();const B=Le($.nativeEvent);if(!(B&&B.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(te.current=!1,ue.current=void 0,ge.current=0,ee.current={x:$.clientX,y:$.clientY},G.current=ee.current,U.current){const le=Tl(U.current);H.current=le,D(le),I({x:le.x,y:le.y})}v(!0),R(!0),N(!1),V(null),q.current=!0,U.current?.setPointerCapture($.pointerId)}}function se($){if(!b)return;$.preventDefault(),q.current&&(ee.current={x:$.clientX,y:$.clientY},q.current=!1);const{clientY:B,clientX:oe,movementX:le,movementY:fe}=$;(fe<0&&B>G.current.y||fe>0&&B<G.current.y)&&(G.current={x:G.current.x,y:B}),(le<0&&oe>G.current.x||le>0&&oe<G.current.x)&&(G.current={x:oe,y:G.current.y});const xe=oe-ee.current.x,Se=B-ee.current.y,ze=B-G.current.y,We=oe-G.current.x;if(!C&&Math.sqrt(xe*xe+Se*Se)>=Ol&&(N(!0),F===null)){const Ne=a.includes("left")||a.includes("right"),Ke=a.includes("up")||a.includes("down");if(Ne&&Ke){const Be=Math.abs(xe),ot=Math.abs(Se);V(Be>ot?"horizontal":"vertical")}}let Me;if(!ue.current)F==="vertical"?Se>0?Me="down":Se<0&&(Me="up"):F==="horizontal"?xe>0?Me="right":xe<0&&(Me="left"):Math.abs(xe)>=Math.abs(Se)?Me=xe>0?"right":"left":Me=Se>0?"down":"up",Me&&a.includes(Me)&&(ue.current=Me,ge.current=Lo(Me,xe,Se),x(Me));else{const Oe=ue.current,Ne=Lo(Oe,We,ze);Ne>Qt?(te.current=!1,x(Oe)):!(a.includes("left")&&a.includes("right"))&&!(a.includes("up")&&a.includes("down"))&&ge.current-Ne>=Cl&&(te.current=!0)}const pe=Z(xe,Se);let Ee=H.current.x,De=H.current.y;F==="horizontal"?(a.includes("left")||a.includes("right"))&&(Ee+=pe.x):(F==="vertical"||(a.includes("left")||a.includes("right"))&&(Ee+=pe.x),(a.includes("up")||a.includes("down"))&&(De+=pe.y)),I({x:Ee,y:De})}function z($){if(!b)return;if(R(!1),N(!1),V(null),U.current?.releasePointerCapture($.pointerId),te.current){I({x:S.x,y:S.y}),x(void 0);return}let B=!1;const oe=j.x-S.x,le=j.y-S.y;let fe;for(const xe of a){switch(xe){case"right":oe>Qt&&(B=!0,fe="right");break;case"left":oe<-Qt&&(B=!0,fe="left");break;case"down":le>Qt&&(B=!0,fe="down");break;case"up":le<-Qt&&(B=!0,fe="up");break}if(B)break}B?(x(fe),L(!0),m(r.id)):(I({x:S.x,y:S.y}),x(void 0))}function W($){if($.key==="Escape"){if(!U.current||!me(U.current,Ge(Ye(U.current))))return;m(r.id)}}f.useEffect(()=>{if(!d)return;const $=U.current;if(!$)return;function B(oe){me($,oe.target)&&oe.preventDefault()}return $.addEventListener("touchmove",B,{passive:!1}),()=>{$.removeEventListener("touchmove",B)}},[d]);function ie(){if(!b&&j.x===S.x&&j.y===S.y&&!_)return{[Nt.swipeMovementX]:"0px",[Nt.swipeMovementY]:"0px"};const $=j.x-S.x,B=j.y-S.y;return{transition:b?"none":void 0,transform:b?`translateX(${j.x}px) translateY(${j.y}px) scale(${S.scale})`:void 0,[Nt.swipeMovementX]:`${$}px`,[Nt.swipeMovementY]:`${B}px`}}const re=r.priority==="high",he={role:re?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":M,"aria-describedby":k,"aria-hidden":re&&!p?!0:void 0,onPointerDown:d?Re:void 0,onPointerMove:d?se:void 0,onPointerUp:d?z:void 0,onKeyDown:W,inert:Yr(r.limited),style:{...ie(),[Nt.index]:r.transitionStatus==="ending"?de:ne,[Nt.offsetY]:`${A}px`,[Nt.height]:r.height?`${r.height}px`:void 0}},K=f.useMemo(()=>({rootRef:U,toast:r,titleId:M,setTitleId:P,descriptionId:k,setDescriptionId:O,swiping:b,swipeDirection:w,recalculateHeight:Q,index:de,visibleIndex:ne,expanded:y}),[r,M,k,b,w,Q,de,ne,y]),ae=f.useMemo(()=>({transitionStatus:r.transitionStatus,expanded:y,limited:r.limited||!1,type:r.type,swiping:K.swiping,swipeDirection:K.swipeDirection}),[y,r.transitionStatus,r.limited,r.type,K.swiping,K.swipeDirection]),Y=Te("div",t,{ref:[n,K.rootRef],state:ae,stateAttributesMapping:Sl,props:[he,i]});return T.jsx(qr.Provider,{value:K,children:Y})});process.env.NODE_ENV!=="production"&&(Xs.displayName="ToastRoot");const Nl={...f};let Fo=0;function Ml(e,t="mui"){const[n,r]=f.useState(e),o=e||n;return f.useEffect(()=>{n==null&&(Fo+=1,r(`${t}-${Fo}`))},[n,t]),o}const Vo=Nl.useId;function gt(e,t){if(Vo!==void 0){const n=Vo();return e??(t?`${t}-${n}`:n)}return Ml(e,t)}const Js=f.forwardRef(function(t,n){const{render:r,className:o,id:s,children:c,...i}=t,{toast:u}=an(),a=c??u.description,d=!!a,l=gt(s),{setDescriptionId:p}=an();J(()=>{if(d)return p(l),()=>{p(void 0)}},[d,l,p]);const m=f.useMemo(()=>({type:u.type}),[u.type]),g=Te("p",t,{ref:n,state:m,props:{...i,id:l,children:a}});return d?g:null});process.env.NODE_ENV!=="production"&&(Js.displayName="ToastDescription");const Zs=f.forwardRef(function(t,n){const{render:r,className:o,id:s,children:c,...i}=t,{toast:u}=an(),a=c??u.title,d=!!a,l=gt(s),{setTitleId:p}=an();J(()=>{if(d)return p(l),()=>{p(void 0)}},[d,l,p]);const m=f.useMemo(()=>({type:u.type}),[u.type]),g=Te("h2",t,{ref:n,state:m,props:{...i,id:l,children:a}});return d?g:null});process.env.NODE_ENV!=="production"&&(Zs.displayName="ToastTitle");let Mr;process.env.NODE_ENV!=="production"&&(Mr=new Set);function jo(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Mr.has(t)||(Mr.add(t),console.error(`Base UI: ${t}`))}}const Qs=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Qs.displayName="CompositeRootContext");function Xr(e=!1){const t=f.useContext(Qs);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":Fe(16));return t}function Il(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,c=r&&t!==!1,i=r&&t===!1;return{props:f.useMemo(()=>{const a={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(a.tabIndex=o,!s&&n&&(a.tabIndex=t?o:-1)),(s&&(t||c)||!s&&n)&&(a["aria-disabled"]=n),s&&(!t||i)&&(a.disabled=n),a},[r,n,t,c,i,s,o])}}function Xt(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=f.useRef(null),c=Xr(!0)!==void 0,i=X(()=>{const p=s.current;return!!(p?.tagName==="A"&&p?.href)}),{props:u}=Il({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!s.current)return;const p=s.current.tagName==="BUTTON";o?p||jo("A component that acts as a button was not rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is a real <button>, or set the `nativeButton` prop on the component to `false`."):p&&jo("A component that acts as a button was rendered as a native <button>, which does not match the default. Ensure that the element passed to the `render` prop of the component is not a real <button>, or set the `nativeButton` prop on the component to `true`.")},[o]);const a=f.useCallback(()=>{const p=s.current;Pl(p)&&c&&t&&u.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,u.disabled,c]);J(a,[a]);const d=f.useCallback((p={})=>{const{onClick:m,onMouseDown:g,onKeyUp:h,onKeyDown:E,onPointerDown:y,...v}=p;return cn({type:o?"button":void 0,onClick(x){if(t){x.preventDefault();return}m?.(x)},onMouseDown(x){t||g?.(x)},onKeyDown(x){if(t||(Nr(x),E?.(x)),x.baseUIHandlerPrevented)return;const b=x.target===x.currentTarget&&!o&&!i()&&!t,R=x.key==="Enter",C=x.key===" ";b&&((C||R)&&x.preventDefault(),R&&m?.(x))},onKeyUp(x){t||(Nr(x),h?.(x)),!x.baseUIHandlerPrevented&&x.target===x.currentTarget&&!o&&!t&&x.key===" "&&m?.(x)},onPointerDown(x){if(t){x.preventDefault();return}y?.(x)}},o?void 0:{role:"button"},u,v)},[t,u,o,i]),l=X(p=>{s.current=p,a()});return{getButtonProps:d,buttonRef:l}}function Pl(e){return Pe(e)&&e.tagName==="BUTTON"}const ei=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s,nativeButton:c=!0,...i}=t,{close:u,expanded:a}=Kr(),{toast:d}=an(),[l,p]=f.useState(!1),{getButtonProps:m,buttonRef:g}=Xt({disabled:s,native:c}),h=f.useMemo(()=>({type:d.type}),[d.type]);return Te("button",t,{ref:[n,g],state:h,props:[{"aria-hidden":!a&&!l,onClick(){u(d.id)},onFocus(){p(!0)},onBlur(){p(!1)}},i,m]})});process.env.NODE_ENV!=="production"&&(ei.displayName="ToastClose");function ti(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Jr{constructor(){Ce(this,"nodesRef",{current:[]});Ce(this,"events",ti())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Zr=f.createContext(null);process.env.NODE_ENV!=="production"&&(Zr.displayName="FloatingNodeContext");const Qr=f.createContext(null);process.env.NODE_ENV!=="production"&&(Qr.displayName="FloatingTreeContext");const ht=()=>f.useContext(Zr)?.id||null,Ct=e=>{const t=f.useContext(Qr);return e??t};function ni(e){const t=gt(),n=Ct(e),r=ht();return J(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function Dl(e){const{children:t,id:n}=e,r=ht();return T.jsx(Zr.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function _l(e){const{children:t,externalTree:n}=e,r=et(()=>n??new Jr).current;return T.jsx(Qr.Provider,{value:r,children:t})}const eo="none",wt="trigger-press",Je="trigger-hover",Bn="trigger-focus",to="outside-press",ri="item-press",kl="close-press",zt="focus-out",no="escape-key",Tn="list-navigation",Al="cancel-open",en="sibling-open",oi="imperative-action";function ve(e,t,n,r){let o=!1,s=!1;const c=ke;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...c}}function Gt(e){return`data-base-ui-${e}`}function sr(e,t,n){if(n&&!Ht(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}let Bo=0;function Nn(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Bo);const s=()=>e?.focus({preventScroll:n});o?s():Bo=requestAnimationFrame(s)}const Bt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function $o(e){return e==="inert"?Bt.inert:e==="aria-hidden"?Bt["aria-hidden"]:Bt.none}let yn=new WeakSet,vn={},ir=0;const si=e=>e&&(e.host||si(e.parentNode)),Ll=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=si(n);return e.contains(r)?r:null}).filter(n=>n!=null);function Fl(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,c=Ll(t,e),i=new Set,u=new Set(c),a=[];vn[o]||(vn[o]=new WeakMap);const d=vn[o];c.forEach(l),p(t),i.clear();function l(m){!m||i.has(m)||(i.add(m),m.parentNode&&l(m.parentNode))}function p(m){!m||u.has(m)||[].forEach.call(m.children,g=>{if(Rt(g)!=="script")if(i.has(g))p(g);else{const h=s?g.getAttribute(s):null,E=h!==null&&h!=="false",y=$o(s),v=(y.get(g)||0)+1,w=(d.get(g)||0)+1;y.set(g,v),d.set(g,w),a.push(g),v===1&&E&&yn.add(g),w===1&&g.setAttribute(o,""),!E&&s&&g.setAttribute(s,s==="inert"?"":"true")}})}return ir+=1,()=>{a.forEach(m=>{const g=$o(s),E=(g.get(m)||0)-1,y=(d.get(m)||0)-1;g.set(m,E),d.set(m,y),E||(!yn.has(m)&&s&&m.removeAttribute(s),yn.delete(m)),y||m.removeAttribute(o)}),ir-=1,ir||(Bt.inert=new WeakMap,Bt["aria-hidden"]=new WeakMap,Bt.none=new WeakMap,yn=new WeakSet,vn={})}}function Vl(e,t=!1,n=!1){const r=_e(e[0]).body;return Fl(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const ro=f.createContext(null);process.env.NODE_ENV!=="production"&&(ro.displayName="PortalContext");const ii=()=>f.useContext(ro),jl=Gt("portal");function Bl(e={}){const{ref:t,container:n,componentProps:r=ke,elementProps:o,elementState:s}=e,c=gt(),u=ii()?.portalNode,[a,d]=f.useState(null),[l,p]=f.useState(null),m=f.useRef(null);J(()=>{if(n===null){m.current&&(m.current=null,p(null),d(null));return}if(c==null)return;const E=(n&&(Lr(n)?n:n.current))??u??document.body;if(E==null){m.current&&(m.current=null,p(null),d(null));return}m.current!==E&&(m.current=E,p(null),d(E))},[n,u,c]);const g=Te("div",r,{ref:[t,p],state:s,props:[{id:c,[jl]:""},o]});return{portalNode:l,portalSubtree:a&&g?ct.createPortal(g,a):null}}const oo=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:c,renderGuards:i,...u}=t,{portalNode:a,portalSubtree:d}=Bl({container:o,ref:n,componentProps:t,elementProps:u}),l=f.useRef(null),p=f.useRef(null),m=f.useRef(null),g=f.useRef(null),[h,E]=f.useState(null),y=h?.modal,v=h?.open,w=typeof i=="boolean"?i:!!h&&!h.modal&&h.open&&!!a;f.useEffect(()=>{if(!a||y)return;function b(R){a&&jt(R)&&(R.type==="focusin"?_o:qa)(a)}return a.addEventListener("focusin",b,!0),a.addEventListener("focusout",b,!0),()=>{a.removeEventListener("focusin",b,!0),a.removeEventListener("focusout",b,!0)}},[a,y]),f.useEffect(()=>{!a||v||_o(a)},[v,a]);const x=f.useMemo(()=>({beforeOutsideRef:l,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:g,portalNode:a,setFocusManagerState:E}),[a]);return T.jsxs(f.Fragment,{children:[d,T.jsxs(ro.Provider,{value:x,children:[w&&a&&T.jsx(ut,{"data-type":"outside",ref:l,onFocus:b=>{if(jt(b,a))m.current?.focus();else{const R=h?h.domReference:null;Bs(R)?.focus()}}}),w&&a&&T.jsx("span",{"aria-owns":a.id,style:gl}),a&&ct.createPortal(r,a),w&&a&&T.jsx(ut,{"data-type":"outside",ref:p,onFocus:b=>{if(jt(b,a))g.current?.focus();else{const R=h?h.domReference:null;Wr(R)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,ve(zt,b.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(oo.displayName="FloatingPortal");function $l(e,t){const n=Ae(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Ho=20;let yt=[];function so(){yt=yt.filter(e=>e.isConnected)}function Hl(e){so(),e&&Rt(e)!=="body"&&(yt.push(e),yt.length>Ho&&(yt=yt.slice(-Ho)))}function cr(){return so(),yt[yt.length-1]}function Ul(e){if(!e)return null;const t=qt();return Vs(e,t)?e:fn(e,t)[0]||e}function Wl(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Qe(e).display!=="none"}function Uo(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=qt(),o=za(e,n).filter(c=>{const i=c.getAttribute("data-tabindex")||"";return Vs(c,n)||c.hasAttribute("data-tabindex")&&!i.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ci(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],initialFocus:s=!0,returnFocus:c=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:a=!0,openInteractionType:d="",getInsideElements:l=()=>[],nextFocusableElement:p,previousFocusableElement:m,beforeContentFocusGuardRef:g,externalTree:h}=e,E="rootStore"in t?t.rootStore:t,y=E.useState("open"),v=E.useState("domReferenceElement"),w=E.useState("floatingElement"),{events:x,dataRef:b}=E.context,R=X(()=>b.current.floatingContext?.nodeId),C=X(l),N=s===!1,_=xr(v)&&N,L=je(o),j=je(s),I=je(c),S=je(d),D=Ct(h),M=ii(),P=f.useRef(null),k=f.useRef(null),O=f.useRef(!1),F=f.useRef(!1),V=f.useRef(!1),U=f.useRef(-1),ee=f.useRef(""),H=f.useRef(""),ue=tt(),ge=tt(),te=dn(),G=M!=null,q=Pn(w),de=X((z=q)=>z?fn(z,qt()):[]),ne=X(z=>{const W=de(z);return L.current.map(()=>W).filter(Boolean).flat()});f.useEffect(()=>{if(r||!u)return;function z(ie){ie.key==="Tab"&&me(q,Ge(_e(q)))&&de().length===0&&!_&&He(ie)}const W=_e(q);return W.addEventListener("keydown",z),()=>{W.removeEventListener("keydown",z)}},[r,v,q,u,L,_,de,ne]),f.useEffect(()=>{if(r||!w)return;function z(W){const ie=Le(W),he=de().indexOf(ie);he!==-1&&(U.current=he)}return w.addEventListener("focusin",z),()=>{w.removeEventListener("focusin",z)}},[r,w,de]),f.useEffect(()=>{if(r||!y)return;const z=_e(q);function W(){V.current=!1}function ie(he){const K=Le(he),ae=me(w,K)||me(v,K)||me(M?.portalNode,K);V.current=!ae,H.current=he.pointerType||"keyboard"}function re(){H.current="keyboard"}return z.addEventListener("pointerdown",ie,!0),z.addEventListener("pointerup",W,!0),z.addEventListener("pointercancel",W,!0),z.addEventListener("keydown",re,!0),()=>{z.removeEventListener("pointerdown",ie,!0),z.removeEventListener("pointerup",W,!0),z.removeEventListener("pointercancel",W,!0),z.removeEventListener("keydown",re,!0)}},[r,w,v,q,y,M]),f.useEffect(()=>{if(r||!a)return;function z(){F.current=!0,ge.start(0,()=>{F.current=!1})}function W(K){const ae=K.relatedTarget,Y=K.currentTarget,$=Le(K);queueMicrotask(()=>{const B=R(),oe=E.context.triggerElements,le=!(me(v,ae)||me(w,ae)||me(ae,w)||me(M?.portalNode,ae)||ae!=null&&oe.hasElement(ae)||oe.hasMatchingElement(fe=>me(fe,ae))||ae?.hasAttribute(Gt("focus-guard"))||D&&(It(D.nodesRef.current,B).find(fe=>me(fe.context?.elements.floating,ae)||me(fe.context?.elements.domReference,ae))||No(D.nodesRef.current,B).find(fe=>[fe.context?.elements.floating,Pn(fe.context?.elements.floating)].includes(ae)||fe.context?.elements.domReference===ae)));if(Y===v&&q&&Uo(q,L),i&&Y!==v&&!Wl($)&&Ge(_e(q))===_e(q).body){if(Pe(q)&&(q.focus(),i==="popup")){te.request(()=>{q.focus()});return}const fe=U.current,xe=de(),Se=xe[fe]||xe[xe.length-1]||q;Pe(Se)&&Se.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(_||!u)&&ae&&le&&!F.current&&(_||ae!==cr())&&(O.current=!0,E.setOpen(!1,ve(zt,K)))})}function ie(){V.current||(b.current.insideReactTree=!0,ue.start(0,()=>{b.current.insideReactTree=!1}))}const re=Pe(v)?v:null,he=[];if(!(!w&&!re))return re&&(re.addEventListener("focusout",W),re.addEventListener("pointerdown",z),he.push(()=>{re.removeEventListener("focusout",W),re.removeEventListener("pointerdown",z)})),w&&(w.addEventListener("focusout",W),M&&(w.addEventListener("focusout",ie,!0),he.push(()=>{w.removeEventListener("focusout",ie,!0)})),he.push(()=>{w.removeEventListener("focusout",W)})),()=>{he.forEach(K=>{K()})}},[r,v,w,q,u,D,M,E,a,i,de,_,R,L,b,ue,ge,te]);const A=f.useRef(null),Q=f.useRef(null),Z=Pt(A,g,M?.beforeInsideRef),Re=Pt(Q,M?.afterInsideRef);f.useEffect(()=>{if(r||!w||!y)return;const z=Array.from(M?.portalNode?.querySelectorAll(`[${Gt("portal")}]`)||[]),ie=(D?No(D.nodesRef.current,R()):[]).find(K=>xr(K.context?.elements.domReference||null))?.context?.elements.domReference,re=[w,ie,...z,...C(),P.current,k.current,A.current,Q.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,Mt(m),Mt(p),_?v:null].filter(K=>K!=null),he=Vl(re,u||_);return()=>{he()}},[y,r,v,w,u,L,M,_,D,R,C,p,m]),J(()=>{if(!y||r||!Pe(q))return;const z=_e(q),W=Ge(z);queueMicrotask(()=>{const ie=ne(q),re=j.current,he=typeof re=="function"?re(S.current||""):re;if(he===void 0||he===!1)return;let K;he===!0||he===null?K=ie[0]||q:K=Mt(he),K=K||ie[0]||q,!me(q,W)&&Nn(K,{preventScroll:K===q})})},[r,y,q,N,ne,j,S]),J(()=>{if(r||!q)return;const z=_e(q),W=Ge(z);Hl(W);function ie(K){if(K.open||(ee.current=$l(K.nativeEvent,H.current)),K.reason===Je&&K.nativeEvent.type==="mouseleave"&&(O.current=!0),K.reason===to)if(K.nested)O.current=!1;else if(Ns(K.nativeEvent)||Ms(K.nativeEvent))O.current=!1;else{let ae=!1;document.createElement("div").focus({get preventScroll(){return ae=!0,!1}}),ae?O.current=!1:O.current=!0}}x.on("openchange",ie);const re=z.createElement("span");re.setAttribute("tabindex","-1"),re.setAttribute("aria-hidden","true"),Object.assign(re.style,zr),G&&v&&v.insertAdjacentElement("afterend",re);function he(){const K=I.current;let ae=typeof K=="function"?K(ee.current):K;if(ae===void 0||ae===!1)return null;if(ae===null&&(ae=!0),typeof ae=="boolean"){const $=v||cr();return $&&$.isConnected?$:re}const Y=v||cr()||re;return Mt(ae)||Y}return()=>{x.off("openchange",ie);const K=Ge(z),ae=me(w,K)||D&&It(D.nodesRef.current,R(),!1).some($=>me($.context?.elements.floating,K)),Y=he();queueMicrotask(()=>{const $=Ul(Y),B=typeof I.current!="boolean";I.current&&!O.current&&Pe($)&&(!(!B&&$!==K&&K!==z.body)||ae)&&$.focus({preventScroll:!0}),re.remove()})}},[r,w,q,I,b,x,D,G,v,R]),f.useEffect(()=>{queueMicrotask(()=>{O.current=!1})},[r]),f.useEffect(()=>{if(r||!y)return;function z(ie){Le(ie)?.closest(`[${dl}]`)&&(F.current=!0)}const W=_e(q);return W.addEventListener("pointerdown",z,!0),()=>{W.removeEventListener("pointerdown",z,!0)}},[r,y,q]),J(()=>{if(!r&&M)return M.setFocusManagerState({modal:u,closeOnFocusOut:a,open:y,onOpenChange:E.setOpen,domReference:v}),()=>{M.setFocusManagerState(null)}},[r,M,u,y,E,a,v]),J(()=>{if(!(r||!q))return Uo(q,L),()=>{queueMicrotask(so)}},[r,q,L]);const se=!r&&(u?!_:!0)&&(G||u);return T.jsxs(f.Fragment,{children:[se&&T.jsx(ut,{"data-type":"inside",ref:Z,onFocus:z=>{if(u){const W=ne();Nn(W[W.length-1])}else M?.portalNode&&(O.current=!1,jt(z,M.portalNode)?Wr(v)?.focus():Mt(m??M.beforeOutsideRef)?.focus())}}),n,se&&T.jsx(ut,{"data-type":"inside",ref:Re,onFocus:z=>{u?Nn(ne()[0]):M?.portalNode&&(a&&(O.current=!0),jt(z,M.portalNode)?Bs(v)?.focus():Mt(p??M.afterOutsideRef)?.focus())}})]})}function Kl(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:c=!0,ignoreMouse:i=!1,stickIfOpen:u=!0,touchOpenDelay:a=0}=t,d=f.useRef(void 0),l=dn(),p=tt(),m=f.useMemo(()=>({onPointerDown(g){d.current=g.pointerType},onMouseDown(g){const h=d.current,E=g.nativeEvent,y=n.select("open");if(g.button!==0||s==="click"||Ht(h,!0)&&i)return;const v=r.current.openEvent,w=v?.type,x=n.select("domReferenceElement")!==g.currentTarget,b=y&&x||!(y&&c&&(!(v&&u)||w==="click"||w==="mousedown"));if(Br(E.target)){const C=ve(wt,E,E.target);b&&h==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,C)}):n.setOpen(b,C);return}const R=g.currentTarget;l.request(()=>{const C=ve(wt,E,R);b&&h==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,C)}):n.setOpen(b,C)})},onClick(g){if(s==="mousedown-only")return;const h=d.current;if(s==="mousedown"&&h){d.current=void 0;return}if(Ht(h,!0)&&i)return;const E=n.select("open"),y=r.current.openEvent,v=n.select("domReferenceElement")!==g.currentTarget,w=E&&v||!(E&&c&&(!(y&&u)||Is(y))),x=ve(wt,g.nativeEvent,g.currentTarget);w&&h==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,x)}):n.setOpen(w,x)},onKeyDown(){d.current=void 0}}),[r,s,i,n,u,c,l,p,a]);return f.useMemo(()=>o?{reference:m}:ke,[o,m])}function Wo(e,t,n){let{reference:r,floating:o}=e;const s=rt(t),c=Ur(t),i=Hr(c),u=Ze(t),a=s==="y",d=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,p=r[i]/2-o[i]/2;let m;switch(u){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:l};break;case"left":m={x:r.x-o.width,y:l};break;default:m={x:r.x,y:r.y}}switch(St(t)){case"start":m[c]-=p*(n&&a?-1:1);break;case"end":m[c]+=p*(n&&a?-1:1);break}return m}const zl=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,i=s.filter(Boolean),u=await(c.isRTL==null?void 0:c.isRTL(t));let a=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:l}=Wo(a,r,u),p=r,m={},g=0;for(let h=0;h<i.length;h++){const{name:E,fn:y}=i[h],{x:v,y:w,data:x,reset:b}=await y({x:d,y:l,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:a,platform:c,elements:{reference:e,floating:t}});d=v??d,l=w??l,m={...m,[E]:{...m[E],...x}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(a=b.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:d,y:l}=Wo(a,p,u)),h=-1)}return{x:d,y:l,placement:p,strategy:o,middlewareData:m}};async function ln(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:i,strategy:u}=e,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:l="floating",altBoundary:p=!1,padding:m=0}=mt(t,e),g=Ps(m),E=i[p?l==="floating"?"reference":"floating":l],y=kn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(E)))==null||n?E:E.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:a,rootBoundary:d,strategy:u})),v=l==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),x=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},b=kn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:w,strategy:u}):v);return{top:(y.top-b.top+g.top)/x.y,bottom:(b.bottom-y.bottom+g.bottom)/x.y,left:(y.left-b.left+g.left)/x.x,right:(b.right-y.right+g.right)/x.x}}const Gl=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:c,initialPlacement:i,platform:u,elements:a}=t,{mainAxis:d=!0,crossAxis:l=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...E}=mt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ze(o),v=rt(i),w=Ze(i)===i,x=await(u.isRTL==null?void 0:u.isRTL(a.floating)),b=p||(w||!h?[_n(i)]:wa(i)),R=g!=="none";!p&&R&&b.push(...Oa(i,h,g,x));const C=[i,...b],N=await ln(t,E),_=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&_.push(N[y]),l){const D=xa(o,c,x);_.push(N[D[0]],N[D[1]])}if(L=[...L,{placement:o,overflows:_}],!_.every(D=>D<=0)){var j,I;const D=(((j=s.flip)==null?void 0:j.index)||0)+1,M=C[D];if(M&&(!(l==="alignment"?v!==rt(M):!1)||L.every(O=>rt(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:D,overflows:L},reset:{placement:M}};let P=(I=L.filter(k=>k.overflows[0]<=0).sort((k,O)=>k.overflows[1]-O.overflows[1])[0])==null?void 0:I.placement;if(!P)switch(m){case"bestFit":{var S;const k=(S=L.filter(O=>{if(R){const F=rt(O.placement);return F===v||F==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(F=>F>0).reduce((F,V)=>F+V,0)]).sort((O,F)=>O[1]-F[1])[0])==null?void 0:S[0];k&&(P=k);break}case"initialPlacement":P=i;break}if(o!==P)return{reset:{placement:P}}}return{}}}};function Ko(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zo(e){return ba.some(t=>e[t]>=0)}const Yl=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=mt(e,t);switch(r){case"referenceHidden":{const s=await ln(t,{...o,elementContext:"reference"}),c=Ko(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:zo(c)}}}case"escaped":{const s=await ln(t,{...o,altBoundary:!0}),c=Ko(s,n.floating);return{data:{escapedOffsets:c,escaped:zo(c)}}}default:return{}}}}},ai=new Set(["left","top"]);async function ql(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Ze(n),i=St(n),u=rt(n)==="y",a=ai.has(c)?-1:1,d=s&&u?-1:1,l=mt(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return i&&typeof g=="number"&&(m=i==="end"?g*-1:g),u?{x:m*d,y:p*a}:{x:p*a,y:m*d}}const Xl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:i}=t,u=await ql(t,e);return c===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:c}}}}},Jl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:i={fn:E=>{let{x:y,y:v}=E;return{x:y,y:v}}},...u}=mt(e,t),a={x:n,y:r},d=await ln(t,u),l=rt(Ze(o)),p=$r(l);let m=a[p],g=a[l];if(s){const E=p==="y"?"top":"left",y=p==="y"?"bottom":"right",v=m+d[E],w=m-d[y];m=wr(v,m,w)}if(c){const E=l==="y"?"top":"left",y=l==="y"?"bottom":"right",v=g+d[E],w=g-d[y];g=wr(v,g,w)}const h=i.fn({...t,[p]:m,[l]:g});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[p]:s,[l]:c}}}}}},Zl=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:c}=t,{offset:i=0,mainAxis:u=!0,crossAxis:a=!0}=mt(e,t),d={x:n,y:r},l=rt(o),p=$r(l);let m=d[p],g=d[l];const h=mt(i,t),E=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const w=p==="y"?"height":"width",x=s.reference[p]-s.floating[w]+E.mainAxis,b=s.reference[p]+s.reference[w]-E.mainAxis;m<x?m=x:m>b&&(m=b)}if(a){var y,v;const w=p==="y"?"width":"height",x=ai.has(Ze(o)),b=s.reference[l]-s.floating[w]+(x&&((y=c.offset)==null?void 0:y[l])||0)+(x?0:E.crossAxis),R=s.reference[l]+s.reference[w]+(x?0:((v=c.offset)==null?void 0:v[l])||0)-(x?E.crossAxis:0);g<b?g=b:g>R&&(g=R)}return{[p]:m,[l]:g}}}},Ql=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:i}=t,{apply:u=()=>{},...a}=mt(e,t),d=await ln(t,a),l=Ze(o),p=St(o),m=rt(o)==="y",{width:g,height:h}=s.floating;let E,y;l==="top"||l==="bottom"?(E=l,y=p===(await(c.isRTL==null?void 0:c.isRTL(i.floating))?"start":"end")?"left":"right"):(y=l,E=p==="end"?"top":"bottom");const v=h-d.top-d.bottom,w=g-d.left-d.right,x=Ut(h-d[E],v),b=Ut(g-d[y],w),R=!t.middlewareData.shift;let C=x,N=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),R&&!p){const L=qe(d.left,0),j=qe(d.right,0),I=qe(d.top,0),S=qe(d.bottom,0);m?N=g-2*(L!==0||j!==0?L+j:qe(d.left,d.right)):C=h-2*(I!==0||S!==0?I+S:qe(d.top,d.bottom))}await u({...t,availableWidth:N,availableHeight:C});const _=await c.getDimensions(i.floating);return g!==_.width||h!==_.height?{reset:{rects:!0}}:{}}}};function li(e){const t=Qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Pe(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,i=Dn(n)!==s||Dn(r)!==c;return i&&(n=s,r=c),{width:n,height:r,$:i}}function io(e){return we(e)?e:e.contextElement}function $t(e){const t=io(e);if(!Pe(t))return lt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=li(t);let c=(s?Dn(n.width):n.width)/r,i=(s?Dn(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!i||!Number.isFinite(i))&&(i=1),{x:c,y:i}}const eu=lt(0);function ui(e){const t=Ae(e);return!Kn()||!t.visualViewport?eu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ae(e)?!1:t}function Dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=io(e);let c=lt(1);t&&(r?we(r)&&(c=$t(r)):c=$t(e));const i=tu(s,n,r)?ui(s):lt(0);let u=(o.left+i.x)/c.x,a=(o.top+i.y)/c.y,d=o.width/c.x,l=o.height/c.y;if(s){const p=Ae(s),m=r&&we(r)?Ae(r):r;let g=p,h=yr(g);for(;h&&r&&m!==g;){const E=$t(h),y=h.getBoundingClientRect(),v=Qe(h),w=y.left+(h.clientLeft+parseFloat(v.paddingLeft))*E.x,x=y.top+(h.clientTop+parseFloat(v.paddingTop))*E.y;u*=E.x,a*=E.y,d*=E.x,l*=E.y,u+=w,a+=x,g=Ae(h),h=yr(g)}}return kn({width:d,height:l,x:u,y:a})}function Yn(e,t){const n=zn(e).scrollLeft;return t?t.left+n:Dt(dt(e)).left+n}function fi(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Yn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function nu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=dt(r),i=t?Wn(t.floating):!1;if(r===c||i&&s)return n;let u={scrollLeft:0,scrollTop:0},a=lt(1);const d=lt(0),l=Pe(r);if((l||!l&&!s)&&((Rt(r)!=="body"||kt(c))&&(u=zn(r)),Pe(r))){const m=Dt(r);a=$t(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}const p=c&&!l&&!s?fi(c,u):lt(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-u.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-u.scrollTop*a.y+d.y+p.y}}function ru(e){return Array.from(e.getClientRects())}function ou(e){const t=dt(e),n=zn(e),r=e.ownerDocument.body,o=qe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=qe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Yn(e);const i=-n.scrollTop;return Qe(r).direction==="rtl"&&(c+=qe(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:i}}const Go=25;function su(e,t){const n=Ae(e),r=dt(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,i=0,u=0;if(o){s=o.width,c=o.height;const d=Kn();(!d||d&&t==="fixed")&&(i=o.offsetLeft,u=o.offsetTop)}const a=Yn(r);if(a<=0){const d=r.ownerDocument,l=d.body,p=getComputedStyle(l),m=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-l.clientWidth-m);g<=Go&&(s-=g)}else a<=Go&&(s+=a);return{width:s,height:c,x:i,y:u}}const iu=new Set(["absolute","fixed"]);function cu(e,t){const n=Dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Pe(e)?$t(e):lt(1),c=e.clientWidth*s.x,i=e.clientHeight*s.y,u=o*s.x,a=r*s.y;return{width:c,height:i,x:u,y:a}}function Yo(e,t,n){let r;if(t==="viewport")r=su(e,n);else if(t==="document")r=ou(dt(e));else if(we(t))r=cu(t,n);else{const o=ui(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return kn(r)}function di(e,t){const n=ft(e);return n===t||!we(n)||at(n)?!1:Qe(n).position==="fixed"||di(n,t)}function au(e,t){const n=t.get(e);if(n)return n;let r=vt(e,[],!1).filter(i=>we(i)&&Rt(i)!=="body"),o=null;const s=Qe(e).position==="fixed";let c=s?ft(e):e;for(;we(c)&&!at(c);){const i=Qe(c),u=Fr(c);!u&&i.position==="fixed"&&(o=null),(s?!u&&!o:!u&&i.position==="static"&&!!o&&iu.has(o.position)||kt(c)&&!u&&di(e,c))?r=r.filter(d=>d!==c):o=i,c=ft(c)}return t.set(e,r),r}function lu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Wn(t)?[]:au(t,this._c):[].concat(n),r],i=c[0],u=c.reduce((a,d)=>{const l=Yo(t,d,o);return a.top=qe(l.top,a.top),a.right=Ut(l.right,a.right),a.bottom=Ut(l.bottom,a.bottom),a.left=qe(l.left,a.left),a},Yo(t,i,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function uu(e){const{width:t,height:n}=li(e);return{width:t,height:n}}function fu(e,t,n){const r=Pe(t),o=dt(t),s=n==="fixed",c=Dt(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const u=lt(0);function a(){u.x=Yn(o)}if(r||!r&&!s)if((Rt(t)!=="body"||kt(o))&&(i=zn(t)),r){const m=Dt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&a();s&&!r&&o&&a();const d=o&&!r&&!s?fi(o,i):lt(0),l=c.left+i.scrollLeft-u.x-d.x,p=c.top+i.scrollTop-u.y-d.y;return{x:l,y:p,width:c.width,height:c.height}}function ar(e){return Qe(e).position==="static"}function qo(e,t){if(!Pe(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return dt(e)===n&&(n=n.ownerDocument.body),n}function pi(e,t){const n=Ae(e);if(Wn(e))return n;if(!Pe(e)){let o=ft(e);for(;o&&!at(o);){if(we(o)&&!ar(o))return o;o=ft(o)}return n}let r=qo(e,t);for(;r&&Jc(r)&&ar(r);)r=qo(r,t);return r&&at(r)&&ar(r)&&!Fr(r)?n:r||na(e)||n}const du=async function(e){const t=this.getOffsetParent||pi,n=this.getDimensions,r=await n(e.floating);return{reference:fu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pu(e){return Qe(e).direction==="rtl"}const mu={convertOffsetParentRelativeRectToViewportRelativeRect:nu,getDocumentElement:dt,getClippingRect:lu,getOffsetParent:pi,getElementRects:du,getClientRects:ru,getDimensions:uu,getScale:$t,isElement:we,isRTL:pu};function mi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gu(e,t){let n=null,r;const o=dt(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function c(i,u){i===void 0&&(i=!1),u===void 0&&(u=1),s();const a=e.getBoundingClientRect(),{left:d,top:l,width:p,height:m}=a;if(i||t(),!p||!m)return;const g=Vt(l),h=Vt(o.clientWidth-(d+p)),E=Vt(o.clientHeight-(l+m)),y=Vt(d),w={rootMargin:-g+"px "+-h+"px "+-E+"px "+-y+"px",threshold:qe(0,Ut(1,u))||1};let x=!0;function b(R){const C=R[0].intersectionRatio;if(C!==u){if(!x)return c();C?c(!1,C):r=setTimeout(()=>{c(!1,1e-7)},1e3)}C===1&&!mi(a,e.getBoundingClientRect())&&c(),x=!1}try{n=new IntersectionObserver(b,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return c(!0),s}function Xo(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,a=io(e),d=o||s?[...a?vt(a):[],...vt(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const l=a&&i?gu(a,n):null;let p=-1,m=null;c&&(m=new ResizeObserver(y=>{let[v]=y;v&&v.target===a&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),a&&!u&&m.observe(a),m.observe(t));let g,h=u?Dt(e):null;u&&E();function E(){const y=Dt(e);h&&!mi(h,y)&&n(),h=y,g=requestAnimationFrame(E)}return n(),()=>{var y;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),l?.(),(y=m)==null||y.disconnect(),m=null,u&&cancelAnimationFrame(g)}}const hu=Xl,bu=Jl,yu=Gl,vu=Ql,Eu=Yl,xu=Zl,wu=(e,t,n)=>{const r=new Map,o={platform:mu,...n},s={...o.platform,_c:r};return zl(e,t,{...o,platform:s})};var Ru=typeof document<"u",Su=function(){},Mn=Ru?be.useLayoutEffect:Su;function $n(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!$n(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!$n(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function gi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jo(e,t){const n=gi(e);return Math.round(t*n)/n}function lr(e){const t=f.useRef(e);return Mn(()=>{t.current=e}),t}function Cu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:i=!0,whileElementsMounted:u,open:a}=e,[d,l]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=f.useState(r);$n(p,r)||m(r);const[g,h]=f.useState(null),[E,y]=f.useState(null),v=f.useCallback(O=>{O!==R.current&&(R.current=O,h(O))},[]),w=f.useCallback(O=>{O!==C.current&&(C.current=O,y(O))},[]),x=s||g,b=c||E,R=f.useRef(null),C=f.useRef(null),N=f.useRef(d),_=u!=null,L=lr(u),j=lr(o),I=lr(a),S=f.useCallback(()=>{if(!R.current||!C.current)return;const O={placement:t,strategy:n,middleware:p};j.current&&(O.platform=j.current),wu(R.current,C.current,O).then(F=>{const V={...F,isPositioned:I.current!==!1};D.current&&!$n(N.current,V)&&(N.current=V,ct.flushSync(()=>{l(V)}))})},[p,t,n,j,I]);Mn(()=>{a===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,l(O=>({...O,isPositioned:!1})))},[a]);const D=f.useRef(!1);Mn(()=>(D.current=!0,()=>{D.current=!1}),[]),Mn(()=>{if(x&&(R.current=x),b&&(C.current=b),x&&b){if(L.current)return L.current(x,b,S);S()}},[x,b,S,L,_]);const M=f.useMemo(()=>({reference:R,floating:C,setReference:v,setFloating:w}),[v,w]),P=f.useMemo(()=>({reference:x,floating:b}),[x,b]),k=f.useMemo(()=>{const O={position:n,left:0,top:0};if(!P.floating)return O;const F=Jo(P.floating,d.x),V=Jo(P.floating,d.y);return i?{...O,transform:"translate("+F+"px, "+V+"px)",...gi(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:V}},[n,i,P.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:S,refs:M,elements:P,floatingStyles:k}),[d,S,M,P,k])}const Ou=(e,t)=>({...hu(e),options:[e,t]}),Tu=(e,t)=>({...bu(e),options:[e,t]}),Nu=(e,t)=>({...xu(e),options:[e,t]}),Mu=(e,t)=>({...yu(e),options:[e,t]}),Iu=(e,t)=>({...vu(e),options:[e,t]}),Pu=(e,t)=>({...Eu(e),options:[e,t]}),Du={intentional:"onClick",sloppy:"onPointerDown"};function _u(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function hi(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),c=n.useState("domReferenceElement"),{onOpenChange:i,dataRef:u}=n.context,{enabled:a=!0,escapeKey:d=!0,outsidePress:l=!0,outsidePressEvent:p="sloppy",referencePress:m=!1,referencePressEvent:g="sloppy",ancestorScroll:h=!1,bubbles:E,externalTree:y}=t,v=Ct(y),w=X(typeof l=="function"?l:()=>!1),x=typeof l=="function"?w:l,b=f.useRef(!1),{escapeKey:R,outsidePress:C}=_u(E),N=f.useRef(null),_=tt(),L=tt(),j=X(()=>{L.clear(),u.current.insideReactTree=!1}),I=f.useRef(!1),S=f.useRef(""),D=X(A=>{S.current=A.pointerType}),M=X(()=>{const A=S.current,Q=A==="pen"||!A?"mouse":A,Z=typeof p=="function"?p():p;return typeof Z=="string"?Z:Z[Q]}),P=X(A=>{if(!r||!a||!d||A.key!=="Escape"||I.current)return;const Q=u.current.floatingContext?.nodeId,Z=v?It(v.nodesRef.current,Q):[];if(!R&&Z.length>0){let z=!0;if(Z.forEach(W=>{W.context?.open&&!W.context.dataRef.current.__escapeKeyBubbles&&(z=!1)}),!z)return}const Re=ha(A)?A.nativeEvent:A,se=ve(no,Re);n.setOpen(!1,se),!R&&!se.isPropagationAllowed&&A.stopPropagation()}),k=X(A=>{const Q=M();return Q==="intentional"&&A.type!=="click"||Q==="sloppy"&&A.type==="click"}),O=X(()=>{u.current.insideReactTree=!0,L.start(0,j)}),F=X((A,Q=!1)=>{if(k(A)){j();return}if(u.current.insideReactTree){j();return}if(M()==="intentional"&&Q||typeof x=="function"&&!x(A))return;const Z=Le(A),Re=`[${Gt("inert")}]`,se=_e(n.select("floatingElement")).querySelectorAll(Re),z=n.context.triggerElements;if(Z&&(z.hasElement(Z)||z.hasMatchingElement(K=>me(K,Z))))return;let W=we(Z)?Z:null;for(;W&&!at(W);){const K=ft(W);if(at(K)||!we(K))break;W=K}if(se.length&&we(Z)&&!ga(Z)&&!me(Z,n.select("floatingElement"))&&Array.from(se).every(K=>!me(W,K)))return;if(Pe(Z)&&!("touches"in A)){const K=at(Z),ae=Qe(Z),Y=/auto|scroll/,$=K||Y.test(ae.overflowX),B=K||Y.test(ae.overflowY),oe=$&&Z.clientWidth>0&&Z.scrollWidth>Z.clientWidth,le=B&&Z.clientHeight>0&&Z.scrollHeight>Z.clientHeight,fe=ae.direction==="rtl",xe=le&&(fe?A.offsetX<=Z.offsetWidth-Z.clientWidth:A.offsetX>Z.clientWidth),Se=oe&&A.offsetY>Z.clientHeight;if(xe||Se)return}const ie=u.current.floatingContext?.nodeId,re=v&&It(v.nodesRef.current,ie).some(K=>st(A,K.context?.elements.floating));if(st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement"))||re)return;const he=v?It(v.nodesRef.current,ie):[];if(he.length>0){let K=!0;if(he.forEach(ae=>{ae.context?.open&&!ae.context.dataRef.current.__outsidePressBubbles&&(K=!1)}),!K)return}n.setOpen(!1,ve(to,A)),j()}),V=X(A=>{M()!=="sloppy"||A.pointerType==="touch"||!n.select("open")||!a||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement"))||F(A)}),U=X(A=>{if(M()!=="sloppy"||!n.select("open")||!a||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement")))return;const Q=A.touches[0];Q&&(N.current={startTime:Date.now(),startX:Q.clientX,startY:Q.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},_.start(1e3,()=>{N.current&&(N.current.dismissOnTouchEnd=!1,N.current.dismissOnMouseDown=!1)}))}),ee=X(A=>{const Q=Le(A);function Z(){U(A),Q?.removeEventListener(A.type,Z)}Q?.addEventListener(A.type,Z)}),H=X(A=>{const Q=b.current;if(b.current=!1,_.clear(),A.type==="mousedown"&&N.current&&!N.current.dismissOnMouseDown)return;const Z=Le(A);function Re(){A.type==="pointerdown"?V(A):F(A,Q),Z?.removeEventListener(A.type,Re)}Z?.addEventListener(A.type,Re)}),ue=X(A=>{if(M()!=="sloppy"||!N.current||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement")))return;const Q=A.touches[0];if(!Q)return;const Z=Math.abs(Q.clientX-N.current.startX),Re=Math.abs(Q.clientY-N.current.startY),se=Math.sqrt(Z*Z+Re*Re);se>5&&(N.current.dismissOnTouchEnd=!0),se>10&&(F(A),_.clear(),N.current=null)}),ge=X(A=>{const Q=Le(A);function Z(){ue(A),Q?.removeEventListener(A.type,Z)}Q?.addEventListener(A.type,Z)}),te=X(A=>{M()!=="sloppy"||!N.current||st(A,n.select("floatingElement"))||st(A,n.select("domReferenceElement"))||(N.current.dismissOnTouchEnd&&F(A),_.clear(),N.current=null)}),G=X(A=>{const Q=Le(A);function Z(){te(A),Q?.removeEventListener(A.type,Z)}Q?.addEventListener(A.type,Z)});f.useEffect(()=>{if(!r||!a)return;u.current.__escapeKeyBubbles=R,u.current.__outsidePressBubbles=C;const A=new pt;function Q(W){n.setOpen(!1,ve(eo,W))}function Z(){A.clear(),I.current=!0}function Re(){A.start(Kn()?5:0,()=>{I.current=!1})}const se=_e(o);se.addEventListener("pointerdown",D,!0),d&&(se.addEventListener("keydown",P),se.addEventListener("compositionstart",Z),se.addEventListener("compositionend",Re)),x&&(se.addEventListener("click",H,!0),se.addEventListener("pointerdown",H,!0),se.addEventListener("touchstart",ee,!0),se.addEventListener("touchmove",ge,!0),se.addEventListener("touchend",G,!0),se.addEventListener("mousedown",H,!0));let z=[];return h&&(we(c)&&(z=vt(c)),we(o)&&(z=z.concat(vt(o))),!we(s)&&s&&s.contextElement&&(z=z.concat(vt(s.contextElement)))),z=z.filter(W=>W!==se.defaultView?.visualViewport),z.forEach(W=>{W.addEventListener("scroll",Q,{passive:!0})}),()=>{se.removeEventListener("pointerdown",D,!0),d&&(se.removeEventListener("keydown",P),se.removeEventListener("compositionstart",Z),se.removeEventListener("compositionend",Re)),x&&(se.removeEventListener("click",H,!0),se.removeEventListener("pointerdown",H,!0),se.removeEventListener("touchstart",ee,!0),se.removeEventListener("touchmove",ge,!0),se.removeEventListener("touchend",G,!0),se.removeEventListener("mousedown",H,!0)),z.forEach(W=>{W.removeEventListener("scroll",Q)}),A.clear()}},[u,o,s,c,d,x,r,i,h,a,R,C,P,F,H,V,ee,ge,G,D,n]),f.useEffect(j,[x,j]);const q=f.useMemo(()=>({onKeyDown:P,...m&&{[Du[g]]:A=>{n.setOpen(!1,ve(wt,A.nativeEvent))},...g!=="intentional"&&{onClick(A){n.setOpen(!1,ve(wt,A.nativeEvent))}}}}),[P,n,m,g]),de=X(A=>{const Q=Le(A.nativeEvent);!me(n.select("floatingElement"),Q)||A.button!==0||(b.current=!0)}),ne=f.useMemo(()=>({onKeyDown:P,onPointerDown:de,onMouseDown:de,onMouseUp:de,onClickCapture:O,onMouseDownCapture:O,onPointerDownCapture:O,onMouseUpCapture:O,onTouchEndCapture:O,onTouchMoveCapture:O}),[P,de,O]);return f.useMemo(()=>a?{reference:q,floating:ne,trigger:q}:{},[a,q,ne])}var ku=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(s){({stack:o}=s)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
5
5
|
\`createSelector([state => state.todos], todos => todos)\`
|
|
6
6
|
This could lead to inefficient memoization and unnecessary re-renders.
|
|
7
7
|
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:o})}}},Au=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:s,inputSelectorResultsCopy:c}=e,i=r(()=>({}),...o);if(!(i.apply(null,s)===i.apply(null,c))){let a;try{throw new Error}catch(d){({stack:a}=d)}console.warn(`An input selector returned a different result when passed same arguments.
|
|
8
8
|
This means your output selector will likely run more frequently than intended.
|
|
9
9
|
Avoid returning a new reference inside your input selector, e.g.
|
|
10
|
-
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:c,stack:a})}},Lu={inputStabilityCheck:"once",identityFunctionCheck:"once"},Hn=Symbol("NOT_FOUND");function Fu(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Vu(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function ju(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var
|
|
10
|
+
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:c,stack:a})}},Lu={inputStabilityCheck:"once",identityFunctionCheck:"once"},Hn=Symbol("NOT_FOUND");function Fu(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Vu(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function ju(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Zo=e=>Array.isArray(e)?e:[e];function Bu(e){const t=Array.isArray(e[0])?e[0]:e;return ju(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Qo(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var $u=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Lu,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:ku},inputStabilityCheck:{shouldRun:r==="always"||r==="once"&&e,run:Au}}};function Hu(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Hn},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Uu(e,t){let n=[];function r(i){const u=n.findIndex(a=>t(i,a.key));if(u>-1){const a=n[u];return u>0&&(n.splice(u,1),n.unshift(a)),a.value}return Hn}function o(i,u){r(i)===Hn&&(n.unshift({key:i,value:u}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:o,getEntries:s,clear:c}}var Wu=(e,t)=>e===t;function Ku(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function zu(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Wu,maxSize:o=1,resultEqualityCheck:s}=n,c=Ku(r);let i=0;const u=o<=1?Hu(c):Uu(o,c);function a(){let d=u.get(arguments);if(d===Hn){if(d=e.apply(null,arguments),i++,s){const p=u.getEntries().find(m=>s(m.value,d));p&&(d=p.value,i!==0&&i--)}u.put(arguments,d)}return d}return a.clearCache=()=>{u.clear(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}var Gu=class{constructor(e){this.value=e}deref(){return this.value}},Yu=typeof WeakRef<"u"?WeakRef:Gu,qu=0,es=1;function En(){return{s:qu,v:void 0,o:null,p:null}}function bi(e,t={}){let n=En();const{resultEqualityCheck:r}=t;let o,s=0;function c(){let i=n;const{length:u}=arguments;for(let l=0,p=u;l<p;l++){const m=arguments[l];if(typeof m=="function"||typeof m=="object"&&m!==null){let g=i.o;g===null&&(i.o=g=new WeakMap);const h=g.get(m);h===void 0?(i=En(),g.set(m,i)):i=h}else{let g=i.p;g===null&&(i.p=g=new Map);const h=g.get(m);h===void 0?(i=En(),g.set(m,i)):i=h}}const a=i;let d;if(i.s===es)d=i.v;else if(d=e.apply(null,arguments),s++,r){const l=o?.deref?.()??o;l!=null&&r(l,d)&&(d=l,s!==0&&s--),o=typeof d=="object"&&d!==null||typeof d=="function"?new Yu(d):d}return a.s=es,a.v=d,d}return c.clearCache=()=>{n=En(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}function yi(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,c=0,i,u={},a=o.pop();typeof a=="object"&&(u=a,a=o.pop()),Fu(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const d={...n,...u},{memoize:l,memoizeOptions:p=[],argsMemoize:m=bi,argsMemoizeOptions:g=[],devModeChecks:h={}}=d,E=Zo(p),y=Zo(g),v=Bu(o),w=l(function(){return s++,a.apply(null,arguments)},...E);let x=!0;const b=m(function(){c++;const C=Qo(v,arguments);if(i=w.apply(null,C),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:N,inputStabilityCheck:_}=$u(x,h);if(N.shouldRun&&N.run(a,C,i),_.shouldRun){const L=Qo(v,arguments);_.run({inputSelectorResults:C,inputSelectorResultsCopy:L},{memoize:l,memoizeOptions:E},arguments)}x&&(x=!1)}return i},...y);return Object.assign(b,{resultFunc:a,memoizedResultFunc:w,dependencies:v,dependencyRecomputations:()=>c,resetDependencyRecomputations:()=>{c=0},lastResult:()=>i,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:l,argsMemoize:m})};return Object.assign(r,{withTypes:()=>r}),r}var Xu=yi(bi),Ju=Object.assign((e,t=Xu)=>{Vu(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((c,i,u)=>(c[n[u]]=i,c),{}))},{withTypes:()=>Ju});yi({memoize:zu,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const ce=(e,t,n,r,o,s,...c)=>{if(c.length>0)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of selectors":Fe(1));let i;if(e)i=e;else throw new Error("Missing arguments");return i};var xn={exports:{}},ur={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* use-sync-external-store-shim.production.js
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@ Avoid returning a new reference inside your input selector, e.g.
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var ts;function Zu(){if(ts)return ur;ts=1;var e=be;function t(l,p){return l===p&&(l!==0||1/l===1/p)||l!==l&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function i(l,p){var m=p(),g=r({inst:{value:m,getSnapshot:p}}),h=g[0].inst,E=g[1];return s(function(){h.value=m,h.getSnapshot=p,u(h)&&E({inst:h})},[l,m,p]),o(function(){return u(h)&&E({inst:h}),l(function(){u(h)&&E({inst:h})})},[l]),c(m),m}function u(l){var p=l.getSnapshot;l=l.value;try{var m=p();return!n(l,m)}catch{return!0}}function a(l,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:i;return ur.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,ur}var fr={};/**
|
|
19
19
|
* @license React
|
|
20
20
|
* use-sync-external-store-shim.development.js
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ Avoid returning a new reference inside your input selector, e.g.
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the MIT license found in the
|
|
25
25
|
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var
|
|
26
|
+
*/var ns;function Qu(){return ns||(ns=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){d||o.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=g();if(!l){var E=g();s(h,E)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}E=c({inst:{value:h,getSnapshot:g}});var y=E[0].inst,v=E[1];return u(function(){y.value=h,y.getSnapshot=g,n(y)&&v({inst:y})},[m,h,g]),i(function(){return n(y)&&v({inst:y}),m(function(){n(y)&&v({inst:y})})},[m]),a(h),h}function n(m){var g=m.getSnapshot;m=m.value;try{var h=g();return!s(m,h)}catch{return!0}}function r(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=be,s=typeof Object.is=="function"?Object.is:e,c=o.useState,i=o.useEffect,u=o.useLayoutEffect,a=o.useDebugValue,d=!1,l=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;fr.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fr}var rs;function co(){return rs||(rs=1,process.env.NODE_ENV==="production"?xn.exports=Zu():xn.exports=Qu()),xn.exports}var ef=co(),wn={exports:{}},dr={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* use-sync-external-store-shim/with-selector.production.js
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ Avoid returning a new reference inside your input selector, e.g.
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var
|
|
34
|
+
*/var os;function tf(){if(os)return dr;os=1;var e=be,t=co();function n(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,i=e.useMemo,u=e.useDebugValue;return dr.useSyncExternalStoreWithSelector=function(a,d,l,p,m){var g=s(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=i(function(){function y(R){if(!v){if(v=!0,w=R,R=p(R),m!==void 0&&h.hasValue){var C=h.value;if(m(C,R))return x=C}return x=R}if(C=x,r(w,R))return C;var N=p(R);return m!==void 0&&m(C,N)?(w=R,C):(w=R,x=N)}var v=!1,w,x,b=l===void 0?null:l;return[function(){return y(d())},b===null?void 0:function(){return y(b())}]},[d,l,p,m]);var E=o(a,g[0],g[1]);return c(function(){h.hasValue=!0,h.value=E},[E]),u(E),E},dr}var pr={};/**
|
|
35
35
|
* @license React
|
|
36
36
|
* use-sync-external-store-shim/with-selector.development.js
|
|
37
37
|
*
|
|
@@ -39,9 +39,9 @@ Avoid returning a new reference inside your input selector, e.g.
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the MIT license found in the
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var os;function nf(){return os||(os=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=be,n=io(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,i=t.useMemo,u=t.useDebugValue;pr.useSyncExternalStoreWithSelector=function(a,d,f,p,m){var g=s(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=i(function(){function y(R){if(!v){if(v=!0,w=R,R=p(R),m!==void 0&&h.hasValue){var C=h.value;if(m(C,R))return E=C}return E=R}if(C=E,r(w,R))return C;var N=p(R);return m!==void 0&&m(C,N)?(w=R,C):(w=R,E=N)}var v=!1,w,E,b=f===void 0?null:f;return[function(){return y(d())},b===null?void 0:function(){return y(b())}]},[d,f,p,m]);var x=o(a,g[0],g[1]);return c(function(){h.hasValue=!0,h.value=x},[x]),u(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),pr}var ss;function rf(){return ss||(ss=1,process.env.NODE_ENV==="production"?wn.exports=tf():wn.exports=nf()),wn.exports}var of=rf();const sf=zr(19),cf=sf?lf:uf;function af(e,t,n,r,o){return cf(e,t,n,r,o)}function lf(e,t,n,r,o){const s=l.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ef.useSyncExternalStore(e.subscribe,s,s)}function uf(e,t,n,r,o){return of.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class on{constructor(t){Ce(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ce(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){on.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||on.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};on.prototype.setState.call(this,t)}}class co extends on{constructor(n,r={},o){super(n);Ce(this,"controlledValues",new Map);Ce(this,"select",(n,r,o,s)=>{const c=this.selectors[n];return c(this.state,r,o,s)});Ce(this,"useState",(n,r,o,s)=>{l.useDebugValue(n);const c=this.selectors[n];return af(this,c,r,o,s)});this.context=r,this.selectors=o}useSyncedValue(n,r){l.useDebugValue(n),J(()=>{this.state[n]!==r&&this.set(n,r)},[n,r])}useSyncedValueWithCleanup(n,r){J(()=>(this.state[n]!==r&&this.set(n,r),()=>{this.set(n,void 0)}),[n,r])}useSyncedValues(n){if(process.env.NODE_ENV!=="production"){l.useDebugValue(n,c=>Object.keys(c));const o=l.useRef(Object.keys(n)).current,s=Object.keys(n);(o.length!==s.length||o.some((c,i)=>c!==s[i]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(n);J(()=>{this.update(n)},r)}useControlledProp(n,r,o){l.useDebugValue(n);const s=r!==void 0;if(process.env.NODE_ENV!=="production"){const c=this.controlledValues.get(n);c!==void 0&&c!==s&&console.error(`A component is changing the ${s?"":"un"}controlled state of ${n.toString()} to be ${s?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}this.controlledValues.has(n)||(this.controlledValues.set(n,s),!s&&!Object.is(this.state[n],o)&&super.setState({...this.state,[n]:o})),J(()=>{s&&!Object.is(this.state[n],r)&&super.setState({...this.state,[n]:r})},[n,r,o,s])}set(n,r){this.controlledValues.get(n)!==!0&&super.set(n,r)}update(n){const r={...n};for(const o in r)if(Object.hasOwn(r,o)&&this.controlledValues.get(o)===!0){delete r[o];continue}super.update(r)}setState(n){const r={...n};for(const o in r)if(Object.hasOwn(r,o)&&this.controlledValues.get(o)===!0){delete r[o];continue}super.setState({...this.state,...r})}useContextCallback(n,r){l.useDebugValue(n);const o=X(r??Xe);this.context[n]=o}useStateSetter(n){const r=l.useRef(void 0);return r.current===void 0&&(r.current=o=>{this.set(n,o)}),r.current}observe(n,r){let o;typeof n=="function"?o=n:o=this.selectors[n];let s=o(this.state);return r(s,s,this),this.subscribe(c=>{const i=o(c);if(!Object.is(s,i)){const u=s;s=i,r(i,u,this)}})}}const ff={open:ce(e=>e.open),domReferenceElement:ce(e=>e.domReferenceElement),referenceElement:ce(e=>e.positionReference??e.referenceElement),floatingElement:ce(e=>e.floatingElement),floatingId:ce(e=>e.floatingId)};class ao extends co{constructor(n){const{nested:r,noEmit:o,onOpenChange:s,triggerElements:c,...i}=n;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:ei(),nested:r,noEmit:o,triggerElements:c},ff);Ce(this,"setOpen",(n,r)=>{if((!n||!this.state.open||Ms(r.event))&&(this.context.dataRef.current.openEvent=n?r.event:void 0),!this.context.noEmit){const o={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(n,r)})}}function yi(e,t=!1,n=!1){const[r,o]=l.useState(e&&t?"idle":void 0),[s,c]=l.useState(e);return e&&!s&&(c(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),J(()=>{if(!e&&s&&r!=="ending"&&n){const i=Ie.request(()=>{o("ending")});return()=>{Ie.cancel(i)}}},[e,s,r,n]),J(()=>{if(!e||t)return;const i=Ie.request(()=>{o(void 0)});return()=>{Ie.cancel(i)}},[t,e]),J(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const i=Ie.request(()=>{o("idle")});return()=>{Ie.cancel(i)}},[t,e,s,o,r]),l.useMemo(()=>({mounted:s,setMounted:c,transitionStatus:r}),[s,r])}function df(e,t){const n=l.useRef(null);return l.useCallback(r=>{e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null&&(n.current=e,t.context.triggerElements.add(e,r)))},[t,e])}function pf(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=df(e,n),c=X(i=>{s(i),i!==null&&n.select("open")&&n.select("activeTriggerId")==null&&n.update({activeTriggerId:e,activeTriggerElement:i,...r})});return J(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function vi(e){const t=e.useState("open");J(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Ei(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=yi(e);t.useSyncedValues({mounted:r,transitionStatus:s});const c=X(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),i=t.useState("preventUnmountingOnClose");return pn({enabled:!i,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}class qn{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elements.size!==this.idMap.size))throw new Error(process.env.NODE_ENV!=="production"?"Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.":Fe(87))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function mf(){return new ao({open:!1,floatingElement:null,referenceElement:null,triggerElements:new qn,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function xi(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:mf(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ke,inactiveTriggerProps:ke,popupProps:ke}}const wi={open:ce(e=>e.open),mounted:ce(e=>e.mounted),transitionStatus:ce(e=>e.transitionStatus),floatingRootContext:ce(e=>e.floatingRootContext),preventUnmountingOnClose:ce(e=>e.preventUnmountingOnClose),payload:ce(e=>e.payload),activeTriggerId:ce(e=>e.activeTriggerId),activeTriggerElement:ce(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:ce((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:ce((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:ce((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:ce((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:ce(e=>e.popupProps),popupElement:ce(e=>e.popupElement),positionerElement:ce(e=>e.positionerElement)};function gf(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=gt(),s=ht()!=null;if(process.env.NODE_ENV!=="production"){const i=r.reference;i&&!we(i)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const c=et(()=>new ao({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new qn,floatingId:o,nested:s,noEmit:e.noEmit||!1})).current;return J(()=>{const i={open:t,floatingId:o};r.reference!==void 0&&(i.referenceElement=r.reference,i.domReferenceElement=we(r.reference)?r.reference:null),r.floating!==void 0&&(i.floatingElement=r.floating),c.update(i)},[t,o,r.reference,r.floating,c]),c.context.onOpenChange=n,c.context.nested=s,c.context.noEmit=e.noEmit||!1,c}function hf(e={}){const{nodeId:t,externalTree:n}=e,r=gf(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[c,i]=l.useState(null),u=l.useRef(null),a=Ct(n);J(()=>{s.domReference&&(u.current=s.domReference)},[s.domReference]);const d=Cu({...e,elements:{...s,...c&&{reference:c}}}),f=l.useCallback(C=>{const N=we(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;i(N),d.refs.setReference(N)},[d.refs]),[p,m]=l.useState(null),[g,h]=l.useState(null);o.useSyncedValue("referenceElement",p),o.useSyncedValue("domReferenceElement",we(p)?p:null),o.useSyncedValue("floatingElement",g);const x=l.useCallback(C=>{(we(C)||C===null)&&(u.current=C,m(C)),(we(d.refs.reference.current)||d.refs.reference.current===null||C!==null&&!we(C))&&d.refs.setReference(C)},[d.refs,m]),y=l.useCallback(C=>{h(C),d.refs.setFloating(C)},[d.refs]),v=l.useMemo(()=>({...d.refs,setReference:x,setFloating:y,setPositionReference:f,domReference:u}),[d.refs,x,y,f]),w=l.useMemo(()=>({...d.elements,domReference:s.domReference}),[d.elements,s.domReference]),E=o.useState("open"),b=o.useState("floatingId"),R=l.useMemo(()=>({...d,dataRef:o.context.dataRef,open:E,onOpenChange:o.setOpen,events:o.context.events,floatingId:b,refs:v,elements:w,nodeId:t,rootStore:o}),[d,v,w,t,o,E,b]);return J(()=>{o.context.dataRef.current.floatingContext=R;const C=a?.nodesRef.current.find(N=>N.id===t);C&&(C.context=R)}),l.useMemo(()=>({...d,context:R,refs:v,elements:w,rootStore:o}),[d,v,w,R,o])}function Ri(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=gt(),c=ht()!=null,i=t.useState("open"),u=t.useState("activeTriggerElement"),a=t.useState(r?"popupElement":"positionerElement"),d=t.context.triggerElements,f=et(()=>new ao({open:i,referenceElement:u,floatingElement:a,triggerElements:d,onOpenChange:o,floatingId:s,nested:c,noEmit:n})).current;return J(()=>{const p={open:i,floatingId:s,referenceElement:u,floatingElement:a};we(u)&&(p.domReferenceElement=u),f.update(p)},[i,s,u,a,f]),f.context.onOpenChange=o,f.context.nested=c,f.context.noEmit=n,f}const mr=fa&&ws;function bf(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:o}=n.context,{enabled:s=!0,visibleOnly:c=!0}=t,i=l.useRef(!1),u=tt(),a=l.useRef(!0);l.useEffect(()=>{const f=n.select("domReferenceElement");if(!s)return;const p=Ae(f);function m(){!n.select("open")&&Pe(f)&&f===Ge(_e(f))&&(i.current=!0)}function g(){a.current=!0}function h(){a.current=!1}return p.addEventListener("blur",m),mr&&(p.addEventListener("keydown",g,!0),p.addEventListener("pointerdown",h,!0)),()=>{p.removeEventListener("blur",m),mr&&(p.removeEventListener("keydown",g,!0),p.removeEventListener("pointerdown",h,!0))}},[n,s]),l.useEffect(()=>{if(!s)return;function f(p){(p.reason===wt||p.reason===to)&&(i.current=!0)}return r.on("openchange",f),()=>{r.off("openchange",f)}},[r,s]);const d=l.useMemo(()=>({onMouseLeave(){i.current=!1},onFocus(f){if(i.current)return;const p=Le(f.nativeEvent);if(c&&we(p)){if(mr&&!f.relatedTarget){if(!a.current&&!jr(p))return}else if(!In(p))return}n.setOpen(!0,ve(Bn,f.nativeEvent,f.currentTarget))},onBlur(f){i.current=!1;const p=f.relatedTarget,m=f.nativeEvent,g=we(p)&&p.hasAttribute(zt("focus-guard"))&&p.getAttribute("data-type")==="outside";u.start(0,()=>{const h=n.select("domReferenceElement"),x=Ge(h?h.ownerDocument:document);!p&&x===h||me(o.current.floatingContext?.refs.floating.current,x)||me(h,x)||g||n.context.triggerElements.hasElement(f.relatedTarget)||n.setOpen(!1,ve(Bn,m))})}}),[o,n,c,u]);return l.useMemo(()=>s?{reference:d,trigger:d}:{},[s,d])}const Ir=zt("safe-polygon"),yf=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Os}`;function vf(e){return e?!!e.closest(yf):!1}function Si(e){const t=l.useRef(void 0),n=l.useRef(!1),r=l.useRef(void 0),o=l.useRef(!0),s=l.useRef(!1),c=l.useRef(()=>{}),i=l.useRef(!1),u=tt(),a=tt(),d=l.useRef(void 0);return l.useMemo(()=>{const f=e.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:o,performedPointerEventsMutationRef:s,unbindMouseMoveRef:c,restTimeoutPendingRef:i,openChangeTimeout:u,restTimeout:a,handleCloseOptionsRef:d}),f.hoverInteractionState},[e,t,n,r,o,s,c,i,u,a,d])}const Ef=new Set(["click","mousedown"]);function xf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:c}=n.context,{enabled:i=!0,closeDelay:u=0,externalTree:a}=t,{pointerTypeRef:d,interactedInsideRef:f,handlerRef:p,performedPointerEventsMutationRef:m,unbindMouseMoveRef:g,restTimeoutPendingRef:h,openChangeTimeout:x,handleCloseOptionsRef:y}=Si(n),v=Ct(a),w=ht(),E=X(()=>f.current?!0:c.current.openEvent?Ef.has(c.current.openEvent.type):!1),b=X(()=>{const L=c.current.openEvent?.type;return L?.includes("mouse")&&L!=="mousedown"}),R=l.useCallback((L,j=!0)=>{const I=wf(u,d.current);I&&!p.current?x.start(I,()=>n.setOpen(!1,ve(Je,L))):j&&(x.clear(),n.setOpen(!1,ve(Je,L)))},[u,p,n,d,x]),C=X(()=>{g.current(),p.current=void 0}),N=X(()=>{if(m.current){const L=_e(o).body;L.style.pointerEvents="",L.removeAttribute(Ir),m.current=!1}}),_=X(L=>{const j=Le(L);if(!vf(j)){f.current=!1;return}f.current=!0});J(()=>{r||(d.current=void 0,h.current=!1,f.current=!1,C(),N())},[r,d,h,f,C,N]),l.useEffect(()=>()=>{C()},[C]),l.useEffect(()=>N,[N]),J(()=>{if(i&&r&&y.current?.blockPointerEvents&&b()&&we(s)&&o){m.current=!0;const L=_e(o).body;L.setAttribute(Ir,"");const j=s,I=o,S=v?.nodesRef.current.find(D=>D.id===w)?.context?.elements.floating;return S&&(S.style.pointerEvents=""),L.style.pointerEvents="none",j.style.pointerEvents="auto",I.style.pointerEvents="auto",()=>{L.style.pointerEvents="",j.style.pointerEvents="",I.style.pointerEvents=""}}},[i,r,s,o,y,b,v,w,m]),l.useEffect(()=>{if(!i)return;function L(D){if(E()||!c.current.floatingContext||!n.select("open"))return;const M=n.context.triggerElements;D.relatedTarget&&M.hasElement(D.relatedTarget)||(N(),C(),E()||R(D))}function j(D){x.clear(),N(),p.current?.(D),C()}function I(D){E()||R(D,!1)}const S=o;return S&&(S.addEventListener("mouseleave",L),S.addEventListener("mouseenter",j),S.addEventListener("mouseleave",I),S.addEventListener("pointerdown",_,!0)),()=>{S&&(S.removeEventListener("mouseleave",L),S.removeEventListener("mouseenter",j),S.removeEventListener("mouseleave",I),S.removeEventListener("pointerdown",_,!0))}})}function wf(e,t){return t&&!$t(t)?0:typeof e=="function"?e():e}function gr(e){return typeof e=="function"?e():e}const Rf={current:null};function Sf(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:c=0,handleClose:i=null,mouseOnly:u=!1,restMs:a=0,move:d=!0,triggerElementRef:f=Rf,externalTree:p,isActiveTrigger:m=!0}=t,g=Ct(p),{pointerTypeRef:h,interactedInsideRef:x,handlerRef:y,blockMouseMoveRef:v,performedPointerEventsMutationRef:w,unbindMouseMoveRef:E,restTimeoutPendingRef:b,openChangeTimeout:R,restTimeout:C,handleCloseOptionsRef:N}=Si(n),_=je(i),L=je(c),j=je(a);m&&(N.current=_.current?.__options);const I=X(()=>x.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),S=l.useCallback((k,O=!0)=>{const F=sr(L.current,"close",h.current);F&&!y.current?R.start(F,()=>n.setOpen(!1,ve(Je,k))):O&&(R.clear(),n.setOpen(!1,ve(Je,k)))},[L,y,n,h,R]),D=X(()=>{E.current(),y.current=void 0}),M=X(()=>{if(w.current){const k=_e(n.select("domReferenceElement")).body;k.style.pointerEvents="",k.removeAttribute(Ir),w.current=!1}});l.useEffect(()=>{if(!s)return;function k(O){O.open||(R.clear(),C.clear(),v.current=!0,b.current=!1)}return o.on("openchange",k),()=>{o.off("openchange",k)}},[s,o,R,C,v,b]);const P=X(k=>{if(I()||!r.current.floatingContext)return;const O=n.context.triggerElements;if(k.relatedTarget&&O.hasElement(k.relatedTarget))return;const F=f.current;_.current?.({...r.current.floatingContext,tree:g,x:k.clientX,y:k.clientY,onClose(){M(),D(),!I()&&F===n.select("domReferenceElement")&&S(k)}})(k)});return l.useEffect(()=>{if(!s)return;const k=f.current??(m?n.select("domReferenceElement"):null);if(!we(k))return;function O(U){if(R.clear(),v.current=!1,u&&!$t(h.current)||gr(j.current)>0&&!sr(L.current,"open"))return;const ee=sr(L.current,"open",h.current),H=n.select("domReferenceElement"),ue=n.context.triggerElements,ge=(ue.hasElement(U.target)||ue.hasMatchingElement(q=>me(q,U.target)))&&(!H||!me(H,U.target)),te=U.currentTarget??null,G=!n.select("open")||ge;ee?R.start(ee,()=>{G&&n.setOpen(!0,ve(Je,U,te))}):G&&n.setOpen(!0,ve(Je,U,te))}function F(U){if(I()){M();return}E.current();const ee=n.select("domReferenceElement"),H=_e(ee);C.clear(),b.current=!1;const ue=n.context.triggerElements;if(U.relatedTarget&&ue.hasElement(U.relatedTarget))return;if(_.current&&r.current.floatingContext){n.select("open")||R.clear();const te=f.current;y.current=_.current({...r.current.floatingContext,tree:g,x:U.clientX,y:U.clientY,onClose(){M(),D(),!I()&&te===n.select("domReferenceElement")&&S(U,!0)}});const G=y.current;G(U),H.addEventListener("mousemove",G),E.current=()=>{H.removeEventListener("mousemove",G)};return}(h.current==="touch"?!me(n.select("floatingElement"),U.relatedTarget):!0)&&S(U)}function V(U){P(U)}return n.select("open")&&k.addEventListener("mouseleave",V),d&&k.addEventListener("mousemove",O,{once:!0}),k.addEventListener("mouseenter",O),k.addEventListener("mouseleave",F),()=>{k.removeEventListener("mouseleave",V),d&&k.removeEventListener("mousemove",O),k.removeEventListener("mouseenter",O),k.removeEventListener("mouseleave",F)}},[D,M,v,r,L,S,n,s,_,P,m,I,u,d,h,j,C,b,R,f,g,E,y]),l.useMemo(()=>{function k(O){h.current=O.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(O){const{nativeEvent:F}=O,V=O.currentTarget,U=n.select("domReferenceElement"),ee=n.context.triggerElements,H=n.select("open"),ue=(ee.hasElement(O.target)||ee.hasMatchingElement(te=>me(te,O.target)))&&(!U||!me(U,O.target));if(u&&!$t(h.current)||H&&!ue||gr(j.current)===0||!ue&&b.current&&O.movementX**2+O.movementY**2<2)return;C.clear();function ge(){!v.current&&(!H||ue)&&n.setOpen(!0,ve(Je,F,V))}h.current==="touch"?ct.flushSync(()=>{ge()}):ue&&H?ge():(b.current=!0,C.start(gr(j.current),ge))}}},[v,u,n,h,j,C,b])}function lo(e=[]){const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=e.map(a=>a?.trigger),s=l.useCallback(a=>Rn(a,e,"reference"),t),c=l.useCallback(a=>Rn(a,e,"floating"),n),i=l.useCallback(a=>Rn(a,e,"item"),r),u=l.useCallback(a=>Rn(a,e,"trigger"),o);return l.useMemo(()=>({getReferenceProps:s,getFloatingProps:c,getItemProps:i,getTriggerProps:u}),[s,c,i,u])}function Rn(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Er]="");for(const c in e)o&&e&&(c===Ss||c===Cs)||(s[c]=e[c]);for(let c=0;c<t.length;c+=1){let i;const u=t[c]?.[n];typeof u=="function"?i=e?u(e):null:i=u,i&&is(s,i,o,r)}return is(s,e,o,r),s}function is(e,t,n,r){for(const o in t){const s=t[o];n&&(o===Ss||o===Cs)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...c)=>r.get(o)?.map(i=>i(...c)).find(i=>i!==void 0))):e[o]=s)}}const Cf="Escape";function Xn(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Sn(e,t){return Xn(t,e===Vr||e===un,e===Et||e===xt)}function hr(e,t,n){return Xn(t,e===un,n?e===Et:e===xt)||e==="Enter"||e===" "||e===""}function Of(e,t,n){return Xn(t,n?e===Et:e===xt,e===un)}function Tf(e,t,n,r){const o=n?e===xt:e===Et,s=e===Vr;return t==="both"||t==="horizontal"&&r&&r>1?e===Cf:Xn(t,o,s)}function Nf(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),c=n.context.dataRef,{listRef:i,activeIndex:u,onNavigate:a=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:x=!1,focusItemOnOpen:y="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:w=!0,disabledIndices:E=void 0,orientation:b="vertical",parentOrientation:R,cols:C=1,scrollItemIntoView:N=!0,itemSizes:_,dense:L=!1,id:j,resetOnPointerLeave:I=!0,externalTree:S}=t;process.env.NODE_ENV!=="production"&&(p&&(m||console.warn("`useListNavigation` looping must be enabled to allow escaping."),x||console.warn("`useListNavigation` must be virtual to allow escaping.")),b==="vertical"&&C>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const D=Pn(o),M=je(D),P=ht(),k=Ct(S);J(()=>{c.current.orientation=b},[c,b]);const O=xr(s),F=l.useRef(y),V=l.useRef(f??-1),U=l.useRef(null),ee=l.useRef(!0),H=X(Y=>{a(V.current===-1?null:V.current,Y)}),ue=l.useRef(H),ge=l.useRef(!!o),te=l.useRef(r),G=l.useRef(!1),q=l.useRef(!1),de=je(E),ne=je(r),A=je(N),Q=je(f),Z=je(I),Re=X(()=>{function Y(le){x?k?.events.emit("virtualfocus",le):Nn(le,{sync:G.current,preventScroll:!0})}const $=i.current[V.current],B=q.current;$&&Y($),(G.current?le=>le():requestAnimationFrame)(()=>{const le=i.current[V.current]||$;if(!le)return;$||Y(le);const fe=A.current;fe&&z&&(B||!ee.current)&&le.scrollIntoView?.(typeof fe=="boolean"?{block:"nearest",inline:"nearest"}:fe)})});J(()=>{d&&(r&&o?(V.current=f??-1,F.current&&f!=null&&(q.current=!0,H())):ge.current&&(V.current=-1,ue.current()))},[d,r,o,f,H]),J(()=>{if(d){if(!r){G.current=!1;return}if(o)if(u==null){if(G.current=!1,Q.current!=null)return;if(ge.current&&(V.current=-1,Re()),(!te.current||!ge.current)&&F.current&&(U.current!=null||F.current===!0&&U.current==null)){let Y=0;const $=()=>{i.current[0]==null?(Y<2&&(Y?requestAnimationFrame:queueMicrotask)($),Y+=1):(V.current=U.current==null||hr(U.current,b,h)||g?rr(i):Io(i),U.current=null,H())};$()}}else tn(i,u)||(V.current=u,Re(),q.current=!1)}},[d,r,o,u,Q,g,i,b,h,H,Re,de]),J(()=>{if(!d||o||!k||x||!ge.current)return;const Y=k.nodesRef.current,$=Y.find(le=>le.id===P)?.context?.elements.floating,B=Ge(_e(o)),oe=Y.some(le=>le.context&&me(le.context.elements.floating,B));$&&!oe&&ee.current&&$.focus({preventScroll:!0})},[d,o,k,P,x]),J(()=>{ue.current=H,te.current=r,ge.current=!!o}),J(()=>{r||(U.current=null,F.current=y)},[r,y]);const se=u!=null,z=l.useMemo(()=>{function Y(B){if(!ne.current)return;const oe=i.current.indexOf(B.currentTarget);oe!==-1&&V.current!==oe&&(V.current=oe,H(B))}return{onFocus(B){G.current=!0,Y(B)},onClick:({currentTarget:B})=>B.focus({preventScroll:!0}),onMouseMove(B){G.current=!0,q.current=!1,v&&Y(B)},onPointerLeave(B){if(!ne.current||!ee.current||B.pointerType==="touch")return;G.current=!0;const oe=B.relatedTarget;!v||i.current.includes(oe)||Z.current&&(V.current=-1,H(B),x||M.current?.focus({preventScroll:!0}))}}},[ne,M,v,i,H,Z,x]),W=l.useCallback(()=>R??k?.nodesRef.current.find(Y=>Y.id===P)?.context?.dataRef?.current.orientation,[P,k,R]),ie=X(Y=>{if(ee.current=!1,G.current=!0,Y.which===229||!ne.current&&Y.currentTarget===M.current)return;if(g&&Tf(Y.key,b,h,C)){Sn(Y.key,W())||He(Y),n.setOpen(!1,ve(Tn,Y.nativeEvent)),Pe(s)&&(x?k?.events.emit("virtualfocus",s):s.focus());return}const $=V.current,B=rr(i,E),oe=Io(i,E);if(O||(Y.key==="Home"&&(He(Y),V.current=B,H(Y)),Y.key==="End"&&(He(Y),V.current=oe,H(Y))),C>1){const le=_||Array.from({length:i.current.length},()=>({width:1,height:1})),fe=Ma(le,C,L),xe=fe.findIndex(We=>We!=null&&!nn(i,We,E)),Se=fe.reduce((We,Me,pe)=>Me!=null&&!nn(i,Me,E)?pe:We,-1),ze=fe[Na({current:fe.map(We=>We!=null?i.current[We]:null)},{event:Y,orientation:b,loopFocus:m,rtl:h,cols:C,disabledIndices:Pa([...(typeof E!="function"?E:null)||i.current.map((We,Me)=>nn(i,Me,E)?Me:void 0),void 0],fe),minIndex:xe,maxIndex:Se,prevIndex:Ia(V.current>oe?B:V.current,le,fe,C,Y.key===un?"bl":Y.key===(h?Et:xt)?"tr":"tl"),stopEvent:!0})];if(ze!=null&&(V.current=ze,H(Y)),b==="both")return}if(Sn(Y.key,b)){if(He(Y),r&&!x&&Ge(Y.currentTarget.ownerDocument)===Y.currentTarget){V.current=hr(Y.key,b,h)?B:oe,H(Y);return}hr(Y.key,b,h)?m?$>=oe?p&&$!==i.current.length?V.current=-1:(G.current=!1,V.current=B):V.current=$e(i,{startingIndex:$,disabledIndices:E}):V.current=Math.min(oe,$e(i,{startingIndex:$,disabledIndices:E})):m?$<=B?p&&$!==-1?V.current=i.current.length:(G.current=!1,V.current=oe):V.current=$e(i,{startingIndex:$,decrement:!0,disabledIndices:E}):V.current=Math.max(B,$e(i,{startingIndex:$,decrement:!0,disabledIndices:E})),tn(i,V.current)&&(V.current=-1),H(Y)}}),re=l.useMemo(()=>x&&r&&se&&{"aria-activedescendant":`${j}-${u}`},[x,r,se,j,u]),he=l.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...O?{}:re,onKeyDown(Y){if(Y.key==="Tab"&&Y.shiftKey&&r&&!x){const $=Le(Y.nativeEvent);if($&&!me(M.current,$))return;He(Y),n.setOpen(!1,ve(Kt,Y.nativeEvent)),Pe(s)&&s.focus();return}ie(Y)},onPointerMove(){ee.current=!0}}),[re,ie,M,b,O,n,r,x,s]),K=l.useMemo(()=>{function Y(B){y==="auto"&&Ts(B.nativeEvent)&&(F.current=!x)}function $(B){F.current=y,y==="auto"&&Ns(B.nativeEvent)&&(F.current=!0)}return{onKeyDown(B){const oe=n.select("open");ee.current=!1;const le=B.key.startsWith("Arrow"),fe=Of(B.key,W(),h),xe=Sn(B.key,b),Se=(g?fe:xe)||B.key==="Enter"||B.key.trim()==="";if(x&&oe)return ie(B);if(!(!oe&&!w&&le)){if(Se){const ze=Sn(B.key,W());U.current=g&&ze?null:B.key}if(g){fe&&(He(B),oe?(V.current=rr(i,de.current),H(B)):n.setOpen(!0,ve(Tn,B.nativeEvent,B.currentTarget)));return}xe&&(Q.current!=null&&(V.current=Q.current),He(B),!oe&&w?n.setOpen(!0,ve(Tn,B.nativeEvent,B.currentTarget)):ie(B),oe&&H(B))}},onFocus(B){n.select("open")&&!x&&(V.current=-1,H(B))},onPointerDown:$,onPointerEnter:$,onMouseDown:Y,onClick:Y}},[ie,de,y,i,g,H,n,w,b,W,h,Q,x]),ae=l.useMemo(()=>({...re,...K}),[re,K]);return l.useMemo(()=>d?{reference:ae,floating:he,item:z,trigger:K}:{},[d,ae,he,K,z])}const Mf=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Ci(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),c=n.useState("floatingElement"),{enabled:i=!0,role:u="dialog"}=t,a=gt(),d=s?.id||a,f=l.useMemo(()=>Pn(c)?.id||o,[c,o]),p=Mf.get(u)??u,g=ht()!=null,h=l.useMemo(()=>p==="tooltip"||u==="label"?ke:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&g&&{role:"menuitem"},...u==="select"&&{"aria-autocomplete":"none"},...u==="combobox"&&{"aria-autocomplete":"list"}},[p,g,u]),x=l.useMemo(()=>p==="tooltip"||u==="label"?{[`aria-${u==="label"?"labelledby":"describedby"}`]:r?f:void 0}:{...h,"aria-expanded":r?"true":"false","aria-controls":r?f:void 0,...p==="menu"&&{id:d}},[p,f,r,d,u,h]),y=l.useMemo(()=>{const w={id:f,...p&&{role:p}};return p==="tooltip"||u==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":d}}},[p,f,d,u]),v=l.useCallback(({active:w,selected:E})=>{const b={role:"option",...w&&{id:`${f}-fui-option`}};switch(u){case"select":case"combobox":return{...b,"aria-selected":E}}return{}},[f,u]);return l.useMemo(()=>i?{reference:x,floating:y,item:v,trigger:h}:{},[i,x,y,h,v])}function If(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.context.dataRef,{listRef:s,activeIndex:c,onMatch:i,onTypingChange:u,enabled:a=!0,findMatch:d=null,resetMs:f=750,ignoreKeys:p=jn,selectedIndex:m=null}=t,g=tt(),h=l.useRef(""),x=l.useRef(m??c??-1),y=l.useRef(null);J(()=>{r&&(g.clear(),y.current=null,h.current="")},[r,g]),J(()=>{r&&h.current===""&&(x.current=m??c??-1)},[r,m,c]);const v=X(R=>{R?o.current.typing||(o.current.typing=R,u?.(R)):o.current.typing&&(o.current.typing=R,u?.(R))}),w=X(R=>{function C(I,S,D){const M=d?d(S,D):S.find(P=>P?.toLocaleLowerCase().indexOf(D.toLocaleLowerCase())===0);return M?I.indexOf(M):-1}const N=s.current;if(h.current.length>0&&h.current[0]!==" "&&(C(N,N,h.current)===-1?v(!1):R.key===" "&&He(R)),N==null||p.includes(R.key)||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;r&&R.key!==" "&&(He(R),v(!0)),N.every(I=>I?I[0]?.toLocaleLowerCase()!==I[1]?.toLocaleLowerCase():!0)&&h.current===R.key&&(h.current="",x.current=y.current),h.current+=R.key,g.start(f,()=>{h.current="",x.current=y.current,v(!1)});const L=x.current,j=C(N,[...N.slice((L||0)+1),...N.slice(0,(L||0)+1)],h.current);j!==-1?(i?.(j),y.current=j):R.key!==" "&&(h.current="",v(!1))}),E=l.useMemo(()=>({onKeyDown:w}),[w]),b=l.useMemo(()=>({onKeyDown:w,onKeyUp(R){R.key===" "&&v(!1)}}),[w,v]);return l.useMemo(()=>a?{reference:E,floating:b}:{},[a,E,b])}function cs(e,t){const[n,r]=e;let o=!1;const s=t.length;for(let c=0,i=s-1;c<s;i=c++){const[u,a]=t[c]||[0,0],[d,f]=t[i]||[0,0];a>=r!=f>=r&&n<=(d-u)*(r-a)/(f-a)+u&&(o=!o)}return o}function Pf(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Df(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o=new pt;let s=!1,c=null,i=null,u=typeof performance<"u"?performance.now():0;function a(f,p){const m=performance.now(),g=m-u;if(c===null||i===null||g===0)return c=f,i=p,u=m,null;const h=f-c,x=p-i,v=Math.sqrt(h*h+x*x)/g;return c=f,i=p,u=m,v}const d=({x:f,y:p,placement:m,elements:g,onClose:h,nodeId:x,tree:y})=>function(w){function E(){o.clear(),h()}if(o.clear(),!g.domReference||!g.floating||m==null||f==null||p==null)return;const{clientX:b,clientY:R}=w,C=[b,R],N=Le(w),_=w.type==="mouseleave",L=me(g.floating,N),j=me(g.domReference,N),I=g.domReference.getBoundingClientRect(),S=g.floating.getBoundingClientRect(),D=m.split("-")[0],M=f>S.right-S.width/2,P=p>S.bottom-S.height/2,k=Pf(C,I),O=S.width>I.width,F=S.height>I.height,V=(O?I:S).left,U=(O?I:S).right,ee=(F?I:S).top,H=(F?I:S).bottom;if(L&&(s=!0,!_))return;if(j&&(s=!1),j&&!_){s=!0;return}if(_&&we(w.relatedTarget)&&me(g.floating,w.relatedTarget)||y&&It(y.nodesRef.current,x).some(({context:te})=>te?.open))return;if(D==="top"&&p>=I.bottom-1||D==="bottom"&&p<=I.top+1||D==="left"&&f>=I.right-1||D==="right"&&f<=I.left+1)return E();let ue=[];switch(D){case"top":ue=[[V,I.top+1],[V,S.bottom-1],[U,S.bottom-1],[U,I.top+1]];break;case"bottom":ue=[[V,S.top+1],[V,I.bottom-1],[U,I.bottom-1],[U,S.top+1]];break;case"left":ue=[[S.right-1,H],[S.right-1,ee],[I.left+1,ee],[I.left+1,H]];break;case"right":ue=[[I.right-1,H],[I.right-1,ee],[S.left+1,ee],[S.left+1,H]];break}function ge([te,G]){switch(D){case"top":{const q=[O?te+t/2:M?te+t*4:te-t*4,G+t+1],de=[O?te-t/2:M?te+t*4:te-t*4,G+t+1],ne=[[S.left,M||O?S.bottom-t:S.top],[S.right,M?O?S.bottom-t:S.top:S.bottom-t]];return[q,de,...ne]}case"bottom":{const q=[O?te+t/2:M?te+t*4:te-t*4,G-t],de=[O?te-t/2:M?te+t*4:te-t*4,G-t],ne=[[S.left,M||O?S.top+t:S.bottom],[S.right,M?O?S.top+t:S.bottom:S.top+t]];return[q,de,...ne]}case"left":{const q=[te+t+1,F?G+t/2:P?G+t*4:G-t*4],de=[te+t+1,F?G-t/2:P?G+t*4:G-t*4];return[...[[P||F?S.right-t:S.left,S.top],[P?F?S.right-t:S.left:S.right-t,S.bottom]],q,de]}case"right":{const q=[te-t,F?G+t/2:P?G+t*4:G-t*4],de=[te-t,F?G-t/2:P?G+t*4:G-t*4],ne=[[P||F?S.left+t:S.right,S.top],[P?F?S.left+t:S.right:S.left+t,S.bottom]];return[q,de,...ne]}default:return[]}}if(!cs([b,R],ue)){if(s&&!k)return E();if(!_&&r){const te=a(w.clientX,w.clientY);if(te!==null&&te<.1)return E()}cs([b,R],ge([f,p]))?!s&&r&&o.start(40,E):E()}};return d.__options={blockPointerEvents:n},d}const Oi=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(Oi.displayName="DirectionContext");function Ti(){return l.useContext(Oi)?.direction??"ltr"}const _f=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:c,elements:i,middlewareData:u}=t,{element:a,padding:d=0,offsetParent:f="real"}=mt(e,t)||{};if(a==null)return{};const p=Is(d),m={x:n,y:r},g=Hr(o),h=$r(g),x=await c.getDimensions(a),y=g==="y",v=y?"top":"left",w=y?"bottom":"right",E=y?"clientHeight":"clientWidth",b=s.reference[h]+s.reference[g]-m[g]-s.floating[h],R=m[g]-s.reference[g],C=f==="real"?await c.getOffsetParent?.(a):i.floating;let N=i.floating[E]||s.floating[h];(!N||!await c.isElement?.(C))&&(N=i.floating[E]||s.floating[h]);const _=b/2-R/2,L=N/2-x[h]/2-1,j=Math.min(p[v],L),I=Math.min(p[w],L),S=j,D=N-x[h]-I,M=N/2-x[h]/2+_,P=wr(S,M,D),k=!u.arrow&&St(o)!=null&&M!==P&&s.reference[h]/2-(M<S?j:I)-x[h]/2<0,O=k?M<S?M-S:M-D:0;return{[g]:m[g]+O,data:{[g]:P,centerOffset:M-P-O,...k&&{alignmentOffset:O}},reset:k}}}),kf=(e,t)=>({..._f(e),options:[e,t]}),Af={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Pu().fn(e)).data?.referenceHidden||s}}}},Lf={sideX:"left",sideY:"top"};function Ni(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function as(e,t,n){const{rects:r,placement:o}=e;return{side:Ni(t,Ze(o),n),align:St(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ff(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:c=0,collisionBoundary:i,collisionPadding:u=5,sticky:a=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,keepMounted:p=!1,floatingRootContext:m,mounted:g,collisionAvoidance:h,shiftCrossAxis:x=!1,nodeId:y,adaptiveOrigin:v,lazyFlip:w=!1,externalTree:E}=e,[b,R]=l.useState(null);!g&&b!==null&&R(null);const C=h.side||"flip",N=h.align||"flip",_=h.fallbackAxisSide||"end",L=typeof t=="function"?t:void 0,j=X(L),I=L?j:t,S=je(t),M=Ti()==="rtl",P=b||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":M?"left":"right","inline-start":M?"right":"left"}[r],k=s==="center"?P:`${P}-${s}`;let O=u;const F=1,V=r==="bottom"?F:0,U=r==="top"?F:0,ee=r==="right"?F:0,H=r==="left"?F:0;typeof O=="number"?O={top:O+V,right:O+H,bottom:O+U,left:O+ee}:O&&(O={top:(O.top||0)+V,right:(O.right||0)+H,bottom:(O.bottom||0)+U,left:(O.left||0)+ee});const ue={boundary:i==="clipping-ancestors"?"clippingAncestors":i,padding:O},ge=l.useRef(null),te=je(o),G=je(c),ne=[Ou(Oe=>{const Ne=as(Oe,r,M),Ke=typeof te.current=="function"?te.current(Ne):te.current,Be=typeof G.current=="function"?G.current(Ne):G.current;return{mainAxis:Ke,crossAxis:Be,alignmentAxis:Be}},[typeof o!="function"?o:0,typeof c!="function"?c:0,M,r])],A=N==="none"&&C!=="shift",Q=!A&&(a||x||C==="shift"),Z=C==="none"?null:Mu({...ue,padding:{top:O.top+F,right:O.right+F,bottom:O.bottom+F,left:O.left+F},mainAxis:!x&&C==="flip",crossAxis:N==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),Re=A?null:Tu(Oe=>{const Ne=Ye(Oe.elements.floating).documentElement;return{...ue,rootBoundary:x?{x:0,y:0,width:Ne.clientWidth,height:Ne.clientHeight}:void 0,mainAxis:N!=="none",crossAxis:Q,limiter:a||x?void 0:Nu(Ke=>{if(!ge.current)return{};const{width:Be,height:ot}=ge.current.getBoundingClientRect(),nt=rt(Ze(Ke.placement)),Tt=nt==="y"?Be:ot,Qn=nt==="y"?O.left+O.right:O.top+O.bottom;return{offset:Tt/2+Qn/2}})}},[ue,a,x,O,N]);C==="shift"||N==="shift"||s==="center"?ne.push(Re,Z):ne.push(Z,Re),ne.push(Iu({...ue,apply({elements:{floating:Oe},rects:{reference:Ne},availableWidth:Ke,availableHeight:Be}){Object.entries({"--available-width":`${Ke}px`,"--available-height":`${Be}px`,"--anchor-width":`${Ne.width}px`,"--anchor-height":`${Ne.height}px`}).forEach(([ot,nt])=>{Oe.style.setProperty(ot,nt)})}}),kf(()=>({element:ge.current||document.createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(Oe){const{elements:Ne,middlewareData:Ke,placement:Be,rects:ot,y:nt}=Oe,Tt=Ze(Be),Qn=rt(Tt),Ro=ge.current,Lc=Ke.arrow?.x||0,Fc=Ke.arrow?.y||0,Vc=Ro?.clientWidth||0,jc=Ro?.clientHeight||0,er=Lc+Vc/2,So=Fc+jc/2,Bc=Math.abs(Ke.shift?.y||0),$c=ot.reference.height/2,Jt=typeof o=="function"?o(as(Oe,r,M)):o,Hc=Bc>Jt,Uc={top:`${er}px calc(100% + ${Jt}px)`,bottom:`${er}px ${-Jt}px`,left:`calc(100% + ${Jt}px) ${So}px`,right:`${-Jt}px ${So}px`}[Tt],Wc=`${er}px ${ot.reference.y+$c-nt}px`;return Ne.floating.style.setProperty("--transform-origin",Q&&Qn==="y"&&Hc?Wc:Uc),{}}},Af,v),J(()=>{!g&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,m]);const se=l.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:z,elements:W,x:ie,y:re,middlewareData:he,update:K,placement:ae,context:Y,isPositioned:$,floatingStyles:B}=hf({rootContext:m,placement:k,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...Oe)=>qo(...Oe,se),nodeId:y,externalTree:E}),{sideX:oe,sideY:le}=he.adaptiveOrigin||Lf,fe=$?n:"fixed",xe=l.useMemo(()=>v?{position:fe,[oe]:ie,[le]:re}:{position:fe,...B},[v,fe,oe,ie,le,re,B]),Se=l.useRef(null);J(()=>{if(!g)return;const Oe=S.current,Ne=typeof Oe=="function"?Oe():Oe,Be=(ls(Ne)?Ne.current:Ne)||null||null;Be!==Se.current&&(z.setPositionReference(Be),Se.current=Be)},[g,z,I,S]),l.useEffect(()=>{if(!g)return;const Oe=S.current;typeof Oe!="function"&&ls(Oe)&&Oe.current!==Se.current&&(z.setPositionReference(Oe.current),Se.current=Oe.current)},[g,z,I,S]),l.useEffect(()=>{if(p&&g&&W.domReference&&W.floating)return qo(W.domReference,W.floating,K,se)},[p,g,W,K,se]);const ze=Ze(ae),We=Ni(r,ze,M),Me=St(ae)||"center",pe=!!he.hide?.referenceHidden;J(()=>{w&&g&&$&&R(ze)},[w,g,$,ze]);const Ee=l.useMemo(()=>({position:"absolute",top:he.arrow?.y,left:he.arrow?.x}),[he.arrow]),De=he.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:xe,arrowStyles:Ee,arrowRef:ge,arrowUncentered:De,side:We,align:Me,physicalSide:ze,anchorHidden:pe,refs:z,context:Y,isPositioned:$,update:K}),[xe,Ee,ge,De,We,Me,ze,pe,z,Y,$,K])}function ls(e){return e!=null&&"current"in e}let it=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Wt.startingStyle]="startingStyle",e[e.endingStyle=Wt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),us=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Vf={[us.popupOpen]:"",[us.pressed]:""},jf={[it.open]:""},Bf={[it.closed]:""},$f={[it.anchorHidden]:""},fs={open(e){return e?Vf:null}},mn={open(e){return e?jf:Bf},anchorHidden(e){return e?$f:null}};function uo(){const e=l.useContext(Gn);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":Fe(73));const{toasts:t,add:n,close:r,update:o,promise:s}=e;return l.useMemo(()=>({toasts:t,add:n,close:r,update:o,promise:s}),[t,n,r,o,s])}const Hf=e=>{const t={size:20,"aria-hidden":!0};switch(e){case"success":return T.jsx(Ue.CheckCircle,{...t});case"warning":return T.jsx(Ue.AlertTriangle,{...t});case"error":return T.jsx(Ue.XCircle,{...t});case"info":default:return T.jsx(Ue.Info,{...t})}},Mi=l.forwardRef(function(t,n){const{toast:r,className:o,style:s}=t,c=r.data??{},i=c.severity??"info",u=c.showIcon??!0,a=c.closable??!0,d=c.icon??(u?Hf(i):null),f=c.action,p=c.onClose,m=uo(),g=l.useCallback(()=>{p?.(),m.close(r.id)},[p,m,r.id]);return T.jsx(qs,{ref:n,toast:r,className:ye("memori-alert",`memori-alert--${i}`,o),style:s,children:T.jsxs("div",{className:"memori-alert__container",children:[d&&T.jsx("div",{className:"memori-alert__icon","aria-hidden":"true",children:d}),T.jsxs("div",{className:"memori-alert__content",children:[r.title&&T.jsx(Js,{className:"memori-alert__title",children:r.title}),r.description&&T.jsx(Xs,{className:"memori-alert__description",children:r.description})]}),T.jsxs("div",{className:"memori-alert__actions",children:[f&&T.jsx("div",{className:"memori-alert__action",children:f}),a&&T.jsx(Qs,{className:"memori-alert__close","aria-label":"Close alert",onClick:g,children:T.jsx(Ue.X,{size:16,"aria-hidden":"true"})})]})]})})}),Uf=l.forwardRef(function(t,n){const{placement:r="top-end",className:o,style:s}=t,c=uo();return T.jsx(Gs,{ref:n,className:ye("memori-alert-viewport",`memori-alert-viewport--${r}`,o),style:s,children:c.toasts.map(i=>T.jsx(Mi,{toast:i},i.id))})}),Wf=({children:e,defaultDuration:t=5e3,limit:n=5})=>T.jsx($s,{timeout:t,limit:n,children:e}),Kf=()=>uo(),zf=e=>({title:e.title,description:e.description,timeout:e.duration,data:{severity:e.severity,icon:e.icon,showIcon:e.showIcon,closable:e.closable,action:e.action,onClose:e.onClose}}),Ii=l.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:c=!1,nativeButton:i=!0,...u}=t,a=!!s,{getButtonProps:d,buttonRef:f}=Xt({disabled:a,focusableWhenDisabled:c,native:i}),p=l.useMemo(()=>({disabled:a}),[a]);return Te("button",t,{state:p,ref:[n,f],props:[u,d]})});process.env.NODE_ENV!=="production"&&(Ii.displayName="Button");const Gt=be.forwardRef(({variant:e="primary",size:t="md",fullWidth:n=!1,loading:r=!1,icon:o,iconPosition:s="left",shape:c="default",active:i=!1,danger:u=!1,className:a,children:d,disabled:f,type:p="button",ariaLabel:m,...g},h)=>{const y={primary:"memori-button--primary",secondary:"memori-button--secondary",outline:"memori-button--outline",ghost:"memori-button--ghost",danger:"memori-button--danger"}[u?"danger":e],v={sm:"memori-button--sm",md:"memori-button--md",lg:"memori-button--lg"}[t],w={default:void 0,round:"memori-button--round",circle:"memori-button--circle"}[c],E=f||r,b=r?T.jsx(Ue.Loader2,{className:"memori-button__spinner","aria-hidden":"true"}):o?T.jsx("span",{className:"memori-button__icon",children:o}):null,R=be.Children.count(d)>0;return T.jsxs(Ii,{ref:h,disabled:E,focusableWhenDisabled:r,className:ye("memori-button",y,v,w,n&&"memori-button--full-width",E&&"memori-button--disabled",r&&"memori-button--loading",i&&"memori-button--active",!R&&b&&"memori-button--icon-only",a),type:p,"aria-label":m,...g,children:[b&&s==="left"&&b,R&&T.jsx("span",{className:"memori-button__content",children:d}),b&&s==="right"&&b]})});Gt.displayName="Button";function Pi({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,c]=l.useState(t),i=o?e:s;if(process.env.NODE_ENV!=="production"){l.useEffect(()=>{o!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
43
|
-
`))},[r,n,e]);const{current:a}=
|
|
44
|
-
`))},[JSON.stringify(t)])}const u=l.useCallback(a=>{o||c(a)},[]);return[i,u]}function At(e){return gt(e,"base-ui")}function Gf(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,s=t!==void 0,[c,i]=Pi({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:u,setMounted:a,transitionStatus:d}=yi(c,!0,!0),[f,p]=l.useState(c),[{height:m,width:g},h]=l.useState({height:void 0,width:void 0}),x=At(),[y,v]=l.useState(),w=y??x,[E,b]=l.useState(!1),[R,C]=l.useState(!1),N=l.useRef(null),_=l.useRef(null),L=l.useRef(null),j=l.useRef(null),I=Ys(j,!1),S=X(D=>{const M=!c,P=ve(wt,D.nativeEvent);if(r(M,P),P.isCanceled)return;const k=j.current;_.current==="css-animation"&&k!=null&&k.style.removeProperty("animation-name"),!E&&!R&&(_.current!=null&&_.current!=="css-animation"&&!u&&M&&a(!0),_.current==="css-animation"&&(!f&&M&&p(!0),!u&&M&&a(!0))),i(M),_.current==="none"&&u&&!M&&a(!1)});return J(()=>{s&&_.current==="none"&&!R&&!c&&a(!1)},[s,R,c,t,a]),l.useMemo(()=>({abortControllerRef:N,animationTypeRef:_,disabled:o,handleTrigger:S,height:m,mounted:u,open:c,panelId:w,panelRef:j,runOnceAnimationsFinish:I,setDimensions:h,setHiddenUntilFound:b,setKeepMounted:C,setMounted:a,setOpen:i,setPanelIdState:v,setVisible:p,transitionDimensionRef:L,transitionStatus:d,visible:f,width:g}),[N,_,o,S,m,u,c,w,j,I,h,b,C,a,i,p,L,d,f,g])}const fo=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(fo.displayName="CollapsibleRootContext");function Di(){const e=l.useContext(fo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.":Fe(15));return e}let sn=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Wt.startingStyle]="startingStyle",e[e.endingStyle=Wt.endingStyle]="endingStyle",e})({}),Yf=(function(e){return e.panelOpen="data-panel-open",e})({});const qf={[sn.open]:""},Xf={[sn.closed]:""},Jf={open(e){return e?{[Yf.panelOpen]:""}:null}},Zf={open(e){return e?qf:Xf}},_i={...Zf,...kt},ki=l.forwardRef(function(t,n){const{render:r,className:o,defaultOpen:s=!1,disabled:c=!1,onOpenChange:i,open:u,...a}=t,d=X(i),f=Gf({open:u,defaultOpen:s,onOpenChange:d,disabled:c}),p=l.useMemo(()=>({open:f.open,disabled:f.disabled,transitionStatus:f.transitionStatus}),[f.open,f.disabled,f.transitionStatus]),m=l.useMemo(()=>({...f,onOpenChange:d,state:p}),[f,d,p]),g=Te("div",t,{state:p,ref:n,props:a,stateAttributesMapping:_i});return T.jsx(fo.Provider,{value:m,children:g})});process.env.NODE_ENV!=="production"&&(ki.displayName="CollapsibleRoot");const Qf={...Jf,...kt},Ai=l.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:c,disabled:i}=Di(),{className:u,disabled:a=i,id:d,render:f,nativeButton:p=!0,...m}=t,{getButtonProps:g,buttonRef:h}=Xt({disabled:a,focusableWhenDisabled:!0,native:p}),x=l.useMemo(()=>({"aria-controls":o?r:void 0,"aria-expanded":o,disabled:a,onClick:s}),[r,a,o,s]);return Te("button",t,{state:c,ref:[n,h],props:[x,m,g],stateAttributesMapping:Qf})});process.env.NODE_ENV!=="production"&&(Ai.displayName="CollapsibleTrigger");let Pr;process.env.NODE_ENV!=="production"&&(Pr=new Set);function Li(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Pr.has(t)||(Pr.add(t),console.warn(`Base UI: ${t}`))}}let ed=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function td(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:o,hiddenUntilFound:s,keepMounted:c,id:i,mounted:u,onOpenChange:a,open:d,panelRef:f,runOnceAnimationsFinish:p,setDimensions:m,setMounted:g,setOpen:h,setVisible:x,transitionDimensionRef:y,visible:v,width:w}=e,E=l.useRef(!1),b=l.useRef(null),R=l.useRef(d),C=l.useRef(d),N=dn(),_=l.useMemo(()=>n.current==="css-animation"?!v:!d&&!u,[d,u,v,n]),L=X(I=>{if(!I)return;if(n.current==null||y.current==null){const M=getComputedStyle(I),P=M.animationName!=="none"&&M.animationName!=="",k=M.transitionDuration!=="0s"&&M.transitionDuration!=="";P&&k?process.env.NODE_ENV!=="production"&&Li("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.","Only one of either animation type should be used."):M.animationName==="none"&&M.transitionDuration!=="0s"?n.current="css-transition":M.animationName!=="none"&&M.transitionDuration==="0s"?n.current="css-animation":n.current="none",I.getAttribute(ed.orientation)==="horizontal"||M.transitionProperty.indexOf("width")>-1?y.current="width":y.current="height"}if(n.current!=="css-transition")return;(o===void 0||w===void 0)&&(m({height:I.scrollHeight,width:I.scrollWidth}),C.current&&I.style.setProperty("transition-duration","0s"));let S=-1,D=-1;return S=Ie.request(()=>{C.current=!1,D=Ie.request(()=>{setTimeout(()=>{I.style.removeProperty("transition-duration")})})}),()=>{Ie.cancel(S),Ie.cancel(D)}}),j=Pt(r,f,L);return J(()=>{if(n.current!=="css-transition")return;const I=f.current;if(!I)return;let S=-1;if(t.current!=null&&(t.current.abort(),t.current=null),d){const D={"justify-content":I.style.justifyContent,"align-items":I.style.alignItems,"align-content":I.style.alignContent,"justify-items":I.style.justifyItems};Object.keys(D).forEach(M=>{I.style.setProperty(M,"initial","important")}),!C.current&&!c&&I.setAttribute(sn.startingStyle,""),m({height:I.scrollHeight,width:I.scrollWidth}),S=Ie.request(()=>{Object.entries(D).forEach(([M,P])=>{P===""?I.style.removeProperty(M):I.style.setProperty(M,P)})})}else{if(I.scrollHeight===0&&I.scrollWidth===0)return;m({height:I.scrollHeight,width:I.scrollWidth});const D=new AbortController;t.current=D;const M=D.signal;let P=null;const k=sn.endingStyle;return P=new MutationObserver(O=>{O.some(V=>V.type==="attributes"&&V.attributeName===k)&&(P?.disconnect(),P=null,p(()=>{m({height:0,width:0}),I.style.removeProperty("content-visibility"),g(!1),t.current===D&&(t.current=null)},M))}),P.observe(I,{attributes:!0,attributeFilter:[k]}),()=>{P?.disconnect(),N.cancel(),t.current===D&&(D.abort(),t.current=null)}}return()=>{Ie.cancel(S)}},[t,n,N,s,c,u,d,f,p,m,g]),J(()=>{if(n.current!=="css-animation")return;const I=f.current;I&&(b.current=I.style.animationName||b.current,I.style.setProperty("animation-name","none"),m({height:I.scrollHeight,width:I.scrollWidth}),!R.current&&!E.current&&I.style.removeProperty("animation-name"),d?(t.current!=null&&(t.current.abort(),t.current=null),g(!0),x(!0)):(t.current=new AbortController,p(()=>{g(!1),x(!1),t.current=null},t.current.signal)))},[t,n,d,f,p,m,g,x,v]),Fr(()=>{const I=Ie.request(()=>{R.current=!1});return()=>Ie.cancel(I)}),J(()=>{if(!s)return;const I=f.current;if(!I)return;let S=-1,D=-1;return d&&E.current&&(I.style.transitionDuration="0s",m({height:I.scrollHeight,width:I.scrollWidth}),S=Ie.request(()=>{E.current=!1,D=Ie.request(()=>{setTimeout(()=>{I.style.removeProperty("transition-duration")})})})),()=>{Ie.cancel(S),Ie.cancel(D)}},[s,d,f,m]),J(()=>{const I=f.current;I&&s&&_&&(I.setAttribute("hidden","until-found"),n.current==="css-transition"&&I.setAttribute(sn.startingStyle,""))},[s,_,n,f]),l.useEffect(function(){const S=f.current;if(!S)return;function D(M){E.current=!0,h(!0),a(!0,ve(Qr,M))}return S.addEventListener("beforematch",D),()=>{S.removeEventListener("beforematch",D)}},[a,f,h]),l.useMemo(()=>({props:{hidden:_,id:i,ref:j}}),[_,i,j])}let ds=(function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e})({});const Fi=l.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:c,id:i,...u}=t;process.env.NODE_ENV!=="production"&&J(()=>{o&&s===!1&&Li("The `keepMounted={false}` prop on a Collapsible will be ignored when using `hiddenUntilFound` since it requires the Panel to remain mounted even when closed.")},[o,s]);const{abortControllerRef:a,animationTypeRef:d,height:f,mounted:p,onOpenChange:m,open:g,panelId:h,panelRef:x,runOnceAnimationsFinish:y,setDimensions:v,setHiddenUntilFound:w,setKeepMounted:E,setMounted:b,setPanelIdState:R,setOpen:C,setVisible:N,state:_,transitionDimensionRef:L,visible:j,width:I,transitionStatus:S}=Di(),D=o??!1,M=s??!1;J(()=>{if(i)return R(i),()=>{R(void 0)}},[i,R]),J(()=>{w(D)},[w,D]),J(()=>{E(M)},[E,M]);const{props:P}=td({abortControllerRef:a,animationTypeRef:d,externalRef:n,height:f,hiddenUntilFound:D,id:h,keepMounted:M,mounted:p,onOpenChange:m,open:g,panelRef:x,runOnceAnimationsFinish:y,setDimensions:v,setMounted:b,setOpen:C,setVisible:N,transitionDimensionRef:L,visible:j,width:I});pn({open:g&&S==="idle",ref:x,onComplete(){g&&v({height:void 0,width:void 0})}});const k=l.useMemo(()=>({..._,transitionStatus:S}),[_,S]),O=Te("div",t,{state:k,ref:[n,x],props:[P,{style:{[ds.collapsiblePanelHeight]:f===void 0?"auto":`${f}px`,[ds.collapsiblePanelWidth]:I===void 0?"auto":`${I}px`}},u],stateAttributesMapping:_i});return M||D||!M&&p?O:null});process.env.NODE_ENV!=="production"&&(Fi.displayName="CollapsiblePanel");const Vi=be.forwardRef(({summary:e,children:t,defaultOpen:n=!1,open:r,onOpenChange:o,disabled:s=!1,className:c,triggerClassName:i,panelClassName:u,style:a,triggerStyle:d,panelStyle:f,keepMounted:p=!1,id:m,"aria-label":g,"aria-labelledby":h,...x},y)=>{const[v,w]=be.useState(n),E=r!==void 0,b=E?r:v,R=be.useCallback(L=>{E||w(L),o?.(L)},[E,o]),C=be.useId(),N=m||`collapsible-trigger-${C}`,_=`collapsible-panel-${C}`;return T.jsxs(ki,{ref:y,defaultOpen:n,open:E?r:void 0,onOpenChange:R,disabled:s,className:ye("memori-collapsible",c),style:a,id:m,...x,children:[T.jsxs(Ai,{id:N,"aria-label":g,"aria-labelledby":h,"aria-expanded":b,"aria-controls":_,className:ye("memori-collapsible__trigger",i),style:d,children:[T.jsx("span",{className:"memori-collapsible__summary",children:e}),T.jsx(Ue.ChevronDown,{className:ye("memori-collapsible__icon",{"memori-collapsible__icon--open":b}),"aria-hidden":"true"})]}),T.jsx(Fi,{id:_,role:"region","aria-labelledby":N,keepMounted:p,className:ye("memori-collapsible__panel",u),style:f,children:t})]})});Vi.displayName="Collapsible";const Jn=be.forwardRef(({spinning:e=!1,primary:t=!1,children:n,className:r,spinnerClassName:o,style:s,spinnerStyle:c,size:i="default",indicator:u,tip:a,...d},f)=>{const p=u||T.jsx(Ue.Loader2,{className:ye("memori-spin__icon",{"memori-spin__icon--primary":t,"memori-spin__icon--sm":i==="sm","memori-spin__icon--md":i==="md","memori-spin__icon--lg":i==="lg"}),"aria-hidden":"true"});return T.jsxs("div",{ref:f,className:ye("memori-spin",{"memori-spin--spinning":e,"memori-spin--primary":t},r),style:s,...d,children:[n,e&&T.jsx("div",{className:ye("memori-spin__overlay",o),style:c,role:"status","aria-live":"polite","aria-label":"Loading",children:T.jsxs("div",{className:"memori-spin__container",children:[p,a&&T.jsx("div",{className:"memori-spin__tip",children:a})]})})]})});Jn.displayName="Spin";const ji=be.forwardRef(({children:e,className:t,style:n,variant:r="elevated",padding:o="md",component:s="div",focusable:c,onClick:i,title:u,description:a,cover:d,loading:f=!1,hoverable:p=!1,...m},g)=>{const h=!!i||c===!0||p===!0,x=h||c?0:void 0,y=ye("memori-card",r==="elevated"?"memori-card--elevated":"memori-card--outlined",h&&"memori-card--interactive",t),v=ye("memori-card__body",`memori-card__body--padding-${o}`);return T.jsxs(s,{ref:g,className:y,style:n,tabIndex:x,onClick:i,...m,children:[d&&T.jsx("div",{className:"memori-card__cover",children:d}),T.jsx("div",{className:v,children:T.jsxs(Jn,{spinning:f,children:[(u||a)&&T.jsxs("div",{className:"memori-card__header",children:[u&&T.jsx("div",{className:"memori-card__title",children:u}),a&&T.jsx("div",{className:"memori-card__description",children:a})]}),e]})})]})});ji.displayName="Card";const Bi=l.forwardRef(({checked:e,defaultChecked:t,indeterminate:n=!1,disabled:r=!1,required:o=!1,name:s,value:c,label:i,onChange:u,className:a,style:d,id:f,"aria-label":p,"aria-describedby":m,"aria-labelledby":g},h)=>{const x=v=>{u?.(v,{target:{checked:v},currentTarget:{checked:v}})},y=n?!1:e;return T.jsxs(Ve.Checkbox.Root,{checked:y,defaultChecked:t,disabled:r,required:o,name:s,value:c,onCheckedChange:x,className:ye("memori-checkbox",r&&"memori-checkbox--disabled",a),style:d,id:f,"aria-label":p,"aria-describedby":m,"aria-labelledby":g,ref:h,children:[T.jsx("span",{className:ye("memori-checkbox__indicator",e&&!n&&"memori-checkbox__indicator--checked",n&&"memori-checkbox__indicator--indeterminate"),children:T.jsx(Ve.Checkbox.Indicator,{className:"memori-checkbox__icon-wrapper",children:n?T.jsx(Ue.Minus,{className:"memori-checkbox__icon",size:14,strokeWidth:3}):T.jsx(Ue.Check,{className:"memori-checkbox__icon",size:14,strokeWidth:3})})}),i&&T.jsx("span",{className:"memori-checkbox__label",children:i})]})});Bi.displayName="Checkbox";const po=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(po.displayName="DialogRootContext");function Ot(e){const t=l.useContext(po);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":Fe(27));return t}const nd={...mn,...kt},$i=l.forwardRef(function(t,n){const{render:r,className:o,forceRender:s=!1,...c}=t,{store:i}=Ot(),u=i.useState("open"),a=i.useState("nested"),d=i.useState("mounted"),f=i.useState("transitionStatus"),p=l.useMemo(()=>({open:u,transitionStatus:f}),[u,f]);return Te("div",t,{state:p,ref:[i.context.backdropRef,n],stateAttributesMapping:nd,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:s||!a})});process.env.NODE_ENV!=="production"&&($i.displayName="DialogBackdrop");const Hi=l.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:c=!0,...i}=t,{store:u}=Ot(),a=u.useState("open");function d(g){a&&u.setOpen(!1,ve(kl,g.nativeEvent))}const{getButtonProps:f,buttonRef:p}=Xt({disabled:s,native:c}),m=l.useMemo(()=>({disabled:s}),[s]);return Te("button",t,{state:m,ref:[n,p],props:[{onClick:d},i,f]})});process.env.NODE_ENV!=="production"&&(Hi.displayName="DialogClose");const Ui=l.forwardRef(function(t,n){const{render:r,className:o,id:s,...c}=t,{store:i}=Ot(),u=At(s);return i.useSyncedValueWithCleanup("descriptionElementId",u),Te("p",t,{ref:n,props:[{id:u},c]})});process.env.NODE_ENV!=="production"&&(Ui.displayName="DialogDescription");let rd=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),od=(function(e){return e[e.open=it.open]="open",e[e.closed=it.closed]="closed",e[e.startingStyle=it.startingStyle]="startingStyle",e[e.endingStyle=it.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const mo=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(mo.displayName="DialogPortalContext");function Wi(){const e=l.useContext(mo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":Fe(26));return e}const Ki="ArrowUp",zi="ArrowDown",Gi="ArrowLeft",Yi="ArrowRight",qi="Home",Xi="End",sd=new Set([Gi,Yi]),id=new Set([Ki,zi]),cd=new Set([...sd,...id]);[...cd];const Ji=new Set([Ki,zi,Gi,Yi,qi,Xi]),ad={...mn,...kt,nestedDialogOpen(e){return e?{[od.nestedDialogOpen]:""}:null}},Zi=l.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:c,...i}=t,{store:u}=Ot(),a=u.useState("descriptionElementId"),d=u.useState("disablePointerDismissal"),f=u.useState("floatingRootContext"),p=u.useState("popupProps"),m=u.useState("modal"),g=u.useState("mounted"),h=u.useState("nested"),x=u.useState("nestedOpenDialogCount"),y=u.useState("open"),v=u.useState("openMethod"),w=u.useState("titleElementId"),E=u.useState("transitionStatus"),b=u.useState("role");Wi(),pn({open:y,ref:u.context.popupRef,onComplete(){y&&u.context.onOpenChangeComplete?.(!0)}});function R(j){return j==="touch"?u.context.popupRef.current:!0}const C=s===void 0?R:s,N=x>0,_=l.useMemo(()=>({open:y,nested:h,transitionStatus:E,nestedDialogOpen:N}),[y,h,E,N]),L=Te("div",t,{state:_,props:[p,{"aria-labelledby":w??void 0,"aria-describedby":a??void 0,role:b,tabIndex:-1,hidden:!g,onKeyDown(j){Ji.has(j.key)&&j.stopPropagation()},style:{[rd.nestedDialogs]:x}},i],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:ad});return T.jsx(ii,{context:f,openInteractionType:v,disabled:!g,closeOnFocusOut:!d,initialFocus:C,returnFocus:o,modal:m!==!1,restoreFocus:"popup",children:L})});process.env.NODE_ENV!=="production"&&(Zi.displayName="DialogPopup");const go=l.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const c=r?.getBoundingClientRect();s=`polygon(
|
|
42
|
+
*/var ss;function nf(){return ss||(ss=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=be,n=co(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,i=t.useMemo,u=t.useDebugValue;pr.useSyncExternalStoreWithSelector=function(a,d,l,p,m){var g=s(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=i(function(){function y(R){if(!v){if(v=!0,w=R,R=p(R),m!==void 0&&h.hasValue){var C=h.value;if(m(C,R))return x=C}return x=R}if(C=x,r(w,R))return C;var N=p(R);return m!==void 0&&m(C,N)?(w=R,C):(w=R,x=N)}var v=!1,w,x,b=l===void 0?null:l;return[function(){return y(d())},b===null?void 0:function(){return y(b())}]},[d,l,p,m]);var E=o(a,g[0],g[1]);return c(function(){h.hasValue=!0,h.value=E},[E]),u(E),E},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),pr}var is;function rf(){return is||(is=1,process.env.NODE_ENV==="production"?wn.exports=tf():wn.exports=nf()),wn.exports}var of=rf();const sf=Gr(19),cf=sf?lf:uf;function af(e,t,n,r,o){return cf(e,t,n,r,o)}function lf(e,t,n,r,o){const s=f.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ef.useSyncExternalStore(e.subscribe,s,s)}function uf(e,t,n,r,o){return of.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class on{constructor(t){Ce(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ce(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){on.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||on.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};on.prototype.setState.call(this,t)}}class ao extends on{constructor(n,r={},o){super(n);Ce(this,"controlledValues",new Map);Ce(this,"select",(n,r,o,s)=>{const c=this.selectors[n];return c(this.state,r,o,s)});Ce(this,"useState",(n,r,o,s)=>{f.useDebugValue(n);const c=this.selectors[n];return af(this,c,r,o,s)});this.context=r,this.selectors=o}useSyncedValue(n,r){f.useDebugValue(n),J(()=>{this.state[n]!==r&&this.set(n,r)},[n,r])}useSyncedValueWithCleanup(n,r){J(()=>(this.state[n]!==r&&this.set(n,r),()=>{this.set(n,void 0)}),[n,r])}useSyncedValues(n){if(process.env.NODE_ENV!=="production"){f.useDebugValue(n,c=>Object.keys(c));const o=f.useRef(Object.keys(n)).current,s=Object.keys(n);(o.length!==s.length||o.some((c,i)=>c!==s[i]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(n);J(()=>{this.update(n)},r)}useControlledProp(n,r,o){f.useDebugValue(n);const s=r!==void 0;if(process.env.NODE_ENV!=="production"){const c=this.controlledValues.get(n);c!==void 0&&c!==s&&console.error(`A component is changing the ${s?"":"un"}controlled state of ${n.toString()} to be ${s?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}this.controlledValues.has(n)||(this.controlledValues.set(n,s),!s&&!Object.is(this.state[n],o)&&super.setState({...this.state,[n]:o})),J(()=>{s&&!Object.is(this.state[n],r)&&super.setState({...this.state,[n]:r})},[n,r,o,s])}set(n,r){this.controlledValues.get(n)!==!0&&super.set(n,r)}update(n){const r={...n};for(const o in r)if(Object.hasOwn(r,o)&&this.controlledValues.get(o)===!0){delete r[o];continue}super.update(r)}setState(n){const r={...n};for(const o in r)if(Object.hasOwn(r,o)&&this.controlledValues.get(o)===!0){delete r[o];continue}super.setState({...this.state,...r})}useContextCallback(n,r){f.useDebugValue(n);const o=X(r??Xe);this.context[n]=o}useStateSetter(n){const r=f.useRef(void 0);return r.current===void 0&&(r.current=o=>{this.set(n,o)}),r.current}observe(n,r){let o;typeof n=="function"?o=n:o=this.selectors[n];let s=o(this.state);return r(s,s,this),this.subscribe(c=>{const i=o(c);if(!Object.is(s,i)){const u=s;s=i,r(i,u,this)}})}}const ff={open:ce(e=>e.open),domReferenceElement:ce(e=>e.domReferenceElement),referenceElement:ce(e=>e.positionReference??e.referenceElement),floatingElement:ce(e=>e.floatingElement),floatingId:ce(e=>e.floatingId)};class lo extends ao{constructor(n){const{nested:r,noEmit:o,onOpenChange:s,triggerElements:c,...i}=n;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:ti(),nested:r,noEmit:o,triggerElements:c},ff);Ce(this,"setOpen",(n,r)=>{if((!n||!this.state.open||Is(r.event))&&(this.context.dataRef.current.openEvent=n?r.event:void 0),!this.context.noEmit){const o={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(n,r)})}}function vi(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,c]=f.useState(e);return e&&!s&&(c(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),J(()=>{if(!e&&s&&r!=="ending"&&n){const i=Ie.request(()=>{o("ending")});return()=>{Ie.cancel(i)}}},[e,s,r,n]),J(()=>{if(!e||t)return;const i=Ie.request(()=>{o(void 0)});return()=>{Ie.cancel(i)}},[t,e]),J(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const i=Ie.request(()=>{o("idle")});return()=>{Ie.cancel(i)}},[t,e,s,o,r]),f.useMemo(()=>({mounted:s,setMounted:c,transitionStatus:r}),[s,r])}function df(e,t){const n=f.useRef(null);return f.useCallback(r=>{e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null&&(n.current=e,t.context.triggerElements.add(e,r)))},[t,e])}function pf(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=df(e,n),c=X(i=>{s(i),i!==null&&n.select("open")&&n.select("activeTriggerId")==null&&n.update({activeTriggerId:e,activeTriggerElement:i,...r})});return J(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function Ei(e){const t=e.useState("open");J(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function xi(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=vi(e);t.useSyncedValues({mounted:r,transitionStatus:s});const c=X(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),i=t.useState("preventUnmountingOnClose");return pn({enabled:!i,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:s}}class qn{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elements.size!==this.idMap.size))throw new Error(process.env.NODE_ENV!=="production"?"Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.":Fe(87))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function mf(){return new lo({open:!1,floatingElement:null,referenceElement:null,triggerElements:new qn,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function wi(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:mf(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ke,inactiveTriggerProps:ke,popupProps:ke}}const Ri={open:ce(e=>e.open),mounted:ce(e=>e.mounted),transitionStatus:ce(e=>e.transitionStatus),floatingRootContext:ce(e=>e.floatingRootContext),preventUnmountingOnClose:ce(e=>e.preventUnmountingOnClose),payload:ce(e=>e.payload),activeTriggerId:ce(e=>e.activeTriggerId),activeTriggerElement:ce(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:ce((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:ce((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:ce((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:ce((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:ce(e=>e.popupProps),popupElement:ce(e=>e.popupElement),positionerElement:ce(e=>e.positionerElement)};function gf(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=gt(),s=ht()!=null;if(process.env.NODE_ENV!=="production"){const i=r.reference;i&&!we(i)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const c=et(()=>new lo({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new qn,floatingId:o,nested:s,noEmit:e.noEmit||!1})).current;return J(()=>{const i={open:t,floatingId:o};r.reference!==void 0&&(i.referenceElement=r.reference,i.domReferenceElement=we(r.reference)?r.reference:null),r.floating!==void 0&&(i.floatingElement=r.floating),c.update(i)},[t,o,r.reference,r.floating,c]),c.context.onOpenChange=n,c.context.nested=s,c.context.noEmit=e.noEmit||!1,c}function hf(e={}){const{nodeId:t,externalTree:n}=e,r=gf(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[c,i]=f.useState(null),u=f.useRef(null),a=Ct(n);J(()=>{s.domReference&&(u.current=s.domReference)},[s.domReference]);const d=Cu({...e,elements:{...s,...c&&{reference:c}}}),l=f.useCallback(C=>{const N=we(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;i(N),d.refs.setReference(N)},[d.refs]),[p,m]=f.useState(null),[g,h]=f.useState(null);o.useSyncedValue("referenceElement",p),o.useSyncedValue("domReferenceElement",we(p)?p:null),o.useSyncedValue("floatingElement",g);const E=f.useCallback(C=>{(we(C)||C===null)&&(u.current=C,m(C)),(we(d.refs.reference.current)||d.refs.reference.current===null||C!==null&&!we(C))&&d.refs.setReference(C)},[d.refs,m]),y=f.useCallback(C=>{h(C),d.refs.setFloating(C)},[d.refs]),v=f.useMemo(()=>({...d.refs,setReference:E,setFloating:y,setPositionReference:l,domReference:u}),[d.refs,E,y,l]),w=f.useMemo(()=>({...d.elements,domReference:s.domReference}),[d.elements,s.domReference]),x=o.useState("open"),b=o.useState("floatingId"),R=f.useMemo(()=>({...d,dataRef:o.context.dataRef,open:x,onOpenChange:o.setOpen,events:o.context.events,floatingId:b,refs:v,elements:w,nodeId:t,rootStore:o}),[d,v,w,t,o,x,b]);return J(()=>{o.context.dataRef.current.floatingContext=R;const C=a?.nodesRef.current.find(N=>N.id===t);C&&(C.context=R)}),f.useMemo(()=>({...d,context:R,refs:v,elements:w,rootStore:o}),[d,v,w,R,o])}function Si(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=gt(),c=ht()!=null,i=t.useState("open"),u=t.useState("activeTriggerElement"),a=t.useState(r?"popupElement":"positionerElement"),d=t.context.triggerElements,l=et(()=>new lo({open:i,referenceElement:u,floatingElement:a,triggerElements:d,onOpenChange:o,floatingId:s,nested:c,noEmit:n})).current;return J(()=>{const p={open:i,floatingId:s,referenceElement:u,floatingElement:a};we(u)&&(p.domReferenceElement=u),l.update(p)},[i,s,u,a,l]),l.context.onOpenChange=o,l.context.nested=c,l.context.noEmit=n,l}const mr=fa&&Rs;function bf(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:o}=n.context,{enabled:s=!0,visibleOnly:c=!0}=t,i=f.useRef(!1),u=tt(),a=f.useRef(!0);f.useEffect(()=>{const l=n.select("domReferenceElement");if(!s)return;const p=Ae(l);function m(){!n.select("open")&&Pe(l)&&l===Ge(_e(l))&&(i.current=!0)}function g(){a.current=!0}function h(){a.current=!1}return p.addEventListener("blur",m),mr&&(p.addEventListener("keydown",g,!0),p.addEventListener("pointerdown",h,!0)),()=>{p.removeEventListener("blur",m),mr&&(p.removeEventListener("keydown",g,!0),p.removeEventListener("pointerdown",h,!0))}},[n,s]),f.useEffect(()=>{if(!s)return;function l(p){(p.reason===wt||p.reason===no)&&(i.current=!0)}return r.on("openchange",l),()=>{r.off("openchange",l)}},[r,s]);const d=f.useMemo(()=>({onMouseLeave(){i.current=!1},onFocus(l){if(i.current)return;const p=Le(l.nativeEvent);if(c&&we(p)){if(mr&&!l.relatedTarget){if(!a.current&&!Br(p))return}else if(!In(p))return}n.setOpen(!0,ve(Bn,l.nativeEvent,l.currentTarget))},onBlur(l){i.current=!1;const p=l.relatedTarget,m=l.nativeEvent,g=we(p)&&p.hasAttribute(Gt("focus-guard"))&&p.getAttribute("data-type")==="outside";u.start(0,()=>{const h=n.select("domReferenceElement"),E=Ge(h?h.ownerDocument:document);!p&&E===h||me(o.current.floatingContext?.refs.floating.current,E)||me(h,E)||g||n.context.triggerElements.hasElement(l.relatedTarget)||n.setOpen(!1,ve(Bn,m))})}}),[o,n,c,u]);return f.useMemo(()=>s?{reference:d,trigger:d}:{},[s,d])}const Ir=Gt("safe-polygon"),yf=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ts}`;function vf(e){return e?!!e.closest(yf):!1}function Ci(e){const t=f.useRef(void 0),n=f.useRef(!1),r=f.useRef(void 0),o=f.useRef(!0),s=f.useRef(!1),c=f.useRef(()=>{}),i=f.useRef(!1),u=tt(),a=tt(),d=f.useRef(void 0);return f.useMemo(()=>{const l=e.context.dataRef.current;return l.hoverInteractionState||(l.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:o,performedPointerEventsMutationRef:s,unbindMouseMoveRef:c,restTimeoutPendingRef:i,openChangeTimeout:u,restTimeout:a,handleCloseOptionsRef:d}),l.hoverInteractionState},[e,t,n,r,o,s,c,i,u,a,d])}const Ef=new Set(["click","mousedown"]);function xf(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:c}=n.context,{enabled:i=!0,closeDelay:u=0,externalTree:a}=t,{pointerTypeRef:d,interactedInsideRef:l,handlerRef:p,performedPointerEventsMutationRef:m,unbindMouseMoveRef:g,restTimeoutPendingRef:h,openChangeTimeout:E,handleCloseOptionsRef:y}=Ci(n),v=Ct(a),w=ht(),x=X(()=>l.current?!0:c.current.openEvent?Ef.has(c.current.openEvent.type):!1),b=X(()=>{const L=c.current.openEvent?.type;return L?.includes("mouse")&&L!=="mousedown"}),R=f.useCallback((L,j=!0)=>{const I=wf(u,d.current);I&&!p.current?E.start(I,()=>n.setOpen(!1,ve(Je,L))):j&&(E.clear(),n.setOpen(!1,ve(Je,L)))},[u,p,n,d,E]),C=X(()=>{g.current(),p.current=void 0}),N=X(()=>{if(m.current){const L=_e(o).body;L.style.pointerEvents="",L.removeAttribute(Ir),m.current=!1}}),_=X(L=>{const j=Le(L);if(!vf(j)){l.current=!1;return}l.current=!0});J(()=>{r||(d.current=void 0,h.current=!1,l.current=!1,C(),N())},[r,d,h,l,C,N]),f.useEffect(()=>()=>{C()},[C]),f.useEffect(()=>N,[N]),J(()=>{if(i&&r&&y.current?.blockPointerEvents&&b()&&we(s)&&o){m.current=!0;const L=_e(o).body;L.setAttribute(Ir,"");const j=s,I=o,S=v?.nodesRef.current.find(D=>D.id===w)?.context?.elements.floating;return S&&(S.style.pointerEvents=""),L.style.pointerEvents="none",j.style.pointerEvents="auto",I.style.pointerEvents="auto",()=>{L.style.pointerEvents="",j.style.pointerEvents="",I.style.pointerEvents=""}}},[i,r,s,o,y,b,v,w,m]),f.useEffect(()=>{if(!i)return;function L(D){if(x()||!c.current.floatingContext||!n.select("open"))return;const M=n.context.triggerElements;D.relatedTarget&&M.hasElement(D.relatedTarget)||(N(),C(),x()||R(D))}function j(D){E.clear(),N(),p.current?.(D),C()}function I(D){x()||R(D,!1)}const S=o;return S&&(S.addEventListener("mouseleave",L),S.addEventListener("mouseenter",j),S.addEventListener("mouseleave",I),S.addEventListener("pointerdown",_,!0)),()=>{S&&(S.removeEventListener("mouseleave",L),S.removeEventListener("mouseenter",j),S.removeEventListener("mouseleave",I),S.removeEventListener("pointerdown",_,!0))}})}function wf(e,t){return t&&!Ht(t)?0:typeof e=="function"?e():e}function gr(e){return typeof e=="function"?e():e}const Rf={current:null};function Sf(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:c=0,handleClose:i=null,mouseOnly:u=!1,restMs:a=0,move:d=!0,triggerElementRef:l=Rf,externalTree:p,isActiveTrigger:m=!0}=t,g=Ct(p),{pointerTypeRef:h,interactedInsideRef:E,handlerRef:y,blockMouseMoveRef:v,performedPointerEventsMutationRef:w,unbindMouseMoveRef:x,restTimeoutPendingRef:b,openChangeTimeout:R,restTimeout:C,handleCloseOptionsRef:N}=Ci(n),_=je(i),L=je(c),j=je(a);m&&(N.current=_.current?.__options);const I=X(()=>E.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),S=f.useCallback((k,O=!0)=>{const F=sr(L.current,"close",h.current);F&&!y.current?R.start(F,()=>n.setOpen(!1,ve(Je,k))):O&&(R.clear(),n.setOpen(!1,ve(Je,k)))},[L,y,n,h,R]),D=X(()=>{x.current(),y.current=void 0}),M=X(()=>{if(w.current){const k=_e(n.select("domReferenceElement")).body;k.style.pointerEvents="",k.removeAttribute(Ir),w.current=!1}});f.useEffect(()=>{if(!s)return;function k(O){O.open||(R.clear(),C.clear(),v.current=!0,b.current=!1)}return o.on("openchange",k),()=>{o.off("openchange",k)}},[s,o,R,C,v,b]);const P=X(k=>{if(I()||!r.current.floatingContext)return;const O=n.context.triggerElements;if(k.relatedTarget&&O.hasElement(k.relatedTarget))return;const F=l.current;_.current?.({...r.current.floatingContext,tree:g,x:k.clientX,y:k.clientY,onClose(){M(),D(),!I()&&F===n.select("domReferenceElement")&&S(k)}})(k)});return f.useEffect(()=>{if(!s)return;const k=l.current??(m?n.select("domReferenceElement"):null);if(!we(k))return;function O(U){if(R.clear(),v.current=!1,u&&!Ht(h.current)||gr(j.current)>0&&!sr(L.current,"open"))return;const ee=sr(L.current,"open",h.current),H=n.select("domReferenceElement"),ue=n.context.triggerElements,ge=(ue.hasElement(U.target)||ue.hasMatchingElement(q=>me(q,U.target)))&&(!H||!me(H,U.target)),te=U.currentTarget??null,G=!n.select("open")||ge;ee?R.start(ee,()=>{G&&n.setOpen(!0,ve(Je,U,te))}):G&&n.setOpen(!0,ve(Je,U,te))}function F(U){if(I()){M();return}x.current();const ee=n.select("domReferenceElement"),H=_e(ee);C.clear(),b.current=!1;const ue=n.context.triggerElements;if(U.relatedTarget&&ue.hasElement(U.relatedTarget))return;if(_.current&&r.current.floatingContext){n.select("open")||R.clear();const te=l.current;y.current=_.current({...r.current.floatingContext,tree:g,x:U.clientX,y:U.clientY,onClose(){M(),D(),!I()&&te===n.select("domReferenceElement")&&S(U,!0)}});const G=y.current;G(U),H.addEventListener("mousemove",G),x.current=()=>{H.removeEventListener("mousemove",G)};return}(h.current==="touch"?!me(n.select("floatingElement"),U.relatedTarget):!0)&&S(U)}function V(U){P(U)}return n.select("open")&&k.addEventListener("mouseleave",V),d&&k.addEventListener("mousemove",O,{once:!0}),k.addEventListener("mouseenter",O),k.addEventListener("mouseleave",F),()=>{k.removeEventListener("mouseleave",V),d&&k.removeEventListener("mousemove",O),k.removeEventListener("mouseenter",O),k.removeEventListener("mouseleave",F)}},[D,M,v,r,L,S,n,s,_,P,m,I,u,d,h,j,C,b,R,l,g,x,y]),f.useMemo(()=>{function k(O){h.current=O.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(O){const{nativeEvent:F}=O,V=O.currentTarget,U=n.select("domReferenceElement"),ee=n.context.triggerElements,H=n.select("open"),ue=(ee.hasElement(O.target)||ee.hasMatchingElement(te=>me(te,O.target)))&&(!U||!me(U,O.target));if(u&&!Ht(h.current)||H&&!ue||gr(j.current)===0||!ue&&b.current&&O.movementX**2+O.movementY**2<2)return;C.clear();function ge(){!v.current&&(!H||ue)&&n.setOpen(!0,ve(Je,F,V))}h.current==="touch"?ct.flushSync(()=>{ge()}):ue&&H?ge():(b.current=!0,C.start(gr(j.current),ge))}}},[v,u,n,h,j,C,b])}function uo(e=[]){const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=e.map(a=>a?.trigger),s=f.useCallback(a=>Rn(a,e,"reference"),t),c=f.useCallback(a=>Rn(a,e,"floating"),n),i=f.useCallback(a=>Rn(a,e,"item"),r),u=f.useCallback(a=>Rn(a,e,"trigger"),o);return f.useMemo(()=>({getReferenceProps:s,getFloatingProps:c,getItemProps:i,getTriggerProps:u}),[s,c,i,u])}function Rn(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Er]="");for(const c in e)o&&e&&(c===Cs||c===Os)||(s[c]=e[c]);for(let c=0;c<t.length;c+=1){let i;const u=t[c]?.[n];typeof u=="function"?i=e?u(e):null:i=u,i&&cs(s,i,o,r)}return cs(s,e,o,r),s}function cs(e,t,n,r){for(const o in t){const s=t[o];n&&(o===Cs||o===Os)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...c)=>r.get(o)?.map(i=>i(...c)).find(i=>i!==void 0))):e[o]=s)}}const Cf="Escape";function Xn(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Sn(e,t){return Xn(t,e===jr||e===un,e===Et||e===xt)}function hr(e,t,n){return Xn(t,e===un,n?e===Et:e===xt)||e==="Enter"||e===" "||e===""}function Of(e,t,n){return Xn(t,n?e===Et:e===xt,e===un)}function Tf(e,t,n,r){const o=n?e===xt:e===Et,s=e===jr;return t==="both"||t==="horizontal"&&r&&r>1?e===Cf:Xn(t,o,s)}function Nf(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),c=n.context.dataRef,{listRef:i,activeIndex:u,onNavigate:a=()=>{},enabled:d=!0,selectedIndex:l=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:E=!1,focusItemOnOpen:y="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:w=!0,disabledIndices:x=void 0,orientation:b="vertical",parentOrientation:R,cols:C=1,scrollItemIntoView:N=!0,itemSizes:_,dense:L=!1,id:j,resetOnPointerLeave:I=!0,externalTree:S}=t;process.env.NODE_ENV!=="production"&&(p&&(m||console.warn("`useListNavigation` looping must be enabled to allow escaping."),E||console.warn("`useListNavigation` must be virtual to allow escaping.")),b==="vertical"&&C>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const D=Pn(o),M=je(D),P=ht(),k=Ct(S);J(()=>{c.current.orientation=b},[c,b]);const O=xr(s),F=f.useRef(y),V=f.useRef(l??-1),U=f.useRef(null),ee=f.useRef(!0),H=X(Y=>{a(V.current===-1?null:V.current,Y)}),ue=f.useRef(H),ge=f.useRef(!!o),te=f.useRef(r),G=f.useRef(!1),q=f.useRef(!1),de=je(x),ne=je(r),A=je(N),Q=je(l),Z=je(I),Re=X(()=>{function Y(le){E?k?.events.emit("virtualfocus",le):Nn(le,{sync:G.current,preventScroll:!0})}const $=i.current[V.current],B=q.current;$&&Y($),(G.current?le=>le():requestAnimationFrame)(()=>{const le=i.current[V.current]||$;if(!le)return;$||Y(le);const fe=A.current;fe&&z&&(B||!ee.current)&&le.scrollIntoView?.(typeof fe=="boolean"?{block:"nearest",inline:"nearest"}:fe)})});J(()=>{d&&(r&&o?(V.current=l??-1,F.current&&l!=null&&(q.current=!0,H())):ge.current&&(V.current=-1,ue.current()))},[d,r,o,l,H]),J(()=>{if(d){if(!r){G.current=!1;return}if(o)if(u==null){if(G.current=!1,Q.current!=null)return;if(ge.current&&(V.current=-1,Re()),(!te.current||!ge.current)&&F.current&&(U.current!=null||F.current===!0&&U.current==null)){let Y=0;const $=()=>{i.current[0]==null?(Y<2&&(Y?requestAnimationFrame:queueMicrotask)($),Y+=1):(V.current=U.current==null||hr(U.current,b,h)||g?rr(i):Po(i),U.current=null,H())};$()}}else tn(i,u)||(V.current=u,Re(),q.current=!1)}},[d,r,o,u,Q,g,i,b,h,H,Re,de]),J(()=>{if(!d||o||!k||E||!ge.current)return;const Y=k.nodesRef.current,$=Y.find(le=>le.id===P)?.context?.elements.floating,B=Ge(_e(o)),oe=Y.some(le=>le.context&&me(le.context.elements.floating,B));$&&!oe&&ee.current&&$.focus({preventScroll:!0})},[d,o,k,P,E]),J(()=>{ue.current=H,te.current=r,ge.current=!!o}),J(()=>{r||(U.current=null,F.current=y)},[r,y]);const se=u!=null,z=f.useMemo(()=>{function Y(B){if(!ne.current)return;const oe=i.current.indexOf(B.currentTarget);oe!==-1&&V.current!==oe&&(V.current=oe,H(B))}return{onFocus(B){G.current=!0,Y(B)},onClick:({currentTarget:B})=>B.focus({preventScroll:!0}),onMouseMove(B){G.current=!0,q.current=!1,v&&Y(B)},onPointerLeave(B){if(!ne.current||!ee.current||B.pointerType==="touch")return;G.current=!0;const oe=B.relatedTarget;!v||i.current.includes(oe)||Z.current&&(V.current=-1,H(B),E||M.current?.focus({preventScroll:!0}))}}},[ne,M,v,i,H,Z,E]),W=f.useCallback(()=>R??k?.nodesRef.current.find(Y=>Y.id===P)?.context?.dataRef?.current.orientation,[P,k,R]),ie=X(Y=>{if(ee.current=!1,G.current=!0,Y.which===229||!ne.current&&Y.currentTarget===M.current)return;if(g&&Tf(Y.key,b,h,C)){Sn(Y.key,W())||He(Y),n.setOpen(!1,ve(Tn,Y.nativeEvent)),Pe(s)&&(E?k?.events.emit("virtualfocus",s):s.focus());return}const $=V.current,B=rr(i,x),oe=Po(i,x);if(O||(Y.key==="Home"&&(He(Y),V.current=B,H(Y)),Y.key==="End"&&(He(Y),V.current=oe,H(Y))),C>1){const le=_||Array.from({length:i.current.length},()=>({width:1,height:1})),fe=Ma(le,C,L),xe=fe.findIndex(We=>We!=null&&!nn(i,We,x)),Se=fe.reduce((We,Me,pe)=>Me!=null&&!nn(i,Me,x)?pe:We,-1),ze=fe[Na({current:fe.map(We=>We!=null?i.current[We]:null)},{event:Y,orientation:b,loopFocus:m,rtl:h,cols:C,disabledIndices:Pa([...(typeof x!="function"?x:null)||i.current.map((We,Me)=>nn(i,Me,x)?Me:void 0),void 0],fe),minIndex:xe,maxIndex:Se,prevIndex:Ia(V.current>oe?B:V.current,le,fe,C,Y.key===un?"bl":Y.key===(h?Et:xt)?"tr":"tl"),stopEvent:!0})];if(ze!=null&&(V.current=ze,H(Y)),b==="both")return}if(Sn(Y.key,b)){if(He(Y),r&&!E&&Ge(Y.currentTarget.ownerDocument)===Y.currentTarget){V.current=hr(Y.key,b,h)?B:oe,H(Y);return}hr(Y.key,b,h)?m?$>=oe?p&&$!==i.current.length?V.current=-1:(G.current=!1,V.current=B):V.current=$e(i,{startingIndex:$,disabledIndices:x}):V.current=Math.min(oe,$e(i,{startingIndex:$,disabledIndices:x})):m?$<=B?p&&$!==-1?V.current=i.current.length:(G.current=!1,V.current=oe):V.current=$e(i,{startingIndex:$,decrement:!0,disabledIndices:x}):V.current=Math.max(B,$e(i,{startingIndex:$,decrement:!0,disabledIndices:x})),tn(i,V.current)&&(V.current=-1),H(Y)}}),re=f.useMemo(()=>E&&r&&se&&{"aria-activedescendant":`${j}-${u}`},[E,r,se,j,u]),he=f.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...O?{}:re,onKeyDown(Y){if(Y.key==="Tab"&&Y.shiftKey&&r&&!E){const $=Le(Y.nativeEvent);if($&&!me(M.current,$))return;He(Y),n.setOpen(!1,ve(zt,Y.nativeEvent)),Pe(s)&&s.focus();return}ie(Y)},onPointerMove(){ee.current=!0}}),[re,ie,M,b,O,n,r,E,s]),K=f.useMemo(()=>{function Y(B){y==="auto"&&Ns(B.nativeEvent)&&(F.current=!E)}function $(B){F.current=y,y==="auto"&&Ms(B.nativeEvent)&&(F.current=!0)}return{onKeyDown(B){const oe=n.select("open");ee.current=!1;const le=B.key.startsWith("Arrow"),fe=Of(B.key,W(),h),xe=Sn(B.key,b),Se=(g?fe:xe)||B.key==="Enter"||B.key.trim()==="";if(E&&oe)return ie(B);if(!(!oe&&!w&&le)){if(Se){const ze=Sn(B.key,W());U.current=g&&ze?null:B.key}if(g){fe&&(He(B),oe?(V.current=rr(i,de.current),H(B)):n.setOpen(!0,ve(Tn,B.nativeEvent,B.currentTarget)));return}xe&&(Q.current!=null&&(V.current=Q.current),He(B),!oe&&w?n.setOpen(!0,ve(Tn,B.nativeEvent,B.currentTarget)):ie(B),oe&&H(B))}},onFocus(B){n.select("open")&&!E&&(V.current=-1,H(B))},onPointerDown:$,onPointerEnter:$,onMouseDown:Y,onClick:Y}},[ie,de,y,i,g,H,n,w,b,W,h,Q,E]),ae=f.useMemo(()=>({...re,...K}),[re,K]);return f.useMemo(()=>d?{reference:ae,floating:he,item:z,trigger:K}:{},[d,ae,he,K,z])}const Mf=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Oi(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),c=n.useState("floatingElement"),{enabled:i=!0,role:u="dialog"}=t,a=gt(),d=s?.id||a,l=f.useMemo(()=>Pn(c)?.id||o,[c,o]),p=Mf.get(u)??u,g=ht()!=null,h=f.useMemo(()=>p==="tooltip"||u==="label"?ke:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&g&&{role:"menuitem"},...u==="select"&&{"aria-autocomplete":"none"},...u==="combobox"&&{"aria-autocomplete":"list"}},[p,g,u]),E=f.useMemo(()=>p==="tooltip"||u==="label"?{[`aria-${u==="label"?"labelledby":"describedby"}`]:r?l:void 0}:{...h,"aria-expanded":r?"true":"false","aria-controls":r?l:void 0,...p==="menu"&&{id:d}},[p,l,r,d,u,h]),y=f.useMemo(()=>{const w={id:l,...p&&{role:p}};return p==="tooltip"||u==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":d}}},[p,l,d,u]),v=f.useCallback(({active:w,selected:x})=>{const b={role:"option",...w&&{id:`${l}-fui-option`}};switch(u){case"select":case"combobox":return{...b,"aria-selected":x}}return{}},[l,u]);return f.useMemo(()=>i?{reference:E,floating:y,item:v,trigger:h}:{},[i,E,y,h,v])}function If(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.context.dataRef,{listRef:s,activeIndex:c,onMatch:i,onTypingChange:u,enabled:a=!0,findMatch:d=null,resetMs:l=750,ignoreKeys:p=jn,selectedIndex:m=null}=t,g=tt(),h=f.useRef(""),E=f.useRef(m??c??-1),y=f.useRef(null);J(()=>{r&&(g.clear(),y.current=null,h.current="")},[r,g]),J(()=>{r&&h.current===""&&(E.current=m??c??-1)},[r,m,c]);const v=X(R=>{R?o.current.typing||(o.current.typing=R,u?.(R)):o.current.typing&&(o.current.typing=R,u?.(R))}),w=X(R=>{function C(I,S,D){const M=d?d(S,D):S.find(P=>P?.toLocaleLowerCase().indexOf(D.toLocaleLowerCase())===0);return M?I.indexOf(M):-1}const N=s.current;if(h.current.length>0&&h.current[0]!==" "&&(C(N,N,h.current)===-1?v(!1):R.key===" "&&He(R)),N==null||p.includes(R.key)||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;r&&R.key!==" "&&(He(R),v(!0)),N.every(I=>I?I[0]?.toLocaleLowerCase()!==I[1]?.toLocaleLowerCase():!0)&&h.current===R.key&&(h.current="",E.current=y.current),h.current+=R.key,g.start(l,()=>{h.current="",E.current=y.current,v(!1)});const L=E.current,j=C(N,[...N.slice((L||0)+1),...N.slice(0,(L||0)+1)],h.current);j!==-1?(i?.(j),y.current=j):R.key!==" "&&(h.current="",v(!1))}),x=f.useMemo(()=>({onKeyDown:w}),[w]),b=f.useMemo(()=>({onKeyDown:w,onKeyUp(R){R.key===" "&&v(!1)}}),[w,v]);return f.useMemo(()=>a?{reference:x,floating:b}:{},[a,x,b])}function as(e,t){const[n,r]=e;let o=!1;const s=t.length;for(let c=0,i=s-1;c<s;i=c++){const[u,a]=t[c]||[0,0],[d,l]=t[i]||[0,0];a>=r!=l>=r&&n<=(d-u)*(r-a)/(l-a)+u&&(o=!o)}return o}function Pf(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Df(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o=new pt;let s=!1,c=null,i=null,u=typeof performance<"u"?performance.now():0;function a(l,p){const m=performance.now(),g=m-u;if(c===null||i===null||g===0)return c=l,i=p,u=m,null;const h=l-c,E=p-i,v=Math.sqrt(h*h+E*E)/g;return c=l,i=p,u=m,v}const d=({x:l,y:p,placement:m,elements:g,onClose:h,nodeId:E,tree:y})=>function(w){function x(){o.clear(),h()}if(o.clear(),!g.domReference||!g.floating||m==null||l==null||p==null)return;const{clientX:b,clientY:R}=w,C=[b,R],N=Le(w),_=w.type==="mouseleave",L=me(g.floating,N),j=me(g.domReference,N),I=g.domReference.getBoundingClientRect(),S=g.floating.getBoundingClientRect(),D=m.split("-")[0],M=l>S.right-S.width/2,P=p>S.bottom-S.height/2,k=Pf(C,I),O=S.width>I.width,F=S.height>I.height,V=(O?I:S).left,U=(O?I:S).right,ee=(F?I:S).top,H=(F?I:S).bottom;if(L&&(s=!0,!_))return;if(j&&(s=!1),j&&!_){s=!0;return}if(_&&we(w.relatedTarget)&&me(g.floating,w.relatedTarget)||y&&It(y.nodesRef.current,E).some(({context:te})=>te?.open))return;if(D==="top"&&p>=I.bottom-1||D==="bottom"&&p<=I.top+1||D==="left"&&l>=I.right-1||D==="right"&&l<=I.left+1)return x();let ue=[];switch(D){case"top":ue=[[V,I.top+1],[V,S.bottom-1],[U,S.bottom-1],[U,I.top+1]];break;case"bottom":ue=[[V,S.top+1],[V,I.bottom-1],[U,I.bottom-1],[U,S.top+1]];break;case"left":ue=[[S.right-1,H],[S.right-1,ee],[I.left+1,ee],[I.left+1,H]];break;case"right":ue=[[I.right-1,H],[I.right-1,ee],[S.left+1,ee],[S.left+1,H]];break}function ge([te,G]){switch(D){case"top":{const q=[O?te+t/2:M?te+t*4:te-t*4,G+t+1],de=[O?te-t/2:M?te+t*4:te-t*4,G+t+1],ne=[[S.left,M||O?S.bottom-t:S.top],[S.right,M?O?S.bottom-t:S.top:S.bottom-t]];return[q,de,...ne]}case"bottom":{const q=[O?te+t/2:M?te+t*4:te-t*4,G-t],de=[O?te-t/2:M?te+t*4:te-t*4,G-t],ne=[[S.left,M||O?S.top+t:S.bottom],[S.right,M?O?S.top+t:S.bottom:S.top+t]];return[q,de,...ne]}case"left":{const q=[te+t+1,F?G+t/2:P?G+t*4:G-t*4],de=[te+t+1,F?G-t/2:P?G+t*4:G-t*4];return[...[[P||F?S.right-t:S.left,S.top],[P?F?S.right-t:S.left:S.right-t,S.bottom]],q,de]}case"right":{const q=[te-t,F?G+t/2:P?G+t*4:G-t*4],de=[te-t,F?G-t/2:P?G+t*4:G-t*4],ne=[[P||F?S.left+t:S.right,S.top],[P?F?S.left+t:S.right:S.left+t,S.bottom]];return[q,de,...ne]}default:return[]}}if(!as([b,R],ue)){if(s&&!k)return x();if(!_&&r){const te=a(w.clientX,w.clientY);if(te!==null&&te<.1)return x()}as([b,R],ge([l,p]))?!s&&r&&o.start(40,x):x()}};return d.__options={blockPointerEvents:n},d}const Ti=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ti.displayName="DirectionContext");function Ni(){return f.useContext(Ti)?.direction??"ltr"}const _f=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:c,elements:i,middlewareData:u}=t,{element:a,padding:d=0,offsetParent:l="real"}=mt(e,t)||{};if(a==null)return{};const p=Ps(d),m={x:n,y:r},g=Ur(o),h=Hr(g),E=await c.getDimensions(a),y=g==="y",v=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",b=s.reference[h]+s.reference[g]-m[g]-s.floating[h],R=m[g]-s.reference[g],C=l==="real"?await c.getOffsetParent?.(a):i.floating;let N=i.floating[x]||s.floating[h];(!N||!await c.isElement?.(C))&&(N=i.floating[x]||s.floating[h]);const _=b/2-R/2,L=N/2-E[h]/2-1,j=Math.min(p[v],L),I=Math.min(p[w],L),S=j,D=N-E[h]-I,M=N/2-E[h]/2+_,P=wr(S,M,D),k=!u.arrow&&St(o)!=null&&M!==P&&s.reference[h]/2-(M<S?j:I)-E[h]/2<0,O=k?M<S?M-S:M-D:0;return{[g]:m[g]+O,data:{[g]:P,centerOffset:M-P-O,...k&&{alignmentOffset:O}},reset:k}}}),kf=(e,t)=>({..._f(e),options:[e,t]}),Af={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Pu().fn(e)).data?.referenceHidden||s}}}},Lf={sideX:"left",sideY:"top"};function Mi(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function ls(e,t,n){const{rects:r,placement:o}=e;return{side:Mi(t,Ze(o),n),align:St(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ff(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:c=0,collisionBoundary:i,collisionPadding:u=5,sticky:a=!1,arrowPadding:d=5,disableAnchorTracking:l=!1,keepMounted:p=!1,floatingRootContext:m,mounted:g,collisionAvoidance:h,shiftCrossAxis:E=!1,nodeId:y,adaptiveOrigin:v,lazyFlip:w=!1,externalTree:x}=e,[b,R]=f.useState(null);!g&&b!==null&&R(null);const C=h.side||"flip",N=h.align||"flip",_=h.fallbackAxisSide||"end",L=typeof t=="function"?t:void 0,j=X(L),I=L?j:t,S=je(t),M=Ni()==="rtl",P=b||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":M?"left":"right","inline-start":M?"right":"left"}[r],k=s==="center"?P:`${P}-${s}`;let O=u;const F=1,V=r==="bottom"?F:0,U=r==="top"?F:0,ee=r==="right"?F:0,H=r==="left"?F:0;typeof O=="number"?O={top:O+V,right:O+H,bottom:O+U,left:O+ee}:O&&(O={top:(O.top||0)+V,right:(O.right||0)+H,bottom:(O.bottom||0)+U,left:(O.left||0)+ee});const ue={boundary:i==="clipping-ancestors"?"clippingAncestors":i,padding:O},ge=f.useRef(null),te=je(o),G=je(c),ne=[Ou(Oe=>{const Ne=ls(Oe,r,M),Ke=typeof te.current=="function"?te.current(Ne):te.current,Be=typeof G.current=="function"?G.current(Ne):G.current;return{mainAxis:Ke,crossAxis:Be,alignmentAxis:Be}},[typeof o!="function"?o:0,typeof c!="function"?c:0,M,r])],A=N==="none"&&C!=="shift",Q=!A&&(a||E||C==="shift"),Z=C==="none"?null:Mu({...ue,padding:{top:O.top+F,right:O.right+F,bottom:O.bottom+F,left:O.left+F},mainAxis:!E&&C==="flip",crossAxis:N==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),Re=A?null:Tu(Oe=>{const Ne=Ye(Oe.elements.floating).documentElement;return{...ue,rootBoundary:E?{x:0,y:0,width:Ne.clientWidth,height:Ne.clientHeight}:void 0,mainAxis:N!=="none",crossAxis:Q,limiter:a||E?void 0:Nu(Ke=>{if(!ge.current)return{};const{width:Be,height:ot}=ge.current.getBoundingClientRect(),nt=rt(Ze(Ke.placement)),Tt=nt==="y"?Be:ot,Qn=nt==="y"?O.left+O.right:O.top+O.bottom;return{offset:Tt/2+Qn/2}})}},[ue,a,E,O,N]);C==="shift"||N==="shift"||s==="center"?ne.push(Re,Z):ne.push(Z,Re),ne.push(Iu({...ue,apply({elements:{floating:Oe},rects:{reference:Ne},availableWidth:Ke,availableHeight:Be}){Object.entries({"--available-width":`${Ke}px`,"--available-height":`${Be}px`,"--anchor-width":`${Ne.width}px`,"--anchor-height":`${Ne.height}px`}).forEach(([ot,nt])=>{Oe.style.setProperty(ot,nt)})}}),kf(()=>({element:ge.current||document.createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(Oe){const{elements:Ne,middlewareData:Ke,placement:Be,rects:ot,y:nt}=Oe,Tt=Ze(Be),Qn=rt(Tt),So=ge.current,Lc=Ke.arrow?.x||0,Fc=Ke.arrow?.y||0,Vc=So?.clientWidth||0,jc=So?.clientHeight||0,er=Lc+Vc/2,Co=Fc+jc/2,Bc=Math.abs(Ke.shift?.y||0),$c=ot.reference.height/2,Jt=typeof o=="function"?o(ls(Oe,r,M)):o,Hc=Bc>Jt,Uc={top:`${er}px calc(100% + ${Jt}px)`,bottom:`${er}px ${-Jt}px`,left:`calc(100% + ${Jt}px) ${Co}px`,right:`${-Jt}px ${Co}px`}[Tt],Wc=`${er}px ${ot.reference.y+$c-nt}px`;return Ne.floating.style.setProperty("--transform-origin",Q&&Qn==="y"&&Hc?Wc:Uc),{}}},Af,v),J(()=>{!g&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,m]);const se=f.useMemo(()=>({elementResize:!l&&typeof ResizeObserver<"u",layoutShift:!l&&typeof IntersectionObserver<"u"}),[l]),{refs:z,elements:W,x:ie,y:re,middlewareData:he,update:K,placement:ae,context:Y,isPositioned:$,floatingStyles:B}=hf({rootContext:m,placement:k,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...Oe)=>Xo(...Oe,se),nodeId:y,externalTree:x}),{sideX:oe,sideY:le}=he.adaptiveOrigin||Lf,fe=$?n:"fixed",xe=f.useMemo(()=>v?{position:fe,[oe]:ie,[le]:re}:{position:fe,...B},[v,fe,oe,ie,le,re,B]),Se=f.useRef(null);J(()=>{if(!g)return;const Oe=S.current,Ne=typeof Oe=="function"?Oe():Oe,Be=(us(Ne)?Ne.current:Ne)||null||null;Be!==Se.current&&(z.setPositionReference(Be),Se.current=Be)},[g,z,I,S]),f.useEffect(()=>{if(!g)return;const Oe=S.current;typeof Oe!="function"&&us(Oe)&&Oe.current!==Se.current&&(z.setPositionReference(Oe.current),Se.current=Oe.current)},[g,z,I,S]),f.useEffect(()=>{if(p&&g&&W.domReference&&W.floating)return Xo(W.domReference,W.floating,K,se)},[p,g,W,K,se]);const ze=Ze(ae),We=Mi(r,ze,M),Me=St(ae)||"center",pe=!!he.hide?.referenceHidden;J(()=>{w&&g&&$&&R(ze)},[w,g,$,ze]);const Ee=f.useMemo(()=>({position:"absolute",top:he.arrow?.y,left:he.arrow?.x}),[he.arrow]),De=he.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:xe,arrowStyles:Ee,arrowRef:ge,arrowUncentered:De,side:We,align:Me,physicalSide:ze,anchorHidden:pe,refs:z,context:Y,isPositioned:$,update:K}),[xe,Ee,ge,De,We,Me,ze,pe,z,Y,$,K])}function us(e){return e!=null&&"current"in e}let it=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Kt.startingStyle]="startingStyle",e[e.endingStyle=Kt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),fs=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Vf={[fs.popupOpen]:"",[fs.pressed]:""},jf={[it.open]:""},Bf={[it.closed]:""},$f={[it.anchorHidden]:""},ds={open(e){return e?Vf:null}},mn={open(e){return e?jf:Bf},anchorHidden(e){return e?$f:null}};function fo(){const e=f.useContext(Gn);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":Fe(73));const{toasts:t,add:n,close:r,update:o,promise:s}=e;return f.useMemo(()=>({toasts:t,add:n,close:r,update:o,promise:s}),[t,n,r,o,s])}const Hf=e=>{const t={size:20,"aria-hidden":!0};switch(e){case"success":return T.jsx(Ue.CheckCircle,{...t});case"warning":return T.jsx(Ue.AlertTriangle,{...t});case"error":return T.jsx(Ue.XCircle,{...t});case"info":default:return T.jsx(Ue.Info,{...t})}},Ii=f.forwardRef(function(t,n){const{toast:r,className:o,style:s}=t,c=r.data??{},i=c.severity??"info",u=c.showIcon??!0,a=c.closable??!0,d=c.icon??(u?Hf(i):null),l=c.action,p=c.onClose,m=fo(),g=f.useCallback(()=>{p?.(),m.close(r.id)},[p,m,r.id]);return T.jsx(Xs,{ref:n,toast:r,className:ye("memori-alert",`memori-alert--${i}`,o),style:s,children:T.jsxs("div",{className:"memori-alert__container",children:[d&&T.jsx("div",{className:"memori-alert__icon","aria-hidden":"true",children:d}),T.jsxs("div",{className:"memori-alert__content",children:[r.title&&T.jsx(Zs,{className:"memori-alert__title",children:r.title}),r.description&&T.jsx(Js,{className:"memori-alert__description",children:r.description})]}),T.jsxs("div",{className:"memori-alert__actions",children:[l&&T.jsx("div",{className:"memori-alert__action",children:l}),a&&T.jsx(ei,{className:"memori-alert__close","aria-label":"Close alert",onClick:g,children:T.jsx(Ue.X,{size:16,"aria-hidden":"true"})})]})]})})}),Uf=f.forwardRef(function(t,n){const{placement:r="top-end",className:o,style:s}=t,c=fo();return T.jsx(Ys,{ref:n,className:ye("memori-alert-viewport",`memori-alert-viewport--${r}`,o),style:s,children:c.toasts.map(i=>T.jsx(Ii,{toast:i},i.id))})}),Wf=({children:e,defaultDuration:t=5e3,limit:n=5})=>T.jsx(Hs,{timeout:t,limit:n,children:e}),Kf=()=>fo(),zf=e=>({title:e.title,description:e.description,timeout:e.duration,data:{severity:e.severity,icon:e.icon,showIcon:e.showIcon,closable:e.closable,action:e.action,onClose:e.onClose}}),Pi=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:c=!1,nativeButton:i=!0,...u}=t,a=!!s,{getButtonProps:d,buttonRef:l}=Xt({disabled:a,focusableWhenDisabled:c,native:i}),p=f.useMemo(()=>({disabled:a}),[a]);return Te("button",t,{state:p,ref:[n,l],props:[u,d]})});process.env.NODE_ENV!=="production"&&(Pi.displayName="Button");const _t=be.forwardRef(({variant:e="primary",size:t="md",fullWidth:n=!1,loading:r=!1,icon:o,iconPosition:s="left",shape:c="default",shadow:i=!1,active:u=!1,danger:a=!1,className:d,children:l,disabled:p,type:m="button",ariaLabel:g,...h},E)=>{const v={primary:"memori-button--primary",secondary:"memori-button--secondary",outline:"memori-button--outline",ghost:"memori-button--ghost",danger:"memori-button--danger"}[a?"danger":e],w={sm:"memori-button--sm",md:"memori-button--md",lg:"memori-button--lg"}[t],x={default:void 0,round:"memori-button--round",circle:"memori-button--circle"}[c],b=p||r,R=r?T.jsx(Ue.Loader2,{className:"memori-button__spinner","aria-hidden":"true"}):o?T.jsx("span",{className:"memori-button__icon",children:o}):null,C=be.Children.count(l)>0;return T.jsxs(Pi,{ref:E,disabled:b,focusableWhenDisabled:r,className:ye("memori-button",v,w,x,n&&"memori-button--full-width",i&&"memori-button--shadow",b&&"memori-button--disabled",r&&"memori-button--loading",u&&"memori-button--active",!C&&R&&"memori-button--icon-only",d),type:m,"aria-label":g,...h,children:[R&&s==="left"&&R,C&&T.jsx("span",{className:"memori-button__content",children:l}),R&&s==="right"&&R]})});_t.displayName="Button";function Di({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=f.useRef(e!==void 0),[s,c]=f.useState(t),i=o?e:s;if(process.env.NODE_ENV!=="production"){f.useEffect(()=>{o!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
43
|
+
`))},[r,n,e]);const{current:a}=f.useRef(t);f.useEffect(()=>{!o&&JSON.stringify(a)!==JSON.stringify(t)&&console.error([`Base UI: A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
|
|
44
|
+
`))},[JSON.stringify(t)])}const u=f.useCallback(a=>{o||c(a)},[]);return[i,u]}function Lt(e){return gt(e,"base-ui")}function Gf(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:o}=e,s=t!==void 0,[c,i]=Di({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:u,setMounted:a,transitionStatus:d}=vi(c,!0,!0),[l,p]=f.useState(c),[{height:m,width:g},h]=f.useState({height:void 0,width:void 0}),E=Lt(),[y,v]=f.useState(),w=y??E,[x,b]=f.useState(!1),[R,C]=f.useState(!1),N=f.useRef(null),_=f.useRef(null),L=f.useRef(null),j=f.useRef(null),I=qs(j,!1),S=X(D=>{const M=!c,P=ve(wt,D.nativeEvent);if(r(M,P),P.isCanceled)return;const k=j.current;_.current==="css-animation"&&k!=null&&k.style.removeProperty("animation-name"),!x&&!R&&(_.current!=null&&_.current!=="css-animation"&&!u&&M&&a(!0),_.current==="css-animation"&&(!l&&M&&p(!0),!u&&M&&a(!0))),i(M),_.current==="none"&&u&&!M&&a(!1)});return J(()=>{s&&_.current==="none"&&!R&&!c&&a(!1)},[s,R,c,t,a]),f.useMemo(()=>({abortControllerRef:N,animationTypeRef:_,disabled:o,handleTrigger:S,height:m,mounted:u,open:c,panelId:w,panelRef:j,runOnceAnimationsFinish:I,setDimensions:h,setHiddenUntilFound:b,setKeepMounted:C,setMounted:a,setOpen:i,setPanelIdState:v,setVisible:p,transitionDimensionRef:L,transitionStatus:d,visible:l,width:g}),[N,_,o,S,m,u,c,w,j,I,h,b,C,a,i,p,L,d,l,g])}const po=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(po.displayName="CollapsibleRootContext");function _i(){const e=f.useContext(po);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.":Fe(15));return e}let sn=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Kt.startingStyle]="startingStyle",e[e.endingStyle=Kt.endingStyle]="endingStyle",e})({}),Yf=(function(e){return e.panelOpen="data-panel-open",e})({});const qf={[sn.open]:""},Xf={[sn.closed]:""},Jf={open(e){return e?{[Yf.panelOpen]:""}:null}},Zf={open(e){return e?qf:Xf}},ki={...Zf,...At},Ai=f.forwardRef(function(t,n){const{render:r,className:o,defaultOpen:s=!1,disabled:c=!1,onOpenChange:i,open:u,...a}=t,d=X(i),l=Gf({open:u,defaultOpen:s,onOpenChange:d,disabled:c}),p=f.useMemo(()=>({open:l.open,disabled:l.disabled,transitionStatus:l.transitionStatus}),[l.open,l.disabled,l.transitionStatus]),m=f.useMemo(()=>({...l,onOpenChange:d,state:p}),[l,d,p]),g=Te("div",t,{state:p,ref:n,props:a,stateAttributesMapping:ki});return T.jsx(po.Provider,{value:m,children:g})});process.env.NODE_ENV!=="production"&&(Ai.displayName="CollapsibleRoot");const Qf={...Jf,...At},Li=f.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:c,disabled:i}=_i(),{className:u,disabled:a=i,id:d,render:l,nativeButton:p=!0,...m}=t,{getButtonProps:g,buttonRef:h}=Xt({disabled:a,focusableWhenDisabled:!0,native:p}),E=f.useMemo(()=>({"aria-controls":o?r:void 0,"aria-expanded":o,disabled:a,onClick:s}),[r,a,o,s]);return Te("button",t,{state:c,ref:[n,h],props:[E,m,g],stateAttributesMapping:Qf})});process.env.NODE_ENV!=="production"&&(Li.displayName="CollapsibleTrigger");let Pr;process.env.NODE_ENV!=="production"&&(Pr=new Set);function Fi(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");Pr.has(t)||(Pr.add(t),console.warn(`Base UI: ${t}`))}}let ed=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function td(e){const{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:o,hiddenUntilFound:s,keepMounted:c,id:i,mounted:u,onOpenChange:a,open:d,panelRef:l,runOnceAnimationsFinish:p,setDimensions:m,setMounted:g,setOpen:h,setVisible:E,transitionDimensionRef:y,visible:v,width:w}=e,x=f.useRef(!1),b=f.useRef(null),R=f.useRef(d),C=f.useRef(d),N=dn(),_=f.useMemo(()=>n.current==="css-animation"?!v:!d&&!u,[d,u,v,n]),L=X(I=>{if(!I)return;if(n.current==null||y.current==null){const M=getComputedStyle(I),P=M.animationName!=="none"&&M.animationName!=="",k=M.transitionDuration!=="0s"&&M.transitionDuration!=="";P&&k?process.env.NODE_ENV!=="production"&&Fi("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.","Only one of either animation type should be used."):M.animationName==="none"&&M.transitionDuration!=="0s"?n.current="css-transition":M.animationName!=="none"&&M.transitionDuration==="0s"?n.current="css-animation":n.current="none",I.getAttribute(ed.orientation)==="horizontal"||M.transitionProperty.indexOf("width")>-1?y.current="width":y.current="height"}if(n.current!=="css-transition")return;(o===void 0||w===void 0)&&(m({height:I.scrollHeight,width:I.scrollWidth}),C.current&&I.style.setProperty("transition-duration","0s"));let S=-1,D=-1;return S=Ie.request(()=>{C.current=!1,D=Ie.request(()=>{setTimeout(()=>{I.style.removeProperty("transition-duration")})})}),()=>{Ie.cancel(S),Ie.cancel(D)}}),j=Pt(r,l,L);return J(()=>{if(n.current!=="css-transition")return;const I=l.current;if(!I)return;let S=-1;if(t.current!=null&&(t.current.abort(),t.current=null),d){const D={"justify-content":I.style.justifyContent,"align-items":I.style.alignItems,"align-content":I.style.alignContent,"justify-items":I.style.justifyItems};Object.keys(D).forEach(M=>{I.style.setProperty(M,"initial","important")}),!C.current&&!c&&I.setAttribute(sn.startingStyle,""),m({height:I.scrollHeight,width:I.scrollWidth}),S=Ie.request(()=>{Object.entries(D).forEach(([M,P])=>{P===""?I.style.removeProperty(M):I.style.setProperty(M,P)})})}else{if(I.scrollHeight===0&&I.scrollWidth===0)return;m({height:I.scrollHeight,width:I.scrollWidth});const D=new AbortController;t.current=D;const M=D.signal;let P=null;const k=sn.endingStyle;return P=new MutationObserver(O=>{O.some(V=>V.type==="attributes"&&V.attributeName===k)&&(P?.disconnect(),P=null,p(()=>{m({height:0,width:0}),I.style.removeProperty("content-visibility"),g(!1),t.current===D&&(t.current=null)},M))}),P.observe(I,{attributes:!0,attributeFilter:[k]}),()=>{P?.disconnect(),N.cancel(),t.current===D&&(D.abort(),t.current=null)}}return()=>{Ie.cancel(S)}},[t,n,N,s,c,u,d,l,p,m,g]),J(()=>{if(n.current!=="css-animation")return;const I=l.current;I&&(b.current=I.style.animationName||b.current,I.style.setProperty("animation-name","none"),m({height:I.scrollHeight,width:I.scrollWidth}),!R.current&&!x.current&&I.style.removeProperty("animation-name"),d?(t.current!=null&&(t.current.abort(),t.current=null),g(!0),E(!0)):(t.current=new AbortController,p(()=>{g(!1),E(!1),t.current=null},t.current.signal)))},[t,n,d,l,p,m,g,E,v]),Vr(()=>{const I=Ie.request(()=>{R.current=!1});return()=>Ie.cancel(I)}),J(()=>{if(!s)return;const I=l.current;if(!I)return;let S=-1,D=-1;return d&&x.current&&(I.style.transitionDuration="0s",m({height:I.scrollHeight,width:I.scrollWidth}),S=Ie.request(()=>{x.current=!1,D=Ie.request(()=>{setTimeout(()=>{I.style.removeProperty("transition-duration")})})})),()=>{Ie.cancel(S),Ie.cancel(D)}},[s,d,l,m]),J(()=>{const I=l.current;I&&s&&_&&(I.setAttribute("hidden","until-found"),n.current==="css-transition"&&I.setAttribute(sn.startingStyle,""))},[s,_,n,l]),f.useEffect(function(){const S=l.current;if(!S)return;function D(M){x.current=!0,h(!0),a(!0,ve(eo,M))}return S.addEventListener("beforematch",D),()=>{S.removeEventListener("beforematch",D)}},[a,l,h]),f.useMemo(()=>({props:{hidden:_,id:i,ref:j}}),[_,i,j])}let ps=(function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e})({});const Vi=f.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:c,id:i,...u}=t;process.env.NODE_ENV!=="production"&&J(()=>{o&&s===!1&&Fi("The `keepMounted={false}` prop on a Collapsible will be ignored when using `hiddenUntilFound` since it requires the Panel to remain mounted even when closed.")},[o,s]);const{abortControllerRef:a,animationTypeRef:d,height:l,mounted:p,onOpenChange:m,open:g,panelId:h,panelRef:E,runOnceAnimationsFinish:y,setDimensions:v,setHiddenUntilFound:w,setKeepMounted:x,setMounted:b,setPanelIdState:R,setOpen:C,setVisible:N,state:_,transitionDimensionRef:L,visible:j,width:I,transitionStatus:S}=_i(),D=o??!1,M=s??!1;J(()=>{if(i)return R(i),()=>{R(void 0)}},[i,R]),J(()=>{w(D)},[w,D]),J(()=>{x(M)},[x,M]);const{props:P}=td({abortControllerRef:a,animationTypeRef:d,externalRef:n,height:l,hiddenUntilFound:D,id:h,keepMounted:M,mounted:p,onOpenChange:m,open:g,panelRef:E,runOnceAnimationsFinish:y,setDimensions:v,setMounted:b,setOpen:C,setVisible:N,transitionDimensionRef:L,visible:j,width:I});pn({open:g&&S==="idle",ref:E,onComplete(){g&&v({height:void 0,width:void 0})}});const k=f.useMemo(()=>({..._,transitionStatus:S}),[_,S]),O=Te("div",t,{state:k,ref:[n,E],props:[P,{style:{[ps.collapsiblePanelHeight]:l===void 0?"auto":`${l}px`,[ps.collapsiblePanelWidth]:I===void 0?"auto":`${I}px`}},u],stateAttributesMapping:ki});return M||D||!M&&p?O:null});process.env.NODE_ENV!=="production"&&(Vi.displayName="CollapsiblePanel");const ji=be.forwardRef(({summary:e,children:t,defaultOpen:n=!1,open:r,onOpenChange:o,disabled:s=!1,className:c,triggerClassName:i,panelClassName:u,style:a,triggerStyle:d,panelStyle:l,keepMounted:p=!1,id:m,"aria-label":g,"aria-labelledby":h,...E},y)=>{const[v,w]=be.useState(n),x=r!==void 0,b=x?r:v,R=be.useCallback(L=>{x||w(L),o?.(L)},[x,o]),C=be.useId(),N=m||`collapsible-trigger-${C}`,_=`collapsible-panel-${C}`;return T.jsxs(Ai,{ref:y,defaultOpen:n,open:x?r:void 0,onOpenChange:R,disabled:s,className:ye("memori-collapsible",c),style:a,id:m,...E,children:[T.jsxs(Li,{id:N,"aria-label":g,"aria-labelledby":h,"aria-expanded":b,"aria-controls":_,className:ye("memori-collapsible__trigger",i),style:d,children:[T.jsx("span",{className:"memori-collapsible__summary",children:e}),T.jsx(Ue.ChevronDown,{className:ye("memori-collapsible__icon",{"memori-collapsible__icon--open":b}),"aria-hidden":"true"})]}),T.jsx(Vi,{id:_,role:"region","aria-labelledby":N,keepMounted:p,className:ye("memori-collapsible__panel",u),style:l,children:t})]})});ji.displayName="Collapsible";const Jn=be.forwardRef(({spinning:e=!1,primary:t=!1,children:n,className:r,spinnerClassName:o,style:s,spinnerStyle:c,size:i="default",indicator:u,tip:a,...d},l)=>{const p=u||T.jsx(Ue.Loader2,{className:ye("memori-spin__icon",{"memori-spin__icon--primary":t,"memori-spin__icon--sm":i==="sm","memori-spin__icon--md":i==="md","memori-spin__icon--lg":i==="lg"}),"aria-hidden":"true"});return T.jsxs("div",{ref:l,className:ye("memori-spin",{"memori-spin--spinning":e,"memori-spin--primary":t},r),style:s,...d,children:[n,e&&T.jsx("div",{className:ye("memori-spin__overlay",o),style:c,role:"status","aria-live":"polite","aria-label":"Loading",children:T.jsxs("div",{className:"memori-spin__container",children:[p,a&&T.jsx("div",{className:"memori-spin__tip",children:a})]})})]})});Jn.displayName="Spin";const Bi=be.forwardRef(({children:e,className:t,style:n,variant:r="elevated",padding:o="md",component:s="div",focusable:c,onClick:i,title:u,description:a,cover:d,loading:l=!1,hoverable:p=!1,...m},g)=>{const h=!!i||c===!0||p===!0,E=h||c?0:void 0,v=ye("memori-card",r==="elevated"?"memori-card--elevated":r==="flat"?"memori-card--flat":"memori-card--outlined",h&&"memori-card--interactive",t),w=ye("memori-card__body",`memori-card__body--padding-${o}`);return T.jsxs(s,{ref:g,className:v,style:n,tabIndex:E,onClick:i,...m,children:[d&&T.jsx("div",{className:"memori-card__cover",children:d}),T.jsx("div",{className:w,children:T.jsxs(Jn,{spinning:l,children:[(u||a)&&T.jsxs("div",{className:"memori-card__header",children:[u&&T.jsx("div",{className:"memori-card__title",children:u}),a&&T.jsx("div",{className:"memori-card__description",children:a})]}),e]})})]})});Bi.displayName="Card";const $i=f.forwardRef(({checked:e,defaultChecked:t,indeterminate:n=!1,disabled:r=!1,required:o=!1,name:s,value:c,label:i,onChange:u,className:a,style:d,id:l,"aria-label":p,"aria-describedby":m,"aria-labelledby":g},h)=>{const E=v=>{u?.(v,{target:{checked:v},currentTarget:{checked:v}})},y=n?!1:e;return T.jsxs(Ve.Checkbox.Root,{checked:y,defaultChecked:t,disabled:r,required:o,name:s,value:c,onCheckedChange:E,className:ye("memori-checkbox",r&&"memori-checkbox--disabled",a),style:d,id:l,"aria-label":p,"aria-describedby":m,"aria-labelledby":g,ref:h,children:[T.jsx("span",{className:ye("memori-checkbox__indicator",e&&!n&&"memori-checkbox__indicator--checked",n&&"memori-checkbox__indicator--indeterminate"),children:T.jsx(Ve.Checkbox.Indicator,{className:"memori-checkbox__icon-wrapper",children:n?T.jsx(Ue.Minus,{className:"memori-checkbox__icon",size:14,strokeWidth:3}):T.jsx(Ue.Check,{className:"memori-checkbox__icon",size:14,strokeWidth:3})})}),i&&T.jsx("span",{className:"memori-checkbox__label",children:i})]})});$i.displayName="Checkbox";const mo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(mo.displayName="DialogRootContext");function Ot(e){const t=f.useContext(mo);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":Fe(27));return t}const nd={...mn,...At},Hi=f.forwardRef(function(t,n){const{render:r,className:o,forceRender:s=!1,...c}=t,{store:i}=Ot(),u=i.useState("open"),a=i.useState("nested"),d=i.useState("mounted"),l=i.useState("transitionStatus"),p=f.useMemo(()=>({open:u,transitionStatus:l}),[u,l]);return Te("div",t,{state:p,ref:[i.context.backdropRef,n],stateAttributesMapping:nd,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:s||!a})});process.env.NODE_ENV!=="production"&&(Hi.displayName="DialogBackdrop");const Ui=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:c=!0,...i}=t,{store:u}=Ot(),a=u.useState("open");function d(g){a&&u.setOpen(!1,ve(kl,g.nativeEvent))}const{getButtonProps:l,buttonRef:p}=Xt({disabled:s,native:c}),m=f.useMemo(()=>({disabled:s}),[s]);return Te("button",t,{state:m,ref:[n,p],props:[{onClick:d},i,l]})});process.env.NODE_ENV!=="production"&&(Ui.displayName="DialogClose");const Wi=f.forwardRef(function(t,n){const{render:r,className:o,id:s,...c}=t,{store:i}=Ot(),u=Lt(s);return i.useSyncedValueWithCleanup("descriptionElementId",u),Te("p",t,{ref:n,props:[{id:u},c]})});process.env.NODE_ENV!=="production"&&(Wi.displayName="DialogDescription");let rd=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),od=(function(e){return e[e.open=it.open]="open",e[e.closed=it.closed]="closed",e[e.startingStyle=it.startingStyle]="startingStyle",e[e.endingStyle=it.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const go=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(go.displayName="DialogPortalContext");function Ki(){const e=f.useContext(go);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":Fe(26));return e}const zi="ArrowUp",Gi="ArrowDown",Yi="ArrowLeft",qi="ArrowRight",Xi="Home",Ji="End",sd=new Set([Yi,qi]),id=new Set([zi,Gi]),cd=new Set([...sd,...id]);[...cd];const Zi=new Set([zi,Gi,Yi,qi,Xi,Ji]),ad={...mn,...At,nestedDialogOpen(e){return e?{[od.nestedDialogOpen]:""}:null}},Qi=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:c,...i}=t,{store:u}=Ot(),a=u.useState("descriptionElementId"),d=u.useState("disablePointerDismissal"),l=u.useState("floatingRootContext"),p=u.useState("popupProps"),m=u.useState("modal"),g=u.useState("mounted"),h=u.useState("nested"),E=u.useState("nestedOpenDialogCount"),y=u.useState("open"),v=u.useState("openMethod"),w=u.useState("titleElementId"),x=u.useState("transitionStatus"),b=u.useState("role");Ki(),pn({open:y,ref:u.context.popupRef,onComplete(){y&&u.context.onOpenChangeComplete?.(!0)}});function R(j){return j==="touch"?u.context.popupRef.current:!0}const C=s===void 0?R:s,N=E>0,_=f.useMemo(()=>({open:y,nested:h,transitionStatus:x,nestedDialogOpen:N}),[y,h,x,N]),L=Te("div",t,{state:_,props:[p,{"aria-labelledby":w??void 0,"aria-describedby":a??void 0,role:b,tabIndex:-1,hidden:!g,onKeyDown(j){Zi.has(j.key)&&j.stopPropagation()},style:{[rd.nestedDialogs]:E}},i],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:ad});return T.jsx(ci,{context:l,openInteractionType:v,disabled:!g,closeOnFocusOut:!d,initialFocus:C,returnFocus:o,modal:m!==!1,restoreFocus:"popup",children:L})});process.env.NODE_ENV!=="production"&&(Qi.displayName="DialogPopup");const ho=f.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const c=r?.getBoundingClientRect();s=`polygon(
|
|
45
45
|
0% 0%,
|
|
46
46
|
100% 0%,
|
|
47
47
|
100% 100%,
|
|
@@ -52,6 +52,6 @@ Avoid returning a new reference inside your input selector, e.g.
|
|
|
52
52
|
${c.right}px ${c.bottom}px,
|
|
53
53
|
${c.right}px ${c.top}px,
|
|
54
54
|
${c.left}px ${c.top}px
|
|
55
|
-
)`}return T.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(go.displayName="InternalBackdrop");const Qi=l.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Ot(),c=s.useState("mounted"),i=s.useState("modal");return c||r?T.jsx(mo.Provider,{value:r,children:T.jsxs(ro,{ref:n,...o,children:[c&&i===!0&&T.jsx(go,{ref:s.context.internalBackdropRef,inert:Gr(!open)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(Qi.displayName="DialogPortal");let ps={},ms={},gs="";function ld(e){if(typeof document>"u")return!1;const t=Ye(e);return Ae(t).innerWidth-t.documentElement.clientWidth>0}function ud(e){const t=Ye(e),n=t.documentElement,r=t.body,o=_t(n)?n:r,s=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=s}}function fd(e){const t=Ye(e),n=t.documentElement,r=t.body,o=Ae(n);let s=0,c=0;const i=Ie.create(),u=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(la&&(o.visualViewport?.scale??1)!==1)return()=>{};function a(){const p=o.getComputedStyle(n),m=o.getComputedStyle(r),x=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,c=n.scrollLeft,ps={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},gs=n.style.scrollBehavior,ms={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const y=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,w=p.overflowY==="scroll"||m.overflowY==="scroll",E=p.overflowX==="scroll"||m.overflowX==="scroll",b=Math.max(0,o.innerWidth-n.clientWidth),R=Math.max(0,o.innerHeight-n.clientHeight),C=parseFloat(m.marginTop)+parseFloat(m.marginBottom),N=parseFloat(m.marginLeft)+parseFloat(m.marginRight),_=_t(n)?n:r;if(u){n.style.scrollbarGutter=x,_.style.overflowY="hidden",_.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:x,overflowY:"hidden",overflowX:"hidden"}),(y||w)&&(n.style.overflowY="scroll"),(v||E)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:C||R?`calc(100dvh - ${C+R}px)`:"100dvh",width:N||b?`calc(100vw - ${N+b}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=c,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,ps),Object.assign(r.style,ms),u||(n.scrollTop=s,n.scrollLeft=c,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=gs)}function f(){d(),i.request(a)}return a(),o.addEventListener("resize",f),()=>{i.cancel(),d(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",f)}}class dd{constructor(){Ce(this,"lockCount",0);Ce(this,"restore",null);Ce(this,"timeoutLock",pt.create());Ce(this,"timeoutUnlock",pt.create());Ce(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Ce(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ye(t).documentElement,o=Ae(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=Xe;return}const s=ua||!ld(t);this.restore=s?ud(t):fd(t)}}const pd=new dd;function ec(e=!0,t=null){J(()=>{if(e)return pd.acquire(t)},[e,t])}function md(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,t.current),t.current=""},[e]),onPointerDown:n}}function tc(e){const[t,n]=l.useState(null),r=X((i,u)=>{e||n(u)}),o=l.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:c}=md(r);return l.useMemo(()=>({openMethod:t,reset:o,triggerProps:{onClick:s,onPointerDown:c}}),[t,o,s,c])}function gd(e){const{store:t,parentContext:n,actionsRef:r}=e,o=t.useState("open"),s=t.useState("disablePointerDismissal"),c=t.useState("modal"),i=t.useState("popupElement"),{openMethod:u,triggerProps:a,reset:d}=tc(o);vi(t);const{forceUnmount:f}=Ei(o,t,()=>{d()}),p=X(L=>{const j=ve(L);return j.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},j}),m=l.useCallback(()=>{t.setOpen(!1,p(ri))},[t,p]);l.useImperativeHandle(r,()=>({unmount:f,close:m}),[f,m]);const g=Ri({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,x]=l.useState(0),y=h===0,v=Ci(g),w=gi(g,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if("button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const j=Le(L);if(y&&!s){const I=j;return c&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===I||t.context.backdropRef.current===I||me(I,i)&&!I?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:y});ec(o&&c===!0,i);const{getReferenceProps:E,getFloatingProps:b,getTriggerProps:R}=lo([v,w]);t.useContextCallback("onNestedDialogOpen",L=>{x(L+1)}),t.useContextCallback("onNestedDialogClose",()=>{x(0)}),l.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,h]);const C=l.useMemo(()=>E(a),[E,a]),N=l.useMemo(()=>R(a),[R,a]),_=l.useMemo(()=>b(),[b]);t.useSyncedValues({openMethod:u,activeTriggerProps:C,inactiveTriggerProps:N,popupProps:_,floatingRootContext:g,nestedOpenDialogCount:h})}const hd={...wi,modal:ce(e=>e.modal),nested:ce(e=>e.nested),nestedOpenDialogCount:ce(e=>e.nestedOpenDialogCount),disablePointerDismissal:ce(e=>e.disablePointerDismissal),openMethod:ce(e=>e.openMethod),descriptionElementId:ce(e=>e.descriptionElementId),titleElementId:ce(e=>e.titleElementId),viewportElement:ce(e=>e.viewportElement),role:ce(e=>e.role)};class bd extends co{constructor(n){super(yd(n),{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),triggerElements:new qn,onOpenChange:void 0,onOpenChangeComplete:void 0},hd);Ce(this,"setOpen",(n,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,r),r.isCanceled)return;const o={open:n,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const s={open:n},c=r.trigger?.id??null;(c||n)&&(s.activeTriggerId=c,s.activeTriggerElement=r.trigger??null),this.update(s)})}}function yd(e={}){return{...xi(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function vd(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:c=!1,modal:i=!0,actionsRef:u,handle:a,triggerId:d,defaultTriggerId:f=null}=e,p=Ot(!0),m=!!p,g=et(()=>a?.store??new bd({open:n??r,activeTriggerId:d!==void 0?d:f,modal:i,disablePointerDismissal:c,nested:m})).current;g.useControlledProp("open",n,r),g.useControlledProp("activeTriggerId",d,f),g.useSyncedValues({disablePointerDismissal:c,nested:m,modal:i}),g.useContextCallback("onOpenChange",o),g.useContextCallback("onOpenChangeComplete",s);const h=g.useState("payload");gd({store:g,actionsRef:u,parentContext:p?.store.context});const x=l.useMemo(()=>({store:g}),[g]);return T.jsx(po.Provider,{value:x,children:typeof t=="function"?t({payload:h}):t})}let hs=(function(e){return e[e.open=it.open]="open",e[e.closed=it.closed]="closed",e[e.startingStyle=it.startingStyle]="startingStyle",e[e.endingStyle=it.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Ed={...mn,...kt,nested(e){return e?{[hs.nested]:""}:null},nestedDialogOpen(e){return e?{[hs.nestedDialogOpen]:""}:null}},nc=l.forwardRef(function(t,n){const{className:r,render:o,children:s,...c}=t,i=Wi(),{store:u}=Ot(),a=u.useState("open"),d=u.useState("nested"),f=u.useState("transitionStatus"),p=u.useState("nestedOpenDialogCount"),m=u.useState("mounted"),g=p>0,h=l.useMemo(()=>({open:a,nested:d,transitionStatus:f,nestedDialogOpen:g}),[a,d,f,g]);return Te("div",t,{enabled:i||m,state:h,ref:[n,u.useStateSetter("viewportElement")],stateAttributesMapping:Ed,props:[{role:"presentation",hidden:!m,children:s},c]})});process.env.NODE_ENV!=="production"&&(nc.displayName="DialogViewport");const rc=l.forwardRef(function(t,n){const{render:r,className:o,id:s,...c}=t,{store:i}=Ot(),u=At(s);return i.useSyncedValueWithCleanup("titleElementId",u),Te("h2",t,{ref:n,props:[{id:u},c]})});process.env.NODE_ENV!=="production"&&(rc.displayName="DialogTitle");const ho=be.forwardRef(({open:e=!1,onOpenChange:t,onClose:n,title:r,description:o,children:s,footer:c,loading:i=!1,closable:u=!0,closeOnOverlayClick:a=!0,closeOnEsc:d=!0,size:f="md",width:p,widthMd:m,widthLg:g,centered:h=!0,modal:x=!0,disablePointerDismissal:y,initialFocus:v,finalFocus:w,onAfterOpen:E,onAfterClose:b,className:R,backdropClassName:C,contentClassName:N,titleClassName:_,descriptionClassName:L,footerClassName:j,style:I,contentStyle:S,id:D,"data-testid":M,"aria-label":P,"aria-labelledby":k,"aria-describedby":O,animated:F=!0,closeButton:V,closeIcon:U,...ee},H)=>{const ue=be.useCallback((ne,A)=>{!ne&&!d&&A?.reason&&(A.reason==="escapeKey"||String(A.reason).includes("escape"))||(t?.(ne),ne||n?.())},[t,n,d]),ge=be.useCallback(ne=>{ne?E?.():b?.()},[E,b]),te=y!==void 0?y:!a,G={...p&&{maxWidth:typeof p=="number"?`${p}px`:p},...m&&{"--memori-modal-width-md":typeof m=="number"?`${m}px`:m},...g&&{"--memori-modal-width-lg":typeof g=="number"?`${g}px`:g},...S},de=ye("memori-modal__popup",f==="sm"?"memori-modal__popup--sm":f==="md"?"memori-modal__popup--md":f==="lg"?"memori-modal__popup--lg":f==="xl"?"memori-modal__popup--xl":f==="full"?"memori-modal__popup--full":void 0,N);return T.jsx(vd,{open:e,onOpenChange:ue,onOpenChangeComplete:ge,modal:x,disablePointerDismissal:te,...ee,children:T.jsxs(Qi,{children:[F&&T.jsx($i,{className:ye("memori-modal__backdrop",C)}),T.jsx(nc,{className:ye("memori-modal__viewport",h&&"memori-modal__viewport--centered",R),children:T.jsxs(Zi,{ref:H,initialFocus:v,finalFocus:w,className:de,style:G,"data-testid":M,"aria-label":r?void 0:P,"aria-labelledby":r?void 0:k,"aria-describedby":o?void 0:O,...m&&{"data-width-md":""},...g&&{"data-width-lg":""},children:[u&&(V?T.jsx("div",{className:"memori-modal__close",children:V}):T.jsx(Hi,{className:"memori-modal__close","aria-label":"Close modal",children:U||T.jsx(Ue.X,{})})),T.jsxs(Jn,{spinning:i,children:[r&&T.jsx(rc,{className:ye("memori-modal__title",_),children:r}),o&&T.jsx(Ui,{className:ye("memori-modal__description",L),children:o}),T.jsx("div",{className:"memori-modal__content",children:s}),c&&T.jsx("div",{className:ye("memori-modal__footer",j),children:c})]})]})})]})})});ho.displayName="Modal";const xd=({isOpen:e,onClose:t,onConfirm:n,title:r,message:o,confirmText:s="Confirm",cancelText:c="Cancel",loading:i=!1})=>{const u=d=>{d||t()},a=T.jsxs(T.Fragment,{children:[T.jsx(Gt,{variant:"outline",onClick:t,disabled:i,children:c}),T.jsx(Gt,{variant:"primary",onClick:n,loading:i,children:s})]});return T.jsx(ho,{open:e,onOpenChange:u,title:r,size:"sm",footer:a,closable:!i,closeOnEsc:!i,closeOnOverlayClick:!i,children:T.jsx("div",{children:o})})},Dr=4e3,_r=300,wd=e=>{let t=e;return e.length>Dr&&(t=`${e.slice(0,Dr)}
|
|
56
|
-
<br />...`),t.split(" ").length>_r&&(t=t.split(" ").slice(0,_r).join(" ")),t},Rd=({rows:e,className:t,innerClassName:n,btnClassName:r,lineHeightMultiplier:o=1.2,defaultExpanded:s=!1,expandSymbol:c=()=>"...",collapseSymbol:i=d=>d==="it"?"Mostra meno":"Show less",children:u,mode:a="rows"})=>{const{i18n:d}=Yc.useTranslation(),f=d.language,p=i(f),m=c(f),[g,h]=be.useState(s),[x,y]=be.useState(!1),[v,w]=be.useState(16),E=be.useRef(null);be.useEffect(()=>{if(E.current){if(a==="rows"){let R=E.current.getBoundingClientRect().height,C=getComputedStyle(E.current),N=C.lineHeight,_=N==="normal"||!N?.length?o*parseInt(C.fontSize,10):parseInt(N,10);w(_),R&&e&&R>e*_&&y(!0)}else if(a==="characters"){const R=E.current.textContent||"";(R.length>Dr||R.split(" ").length>_r)&&y(!0)}}},[e,a,E.current]);const b=()=>{if(a==="characters"&&!g&&x){const R=E.current?.textContent||"";return wd(R)}return u};return T.jsxs("div",{className:ye("memori-expandable",t),children:[T.jsx("div",{ref:E,className:ye("memori-expandable__inner",n),style:{maxHeight:g||!x||a==="characters"?"9999px":`${v*(e||1)}px`},children:b()}),x&&!g&&T.jsx(Gt,{variant:"ghost",className:r,onClick:()=>h(!0),children:m}),x&&g&&T.jsx(Gt,{variant:"ghost",className:r,onClick:()=>h(!1),children:p})]})},bo=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(bo.displayName="MenuPositionerContext");function oc(e){const t=l.useContext(bo);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.":Fe(33));return t}const yo=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(yo.displayName="MenuRootContext");function Lt(e){const t=l.useContext(yo);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.":Fe(36));return t}const sc=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(sc.displayName="ContextMenuRootContext");function Zn(e=!0){const t=l.useContext(sc);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.":Fe(25));return t}const Sd={type:"regular-item"};function Cd(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:o,store:s,nativeButton:c,itemMetadata:i,nodeId:u}=e,a=l.useRef(null),d=Zn(!0),f=d!==void 0,{events:p}=s.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:g}=Xt({disabled:n,focusableWhenDisabled:!0,native:c}),h=l.useCallback(y=>cn({id:o,role:"menuitem",tabIndex:r?0:-1,onMouseMove(v){u&&p.emit("itemhover",{nodeId:u,target:v.currentTarget})},onMouseEnter(){i.type==="submenu-trigger"&&i.setActive()},onKeyUp(v){v.key===" "&&s.context.typingRef.current&&v.preventBaseUIHandler()},onClick(v){t&&p.emit("close",{domEvent:v,reason:ni})},onMouseUp(v){if(d){const w=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&w&&Math.abs(v.clientX-w.x)<=1&&Math.abs(v.clientY-w.y)<=1)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!f||v.button===2)&&i.type==="regular-item"&&a.current.click()}},y,m),[o,r,m,t,p,s,f,d,i,u]),x=Pt(a,g);return l.useMemo(()=>({getItemProps:h,itemRef:x}),[h,x])}const vo=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&(vo.displayName="CompositeListContext");function Od(){return l.useContext(vo)}let Td=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ic(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:c,unregister:i,subscribeMapChange:u,elementsRef:a,labelsRef:d,nextIndexRef:f}=Od(),p=l.useRef(-1),[m,g]=l.useState(s??(o===Td.GuessFromOrder?()=>{if(p.current===-1){const y=f.current;f.current+=1,p.current=y}return p.current}:-1)),h=l.useRef(null),x=l.useCallback(y=>{if(h.current=y,m!==-1&&y!==null&&(a.current[m]=y,d)){const v=t!==void 0;d.current[m]=v?t:r?.current?.textContent??y.textContent}},[m,a,d,t,r]);return J(()=>{if(s!=null)return;const y=h.current;if(y)return c(y,n),()=>{i(y)}},[s,c,i,n]),J(()=>{if(s==null)return u(y=>{const v=h.current?y.get(h.current)?.index:null;v!=null&&g(v)})},[s,u,g]),l.useMemo(()=>({ref:x,index:m}),[m,x])}const Eo=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(Eo.displayName="MenuGroupContext");function Nd(){const e=l.useContext(Eo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>.":Fe(31));return e}const cc=l.forwardRef(function(t,n){const{render:r,className:o,...s}=t,[c,i]=l.useState(void 0),u=l.useMemo(()=>({setLabelId:i}),[i]),a=Te("div",t,{ref:n,props:{role:"group","aria-labelledby":c,...s}});return T.jsx(Eo.Provider,{value:u,children:a})});process.env.NODE_ENV!=="production"&&(cc.displayName="MenuGroup");const ac=l.forwardRef(function(t,n){const{className:r,render:o,id:s,...c}=t,i=At(s),{setLabelId:u}=Nd();return J(()=>(u(i),()=>{u(void 0)}),[u,i]),Te("div",t,{ref:n,props:{id:i,role:"presentation",...c}})});process.env.NODE_ENV!=="production"&&(ac.displayName="MenuGroupLabel");const lc=l.forwardRef(function(t,n){const{render:r,className:o,id:s,label:c,nativeButton:i=!1,disabled:u=!1,closeOnClick:a=!0,...d}=t,f=ic({label:c}),p=oc(!0),m=At(s),{store:g}=Lt(),h=g.useState("isActive",f.index),x=g.useState("itemProps"),{getItemProps:y,itemRef:v}=Cd({closeOnClick:a,disabled:u,highlighted:h,id:m,store:g,nativeButton:i,nodeId:p?.nodeId,itemMetadata:Sd}),w=l.useMemo(()=>({disabled:u,highlighted:h}),[u,h]);return Te("div",t,{state:w,props:[x,d,y],ref:[v,n,f.ref]})});process.env.NODE_ENV!=="production"&&(lc.displayName="MenuItem");const uc=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(uc.displayName="ToolbarRootContext");function Md(e){return l.useContext(uc)}function Id(e){return e==="starting"?fl:ke}const Pd={...mn,...kt},fc=l.forwardRef(function(t,n){const{render:r,className:o,finalFocus:s,...c}=t,{store:i}=Lt(),{side:u,align:a}=oc(),d=Md()!=null,f=i.useState("open"),p=i.useState("transitionStatus"),m=i.useState("popupProps"),g=i.useState("mounted"),h=i.useState("instantType"),x=i.useState("activeTriggerElement"),y=i.useState("parent"),v=i.useState("lastOpenChangeReason"),w=i.useState("rootId"),E=i.useState("floatingRootContext"),b=i.useState("floatingTreeRoot"),R=i.useState("closeDelay"),C=i.useState("activeTriggerElement");pn({open:f,ref:i.context.popupRef,onComplete(){f&&i.context.onOpenChangeComplete?.(!0)}}),l.useEffect(()=>{function S(D){i.setOpen(!1,ve(D.reason,D.domEvent))}return b.events.on("close",S),()=>{b.events.off("close",S)}},[b.events,i]);const N=i.useState("hoverEnabled"),_=i.useState("disabled");xf(E,{enabled:N&&!_&&y.type!=="context-menu"&&y.type!=="menubar",closeDelay:R});const L=l.useMemo(()=>({transitionStatus:p,side:u,align:a,open:f,nested:y.type==="menu",instant:h}),[p,u,a,f,y.type,h]),j=Te("div",t,{state:L,ref:[n,i.context.popupRef],stateAttributesMapping:Pd,props:[m,{onKeyDown(S){d&&Ji.has(S.key)&&S.stopPropagation()}},Id(p),c,{"data-rootownerid":w}]});let I=y.type===void 0||y.type==="context-menu";return(x||y.type==="menubar"&&v!==eo)&&(I=!0),T.jsx(ii,{context:E,modal:!1,disabled:!g,returnFocus:s===void 0?I:s,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?b:void 0,previousFocusableElement:C,nextFocusableElement:y.type===void 0?i.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?i.context.beforeContentFocusGuardRef:void 0,children:j})});process.env.NODE_ENV!=="production"&&(fc.displayName="MenuPopup");const xo=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(xo.displayName="MenuPortalContext");function Dd(){const e=l.useContext(xo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Menu.Portal> is missing.":Fe(32));return e}const dc=l.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Lt();return s.useState("mounted")||r?T.jsx(xo.Provider,{value:r,children:T.jsx(ro,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(dc.displayName="MenuPortal");function _d(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=X(o),c=l.useRef(0),i=et(Ad).current,u=et(kd).current,[a,d]=l.useState(0),f=l.useRef(a),p=X((y,v)=>{u.set(y,v??null),f.current+=1,d(f.current)}),m=X(y=>{u.delete(y),f.current+=1,d(f.current)}),g=l.useMemo(()=>{const y=new Map;return Array.from(u.keys()).filter(w=>w.isConnected).sort(Ld).forEach((w,E)=>{const b=u.get(w)??{};y.set(w,{...b,index:E})}),y},[u,a]);J(()=>{if(typeof MutationObserver!="function"||g.size===0)return;const y=new MutationObserver(v=>{const w=new Set,E=b=>w.has(b)?w.delete(b):w.add(b);v.forEach(b=>{b.removedNodes.forEach(E),b.addedNodes.forEach(E)}),w.size===0&&(f.current+=1,d(f.current))});return g.forEach((v,w)=>{w.parentElement&&y.observe(w.parentElement,{childList:!0})}),()=>{y.disconnect()}},[g]),J(()=>{f.current===a&&(n.current.length!==g.size&&(n.current.length=g.size),r&&r.current.length!==g.size&&(r.current.length=g.size),c.current=g.size),s(g)},[s,g,n,r,a]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const h=X(y=>(i.add(y),()=>{i.delete(y)}));J(()=>{i.forEach(y=>y(g))},[i,g]);const x=l.useMemo(()=>({register:p,unregister:m,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:c}),[p,m,h,n,r,c]);return T.jsx(vo.Provider,{value:x,children:t})}function kd(){return new Map}function Ad(){return new Set}function Ld(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const pc=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:c,side:i,align:u,sideOffset:a=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:x=pl,...y}=t,{store:v}=Lt(),w=Dd(),E=Zn(!0),b=v.useState("parent"),R=v.useState("floatingRootContext"),C=v.useState("floatingTreeRoot"),N=v.useState("mounted"),_=v.useState("open"),L=v.useState("modal"),j=v.useState("activeTriggerElement"),I=v.useState("lastOpenChangeReason"),S=v.useState("floatingNodeId"),D=v.useState("floatingParentNodeId");let M=r,P=a,k=d,O=u,F=x;b.type==="context-menu"&&(M=r??b.context?.anchor,O=O??"start",!i&&O!=="center"&&(k=t.alignOffset??2,P=t.sideOffset??-5));let V=i,U=O;b.type==="menu"?(V=V??"inline-end",U=U??"start",F=t.collisionAvoidance??ml):b.type==="menubar"&&(V=V??"bottom",U=U??"start");const ee=b.type==="context-menu",H=Ff({anchor:M,floatingRootContext:R,positionMethod:E?"fixed":o,mounted:N,side:V,sideOffset:P,align:U,alignOffset:k,arrowPadding:ee?0:m,collisionBoundary:f,collisionPadding:p,sticky:g,nodeId:S,keepMounted:w,disableAnchorTracking:h,collisionAvoidance:F,shiftCrossAxis:ee,externalTree:C}),ue=l.useMemo(()=>{const ne={};return _||(ne.pointerEvents="none"),{role:"presentation",hidden:!N,style:{...H.positionerStyles,...ne}}},[_,N,H.positionerStyles]);l.useEffect(()=>{function ne(A){A.open?(A.parentNodeId===S&&v.set("hoverEnabled",!1),A.nodeId!==S&&A.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,ve(en))):A.parentNodeId===S&&A.reason!==en&&v.set("hoverEnabled",!0)}return C.events.on("menuopenchange",ne),()=>{C.events.off("menuopenchange",ne)}},[v,C.events,S]),l.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ne(A){if(A.open||A.nodeId!==v.select("floatingParentNodeId"))return;const Q=A.reason??en;v.setOpen(!1,ve(Q))}return C.events.on("menuopenchange",ne),()=>{C.events.off("menuopenchange",ne)}},[C.events,v]),l.useEffect(()=>{function ne(A){!_||A.nodeId!==v.select("floatingParentNodeId")||A.target&&j&&j!==A.target&&v.setOpen(!1,ve(en))}return C.events.on("itemhover",ne),()=>{C.events.off("itemhover",ne)}},[C.events,_,j,v]),l.useEffect(()=>{const ne={open:_,nodeId:S,parentNodeId:D,reason:v.select("lastOpenChangeReason")};C.events.emit("menuopenchange",ne)},[C.events,_,v,S,D]);const ge=l.useMemo(()=>({open:_,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:b.type==="menu"}),[_,H.side,H.align,H.anchorHidden,b.type]),te=l.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,nodeId:H.context.nodeId}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.context.nodeId]),G=Te("div",t,{state:ge,stateAttributesMapping:mn,ref:[n,v.useStateSetter("positionerElement")],props:[ue,y]}),q=N&&b.type!=="menu"&&(b.type!=="menubar"&&L&&I!==Je||b.type==="menubar"&&b.context.modal);let de=null;return b.type==="menubar"?de=b.context.contentElement:b.type===void 0&&(de=j),T.jsxs(bo.Provider,{value:te,children:[q&&T.jsx(go,{ref:b.type==="context-menu"||b.type==="nested-context-menu"?b.context.internalBackdropRef:null,inert:Gr(!_),cutout:de}),T.jsx(Dl,{id:S,children:T.jsx(_d,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:G})})]})});process.env.NODE_ENV!=="production"&&(pc.displayName="MenuPositioner");const mc=l.createContext(null);process.env.NODE_ENV!=="production"&&(mc.displayName="MenubarContext");function gc(e){return l.useContext(mc)}const Fd={...wi,disabled:ce(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ce(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ce(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ce(e=>e.stickIfOpen),parent:ce(e=>e.parent),rootId:ce(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ce(e=>e.activeIndex),isActive:ce((e,t)=>e.activeIndex===t),hoverEnabled:ce(e=>e.hoverEnabled),instantType:ce(e=>e.instantType),lastOpenChangeReason:ce(e=>e.openChangeReason),floatingTreeRoot:ce(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ce(e=>e.floatingNodeId),floatingParentNodeId:ce(e=>e.floatingParentNodeId),itemProps:ce(e=>e.itemProps),closeDelay:ce(e=>e.closeDelay),keyboardEventRelay:ce(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class wo extends co{constructor(n){super({...Vd(),...n},{positionerRef:l.createRef(),popupRef:l.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:l.createRef(),beforeContentFocusGuardRef:l.createRef(),onOpenChangeComplete:void 0,triggerElements:new qn},Fd);Ce(this,"unsubscribeParentListener",null);this.observe(ce(r=>r.allowMouseEnter),(r,o)=>{this.state.parent.type==="menu"&&r!==o&&this.state.parent.store.set("allowMouseEnter",r)}),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){this.unsubscribeParentListener=r.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(n,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:n,eventDetails:r})}static useStore(n,r){return et(()=>n??new wo(r)).current}}function Vd(){return{...xi(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Xr,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ke,keyboardEventRelay:void 0,closeDelay:0}}const hc=l.createContext(void 0);process.env.NODE_ENV!=="production"&&(hc.displayName="MenuSubmenuRootContext");function jd(){return l.useContext(hc)}function Bd(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:o,defaultOpen:s=!1,disabled:c=!1,modal:i,loopFocus:u=!0,orientation:a="vertical",actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:g=null,highlightItemOnHover:h=!0}=e,x=Zn(!0),y=Lt(!0),v=gc(),w=jd(),E=l.useMemo(()=>w&&y?{type:"menu",store:y.store}:v?{type:"menubar",context:v}:x&&!y?{type:"context-menu",context:x}:{type:void 0},[x,y,v,w]),b=wo.useStore(p?.store,{parent:E}),R=b.useState("floatingTreeRoot"),C=ti(R),N=ht();J(()=>{x&&!y?b.update({parent:{type:"context-menu",context:x},floatingNodeId:C,floatingParentNodeId:N}):y&&b.update({floatingNodeId:C,floatingParentNodeId:N})},[x,y,C,N,b]),b.useControlledProp("open",n,s),b.useControlledProp("activeTriggerId",m,g),b.useContextCallback("onOpenChangeComplete",o);const _=b.useState("open"),L=b.useState("activeTriggerElement"),j=b.useState("positionerElement"),I=b.useState("hoverEnabled"),S=b.useState("modal"),D=b.useState("disabled"),M=b.useState("lastOpenChangeReason"),P=b.useState("parent"),k=b.useState("activeIndex"),O=b.useState("payload"),F=b.useState("floatingParentNodeId"),V=l.useRef(null),U=F!=null;let ee;process.env.NODE_ENV!=="production"&&P.type!==void 0&&i!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored."),b.useSyncedValues({disabled:c,modal:P.type===void 0?i:void 0,rootId:gt()});const{openMethod:H,triggerProps:ue,reset:ge}=tc(_);vi(b);const{forceUnmount:te}=Ei(_,b,()=>{b.update({allowMouseEnter:!1,stickIfOpen:!0}),ge()}),G=l.useRef(P.type!=="context-menu"),q=tt();l.useEffect(()=>{if(_||(V.current=null),P.type==="context-menu"){if(!_){q.clear(),G.current=!1;return}q.start(500,()=>{G.current=!0})}},[q,_,P.type]),ec(_&&S&&M!==Je&&H!=="touch",j),J(()=>{!_&&!I&&b.set("hoverEnabled",!0)},[_,I,b]);const de=l.useRef(!0),ne=tt(),A=X((pe,Ee)=>{const De=Ee.reason;if(_===pe&&Ee.trigger===L||(Ee.preventUnmountOnClose=()=>{b.set("preventUnmountingOnClose",!0)},!pe&&Ee.trigger==null&&(Ee.trigger=L??void 0),r?.(pe,Ee),Ee.isCanceled))return;const Oe={open:pe,nativeEvent:Ee.event,reason:Ee.reason,nested:U};ee?.emit("openchange",Oe);const Ne=Ee.event;if(pe===!1&&Ne?.type==="click"&&Ne.pointerType==="touch"&&!de.current)return;if(!pe&&k!==null){const nt=b.context.itemDomElements.current[k];queueMicrotask(()=>{nt?.setAttribute("tabindex","-1")})}pe&&De===Bn?(de.current=!1,ne.start(300,()=>{de.current=!0})):(de.current=!0,ne.clear());const Ke=(De===wt||De===ni)&&Ne.detail===0&&Ne?.isTrusted,Be=!pe&&(De===to||De==null);function ot(){const nt={open:pe,openChangeReason:De};V.current=Ee.event??null;const Tt=Ee.trigger?.id??null;(Tt||pe)&&(nt.activeTriggerId=Tt,nt.activeTriggerElement=Ee.trigger??null),b.update(nt)}De===Je?ct.flushSync(ot):ot(),P.type==="menubar"&&(De===Bn||De===Kt||De===Je||De===Tn||De===en)?b.set("instantType","group"):Ke||Be?b.set("instantType",Ke?"click":"dismiss"):b.set("instantType",void 0)}),Q=l.useCallback(pe=>{const Ee=ve(pe);return Ee.preventUnmountOnClose=()=>{b.set("preventUnmountingOnClose",!0)},Ee},[b]),Z=l.useCallback(()=>{b.setOpen(!1,Q(ri))},[b,Q]);l.useImperativeHandle(d,()=>({unmount:te,close:Z}),[te,Z]);let Re;P.type==="context-menu"&&(Re=P.context),l.useImperativeHandle(Re?.positionerRef,()=>j,[j]),l.useImperativeHandle(Re?.actionsRef,()=>({setOpen:A}),[A]);const se=Ri({popupStore:b,onOpenChange:A});ee=se.context.events,l.useEffect(()=>{const pe=({open:Ee,eventDetails:De})=>A(Ee,De);return ee.on("setOpen",pe),()=>{ee?.off("setOpen",pe)}},[ee,A]);const z=gi(se,{enabled:!D,bubbles:f&&P.type==="menu",outsidePress(){return P.type!=="context-menu"||V.current?.type==="contextmenu"?!0:G.current},externalTree:U?R:void 0}),W=Ci(se,{role:"menu"}),ie=Ti(),re=l.useCallback(pe=>{b.select("activeIndex")!==pe&&b.set("activeIndex",pe)},[b]),he=Nf(se,{enabled:!D,listRef:b.context.itemDomElements,activeIndex:k,nested:P.type!==void 0,loopFocus:u,orientation:a,parentOrientation:P.type==="menubar"?P.context.orientation:void 0,rtl:ie==="rtl",disabledIndices:jn,onNavigate:re,openOnArrowKeyDown:P.type!=="context-menu",externalTree:U?R:void 0,focusItemOnHover:h}),K=l.useCallback(pe=>{b.context.typingRef.current=pe},[b]),ae=If(se,{listRef:b.context.itemLabels,activeIndex:k,resetMs:ll,onMatch:pe=>{_&&pe!==k&&b.set("activeIndex",pe)},onTypingChange:K}),{getReferenceProps:Y,getFloatingProps:$,getItemProps:B,getTriggerProps:oe}=lo([z,W,he,ae]),le=l.useMemo(()=>{const pe=cn(Y(),{onMouseEnter(){b.set("hoverEnabled",!0)},onMouseMove(){b.set("allowMouseEnter",!0)}},ue);return delete pe.role,pe},[Y,b,ue]),fe=l.useMemo(()=>{const pe=oe();if(!pe)return pe;const Ee=cn(pe,ue);return delete Ee.role,delete Ee["aria-controls"],Ee},[oe,ue]),xe=dn(),Se=l.useMemo(()=>$({onMouseEnter(){P.type==="menu"&&xe.request(()=>b.set("hoverEnabled",!1))},onMouseMove(){b.set("allowMouseEnter",!0)},onClick(){b.select("hoverEnabled")&&b.set("hoverEnabled",!1)},onKeyDown(pe){const Ee=b.select("keyboardEventRelay");Ee&&!pe.isPropagationStopped()&&Ee(pe)}}),[$,P.type,xe,b]),ze=l.useMemo(()=>B(),[B]);b.useSyncedValues({floatingRootContext:se,activeTriggerProps:le,inactiveTriggerProps:fe,popupProps:Se,itemProps:ze});const We=l.useMemo(()=>({store:b,parent:E}),[b,E]),Me=T.jsx(yo.Provider,{value:We,children:typeof t=="function"?t({payload:O}):t});return P.type===void 0||P.type==="context-menu"?T.jsx(_l,{externalTree:R,children:Me}):Me}function $d(e){const t=e.getBoundingClientRect();if(process.env.NODE_ENV==="test")return t;const n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const s=parseFloat(n.width)||0,c=parseFloat(n.height)||0,i=parseFloat(r.width)||0,u=parseFloat(r.height)||0,a=Math.max(t.width,s,i),d=Math.max(t.height,c,u),f=a-t.width,p=d-t.height;return{left:t.left-f/2,right:t.right+f/2,top:t.top-p/2,bottom:t.bottom+p/2}}function Hd(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qr(),{ref:o,index:s}=ic(e),c=n===s,i=l.useRef(null),u=Pt(o,i);return{compositeProps:l.useMemo(()=>({tabIndex:c?0:-1,onFocus(){r(s)},onMouseMove(){const d=i.current;if(!t||!d)return;const f=d.hasAttribute("disabled")||d.ariaDisabled==="true";!c&&!f&&d.focus()}}),[c,r,s,t]),compositeRef:u,index:s}}function Ud(e){const{render:t,className:n,state:r=ke,props:o=jn,refs:s=jn,metadata:c,stateAttributesMapping:i,tag:u="div",...a}=e,{compositeProps:d,compositeRef:f}=Hd({metadata:c});return Te(u,e,{state:r,ref:[...s,f],props:[d,...o,a],stateAttributesMapping:i})}function bc(e){if(Pe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!at(e))return bc(ft(e))}function Wd(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=l.useRef(!1);return l.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,Ye(s.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:s=>{o.current&&(o.current=!1,s.preventBaseUIHandler())}}:ke,[t,n,r])}const Cn=2,yc=l.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:c=!0,id:i,openOnHover:u,delay:a=100,closeDelay:d=0,handle:f,payload:p,...m}=t,g=Lt(!0),h=f?.store??g?.store;if(!h)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.":Fe(85));const x=At(i),y=h.useState("isTriggerActive",x),v=h.useState("floatingRootContext"),w=h.useState("isOpenedByTrigger",x),E=l.useRef(null),b=zd(),R=qr(!0),C=Ct(),N=l.useMemo(()=>C??new Xr,[C]),_=ti(N),L=ht(),{registerTrigger:j,isMountedByThisTrigger:I}=pf(x,E,h,{payload:p,closeDelay:d,parent:b,floatingTreeRoot:N,floatingNodeId:_,floatingParentNodeId:L,keyboardEventRelay:R?.relayKeyboardEvent}),S=h.useState("disabled"),D=s||S||b.type==="menubar"&&b.context.disabled,{getButtonProps:M,buttonRef:P}=Xt({disabled:D,native:c});l.useEffect(()=>{!w&&b.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,w,b.type]);const k=l.useRef(null),O=tt(),F=X(W=>{if(!k.current)return;O.clear(),h.context.allowMouseUpTriggerRef.current=!1;const ie=W.target;if(me(k.current,ie)||me(h.select("positionerElement"),ie)||ie===k.current||ie!=null&&bc(ie)===h.select("rootId"))return;const re=$d(k.current);W.clientX>=re.left-Cn&&W.clientX<=re.right+Cn&&W.clientY>=re.top-Cn&&W.clientY<=re.bottom+Cn||N.events.emit("close",{domEvent:W,reason:Al})});l.useEffect(()=>{w&&h.select("lastOpenChangeReason")===Je&&Ye(k.current).addEventListener("mouseup",F,{once:!0})},[w,F,h]);const V=b.type==="menubar"&&b.context.hasSubmenuOpen,ee=Sf(v,{enabled:(u??V??!1)&&!D&&b.type!=="context-menu"&&(b.type!=="menubar"||V&&!I),handleClose:Df({blockPointerEvents:b.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:b.type===void 0?a:void 0,delay:{close:d},triggerElementRef:E,externalTree:N,isActiveTrigger:y}),H=Kd(w,h.select("lastOpenChangeReason")),ue=Kl(v,{enabled:!D&&b.type!=="context-menu",event:w&&b.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?H:!1}),ge=bf(v,{enabled:!D&&(b.type!=="menubar"&&w||V)}),te=Wd({open:w,enabled:b.type==="menubar",mouseDownAction:"open"}),G=lo([ue,ge]),q=b.type==="menubar",de=l.useMemo(()=>({disabled:D,open:w}),[D,w]),ne=h.useState("triggerProps",I),A=[k,n,P,j,E],Q=[G.getReferenceProps(),ee??ke,ne,{"aria-haspopup":"menu",id:x,onMouseDown:W=>{if(h.select("open"))return;O.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Ye(W.currentTarget).addEventListener("mouseup",F,{once:!0})}},q?{role:"menuitem"}:{},te,m,M],Z=l.useRef(null),Re=X(W=>{ct.flushSync(()=>{h.setOpen(!1,ve(Kt,W.nativeEvent,W.currentTarget))}),Ya(Z.current)?.focus()}),se=X(W=>{const ie=h.select("positionerElement");if(ie&&Vt(W,ie))h.context.beforeContentFocusGuardRef.current?.focus();else{ct.flushSync(()=>{h.setOpen(!1,ve(Kt,W.nativeEvent,W.currentTarget))});let re=Ga(E.current);for(;re!==null&&me(ie,re)||re?.hasAttribute("aria-hidden");){const he=re;if(re=Ur(re),re===he)break}re?.focus()}}),z=Te("button",t,{enabled:!q,stateAttributesMapping:fs,state:de,ref:A,props:Q});return q?T.jsx(Ud,{tag:"button",render:r,className:o,state:de,refs:A,props:Q,stateAttributesMapping:fs}):w?T.jsxs(l.Fragment,{children:[T.jsx(ut,{ref:Z,onFocus:Re},`${x}-pre-focus-guard`),T.jsx(l.Fragment,{children:z},x),T.jsx(ut,{ref:h.context.triggerFocusTargetRef,onFocus:se},`${x}-post-focus-guard`)]}):T.jsx(l.Fragment,{children:z},x)});process.env.NODE_ENV!=="production"&&(yc.displayName="MenuTrigger");function Kd(e,t){const n=tt(),[r,o]=l.useState(!1);return J(()=>{e&&t==="trigger-hover"?(o(!0),n.start(ul,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function zd(){const e=Zn(!0),t=Lt(!0),n=gc();return l.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}const vc=l.forwardRef(function(t,n){const{className:r,render:o,orientation:s="horizontal",...c}=t,i=l.useMemo(()=>({orientation:s}),[s]);return Te("div",t,{state:i,ref:n,props:[{role:"separator","aria-orientation":s},c]})});process.env.NODE_ENV!=="production"&&(vc.displayName="Separator");const Ec=be.forwardRef(({open:e,defaultOpen:t=!1,onOpenChange:n,disabled:r=!1,className:o,style:s,children:c,...i},u)=>T.jsx("div",{ref:u,className:ye("memori-dropdown",o),style:s,children:T.jsx(Bd,{open:e,defaultOpen:t,onOpenChange:n,disabled:r,...i,children:c})}));Ec.displayName="Dropdown";const xc=be.forwardRef(({children:e,showChevron:t=!0,className:n,style:r,disabled:o,"aria-label":s,...c},i)=>T.jsxs(yc,{ref:i,disabled:o,className:ye("memori-dropdown__trigger",n),style:r,"aria-label":s,...c,children:[e,t&&T.jsx("span",{className:"memori-dropdown__trigger-icon","aria-hidden":!0,children:T.jsx(Ue.ChevronDown,{size:16})})]}));xc.displayName="DropdownTrigger";function wc({children:e,sideOffset:t=8,placement:n="bottom",align:r="start",container:o,className:s,style:c}){return T.jsx(dc,{container:o??document.body,children:T.jsx(pc,{sideOffset:t,side:n,align:r,className:"memori-dropdown__positioner",children:T.jsx(fc,{className:ye("memori-dropdown__popup",s),style:c,role:"menu",children:e})})})}wc.displayName="DropdownMenu";const Rc=be.forwardRef(({children:e,disabled:t=!1,closeOnClick:n=!0,label:r,className:o,style:s,onClick:c,...i},u)=>T.jsx(lc,{ref:u,disabled:t,closeOnClick:n,label:r,className:ye("memori-dropdown__item",o),style:s,onClick:c,role:"menuitem",...i,children:e}));Rc.displayName="DropdownItem";const Sc=be.forwardRef(({className:e,style:t,...n},r)=>T.jsx(vc,{ref:r,className:ye("memori-dropdown__separator",e),style:t,role:"separator",...n}));Sc.displayName="DropdownSeparator";const Cc=be.forwardRef(({children:e,className:t,style:n,...r},o)=>T.jsx(cc,{ref:o,className:ye("memori-dropdown__group",t),style:n,role:"group",...r,children:e}));Cc.displayName="DropdownGroup";const Oc=be.forwardRef(({children:e,className:t,style:n,...r},o)=>T.jsx(ac,{ref:o,className:ye("memori-dropdown__group-label",t),style:n,...r,children:e}));Oc.displayName="DropdownGroupLabel";const Gd=Object.assign(Ec,{Trigger:xc,Menu:wc,Item:Rc,Separator:Sc,Group:Cc,GroupLabel:Oc}),Tc=l.forwardRef(({open:e,onOpenChange:t,onClose:n,anchor:r="right",size:o="sm",children:s,title:c,description:i,footer:u,loading:a,className:d,style:f,showCloseButton:p=!0,closable:m=!0,...g},h)=>{const x=(v,w)=>{t?.(v,w),v||n?.(w)},y=m!==void 0?m:p;return T.jsx(Ve.Dialog.Root,{open:e,onOpenChange:x,children:T.jsxs(Ve.Dialog.Portal,{children:[T.jsx(Ve.Dialog.Backdrop,{className:"memori-drawer__backdrop"}),T.jsxs(Ve.Dialog.Popup,{ref:h,className:ye("memori-drawer",`memori-drawer--${r}`,`memori-drawer--size-${o}`,d),style:f,...g,children:[(c||i||y)&&T.jsxs("div",{className:"memori-drawer__header",children:[T.jsxs("div",{children:[c&&T.jsx("div",{className:"memori-drawer__title",children:c}),i&&T.jsx("div",{className:"memori-drawer__description",children:i})]}),y&&T.jsx(Ve.Dialog.Close,{className:"memori-drawer__close","aria-label":"Close",children:T.jsx(Ue.X,{size:20})})]}),T.jsx("div",{className:"memori-drawer__body",children:a?T.jsx("div",{className:"memori-drawer__loading",children:T.jsx(Ue.Loader2,{className:"memori-drawer__spinner","aria-label":"Loading"})}):s}),u&&T.jsx("div",{className:"memori-drawer__footer",children:u})]})]})})});Tc.displayName="Drawer";let bs=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Yd={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},qd={valid(e){return e===null?null:e?{[bs.valid]:""}:{[bs.invalid]:""}}},Nc=l.createContext({invalid:void 0,name:void 0,validityData:{state:Yd,errors:[],error:"",value:"",initialValue:null},setValidityData:Xe,disabled:void 0,touched:!1,setTouched:Xe,dirty:!1,setDirty:Xe,filled:!1,setFilled:Xe,focused:!1,setFocused:Xe,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=ke)=>e,getInputValidationProps:(e=ke)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(Nc.displayName="FieldRootContext");function kr(e=!0){const t=l.useContext(Nc);if(t.setValidityData===Xe&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":Fe(28));return t}const Mc=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Xe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(Mc.displayName="FormContext");function Xd(){return l.useContext(Mc)}const Ic=l.createContext({controlId:void 0,setControlId:Xe,labelId:void 0,setLabelId:Xe,messageIds:[],setMessageIds:Xe,getDescriptionProps:e=>e});process.env.NODE_ENV!=="production"&&(Ic.displayName="LabelableContext");function Pc(){return l.useContext(Ic)}function Jd(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Zd(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,setControlId:s}=Pc(),c=At(t);return J(()=>{if(!(!n&&!t||s===Xe)){if(n){const i=r?.current;we(i)&&i.closest("label")!=null?s(t??null):s(o??c)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,r,o,s,n,c]),o??c}function Qd(e){const{enabled:t=!0,value:n,id:r,name:o,controlRef:s,commit:c}=e,{formRef:i}=Xd(),{invalid:u,markedDirtyRef:a,validityData:d,setValidityData:f}=kr(),p=X(e.getValue);J(()=>{if(!t)return;let m=n;m===void 0&&(m=p()),d.initialValue===null&&m!==null&&f(g=>({...g,initialValue:m}))},[t,f,n,d.initialValue,p]),J(()=>{!t||!r||i.current.fields.set(r,{getValue:p,name:o,controlRef:s,validityData:Jd(d,u),validate(){let m=n;m===void 0&&(m=p()),a.current=!0,ct.flushSync(()=>c(m))}})},[c,s,t,i,p,r,u,a,o,d,n]),J(()=>{const m=i.current.fields;return()=>{r&&m.delete(r)}},[i,r])}const Dc=l.forwardRef(function(t,n){const{render:r,className:o,id:s,name:c,value:i,disabled:u=!1,onValueChange:a,defaultValue:d,...f}=t,{state:p,name:m,disabled:g}=kr(),h=g||u,x=m??c,y=l.useMemo(()=>({...p,disabled:h}),[p,h]),{setTouched:v,setDirty:w,validityData:E,setFocused:b,setFilled:R,validationMode:C,validation:N}=kr(),{labelId:_}=Pc(),L=Zd({id:s});J(()=>{const P=i!=null;N.inputRef.current?.value||P&&i!==""?R(!0):P&&i===""&&R(!1)},[N.inputRef,R,i]);const[j,I]=Pi({controlled:i,default:d,name:"FieldControl",state:"value"}),S=i!==void 0,D=X((P,k)=>{a?.(P,k),!k.isCanceled&&I(P)});return Qd({id:L,name:x,commit:N.commit,value:j,getValue:()=>N.inputRef.current?.value,controlRef:N.inputRef}),Te("input",t,{ref:n,state:y,props:[{id:L,disabled:h,name:x,ref:N.inputRef,"aria-labelledby":_,...S?{value:j}:{defaultValue:d},onChange(P){const k=P.currentTarget.value;D(k,ve(Qr,P.nativeEvent)),w(k!==E.initialValue),R(k!=="")},onFocus(){b(!0)},onBlur(P){v(!0),b(!1),C==="onBlur"&&N.commit(P.currentTarget.value)},onKeyDown(P){P.currentTarget.tagName==="INPUT"&&P.key==="Enter"&&(v(!0),N.commit(P.currentTarget.value))}},N.getInputValidationProps(),f],stateAttributesMapping:qd})});process.env.NODE_ENV!=="production"&&(Dc.displayName="FieldControl");const _c=l.forwardRef(function(t,n){return T.jsx(Dc,{ref:n,...t})});process.env.NODE_ENV!=="production"&&(_c.displayName="Input");const kc=be.forwardRef(({variant:e="default",size:t="md",fullWidth:n=!1,className:r,disabled:o,...s},c)=>{const i=o||e==="disabled",u=e==="error"?"memori-input--error":e==="disabled"?"memori-input--disabled":"memori-input--default",a=t==="sm"?"memori-input--sm":t==="lg"?"memori-input--lg":"memori-input--md",d=n?"memori-input--full-width":void 0,f=i?"memori-input--disabled":void 0;return T.jsx(_c,{ref:c,disabled:i,className:ye("memori-input",u,a,d,f,r),...s})});kc.displayName="Input";const Ac=be.forwardRef(({options:e,value:t,defaultValue:n,onChange:r,placeholder:o="Select an option",label:s,disabled:c,required:i,error:u,name:a,className:d,style:f},p)=>T.jsx("div",{className:ye("memori-select",d),style:f,children:T.jsxs(Ve.Select.Root,{value:t,defaultValue:n,onValueChange:m=>r?.(m),disabled:c,required:i,name:a,children:[s&&T.jsx("label",{className:"memori-select__label",children:s}),T.jsxs(Ve.Select.Trigger,{ref:p,className:ye("memori-select__trigger",u&&"memori-select__trigger--error"),children:[T.jsx(Ve.Select.Value,{className:"memori-select__value","data-placeholder":o}),T.jsx(Ve.Select.Icon,{className:"memori-select__icon",children:T.jsx(Ue.ChevronDown,{size:16})})]}),T.jsx(Ve.Select.Portal,{className:"memori-select__portal",children:T.jsx(Ve.Select.Positioner,{className:"memori-select__positioner",sideOffset:8,side:"bottom",align:"start",children:T.jsx(Ve.Select.Popup,{className:"memori-select__popup",children:e.map(m=>T.jsxs(Ve.Select.Item,{value:m.value,disabled:m.disabled,className:"memori-select__item",children:[T.jsx(Ve.Select.ItemText,{children:m.label}),T.jsx(Ve.Select.ItemIndicator,{children:T.jsx(Ue.Check,{className:"memori-select__check-icon"})})]},m.value))})})})]})}));Ac.displayName="SelectBox";const ep=({min:e=0,max:t=100,step:n=1,value:r,defaultValue:o=50,label:s,onChange:c,disabled:i=!1})=>{const[u,a]=be.useState(o),d=r!==void 0,f=d?r:u,p=R=>{d||a(R),c?.(R)},[m,g]=be.useState(!1),h=be.useRef(null),x=(f-e)/(t-e)*100,y=[];for(let R=e;R<=t;R+=(t-e)/4)y.push(Math.round(R));const v=R=>{if(!h.current)return f;const C=h.current.getBoundingClientRect(),N=R-C.left,_=C.width,L=Math.max(0,Math.min(100,N/_*100)),j=Math.round(L/100*(t-e)+e),I=Math.round(j/n)*n;return Math.min(Math.max(I,e),t)},w=R=>{if(i)return;g(!0);const C=v(R);p(C)},E=R=>{if(!m||i)return;const C=v(R);p(C)},b=()=>{g(!1)};return be.useEffect(()=>{const R=_=>{m&&(_.preventDefault(),E(_.touches[0]?.clientX??0))},C=_=>{E(_.clientX)},N=()=>{b()};return m&&(window.addEventListener("touchmove",R,{passive:!1}),window.addEventListener("mousemove",C),window.addEventListener("touchend",N),window.addEventListener("mouseup",N)),()=>{window.removeEventListener("touchmove",R),window.removeEventListener("mousemove",C),window.removeEventListener("touchend",N),window.removeEventListener("mouseup",N)}},[m]),be.useEffect(()=>{d||a(o)},[o,d]),T.jsxs("div",{className:ye("memori-slider",{"memori-slider--disabled":i}),style:{"--percentage":`${x}%`},children:[T.jsxs("div",{className:"memori-slider__header",children:[s&&T.jsx("div",{className:"memori-slider__label",children:s}),T.jsx("div",{className:"memori-slider__value",children:f})]}),T.jsxs("div",{ref:h,className:"memori-slider__track-container",onMouseDown:R=>w(R.clientX),onTouchStart:R=>w(R.touches[0]?.clientX??0),children:[T.jsx("div",{className:"memori-slider__track",children:T.jsx("div",{className:"memori-slider__track-fill"})}),T.jsx("div",{className:"memori-slider__marks",children:y.map(R=>T.jsxs("div",{className:"memori-slider__mark",children:[T.jsx("div",{className:"memori-slider__mark-line"}),T.jsx("span",{className:"memori-slider__mark-value",children:R})]},R))}),T.jsx("div",{className:"memori-slider__thumb",role:"slider","aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":f,tabIndex:i?-1:0})]})]})},tp=({content:e,className:t,align:n="right",disabled:r=!1,visible:o=!1,children:s})=>T.jsxs("div",{className:ye("memori-tooltip",`memori-tooltip--align-${n}`,t,{"memori-tooltip--disabled":r,"memori-tooltip--visible":o}),children:[T.jsx("div",{className:"memori-tooltip--content",children:e}),T.jsx("div",{className:"memori-tooltip--trigger",children:s})]});function np(){const[e,t]=be.useState(()=>{if(typeof window<"u"){const o=localStorage.getItem("theme");if(o==="light"||o==="dark")return o;if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}return"light"});return be.useEffect(()=>{const o=document.documentElement;o.removeAttribute("data-theme"),o.classList.remove("dark"),e==="dark"?(o.setAttribute("data-theme","dark"),o.classList.add("dark")):(o.removeAttribute("data-theme"),o.classList.remove("dark")),localStorage.setItem("theme",e)},[e]),{theme:e,setTheme:o=>{t(o)},toggleTheme:()=>{t(o=>o==="light"?"dark":"light")}}}exports.Alert=Mi;exports.AlertProvider=Wf;exports.AlertViewport=Uf;exports.Button=Gt;exports.Card=ji;exports.Checkbox=Bi;exports.Collapsible=Vi;exports.ConfirmDialog=xd;exports.Drawer=Tc;exports.Dropdown=Gd;exports.Expandable=Rd;exports.Input=kc;exports.Modal=ho;exports.SelectBox=Ac;exports.Slider=ep;exports.Spin=Jn;exports.Tooltip=tp;exports.createAlertOptions=zf;exports.useAlertManager=Kf;exports.useTheme=np;
|
|
55
|
+
)`}return T.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(ho.displayName="InternalBackdrop");const ec=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Ot(),c=s.useState("mounted"),i=s.useState("modal");return c||r?T.jsx(go.Provider,{value:r,children:T.jsxs(oo,{ref:n,...o,children:[c&&i===!0&&T.jsx(ho,{ref:s.context.internalBackdropRef,inert:Yr(!open)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(ec.displayName="DialogPortal");let ms={},gs={},hs="";function ld(e){if(typeof document>"u")return!1;const t=Ye(e);return Ae(t).innerWidth-t.documentElement.clientWidth>0}function ud(e){const t=Ye(e),n=t.documentElement,r=t.body,o=kt(n)?n:r,s=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=s}}function fd(e){const t=Ye(e),n=t.documentElement,r=t.body,o=Ae(n);let s=0,c=0;const i=Ie.create(),u=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(la&&(o.visualViewport?.scale??1)!==1)return()=>{};function a(){const p=o.getComputedStyle(n),m=o.getComputedStyle(r),E=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,c=n.scrollLeft,ms={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},hs=n.style.scrollBehavior,gs={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const y=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,w=p.overflowY==="scroll"||m.overflowY==="scroll",x=p.overflowX==="scroll"||m.overflowX==="scroll",b=Math.max(0,o.innerWidth-n.clientWidth),R=Math.max(0,o.innerHeight-n.clientHeight),C=parseFloat(m.marginTop)+parseFloat(m.marginBottom),N=parseFloat(m.marginLeft)+parseFloat(m.marginRight),_=kt(n)?n:r;if(u){n.style.scrollbarGutter=E,_.style.overflowY="hidden",_.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(y||w)&&(n.style.overflowY="scroll"),(v||x)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:C||R?`calc(100dvh - ${C+R}px)`:"100dvh",width:N||b?`calc(100vw - ${N+b}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=c,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,ms),Object.assign(r.style,gs),u||(n.scrollTop=s,n.scrollLeft=c,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=hs)}function l(){d(),i.request(a)}return a(),o.addEventListener("resize",l),()=>{i.cancel(),d(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",l)}}class dd{constructor(){Ce(this,"lockCount",0);Ce(this,"restore",null);Ce(this,"timeoutLock",pt.create());Ce(this,"timeoutUnlock",pt.create());Ce(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Ce(this,"unlock",()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ye(t).documentElement,o=Ae(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=Xe;return}const s=ua||!ld(t);this.restore=s?ud(t):fd(t)}}const pd=new dd;function tc(e=!0,t=null){J(()=>{if(e)return pd.acquire(t)},[e,t])}function md(e){const t=f.useRef(""),n=f.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:f.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,t.current),t.current=""},[e]),onPointerDown:n}}function nc(e){const[t,n]=f.useState(null),r=X((i,u)=>{e||n(u)}),o=f.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:c}=md(r);return f.useMemo(()=>({openMethod:t,reset:o,triggerProps:{onClick:s,onPointerDown:c}}),[t,o,s,c])}function gd(e){const{store:t,parentContext:n,actionsRef:r}=e,o=t.useState("open"),s=t.useState("disablePointerDismissal"),c=t.useState("modal"),i=t.useState("popupElement"),{openMethod:u,triggerProps:a,reset:d}=nc(o);Ei(t);const{forceUnmount:l}=xi(o,t,()=>{d()}),p=X(L=>{const j=ve(L);return j.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},j}),m=f.useCallback(()=>{t.setOpen(!1,p(oi))},[t,p]);f.useImperativeHandle(r,()=>({unmount:l,close:m}),[l,m]);const g=Si({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,E]=f.useState(0),y=h===0,v=Oi(g),w=hi(g,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if("button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const j=Le(L);if(y&&!s){const I=j;return c&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===I||t.context.backdropRef.current===I||me(I,i)&&!I?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:y});tc(o&&c===!0,i);const{getReferenceProps:x,getFloatingProps:b,getTriggerProps:R}=uo([v,w]);t.useContextCallback("onNestedDialogOpen",L=>{E(L+1)}),t.useContextCallback("onNestedDialogClose",()=>{E(0)}),f.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,h]);const C=f.useMemo(()=>x(a),[x,a]),N=f.useMemo(()=>R(a),[R,a]),_=f.useMemo(()=>b(),[b]);t.useSyncedValues({openMethod:u,activeTriggerProps:C,inactiveTriggerProps:N,popupProps:_,floatingRootContext:g,nestedOpenDialogCount:h})}const hd={...Ri,modal:ce(e=>e.modal),nested:ce(e=>e.nested),nestedOpenDialogCount:ce(e=>e.nestedOpenDialogCount),disablePointerDismissal:ce(e=>e.disablePointerDismissal),openMethod:ce(e=>e.openMethod),descriptionElementId:ce(e=>e.descriptionElementId),titleElementId:ce(e=>e.titleElementId),viewportElement:ce(e=>e.viewportElement),role:ce(e=>e.role)};class bd extends ao{constructor(n){super(yd(n),{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),triggerElements:new qn,onOpenChange:void 0,onOpenChangeComplete:void 0},hd);Ce(this,"setOpen",(n,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,r),r.isCanceled)return;const o={open:n,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const s={open:n},c=r.trigger?.id??null;(c||n)&&(s.activeTriggerId=c,s.activeTriggerElement=r.trigger??null),this.update(s)})}}function yd(e={}){return{...wi(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function vd(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:c=!1,modal:i=!0,actionsRef:u,handle:a,triggerId:d,defaultTriggerId:l=null}=e,p=Ot(!0),m=!!p,g=et(()=>a?.store??new bd({open:n??r,activeTriggerId:d!==void 0?d:l,modal:i,disablePointerDismissal:c,nested:m})).current;g.useControlledProp("open",n,r),g.useControlledProp("activeTriggerId",d,l),g.useSyncedValues({disablePointerDismissal:c,nested:m,modal:i}),g.useContextCallback("onOpenChange",o),g.useContextCallback("onOpenChangeComplete",s);const h=g.useState("payload");gd({store:g,actionsRef:u,parentContext:p?.store.context});const E=f.useMemo(()=>({store:g}),[g]);return T.jsx(mo.Provider,{value:E,children:typeof t=="function"?t({payload:h}):t})}let bs=(function(e){return e[e.open=it.open]="open",e[e.closed=it.closed]="closed",e[e.startingStyle=it.startingStyle]="startingStyle",e[e.endingStyle=it.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Ed={...mn,...At,nested(e){return e?{[bs.nested]:""}:null},nestedDialogOpen(e){return e?{[bs.nestedDialogOpen]:""}:null}},rc=f.forwardRef(function(t,n){const{className:r,render:o,children:s,...c}=t,i=Ki(),{store:u}=Ot(),a=u.useState("open"),d=u.useState("nested"),l=u.useState("transitionStatus"),p=u.useState("nestedOpenDialogCount"),m=u.useState("mounted"),g=p>0,h=f.useMemo(()=>({open:a,nested:d,transitionStatus:l,nestedDialogOpen:g}),[a,d,l,g]);return Te("div",t,{enabled:i||m,state:h,ref:[n,u.useStateSetter("viewportElement")],stateAttributesMapping:Ed,props:[{role:"presentation",hidden:!m,children:s},c]})});process.env.NODE_ENV!=="production"&&(rc.displayName="DialogViewport");const oc=f.forwardRef(function(t,n){const{render:r,className:o,id:s,...c}=t,{store:i}=Ot(),u=Lt(s);return i.useSyncedValueWithCleanup("titleElementId",u),Te("h2",t,{ref:n,props:[{id:u},c]})});process.env.NODE_ENV!=="production"&&(oc.displayName="DialogTitle");const bo=be.forwardRef(({open:e=!1,onOpenChange:t,onClose:n,title:r,description:o,children:s,footer:c,loading:i=!1,closable:u=!0,closeOnOverlayClick:a=!0,closeOnEsc:d=!0,size:l="md",width:p,widthMd:m,widthLg:g,centered:h=!0,modal:E=!0,disablePointerDismissal:y,initialFocus:v,finalFocus:w,onAfterOpen:x,onAfterClose:b,className:R,backdropClassName:C,contentClassName:N,titleClassName:_,descriptionClassName:L,footerClassName:j,style:I,contentStyle:S,id:D,"data-testid":M,"aria-label":P,"aria-labelledby":k,"aria-describedby":O,animated:F=!0,closeButton:V,closeIcon:U,...ee},H)=>{const ue=be.useCallback((ne,A)=>{!ne&&!d&&A?.reason&&(A.reason==="escapeKey"||String(A.reason).includes("escape"))||(t?.(ne),ne||n?.())},[t,n,d]),ge=be.useCallback(ne=>{ne?x?.():b?.()},[x,b]),te=y!==void 0?y:!a,G={...p&&{maxWidth:typeof p=="number"?`${p}px`:p},...m&&{"--memori-modal-width-md":typeof m=="number"?`${m}px`:m},...g&&{"--memori-modal-width-lg":typeof g=="number"?`${g}px`:g},...S},de=ye("memori-modal__popup",l==="sm"?"memori-modal__popup--sm":l==="md"?"memori-modal__popup--md":l==="lg"?"memori-modal__popup--lg":l==="xl"?"memori-modal__popup--xl":l==="full"?"memori-modal__popup--full":void 0,N);return T.jsx(vd,{open:e,onOpenChange:ue,onOpenChangeComplete:ge,modal:E,disablePointerDismissal:te,...ee,children:T.jsxs(ec,{children:[F&&T.jsx(Hi,{className:ye("memori-modal__backdrop",C)}),T.jsx(rc,{className:ye("memori-modal__viewport",h&&"memori-modal__viewport--centered",R),children:T.jsxs(Qi,{ref:H,initialFocus:v,finalFocus:w,className:de,style:G,"data-testid":M,"aria-label":r?void 0:P,"aria-labelledby":r?void 0:k,"aria-describedby":o?void 0:O,...m&&{"data-width-md":""},...g&&{"data-width-lg":""},children:[u&&(V?T.jsx("div",{className:"memori-modal__close",children:V}):T.jsx(Ui,{className:"memori-modal__close","aria-label":"Close modal",children:U||T.jsx(Ue.X,{})})),T.jsxs(Jn,{spinning:i,children:[r&&T.jsx(oc,{className:ye("memori-modal__title",_),children:r}),o&&T.jsx(Wi,{className:ye("memori-modal__description",L),children:o}),T.jsx("div",{className:"memori-modal__content",children:s}),c&&T.jsx("div",{className:ye("memori-modal__footer",j),children:c})]})]})})]})})});bo.displayName="Modal";const xd=({isOpen:e,onClose:t,onConfirm:n,title:r,message:o,confirmText:s="Confirm",cancelText:c="Cancel",loading:i=!1})=>{const u=d=>{d||t()},a=T.jsxs(T.Fragment,{children:[T.jsx(_t,{variant:"outline",onClick:t,disabled:i,children:c}),T.jsx(_t,{variant:"primary",onClick:n,loading:i,children:s})]});return T.jsx(bo,{open:e,onOpenChange:u,title:r,size:"sm",footer:a,closable:!i,closeOnEsc:!i,closeOnOverlayClick:!i,children:T.jsx("div",{children:o})})},Dr=4e3,_r=300,wd=e=>{let t=e;return e.length>Dr&&(t=`${e.slice(0,Dr)}
|
|
56
|
+
<br />...`),t.split(" ").length>_r&&(t=t.split(" ").slice(0,_r).join(" ")),t},Rd=({rows:e,className:t,innerClassName:n,btnClassName:r,lineHeightMultiplier:o=1.2,defaultExpanded:s=!1,expandSymbol:c=()=>"...",collapseSymbol:i=d=>d==="it"?"Mostra meno":"Show less",children:u,mode:a="rows"})=>{const{i18n:d}=Yc.useTranslation(),l=d.language,p=i(l),m=c(l),[g,h]=be.useState(s),[E,y]=be.useState(!1),[v,w]=be.useState(16),x=be.useRef(null);be.useEffect(()=>{if(x.current){if(a==="rows"){let R=x.current.getBoundingClientRect().height,C=getComputedStyle(x.current),N=C.lineHeight,_=N==="normal"||!N?.length?o*parseInt(C.fontSize,10):parseInt(N,10);w(_),R&&e&&R>e*_&&y(!0)}else if(a==="characters"){const R=x.current.textContent||"";(R.length>Dr||R.split(" ").length>_r)&&y(!0)}}},[e,a,x.current]);const b=()=>{if(a==="characters"&&!g&&E){const R=x.current?.textContent||"";return wd(R)}return u};return T.jsxs("div",{className:ye("memori-expandable",t),children:[T.jsx("div",{ref:x,className:ye("memori-expandable__inner",n),style:{maxHeight:g||!E||a==="characters"?"9999px":`${v*(e||1)}px`},children:b()}),E&&!g&&T.jsx(_t,{variant:"ghost",className:r,onClick:()=>h(!0),children:m}),E&&g&&T.jsx(_t,{variant:"ghost",className:r,onClick:()=>h(!1),children:p})]})},yo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(yo.displayName="MenuPositionerContext");function sc(e){const t=f.useContext(yo);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.":Fe(33));return t}const vo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(vo.displayName="MenuRootContext");function Ft(e){const t=f.useContext(vo);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.":Fe(36));return t}const ic=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(ic.displayName="ContextMenuRootContext");function Zn(e=!0){const t=f.useContext(ic);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.":Fe(25));return t}const Sd={type:"regular-item"};function Cd(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:o,store:s,nativeButton:c,itemMetadata:i,nodeId:u}=e,a=f.useRef(null),d=Zn(!0),l=d!==void 0,{events:p}=s.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:g}=Xt({disabled:n,focusableWhenDisabled:!0,native:c}),h=f.useCallback(y=>cn({id:o,role:"menuitem",tabIndex:r?0:-1,onMouseMove(v){u&&p.emit("itemhover",{nodeId:u,target:v.currentTarget})},onMouseEnter(){i.type==="submenu-trigger"&&i.setActive()},onKeyUp(v){v.key===" "&&s.context.typingRef.current&&v.preventBaseUIHandler()},onClick(v){t&&p.emit("close",{domEvent:v,reason:ri})},onMouseUp(v){if(d){const w=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,l&&w&&Math.abs(v.clientX-w.x)<=1&&Math.abs(v.clientY-w.y)<=1)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!l||v.button===2)&&i.type==="regular-item"&&a.current.click()}},y,m),[o,r,m,t,p,s,l,d,i,u]),E=Pt(a,g);return f.useMemo(()=>({getItemProps:h,itemRef:E}),[h,E])}const Eo=f.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&(Eo.displayName="CompositeListContext");function Od(){return f.useContext(Eo)}let Td=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function cc(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:c,unregister:i,subscribeMapChange:u,elementsRef:a,labelsRef:d,nextIndexRef:l}=Od(),p=f.useRef(-1),[m,g]=f.useState(s??(o===Td.GuessFromOrder?()=>{if(p.current===-1){const y=l.current;l.current+=1,p.current=y}return p.current}:-1)),h=f.useRef(null),E=f.useCallback(y=>{if(h.current=y,m!==-1&&y!==null&&(a.current[m]=y,d)){const v=t!==void 0;d.current[m]=v?t:r?.current?.textContent??y.textContent}},[m,a,d,t,r]);return J(()=>{if(s!=null)return;const y=h.current;if(y)return c(y,n),()=>{i(y)}},[s,c,i,n]),J(()=>{if(s==null)return u(y=>{const v=h.current?y.get(h.current)?.index:null;v!=null&&g(v)})},[s,u,g]),f.useMemo(()=>({ref:E,index:m}),[m,E])}const xo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(xo.displayName="MenuGroupContext");function Nd(){const e=f.useContext(xo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>.":Fe(31));return e}const ac=f.forwardRef(function(t,n){const{render:r,className:o,...s}=t,[c,i]=f.useState(void 0),u=f.useMemo(()=>({setLabelId:i}),[i]),a=Te("div",t,{ref:n,props:{role:"group","aria-labelledby":c,...s}});return T.jsx(xo.Provider,{value:u,children:a})});process.env.NODE_ENV!=="production"&&(ac.displayName="MenuGroup");const lc=f.forwardRef(function(t,n){const{className:r,render:o,id:s,...c}=t,i=Lt(s),{setLabelId:u}=Nd();return J(()=>(u(i),()=>{u(void 0)}),[u,i]),Te("div",t,{ref:n,props:{id:i,role:"presentation",...c}})});process.env.NODE_ENV!=="production"&&(lc.displayName="MenuGroupLabel");const uc=f.forwardRef(function(t,n){const{render:r,className:o,id:s,label:c,nativeButton:i=!1,disabled:u=!1,closeOnClick:a=!0,...d}=t,l=cc({label:c}),p=sc(!0),m=Lt(s),{store:g}=Ft(),h=g.useState("isActive",l.index),E=g.useState("itemProps"),{getItemProps:y,itemRef:v}=Cd({closeOnClick:a,disabled:u,highlighted:h,id:m,store:g,nativeButton:i,nodeId:p?.nodeId,itemMetadata:Sd}),w=f.useMemo(()=>({disabled:u,highlighted:h}),[u,h]);return Te("div",t,{state:w,props:[E,d,y],ref:[v,n,l.ref]})});process.env.NODE_ENV!=="production"&&(uc.displayName="MenuItem");const fc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(fc.displayName="ToolbarRootContext");function Md(e){return f.useContext(fc)}function Id(e){return e==="starting"?fl:ke}const Pd={...mn,...At},dc=f.forwardRef(function(t,n){const{render:r,className:o,finalFocus:s,...c}=t,{store:i}=Ft(),{side:u,align:a}=sc(),d=Md()!=null,l=i.useState("open"),p=i.useState("transitionStatus"),m=i.useState("popupProps"),g=i.useState("mounted"),h=i.useState("instantType"),E=i.useState("activeTriggerElement"),y=i.useState("parent"),v=i.useState("lastOpenChangeReason"),w=i.useState("rootId"),x=i.useState("floatingRootContext"),b=i.useState("floatingTreeRoot"),R=i.useState("closeDelay"),C=i.useState("activeTriggerElement");pn({open:l,ref:i.context.popupRef,onComplete(){l&&i.context.onOpenChangeComplete?.(!0)}}),f.useEffect(()=>{function S(D){i.setOpen(!1,ve(D.reason,D.domEvent))}return b.events.on("close",S),()=>{b.events.off("close",S)}},[b.events,i]);const N=i.useState("hoverEnabled"),_=i.useState("disabled");xf(x,{enabled:N&&!_&&y.type!=="context-menu"&&y.type!=="menubar",closeDelay:R});const L=f.useMemo(()=>({transitionStatus:p,side:u,align:a,open:l,nested:y.type==="menu",instant:h}),[p,u,a,l,y.type,h]),j=Te("div",t,{state:L,ref:[n,i.context.popupRef],stateAttributesMapping:Pd,props:[m,{onKeyDown(S){d&&Zi.has(S.key)&&S.stopPropagation()}},Id(p),c,{"data-rootownerid":w}]});let I=y.type===void 0||y.type==="context-menu";return(E||y.type==="menubar"&&v!==to)&&(I=!0),T.jsx(ci,{context:x,modal:!1,disabled:!g,returnFocus:s===void 0?I:s,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?b:void 0,previousFocusableElement:C,nextFocusableElement:y.type===void 0?i.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?i.context.beforeContentFocusGuardRef:void 0,children:j})});process.env.NODE_ENV!=="production"&&(dc.displayName="MenuPopup");const wo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(wo.displayName="MenuPortalContext");function Dd(){const e=f.useContext(wo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Menu.Portal> is missing.":Fe(32));return e}const pc=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Ft();return s.useState("mounted")||r?T.jsx(wo.Provider,{value:r,children:T.jsx(oo,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(pc.displayName="MenuPortal");function _d(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=X(o),c=f.useRef(0),i=et(Ad).current,u=et(kd).current,[a,d]=f.useState(0),l=f.useRef(a),p=X((y,v)=>{u.set(y,v??null),l.current+=1,d(l.current)}),m=X(y=>{u.delete(y),l.current+=1,d(l.current)}),g=f.useMemo(()=>{const y=new Map;return Array.from(u.keys()).filter(w=>w.isConnected).sort(Ld).forEach((w,x)=>{const b=u.get(w)??{};y.set(w,{...b,index:x})}),y},[u,a]);J(()=>{if(typeof MutationObserver!="function"||g.size===0)return;const y=new MutationObserver(v=>{const w=new Set,x=b=>w.has(b)?w.delete(b):w.add(b);v.forEach(b=>{b.removedNodes.forEach(x),b.addedNodes.forEach(x)}),w.size===0&&(l.current+=1,d(l.current))});return g.forEach((v,w)=>{w.parentElement&&y.observe(w.parentElement,{childList:!0})}),()=>{y.disconnect()}},[g]),J(()=>{l.current===a&&(n.current.length!==g.size&&(n.current.length=g.size),r&&r.current.length!==g.size&&(r.current.length=g.size),c.current=g.size),s(g)},[s,g,n,r,a]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const h=X(y=>(i.add(y),()=>{i.delete(y)}));J(()=>{i.forEach(y=>y(g))},[i,g]);const E=f.useMemo(()=>({register:p,unregister:m,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:c}),[p,m,h,n,r,c]);return T.jsx(Eo.Provider,{value:E,children:t})}function kd(){return new Map}function Ad(){return new Set}function Ld(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const mc=f.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:c,side:i,align:u,sideOffset:a=0,alignOffset:d=0,collisionBoundary:l="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:E=pl,...y}=t,{store:v}=Ft(),w=Dd(),x=Zn(!0),b=v.useState("parent"),R=v.useState("floatingRootContext"),C=v.useState("floatingTreeRoot"),N=v.useState("mounted"),_=v.useState("open"),L=v.useState("modal"),j=v.useState("activeTriggerElement"),I=v.useState("lastOpenChangeReason"),S=v.useState("floatingNodeId"),D=v.useState("floatingParentNodeId");let M=r,P=a,k=d,O=u,F=E;b.type==="context-menu"&&(M=r??b.context?.anchor,O=O??"start",!i&&O!=="center"&&(k=t.alignOffset??2,P=t.sideOffset??-5));let V=i,U=O;b.type==="menu"?(V=V??"inline-end",U=U??"start",F=t.collisionAvoidance??ml):b.type==="menubar"&&(V=V??"bottom",U=U??"start");const ee=b.type==="context-menu",H=Ff({anchor:M,floatingRootContext:R,positionMethod:x?"fixed":o,mounted:N,side:V,sideOffset:P,align:U,alignOffset:k,arrowPadding:ee?0:m,collisionBoundary:l,collisionPadding:p,sticky:g,nodeId:S,keepMounted:w,disableAnchorTracking:h,collisionAvoidance:F,shiftCrossAxis:ee,externalTree:C}),ue=f.useMemo(()=>{const ne={};return _||(ne.pointerEvents="none"),{role:"presentation",hidden:!N,style:{...H.positionerStyles,...ne}}},[_,N,H.positionerStyles]);f.useEffect(()=>{function ne(A){A.open?(A.parentNodeId===S&&v.set("hoverEnabled",!1),A.nodeId!==S&&A.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,ve(en))):A.parentNodeId===S&&A.reason!==en&&v.set("hoverEnabled",!0)}return C.events.on("menuopenchange",ne),()=>{C.events.off("menuopenchange",ne)}},[v,C.events,S]),f.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ne(A){if(A.open||A.nodeId!==v.select("floatingParentNodeId"))return;const Q=A.reason??en;v.setOpen(!1,ve(Q))}return C.events.on("menuopenchange",ne),()=>{C.events.off("menuopenchange",ne)}},[C.events,v]),f.useEffect(()=>{function ne(A){!_||A.nodeId!==v.select("floatingParentNodeId")||A.target&&j&&j!==A.target&&v.setOpen(!1,ve(en))}return C.events.on("itemhover",ne),()=>{C.events.off("itemhover",ne)}},[C.events,_,j,v]),f.useEffect(()=>{const ne={open:_,nodeId:S,parentNodeId:D,reason:v.select("lastOpenChangeReason")};C.events.emit("menuopenchange",ne)},[C.events,_,v,S,D]);const ge=f.useMemo(()=>({open:_,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:b.type==="menu"}),[_,H.side,H.align,H.anchorHidden,b.type]),te=f.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,nodeId:H.context.nodeId}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.context.nodeId]),G=Te("div",t,{state:ge,stateAttributesMapping:mn,ref:[n,v.useStateSetter("positionerElement")],props:[ue,y]}),q=N&&b.type!=="menu"&&(b.type!=="menubar"&&L&&I!==Je||b.type==="menubar"&&b.context.modal);let de=null;return b.type==="menubar"?de=b.context.contentElement:b.type===void 0&&(de=j),T.jsxs(yo.Provider,{value:te,children:[q&&T.jsx(ho,{ref:b.type==="context-menu"||b.type==="nested-context-menu"?b.context.internalBackdropRef:null,inert:Yr(!_),cutout:de}),T.jsx(Dl,{id:S,children:T.jsx(_d,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:G})})]})});process.env.NODE_ENV!=="production"&&(mc.displayName="MenuPositioner");const gc=f.createContext(null);process.env.NODE_ENV!=="production"&&(gc.displayName="MenubarContext");function hc(e){return f.useContext(gc)}const Fd={...Ri,disabled:ce(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ce(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ce(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ce(e=>e.stickIfOpen),parent:ce(e=>e.parent),rootId:ce(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ce(e=>e.activeIndex),isActive:ce((e,t)=>e.activeIndex===t),hoverEnabled:ce(e=>e.hoverEnabled),instantType:ce(e=>e.instantType),lastOpenChangeReason:ce(e=>e.openChangeReason),floatingTreeRoot:ce(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ce(e=>e.floatingNodeId),floatingParentNodeId:ce(e=>e.floatingParentNodeId),itemProps:ce(e=>e.itemProps),closeDelay:ce(e=>e.closeDelay),keyboardEventRelay:ce(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Ro extends ao{constructor(n){super({...Vd(),...n},{positionerRef:f.createRef(),popupRef:f.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:f.createRef(),beforeContentFocusGuardRef:f.createRef(),onOpenChangeComplete:void 0,triggerElements:new qn},Fd);Ce(this,"unsubscribeParentListener",null);this.observe(ce(r=>r.allowMouseEnter),(r,o)=>{this.state.parent.type==="menu"&&r!==o&&this.state.parent.store.set("allowMouseEnter",r)}),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){this.unsubscribeParentListener=r.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(n,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:n,eventDetails:r})}static useStore(n,r){return et(()=>n??new Ro(r)).current}}function Vd(){return{...wi(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Jr,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ke,keyboardEventRelay:void 0,closeDelay:0}}const bc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(bc.displayName="MenuSubmenuRootContext");function jd(){return f.useContext(bc)}function Bd(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:o,defaultOpen:s=!1,disabled:c=!1,modal:i,loopFocus:u=!0,orientation:a="vertical",actionsRef:d,closeParentOnEsc:l=!1,handle:p,triggerId:m,defaultTriggerId:g=null,highlightItemOnHover:h=!0}=e,E=Zn(!0),y=Ft(!0),v=hc(),w=jd(),x=f.useMemo(()=>w&&y?{type:"menu",store:y.store}:v?{type:"menubar",context:v}:E&&!y?{type:"context-menu",context:E}:{type:void 0},[E,y,v,w]),b=Ro.useStore(p?.store,{parent:x}),R=b.useState("floatingTreeRoot"),C=ni(R),N=ht();J(()=>{E&&!y?b.update({parent:{type:"context-menu",context:E},floatingNodeId:C,floatingParentNodeId:N}):y&&b.update({floatingNodeId:C,floatingParentNodeId:N})},[E,y,C,N,b]),b.useControlledProp("open",n,s),b.useControlledProp("activeTriggerId",m,g),b.useContextCallback("onOpenChangeComplete",o);const _=b.useState("open"),L=b.useState("activeTriggerElement"),j=b.useState("positionerElement"),I=b.useState("hoverEnabled"),S=b.useState("modal"),D=b.useState("disabled"),M=b.useState("lastOpenChangeReason"),P=b.useState("parent"),k=b.useState("activeIndex"),O=b.useState("payload"),F=b.useState("floatingParentNodeId"),V=f.useRef(null),U=F!=null;let ee;process.env.NODE_ENV!=="production"&&P.type!==void 0&&i!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored."),b.useSyncedValues({disabled:c,modal:P.type===void 0?i:void 0,rootId:gt()});const{openMethod:H,triggerProps:ue,reset:ge}=nc(_);Ei(b);const{forceUnmount:te}=xi(_,b,()=>{b.update({allowMouseEnter:!1,stickIfOpen:!0}),ge()}),G=f.useRef(P.type!=="context-menu"),q=tt();f.useEffect(()=>{if(_||(V.current=null),P.type==="context-menu"){if(!_){q.clear(),G.current=!1;return}q.start(500,()=>{G.current=!0})}},[q,_,P.type]),tc(_&&S&&M!==Je&&H!=="touch",j),J(()=>{!_&&!I&&b.set("hoverEnabled",!0)},[_,I,b]);const de=f.useRef(!0),ne=tt(),A=X((pe,Ee)=>{const De=Ee.reason;if(_===pe&&Ee.trigger===L||(Ee.preventUnmountOnClose=()=>{b.set("preventUnmountingOnClose",!0)},!pe&&Ee.trigger==null&&(Ee.trigger=L??void 0),r?.(pe,Ee),Ee.isCanceled))return;const Oe={open:pe,nativeEvent:Ee.event,reason:Ee.reason,nested:U};ee?.emit("openchange",Oe);const Ne=Ee.event;if(pe===!1&&Ne?.type==="click"&&Ne.pointerType==="touch"&&!de.current)return;if(!pe&&k!==null){const nt=b.context.itemDomElements.current[k];queueMicrotask(()=>{nt?.setAttribute("tabindex","-1")})}pe&&De===Bn?(de.current=!1,ne.start(300,()=>{de.current=!0})):(de.current=!0,ne.clear());const Ke=(De===wt||De===ri)&&Ne.detail===0&&Ne?.isTrusted,Be=!pe&&(De===no||De==null);function ot(){const nt={open:pe,openChangeReason:De};V.current=Ee.event??null;const Tt=Ee.trigger?.id??null;(Tt||pe)&&(nt.activeTriggerId=Tt,nt.activeTriggerElement=Ee.trigger??null),b.update(nt)}De===Je?ct.flushSync(ot):ot(),P.type==="menubar"&&(De===Bn||De===zt||De===Je||De===Tn||De===en)?b.set("instantType","group"):Ke||Be?b.set("instantType",Ke?"click":"dismiss"):b.set("instantType",void 0)}),Q=f.useCallback(pe=>{const Ee=ve(pe);return Ee.preventUnmountOnClose=()=>{b.set("preventUnmountingOnClose",!0)},Ee},[b]),Z=f.useCallback(()=>{b.setOpen(!1,Q(oi))},[b,Q]);f.useImperativeHandle(d,()=>({unmount:te,close:Z}),[te,Z]);let Re;P.type==="context-menu"&&(Re=P.context),f.useImperativeHandle(Re?.positionerRef,()=>j,[j]),f.useImperativeHandle(Re?.actionsRef,()=>({setOpen:A}),[A]);const se=Si({popupStore:b,onOpenChange:A});ee=se.context.events,f.useEffect(()=>{const pe=({open:Ee,eventDetails:De})=>A(Ee,De);return ee.on("setOpen",pe),()=>{ee?.off("setOpen",pe)}},[ee,A]);const z=hi(se,{enabled:!D,bubbles:l&&P.type==="menu",outsidePress(){return P.type!=="context-menu"||V.current?.type==="contextmenu"?!0:G.current},externalTree:U?R:void 0}),W=Oi(se,{role:"menu"}),ie=Ni(),re=f.useCallback(pe=>{b.select("activeIndex")!==pe&&b.set("activeIndex",pe)},[b]),he=Nf(se,{enabled:!D,listRef:b.context.itemDomElements,activeIndex:k,nested:P.type!==void 0,loopFocus:u,orientation:a,parentOrientation:P.type==="menubar"?P.context.orientation:void 0,rtl:ie==="rtl",disabledIndices:jn,onNavigate:re,openOnArrowKeyDown:P.type!=="context-menu",externalTree:U?R:void 0,focusItemOnHover:h}),K=f.useCallback(pe=>{b.context.typingRef.current=pe},[b]),ae=If(se,{listRef:b.context.itemLabels,activeIndex:k,resetMs:ll,onMatch:pe=>{_&&pe!==k&&b.set("activeIndex",pe)},onTypingChange:K}),{getReferenceProps:Y,getFloatingProps:$,getItemProps:B,getTriggerProps:oe}=uo([z,W,he,ae]),le=f.useMemo(()=>{const pe=cn(Y(),{onMouseEnter(){b.set("hoverEnabled",!0)},onMouseMove(){b.set("allowMouseEnter",!0)}},ue);return delete pe.role,pe},[Y,b,ue]),fe=f.useMemo(()=>{const pe=oe();if(!pe)return pe;const Ee=cn(pe,ue);return delete Ee.role,delete Ee["aria-controls"],Ee},[oe,ue]),xe=dn(),Se=f.useMemo(()=>$({onMouseEnter(){P.type==="menu"&&xe.request(()=>b.set("hoverEnabled",!1))},onMouseMove(){b.set("allowMouseEnter",!0)},onClick(){b.select("hoverEnabled")&&b.set("hoverEnabled",!1)},onKeyDown(pe){const Ee=b.select("keyboardEventRelay");Ee&&!pe.isPropagationStopped()&&Ee(pe)}}),[$,P.type,xe,b]),ze=f.useMemo(()=>B(),[B]);b.useSyncedValues({floatingRootContext:se,activeTriggerProps:le,inactiveTriggerProps:fe,popupProps:Se,itemProps:ze});const We=f.useMemo(()=>({store:b,parent:x}),[b,x]),Me=T.jsx(vo.Provider,{value:We,children:typeof t=="function"?t({payload:O}):t});return P.type===void 0||P.type==="context-menu"?T.jsx(_l,{externalTree:R,children:Me}):Me}function $d(e){const t=e.getBoundingClientRect();if(process.env.NODE_ENV==="test")return t;const n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const s=parseFloat(n.width)||0,c=parseFloat(n.height)||0,i=parseFloat(r.width)||0,u=parseFloat(r.height)||0,a=Math.max(t.width,s,i),d=Math.max(t.height,c,u),l=a-t.width,p=d-t.height;return{left:t.left-l/2,right:t.right+l/2,top:t.top-p/2,bottom:t.bottom+p/2}}function Hd(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Xr(),{ref:o,index:s}=cc(e),c=n===s,i=f.useRef(null),u=Pt(o,i);return{compositeProps:f.useMemo(()=>({tabIndex:c?0:-1,onFocus(){r(s)},onMouseMove(){const d=i.current;if(!t||!d)return;const l=d.hasAttribute("disabled")||d.ariaDisabled==="true";!c&&!l&&d.focus()}}),[c,r,s,t]),compositeRef:u,index:s}}function Ud(e){const{render:t,className:n,state:r=ke,props:o=jn,refs:s=jn,metadata:c,stateAttributesMapping:i,tag:u="div",...a}=e,{compositeProps:d,compositeRef:l}=Hd({metadata:c});return Te(u,e,{state:r,ref:[...s,l],props:[d,...o,a],stateAttributesMapping:i})}function yc(e){if(Pe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!at(e))return yc(ft(e))}function Wd(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=f.useRef(!1);return f.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,Ye(s.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:s=>{o.current&&(o.current=!1,s.preventBaseUIHandler())}}:ke,[t,n,r])}const Cn=2,kr=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:c=!0,id:i,openOnHover:u,delay:a=100,closeDelay:d=0,handle:l,payload:p,...m}=t,g=Ft(!0),h=l?.store??g?.store;if(!h)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.":Fe(85));const E=Lt(i),y=h.useState("isTriggerActive",E),v=h.useState("floatingRootContext"),w=h.useState("isOpenedByTrigger",E),x=f.useRef(null),b=zd(),R=Xr(!0),C=Ct(),N=f.useMemo(()=>C??new Jr,[C]),_=ni(N),L=ht(),{registerTrigger:j,isMountedByThisTrigger:I}=pf(E,x,h,{payload:p,closeDelay:d,parent:b,floatingTreeRoot:N,floatingNodeId:_,floatingParentNodeId:L,keyboardEventRelay:R?.relayKeyboardEvent}),S=h.useState("disabled"),D=s||S||b.type==="menubar"&&b.context.disabled,{getButtonProps:M,buttonRef:P}=Xt({disabled:D,native:c});f.useEffect(()=>{!w&&b.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,w,b.type]);const k=f.useRef(null),O=tt(),F=X(W=>{if(!k.current)return;O.clear(),h.context.allowMouseUpTriggerRef.current=!1;const ie=W.target;if(me(k.current,ie)||me(h.select("positionerElement"),ie)||ie===k.current||ie!=null&&yc(ie)===h.select("rootId"))return;const re=$d(k.current);W.clientX>=re.left-Cn&&W.clientX<=re.right+Cn&&W.clientY>=re.top-Cn&&W.clientY<=re.bottom+Cn||N.events.emit("close",{domEvent:W,reason:Al})});f.useEffect(()=>{w&&h.select("lastOpenChangeReason")===Je&&Ye(k.current).addEventListener("mouseup",F,{once:!0})},[w,F,h]);const V=b.type==="menubar"&&b.context.hasSubmenuOpen,ee=Sf(v,{enabled:(u??V??!1)&&!D&&b.type!=="context-menu"&&(b.type!=="menubar"||V&&!I),handleClose:Df({blockPointerEvents:b.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:b.type===void 0?a:void 0,delay:{close:d},triggerElementRef:x,externalTree:N,isActiveTrigger:y}),H=Kd(w,h.select("lastOpenChangeReason")),ue=Kl(v,{enabled:!D&&b.type!=="context-menu",event:w&&b.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?H:!1}),ge=bf(v,{enabled:!D&&(b.type!=="menubar"&&w||V)}),te=Wd({open:w,enabled:b.type==="menubar",mouseDownAction:"open"}),G=uo([ue,ge]),q=b.type==="menubar",de=f.useMemo(()=>({disabled:D,open:w}),[D,w]),ne=h.useState("triggerProps",I),A=[k,n,P,j,x],Q=[G.getReferenceProps(),ee??ke,ne,{"aria-haspopup":"menu",id:E,onMouseDown:W=>{if(h.select("open"))return;O.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Ye(W.currentTarget).addEventListener("mouseup",F,{once:!0})}},q?{role:"menuitem"}:{},te,m,M],Z=f.useRef(null),Re=X(W=>{ct.flushSync(()=>{h.setOpen(!1,ve(zt,W.nativeEvent,W.currentTarget))}),Ya(Z.current)?.focus()}),se=X(W=>{const ie=h.select("positionerElement");if(ie&&jt(W,ie))h.context.beforeContentFocusGuardRef.current?.focus();else{ct.flushSync(()=>{h.setOpen(!1,ve(zt,W.nativeEvent,W.currentTarget))});let re=Ga(x.current);for(;re!==null&&me(ie,re)||re?.hasAttribute("aria-hidden");){const he=re;if(re=Wr(re),re===he)break}re?.focus()}}),z=Te("button",t,{enabled:!q,stateAttributesMapping:ds,state:de,ref:A,props:Q});return q?T.jsx(Ud,{tag:"button",render:r,className:o,state:de,refs:A,props:Q,stateAttributesMapping:ds}):w?T.jsxs(f.Fragment,{children:[T.jsx(ut,{ref:Z,onFocus:Re},`${E}-pre-focus-guard`),T.jsx(f.Fragment,{children:z},E),T.jsx(ut,{ref:h.context.triggerFocusTargetRef,onFocus:se},`${E}-post-focus-guard`)]}):T.jsx(f.Fragment,{children:z},E)});process.env.NODE_ENV!=="production"&&(kr.displayName="MenuTrigger");function Kd(e,t){const n=tt(),[r,o]=f.useState(!1);return J(()=>{e&&t==="trigger-hover"?(o(!0),n.start(ul,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function zd(){const e=Zn(!0),t=Ft(!0),n=hc();return f.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}const vc=f.forwardRef(function(t,n){const{className:r,render:o,orientation:s="horizontal",...c}=t,i=f.useMemo(()=>({orientation:s}),[s]);return Te("div",t,{state:i,ref:n,props:[{role:"separator","aria-orientation":s},c]})});process.env.NODE_ENV!=="production"&&(vc.displayName="Separator");const Ec=be.forwardRef(({open:e,defaultOpen:t=!1,onOpenChange:n,disabled:r=!1,className:o,style:s,children:c,...i},u)=>T.jsx("div",{ref:u,className:ye("memori-dropdown",o),style:s,children:T.jsx(Bd,{open:e,defaultOpen:t,onOpenChange:n,disabled:r,...i,children:c})}));Ec.displayName="Dropdown";const xc=be.forwardRef(({children:e,showChevron:t=!0,className:n,style:r,disabled:o,"aria-label":s,render:c,variant:i,size:u,fullWidth:a,shape:d,shadow:l,danger:p,active:m,...g},h)=>{const E=i!=null||u!=null||a!=null||d!=null||l!=null||p!=null||m!=null,y=ye("memori-dropdown__trigger",n),v=t?T.jsx("span",{className:"memori-dropdown__trigger-icon","aria-hidden":!0,children:T.jsx(Ue.ChevronDown,{size:16})}):null,w=(()=>{if(c)return c;if(E)return(x,b)=>T.jsxs(_t,{...x,ref:h,variant:i,size:u,fullWidth:a,shape:d,shadow:l,danger:p,active:m??b.open,className:ye(y,x.className),"aria-expanded":b.open,children:[e,v]})})();return w?T.jsx(kr,{ref:h,disabled:o,render:w,"aria-label":s,...g}):T.jsxs(kr,{ref:h,disabled:o,className:y,style:r,"aria-label":s,...g,children:[e,v]})});xc.displayName="DropdownTrigger";function wc({children:e,sideOffset:t=8,placement:n="bottom",align:r="start",container:o,className:s,style:c}){return T.jsx(pc,{container:o??document.body,children:T.jsx(mc,{sideOffset:t,side:n,align:r,className:"memori-dropdown__positioner",children:T.jsx(dc,{className:ye("memori-dropdown__popup",s),style:c,role:"menu",children:e})})})}wc.displayName="DropdownMenu";const Rc=be.forwardRef(({children:e,icon:t,disabled:n=!1,closeOnClick:r=!0,label:o,className:s,style:c,onClick:i,...u},a)=>T.jsxs(uc,{ref:a,disabled:n,closeOnClick:r,label:o,className:ye("memori-dropdown__item",t?"memori-dropdown__item--with-icon":void 0,s),style:c,onClick:i,role:"menuitem",...u,children:[t&&T.jsx("span",{className:"memori-dropdown__item-icon","aria-hidden":!0,children:t}),e]}));Rc.displayName="DropdownItem";const Sc=be.forwardRef(({className:e,style:t,...n},r)=>T.jsx(vc,{ref:r,className:ye("memori-dropdown__separator",e),style:t,role:"separator",...n}));Sc.displayName="DropdownSeparator";const Cc=be.forwardRef(({children:e,className:t,style:n,...r},o)=>T.jsx(ac,{ref:o,className:ye("memori-dropdown__group",t),style:n,role:"group",...r,children:e}));Cc.displayName="DropdownGroup";const Oc=be.forwardRef(({children:e,className:t,style:n,...r},o)=>T.jsx(lc,{ref:o,className:ye("memori-dropdown__group-label",t),style:n,...r,children:e}));Oc.displayName="DropdownGroupLabel";const Gd=Object.assign(Ec,{Trigger:xc,Menu:wc,Item:Rc,Separator:Sc,Group:Cc,GroupLabel:Oc}),Tc=f.forwardRef(({open:e,onOpenChange:t,onClose:n,anchor:r="right",size:o="sm",children:s,title:c,description:i,footer:u,loading:a,className:d,style:l,showCloseButton:p=!0,closable:m=!0,...g},h)=>{const E=(v,w)=>{t?.(v,w),v||n?.(w)},y=m!==void 0?m:p;return T.jsx(Ve.Dialog.Root,{open:e,onOpenChange:E,children:T.jsxs(Ve.Dialog.Portal,{children:[T.jsx(Ve.Dialog.Backdrop,{className:"memori-drawer__backdrop"}),T.jsxs(Ve.Dialog.Popup,{ref:h,className:ye("memori-drawer",`memori-drawer--${r}`,`memori-drawer--size-${o}`,d),style:l,...g,children:[(c||i||y)&&T.jsxs("div",{className:"memori-drawer__header",children:[T.jsxs("div",{children:[c&&T.jsx("div",{className:"memori-drawer__title",children:c}),i&&T.jsx("div",{className:"memori-drawer__description",children:i})]}),y&&T.jsx(Ve.Dialog.Close,{className:"memori-drawer__close","aria-label":"Close",children:T.jsx(Ue.X,{size:20})})]}),T.jsx("div",{className:"memori-drawer__body",children:a?T.jsx("div",{className:"memori-drawer__loading",children:T.jsx(Ue.Loader2,{className:"memori-drawer__spinner","aria-label":"Loading"})}):s}),u&&T.jsx("div",{className:"memori-drawer__footer",children:u})]})]})})});Tc.displayName="Drawer";let ys=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Yd={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},qd={valid(e){return e===null?null:e?{[ys.valid]:""}:{[ys.invalid]:""}}},Nc=f.createContext({invalid:void 0,name:void 0,validityData:{state:Yd,errors:[],error:"",value:"",initialValue:null},setValidityData:Xe,disabled:void 0,touched:!1,setTouched:Xe,dirty:!1,setDirty:Xe,filled:!1,setFilled:Xe,focused:!1,setFocused:Xe,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=ke)=>e,getInputValidationProps:(e=ke)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(Nc.displayName="FieldRootContext");function Ar(e=!0){const t=f.useContext(Nc);if(t.setValidityData===Xe&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":Fe(28));return t}const Mc=f.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Xe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(Mc.displayName="FormContext");function Xd(){return f.useContext(Mc)}const Ic=f.createContext({controlId:void 0,setControlId:Xe,labelId:void 0,setLabelId:Xe,messageIds:[],setMessageIds:Xe,getDescriptionProps:e=>e});process.env.NODE_ENV!=="production"&&(Ic.displayName="LabelableContext");function Pc(){return f.useContext(Ic)}function Jd(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Zd(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,setControlId:s}=Pc(),c=Lt(t);return J(()=>{if(!(!n&&!t||s===Xe)){if(n){const i=r?.current;we(i)&&i.closest("label")!=null?s(t??null):s(o??c)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,r,o,s,n,c]),o??c}function Qd(e){const{enabled:t=!0,value:n,id:r,name:o,controlRef:s,commit:c}=e,{formRef:i}=Xd(),{invalid:u,markedDirtyRef:a,validityData:d,setValidityData:l}=Ar(),p=X(e.getValue);J(()=>{if(!t)return;let m=n;m===void 0&&(m=p()),d.initialValue===null&&m!==null&&l(g=>({...g,initialValue:m}))},[t,l,n,d.initialValue,p]),J(()=>{!t||!r||i.current.fields.set(r,{getValue:p,name:o,controlRef:s,validityData:Jd(d,u),validate(){let m=n;m===void 0&&(m=p()),a.current=!0,ct.flushSync(()=>c(m))}})},[c,s,t,i,p,r,u,a,o,d,n]),J(()=>{const m=i.current.fields;return()=>{r&&m.delete(r)}},[i,r])}const Dc=f.forwardRef(function(t,n){const{render:r,className:o,id:s,name:c,value:i,disabled:u=!1,onValueChange:a,defaultValue:d,...l}=t,{state:p,name:m,disabled:g}=Ar(),h=g||u,E=m??c,y=f.useMemo(()=>({...p,disabled:h}),[p,h]),{setTouched:v,setDirty:w,validityData:x,setFocused:b,setFilled:R,validationMode:C,validation:N}=Ar(),{labelId:_}=Pc(),L=Zd({id:s});J(()=>{const P=i!=null;N.inputRef.current?.value||P&&i!==""?R(!0):P&&i===""&&R(!1)},[N.inputRef,R,i]);const[j,I]=Di({controlled:i,default:d,name:"FieldControl",state:"value"}),S=i!==void 0,D=X((P,k)=>{a?.(P,k),!k.isCanceled&&I(P)});return Qd({id:L,name:E,commit:N.commit,value:j,getValue:()=>N.inputRef.current?.value,controlRef:N.inputRef}),Te("input",t,{ref:n,state:y,props:[{id:L,disabled:h,name:E,ref:N.inputRef,"aria-labelledby":_,...S?{value:j}:{defaultValue:d},onChange(P){const k=P.currentTarget.value;D(k,ve(eo,P.nativeEvent)),w(k!==x.initialValue),R(k!=="")},onFocus(){b(!0)},onBlur(P){v(!0),b(!1),C==="onBlur"&&N.commit(P.currentTarget.value)},onKeyDown(P){P.currentTarget.tagName==="INPUT"&&P.key==="Enter"&&(v(!0),N.commit(P.currentTarget.value))}},N.getInputValidationProps(),l],stateAttributesMapping:qd})});process.env.NODE_ENV!=="production"&&(Dc.displayName="FieldControl");const _c=f.forwardRef(function(t,n){return T.jsx(Dc,{ref:n,...t})});process.env.NODE_ENV!=="production"&&(_c.displayName="Input");const kc=be.forwardRef(({variant:e="default",size:t="md",fullWidth:n=!1,className:r,disabled:o,...s},c)=>{const i=o||e==="disabled",u=e==="error"?"memori-input--error":e==="disabled"?"memori-input--disabled":"memori-input--default",a=t==="sm"?"memori-input--sm":t==="lg"?"memori-input--lg":"memori-input--md",d=n?"memori-input--full-width":void 0,l=i?"memori-input--disabled":void 0;return T.jsx(_c,{ref:c,disabled:i,className:ye("memori-input",u,a,d,l,r),...s})});kc.displayName="Input";const Ac=be.forwardRef(({options:e,value:t,defaultValue:n,onChange:r,placeholder:o="Select an option",displayValue:s,label:c,disabled:i,required:u,error:a,name:d,className:l,style:p},m)=>T.jsx("div",{className:ye("memori-select",l),style:p,children:T.jsxs(Ve.Select.Root,{value:t,defaultValue:n,onValueChange:g=>r?.(g),disabled:i,required:u,name:d,children:[c&&T.jsx("label",{className:"memori-select__label",children:c}),T.jsxs(Ve.Select.Trigger,{ref:m,className:ye("memori-select__trigger",a&&"memori-select__trigger--error"),children:[T.jsx(Ve.Select.Value,{className:"memori-select__value","data-placeholder":o,children:s}),T.jsx(Ve.Select.Icon,{className:"memori-select__icon",children:T.jsx(Ue.ChevronDown,{size:16})})]}),T.jsx(Ve.Select.Portal,{className:"memori-select__portal",children:T.jsx(Ve.Select.Positioner,{className:"memori-select__positioner",sideOffset:8,side:"bottom",align:"start",children:T.jsx(Ve.Select.Popup,{className:"memori-select__popup",children:e.map(g=>T.jsxs(Ve.Select.Item,{value:g.value,disabled:g.disabled,className:"memori-select__item",children:[T.jsx(Ve.Select.ItemText,{children:g.label}),T.jsx(Ve.Select.ItemIndicator,{children:T.jsx(Ue.Check,{className:"memori-select__check-icon"})})]},g.value))})})})]})}));Ac.displayName="SelectBox";const ep=({min:e=0,max:t=100,step:n=1,value:r,defaultValue:o=50,label:s,onChange:c,disabled:i=!1})=>{const[u,a]=be.useState(o),d=r!==void 0,l=d?r:u,p=R=>{d||a(R),c?.(R)},[m,g]=be.useState(!1),h=be.useRef(null),E=(l-e)/(t-e)*100,y=[];for(let R=e;R<=t;R+=(t-e)/4)y.push(Math.round(R));const v=R=>{if(!h.current)return l;const C=h.current.getBoundingClientRect(),N=R-C.left,_=C.width,L=Math.max(0,Math.min(100,N/_*100)),j=Math.round(L/100*(t-e)+e),I=Math.round(j/n)*n;return Math.min(Math.max(I,e),t)},w=R=>{if(i)return;g(!0);const C=v(R);p(C)},x=R=>{if(!m||i)return;const C=v(R);p(C)},b=()=>{g(!1)};return be.useEffect(()=>{const R=_=>{m&&(_.preventDefault(),x(_.touches[0]?.clientX??0))},C=_=>{x(_.clientX)},N=()=>{b()};return m&&(window.addEventListener("touchmove",R,{passive:!1}),window.addEventListener("mousemove",C),window.addEventListener("touchend",N),window.addEventListener("mouseup",N)),()=>{window.removeEventListener("touchmove",R),window.removeEventListener("mousemove",C),window.removeEventListener("touchend",N),window.removeEventListener("mouseup",N)}},[m]),be.useEffect(()=>{d||a(o)},[o,d]),T.jsxs("div",{className:ye("memori-slider",{"memori-slider--disabled":i}),style:{"--percentage":`${E}%`},children:[T.jsxs("div",{className:"memori-slider__header",children:[s&&T.jsx("div",{className:"memori-slider__label",children:s}),T.jsx("div",{className:"memori-slider__value",children:l})]}),T.jsxs("div",{ref:h,className:"memori-slider__track-container",onMouseDown:R=>w(R.clientX),onTouchStart:R=>w(R.touches[0]?.clientX??0),children:[T.jsx("div",{className:"memori-slider__track",children:T.jsx("div",{className:"memori-slider__track-fill"})}),T.jsx("div",{className:"memori-slider__marks",children:y.map(R=>T.jsxs("div",{className:"memori-slider__mark",children:[T.jsx("div",{className:"memori-slider__mark-line"}),T.jsx("span",{className:"memori-slider__mark-value",children:R})]},R))}),T.jsx("div",{className:"memori-slider__thumb",role:"slider","aria-valuemin":e,"aria-valuemax":t,"aria-valuenow":l,tabIndex:i?-1:0})]})]})},tp=({content:e,className:t,align:n="right",disabled:r=!1,visible:o=!1,children:s})=>T.jsxs("div",{className:ye("memori-tooltip",`memori-tooltip--align-${n}`,t,{"memori-tooltip--disabled":r,"memori-tooltip--visible":o}),children:[T.jsx("div",{className:"memori-tooltip--content",children:e}),T.jsx("div",{className:"memori-tooltip--trigger",children:s})]});function np(){const[e,t]=be.useState(()=>{if(typeof window<"u"){const o=localStorage.getItem("theme");if(o==="light"||o==="dark")return o;if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}return"light"});return be.useEffect(()=>{const o=document.documentElement;o.removeAttribute("data-theme"),o.classList.remove("dark"),e==="dark"?(o.setAttribute("data-theme","dark"),o.classList.add("dark")):(o.removeAttribute("data-theme"),o.classList.remove("dark")),localStorage.setItem("theme",e)},[e]),{theme:e,setTheme:o=>{t(o)},toggleTheme:()=>{t(o=>o==="light"?"dark":"light")}}}exports.Alert=Ii;exports.AlertProvider=Wf;exports.AlertViewport=Uf;exports.Button=_t;exports.Card=Bi;exports.Checkbox=$i;exports.Collapsible=ji;exports.ConfirmDialog=xd;exports.Drawer=Tc;exports.Dropdown=Gd;exports.Expandable=Rd;exports.Input=kc;exports.Modal=bo;exports.SelectBox=Ac;exports.Slider=ep;exports.Spin=Jn;exports.Tooltip=tp;exports.createAlertOptions=zf;exports.useAlertManager=Kf;exports.useTheme=np;
|
|
57
57
|
//# sourceMappingURL=memori-ai-ui.cjs.js.map
|