@dudousxd/nestjs-agent-dashboard 0.15.4 → 0.16.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/dist/client/agent-client.d.ts +77 -0
- package/dist/client/agent-client.d.ts.map +1 -1
- package/dist/client/agent-client.js +8 -0
- package/dist/client/agent-client.js.map +1 -1
- package/dist/server/index.cjs +32 -0
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +14 -1
- package/dist/server/index.d.ts +14 -1
- package/dist/server/index.js +32 -0
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/{base-ui-CWwgtV-8.js → base-ui-Bm0nR785.js} +1 -1
- package/dist/spa/assets/index-CnY2UUny.js +25 -0
- package/dist/spa/assets/index-DM4zr-AZ.css +1 -0
- package/dist/spa/assets/index-Dri7bktH.js +1 -0
- package/dist/spa/assets/preview-DQADeKT4.js +1 -0
- package/dist/spa/assets/{recharts-El_Zr62O.js → recharts-CURTGZ5d.js} +2 -2
- package/dist/spa/index.html +5 -5
- package/dist/spa/preview.html +5 -5
- package/package.json +2 -2
- package/dist/spa/assets/index-BMcG8dYT.js +0 -25
- package/dist/spa/assets/index-CO6XH1b7.css +0 -1
- package/dist/spa/assets/index-d4_rang9.js +0 -1
- package/dist/spa/assets/preview-3GvRyoRW.js +0 -1
|
@@ -38,4 +38,4 @@ var Uu=Object.defineProperty;var Yu=(e,t,n)=>t in e?Uu(e,t,{enumerable:!0,config
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var Mo=l,fd=Ao;function dd(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pd=typeof Object.is=="function"?Object.is:dd,gd=fd.useSyncExternalStore,hd=Mo.useRef,md=Mo.useEffect,yd=Mo.useMemo,bd=Mo.useDebugValue;zc.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=hd(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=yd(function(){function u(p){if(!a){if(a=!0,f=p,p=o(p),r!==void 0&&i.hasValue){var g=i.value;if(r(g,p))return d=g}return d=p}if(g=d,pd(f,p))return g;var y=o(p);return r!==void 0&&r(g,y)?(f=p,g):(f=p,d=y)}var a=!1,f,d,h=n===void 0?null:n;return[function(){return u(t())},h===null?void 0:function(){return u(h())}]},[t,n,o,r]);var c=gd(e,s[0],s[1]);return md(function(){i.hasValue=!0,i.value=c},[c]),bd(c),c};Yc.exports=zc;var Rd=Yc.exports;const vd=Pr(19),Ed=vd?xd:Td;function Kc(e,t,n,o,r){return Ed(e,t,n,o,r)}function Sd(e,t,n,o,r){const s=l.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return Ao.useSyncExternalStore(e.subscribe,s,s)}Hl({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const o=e.syncHooks[n],r=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,r)||(t=!0,o.value=r)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const r of e.syncHooks)n.add(r.store);const o=[];for(const r of n)o.push(r.subscribe(t));return()=>{for(const r of o)r()}}),Ao.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function xd(e,t,n,o,r){const s=Nl();if(!s)return Sd(e,t,n,o,r);const i=s.syncIndex;s.syncIndex+=1;let c;return s.didInitialize?(c=s.syncHooks[i],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,o)||!Object.is(c.a3,r))&&(c.store!==e&&(s.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=o,c.a3=r,c.value=t(e.getSnapshot(),n,o,r))):(c={store:e,selector:t,a1:n,a2:o,a3:r,value:t(e.getSnapshot(),n,o,r)},s.syncHooks.push(c)),c.value}function Td(e,t,n,o,r){return Rd.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class Cd{constructor(t){Te(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Te(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,o,r){return Kc(this,t,n,o,r)}}class On extends Cd{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){l.useDebugValue(t);const o=this;J(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){const o=this;J(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);J(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){l.useDebugValue(t);const o=this,r=n!==void 0;J(()=>{r&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,r])}select(t,n,o,r){const s=this.selectors[t];return s(this.state,n,o,r)}useState(t,n,o,r){return l.useDebugValue(t),Kc(this,this.selectors[t],n,o,r)}useContextCallback(t,n){l.useDebugValue(t);const o=te(n??ke);this.context[t]=o}useStateSetter(t){const n=l.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const i=o(s);if(!Object.is(r,i)){const c=r;r=i,n(i,c,this)}})}}const wd={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Zr extends On{constructor(n){const{syncOnly:o,nested:r,onOpenChange:s,triggerElements:i,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Oc(),nested:r,triggerElements:i},wd);Te(this,"syncOpenEvent",(n,o)=>{(!n||!this.state.open||o!=null&&Gl(o))&&(this.context.dataRef.current.openEvent=n?o:void 0)});Te(this,"dispatchOpenChange",(n,o)=>{this.syncOpenEvent(n,o.event);const r={open:n,reason:o.reason,nativeEvent:o.event,nested:this.context.nested,triggerElement:o.trigger};this.context.events.emit("openchange",r)});Te(this,"setOpen",(n,o)=>{var r,s,i,c;if(this.syncOnly){(s=(r=this.context).onOpenChange)==null||s.call(r,n,o);return}this.dispatchOpenChange(n,o),(c=(i=this.context).onOpenChange)==null||c.call(i,n,o)});this.syncOnly=o}}function Pd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:r,nested:s,onOpenChange:i}=e,c=t.useState("open"),u=t.useState("activeTriggerElement"),a=t.useState(n?"popupElement":"positionerElement"),f=t.context.triggerElements,d=i,h=l.useRef(null);o===void 0&&h.current===null&&(h.current=new Zr({open:c,transitionStatus:void 0,referenceElement:u,floatingElement:a,triggerElements:f,onOpenChange:d,floatingId:r,syncOnly:!0,nested:s}));const p=o??h.current;return t.useSyncedValue("floatingId",r),J(()=>{const g={open:c,floatingId:r,referenceElement:u,floatingElement:a};Re(u)&&(g.domReferenceElement=u),p.state.positionReference===p.state.referenceElement&&(g.positionReference=u),p.update(g)},[c,r,u,a,p]),p.context.onOpenChange=d,p.context.nested=s,p}function Jr(e,t=!1,n=!1,o=!1){const[r,s]=l.useState(e&&t?"idle":void 0),[i,c]=l.useState(e&&!o);return e&&!i&&(c(!0),s("starting")),!e&&i&&r!=="ending"&&!n&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),J(()=>{if(!e&&i&&r!=="ending"&&n){const u=gt.request(()=>{s("ending")});return()=>{gt.cancel(u)}}},[e,i,r,n]),J(()=>{if(!e||t)return;const u=gt.request(()=>{s(void 0)});return()=>{gt.cancel(u)}},[t,e]),J(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&s("starting");const u=gt.request(()=>{s("idle")});return()=>{gt.cancel(u)}},[t,e,i,r]),{mounted:i,setMounted:c,transitionStatus:r}}let Vn=null;function Id(e){if(!Vn){const t=[];Vn=t,queueMicrotask(()=>{Vn=null,at.flushSync(()=>{for(const n of t)n()})})}Vn.push(e)}function Gc(e,t=!1,n=!1){const o=rn();return te((r,s=null)=>{o.cancel();const i=Rt(e);if(i==null)return;const c=i,u=()=>{if(!n){at.flushSync(r);return}Id(()=>{s!=null&&s.aborted||r()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function a(){Promise.all(c.getAnimations().map(f=>f.finished)).then(()=>{s!=null&&s.aborted||u()},()=>{if(s!=null&&s.aborted)return;if(c.getAnimations().some(d=>d.pending||d.playState!=="finished")){a();return}u()})}if(t){const f=nc;if(!c.hasAttribute(f)){o.request(a);return}const d=new MutationObserver(()=>{c.hasAttribute(f)||(d.disconnect(),a())});d.observe(c,{attributes:!0,attributeFilter:[f]}),s==null||s.addEventListener("abort",()=>d.disconnect(),{once:!0});return}o.request(a)})}function Xt(e){const{enabled:t=!0,open:n,ref:o,batch:r=!1,onComplete:s}=e,i=te(s),c=Gc(o,n,r);l.useEffect(()=>{if(!t)return;const u=new AbortController;return c(i,u.signal),()=>{u.abort()}},[t,n,i,c])}const ko={tabIndex:-1,[sr]:""};function Xc(e){return t=>t==="touch"?e.current:!0}function Qr(e,t=!1){const n=In(),o=an()!=null,r=ze(()=>e(n,o)).current;return Pd({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:r.setOpen}),r}function es({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function si(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Od(e,t){const n=l.useRef(null);return te(o=>{const r=n.current;if(r!==null){if(r.element===o&&r.store===t&&r.id===e)return;n.current=null;const s=r.store;s.context.triggerElements.getById(r.id)===r.element&&(s.context.triggerElements.delete(r.id),si(s))}o!==null&&e!==void 0&&(n.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),si(t))})}function ts(e,t,n,o=!1){let r=e.preventUnmountingOnClose;t?r=!1:o&&(r=!0);const s=(n==null?void 0:n.id)??null;let i=e.activeTriggerId,c=e.activeTriggerElement;return(s||t)&&(i=s,c=n??null),{open:t,preventUnmountingOnClose:r,activeTriggerId:i,activeTriggerElement:c}}function qc(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Ad(e,t,n,o={}){var f,d,h;const r=n.reason,s=r===$e,i=t&&r===Xn,c=!t&&(r===Lt||r===wo),u=qc(n);if((d=(f=e.context).onOpenChange)==null||d.call(f,t,n),n.isCanceled)return;(h=o.onBeforeDispatch)==null||h.call(o),e.state.floatingRootContext.dispatchOpenChange(t,n);const a=()=>{const p=ts(e.state,t,n.trigger,u()),g={...o.extraState,...p};i?g.instantType="focus":c?g.instantType="dismiss":s&&(g.instantType=void 0),e.update(g)};s?at.flushSync(a):a()}function Zc(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Od(e,n),i=te(u=>{const a=n.select("open"),f=n.select("activeTriggerId");if(f===e){const d={activeTriggerElement:u,...a?o:null};n.update(d);return}if(f==null&&a){const d={activeTriggerId:e??null,activeTriggerElement:u,...o};n.update(d)}}),c=te(u=>{s(u),u&&i(u)});return J(()=>(c(t.current),()=>c(null)),[c,t,n,e]),J(()=>{if(r){const u={activeTriggerElement:t.current,...o};n.update(u)}},[r,n,t,...Object.values(o)]),{registerTrigger:c,isMountedByThisTrigger:r}}function ns(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,o=l.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");J(()=>{if(!r){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const u=e.context.triggerElements.size,a={};e.state.triggerCount!==u&&(a.triggerCount=u);const f=e.select("activeTriggerId");let d=null;if(f){const h=e.context.triggerElements.getById(f);if(h)o.current=f,h!==e.state.activeTriggerElement&&(a.activeTriggerElement=h);else{for(const[p,g]of e.context.triggerElements.entries())if(g===e.state.activeTriggerElement){a.activeTriggerId=p,a.activeTriggerElement=g,o.current=p;break}a.activeTriggerId===void 0&&(o.current===f?d=f:o.current=null)}}else o.current=null;if(!d&&!f&&u===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[p,g]=h.value;a.activeTriggerId=p,a.activeTriggerElement=g,o.current=p}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),d&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===d&&!e.context.triggerElements.getById(d)){const h=he(Ft);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,i,c,n])}function os(e,t,n,o){const{mounted:r,setMounted:s,transitionStatus:i}=Jr(e,!1,!1,o),c=t.useState("preventUnmountingOnClose"),u=e?!1:c;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:u});const a=te(()=>{var f,d;s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(d=(f=t.context).onOpenChangeComplete)==null||d.call(f,!1)});return Xt({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||a()}}),{forceUnmount:a,transitionStatus:i}}function rs(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:_e,inactiveTriggerProps:_e,popupProps:_e})},[e])}function Jc(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Do{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function ss(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Zr({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:_e,inactiveTriggerProps:_e,popupProps:_e}}const En=e=>e.triggerIdProp??e.activeTriggerId,is=e=>e.openProp??e.open,ii=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function Qc(e,t){return t!==void 0&&is(e)&&En(e)===t}function Md(e,t){return Qc(e,t)?!0:t!==void 0&&is(e)&&En(e)==null&&e.triggerCount===1}const cs={open:is,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:En,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:ii,isTriggerActive:(e,t)=>t!==void 0&&En(e)===t,isOpenedByTrigger:(e,t)=>Qc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&En(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Md(e,t)?ii(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function eu(e){const t=l.useCallback(o=>e===void 0?ke:e.subscribeStore(o),[e]),n=l.useCallback(()=>e===void 0?void 0:e.store,[e]);return Ao.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}function kd(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=In(),s=an()!=null,i=ze(()=>new Zr({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Do,floatingId:r,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=Re(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Dd(e){return Fd(e,e.rootContext)}function Fd(e,t){const{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),c=t.useState("open"),u=t.useState("floatingId"),[a,f]=l.useState(null),[d,h]=l.useState(void 0),[p,g]=l.useState(void 0),y=l.useRef(null),R=Gt(o),m=l.useMemo(()=>({reference:r,floating:s,domReference:i}),[r,s,i]),v=jf({...e,elements:{...m,...a&&{reference:a}}}),E=Re(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue("referenceElement",d??null),t.useSyncedValue("domReferenceElement",d===void 0?i:E),t.useSyncedValue("floatingElement",b);const S=l.useCallback(P=>{const L=Re(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;f(L),v.refs.setReference(L)},[v.refs]),w=l.useCallback(P=>{(Re(P)||P===null)&&(y.current=P,h(P)),(Re(v.refs.reference.current)||v.refs.reference.current===null||P!==null&&!Re(P))&&v.refs.setReference(P)},[v.refs,h]),T=l.useCallback(P=>{g(P),v.refs.setFloating(P)},[v.refs]),C=l.useMemo(()=>({...v.refs,setReference:w,setFloating:T,setPositionReference:S,domReference:y}),[v.refs,w,T,S]),I=l.useMemo(()=>({...v.elements,domReference:i}),[v.elements,i]),O=l.useMemo(()=>({...v,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:u,refs:C,elements:I,nodeId:n,rootStore:t}),[v,C,I,n,t,c,u]);return J(()=>{i&&(y.current=i)},[i]),J(()=>{t.context.dataRef.current.floatingContext=O;const P=R==null?void 0:R.nodesRef.current.find(L=>L.id===n);P&&(P.context=O)}),l.useMemo(()=>({...v,context:O,refs:C,elements:I,rootStore:t}),[v,C,I,O,t])}const Xo=Ji&&Ct;function Ld(e,t={}){const{enabled:n=!0,delay:o}=t,r="rootStore"in e?e.rootStore:e,{events:s,dataRef:i}=r.context,c=l.useRef(!1),u=l.useRef(null),a=l.useRef(!0),f=tt();l.useEffect(()=>{const h=r.select("domReferenceElement");if(!n)return;const p=Ae(h);function g(){const m=r.select("domReferenceElement");!r.select("open")&&Pe(m)&&m===qe(Se(m))&&(c.current=!0,u.current=m)}function y(){a.current=!0}function R(){a.current=!1}return ht(be(p,"blur",g),Xo&&be(p,"keydown",y,!0),Xo&&be(p,"pointerdown",R,!0))},[r,n]),l.useEffect(()=>{if(!n)return;function h(p){if(p.reason===Lt||p.reason===wo){const g=r.select("domReferenceElement");Re(g)&&(u.current=g,c.current=!0)}}return s.on("openchange",h),()=>{s.off("openchange",h)}},[s,n,r]);const d=l.useMemo(()=>{function h(){c.current=!1,u.current=null}return{onMouseLeave(){h()},onFocus(p){const g=p.currentTarget;if(c.current){if(u.current===g)return;h()}const y=We(p.nativeEvent);if(Re(y)){if(Xo&&!p.relatedTarget){if(!a.current&&!Co(y))return}else if(!pa(y))return}const R=no(p.relatedTarget,r.context.triggerElements),{nativeEvent:m,currentTarget:v}=p,E=typeof o=="function"?o():o;if(r.select("open")&&R||E===0||E===void 0){r.setOpen(!0,he(Xn,m,v));return}f.start(E,()=>{c.current||r.setOpen(!0,he(Xn,m,v))})},onBlur(p){h();const g=p.relatedTarget,y=p.nativeEvent,R=Re(g)&&g.hasAttribute(Cn("focus-guard"))&&g.getAttribute("data-type")==="outside";f.start(0,()=>{var b;const m=r.select("domReferenceElement"),v=qe(Se(m));!g&&v===m||ue((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,v)||ue(m,v)||R||no(g??v,r.context.triggerElements)||r.setOpen(!1,he(Xn,y))})}}},[i,o,r,f]);return l.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}class us{constructor(){Te(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});Te(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ct,this.restTimeout=new ct,this.handleCloseOptions=void 0}static create(){return new us}}const co=new WeakMap;function uo(e){var n,o,r;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&co.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(o=e.pointerEventsReferenceElement)==null||o.style.removeProperty("pointer-events"),(r=e.pointerEventsFloatingElement)==null||r.style.removeProperty("pointer-events"),co.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function tu(e,t){const{scopeElement:n,referenceElement:o,floatingElement:r}=t,s=co.get(n);s&&s!==e&&uo(s),uo(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=r,co.set(n,e),n.style.pointerEvents="none",o.style.pointerEvents="auto",r.style.pointerEvents="auto"}function ls(e){const t=e.context.dataRef.current,n=ze(()=>t.hoverInteractionState??us.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Ar(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function nu(e,t={}){const{enabled:n=!0,closeDelay:o=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),c=s.useState("floatingElement"),u=s.useState("domReferenceElement"),{dataRef:a}=s.context,f=Gt(),d=an(),h=ls(s),p=tt(),g=te(()=>{var m;return sc((m=a.current.openEvent)==null?void 0:m.type,h.interactedInside)}),y=te(()=>{var m;return ha((m=a.current.openEvent)==null?void 0:m.type)}),R=te(()=>{uo(h)});J(()=>{i||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,R())},[i,h,R]),l.useEffect(()=>R,[R]),J(()=>{var m,v,E,b,S;if(n&&i&&(m=h.handleCloseOptions)!=null&&m.blockPointerEvents&&y()&&Re(u)&&c){const w=u,T=c,C=Se(c),I=(E=(v=f==null?void 0:f.nodesRef.current.find(x=>x.id===d))==null?void 0:v.context)==null?void 0:E.elements.floating;I&&(I.style.pointerEvents="");const O=h.pointerEventsScopeElement!==T?h.pointerEventsScopeElement:null,P=I!==T?I:null,L=((S=(b=h.handleCloseOptions)==null?void 0:b.getScope)==null?void 0:S.call(b))??O??P??w.closest("[data-rootownerid]")??C.body;return tu(h,{scopeElement:L,referenceElement:w,floatingElement:T}),()=>{R()}}},[n,i,u,c,h,y,f,d,R]),l.useEffect(()=>{if(!n)return;function m(){return!!(f&&d&&Nt(f.nodesRef.current,d).length>0)}function v(C){const I=Ut(o,"close",h.pointerType),O=()=>{s.setOpen(!1,he($e,C)),f==null||f.events.emit("floating.closed",C)};I?h.openChangeTimeout.start(I,O):(h.openChangeTimeout.clear(),O())}function E(C){const I=We(C);if(!da(I)){h.interactedInside=!1;return}h.interactedInside=(I==null?void 0:I.closest("[aria-haspopup]"))!=null}function b(){h.openChangeTimeout.clear(),p.clear(),f==null||f.events.off("floating.closed",w),R()}function S(C){var L;if(m()&&f){f.events.on("floating.closed",w);return}if(no(C.relatedTarget,s.context.triggerElements))return;const I=((L=a.current.floatingContext)==null?void 0:L.nodeId)??r,O=C.relatedTarget;if(!(f&&I&&Re(O)&&Nt(f.nodesRef.current,I,!1).some(x=>{var k;return ue((k=x.context)==null?void 0:k.elements.floating,O)}))){if(h.handler){h.handler(C);return}R(),y()&&!g()&&v(C)}}function w(C){!f||!d||m()||p.start(0,()=>{f.events.off("floating.closed",w),s.setOpen(!1,he($e,C)),f.events.emit("floating.closed",C)})}const T=c;return ht(T&&be(T,"mouseenter",b),T&&be(T,"mouseleave",S),T&&be(T,"pointerdown",E,!0),()=>{f==null||f.events.off("floating.closed",w)})},[n,c,s,a,o,r,y,g,R,h,f,d,p])}const _d={current:null};function ou(e,t={}){const{enabled:n=!0,delay:o=0,handleClose:r=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:u=_d,externalTree:a,isActiveTrigger:f=!0,getHandleCloseContext:d,isClosing:h,shouldOpen:p,guardStaleOpen:g=!1}=t,y="rootStore"in e?e.rootStore:e,{dataRef:R,events:m}=y.context,v=Gt(a),E=ls(y),b=l.useRef(!1),S=Fe(r),w=Fe(o),T=Fe(i),C=Fe(n),I=Fe(p),O=Fe(h),P=te(()=>{var F;return sc((F=R.current.openEvent)==null?void 0:F.type,E.interactedInside)}),L=te(()=>{var F;return((F=I.current)==null?void 0:F.call(I))!==!1}),x=te((F,V,M)=>{const N=y.context.triggerElements;if(N.hasElement(V))return!F||!ue(F,V);if(!Re(M))return!1;const A=M;return N.hasMatchingElement(U=>ue(U,A))&&(!F||!ue(F,A))}),k=te(()=>{if(!E.handler)return;Se(y.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),D=te(()=>{uo(E)});return f&&(E.handleCloseOptions=r==null?void 0:r.__options),l.useEffect(()=>k,[k]),l.useEffect(()=>{if(!n)return;function F(V){V.open?b.current=!1:(b.current=V.reason===$e,k(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return m.on("openchange",F),()=>{m.off("openchange",F)}},[n,m,E,k]),l.useEffect(()=>{if(!n)return;function F(B,W=!0){const H=Ut(w.current,"close",E.pointerType);H?E.openChangeTimeout.start(H,()=>{y.setOpen(!1,he($e,B)),v==null||v.events.emit("floating.closed",B)}):W&&(E.openChangeTimeout.clear(),y.setOpen(!1,he($e,B)),v==null||v.events.emit("floating.closed",B))}const V=u.current??(f?y.select("domReferenceElement"):null);if(!Re(V))return;function M(B){var ee;if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,s&&!At(E.pointerType))return;const W=ks(T.current),H=Ut(w.current,"open",E.pointerType),Y=We(B),$=B.currentTarget??null,Q=y.select("domReferenceElement");let j=$;if(Re(Y)&&!y.context.triggerElements.hasElement(Y)){for(const ae of y.context.triggerElements.elements())if(ue(ae,Y)){j=ae;break}}Re($)&&Re(Q)&&!y.context.triggerElements.hasElement($)&&ue($,Q)&&(j=Q);const X=j==null?!1:x(Q,j,Y),se=y.select("open"),le=((ee=O.current)==null?void 0:ee.call(O))??y.select("transitionStatus")==="ending",q=!se&&le&&b.current,G=!X&&Re(j)&&Re(Q)&&ue(Q,j)&&q,Z=W>0&&!H,ie=X&&(se||q)||G,xe=!se||X;if(ie){L()&&y.setOpen(!0,he($e,B,j));return}Z||(H?E.openChangeTimeout.start(H,()=>{xe&&L()&&y.setOpen(!0,he($e,B,j))}):xe&&L()&&y.setOpen(!0,he($e,B,j)))}function N(B){if(P()){D();return}k();const W=y.select("domReferenceElement"),H=Se(W);E.restTimeout.clear(),E.restTimeoutPending=!1;const Y=R.current.floatingContext??(d==null?void 0:d());if(no(B.relatedTarget,y.context.triggerElements))return;if(S.current&&Y){y.select("open")||E.openChangeTimeout.clear();const Q=u.current;E.handler=S.current({...Y,tree:v,x:B.clientX,y:B.clientY,onClose(){D(),k(),C.current&&!P()&&Q===y.select("domReferenceElement")&&F(B,!0)}}),H.addEventListener("mousemove",E.handler),E.handler(B);return}(E.pointerType==="touch"?!ue(y.select("floatingElement"),B.relatedTarget):!0)&&F(B)}function A(B){ue(V,B.relatedTarget)||(E.openChangeTimeout.clear(),E.restTimeout.clear(),E.restTimeoutPending=!1)}const U=g?be(V,"mouseout",A):void 0;return c?ht(be(V,"mousemove",M,{once:!0}),be(V,"mouseenter",M),be(V,"mouseleave",N),U):ht(be(V,"mouseenter",M),be(V,"mouseleave",N),U)},[k,D,R,w,y,n,S,E,f,x,P,s,c,T,u,v,C,d,O,L,g]),l.useMemo(()=>{if(!n)return;function F(V){E.pointerType=V.pointerType}return{onPointerDown:F,onPointerEnter:F,onMouseMove(V){var Y,$,Q;const{nativeEvent:M}=V,N=V.currentTarget,A=y.select("domReferenceElement"),U=y.select("open"),B=x(A,N,V.target);if(s&&!At(E.pointerType))return;if(U&&B&&((Y=E.handleCloseOptions)!=null&&Y.blockPointerEvents)){const j=y.select("floatingElement");if(j){const X=((Q=($=E.handleCloseOptions)==null?void 0:$.getScope)==null?void 0:Q.call($))??N.ownerDocument.body;tu(E,{scopeElement:X,referenceElement:N,floatingElement:j})}}const W=ks(T.current);if(U&&!B||W===0||!B&&E.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;E.restTimeout.clear();function H(){if(E.restTimeoutPending=!1,P())return;const j=y.select("open");!E.blockMouseMove&&(!j||B)&&L()&&y.setOpen(!0,he($e,M,N))}E.pointerType==="touch"?at.flushSync(()=>{H()}):B&&U?H():(E.restTimeoutPending=!0,E.restTimeout.start(W,H))}}},[n,E,P,x,s,y,T,L])}const Nd="Escape";function ci(e){return Ct&&e.movementX===0&&e.movementY===0}function Fo(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Bn(e,t){return Fo(t,e===tc||e===_r,e===Eo||e===So)}function qo(e,t,n){return Fo(t,e===_r,n?e===Eo:e===So)||e==="Enter"||e===" "||e===""}function Hd(e,t,n){return Fo(t,n?e===Eo:e===So,e===_r)}function Vd(e,t,n,o){const r=n?e===So:e===Eo,s=e===tc;return t==="both"||t==="horizontal"&&o?e===Nd:Fo(t,r,s)}function Bd(e,t){const{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:u=!1,nested:a=!1,rtl:f=!1,virtual:d=!1,focusItemOnOpen:h="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:g=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:m,id:v,resetOnPointerLeave:E=!0,externalTree:b,grid:S}=t,w=S!=null,T="rootStore"in e?e.rootStore:e,C=T.useState("open"),I=T.useState("floatingElement"),O=T.useState("domReferenceElement"),P=T.context.dataRef,L=oo(I),x=cr(O),k=Fe(L),D=an(),F=Gt(b),V=l.useRef(h),M=l.useRef(i??-1),N=l.useRef(null),A=l.useRef(!0),U=te(z=>{r(M.current===-1?null:M.current,z)}),B=l.useRef(!!I),W=l.useRef(C),H=l.useRef(!1),Y=l.useRef(!1),$=l.useRef(null),Q=Fe(y),j=Fe(C),X=Fe(i),se=Fe(E),le=rn(),q=rn(),G=te(()=>{function z(ce){d?F==null||F.events.emit("virtualfocus",ce):$.current=Zn(ce,{sync:H.current,preventScroll:!0})}const re=n.current[M.current],K=Y.current;re&&z(re),(H.current?ce=>ce():ce=>le.request(ce))(()=>{var Ee;const ce=n.current[M.current]||re;if(!ce)return;re||z(ce),oe&&(K||!A.current)&&((Ee=ce.scrollIntoView)==null||Ee.call(ce,{block:"nearest",inline:"nearest"}))})});J(()=>{P.current.orientation=R},[P,R]),J(()=>{s&&(C&&I?(M.current=i??-1,V.current&&i!=null&&(Y.current=!0,U())):B.current&&(M.current=-1,U()))},[s,C,I,i,U]),J(()=>{if(s){if(!C){H.current=!1;return}if(I)if(o==null){if(H.current=!1,X.current!=null)return;if(B.current&&(M.current=-1,G()),(!W.current||!B.current)&&V.current&&(N.current!=null||V.current===!0&&N.current==null)){let z=0;const re=()=>{n.current[0]==null?(z<2&&(z?_=>q.request(_):queueMicrotask)(re),z+=1):(M.current=N.current==null||qo(N.current,R,f)||a?qn(n):lr(n),N.current=null,U())};re()}}else vn(n.current,o)||(M.current=o,G(),Y.current=!1)}},[s,C,I,o,X,a,n,R,f,U,G,q]),J(()=>{var ce,de;if(!s||I||!F||d||!B.current)return;const z=F.nodesRef.current,re=(de=(ce=z.find(Ee=>Ee.id===D))==null?void 0:ce.context)==null?void 0:de.elements.floating,K=qe(Se(O??re??null)),_=z.some(Ee=>Ee.context&&ue(Ee.context.elements.floating,K));re&&!_&&A.current&&re.focus({preventScroll:!0})},[s,I,O,F,D,d]),J(()=>{W.current=C,B.current=!!I}),J(()=>{C||(N.current=null,V.current=h)},[C,h]);const Z=o!=null,ie=te(z=>{if(!j.current)return;const re=n.current.indexOf(z.currentTarget);re!==-1&&(M.current!==re||o!==re)&&(M.current=re,U(z))}),xe=te(()=>{var z,re,K;return m??((K=(re=(z=F==null?void 0:F.nodesRef.current.find(_=>_.id===D))==null?void 0:z.context)==null?void 0:re.dataRef)==null?void 0:K.current.orientation)}),ee=te(()=>qn(n,Q.current)),ae=te(z=>{if(A.current=!1,H.current=!0,z.which===229||!j.current&&z.currentTarget===k.current)return;if(a&&Vd(z.key,R,f,w)){Bn(z.key,xe())||pt(z),T.setOpen(!1,he(Ds,z.nativeEvent)),Pe(O)&&(d?F==null||F.events.emit("virtualfocus",O):O.focus());return}const re=M.current,K=qn(n,y),_=lr(n,y);if(x||(z.key==="Home"&&(pt(z),M.current=K,U(z)),z.key==="End"&&(pt(z),M.current=_,U(z))),S!=null){const ce=S(z,M.current,n,R,u,f,y,K,_);if(ce!=null&&(M.current=ce,U(z)),R==="both")return}if(Bn(z.key,R)){if(pt(z),C&&!d&&qe(z.currentTarget.ownerDocument)===z.currentTarget){M.current=qo(z.key,R,f)?K:_,U(z);return}qo(z.key,R,f)?u?re>=_?c&&re!==n.current.length?M.current=-1:(H.current=!1,M.current=K):M.current=Et(n.current,{startingIndex:re,disabledIndices:y}):M.current=Math.min(_,Et(n.current,{startingIndex:re,disabledIndices:y})):u?re<=K?c&&re!==-1?M.current=n.current.length:(H.current=!1,M.current=_):M.current=Et(n.current,{startingIndex:re,decrement:!0,disabledIndices:y}):M.current=Math.max(K,Et(n.current,{startingIndex:re,decrement:!0,disabledIndices:y})),vn(n.current,M.current)&&(M.current=-1),U(z)}}),oe=l.useMemo(()=>({onFocus(re){H.current=!0,ie(re)},onClick:({currentTarget:re})=>re.focus({preventScroll:!0}),onMouseMove(re){ci(re)||(H.current=!0,Y.current=!1,p&&ie(re))},onPointerLeave(re){var _;if(!j.current||!A.current||re.pointerType==="touch")return;H.current=!0;const K=re.relatedTarget;if(!(!p||n.current.includes(K))&&se.current&&((_=$.current)==null||_.call($),$.current=null,M.current=-1,U(re),!d)){const ce=k.current,de=qe(Se(ce));ce&&ue(ce,de)&&ce.focus({preventScroll:!0})}}}),[ie,j,k,p,n,U,se,d]),me=l.useMemo(()=>d&&C&&Z&&{"aria-activedescendant":`${v}-${o}`},[d,C,Z,v,o]),ye=l.useMemo(()=>({...x?{}:me,onKeyDown(z){if(z.key==="Tab"&&z.shiftKey&&C&&!d){const re=We(z.nativeEvent);if(re&&!ue(k.current,re))return;pt(z),T.setOpen(!1,he(Yt,z.nativeEvent)),Pe(O)&&O.focus();return}ae(z)},onPointerMove(z){ci(z)||(A.current=!0)}}),[me,ae,k,x,T,C,d,O]),ge=l.useMemo(()=>{function z(_){T.setOpen(!0,he(Ds,_.nativeEvent,_.currentTarget))}function re(_){h==="auto"&&yo(_.nativeEvent)&&(V.current=!d)}function K(_){V.current=h,h==="auto"&&kr(_.nativeEvent)&&(V.current=!0)}return{onKeyDown(_){const ce=T.select("open");A.current=!1;const de=_.key.startsWith("Arrow"),Ee=Hd(_.key,xe(),f),Ve=Bn(_.key,R),Ge=(a?Ee:Ve)||_.key==="Enter"||_.key.trim()==="";if(d&&ce)return ae(_);if(!(!ce&&!g&&de)){if(Ge){const Me=Bn(_.key,xe());N.current=a&&Me?null:_.key}if(a){Ee&&(pt(_),ce?(M.current=ee(),U(_)):z(_));return}Ve&&(X.current!=null&&(M.current=X.current),pt(_),!ce&&g?z(_):ae(_),ce&&U(_))}},onFocus(_){T.select("open")&&!d&&(M.current=-1,U(_))},onPointerDown:K,onPointerEnter:K,onMouseDown:re,onClick:re}},[ae,h,ee,a,U,T,g,R,xe,f,X,d]),Ce=l.useMemo(()=>({...me,...ge}),[me,ge]);return l.useMemo(()=>s?{reference:Ce,floating:ye,item:oe,trigger:ge}:{},[s,Ce,ye,ge,oe])}function jd(e,t){const{listRef:n,elementsRef:o,activeIndex:r,onMatch:s,disabledIndices:i,onTyping:c,enabled:u=!0,resetMs:a=750,selectedIndex:f=null}=t,d="rootStore"in e?e.rootStore:e,h=d.useState("open"),p=tt(),g=l.useRef(""),y=l.useRef(f??r??-1),R=l.useRef(null),m=te(b=>{function S(k){return o==null?void 0:o.current[k]}function w(k){const D=S(k);return D&&!Po(D)||D!=null&&D.matches(":disabled")?!1:i==null||!en(kt,k,i)}function T(k,D,F=0){if(k.length===0)return-1;const V=(F%k.length+k.length)%k.length,M=D.toLowerCase();for(let N=0;N<k.length;N+=1){const A=(V+N)%k.length,U=k[A];if(!(!(U!=null&&U.toLowerCase().startsWith(M))||!w(A)))return A}return-1}const C=n.current;if(g.current.length>0&&b.key===" "&&(pt(b),c==null||c(!0)),g.current.length>0&&g.current[0]!==" "&&T(C,g.current)===-1&&b.key!==" "&&(c==null||c(!1)),C==null||b.key.length!==1||b.ctrlKey||b.metaKey||b.altKey)return;h&&b.key!==" "&&(pt(b),c==null||c(!0));const I=g.current==="";I&&(y.current=f??r??-1),C.every((k,D)=>{var F,V;return k&&w(D)?((F=k[0])==null?void 0:F.toLowerCase())!==((V=k[1])==null?void 0:V.toLowerCase()):!0})&&g.current===b.key&&(g.current="",y.current=R.current),g.current+=b.key,p.start(a,()=>{g.current="",y.current=R.current,c==null||c(!1)});const L=((I?f??r??-1:y.current)??0)+1,x=T(C,g.current,L);x!==-1?(s==null||s(x),R.current=x):b.key!==" "&&(g.current="",c==null||c(!1))}),v=te(b=>{const S=b.relatedTarget,w=d.select("domReferenceElement"),T=d.select("floatingElement");ue(w,S)||ue(T,S)||(p.clear(),g.current="",y.current=R.current,c==null||c(!1))});J(()=>{!h&&f!==null||(p.clear(),R.current=null,g.current!==""&&(g.current=""))},[h,f,p]);const E=l.useMemo(()=>({onKeyDown:m,onBlur:v}),[m,v]);return l.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}const ui=.1,$d=ui*ui,we=.5;function jn(e,t,n,o,r,s){return o>=t!=s>=t&&e<=(r-n)*(t-o)/(s-o)+n}function $n(e,t,n,o,r,s,i,c,u,a){let f=!1;return jn(e,t,n,o,r,s)&&(f=!f),jn(e,t,r,s,i,c)&&(f=!f),jn(e,t,i,c,u,a)&&(f=!f),jn(e,t,u,a,n,o)&&(f=!f),f}function Wd(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Wn(e,t,n,o,r,s){const i=Math.min(n,r),c=Math.max(n,r),u=Math.min(o,s),a=Math.max(o,s);return e>=i&&e<=c&&t>=u&&t<=a}function ru(e={}){const{blockPointerEvents:t=!1}=e,n=new ct,o=({x:r,y:s,placement:i,elements:c,onClose:u,nodeId:a,tree:f})=>{const d=i==null?void 0:i.split("-")[0];let h=!1,p=null,g=null,y=typeof performance<"u"?performance.now():0;function R(v,E){const b=performance.now(),S=b-y;if(p===null||g===null||S===0)return p=v,g=E,y=b,!1;const w=v-p,T=E-g,C=w*w+T*T,I=S*S*$d;return p=v,g=E,y=b,C<I}function m(){n.clear(),u()}return function(E){n.clear();const b=c.domReference,S=c.floating;if(!b||!S||d==null||r==null||s==null)return;const{clientX:w,clientY:T}=E,C=We(E),I=E.type==="mouseleave",O=ue(S,C),P=ue(b,C);if(O&&(h=!0,!I))return;if(P&&(h=!1,!I)){h=!0;return}if(I&&Re(E.relatedTarget)&&ue(S,E.relatedTarget))return;function L(){return!!(f&&Nt(f.nodesRef.current,a).length>0)}function x(){L()||m()}if(L())return;const k=b.getBoundingClientRect(),D=S.getBoundingClientRect(),F=r>D.right-D.width/2,V=s>D.bottom-D.height/2,M=D.width>k.width,N=D.height>k.height,A=(M?k:D).left,U=(M?k:D).right,B=(N?k:D).top,W=(N?k:D).bottom;if(d==="top"&&s>=k.bottom-1||d==="bottom"&&s<=k.top+1||d==="left"&&r>=k.right-1||d==="right"&&r<=k.left+1){x();return}let H=!1;switch(d){case"top":H=Wn(w,T,A,k.top+1,U,D.bottom-1);break;case"bottom":H=Wn(w,T,A,D.top+1,U,k.bottom-1);break;case"left":H=Wn(w,T,D.right-1,W,k.left+1,B);break;case"right":H=Wn(w,T,k.right-1,W,D.left+1,B);break}if(H)return;if(h&&!Wd(w,T,k)){x();return}if(!I&&R(w,T)){x();return}let Y=!1;switch(d){case"top":{const $=M?we/2:we*4,Q=M||F?r+$:r-$,j=M?r-$:F?r+$:r-$,X=s+we+1,se=F||M?D.bottom-we:D.top,le=F?M?D.bottom-we:D.top:D.bottom-we;Y=$n(w,T,Q,X,j,X,D.left,se,D.right,le);break}case"bottom":{const $=M?we/2:we*4,Q=M||F?r+$:r-$,j=M?r-$:F?r+$:r-$,X=s-we,se=F||M?D.top+we:D.bottom,le=F?M?D.top+we:D.bottom:D.top+we;Y=$n(w,T,Q,X,j,X,D.left,se,D.right,le);break}case"left":{const $=N?we/2:we*4,Q=N||V?s+$:s-$,j=N?s-$:V?s+$:s-$,X=r+we+1,se=V||N?D.right-we:D.left,le=V?N?D.right-we:D.left:D.right-we;Y=$n(w,T,se,D.top,le,D.bottom,X,Q,X,j);break}case"right":{const $=N?we/2:we*4,Q=N||V?s+$:s-$,j=N?s-$:V?s+$:s-$,X=r-we,se=V||N?D.left+we:D.right,le=V?N?D.left+we:D.right:D.left+we;Y=$n(w,T,X,Q,X,j,se,D.top,le,D.bottom);break}}Y?h||n.start(40,x):x()}};return o.__options={...e,blockPointerEvents:t},o}const Ud={...cs,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Yd extends On{constructor(n,o,r){const s=new Do;super(zd(n,s,o,r),Kd(s),Ud);Te(this,"setOpen",(n,o)=>{Ad(this,n,o,{extraState:{openChangeReason:o.reason}})})}cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,he(Lt,n))}}function zd(e,t,n,o=!1){return{...ss(t,n,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Kd(e){return{popupRef:l.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Jg=po(function(t){const{disabled:n=!1,defaultOpen:o=!1,open:r,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:u,onOpenChangeComplete:a,handle:f,triggerId:d,defaultTriggerId:h=null,children:p}=t,g=Qr((P,L)=>new Yd({open:o,openProp:r,activeTriggerId:h,triggerIdProp:d},P,L));g.useControlledProp("openProp",r),g.useControlledProp("triggerIdProp",d),g.useContextCallback("onOpenChange",u),g.useContextCallback("onOpenChangeComplete",a);const y=g.useState("open"),R=!n&&y,m=g.useState("activeTriggerId"),v=g.useState("mounted"),E=g.useState("payload");g.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),ns(g,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:b,transitionStatus:S}=os(R,g),w=g.useState("isInstantPhase"),T=g.useState("instantType"),C=g.useState("lastOpenChangeReason"),I=l.useRef(null);J(()=>{y&&n&&g.setOpen(!1,he(cc))},[y,n,g]),J(()=>{S==="ending"&&C===Ft||S!=="ending"&&w?(T!=="delay"&&(I.current=T),g.set("instantType","delay")):I.current!==null&&(g.set("instantType",I.current),I.current=null)},[S,w,C,T,g]),J(()=>{R&&m==null&&g.set("payload",void 0)},[g,m,R]),l.useImperativeHandle(c,()=>({unmount:b,close:()=>g.setOpen(!1,he(Br))}),[b,g]);const O=R||v||!n&&i!=="none";return ne.jsxs(Zi.Provider,{value:g,children:[f&&ne.jsx(es,{handle:f,store:g}),O&&ne.jsx(Gd,{store:g,disabled:n,trackCursorAxis:i}),typeof p=="function"?p({payload:E}):p]})});function Gd({store:e,disabled:t,trackCursorAxis:n}){const o=e.useState("floatingRootContext"),r=Io(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=sf(o,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=l.useMemo(()=>Wt(s.reference,r.reference),[s.reference,r.reference]);return rs(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:r.floating??_e}),null}function fn(e){return In(e,"base-ui")}const su=l.createContext(void 0);function Xd(){return l.useContext(su)}const qd=600,iu="data-base-ui-tooltip-trigger";function li(e){if("composedPath"in e){const n=e.composedPath();for(let o=0;o<n.length;o+=1){const r=n[o];if(Re(r))return r}}const t=e.target;return Re(t)?t:null}function Zd(e){let t=e;for(;t;){const n=t.closest(`[${iu}]`);if(n)return n;const o=t.getRootNode();t="host"in o&&Re(o.host)?o.host:null}return null}const Qg=qi(function(t,n){const{render:o,className:r,style:s,handle:i,payload:c,disabled:u,delay:a,closeOnClick:f=!0,closeDelay:d,id:h,...p}=t,g=go(!0),R=eu(i)??g;if(!R)throw new Error(Ne(82));const m=fn(h),v=R.useState("isTriggerActive",m),E=R.useState("isOpenedByTrigger",m),b=R.useState("floatingRootContext"),S=l.useRef(null),w=d??0,{registerTrigger:T,isMountedByThisTrigger:C}=Zc(m,S,R,{payload:c,closeOnClick:f,closeDelay:w}),I=Xd(),{activeIdRef:O,delayRef:P,isInstantPhase:L,hasProvider:x}=va(b,{open:E}),k=ls(b);R.useSyncedValue("isInstantPhase",L);const D=R.useState("disabled"),F=u??D,V=Fe(F),M=R.useState("trackCursorAxis"),N=R.useState("disableHoverablePopup"),A=l.useRef(!1),U=tt(),B=l.useRef(void 0);function W(){return x&&O.current!=null?0:a??I??qd}function H(G){const Z=S.current;if(!Z||!G)return!1;const ie=Zd(G);return ie!==null&&ie!==Z&&ue(Z,ie)}function Y(G){const Z=H(G);return A.current=Z,Z&&(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1,U.clear()),Z}const $=ou(b,{enabled:!F,mouseOnly:!0,move:!1,handleClose:!N&&M!=="both"?ru():null,restMs:W,delay(){return d==null&&x?{close:Ut(P.current,"close")}:{close:w}},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>R.select("transitionStatus")==="ending",shouldOpen(){return!A.current}}),Q=Ld(b,{enabled:!F}).reference,j=G=>{const Z=A.current,ie=li(G),xe=Y(ie),ee=S.current,ae=ee&&ie&&ue(ee,ie);if(xe&&R.select("open")&&R.select("lastOpenChangeReason")===$e){R.setOpen(!1,he($e,G));return}if(Z&&!xe&&ae&&!V.current&&!R.select("open")&&ee&&At(B.current)){const oe=()=>{!A.current&&!V.current&&!R.select("open")&&R.setOpen(!0,he($e,G,ee))},me=W();me===0?(U.clear(),oe()):U.start(me,oe)}},X=R.useState("triggerProps",C);return Le("button",t,{state:{open:E},ref:[n,T,S],props:[$,Q,C||M!=="none"?X:void 0,{onMouseOver(G){j(G.nativeEvent)},onFocus(G){H(li(G.nativeEvent))&&G.preventBaseUIHandler()},onMouseLeave(){A.current=!1,U.clear(),B.current=void 0},onPointerEnter(G){B.current=G.pointerType},onPointerDown(G){B.current=G.pointerType,R.set("closeOnClick",f),f&&!R.select("open")&&R.cancelPendingOpen(G.nativeEvent)},onClick(G){f&&!R.select("open")&&R.cancelPendingOpen(G.nativeEvent)},id:m,[ir]:F?"":void 0,[iu]:F?void 0:""},p],stateAttributesMapping:Nr})}),cu=l.createContext(void 0);function Jd(){const e=l.useContext(cu);if(e===void 0)throw new Error(Ne(70));return e}const Qd=l.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,style:c,...u}=t,{node:a,subtree:f}=Ic({container:r,ref:n,componentProps:t,elementProps:u});return!f&&!a?null:ne.jsxs(l.Fragment,{children:[f,a&&at.createPortal(o,a)]})}),eh=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t;return go().useState("mounted")||o?ne.jsx(cu.Provider,{value:o,children:ne.jsx(Qd,{ref:n,...r})}):null}),uu=l.createContext(void 0);function ep(){const e=l.useContext(uu);if(e===void 0)throw new Error(Ne(71));return e}const tp=l.createContext(void 0);function as(){const e=l.useContext(tp);return(e==null?void 0:e.direction)??"ltr"}const np=e=>({name:"arrow",options:e,async fn(t){var N,A;const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:a,padding:f=0,offsetParent:d="real"}=_t(e,t)||{};if(a==null)return{};const h=dc(f),p={x:n,y:o},g=Ur(r),y=Wr(g),R=await i.getDimensions(a),m=g==="y",v=m?"top":"left",E=m?"bottom":"right",b=m?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[g]-p[g]-s.floating[y],w=p[g]-s.reference[g],T=d==="real"?await((N=i.getOffsetParent)==null?void 0:N.call(i,a)):c.floating;let C=c.floating[b]||s.floating[y];(!C||!await((A=i.isElement)==null?void 0:A.call(i,T)))&&(C=c.floating[b]||s.floating[y]);const I=S/2-w/2,O=C/2-R[y]/2-1,P=Math.min(h[v],O),L=Math.min(h[E],O),x=P,k=C-R[y]-L,D=C/2-R[y]/2+I,F=fc(x,D,k),V=!u.arrow&&Tt(r)!=null&&D!==F&&s.reference[y]/2-(D<x?P:L)-R[y]/2<0,M=V?D<x?D-x:D-k:0;return{[g]:p[g]+M,data:{[g]:F,centerOffset:D-F-M,...V&&{alignmentOffset:M}},reset:V}}}),op=(e,t)=>{const{name:n,fn:o}=np(e);return{name:n,fn:o,options:[e,t]}},rp={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},sp={sideX:"left",sideY:"top"},ip="--available-width",cp="--available-height",up="--anchor-width",lp="--anchor-height",ap="--transform-origin",ai=ip,fi=cp;function lu(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function di(e,t,n){const{rects:o,placement:r}=e;return{side:lu(t,it(r),n),align:Tt(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function fs(e){return fp(e,Dd)}function fp(e,t){var lt,He;const{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,collisionBoundary:u,collisionPadding:a=5,sticky:f=!1,arrowPadding:d=5,disableAnchorTracking:h=!1,inline:p,keepMounted:g=!1,floatingRootContext:y,mounted:R,collisionAvoidance:m,shift:v,nodeId:E,adaptiveOrigin:b,lazyFlip:S=!1,externalTree:w}=e,[T,C]=l.useState(null);!R&&T!==null&&C(null);const I=m.side||"flip",O=m.align||"flip",P=m.fallbackAxisSide||"end",L=(v==null?void 0:v.crossAxis)??!1,x=v==null?void 0:v.rootBoundary,k=typeof n=="function"?n:void 0,D=te(k),F=k?D:n,V=Fe(n),M=Fe(R),A=as()==="rtl",U=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":A?"left":"right","inline-start":A?"right":"left"}[r],B=i==="center"?U:`${U}-${i}`;let W=a;typeof W=="number"?W={top:W,right:W,bottom:W,left:W}:W&&(W={top:W.top||0,right:W.right||0,bottom:W.bottom||0,left:W.left||0});const H=1,Y=r==="bottom"?H:0,$=r==="top"?H:0,Q=r==="right"?H:0,j=r==="left"?H:0,X={boundary:u==="clipping-ancestors"?"clippingAncestors":u,padding:W},se=l.useRef(null),le=Fe(s),q=Fe(c),G=typeof s!="function"?s:0,Z=typeof c!="function"?c:0,ie=[];p&&ie.push(p),ie.push($f(pe=>{const De=di(pe,r,A),Be=typeof le.current=="function"?le.current(De):le.current,je=typeof q.current=="function"?q.current(De):q.current;return{mainAxis:Be,crossAxis:je,alignmentAxis:je}},[G,Z,A,r]));const xe=O==="none"&&I!=="shift",ee=!xe&&(f||L||I==="shift"),ae=I==="none"?null:Yf({...X,padding:{top:W.top+H+Y,right:W.right+H+j,bottom:W.bottom+H+$,left:W.left+H+Q},mainAxis:!L&&I==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),oe=xe?null:Wf({...X,rootBoundary:x,mainAxis:O!=="none",crossAxis:ee,limiter:f||L?void 0:Uf(pe=>{if(!se.current)return{};const{width:De,height:Be}=se.current.getBoundingClientRect(),je=st(it(pe.placement)),rt=je==="y"?De:Be,et=je==="y"?W.left+W.right:W.top+W.bottom;return{offset:rt/2+et/2}})},[X,f,L,x,W,O]);I==="shift"||O==="shift"||i==="center"?ie.push(oe,ae):ie.push(ae,oe),ie.push(zf({...X,apply({elements:{floating:pe},availableWidth:De,availableHeight:Be,rects:je}){if(!M.current)return;const rt=pe.style;rt.setProperty(ai,`${De}px`),rt.setProperty(fi,`${Be}px`);const et=Ae(pe).devicePixelRatio||1,{x:Vt,y:Pt,width:ve,height:Ie}=je.reference,Je=(Math.round((Vt+ve)*et)-Math.round(Vt*et))/et,bt=(Math.round((Pt+Ie)*et)-Math.round(Pt*et))/et;rt.setProperty(up,`${Je}px`),rt.setProperty(lp,`${bt}px`)}}),op(pe=>({element:se.current||Se(pe.elements.floating).createElement("div"),padding:se.current?d:0,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(pe){var dn,Zt,kn,pn,Ss,xs;const{elements:{floating:De},middlewareData:Be,placement:je,platform:rt,rects:et,y:Vt}=pe,Pt=it(je),ve=Tt(je),Ie=st(Pt)==="y",Je=se.current,bt=typeof s=="function"?s(di(pe,r,A)):s;let dt;if(!Je&&ve&&Math.abs(Ie?((dn=Be.shift)==null?void 0:dn.x)||0:((Zt=Be.shift)==null?void 0:Zt.y)||0)<=1)dt=ve==="start"===(Ie&&((kn=rt.isRTL)==null?void 0:kn.call(rt,De))===!0)?"100%":"0%";else{const $u=Ie?((pn=Be.arrow)==null?void 0:pn.x)||0:((Ss=Be.arrow)==null?void 0:Ss.y)||0,Wu=Ie?(Je==null?void 0:Je.clientWidth)||0:(Je==null?void 0:Je.clientHeight)||0;dt=`${$u+Wu/2}px`}let Bt=Pt==="top"||Pt==="left"?`calc(100% + ${bt}px)`:`${-bt}px`;return ee&&Ie&&Math.abs(((xs=Be.shift)==null?void 0:xs.y)||0)>bt&&(Bt=`${et.reference.y+et.reference.height/2-Vt}px`),De.style.setProperty(ap,Ie?`${dt} ${Bt}`:`${Bt} ${dt}`),{}}},rp,b),J(()=>{!R&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[R,y]);const me=l.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:ye,elements:ge,x:Ce,y:z,middlewareData:re,update:K,placement:_,context:ce,isPositioned:de,floatingStyles:Ee}=t({rootContext:y,open:g?R:void 0,placement:B,middleware:ie,strategy:o,whileElementsMounted:g?void 0:(...pe)=>ti(...pe,me),nodeId:E,externalTree:w}),{sideX:Ve,sideY:Ge}=re.adaptiveOrigin||sp,Me=de?o:"fixed",Ye=l.useMemo(()=>{let pe;return de?b?pe={position:Me,[Ve]:Ce,[Ge]:z}:pe={...Ee,position:Me}:pe={position:Me,top:0,left:0},pe[ai]="100vw",pe[fi]="100vh",de||(pe.opacity=0),pe},[b,Me,Ve,Ce,Ge,z,Ee,de]),Qe=l.useRef(null);J(()=>{if(!R)return;const pe=V.current,De=typeof pe=="function"?pe():pe,je=(pi(De)?De.current:De)||null||null;je!==Qe.current&&(ye.setPositionReference(je),Qe.current=je)},[R,ye,F,V]),l.useEffect(()=>{if(!R)return;const pe=V.current;typeof pe!="function"&&pi(pe)&&pe.current!==Qe.current&&(ye.setPositionReference(pe.current),Qe.current=pe.current)},[R,ye,F,V]),l.useEffect(()=>{if(g&&R&&ge.reference&&ge.floating)return ti(ge.reference,ge.floating,K,me)},[g,R,ge,K,me]);const Xe=it(_),ft=lu(r,Xe,A),ut=Tt(_)||"center",mt=!!((lt=re.hide)!=null&<.referenceHidden);J(()=>{S&&R&&de&&Xe!==U&&C(Xe)},[S,R,de,Xe,U]);const ot=l.useMemo(()=>{var pe,De;return{position:"absolute",top:(pe=re.arrow)==null?void 0:pe.y,left:(De=re.arrow)==null?void 0:De.x}},[re.arrow]),yt=((He=re.arrow)==null?void 0:He.centerOffset)!==0;return l.useMemo(()=>({positionerStyles:Ye,arrowStyles:ot,arrowRef:se,arrowUncentered:yt,side:ft,align:ut,physicalSide:Xe,anchorHidden:mt,refs:ye,context:ce,isPositioned:de,update:K}),[Ye,ot,se,yt,ft,ut,Xe,mt,ye,ce,de,K])}function pi(e){return e!=null&&"current"in e}function Lo(e){return e==="starting"?Ga:_e}function ds(e,t,{styles:n,transitionStatus:o,props:r,refs:s,hidden:i,inert:c=!1}){const u={...n};return c&&(u.pointerEvents="none"),Le("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:u},Lo(o),r],stateAttributesMapping:To})}const th=l.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="top",align:u="center",sideOffset:a=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:p=5,sticky:g=!1,disableAnchorTracking:y=!1,collisionAvoidance:R=Cc,style:m,...v}=t,E=go(),b=Jd(),S=E.useState("open"),w=E.useState("mounted"),T=E.useState("trackCursorAxis"),C=E.useState("disableHoverablePopup"),I=E.useState("floatingRootContext"),O=E.useState("instantType"),P=E.useState("transitionStatus"),L=E.useState("adaptiveOrigin"),x=fs({anchor:s,positionMethod:i,floatingRootContext:I,mounted:w,side:c,sideOffset:a,align:u,alignOffset:f,collisionBoundary:d,collisionPadding:h,sticky:g,arrowPadding:p,disableAnchorTracking:y,keepMounted:b,collisionAvoidance:R,adaptiveOrigin:L}),k=l.useMemo(()=>({open:S,side:x.side,align:x.align,anchorHidden:x.anchorHidden,instant:T!=="none"?"tracking-cursor":O}),[S,x.side,x.align,x.anchorHidden,T,O]),D=ds(t,k,{styles:x.positionerStyles,transitionStatus:P,props:v,refs:[n,E.useStateSetter("positionerElement")],hidden:!w,inert:!S||T==="both"||C});return ne.jsx(uu.Provider,{value:x,children:D})}),nh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,...i}=t,c=go(),{side:u,align:a}=ep(),f=c.useState("open"),d=c.useState("instantType"),h=c.useState("transitionStatus"),p=c.useState("popupProps"),g=c.useState("floatingRootContext"),y=c.useState("disabled"),R=c.useState("closeDelay");Xt({open:f,ref:c.context.popupRef,onComplete(){var b,S;f&&((S=(b=c.context).onOpenChangeComplete)==null||S.call(b,!0))}}),nu(g,{enabled:!y,closeDelay:R});const m=c.useStateSetter("popupElement");return Le("div",t,{state:{open:f,side:u,align:a,instant:d,transitionStatus:h},ref:[n,c.context.popupRef,m],props:[ko,p,Lo(h),i],stateAttributesMapping:Hr})}),oh=function(t){const{delay:n,closeDelay:o,timeout:r=400}=t,s=l.useMemo(()=>({open:n,close:o}),[n,o]);return ne.jsx(su.Provider,{value:n,children:ne.jsx(Ra,{delay:s,timeoutMs:r,children:t.children})})};function ps(e){return Pr(19)?e:e?"true":void 0}function dp(e){const[t,n]=l.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const au=l.createContext(void 0);function qt(e){const t=l.useContext(au);if(!e&&t===void 0)throw new Error(Ne(27));return t}const rh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,forceRender:i=!1,...c}=t,u=qt(),a=u.useState("open"),f=u.useState("nested"),d=u.useState("mounted"),h=u.useState("transitionStatus");return Le("div",t,{state:{open:a,transitionStatus:h},ref:[u.context.backdropRef,n],stateAttributesMapping:Hr,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:i||!f})}),fu=l.createContext(void 0);function gs(e=!1){const t=l.useContext(fu);if(t===void 0&&!e)throw new Error(Ne(16));return t}function pp(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,c=o&&t===!1;return{props:l.useMemo(()=>{const a={onKeyDown(f){n&&t&&f.key!=="Tab"&&f.preventDefault()}};return o||(a.tabIndex=r,!s&&n&&(a.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(a["aria-disabled"]=n),s&&(!t||c)&&(a.disabled=n),a},[o,n,t,i,c,s,r])}}function Zo(e,t,{detail:n=0}={}){e.dispatchEvent(new(Ae(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function An(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0,composite:s}=e,i=l.useRef(null),c=gs(!0),u=s??c!==void 0,{props:a}=pp({focusableWhenDisabled:n,disabled:t,composite:u,tabIndex:o,isNativeButton:r}),f=l.useCallback(()=>{const p=i.current;Jo(p)&&u&&t&&a.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,a.disabled,u]);J(f,[f]);const d=l.useCallback((p={})=>{const{onClick:g,onMouseDown:y,onKeyUp:R,onKeyDown:m,onPointerDown:v,...E}=p;return Wt({onClick(b){if(t){b.preventDefault();return}g==null||g(b)},onMouseDown(b){t||y==null||y(b)},onKeyDown(b){if(t||(to(b),m==null||m(b),b.baseUIHandlerPrevented))return;const S=b.target===b.currentTarget,w=b.currentTarget,T=Jo(w),C=!r&&gp(w),I=S&&(r?T:!C),O=b.key==="Enter",P=b.key===" ",L=w.getAttribute("role"),x=(L==null?void 0:L.startsWith("menuitem"))||L==="option"||L==="gridcell";if(S&&u&&P){if(b.defaultPrevented&&x)return;b.preventDefault(),(!r||T)&&(b.preventBaseUIHandler(),Zo(w,b));return}if(!I||r||!P&&!O){S&&C&&P&&b.preventDefault();return}b.defaultPrevented||(b.preventDefault(),O&&(b.preventBaseUIHandler(),Zo(w,b)))},onKeyUp(b){if(!t){if(to(b),R==null||R(b),b.target===b.currentTarget&&r&&u&&Jo(b.currentTarget)&&b.key===" "){b.preventDefault();return}b.baseUIHandlerPrevented||b.target===b.currentTarget&&!r&&!u&&!b.defaultPrevented&&b.key===" "&&(b.preventBaseUIHandler(),Zo(b.currentTarget,b))}},onPointerDown(b){if(t){b.preventDefault();return}v==null||v(b)}},r?{type:"button"}:{role:"button"},a,E)},[t,a,u,r]),h=te(p=>{i.current=p,f()});return{getButtonProps:d,buttonRef:h}}function Jo(e){return Pe(e)&&e.tagName==="BUTTON"}function gp(e){return Pe(e)&&e.tagName==="A"&&!!e.href}const sh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,disabled:i=!1,nativeButton:c=!0,...u}=t,a=qt(),f=a.useState("open"),{getButtonProps:d,buttonRef:h}=An({disabled:i,native:c}),p={disabled:i};function g(y){f&&a.setOpen(!1,he(ic,y.nativeEvent))}return Le("button",t,{state:p,ref:[n,h],props:[{onClick:g},u,d]})}),ih=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,...c}=t,u=qt(),a=fn(i);return u.useSyncedValueWithCleanup("descriptionElementId",a),Le("p",t,{ref:n,props:[{id:a},c]})}),du=l.createContext(void 0);function hp(){const e=l.useContext(du);if(e===void 0)throw new Error(Ne(26));return e}const dr="ArrowUp",pr="ArrowDown",gr="ArrowLeft",hr="ArrowRight",mr="Home",yr="End",_o=new Set([dr,pr,gr,hr,mr,yr]),mp="Shift",yp=[mp,"Control","Alt","Meta"];function bp(e){return Pe(e)&&e.tagName==="INPUT"}function gi(e){return!!(bp(e)&&e.selectionStart!=null||Pe(e)&&e.tagName==="TEXTAREA")}function hi(e,t,n,o){if(!e||!t||!t.scrollTo)return;let r=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,c=e.clientHeight<e.scrollHeight;if(i&&o!=="vertical"){const u=mi(e,t,"left"),a=Un(e),f=Un(t);n==="ltr"&&(u+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?r=u+t.offsetWidth+f.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:u-f.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(r=u-f.scrollMarginLeft-a.scrollPaddingLeft)),n==="rtl"&&(u-f.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?r=u-f.scrollMarginLeft-a.scrollPaddingLeft:u+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(r=u+t.offsetWidth+f.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(c&&o!=="horizontal"){const u=mi(e,t,"top"),a=Un(e),f=Un(t);u-f.scrollMarginTop<e.scrollTop+a.scrollPaddingTop?s=u-f.scrollMarginTop-a.scrollPaddingTop:u+t.offsetHeight+f.scrollMarginBottom>e.scrollTop+e.clientHeight-a.scrollPaddingBottom&&(s=u+t.offsetHeight+f.scrollMarginBottom-e.clientHeight+a.scrollPaddingBottom)}e.scrollTo({left:r,top:s,behavior:"auto"})}function mi(e,t,n){const o=n==="left"?"offsetLeft":"offsetTop";let r=0;for(;t.offsetParent&&(r+=t[o],t.offsetParent!==e);)t=t.offsetParent;return r}function Un(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const Rp="--nested-dialogs",vp="data-nested-dialog-open",Ep={...To,...xo,nestedDialogOpen(e){return e?{[vp]:""}:null}},ch=l.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,initialFocus:c,...u}=t,a=qt(),f=a.useState("descriptionElementId"),d=a.useState("disablePointerDismissal"),h=a.useState("floatingRootContext"),p=a.useState("popupProps"),g=a.useState("modal"),y=a.useState("mounted"),R=a.useState("nested"),m=a.useState("nestedOpenDialogCount"),v=a.useState("open"),E=a.useState("openMethod"),b=a.useState("titleElementId"),S=a.useState("transitionStatus"),w=a.useState("role"),T=h.useState("floatingId");hp(),Xt({open:v,ref:a.context.popupRef,onComplete(){var x,k;v&&((k=(x=a.context).onOpenChangeComplete)==null||k.call(x,!0))}});const C=c===void 0?Xc(a.context.popupRef):c,I=m>0,O=a.useStateSetter("popupElement"),L=Le("div",t,{state:{open:v,nested:R,transitionStatus:S,nestedDialogOpen:I},props:[p,{id:T,"aria-labelledby":b,"aria-describedby":f,role:w,...ko,hidden:!y,onKeyDown(x){_o.has(x.key)&&x.stopPropagation()},style:{[Rp]:m}},u],ref:[n,a.context.popupRef,O],stateAttributesMapping:Ep});return ne.jsx(Xr,{context:h,openInteractionType:E,disabled:!y,closeOnFocusOut:!d,initialFocus:C,returnFocus:i,modal:g!==!1,restoreFocus:"popup",children:L})}),hs=l.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const i=o.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),uh=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,s=qt(),i=s.useState("mounted"),c=s.useState("modal"),u=s.useState("open");return i||o?ne.jsx(du.Provider,{value:o,children:ne.jsxs(Kr,{ref:n,...r,children:[i&&c===!0&&ne.jsx(hs,{ref:s.context.internalBackdropRef,inert:ps(!u)}),t.children]})}):null});let yi={},bi={},Ri="";function No(e,t){return wn(e)?e:t}function vi(e,t,n){return/hidden|clip/.test(e.getComputedStyle(No(t,n)).overflowY)}function Sp(e){if(typeof document>"u")return!1;const t=Se(e);return Ae(t).innerWidth-t.documentElement.clientWidth>0}function xp(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Se(e),o=n.documentElement,r=n.body,s=No(o,r),i=s.style.overflowY,c=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",s.style.overflowY="scroll";const u=s.offsetWidth;s.style.overflowY="hidden";const a=s.offsetWidth;return s.style.overflowY=i,o.style.scrollbarGutter=c,u===a}function Tp(e){const t=Se(e),n=t.documentElement,o=t.body,r=No(n,o),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function Cp(e){var p;const t=Se(e),n=t.documentElement,o=t.body,r=Ae(n);let s=0,i=0,c=!1;const u=gt.create();if(Ct&&(((p=r.visualViewport)==null?void 0:p.scale)??1)!==1)return()=>{};function a(){const g=r.getComputedStyle(n),y=r.getComputedStyle(o),v=(g.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,yi={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ri=n.style.scrollBehavior,bi={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,S=g.overflowY==="scroll"||y.overflowY==="scroll",w=g.overflowX==="scroll"||y.overflowX==="scroll",T=Math.max(0,r.innerWidth-o.clientWidth),C=Math.max(0,r.innerHeight-o.clientHeight),I=parseFloat(y.marginTop)+parseFloat(y.marginBottom),O=parseFloat(y.marginLeft)+parseFloat(y.marginRight),P=No(n,o);if(c=xp(e),c){n.style.scrollbarGutter=v,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(E||S)&&(n.style.overflowY="scroll"),(b||w)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:I||C?`calc(100dvh - ${I+C}px)`:"100dvh",width:O||T?`calc(100vw - ${O+T}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,yi),Object.assign(o.style,bi),c||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ri)}function d(){f(),u.request(a)}a();const h=be(r,"resize",d);return()=>{u.cancel(),f(),typeof r.removeEventListener=="function"&&h()}}class wp{constructor(){Te(this,"lockCount",0);Te(this,"restore",null);Te(this,"timeoutLock",ct.create());Te(this,"timeoutUnlock",ct.create());Te(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Te(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),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 n=Se(t),o=n.documentElement,r=n.body,s=Ae(o);if(vi(s,o,r)){const c=new s.MutationObserver(()=>{vi(s,o,r)||(c.disconnect(),this.restore=null,this.lock(t))}),u={attributes:!0};c.observe(o,u),c.observe(r,u),this.restore=()=>c.disconnect();return}const i=mo||!Sp(t);this.restore=i?Tp(t):Cp(t)}}const Pp=new wp;function pu(e=!0,t=null){J(()=>{if(e)return Pp.acquire(t)},[e,t])}function Ip({store:e,parentContext:t,isDrawer:n}){const o=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),c=e.useState("floatingRootContext"),[u,a]=l.useState(0),[f,d]=l.useState(0),h=u===0,p=Io(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}const y=We(g);if(h&&!r){if(s){const R=e.context.internalBackdropRef.current,m=e.context.backdropRef.current;return R||m?R===y||m===y||ue(y,i)&&!(y!=null&&y.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:h});return pu(o&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(g,y)=>{a(g),d(y)}),J(()=>(t!=null&&t.onNestedDialogOpen&&(o?t.onNestedDialogOpen(u+1,f+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,u,f,t]),rs(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:u,nestedOpenDrawerCount:f}),null}const Op={...cs,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Ap extends On{constructor(n,o,r){const s=new Do,i=Mp(n,s,o,r);super(i,kp(s),Op);Te(this,"setOpen",(n,o)=>{var r,s;o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),(s=(r=this.context).onOpenChange)==null||s.call(r,n,o),!o.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(n,o),this.update(ts(this.state,n,o.trigger)))})}}function Mp(e,t,n,o=!1){return{...ss(t,n,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function kp(e){return{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Dp(e,t){const{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:c=!1,modal:u=!0,actionsRef:a,handle:f,triggerId:d,defaultTriggerId:h=null}=t,p=e==="drawer",g=u,y=c,R="dialog",m=qt(!0),v=m!=null,E={modal:g,disablePointerDismissal:y,nested:v,role:R},b=Qr((O,P)=>new Ap({open:r,openProp:o,activeTriggerId:h,triggerIdProp:d,...E},O,P),!0);b.useControlledProp("openProp",o),b.useControlledProp("triggerIdProp",d),b.useSyncedValues(E),b.useContextCallback("onOpenChange",s),b.useContextCallback("onOpenChangeComplete",i);const S=b.useState("open"),w=b.useState("mounted"),T=b.useState("payload");Jc(b,S),ns(b);const{forceUnmount:C}=os(S,b);l.useImperativeHandle(a,()=>({unmount:C,close:()=>b.setOpen(!1,he(Br))}),[C,b]);const I=S||w;return ne.jsxs(au.Provider,{value:b,children:[f&&ne.jsx(es,{handle:f,store:b}),I&&ne.jsx(Ip,{store:b,parentContext:m==null?void 0:m.context,isDrawer:p}),typeof n=="function"?n({payload:T}):n]})}const lh=po(function(t){return Dp("dialog",t)}),ah=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,...c}=t,u=qt(),a=fn(i);return u.useSyncedValueWithCleanup("titleElementId",a),Le("h2",t,{ref:n,props:[{id:a},c]})});function Fp(e){const t=l.useRef(""),n=l.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:l.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function gu(e,t){const n=l.useRef(e),o=te(t);J(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}function hu(e,t){const n=te((s,i)=>{(typeof e=="function"?e():e)||t(i||(mo?"touch":""))}),{onClick:o,onPointerDown:r}=Fp(n);return l.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function Lp(e){const[t,n]=l.useState(null),o=hu(e,n);return gu(e,r=>{r&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function _p(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}function mu(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function br({controlled:e,default:t,name:n,state:o="value"}){const{current:r}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=r&&e!==void 0?e:s,u=l.useCallback(a=>{r||i(a)},[]);return[c,u]}const yu=l.createContext(void 0),bu=l.createContext(void 0),Ru=l.createContext(void 0);function Ht(){const e=l.useContext(yu);if(e===void 0)throw new Error(Ne(60));return e}function ms(){const e=l.useContext(bu);if(e===void 0)throw new Error(Ne(101));return e}function vu(){const e=l.useContext(Ru);if(e===void 0)throw new Error(Ne(61));return e}const Np="data-valid",Hp="data-invalid",Vp={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Bp={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},jp={disabled:!1,...Bp},$p={valid(e){return e===null?null:e?{[Np]:""}:{[Hp]:""}}},Wp={invalid:void 0,name:void 0,validityData:{state:Vp,errors:[],error:"",value:"",initialValue:null},setValidityData:ke,disabled:void 0,setTouched:ke,setDirty:ke,setFilled:ke,setFocused:ke,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:jp,registerFieldControl:ke,validation:{getValidationProps:(e,t=_e)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:ke,getInputControl:()=>null,commit:async()=>{},change:ke}},Up=l.createContext(Wp);function ys(e=!0){const t=l.useContext(Up);if(t.setValidityData===ke&&!e)throw new Error(Ne(28));return t}function Yp(e,t,n,o,r=!0,s){const{registerFieldControl:i}=ys(),c=ze(()=>Symbol());J(()=>{const u=c.current;if(!r){i(u,void 0);return}i(u,{controlRef:e,getValue:o,id:t,name:s,value:n})},[e,r,o,t,s,i,c,n]),J(()=>{const u=c.current;return()=>{i(u,void 0)}},[i,c])}const zp=l.createContext({controlId:void 0,registerControlId:ke,resetControlId:ke,labelId:void 0,setLabelId:ke,messageIds:[],setMessageIds:ke,getDescriptionProps:e=>e});function Eu(){return l.useContext(zp)}function Su(e={}){const{id:t,enabled:n=!0}=e,{controlId:o,registerControlId:r,resetControlId:s}=Eu(),i=fn(),c=ze(()=>Symbol()),u=l.useRef(!1),a=l.useRef(!1),f=te(()=>{!u.current||r===ke||(u.current=!1,r(c.current,void 0))});return J(()=>{if(!n||r===ke){f();return}let d;if(t!==void 0)a.current=!0,d=t;else if(a.current)d=i;else{s();return}if(d===void 0){f();return}u.current=!0,r(c.current,d)},[t,n,r,s,i,c,f]),J(()=>f,[f]),(n?o:void 0)??t??i}function Kp(e,t,n=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let r=0;r<o;r+=1)if(!n(e[r],t[r]))return!1;return!0}const xu=(e,t)=>Object.is(e,t);function Kt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Gp(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Kp(e,t,(o,r)=>Kt(o,r,n)):e!==t}function Rr(e,t,n){return e?e.some(o=>o===void 0?!1:Kt(t,o,n)):!1}function Qn(e,t,n){return e?e.findIndex(o=>o===void 0?!1:Kt(o,t,n)):-1}function Xp(e,t){if(t!==xu)return o=>Rr(e,o,t);const n=new Set(e);return n.delete(void 0),o=>n.has(o)&&(o!==0||e.some(r=>Object.is(o,r)))}function Tu(e,t,n,o){const r=o&&Array.isArray(t)?e.findIndex(Xp(t,n)):Qn(e,t,n);return r===-1?null:r}function qp(e,t,n,o,r,s){return Rr(o,t,r)?s!=null&&e>s&&Rr(o,n[s],r)?s:e:e===s?Tu(n,o,r,!0):s}function Zp(e,t,n){return e.filter(o=>!Kt(t,o,n))}function vr(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Jp(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function Cu(e){return Jp(e==null?void 0:e[0])}function Qp(e){return Cu(e)?e.flatMap(t=>t.items):e}function eg(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Cu(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function wu(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return vr(e)}function Qt(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?vr(e.value):vr(e)}function Pu(e,t,n){function o(){return wu(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const s=Qp(t);if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function tg(e,t,n){return e.reduce((o,r,s)=>(s>0&&o.push(", "),o.push(ne.jsx(l.Fragment,{children:Pu(r,t,n)},s)),o),[])}const ng={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Qt(t,o)!==""},hasNullItemLabel:(e,t)=>t?eg(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(r=>Kt(t,r,n)):Kt(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},og=l.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:ke,validationMode:"onSubmit",submitCountRef:{current:0}});function rg(){return l.useContext(og)}function yn(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const vt=1;function Iu(e,t){return Math.max(0,e-t)}function sg(e,t){if(t<=0)return 0;const n=yn(e,0,t),o=n,r=t-n,s=o<=vt,i=r<=vt;return s&&i?o<=r?0:t:s?0:i?t:n}function fh(e){const{id:t,value:n,defaultValue:o=null,onValueChange:r,open:s,defaultOpen:i=!1,onOpenChange:c,name:u,form:a,autoComplete:f,disabled:d=!1,readOnly:h=!1,required:p=!1,modal:g=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:m,items:v,multiple:E=!1,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:w=xu,highlightItemOnHover:T=!0,children:C}=e,{clearErrors:I}=rg(),{setDirty:O,setTouched:P,setFocused:L,validityData:x,setFilled:k,name:D,disabled:F,validation:V,validationMode:M}=ys(),N=Su({id:t}),A=F||d,U=D??u,[B,W]=br({controlled:n,default:E?o??kt:o,name:"Select",state:"value"}),[H,Y]=br({controlled:s,default:i,name:"Select",state:"open"}),$=l.useRef([]),Q=l.useRef([]),j=l.useRef(null),X=l.useRef(null),se=l.useRef(0),le=l.useRef(null),q=l.useRef([]),G=l.useRef(!1),Z=l.useRef(null),ie=l.useRef(null),xe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ee=l.useRef(!1),ae=l.useRef(B),{mounted:oe,setMounted:me,transitionStatus:ye}=Jr(H),{openMethod:ge,triggerProps:Ce}=Lp(H),z=ze(()=>new On({id:N,labelId:void 0,modal:g,multiple:E,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:w,value:B,open:H,mounted:oe,transitionStatus:ye,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:_e,triggerProps:_e,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ke,setOpen:ke,handleScrollArrowVisibility:ke,onOpenChangeComplete:ke,listRef:$,popupRef:j,scrollHandlerRef:X,scrollArrowsMountedCountRef:se,valueRef:le,valuesRef:q,labelsRef:Q,typingRef:G,selectionRef:xe,firstItemTextRef:Z,selectedItemTextRef:ie,alignItemWithTriggerActiveRef:ee,initialValueRef:ae},ng)).current,re=z.useState("activeIndex"),K=z.useState("selectedIndex"),_=z.useState("triggerElement"),ce=z.useState("positionerElement"),de=dp(ge),Ee=ge??de,Ve=l.useMemo(()=>E?"":Qt(B,S),[E,B,S]),Ge=l.useMemo(()=>E&&Array.isArray(B)?B.map(ve=>Qt(ve,S)):Qt(B,S),[E,B,S]),Me=Fe(_),Ye=te(()=>Ge);Yp(Me,N,B,Ye,!A,u);const Qe=E?Array.isArray(B)&&B.length>0:B!=null&&Ve!=="";J(()=>{k(Qe)},[Qe,k]),J(function(){const Ie=Tu(q.current,B,w,E);Ie===null&&(ie.current=null),!H&&z.set("selectedIndex",Ie)},[E,H,B,w,z]),gu(B,()=>{I(U),O(Gp(B,x.initialValue,w)),V.change(B)});const Xe=te((ve,Ie)=>{c==null||c(ve,Ie),!Ie.isCanceled&&(Y(ve),!ve&&(Ie.reason===Yt||Ie.reason===Vr)&&(P(!0),L(!1),M==="onBlur"&&V.commit(B)))}),ft=te(()=>{me(!1),z.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),m==null||m(!1)});Xt({enabled:!y,open:H,ref:j,onComplete(){H||ft()}}),l.useImperativeHandle(y,()=>({unmount:ft}),[ft]);const ut=te((ve,Ie)=>{r==null||r(ve,Ie),!Ie.isCanceled&&W(ve)}),mt=te(ve=>{const Ie=Iu(ve.scrollHeight,ve.clientHeight),Je=sg(ve.scrollTop,Ie),bt=Je>0,dt=Je<Ie;z.set("scrollUpArrowVisible",bt),z.set("scrollDownArrowVisible",dt)}),ot=kd({open:H,onOpenChange:Xe,elements:{reference:_,floating:ce}}),yt=kc(ot,{enabled:!A,event:"mousedown"}),lt=Io(ot),He=Bd(ot,{enabled:!A,listRef:$,activeIndex:re,selectedIndex:K,disabledIndices:kt,onNavigate(ve){ve===null&&!H||z.set("activeIndex",ve)},focusItemOnHover:T}),pe=jd(ot,{enabled:!A&&(H||!h&&!E),listRef:Q,activeIndex:re,selectedIndex:K,disabledIndices:ve=>mu($.current[ve]),onMatch(ve){H?z.set("activeIndex",ve):ut(q.current[ve],he(Ft))},onTyping(ve){G.current=ve}}),De=l.useMemo(()=>Wt(pe.reference,He.reference,lt.reference,yt.reference,Ce),[yt.reference,pe.reference,He.reference,lt.reference,Ce]),Be=l.useMemo(()=>Wt(ko,pe.floating,He.floating,lt.floating),[pe.floating,He.floating,lt.floating]),je=He.item??_e;z.useContextCallback("setValue",ut),z.useContextCallback("setOpen",Xe),z.useContextCallback("handleScrollArrowVisibility",mt),z.useContextCallback("onOpenChangeComplete",m),_p(()=>{z.update({popupProps:Be,triggerProps:De})}),z.useSyncedValues({id:N,modal:g,multiple:E,value:B,open:H,mounted:oe,transitionStatus:ye,popupProps:Be,triggerProps:De,items:v,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:w,openMethod:Ee});const rt=l.useMemo(()=>({disabled:A,readOnly:h,required:p,multiple:E,highlightItemOnHover:T,itemProps:je}),[A,h,p,E,T,je]),et=$t(R,V.inputRef),Vt=E?void 0:U,Pt=l.useMemo(()=>!E||!Array.isArray(B)||!U?null:B.map(ve=>{const Ie=Qt(ve,S);return ne.jsx("input",{type:"hidden",form:a,name:U,value:Ie,disabled:A},Ie)}),[E,B,a,U,S,A]);return ne.jsxs(yu.Provider,{value:z,children:[ne.jsx(bu.Provider,{value:rt,children:ne.jsx(Ru.Provider,{value:ot,children:C})}),ne.jsx("input",{...V.getValidationProps(A,{onFocus(){var ve;(ve=z.state.triggerElement)==null||ve.focus({focusVisible:!0})},onChange(ve){if(ve.nativeEvent.defaultPrevented||A||h)return;const Ie=ve.currentTarget.value,Je=he(Ft,ve.nativeEvent);function bt(){if(E)return;const dt=Ie.toLowerCase();let Bt=q.current.findIndex(Zt=>Qt(Zt,S).toLowerCase()===dt||wu(Zt,b).toLowerCase()===dt);Bt===-1&&(Bt=q.current.findIndex((Zt,kn)=>{const pn=Q.current[kn];return pn!=null&&pn.toLowerCase()===dt}));const dn=q.current[Bt];dn!=null&&ut(dn,Je)}z.set("forceMount",!0),queueMicrotask(bt)}}),id:N&&Vt==null?`${N}-hidden-input`:void 0,form:a,name:Vt,autoComplete:f,value:Ve,disabled:A,required:p&&!(E&&Qe),readOnly:h,ref:et,style:U?wa:ac,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Pt]})}function ig(e,t){return e??t}const Yn=5;function cg(e,t){const n=ug(t);return e.clientX>=n.left-Yn&&e.clientX<=n.right+Yn&&e.clientY>=n.top-Yn&&e.clientY<=n.bottom+Yn}function ug(e){const t=e.getBoundingClientRect(),n=Ae(e);if(Mr)return t;const o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;const i=parseFloat(o.width)||0,c=parseFloat(o.height)||0,u=parseFloat(r.width)||0,a=parseFloat(r.height)||0,f=Math.max(t.width,i,u),d=Math.max(t.height,c,a),h=f-t.width,p=d-t.height;return{left:t.left-h/2,right:t.right+h/2,top:t.top-p/2,bottom:t.bottom+p/2}}const lg="data-popup-side",ag=400,fg={...rc,...$p,popupSide:e=>e?{[lg]:e}:null,value:()=>null},dh=l.forwardRef(function(t,n){var se;const{render:o,className:r,id:s,disabled:i=!1,nativeButton:c=!0,style:u,...a}=t,{setTouched:f,setFocused:d,validationMode:h,validation:p,state:g,disabled:y}=ys(),{labelId:R}=Eu(),m=Ht(),{readOnly:v,required:E,disabled:b}=ms(),S=y||b||i,w=m.useState("open"),T=m.useState("mounted"),C=m.useState("value"),I=m.useState("triggerProps"),O=m.useState("positionerElement"),P=m.useState("listElement"),L=m.useState("popupSide"),x=m.useState("id"),k=m.useState("labelId"),D=m.useState("hasSelectedValue"),F=T&&O?L:null,V=s??x,M=ig(R,k);Su({id:s});const N=Fe(O),A=l.useRef(null),{getButtonProps:U,buttonRef:B}=An({disabled:S,native:c}),W=m.useStateSetter("triggerElement"),H=tt(),Y=tt(),$=tt();l.useEffect(()=>{if(w)return $.start(ag,()=>{m.context.selectionRef.current.allowUnselectedMouseUp=!0,m.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{$.clear()};m.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Y.clear()},[w,m,Y,$]);const Q=Wt(I,{id:V,role:"combobox","aria-expanded":w,"aria-haspopup":"listbox","aria-controls":w?(P==null?void 0:P.id)??((se=oo(O))==null?void 0:se.id):void 0,"aria-labelledby":M,"aria-readonly":v||void 0,"aria-required":E||void 0,tabIndex:S?-1:0,onFocus(le){d(!0),w&&m.context.alignItemWithTriggerActiveRef.current&&m.context.setOpen(!1,he(Ft,le.nativeEvent)),H.start(0,()=>{m.set("forceMount",!0)})},onBlur(le){ue(O,le.relatedTarget)||(f(!0),d(!1),h==="onBlur"&&p.commit(C))},onMouseDown(le){if(w)return;const q=Se(le.currentTarget);function G(Z){if(!A.current)return;const ie=Z.target;ue(A.current,ie)||ue(N.current,ie)||cg(Z,A.current)||m.context.setOpen(!1,he(ma,Z))}Y.start(0,()=>{q.addEventListener("mouseup",G,{once:!0})})}},a,U),j=p.getValidationProps(S,Q);j.role="combobox";const X={...g,open:w,disabled:S,value:C,readOnly:v,popupSide:F,placeholder:!D};return Le("button",t,{ref:[n,A,B,W],state:X,stateAttributesMapping:fg,props:j})}),dg={value:()=>null},ph=l.forwardRef(function(t,n){const{className:o,render:r,children:s,placeholder:i,style:c,...u}=t,a=Ht(),f=a.useState("value"),d=a.useState("items"),h=a.useState("itemToStringLabel"),p=a.useState("hasSelectedValue"),g=!p&&i!=null&&s==null,y=a.useState("hasNullItemLabel",g),R={value:f,placeholder:!p};let m=null;return typeof s=="function"?m=s(f):s!=null?m=s:g&&!y?m=i:Array.isArray(f)?m=tg(f,d,h):m=Pu(f,d,h),Le("span",t,{state:R,ref:[n,a.context.valueRef],props:[{children:m},u],stateAttributesMapping:dg})}),gh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,...i}=t,a={open:Ht().useState("open")};return Le("span",t,{state:a,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:Nr})}),hh=l.forwardRef(function(t,n){const o=Ht(),r=o.useState("mounted"),s=o.useState("forceMount");return r||s?ne.jsx(Kr,{ref:n,...t}):null}),Ou=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function pg(){return l.useContext(Ou)}function bs(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=te(r),[,i]=l.useState(!1),c=ze(hg).current,u=ze(gg).current,a=l.useRef(0),f=l.useRef(!0),d=l.useRef(null),h=l.useRef(null),p=te(()=>{f.current||(f.current=!0,i(S=>!S))}),g=te((S,w)=>{u.set(S,w),p()}),y=te(S=>{u.delete(S),p()}),R=te(S=>{const w=new Map;return n.current.length=0,o&&(o.current.length=0),S.forEach(T=>{var C,I;w.set(T.element,{...T.registration.metadata??{},index:T.index}),n.current[T.index]=T.element,o&&(o.current[T.index]=T.registration.label!==void 0?T.registration.label:((I=(C=T.registration.textRef)==null?void 0:C.current)==null?void 0:I.textContent)??T.element.textContent)}),a.current=n.current.length,w});function m(S){var C;if((C=h.current)==null||C.disconnect(),h.current=null,typeof MutationObserver!="function"||S.length<2)return;const w=new MutationObserver(I=>{if(!bg(I))return;let O=null;for(const P of S)if(P.isConnected){if(O&&Au(O,P)>0){w.disconnect(),p();return}O=P}});h.current=w;const T=new Set;for(let I=1;I<S.length;I+=1){const O=yg(S[I-1],S[I]);O&&T.add(O)}T.forEach(I=>w.observe(I,{childList:!0}))}const v=te(()=>{const[S,w]=mg(u),T=R(S),C=d.current,I=!C||C.length!==S.length||S.some((O,P)=>{const L=C[P];return O.index!==L.index||O.element!==L.element||O.registration.index!==L.registration.index||O.registration.metadata!==L.registration.metadata});m(w),d.current=S,f.current=!1,I&&(c.forEach(O=>O(T)),s(T))});J(()=>(!f.current&&d.current&&R(d.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,R]),J(()=>{f.current&&v()}),J(()=>()=>{var S;(S=h.current)==null||S.disconnect(),f.current=!0},[]);const E=te(S=>(c.add(S),()=>{c.delete(S)})),b=l.useMemo(()=>({register:g,unregister:y,subscribeMapChange:E,nextIndexRef:a}),[g,y,E,a]);return ne.jsx(Ou.Provider,{value:b,children:t})}function gg(){return new Map}function hg(){return new Set}function mg(e){const t=new Set,n=[],o=[];e.forEach((s,i)=>{if(!i.isConnected)return;const c=s.index,u={index:c??-1,element:i,registration:s};c===null?o.push(u):c>=0&&(t.add(c),n.push(u))});let r=0;return o.sort((s,i)=>Au(s.element,i.element)),o.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,o.map(s=>s.element)]}function yg(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function bg(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function Au(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Mu=l.createContext(void 0);function Rg(){const e=l.useContext(Mu);if(!e)throw new Error(Ne(59));return e}function lo(e,t){e&&Object.assign(e.style,t)}const vg={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Eg=20;function ku(e,t,n,o){const[r,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=Se(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-Eg)},[e,t,n]),pu(e&&(!t||r),o)}const Sg={position:"fixed"},mh=l.forwardRef(function(t,n){const{anchor:o,className:r,render:s,positionMethod:i,side:c,align:u,sideOffset:a,alignOffset:f,collisionBoundary:d="clipping-ancestors",collisionPadding:h,arrowPadding:p,sticky:g,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:m=Xa,style:v,...E}=t,b=Ht(),S=vu(),w=b.useState("open"),T=b.useState("mounted"),C=b.useState("modal"),I=b.useState("value"),O=b.useState("openMethod"),P=b.useState("positionerElement"),L=b.useState("triggerElement"),x=b.useState("isItemEqualToValue"),k=b.useState("transitionStatus"),D=l.useRef(null),F=l.useRef(null),[V,M]=l.useState(R),N=T&&V&&O!=="touch";!T&&V!==R&&M(R),l.useImperativeHandle(b.context.alignItemWithTriggerActiveRef,()=>N),ku((N||C)&&w,O==="touch",P,L);const A=fs({anchor:o,floatingRootContext:S,positionMethod:i,mounted:T,side:c,sideOffset:a,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:d,collisionPadding:h,sticky:g,disableAnchorTracking:y??N,collisionAvoidance:m,keepMounted:!0}),U=N?"none":A.side,B=N?Sg:A.positionerStyles,W={open:w,side:U,align:A.align,anchorHidden:A.anchorHidden};J(()=>{b.set("popupSide",A.side)},[b,A.side]);const H=b.useStateSetter("positionerElement"),Y=ds(t,W,{styles:B,transitionStatus:k,props:E,refs:[n,H],hidden:!T,inert:!w}),$=l.useRef(0),Q=te(X=>{if(b.context.valuesRef.current.length===0)return;const se=$.current;$.current=X.size;const le=he(Ft);if(se!==0&&!b.state.multiple&&I!==null&&Qn(b.context.valuesRef.current,I,x)===-1){const G=b.context.initialValueRef.current,ie=G!=null&&Qn(b.context.valuesRef.current,G,x)!==-1?G:null;b.context.setValue(ie,le),ie===null&&(b.set("selectedIndex",null),b.context.selectedItemTextRef.current=null)}if(se!==0&&b.state.multiple&&Array.isArray(I)){const q=I.filter(G=>Qn(b.context.valuesRef.current,G,x)!==-1);q.length!==I.length&&(b.context.setValue(q,le),q.length===0&&(b.set("selectedIndex",null),b.context.selectedItemTextRef.current=null))}if(w&&N){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};lo(P,q),lo(b.context.popupRef.current,q)}}),j=l.useMemo(()=>({...A,side:U,alignItemWithTriggerActive:N,setControlledAlignItemWithTrigger:M,scrollUpArrowRef:D,scrollDownArrowRef:F}),[A,U,N,M]);return ne.jsx(bs,{elementsRef:b.context.listRef,labelsRef:b.context.labelsRef,onMapChange:Q,children:ne.jsxs(Mu.Provider,{value:j,children:[T&&C&&ne.jsx(hs,{inert:ps(!w),cutout:L}),Y]})})}),zn="base-ui-disable-scrollbar",Ei={className:zn,getElement(e){return ne.jsx("style",{nonce:e,href:zn,precedence:"base-ui:low",children:`.${zn}{scrollbar-width:none}.${zn}::-webkit-scrollbar{display:none}`})}},xg=l.createContext(void 0);function Du(e){return l.useContext(xg)}const Tg=l.createContext(void 0),Cg={disableStyleElements:!1};function wg(){return l.useContext(Tg)??Cg}const Si="--transform-origin",Pg={...To,...xo},yh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,...c}=t,u=Ht(),{multiple:a,readOnly:f,highlightItemOnHover:d}=ms(),h=vu(),{side:p,align:g,alignItemWithTriggerActive:y,isPositioned:R,setControlledAlignItemWithTrigger:m}=Rg(),v=Du()!=null,E=as(),{nonce:b,disableStyleElements:S}=wg(),w=u.useState("id"),T=u.useState("open"),C=u.useState("openMethod"),I=u.useState("mounted"),O=u.useState("popupProps"),P=u.useState("transitionStatus"),L=u.useState("triggerElement"),x=u.useState("positionerElement"),k=u.useState("listElement"),D=l.useRef(!1),F=l.useRef(!1),V=l.useRef({}),M=rn(),N=te(W=>{if(!x||!u.context.popupRef.current||!F.current)return;const H=x.style.top==="0px",Y=x.style.bottom==="0px";if(D.current||!y||!H&&!Y){u.context.handleScrollArrowVisibility(W);return}const $=Ti(x),Q=bn(x.getBoundingClientRect().height,"y",$),j=Se(x),X=Ae(x),se=X.getComputedStyle(x),le=parseFloat(se.marginTop),q=parseFloat(se.marginBottom),G=xi(X.getComputedStyle(u.context.popupRef.current)),Z=Math.min(j.documentElement.clientHeight-le-q,G),ie=W.scrollTop,xe=Kn(W);let ee=null;const ae=ge=>{x.style.height=`${ge}px`},oe=H?xe-ie:ie,me=Math.min(Q+oe,Z);if(oe<=vt){const ge=yn(oe,0,Z-Q);ge>0&&ae(Q+ge),W.scrollTop=H?xe:0,Z-(Q+ge)<=vt&&(D.current=!0),u.context.handleScrollArrowVisibility(W);return}if(Z-me>vt)ee=H?1/0:0;else if(Y&&ie<xe){const ge=Q+oe-Z;ee=ie-(oe-ge)}const ye=Math.ceil(me);if(ye!==0&&ae(ye),ee!=null){const ge=yn(ee,0,Kn(W));Math.abs(W.scrollTop-ge)>vt&&(W.scrollTop=ge)}ye>=Z-vt&&(D.current=!0),u.context.handleScrollArrowVisibility(W)});l.useImperativeHandle(u.context.scrollHandlerRef,()=>N,[N]),Xt({open:T,ref:u.context.popupRef,onComplete(){T&&u.context.onOpenChangeComplete(!0)}});const A={open:T,transitionStatus:P,side:p,align:g};J(()=>{!x||!u.context.popupRef.current||Object.keys(V.current).length||(V.current={top:x.style.top||"0",left:x.style.left||"0",right:x.style.right,height:x.style.height,bottom:x.style.bottom,minHeight:x.style.minHeight,maxHeight:x.style.maxHeight,marginTop:x.style.marginTop,marginBottom:x.style.marginBottom})},[u,x]),J(()=>{T||y||(F.current=!1,D.current=!1,lo(x,V.current))},[T,y,x]),J(()=>{var Y,$;const W=u.context.popupRef.current;if(!T||!L||!x||!W||y&&!R||u.state.transitionStatus==="ending")return;if(F.current=!0,W.style.removeProperty(Si),!y){M.request(()=>u.context.handleScrollArrowVisibility(k||W));return}const H=Ig(W);try{let Q=u.context.selectedItemTextRef.current;Q!=null&&Q.isConnected||(Q=!u.select("hasSelectedValue")&&((Y=u.context.firstItemTextRef.current)!=null&&Y.isConnected)?u.context.firstItemTextRef.current:null);const j=u.context.valueRef.current,X=Ae(x),se=X.getComputedStyle(x),le=X.getComputedStyle(W),q=Se(L),G=Ti(L),Z=Gn(L.getBoundingClientRect(),G),ie=Gn(x.getBoundingClientRect(),G),xe=Z.height,ee=k||W,ae=ee.scrollHeight,oe=parseFloat(le.borderBottomWidth),me=parseFloat(se.marginTop)||10,ye=parseFloat(se.marginBottom)||10,ge=parseFloat(se.minHeight)||100,Ce=xi(le),z=5,re=5,K=20,_=q.documentElement.clientHeight-me-ye,ce=q.documentElement.clientWidth,de=_-Z.bottom+xe;let Ee,Ve=E==="rtl"?Z.right-ie.width:Z.left,Ge=0;if(Q&&j){const He=Gn(j.getBoundingClientRect(),G);Ee=Gn(Q.getBoundingClientRect(),G),Ve=ie.left+(E==="rtl"?He.right-Ee.right:He.left-Ee.left);const pe=He.top-Z.top+He.height/2;Ge=Ee.top-ie.top+Ee.height/2-pe}const Me=de+Ge+ye+oe;let Ye=Math.min(_,Me);const Qe=_-me-ye,Xe=Me-Ye,ft=ce-re;x.style.left=`${yn(Ve,z,ft-ie.width)}px`,x.style.height=`${Ye}px`,x.style.maxHeight="none",x.style.marginTop=`${me}px`,x.style.marginBottom=`${ye}px`,W.style.height="100%";const ut=Kn(ee),mt=Xe>=ut-vt;mt&&(Ye=Math.min(_,ie.height)-(Xe-ut));const ot=Z.top<K||Z.bottom>_-K||Math.ceil(Ye)+vt<Math.min(ae,ge),yt=((($=X.visualViewport)==null?void 0:$.scale)??1)!==1&&Ct;if(ot||yt){lo(x,V.current),m(!1);return}const lt=Math.max(ge,Ye);if(mt){const He=Math.max(0,_-Me);x.style.top=ie.height>=Qe?"0":`${He}px`,x.style.height=`${Ye}px`,ee.scrollTop=Kn(ee)}else x.style.bottom="0",ee.scrollTop=Xe;if(Ee){const He=ie.top,pe=ie.height,De=Ee.top+Ee.height/2,Be=yn(pe>0?(De-He)/pe*100:50,0,100);W.style.setProperty(Si,`50% ${Be}%`)}(lt===_||Ye>=Ce)&&(D.current=!0),u.context.handleScrollArrowVisibility(ee),d&&u.state.selectedIndex===null&&u.state.activeIndex===null&&u.context.listRef.current[0]!=null&&u.set("activeIndex",0)}finally{H()}},[u,T,x,L,y,m,M,k,d,E,R]),l.useEffect(()=>{if(!y||!x||!T)return;const W=Ae(x);function H(Y){u.context.setOpen(!1,he(ya,Y))}return be(W,"resize",H)},[u,y,x,T]);const U={...k?{role:"presentation"}:{role:"listbox","aria-multiselectable":a||void 0,"aria-readonly":f||void 0,id:`${w}-list`},onKeyDown(W){v&&_o.has(W.key)&&W.stopPropagation()},onScroll(W){k||N(W.currentTarget)},...y&&{style:k?{height:"100%"}:vg},className:!k&&y?Ei.className:void 0},B=Le("div",t,{ref:[n,u.context.popupRef],state:A,stateAttributesMapping:Pg,props:[O,U,Lo(P),c]});return ne.jsxs(l.Fragment,{children:[!S&&Ei.getElement(b),ne.jsx(Xr,{context:h,modal:!1,disabled:!I,openInteractionType:C,returnFocus:i,restoreFocus:!0,children:B})]})});function xi(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Kn(e){return Iu(e.scrollHeight,e.clientHeight)}function Ti(e){return Hc.getScale(e)}function bn(e,t,n){return e/n[t]}function Gn(e,t){return Tn({x:bn(e.x,"x",t),y:bn(e.y,"y",t),width:bn(e.width,"x",t),height:bn(e.height,"y",t)})}const Ci=[["transform","none"],["scale","1"],["translate","0 0"]];function Ig(e){const{style:t}=e,n={};for(const[o,r]of Ci)n[o]=t.getPropertyValue(o),t.setProperty(o,r,"important");return()=>{for(const[o]of Ci){const r=n[o];r?t.setProperty(o,r):t.removeProperty(o)}}}function Fu(e={}){const{guess:t,label:n,metadata:o,textRef:r,index:s}=e,{register:i,unregister:c,subscribeMapChange:u,nextIndexRef:a}=pg(),f=l.useRef(-1),[d,h]=l.useState(s==null&&t?()=>{if(f.current===-1){const R=a.current;a.current+=1,f.current=R}return f.current}:-1),p=s??d,g=l.useRef(null),y=l.useCallback(R=>{const m=g.current;m&&c(m),g.current=R,R&&i(R,{metadata:o??null,index:s??null,label:n,textRef:r})},[s,i,c,o,n,r]);return J(()=>{if(s==null)return u(R=>{var v;const m=g.current?(v=R.get(g.current))==null?void 0:v.index:null;m!=null&&h(m)})},[s,u]),{ref:y,index:p}}const Lu=l.createContext(void 0);function Rs(){const e=l.useContext(Lu);if(!e)throw new Error(Ne(57));return e}const bh=l.memo(l.forwardRef(function(t,n){const{render:o,className:r,style:s,value:i=null,label:c,disabled:u=!1,nativeButton:a=!1,...f}=t,d=l.useRef(null),h=Fu({guess:!0,label:c,textRef:d}),p=Ht(),{itemProps:g,multiple:y,disabled:R,readOnly:m}=ms(),v=R||u,E=p.useState("isActive",h.index),b=p.useState("open"),S=p.useState("isSelected",i),w=p.useState("isSelectedByFocus",h.index),T=p.useState("isItemEqualToValue"),C=h.index,I=l.useRef(null);J(()=>{const A=p.context.valuesRef.current;return A[C]=i,()=>{delete A[C]}},[C,i,p]),J(()=>{const A=p.state.value,U=p.state.selectedIndex;let B=U,W;y&&Array.isArray(A)?(B=qp(C,i,p.context.valuesRef.current,A,T,U),W=B===C,C===U&&!W&&(p.context.selectedItemTextRef.current=null)):(W=A!==void 0&&Kt(i,A,T),W&&(B=C)),p.set("selectedIndex",B),W&&d.current&&(p.context.selectedItemTextRef.current=d.current)},[C,y,T,p,i]);const O=l.useRef("mouse"),P=l.useRef(!1),{getButtonProps:L,buttonRef:x}=An({disabled:v,focusableWhenDisabled:!0,native:a,composite:!0}),k={disabled:v,selected:S,highlighted:E};function D(A){if(R||m)return;const U=p.state.value;if(y){const B=Array.isArray(U)?U:[],W=S?Zp(B,i,T):[...B,i];p.context.setValue(W,he(jo,A))}else p.context.setValue(i,he(jo,A)),p.context.setOpen(!1,he(jo,A))}function F(){p.context.selectionRef.current.dragY=0}const V={role:"option","aria-selected":S,tabIndex:b&&E?0:-1,onKeyDown(A){p.set("activeIndex",C),A.key===" "&&p.context.typingRef.current&&A.preventDefault()},onClick(A){const U=O.current!=="touch",B=A.nativeEvent.pointerType,W=U&&yo(A.nativeEvent)&&(B!==void 0||E),H=U&&!W&&!P.current;P.current=!1,!(v||H)&&D(A.nativeEvent)},onPointerEnter(A){O.current=A.pointerType},onPointerMove(A){if(A.pointerType==="mouse"&&A.buttons===1){const U=p.context.selectionRef.current;U.dragY+=A.movementY,U.dragY**2>=64&&(U.allowUnselectedMouseUp=!0)}},onPointerDown(A){O.current=A.pointerType,P.current=!0,F()},onMouseUp(){var B;if(F(),v||O.current==="touch"||P.current)return;const A=!p.context.selectionRef.current.allowSelectedMouseUp&&S,U=!p.context.selectionRef.current.allowUnselectedMouseUp&&!S;A||U||(P.current=!0,(B=I.current)==null||B.click(),P.current=!1)}},M=Le("div",t,{ref:[x,n,h.ref,I],state:k,props:[g,V,f,L]}),N=l.useMemo(()=>({selected:S,index:C,textRef:d,selectedByFocus:w}),[S,C,d,w]);return ne.jsx(Lu.Provider,{value:N,children:M})})),Rh=l.forwardRef(function(t,n){const{selected:o}=Rs();return t.keepMounted||o?ne.jsx(Og,{...t,ref:n}):null}),Og=l.memo(l.forwardRef((e,t)=>{const{render:n,className:o,style:r,keepMounted:s,...i}=e,{selected:c}=Rs(),u=l.useRef(null),{transitionStatus:a,setMounted:f}=Jr(c),h=Le("span",e,{ref:[t,u],state:{selected:c,transitionStatus:a},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:xo});return Xt({batch:!0,enabled:!c,open:c,ref:u,onComplete(){c||f(!1)}}),h})),vh=l.memo(l.forwardRef(function(t,n){const{index:o,textRef:r,selectedByFocus:s}=Rs(),i=Ht(),{render:c,className:u,style:a,...f}=t,d=l.useCallback(p=>{p&&(o===0&&(i.context.firstItemTextRef.current=p),s&&(i.context.selectedItemTextRef.current=p))},[i,o,s]);return Le("div",t,{ref:[d,n,r],props:f})})),_u=l.createContext(void 0);function Nu(){const e=l.useContext(_u);if(e===void 0)throw new Error(Ne(64));return e}const Ag="data-activation-direction",vs={tabActivationDirection:e=>({[Ag]:e})},Eh=l.forwardRef(function(t,n){const{className:o,defaultValue:r=0,onValueChange:s,orientation:i="horizontal",render:c,value:u,style:a,...f}=t,d=t.defaultValue!==void 0,h=l.useRef([]),[p,g]=l.useState(()=>new Map),[y,R]=br({controlled:u,default:r,name:"Tabs",state:"value"}),m=u!==void 0,[v,E]=l.useState(()=>new Map),b=l.useRef(void 0),S=l.useCallback(j=>Er(v,j),[v]),[w,T]=l.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:C,tabActivationDirection:I}=w;let O=I,P=!1;C!==y&&(O=wi(C,y,i,v),P=C!=null&&y!=null&&S(y)==null);const L=P?C:y,x=C!==L||I!==O;J(()=>{x&&T({previousValue:L,tabActivationDirection:O})},[L,x,O]);const k=te((j,X)=>{const se=wi(y,j,i,v);X.activationDirection=se,s==null||s(j,X),!X.isCanceled&&R(j)}),D=te((j,X)=>{s==null||s(j,he(X,void 0,void 0,{activationDirection:"none"}))}),F=te((j,X)=>(g(se=>{const le=new Map(se);return le.set(j,X),le}),()=>{g(se=>{if(se.get(j)!==X)return se;const le=new Map(se);return le.delete(j),le})})),V=l.useCallback(j=>p.get(j),[p]),M=l.useCallback(j=>{for(const X of v.values())if(j===X.value)return X.id},[v]),N=l.useMemo(()=>({getTabElementBySelectedValue:S,getTabIdByPanelValue:M,getTabPanelIdByValue:V,onValueChange:k,orientation:i,registerMountedTabPanel:F,setTabMap:E,tabActivationDirection:O,value:y}),[S,M,V,k,i,F,E,O,y]),A=l.useMemo(()=>{for(const j of v.values())if(j.value===y)return j},[v,y]),U=l.useMemo(()=>{for(const j of v.values())if(!j.disabled)return j.value},[v]),B=l.useRef(!d),W=l.useRef(r),H=l.useRef(d),Y=l.useRef(!1);J(()=>{var q;if(m)return;function j(G,Z){R(G),T({previousValue:G,tabActivationDirection:"none"}),D(G,Z),B.current=!1}if(v.size===0){Y.current&&y!==null&&!((q=b.current)!=null&&q.isConnected)&&j(null,Fs);return}Y.current=!0,b.current=v.keys().next().value;const X=A==null?void 0:A.disabled,se=A==null&&y!==null;if(!X&&y===W.current&&(H.current=!1),H.current&&X&&y===W.current)return;const le=B.current;if(X||se){const G=U??null;if(y===G){B.current=!1;return}let Z=Fs;le?Z=Ls:X&&(Z=cc),j(G,Z);return}le&&A!=null&&(D(y,Ls),B.current=!1)},[U,m,D,A,R,v,y]);const Q=Le("div",t,{state:{orientation:i,tabActivationDirection:O},ref:n,props:f,stateAttributesMapping:vs});return ne.jsx(_u.Provider,{value:N,children:ne.jsx(bs,{elementsRef:h,children:Q})})});function Er(e,t){for(const[n,o]of e.entries())if(t===o.value)return n;return null}function wi(e,t,n,o){if(e==null||t==null)return"none";const[r,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],c=Er(o,e),u=Er(o,t);if(c==null||u==null)return c!==u&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?i:s:"none";const a=c.getBoundingClientRect()[r],f=u.getBoundingClientRect()[r];return f<a?s:f>a?i:"none"}const Es="data-composite-item-active";function Mg(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=gs(),{ref:r,index:s}=Fu(e),i=n===s,c=l.useRef(null),u=$t(r,c);return{compositeProps:{tabIndex:i?0:-1,onFocus(){o(s)},onMouseMove(){const f=c.current;if(!t||!f)return;const d=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!d&&f.focus()}},compositeRef:u,index:s}}const Hu=l.createContext(void 0);function kg(){const e=l.useContext(Hu);if(e===void 0)throw new Error(Ne(65));return e}const Sh=l.forwardRef(function(t,n){const{className:o,disabled:r=!1,render:s,value:i,id:c,nativeButton:u=!0,style:a,...f}=t,{value:d,getTabPanelIdByValue:h,onValueChange:p,orientation:g,tabActivationDirection:y}=Nu(),{activateOnFocus:R,registerTabResizeObserverElement:m,tabsListElement:v}=kg(),{highlightedIndex:E,onHighlightedIndexChange:b}=gs(),S=fn(c),w=l.useMemo(()=>({disabled:r,id:S,value:i}),[r,S,i]),{compositeProps:T,compositeRef:C,index:I}=Mg({metadata:w}),O=i===d,P=l.useRef(!1),L=l.useRef(null),x=te(Y=>{var $;($=L.current)==null||$.call(L),L.current=Y?m(Y):null});J(()=>{if(P.current){P.current=!1;return}if(!(O&&I>-1&&E!==I))return;const Y=v;if(Y!=null){const $=qe(Se(Y));if($&&ue(Y,$))return}r||b(I)},[O,I,E,b,r,v]);const{getButtonProps:k,buttonRef:D}=An({disabled:r,native:u,focusableWhenDisabled:!0}),F=h(i),V=l.useRef(!1),M=l.useRef(!1);function N(Y){p(i,he(Ft,Y.nativeEvent,void 0,{activationDirection:"none"}))}function A(Y){O||r||N(Y)}function U(Y){O||r||R&&(!V.current||M.current)&&N(Y)}function B(Y){if(O||r)return;V.current=!0,M.current=Y.button===0;const $=Se(Y.currentTarget);function Q(){V.current=!1,M.current=!1,$.removeEventListener("pointerup",Q),$.removeEventListener("pointercancel",Q)}$.addEventListener("pointerup",Q),$.addEventListener("pointercancel",Q)}return Le("button",t,{state:{disabled:r,active:O,orientation:g,tabActivationDirection:y},ref:[n,D,C,x],props:[T,{role:"tab","aria-controls":F,"aria-selected":O,id:S,onClick:A,onFocus:U,onPointerDown:B,[Es]:O?"":void 0,onKeyDownCapture(){P.current=!0}},f,k],stateAttributesMapping:vs})});function Dg(e){const{loopFocus:t=!0,orientation:n="both",grid:o,onLoop:r,direction:s,highlightedIndex:i,onHighlightedIndexChange:c,rootRef:u,enableHomeAndEndKeys:a=!1,stopEventPropagation:f,disabledIndices:d,modifierKeys:h=kt}=e,[p,g]=l.useState(0),y=o!=null,R=l.useRef(null),m=$t(R,u),v=l.useRef([]),E=l.useRef(!1),b=l.useRef(null),S=i??p,w=te((P,L=!1)=>{if(b.current=v.current[P]??null,(c??g)(P),L){const x=v.current[P];hi(R.current,x,s,n)}}),T=te(P=>{var D;if(P.size===0)return;if(E.current){const F=v.current,V=F.indexOf(b.current);if(V===-1){const M=F[S];!M||en(F,S,d)?w(Fg(F,d)):b.current=M}else V!==S&&w(V);return}E.current=!0;const L=Array.from(P.keys()),x=L.find(F=>F==null?void 0:F.hasAttribute(Es))??null,k=x?((D=P.get(x))==null?void 0:D.index)??-1:-1;if(k!==-1)w(k);else if(en(L,S,d)){const F=Et(L,{disabledIndices:d});vn(L,F)||w(F)}hi(R.current,x,s,n)});J(()=>{if(d==null||i!=null||!E.current)return;const P=v.current;if(en(P,S,d)){const L=Et(P,{disabledIndices:d});vn(P,L)||w(L)}},[d,i,S,v,w]);const C=te((P,L,x)=>r?r(P,L,x,v):x),I=te(P=>{const L=P.key===mr||P.key===yr;if(!_o.has(P.key)||!a&&L||Lg(P,h)||!R.current)return;const k=s==="rtl",D=k?gr:hr,F=k?hr:gr,V=n==="vertical"?pr:D,M=n==="vertical"?dr:F,N=We(P.nativeEvent);if(N!=null&&gi(N)&&!mu(N)){const Y=N.selectionStart,$=N.selectionEnd,Q=N.value;if(Y==null||P.shiftKey||Y!==$||P.key!==M&&Y<Q.length||P.key!==V&&Y>0)return}let A=S;const U=qn(v,d),B=lr(v,d);o!=null&&(A=o({disabledIndices:d,elementsRef:v,event:P,highlightedIndex:S,loopFocus:t,maxIndex:B,minIndex:U,onLoop:C,orientation:n,rtl:k}));const W=n!=="vertical"&&P.key===D||n!=="horizontal"&&P.key===pr,H=n!=="vertical"&&P.key===F||n!=="horizontal"&&P.key===dr;a&&(P.key===mr?A=U:P.key===yr&&(A=B)),A===S&&(W||H)&&(t&&A===B&&W?(A=U,r&&(A=r(P,S,A,v))):t&&A===U&&H?(A=B,r&&(A=r(P,S,A,v))):A=Et(v.current,{startingIndex:A,decrement:H,disabledIndices:d})),A!==S&&!vn(v.current,A)&&(f&&P.stopPropagation(),(y||L||W||H)&&P.preventDefault(),w(A,!0),queueMicrotask(()=>{var Y;(Y=v.current[A])==null||Y.focus()}))});return{props:{ref:m,onFocus(P){const L=R.current,x=We(P.nativeEvent);!L||x==null||!gi(x)||x.setSelectionRange(0,x.value.length)},onKeyDown:I},highlightedIndex:S,onHighlightedIndexChange:w,elementsRef:v,onMapChange:T,relayKeyboardEvent:I}}function Fg(e,t){let n=-1;for(let o=0;o<e.length;o+=1){const r=e[o];if(!(!r||en(e,o,t))){if(r.hasAttribute(Es))return o;n===-1&&(n=o)}}return Math.max(n,0)}function Lg(e,t){for(const n of yp)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function _g(e){const{render:t,className:n,style:o,refs:r=kt,props:s=kt,state:i=_e,stateAttributesMapping:c,highlightedIndex:u,onHighlightedIndexChange:a,orientation:f,grid:d,loopFocus:h,onLoop:p,enableHomeAndEndKeys:g,onMapChange:y,stopEventPropagation:R=!0,rootRef:m,disabledIndices:v,modifierKeys:E,highlightItemOnHover:b=!1,tag:S="div",...w}=e,T=as(),{props:C,highlightedIndex:I,onHighlightedIndexChange:O,elementsRef:P,onMapChange:L,relayKeyboardEvent:x}=Dg({grid:d,loopFocus:h,onLoop:p,orientation:f,highlightedIndex:u,onHighlightedIndexChange:a,rootRef:m,stopEventPropagation:R,enableHomeAndEndKeys:g,direction:T,disabledIndices:v,modifierKeys:E}),k=Le(S,e,{state:i,ref:r,props:[C,...s,w],stateAttributesMapping:c}),D=l.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:O,highlightItemOnHover:b,relayKeyboardEvent:x}),[I,O,b,x]);return ne.jsx(fu.Provider,{value:D,children:ne.jsx(bs,{elementsRef:P,onMapChange:F=>{y==null||y(F),L(F)},children:k})})}const xh=l.forwardRef(function(t,n){const{activateOnFocus:o=!1,className:r,loopFocus:s=!0,render:i,style:c,...u}=t,{orientation:a,setTabMap:f,tabActivationDirection:d}=Nu(),[h,p]=l.useState(0),[g,y]=l.useState(null),R=l.useRef(new Set),m=l.useRef(new Set),v=l.useRef(null);J(()=>{if(typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>{R.current.forEach(I=>{I()})});return v.current=C,g&&C.observe(g),m.current.forEach(I=>{C.observe(I)}),()=>{C.disconnect(),v.current=null}},[g]);const E=te(C=>(R.current.add(C),()=>{R.current.delete(C)})),b=te(C=>{var I;return m.current.add(C),(I=v.current)==null||I.observe(C),()=>{var O;m.current.delete(C),(O=v.current)==null||O.unobserve(C)}}),S={orientation:a,tabActivationDirection:d},w={"aria-orientation":a==="vertical"?"vertical":void 0,role:"tablist"},T=l.useMemo(()=>({activateOnFocus:o,registerIndicatorUpdateListener:E,registerTabResizeObserverElement:b,tabsListElement:g}),[o,E,b,g]);return ne.jsx(Hu.Provider,{value:T,children:ne.jsx(_g,{render:i,className:r,style:c,state:S,refs:[n,y],props:[w,u],stateAttributesMapping:vs,highlightedIndex:h,enableHomeAndEndKeys:!0,loopFocus:s,orientation:a,onHighlightedIndexChange:p,onMapChange:f,disabledIndices:kt})})}),Vu=l.createContext(void 0);function Mn(e){const t=l.useContext(Vu);if(t===void 0&&!e)throw new Error(Ne(47));return t}const Ng={...cs,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Hg extends On{constructor(n,o,r){const s=new Do;super(Vg(n,s,o,r),Bg(s),Ng);Te(this,"setOpen",(n,o)=>{var d,h;const r=o.reason===$e,s=o.reason===Lt&&o.event.detail===0,i=!n&&(o.reason===wo||o.reason==null),c=qc(o),u=this.select("activeTriggerId");if(!n&&o.reason===ic&&o.trigger==null&&u!=null&&(o.trigger=this.context.triggerElements.getById(u)??this.select("activeTriggerElement")??void 0),(h=(d=this.context).onOpenChange)==null||h.call(d,n,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,o);const a=()=>{const p=ts(this.state,n,o.trigger,c());p.openChangeReason=o.reason,this.update(p)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Ka,()=>{this.set("stickIfOpen",!1)}),at.flushSync(a)):a();let f;s?f="click":i?f="dismiss":o.reason===Yt&&(f="focus"),this.set("instantType",f)})}}function Vg(e,t,n,o=!1){const r={...ss(t,n,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return r.open&&(e==null?void 0:e.mounted)===void 0&&(r.mounted=!0),r}function Bg(e){return{popupRef:l.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:l.createRef(),beforeContentFocusGuardRef:l.createRef(),stickIfOpenTimeout:new ct,triggerElements:e}}const Pi=po(function({props:t}){const{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,modal:c=!1,handle:u,triggerId:a,defaultTriggerId:f=null}=t,d=jg(u,{modal:c,open:r,openProp:o,activeTriggerId:f,triggerIdProp:a});d.useControlledProp("openProp",o),d.useControlledProp("triggerIdProp",a);const h=d.useState("open"),p=d.useState("mounted"),g=d.useState("payload");d.useContextCallback("onOpenChange",s),d.useContextCallback("onOpenChangeComplete",i),Jc(d,h),ns(d);const{forceUnmount:y}=os(h,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:c}),l.useEffect(()=>{h||d.context.stickIfOpenTimeout.clear()},[d,h]),l.useImperativeHandle(t.actionsRef,()=>({unmount:y,close:()=>d.setOpen(!1,he(Br))}),[y,d]);const R=h||p;return ne.jsxs(Vu.Provider,{value:d,children:[u&&ne.jsx(es,{handle:u,store:d}),R&&ne.jsx($g,{store:d,modal:c}),typeof n=="function"?n({payload:g}):n]})});function Th(e){return Mn(!0)?ne.jsx(Pi,{props:e}):ne.jsx(tf,{children:ne.jsx(Pi,{props:e})})}function jg(e,t){const n=Qr((o,r)=>new Hg(t,o,r));return l.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function $g({store:e,modal:t}){const n=e.useState("floatingRootContext"),o=Io(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=o.reference,s=o.floating;return rs(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const Wg=300;function Ug(e,t){const n=l.useRef(null);function o(s){at.flushSync(()=>{e.setOpen(!1,he(Yt,s.nativeEvent,s.currentTarget))});const i=$a(n.current);i==null||i.focus()}function r(s){var c;const i=e.select("positionerElement");if(i&&tn(s,i))(c=e.context.beforeContentFocusGuardRef.current)==null||c.focus();else{at.flushSync(()=>{e.setOpen(!1,he(Yt,s.nativeEvent,s.currentTarget))});let u=ja(e.context.triggerFocusTargetRef.current||t.current);for(;u!==null&&ue(i,u);){const a=u;if(u=zr(u),u===a)break}u==null||u.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:r}}const Ch=qi(function(t,n){const{render:o,className:r,style:s,disabled:i=!1,nativeButton:c=!0,handle:u,payload:a,openOnHover:f=!1,delay:d=Wg,closeDelay:h=0,id:p,...g}=t,y=Mn(!0),m=eu(u)??y;if(!m)throw new Error(Ne(74));const v=fn(p),E=m.useState("isTriggerActive",v),b=m.useState("floatingRootContext"),S=m.useState("isOpenedByTrigger",v),w=m.useState("triggerPopupId",v),T=l.useRef(null),{registerTrigger:C,isMountedByThisTrigger:I}=Zc(v,T,m,{payload:a,disabled:i,openOnHover:f,closeDelay:h}),O=m.useState("openChangeReason"),P=m.useState("stickIfOpen"),L=m.useState("openMethod"),x=m.useState("focusManagerModal"),k=ou(b,{enabled:!i&&f&&(L!=="touch"||O!==Lt),mouseOnly:!0,move:!1,handleClose:ru(),restMs:d,delay:{close:h},triggerElementRef:T,isActiveTrigger:E,isClosing:()=>m.select("transitionStatus")==="ending"}),D=kc(b,{stickIfOpen:P}),F=hu(()=>m.select("open"),Q=>{m.set("openMethod",Q)}),V=m.useState("triggerProps",I),{getButtonProps:M,buttonRef:N}=An({disabled:i,native:c}),A={open(Q){return Q&&O===Lt?rc.open(Q):Nr.open(Q)}},{preFocusGuardRef:U,handlePreFocusGuardFocus:B,handleFocusTargetFocus:W}=Ug(m,T),Y=Le("button",t,{state:{disabled:i,open:S},ref:[N,n,C,T],props:[D.reference,k,V,F,{[Tc]:"",id:v,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":w},g,M],stateAttributesMapping:A}),$=ne.jsx(l.Fragment,{children:Y},v);return I&&!x?ne.jsxs(l.Fragment,{children:[ne.jsx(sn,{ref:U,onFocus:B}),$,ne.jsx(sn,{ref:m.context.triggerFocusTargetRef,onFocus:W})]}):$}),Bu=l.createContext(void 0);function Yg(){const e=l.useContext(Bu);if(e===void 0)throw new Error(Ne(45));return e}const wh=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t;return Mn().useState("mounted")||o?ne.jsx(Bu.Provider,{value:o,children:ne.jsx(Kr,{ref:n,...r})}):null}),ju=l.createContext(void 0);function zg(){const e=l.useContext(ju);if(!e)throw new Error(Ne(46));return e}const Ph=l.forwardRef(function(t,n){const{render:o,className:r,style:s,anchor:i,positionMethod:c,side:u,align:a,sideOffset:f,alignOffset:d,collisionBoundary:h="clipping-ancestors",collisionPadding:p,arrowPadding:g,sticky:y,disableAnchorTracking:R=!1,collisionAvoidance:m=Cc,...v}=t,E=Mn(),b=Yg(),S=Qa(),w=E.useState("floatingRootContext"),T=E.useState("mounted"),C=E.useState("open"),I=E.useState("openChangeReason"),O=E.useState("activeTriggerElement"),P=E.useState("modal"),L=E.useState("openMethod"),x=E.useState("positionerElement"),k=E.useState("instantType"),D=E.useState("transitionStatus"),F=E.useState("adaptiveOrigin"),V=l.useRef(null),M=Gc(x),N=fs({anchor:i,floatingRootContext:w,positionMethod:c,mounted:T,side:u,sideOffset:f,align:a,alignOffset:d,arrowPadding:g,collisionBoundary:h,collisionPadding:p,sticky:y,disableAnchorTracking:R,keepMounted:b,nodeId:S,collisionAvoidance:m,adaptiveOrigin:F}),A=w.useState("domReferenceElement");J(()=>{const Y=A,$=V.current;if(Y&&(V.current=Y),$&&Y&&Y!==$){E.set("instantType",void 0);const Q=new AbortController;return M(()=>{E.set("instantType","trigger-change")},Q.signal),()=>{Q.abort()}}},[A,M,E]);const U=P===!0&&I!==$e;ku(C&&U,L==="touch",x,O);const B=E.useStateSetter("positionerElement"),W={open:C,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:k},H=ds(t,W,{styles:N.positionerStyles,transitionStatus:D,props:v,refs:[n,B],hidden:!T,inert:!C});return ne.jsxs(ju.Provider,{value:N,children:[T&&U&&ne.jsx(hs,{inert:ps(!C),cutout:O}),ne.jsx(ef,{id:S,children:H})]})}),Kg=l.createContext(void 0);function Gg(){const[e,t]=l.useState(0),n=te(()=>(t(r=>r+1),()=>{t(r=>Math.max(0,r-1))}));return{context:l.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const Ih=l.forwardRef(function(t,n){const{render:o,className:r,style:s,initialFocus:i,finalFocus:c,...u}=t,a=Mn(),f=zg(),d=Du()!=null,{context:h,hasClosePart:p}=Gg(),g=a.useState("open"),y=a.useState("openMethod"),R=a.useState("instantType"),m=a.useState("transitionStatus"),v=a.useState("popupProps"),E=a.useState("titleElementId"),b=a.useState("descriptionElementId"),S=a.useState("modal"),w=a.useState("mounted"),T=a.useState("openChangeReason"),C=a.useState("activeTriggerElement"),I=a.useState("floatingRootContext"),O=I.useState("floatingId"),P=a.useState("disabled"),L=a.useState("openOnHover"),x=a.useState("closeDelay");Xt({open:g,ref:a.context.popupRef,onComplete(){var N,A;g&&((A=(N=a.context).onOpenChangeComplete)==null||A.call(N,!0))}}),nu(I,{enabled:L&&!P,closeDelay:x});const k=i===void 0?Xc(a.context.popupRef):i,D=S!==!1&&p;a.useSyncedValue("focusManagerModal",D);const F=a.useStateSetter("popupElement"),V={open:g,side:f.side,align:f.align,instant:R,transitionStatus:m},M=Le("div",t,{state:V,ref:[n,a.context.popupRef,F],props:[v,{id:O,role:"dialog",...ko,"aria-labelledby":E,"aria-describedby":b,onKeyDown(N){d&&_o.has(N.key)&&N.stopPropagation()}},Lo(m),u],stateAttributesMapping:Hr});return ne.jsx(Xr,{context:I,openInteractionType:y,modal:D,disabled:!w||T===$e,initialFocus:k,returnFocus:c,restoreFocus:"popup",previousFocusableElement:Pe(C)?C:void 0,nextFocusableElement:a.context.triggerFocusTargetRef,beforeContentFocusGuardRef:a.context.beforeContentFocusGuardRef,children:ne.jsx(Kg.Provider,{value:h,children:M})})});export{mh as A,yh as B,bh as C,lh as D,Rh as E,vh as F,Eh as G,xh as H,Sh as I,Th as P,gl as R,fh as S,oh as T,at as a,Ch as b,Zg as c,wh as d,Ph as e,Ih as f,Ku as g,Jg as h,Qg as i,ne as j,eh as k,th as l,nh as m,ah as n,ih as o,sh as p,uh as q,l as r,rh as s,ch as t,qg as u,ph as v,Rd as w,dh as x,gh as y,hh as z};
|
|
41
|
+
*/var Mo=l,fd=Ao;function dd(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pd=typeof Object.is=="function"?Object.is:dd,gd=fd.useSyncExternalStore,hd=Mo.useRef,md=Mo.useEffect,yd=Mo.useMemo,bd=Mo.useDebugValue;zc.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=hd(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=yd(function(){function u(p){if(!a){if(a=!0,f=p,p=o(p),r!==void 0&&i.hasValue){var g=i.value;if(r(g,p))return d=g}return d=p}if(g=d,pd(f,p))return g;var y=o(p);return r!==void 0&&r(g,y)?(f=p,g):(f=p,d=y)}var a=!1,f,d,h=n===void 0?null:n;return[function(){return u(t())},h===null?void 0:function(){return u(h())}]},[t,n,o,r]);var c=gd(e,s[0],s[1]);return md(function(){i.hasValue=!0,i.value=c},[c]),bd(c),c};Yc.exports=zc;var Rd=Yc.exports;const vd=Pr(19),Ed=vd?xd:Td;function Kc(e,t,n,o,r){return Ed(e,t,n,o,r)}function Sd(e,t,n,o,r){const s=l.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return Ao.useSyncExternalStore(e.subscribe,s,s)}Hl({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const o=e.syncHooks[n],r=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,r)||(t=!0,o.value=r)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const r of e.syncHooks)n.add(r.store);const o=[];for(const r of n)o.push(r.subscribe(t));return()=>{for(const r of o)r()}}),Ao.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function xd(e,t,n,o,r){const s=Nl();if(!s)return Sd(e,t,n,o,r);const i=s.syncIndex;s.syncIndex+=1;let c;return s.didInitialize?(c=s.syncHooks[i],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,o)||!Object.is(c.a3,r))&&(c.store!==e&&(s.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=o,c.a3=r,c.value=t(e.getSnapshot(),n,o,r))):(c={store:e,selector:t,a1:n,a2:o,a3:r,value:t(e.getSnapshot(),n,o,r)},s.syncHooks.push(c)),c.value}function Td(e,t,n,o,r){return Rd.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class Cd{constructor(t){Te(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Te(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,o,r){return Kc(this,t,n,o,r)}}class On extends Cd{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){l.useDebugValue(t);const o=this;J(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){const o=this;J(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);J(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){l.useDebugValue(t);const o=this,r=n!==void 0;J(()=>{r&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,r])}select(t,n,o,r){const s=this.selectors[t];return s(this.state,n,o,r)}useState(t,n,o,r){return l.useDebugValue(t),Kc(this,this.selectors[t],n,o,r)}useContextCallback(t,n){l.useDebugValue(t);const o=te(n??ke);this.context[t]=o}useStateSetter(t){const n=l.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const i=o(s);if(!Object.is(r,i)){const c=r;r=i,n(i,c,this)}})}}const wd={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Zr extends On{constructor(n){const{syncOnly:o,nested:r,onOpenChange:s,triggerElements:i,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Oc(),nested:r,triggerElements:i},wd);Te(this,"syncOpenEvent",(n,o)=>{(!n||!this.state.open||o!=null&&Gl(o))&&(this.context.dataRef.current.openEvent=n?o:void 0)});Te(this,"dispatchOpenChange",(n,o)=>{this.syncOpenEvent(n,o.event);const r={open:n,reason:o.reason,nativeEvent:o.event,nested:this.context.nested,triggerElement:o.trigger};this.context.events.emit("openchange",r)});Te(this,"setOpen",(n,o)=>{var r,s,i,c;if(this.syncOnly){(s=(r=this.context).onOpenChange)==null||s.call(r,n,o);return}this.dispatchOpenChange(n,o),(c=(i=this.context).onOpenChange)==null||c.call(i,n,o)});this.syncOnly=o}}function Pd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:r,nested:s,onOpenChange:i}=e,c=t.useState("open"),u=t.useState("activeTriggerElement"),a=t.useState(n?"popupElement":"positionerElement"),f=t.context.triggerElements,d=i,h=l.useRef(null);o===void 0&&h.current===null&&(h.current=new Zr({open:c,transitionStatus:void 0,referenceElement:u,floatingElement:a,triggerElements:f,onOpenChange:d,floatingId:r,syncOnly:!0,nested:s}));const p=o??h.current;return t.useSyncedValue("floatingId",r),J(()=>{const g={open:c,floatingId:r,referenceElement:u,floatingElement:a};Re(u)&&(g.domReferenceElement=u),p.state.positionReference===p.state.referenceElement&&(g.positionReference=u),p.update(g)},[c,r,u,a,p]),p.context.onOpenChange=d,p.context.nested=s,p}function Jr(e,t=!1,n=!1,o=!1){const[r,s]=l.useState(e&&t?"idle":void 0),[i,c]=l.useState(e&&!o);return e&&!i&&(c(!0),s("starting")),!e&&i&&r!=="ending"&&!n&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),J(()=>{if(!e&&i&&r!=="ending"&&n){const u=gt.request(()=>{s("ending")});return()=>{gt.cancel(u)}}},[e,i,r,n]),J(()=>{if(!e||t)return;const u=gt.request(()=>{s(void 0)});return()=>{gt.cancel(u)}},[t,e]),J(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&s("starting");const u=gt.request(()=>{s("idle")});return()=>{gt.cancel(u)}},[t,e,i,r]),{mounted:i,setMounted:c,transitionStatus:r}}let Vn=null;function Id(e){if(!Vn){const t=[];Vn=t,queueMicrotask(()=>{Vn=null,at.flushSync(()=>{for(const n of t)n()})})}Vn.push(e)}function Gc(e,t=!1,n=!1){const o=rn();return te((r,s=null)=>{o.cancel();const i=Rt(e);if(i==null)return;const c=i,u=()=>{if(!n){at.flushSync(r);return}Id(()=>{s!=null&&s.aborted||r()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function a(){Promise.all(c.getAnimations().map(f=>f.finished)).then(()=>{s!=null&&s.aborted||u()},()=>{if(s!=null&&s.aborted)return;if(c.getAnimations().some(d=>d.pending||d.playState!=="finished")){a();return}u()})}if(t){const f=nc;if(!c.hasAttribute(f)){o.request(a);return}const d=new MutationObserver(()=>{c.hasAttribute(f)||(d.disconnect(),a())});d.observe(c,{attributes:!0,attributeFilter:[f]}),s==null||s.addEventListener("abort",()=>d.disconnect(),{once:!0});return}o.request(a)})}function Xt(e){const{enabled:t=!0,open:n,ref:o,batch:r=!1,onComplete:s}=e,i=te(s),c=Gc(o,n,r);l.useEffect(()=>{if(!t)return;const u=new AbortController;return c(i,u.signal),()=>{u.abort()}},[t,n,i,c])}const ko={tabIndex:-1,[sr]:""};function Xc(e){return t=>t==="touch"?e.current:!0}function Qr(e,t=!1){const n=In(),o=an()!=null,r=ze(()=>e(n,o)).current;return Pd({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:r.setOpen}),r}function es({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function si(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Od(e,t){const n=l.useRef(null);return te(o=>{const r=n.current;if(r!==null){if(r.element===o&&r.store===t&&r.id===e)return;n.current=null;const s=r.store;s.context.triggerElements.getById(r.id)===r.element&&(s.context.triggerElements.delete(r.id),si(s))}o!==null&&e!==void 0&&(n.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),si(t))})}function ts(e,t,n,o=!1){let r=e.preventUnmountingOnClose;t?r=!1:o&&(r=!0);const s=(n==null?void 0:n.id)??null;let i=e.activeTriggerId,c=e.activeTriggerElement;return(s||t)&&(i=s,c=n??null),{open:t,preventUnmountingOnClose:r,activeTriggerId:i,activeTriggerElement:c}}function qc(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Ad(e,t,n,o={}){var f,d,h;const r=n.reason,s=r===$e,i=t&&r===Xn,c=!t&&(r===Lt||r===wo),u=qc(n);if((d=(f=e.context).onOpenChange)==null||d.call(f,t,n),n.isCanceled)return;(h=o.onBeforeDispatch)==null||h.call(o),e.state.floatingRootContext.dispatchOpenChange(t,n);const a=()=>{const p=ts(e.state,t,n.trigger,u()),g={...o.extraState,...p};i?g.instantType="focus":c?g.instantType="dismiss":s&&(g.instantType=void 0),e.update(g)};s?at.flushSync(a):a()}function Zc(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Od(e,n),i=te(u=>{const a=n.select("open"),f=n.select("activeTriggerId");if(f===e){const d={activeTriggerElement:u,...a?o:null};n.update(d);return}if(f==null&&a){const d={activeTriggerId:e??null,activeTriggerElement:u,...o};n.update(d)}}),c=te(u=>{s(u),u&&i(u)});return J(()=>(c(t.current),()=>c(null)),[c,t,n,e]),J(()=>{if(r){const u={activeTriggerElement:t.current,...o};n.update(u)}},[r,n,t,...Object.values(o)]),{registerTrigger:c,isMountedByThisTrigger:r}}function ns(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,o=l.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");J(()=>{if(!r){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const u=e.context.triggerElements.size,a={};e.state.triggerCount!==u&&(a.triggerCount=u);const f=e.select("activeTriggerId");let d=null;if(f){const h=e.context.triggerElements.getById(f);if(h)o.current=f,h!==e.state.activeTriggerElement&&(a.activeTriggerElement=h);else{for(const[p,g]of e.context.triggerElements.entries())if(g===e.state.activeTriggerElement){a.activeTriggerId=p,a.activeTriggerElement=g,o.current=p;break}a.activeTriggerId===void 0&&(o.current===f?d=f:o.current=null)}}else o.current=null;if(!d&&!f&&u===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[p,g]=h.value;a.activeTriggerId=p,a.activeTriggerElement=g,o.current=p}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),d&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===d&&!e.context.triggerElements.getById(d)){const h=he(Ft);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,i,c,n])}function os(e,t,n,o){const{mounted:r,setMounted:s,transitionStatus:i}=Jr(e,!1,!1,o),c=t.useState("preventUnmountingOnClose"),u=e?!1:c;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:u});const a=te(()=>{var f,d;s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(d=(f=t.context).onOpenChangeComplete)==null||d.call(f,!1)});return Xt({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||a()}}),{forceUnmount:a,transitionStatus:i}}function rs(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:_e,inactiveTriggerProps:_e,popupProps:_e})},[e])}function Jc(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Do{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function ss(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Zr({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:_e,inactiveTriggerProps:_e,popupProps:_e}}const En=e=>e.triggerIdProp??e.activeTriggerId,is=e=>e.openProp??e.open,ii=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function Qc(e,t){return t!==void 0&&is(e)&&En(e)===t}function Md(e,t){return Qc(e,t)?!0:t!==void 0&&is(e)&&En(e)==null&&e.triggerCount===1}const cs={open:is,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:En,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:ii,isTriggerActive:(e,t)=>t!==void 0&&En(e)===t,isOpenedByTrigger:(e,t)=>Qc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&En(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Md(e,t)?ii(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function eu(e){const t=l.useCallback(o=>e===void 0?ke:e.subscribeStore(o),[e]),n=l.useCallback(()=>e===void 0?void 0:e.store,[e]);return Ao.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}function kd(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=In(),s=an()!=null,i=ze(()=>new Zr({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Do,floatingId:r,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=Re(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Dd(e){return Fd(e,e.rootContext)}function Fd(e,t){const{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),c=t.useState("open"),u=t.useState("floatingId"),[a,f]=l.useState(null),[d,h]=l.useState(void 0),[p,g]=l.useState(void 0),y=l.useRef(null),R=Gt(o),m=l.useMemo(()=>({reference:r,floating:s,domReference:i}),[r,s,i]),v=jf({...e,elements:{...m,...a&&{reference:a}}}),E=Re(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue("referenceElement",d??null),t.useSyncedValue("domReferenceElement",d===void 0?i:E),t.useSyncedValue("floatingElement",b);const S=l.useCallback(P=>{const L=Re(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;f(L),v.refs.setReference(L)},[v.refs]),w=l.useCallback(P=>{(Re(P)||P===null)&&(y.current=P,h(P)),(Re(v.refs.reference.current)||v.refs.reference.current===null||P!==null&&!Re(P))&&v.refs.setReference(P)},[v.refs,h]),T=l.useCallback(P=>{g(P),v.refs.setFloating(P)},[v.refs]),C=l.useMemo(()=>({...v.refs,setReference:w,setFloating:T,setPositionReference:S,domReference:y}),[v.refs,w,T,S]),I=l.useMemo(()=>({...v.elements,domReference:i}),[v.elements,i]),O=l.useMemo(()=>({...v,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:u,refs:C,elements:I,nodeId:n,rootStore:t}),[v,C,I,n,t,c,u]);return J(()=>{i&&(y.current=i)},[i]),J(()=>{t.context.dataRef.current.floatingContext=O;const P=R==null?void 0:R.nodesRef.current.find(L=>L.id===n);P&&(P.context=O)}),l.useMemo(()=>({...v,context:O,refs:C,elements:I,rootStore:t}),[v,C,I,O,t])}const Xo=Ji&&Ct;function Ld(e,t={}){const{enabled:n=!0,delay:o}=t,r="rootStore"in e?e.rootStore:e,{events:s,dataRef:i}=r.context,c=l.useRef(!1),u=l.useRef(null),a=l.useRef(!0),f=tt();l.useEffect(()=>{const h=r.select("domReferenceElement");if(!n)return;const p=Ae(h);function g(){const m=r.select("domReferenceElement");!r.select("open")&&Pe(m)&&m===qe(Se(m))&&(c.current=!0,u.current=m)}function y(){a.current=!0}function R(){a.current=!1}return ht(be(p,"blur",g),Xo&&be(p,"keydown",y,!0),Xo&&be(p,"pointerdown",R,!0))},[r,n]),l.useEffect(()=>{if(!n)return;function h(p){if(p.reason===Lt||p.reason===wo){const g=r.select("domReferenceElement");Re(g)&&(u.current=g,c.current=!0)}}return s.on("openchange",h),()=>{s.off("openchange",h)}},[s,n,r]);const d=l.useMemo(()=>{function h(){c.current=!1,u.current=null}return{onMouseLeave(){h()},onFocus(p){const g=p.currentTarget;if(c.current){if(u.current===g)return;h()}const y=We(p.nativeEvent);if(Re(y)){if(Xo&&!p.relatedTarget){if(!a.current&&!Co(y))return}else if(!pa(y))return}const R=no(p.relatedTarget,r.context.triggerElements),{nativeEvent:m,currentTarget:v}=p,E=typeof o=="function"?o():o;if(r.select("open")&&R||E===0||E===void 0){r.setOpen(!0,he(Xn,m,v));return}f.start(E,()=>{c.current||r.setOpen(!0,he(Xn,m,v))})},onBlur(p){h();const g=p.relatedTarget,y=p.nativeEvent,R=Re(g)&&g.hasAttribute(Cn("focus-guard"))&&g.getAttribute("data-type")==="outside";f.start(0,()=>{var b;const m=r.select("domReferenceElement"),v=qe(Se(m));!g&&v===m||ue((b=i.current.floatingContext)==null?void 0:b.refs.floating.current,v)||ue(m,v)||R||no(g??v,r.context.triggerElements)||r.setOpen(!1,he(Xn,y))})}}},[i,o,r,f]);return l.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}class us{constructor(){Te(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});Te(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ct,this.restTimeout=new ct,this.handleCloseOptions=void 0}static create(){return new us}}const co=new WeakMap;function uo(e){var n,o,r;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&co.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(o=e.pointerEventsReferenceElement)==null||o.style.removeProperty("pointer-events"),(r=e.pointerEventsFloatingElement)==null||r.style.removeProperty("pointer-events"),co.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function tu(e,t){const{scopeElement:n,referenceElement:o,floatingElement:r}=t,s=co.get(n);s&&s!==e&&uo(s),uo(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=r,co.set(n,e),n.style.pointerEvents="none",o.style.pointerEvents="auto",r.style.pointerEvents="auto"}function ls(e){const t=e.context.dataRef.current,n=ze(()=>t.hoverInteractionState??us.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Ar(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function nu(e,t={}){const{enabled:n=!0,closeDelay:o=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),c=s.useState("floatingElement"),u=s.useState("domReferenceElement"),{dataRef:a}=s.context,f=Gt(),d=an(),h=ls(s),p=tt(),g=te(()=>{var m;return sc((m=a.current.openEvent)==null?void 0:m.type,h.interactedInside)}),y=te(()=>{var m;return ha((m=a.current.openEvent)==null?void 0:m.type)}),R=te(()=>{uo(h)});J(()=>{i||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,R())},[i,h,R]),l.useEffect(()=>R,[R]),J(()=>{var m,v,E,b,S;if(n&&i&&(m=h.handleCloseOptions)!=null&&m.blockPointerEvents&&y()&&Re(u)&&c){const w=u,T=c,C=Se(c),I=(E=(v=f==null?void 0:f.nodesRef.current.find(x=>x.id===d))==null?void 0:v.context)==null?void 0:E.elements.floating;I&&(I.style.pointerEvents="");const O=h.pointerEventsScopeElement!==T?h.pointerEventsScopeElement:null,P=I!==T?I:null,L=((S=(b=h.handleCloseOptions)==null?void 0:b.getScope)==null?void 0:S.call(b))??O??P??w.closest("[data-rootownerid]")??C.body;return tu(h,{scopeElement:L,referenceElement:w,floatingElement:T}),()=>{R()}}},[n,i,u,c,h,y,f,d,R]),l.useEffect(()=>{if(!n)return;function m(){return!!(f&&d&&Nt(f.nodesRef.current,d).length>0)}function v(C){const I=Ut(o,"close",h.pointerType),O=()=>{s.setOpen(!1,he($e,C)),f==null||f.events.emit("floating.closed",C)};I?h.openChangeTimeout.start(I,O):(h.openChangeTimeout.clear(),O())}function E(C){const I=We(C);if(!da(I)){h.interactedInside=!1;return}h.interactedInside=(I==null?void 0:I.closest("[aria-haspopup]"))!=null}function b(){h.openChangeTimeout.clear(),p.clear(),f==null||f.events.off("floating.closed",w),R()}function S(C){var L;if(m()&&f){f.events.on("floating.closed",w);return}if(no(C.relatedTarget,s.context.triggerElements))return;const I=((L=a.current.floatingContext)==null?void 0:L.nodeId)??r,O=C.relatedTarget;if(!(f&&I&&Re(O)&&Nt(f.nodesRef.current,I,!1).some(x=>{var k;return ue((k=x.context)==null?void 0:k.elements.floating,O)}))){if(h.handler){h.handler(C);return}R(),y()&&!g()&&v(C)}}function w(C){!f||!d||m()||p.start(0,()=>{f.events.off("floating.closed",w),s.setOpen(!1,he($e,C)),f.events.emit("floating.closed",C)})}const T=c;return ht(T&&be(T,"mouseenter",b),T&&be(T,"mouseleave",S),T&&be(T,"pointerdown",E,!0),()=>{f==null||f.events.off("floating.closed",w)})},[n,c,s,a,o,r,y,g,R,h,f,d,p])}const _d={current:null};function ou(e,t={}){const{enabled:n=!0,delay:o=0,handleClose:r=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:u=_d,externalTree:a,isActiveTrigger:f=!0,getHandleCloseContext:d,isClosing:h,shouldOpen:p,guardStaleOpen:g=!1}=t,y="rootStore"in e?e.rootStore:e,{dataRef:R,events:m}=y.context,v=Gt(a),E=ls(y),b=l.useRef(!1),S=Fe(r),w=Fe(o),T=Fe(i),C=Fe(n),I=Fe(p),O=Fe(h),P=te(()=>{var F;return sc((F=R.current.openEvent)==null?void 0:F.type,E.interactedInside)}),L=te(()=>{var F;return((F=I.current)==null?void 0:F.call(I))!==!1}),x=te((F,V,M)=>{const N=y.context.triggerElements;if(N.hasElement(V))return!F||!ue(F,V);if(!Re(M))return!1;const A=M;return N.hasMatchingElement(U=>ue(U,A))&&(!F||!ue(F,A))}),k=te(()=>{if(!E.handler)return;Se(y.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),D=te(()=>{uo(E)});return f&&(E.handleCloseOptions=r==null?void 0:r.__options),l.useEffect(()=>k,[k]),l.useEffect(()=>{if(!n)return;function F(V){V.open?b.current=!1:(b.current=V.reason===$e,k(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return m.on("openchange",F),()=>{m.off("openchange",F)}},[n,m,E,k]),l.useEffect(()=>{if(!n)return;function F(B,W=!0){const H=Ut(w.current,"close",E.pointerType);H?E.openChangeTimeout.start(H,()=>{y.setOpen(!1,he($e,B)),v==null||v.events.emit("floating.closed",B)}):W&&(E.openChangeTimeout.clear(),y.setOpen(!1,he($e,B)),v==null||v.events.emit("floating.closed",B))}const V=u.current??(f?y.select("domReferenceElement"):null);if(!Re(V))return;function M(B){var ee;if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,s&&!At(E.pointerType))return;const W=ks(T.current),H=Ut(w.current,"open",E.pointerType),Y=We(B),$=B.currentTarget??null,Q=y.select("domReferenceElement");let j=$;if(Re(Y)&&!y.context.triggerElements.hasElement(Y)){for(const ae of y.context.triggerElements.elements())if(ue(ae,Y)){j=ae;break}}Re($)&&Re(Q)&&!y.context.triggerElements.hasElement($)&&ue($,Q)&&(j=Q);const X=j==null?!1:x(Q,j,Y),se=y.select("open"),le=((ee=O.current)==null?void 0:ee.call(O))??y.select("transitionStatus")==="ending",q=!se&&le&&b.current,G=!X&&Re(j)&&Re(Q)&&ue(Q,j)&&q,Z=W>0&&!H,ie=X&&(se||q)||G,xe=!se||X;if(ie){L()&&y.setOpen(!0,he($e,B,j));return}Z||(H?E.openChangeTimeout.start(H,()=>{xe&&L()&&y.setOpen(!0,he($e,B,j))}):xe&&L()&&y.setOpen(!0,he($e,B,j)))}function N(B){if(P()){D();return}k();const W=y.select("domReferenceElement"),H=Se(W);E.restTimeout.clear(),E.restTimeoutPending=!1;const Y=R.current.floatingContext??(d==null?void 0:d());if(no(B.relatedTarget,y.context.triggerElements))return;if(S.current&&Y){y.select("open")||E.openChangeTimeout.clear();const Q=u.current;E.handler=S.current({...Y,tree:v,x:B.clientX,y:B.clientY,onClose(){D(),k(),C.current&&!P()&&Q===y.select("domReferenceElement")&&F(B,!0)}}),H.addEventListener("mousemove",E.handler),E.handler(B);return}(E.pointerType==="touch"?!ue(y.select("floatingElement"),B.relatedTarget):!0)&&F(B)}function A(B){ue(V,B.relatedTarget)||(E.openChangeTimeout.clear(),E.restTimeout.clear(),E.restTimeoutPending=!1)}const U=g?be(V,"mouseout",A):void 0;return c?ht(be(V,"mousemove",M,{once:!0}),be(V,"mouseenter",M),be(V,"mouseleave",N),U):ht(be(V,"mouseenter",M),be(V,"mouseleave",N),U)},[k,D,R,w,y,n,S,E,f,x,P,s,c,T,u,v,C,d,O,L,g]),l.useMemo(()=>{if(!n)return;function F(V){E.pointerType=V.pointerType}return{onPointerDown:F,onPointerEnter:F,onMouseMove(V){var Y,$,Q;const{nativeEvent:M}=V,N=V.currentTarget,A=y.select("domReferenceElement"),U=y.select("open"),B=x(A,N,V.target);if(s&&!At(E.pointerType))return;if(U&&B&&((Y=E.handleCloseOptions)!=null&&Y.blockPointerEvents)){const j=y.select("floatingElement");if(j){const X=((Q=($=E.handleCloseOptions)==null?void 0:$.getScope)==null?void 0:Q.call($))??N.ownerDocument.body;tu(E,{scopeElement:X,referenceElement:N,floatingElement:j})}}const W=ks(T.current);if(U&&!B||W===0||!B&&E.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;E.restTimeout.clear();function H(){if(E.restTimeoutPending=!1,P())return;const j=y.select("open");!E.blockMouseMove&&(!j||B)&&L()&&y.setOpen(!0,he($e,M,N))}E.pointerType==="touch"?at.flushSync(()=>{H()}):B&&U?H():(E.restTimeoutPending=!0,E.restTimeout.start(W,H))}}},[n,E,P,x,s,y,T,L])}const Nd="Escape";function ci(e){return Ct&&e.movementX===0&&e.movementY===0}function Fo(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Bn(e,t){return Fo(t,e===tc||e===_r,e===Eo||e===So)}function qo(e,t,n){return Fo(t,e===_r,n?e===Eo:e===So)||e==="Enter"||e===" "||e===""}function Hd(e,t,n){return Fo(t,n?e===Eo:e===So,e===_r)}function Vd(e,t,n,o){const r=n?e===So:e===Eo,s=e===tc;return t==="both"||t==="horizontal"&&o?e===Nd:Fo(t,r,s)}function Bd(e,t){const{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:u=!1,nested:a=!1,rtl:f=!1,virtual:d=!1,focusItemOnOpen:h="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:g=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:m,id:v,resetOnPointerLeave:E=!0,externalTree:b,grid:S}=t,w=S!=null,T="rootStore"in e?e.rootStore:e,C=T.useState("open"),I=T.useState("floatingElement"),O=T.useState("domReferenceElement"),P=T.context.dataRef,L=oo(I),x=cr(O),k=Fe(L),D=an(),F=Gt(b),V=l.useRef(h),M=l.useRef(i??-1),N=l.useRef(null),A=l.useRef(!0),U=te(z=>{r(M.current===-1?null:M.current,z)}),B=l.useRef(!!I),W=l.useRef(C),H=l.useRef(!1),Y=l.useRef(!1),$=l.useRef(null),Q=Fe(y),j=Fe(C),X=Fe(i),se=Fe(E),le=rn(),q=rn(),G=te(()=>{function z(ce){d?F==null||F.events.emit("virtualfocus",ce):$.current=Zn(ce,{sync:H.current,preventScroll:!0})}const re=n.current[M.current],K=Y.current;re&&z(re),(H.current?ce=>ce():ce=>le.request(ce))(()=>{var Ee;const ce=n.current[M.current]||re;if(!ce)return;re||z(ce),oe&&(K||!A.current)&&((Ee=ce.scrollIntoView)==null||Ee.call(ce,{block:"nearest",inline:"nearest"}))})});J(()=>{P.current.orientation=R},[P,R]),J(()=>{s&&(C&&I?(M.current=i??-1,V.current&&i!=null&&(Y.current=!0,U())):B.current&&(M.current=-1,U()))},[s,C,I,i,U]),J(()=>{if(s){if(!C){H.current=!1;return}if(I)if(o==null){if(H.current=!1,X.current!=null)return;if(B.current&&(M.current=-1,G()),(!W.current||!B.current)&&V.current&&(N.current!=null||V.current===!0&&N.current==null)){let z=0;const re=()=>{n.current[0]==null?(z<2&&(z?_=>q.request(_):queueMicrotask)(re),z+=1):(M.current=N.current==null||qo(N.current,R,f)||a?qn(n):lr(n),N.current=null,U())};re()}}else vn(n.current,o)||(M.current=o,G(),Y.current=!1)}},[s,C,I,o,X,a,n,R,f,U,G,q]),J(()=>{var ce,de;if(!s||I||!F||d||!B.current)return;const z=F.nodesRef.current,re=(de=(ce=z.find(Ee=>Ee.id===D))==null?void 0:ce.context)==null?void 0:de.elements.floating,K=qe(Se(O??re??null)),_=z.some(Ee=>Ee.context&&ue(Ee.context.elements.floating,K));re&&!_&&A.current&&re.focus({preventScroll:!0})},[s,I,O,F,D,d]),J(()=>{W.current=C,B.current=!!I}),J(()=>{C||(N.current=null,V.current=h)},[C,h]);const Z=o!=null,ie=te(z=>{if(!j.current)return;const re=n.current.indexOf(z.currentTarget);re!==-1&&(M.current!==re||o!==re)&&(M.current=re,U(z))}),xe=te(()=>{var z,re,K;return m??((K=(re=(z=F==null?void 0:F.nodesRef.current.find(_=>_.id===D))==null?void 0:z.context)==null?void 0:re.dataRef)==null?void 0:K.current.orientation)}),ee=te(()=>qn(n,Q.current)),ae=te(z=>{if(A.current=!1,H.current=!0,z.which===229||!j.current&&z.currentTarget===k.current)return;if(a&&Vd(z.key,R,f,w)){Bn(z.key,xe())||pt(z),T.setOpen(!1,he(Ds,z.nativeEvent)),Pe(O)&&(d?F==null||F.events.emit("virtualfocus",O):O.focus());return}const re=M.current,K=qn(n,y),_=lr(n,y);if(x||(z.key==="Home"&&(pt(z),M.current=K,U(z)),z.key==="End"&&(pt(z),M.current=_,U(z))),S!=null){const ce=S(z,M.current,n,R,u,f,y,K,_);if(ce!=null&&(M.current=ce,U(z)),R==="both")return}if(Bn(z.key,R)){if(pt(z),C&&!d&&qe(z.currentTarget.ownerDocument)===z.currentTarget){M.current=qo(z.key,R,f)?K:_,U(z);return}qo(z.key,R,f)?u?re>=_?c&&re!==n.current.length?M.current=-1:(H.current=!1,M.current=K):M.current=Et(n.current,{startingIndex:re,disabledIndices:y}):M.current=Math.min(_,Et(n.current,{startingIndex:re,disabledIndices:y})):u?re<=K?c&&re!==-1?M.current=n.current.length:(H.current=!1,M.current=_):M.current=Et(n.current,{startingIndex:re,decrement:!0,disabledIndices:y}):M.current=Math.max(K,Et(n.current,{startingIndex:re,decrement:!0,disabledIndices:y})),vn(n.current,M.current)&&(M.current=-1),U(z)}}),oe=l.useMemo(()=>({onFocus(re){H.current=!0,ie(re)},onClick:({currentTarget:re})=>re.focus({preventScroll:!0}),onMouseMove(re){ci(re)||(H.current=!0,Y.current=!1,p&&ie(re))},onPointerLeave(re){var _;if(!j.current||!A.current||re.pointerType==="touch")return;H.current=!0;const K=re.relatedTarget;if(!(!p||n.current.includes(K))&&se.current&&((_=$.current)==null||_.call($),$.current=null,M.current=-1,U(re),!d)){const ce=k.current,de=qe(Se(ce));ce&&ue(ce,de)&&ce.focus({preventScroll:!0})}}}),[ie,j,k,p,n,U,se,d]),me=l.useMemo(()=>d&&C&&Z&&{"aria-activedescendant":`${v}-${o}`},[d,C,Z,v,o]),ye=l.useMemo(()=>({...x?{}:me,onKeyDown(z){if(z.key==="Tab"&&z.shiftKey&&C&&!d){const re=We(z.nativeEvent);if(re&&!ue(k.current,re))return;pt(z),T.setOpen(!1,he(Yt,z.nativeEvent)),Pe(O)&&O.focus();return}ae(z)},onPointerMove(z){ci(z)||(A.current=!0)}}),[me,ae,k,x,T,C,d,O]),ge=l.useMemo(()=>{function z(_){T.setOpen(!0,he(Ds,_.nativeEvent,_.currentTarget))}function re(_){h==="auto"&&yo(_.nativeEvent)&&(V.current=!d)}function K(_){V.current=h,h==="auto"&&kr(_.nativeEvent)&&(V.current=!0)}return{onKeyDown(_){const ce=T.select("open");A.current=!1;const de=_.key.startsWith("Arrow"),Ee=Hd(_.key,xe(),f),Ve=Bn(_.key,R),Ge=(a?Ee:Ve)||_.key==="Enter"||_.key.trim()==="";if(d&&ce)return ae(_);if(!(!ce&&!g&&de)){if(Ge){const Me=Bn(_.key,xe());N.current=a&&Me?null:_.key}if(a){Ee&&(pt(_),ce?(M.current=ee(),U(_)):z(_));return}Ve&&(X.current!=null&&(M.current=X.current),pt(_),!ce&&g?z(_):ae(_),ce&&U(_))}},onFocus(_){T.select("open")&&!d&&(M.current=-1,U(_))},onPointerDown:K,onPointerEnter:K,onMouseDown:re,onClick:re}},[ae,h,ee,a,U,T,g,R,xe,f,X,d]),Ce=l.useMemo(()=>({...me,...ge}),[me,ge]);return l.useMemo(()=>s?{reference:Ce,floating:ye,item:oe,trigger:ge}:{},[s,Ce,ye,ge,oe])}function jd(e,t){const{listRef:n,elementsRef:o,activeIndex:r,onMatch:s,disabledIndices:i,onTyping:c,enabled:u=!0,resetMs:a=750,selectedIndex:f=null}=t,d="rootStore"in e?e.rootStore:e,h=d.useState("open"),p=tt(),g=l.useRef(""),y=l.useRef(f??r??-1),R=l.useRef(null),m=te(b=>{function S(k){return o==null?void 0:o.current[k]}function w(k){const D=S(k);return D&&!Po(D)||D!=null&&D.matches(":disabled")?!1:i==null||!en(kt,k,i)}function T(k,D,F=0){if(k.length===0)return-1;const V=(F%k.length+k.length)%k.length,M=D.toLowerCase();for(let N=0;N<k.length;N+=1){const A=(V+N)%k.length,U=k[A];if(!(!(U!=null&&U.toLowerCase().startsWith(M))||!w(A)))return A}return-1}const C=n.current;if(g.current.length>0&&b.key===" "&&(pt(b),c==null||c(!0)),g.current.length>0&&g.current[0]!==" "&&T(C,g.current)===-1&&b.key!==" "&&(c==null||c(!1)),C==null||b.key.length!==1||b.ctrlKey||b.metaKey||b.altKey)return;h&&b.key!==" "&&(pt(b),c==null||c(!0));const I=g.current==="";I&&(y.current=f??r??-1),C.every((k,D)=>{var F,V;return k&&w(D)?((F=k[0])==null?void 0:F.toLowerCase())!==((V=k[1])==null?void 0:V.toLowerCase()):!0})&&g.current===b.key&&(g.current="",y.current=R.current),g.current+=b.key,p.start(a,()=>{g.current="",y.current=R.current,c==null||c(!1)});const L=((I?f??r??-1:y.current)??0)+1,x=T(C,g.current,L);x!==-1?(s==null||s(x),R.current=x):b.key!==" "&&(g.current="",c==null||c(!1))}),v=te(b=>{const S=b.relatedTarget,w=d.select("domReferenceElement"),T=d.select("floatingElement");ue(w,S)||ue(T,S)||(p.clear(),g.current="",y.current=R.current,c==null||c(!1))});J(()=>{!h&&f!==null||(p.clear(),R.current=null,g.current!==""&&(g.current=""))},[h,f,p]);const E=l.useMemo(()=>({onKeyDown:m,onBlur:v}),[m,v]);return l.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}const ui=.1,$d=ui*ui,we=.5;function jn(e,t,n,o,r,s){return o>=t!=s>=t&&e<=(r-n)*(t-o)/(s-o)+n}function $n(e,t,n,o,r,s,i,c,u,a){let f=!1;return jn(e,t,n,o,r,s)&&(f=!f),jn(e,t,r,s,i,c)&&(f=!f),jn(e,t,i,c,u,a)&&(f=!f),jn(e,t,u,a,n,o)&&(f=!f),f}function Wd(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Wn(e,t,n,o,r,s){const i=Math.min(n,r),c=Math.max(n,r),u=Math.min(o,s),a=Math.max(o,s);return e>=i&&e<=c&&t>=u&&t<=a}function ru(e={}){const{blockPointerEvents:t=!1}=e,n=new ct,o=({x:r,y:s,placement:i,elements:c,onClose:u,nodeId:a,tree:f})=>{const d=i==null?void 0:i.split("-")[0];let h=!1,p=null,g=null,y=typeof performance<"u"?performance.now():0;function R(v,E){const b=performance.now(),S=b-y;if(p===null||g===null||S===0)return p=v,g=E,y=b,!1;const w=v-p,T=E-g,C=w*w+T*T,I=S*S*$d;return p=v,g=E,y=b,C<I}function m(){n.clear(),u()}return function(E){n.clear();const b=c.domReference,S=c.floating;if(!b||!S||d==null||r==null||s==null)return;const{clientX:w,clientY:T}=E,C=We(E),I=E.type==="mouseleave",O=ue(S,C),P=ue(b,C);if(O&&(h=!0,!I))return;if(P&&(h=!1,!I)){h=!0;return}if(I&&Re(E.relatedTarget)&&ue(S,E.relatedTarget))return;function L(){return!!(f&&Nt(f.nodesRef.current,a).length>0)}function x(){L()||m()}if(L())return;const k=b.getBoundingClientRect(),D=S.getBoundingClientRect(),F=r>D.right-D.width/2,V=s>D.bottom-D.height/2,M=D.width>k.width,N=D.height>k.height,A=(M?k:D).left,U=(M?k:D).right,B=(N?k:D).top,W=(N?k:D).bottom;if(d==="top"&&s>=k.bottom-1||d==="bottom"&&s<=k.top+1||d==="left"&&r>=k.right-1||d==="right"&&r<=k.left+1){x();return}let H=!1;switch(d){case"top":H=Wn(w,T,A,k.top+1,U,D.bottom-1);break;case"bottom":H=Wn(w,T,A,D.top+1,U,k.bottom-1);break;case"left":H=Wn(w,T,D.right-1,W,k.left+1,B);break;case"right":H=Wn(w,T,k.right-1,W,D.left+1,B);break}if(H)return;if(h&&!Wd(w,T,k)){x();return}if(!I&&R(w,T)){x();return}let Y=!1;switch(d){case"top":{const $=M?we/2:we*4,Q=M||F?r+$:r-$,j=M?r-$:F?r+$:r-$,X=s+we+1,se=F||M?D.bottom-we:D.top,le=F?M?D.bottom-we:D.top:D.bottom-we;Y=$n(w,T,Q,X,j,X,D.left,se,D.right,le);break}case"bottom":{const $=M?we/2:we*4,Q=M||F?r+$:r-$,j=M?r-$:F?r+$:r-$,X=s-we,se=F||M?D.top+we:D.bottom,le=F?M?D.top+we:D.bottom:D.top+we;Y=$n(w,T,Q,X,j,X,D.left,se,D.right,le);break}case"left":{const $=N?we/2:we*4,Q=N||V?s+$:s-$,j=N?s-$:V?s+$:s-$,X=r+we+1,se=V||N?D.right-we:D.left,le=V?N?D.right-we:D.left:D.right-we;Y=$n(w,T,se,D.top,le,D.bottom,X,Q,X,j);break}case"right":{const $=N?we/2:we*4,Q=N||V?s+$:s-$,j=N?s-$:V?s+$:s-$,X=r-we,se=V||N?D.left+we:D.right,le=V?N?D.left+we:D.right:D.left+we;Y=$n(w,T,X,Q,X,j,se,D.top,le,D.bottom);break}}Y?h||n.start(40,x):x()}};return o.__options={...e,blockPointerEvents:t},o}const Ud={...cs,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Yd extends On{constructor(n,o,r){const s=new Do;super(zd(n,s,o,r),Kd(s),Ud);Te(this,"setOpen",(n,o)=>{Ad(this,n,o,{extraState:{openChangeReason:o.reason}})})}cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,he(Lt,n))}}function zd(e,t,n,o=!1){return{...ss(t,n,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Kd(e){return{popupRef:l.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Jg=po(function(t){const{disabled:n=!1,defaultOpen:o=!1,open:r,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:u,onOpenChangeComplete:a,handle:f,triggerId:d,defaultTriggerId:h=null,children:p}=t,g=Qr((P,L)=>new Yd({open:o,openProp:r,activeTriggerId:h,triggerIdProp:d},P,L));g.useControlledProp("openProp",r),g.useControlledProp("triggerIdProp",d),g.useContextCallback("onOpenChange",u),g.useContextCallback("onOpenChangeComplete",a);const y=g.useState("open"),R=!n&&y,m=g.useState("activeTriggerId"),v=g.useState("mounted"),E=g.useState("payload");g.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s,disabled:n}),ns(g,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:b,transitionStatus:S}=os(R,g),w=g.useState("isInstantPhase"),T=g.useState("instantType"),C=g.useState("lastOpenChangeReason"),I=l.useRef(null);J(()=>{y&&n&&g.setOpen(!1,he(cc))},[y,n,g]),J(()=>{S==="ending"&&C===Ft||S!=="ending"&&w?(T!=="delay"&&(I.current=T),g.set("instantType","delay")):I.current!==null&&(g.set("instantType",I.current),I.current=null)},[S,w,C,T,g]),J(()=>{R&&m==null&&g.set("payload",void 0)},[g,m,R]),l.useImperativeHandle(c,()=>({unmount:b,close:()=>g.setOpen(!1,he(Br))}),[b,g]);const O=R||v||!n&&i!=="none";return ne.jsxs(Zi.Provider,{value:g,children:[f&&ne.jsx(es,{handle:f,store:g}),O&&ne.jsx(Gd,{store:g,disabled:n,trackCursorAxis:i}),typeof p=="function"?p({payload:E}):p]})});function Gd({store:e,disabled:t,trackCursorAxis:n}){const o=e.useState("floatingRootContext"),r=Io(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),s=sf(o,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=l.useMemo(()=>Wt(s.reference,r.reference),[s.reference,r.reference]);return rs(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:r.floating??_e}),null}function fn(e){return In(e,"base-ui")}const su=l.createContext(void 0);function Xd(){return l.useContext(su)}const qd=600,iu="data-base-ui-tooltip-trigger";function li(e){if("composedPath"in e){const n=e.composedPath();for(let o=0;o<n.length;o+=1){const r=n[o];if(Re(r))return r}}const t=e.target;return Re(t)?t:null}function Zd(e){let t=e;for(;t;){const n=t.closest(`[${iu}]`);if(n)return n;const o=t.getRootNode();t="host"in o&&Re(o.host)?o.host:null}return null}const Qg=qi(function(t,n){const{render:o,className:r,style:s,handle:i,payload:c,disabled:u,delay:a,closeOnClick:f=!0,closeDelay:d,id:h,...p}=t,g=go(!0),R=eu(i)??g;if(!R)throw new Error(Ne(82));const m=fn(h),v=R.useState("isTriggerActive",m),E=R.useState("isOpenedByTrigger",m),b=R.useState("floatingRootContext"),S=l.useRef(null),w=d??0,{registerTrigger:T,isMountedByThisTrigger:C}=Zc(m,S,R,{payload:c,closeOnClick:f,closeDelay:w}),I=Xd(),{activeIdRef:O,delayRef:P,isInstantPhase:L,hasProvider:x}=va(b,{open:E}),k=ls(b);R.useSyncedValue("isInstantPhase",L);const D=R.useState("disabled"),F=u??D,V=Fe(F),M=R.useState("trackCursorAxis"),N=R.useState("disableHoverablePopup"),A=l.useRef(!1),U=tt(),B=l.useRef(void 0);function W(){return x&&O.current!=null?0:a??I??qd}function H(G){const Z=S.current;if(!Z||!G)return!1;const ie=Zd(G);return ie!==null&&ie!==Z&&ue(Z,ie)}function Y(G){const Z=H(G);return A.current=Z,Z&&(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1,U.clear()),Z}const $=ou(b,{enabled:!F,mouseOnly:!0,move:!1,handleClose:!N&&M!=="both"?ru():null,restMs:W,delay(){return d==null&&x?{close:Ut(P.current,"close")}:{close:w}},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>R.select("transitionStatus")==="ending",shouldOpen(){return!A.current}}),Q=Ld(b,{enabled:!F}).reference,j=G=>{const Z=A.current,ie=li(G),xe=Y(ie),ee=S.current,ae=ee&&ie&&ue(ee,ie);if(xe&&R.select("open")&&R.select("lastOpenChangeReason")===$e){R.setOpen(!1,he($e,G));return}if(Z&&!xe&&ae&&!V.current&&!R.select("open")&&ee&&At(B.current)){const oe=()=>{!A.current&&!V.current&&!R.select("open")&&R.setOpen(!0,he($e,G,ee))},me=W();me===0?(U.clear(),oe()):U.start(me,oe)}},X=R.useState("triggerProps",C);return Le("button",t,{state:{open:E},ref:[n,T,S],props:[$,Q,C||M!=="none"?X:void 0,{onMouseOver(G){j(G.nativeEvent)},onFocus(G){H(li(G.nativeEvent))&&G.preventBaseUIHandler()},onMouseLeave(){A.current=!1,U.clear(),B.current=void 0},onPointerEnter(G){B.current=G.pointerType},onPointerDown(G){B.current=G.pointerType,R.set("closeOnClick",f),f&&!R.select("open")&&R.cancelPendingOpen(G.nativeEvent)},onClick(G){f&&!R.select("open")&&R.cancelPendingOpen(G.nativeEvent)},id:m,[ir]:F?"":void 0,[iu]:F?void 0:""},p],stateAttributesMapping:Nr})}),cu=l.createContext(void 0);function Jd(){const e=l.useContext(cu);if(e===void 0)throw new Error(Ne(70));return e}const Qd=l.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,style:c,...u}=t,{node:a,subtree:f}=Ic({container:r,ref:n,componentProps:t,elementProps:u});return!f&&!a?null:ne.jsxs(l.Fragment,{children:[f,a&&at.createPortal(o,a)]})}),eh=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t;return go().useState("mounted")||o?ne.jsx(cu.Provider,{value:o,children:ne.jsx(Qd,{ref:n,...r})}):null}),uu=l.createContext(void 0);function ep(){const e=l.useContext(uu);if(e===void 0)throw new Error(Ne(71));return e}const tp=l.createContext(void 0);function as(){const e=l.useContext(tp);return(e==null?void 0:e.direction)??"ltr"}const np=e=>({name:"arrow",options:e,async fn(t){var N,A;const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:a,padding:f=0,offsetParent:d="real"}=_t(e,t)||{};if(a==null)return{};const h=dc(f),p={x:n,y:o},g=Ur(r),y=Wr(g),R=await i.getDimensions(a),m=g==="y",v=m?"top":"left",E=m?"bottom":"right",b=m?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[g]-p[g]-s.floating[y],w=p[g]-s.reference[g],T=d==="real"?await((N=i.getOffsetParent)==null?void 0:N.call(i,a)):c.floating;let C=c.floating[b]||s.floating[y];(!C||!await((A=i.isElement)==null?void 0:A.call(i,T)))&&(C=c.floating[b]||s.floating[y]);const I=S/2-w/2,O=C/2-R[y]/2-1,P=Math.min(h[v],O),L=Math.min(h[E],O),x=P,k=C-R[y]-L,D=C/2-R[y]/2+I,F=fc(x,D,k),V=!u.arrow&&Tt(r)!=null&&D!==F&&s.reference[y]/2-(D<x?P:L)-R[y]/2<0,M=V?D<x?D-x:D-k:0;return{[g]:p[g]+M,data:{[g]:F,centerOffset:D-F-M,...V&&{alignmentOffset:M}},reset:V}}}),op=(e,t)=>{const{name:n,fn:o}=np(e);return{name:n,fn:o,options:[e,t]}},rp={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},sp={sideX:"left",sideY:"top"},ip="--available-width",cp="--available-height",up="--anchor-width",lp="--anchor-height",ap="--transform-origin",ai=ip,fi=cp;function lu(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function di(e,t,n){const{rects:o,placement:r}=e;return{side:lu(t,it(r),n),align:Tt(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function fs(e){return fp(e,Dd)}function fp(e,t){var lt,He;const{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,collisionBoundary:u,collisionPadding:a=5,sticky:f=!1,arrowPadding:d=5,disableAnchorTracking:h=!1,inline:p,keepMounted:g=!1,floatingRootContext:y,mounted:R,collisionAvoidance:m,shift:v,nodeId:E,adaptiveOrigin:b,lazyFlip:S=!1,externalTree:w}=e,[T,C]=l.useState(null);!R&&T!==null&&C(null);const I=m.side||"flip",O=m.align||"flip",P=m.fallbackAxisSide||"end",L=(v==null?void 0:v.crossAxis)??!1,x=v==null?void 0:v.rootBoundary,k=typeof n=="function"?n:void 0,D=te(k),F=k?D:n,V=Fe(n),M=Fe(R),A=as()==="rtl",U=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":A?"left":"right","inline-start":A?"right":"left"}[r],B=i==="center"?U:`${U}-${i}`;let W=a;typeof W=="number"?W={top:W,right:W,bottom:W,left:W}:W&&(W={top:W.top||0,right:W.right||0,bottom:W.bottom||0,left:W.left||0});const H=1,Y=r==="bottom"?H:0,$=r==="top"?H:0,Q=r==="right"?H:0,j=r==="left"?H:0,X={boundary:u==="clipping-ancestors"?"clippingAncestors":u,padding:W},se=l.useRef(null),le=Fe(s),q=Fe(c),G=typeof s!="function"?s:0,Z=typeof c!="function"?c:0,ie=[];p&&ie.push(p),ie.push($f(pe=>{const De=di(pe,r,A),Be=typeof le.current=="function"?le.current(De):le.current,je=typeof q.current=="function"?q.current(De):q.current;return{mainAxis:Be,crossAxis:je,alignmentAxis:je}},[G,Z,A,r]));const xe=O==="none"&&I!=="shift",ee=!xe&&(f||L||I==="shift"),ae=I==="none"?null:Yf({...X,padding:{top:W.top+H+Y,right:W.right+H+j,bottom:W.bottom+H+$,left:W.left+H+Q},mainAxis:!L&&I==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),oe=xe?null:Wf({...X,rootBoundary:x,mainAxis:O!=="none",crossAxis:ee,limiter:f||L?void 0:Uf(pe=>{if(!se.current)return{};const{width:De,height:Be}=se.current.getBoundingClientRect(),je=st(it(pe.placement)),rt=je==="y"?De:Be,et=je==="y"?W.left+W.right:W.top+W.bottom;return{offset:rt/2+et/2}})},[X,f,L,x,W,O]);I==="shift"||O==="shift"||i==="center"?ie.push(oe,ae):ie.push(ae,oe),ie.push(zf({...X,apply({elements:{floating:pe},availableWidth:De,availableHeight:Be,rects:je}){if(!M.current)return;const rt=pe.style;rt.setProperty(ai,`${De}px`),rt.setProperty(fi,`${Be}px`);const et=Ae(pe).devicePixelRatio||1,{x:Vt,y:Pt,width:ve,height:Ie}=je.reference,Je=(Math.round((Vt+ve)*et)-Math.round(Vt*et))/et,bt=(Math.round((Pt+Ie)*et)-Math.round(Pt*et))/et;rt.setProperty(up,`${Je}px`),rt.setProperty(lp,`${bt}px`)}}),op(pe=>({element:se.current||Se(pe.elements.floating).createElement("div"),padding:se.current?d:0,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(pe){var dn,Zt,kn,pn,Ss,xs;const{elements:{floating:De},middlewareData:Be,placement:je,platform:rt,rects:et,y:Vt}=pe,Pt=it(je),ve=Tt(je),Ie=st(Pt)==="y",Je=se.current,bt=typeof s=="function"?s(di(pe,r,A)):s;let dt;if(!Je&&ve&&Math.abs(Ie?((dn=Be.shift)==null?void 0:dn.x)||0:((Zt=Be.shift)==null?void 0:Zt.y)||0)<=1)dt=ve==="start"===(Ie&&((kn=rt.isRTL)==null?void 0:kn.call(rt,De))===!0)?"100%":"0%";else{const $u=Ie?((pn=Be.arrow)==null?void 0:pn.x)||0:((Ss=Be.arrow)==null?void 0:Ss.y)||0,Wu=Ie?(Je==null?void 0:Je.clientWidth)||0:(Je==null?void 0:Je.clientHeight)||0;dt=`${$u+Wu/2}px`}let Bt=Pt==="top"||Pt==="left"?`calc(100% + ${bt}px)`:`${-bt}px`;return ee&&Ie&&Math.abs(((xs=Be.shift)==null?void 0:xs.y)||0)>bt&&(Bt=`${et.reference.y+et.reference.height/2-Vt}px`),De.style.setProperty(ap,Ie?`${dt} ${Bt}`:`${Bt} ${dt}`),{}}},rp,b),J(()=>{!R&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[R,y]);const me=l.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:ye,elements:ge,x:Ce,y:z,middlewareData:re,update:K,placement:_,context:ce,isPositioned:de,floatingStyles:Ee}=t({rootContext:y,open:g?R:void 0,placement:B,middleware:ie,strategy:o,whileElementsMounted:g?void 0:(...pe)=>ti(...pe,me),nodeId:E,externalTree:w}),{sideX:Ve,sideY:Ge}=re.adaptiveOrigin||sp,Me=de?o:"fixed",Ye=l.useMemo(()=>{let pe;return de?b?pe={position:Me,[Ve]:Ce,[Ge]:z}:pe={...Ee,position:Me}:pe={position:Me,top:0,left:0},pe[ai]="100vw",pe[fi]="100vh",de||(pe.opacity=0),pe},[b,Me,Ve,Ce,Ge,z,Ee,de]),Qe=l.useRef(null);J(()=>{if(!R)return;const pe=V.current,De=typeof pe=="function"?pe():pe,je=(pi(De)?De.current:De)||null||null;je!==Qe.current&&(ye.setPositionReference(je),Qe.current=je)},[R,ye,F,V]),l.useEffect(()=>{if(!R)return;const pe=V.current;typeof pe!="function"&&pi(pe)&&pe.current!==Qe.current&&(ye.setPositionReference(pe.current),Qe.current=pe.current)},[R,ye,F,V]),l.useEffect(()=>{if(g&&R&&ge.reference&&ge.floating)return ti(ge.reference,ge.floating,K,me)},[g,R,ge,K,me]);const Xe=it(_),ft=lu(r,Xe,A),ut=Tt(_)||"center",mt=!!((lt=re.hide)!=null&<.referenceHidden);J(()=>{S&&R&&de&&Xe!==U&&C(Xe)},[S,R,de,Xe,U]);const ot=l.useMemo(()=>{var pe,De;return{position:"absolute",top:(pe=re.arrow)==null?void 0:pe.y,left:(De=re.arrow)==null?void 0:De.x}},[re.arrow]),yt=((He=re.arrow)==null?void 0:He.centerOffset)!==0;return l.useMemo(()=>({positionerStyles:Ye,arrowStyles:ot,arrowRef:se,arrowUncentered:yt,side:ft,align:ut,physicalSide:Xe,anchorHidden:mt,refs:ye,context:ce,isPositioned:de,update:K}),[Ye,ot,se,yt,ft,ut,Xe,mt,ye,ce,de,K])}function pi(e){return e!=null&&"current"in e}function Lo(e){return e==="starting"?Ga:_e}function ds(e,t,{styles:n,transitionStatus:o,props:r,refs:s,hidden:i,inert:c=!1}){const u={...n};return c&&(u.pointerEvents="none"),Le("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:u},Lo(o),r],stateAttributesMapping:To})}const th=l.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="top",align:u="center",sideOffset:a=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:p=5,sticky:g=!1,disableAnchorTracking:y=!1,collisionAvoidance:R=Cc,style:m,...v}=t,E=go(),b=Jd(),S=E.useState("open"),w=E.useState("mounted"),T=E.useState("trackCursorAxis"),C=E.useState("disableHoverablePopup"),I=E.useState("floatingRootContext"),O=E.useState("instantType"),P=E.useState("transitionStatus"),L=E.useState("adaptiveOrigin"),x=fs({anchor:s,positionMethod:i,floatingRootContext:I,mounted:w,side:c,sideOffset:a,align:u,alignOffset:f,collisionBoundary:d,collisionPadding:h,sticky:g,arrowPadding:p,disableAnchorTracking:y,keepMounted:b,collisionAvoidance:R,adaptiveOrigin:L}),k=l.useMemo(()=>({open:S,side:x.side,align:x.align,anchorHidden:x.anchorHidden,instant:T!=="none"?"tracking-cursor":O}),[S,x.side,x.align,x.anchorHidden,T,O]),D=ds(t,k,{styles:x.positionerStyles,transitionStatus:P,props:v,refs:[n,E.useStateSetter("positionerElement")],hidden:!w,inert:!S||T==="both"||C});return ne.jsx(uu.Provider,{value:x,children:D})}),nh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,...i}=t,c=go(),{side:u,align:a}=ep(),f=c.useState("open"),d=c.useState("instantType"),h=c.useState("transitionStatus"),p=c.useState("popupProps"),g=c.useState("floatingRootContext"),y=c.useState("disabled"),R=c.useState("closeDelay");Xt({open:f,ref:c.context.popupRef,onComplete(){var b,S;f&&((S=(b=c.context).onOpenChangeComplete)==null||S.call(b,!0))}}),nu(g,{enabled:!y,closeDelay:R});const m=c.useStateSetter("popupElement");return Le("div",t,{state:{open:f,side:u,align:a,instant:d,transitionStatus:h},ref:[n,c.context.popupRef,m],props:[ko,p,Lo(h),i],stateAttributesMapping:Hr})}),oh=function(t){const{delay:n,closeDelay:o,timeout:r=400}=t,s=l.useMemo(()=>({open:n,close:o}),[n,o]);return ne.jsx(su.Provider,{value:n,children:ne.jsx(Ra,{delay:s,timeoutMs:r,children:t.children})})};function ps(e){return Pr(19)?e:e?"true":void 0}function dp(e){const[t,n]=l.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const au=l.createContext(void 0);function qt(e){const t=l.useContext(au);if(!e&&t===void 0)throw new Error(Ne(27));return t}const rh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,forceRender:i=!1,...c}=t,u=qt(),a=u.useState("open"),f=u.useState("nested"),d=u.useState("mounted"),h=u.useState("transitionStatus");return Le("div",t,{state:{open:a,transitionStatus:h},ref:[u.context.backdropRef,n],stateAttributesMapping:Hr,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:i||!f})}),fu=l.createContext(void 0);function gs(e=!1){const t=l.useContext(fu);if(t===void 0&&!e)throw new Error(Ne(16));return t}function pp(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,c=o&&t===!1;return{props:l.useMemo(()=>{const a={onKeyDown(f){n&&t&&f.key!=="Tab"&&f.preventDefault()}};return o||(a.tabIndex=r,!s&&n&&(a.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(a["aria-disabled"]=n),s&&(!t||c)&&(a.disabled=n),a},[o,n,t,i,c,s,r])}}function Zo(e,t,{detail:n=0}={}){e.dispatchEvent(new(Ae(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function An(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0,composite:s}=e,i=l.useRef(null),c=gs(!0),u=s??c!==void 0,{props:a}=pp({focusableWhenDisabled:n,disabled:t,composite:u,tabIndex:o,isNativeButton:r}),f=l.useCallback(()=>{const p=i.current;Jo(p)&&u&&t&&a.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,a.disabled,u]);J(f,[f]);const d=l.useCallback((p={})=>{const{onClick:g,onMouseDown:y,onKeyUp:R,onKeyDown:m,onPointerDown:v,...E}=p;return Wt({onClick(b){if(t){b.preventDefault();return}g==null||g(b)},onMouseDown(b){t||y==null||y(b)},onKeyDown(b){if(t||(to(b),m==null||m(b),b.baseUIHandlerPrevented))return;const S=b.target===b.currentTarget,w=b.currentTarget,T=Jo(w),C=!r&&gp(w),I=S&&(r?T:!C),O=b.key==="Enter",P=b.key===" ",L=w.getAttribute("role"),x=(L==null?void 0:L.startsWith("menuitem"))||L==="option"||L==="gridcell";if(S&&u&&P){if(b.defaultPrevented&&x)return;b.preventDefault(),(!r||T)&&(b.preventBaseUIHandler(),Zo(w,b));return}if(!I||r||!P&&!O){S&&C&&P&&b.preventDefault();return}b.defaultPrevented||(b.preventDefault(),O&&(b.preventBaseUIHandler(),Zo(w,b)))},onKeyUp(b){if(!t){if(to(b),R==null||R(b),b.target===b.currentTarget&&r&&u&&Jo(b.currentTarget)&&b.key===" "){b.preventDefault();return}b.baseUIHandlerPrevented||b.target===b.currentTarget&&!r&&!u&&!b.defaultPrevented&&b.key===" "&&(b.preventBaseUIHandler(),Zo(b.currentTarget,b))}},onPointerDown(b){if(t){b.preventDefault();return}v==null||v(b)}},r?{type:"button"}:{role:"button"},a,E)},[t,a,u,r]),h=te(p=>{i.current=p,f()});return{getButtonProps:d,buttonRef:h}}function Jo(e){return Pe(e)&&e.tagName==="BUTTON"}function gp(e){return Pe(e)&&e.tagName==="A"&&!!e.href}const sh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,disabled:i=!1,nativeButton:c=!0,...u}=t,a=qt(),f=a.useState("open"),{getButtonProps:d,buttonRef:h}=An({disabled:i,native:c}),p={disabled:i};function g(y){f&&a.setOpen(!1,he(ic,y.nativeEvent))}return Le("button",t,{state:p,ref:[n,h],props:[{onClick:g},u,d]})}),ih=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,...c}=t,u=qt(),a=fn(i);return u.useSyncedValueWithCleanup("descriptionElementId",a),Le("p",t,{ref:n,props:[{id:a},c]})}),du=l.createContext(void 0);function hp(){const e=l.useContext(du);if(e===void 0)throw new Error(Ne(26));return e}const dr="ArrowUp",pr="ArrowDown",gr="ArrowLeft",hr="ArrowRight",mr="Home",yr="End",_o=new Set([dr,pr,gr,hr,mr,yr]),mp="Shift",yp=[mp,"Control","Alt","Meta"];function bp(e){return Pe(e)&&e.tagName==="INPUT"}function gi(e){return!!(bp(e)&&e.selectionStart!=null||Pe(e)&&e.tagName==="TEXTAREA")}function hi(e,t,n,o){if(!e||!t||!t.scrollTo)return;let r=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,c=e.clientHeight<e.scrollHeight;if(i&&o!=="vertical"){const u=mi(e,t,"left"),a=Un(e),f=Un(t);n==="ltr"&&(u+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?r=u+t.offsetWidth+f.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:u-f.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(r=u-f.scrollMarginLeft-a.scrollPaddingLeft)),n==="rtl"&&(u-f.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?r=u-f.scrollMarginLeft-a.scrollPaddingLeft:u+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(r=u+t.offsetWidth+f.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(c&&o!=="horizontal"){const u=mi(e,t,"top"),a=Un(e),f=Un(t);u-f.scrollMarginTop<e.scrollTop+a.scrollPaddingTop?s=u-f.scrollMarginTop-a.scrollPaddingTop:u+t.offsetHeight+f.scrollMarginBottom>e.scrollTop+e.clientHeight-a.scrollPaddingBottom&&(s=u+t.offsetHeight+f.scrollMarginBottom-e.clientHeight+a.scrollPaddingBottom)}e.scrollTo({left:r,top:s,behavior:"auto"})}function mi(e,t,n){const o=n==="left"?"offsetLeft":"offsetTop";let r=0;for(;t.offsetParent&&(r+=t[o],t.offsetParent!==e);)t=t.offsetParent;return r}function Un(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const Rp="--nested-dialogs",vp="data-nested-dialog-open",Ep={...To,...xo,nestedDialogOpen(e){return e?{[vp]:""}:null}},ch=l.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,initialFocus:c,...u}=t,a=qt(),f=a.useState("descriptionElementId"),d=a.useState("disablePointerDismissal"),h=a.useState("floatingRootContext"),p=a.useState("popupProps"),g=a.useState("modal"),y=a.useState("mounted"),R=a.useState("nested"),m=a.useState("nestedOpenDialogCount"),v=a.useState("open"),E=a.useState("openMethod"),b=a.useState("titleElementId"),S=a.useState("transitionStatus"),w=a.useState("role"),T=h.useState("floatingId");hp(),Xt({open:v,ref:a.context.popupRef,onComplete(){var x,k;v&&((k=(x=a.context).onOpenChangeComplete)==null||k.call(x,!0))}});const C=c===void 0?Xc(a.context.popupRef):c,I=m>0,O=a.useStateSetter("popupElement"),L=Le("div",t,{state:{open:v,nested:R,transitionStatus:S,nestedDialogOpen:I},props:[p,{id:T,"aria-labelledby":b,"aria-describedby":f,role:w,...ko,hidden:!y,onKeyDown(x){_o.has(x.key)&&x.stopPropagation()},style:{[Rp]:m}},u],ref:[n,a.context.popupRef,O],stateAttributesMapping:Ep});return ne.jsx(Xr,{context:h,openInteractionType:E,disabled:!y,closeOnFocusOut:!d,initialFocus:C,returnFocus:i,modal:g!==!1,restoreFocus:"popup",children:L})}),hs=l.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const i=o.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),uh=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,s=qt(),i=s.useState("mounted"),c=s.useState("modal"),u=s.useState("open");return i||o?ne.jsx(du.Provider,{value:o,children:ne.jsxs(Kr,{ref:n,...r,children:[i&&c===!0&&ne.jsx(hs,{ref:s.context.internalBackdropRef,inert:ps(!u)}),t.children]})}):null});let yi={},bi={},Ri="";function No(e,t){return wn(e)?e:t}function vi(e,t,n){return/hidden|clip/.test(e.getComputedStyle(No(t,n)).overflowY)}function Sp(e){if(typeof document>"u")return!1;const t=Se(e);return Ae(t).innerWidth-t.documentElement.clientWidth>0}function xp(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Se(e),o=n.documentElement,r=n.body,s=No(o,r),i=s.style.overflowY,c=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",s.style.overflowY="scroll";const u=s.offsetWidth;s.style.overflowY="hidden";const a=s.offsetWidth;return s.style.overflowY=i,o.style.scrollbarGutter=c,u===a}function Tp(e){const t=Se(e),n=t.documentElement,o=t.body,r=No(n,o),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function Cp(e){var p;const t=Se(e),n=t.documentElement,o=t.body,r=Ae(n);let s=0,i=0,c=!1;const u=gt.create();if(Ct&&(((p=r.visualViewport)==null?void 0:p.scale)??1)!==1)return()=>{};function a(){const g=r.getComputedStyle(n),y=r.getComputedStyle(o),v=(g.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,yi={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ri=n.style.scrollBehavior,bi={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,S=g.overflowY==="scroll"||y.overflowY==="scroll",w=g.overflowX==="scroll"||y.overflowX==="scroll",T=Math.max(0,r.innerWidth-o.clientWidth),C=Math.max(0,r.innerHeight-o.clientHeight),I=parseFloat(y.marginTop)+parseFloat(y.marginBottom),O=parseFloat(y.marginLeft)+parseFloat(y.marginRight),P=No(n,o);if(c=xp(e),c){n.style.scrollbarGutter=v,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(E||S)&&(n.style.overflowY="scroll"),(b||w)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:I||C?`calc(100dvh - ${I+C}px)`:"100dvh",width:O||T?`calc(100vw - ${O+T}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,yi),Object.assign(o.style,bi),c||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ri)}function d(){f(),u.request(a)}a();const h=be(r,"resize",d);return()=>{u.cancel(),f(),typeof r.removeEventListener=="function"&&h()}}class wp{constructor(){Te(this,"lockCount",0);Te(this,"restore",null);Te(this,"timeoutLock",ct.create());Te(this,"timeoutUnlock",ct.create());Te(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Te(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),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 n=Se(t),o=n.documentElement,r=n.body,s=Ae(o);if(vi(s,o,r)){const c=new s.MutationObserver(()=>{vi(s,o,r)||(c.disconnect(),this.restore=null,this.lock(t))}),u={attributes:!0};c.observe(o,u),c.observe(r,u),this.restore=()=>c.disconnect();return}const i=mo||!Sp(t);this.restore=i?Tp(t):Cp(t)}}const Pp=new wp;function pu(e=!0,t=null){J(()=>{if(e)return Pp.acquire(t)},[e,t])}function Ip({store:e,parentContext:t,isDrawer:n}){const o=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),c=e.useState("floatingRootContext"),[u,a]=l.useState(0),[f,d]=l.useState(0),h=u===0,p=Io(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}const y=We(g);if(h&&!r){if(s){const R=e.context.internalBackdropRef.current,m=e.context.backdropRef.current;return R||m?R===y||m===y||ue(y,i)&&!(y!=null&&y.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:h});return pu(o&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(g,y)=>{a(g),d(y)}),J(()=>(t!=null&&t.onNestedDialogOpen&&(o?t.onNestedDialogOpen(u+1,f+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,u,f,t]),rs(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:u,nestedOpenDrawerCount:f}),null}const Op={...cs,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Ap extends On{constructor(n,o,r){const s=new Do,i=Mp(n,s,o,r);super(i,kp(s),Op);Te(this,"setOpen",(n,o)=>{var r,s;o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),(s=(r=this.context).onOpenChange)==null||s.call(r,n,o),!o.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(n,o),this.update(ts(this.state,n,o.trigger)))})}}function Mp(e,t,n,o=!1){return{...ss(t,n,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function kp(e){return{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Dp(e,t){const{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:c=!1,modal:u=!0,actionsRef:a,handle:f,triggerId:d,defaultTriggerId:h=null}=t,p=e==="drawer",g=u,y=c,R="dialog",m=qt(!0),v=m!=null,E={modal:g,disablePointerDismissal:y,nested:v,role:R},b=Qr((O,P)=>new Ap({open:r,openProp:o,activeTriggerId:h,triggerIdProp:d,...E},O,P),!0);b.useControlledProp("openProp",o),b.useControlledProp("triggerIdProp",d),b.useSyncedValues(E),b.useContextCallback("onOpenChange",s),b.useContextCallback("onOpenChangeComplete",i);const S=b.useState("open"),w=b.useState("mounted"),T=b.useState("payload");Jc(b,S),ns(b);const{forceUnmount:C}=os(S,b);l.useImperativeHandle(a,()=>({unmount:C,close:()=>b.setOpen(!1,he(Br))}),[C,b]);const I=S||w;return ne.jsxs(au.Provider,{value:b,children:[f&&ne.jsx(es,{handle:f,store:b}),I&&ne.jsx(Ip,{store:b,parentContext:m==null?void 0:m.context,isDrawer:p}),typeof n=="function"?n({payload:T}):n]})}const lh=po(function(t){return Dp("dialog",t)}),ah=l.forwardRef(function(t,n){const{render:o,className:r,style:s,id:i,...c}=t,u=qt(),a=fn(i);return u.useSyncedValueWithCleanup("titleElementId",a),Le("h2",t,{ref:n,props:[{id:a},c]})});function Fp(e){const t=l.useRef(""),n=l.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:l.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function gu(e,t){const n=l.useRef(e),o=te(t);J(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}function hu(e,t){const n=te((s,i)=>{(typeof e=="function"?e():e)||t(i||(mo?"touch":""))}),{onClick:o,onPointerDown:r}=Fp(n);return l.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function Lp(e){const[t,n]=l.useState(null),o=hu(e,n);return gu(e,r=>{r&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function br({controlled:e,default:t,name:n,state:o="value"}){const{current:r}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=r&&e!==void 0?e:s,u=l.useCallback(a=>{r||i(a)},[]);return[c,u]}const mu=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function _p(){return l.useContext(mu)}function ms(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=te(r),[,i]=l.useState(!1),c=ze(Hp).current,u=ze(Np).current,a=l.useRef(0),f=l.useRef(!0),d=l.useRef(null),h=l.useRef(null),p=te(()=>{f.current||(f.current=!0,i(S=>!S))}),g=te((S,w)=>{u.set(S,w),p()}),y=te(S=>{u.delete(S),p()}),R=te(S=>{const w=new Map;return n.current.length=0,o&&(o.current.length=0),S.forEach(T=>{var C,I;w.set(T.element,{...T.registration.metadata??{},index:T.index}),n.current[T.index]=T.element,o&&(o.current[T.index]=T.registration.label!==void 0?T.registration.label:((I=(C=T.registration.textRef)==null?void 0:C.current)==null?void 0:I.textContent)??T.element.textContent)}),a.current=n.current.length,w});function m(S){var C;if((C=h.current)==null||C.disconnect(),h.current=null,typeof MutationObserver!="function"||S.length<2)return;const w=new MutationObserver(I=>{if(!jp(I))return;let O=null;for(const P of S)if(P.isConnected){if(O&&yu(O,P)>0){w.disconnect(),p();return}O=P}});h.current=w;const T=new Set;for(let I=1;I<S.length;I+=1){const O=Bp(S[I-1],S[I]);O&&T.add(O)}T.forEach(I=>w.observe(I,{childList:!0}))}const v=te(()=>{const[S,w]=Vp(u),T=R(S),C=d.current,I=!C||C.length!==S.length||S.some((O,P)=>{const L=C[P];return O.index!==L.index||O.element!==L.element||O.registration.index!==L.registration.index||O.registration.metadata!==L.registration.metadata});m(w),d.current=S,f.current=!1,I&&(c.forEach(O=>O(T)),s(T))});J(()=>(!f.current&&d.current&&R(d.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,R]),J(()=>{f.current&&v()}),J(()=>()=>{var S;(S=h.current)==null||S.disconnect(),f.current=!0},[]);const E=te(S=>(c.add(S),()=>{c.delete(S)})),b=l.useMemo(()=>({register:g,unregister:y,subscribeMapChange:E,nextIndexRef:a}),[g,y,E,a]);return ne.jsx(mu.Provider,{value:b,children:t})}function Np(){return new Map}function Hp(){return new Set}function Vp(e){const t=new Set,n=[],o=[];e.forEach((s,i)=>{if(!i.isConnected)return;const c=s.index,u={index:c??-1,element:i,registration:s};c===null?o.push(u):c>=0&&(t.add(c),n.push(u))});let r=0;return o.sort((s,i)=>yu(s.element,i.element)),o.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,o.map(s=>s.element)]}function Bp(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function jp(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function yu(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const bu=l.createContext(void 0);function Ru(){const e=l.useContext(bu);if(e===void 0)throw new Error(Ne(64));return e}const $p="data-activation-direction",ys={tabActivationDirection:e=>({[$p]:e})},fh=l.forwardRef(function(t,n){const{className:o,defaultValue:r=0,onValueChange:s,orientation:i="horizontal",render:c,value:u,style:a,...f}=t,d=t.defaultValue!==void 0,h=l.useRef([]),[p,g]=l.useState(()=>new Map),[y,R]=br({controlled:u,default:r,name:"Tabs",state:"value"}),m=u!==void 0,[v,E]=l.useState(()=>new Map),b=l.useRef(void 0),S=l.useCallback(j=>Rr(v,j),[v]),[w,T]=l.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:C,tabActivationDirection:I}=w;let O=I,P=!1;C!==y&&(O=Ei(C,y,i,v),P=C!=null&&y!=null&&S(y)==null);const L=P?C:y,x=C!==L||I!==O;J(()=>{x&&T({previousValue:L,tabActivationDirection:O})},[L,x,O]);const k=te((j,X)=>{const se=Ei(y,j,i,v);X.activationDirection=se,s==null||s(j,X),!X.isCanceled&&R(j)}),D=te((j,X)=>{s==null||s(j,he(X,void 0,void 0,{activationDirection:"none"}))}),F=te((j,X)=>(g(se=>{const le=new Map(se);return le.set(j,X),le}),()=>{g(se=>{if(se.get(j)!==X)return se;const le=new Map(se);return le.delete(j),le})})),V=l.useCallback(j=>p.get(j),[p]),M=l.useCallback(j=>{for(const X of v.values())if(j===X.value)return X.id},[v]),N=l.useMemo(()=>({getTabElementBySelectedValue:S,getTabIdByPanelValue:M,getTabPanelIdByValue:V,onValueChange:k,orientation:i,registerMountedTabPanel:F,setTabMap:E,tabActivationDirection:O,value:y}),[S,M,V,k,i,F,E,O,y]),A=l.useMemo(()=>{for(const j of v.values())if(j.value===y)return j},[v,y]),U=l.useMemo(()=>{for(const j of v.values())if(!j.disabled)return j.value},[v]),B=l.useRef(!d),W=l.useRef(r),H=l.useRef(d),Y=l.useRef(!1);J(()=>{var q;if(m)return;function j(G,Z){R(G),T({previousValue:G,tabActivationDirection:"none"}),D(G,Z),B.current=!1}if(v.size===0){Y.current&&y!==null&&!((q=b.current)!=null&&q.isConnected)&&j(null,Fs);return}Y.current=!0,b.current=v.keys().next().value;const X=A==null?void 0:A.disabled,se=A==null&&y!==null;if(!X&&y===W.current&&(H.current=!1),H.current&&X&&y===W.current)return;const le=B.current;if(X||se){const G=U??null;if(y===G){B.current=!1;return}let Z=Fs;le?Z=Ls:X&&(Z=cc),j(G,Z);return}le&&A!=null&&(D(y,Ls),B.current=!1)},[U,m,D,A,R,v,y]);const Q=Le("div",t,{state:{orientation:i,tabActivationDirection:O},ref:n,props:f,stateAttributesMapping:ys});return ne.jsx(bu.Provider,{value:N,children:ne.jsx(ms,{elementsRef:h,children:Q})})});function Rr(e,t){for(const[n,o]of e.entries())if(t===o.value)return n;return null}function Ei(e,t,n,o){if(e==null||t==null)return"none";const[r,s,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],c=Rr(o,e),u=Rr(o,t);if(c==null||u==null)return c!==u&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?i:s:"none";const a=c.getBoundingClientRect()[r],f=u.getBoundingClientRect()[r];return f<a?s:f>a?i:"none"}const bs="data-composite-item-active";function vu(e={}){const{guess:t,label:n,metadata:o,textRef:r,index:s}=e,{register:i,unregister:c,subscribeMapChange:u,nextIndexRef:a}=_p(),f=l.useRef(-1),[d,h]=l.useState(s==null&&t?()=>{if(f.current===-1){const R=a.current;a.current+=1,f.current=R}return f.current}:-1),p=s??d,g=l.useRef(null),y=l.useCallback(R=>{const m=g.current;m&&c(m),g.current=R,R&&i(R,{metadata:o??null,index:s??null,label:n,textRef:r})},[s,i,c,o,n,r]);return J(()=>{if(s==null)return u(R=>{var v;const m=g.current?(v=R.get(g.current))==null?void 0:v.index:null;m!=null&&h(m)})},[s,u]),{ref:y,index:p}}function Wp(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=gs(),{ref:r,index:s}=vu(e),i=n===s,c=l.useRef(null),u=$t(r,c);return{compositeProps:{tabIndex:i?0:-1,onFocus(){o(s)},onMouseMove(){const f=c.current;if(!t||!f)return;const d=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!d&&f.focus()}},compositeRef:u,index:s}}const Eu=l.createContext(void 0);function Up(){const e=l.useContext(Eu);if(e===void 0)throw new Error(Ne(65));return e}const dh=l.forwardRef(function(t,n){const{className:o,disabled:r=!1,render:s,value:i,id:c,nativeButton:u=!0,style:a,...f}=t,{value:d,getTabPanelIdByValue:h,onValueChange:p,orientation:g,tabActivationDirection:y}=Ru(),{activateOnFocus:R,registerTabResizeObserverElement:m,tabsListElement:v}=Up(),{highlightedIndex:E,onHighlightedIndexChange:b}=gs(),S=fn(c),w=l.useMemo(()=>({disabled:r,id:S,value:i}),[r,S,i]),{compositeProps:T,compositeRef:C,index:I}=Wp({metadata:w}),O=i===d,P=l.useRef(!1),L=l.useRef(null),x=te(Y=>{var $;($=L.current)==null||$.call(L),L.current=Y?m(Y):null});J(()=>{if(P.current){P.current=!1;return}if(!(O&&I>-1&&E!==I))return;const Y=v;if(Y!=null){const $=qe(Se(Y));if($&&ue(Y,$))return}r||b(I)},[O,I,E,b,r,v]);const{getButtonProps:k,buttonRef:D}=An({disabled:r,native:u,focusableWhenDisabled:!0}),F=h(i),V=l.useRef(!1),M=l.useRef(!1);function N(Y){p(i,he(Ft,Y.nativeEvent,void 0,{activationDirection:"none"}))}function A(Y){O||r||N(Y)}function U(Y){O||r||R&&(!V.current||M.current)&&N(Y)}function B(Y){if(O||r)return;V.current=!0,M.current=Y.button===0;const $=Se(Y.currentTarget);function Q(){V.current=!1,M.current=!1,$.removeEventListener("pointerup",Q),$.removeEventListener("pointercancel",Q)}$.addEventListener("pointerup",Q),$.addEventListener("pointercancel",Q)}return Le("button",t,{state:{disabled:r,active:O,orientation:g,tabActivationDirection:y},ref:[n,D,C,x],props:[T,{role:"tab","aria-controls":F,"aria-selected":O,id:S,onClick:A,onFocus:U,onPointerDown:B,[bs]:O?"":void 0,onKeyDownCapture(){P.current=!0}},f,k],stateAttributesMapping:ys})}),Yp=l.createContext(void 0),zp={disableStyleElements:!1};function Kp(){return l.useContext(Yp)??zp}function Su(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Gp(e){const{loopFocus:t=!0,orientation:n="both",grid:o,onLoop:r,direction:s,highlightedIndex:i,onHighlightedIndexChange:c,rootRef:u,enableHomeAndEndKeys:a=!1,stopEventPropagation:f,disabledIndices:d,modifierKeys:h=kt}=e,[p,g]=l.useState(0),y=o!=null,R=l.useRef(null),m=$t(R,u),v=l.useRef([]),E=l.useRef(!1),b=l.useRef(null),S=i??p,w=te((P,L=!1)=>{if(b.current=v.current[P]??null,(c??g)(P),L){const x=v.current[P];hi(R.current,x,s,n)}}),T=te(P=>{var D;if(P.size===0)return;if(E.current){const F=v.current,V=F.indexOf(b.current);if(V===-1){const M=F[S];!M||en(F,S,d)?w(Xp(F,d)):b.current=M}else V!==S&&w(V);return}E.current=!0;const L=Array.from(P.keys()),x=L.find(F=>F==null?void 0:F.hasAttribute(bs))??null,k=x?((D=P.get(x))==null?void 0:D.index)??-1:-1;if(k!==-1)w(k);else if(en(L,S,d)){const F=Et(L,{disabledIndices:d});vn(L,F)||w(F)}hi(R.current,x,s,n)});J(()=>{if(d==null||i!=null||!E.current)return;const P=v.current;if(en(P,S,d)){const L=Et(P,{disabledIndices:d});vn(P,L)||w(L)}},[d,i,S,v,w]);const C=te((P,L,x)=>r?r(P,L,x,v):x),I=te(P=>{const L=P.key===mr||P.key===yr;if(!_o.has(P.key)||!a&&L||qp(P,h)||!R.current)return;const k=s==="rtl",D=k?gr:hr,F=k?hr:gr,V=n==="vertical"?pr:D,M=n==="vertical"?dr:F,N=We(P.nativeEvent);if(N!=null&&gi(N)&&!Su(N)){const Y=N.selectionStart,$=N.selectionEnd,Q=N.value;if(Y==null||P.shiftKey||Y!==$||P.key!==M&&Y<Q.length||P.key!==V&&Y>0)return}let A=S;const U=qn(v,d),B=lr(v,d);o!=null&&(A=o({disabledIndices:d,elementsRef:v,event:P,highlightedIndex:S,loopFocus:t,maxIndex:B,minIndex:U,onLoop:C,orientation:n,rtl:k}));const W=n!=="vertical"&&P.key===D||n!=="horizontal"&&P.key===pr,H=n!=="vertical"&&P.key===F||n!=="horizontal"&&P.key===dr;a&&(P.key===mr?A=U:P.key===yr&&(A=B)),A===S&&(W||H)&&(t&&A===B&&W?(A=U,r&&(A=r(P,S,A,v))):t&&A===U&&H?(A=B,r&&(A=r(P,S,A,v))):A=Et(v.current,{startingIndex:A,decrement:H,disabledIndices:d})),A!==S&&!vn(v.current,A)&&(f&&P.stopPropagation(),(y||L||W||H)&&P.preventDefault(),w(A,!0),queueMicrotask(()=>{var Y;(Y=v.current[A])==null||Y.focus()}))});return{props:{ref:m,onFocus(P){const L=R.current,x=We(P.nativeEvent);!L||x==null||!gi(x)||x.setSelectionRange(0,x.value.length)},onKeyDown:I},highlightedIndex:S,onHighlightedIndexChange:w,elementsRef:v,onMapChange:T,relayKeyboardEvent:I}}function Xp(e,t){let n=-1;for(let o=0;o<e.length;o+=1){const r=e[o];if(!(!r||en(e,o,t))){if(r.hasAttribute(bs))return o;n===-1&&(n=o)}}return Math.max(n,0)}function qp(e,t){for(const n of yp)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Zp(e){const{render:t,className:n,style:o,refs:r=kt,props:s=kt,state:i=_e,stateAttributesMapping:c,highlightedIndex:u,onHighlightedIndexChange:a,orientation:f,grid:d,loopFocus:h,onLoop:p,enableHomeAndEndKeys:g,onMapChange:y,stopEventPropagation:R=!0,rootRef:m,disabledIndices:v,modifierKeys:E,highlightItemOnHover:b=!1,tag:S="div",...w}=e,T=as(),{props:C,highlightedIndex:I,onHighlightedIndexChange:O,elementsRef:P,onMapChange:L,relayKeyboardEvent:x}=Gp({grid:d,loopFocus:h,onLoop:p,orientation:f,highlightedIndex:u,onHighlightedIndexChange:a,rootRef:m,stopEventPropagation:R,enableHomeAndEndKeys:g,direction:T,disabledIndices:v,modifierKeys:E}),k=Le(S,e,{state:i,ref:r,props:[C,...s,w],stateAttributesMapping:c}),D=l.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:O,highlightItemOnHover:b,relayKeyboardEvent:x}),[I,O,b,x]);return ne.jsx(fu.Provider,{value:D,children:ne.jsx(ms,{elementsRef:P,onMapChange:F=>{y==null||y(F),L(F)},children:k})})}const ph=l.forwardRef(function(t,n){const{activateOnFocus:o=!1,className:r,loopFocus:s=!0,render:i,style:c,...u}=t,{orientation:a,setTabMap:f,tabActivationDirection:d}=Ru(),[h,p]=l.useState(0),[g,y]=l.useState(null),R=l.useRef(new Set),m=l.useRef(new Set),v=l.useRef(null);J(()=>{if(typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>{R.current.forEach(I=>{I()})});return v.current=C,g&&C.observe(g),m.current.forEach(I=>{C.observe(I)}),()=>{C.disconnect(),v.current=null}},[g]);const E=te(C=>(R.current.add(C),()=>{R.current.delete(C)})),b=te(C=>{var I;return m.current.add(C),(I=v.current)==null||I.observe(C),()=>{var O;m.current.delete(C),(O=v.current)==null||O.unobserve(C)}}),S={orientation:a,tabActivationDirection:d},w={"aria-orientation":a==="vertical"?"vertical":void 0,role:"tablist"},T=l.useMemo(()=>({activateOnFocus:o,registerIndicatorUpdateListener:E,registerTabResizeObserverElement:b,tabsListElement:g}),[o,E,b,g]);return ne.jsx(Eu.Provider,{value:T,children:ne.jsx(Zp,{render:i,className:r,style:c,state:S,refs:[n,y],props:[w,u],stateAttributesMapping:ys,highlightedIndex:h,enableHomeAndEndKeys:!0,loopFocus:s,orientation:a,onHighlightedIndexChange:p,onMapChange:f,disabledIndices:kt})})});function Jp(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}const xu=l.createContext(void 0),Tu=l.createContext(void 0),Cu=l.createContext(void 0);function Ht(){const e=l.useContext(xu);if(e===void 0)throw new Error(Ne(60));return e}function Rs(){const e=l.useContext(Tu);if(e===void 0)throw new Error(Ne(101));return e}function wu(){const e=l.useContext(Cu);if(e===void 0)throw new Error(Ne(61));return e}const Qp="data-valid",eg="data-invalid",tg={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ng={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},og={disabled:!1,...ng},rg={valid(e){return e===null?null:e?{[Qp]:""}:{[eg]:""}}},sg={invalid:void 0,name:void 0,validityData:{state:tg,errors:[],error:"",value:"",initialValue:null},setValidityData:ke,disabled:void 0,setTouched:ke,setDirty:ke,setFilled:ke,setFocused:ke,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:og,registerFieldControl:ke,validation:{getValidationProps:(e,t=_e)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:ke,getInputControl:()=>null,commit:async()=>{},change:ke}},ig=l.createContext(sg);function vs(e=!0){const t=l.useContext(ig);if(t.setValidityData===ke&&!e)throw new Error(Ne(28));return t}function cg(e,t,n,o,r=!0,s){const{registerFieldControl:i}=vs(),c=ze(()=>Symbol());J(()=>{const u=c.current;if(!r){i(u,void 0);return}i(u,{controlRef:e,getValue:o,id:t,name:s,value:n})},[e,r,o,t,s,i,c,n]),J(()=>{const u=c.current;return()=>{i(u,void 0)}},[i,c])}const ug=l.createContext({controlId:void 0,registerControlId:ke,resetControlId:ke,labelId:void 0,setLabelId:ke,messageIds:[],setMessageIds:ke,getDescriptionProps:e=>e});function Pu(){return l.useContext(ug)}function Iu(e={}){const{id:t,enabled:n=!0}=e,{controlId:o,registerControlId:r,resetControlId:s}=Pu(),i=fn(),c=ze(()=>Symbol()),u=l.useRef(!1),a=l.useRef(!1),f=te(()=>{!u.current||r===ke||(u.current=!1,r(c.current,void 0))});return J(()=>{if(!n||r===ke){f();return}let d;if(t!==void 0)a.current=!0,d=t;else if(a.current)d=i;else{s();return}if(d===void 0){f();return}u.current=!0,r(c.current,d)},[t,n,r,s,i,c,f]),J(()=>f,[f]),(n?o:void 0)??t??i}function lg(e,t,n=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let r=0;r<o;r+=1)if(!n(e[r],t[r]))return!1;return!0}const Ou=(e,t)=>Object.is(e,t);function Kt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ag(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!lg(e,t,(o,r)=>Kt(o,r,n)):e!==t}function vr(e,t,n){return e?e.some(o=>o===void 0?!1:Kt(t,o,n)):!1}function Qn(e,t,n){return e?e.findIndex(o=>o===void 0?!1:Kt(o,t,n)):-1}function fg(e,t){if(t!==Ou)return o=>vr(e,o,t);const n=new Set(e);return n.delete(void 0),o=>n.has(o)&&(o!==0||e.some(r=>Object.is(o,r)))}function Au(e,t,n,o){const r=o&&Array.isArray(t)?e.findIndex(fg(t,n)):Qn(e,t,n);return r===-1?null:r}function dg(e,t,n,o,r,s){return vr(o,t,r)?s!=null&&e>s&&vr(o,n[s],r)?s:e:e===s?Au(n,o,r,!0):s}function pg(e,t,n){return e.filter(o=>!Kt(t,o,n))}function Er(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function gg(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function Mu(e){return gg(e==null?void 0:e[0])}function hg(e){return Mu(e)?e.flatMap(t=>t.items):e}function mg(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Mu(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function ku(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Er(e)}function Qt(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Er(e.value):Er(e)}function Du(e,t,n){function o(){return ku(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const s=hg(t);if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function yg(e,t,n){return e.reduce((o,r,s)=>(s>0&&o.push(", "),o.push(ne.jsx(l.Fragment,{children:Du(r,t,n)},s)),o),[])}const bg={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Qt(t,o)!==""},hasNullItemLabel:(e,t)=>t?mg(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(r=>Kt(t,r,n)):Kt(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},Rg=l.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:ke,validationMode:"onSubmit",submitCountRef:{current:0}});function vg(){return l.useContext(Rg)}function yn(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const vt=1;function Fu(e,t){return Math.max(0,e-t)}function Eg(e,t){if(t<=0)return 0;const n=yn(e,0,t),o=n,r=t-n,s=o<=vt,i=r<=vt;return s&&i?o<=r?0:t:s?0:i?t:n}function gh(e){const{id:t,value:n,defaultValue:o=null,onValueChange:r,open:s,defaultOpen:i=!1,onOpenChange:c,name:u,form:a,autoComplete:f,disabled:d=!1,readOnly:h=!1,required:p=!1,modal:g=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:m,items:v,multiple:E=!1,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:w=Ou,highlightItemOnHover:T=!0,children:C}=e,{clearErrors:I}=vg(),{setDirty:O,setTouched:P,setFocused:L,validityData:x,setFilled:k,name:D,disabled:F,validation:V,validationMode:M}=vs(),N=Iu({id:t}),A=F||d,U=D??u,[B,W]=br({controlled:n,default:E?o??kt:o,name:"Select",state:"value"}),[H,Y]=br({controlled:s,default:i,name:"Select",state:"open"}),$=l.useRef([]),Q=l.useRef([]),j=l.useRef(null),X=l.useRef(null),se=l.useRef(0),le=l.useRef(null),q=l.useRef([]),G=l.useRef(!1),Z=l.useRef(null),ie=l.useRef(null),xe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ee=l.useRef(!1),ae=l.useRef(B),{mounted:oe,setMounted:me,transitionStatus:ye}=Jr(H),{openMethod:ge,triggerProps:Ce}=Lp(H),z=ze(()=>new On({id:N,labelId:void 0,modal:g,multiple:E,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:w,value:B,open:H,mounted:oe,transitionStatus:ye,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:_e,triggerProps:_e,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ke,setOpen:ke,handleScrollArrowVisibility:ke,onOpenChangeComplete:ke,listRef:$,popupRef:j,scrollHandlerRef:X,scrollArrowsMountedCountRef:se,valueRef:le,valuesRef:q,labelsRef:Q,typingRef:G,selectionRef:xe,firstItemTextRef:Z,selectedItemTextRef:ie,alignItemWithTriggerActiveRef:ee,initialValueRef:ae},bg)).current,re=z.useState("activeIndex"),K=z.useState("selectedIndex"),_=z.useState("triggerElement"),ce=z.useState("positionerElement"),de=dp(ge),Ee=ge??de,Ve=l.useMemo(()=>E?"":Qt(B,S),[E,B,S]),Ge=l.useMemo(()=>E&&Array.isArray(B)?B.map(ve=>Qt(ve,S)):Qt(B,S),[E,B,S]),Me=Fe(_),Ye=te(()=>Ge);cg(Me,N,B,Ye,!A,u);const Qe=E?Array.isArray(B)&&B.length>0:B!=null&&Ve!=="";J(()=>{k(Qe)},[Qe,k]),J(function(){const Ie=Au(q.current,B,w,E);Ie===null&&(ie.current=null),!H&&z.set("selectedIndex",Ie)},[E,H,B,w,z]),gu(B,()=>{I(U),O(ag(B,x.initialValue,w)),V.change(B)});const Xe=te((ve,Ie)=>{c==null||c(ve,Ie),!Ie.isCanceled&&(Y(ve),!ve&&(Ie.reason===Yt||Ie.reason===Vr)&&(P(!0),L(!1),M==="onBlur"&&V.commit(B)))}),ft=te(()=>{me(!1),z.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),m==null||m(!1)});Xt({enabled:!y,open:H,ref:j,onComplete(){H||ft()}}),l.useImperativeHandle(y,()=>({unmount:ft}),[ft]);const ut=te((ve,Ie)=>{r==null||r(ve,Ie),!Ie.isCanceled&&W(ve)}),mt=te(ve=>{const Ie=Fu(ve.scrollHeight,ve.clientHeight),Je=Eg(ve.scrollTop,Ie),bt=Je>0,dt=Je<Ie;z.set("scrollUpArrowVisible",bt),z.set("scrollDownArrowVisible",dt)}),ot=kd({open:H,onOpenChange:Xe,elements:{reference:_,floating:ce}}),yt=kc(ot,{enabled:!A,event:"mousedown"}),lt=Io(ot),He=Bd(ot,{enabled:!A,listRef:$,activeIndex:re,selectedIndex:K,disabledIndices:kt,onNavigate(ve){ve===null&&!H||z.set("activeIndex",ve)},focusItemOnHover:T}),pe=jd(ot,{enabled:!A&&(H||!h&&!E),listRef:Q,activeIndex:re,selectedIndex:K,disabledIndices:ve=>Su($.current[ve]),onMatch(ve){H?z.set("activeIndex",ve):ut(q.current[ve],he(Ft))},onTyping(ve){G.current=ve}}),De=l.useMemo(()=>Wt(pe.reference,He.reference,lt.reference,yt.reference,Ce),[yt.reference,pe.reference,He.reference,lt.reference,Ce]),Be=l.useMemo(()=>Wt(ko,pe.floating,He.floating,lt.floating),[pe.floating,He.floating,lt.floating]),je=He.item??_e;z.useContextCallback("setValue",ut),z.useContextCallback("setOpen",Xe),z.useContextCallback("handleScrollArrowVisibility",mt),z.useContextCallback("onOpenChangeComplete",m),Jp(()=>{z.update({popupProps:Be,triggerProps:De})}),z.useSyncedValues({id:N,modal:g,multiple:E,value:B,open:H,mounted:oe,transitionStatus:ye,popupProps:Be,triggerProps:De,items:v,itemToStringLabel:b,itemToStringValue:S,isItemEqualToValue:w,openMethod:Ee});const rt=l.useMemo(()=>({disabled:A,readOnly:h,required:p,multiple:E,highlightItemOnHover:T,itemProps:je}),[A,h,p,E,T,je]),et=$t(R,V.inputRef),Vt=E?void 0:U,Pt=l.useMemo(()=>!E||!Array.isArray(B)||!U?null:B.map(ve=>{const Ie=Qt(ve,S);return ne.jsx("input",{type:"hidden",form:a,name:U,value:Ie,disabled:A},Ie)}),[E,B,a,U,S,A]);return ne.jsxs(xu.Provider,{value:z,children:[ne.jsx(Tu.Provider,{value:rt,children:ne.jsx(Cu.Provider,{value:ot,children:C})}),ne.jsx("input",{...V.getValidationProps(A,{onFocus(){var ve;(ve=z.state.triggerElement)==null||ve.focus({focusVisible:!0})},onChange(ve){if(ve.nativeEvent.defaultPrevented||A||h)return;const Ie=ve.currentTarget.value,Je=he(Ft,ve.nativeEvent);function bt(){if(E)return;const dt=Ie.toLowerCase();let Bt=q.current.findIndex(Zt=>Qt(Zt,S).toLowerCase()===dt||ku(Zt,b).toLowerCase()===dt);Bt===-1&&(Bt=q.current.findIndex((Zt,kn)=>{const pn=Q.current[kn];return pn!=null&&pn.toLowerCase()===dt}));const dn=q.current[Bt];dn!=null&&ut(dn,Je)}z.set("forceMount",!0),queueMicrotask(bt)}}),id:N&&Vt==null?`${N}-hidden-input`:void 0,form:a,name:Vt,autoComplete:f,value:Ve,disabled:A,required:p&&!(E&&Qe),readOnly:h,ref:et,style:U?wa:ac,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Pt]})}function Sg(e,t){return e??t}const Yn=5;function xg(e,t){const n=Tg(t);return e.clientX>=n.left-Yn&&e.clientX<=n.right+Yn&&e.clientY>=n.top-Yn&&e.clientY<=n.bottom+Yn}function Tg(e){const t=e.getBoundingClientRect(),n=Ae(e);if(Mr)return t;const o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;const i=parseFloat(o.width)||0,c=parseFloat(o.height)||0,u=parseFloat(r.width)||0,a=parseFloat(r.height)||0,f=Math.max(t.width,i,u),d=Math.max(t.height,c,a),h=f-t.width,p=d-t.height;return{left:t.left-h/2,right:t.right+h/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Cg="data-popup-side",wg=400,Pg={...rc,...rg,popupSide:e=>e?{[Cg]:e}:null,value:()=>null},hh=l.forwardRef(function(t,n){var se;const{render:o,className:r,id:s,disabled:i=!1,nativeButton:c=!0,style:u,...a}=t,{setTouched:f,setFocused:d,validationMode:h,validation:p,state:g,disabled:y}=vs(),{labelId:R}=Pu(),m=Ht(),{readOnly:v,required:E,disabled:b}=Rs(),S=y||b||i,w=m.useState("open"),T=m.useState("mounted"),C=m.useState("value"),I=m.useState("triggerProps"),O=m.useState("positionerElement"),P=m.useState("listElement"),L=m.useState("popupSide"),x=m.useState("id"),k=m.useState("labelId"),D=m.useState("hasSelectedValue"),F=T&&O?L:null,V=s??x,M=Sg(R,k);Iu({id:s});const N=Fe(O),A=l.useRef(null),{getButtonProps:U,buttonRef:B}=An({disabled:S,native:c}),W=m.useStateSetter("triggerElement"),H=tt(),Y=tt(),$=tt();l.useEffect(()=>{if(w)return $.start(wg,()=>{m.context.selectionRef.current.allowUnselectedMouseUp=!0,m.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{$.clear()};m.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Y.clear()},[w,m,Y,$]);const Q=Wt(I,{id:V,role:"combobox","aria-expanded":w,"aria-haspopup":"listbox","aria-controls":w?(P==null?void 0:P.id)??((se=oo(O))==null?void 0:se.id):void 0,"aria-labelledby":M,"aria-readonly":v||void 0,"aria-required":E||void 0,tabIndex:S?-1:0,onFocus(le){d(!0),w&&m.context.alignItemWithTriggerActiveRef.current&&m.context.setOpen(!1,he(Ft,le.nativeEvent)),H.start(0,()=>{m.set("forceMount",!0)})},onBlur(le){ue(O,le.relatedTarget)||(f(!0),d(!1),h==="onBlur"&&p.commit(C))},onMouseDown(le){if(w)return;const q=Se(le.currentTarget);function G(Z){if(!A.current)return;const ie=Z.target;ue(A.current,ie)||ue(N.current,ie)||xg(Z,A.current)||m.context.setOpen(!1,he(ma,Z))}Y.start(0,()=>{q.addEventListener("mouseup",G,{once:!0})})}},a,U),j=p.getValidationProps(S,Q);j.role="combobox";const X={...g,open:w,disabled:S,value:C,readOnly:v,popupSide:F,placeholder:!D};return Le("button",t,{ref:[n,A,B,W],state:X,stateAttributesMapping:Pg,props:j})}),Ig={value:()=>null},mh=l.forwardRef(function(t,n){const{className:o,render:r,children:s,placeholder:i,style:c,...u}=t,a=Ht(),f=a.useState("value"),d=a.useState("items"),h=a.useState("itemToStringLabel"),p=a.useState("hasSelectedValue"),g=!p&&i!=null&&s==null,y=a.useState("hasNullItemLabel",g),R={value:f,placeholder:!p};let m=null;return typeof s=="function"?m=s(f):s!=null?m=s:g&&!y?m=i:Array.isArray(f)?m=yg(f,d,h):m=Du(f,d,h),Le("span",t,{state:R,ref:[n,a.context.valueRef],props:[{children:m},u],stateAttributesMapping:Ig})}),yh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,...i}=t,a={open:Ht().useState("open")};return Le("span",t,{state:a,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:Nr})}),bh=l.forwardRef(function(t,n){const o=Ht(),r=o.useState("mounted"),s=o.useState("forceMount");return r||s?ne.jsx(Kr,{ref:n,...t}):null}),Lu=l.createContext(void 0);function Og(){const e=l.useContext(Lu);if(!e)throw new Error(Ne(59));return e}function lo(e,t){e&&Object.assign(e.style,t)}const Ag={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Mg=20;function _u(e,t,n,o){const[r,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=Se(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-Mg)},[e,t,n]),pu(e&&(!t||r),o)}const kg={position:"fixed"},Rh=l.forwardRef(function(t,n){const{anchor:o,className:r,render:s,positionMethod:i,side:c,align:u,sideOffset:a,alignOffset:f,collisionBoundary:d="clipping-ancestors",collisionPadding:h,arrowPadding:p,sticky:g,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:m=Xa,style:v,...E}=t,b=Ht(),S=wu(),w=b.useState("open"),T=b.useState("mounted"),C=b.useState("modal"),I=b.useState("value"),O=b.useState("openMethod"),P=b.useState("positionerElement"),L=b.useState("triggerElement"),x=b.useState("isItemEqualToValue"),k=b.useState("transitionStatus"),D=l.useRef(null),F=l.useRef(null),[V,M]=l.useState(R),N=T&&V&&O!=="touch";!T&&V!==R&&M(R),l.useImperativeHandle(b.context.alignItemWithTriggerActiveRef,()=>N),_u((N||C)&&w,O==="touch",P,L);const A=fs({anchor:o,floatingRootContext:S,positionMethod:i,mounted:T,side:c,sideOffset:a,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:d,collisionPadding:h,sticky:g,disableAnchorTracking:y??N,collisionAvoidance:m,keepMounted:!0}),U=N?"none":A.side,B=N?kg:A.positionerStyles,W={open:w,side:U,align:A.align,anchorHidden:A.anchorHidden};J(()=>{b.set("popupSide",A.side)},[b,A.side]);const H=b.useStateSetter("positionerElement"),Y=ds(t,W,{styles:B,transitionStatus:k,props:E,refs:[n,H],hidden:!T,inert:!w}),$=l.useRef(0),Q=te(X=>{if(b.context.valuesRef.current.length===0)return;const se=$.current;$.current=X.size;const le=he(Ft);if(se!==0&&!b.state.multiple&&I!==null&&Qn(b.context.valuesRef.current,I,x)===-1){const G=b.context.initialValueRef.current,ie=G!=null&&Qn(b.context.valuesRef.current,G,x)!==-1?G:null;b.context.setValue(ie,le),ie===null&&(b.set("selectedIndex",null),b.context.selectedItemTextRef.current=null)}if(se!==0&&b.state.multiple&&Array.isArray(I)){const q=I.filter(G=>Qn(b.context.valuesRef.current,G,x)!==-1);q.length!==I.length&&(b.context.setValue(q,le),q.length===0&&(b.set("selectedIndex",null),b.context.selectedItemTextRef.current=null))}if(w&&N){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};lo(P,q),lo(b.context.popupRef.current,q)}}),j=l.useMemo(()=>({...A,side:U,alignItemWithTriggerActive:N,setControlledAlignItemWithTrigger:M,scrollUpArrowRef:D,scrollDownArrowRef:F}),[A,U,N,M]);return ne.jsx(ms,{elementsRef:b.context.listRef,labelsRef:b.context.labelsRef,onMapChange:Q,children:ne.jsxs(Lu.Provider,{value:j,children:[T&&C&&ne.jsx(hs,{inert:ps(!w),cutout:L}),Y]})})}),zn="base-ui-disable-scrollbar",Si={className:zn,getElement(e){return ne.jsx("style",{nonce:e,href:zn,precedence:"base-ui:low",children:`.${zn}{scrollbar-width:none}.${zn}::-webkit-scrollbar{display:none}`})}},Dg=l.createContext(void 0);function Nu(e){return l.useContext(Dg)}const xi="--transform-origin",Fg={...To,...xo},vh=l.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,...c}=t,u=Ht(),{multiple:a,readOnly:f,highlightItemOnHover:d}=Rs(),h=wu(),{side:p,align:g,alignItemWithTriggerActive:y,isPositioned:R,setControlledAlignItemWithTrigger:m}=Og(),v=Nu()!=null,E=as(),{nonce:b,disableStyleElements:S}=Kp(),w=u.useState("id"),T=u.useState("open"),C=u.useState("openMethod"),I=u.useState("mounted"),O=u.useState("popupProps"),P=u.useState("transitionStatus"),L=u.useState("triggerElement"),x=u.useState("positionerElement"),k=u.useState("listElement"),D=l.useRef(!1),F=l.useRef(!1),V=l.useRef({}),M=rn(),N=te(W=>{if(!x||!u.context.popupRef.current||!F.current)return;const H=x.style.top==="0px",Y=x.style.bottom==="0px";if(D.current||!y||!H&&!Y){u.context.handleScrollArrowVisibility(W);return}const $=Ci(x),Q=bn(x.getBoundingClientRect().height,"y",$),j=Se(x),X=Ae(x),se=X.getComputedStyle(x),le=parseFloat(se.marginTop),q=parseFloat(se.marginBottom),G=Ti(X.getComputedStyle(u.context.popupRef.current)),Z=Math.min(j.documentElement.clientHeight-le-q,G),ie=W.scrollTop,xe=Kn(W);let ee=null;const ae=ge=>{x.style.height=`${ge}px`},oe=H?xe-ie:ie,me=Math.min(Q+oe,Z);if(oe<=vt){const ge=yn(oe,0,Z-Q);ge>0&&ae(Q+ge),W.scrollTop=H?xe:0,Z-(Q+ge)<=vt&&(D.current=!0),u.context.handleScrollArrowVisibility(W);return}if(Z-me>vt)ee=H?1/0:0;else if(Y&&ie<xe){const ge=Q+oe-Z;ee=ie-(oe-ge)}const ye=Math.ceil(me);if(ye!==0&&ae(ye),ee!=null){const ge=yn(ee,0,Kn(W));Math.abs(W.scrollTop-ge)>vt&&(W.scrollTop=ge)}ye>=Z-vt&&(D.current=!0),u.context.handleScrollArrowVisibility(W)});l.useImperativeHandle(u.context.scrollHandlerRef,()=>N,[N]),Xt({open:T,ref:u.context.popupRef,onComplete(){T&&u.context.onOpenChangeComplete(!0)}});const A={open:T,transitionStatus:P,side:p,align:g};J(()=>{!x||!u.context.popupRef.current||Object.keys(V.current).length||(V.current={top:x.style.top||"0",left:x.style.left||"0",right:x.style.right,height:x.style.height,bottom:x.style.bottom,minHeight:x.style.minHeight,maxHeight:x.style.maxHeight,marginTop:x.style.marginTop,marginBottom:x.style.marginBottom})},[u,x]),J(()=>{T||y||(F.current=!1,D.current=!1,lo(x,V.current))},[T,y,x]),J(()=>{var Y,$;const W=u.context.popupRef.current;if(!T||!L||!x||!W||y&&!R||u.state.transitionStatus==="ending")return;if(F.current=!0,W.style.removeProperty(xi),!y){M.request(()=>u.context.handleScrollArrowVisibility(k||W));return}const H=Lg(W);try{let Q=u.context.selectedItemTextRef.current;Q!=null&&Q.isConnected||(Q=!u.select("hasSelectedValue")&&((Y=u.context.firstItemTextRef.current)!=null&&Y.isConnected)?u.context.firstItemTextRef.current:null);const j=u.context.valueRef.current,X=Ae(x),se=X.getComputedStyle(x),le=X.getComputedStyle(W),q=Se(L),G=Ci(L),Z=Gn(L.getBoundingClientRect(),G),ie=Gn(x.getBoundingClientRect(),G),xe=Z.height,ee=k||W,ae=ee.scrollHeight,oe=parseFloat(le.borderBottomWidth),me=parseFloat(se.marginTop)||10,ye=parseFloat(se.marginBottom)||10,ge=parseFloat(se.minHeight)||100,Ce=Ti(le),z=5,re=5,K=20,_=q.documentElement.clientHeight-me-ye,ce=q.documentElement.clientWidth,de=_-Z.bottom+xe;let Ee,Ve=E==="rtl"?Z.right-ie.width:Z.left,Ge=0;if(Q&&j){const He=Gn(j.getBoundingClientRect(),G);Ee=Gn(Q.getBoundingClientRect(),G),Ve=ie.left+(E==="rtl"?He.right-Ee.right:He.left-Ee.left);const pe=He.top-Z.top+He.height/2;Ge=Ee.top-ie.top+Ee.height/2-pe}const Me=de+Ge+ye+oe;let Ye=Math.min(_,Me);const Qe=_-me-ye,Xe=Me-Ye,ft=ce-re;x.style.left=`${yn(Ve,z,ft-ie.width)}px`,x.style.height=`${Ye}px`,x.style.maxHeight="none",x.style.marginTop=`${me}px`,x.style.marginBottom=`${ye}px`,W.style.height="100%";const ut=Kn(ee),mt=Xe>=ut-vt;mt&&(Ye=Math.min(_,ie.height)-(Xe-ut));const ot=Z.top<K||Z.bottom>_-K||Math.ceil(Ye)+vt<Math.min(ae,ge),yt=((($=X.visualViewport)==null?void 0:$.scale)??1)!==1&&Ct;if(ot||yt){lo(x,V.current),m(!1);return}const lt=Math.max(ge,Ye);if(mt){const He=Math.max(0,_-Me);x.style.top=ie.height>=Qe?"0":`${He}px`,x.style.height=`${Ye}px`,ee.scrollTop=Kn(ee)}else x.style.bottom="0",ee.scrollTop=Xe;if(Ee){const He=ie.top,pe=ie.height,De=Ee.top+Ee.height/2,Be=yn(pe>0?(De-He)/pe*100:50,0,100);W.style.setProperty(xi,`50% ${Be}%`)}(lt===_||Ye>=Ce)&&(D.current=!0),u.context.handleScrollArrowVisibility(ee),d&&u.state.selectedIndex===null&&u.state.activeIndex===null&&u.context.listRef.current[0]!=null&&u.set("activeIndex",0)}finally{H()}},[u,T,x,L,y,m,M,k,d,E,R]),l.useEffect(()=>{if(!y||!x||!T)return;const W=Ae(x);function H(Y){u.context.setOpen(!1,he(ya,Y))}return be(W,"resize",H)},[u,y,x,T]);const U={...k?{role:"presentation"}:{role:"listbox","aria-multiselectable":a||void 0,"aria-readonly":f||void 0,id:`${w}-list`},onKeyDown(W){v&&_o.has(W.key)&&W.stopPropagation()},onScroll(W){k||N(W.currentTarget)},...y&&{style:k?{height:"100%"}:Ag},className:!k&&y?Si.className:void 0},B=Le("div",t,{ref:[n,u.context.popupRef],state:A,stateAttributesMapping:Fg,props:[O,U,Lo(P),c]});return ne.jsxs(l.Fragment,{children:[!S&&Si.getElement(b),ne.jsx(Xr,{context:h,modal:!1,disabled:!I,openInteractionType:C,returnFocus:i,restoreFocus:!0,children:B})]})});function Ti(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Kn(e){return Fu(e.scrollHeight,e.clientHeight)}function Ci(e){return Hc.getScale(e)}function bn(e,t,n){return e/n[t]}function Gn(e,t){return Tn({x:bn(e.x,"x",t),y:bn(e.y,"y",t),width:bn(e.width,"x",t),height:bn(e.height,"y",t)})}const wi=[["transform","none"],["scale","1"],["translate","0 0"]];function Lg(e){const{style:t}=e,n={};for(const[o,r]of wi)n[o]=t.getPropertyValue(o),t.setProperty(o,r,"important");return()=>{for(const[o]of wi){const r=n[o];r?t.setProperty(o,r):t.removeProperty(o)}}}const Hu=l.createContext(void 0);function Es(){const e=l.useContext(Hu);if(!e)throw new Error(Ne(57));return e}const Eh=l.memo(l.forwardRef(function(t,n){const{render:o,className:r,style:s,value:i=null,label:c,disabled:u=!1,nativeButton:a=!1,...f}=t,d=l.useRef(null),h=vu({guess:!0,label:c,textRef:d}),p=Ht(),{itemProps:g,multiple:y,disabled:R,readOnly:m}=Rs(),v=R||u,E=p.useState("isActive",h.index),b=p.useState("open"),S=p.useState("isSelected",i),w=p.useState("isSelectedByFocus",h.index),T=p.useState("isItemEqualToValue"),C=h.index,I=l.useRef(null);J(()=>{const A=p.context.valuesRef.current;return A[C]=i,()=>{delete A[C]}},[C,i,p]),J(()=>{const A=p.state.value,U=p.state.selectedIndex;let B=U,W;y&&Array.isArray(A)?(B=dg(C,i,p.context.valuesRef.current,A,T,U),W=B===C,C===U&&!W&&(p.context.selectedItemTextRef.current=null)):(W=A!==void 0&&Kt(i,A,T),W&&(B=C)),p.set("selectedIndex",B),W&&d.current&&(p.context.selectedItemTextRef.current=d.current)},[C,y,T,p,i]);const O=l.useRef("mouse"),P=l.useRef(!1),{getButtonProps:L,buttonRef:x}=An({disabled:v,focusableWhenDisabled:!0,native:a,composite:!0}),k={disabled:v,selected:S,highlighted:E};function D(A){if(R||m)return;const U=p.state.value;if(y){const B=Array.isArray(U)?U:[],W=S?pg(B,i,T):[...B,i];p.context.setValue(W,he(jo,A))}else p.context.setValue(i,he(jo,A)),p.context.setOpen(!1,he(jo,A))}function F(){p.context.selectionRef.current.dragY=0}const V={role:"option","aria-selected":S,tabIndex:b&&E?0:-1,onKeyDown(A){p.set("activeIndex",C),A.key===" "&&p.context.typingRef.current&&A.preventDefault()},onClick(A){const U=O.current!=="touch",B=A.nativeEvent.pointerType,W=U&&yo(A.nativeEvent)&&(B!==void 0||E),H=U&&!W&&!P.current;P.current=!1,!(v||H)&&D(A.nativeEvent)},onPointerEnter(A){O.current=A.pointerType},onPointerMove(A){if(A.pointerType==="mouse"&&A.buttons===1){const U=p.context.selectionRef.current;U.dragY+=A.movementY,U.dragY**2>=64&&(U.allowUnselectedMouseUp=!0)}},onPointerDown(A){O.current=A.pointerType,P.current=!0,F()},onMouseUp(){var B;if(F(),v||O.current==="touch"||P.current)return;const A=!p.context.selectionRef.current.allowSelectedMouseUp&&S,U=!p.context.selectionRef.current.allowUnselectedMouseUp&&!S;A||U||(P.current=!0,(B=I.current)==null||B.click(),P.current=!1)}},M=Le("div",t,{ref:[x,n,h.ref,I],state:k,props:[g,V,f,L]}),N=l.useMemo(()=>({selected:S,index:C,textRef:d,selectedByFocus:w}),[S,C,d,w]);return ne.jsx(Hu.Provider,{value:N,children:M})})),Sh=l.forwardRef(function(t,n){const{selected:o}=Es();return t.keepMounted||o?ne.jsx(_g,{...t,ref:n}):null}),_g=l.memo(l.forwardRef((e,t)=>{const{render:n,className:o,style:r,keepMounted:s,...i}=e,{selected:c}=Es(),u=l.useRef(null),{transitionStatus:a,setMounted:f}=Jr(c),h=Le("span",e,{ref:[t,u],state:{selected:c,transitionStatus:a},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:xo});return Xt({batch:!0,enabled:!c,open:c,ref:u,onComplete(){c||f(!1)}}),h})),xh=l.memo(l.forwardRef(function(t,n){const{index:o,textRef:r,selectedByFocus:s}=Es(),i=Ht(),{render:c,className:u,style:a,...f}=t,d=l.useCallback(p=>{p&&(o===0&&(i.context.firstItemTextRef.current=p),s&&(i.context.selectedItemTextRef.current=p))},[i,o,s]);return Le("div",t,{ref:[d,n,r],props:f})})),Vu=l.createContext(void 0);function Mn(e){const t=l.useContext(Vu);if(t===void 0&&!e)throw new Error(Ne(47));return t}const Ng={...cs,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Hg extends On{constructor(n,o,r){const s=new Do;super(Vg(n,s,o,r),Bg(s),Ng);Te(this,"setOpen",(n,o)=>{var d,h;const r=o.reason===$e,s=o.reason===Lt&&o.event.detail===0,i=!n&&(o.reason===wo||o.reason==null),c=qc(o),u=this.select("activeTriggerId");if(!n&&o.reason===ic&&o.trigger==null&&u!=null&&(o.trigger=this.context.triggerElements.getById(u)??this.select("activeTriggerElement")??void 0),(h=(d=this.context).onOpenChange)==null||h.call(d,n,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,o);const a=()=>{const p=ts(this.state,n,o.trigger,c());p.openChangeReason=o.reason,this.update(p)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Ka,()=>{this.set("stickIfOpen",!1)}),at.flushSync(a)):a();let f;s?f="click":i?f="dismiss":o.reason===Yt&&(f="focus"),this.set("instantType",f)})}}function Vg(e,t,n,o=!1){const r={...ss(t,n,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return r.open&&(e==null?void 0:e.mounted)===void 0&&(r.mounted=!0),r}function Bg(e){return{popupRef:l.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:l.createRef(),beforeContentFocusGuardRef:l.createRef(),stickIfOpenTimeout:new ct,triggerElements:e}}const Pi=po(function({props:t}){const{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,modal:c=!1,handle:u,triggerId:a,defaultTriggerId:f=null}=t,d=jg(u,{modal:c,open:r,openProp:o,activeTriggerId:f,triggerIdProp:a});d.useControlledProp("openProp",o),d.useControlledProp("triggerIdProp",a);const h=d.useState("open"),p=d.useState("mounted"),g=d.useState("payload");d.useContextCallback("onOpenChange",s),d.useContextCallback("onOpenChangeComplete",i),Jc(d,h),ns(d);const{forceUnmount:y}=os(h,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:c}),l.useEffect(()=>{h||d.context.stickIfOpenTimeout.clear()},[d,h]),l.useImperativeHandle(t.actionsRef,()=>({unmount:y,close:()=>d.setOpen(!1,he(Br))}),[y,d]);const R=h||p;return ne.jsxs(Vu.Provider,{value:d,children:[u&&ne.jsx(es,{handle:u,store:d}),R&&ne.jsx($g,{store:d,modal:c}),typeof n=="function"?n({payload:g}):n]})});function Th(e){return Mn(!0)?ne.jsx(Pi,{props:e}):ne.jsx(tf,{children:ne.jsx(Pi,{props:e})})}function jg(e,t){const n=Qr((o,r)=>new Hg(t,o,r));return l.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function $g({store:e,modal:t}){const n=e.useState("floatingRootContext"),o=Io(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=o.reference,s=o.floating;return rs(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const Wg=300;function Ug(e,t){const n=l.useRef(null);function o(s){at.flushSync(()=>{e.setOpen(!1,he(Yt,s.nativeEvent,s.currentTarget))});const i=$a(n.current);i==null||i.focus()}function r(s){var c;const i=e.select("positionerElement");if(i&&tn(s,i))(c=e.context.beforeContentFocusGuardRef.current)==null||c.focus();else{at.flushSync(()=>{e.setOpen(!1,he(Yt,s.nativeEvent,s.currentTarget))});let u=ja(e.context.triggerFocusTargetRef.current||t.current);for(;u!==null&&ue(i,u);){const a=u;if(u=zr(u),u===a)break}u==null||u.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:r}}const Ch=qi(function(t,n){const{render:o,className:r,style:s,disabled:i=!1,nativeButton:c=!0,handle:u,payload:a,openOnHover:f=!1,delay:d=Wg,closeDelay:h=0,id:p,...g}=t,y=Mn(!0),m=eu(u)??y;if(!m)throw new Error(Ne(74));const v=fn(p),E=m.useState("isTriggerActive",v),b=m.useState("floatingRootContext"),S=m.useState("isOpenedByTrigger",v),w=m.useState("triggerPopupId",v),T=l.useRef(null),{registerTrigger:C,isMountedByThisTrigger:I}=Zc(v,T,m,{payload:a,disabled:i,openOnHover:f,closeDelay:h}),O=m.useState("openChangeReason"),P=m.useState("stickIfOpen"),L=m.useState("openMethod"),x=m.useState("focusManagerModal"),k=ou(b,{enabled:!i&&f&&(L!=="touch"||O!==Lt),mouseOnly:!0,move:!1,handleClose:ru(),restMs:d,delay:{close:h},triggerElementRef:T,isActiveTrigger:E,isClosing:()=>m.select("transitionStatus")==="ending"}),D=kc(b,{stickIfOpen:P}),F=hu(()=>m.select("open"),Q=>{m.set("openMethod",Q)}),V=m.useState("triggerProps",I),{getButtonProps:M,buttonRef:N}=An({disabled:i,native:c}),A={open(Q){return Q&&O===Lt?rc.open(Q):Nr.open(Q)}},{preFocusGuardRef:U,handlePreFocusGuardFocus:B,handleFocusTargetFocus:W}=Ug(m,T),Y=Le("button",t,{state:{disabled:i,open:S},ref:[N,n,C,T],props:[D.reference,k,V,F,{[Tc]:"",id:v,"aria-haspopup":"dialog","aria-expanded":S,"aria-controls":w},g,M],stateAttributesMapping:A}),$=ne.jsx(l.Fragment,{children:Y},v);return I&&!x?ne.jsxs(l.Fragment,{children:[ne.jsx(sn,{ref:U,onFocus:B}),$,ne.jsx(sn,{ref:m.context.triggerFocusTargetRef,onFocus:W})]}):$}),Bu=l.createContext(void 0);function Yg(){const e=l.useContext(Bu);if(e===void 0)throw new Error(Ne(45));return e}const wh=l.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t;return Mn().useState("mounted")||o?ne.jsx(Bu.Provider,{value:o,children:ne.jsx(Kr,{ref:n,...r})}):null}),ju=l.createContext(void 0);function zg(){const e=l.useContext(ju);if(!e)throw new Error(Ne(46));return e}const Ph=l.forwardRef(function(t,n){const{render:o,className:r,style:s,anchor:i,positionMethod:c,side:u,align:a,sideOffset:f,alignOffset:d,collisionBoundary:h="clipping-ancestors",collisionPadding:p,arrowPadding:g,sticky:y,disableAnchorTracking:R=!1,collisionAvoidance:m=Cc,...v}=t,E=Mn(),b=Yg(),S=Qa(),w=E.useState("floatingRootContext"),T=E.useState("mounted"),C=E.useState("open"),I=E.useState("openChangeReason"),O=E.useState("activeTriggerElement"),P=E.useState("modal"),L=E.useState("openMethod"),x=E.useState("positionerElement"),k=E.useState("instantType"),D=E.useState("transitionStatus"),F=E.useState("adaptiveOrigin"),V=l.useRef(null),M=Gc(x),N=fs({anchor:i,floatingRootContext:w,positionMethod:c,mounted:T,side:u,sideOffset:f,align:a,alignOffset:d,arrowPadding:g,collisionBoundary:h,collisionPadding:p,sticky:y,disableAnchorTracking:R,keepMounted:b,nodeId:S,collisionAvoidance:m,adaptiveOrigin:F}),A=w.useState("domReferenceElement");J(()=>{const Y=A,$=V.current;if(Y&&(V.current=Y),$&&Y&&Y!==$){E.set("instantType",void 0);const Q=new AbortController;return M(()=>{E.set("instantType","trigger-change")},Q.signal),()=>{Q.abort()}}},[A,M,E]);const U=P===!0&&I!==$e;_u(C&&U,L==="touch",x,O);const B=E.useStateSetter("positionerElement"),W={open:C,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:k},H=ds(t,W,{styles:N.positionerStyles,transitionStatus:D,props:v,refs:[n,B],hidden:!T,inert:!C});return ne.jsxs(ju.Provider,{value:N,children:[T&&U&&ne.jsx(hs,{inert:ps(!C),cutout:O}),ne.jsx(ef,{id:S,children:H})]})}),Kg=l.createContext(void 0);function Gg(){const[e,t]=l.useState(0),n=te(()=>(t(r=>r+1),()=>{t(r=>Math.max(0,r-1))}));return{context:l.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const Ih=l.forwardRef(function(t,n){const{render:o,className:r,style:s,initialFocus:i,finalFocus:c,...u}=t,a=Mn(),f=zg(),d=Nu()!=null,{context:h,hasClosePart:p}=Gg(),g=a.useState("open"),y=a.useState("openMethod"),R=a.useState("instantType"),m=a.useState("transitionStatus"),v=a.useState("popupProps"),E=a.useState("titleElementId"),b=a.useState("descriptionElementId"),S=a.useState("modal"),w=a.useState("mounted"),T=a.useState("openChangeReason"),C=a.useState("activeTriggerElement"),I=a.useState("floatingRootContext"),O=I.useState("floatingId"),P=a.useState("disabled"),L=a.useState("openOnHover"),x=a.useState("closeDelay");Xt({open:g,ref:a.context.popupRef,onComplete(){var N,A;g&&((A=(N=a.context).onOpenChangeComplete)==null||A.call(N,!0))}}),nu(I,{enabled:L&&!P,closeDelay:x});const k=i===void 0?Xc(a.context.popupRef):i,D=S!==!1&&p;a.useSyncedValue("focusManagerModal",D);const F=a.useStateSetter("popupElement"),V={open:g,side:f.side,align:f.align,instant:R,transitionStatus:m},M=Le("div",t,{state:V,ref:[n,a.context.popupRef,F],props:[v,{id:O,role:"dialog",...ko,"aria-labelledby":E,"aria-describedby":b,onKeyDown(N){d&&_o.has(N.key)&&N.stopPropagation()}},Lo(m),u],stateAttributesMapping:Hr});return ne.jsx(Xr,{context:I,openInteractionType:y,modal:D,disabled:!w||T===$e,initialFocus:k,returnFocus:c,restoreFocus:"popup",previousFocusableElement:Pe(C)?C:void 0,nextFocusableElement:a.context.triggerFocusTargetRef,beforeContentFocusGuardRef:a.context.beforeContentFocusGuardRef,children:ne.jsx(Kg.Provider,{value:h,children:M})})});export{hh as A,yh as B,bh as C,lh as D,Rh as E,vh as F,Eh as G,Sh as H,xh as I,Th as P,gl as R,gh as S,oh as T,at as a,Ch as b,Zg as c,wh as d,Ph as e,Ih as f,Ku as g,Jg as h,Qg as i,ne as j,eh as k,th as l,nh as m,ah as n,ih as o,sh as p,uh as q,l as r,rh as s,ch as t,qg as u,fh as v,Rd as w,ph as x,dh as y,mh as z};
|