tokentracker-cli 0.15.3 → 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.
Files changed (34) hide show
  1. package/README.md +3 -3
  2. package/README.zh-CN.md +3 -3
  3. package/dashboard/dist/assets/{Card-CFkWVhb0.js → Card-D4lYhDyu.js} +1 -1
  4. package/dashboard/dist/assets/DashboardPage-DpKpZNFo.js +1 -0
  5. package/dashboard/dist/assets/{FadeIn-Dnh91CXb.js → FadeIn-yTlYx7ct.js} +1 -1
  6. package/dashboard/dist/assets/{HeaderGithubStar-Csm3Ealb.js → HeaderGithubStar-EF6oEuWV.js} +1 -1
  7. package/dashboard/dist/assets/{IpCheckPage-CO11dZjw.js → IpCheckPage-BUdcwsiG.js} +1 -1
  8. package/dashboard/dist/assets/{LandingPage-DGwfREJQ.js → LandingPage-c8GJYo2M.js} +1 -1
  9. package/dashboard/dist/assets/{LeaderboardPage-BNEOrCyJ.js → LeaderboardPage-Bj_VxRzv.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardProfilePage-BTr06sjH.js → LeaderboardProfilePage-BaPSajXn.js} +1 -1
  11. package/dashboard/dist/assets/{LimitsPage-Do6ixJEC.js → LimitsPage-IXaDKbhd.js} +1 -1
  12. package/dashboard/dist/assets/{LoginPage-DkI12oqp.js → LoginPage-hsXxJZiT.js} +1 -1
  13. package/dashboard/dist/assets/PopoverPopup-Bx-5Aj3z.js +12 -0
  14. package/dashboard/dist/assets/{ProviderIcon-BrQ-p8RF.js → ProviderIcon-BN6vqCFK.js} +1 -1
  15. package/dashboard/dist/assets/{SettingsPage-BRqlRIMB.js → SettingsPage-C_Fu5jJW.js} +1 -1
  16. package/dashboard/dist/assets/SkillsPage-aksh8wJT.js +1 -0
  17. package/dashboard/dist/assets/{WidgetsPage-C9GQDr-H.js → WidgetsPage-Bn3mt1ye.js} +1 -1
  18. package/dashboard/dist/assets/{chevron-down-DL3I7ot4.js → chevron-down-nR8bajLc.js} +1 -1
  19. package/dashboard/dist/assets/{download-6m9qXhnE.js → download-DG1IfRBC.js} +1 -1
  20. package/dashboard/dist/assets/{leaderboard-columns-hS7oew2p.js → leaderboard-columns-BgANY_mN.js} +1 -1
  21. package/dashboard/dist/assets/main-CITVpx5B.css +1 -0
  22. package/dashboard/dist/assets/{main-B5QLmAE0.js → main-Dz3eXsti.js} +22 -8
  23. package/dashboard/dist/assets/{use-limits-display-prefs-BcoGb7lc.js → use-limits-display-prefs-B-3ijvSG.js} +1 -1
  24. package/dashboard/dist/assets/{use-native-settings-B3GRVvNg.js → use-native-settings-Dq7ZqvuB.js} +1 -1
  25. package/dashboard/dist/assets/{use-reduced-motion-CybCedEn.js → use-reduced-motion-58h8DZHu.js} +1 -1
  26. package/dashboard/dist/assets/{use-usage-limits-CNGlifnQ.js → use-usage-limits-CdShRnbs.js} +1 -1
  27. package/dashboard/dist/index.html +2 -2
  28. package/dashboard/dist/share.html +2 -2
  29. package/package.json +1 -1
  30. package/src/lib/pricing/seed-snapshot.json +1 -1
  31. package/dashboard/dist/assets/DashboardPage-RjZ7ipnP.js +0 -1
  32. package/dashboard/dist/assets/PopoverPopup-D3QrvkAB.js +0 -12
  33. package/dashboard/dist/assets/SkillsPage-tu65Bfiu.js +0 -1
  34. package/dashboard/dist/assets/main-Bnr_KT_S.css +0 -1
@@ -1,12 +0,0 @@
1
- import{c as Is,r as d,ax as zo,ay as qo,D as ee,a7 as Ke}from"./main-B5QLmAE0.js";const ks=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Fl=Is("loader-circle",ks),Ko={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Go={...Ko,position:"fixed",top:0,left:0},Dl={...Ko,position:"absolute"},ao={};function ke(e,t){const n=d.useRef(ao);return n.current===ao&&(n.current=e(t)),n}function Ut(e,t,n,o){const r=ke(Xo).current;return As(r,e,t,n,o)&&Zo(r,[e,t,n,o]),r.callback}function Ms(e){const t=ke(Xo).current;return Ls(t,e)&&Zo(t,e),t.callback}function Xo(){return{callback:null,cleanup:null,refs:[]}}function As(e,t,n,o,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==r}function Ls(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}function Zo(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const o=Array(t.length).fill(null);for(let r=0;r<t.length;r+=1){const s=t[r];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(o[r]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let r=0;r<t.length;r+=1){const s=t[r];if(s!=null)switch(typeof s){case"function":{const i=o[r];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const Fs=()=>{},se=typeof document<"u"?d.useLayoutEffect:Fs,fn=zo[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Ds=fn&&fn!==d.useLayoutEffect?fn:e=>e();function Y(e){const t=ke(Ns).current;return t.next=e,Ds(t.effect),t.trampoline}function Ns(){const e={next:void 0,callback:Bs,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Bs(){}function De(e){const t=ke($s,e).current;return t.next=e,se(t.effect),t}function $s(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Ye(e,...t){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",e.toString()),t.forEach(o=>n.searchParams.append("args[]",o)),`Base UI error #${e}; visit ${n} for the full message.`}var zt=Symbol("NOT_FOUND");function Ws(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Vs(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function js(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${n}]`)}}var lo=e=>Array.isArray(e)?e:[e];function Hs(e){const t=Array.isArray(e[0])?e[0]:e;return js(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function _s(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}function Ys(e){let t;return{get(n){return t&&e(t.key,n)?t.value:zt},put(n,o){t={key:n,value:o}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Us(e,t){let n=[];function o(a){const c=n.findIndex(l=>t(a,l.key));if(c>-1){const l=n[c];return c>0&&(n.splice(c,1),n.unshift(l)),l.value}return zt}function r(a,c){o(a)===zt&&(n.unshift({key:a,value:c}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:o,put:r,getEntries:s,clear:i}}var zs=(e,t)=>e===t;function qs(e){return function(n,o){if(n===null||o===null||n.length!==o.length)return!1;const{length:r}=n;for(let s=0;s<r;s++)if(!e(n[s],o[s]))return!1;return!0}}function Ks(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:o=zs,maxSize:r=1,resultEqualityCheck:s}=n,i=qs(o);let a=0;const c=r<=1?Ys(i):Us(r,i);function l(){let u=c.get(arguments);if(u===zt){if(u=e.apply(null,arguments),a++,s){const p=c.getEntries().find(g=>s(g.value,u));p&&(u=p.value,a!==0&&a--)}c.put(arguments,u)}return u}return l.clearCache=()=>{c.clear(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}var Gs=class{constructor(e){this.value=e}deref(){return this.value}},Xs=typeof WeakRef<"u"?WeakRef:Gs,Zs=0,uo=1;function Nt(){return{s:Zs,v:void 0,o:null,p:null}}function Jo(e,t={}){let n=Nt();const{resultEqualityCheck:o}=t;let r,s=0;function i(){let a=n;const{length:c}=arguments;for(let f=0,p=c;f<p;f++){const g=arguments[f];if(typeof g=="function"||typeof g=="object"&&g!==null){let m=a.o;m===null&&(a.o=m=new WeakMap);const h=m.get(g);h===void 0?(a=Nt(),m.set(g,a)):a=h}else{let m=a.p;m===null&&(a.p=m=new Map);const h=m.get(g);h===void 0?(a=Nt(),m.set(g,a)):a=h}}const l=a;let u;if(a.s===uo)u=a.v;else if(u=e.apply(null,arguments),s++,o){const f=r?.deref?.()??r;f!=null&&o(f,u)&&(u=f,s!==0&&s--),r=typeof u=="object"&&u!==null||typeof u=="function"?new Xs(u):u}return l.s=uo,l.v=u,u}return i.clearCache=()=>{n=Nt(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Qo(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...r)=>{let s=0,i=0,a,c={},l=r.pop();typeof l=="object"&&(c=l,l=r.pop()),Ws(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const u={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:g=Jo,argsMemoizeOptions:m=[]}=u,h=lo(p),y=lo(m),E=Hs(r),b=f(function(){return s++,l.apply(null,arguments)},...h),R=g(function(){i++;const S=_s(E,arguments);return a=b.apply(null,S),a},...y);return Object.assign(R,{resultFunc:l,memoizedResultFunc:b,dependencies:E,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:g})};return Object.assign(o,{withTypes:()=>o}),o}var Js=Qo(Jo),Qs=Object.assign((e,t=Js)=>{Vs(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),o=n.map(s=>e[s]);return t(o,(...s)=>s.reduce((i,a,c)=>(i[n[c]]=a,i),{}))},{withTypes:()=>Qs});Qo({memoize:Ks,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const K=(e,t,n,o,r,s,...i)=>{if(i.length>0)throw new Error(Ye(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var dn={exports:{}},pn={};var fo;function ei(){if(fo)return pn;fo=1;var e=qo();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(f,p){var g=p(),m=o({inst:{value:g,getSnapshot:p}}),h=m[0].inst,y=m[1];return s(function(){h.value=g,h.getSnapshot=p,c(h)&&y({inst:h})},[f,g,p]),r(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),i(g),g}function c(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function l(f,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return pn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,pn}var po;function er(){return po||(po=1,dn.exports=ei()),dn.exports}var ti=er(),gn={exports:{}},mn={};var go;function ni(){if(go)return mn;go=1;var e=qo(),t=er();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return mn.useSyncExternalStoreWithSelector=function(l,u,f,p,g){var m=s(null);if(m.current===null){var h={hasValue:!1,value:null};m.current=h}else h=m.current;m=a(function(){function E(C){if(!b){if(b=!0,R=C,C=p(C),g!==void 0&&h.hasValue){var T=h.value;if(g(T,C))return v=T}return v=C}if(T=v,o(R,C))return T;var I=p(C);return g!==void 0&&g(T,I)?(R=C,T):(R=C,v=I)}var b=!1,R,v,S=f===void 0?null:f;return[function(){return E(u())},S===null?void 0:function(){return E(S())}]},[u,f,p,g]);var y=r(l,m[0],m[1]);return i(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},mn}var mo;function oi(){return mo||(mo=1,gn.exports=ni()),gn.exports}var ri=oi();const si=parseInt(d.version,10);function Wn(e){return si>=e}const ii=Wn(19),ci=ii?li:ui;function ai(e,t,n,o,r){return ci(e,t,n,o,r)}function li(e,t,n,o,r){const s=d.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return ti.useSyncExternalStore(e.subscribe,s,s)}function ui(e,t,n,o,r){return ri.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class Ot{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;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])){Ot.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Ot.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Ot.prototype.setState.call(this,t)}}function tr(){}const Nl=Object.freeze([]),Ee=Object.freeze({});class Vn extends Ot{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}controlledValues=new Map;useSyncedValue(t,n){d.useDebugValue(t),se(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const o=this;se(()=>(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);se(()=>{n.update(t)},[n,...o])}useControlledProp(t,n,o){d.useDebugValue(t);const r=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],o)&&super.setState({...this.state,[t]:o})),se(()=>{s&&!Object.is(r.state[t],n)&&super.setState({...r.state,[t]:n})},[r,t,n,o,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.update(n)}setState(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.setState({...this.state,...n})}select=(t,n,o,r)=>{const s=this.selectors[t];return s(this.state,n,o,r)};useState=(t,n,o,r)=>{d.useDebugValue(t);const s=this.selectors[t];return ai(this,s,n,o,r)};useContextCallback(t,n){d.useDebugValue(t);const o=Y(n??tr);this.context[t]=o}useStateSetter(t){const n=d.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 a=r;r=i,n(i,a,this)}})}}const fi=[];function jn(e){d.useEffect(e,fi)}const Bt=null;class di{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const $t=new di;class Fe{static create(){return new Fe}static request(t){return $t.request(t)}static cancel(t){return $t.cancel(t)}currentId=Bt;request(t){this.cancel(),this.currentId=$t.request(()=>{this.currentId=Bt,t()})}cancel=()=>{this.currentId!==Bt&&($t.cancel(this.currentId),this.currentId=Bt)};disposeEffect=()=>this.cancel}function Hn(){const e=ke(Fe.create).current;return jn(e.disposeEffect),e}const Ct=0;class Ge{static create(){return new Ge}currentId=Ct;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ct,n()},t)}isStarted(){return this.currentId!==Ct}clear=()=>{this.currentId!==Ct&&(clearTimeout(this.currentId),this.currentId=Ct)};disposeEffect=()=>this.clear}function ot(){const e=ke(Ge.create).current;return jn(e.disposeEffect),e}function tn(){return typeof window<"u"}function Xe(e){return _n(e)?(e.nodeName||"").toLowerCase():"#document"}function he(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Be(e){var t;return(t=(_n(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _n(e){return tn()?e instanceof Node||e instanceof he(e).Node:!1}function ie(e){return tn()?e instanceof Element||e instanceof he(e).Element:!1}function me(e){return tn()?e instanceof HTMLElement||e instanceof he(e).HTMLElement:!1}function Cn(e){return!tn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof he(e).ShadowRoot}function st(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ce(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function pi(e){return/^(table|td|th)$/.test(Xe(e))}function nn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const gi=/transform|translate|scale|rotate|perspective|filter/,mi=/paint|layout|strict|content/,tt=e=>!!e&&e!=="none";let hn;function Yn(e){const t=ie(e)?Ce(e):e;return tt(t.transform)||tt(t.translate)||tt(t.scale)||tt(t.rotate)||tt(t.perspective)||!on()&&(tt(t.backdropFilter)||tt(t.filter))||gi.test(t.willChange||"")||mi.test(t.contain||"")}function hi(e){let t=He(e);for(;me(t)&&!je(t);){if(Yn(t))return t;if(nn(t))return null;t=He(t)}return null}function on(){return hn==null&&(hn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hn}function je(e){return/^(html|body|#document)$/.test(Xe(e))}function Ce(e){return he(e).getComputedStyle(e)}function rn(e){return ie(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function He(e){if(Xe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Cn(e)&&e.host||Be(e);return Cn(t)?t.host:t}function nr(e){const t=He(e);return je(t)?e.ownerDocument?e.ownerDocument.body:e.body:me(t)&&st(t)?t:nr(t)}function ze(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=nr(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=he(r);if(s){const a=Tn(i);return t.concat(i,i.visualViewport||[],st(r)?r:[],a&&n?ze(a):[])}else return t.concat(r,ze(r,[],n))}function Tn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const vt=typeof navigator<"u",bn=Ei(),or=xi(),rr=Ri(),bi=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),sr=bn.platform==="MacIntel"&&bn.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(bn.platform),yi=vt&&/apple/i.test(navigator.vendor),On=vt&&/android/i.test(or)||/android/i.test(rr);vt&&or.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const vi=rr.includes("jsdom/");function Ei(){if(!vt)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Ri(){if(!vt)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function xi(){if(!vt)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Pn="data-base-ui-focusable",ir="active",cr="selected",ar="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Bl="ArrowLeft",$l="ArrowRight",Wl="ArrowUp",Vl="ArrowDown";function ft(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function re(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Cn(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function xe(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Pe(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function wi(e){return e.matches("html,body")}function fe(e){return e?.ownerDocument||document}function lr(e){return me(e)&&e.matches(ar)}function ho(e){return e?e.getAttribute("role")==="combobox"&&lr(e):!1}function In(e){return e?e.hasAttribute(Pn)?e:e.querySelector(`[${Pn}]`)||e:null}function nt(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...nt(e,r.id,n)])}function bo(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function Si(e){e.preventDefault(),e.stopPropagation()}function Ci(e){return"nativeEvent"in e}function Ti(e){return e.mozInputSource===0&&e.isTrusted?!0:On&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Oi(e){return vi?!1:!On&&e.width===0&&e.height===0||On&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function mt(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function ur(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Pi=["top","right","bottom","left"],ht=Math.min,we=Math.max,qt=Math.round,Wt=Math.floor,Ne=e=>({x:e,y:e}),Ii={left:"right",right:"left",bottom:"top",top:"bottom"};function kn(e,t,n){return we(e,ht(t,n))}function _e(e,t){return typeof e=="function"?e(t):e}function Re(e){return e.split("-")[0]}function Ze(e){return e.split("-")[1]}function Un(e){return e==="x"?"y":"x"}function zn(e){return e==="y"?"height":"width"}function Oe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qn(e){return Un(Oe(e))}function ki(e,t,n){n===void 0&&(n=!1);const o=Ze(e),r=qn(e),s=zn(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Kt(i)),[i,Kt(i)]}function Mi(e){const t=Kt(e);return[Mn(e),t,Mn(t)]}function Mn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const yo=["left","right"],vo=["right","left"],Ai=["top","bottom"],Li=["bottom","top"];function Fi(e,t,n){switch(e){case"top":case"bottom":return n?t?vo:yo:t?yo:vo;case"left":case"right":return t?Ai:Li;default:return[]}}function Di(e,t,n,o){const r=Ze(e);let s=Fi(Re(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(Mn)))),s}function Kt(e){const t=Re(e);return Ii[t]+e.slice(t.length)}function Ni(e){return{top:0,right:0,bottom:0,left:0,...e}}function fr(e){return typeof e!="number"?Ni(e):{top:e,right:e,bottom:e,left:e}}function Gt(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}var Bi=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Xt=Bi.join(","),dr=typeof Element>"u",bt=dr?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Zt=!dr&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Jt=function(t,n){var o;n===void 0&&(n=!0);var r=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),s=r===""||r==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Jt(t.parentNode));return i},$i=function(t){var n,o=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return o===""||o==="true"},pr=function(t,n,o){if(Jt(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(Xt));return n&&bt.call(t,Xt)&&r.unshift(t),r=r.filter(o),r},Qt=function(t,n,o){for(var r=[],s=Array.from(t);s.length;){var i=s.shift();if(!Jt(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),c=a.length?a:i.children,l=Qt(c,!0,o);o.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{var u=bt.call(i,Xt);u&&o.filter(i)&&(n||!t.includes(i))&&r.push(i);var f=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),p=!Jt(f,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(f&&p){var g=Qt(f===!0?i.children:f.children,!0,o);o.flatten?r.push.apply(r,g):r.push({scopeParent:i,candidates:g})}else s.unshift.apply(s,i.children)}}return r},gr=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},mr=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||$i(t))&&!gr(t)?0:t.tabIndex},Wi=function(t,n){var o=mr(t);return o<0&&n&&!gr(t)?0:o},Vi=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},hr=function(t){return t.tagName==="INPUT"},ji=function(t){return hr(t)&&t.type==="hidden"},Hi=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},_i=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},Yi=function(t){if(!t.name)return!0;var n=t.form||Zt(t),o=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(t.name));else try{r=o(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=_i(r,t.form);return!s||s===t},Ui=function(t){return hr(t)&&t.type==="radio"},zi=function(t){return Ui(t)&&!Yi(t)},qi=function(t){var n,o=t&&Zt(t),r=(n=o)===null||n===void 0?void 0:n.host,s=!1;if(o&&o!==t){var i,a,c;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||t!=null&&(c=t.ownerDocument)!==null&&c!==void 0&&c.contains(t));!s&&r;){var l,u,f;o=Zt(r),r=(l=o)===null||l===void 0?void 0:l.host,s=!!((u=r)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(r))}}return s},Eo=function(t){var n=t.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},Ki=function(t,n){var o=n.displayCheck,r=n.getShadowRoot;if(o==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=bt.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(bt.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var c=t;t;){var l=t.parentElement,u=Zt(t);if(l&&!l.shadowRoot&&r(l)===!0)return Eo(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=c}if(qi(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return Eo(t);return!1},Gi=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return bt.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},An=function(t,n){return!(n.disabled||ji(n)||Ki(n,t)||Hi(n)||Gi(n))},Ln=function(t,n){return!(zi(n)||mr(n)<0||!An(t,n))},Xi=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},br=function(t){var n=[],o=[];return t.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,c=Wi(a,i),l=i?br(r.candidates):a;c===0?i?n.push.apply(n,l):n.push(a):o.push({documentOrder:s,tabIndex:c,item:r,isScope:i,content:l})}),o.sort(Vi).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(n)},At=function(t,n){n=n||{};var o;return n.getShadowRoot?o=Qt([t],n.includeContainer,{filter:Ln.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Xi}):o=pr(t,n.includeContainer,Ln.bind(null,n)),br(o)},Zi=function(t,n){n=n||{};var o;return n.getShadowRoot?o=Qt([t],n.includeContainer,{filter:An.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):o=pr(t,n.includeContainer,An.bind(null,n)),o},yr=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return bt.call(t,Xt)===!1?!1:Ln(n,t)};const Et=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function vr(e,t){const n=At(e,Et()),o=n.length;if(o===0)return;const r=ft(fe(e)),s=n.indexOf(r),i=s===-1?t===1?0:o-1:s+t;return n[i]}function Kn(e){return vr(fe(e).body,1)||e}function Er(e){return vr(fe(e).body,-1)||e}function Rr(e,t){if(!e)return null;const n=At(fe(e).body,Et()),o=n.length;if(o===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+o)%o;return n[s]}function Ji(e){return Rr(e,1)}function Qi(e){return Rr(e,-1)}function dt(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!re(n,o)}function ec(e){At(e,Et()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ro(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}const tc={...zo};let xo=0;function nc(e,t="mui"){const[n,o]=d.useState(e),r=e||n;return d.useEffect(()=>{n==null&&(xo+=1,o(`${t}-${xo}`))},[n,t]),r}const wo=tc.useId;function Rt(e,t){if(wo!==void 0){const n=wo();return e??(t?`${t}-${n}`:n)}return nc(e,t)}function xr(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class oc{nodesRef={current:[]};events=xr();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const wr=d.createContext(null),Sr=d.createContext(null),it=()=>d.useContext(wr)?.id||null,xt=e=>{const t=d.useContext(Sr);return e??t};function rc(e){const t=Rt(),n=xt(e),o=it();return se(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function sc(e){const{children:t,id:n}=e,o=it();return ee.jsx(wr.Provider,{value:d.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function ic(e){const{children:t,externalTree:n}=e,o=ke(()=>n??new oc).current;return ee.jsx(Sr.Provider,{value:o,children:t})}const cc=500,ac={style:{transition:"none"}},Cr="data-base-ui-click-trigger",jl={fallbackAxisSide:"none"},lc={fallbackAxisSide:"end"},uc={clipPath:"inset(50%)",position:"fixed",top:0,left:0},fc="none",qe="trigger-press",Se="trigger-hover",Tr="outside-press",Hl="item-press",_l="close-press",It="focus-out",Or="escape-key",Yl="list-navigation",Ul="cancel-open",Pr="imperative-action",zl="window-resize";function ce(e,t,n,o){let r=!1,s=!1;const i=Ee;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...i}}function kt(e){return`data-base-ui-${e}`}function yn(e,t,n){if(n&&!mt(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function ct(e){return e?.ownerDocument||document}const yt=d.forwardRef(function(t,n){const[o,r]=d.useState();se(()=>{yi&&r("button")},[]);const s={tabIndex:0,role:o};return ee.jsx("span",{...t,ref:n,style:Go,"aria-hidden":o?void 0:!0,...s,"data-base-ui-focus-guard":""})});let So=0;function vn(e,t={}){const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(So);const s=()=>e?.focus({preventScroll:n});r?s():So=requestAnimationFrame(s)}const pt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Co(e){return e==="inert"?pt.inert:e==="aria-hidden"?pt["aria-hidden"]:pt.none}let Vt=new WeakSet,jt={},En=0;const Ir=e=>e&&(e.host||Ir(e.parentNode)),dc=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Ir(n);return e.contains(o)?o:null}).filter(n=>n!=null);function pc(e,t,n,o){const r="data-base-ui-inert",s=o?"inert":n?"aria-hidden":null,i=dc(t,e),a=new Set,c=new Set(i),l=[];jt[r]||(jt[r]=new WeakMap);const u=jt[r];i.forEach(f),p(t),a.clear();function f(g){!g||a.has(g)||(a.add(g),g.parentNode&&f(g.parentNode))}function p(g){!g||c.has(g)||[].forEach.call(g.children,m=>{if(Xe(m)!=="script")if(a.has(m))p(m);else{const h=s?m.getAttribute(s):null,y=h!==null&&h!=="false",E=Co(s),b=(E.get(m)||0)+1,R=(u.get(m)||0)+1;E.set(m,b),u.set(m,R),l.push(m),b===1&&y&&Vt.add(m),R===1&&m.setAttribute(r,""),!y&&s&&m.setAttribute(s,s==="inert"?"":"true")}})}return En+=1,()=>{l.forEach(g=>{const m=Co(s),y=(m.get(g)||0)-1,E=(u.get(g)||0)-1;m.set(g,y),u.set(g,E),y||(!Vt.has(g)&&s&&g.removeAttribute(s),Vt.delete(g)),E||g.removeAttribute(r)}),En-=1,En||(pt.inert=new WeakMap,pt["aria-hidden"]=new WeakMap,pt.none=new WeakMap,Vt=new WeakSet,jt={})}}function gc(e,t=!1,n=!1){const o=fe(e[0]).body;return pc(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}function To(e){if(!d.isValidElement(e))return null;const t=e,n=t.props;return(Wn(19)?n?.ref:t.ref)??null}function Fn(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function mc(e,t){const n={};for(const o in e){const r=e[o];if(t?.hasOwnProperty(o)){const s=t[o](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${o.toLowerCase()}`]="":r&&(n[`data-${o.toLowerCase()}`]=r.toString())}return n}function hc(e,t){return typeof e=="function"?e(t):e}function bc(e,t){return typeof e=="function"?e(t):e}const Pt={};function kr(e,t,n,o,r){let s={...Dn(e,Pt)};return t&&(s=Tt(s,t)),n&&(s=Tt(s,n)),o&&(s=Tt(s,o)),r&&(s=Tt(s,r)),s}function yc(e){if(e.length===0)return Pt;if(e.length===1)return Dn(e[0],Pt);let t={...Dn(e[0],Pt)};for(let n=1;n<e.length;n+=1)t=Tt(t,e[n]);return t}function Tt(e,t){return Mr(t)?t(e):vc(e,t)}function vc(e,t){if(!t)return e;for(const n in t){const o=t[n];switch(n){case"style":{e[n]=Fn(e.style,o);break}case"className":{e[n]=Ar(e.className,o);break}default:Ec(n,o)?e[n]=Rc(e[n],o):e[n]=o}}return e}function Ec(e,t){const n=e.charCodeAt(0),o=e.charCodeAt(1),r=e.charCodeAt(2);return n===111&&o===110&&r>=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function Mr(e){return typeof e=="function"}function Dn(e,t){return Mr(e)?e(t):e??Pt}function Rc(e,t){return t?e?n=>{if(xc(n)){const r=n;Nn(r);const s=t(r);return r.baseUIHandlerPrevented||e?.(r),s}const o=t(n);return e?.(n),o}:t:e}function Nn(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Ar(e,t){return t?e?t+" "+e:t:e}function xc(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Je(e,t,n={}){const o=t.render,r=wc(t,n);if(n.enabled===!1)return null;const s=n.state??Ee;return Sc(e,o,r,s)}function wc(e,t={}){const{className:n,style:o,render:r}=e,{state:s=Ee,ref:i,props:a,stateAttributesMapping:c,enabled:l=!0}=t,u=l?hc(n,s):void 0,f=l?bc(o,s):void 0,p=l?mc(s,c):Ee,g=l?Fn(p,Array.isArray(a)?yc(a):a)??Ee:Ee;return typeof document<"u"&&(l?Array.isArray(i)?g.ref=Ms([g.ref,To(r),...i]):g.ref=Ut(g.ref,To(r),i):Ut(null,null)),l?(u!==void 0&&(g.className=Ar(g.className,u)),f!==void 0&&(g.style=Fn(g.style,f)),g):Ee}function Sc(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);const r=kr(n,t.props);return r.ref=n.ref,d.cloneElement(t,r)}if(e&&typeof e=="string")return Cc(e,n);throw new Error(Ye(8))}function Cc(e,t){return e==="button"?d.createElement("button",{type:"button",...t,key:t.key}):e==="img"?d.createElement("img",{alt:"",...t,key:t.key}):d.createElement(e,t)}const Lr=d.createContext(null),Fr=()=>d.useContext(Lr),Tc=kt("portal");function Oc(e={}){const{ref:t,container:n,componentProps:o=Ee,elementProps:r,elementState:s}=e,i=Rt(),c=Fr()?.portalNode,[l,u]=d.useState(null),[f,p]=d.useState(null),g=Y(E=>{E!==null&&p(E)}),m=d.useRef(null);se(()=>{if(n===null){m.current&&(m.current=null,p(null),u(null));return}if(i==null)return;const E=(n&&(_n(n)?n:n.current))??c??document.body;if(E==null){m.current&&(m.current=null,p(null),u(null));return}m.current!==E&&(m.current=E,p(null),u(E))},[n,c,i]);const h=Je("div",o,{ref:[t,g],state:s,props:[{id:i,[Tc]:""},r]});return{portalNode:f,portalSubtree:l&&h?Ke.createPortal(h,l):null}}const Dr=d.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,renderGuards:a,...c}=t,{portalNode:l,portalSubtree:u}=Oc({container:r,ref:n,componentProps:t,elementProps:c}),f=d.useRef(null),p=d.useRef(null),g=d.useRef(null),m=d.useRef(null),[h,y]=d.useState(null),E=h?.modal,b=h?.open,R=typeof a=="boolean"?a:!!h&&!h.modal&&h.open&&!!l;d.useEffect(()=>{if(!l||E)return;function S(C){l&&C.relatedTarget&&dt(C)&&(C.type==="focusin"?Ro:ec)(l)}return l.addEventListener("focusin",S,!0),l.addEventListener("focusout",S,!0),()=>{l.removeEventListener("focusin",S,!0),l.removeEventListener("focusout",S,!0)}},[l,E]),d.useEffect(()=>{!l||b||Ro(l)},[b,l]);const v=d.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:g,afterInsideRef:m,portalNode:l,setFocusManagerState:y}),[l]);return ee.jsxs(d.Fragment,{children:[u,ee.jsxs(Lr.Provider,{value:v,children:[R&&l&&ee.jsx(yt,{"data-type":"outside",ref:f,onFocus:S=>{if(dt(S,l))g.current?.focus();else{const C=h?h.domReference:null;Er(C)?.focus()}}}),R&&l&&ee.jsx("span",{"aria-owns":l.id,style:uc}),l&&Ke.createPortal(o,l),R&&l&&ee.jsx(yt,{"data-type":"outside",ref:p,onFocus:S=>{if(dt(S,l))m.current?.focus();else{const C=h?h.domReference:null;Kn(C)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,ce(It,S.nativeEvent))}}})]})]})});function Ve(e){return e==null?e:"current"in e?e.current:e}function Pc(e,t){const n=he(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Oo=20;let Ue=[];function Gn(){Ue=Ue.filter(e=>e.isConnected)}function Ic(e){Gn(),e&&Xe(e)!=="body"&&(Ue.push(e),Ue.length>Oo&&(Ue=Ue.slice(-Oo)))}function Rn(){return Gn(),Ue[Ue.length-1]}function kc(e){if(!e)return null;const t=Et();return yr(e,t)?e:At(e,t)[0]||e}function Mc(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Ce(e).display!=="none"}function Po(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Et(),r=Zi(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return yr(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Nr(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:a=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u="",getInsideElements:f=()=>[],nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:m,externalTree:h}=e,y="rootStore"in t?t.rootStore:t,E=y.useState("open"),b=y.useState("domReferenceElement"),R=y.useState("floatingElement"),{events:v,dataRef:S}=y.context,C=Y(()=>S.current.floatingContext?.nodeId),T=Y(f),I=s===!1,N=ho(b)&&I,k=De(r),F=De(s),A=De(i),O=De(u),D=xt(h),P=Fr(),V=d.useRef(null),B=d.useRef(null),w=d.useRef(!1),L=d.useRef(!1),Q=d.useRef(!1),G=d.useRef(-1),X=d.useRef(""),Z=d.useRef(""),_=d.useRef(null),ne=d.useRef(null),z=Ut(_,m,P?.beforeInsideRef),J=Ut(ne,P?.afterInsideRef),de=ot(),pe=ot(),ge=Hn(),$e=P!=null,x=In(R),U=Y((M=x)=>M?At(M,Et()):[]),$=Y(M=>{const W=U(M);return k.current.map(()=>W).filter(Boolean).flat()});d.useEffect(()=>{if(o||!c)return;function M(q){q.key==="Tab"&&re(x,ft(fe(x)))&&U().length===0&&!N&&Si(q)}const W=fe(x);return W.addEventListener("keydown",M),()=>{W.removeEventListener("keydown",M)}},[o,b,x,c,k,N,U,$]),d.useEffect(()=>{if(o||!R)return;function M(W){const q=xe(W),oe=U().indexOf(q);oe!==-1&&(G.current=oe)}return R.addEventListener("focusin",M),()=>{R.removeEventListener("focusin",M)}},[o,R,U]),d.useEffect(()=>{if(o||!E)return;const M=fe(x);function W(){Q.current=!1}function q(oe){const H=xe(oe),j=re(R,H)||re(b,H)||re(P?.portalNode,H);Q.current=!j,Z.current=oe.pointerType||"keyboard"}function te(){Z.current="keyboard"}return M.addEventListener("pointerdown",q,!0),M.addEventListener("pointerup",W,!0),M.addEventListener("pointercancel",W,!0),M.addEventListener("keydown",te,!0),()=>{M.removeEventListener("pointerdown",q,!0),M.removeEventListener("pointerup",W,!0),M.removeEventListener("pointercancel",W,!0),M.removeEventListener("keydown",te,!0)}},[o,R,b,x,E,P]),d.useEffect(()=>{if(o||!l)return;function M(){L.current=!0,pe.start(0,()=>{L.current=!1})}function W(H){const j=H.relatedTarget,be=H.currentTarget,ae=xe(H);queueMicrotask(()=>{const We=C(),Qe=y.context.triggerElements,at=j?.hasAttribute(kt("focus-guard"))&&[_.current,ne.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Ve(g),Ve(p)].includes(j),et=!(re(b,j)||re(R,j)||re(j,R)||re(P?.portalNode,j)||j!=null&&Qe.hasElement(j)||Qe.hasMatchingElement(ye=>re(ye,j))||at||D&&(nt(D.nodesRef.current,We).find(ye=>re(ye.context?.elements.floating,j)||re(ye.context?.elements.domReference,j))||bo(D.nodesRef.current,We).find(ye=>[ye.context?.elements.floating,In(ye.context?.elements.floating)].includes(j)||ye.context?.elements.domReference===j)));if(be===b&&x&&Po(x,k),a&&be!==b&&!Mc(ae)&&ft(fe(x))===fe(x).body){if(me(x)&&(x.focus(),a==="popup")){ge.request(()=>{x.focus()});return}const ye=G.current,Me=U(),Ae=Me[ye]||Me[Me.length-1]||x;me(Ae)&&Ae.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(N||!c)&&j&&et&&!L.current&&(N||j!==Rn())&&(w.current=!0,y.setOpen(!1,ce(It,H)))})}function q(){Q.current||(S.current.insideReactTree=!0,de.start(0,()=>{S.current.insideReactTree=!1}))}const te=me(b)?b:null,oe=[];if(!(!R&&!te))return te&&(te.addEventListener("focusout",W),te.addEventListener("pointerdown",M),oe.push(()=>{te.removeEventListener("focusout",W),te.removeEventListener("pointerdown",M)})),R&&(R.addEventListener("focusout",W),P&&(R.addEventListener("focusout",q,!0),oe.push(()=>{R.removeEventListener("focusout",q,!0)})),oe.push(()=>{R.removeEventListener("focusout",W)})),()=>{oe.forEach(H=>{H()})}},[o,b,R,x,c,D,P,y,l,a,U,N,C,k,S,de,pe,ge,p,g]),d.useEffect(()=>{if(o||!R||!E)return;const M=Array.from(P?.portalNode?.querySelectorAll(`[${kt("portal")}]`)||[]),q=(D?bo(D.nodesRef.current,C()):[]).find(H=>ho(H.context?.elements.domReference||null))?.context?.elements.domReference,te=[R,q,...M,...T(),V.current,B.current,_.current,ne.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Ve(g),Ve(p),N?b:null].filter(H=>H!=null),oe=gc(te,c||N);return()=>{oe()}},[E,o,b,R,c,k,P,N,D,C,T,p,g]),se(()=>{if(!E||o||!me(x))return;const M=fe(x),W=ft(M);queueMicrotask(()=>{const q=$(x),te=F.current,oe=typeof te=="function"?te(O.current||""):te;if(oe===void 0||oe===!1)return;let H;oe===!0||oe===null?H=q[0]||x:H=Ve(oe),H=H||q[0]||x,!re(x,W)&&vn(H,{preventScroll:H===x})})},[o,E,x,I,$,F,O]),se(()=>{if(o||!x)return;const M=fe(x),W=ft(M);Ic(W);function q(H){if(H.open||(X.current=Pc(H.nativeEvent,Z.current)),H.reason===Se&&H.nativeEvent.type==="mouseleave"&&(w.current=!0),H.reason===Tr)if(H.nested)w.current=!1;else if(Ti(H.nativeEvent)||Oi(H.nativeEvent))w.current=!1;else{let j=!1;document.createElement("div").focus({get preventScroll(){return j=!0,!1}}),j?w.current=!1:w.current=!0}}v.on("openchange",q);const te=M.createElement("span");te.setAttribute("tabindex","-1"),te.setAttribute("aria-hidden","true"),Object.assign(te.style,Go),$e&&b&&b.insertAdjacentElement("afterend",te);function oe(){const H=A.current;let j=typeof H=="function"?H(X.current):H;if(j===void 0||j===!1)return null;if(j===null&&(j=!0),typeof j=="boolean"){const ae=b||Rn();return ae&&ae.isConnected?ae:te}const be=b||Rn()||te;return Ve(j)||be}return()=>{v.off("openchange",q);const H=ft(M),j=re(R,H)||D&&nt(D.nodesRef.current,C(),!1).some(ae=>re(ae.context?.elements.floating,H)),be=oe();queueMicrotask(()=>{const ae=kc(be),We=typeof A.current!="boolean";A.current&&!w.current&&me(ae)&&(!(!We&&ae!==H&&H!==M.body)||j)&&ae.focus({preventScroll:!0}),te.remove()})}},[o,R,x,A,S,v,D,$e,b,C]),d.useEffect(()=>{queueMicrotask(()=>{w.current=!1})},[o]),d.useEffect(()=>{if(o||!E)return;function M(q){xe(q)?.closest(`[${Cr}]`)&&(L.current=!0)}const W=fe(x);return W.addEventListener("pointerdown",M,!0),()=>{W.removeEventListener("pointerdown",M,!0)}},[o,E,x]),se(()=>{if(!o&&P)return P.setFocusManagerState({modal:c,closeOnFocusOut:l,open:E,onOpenChange:y.setOpen,domReference:b}),()=>{P.setFocusManagerState(null)}},[o,P,c,E,y,l,b]),se(()=>{if(!(o||!x))return Po(x,k),()=>{queueMicrotask(Gn)}},[o,x,k]);const ue=!o&&(c?!N:!0)&&($e||c);return ee.jsxs(d.Fragment,{children:[ue&&ee.jsx(yt,{"data-type":"inside",ref:z,onFocus:M=>{if(c){const W=$();vn(W[W.length-1])}else P?.portalNode&&(w.current=!1,dt(M,P.portalNode)?Kn(b)?.focus():Ve(g??P.beforeOutsideRef)?.focus())}}),n,ue&&ee.jsx(yt,{"data-type":"inside",ref:J,onFocus:M=>{c?vn($()[0]):P?.portalNode&&(l&&(w.current=!0),dt(M,P.portalNode)?Er(b)?.focus():Ve(p??P.afterOutsideRef)?.focus())}})]})}function Ac(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:r=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,u=d.useRef(void 0),f=Hn(),p=ot(),g=d.useMemo(()=>({onPointerDown(m){u.current=m.pointerType},onMouseDown(m){const h=u.current,y=m.nativeEvent,E=n.select("open");if(m.button!==0||s==="click"||mt(h,!0)&&a)return;const b=o.current.openEvent,R=b?.type,v=n.select("domReferenceElement")!==m.currentTarget,S=E&&v||!(E&&i&&(!(b&&c)||R==="click"||R==="mousedown"));if(lr(y.target)){const T=ce(qe,y,y.target);S&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,T)}):n.setOpen(S,T);return}const C=m.currentTarget;f.request(()=>{const T=ce(qe,y,C);S&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,T)}):n.setOpen(S,T)})},onClick(m){if(s==="mousedown-only")return;const h=u.current;if(s==="mousedown"&&h){u.current=void 0;return}if(mt(h,!0)&&a)return;const y=n.select("open"),E=o.current.openEvent,b=n.select("domReferenceElement")!==m.currentTarget,R=y&&b||!(y&&i&&(!(E&&c)||ur(E))),v=ce(qe,m.nativeEvent,m.currentTarget);R&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,v)}):n.setOpen(R,v)},onKeyDown(){u.current=void 0}}),[o,s,a,n,c,i,f,p,l]);return d.useMemo(()=>r?{reference:g}:Ee,[r,g])}function Io(e,t,n){let{reference:o,floating:r}=e;const s=Oe(t),i=qn(t),a=zn(i),c=Re(t),l=s==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2;let g;switch(c){case"top":g={x:u,y:o.y-r.height};break;case"bottom":g={x:u,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:f};break;case"left":g={x:o.x-r.width,y:f};break;default:g={x:o.x,y:o.y}}switch(Ze(t)){case"start":g[i]-=p*(n&&l?-1:1);break;case"end":g[i]+=p*(n&&l?-1:1);break}return g}async function Lc(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:g=0}=_e(t,e),m=fr(g),y=a[p?f==="floating"?"reference":"floating":f],E=Gt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),b=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),v=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},S=Gt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:R,strategy:c}):b);return{top:(E.top-S.top+m.top)/v.y,bottom:(S.bottom-E.bottom+m.bottom)/v.y,left:(E.left-S.left+m.left)/v.x,right:(S.right-E.right+m.right)/v.x}}const Fc=50,Dc=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Lc},c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:f}=Io(l,o,c),p=o,g=0;const m={};for(let h=0;h<s.length;h++){const y=s[h];if(!y)continue;const{name:E,fn:b}=y,{x:R,y:v,data:S,reset:C}=await b({x:u,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});u=R??u,f=v??f,m[E]={...m[E],...S},C&&g<Fc&&(g++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(l=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:u,y:f}=Io(l,p,c)),h=-1)}return{x:u,y:f,placement:p,strategy:r,middlewareData:m}},Nc=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...y}=_e(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const E=Re(r),b=Oe(a),R=Re(a)===a,v=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=p||(R||!h?[Kt(a)]:Mi(a)),C=m!=="none";!p&&C&&S.push(...Di(a,h,m,v));const T=[a,...S],I=await c.detectOverflow(t,y),N=[];let k=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&N.push(I[E]),f){const D=ki(r,i,v);N.push(I[D[0]],I[D[1]])}if(k=[...k,{placement:r,overflows:N}],!N.every(D=>D<=0)){var F,A;const D=(((F=s.flip)==null?void 0:F.index)||0)+1,P=T[D];if(P&&(!(f==="alignment"?b!==Oe(P):!1)||k.every(w=>Oe(w.placement)===b?w.overflows[0]>0:!0)))return{data:{index:D,overflows:k},reset:{placement:P}};let V=(A=k.filter(B=>B.overflows[0]<=0).sort((B,w)=>B.overflows[1]-w.overflows[1])[0])==null?void 0:A.placement;if(!V)switch(g){case"bestFit":{var O;const B=(O=k.filter(w=>{if(C){const L=Oe(w.placement);return L===b||L==="y"}return!0}).map(w=>[w.placement,w.overflows.filter(L=>L>0).reduce((L,Q)=>L+Q,0)]).sort((w,L)=>w[1]-L[1])[0])==null?void 0:O[0];B&&(V=B);break}case"initialPlacement":V=a;break}if(r!==V)return{reset:{placement:V}}}return{}}}};function ko(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mo(e){return Pi.some(t=>e[t]>=0)}const Bc=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=_e(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),a=ko(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Mo(a)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),a=ko(i,n.floating);return{data:{escapedOffsets:a,escaped:Mo(a)}}}default:return{}}}}},Br=new Set(["left","top"]);async function $c(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Re(n),a=Ze(n),c=Oe(n)==="y",l=Br.has(i)?-1:1,u=s&&c?-1:1,f=_e(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(g=a==="end"?m*-1:m),c?{x:g*u,y:p*l}:{x:p*l,y:g*u}}const Wc=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:a}=t,c=await $c(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:i}}}}},Vc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:E=>{let{x:b,y:R}=E;return{x:b,y:R}}},...l}=_e(e,t),u={x:n,y:o},f=await s.detectOverflow(t,l),p=Oe(Re(r)),g=Un(p);let m=u[g],h=u[p];if(i){const E=g==="y"?"top":"left",b=g==="y"?"bottom":"right",R=m+f[E],v=m-f[b];m=kn(R,m,v)}if(a){const E=p==="y"?"top":"left",b=p==="y"?"bottom":"right",R=h+f[E],v=h-f[b];h=kn(R,h,v)}const y=c.fn({...t,[g]:m,[p]:h});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[g]:i,[p]:a}}}}}},jc=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=_e(e,t),u={x:n,y:o},f=Oe(r),p=Un(f);let g=u[p],m=u[f];const h=_e(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const R=p==="y"?"height":"width",v=s.reference[p]-s.floating[R]+y.mainAxis,S=s.reference[p]+s.reference[R]-y.mainAxis;g<v?g=v:g>S&&(g=S)}if(l){var E,b;const R=p==="y"?"width":"height",v=Br.has(Re(r)),S=s.reference[f]-s.floating[R]+(v&&((E=i.offset)==null?void 0:E[f])||0)+(v?0:y.crossAxis),C=s.reference[f]+s.reference[R]+(v?0:((b=i.offset)==null?void 0:b[f])||0)-(v?y.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[p]:g,[f]:m}}}},Hc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...l}=_e(e,t),u=await i.detectOverflow(t,l),f=Re(r),p=Ze(r),g=Oe(r)==="y",{width:m,height:h}=s.floating;let y,E;f==="top"||f==="bottom"?(y=f,E=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(E=f,y=p==="end"?"top":"bottom");const b=h-u.top-u.bottom,R=m-u.left-u.right,v=ht(h-u[y],b),S=ht(m-u[E],R),C=!t.middlewareData.shift;let T=v,I=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=R),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(T=b),C&&!p){const k=we(u.left,0),F=we(u.right,0),A=we(u.top,0),O=we(u.bottom,0);g?I=m-2*(k!==0||F!==0?k+F:we(u.left,u.right)):T=h-2*(A!==0||O!==0?A+O:we(u.top,u.bottom))}await c({...t,availableWidth:I,availableHeight:T});const N=await i.getDimensions(a.floating);return m!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function $r(e){const t=Ce(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=me(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=qt(n)!==s||qt(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function Xn(e){return ie(e)?e:e.contextElement}function gt(e){const t=Xn(e);if(!me(t))return Ne(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=$r(t);let i=(s?qt(n.width):n.width)/o,a=(s?qt(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const _c=Ne(0);function Wr(e){const t=he(e);return!on()||!t.visualViewport?_c:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==he(e)?!1:t}function rt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=Xn(e);let i=Ne(1);t&&(o?ie(o)&&(i=gt(o)):i=gt(e));const a=Yc(s,n,o)?Wr(s):Ne(0);let c=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,u=r.width/i.x,f=r.height/i.y;if(s){const p=he(s),g=o&&ie(o)?he(o):o;let m=p,h=Tn(m);for(;h&&o&&g!==m;){const y=gt(h),E=h.getBoundingClientRect(),b=Ce(h),R=E.left+(h.clientLeft+parseFloat(b.paddingLeft))*y.x,v=E.top+(h.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,l*=y.y,u*=y.x,f*=y.y,c+=R,l+=v,m=he(h),h=Tn(m)}}return Gt({width:u,height:f,x:c,y:l})}function sn(e,t){const n=rn(e).scrollLeft;return t?t.left+n:rt(Be(e)).left+n}function Vr(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-sn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Uc(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=Be(o),a=t?nn(t.floating):!1;if(o===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=Ne(1);const u=Ne(0),f=me(o);if((f||!f&&!s)&&((Xe(o)!=="body"||st(i))&&(c=rn(o)),f)){const g=rt(o);l=gt(o),u.x=g.x+o.clientLeft,u.y=g.y+o.clientTop}const p=i&&!f&&!s?Vr(i,c):Ne(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-c.scrollTop*l.y+u.y+p.y}}function zc(e){return Array.from(e.getClientRects())}function qc(e){const t=Be(e),n=rn(e),o=e.ownerDocument.body,r=we(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=we(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+sn(e);const a=-n.scrollTop;return Ce(o).direction==="rtl"&&(i+=we(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:a}}const Ao=25;function Kc(e,t){const n=he(e),o=Be(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,a=0,c=0;if(r){s=r.width,i=r.height;const u=on();(!u||u&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}const l=sn(o);if(l<=0){const u=o.ownerDocument,f=u.body,p=getComputedStyle(f),g=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-f.clientWidth-g);m<=Ao&&(s-=m)}else l<=Ao&&(s+=l);return{width:s,height:i,x:a,y:c}}function Gc(e,t){const n=rt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=me(e)?gt(e):Ne(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=r*s.x,l=o*s.y;return{width:i,height:a,x:c,y:l}}function Lo(e,t,n){let o;if(t==="viewport")o=Kc(e,n);else if(t==="document")o=qc(Be(e));else if(ie(t))o=Gc(t,n);else{const r=Wr(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Gt(o)}function jr(e,t){const n=He(e);return n===t||!ie(n)||je(n)?!1:Ce(n).position==="fixed"||jr(n,t)}function Xc(e,t){const n=t.get(e);if(n)return n;let o=ze(e,[],!1).filter(a=>ie(a)&&Xe(a)!=="body"),r=null;const s=Ce(e).position==="fixed";let i=s?He(e):e;for(;ie(i)&&!je(i);){const a=Ce(i),c=Yn(i);!c&&a.position==="fixed"&&(r=null),(s?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||st(i)&&!c&&jr(e,i))?o=o.filter(u=>u!==i):r=a,i=He(i)}return t.set(e,o),o}function Zc(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?nn(t)?[]:Xc(t,this._c):[].concat(n),o],a=Lo(t,i[0],r);let c=a.top,l=a.right,u=a.bottom,f=a.left;for(let p=1;p<i.length;p++){const g=Lo(t,i[p],r);c=we(g.top,c),l=ht(g.right,l),u=ht(g.bottom,u),f=we(g.left,f)}return{width:l-f,height:u-c,x:f,y:c}}function Jc(e){const{width:t,height:n}=$r(e);return{width:t,height:n}}function Qc(e,t,n){const o=me(t),r=Be(t),s=n==="fixed",i=rt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Ne(0);function l(){c.x=sn(r)}if(o||!o&&!s)if((Xe(t)!=="body"||st(r))&&(a=rn(t)),o){const g=rt(t,!0,s,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else r&&l();s&&!o&&r&&l();const u=r&&!o&&!s?Vr(r,a):Ne(0),f=i.left+a.scrollLeft-c.x-u.x,p=i.top+a.scrollTop-c.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function xn(e){return Ce(e).position==="static"}function Fo(e,t){if(!me(e)||Ce(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Be(e)===n&&(n=n.ownerDocument.body),n}function Hr(e,t){const n=he(e);if(nn(e))return n;if(!me(e)){let r=He(e);for(;r&&!je(r);){if(ie(r)&&!xn(r))return r;r=He(r)}return n}let o=Fo(e,t);for(;o&&pi(o)&&xn(o);)o=Fo(o,t);return o&&je(o)&&xn(o)&&!Yn(o)?n:o||hi(e)||n}const ea=async function(e){const t=this.getOffsetParent||Hr,n=this.getDimensions,o=await n(e.floating);return{reference:Qc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ta(e){return Ce(e).direction==="rtl"}const na={convertOffsetParentRelativeRectToViewportRelativeRect:Uc,getDocumentElement:Be,getClippingRect:Zc,getOffsetParent:Hr,getElementRects:ea,getClientRects:zc,getDimensions:Jc,getScale:gt,isElement:ie,isRTL:ta};function _r(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function oa(e,t){let n=null,o;const r=Be(e);function s(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=e.getBoundingClientRect(),{left:u,top:f,width:p,height:g}=l;if(a||t(),!p||!g)return;const m=Wt(f),h=Wt(r.clientWidth-(u+p)),y=Wt(r.clientHeight-(f+g)),E=Wt(u),R={rootMargin:-m+"px "+-h+"px "+-y+"px "+-E+"px",threshold:we(0,ht(1,c))||1};let v=!0;function S(C){const T=C[0].intersectionRatio;if(T!==c){if(!v)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!_r(l,e.getBoundingClientRect())&&i(),v=!1}try{n=new IntersectionObserver(S,{...R,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,R)}n.observe(e)}return i(!0),s}function Do(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=Xn(e),u=r||s?[...l?ze(l):[],...t?ze(t):[]]:[];u.forEach(E=>{r&&E.addEventListener("scroll",n,{passive:!0}),s&&E.addEventListener("resize",n)});const f=l&&a?oa(l,n):null;let p=-1,g=null;i&&(g=new ResizeObserver(E=>{let[b]=E;b&&b.target===l&&g&&t&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var R;(R=g)==null||R.observe(t)})),n()}),l&&!c&&g.observe(l),t&&g.observe(t));let m,h=c?rt(e):null;c&&y();function y(){const E=rt(e);h&&!_r(h,E)&&n(),h=E,m=requestAnimationFrame(y)}return n(),()=>{var E;u.forEach(b=>{r&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f?.(),(E=g)==null||E.disconnect(),g=null,c&&cancelAnimationFrame(m)}}const ra=Wc,sa=Vc,ia=Nc,ca=Hc,aa=Bc,la=jc,ua=(e,t,n)=>{const o=new Map,r={platform:na,...n},s={...r.platform,_c:o};return Dc(e,t,{...r,platform:s})};var fa=typeof document<"u",da=function(){},_t=fa?d.useLayoutEffect:da;function en(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!en(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!en(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Yr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function No(e,t){const n=Yr(e);return Math.round(t*n)/n}function wn(e){const t=d.useRef(e);return _t(()=>{t.current=e}),t}function pa(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,f]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=d.useState(o);en(p,o)||g(o);const[m,h]=d.useState(null),[y,E]=d.useState(null),b=d.useCallback(w=>{w!==C.current&&(C.current=w,h(w))},[]),R=d.useCallback(w=>{w!==T.current&&(T.current=w,E(w))},[]),v=s||m,S=i||y,C=d.useRef(null),T=d.useRef(null),I=d.useRef(u),N=c!=null,k=wn(c),F=wn(r),A=wn(l),O=d.useCallback(()=>{if(!C.current||!T.current)return;const w={placement:t,strategy:n,middleware:p};F.current&&(w.platform=F.current),ua(C.current,T.current,w).then(L=>{const Q={...L,isPositioned:A.current!==!1};D.current&&!en(I.current,Q)&&(I.current=Q,Ke.flushSync(()=>{f(Q)}))})},[p,t,n,F,A]);_t(()=>{l===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(w=>({...w,isPositioned:!1})))},[l]);const D=d.useRef(!1);_t(()=>(D.current=!0,()=>{D.current=!1}),[]),_t(()=>{if(v&&(C.current=v),S&&(T.current=S),v&&S){if(k.current)return k.current(v,S,O);O()}},[v,S,O,k,N]);const P=d.useMemo(()=>({reference:C,floating:T,setReference:b,setFloating:R}),[b,R]),V=d.useMemo(()=>({reference:v,floating:S}),[v,S]),B=d.useMemo(()=>{const w={position:n,left:0,top:0};if(!V.floating)return w;const L=No(V.floating,u.x),Q=No(V.floating,u.y);return a?{...w,transform:"translate("+L+"px, "+Q+"px)",...Yr(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:Q}},[n,a,V.floating,u.x,u.y]);return d.useMemo(()=>({...u,update:O,refs:P,elements:V,floatingStyles:B}),[u,O,P,V,B])}const ga=(e,t)=>{const n=ra(e);return{name:n.name,fn:n.fn,options:[e,t]}},ma=(e,t)=>{const n=sa(e);return{name:n.name,fn:n.fn,options:[e,t]}},ha=(e,t)=>({fn:la(e).fn,options:[e,t]}),ba=(e,t)=>{const n=ia(e);return{name:n.name,fn:n.fn,options:[e,t]}},ya=(e,t)=>{const n=ca(e);return{name:n.name,fn:n.fn,options:[e,t]}},va=(e,t)=>{const n=aa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ea={intentional:"onClick",sloppy:"onPointerDown"};function Ra(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Ur(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:c}=n.context,{enabled:l=!0,escapeKey:u=!0,outsidePress:f=!0,outsidePressEvent:p="sloppy",referencePress:g=!1,referencePressEvent:m="sloppy",ancestorScroll:h=!1,bubbles:y,externalTree:E}=t,b=xt(E),R=Y(typeof f=="function"?f:()=>!1),v=typeof f=="function"?R:f,S=d.useRef(!1),{escapeKey:C,outsidePress:T}=Ra(y),I=d.useRef(null),N=ot(),k=ot(),F=Y(()=>{k.clear(),c.current.insideReactTree=!1}),A=d.useRef(!1),O=d.useRef(""),D=Y(x=>{O.current=x.pointerType}),P=Y(()=>{const x=O.current,U=x==="pen"||!x?"mouse":x,$=typeof p=="function"?p():p;return typeof $=="string"?$:$[U]}),V=Y(x=>{if(!o||!l||!u||x.key!=="Escape"||A.current)return;const U=c.current.floatingContext?.nodeId,$=b?nt(b.nodesRef.current,U):[];if(!C&&$.length>0){let W=!0;if($.forEach(q=>{q.context?.open&&!q.context.dataRef.current.__escapeKeyBubbles&&(W=!1)}),!W)return}const ue=Ci(x)?x.nativeEvent:x,M=ce(Or,ue);n.setOpen(!1,M),!C&&!M.isPropagationAllowed&&x.stopPropagation()}),B=Y(x=>{const U=P();return U==="intentional"&&x.type!=="click"||U==="sloppy"&&x.type==="click"}),w=Y(()=>{c.current.insideReactTree=!0,k.start(0,F)}),L=Y((x,U=!1)=>{if(B(x)){F();return}if(c.current.insideReactTree){F();return}if(P()==="intentional"&&U||typeof v=="function"&&!v(x))return;const $=xe(x),ue=`[${kt("inert")}]`,M=fe(n.select("floatingElement")).querySelectorAll(ue),W=n.context.triggerElements;if($&&(W.hasElement($)||W.hasMatchingElement(j=>re(j,$))))return;let q=ie($)?$:null;for(;q&&!je(q);){const j=He(q);if(je(j)||!ie(j))break;q=j}if(M.length&&ie($)&&!wi($)&&!re($,n.select("floatingElement"))&&Array.from(M).every(j=>!re(q,j)))return;if(me($)&&!("touches"in x)){const j=je($),be=Ce($),ae=/auto|scroll/,We=j||ae.test(be.overflowX),Qe=j||ae.test(be.overflowY),at=We&&$.clientWidth>0&&$.scrollWidth>$.clientWidth,et=Qe&&$.clientHeight>0&&$.scrollHeight>$.clientHeight,ye=be.direction==="rtl",Me=et&&(ye?x.offsetX<=$.offsetWidth-$.clientWidth:x.offsetX>$.clientWidth),Ae=at&&x.offsetY>$.clientHeight;if(Me||Ae)return}const te=c.current.floatingContext?.nodeId,oe=b&&nt(b.nodesRef.current,te).some(j=>Pe(x,j.context?.elements.floating));if(Pe(x,n.select("floatingElement"))||Pe(x,n.select("domReferenceElement"))||oe)return;const H=b?nt(b.nodesRef.current,te):[];if(H.length>0){let j=!0;if(H.forEach(be=>{be.context?.open&&!be.context.dataRef.current.__outsidePressBubbles&&(j=!1)}),!j)return}n.setOpen(!1,ce(Tr,x)),F()}),Q=Y(x=>{P()!=="sloppy"||x.pointerType==="touch"||!n.select("open")||!l||Pe(x,n.select("floatingElement"))||Pe(x,n.select("domReferenceElement"))||L(x)}),G=Y(x=>{if(P()!=="sloppy"||!n.select("open")||!l||Pe(x,n.select("floatingElement"))||Pe(x,n.select("domReferenceElement")))return;const U=x.touches[0];U&&(I.current={startTime:Date.now(),startX:U.clientX,startY:U.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},N.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}),X=Y(x=>{const U=xe(x);function $(){G(x),U?.removeEventListener(x.type,$)}U?.addEventListener(x.type,$)}),Z=Y(x=>{const U=S.current;if(S.current=!1,N.clear(),x.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const $=xe(x);function ue(){x.type==="pointerdown"?Q(x):L(x,U),$?.removeEventListener(x.type,ue)}$?.addEventListener(x.type,ue)}),_=Y(x=>{if(P()!=="sloppy"||!I.current||Pe(x,n.select("floatingElement"))||Pe(x,n.select("domReferenceElement")))return;const U=x.touches[0];if(!U)return;const $=Math.abs(U.clientX-I.current.startX),ue=Math.abs(U.clientY-I.current.startY),M=Math.sqrt($*$+ue*ue);M>5&&(I.current.dismissOnTouchEnd=!0),M>10&&(L(x),N.clear(),I.current=null)}),ne=Y(x=>{const U=xe(x);function $(){_(x),U?.removeEventListener(x.type,$)}U?.addEventListener(x.type,$)}),z=Y(x=>{P()!=="sloppy"||!I.current||Pe(x,n.select("floatingElement"))||Pe(x,n.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&L(x),N.clear(),I.current=null)}),J=Y(x=>{const U=xe(x);function $(){z(x),U?.removeEventListener(x.type,$)}U?.addEventListener(x.type,$)});d.useEffect(()=>{if(!o||!l)return;c.current.__escapeKeyBubbles=C,c.current.__outsidePressBubbles=T;const x=new Ge;function U(q){n.setOpen(!1,ce(fc,q))}function $(){x.clear(),A.current=!0}function ue(){x.start(on()?5:0,()=>{A.current=!1})}const M=fe(r);M.addEventListener("pointerdown",D,!0),u&&(M.addEventListener("keydown",V),M.addEventListener("compositionstart",$),M.addEventListener("compositionend",ue)),v&&(M.addEventListener("click",Z,!0),M.addEventListener("pointerdown",Z,!0),M.addEventListener("touchstart",X,!0),M.addEventListener("touchmove",ne,!0),M.addEventListener("touchend",J,!0),M.addEventListener("mousedown",Z,!0));let W=[];return h&&(ie(i)&&(W=ze(i)),ie(r)&&(W=W.concat(ze(r))),!ie(s)&&s&&s.contextElement&&(W=W.concat(ze(s.contextElement)))),W=W.filter(q=>q!==M.defaultView?.visualViewport),W.forEach(q=>{q.addEventListener("scroll",U,{passive:!0})}),()=>{M.removeEventListener("pointerdown",D,!0),u&&(M.removeEventListener("keydown",V),M.removeEventListener("compositionstart",$),M.removeEventListener("compositionend",ue)),v&&(M.removeEventListener("click",Z,!0),M.removeEventListener("pointerdown",Z,!0),M.removeEventListener("touchstart",X,!0),M.removeEventListener("touchmove",ne,!0),M.removeEventListener("touchend",J,!0),M.removeEventListener("mousedown",Z,!0)),W.forEach(q=>{q.removeEventListener("scroll",U)}),x.clear(),S.current=!1}},[c,r,s,i,u,v,o,a,h,l,C,T,V,L,Z,Q,X,ne,J,D,n]),d.useEffect(F,[v,F]);const de=d.useMemo(()=>({onKeyDown:V,...g&&{[Ea[m]]:x=>{n.setOpen(!1,ce(qe,x.nativeEvent))},...m!=="intentional"&&{onClick(x){n.setOpen(!1,ce(qe,x.nativeEvent))}}}}),[V,n,g,m]),pe=Y(x=>{const U=xe(x.nativeEvent);!re(n.select("floatingElement"),U)||x.button!==0||(S.current=!0)}),ge=Y(x=>{!o||!l||x.button!==0||(S.current=!0)}),$e=d.useMemo(()=>({onKeyDown:V,onPointerDown:pe,onMouseDown:pe,onMouseUp:pe,onClickCapture:w,onMouseDownCapture(x){w(),ge(x)},onPointerDownCapture(x){w(),ge(x)},onMouseUpCapture:w,onTouchEndCapture:w,onTouchMoveCapture:w}),[V,pe,w,ge]);return d.useMemo(()=>l?{reference:de,floating:$e,trigger:de}:{},[l,de,$e])}const xa={open:K(e=>e.open),domReferenceElement:K(e=>e.domReferenceElement),referenceElement:K(e=>e.positionReference??e.referenceElement),floatingElement:K(e=>e.floatingElement),floatingId:K(e=>e.floatingId)};class Zn extends Vn{constructor(t){const{nested:n,noEmit:o,onOpenChange:r,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:xr(),nested:n,noEmit:o,triggerElements:s},xa)}setOpen=(t,n)=>{if((!t||!this.state.open||ur(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(t,n)}}function wa(e,t=!1,n=!1){const[o,r]=d.useState(e&&t?"idle":void 0),[s,i]=d.useState(e);return e&&!s&&(i(!0),r("starting")),!e&&s&&o!=="ending"&&!n&&r("ending"),!e&&!s&&o==="ending"&&r(void 0),se(()=>{if(!e&&s&&o!=="ending"&&n){const a=Fe.request(()=>{r("ending")});return()=>{Fe.cancel(a)}}},[e,s,o,n]),se(()=>{if(!e||t)return;const a=Fe.request(()=>{r(void 0)});return()=>{Fe.cancel(a)}},[t,e]),se(()=>{if(!e||!t)return;e&&s&&o!=="idle"&&r("starting");const a=Fe.request(()=>{r("idle")});return()=>{Fe.cancel(a)}},[t,e,s,r,o]),d.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:o}),[s,o])}let Mt=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Sa={[Mt.startingStyle]:""},Ca={[Mt.endingStyle]:""},cn={transitionStatus(e){return e==="starting"?Sa:e==="ending"?Ca:null}};function zr(e,t=!1,n=!0){const o=Hn();return Y((r,s=null)=>{o.cancel();function i(){Ke.flushSync(r)}const a=Ve(e);if(a==null)return;const c=a;if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)r();else{let l=function(){const f=Mt.startingStyle;if(!c.hasAttribute(f)){o.request(u);return}const p=new MutationObserver(()=>{c.hasAttribute(f)||(p.disconnect(),u())});p.observe(c,{attributes:!0,attributeFilter:[f]}),s?.addEventListener("abort",()=>p.disconnect(),{once:!0})},u=function(){Promise.all(c.getAnimations().map(f=>f.finished)).then(()=>{s?.aborted||i()}).catch(()=>{const f=c.getAnimations();if(n){if(s?.aborted)return;i()}else f.length>0&&f.some(p=>p.pending||p.playState!=="finished")&&u()})};if(t){l();return}o.request(u)}})}function Jn(e){const{enabled:t=!0,open:n,ref:o,onComplete:r}=e,s=Y(r),i=zr(o,n,!1);d.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}function Ta(e,t){const n=d.useRef(null),o=d.useRef(null);return d.useCallback(r=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=o.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,o.current=null}r!==null&&(n.current=e,o.current=r,t.context.triggerElements.add(e,r))}},[t,e])}function Oa(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Ta(e,n),i=Y(a=>{if(s(a),!a||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===e){n.update({activeTriggerElement:a,...o});return}c==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...o})});return se(()=>{r&&n.update({activeTriggerElement:t.current,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:i,isMountedByThisTrigger:r}}function qr(e){const t=e.useState("open");se(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[o,r]=n.value;e.update({activeTriggerId:o,activeTriggerElement:r})}}},[t,e])}function Kr(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=wa(e);t.useSyncedValues({mounted:o,transitionStatus:s});const i=Y(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return Jn({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class an{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const o=this.idMap.get(t);o!==n&&(o!==void 0&&this.elements.delete(o),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function Pa(){return new Zn({open:!1,floatingElement:null,referenceElement:null,triggerElements:new an,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Gr(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Pa(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:Ee,inactiveTriggerProps:Ee,popupProps:Ee}}const Xr={open:K(e=>e.open),mounted:K(e=>e.mounted),transitionStatus:K(e=>e.transitionStatus),floatingRootContext:K(e=>e.floatingRootContext),preventUnmountingOnClose:K(e=>e.preventUnmountingOnClose),payload:K(e=>e.payload),activeTriggerId:K(e=>e.activeTriggerId),activeTriggerElement:K(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:K((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:K((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:K((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:K((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:K(e=>e.popupProps),popupElement:K(e=>e.popupElement),positionerElement:K(e=>e.positionerElement)};function Ia(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=Rt(),s=it()!=null,i=ke(()=>new Zn({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new an,floatingId:r,nested:s,noEmit:e.noEmit||!1})).current;return se(()=>{const a={open:t,floatingId:r};o.reference!==void 0&&(a.referenceElement=o.reference,a.domReferenceElement=ie(o.reference)?o.reference:null),o.floating!==void 0&&(a.floatingElement=o.floating),i.update(a)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function ka(e={}){const{nodeId:t,externalTree:n}=e,o=Ia(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,a]=d.useState(null),c=d.useRef(null),l=xt(n);se(()=>{s.domReference&&(c.current=s.domReference)},[s.domReference]);const u=pa({...e,elements:{...s,...i&&{reference:i}}}),f=d.useCallback(T=>{const I=ie(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;a(I),u.refs.setReference(I)},[u.refs]),[p,g]=d.useState(null),[m,h]=d.useState(null);r.useSyncedValue("referenceElement",p),r.useSyncedValue("domReferenceElement",ie(p)?p:null),r.useSyncedValue("floatingElement",m);const y=d.useCallback(T=>{(ie(T)||T===null)&&(c.current=T,g(T)),(ie(u.refs.reference.current)||u.refs.reference.current===null||T!==null&&!ie(T))&&u.refs.setReference(T)},[u.refs,g]),E=d.useCallback(T=>{h(T),u.refs.setFloating(T)},[u.refs]),b=d.useMemo(()=>({...u.refs,setReference:y,setFloating:E,setPositionReference:f,domReference:c}),[u.refs,y,E,f]),R=d.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),v=r.useState("open"),S=r.useState("floatingId"),C=d.useMemo(()=>({...u,dataRef:r.context.dataRef,open:v,onOpenChange:r.setOpen,events:r.context.events,floatingId:S,refs:b,elements:R,nodeId:t,rootStore:r}),[u,b,R,t,r,v,S]);return se(()=>{r.context.dataRef.current.floatingContext=C;const T=l?.nodesRef.current.find(I=>I.id===t);T&&(T.context=C)}),d.useMemo(()=>({...u,context:C,refs:b,elements:R,rootStore:r}),[u,b,R,C,r])}function Zr(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:r}=e,s=Rt(),i=it()!=null,a=t.useState("open"),c=t.useState("activeTriggerElement"),l=t.useState(o?"popupElement":"positionerElement"),u=t.context.triggerElements,f=ke(()=>new Zn({open:a,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:r,floatingId:s,nested:i,noEmit:n})).current;return se(()=>{const p={open:a,floatingId:s,referenceElement:c,floatingElement:l};ie(c)&&(p.domReferenceElement=c),f.state.positionReference===f.state.referenceElement&&(p.positionReference=c),f.update(p)},[a,s,c,l,f]),f.context.onOpenChange=r,f.context.nested=i,f.context.noEmit=n,f}const Bn=kt("safe-polygon"),Ma=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${ar}`;function Aa(e){return e?!!e.closest(Ma):!1}function Jr(e){const t=d.useRef(void 0),n=d.useRef(!1),o=d.useRef(void 0),r=d.useRef(!0),s=d.useRef(!1),i=d.useRef(()=>{}),a=d.useRef(!1),c=ot(),l=ot(),u=d.useRef(void 0);return d.useMemo(()=>{const f=e.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:u}),f.hoverInteractionState},[e,t,n,o,r,s,i,a,c,l,u])}const La=new Set(["click","mousedown"]);function Fa(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:u,interactedInsideRef:f,handlerRef:p,performedPointerEventsMutationRef:g,unbindMouseMoveRef:m,restTimeoutPendingRef:h,openChangeTimeout:y,handleCloseOptionsRef:E}=Jr(n),b=xt(l),R=it(),v=Y(()=>f.current?!0:i.current.openEvent?La.has(i.current.openEvent.type):!1),S=Y(()=>{const k=i.current.openEvent?.type;return k?.includes("mouse")&&k!=="mousedown"}),C=d.useCallback((k,F=!0)=>{const A=Da(c,u.current);A&&!p.current?y.start(A,()=>n.setOpen(!1,ce(Se,k))):F&&(y.clear(),n.setOpen(!1,ce(Se,k)))},[c,p,n,u,y]),T=Y(()=>{m.current(),p.current=void 0}),I=Y(()=>{if(g.current){const k=fe(r).body;k.style.pointerEvents="",k.removeAttribute(Bn),g.current=!1}}),N=Y(k=>{const F=xe(k);if(!Aa(F)){f.current=!1;return}f.current=!0});se(()=>{o||(u.current=void 0,h.current=!1,f.current=!1,T(),I())},[o,u,h,f,T,I]),d.useEffect(()=>()=>{T()},[T]),d.useEffect(()=>I,[I]),se(()=>{if(a&&o&&E.current?.blockPointerEvents&&S()&&ie(s)&&r){g.current=!0;const k=fe(r).body;k.setAttribute(Bn,"");const F=s,A=r,O=b?.nodesRef.current.find(D=>D.id===R)?.context?.elements.floating;return O&&(O.style.pointerEvents=""),k.style.pointerEvents="none",F.style.pointerEvents="auto",A.style.pointerEvents="auto",()=>{k.style.pointerEvents="",F.style.pointerEvents="",A.style.pointerEvents=""}}},[a,o,s,r,E,S,b,R,g]),d.useEffect(()=>{if(!a)return;function k(D){if(v()||!i.current.floatingContext||!n.select("open"))return;const P=n.context.triggerElements;D.relatedTarget&&P.hasElement(D.relatedTarget)||(I(),T(),v()||C(D))}function F(D){y.clear(),I(),p.current?.(D),T()}function A(D){v()||C(D,!1)}const O=r;return O&&(O.addEventListener("mouseleave",k),O.addEventListener("mouseenter",F),O.addEventListener("mouseleave",A),O.addEventListener("pointerdown",N,!0)),()=>{O&&(O.removeEventListener("mouseleave",k),O.removeEventListener("mouseenter",F),O.removeEventListener("mouseleave",A),O.removeEventListener("pointerdown",N,!0))}})}function Da(e,t){return t&&!mt(t)?0:typeof e=="function"?e():e}function Sn(e){return typeof e=="function"?e():e}const Na={current:null};function Ba(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:f=Na,externalTree:p,isActiveTrigger:g=!0}=t,m=xt(p),{pointerTypeRef:h,interactedInsideRef:y,handlerRef:E,blockMouseMoveRef:b,performedPointerEventsMutationRef:R,unbindMouseMoveRef:v,restTimeoutPendingRef:S,openChangeTimeout:C,restTimeout:T,handleCloseOptionsRef:I}=Jr(n),N=De(a),k=De(i),F=De(l);g&&(I.current=N.current?.__options);const A=Y(()=>y.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),O=d.useCallback((B,w=!0)=>{const L=yn(k.current,"close",h.current);L&&!E.current?C.start(L,()=>n.setOpen(!1,ce(Se,B))):w&&(C.clear(),n.setOpen(!1,ce(Se,B)))},[k,E,n,h,C]),D=Y(()=>{v.current(),E.current=void 0}),P=Y(()=>{if(R.current){const B=fe(n.select("domReferenceElement")).body;B.style.pointerEvents="",B.removeAttribute(Bn),R.current=!1}});d.useEffect(()=>{if(!s)return;function B(w){w.open||(C.clear(),T.clear(),b.current=!0,S.current=!1)}return r.on("openchange",B),()=>{r.off("openchange",B)}},[s,r,C,T,b,S]);const V=Y(B=>{if(A()||!o.current.floatingContext)return;const w=n.context.triggerElements;if(B.relatedTarget&&w.hasElement(B.relatedTarget))return;const L=f.current;N.current?.({...o.current.floatingContext,tree:m,x:B.clientX,y:B.clientY,onClose(){P(),D(),!A()&&L===n.select("domReferenceElement")&&O(B)}})(B)});return d.useEffect(()=>{if(!s)return;const B=f.current??(g?n.select("domReferenceElement"):null);if(!ie(B))return;function w(G){if(C.clear(),b.current=!1,c&&!mt(h.current)||Sn(F.current)>0&&!yn(k.current,"open"))return;const X=yn(k.current,"open",h.current),Z=n.select("domReferenceElement"),_=n.context.triggerElements,ne=(_.hasElement(G.target)||_.hasMatchingElement(pe=>re(pe,G.target)))&&(!Z||!re(Z,G.target)),z=G.currentTarget??null,J=n.select("open"),de=!J||ne;ne&&J?n.setOpen(!0,ce(Se,G,z)):X?C.start(X,()=>{de&&n.setOpen(!0,ce(Se,G,z))}):de&&n.setOpen(!0,ce(Se,G,z))}function L(G){if(A()){P();return}v.current();const X=n.select("domReferenceElement"),Z=fe(X);T.clear(),S.current=!1;const _=n.context.triggerElements;if(G.relatedTarget&&_.hasElement(G.relatedTarget))return;if(N.current&&o.current.floatingContext){n.select("open")||C.clear();const z=f.current;E.current=N.current({...o.current.floatingContext,tree:m,x:G.clientX,y:G.clientY,onClose(){P(),D(),!A()&&z===n.select("domReferenceElement")&&O(G,!0)}});const J=E.current;J(G),Z.addEventListener("mousemove",J),v.current=()=>{Z.removeEventListener("mousemove",J)};return}(h.current!=="touch"||!re(n.select("floatingElement"),G.relatedTarget))&&O(G)}function Q(G){V(G)}return n.select("open")&&B.addEventListener("mouseleave",Q),u&&B.addEventListener("mousemove",w,{once:!0}),B.addEventListener("mouseenter",w),B.addEventListener("mouseleave",L),()=>{B.removeEventListener("mouseleave",Q),u&&B.removeEventListener("mousemove",w),B.removeEventListener("mouseenter",w),B.removeEventListener("mouseleave",L)}},[D,P,b,o,k,O,n,s,N,V,g,A,c,u,h,F,T,S,C,f,m,v,E]),d.useMemo(()=>{function B(w){h.current=w.pointerType}return{onPointerDown:B,onPointerEnter:B,onMouseMove(w){const{nativeEvent:L}=w,Q=w.currentTarget,G=n.select("domReferenceElement"),X=n.context.triggerElements,Z=n.select("open"),_=(X.hasElement(w.target)||X.hasMatchingElement(z=>re(z,w.target)))&&(!G||!re(G,w.target));if(c&&!mt(h.current)||Z&&!_||Sn(F.current)===0||!_&&S.current&&w.movementX**2+w.movementY**2<2)return;T.clear();function ne(){if(S.current=!1,A())return;const z=n.select("open");!b.current&&(!z||_)&&n.setOpen(!0,ce(Se,L,Q))}h.current==="touch"?Ke.flushSync(()=>{ne()}):_&&Z?ne():(S.current=!0,T.start(Sn(F.current),ne))}}},[b,A,c,n,h,F,T,S])}function Qn(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),o=e.map(l=>l?.item),r=e.map(l=>l?.trigger),s=d.useCallback(l=>Ht(l,e,"reference"),t),i=d.useCallback(l=>Ht(l,e,"floating"),n),a=d.useCallback(l=>Ht(l,e,"item"),o),c=d.useCallback(l=>Ht(l,e,"trigger"),r);return d.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:c}),[s,i,a,c])}function Ht(e,t,n){const o=new Map,r=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Pn]="");for(const i in e)r&&e&&(i===ir||i===cr)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const c=t[i]?.[n];typeof c=="function"?a=e?c(e):null:a=c,a&&Bo(s,a,r,o)}return Bo(s,e,r,o),s}function Bo(e,t,n,o){for(const r in t){const s=t[r];n&&(r===ir||r===cr)||(r.startsWith("on")?(o.has(r)||o.set(r,[]),typeof s=="function"&&(o.get(r)?.push(s),e[r]=(...i)=>o.get(r)?.map(a=>a(...i)).find(a=>a!==void 0))):e[r]=s)}}const $a=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Qr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:a=!0,role:c="dialog"}=t,l=Rt(),u=s?.id||l,f=d.useMemo(()=>In(i)?.id||r,[i,r]),p=$a.get(c)??c,m=it()!=null,h=d.useMemo(()=>p==="tooltip"||c==="label"?Ee:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&m&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[p,m,c]),y=d.useMemo(()=>p==="tooltip"||c==="label"?{[`aria-${c==="label"?"labelledby":"describedby"}`]:o?f:void 0}:{...h,"aria-expanded":o?"true":"false","aria-controls":o?f:void 0,...p==="menu"&&{id:u}},[p,f,o,u,c,h]),E=d.useMemo(()=>{const R={id:f,...p&&{role:p}};return p==="tooltip"||c==="label"?R:{...R,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,c]),b=d.useCallback(({active:R,selected:v})=>{const S={role:"option",...R&&{id:`${f}-fui-option`}};switch(c){case"select":case"combobox":return{...S,"aria-selected":v}}return{}},[f,c]);return d.useMemo(()=>a?{reference:y,floating:E,item:b,trigger:h}:{},[a,y,E,h,b])}function $o(e,t){const[n,o]=e;let r=!1;const s=t.length;for(let i=0,a=s-1;i<s;a=i++){const[c,l]=t[i]||[0,0],[u,f]=t[a]||[0,0];l>=o!=f>=o&&n<=(u-c)*(o-l)/(f-l)+c&&(r=!r)}return r}function Wa(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Va(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r=new Ge;let s=!1,i=null,a=null,c=typeof performance<"u"?performance.now():0;function l(f,p){const g=performance.now(),m=g-c;if(i===null||a===null||m===0)return i=f,a=p,c=g,null;const h=f-i,y=p-a,b=Math.sqrt(h*h+y*y)/m;return i=f,a=p,c=g,b}const u=({x:f,y:p,placement:g,elements:m,onClose:h,nodeId:y,tree:E})=>function(R){function v(){r.clear(),h()}if(r.clear(),!m.domReference||!m.floating||g==null||f==null||p==null)return;const{clientX:S,clientY:C}=R,T=[S,C],I=xe(R),N=R.type==="mouseleave",k=re(m.floating,I),F=re(m.domReference,I),A=m.domReference.getBoundingClientRect(),O=m.floating.getBoundingClientRect(),D=g.split("-")[0],P=f>O.right-O.width/2,V=p>O.bottom-O.height/2,B=Wa(T,A),w=O.width>A.width,L=O.height>A.height,Q=(w?A:O).left,G=(w?A:O).right,X=(L?A:O).top,Z=(L?A:O).bottom;if(k&&(s=!0,!N))return;if(F&&(s=!1),F&&!N){s=!0;return}if(N&&ie(R.relatedTarget)&&re(m.floating,R.relatedTarget)||E&&nt(E.nodesRef.current,y).some(({context:z})=>z?.open))return;if(D==="top"&&p>=A.bottom-1||D==="bottom"&&p<=A.top+1||D==="left"&&f>=A.right-1||D==="right"&&f<=A.left+1)return v();let _=[];switch(D){case"top":_=[[Q,A.top+1],[Q,O.bottom-1],[G,O.bottom-1],[G,A.top+1]];break;case"bottom":_=[[Q,O.top+1],[Q,A.bottom-1],[G,A.bottom-1],[G,O.top+1]];break;case"left":_=[[O.right-1,Z],[O.right-1,X],[A.left+1,X],[A.left+1,Z]];break;case"right":_=[[A.right-1,Z],[A.right-1,X],[O.left+1,X],[O.left+1,Z]];break}function ne([z,J]){switch(D){case"top":{const de=[w?z+t/2:P?z+t*4:z-t*4,J+t+1],pe=[w?z-t/2:P?z+t*4:z-t*4,J+t+1],ge=[[O.left,P||w?O.bottom-t:O.top],[O.right,P?w?O.bottom-t:O.top:O.bottom-t]];return[de,pe,...ge]}case"bottom":{const de=[w?z+t/2:P?z+t*4:z-t*4,J-t],pe=[w?z-t/2:P?z+t*4:z-t*4,J-t],ge=[[O.left,P||w?O.top+t:O.bottom],[O.right,P?w?O.top+t:O.bottom:O.top+t]];return[de,pe,...ge]}case"left":{const de=[z+t+1,L?J+t/2:V?J+t*4:J-t*4],pe=[z+t+1,L?J-t/2:V?J+t*4:J-t*4];return[...[[V||L?O.right-t:O.left,O.top],[V?L?O.right-t:O.left:O.right-t,O.bottom]],de,pe]}case"right":{const de=[z-t,L?J+t/2:V?J+t*4:J-t*4],pe=[z-t,L?J-t/2:V?J+t*4:J-t*4],ge=[[V||L?O.left+t:O.right,O.top],[V?L?O.left+t:O.right:O.left+t,O.bottom]];return[de,pe,...ge]}default:return[]}}if(!$o([S,C],_)){if(s&&!B)return v();if(!N&&o){const z=l(R.clientX,R.clientY);if(z!==null&&z<.1)return v()}$o([S,C],ne([f,p]))?!s&&o&&r.start(40,v):v()}};return u.__options={blockPointerEvents:n},u}function es(e){return Rt(e,"base-ui")}function ja(e){const t=d.useRef(""),n=d.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:d.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 ts(e){const[t,n]=d.useState(null),o=Y((a,c)=>{e||n(c||(sr?"touch":""))}),r=d.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=ja(o);return d.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:s,onPointerDown:i}}),[t,r,s,i])}let Ie=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Mt.startingStyle]="startingStyle",e[e.endingStyle=Mt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),$n=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Ha={[$n.popupOpen]:""},_a={[$n.popupOpen]:"",[$n.pressed]:""},Ya={[Ie.open]:""},Ua={[Ie.closed]:""},za={[Ie.anchorHidden]:""},qa={open(e){return e?Ha:null}},Ka={open(e){return e?_a:null}},Lt={open(e){return e?Ya:Ua},anchorHidden(e){return e?za:null}},Ga=d.createContext(void 0);function Xa(e=!1){const t=d.useContext(Ga);if(t===void 0&&!e)throw new Error(Ye(16));return t}function Za(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,a=o&&t===!1;return{props:d.useMemo(()=>{const l={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return o||(l.tabIndex=r,!s&&n&&(l.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||a)&&(l.disabled=n),l},[o,n,t,i,a,s,r])}}function Ja(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0}=e,s=d.useRef(null),i=Xa(!0)!==void 0,a=Y(()=>{const p=s.current;return!!(p?.tagName==="A"&&p?.href)}),{props:c}=Za({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:o,isNativeButton:r}),l=d.useCallback(()=>{const p=s.current;Qa(p)&&i&&t&&c.disabled===void 0&&p.disabled&&(p.disabled=!1)},[t,c.disabled,i]);se(l,[l]);const u=d.useCallback((p={})=>{const{onClick:g,onMouseDown:m,onKeyUp:h,onKeyDown:y,onPointerDown:E,...b}=p;return kr({type:r?"button":void 0,onClick(v){if(t){v.preventDefault();return}g?.(v)},onMouseDown(v){t||m?.(v)},onKeyDown(v){if(t||(Nn(v),y?.(v)),v.baseUIHandlerPrevented)return;const S=v.target===v.currentTarget&&!r&&!a()&&!t,C=v.key==="Enter",T=v.key===" ";S&&((T||C)&&v.preventDefault(),C&&g?.(v))},onKeyUp(v){t||(Nn(v),h?.(v)),!v.baseUIHandlerPrevented&&v.target===v.currentTarget&&!r&&!t&&v.key===" "&&g?.(v)},onPointerDown(v){if(t){v.preventDefault();return}E?.(v)}},r?void 0:{role:"button"},c,b)},[t,c,r,a]),f=Y(p=>{s.current=p,l()});return{getButtonProps:u,buttonRef:f}}function Qa(e){return me(e)&&e.tagName==="BUTTON"}function ns(e){return Wn(19)?e:e?"true":void 0}let Wo={},Vo={},jo="";function el(e){if(typeof document>"u")return!1;const t=ct(e);return he(t).innerWidth-t.documentElement.clientWidth>0}function tl(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=ct(e).documentElement,r={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const s=o.offsetWidth;o.style.overflowY="hidden";const i=o.offsetWidth;return Object.assign(o.style,r),s===i}function nl(e){const t=ct(e),n=t.documentElement,o=t.body,r=st(n)?n:o,s=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=s}}function ol(e){const t=ct(e),n=t.documentElement,o=t.body,r=he(n);let s=0,i=0,a=!1;const c=Fe.create();if(bi&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){const p=r.getComputedStyle(n),g=r.getComputedStyle(o),y=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Wo={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},jo=n.style.scrollBehavior,Vo={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,R=p.overflowY==="scroll"||g.overflowY==="scroll",v=p.overflowX==="scroll"||g.overflowX==="scroll",S=Math.max(0,r.innerWidth-o.clientWidth),C=Math.max(0,r.innerHeight-o.clientHeight),T=parseFloat(g.marginTop)+parseFloat(g.marginBottom),I=parseFloat(g.marginLeft)+parseFloat(g.marginRight),N=st(n)?n:o;if(a=tl(e),a){n.style.scrollbarGutter=y,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||R)&&(n.style.overflowY="scroll"),(b||v)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:T||C?`calc(100dvh - ${T+C}px)`:"100dvh",width:I||S?`calc(100vw - ${I+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,Wo),Object.assign(o.style,Vo),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=jo)}function f(){u(),c.request(l)}return l(),r.addEventListener("resize",f),()=>{c.cancel(),u(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",f)}}class rl{lockCount=0;restore=null;timeoutLock=Ge.create();timeoutUnlock=Ge.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const o=ct(t).documentElement,r=he(o).getComputedStyle(o).overflowY;if(r==="hidden"||r==="clip"){this.restore=tr;return}const s=sr||!el(t);this.restore=s?nl(t):ol(t)}}const sl=new rl;function os(e=!0,t=null){se(()=>{if(e)return sl.acquire(t)},[e,t])}const il=d.createContext(void 0);function cl(){return d.useContext(il)?.direction??"ltr"}const al=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:f="real"}=_e(e,t)||{};if(l==null)return{};const p=fr(u),g={x:n,y:o},m=qn(r),h=zn(m),y=await i.getDimensions(l),E=m==="y",b=E?"top":"left",R=E?"bottom":"right",v=E?"clientHeight":"clientWidth",S=s.reference[h]+s.reference[m]-g[m]-s.floating[h],C=g[m]-s.reference[m],T=f==="real"?await i.getOffsetParent?.(l):a.floating;let I=a.floating[v]||s.floating[h];(!I||!await i.isElement?.(T))&&(I=a.floating[v]||s.floating[h]);const N=S/2-C/2,k=I/2-y[h]/2-1,F=Math.min(p[b],k),A=Math.min(p[R],k),O=F,D=I-y[h]-A,P=I/2-y[h]/2+N,V=kn(O,P,D),B=!c.arrow&&Ze(r)!=null&&P!==V&&s.reference[h]/2-(P<O?F:A)-y[h]/2<0,w=B?P<O?P-O:P-D:0;return{[m]:g[m]+w,data:{[m]:V,centerOffset:P-V-w,...B&&{alignmentOffset:w}},reset:B}}}),ll=(e,t)=>({...al(e),options:[e,t]}),ul={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;return{data:{referenceHidden:(await va().fn(e)).data?.referenceHidden||s}}}},Yt={sideX:"left",sideY:"top"},fl={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:a}=e,c=he(r),l=c.getComputedStyle(r);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:Yt};const f=await s.getOffsetParent?.(r);let p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(f===c){const b=ct(r);p={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(f)&&(p=await s.getDimensions(f));const g=Re(a);let m=t,h=n;g==="left"&&(m=p.width-(t+o.width)),g==="top"&&(h=p.height-(n+o.height));const y=g==="left"?"right":Yt.sideX,E=g==="top"?"bottom":Yt.sideY;return{x:m,y:h,data:{sideX:y,sideY:E}}}};function rs(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 Ho(e,t,n){const{rects:o,placement:r}=e;return{side:rs(t,Re(r),n),align:Ze(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function dl(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:f=!1,keepMounted:p=!1,floatingRootContext:g,mounted:m,collisionAvoidance:h,shiftCrossAxis:y=!1,nodeId:E,adaptiveOrigin:b,lazyFlip:R=!1,externalTree:v}=e,[S,C]=d.useState(null);!m&&S!==null&&C(null);const T=h.side||"flip",I=h.align||"flip",N=h.fallbackAxisSide||"end",k=typeof t=="function"?t:void 0,F=Y(k),A=k?F:t,O=De(t),P=cl()==="rtl",V=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[o],B=s==="center"?V:`${V}-${s}`;let w=c;const L=1,Q=o==="bottom"?L:0,G=o==="top"?L:0,X=o==="right"?L:0,Z=o==="left"?L:0;typeof w=="number"?w={top:w+Q,right:w+Z,bottom:w+G,left:w+X}:w&&(w={top:(w.top||0)+Q,right:(w.right||0)+Z,bottom:(w.bottom||0)+G,left:(w.left||0)+X});const _={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:w},ne=d.useRef(null),z=De(r),J=De(i),ge=[ga(le=>{const ve=Ho(le,o,P),Le=typeof z.current=="function"?z.current(ve):z.current,Te=typeof J.current=="function"?J.current(ve):J.current;return{mainAxis:Le,crossAxis:Te,alignmentAxis:Te}},[typeof r!="function"?r:0,typeof i!="function"?i:0,P,o])],$e=I==="none"&&T!=="shift",x=!$e&&(l||y||T==="shift"),U=T==="none"?null:ba({..._,padding:{top:w.top+L,right:w.right+L,bottom:w.bottom+L,left:w.left+L},mainAxis:!y&&T==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:N}),$=$e?null:ma(le=>{const ve=ct(le.elements.floating).documentElement;return{..._,rootBoundary:y?{x:0,y:0,width:ve.clientWidth,height:ve.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:x,limiter:l||y?void 0:ha(Le=>{if(!ne.current)return{};const{width:Te,height:lt}=ne.current.getBoundingClientRect(),ut=Oe(Re(Le.placement)),Dt=ut==="y"?Te:lt,ln=ut==="y"?w.left+w.right:w.top+w.bottom;return{offset:Dt/2+ln/2}})}},[_,l,y,w,I]);T==="shift"||I==="shift"||s==="center"?ge.push($,U):ge.push(U,$),ge.push(ya({..._,apply({elements:{floating:le},rects:{reference:ve},availableWidth:Le,availableHeight:Te}){Object.entries({"--available-width":`${Le}px`,"--available-height":`${Te}px`,"--anchor-width":`${ve.width}px`,"--anchor-height":`${ve.height}px`}).forEach(([lt,ut])=>{le.style.setProperty(lt,ut)})}}),ll(()=>({element:ne.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(le){const{elements:ve,middlewareData:Le,placement:Te,rects:lt,y:ut}=le,Dt=Re(Te),ln=Oe(Dt),io=ne.current,Es=Le.arrow?.x||0,Rs=Le.arrow?.y||0,xs=io?.clientWidth||0,ws=io?.clientHeight||0,un=Es+xs/2,co=Rs+ws/2,Ss=Math.abs(Le.shift?.y||0),Cs=lt.reference.height/2,St=typeof r=="function"?r(Ho(le,o,P)):r,Ts=Ss>St,Os={top:`${un}px calc(100% + ${St}px)`,bottom:`${un}px ${-St}px`,left:`calc(100% + ${St}px) ${co}px`,right:`${-St}px ${co}px`}[Dt],Ps=`${un}px ${lt.reference.y+Cs-ut}px`;return ve.floating.style.setProperty("--transform-origin",x&&ln==="y"&&Ts?Ps:Os),{}}},ul,b),se(()=>{!m&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,g]);const ue=d.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:M,elements:W,x:q,y:te,middlewareData:oe,update:H,placement:j,context:be,isPositioned:ae,floatingStyles:We}=ka({rootContext:g,placement:B,middleware:ge,strategy:n,whileElementsMounted:p?void 0:(...le)=>Do(...le,ue),nodeId:E,externalTree:v}),{sideX:Qe,sideY:at}=oe.adaptiveOrigin||Yt,et=ae?n:"fixed",ye=d.useMemo(()=>b?{position:et,[Qe]:q,[at]:te}:{position:et,...We},[b,et,Qe,q,at,te,We]),Me=d.useRef(null);se(()=>{if(!m)return;const le=O.current,ve=typeof le=="function"?le():le,Te=(_o(ve)?ve.current:ve)||null||null;Te!==Me.current&&(M.setPositionReference(Te),Me.current=Te)},[m,M,A,O]),d.useEffect(()=>{if(!m)return;const le=O.current;typeof le!="function"&&_o(le)&&le.current!==Me.current&&(M.setPositionReference(le.current),Me.current=le.current)},[m,M,A,O]),d.useEffect(()=>{if(p&&m&&W.domReference&&W.floating)return Do(W.domReference,W.floating,H,ue)},[p,m,W,H,ue]);const Ae=Re(j),to=rs(o,Ae,P),no=Ze(j)||"center",oo=!!oe.hide?.referenceHidden;se(()=>{R&&m&&ae&&C(Ae)},[R,m,ae,Ae]);const ro=d.useMemo(()=>({position:"absolute",top:oe.arrow?.y,left:oe.arrow?.x}),[oe.arrow]),so=oe.arrow?.centerOffset!==0;return d.useMemo(()=>({positionerStyles:ye,arrowStyles:ro,arrowRef:ne,arrowUncentered:so,side:to,align:no,physicalSide:Ae,anchorHidden:oo,refs:M,context:be,isPositioned:ae,update:H}),[ye,ro,ne,so,to,no,Ae,oo,M,be,ae,H])}function _o(e){return e!=null&&"current"in e}const ss=d.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const i=o?.getBoundingClientRect();s=`polygon(
2
- 0% 0%,
3
- 100% 0%,
4
- 100% 100%,
5
- 0% 100%,
6
- 0% 0%,
7
- ${i.left}px ${i.top}px,
8
- ${i.left}px ${i.bottom}px,
9
- ${i.right}px ${i.bottom}px,
10
- ${i.right}px ${i.top}px,
11
- ${i.left}px ${i.top}px
12
- )`}return ee.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),pl=d.createContext(void 0);function gl(e){return d.useContext(pl)}const is="ArrowUp",cs="ArrowDown",as="ArrowLeft",ls="ArrowRight",us="Home",fs="End",ml=new Set([as,ls]),hl=new Set([is,cs]),bl=new Set([...ml,...hl]);[...bl];const ds=new Set([is,cs,as,ls,us,fs]);function ps(e){return e==="starting"?ac:Ee}const gs=d.createContext(void 0);function wt(e){const t=d.useContext(gs);if(e===!1&&t===void 0)throw new Error(Ye(27));return t}const yl={...Lt,...cn},ql=d.forwardRef(function(t,n){const{render:o,className:r,forceRender:s=!1,...i}=t,{store:a}=wt(),c=a.useState("open"),l=a.useState("nested"),u=a.useState("mounted"),f=a.useState("transitionStatus"),p=d.useMemo(()=>({open:c,transitionStatus:f}),[c,f]);return Je("div",t,{state:p,ref:[a.context.backdropRef,n],stateAttributesMapping:yl,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!l})});let vl=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),El=(function(e){return e[e.open=Ie.open]="open",e[e.closed=Ie.closed]="closed",e[e.startingStyle=Ie.startingStyle]="startingStyle",e[e.endingStyle=Ie.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ms=d.createContext(void 0);function hs(){const e=d.useContext(ms);if(e===void 0)throw new Error(Ye(26));return e}const Rl={...Lt,...cn,nestedDialogOpen(e){return e?{[El.nestedDialogOpen]:""}:null}},Kl=d.forwardRef(function(t,n){const{className:o,finalFocus:r,initialFocus:s,render:i,...a}=t,{store:c}=wt(),l=c.useState("descriptionElementId"),u=c.useState("disablePointerDismissal"),f=c.useState("floatingRootContext"),p=c.useState("popupProps"),g=c.useState("modal"),m=c.useState("mounted"),h=c.useState("nested"),y=c.useState("nestedOpenDialogCount"),E=c.useState("open"),b=c.useState("openMethod"),R=c.useState("titleElementId"),v=c.useState("transitionStatus"),S=c.useState("role");hs(),Jn({open:E,ref:c.context.popupRef,onComplete(){E&&c.context.onOpenChangeComplete?.(!0)}});function C(F){return F==="touch"?c.context.popupRef.current:!0}const T=s===void 0?C:s,I=y>0,N=d.useMemo(()=>({open:E,nested:h,transitionStatus:v,nestedDialogOpen:I}),[E,h,v,I]),k=Je("div",t,{state:N,props:[p,{"aria-labelledby":R??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(F){ds.has(F.key)&&F.stopPropagation()},style:{[vl.nestedDialogs]:y}},a],ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:Rl});return ee.jsx(Nr,{context:f,openInteractionType:b,disabled:!m,closeOnFocusOut:!u,initialFocus:T,returnFocus:r,modal:g!==!1,restoreFocus:"popup",children:k})}),Gl=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=wt(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||o?ee.jsx(ms.Provider,{value:o,children:ee.jsxs(Dr,{ref:n,...r,children:[i&&a===!0&&ee.jsx(ss,{ref:s.context.internalBackdropRef,inert:ns(!c)}),t.children]})}):null});function xl(e){const{store:t,parentContext:n,actionsRef:o}=e,r=t.useState("open"),s=t.useState("disablePointerDismissal"),i=t.useState("modal"),a=t.useState("popupElement"),{openMethod:c,triggerProps:l,reset:u}=ts(r);qr(t);const{forceUnmount:f}=Kr(r,t,()=>{u()}),p=Y(k=>{const F=ce(k);return F.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},F}),g=d.useCallback(()=>{t.setOpen(!1,p(Pr))},[t,p]);d.useImperativeHandle(o,()=>({unmount:f,close:g}),[f,g]);const m=Zr({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,y]=d.useState(0),E=h===0,b=Qr(m),R=Ur(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(k){if("button"in k&&k.button!==0||"touches"in k&&k.touches.length!==1)return!1;const F=xe(k);if(E&&!s){const A=F;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===A||t.context.backdropRef.current===A||re(A,a)&&!A?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:E});os(r&&i===!0,a);const{getReferenceProps:v,getFloatingProps:S,getTriggerProps:C}=Qn([b,R]);t.useContextCallback("onNestedDialogOpen",k=>{y(k+1)}),t.useContextCallback("onNestedDialogClose",()=>{y(0)}),d.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,h]);const T=d.useMemo(()=>v(l),[v,l]),I=d.useMemo(()=>C(l),[C,l]),N=d.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:c,activeTriggerProps:T,inactiveTriggerProps:I,popupProps:N,floatingRootContext:m,nestedOpenDialogCount:h})}const wl={...Xr,modal:K(e=>e.modal),nested:K(e=>e.nested),nestedOpenDialogCount:K(e=>e.nestedOpenDialogCount),disablePointerDismissal:K(e=>e.disablePointerDismissal),openMethod:K(e=>e.openMethod),descriptionElementId:K(e=>e.descriptionElementId),titleElementId:K(e=>e.titleElementId),viewportElement:K(e=>e.viewportElement),role:K(e=>e.role)};class Sl extends Vn{constructor(t){super(Cl(t),{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),triggerElements:new an,onOpenChange:void 0,onOpenChangeComplete:void 0},wl)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const o={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const r={open:t},s=n.trigger?.id??null;(s||t)&&(r.activeTriggerId=s,r.activeTriggerElement=n.trigger??null),this.update(r)}}function Cl(e={}){return{...Gr(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function Xl(e){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:f=null}=e,p=wt(!0),g=!!p,m=ke(()=>l?.store??new Sl({open:n??o,activeTriggerId:u!==void 0?u:f,modal:a,disablePointerDismissal:i,nested:g})).current;m.useControlledProp("open",n,o),m.useControlledProp("activeTriggerId",u,f),m.useSyncedValues({disablePointerDismissal:i,nested:g,modal:a}),m.useContextCallback("onOpenChange",r),m.useContextCallback("onOpenChangeComplete",s);const h=m.useState("payload");xl({store:m,actionsRef:c,parentContext:p?.store.context});const y=d.useMemo(()=>({store:m}),[m]);return ee.jsx(gs.Provider,{value:y,children:typeof t=="function"?t({payload:h}):t})}let Yo=(function(e){return e[e.open=Ie.open]="open",e[e.closed=Ie.closed]="closed",e[e.startingStyle=Ie.startingStyle]="startingStyle",e[e.endingStyle=Ie.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Tl={...Lt,...cn,nested(e){return e?{[Yo.nested]:""}:null},nestedDialogOpen(e){return e?{[Yo.nestedDialogOpen]:""}:null}},Zl=d.forwardRef(function(t,n){const{className:o,render:r,children:s,...i}=t,a=hs(),{store:c}=wt(),l=c.useState("open"),u=c.useState("nested"),f=c.useState("transitionStatus"),p=c.useState("nestedOpenDialogCount"),g=c.useState("mounted"),m=p>0,h=d.useMemo(()=>({open:l,nested:u,transitionStatus:f,nestedDialogOpen:m}),[l,u,f,m]);return Je("div",t,{enabled:a||g,state:h,ref:[n,c.useStateSetter("viewportElement")],stateAttributesMapping:Tl,props:[{role:"presentation",hidden:!g,children:s},i]})}),Jl=d.forwardRef(function(t,n){const{render:o,className:r,id:s,...i}=t,{store:a}=wt(),c=es(s);return a.useSyncedValueWithCleanup("titleElementId",c),Je("h2",t,{ref:n,props:[{id:c},i]})}),bs=d.createContext(void 0);function Ft(e){const t=d.useContext(bs);if(t===void 0&&!e)throw new Error(Ye(47));return t}function Ol(){return{...Gr(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const Pl={...Xr,disabled:K(e=>e.disabled),instantType:K(e=>e.instantType),openMethod:K(e=>e.openMethod),openChangeReason:K(e=>e.openChangeReason),modal:K(e=>e.modal),stickIfOpen:K(e=>e.stickIfOpen),titleElementId:K(e=>e.titleElementId),descriptionElementId:K(e=>e.descriptionElementId),openOnHover:K(e=>e.openOnHover),closeDelay:K(e=>e.closeDelay),hasViewport:K(e=>e.hasViewport)};class eo extends Vn{constructor(t){const n={...Ol(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:d.createRef(),beforeContentFocusGuardRef:d.createRef(),stickIfOpenTimeout:new Ge,triggerElements:new an},Pl)}setOpen=(t,n)=>{const o=n.reason===Se,r=n.reason===qe&&n.event.detail===0,s=!t&&(n.reason===Or||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const c=()=>{const l={open:t,openChangeReason:n.reason},u=n.trigger?.id??null;(u||t)&&(l.activeTriggerId=u,l.activeTriggerElement=n.trigger??null),this.update(l)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(cc,()=>{this.set("stickIfOpen",!1)}),Ke.flushSync(c)):c(),r||s?this.set("instantType",r?"click":"dismiss"):n.reason===It?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=ke(()=>new eo(n)).current,r=t??o;return jn(o.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function Uo({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:c,defaultTriggerId:l=null}=e,u=eo.useStore(a?.store,{open:n??o,modal:i,activeTriggerId:c!==void 0?c:l});u.useControlledProp("open",n,o),u.useControlledProp("activeTriggerId",c,l);const f=u.useState("open"),p=u.useState("positionerElement"),g=u.useState("payload"),m=u.useState("openChangeReason");u.useContextCallback("onOpenChange",r),u.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:y,reset:E}=ts(f);qr(u);const{forceUnmount:b}=Kr(f,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),E()});os(f&&i===!0&&m!==Se&&h!=="touch",p),d.useEffect(()=>{f||u.context.stickIfOpenTimeout.clear()},[u,f]);const R=d.useCallback(P=>{const V=ce(P);return V.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},V},[u]),v=d.useCallback(()=>{u.setOpen(!1,R(Pr))},[u,R]);d.useImperativeHandle(e.actionsRef,()=>({unmount:b,close:v}),[b,v]);const S=Zr({popupStore:u,onOpenChange:u.setOpen}),C=Ur(S,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),T=Qr(S),{getReferenceProps:I,getFloatingProps:N,getTriggerProps:k}=Qn([C,T]),F=d.useMemo(()=>I(y),[I,y]),A=d.useMemo(()=>k(y),[k,y]),O=d.useMemo(()=>N(),[N]);u.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:F,inactiveTriggerProps:A,popupProps:O,floatingRootContext:S,nested:it()!=null});const D=d.useMemo(()=>({store:u}),[u]);return ee.jsx(bs.Provider,{value:D,children:typeof t=="function"?t({payload:g}):t})}function Ql(e){return Ft(!0)?ee.jsx(Uo,{props:e}):ee.jsx(ic,{children:ee.jsx(Uo,{props:e})})}const Il=300,eu=d.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,handle:a,payload:c,openOnHover:l=!1,delay:u=Il,closeDelay:f=0,id:p,...g}=t,m=Ft(!0),h=a?.store??m?.store;if(!h)throw new Error(Ye(74));const y=es(p),E=h.useState("isTriggerActive",y),b=h.useState("floatingRootContext"),R=h.useState("isOpenedByTrigger",y),v=d.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Oa(y,v,h,{payload:c,disabled:s,openOnHover:l,closeDelay:f}),T=h.useState("openChangeReason"),I=h.useState("stickIfOpen"),N=h.useState("openMethod"),k=Ba(b,{enabled:b!=null&&l&&(N!=="touch"||T!==qe),mouseOnly:!0,move:!1,handleClose:Va(),restMs:u,delay:{close:f},triggerElementRef:v,isActiveTrigger:E}),F=Ac(b,{enabled:b!=null,stickIfOpen:I}),A=Qn([F]),O=h.useState("triggerProps",C),D=d.useMemo(()=>({disabled:s,open:R}),[s,R]),{getButtonProps:P,buttonRef:V}=Ja({disabled:s,native:i}),B=d.useMemo(()=>({open(X){return X&&T===qe?Ka.open(X):qa.open(X)}}),[T]),w=Je("button",t,{state:D,ref:[V,n,S,v],props:[A.getReferenceProps(),k,O,{[Cr]:"",id:y},g,P],stateAttributesMapping:B}),L=d.useRef(null),Q=Y(X=>{Ke.flushSync(()=>{h.setOpen(!1,ce(It,X.nativeEvent,X.currentTarget))}),Qi(L.current)?.focus()}),G=Y(X=>{const Z=h.select("positionerElement");if(Z&&dt(X,Z))h.context.beforeContentFocusGuardRef.current?.focus();else{Ke.flushSync(()=>{h.setOpen(!1,ce(It,X.nativeEvent,X.currentTarget))});let _=Ji(h.context.triggerFocusTargetRef.current||v.current);for(;_!==null&&re(Z,_);){const ne=_;if(_=Kn(_),_===ne)break}_?.focus()}});return E?ee.jsxs(d.Fragment,{children:[ee.jsx(yt,{ref:L,onFocus:Q}),ee.jsx(d.Fragment,{children:w},y),ee.jsx(yt,{ref:h.context.triggerFocusTargetRef,onFocus:G})]}):ee.jsx(d.Fragment,{children:w},y)}),ys=d.createContext(void 0);function kl(){const e=d.useContext(ys);if(e===void 0)throw new Error(Ye(45));return e}const tu=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=Ft();return s.useState("mounted")||o?ee.jsx(ys.Provider,{value:o,children:ee.jsx(Dr,{ref:n,...r,renderGuards:!1})}):null}),vs=d.createContext(void 0);function Ml(){const e=d.useContext(vs);if(!e)throw new Error(Ye(46));return e}const nu=d.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:a="bottom",align:c="center",sideOffset:l=0,alignOffset:u=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:g=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:y=lc,...E}=t,{store:b}=Ft(),R=kl(),v=rc(),S=b.useState("floatingRootContext"),C=b.useState("mounted"),T=b.useState("open"),I=b.useState("openChangeReason"),N=b.useState("activeTriggerElement"),k=b.useState("modal"),F=b.useState("positionerElement"),A=b.useState("instantType"),O=b.useState("transitionStatus"),D=b.useState("hasViewport"),P=d.useRef(null),V=zr(F,!1,!1),B=dl({anchor:s,floatingRootContext:S,positionMethod:i,mounted:C,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:g,collisionBoundary:f,collisionPadding:p,sticky:m,disableAnchorTracking:h,keepMounted:R,nodeId:v,collisionAvoidance:y,adaptiveOrigin:D?fl:void 0}),w=d.useMemo(()=>{const _={};return T||(_.pointerEvents="none"),{role:"presentation",hidden:!C,style:{...B.positionerStyles,..._}}},[T,C,B.positionerStyles]),L=d.useMemo(()=>({props:w,...B}),[w,B]),Q=S?.select("domReferenceElement");se(()=>{const _=Q,ne=P.current;if(_&&(P.current=_),ne&&_&&_!==ne){b.set("instantType",void 0);const z=new AbortController;return V(()=>{b.set("instantType","trigger-change")},z.signal),()=>{z.abort()}}},[Q,V,b]);const G=d.useMemo(()=>({open:T,side:L.side,align:L.align,anchorHidden:L.anchorHidden,instant:A}),[T,L.side,L.align,L.anchorHidden,A]),X=d.useCallback(_=>{b.set("positionerElement",_)},[b]),Z=Je("div",t,{state:G,props:[L.props,ps(O),E],ref:[n,X],stateAttributesMapping:Lt});return ee.jsxs(vs.Provider,{value:L,children:[C&&k===!0&&I!==Se&&ee.jsx(ss,{ref:b.context.internalBackdropRef,inert:ns(!T),cutout:N}),ee.jsx(sc,{id:v,children:Z})]})}),Al={...Lt,...cn},ou=d.forwardRef(function(t,n){const{className:o,render:r,initialFocus:s,finalFocus:i,...a}=t,{store:c}=Ft(),l=Ml(),u=gl()!=null,f=c.useState("open"),p=c.useState("openMethod"),g=c.useState("instantType"),m=c.useState("transitionStatus"),h=c.useState("popupProps"),y=c.useState("titleElementId"),E=c.useState("descriptionElementId"),b=c.useState("modal"),R=c.useState("mounted"),v=c.useState("openChangeReason"),S=c.useState("activeTriggerElement"),C=c.useState("floatingRootContext");Jn({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete?.(!0)}});const T=c.useState("disabled"),I=c.useState("openOnHover"),N=c.useState("closeDelay");Fa(C,{enabled:I&&!T,closeDelay:N});function k(P){return P==="touch"?c.context.popupRef.current:!0}const F=s===void 0?k:s,A=d.useMemo(()=>({open:f,side:l.side,align:l.align,instant:g,transitionStatus:m}),[f,l.side,l.align,g,m]),O=d.useCallback(P=>{c.set("popupElement",P)},[c]),D=Je("div",t,{state:A,ref:[n,c.context.popupRef,O],props:[h,{"aria-labelledby":y,"aria-describedby":E,onKeyDown(P){u&&ds.has(P.key)&&P.stopPropagation()}},ps(m),a],stateAttributesMapping:Al});return ee.jsx(Nr,{context:C,openInteractionType:p,modal:b==="trap-focus",disabled:!R||v===Se,initialFocus:F,returnFocus:i,restoreFocus:"popup",previousFocusableElement:me(S)?S:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:D})});export{Ia as $,Wl as A,vn as B,ft as C,Xl as D,fe as E,re as F,Yl as G,me as H,xe as I,It as J,Ti as K,Fl as L,Oi as M,ot as N,Nl as O,Ql as P,Ye as Q,tr as R,Ee as S,es as T,ie as U,K as V,wa as W,ts as X,ke as Y,ai as Z,Jn as _,Ja as a,Ac as a0,Ur as a1,Qn as a2,kr as a3,Ut as a4,Dl as a5,Go as a6,fc as a7,Ot as a8,Tr as a9,Ka as aa,ct as ab,Ul as ac,qa as ad,Dr as ae,jl as af,os as ag,dl as ah,ss as ai,ns as aj,Lt as ak,gl as al,Hn as am,he as an,bi as ao,Nr as ap,zl as aq,cn as ar,ps as as,ds as at,Hl as au,Je as b,ce as c,_l as d,Gl as e,ql as f,Zl as g,Kl as h,Jl as i,eu as j,tu as k,nu as l,ou as m,Vl as n,Bl as o,$l as p,Wt as q,In as r,Si as s,De as t,wt as u,it as v,xt as w,se as x,ho as y,Y as z};
@@ -1 +0,0 @@
1
- import{c as ot,r as a,D as r,a7 as on,H as Ue,a5 as Je,aw as Ln,B as T,av as Vn,R as Dn}from"./main-B5QLmAE0.js";import{C as _n}from"./Card-CFkWVhb0.js";import{A as Dt,s as Se,n as at,o as Fe,p as $e,q as $t,r as an,t as _e,v as Un,w as Hn,x as Q,y as Fn,z as xe,B as $n,C as Bt,E as Bn,F as tt,c as Me,G as Nt,H as zt,I as zn,J as ln,K as Wn,M as Kn,N as Ke,O as Tt,Q as it,R as Pe,S as Et,T as cn,U as qn,V as se,W as un,X as Yn,Y as Pt,Z as $,_ as _t,$ as Gn,a0 as Xn,a1 as Jn,a2 as Qn,a3 as dn,a4 as fn,a5 as Zn,a6 as er,a7 as Ut,a8 as tr,a9 as nr,a as gn,b as He,aa as rr,ab as At,ac as sr,ad as or,ae as ar,af as ir,ag as lr,ah as cr,ai as ur,aj as dr,ak as mn,al as fr,am as gr,an as Wt,ao as mr,ap as hr,aq as pr,ar as hn,as as xr,at as yr,au as Ct,u as br,D as wr,e as kr,f as vr,g as Rr,h as Sr,i as Nr,L as Be,P as Cr,j as jr,k as Mr,l as Ir,m as Tr}from"./PopoverPopup-D3QrvkAB.js";import{P as yt}from"./ProviderIcon-BrQ-p8RF.js";import{C as pn}from"./chevron-down-DL3I7ot4.js";import{D as Er}from"./download-6m9qXhnE.js";const Pr=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],nt=ot("check",Pr);const Ar=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Or=ot("external-link",Ar);const Lr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xn=ot("plus",Lr);const Vr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Kt=ot("search",Vr);const Dr=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],yn=ot("trash-2",Dr);function _r(e){const t=a.useRef(!0);t.current&&(t.current=!1,e())}function qt({controlled:e,default:t,name:n,state:o="value"}){const{current:d}=a.useRef(e!==void 0),[s,l]=a.useState(t),c=d?e:s,x=a.useCallback(p=>{d||l(p)},[]);return[c,x]}function gt(e,t,n){return Math.floor(e/t)!==n}function rt(e,t){return t<0||t>=e.current.length}function jt(e,t){return we(e,{disabledIndices:t})}function Yt(e,t){return we(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function we(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:d=1}={}){let s=t;do s+=n?-d:d;while(s>=0&&s<=e.current.length-1&&st(e,s,o));return s}function Ur(e,{event:t,orientation:n,loopFocus:o,rtl:d,cols:s,disabledIndices:l,minIndex:c,maxIndex:x,prevIndex:p,stopEvent:f=!1}){let g=p;const y=[],I={};let b=!1;{let u=null,C=-1;e.current.forEach((h,k)=>{if(h==null)return;const P=h.closest('[role="row"]');P&&(b=!0),(P!==u||C===-1)&&(u=P,C+=1,y[C]=[]),y[C].push(k),I[k]=C})}const v=b&&y.length>0&&y.some(u=>u.length!==s);function E(u){if(!v||p===-1)return;const C=I[p];if(C==null)return;const h=y[C].indexOf(p);let k=u==="up"?C-1:C+1;o&&(k<0?k=y.length-1:k>=y.length&&(k=0));const P=new Set;for(;k>=0&&k<y.length&&!P.has(k);){P.add(k);const H=y[k];if(H.length===0){k=u==="up"?k-1:k+1;continue}const Z=Math.min(h,H.length-1);for(let D=Z;D>=0;D-=1){const oe=H[D];if(!st(e,oe,l))return oe}k=u==="up"?k-1:k+1,o&&(k<0?k=y.length-1:k>=y.length&&(k=0))}}if(t.key===Dt){const u=E("up");if(u!==void 0)f&&Se(t),g=u;else{if(f&&Se(t),p===-1)g=x;else if(g=we(e,{startingIndex:g,amount:s,decrement:!0,disabledIndices:l}),o&&(p-s<c||g<0)){const C=p%s,h=x%s,k=x-(h-C);h===C?g=x:g=h>C?k:k-s}rt(e,g)&&(g=p)}}if(t.key===at){const u=E("down");u!==void 0?(f&&Se(t),g=u):(f&&Se(t),p===-1?g=c:(g=we(e,{startingIndex:p,amount:s,disabledIndices:l}),o&&p+s>x&&(g=we(e,{startingIndex:p%s-s,amount:s,disabledIndices:l}))),rt(e,g)&&(g=p))}if(n==="both"){const u=$t(p/s);t.key===(d?Fe:$e)&&(f&&Se(t),p%s!==s-1?(g=we(e,{startingIndex:p,disabledIndices:l}),o&&gt(g,s,u)&&(g=we(e,{startingIndex:p-p%s-1,disabledIndices:l}))):o&&(g=we(e,{startingIndex:p-p%s-1,disabledIndices:l})),gt(g,s,u)&&(g=p)),t.key===(d?$e:Fe)&&(f&&Se(t),p%s!==0?(g=we(e,{startingIndex:p,decrement:!0,disabledIndices:l}),o&&gt(g,s,u)&&(g=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l}))):o&&(g=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l})),gt(g,s,u)&&(g=p));const C=$t(x/s)===u;rt(e,g)&&(o&&C?g=t.key===(d?$e:Fe)?x:we(e,{startingIndex:p-p%s-1,disabledIndices:l}):g=p)}return g}function Hr(e,t,n){const o=[];let d=0;return e.forEach(({width:s,height:l},c)=>{let x=!1;for(n&&(d=0);!x;){const p=[];for(let f=0;f<s;f+=1)for(let g=0;g<l;g+=1)p.push(d+f+g*t);d%t+s<=t&&p.every(f=>o[f]==null)?(p.forEach(f=>{o[f]=c}),x=!0):d+=1}}),[...o]}function Fr(e,t,n,o,d){if(e===-1)return-1;const s=n.indexOf(e),l=t[e];switch(d){case"tl":return s;case"tr":return l?s+l.width-1:s;case"bl":return l?s+(l.height-1)*o:s;case"br":return n.lastIndexOf(e);default:return-1}}function $r(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function st(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const o=e.current[t];return o?o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true":!1}const Br="Escape";function wt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function mt(e,t){return wt(t,e===Dt||e===at,e===Fe||e===$e)}function Mt(e,t,n){return wt(t,e===at,n?e===Fe:e===$e)||e==="Enter"||e===" "||e===""}function zr(e,t,n){return wt(t,n?e===Fe:e===$e,e===at)}function Wr(e,t,n,o){const d=n?e===$e:e===Fe,s=e===Dt;return t==="both"||t==="horizontal"&&o&&o>1?e===Br:wt(t,d,s)}function Kr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.useState("floatingElement"),s=n.useState("domReferenceElement"),l=n.context.dataRef,{listRef:c,activeIndex:x,onNavigate:p=()=>{},enabled:f=!0,selectedIndex:g=null,allowEscape:y=!1,loopFocus:I=!1,nested:b=!1,rtl:v=!1,virtual:E=!1,focusItemOnOpen:u="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:h=!0,disabledIndices:k=void 0,orientation:P="vertical",parentOrientation:H,cols:Z=1,scrollItemIntoView:D=!0,itemSizes:oe,dense:ge=!1,id:F,resetOnPointerLeave:Y=!0,externalTree:q}=t,J=an(d),re=_e(J),K=Un(),ee=Hn(q);Q(()=>{l.current.orientation=P},[l,P]);const S=Fn(s),B=a.useRef(u),R=a.useRef(g??-1),M=a.useRef(null),le=a.useRef(!0),O=xe(m=>{p(R.current===-1?null:R.current,m)}),he=a.useRef(O),ae=a.useRef(!!d),A=a.useRef(o),z=a.useRef(!1),ue=a.useRef(!1),ke=_e(k),L=_e(o),ce=_e(D),te=_e(g),pe=_e(Y),ye=xe(()=>{function m(ie){E?ee?.events.emit("virtualfocus",ie):$n(ie,{sync:z.current,preventScroll:!0})}const V=c.current[R.current],N=ue.current;V&&m(V),(z.current?ie=>ie():requestAnimationFrame)(()=>{const ie=c.current[R.current]||V;if(!ie)return;V||m(ie);const de=ce.current;de&&X&&(N||!le.current)&&ie.scrollIntoView?.(typeof de=="boolean"?{block:"nearest",inline:"nearest"}:de)})});Q(()=>{f&&(o&&d?(R.current=g??-1,B.current&&g!=null&&(ue.current=!0,O())):ae.current&&(R.current=-1,he.current()))},[f,o,d,g,O]),Q(()=>{if(f){if(!o){z.current=!1;return}if(d)if(x==null){if(z.current=!1,te.current!=null)return;if(ae.current&&(R.current=-1,ye()),(!A.current||!ae.current)&&B.current&&(M.current!=null||B.current===!0&&M.current==null)){let m=0;const V=()=>{c.current[0]==null?(m<2&&(m?requestAnimationFrame:queueMicrotask)(V),m+=1):(R.current=M.current==null||Mt(M.current,P,v)||b?jt(c):Yt(c),M.current=null,O())};V()}}else rt(c,x)||(R.current=x,ye(),ue.current=!1)}},[f,o,d,x,te,b,c,P,v,O,ye,ke]),Q(()=>{if(!f||d||!ee||E||!ae.current)return;const m=ee.nodesRef.current,V=m.find(ie=>ie.id===K)?.context?.elements.floating,N=Bt(Bn(d)),ne=m.some(ie=>ie.context&&tt(ie.context.elements.floating,N));V&&!ne&&le.current&&V.focus({preventScroll:!0})},[f,d,ee,K,E]),Q(()=>{he.current=O,A.current=o,ae.current=!!d}),Q(()=>{o||(M.current=null,B.current=u)},[o,u]);const me=x!=null,X=a.useMemo(()=>{function m(N){if(!L.current)return;const ne=c.current.indexOf(N.currentTarget);ne!==-1&&R.current!==ne&&(R.current=ne,O(N))}return{onFocus(N){z.current=!0,m(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){z.current=!0,ue.current=!1,C&&m(N)},onPointerLeave(N){if(!L.current||!le.current||N.pointerType==="touch")return;z.current=!0;const ne=N.relatedTarget;!C||c.current.includes(ne)||pe.current&&(R.current=-1,O(N),E||re.current?.focus({preventScroll:!0}))}}},[L,re,C,c,O,pe,E]),i=a.useCallback(()=>H??ee?.nodesRef.current.find(m=>m.id===K)?.context?.dataRef?.current.orientation,[K,ee,H]),w=xe(m=>{if(le.current=!1,z.current=!0,m.which===229||!L.current&&m.currentTarget===re.current)return;if(b&&Wr(m.key,P,v,Z)){mt(m.key,i())||Se(m),n.setOpen(!1,Me(Nt,m.nativeEvent)),zt(s)&&(E?ee?.events.emit("virtualfocus",s):s.focus());return}const V=R.current,N=jt(c,k),ne=Yt(c,k);if(S||(m.key==="Home"&&(Se(m),R.current=N,O(m)),m.key==="End"&&(Se(m),R.current=ne,O(m))),Z>1){const ie=oe||Array.from({length:c.current.length},()=>({width:1,height:1})),de=Hr(ie,Z,ge),be=de.findIndex(Ne=>Ne!=null&&!st(c,Ne,k)),Re=de.reduce((Ne,Ie,De)=>Ie!=null&&!st(c,Ie,k)?De:Ne,-1),Ve=de[Ur({current:de.map(Ne=>Ne!=null?c.current[Ne]:null)},{event:m,orientation:P,loopFocus:I,rtl:v,cols:Z,disabledIndices:$r([...(typeof k!="function"?k:null)||c.current.map((Ne,Ie)=>st(c,Ie,k)?Ie:void 0),void 0],de),minIndex:be,maxIndex:Re,prevIndex:Fr(R.current>ne?N:R.current,ie,de,Z,m.key===at?"bl":m.key===(v?Fe:$e)?"tr":"tl"),stopEvent:!0})];if(Ve!=null&&(R.current=Ve,O(m)),P==="both")return}if(mt(m.key,P)){if(Se(m),o&&!E&&Bt(m.currentTarget.ownerDocument)===m.currentTarget){R.current=Mt(m.key,P,v)?N:ne,O(m);return}Mt(m.key,P,v)?I?V>=ne?y&&V!==c.current.length?R.current=-1:(z.current=!1,R.current=N):R.current=we(c,{startingIndex:V,disabledIndices:k}):R.current=Math.min(ne,we(c,{startingIndex:V,disabledIndices:k})):I?V<=N?y&&V!==-1?R.current=c.current.length:(z.current=!1,R.current=ne):R.current=we(c,{startingIndex:V,decrement:!0,disabledIndices:k}):R.current=Math.max(N,we(c,{startingIndex:V,decrement:!0,disabledIndices:k})),rt(c,R.current)&&(R.current=-1),O(m)}}),j=a.useMemo(()=>E&&o&&me&&{"aria-activedescendant":`${F}-${x}`},[E,o,me,F,x]),_=a.useMemo(()=>({"aria-orientation":P==="both"?void 0:P,...S?{}:j,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&o&&!E){const V=zn(m.nativeEvent);if(V&&!tt(re.current,V))return;Se(m),n.setOpen(!1,Me(ln,m.nativeEvent)),zt(s)&&s.focus();return}w(m)},onPointerMove(){le.current=!0}}),[j,w,re,P,S,n,o,E,s]),G=a.useMemo(()=>{function m(N){u==="auto"&&Wn(N.nativeEvent)&&(B.current=!E)}function V(N){B.current=u,u==="auto"&&Kn(N.nativeEvent)&&(B.current=!0)}return{onKeyDown(N){const ne=n.select("open");le.current=!1;const ie=N.key.startsWith("Arrow"),de=zr(N.key,i(),v),be=mt(N.key,P),Re=(b?de:be)||N.key==="Enter"||N.key.trim()==="";if(E&&ne)return w(N);if(!(!ne&&!h&&ie)){if(Re){const Ve=mt(N.key,i());M.current=b&&Ve?null:N.key}if(b){de&&(Se(N),ne?(R.current=jt(c,ke.current),O(N)):n.setOpen(!0,Me(Nt,N.nativeEvent,N.currentTarget)));return}be&&(te.current!=null&&(R.current=te.current),Se(N),!ne&&h?n.setOpen(!0,Me(Nt,N.nativeEvent,N.currentTarget)):w(N),ne&&O(N))}},onFocus(N){n.select("open")&&!E&&(R.current=-1,O(N))},onPointerDown:V,onPointerEnter:V,onMouseDown:m,onClick:m}},[w,ke,u,c,b,O,n,h,P,i,v,te,E]),ve=a.useMemo(()=>({...j,...G}),[j,G]);return a.useMemo(()=>f?{reference:ve,floating:_,item:X,trigger:G}:{},[f,ve,_,G,X])}function qr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.context.dataRef,{listRef:s,activeIndex:l,onMatch:c,onTypingChange:x,enabled:p=!0,findMatch:f=null,resetMs:g=750,ignoreKeys:y=Tt,selectedIndex:I=null}=t,b=Ke(),v=a.useRef(""),E=a.useRef(I??l??-1),u=a.useRef(null);Q(()=>{o&&(b.clear(),u.current=null,v.current="")},[o,b]),Q(()=>{o&&v.current===""&&(E.current=I??l??-1)},[o,I,l]);const C=xe(H=>{H?d.current.typing||(d.current.typing=H,x?.(H)):d.current.typing&&(d.current.typing=H,x?.(H))}),h=xe(H=>{function Z(Y,q,J){const re=f?f(q,J):q.find(K=>K?.toLocaleLowerCase().indexOf(J.toLocaleLowerCase())===0);return re?Y.indexOf(re):-1}const D=s.current;if(v.current.length>0&&v.current[0]!==" "&&(Z(D,D,v.current)===-1?C(!1):H.key===" "&&Se(H)),D==null||y.includes(H.key)||H.key.length!==1||H.ctrlKey||H.metaKey||H.altKey)return;o&&H.key!==" "&&(Se(H),C(!0)),D.every(Y=>Y?Y[0]?.toLocaleLowerCase()!==Y[1]?.toLocaleLowerCase():!0)&&v.current===H.key&&(v.current="",E.current=u.current),v.current+=H.key,b.start(g,()=>{v.current="",E.current=u.current,C(!1)});const ge=E.current,F=Z(D,[...D.slice((ge||0)+1),...D.slice(0,(ge||0)+1)],v.current);F!==-1?(c?.(F),u.current=F):H.key!==" "&&(v.current="",C(!1))}),k=a.useMemo(()=>({onKeyDown:h}),[h]),P=a.useMemo(()=>({onKeyDown:h,onKeyUp(H){H.key===" "&&C(!1)}}),[h,C]);return a.useMemo(()=>p?{reference:k,floating:P}:{},[p,k,P])}const bn=a.createContext(null),wn=a.createContext(null);function ze(){const e=a.useContext(bn);if(e===null)throw new Error(it(60));return e}function kn(){const e=a.useContext(wn);if(e===null)throw new Error(it(61));return e}let Gt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Yr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gr={valid(e){return e===null?null:e?{[Gt.valid]:""}:{[Gt.invalid]:""}}},Xr=a.createContext({invalid:void 0,name:void 0,validityData:{state:Yr,errors:[],error:"",value:"",initialValue:null},setValidityData:Pe,disabled:void 0,touched:!1,setTouched:Pe,dirty:!1,setDirty:Pe,filled:!1,setFilled:Pe,focused:!1,setFocused:Pe,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Et)=>e,getInputValidationProps:(e=Et)=>e,inputRef:{current:null},commit:async()=>{}}});function Ht(e=!0){const t=a.useContext(Xr);if(t.setValidityData===Pe&&!e)throw new Error(it(28));return t}const Jr=a.createContext({controlId:void 0,setControlId:Pe,labelId:void 0,setLabelId:Pe,messageIds:[],setMessageIds:Pe,getDescriptionProps:e=>e});function vn(){return a.useContext(Jr)}function Rn(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:d,setControlId:s}=vn(),l=cn(t);return Q(()=>{if(!(!n&&!t||s===Pe)){if(n){const c=o?.current;qn(c)&&c.closest("label")!=null?s(t??null):s(d??l)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,o,d,s,n,l]),d??l}const Qr=(e,t)=>Object.is(e,t);function Qe(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function It(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Qe(o,t,n))}function Ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Qe(o,t,n))}function Zr(e,t,n){return e.filter(o=>!Qe(o,t,n))}function Lt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Sn(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function es(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Sn(e)){for(const t of e)for(const n of t.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function ts(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 Lt(e)}function Xe(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Lt(e.value):Lt(e)}function Nn(e,t,n){function o(){return ts(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 t[e]??o();if(Array.isArray(t)){const d=Sn(t)?t.flatMap(s=>s.items):t;if(e==null||typeof e!="object"){const s=d.find(l=>l.value===e);return s&&s.label!=null?s.label:o()}if("value"in e){const s=d.find(l=>l&&l.value===e.value);if(s&&s.label!=null)return s.label}}return o()}function ns(e,t,n){return e.reduce((o,d,s)=>(s>0&&o.push(", "),o.push(r.jsx(a.Fragment,{children:Nn(d,t,n)},s)),o),[])}const U={id:se(e=>e.id),modal:se(e=>e.modal),multiple:se(e=>e.multiple),items:se(e=>e.items),itemToStringLabel:se(e=>e.itemToStringLabel),itemToStringValue:se(e=>e.itemToStringValue),isItemEqualToValue:se(e=>e.isItemEqualToValue),value:se(e=>e.value),hasSelectedValue:se(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Xe(t,o)!==""}),hasNullItemLabel:se((e,t)=>t?es(e.items):!1),open:se(e=>e.open),mounted:se(e=>e.mounted),forceMount:se(e=>e.forceMount),transitionStatus:se(e=>e.transitionStatus),openMethod:se(e=>e.openMethod),activeIndex:se(e=>e.activeIndex),selectedIndex:se(e=>e.selectedIndex),isActive:se((e,t)=>e.activeIndex===t),isSelected:se((e,t,n)=>{const o=e.isItemEqualToValue,d=e.value;return e.multiple?Array.isArray(d)&&d.some(s=>Qe(s,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Qe(d,n,o)}),isSelectedByFocus:se((e,t)=>e.selectedIndex===t),popupProps:se(e=>e.popupProps),triggerProps:se(e=>e.triggerProps),triggerElement:se(e=>e.triggerElement),positionerElement:se(e=>e.positionerElement),listElement:se(e=>e.listElement),scrollUpArrowVisible:se(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:se(e=>e.scrollDownArrowVisible),hasScrollArrows:se(e=>e.hasScrollArrows)},rs=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cn(){return a.useContext(rs)}function ss(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function os(e){const{enabled:t=!0,value:n,id:o,name:d,controlRef:s,commit:l}=e,{formRef:c}=Cn(),{invalid:x,markedDirtyRef:p,validityData:f,setValidityData:g}=Ht(),y=xe(e.getValue);Q(()=>{if(!t)return;let I=n;I===void 0&&(I=y()),f.initialValue===null&&I!==null&&g(b=>({...b,initialValue:I}))},[t,g,n,f.initialValue,y]),Q(()=>{!t||!o||c.current.fields.set(o,{getValue:y,name:d,controlRef:s,validityData:ss(f,x),validate(I=!0){let b=n;b===void 0&&(b=y()),p.current=!0,I?on.flushSync(()=>l(b)):l(b)}})},[l,s,t,c,y,o,x,p,d,f,n]),Q(()=>{const I=c.current.fields;return()=>{o&&I.delete(o)}},[c,o])}function as(e,t){const n=a.useRef(e),o=xe(t);Q(()=>{n.current!==e&&o(n.current)},[e,o]),Q(()=>{n.current=e},[e])}function is(e){const{id:t,value:n,defaultValue:o=null,onValueChange:d,open:s,defaultOpen:l=!1,onOpenChange:c,name:x,disabled:p=!1,readOnly:f=!1,required:g=!1,modal:y=!0,actionsRef:I,inputRef:b,onOpenChangeComplete:v,items:E,multiple:u=!1,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k=Qr,highlightItemOnHover:P=!0,children:H}=e,{clearErrors:Z}=Cn(),{setDirty:D,setTouched:oe,setFocused:ge,shouldValidateOnChange:F,validityData:Y,setFilled:q,name:J,disabled:re,validation:K,validationMode:ee}=Ht(),S=Rn({id:t}),B=re||p,R=J??x,[M,le]=qt({controlled:n,default:u?o??Tt:o,name:"Select",state:"value"}),[O,he]=qt({controlled:s,default:l,name:"Select",state:"open"}),ae=a.useRef([]),A=a.useRef([]),z=a.useRef(null),ue=a.useRef(null),ke=a.useRef(0),L=a.useRef(null),ce=a.useRef([]),te=a.useRef(!1),pe=a.useRef(!1),ye=a.useRef(null),me=a.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),X=a.useRef(!1),{mounted:i,setMounted:w,transitionStatus:j}=un(O),{openMethod:_,triggerProps:G,reset:ve}=Yn(O),m=Pt(()=>new tr({id:S,modal:y,multiple:u,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k,value:M,open:O,mounted:i,transitionStatus:j,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,V=$(m,U.activeIndex),N=$(m,U.selectedIndex),ne=$(m,U.triggerElement),ie=$(m,U.positionerElement),de=a.useMemo(()=>u&&Array.isArray(M)&&M.length===0?"":Xe(M,h),[u,M,h]),be=a.useMemo(()=>u&&Array.isArray(M)?M.map(W=>Xe(W,h)):Xe(M,h),[u,M,h]),Re=_e(m.state.triggerElement);os({id:S,commit:K.commit,value:M,controlRef:Re,name:R,getValue:()=>be});const Ve=a.useRef(M);Q(()=>{M!==Ve.current&&m.set("forceMount",!0)},[m,M]),Q(()=>{q(u?Array.isArray(M)&&M.length>0:M!=null)},[u,M,q]),Q(function(){if(O)return;const fe=ce.current;if(u){const Ee=Array.isArray(M)?M:[];if(Ee.length===0){m.set("selectedIndex",null);return}const Ce=Ee[Ee.length-1],ft=Ot(fe,Ce,k);m.set("selectedIndex",ft===-1?null:ft);return}const Te=Ot(fe,M,k);m.set("selectedIndex",Te===-1?null:Te)},[u,O,M,ce,k,m]),as(M,()=>{Z(R),D(M!==Y.initialValue),F()?K.commit(M):K.commit(M,!0)});const Ne=xe((W,fe)=>{if(c?.(W,fe),!fe.isCanceled&&(he(W),!W&&(fe.reason===ln||fe.reason===nr)&&(oe(!0),ge(!1),ee==="onBlur"&&K.commit(M)),!W&&m.state.activeIndex!==null)){const Te=ae.current[m.state.activeIndex];queueMicrotask(()=>{Te?.setAttribute("tabindex","-1")})}}),Ie=xe(()=>{w(!1),m.set("activeIndex",null),ve(),v?.(!1)});_t({enabled:!I,open:O,ref:z,onComplete(){O||Ie()}}),a.useImperativeHandle(I,()=>({unmount:Ie}),[Ie]);const De=xe((W,fe)=>{d?.(W,fe),!fe.isCanceled&&le(W)}),Ae=xe(()=>{const W=m.state.listElement||z.current;if(!W)return;const fe=W.scrollTop,Te=W.scrollTop+W.clientHeight,Ee=fe>1,Ce=Te<W.scrollHeight-1;m.state.scrollUpArrowVisible!==Ee&&m.set("scrollUpArrowVisible",Ee),m.state.scrollDownArrowVisible!==Ce&&m.set("scrollDownArrowVisible",Ce)}),Oe=Gn({open:O,onOpenChange:Ne,elements:{reference:ne,floating:ie}}),lt=Xn(Oe,{enabled:!f&&!B,event:"mousedown"}),Ze=Jn(Oe,{bubbles:!1}),Le=Kr(Oe,{enabled:!f&&!B,listRef:ae,activeIndex:V,selectedIndex:N,disabledIndices:Tt,onNavigate(W){W===null&&!O||m.set("activeIndex",W)},focusItemOnHover:!1}),vt=qr(Oe,{enabled:!f&&!B&&(O||!u),listRef:A,activeIndex:V,selectedIndex:N,onMatch(W){O?m.set("activeIndex",W):De(ce.current[W],Me("none"))},onTypingChange(W){te.current=W}}),{getReferenceProps:qe,getFloatingProps:Ye,getItemProps:ct}=Qn([lt,Ze,Le,vt]),et=a.useMemo(()=>dn(qe(),G,S?{id:S}:Et),[qe,G,S]);_r(()=>{m.update({popupProps:Ye(),triggerProps:et})}),Q(()=>{m.update({id:S,modal:y,multiple:u,value:M,open:O,mounted:i,transitionStatus:j,popupProps:Ye(),triggerProps:et,items:E,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k,openMethod:_})},[m,S,y,u,M,O,i,j,Ye,et,E,C,h,k,_]);const ut=a.useMemo(()=>({store:m,name:R,required:g,disabled:B,readOnly:f,multiple:u,itemToStringLabel:C,itemToStringValue:h,highlightItemOnHover:P,setValue:De,setOpen:Ne,listRef:ae,popupRef:z,scrollHandlerRef:ue,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ke,getItemProps:ct,events:Oe.context.events,valueRef:L,valuesRef:ce,labelsRef:A,typingRef:te,selectionRef:me,selectedItemTextRef:ye,validation:K,onOpenChangeComplete:v,keyboardActiveRef:pe,alignItemWithTriggerActiveRef:X,initialValueRef:Ve}),[m,R,g,B,f,u,C,h,P,De,Ne,ct,Oe.context.events,K,v,Ae]),dt=fn(b,K.inputRef),Rt=u&&Array.isArray(M)&&M.length>0,St=a.useMemo(()=>!u||!Array.isArray(M)||!R?null:M.map(W=>{const fe=Xe(W,h);return r.jsx("input",{type:"hidden",name:R,value:fe},fe)}),[u,M,R,h]);return r.jsx(bn.Provider,{value:ut,children:r.jsxs(wn.Provider,{value:Oe,children:[H,r.jsx("input",{...K.getInputValidationProps({onFocus(){m.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented)return;const fe=W.target.value,Te=Me(Ut,W.nativeEvent);function Ee(){if(u)return;const Ce=ce.current.find(ft=>Xe(ft,h).toLowerCase()===fe.toLowerCase());Ce!=null&&(D(Ce!==Y.initialValue),De(Ce,Te),F()&&K.commit(Ce))}m.set("forceMount",!0),queueMicrotask(Ee)}}),name:u?void 0:R,value:de,disabled:B,required:g&&!Rt,readOnly:f,ref:dt,style:R?Zn:er,tabIndex:-1,"aria-hidden":!0}),St]})})}function ls(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||o.content!=="none"))return t;const s=parseFloat(n.width)||0,l=parseFloat(n.height)||0,c=parseFloat(o.width)||0,x=parseFloat(o.height)||0,p=Math.max(t.width,s,c),f=Math.max(t.height,l,x),g=p-t.width,y=f-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-y/2,bottom:t.bottom+y/2}}const ht=2,cs=400,Xt=200,us={...rr,...Gr,value:()=>null},ds=a.forwardRef(function(t,n){const{render:o,className:d,id:s,disabled:l=!1,nativeButton:c=!0,...x}=t,{setTouched:p,setFocused:f,validationMode:g,state:y,disabled:I}=Ht(),{labelId:b}=vn(),{store:v,setOpen:E,selectionRef:u,validation:C,readOnly:h,required:k,alignItemWithTriggerActiveRef:P,disabled:H,keyboardActiveRef:Z}=ze(),D=I||H||l,oe=$(v,U.open),ge=$(v,U.value),F=$(v,U.triggerProps),Y=$(v,U.positionerElement),q=$(v,U.listElement),J=$(v,U.id),re=$(v,U.hasSelectedValue),K=!re&&oe,ee=$(v,U.hasNullItemLabel,K),S=s??J;Rn({id:S});const B=_e(Y),R=a.useRef(null),{getButtonProps:M,buttonRef:le}=gn({disabled:D,native:c}),O=xe(te=>{v.set("triggerElement",te)}),he=fn(n,R,le,O),ae=Ke(),A=Ke(),z=Ke(),ue=Ke();a.useEffect(()=>{if(oe)return!(re||ee)?z.start(cs,()=>{u.current.allowUnselectedMouseUp=!0,u.current.allowSelectedMouseUp=!0}):ue.start(Xt,()=>{u.current.allowUnselectedMouseUp=!0,z.start(Xt,()=>{u.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),ue.clear()};u.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},A.clear()},[oe,re,ee,u,A,z,ue]);const ke=a.useMemo(()=>q?.id??an(Y)?.id,[q,Y]),L=dn(F,{id:S,role:"combobox","aria-expanded":oe?"true":"false","aria-haspopup":"listbox","aria-controls":oe?ke:void 0,"aria-labelledby":b,"aria-readonly":h||void 0,"aria-required":k||void 0,tabIndex:D?-1:0,ref:he,onFocus(te){f(!0),oe&&P.current&&E(!1,Me(Ut,te.nativeEvent)),ae.start(0,()=>{v.set("forceMount",!0)})},onBlur(te){tt(Y,te.relatedTarget)||(p(!0),f(!1),g==="onBlur"&&C.commit(ge))},onPointerMove(){Z.current=!1},onKeyDown(){Z.current=!0},onMouseDown(te){if(oe)return;const pe=At(te.currentTarget);function ye(me){if(!R.current)return;const X=me.target;if(tt(R.current,X)||tt(B.current,X)||X===R.current)return;const i=ls(R.current);me.clientX>=i.left-ht&&me.clientX<=i.right+ht&&me.clientY>=i.top-ht&&me.clientY<=i.bottom+ht||E(!1,Me(sr,me))}A.start(0,()=>{pe.addEventListener("mouseup",ye,{once:!0})})}},C.getValidationProps,x,M);L.role="combobox";const ce=a.useMemo(()=>({...y,open:oe,disabled:D,value:ge,readOnly:h,placeholder:!re}),[y,oe,D,ge,h,re]);return He("button",t,{ref:[n,R],state:ce,stateAttributesMapping:us,props:L})}),fs={value:()=>null},gs=a.forwardRef(function(t,n){const{className:o,render:d,children:s,placeholder:l,...c}=t,{store:x,valueRef:p}=ze(),f=$(x,U.value),g=$(x,U.items),y=$(x,U.itemToStringLabel),I=$(x,U.hasSelectedValue),b=!I&&l!=null&&s==null,v=$(x,U.hasNullItemLabel,b),E=a.useMemo(()=>({value:f,placeholder:!I}),[f,I]);let u=null;return typeof s=="function"?u=s(f):s!=null?u=s:!I&&l!=null&&!v?u=l:Array.isArray(f)?u=ns(f,g,y):u=Nn(f,g,y),He("span",t,{state:E,ref:[n,p],props:[{children:u},c],stateAttributesMapping:fs})}),ms=a.forwardRef(function(t,n){const{className:o,render:d,...s}=t,{store:l}=ze(),c=$(l,U.open),x=a.useMemo(()=>({open:c}),[c]);return He("span",t,{state:x,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:or})}),hs=a.createContext(void 0),ps=a.forwardRef(function(t,n){const{store:o}=ze(),d=$(o,U.mounted),s=$(o,U.forceMount);return d||s?r.jsx(hs.Provider,{value:!0,children:r.jsx(ar,{ref:n,...t})}):null}),jn=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xs(){return a.useContext(jn)}function ys(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:d}=e,s=xe(d),l=a.useRef(0),c=Pt(ws).current,x=Pt(bs).current,[p,f]=a.useState(0),g=a.useRef(p),y=xe((u,C)=>{x.set(u,C??null),g.current+=1,f(g.current)}),I=xe(u=>{x.delete(u),g.current+=1,f(g.current)}),b=a.useMemo(()=>{const u=new Map;return Array.from(x.keys()).filter(h=>h.isConnected).sort(ks).forEach((h,k)=>{const P=x.get(h)??{};u.set(h,{...P,index:k})}),u},[x,p]);Q(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const u=new MutationObserver(C=>{const h=new Set,k=P=>h.has(P)?h.delete(P):h.add(P);C.forEach(P=>{P.removedNodes.forEach(k),P.addedNodes.forEach(k)}),h.size===0&&(g.current+=1,f(g.current))});return b.forEach((C,h)=>{h.parentElement&&u.observe(h.parentElement,{childList:!0})}),()=>{u.disconnect()}},[b]),Q(()=>{g.current===p&&(n.current.length!==b.size&&(n.current.length=b.size),o&&o.current.length!==b.size&&(o.current.length=b.size),l.current=b.size),s(b)},[s,b,n,o,p]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{o&&(o.current=[])},[o]);const v=xe(u=>(c.add(u),()=>{c.delete(u)}));Q(()=>{c.forEach(u=>u(b))},[c,b]);const E=a.useMemo(()=>({register:y,unregister:I,subscribeMapChange:v,elementsRef:n,labelsRef:o,nextIndexRef:l}),[y,I,v,n,o,l]);return r.jsx(jn.Provider,{value:E,children:t})}function bs(){return new Map}function ws(){return new Set}function ks(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Mn=a.createContext(void 0);function vs(){const e=a.useContext(Mn);if(!e)throw new Error(it(59));return e}function bt(e,t){e&&Object.assign(e.style,t)}const Rs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ss={position:"fixed"},Ns=a.forwardRef(function(t,n){const{anchor:o,positionMethod:d="absolute",className:s,render:l,side:c="bottom",align:x="center",sideOffset:p=0,alignOffset:f=0,collisionBoundary:g="clipping-ancestors",collisionPadding:y,arrowPadding:I=5,sticky:b=!1,disableAnchorTracking:v,alignItemWithTrigger:E=!0,collisionAvoidance:u=ir,...C}=t,{store:h,listRef:k,labelsRef:P,alignItemWithTriggerActiveRef:H,selectedItemTextRef:Z,valuesRef:D,initialValueRef:oe,popupRef:ge,setValue:F}=ze(),Y=kn(),q=$(h,U.open),J=$(h,U.mounted),re=$(h,U.modal),K=$(h,U.value),ee=$(h,U.openMethod),S=$(h,U.positionerElement),B=$(h,U.triggerElement),R=$(h,U.isItemEqualToValue),M=a.useRef(null),le=a.useRef(null),[O,he]=a.useState(E),ae=J&&O&&ee!=="touch";!J&&O!==E&&he(E),Q(()=>{J||(U.scrollUpArrowVisible(h.state)&&h.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(h.state)&&h.set("scrollDownArrowVisible",!1))},[h,J]),a.useImperativeHandle(H,()=>ae),lr((ae||re)&&q&&ee!=="touch",B);const A=cr({anchor:o,floatingRootContext:Y,positionMethod:d,mounted:J,side:c,sideOffset:p,align:x,alignOffset:f,arrowPadding:I,collisionBoundary:g,collisionPadding:y,sticky:b,disableAnchorTracking:v??ae,collisionAvoidance:u,keepMounted:!0}),z=ae?"none":A.side,ue=ae?Ss:A.positionerStyles,ke=a.useMemo(()=>{const X={};return q||(X.pointerEvents="none"),{role:"presentation",hidden:!J,style:{...ue,...X}}},[q,J,ue]),L=a.useMemo(()=>({open:q,side:z,align:A.align,anchorHidden:A.anchorHidden}),[q,z,A.align,A.anchorHidden]),ce=xe(X=>{h.set("positionerElement",X)}),te=He("div",t,{ref:[n,ce],state:L,stateAttributesMapping:mn,props:[ke,C]}),pe=a.useRef(0),ye=xe(X=>{if(X.size===0&&pe.current===0||D.current.length===0)return;const i=pe.current;if(pe.current=X.size,X.size===i)return;const w=Me(Ut);if(i!==0&&!h.state.multiple&&K!==null&&Ot(D.current,K,R)===-1){const _=oe.current,ve=_!=null&&It(D.current,_,R)?_:null;F(ve,w),ve===null&&(h.set("selectedIndex",null),Z.current=null)}if(i!==0&&h.state.multiple&&Array.isArray(K)){const j=K.filter(_=>It(D.current,_,R));(j.length!==K.length||j.some(_=>!It(K,_,R)))&&(F(j,w),j.length===0&&(h.set("selectedIndex",null),Z.current=null))}if(q&&ae){h.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};bt(S,j),bt(ge.current,j)}}),me=a.useMemo(()=>({...A,side:z,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:M,scrollDownArrowRef:le}),[A,z,ae,he]);return r.jsx(ys,{elementsRef:k,labelsRef:P,onMapChange:ye,children:r.jsxs(Mn.Provider,{value:me,children:[J&&re&&r.jsx(ur,{inert:dr(!q),cutout:B}),te]})})});function In(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const pt="base-ui-disable-scrollbar",Jt={className:pt,getElement(e){return r.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function Cs(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const js=a.createContext(void 0),Ms={disableStyleElements:!1};function Is(){return a.useContext(js)??Ms}const Ts={...mn,...hn},Es=a.forwardRef(function(t,n){const{render:o,className:d,...s}=t,{store:l,popupRef:c,onOpenChangeComplete:x,setOpen:p,valueRef:f,selectedItemTextRef:g,keyboardActiveRef:y,multiple:I,handleScrollArrowVisibility:b,scrollHandlerRef:v,highlightItemOnHover:E}=ze(),{side:u,align:C,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:P,scrollUpArrowRef:H}=vs(),Z=fr()!=null,D=kn(),{nonce:oe,disableStyleElements:ge}=Is(),F=Ke(),Y=$(l,U.id),q=$(l,U.open),J=$(l,U.mounted),re=$(l,U.popupProps),K=$(l,U.transitionStatus),ee=$(l,U.triggerElement),S=$(l,U.positionerElement),B=$(l,U.listElement),R=a.useRef(0),M=a.useRef(!1),le=a.useRef(0),O=a.useRef(!1),he=a.useRef({}),ae=gr(),A=xe(L=>{if(!S||!c.current||!O.current)return;if(M.current||!h){b();return}const ce=S.style.top==="0px",te=S.style.bottom==="0px",pe=S.getBoundingClientRect().height,ye=At(S),me=getComputedStyle(S),X=parseFloat(me.marginTop),i=parseFloat(me.marginBottom),w=Qt(getComputedStyle(c.current)),j=ye.documentElement.clientHeight-X-i,_=L.scrollTop,G=L.scrollHeight,ve=L.clientHeight,m=G-ve;let V=0,N=null,ne=!1;if(ce){const ie=m-_,de=pe+ie,be=Math.min(de,j);V=be,be!==j?N=m:ne=!0}else if(te){const ie=_-0,de=pe+ie,be=Math.min(de,j),Re=de-j;V=be,be!==j?N=0:(ne=!0,_<m&&(N=_-(ie-Re)))}V!==0&&(S.style.height=`${V}px`),N!=null&&(L.scrollTop=N),(ne||V>=w)&&(M.current=!0),b()});a.useImperativeHandle(v,()=>A,[A]),_t({open:q,ref:c,onComplete(){q&&x?.(!0)}});const z=a.useMemo(()=>({open:q,transitionStatus:K,side:u,align:C}),[q,K,u,C]);Q(()=>{!S||!c.current||Object.keys(he.current).length||(he.current={top:S.style.top||"0",left:S.style.left||"0",right:S.style.right,height:S.style.height,bottom:S.style.bottom,minHeight:S.style.minHeight,maxHeight:S.style.maxHeight,marginTop:S.style.marginTop,marginBottom:S.style.marginBottom})},[c,S]),Q(()=>{q||h||(O.current=!1,M.current=!1,R.current=0,le.current=0,bt(S,he.current))},[q,h,S,c]),Q(()=>{const L=c.current;if(!(!q||!ee||!S||!L||l.state.transitionStatus==="ending")){if(!h){O.current=!0,ae.request(b),L.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const ce=As(L);L.style.removeProperty("--transform-origin");try{const te=getComputedStyle(S),pe=getComputedStyle(L),ye=At(ee),me=Wt(S),X=ee.getBoundingClientRect(),i=S.getBoundingClientRect(),w=X.left,j=X.height,_=B||L,G=_.scrollHeight,ve=parseFloat(pe.borderBottomWidth),m=parseFloat(te.marginTop)||10,V=parseFloat(te.marginBottom)||10,N=parseFloat(te.minHeight)||100,ne=Qt(pe),ie=5,de=5,be=20,Re=ye.documentElement.clientHeight-m-V,Ve=ye.documentElement.clientWidth,Ne=Re-X.bottom+j,Ie=g.current,De=f.current;let Ae,Oe=0,lt=0;if(Ie&&De){const W=De.getBoundingClientRect();Ae=Ie.getBoundingClientRect();const fe=W.left-w,Te=Ae.left-i.left,Ee=W.top-X.top+W.height/2,Ce=Ae.top-i.top+Ae.height/2;Oe=fe-Te,lt=Ce-Ee}const Ze=Ne+lt+V+ve;let Le=Math.min(Re,Ze);const vt=Re-m-V,qe=Ze-Le,Ye=Math.max(ie,w+Oe),ct=Ve-de,et=Math.max(0,Ye+i.width-ct);S.style.left=`${Ye-et}px`,S.style.height=`${Le}px`,S.style.maxHeight="auto",S.style.marginTop=`${m}px`,S.style.marginBottom=`${V}px`,L.style.height="100%";const ut=_.scrollHeight-_.clientHeight,dt=qe>=ut;dt&&(Le=Math.min(Re,i.height)-(qe-ut));const Rt=X.top<be||X.bottom>Re-be||Le<Math.min(G,N),St=(me.visualViewport?.scale??1)!==1&&mr;if(Rt||St){O.current=!0,bt(S,he.current),on.flushSync(()=>k(!1));return}if(dt){const W=Math.max(0,Re-Ze);S.style.top=i.height>=vt?"0":`${W}px`,S.style.height=`${Le}px`,_.scrollTop=_.scrollHeight-_.clientHeight,R.current=Math.max(N,Le)}else S.style.bottom="0",R.current=Math.max(N,Le),_.scrollTop=qe;if(Ae){const W=i.top,fe=i.height,Te=Ae.top+Ae.height/2,Ee=fe>0?(Te-W)/fe*100:50,Ce=Cs(Ee,0,100);L.style.setProperty("--transform-origin",`50% ${Ce}%`)}(R.current===Re||Le>=ne)&&(M.current=!0),b(),setTimeout(()=>{O.current=!0})}finally{ce()}})}},[l,q,S,ee,f,g,c,b,h,k,ae,P,H,B]),a.useEffect(()=>{if(!h||!S||!q)return;const L=Wt(S);function ce(te){p(!1,Me(pr,te))}return L.addEventListener("resize",ce),()=>{L.removeEventListener("resize",ce)}},[p,h,S,q]);const ue={...B?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":I||void 0,id:`${Y}-list`},onKeyDown(L){y.current=!0,Z&&yr.has(L.key)&&L.stopPropagation()},onMouseMove(){y.current=!1},onPointerLeave(L){if(!E||In(L)||L.pointerType==="touch")return;const ce=L.currentTarget;F.start(0,()=>{l.set("activeIndex",null),ce.focus({preventScroll:!0})})},onScroll(L){B||v.current?.(L.currentTarget)},...h&&{style:B?{height:"100%"}:Rs}},ke=He("div",t,{ref:[n,c],state:z,stateAttributesMapping:Ts,props:[re,ue,xr(K),{className:!B&&h?Jt.className:void 0},s]});return r.jsxs(a.Fragment,{children:[!ge&&Jt.getElement(oe),r.jsx(hr,{context:D,modal:!1,disabled:!J,restoreFocus:!0,children:ke})]})});function Qt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const Zt={transform:"none",scale:"1",translate:"0 0"};function Ps(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function As(e){const{style:t}=e,n={},o=Object.keys(Zt);for(const d of o)n[d]=t.getPropertyValue(d),t.setProperty(d,Zt[d]);return()=>{for(const d of o)Ps(t,d,n[d])}}let Tn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Os(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:d,index:s}=e,{register:l,unregister:c,subscribeMapChange:x,elementsRef:p,labelsRef:f,nextIndexRef:g}=xs(),y=a.useRef(-1),[I,b]=a.useState(s??(d===Tn.GuessFromOrder?()=>{if(y.current===-1){const u=g.current;g.current+=1,y.current=u}return y.current}:-1)),v=a.useRef(null),E=a.useCallback(u=>{if(v.current=u,I!==-1&&u!==null&&(p.current[I]=u,f)){const C=t!==void 0;f.current[I]=C?t:o?.current?.textContent??u.textContent}},[I,p,f,t,o]);return Q(()=>{if(s!=null)return;const u=v.current;if(u)return l(u,n),()=>{c(u)}},[s,l,c,n]),Q(()=>{if(s==null)return x(u=>{const C=v.current?u.get(v.current)?.index:null;C!=null&&b(C)})},[s,x,b]),a.useMemo(()=>({ref:E,index:I}),[I,E])}const En=a.createContext(void 0);function Ft(){const e=a.useContext(En);if(!e)throw new Error(it(57));return e}const en=a.memo(a.forwardRef(function(t,n){const{render:o,className:d,value:s=null,label:l,disabled:c=!1,nativeButton:x=!1,...p}=t,f=a.useRef(null),g=Os({label:l,textRef:f,indexGuessBehavior:Tn.GuessFromOrder}),{store:y,getItemProps:I,setOpen:b,setValue:v,selectionRef:E,typingRef:u,valuesRef:C,keyboardActiveRef:h,multiple:k,highlightItemOnHover:P}=ze(),H=Ke(),Z=$(y,U.isActive,g.index),D=$(y,U.isSelected,g.index,s),oe=$(y,U.isSelectedByFocus,g.index),ge=$(y,U.isItemEqualToValue),F=g.index,Y=F!==-1,q=a.useRef(null),J=_e(F);Q(()=>{if(!Y)return;const A=C.current;return A[F]=s,()=>{delete A[F]}},[Y,F,s,C]),Q(()=>{if(!Y)return;const A=y.state.value;let z=A;k&&Array.isArray(A)&&A.length>0&&(z=A[A.length-1]),z!==void 0&&Qe(z,s,ge)&&y.set("selectedIndex",F)},[Y,F,k,ge,y,s]);const re=a.useMemo(()=>({disabled:c,selected:D,highlighted:Z}),[c,D,Z]),K=I({active:Z,selected:D});K.onFocus=void 0,K.id=void 0;const ee=a.useRef(null),S=a.useRef("mouse"),B=a.useRef(!1),{getButtonProps:R,buttonRef:M}=gn({disabled:c,focusableWhenDisabled:!0,native:x});function le(A){const z=y.state.value;if(k){const ue=Array.isArray(z)?z:[],ke=D?Zr(ue,s,ge):[...ue,s];v(ke,Me(Ct,A))}else v(s,Me(Ct,A)),b(!1,Me(Ct,A))}const O={role:"option","aria-selected":D,tabIndex:Z?0:-1,onFocus(){y.set("activeIndex",F)},onMouseEnter(){!h.current&&y.state.selectedIndex===null&&y.set("activeIndex",F)},onMouseMove(){P&&y.set("activeIndex",F)},onMouseLeave(A){!P||h.current||In(A)||H.start(0,()=>{y.state.activeIndex===F&&y.set("activeIndex",null)})},onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(A){ee.current=A.key,y.set("activeIndex",F)},onClick(A){B.current=!1,!(A.type==="keydown"&&ee.current===null)&&(c||ee.current===" "&&u.current||S.current!=="touch"&&!Z||(ee.current=null,le(A.nativeEvent)))},onPointerEnter(A){S.current=A.pointerType},onPointerDown(A){S.current=A.pointerType,B.current=!0},onMouseUp(A){if(c)return;if(B.current){B.current=!1;return}const z=!E.current.allowSelectedMouseUp&&D,ue=!E.current.allowUnselectedMouseUp&&!D;z||ue||S.current!=="touch"&&!Z||le(A.nativeEvent)}},he=He("div",t,{ref:[M,n,g.ref,q],state:re,props:[K,O,p,R]}),ae=a.useMemo(()=>({selected:D,indexRef:J,textRef:f,selectedByFocus:oe,hasRegistered:Y}),[D,J,f,oe,Y]);return r.jsx(En.Provider,{value:ae,children:he})})),tn=a.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:d}=Ft();return o||d?r.jsx(Ls,{...t,ref:n}):null}),Ls=a.memo(a.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:d,...s}=e,{selected:l}=Ft(),c=a.useRef(null),{transitionStatus:x,setMounted:p}=un(l),f=a.useMemo(()=>({selected:l,transitionStatus:x}),[l,x]),g=He("span",e,{ref:[t,c],state:f,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:hn});return _t({open:l,ref:c,onComplete(){l||p(!1)}}),g})),nn=a.memo(a.forwardRef(function(t,n){const{indexRef:o,textRef:d,selectedByFocus:s,hasRegistered:l}=Ft(),{selectedItemTextRef:c}=ze(),{className:x,render:p,...f}=t,g=a.useCallback(I=>{if(!I||!l)return;const b=c.current===null||!c.current.isConnected;(s||b&&o.current===0)&&(c.current=I)},[c,o,s,l]);return He("div",t,{ref:[g,n,d],props:f})})),Vs=a.forwardRef(function(t,n){const{render:o,className:d,id:s,...l}=t,{store:c}=br(),x=cn(s);return c.useSyncedValueWithCleanup("descriptionElementId",x),He("p",t,{ref:n,props:[{id:x},l]})});function Ds({open:e,title:t,description:n,confirmLabel:o,cancelLabel:d,destructive:s=!1,busy:l=!1,onConfirm:c,onCancel:x}){return r.jsx(wr,{open:e,onOpenChange:p=>{!p&&!l&&x?.()},children:r.jsxs(kr,{children:[r.jsx(vr,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),r.jsx(Rr,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Sr,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[r.jsx(Nr,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),n?r.jsx(Vs,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:n}):null,r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx(Ue,{type:"button",variant:"secondary",size:"sm",disabled:l,onClick:()=>x?.(),children:d}),r.jsx(Ue,{type:"button",size:"sm",disabled:l,onClick:()=>c?.(),className:Je(s&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}function Pn({value:e,onChange:t,placeholder:n,disabled:o=!1,type:d="text",label:s,error:l,className:c="",...x}){const y=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${o?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${l?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${c}`;return r.jsxs("div",{className:"w-full",children:[s&&r.jsx("label",{className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),r.jsx("input",{type:d,value:e,onChange:t,placeholder:n,disabled:o,className:y,...x}),l&&r.jsx("p",{className:"mt-1.5 text-sm text-oai-error",children:l})]})}const An="tokentracker-skills";async function kt(e){const t=new URL(`/functions/${An}`,window.location.origin);if(e)for(const[d,s]of Object.entries(e))s!=null&&s!==""&&t.searchParams.set(d,String(s));const n=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}async function We(e){const t=await Ln(),n=await fetch(`/functions/${An}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),o=await n.json().catch(()=>null);if(!n.ok||o?.ok===!1)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}function _s(){return kt({mode:"installed"})}function Us(e={}){return kt({mode:"discover",...e.force?{force:1}:{}})}function Hs(e,t=0,n=20){return kt({mode:"search",q:e,offset:t,limit:n})}function Fs(){return kt({mode:"repos"})}function $s(e,t){return We({action:"install",skill:e,targets:t})}function Bs(e){return We({action:"uninstall",id:e})}function zs(e){return We({action:"restore",id:e})}function Ws(e,t){return We({action:"set_targets",id:e,targets:t})}function Ks(e,t){return We({action:"import_local",directory:e,targets:t})}function qs(e,t){return We({action:"delete_local",directory:e,targets:t||[]})}function Ys(e){return We({action:"add_repo",repo:e})}function Gs(e,t){return We({action:"remove_repo",owner:e,name:t})}const rn=["claude","codex"],Xs={claude:"bg-orange-500/10 ring-1 ring-orange-500/20 hover:bg-orange-500/20",codex:"bg-emerald-500/10 ring-1 ring-emerald-500/20 hover:bg-emerald-500/20",gemini:"bg-sky-500/10 ring-1 ring-sky-500/20 hover:bg-sky-500/20",opencode:"bg-amber-500/10 ring-1 ring-amber-500/20 hover:bg-amber-500/20",hermes:"bg-indigo-500/10 ring-1 ring-indigo-500/20 hover:bg-indigo-500/20"},Ge="all",je="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function sn(e){return`install:${xt(e)}`}function Vt(e){return`remove:${e.id||e.directory}`}function On(e,t){return`target:${e}:${t}`}function Js({skill:e,targets:t,busyKey:n,onToggleTarget:o}){const d=new Set(e.targets||[]);return r.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(s=>{const l=d.has(s.id),c=n===On(e.id,s.id),x=l?"skills.target.remove_title":"skills.target.sync_title";return r.jsx("button",{type:"button","aria-pressed":l,"aria-label":T("skills.target.toggle_aria",{target:s.label}),title:T(x,{target:s.label}),disabled:c,onClick:()=>o(e,s.id,!l),className:Je("inline-flex h-8 w-8 items-center justify-center rounded-md transition disabled:cursor-wait disabled:opacity-70",l?Xs[s.id]||"bg-oai-gray-100 dark:bg-oai-gray-800":"opacity-40 grayscale hover:bg-oai-gray-100 hover:opacity-100 hover:grayscale-0 dark:hover:bg-oai-gray-800"),children:c?r.jsx(Be,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(yt,{provider:s.id,size:16})},s.id)})})}function Qs({skill:e,targets:t,busyKey:n,onToggleTarget:o,onRemove:d}){const s=n===Vt(e),l=e.repoOwner&&e.repoName?`${e.repoOwner}/${e.repoName}`:null,c=l?`${e.directory} · ${l}`:e.directory;return r.jsxs("div",{className:"group grid gap-4 px-1 py-3 lg:grid-cols-[minmax(0,1fr)_auto_auto] lg:items-center",children:[r.jsxs("div",{className:"min-w-0",title:c,children:[r.jsx("h2",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:e.name||e.directory}),e.description?r.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e.description}):null]}),r.jsx(Js,{skill:e,targets:t,busyKey:n,onToggleTarget:o}),r.jsx("button",{type:"button","aria-label":T("skills.action.remove"),title:T("skills.action.remove"),disabled:s,onClick:()=>d(e),className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-400 opacity-0 transition duration-200 hover:bg-red-50 hover:text-red-600 group-hover:opacity-100 focus:opacity-100 disabled:cursor-wait disabled:opacity-100 dark:hover:bg-red-950/30 dark:hover:text-red-300 lg:justify-self-end",children:s?r.jsx(Be,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(yn,{className:"h-4 w-4","aria-hidden":!0})})]})}function Zs({items:e,targets:t,busyKey:n,onToggleTarget:o,onRemove:d}){return r.jsxs("div",{children:[r.jsx("div",{className:"px-1 pb-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:T("skills.my.count",{count:e.length})}),r.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(s=>r.jsx(Qs,{skill:s,targets:t,busyKey:n,onToggleTarget:o,onRemove:d},s.id||s.key))})]})}const eo={contentVisibility:"auto",containIntrinsicSize:"0 240px"},to=Dn.memo(function({skill:t,installed:n,installing:o,allTargets:d,defaultTargets:s,onInstall:l}){const[c,x]=a.useState(()=>(s||[]).filter(b=>d.some(v=>v.id===b))),p=b=>{x(v=>v.includes(b)?v.filter(E=>E!==b):[...v,b])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,g=t.installs!=null?T("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,y=[f,g].filter(Boolean).join(" · "),I=c.length?c.map(b=>d.find(v=>v.id===b)?.label||b).join(", "):T("skills.action.choose_targets");return r.jsxs(_n,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?r.jsxs("a",{href:t.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:t.readmeUrl,children:[r.jsx("span",{className:"truncate",children:t.name||t.directory}),r.jsx(Or,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),y?r.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:y}):null]}),n?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-oai-black/[0.06] px-2 py-1 text-xs font-medium text-oai-gray-700 ring-1 ring-oai-black/10 dark:bg-white/[0.08] dark:text-oai-gray-200 dark:ring-white/10",children:[r.jsx(nt,{className:"h-3 w-3","aria-hidden":!0}),T("skills.card.installed")]}):null]}),t.description?r.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t.description}):null,r.jsx("div",{className:"mt-auto pt-5",children:n?r.jsxs("div",{className:"inline-flex h-8 w-full items-center justify-center gap-1.5 rounded-md bg-oai-black/[0.04] text-sm font-medium text-oai-gray-700 ring-1 ring-inset ring-oai-black/[0.08] dark:bg-white/[0.05] dark:text-oai-gray-200 dark:ring-white/[0.08]",children:[r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0}),T("skills.card.installed")]}):r.jsxs("div",{className:"flex",children:[r.jsxs(Ue,{type:"button",size:"sm",onClick:()=>l(t,c),disabled:o||c.length===0,className:"flex-1 !rounded-r-none",title:I,children:[o?r.jsx(Be,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Er,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),c.length>1?T("skills.action.install_to",{count:c.length}):T("skills.action.install")]}),r.jsxs(Cr,{children:[r.jsx(jr,{disabled:o,"aria-label":T("skills.action.choose_targets"),title:I,className:"inline-flex h-8 items-center justify-center rounded-r-md border-l border-white/20 bg-oai-black px-2 text-white hover:bg-oai-gray-800 disabled:cursor-not-allowed disabled:opacity-60 dark:border-oai-black/20 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:r.jsx(pn,{className:"h-3.5 w-3.5","aria-hidden":!0})}),r.jsx(Mr,{children:r.jsx(Ir,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Tr,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[r.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:T("skills.target.menu_label")}),d.map(b=>{const v=c.includes(b.id);return r.jsxs("button",{type:"button",onClick:()=>p(b.id),className:Je("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm",v?"bg-oai-gray-100 dark:bg-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900"),children:[r.jsx(yt,{provider:b.id,size:16,className:v?"":"grayscale opacity-40"}),r.jsx("span",{className:"flex-1 text-left",children:b.label}),v?r.jsx(nt,{className:"h-3.5 w-3.5 text-emerald-500","aria-hidden":!0}):null]},b.id)})]})})})]})]})})]})});function no({repos:e,repoInput:t,onRepoInput:n,busyKey:o,onAdd:d,onRemove:s}){return r.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsx(Pn,{value:t,onChange:l=>n(l.target.value),placeholder:T("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Ue,{type:"button",variant:"secondary",size:"md",onClick:d,disabled:o==="repo:add",className:"shrink-0 whitespace-nowrap",children:[o==="repo:add"?r.jsx(Be,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(xn,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),T("skills.repo.add")]})]}),e.length?r.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(l=>{const c=o===`repo:${l.owner}/${l.name}`;return r.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[l.owner,"/",l.name]}),r.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:l.branch})]}),r.jsxs(Ue,{type:"button",variant:"ghost",size:"sm",disabled:c,onClick:()=>s(l),className:"shrink-0",children:[c?r.jsx(Be,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(yn,{className:"h-3.5 w-3.5","aria-hidden":!0}),r.jsx("span",{className:"sr-only",children:T("skills.repo.remove")})]})]},`${l.owner}/${l.name}`)})}):null]})}function ro(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function fo(){const[e,t]=a.useState(ro),[n,o]=a.useState({skills:[],targets:[]}),[d,s]=a.useState([]),[l,c]=a.useState([]),[x,p]=a.useState([]),[f,g]=a.useState(Ge),[y,I]=a.useState(""),[b,v]=a.useState(""),[E,u]=a.useState(""),[C,h]=a.useState(!1),[k,P]=a.useState(""),[H,Z]=a.useState(!0),[D,oe]=a.useState(!1),[ge,F]=a.useState(""),[Y,q]=a.useState(null),[J,re]=a.useState(null),K=a.useMemo(()=>{const i=new Set;for(const w of n.skills||[]){i.add(xt(w).toLowerCase()),w.repoOwner&&w.repoName&&i.add(`${w.repoOwner}/${w.repoName}:${w.sourceDirectory||w.directory}`.toLowerCase());const j=String(w.directory||"").split(/[\\/]/).pop().toLowerCase();j&&i.add(`dir:${j}`)}return i},[n.skills]),ee=a.useCallback(async()=>{const i=await _s();o({skills:i.skills||[],targets:i.targets||[]})},[]),S=a.useCallback(async()=>{const i=await Fs();p(i.repos||[])},[]),B=a.useCallback(async({force:i=!1}={})=>{oe(!0);try{const w=await Us({force:i});s(w.skills||[])}finally{oe(!1)}},[]),R=a.useCallback(async()=>{Z(!0),F("");try{await Promise.all([ee(),S()])}catch(i){F(i?.message||T("skills.error.generic"))}finally{Z(!1)}},[ee,S]),M=a.useCallback(async()=>{await R(),e==="browse"&&f!==je&&B({force:!0}).catch(i=>F(i?.message||T("skills.error.generic")))},[B,R,f,e]);a.useEffect(()=>{R()},[R]),a.useEffect(()=>{e==="browse"&&f!==je&&d.length===0&&B().catch(i=>F(i?.message||T("skills.error.generic")))},[d.length,B,f,e]),a.useEffect(()=>{if(!J)return;const i=setTimeout(()=>re(w=>w?.key===J.key?null:w),J.ttlMs||5e3);return()=>clearTimeout(i)},[J]),a.useEffect(()=>{const i=setTimeout(()=>v(y),200);return()=>clearTimeout(i)},[y]),a.useEffect(()=>{if(typeof window>"u")return;const i=new URLSearchParams(window.location.search),w=i.get("tab");if(e==="my"){if(!w)return;i.delete("tab")}else{if(w===e)return;i.set("tab",e)}const j=i.toString(),_=`${window.location.pathname}${j?`?${j}`:""}${window.location.hash}`;window.history.replaceState({},"",_)},[e]);const le=async(i,w)=>{P(i),F("");try{await w(),await ee()}catch(j){F(j?.message||T("skills.error.generic"))}finally{P("")}},O=(i,w)=>{const j=(w&&w.length?w:rn).filter(_=>(n.targets||[]).some(G=>G.id===_));le(sn(i),async()=>{await $s(i,j);const _=j.map(G=>(n.targets||[]).find(ve=>ve.id===G)?.label||G).join(", ");re({key:`${Date.now()}:install:${xt(i)}`,message:T("skills.toast.installed",{name:i.name||i.directory,targets:_||T("skills.target.none")}),ttlMs:4e3})})},he=i=>{q(i)},ae=()=>{const i=Y;i&&(q(null),le(Vt(i),async()=>{let w=null;i.managed?w=await Bs(i.id):await qs(i.directory,i.targets||[]);const j=!!(w?.trashed&&i.managed&&i.id);re({key:`${Date.now()}:${i.id||i.directory}`,message:T("skills.toast.removed",{name:i.name||i.directory}),undo:j?async()=>{try{await zs(i.id),await ee(),re(null)}catch(_){F(_?.message||T("skills.error.generic"))}}:null,ttlMs:5e3})}))},A=(i,w,j)=>le(On(i.id,w),async()=>{const _=new Set(i.targets||[]);j?_.add(w):_.delete(w),i.managed?await Ws(i.id,Array.from(_)):await Ks(i.directory,Array.from(_))}),z=async()=>{const i=y.trim();if(!(i.length<2)){P("search"),F("");try{const w=await Hs(i);c(w.skills||[])}catch(w){F(w?.message||T("skills.error.generic"))}finally{P("")}}},ue=async()=>{const i=E.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[w,j]=i.split("/");if(!w||!j){F(T("skills.repo.invalid"));return}await le("repo:add",async()=>{await Ys({owner:w,name:j,branch:"main",enabled:!0}),u(""),await S(),await B()})},ke=async i=>{await le(`repo:${i.owner}/${i.name}`,async()=>{await Gs(i.owner,i.name),await S(),await B()})},L=n.targets||[],ce=n.skills||[],te=a.useMemo(()=>{const i=f===je?l:d,w=f===je||f===Ge?i:i.filter(G=>`${G.repoOwner}/${G.repoName}`===f),j=b.trim().toLowerCase();return(f===je||!j?w:w.filter(G=>(G.name||"").toLowerCase().includes(j)||(G.directory||"").toLowerCase().includes(j)||(G.description||"").toLowerCase().includes(j))).map(G=>{const ve=xt(G).toLowerCase(),m=String(G.directory||"").split(/[\\/]/).pop().toLowerCase(),V=m?`dir:${m}`:"";return{...G,installed:K.has(ve)||V&&K.has(V)}})},[b,d,K,l,f]),pe=r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(Be,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),ye=r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[r.jsx(Be,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),r.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:T("skills.browse.loading_hint")})]}),me=(i,w=null)=>r.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[r.jsx("p",{children:T(i)}),w]});let X;if(H)X=pe;else if(e==="my")X=ce.length?r.jsx(Zs,{items:ce,targets:L,busyKey:k,onToggleTarget:A,onRemove:he}):r.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[L.length>0?r.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[r.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...L,...L].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`b-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...L,...L].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`c-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:T("skills.empty.my")}),r.jsx(Ue,{type:"button",size:"sm",onClick:()=>t("browse"),children:T("skills.empty.my_cta")})]});else{const i=f===je,w=x.length===0&&!i;let j;w?j=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:r.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:T("skills.browse.empty_sources")})}):D&&!i?j=ye:i&&y.trim().length<2?j=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:T("skills.browse.hint_skillssh")}):te.length?j=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:te.map(G=>r.jsx("div",{style:eo,children:r.jsx(to,{skill:G,installed:!!G.installed,installing:k===sn(G),allTargets:L,defaultTargets:rn,onInstall:O})},G.id||G.key))}):i?j=me("skills.empty.search"):j=me("skills.empty.browse");const _=w||C?r.jsx("div",{className:"mb-5",children:r.jsx(no,{repos:x,repoInput:E,onRepoInput:u,busyKey:k,onAdd:ue,onRemove:ke})}):null;X=r.jsxs(r.Fragment,{children:[_,j]})}return r.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[r.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[r.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:T("skills.page.title")}),r.jsxs(Ue,{type:"button",variant:"secondary",size:"sm",onClick:M,disabled:H||D,children:[r.jsx(Vn,{className:Je("mr-1.5 h-3.5 w-3.5",(H||D)&&"animate-spin"),"aria-hidden":!0}),T("skills.action.refresh")]})]}),r.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",T("skills.tab.my")],["browse",T("skills.tab.browse")]].map(([i,w])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:Je("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===i?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:w},i))}),ge?r.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:ge}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{role:"tablist","aria-label":T("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",T("skills.mode.repo")],["skillssh",T("skills.mode.skillssh")]].map(([i,w])=>{const j=i==="skillssh"==(f===je);return r.jsx("button",{type:"button",role:"tab","aria-selected":j,onClick:()=>{i==="skillssh"?g(je):f===je&&g(Ge)},className:Je("rounded px-3 py-1 text-sm font-medium transition-colors",j?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:w},i)})}),f!==je?r.jsxs(is,{value:f,onValueChange:g,children:[r.jsxs(ds,{"aria-label":T("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(gs,{children:i=>i===Ge?T("skills.source.all"):i}),r.jsx(ms,{className:"text-oai-gray-400",children:r.jsx(pn,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(ps,{children:r.jsx(Ns,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(Es,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[r.jsxs(en,{value:Ge,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(nn,{children:T("skills.source.all")}),r.jsx(tn,{children:r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(i=>{const w=`${i.owner}/${i.name}`;return r.jsxs(en,{value:w,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(nn,{children:w}),r.jsx(tn,{children:r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},w)})]})})})]}):null,r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Kt,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),r.jsx(Pn,{value:y,onChange:i=>I(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===je&&z()},placeholder:f===je?T("skills.browse.placeholder_skillssh"):f===Ge?T("skills.browse.placeholder_all"):T("skills.browse.placeholder_repo",{repo:f}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),f===je?r.jsxs(Ue,{type:"button",onClick:z,disabled:y.trim().length<2||k==="search",className:"focus:!ring-oai-gray-400/30",children:[k==="search"?r.jsx(Be,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Kt,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),T("skills.action.search")]}):r.jsxs(Ue,{type:"button",variant:"secondary",size:"sm",onClick:()=>h(i=>!i),"aria-expanded":C,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[r.jsx(xn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),T("skills.browse.manage_sources"),r.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:x.length})]})]}):null,X]})}),r.jsx(Ds,{open:!!Y,title:T("skills.confirm.remove_title",{name:Y?.name||Y?.directory||""}),description:Y?Y.managed?T("skills.confirm.remove_managed"):T("skills.confirm.remove_local"):"",confirmLabel:T("skills.action.remove"),cancelLabel:T("shared.action.cancel"),destructive:!0,busy:k===Vt(Y||{}),onCancel:()=>q(null),onConfirm:ae}),J?r.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:r.jsxs("div",{className:"pointer-events-auto flex max-w-md items-center gap-3 rounded-full bg-oai-black px-4 py-2 text-sm text-white shadow-lg dark:bg-white dark:text-oai-black",children:[r.jsx("span",{children:J.message}),J.undo?r.jsx("button",{type:"button",onClick:J.undo,className:"rounded-full px-2 py-0.5 text-xs font-semibold uppercase tracking-wide hover:bg-white/10 dark:hover:bg-oai-black/10",children:T("shared.action.undo")}):null]})}):null]})}export{fo as SkillsPage};