@ipv9/tokentracker-cli 0.39.39 → 0.39.41

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 (38) hide show
  1. package/README.md +6 -6
  2. package/dashboard/dist/assets/{Card-BbRYRVXf.js → Card-BwY_Qv6N.js} +1 -1
  3. package/dashboard/dist/assets/DashboardPage-C7b_GjA-.js +60 -0
  4. package/dashboard/dist/assets/{FadeIn-CjAacJ5t.js → FadeIn-DiAafUDN.js} +1 -1
  5. package/dashboard/dist/assets/{IpCheckPage-BGALK8Vy.js → IpCheckPage-CYgWVZJr.js} +1 -1
  6. package/dashboard/dist/assets/LimitsPage-C1y75ftN.js +2 -0
  7. package/dashboard/dist/assets/{LocalOnlyNotice-Dxo2vFMQ.js → LocalOnlyNotice-B5_-ydeu.js} +1 -1
  8. package/dashboard/dist/assets/{PopoverPopup-DP9fwdtl.js → PopoverPopup-DDjjQ5CG.js} +1 -1
  9. package/dashboard/dist/assets/{Select-DPE53NmM.js → Select-BPspkl9p.js} +1 -1
  10. package/dashboard/dist/assets/{SelectItemText-D69v77is.js → SelectItemText-CX0dWYB1.js} +1 -1
  11. package/dashboard/dist/assets/{SettingsPage-Dxzqpi02.js → SettingsPage-9K5ST4D_.js} +1 -1
  12. package/dashboard/dist/assets/{SkillsPage-Bo7e39AB.js → SkillsPage-BpCSS7ls.js} +1 -1
  13. package/dashboard/dist/assets/{WidgetsPage-HHcIr_Eq.js → WidgetsPage-aBisLWrM.js} +1 -1
  14. package/dashboard/dist/assets/{WrappedPage-C-_jLXXU.js → WrappedPage-BgkuBG_j.js} +1 -1
  15. package/dashboard/dist/assets/{arrow-up-right-BJvJHUGj.js → arrow-up-right-DPb2FRSP.js} +1 -1
  16. package/dashboard/dist/assets/{download-CnzY_EgN.js → download-CbZ8YL8m.js} +1 -1
  17. package/dashboard/dist/assets/{format-1w-q5n2f.js → format-aRaCvnht.js} +1 -1
  18. package/dashboard/dist/assets/limitDisplay-1O9-AdgI.js +1 -0
  19. package/dashboard/dist/assets/{main-3gBEI6Jl.js → main-DRcFJLLD.js} +5 -3
  20. package/dashboard/dist/assets/main-ZrWkoMlr.css +1 -0
  21. package/dashboard/dist/assets/mock-data-sZ3-GZV0.js +1 -0
  22. package/dashboard/dist/assets/{use-limits-display-prefs-D1nT9-mr.js → use-limits-display-prefs-2-qYvffB.js} +1 -1
  23. package/dashboard/dist/assets/{use-native-settings-Dh6NzqjY.js → use-native-settings-C1uhDKdL.js} +1 -1
  24. package/dashboard/dist/assets/{useCurrency-Hhs5jbWw.js → useCurrency-BPCF4zUv.js} +1 -1
  25. package/dashboard/dist/index.html +2 -2
  26. package/package.json +3 -2
  27. package/src/commands/serve.js +121 -38
  28. package/src/lib/fs.js +149 -25
  29. package/src/lib/local-api.js +20 -2
  30. package/src/lib/pricing/curated-overrides.json +10 -3
  31. package/src/lib/pricing/index.js +197 -18
  32. package/src/lib/pricing/litellm-fetcher.js +6 -1
  33. package/src/lib/pricing/seed-snapshot.json +1 -1
  34. package/dashboard/dist/assets/DashboardPage-DYKHv0m3.js +0 -60
  35. package/dashboard/dist/assets/LimitsPage-LkZGPYvg.js +0 -2
  36. package/dashboard/dist/assets/main-1kxAVM3m.css +0 -1
  37. package/dashboard/dist/assets/mock-data-CJOMGcL9.js +0 -1
  38. package/dashboard/dist/assets/use-usage-limits-BXR6lzGf.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as Br,b2 as Tn,b3 as jo,b4 as Fn,b5 as Ht,b6 as at,b7 as ut,ax as Ot,a5 as J,j as Ce,aw as Nn,r as u,aD as qe,b8 as Wt,a4 as re,b9 as On,ba as zo,a7 as Zt,az as Ge,bb as Hn,aG as en,bc as _r,bd as Wn,aY as Ne,aA as Mn,be as ct,bf as ht,aF as Re,ab as $r,aC as Yo,bg as Bn,aR as tr,aT as nr,aV as Ko,bh as qo,aE as Qe,k as Se,aO as _n,bi as Ur,bj as We,aQ as Go,bk as Xo,bl as Ze,aL as Dt,bm as Jo,a9 as Nt,bn as vt,ay as Ee,bo as it,bp as rr,bq as $n,br as Un,bs as Mt,bt as mt,bu as Qo,bv as jr,bw as Zo,bx as Bt,by as ln,s as jn,bz as es,bA as Je,aH as An,aM as ts,ac as an,a3 as Pt,bB as zr,bC as ns,a6 as Ye,bD as pt,bE as rs,bF as Yr,bG as Kr,bH as pn,bI as In,bJ as nt,bK as or,bL as qr,bM as Gr,ad as zn,a8 as Xr,aa as os,g as Jr,h as yt,bN as ss,aI as is,bO as cs,aJ as ls,bP as as,bQ as us,ae as Qr,bR as hn}from"./main-3gBEI6Jl.js";const fs=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],vl=Br("check",fs);const ds=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],El=Br("chevron-down",ds);function Et(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...Et(e,o.id,n)])}function sr(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function ke(e){e.preventDefault(),e.stopPropagation()}function ps(e){return"nativeEvent"in e}function Zr(e){return e.mozInputSource===0&&e.isTrusted?!0:Tn&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function eo(e){return jo?!1:!Tn&&e.width===0&&e.height===0||Tn&&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 ir(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function to(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const hs=["top","right","bottom","left"],At=Math.min,ze=Math.max,tn=Math.round,Rt=Math.floor,tt=e=>({x:e,y:e}),ms={left:"right",right:"left",bottom:"top",top:"bottom"};function Pn(e,t,n){return ze(e,At(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Be(e){return e.split("-")[0]}function ft(e){return e.split("-")[1]}function Yn(e){return e==="x"?"y":"x"}function Kn(e){return e==="y"?"height":"width"}function Xe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qn(e){return Yn(Xe(e))}function gs(e,t,n){n===void 0&&(n=!1);const r=ft(e),o=qn(e),s=Kn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=nn(i)),[i,nn(i)]}function ys(e){const t=nn(e);return[kn(e),t,kn(t)]}function kn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const cr=["left","right"],lr=["right","left"],bs=["top","bottom"],xs=["bottom","top"];function ws(e,t,n){switch(e){case"top":case"bottom":return n?t?lr:cr:t?cr:lr;case"left":case"right":return t?bs:xs;default:return[]}}function Rs(e,t,n,r){const o=ft(e);let s=ws(Be(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(kn)))),s}function nn(e){const t=Be(e);return ms[t]+e.slice(t.length)}function vs(e){return{top:0,right:0,bottom:0,left:0,...e}}function no(e){return typeof e!="number"?vs(e):{top:e,right:e,bottom:e,left:e}}function rn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function $t(e,t,n){return Math.floor(e/t)!==n}function Vt(e,t){return t<0||t>=e.current.length}function mn(e,t){return Pe(e,{disabledIndices:t})}function ar(e,t){return Pe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Pe(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&Ft(e,s,r));return s}function Es(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:i,minIndex:c,maxIndex:d,prevIndex:l,stopEvent:a=!1}){let f=l;const g=[],p={};let m=!1;{let h=null,x=-1;e.current.forEach((y,v)=>{if(y==null)return;const S=y.closest('[role="row"]');S&&(m=!0),(S!==h||x===-1)&&(h=S,x+=1,g[x]=[]),g[x].push(v),p[v]=x})}const b=m&&g.length>0&&g.some(h=>h.length!==s);function R(h){if(!b||l===-1)return;const x=p[l];if(x==null)return;const y=g[x].indexOf(l);let v=h==="up"?x-1:x+1;r&&(v<0?v=g.length-1:v>=g.length&&(v=0));const S=new Set;for(;v>=0&&v<g.length&&!S.has(v);){S.add(v);const O=g[v];if(O.length===0){v=h==="up"?v-1:v+1;continue}const M=Math.min(y,O.length-1);for(let A=M;A>=0;A-=1){const z=O[A];if(!Ft(e,z,i))return z}v=h==="up"?v-1:v+1,r&&(v<0?v=g.length-1:v>=g.length&&(v=0))}}if(t.key===Fn){const h=R("up");if(h!==void 0)a&&ke(t),f=h;else{if(a&&ke(t),l===-1)f=d;else if(f=Pe(e,{startingIndex:f,amount:s,decrement:!0,disabledIndices:i}),r&&(l-s<c||f<0)){const x=l%s,y=d%s,v=d-(y-x);y===x?f=d:f=y>x?v:v-s}Vt(e,f)&&(f=l)}}if(t.key===Ht){const h=R("down");h!==void 0?(a&&ke(t),f=h):(a&&ke(t),l===-1?f=c:(f=Pe(e,{startingIndex:l,amount:s,disabledIndices:i}),r&&l+s>d&&(f=Pe(e,{startingIndex:l%s-s,amount:s,disabledIndices:i}))),Vt(e,f)&&(f=l))}if(n==="both"){const h=Rt(l/s);t.key===(o?at:ut)&&(a&&ke(t),l%s!==s-1?(f=Pe(e,{startingIndex:l,disabledIndices:i}),r&&$t(f,s,h)&&(f=Pe(e,{startingIndex:l-l%s-1,disabledIndices:i}))):r&&(f=Pe(e,{startingIndex:l-l%s-1,disabledIndices:i})),$t(f,s,h)&&(f=l)),t.key===(o?ut:at)&&(a&&ke(t),l%s!==0?(f=Pe(e,{startingIndex:l,decrement:!0,disabledIndices:i}),r&&$t(f,s,h)&&(f=Pe(e,{startingIndex:l+(s-l%s),decrement:!0,disabledIndices:i}))):r&&(f=Pe(e,{startingIndex:l+(s-l%s),decrement:!0,disabledIndices:i})),$t(f,s,h)&&(f=l));const x=Rt(d/s)===h;Vt(e,f)&&(r&&x?f=t.key===(o?ut:at)?d:Pe(e,{startingIndex:l-l%s-1,disabledIndices:i}):f=l)}return f}function Ss(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},c)=>{let d=!1;for(n&&(o=0);!d;){const l=[];for(let a=0;a<s;a+=1)for(let f=0;f<i;f+=1)l.push(o+a+f*t);o%t+s<=t&&l.every(a=>r[a]==null)?(l.forEach(a=>{r[a]=c}),d=!0):o+=1}}),[...r]}function Cs(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Ts(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function Ft(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}function Le(e){const t=Ot(Os,e).current;return t.next=e,J(t.effect),t}function Os(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ro(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Ms{nodesRef={current:[]};events=ro();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const oo=u.createContext(null),so=u.createContext(null),un=()=>u.useContext(oo)?.id||null,_t=e=>{const t=u.useContext(so);return e??t};function Sl(e){const t=Nn(),n=_t(e),r=un();return J(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function Cl(e){const{children:t,id:n}=e,r=un();return Ce.jsx(oo.Provider,{value:u.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Tl(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new Ms).current;return Ce.jsx(so.Provider,{value:r,children:t})}let ur=0;function Xt(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ur);const s=()=>e?.focus({preventScroll:n});o?s():ur=requestAnimationFrame(s)}const St={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function fr(e){return e==="inert"?St.inert:e==="aria-hidden"?St["aria-hidden"]:St.none}let Ut=new WeakSet,jt={},gn=0;const io=e=>e&&(e.host||io(e.parentNode)),As=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=io(n);return e.contains(r)?r:null}).filter(n=>n!=null);function Is(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=As(t,e),c=new Set,d=new Set(i),l=[];jt[o]||(jt[o]=new WeakMap);const a=jt[o];i.forEach(f),g(t),c.clear();function f(p){!p||c.has(p)||(c.add(p),p.parentNode&&f(p.parentNode))}function g(p){!p||d.has(p)||[].forEach.call(p.children,m=>{if(Wt(m)!=="script")if(c.has(m))g(m);else{const b=s?m.getAttribute(s):null,R=b!==null&&b!=="false",h=fr(s),x=(h.get(m)||0)+1,y=(a.get(m)||0)+1;h.set(m,x),a.set(m,y),l.push(m),x===1&&R&&Ut.add(m),y===1&&m.setAttribute(o,""),!R&&s&&m.setAttribute(s,s==="inert"?"":"true")}})}return gn+=1,()=>{l.forEach(p=>{const m=fr(s),R=(m.get(p)||0)-1,h=(a.get(p)||0)-1;m.set(p,R),a.set(p,h),R||(!Ut.has(p)&&s&&p.removeAttribute(s),Ut.delete(p)),h||p.removeAttribute(o)}),gn-=1,gn||(St.inert=new WeakMap,St["aria-hidden"]=new WeakMap,St.none=new WeakMap,Ut=new WeakSet,jt={})}}function Ps(e,t=!1,n=!1){const r=qe(e[0]).body;return Is(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}function ks(e,t){const n=We(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 dr=20;let lt=[];function Gn(){lt=lt.filter(e=>e.isConnected)}function Ls(e){Gn(),e&&Wt(e)!=="body"&&(lt.push(e),lt.length>dr&&(lt=lt.slice(-dr)))}function yn(){return Gn(),lt[lt.length-1]}function Ds(e){if(!e)return null;const t=Wn();return Ur(e,t)?e:_r(e,t)[0]||e}function Vs(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Ze(e).display!=="none"}function pr(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Wn(),o=Xo(e,n).filter(i=>{const c=i.getAttribute("data-tabindex")||"";return Ur(i,n)||i.hasAttribute("data-tabindex")&&!c.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Fs(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:c=!1,modal:d=!0,closeOnFocusOut:l=!0,openInteractionType:a="",getInsideElements:f=()=>[],nextFocusableElement:g,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:b}=e,R="rootStore"in t?t.rootStore:t,h=R.useState("open"),x=R.useState("domReferenceElement"),y=R.useState("floatingElement"),{events:v,dataRef:S}=R.context,O=re(()=>S.current.floatingContext?.nodeId),M=re(f),A=s===!1,z=On(x)&&A,Z=Le(o),G=Le(s),Q=Le(i),U=Le(a),X=_t(b),P=zo(),F=u.useRef(null),te=u.useRef(null),E=u.useRef(!1),V=u.useRef(!1),I=u.useRef(!1),B=u.useRef(-1),ye=u.useRef(""),_=u.useRef(""),me=u.useRef(null),se=u.useRef(null),q=Zt(me,m,P?.beforeInsideRef),ne=Zt(se,P?.afterInsideRef),ge=Ge(),ve=Ge(),ee=Hn(),pe=P!=null,w=en(y),N=re((T=w)=>T?_r(T,Wn()):[]),D=re(T=>{const k=N(T);return Z.current.map(()=>k).filter(Boolean).flat()});u.useEffect(()=>{if(r||!d)return;function T(Y){Y.key==="Tab"&&Re(w,ht(qe(w)))&&N().length===0&&!z&&ke(Y)}const k=qe(w);return k.addEventListener("keydown",T),()=>{k.removeEventListener("keydown",T)}},[r,x,w,d,Z,z,N,D]),u.useEffect(()=>{if(r||!y)return;function T(k){const Y=Qe(k),K=N().indexOf(Y);K!==-1&&(B.current=K)}return y.addEventListener("focusin",T),()=>{y.removeEventListener("focusin",T)}},[r,y,N]),u.useEffect(()=>{if(r||!h)return;const T=qe(w);function k(){I.current=!1}function Y(K){const $=Qe(K),H=Re(y,$)||Re(x,$)||Re(P?.portalNode,$);I.current=!H,_.current=K.pointerType||"keyboard"}function j(){_.current="keyboard"}return T.addEventListener("pointerdown",Y,!0),T.addEventListener("pointerup",k,!0),T.addEventListener("pointercancel",k,!0),T.addEventListener("keydown",j,!0),()=>{T.removeEventListener("pointerdown",Y,!0),T.removeEventListener("pointerup",k,!0),T.removeEventListener("pointercancel",k,!0),T.removeEventListener("keydown",j,!0)}},[r,y,x,w,h,P]),u.useEffect(()=>{if(r||!l)return;function T(){V.current=!0,ve.start(0,()=>{V.current=!1})}function k($){const H=$.relatedTarget,C=$.currentTarget,W=Qe($);queueMicrotask(()=>{const L=O(),ae=R.context.triggerElements,ue=H?.hasAttribute(Mn("focus-guard"))&&[me.current,se.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,ct(p),ct(g)].includes(H),he=!(Re(x,H)||Re(y,H)||Re(H,y)||Re(P?.portalNode,H)||H!=null&&ae.hasElement(H)||ae.hasMatchingElement(de=>Re(de,H))||ue||X&&(Et(X.nodesRef.current,L).find(de=>Re(de.context?.elements.floating,H)||Re(de.context?.elements.domReference,H))||sr(X.nodesRef.current,L).find(de=>[de.context?.elements.floating,en(de.context?.elements.floating)].includes(H)||de.context?.elements.domReference===H)));if(C===x&&w&&pr(w,Z),c&&C!==x&&!Vs(W)&&ht(qe(w))===qe(w).body){if(Ne(w)&&(w.focus(),c==="popup")){ee.request(()=>{w.focus()});return}const de=B.current,be=N(),Oe=be[de]||be[be.length-1]||w;Ne(Oe)&&Oe.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(z||!d)&&H&&he&&!V.current&&(z||H!==yn())&&(E.current=!0,R.setOpen(!1,Se(_n,$)))})}function Y(){I.current||(S.current.insideReactTree=!0,ge.start(0,()=>{S.current.insideReactTree=!1}))}const j=Ne(x)?x:null,K=[];if(!(!y&&!j))return j&&(j.addEventListener("focusout",k),j.addEventListener("pointerdown",T),K.push(()=>{j.removeEventListener("focusout",k),j.removeEventListener("pointerdown",T)})),y&&(y.addEventListener("focusout",k),P&&(y.addEventListener("focusout",Y,!0),K.push(()=>{y.removeEventListener("focusout",Y,!0)})),K.push(()=>{y.removeEventListener("focusout",k)})),()=>{K.forEach($=>{$()})}},[r,x,y,w,d,X,P,R,l,c,N,z,O,Z,S,ge,ve,ee,g,p]),u.useEffect(()=>{if(r||!y||!h)return;const T=Array.from(P?.portalNode?.querySelectorAll(`[${Mn("portal")}]`)||[]),Y=(X?sr(X.nodesRef.current,O()):[]).find($=>On($.context?.elements.domReference||null))?.context?.elements.domReference,j=[y,Y,...T,...M(),F.current,te.current,me.current,se.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,ct(p),ct(g),z?x:null].filter($=>$!=null),K=Ps(j,d||z);return()=>{K()}},[h,r,x,y,d,Z,P,z,X,O,M,g,p]),J(()=>{if(!h||r||!Ne(w))return;const T=qe(w),k=ht(T);queueMicrotask(()=>{const Y=D(w),j=G.current,K=typeof j=="function"?j(U.current||""):j;if(K===void 0||K===!1)return;let $;K===!0||K===null?$=Y[0]||w:$=ct(K),$=$||Y[0]||w,!Re(w,k)&&Xt($,{preventScroll:$===w})})},[r,h,w,A,D,G,U]),J(()=>{if(r||!w)return;const T=qe(w),k=ht(T);Ls(k);function Y($){if($.open||(ye.current=ks($.nativeEvent,_.current)),$.reason===Yo&&$.nativeEvent.type==="mouseleave"&&(E.current=!0),$.reason===Bn)if($.nested)E.current=!1;else if(Zr($.nativeEvent)||eo($.nativeEvent))E.current=!1;else{let H=!1;document.createElement("div").focus({get preventScroll(){return H=!0,!1}}),H?E.current=!1:E.current=!0}}v.on("openchange",Y);const j=T.createElement("span");j.setAttribute("tabindex","-1"),j.setAttribute("aria-hidden","true"),Object.assign(j.style,$r),pe&&x&&x.insertAdjacentElement("afterend",j);function K(){const $=Q.current;let H=typeof $=="function"?$(ye.current):$;if(H===void 0||H===!1)return null;if(H===null&&(H=!0),typeof H=="boolean"){const W=x||yn();return W&&W.isConnected?W:j}const C=x||yn()||j;return ct(H)||C}return()=>{v.off("openchange",Y);const $=ht(T),H=Re(y,$)||X&&Et(X.nodesRef.current,O(),!1).some(W=>Re(W.context?.elements.floating,$)),C=K();queueMicrotask(()=>{const W=Ds(C),L=typeof Q.current!="boolean";Q.current&&!E.current&&Ne(W)&&(!(!L&&W!==$&&$!==T.body)||H)&&W.focus({preventScroll:!0}),j.remove()})}},[r,y,w,Q,S,v,X,pe,x,O]),u.useEffect(()=>{queueMicrotask(()=>{E.current=!1})},[r]),u.useEffect(()=>{if(r||!h)return;function T(Y){Qe(Y)?.closest(`[${Go}]`)&&(V.current=!0)}const k=qe(w);return k.addEventListener("pointerdown",T,!0),()=>{k.removeEventListener("pointerdown",T,!0)}},[r,h,w]),J(()=>{if(!r&&P)return P.setFocusManagerState({modal:d,closeOnFocusOut:l,open:h,onOpenChange:R.setOpen,domReference:x}),()=>{P.setFocusManagerState(null)}},[r,P,d,h,R,l,x]),J(()=>{if(!(r||!w))return pr(w,Z),()=>{queueMicrotask(Gn)}},[r,w,Z]);const le=!r&&(d?!z:!0)&&(pe||d);return Ce.jsxs(u.Fragment,{children:[le&&Ce.jsx(tr,{"data-type":"inside",ref:q,onFocus:T=>{if(d){const k=D();Xt(k[k.length-1])}else P?.portalNode&&(E.current=!1,nr(T,P.portalNode)?Ko(x)?.focus():ct(p??P.beforeOutsideRef)?.focus())}}),n,le&&Ce.jsx(tr,{"data-type":"inside",ref:ne,onFocus:T=>{d?Xt(D()[0]):P?.portalNode&&(l&&(E.current=!0),nr(T,P.portalNode)?qo(x)?.focus():ct(g??P.afterOutsideRef)?.focus())}})]})}function Ns(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:l=0}=t,a=u.useRef(void 0),f=Hn(),g=Ge(),p=u.useMemo(()=>({onPointerDown(m){a.current=m.pointerType},onMouseDown(m){const b=a.current,R=m.nativeEvent,h=n.select("open");if(m.button!==0||s==="click"||ir(b,!0)&&c)return;const x=r.current.openEvent,y=x?.type,v=n.select("domReferenceElement")!==m.currentTarget,S=h&&v||!(h&&i&&(!(x&&d)||y==="click"||y==="mousedown"));if(Jo(R.target)){const M=Se(Dt,R,R.target);S&&b==="touch"&&l>0?g.start(l,()=>{n.setOpen(!0,M)}):n.setOpen(S,M);return}const O=m.currentTarget;f.request(()=>{const M=Se(Dt,R,O);S&&b==="touch"&&l>0?g.start(l,()=>{n.setOpen(!0,M)}):n.setOpen(S,M)})},onClick(m){if(s==="mousedown-only")return;const b=a.current;if(s==="mousedown"&&b){a.current=void 0;return}if(ir(b,!0)&&c)return;const R=n.select("open"),h=r.current.openEvent,x=n.select("domReferenceElement")!==m.currentTarget,y=R&&x||!(R&&i&&(!(h&&d)||to(h))),v=Se(Dt,m.nativeEvent,m.currentTarget);y&&b==="touch"&&l>0?g.start(l,()=>{n.setOpen(!0,v)}):n.setOpen(y,v)},onKeyDown(){a.current=void 0}}),[r,s,c,n,d,i,f,g,l]);return u.useMemo(()=>o?{reference:p}:Nt,[o,p])}function hr(e,t,n){let{reference:r,floating:o}=e;const s=Xe(t),i=qn(t),c=Kn(i),d=Be(t),l=s==="y",a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let p;switch(d){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(ft(t)){case"start":p[i]-=g*(n&&l?-1:1);break;case"end":p[i]+=g*(n&&l?-1:1);break}return p}async function Hs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:d}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:g=!1,padding:p=0}=st(t,e),m=no(p),R=c[g?f==="floating"?"reference":"floating":f],h=rn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:d})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),v=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},S=rn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:y,strategy:d}):x);return{top:(h.top-S.top+m.top)/v.y,bottom:(S.bottom-h.bottom+m.bottom)/v.y,left:(h.left-S.left+m.left)/v.x,right:(S.right-h.right+m.right)/v.x}}const Ws=50,Bs=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Hs},d=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=hr(l,r,d),g=r,p=0;const m={};for(let b=0;b<s.length;b++){const R=s[b];if(!R)continue;const{name:h,fn:x}=R,{x:y,y:v,data:S,reset:O}=await x({x:a,y:f,initialPlacement:r,placement:g,strategy:o,middlewareData:m,rects:l,platform:c,elements:{reference:e,floating:t}});a=y??a,f=v??f,m[h]={...m[h],...S},O&&p<Ws&&(p++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(l=O.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:a,y:f}=hr(l,g,d)),b=-1)}return{x:a,y:f,placement:g,strategy:o,middlewareData:m}},_s=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:d,elements:l}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...R}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Be(o),x=Xe(c),y=Be(c)===c,v=await(d.isRTL==null?void 0:d.isRTL(l.floating)),S=g||(y||!b?[nn(c)]:ys(c)),O=m!=="none";!g&&O&&S.push(...Rs(c,b,m,v));const M=[c,...S],A=await d.detectOverflow(t,R),z=[];let Z=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&z.push(A[h]),f){const X=gs(o,i,v);z.push(A[X[0]],A[X[1]])}if(Z=[...Z,{placement:o,overflows:z}],!z.every(X=>X<=0)){var G,Q;const X=(((G=s.flip)==null?void 0:G.index)||0)+1,P=M[X];if(P&&(!(f==="alignment"?x!==Xe(P):!1)||Z.every(E=>Xe(E.placement)===x?E.overflows[0]>0:!0)))return{data:{index:X,overflows:Z},reset:{placement:P}};let F=(Q=Z.filter(te=>te.overflows[0]<=0).sort((te,E)=>te.overflows[1]-E.overflows[1])[0])==null?void 0:Q.placement;if(!F)switch(p){case"bestFit":{var U;const te=(U=Z.filter(E=>{if(O){const V=Xe(E.placement);return V===x||V==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(V=>V>0).reduce((V,I)=>V+I,0)]).sort((E,V)=>E[1]-V[1])[0])==null?void 0:U[0];te&&(F=te);break}case"initialPlacement":F=c;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function mr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gr(e){return hs.some(t=>e[t]>=0)}const $s=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=mr(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:gr(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=mr(i,n.floating);return{data:{escapedOffsets:c,escaped:gr(c)}}}default:return{}}}}},co=new Set(["left","top"]);async function Us(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Be(n),c=ft(n),d=Xe(n)==="y",l=co.has(i)?-1:1,a=s&&d?-1:1,f=st(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),d?{x:p*a,y:g*l}:{x:g*l,y:p*a}}const js=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,d=await Us(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:s+d.y,data:{...d,placement:i}}}}},zs=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:d={fn:h=>{let{x,y}=h;return{x,y}}},...l}=st(e,t),a={x:n,y:r},f=await s.detectOverflow(t,l),g=Xe(Be(o)),p=Yn(g);let m=a[p],b=a[g];if(i){const h=p==="y"?"top":"left",x=p==="y"?"bottom":"right",y=m+f[h],v=m-f[x];m=Pn(y,m,v)}if(c){const h=g==="y"?"top":"left",x=g==="y"?"bottom":"right",y=b+f[h],v=b-f[x];b=Pn(y,b,v)}const R=d.fn({...t,[p]:m,[g]:b});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[p]:i,[g]:c}}}}}},Ys=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:l=!0}=st(e,t),a={x:n,y:r},f=Xe(o),g=Yn(f);let p=a[g],m=a[f];const b=st(c,t),R=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const y=g==="y"?"height":"width",v=s.reference[g]-s.floating[y]+R.mainAxis,S=s.reference[g]+s.reference[y]-R.mainAxis;p<v?p=v:p>S&&(p=S)}if(l){var h,x;const y=g==="y"?"width":"height",v=co.has(Be(o)),S=s.reference[f]-s.floating[y]+(v&&((h=i.offset)==null?void 0:h[f])||0)+(v?0:R.crossAxis),O=s.reference[f]+s.reference[y]+(v?0:((x=i.offset)==null?void 0:x[f])||0)-(v?R.crossAxis:0);m<S?m=S:m>O&&(m=O)}return{[g]:p,[f]:m}}}},Ks=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:d=()=>{},...l}=st(e,t),a=await i.detectOverflow(t,l),f=Be(o),g=ft(o),p=Xe(o)==="y",{width:m,height:b}=s.floating;let R,h;f==="top"||f==="bottom"?(R=f,h=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=f,R=g==="end"?"top":"bottom");const x=b-a.top-a.bottom,y=m-a.left-a.right,v=At(b-a[R],x),S=At(m-a[h],y),O=!t.middlewareData.shift;let M=v,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=x),O&&!g){const Z=ze(a.left,0),G=ze(a.right,0),Q=ze(a.top,0),U=ze(a.bottom,0);p?A=m-2*(Z!==0||G!==0?Z+G:ze(a.left,a.right)):M=b-2*(Q!==0||U!==0?Q+U:ze(a.top,a.bottom))}await d({...t,availableWidth:A,availableHeight:M});const z=await i.getDimensions(c.floating);return m!==z.width||b!==z.height?{reset:{rects:!0}}:{}}}};function lo(e){const t=Ze(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ne(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=tn(n)!==s||tn(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Xn(e){return Ee(e)?e:e.contextElement}function Ct(e){const t=Xn(e);if(!Ne(t))return tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lo(t);let i=(s?tn(n.width):n.width)/r,c=(s?tn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const qs=tt(0);function ao(e){const t=We(e);return!$n()||!t.visualViewport?qs:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==We(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Xn(e);let i=tt(1);t&&(r?Ee(r)&&(i=Ct(r)):i=Ct(e));const c=Gs(s,n,r)?ao(s):tt(0);let d=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,a=o.width/i.x,f=o.height/i.y;if(s){const g=We(s),p=r&&Ee(r)?We(r):r;let m=g,b=rr(m);for(;b&&r&&p!==m;){const R=Ct(b),h=b.getBoundingClientRect(),x=Ze(b),y=h.left+(b.clientLeft+parseFloat(x.paddingLeft))*R.x,v=h.top+(b.clientTop+parseFloat(x.paddingTop))*R.y;d*=R.x,l*=R.y,a*=R.x,f*=R.y,d+=y,l+=v,m=We(b),b=rr(m)}}return rn({width:a,height:f,x:d,y:l})}function fn(e,t){const n=ln(e).scrollLeft;return t?t.left+n:gt(it(e)).left+n}function uo(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-fn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Xs(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?Un(t.floating):!1;if(r===i||c&&s)return n;let d={scrollLeft:0,scrollTop:0},l=tt(1);const a=tt(0),f=Ne(r);if((f||!f&&!s)&&((Wt(r)!=="body"||Bt(i))&&(d=ln(r)),f)){const p=gt(r);l=Ct(r),a.x=p.x+r.clientLeft,a.y=p.y+r.clientTop}const g=i&&!f&&!s?uo(i,d):tt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-d.scrollLeft*l.x+a.x+g.x,y:n.y*l.y-d.scrollTop*l.y+a.y+g.y}}function Js(e){return Array.from(e.getClientRects())}function Qs(e){const t=it(e),n=ln(e),r=e.ownerDocument.body,o=ze(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ze(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+fn(e);const c=-n.scrollTop;return Ze(r).direction==="rtl"&&(i+=ze(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const yr=25;function Zs(e,t){const n=We(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;const a=$n();(!a||a&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const l=fn(r);if(l<=0){const a=r.ownerDocument,f=a.body,g=getComputedStyle(f),p=a.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=yr&&(s-=m)}else l<=yr&&(s+=l);return{width:s,height:i,x:c,y:d}}function ei(e,t){const n=gt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ne(e)?Ct(e):tt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,d=o*s.x,l=r*s.y;return{width:i,height:c,x:d,y:l}}function br(e,t,n){let r;if(t==="viewport")r=Zs(e,n);else if(t==="document")r=Qs(it(e));else if(Ee(t))r=ei(t,n);else{const o=ao(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return rn(r)}function fo(e,t){const n=Mt(e);return n===t||!Ee(n)||mt(n)?!1:Ze(n).position==="fixed"||fo(n,t)}function ti(e,t){const n=t.get(e);if(n)return n;let r=vt(e,[],!1).filter(c=>Ee(c)&&Wt(c)!=="body"),o=null;const s=Ze(e).position==="fixed";let i=s?Mt(e):e;for(;Ee(i)&&!mt(i);){const c=Ze(i),d=jr(i);!d&&c.position==="fixed"&&(o=null),(s?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bt(i)&&!d&&fo(e,i))?r=r.filter(a=>a!==i):o=c,i=Mt(i)}return t.set(e,r),r}function ni(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Un(t)?[]:ti(t,this._c):[].concat(n),r],c=br(t,i[0],o);let d=c.top,l=c.right,a=c.bottom,f=c.left;for(let g=1;g<i.length;g++){const p=br(t,i[g],o);d=ze(p.top,d),l=At(p.right,l),a=At(p.bottom,a),f=ze(p.left,f)}return{width:l-f,height:a-d,x:f,y:d}}function ri(e){const{width:t,height:n}=lo(e);return{width:t,height:n}}function oi(e,t,n){const r=Ne(t),o=it(t),s=n==="fixed",i=gt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=tt(0);function l(){d.x=fn(o)}if(r||!r&&!s)if((Wt(t)!=="body"||Bt(o))&&(c=ln(t)),r){const p=gt(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?uo(o,c):tt(0),f=i.left+c.scrollLeft-d.x-a.x,g=i.top+c.scrollTop-d.y-a.y;return{x:f,y:g,width:i.width,height:i.height}}function bn(e){return Ze(e).position==="static"}function xr(e,t){if(!Ne(e)||Ze(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function po(e,t){const n=We(e);if(Un(e))return n;if(!Ne(e)){let o=Mt(e);for(;o&&!mt(o);){if(Ee(o)&&!bn(o))return o;o=Mt(o)}return n}let r=xr(e,t);for(;r&&Qo(r)&&bn(r);)r=xr(r,t);return r&&mt(r)&&bn(r)&&!jr(r)?n:r||Zo(e)||n}const si=async function(e){const t=this.getOffsetParent||po,n=this.getDimensions,r=await n(e.floating);return{reference:oi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ii(e){return Ze(e).direction==="rtl"}const ci={convertOffsetParentRelativeRectToViewportRelativeRect:Xs,getDocumentElement:it,getClippingRect:ni,getOffsetParent:po,getElementRects:si,getClientRects:Js,getDimensions:ri,getScale:Ct,isElement:Ee,isRTL:ii};function ho(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function li(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const l=e.getBoundingClientRect(),{left:a,top:f,width:g,height:p}=l;if(c||t(),!g||!p)return;const m=Rt(f),b=Rt(o.clientWidth-(a+g)),R=Rt(o.clientHeight-(f+p)),h=Rt(a),y={rootMargin:-m+"px "+-b+"px "+-R+"px "+-h+"px",threshold:ze(0,At(1,d))||1};let v=!0;function S(O){const M=O[0].intersectionRatio;if(M!==d){if(!v)return i();M?i(!1,M):r=setTimeout(()=>{i(!1,1e-7)},1e3)}M===1&&!ho(l,e.getBoundingClientRect())&&i(),v=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return i(!0),s}function wr(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,l=Xn(e),a=o||s?[...l?vt(l):[],...t?vt(t):[]]:[];a.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const f=l&&c?li(l,n):null;let g=-1,p=null;i&&(p=new ResizeObserver(h=>{let[x]=h;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),n()}),l&&!d&&p.observe(l),t&&p.observe(t));let m,b=d?gt(e):null;d&&R();function R(){const h=gt(e);b&&!ho(b,h)&&n(),b=h,m=requestAnimationFrame(R)}return n(),()=>{var h;a.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f?.(),(h=p)==null||h.disconnect(),p=null,d&&cancelAnimationFrame(m)}}const ai=js,ui=zs,fi=_s,di=Ks,pi=$s,hi=Ys,mi=(e,t,n)=>{const r=new Map,o={platform:ci,...n},s={...o.platform,_c:r};return Bs(e,t,{...o,platform:s})};var gi=typeof document<"u",yi=function(){},Jt=gi?u.useLayoutEffect:yi;function on(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!on(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!on(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Rr(e,t){const n=mo(e);return Math.round(t*n)/n}function xn(e){const t=u.useRef(e);return Jt(()=>{t.current=e}),t}function bi(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:d,open:l}=e,[a,f]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=u.useState(r);on(g,r)||p(r);const[m,b]=u.useState(null),[R,h]=u.useState(null),x=u.useCallback(E=>{E!==O.current&&(O.current=E,b(E))},[]),y=u.useCallback(E=>{E!==M.current&&(M.current=E,h(E))},[]),v=s||m,S=i||R,O=u.useRef(null),M=u.useRef(null),A=u.useRef(a),z=d!=null,Z=xn(d),G=xn(o),Q=xn(l),U=u.useCallback(()=>{if(!O.current||!M.current)return;const E={placement:t,strategy:n,middleware:g};G.current&&(E.platform=G.current),mi(O.current,M.current,E).then(V=>{const I={...V,isPositioned:Q.current!==!1};X.current&&!on(A.current,I)&&(A.current=I,jn.flushSync(()=>{f(I)}))})},[g,t,n,G,Q]);Jt(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(E=>({...E,isPositioned:!1})))},[l]);const X=u.useRef(!1);Jt(()=>(X.current=!0,()=>{X.current=!1}),[]),Jt(()=>{if(v&&(O.current=v),S&&(M.current=S),v&&S){if(Z.current)return Z.current(v,S,U);U()}},[v,S,U,Z,z]);const P=u.useMemo(()=>({reference:O,floating:M,setReference:x,setFloating:y}),[x,y]),F=u.useMemo(()=>({reference:v,floating:S}),[v,S]),te=u.useMemo(()=>{const E={position:n,left:0,top:0};if(!F.floating)return E;const V=Rr(F.floating,a.x),I=Rr(F.floating,a.y);return c?{...E,transform:"translate("+V+"px, "+I+"px)",...mo(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:I}},[n,c,F.floating,a.x,a.y]);return u.useMemo(()=>({...a,update:U,refs:P,elements:F,floatingStyles:te}),[a,U,P,F,te])}const xi=(e,t)=>{const n=ai(e);return{name:n.name,fn:n.fn,options:[e,t]}},wi=(e,t)=>{const n=ui(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ri=(e,t)=>({fn:hi(e).fn,options:[e,t]}),vi=(e,t)=>{const n=fi(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ei=(e,t)=>{const n=di(e);return{name:n.name,fn:n.fn,options:[e,t]}},Si=(e,t)=>{const n=pi(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ci={intentional:"onClick",sloppy:"onPointerDown"};function Ti(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Oi(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:c,dataRef:d}=n.context,{enabled:l=!0,escapeKey:a=!0,outsidePress:f=!0,outsidePressEvent:g="sloppy",referencePress:p=!1,referencePressEvent:m="sloppy",ancestorScroll:b=!1,bubbles:R,externalTree:h}=t,x=_t(h),y=re(typeof f=="function"?f:()=>!1),v=typeof f=="function"?y:f,S=u.useRef(!1),{escapeKey:O,outsidePress:M}=Ti(R),A=u.useRef(null),z=Ge(),Z=Ge(),G=re(()=>{Z.clear(),d.current.insideReactTree=!1}),Q=u.useRef(!1),U=u.useRef(""),X=re(w=>{U.current=w.pointerType}),P=re(()=>{const w=U.current,N=w==="pen"||!w?"mouse":w,D=typeof g=="function"?g():g;return typeof D=="string"?D:D[N]}),F=re(w=>{if(!r||!l||!a||w.key!=="Escape"||Q.current)return;const N=d.current.floatingContext?.nodeId,D=x?Et(x.nodesRef.current,N):[];if(!O&&D.length>0){let k=!0;if(D.forEach(Y=>{Y.context?.open&&!Y.context.dataRef.current.__escapeKeyBubbles&&(k=!1)}),!k)return}const le=ps(w)?w.nativeEvent:w,T=Se(ts,le);n.setOpen(!1,T),!O&&!T.isPropagationAllowed&&w.stopPropagation()}),te=re(w=>{const N=P();return N==="intentional"&&w.type!=="click"||N==="sloppy"&&w.type==="click"}),E=re(()=>{d.current.insideReactTree=!0,Z.start(0,G)}),V=re((w,N=!1)=>{if(te(w)){G();return}if(d.current.insideReactTree){G();return}if(P()==="intentional"&&N||typeof v=="function"&&!v(w))return;const D=Qe(w),le=`[${Mn("inert")}]`,T=qe(n.select("floatingElement")).querySelectorAll(le),k=n.context.triggerElements;if(D&&(k.hasElement(D)||k.hasMatchingElement(H=>Re(H,D))))return;let Y=Ee(D)?D:null;for(;Y&&!mt(Y);){const H=Mt(Y);if(mt(H)||!Ee(H))break;Y=H}if(T.length&&Ee(D)&&!es(D)&&!Re(D,n.select("floatingElement"))&&Array.from(T).every(H=>!Re(Y,H)))return;if(Ne(D)&&!("touches"in w)){const H=mt(D),C=Ze(D),W=/auto|scroll/,L=H||W.test(C.overflowX),ae=H||W.test(C.overflowY),ue=L&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,he=ae&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,de=C.direction==="rtl",be=he&&(de?w.offsetX<=D.offsetWidth-D.clientWidth:w.offsetX>D.clientWidth),Oe=ue&&w.offsetY>D.clientHeight;if(be||Oe)return}const j=d.current.floatingContext?.nodeId,K=x&&Et(x.nodesRef.current,j).some(H=>Je(w,H.context?.elements.floating));if(Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement"))||K)return;const $=x?Et(x.nodesRef.current,j):[];if($.length>0){let H=!0;if($.forEach(C=>{C.context?.open&&!C.context.dataRef.current.__outsidePressBubbles&&(H=!1)}),!H)return}n.setOpen(!1,Se(Bn,w)),G()}),I=re(w=>{P()!=="sloppy"||w.pointerType==="touch"||!n.select("open")||!l||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement"))||V(w)}),B=re(w=>{if(P()!=="sloppy"||!n.select("open")||!l||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement")))return;const N=w.touches[0];N&&(A.current={startTime:Date.now(),startX:N.clientX,startY:N.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},z.start(1e3,()=>{A.current&&(A.current.dismissOnTouchEnd=!1,A.current.dismissOnMouseDown=!1)}))}),ye=re(w=>{const N=Qe(w);function D(){B(w),N?.removeEventListener(w.type,D)}N?.addEventListener(w.type,D)}),_=re(w=>{const N=S.current;if(S.current=!1,z.clear(),w.type==="mousedown"&&A.current&&!A.current.dismissOnMouseDown)return;const D=Qe(w);function le(){w.type==="pointerdown"?I(w):V(w,N),D?.removeEventListener(w.type,le)}D?.addEventListener(w.type,le)}),me=re(w=>{if(P()!=="sloppy"||!A.current||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement")))return;const N=w.touches[0];if(!N)return;const D=Math.abs(N.clientX-A.current.startX),le=Math.abs(N.clientY-A.current.startY),T=Math.sqrt(D*D+le*le);T>5&&(A.current.dismissOnTouchEnd=!0),T>10&&(V(w),z.clear(),A.current=null)}),se=re(w=>{const N=Qe(w);function D(){me(w),N?.removeEventListener(w.type,D)}N?.addEventListener(w.type,D)}),q=re(w=>{P()!=="sloppy"||!A.current||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement"))||(A.current.dismissOnTouchEnd&&V(w),z.clear(),A.current=null)}),ne=re(w=>{const N=Qe(w);function D(){q(w),N?.removeEventListener(w.type,D)}N?.addEventListener(w.type,D)});u.useEffect(()=>{if(!r||!l)return;d.current.__escapeKeyBubbles=O,d.current.__outsidePressBubbles=M;const w=new An;function N(Y){n.setOpen(!1,Se(an,Y))}function D(){w.clear(),Q.current=!0}function le(){w.start($n()?5:0,()=>{Q.current=!1})}const T=qe(o);T.addEventListener("pointerdown",X,!0),a&&(T.addEventListener("keydown",F),T.addEventListener("compositionstart",D),T.addEventListener("compositionend",le)),v&&(T.addEventListener("click",_,!0),T.addEventListener("pointerdown",_,!0),T.addEventListener("touchstart",ye,!0),T.addEventListener("touchmove",se,!0),T.addEventListener("touchend",ne,!0),T.addEventListener("mousedown",_,!0));let k=[];return b&&(Ee(i)&&(k=vt(i)),Ee(o)&&(k=k.concat(vt(o))),!Ee(s)&&s&&s.contextElement&&(k=k.concat(vt(s.contextElement)))),k=k.filter(Y=>Y!==T.defaultView?.visualViewport),k.forEach(Y=>{Y.addEventListener("scroll",N,{passive:!0})}),()=>{T.removeEventListener("pointerdown",X,!0),a&&(T.removeEventListener("keydown",F),T.removeEventListener("compositionstart",D),T.removeEventListener("compositionend",le)),v&&(T.removeEventListener("click",_,!0),T.removeEventListener("pointerdown",_,!0),T.removeEventListener("touchstart",ye,!0),T.removeEventListener("touchmove",se,!0),T.removeEventListener("touchend",ne,!0),T.removeEventListener("mousedown",_,!0)),k.forEach(Y=>{Y.removeEventListener("scroll",N)}),w.clear(),S.current=!1}},[d,o,s,i,a,v,r,c,b,l,O,M,F,V,_,I,ye,se,ne,X,n]),u.useEffect(G,[v,G]);const ge=u.useMemo(()=>({onKeyDown:F,...p&&{[Ci[m]]:w=>{n.setOpen(!1,Se(Dt,w.nativeEvent))},...m!=="intentional"&&{onClick(w){n.setOpen(!1,Se(Dt,w.nativeEvent))}}}}),[F,n,p,m]),ve=re(w=>{const N=Qe(w.nativeEvent);!Re(n.select("floatingElement"),N)||w.button!==0||(S.current=!0)}),ee=re(w=>{!r||!l||w.button!==0||(S.current=!0)}),pe=u.useMemo(()=>({onKeyDown:F,onPointerDown:ve,onMouseDown:ve,onMouseUp:ve,onClickCapture:E,onMouseDownCapture(w){E(),ee(w)},onPointerDownCapture(w){E(),ee(w)},onMouseUpCapture:E,onTouchEndCapture:E,onTouchMoveCapture:E}),[F,ve,E,ee]);return u.useMemo(()=>l?{reference:ge,floating:pe,trigger:ge}:{},[l,ge,pe])}var sn=Symbol("NOT_FOUND");function Mi(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Ai(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Ii(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var vr=e=>Array.isArray(e)?e:[e];function Pi(e){const t=Array.isArray(e[0])?e[0]:e;return Ii(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ki(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}function Li(e){let t;return{get(n){return t&&e(t.key,n)?t.value:sn},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Di(e,t){let n=[];function r(c){const d=n.findIndex(l=>t(c,l.key));if(d>-1){const l=n[d];return d>0&&(n.splice(d,1),n.unshift(l)),l.value}return sn}function o(c,d){r(c)===sn&&(n.unshift({key:c,value:d}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var Vi=(e,t)=>e===t;function Fi(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function Ni(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Vi,maxSize:o=1,resultEqualityCheck:s}=n,i=Fi(r);let c=0;const d=o<=1?Li(i):Di(o,i);function l(){let a=d.get(arguments);if(a===sn){if(a=e.apply(null,arguments),c++,s){const g=d.getEntries().find(p=>s(p.value,a));g&&(a=g.value,c!==0&&c--)}d.put(arguments,a)}return a}return l.clearCache=()=>{d.clear(),l.resetResultsCount()},l.resultsCount=()=>c,l.resetResultsCount=()=>{c=0},l}var Hi=class{constructor(e){this.value=e}deref(){return this.value}},Wi=typeof WeakRef<"u"?WeakRef:Hi,Bi=0,Er=1;function zt(){return{s:Bi,v:void 0,o:null,p:null}}function go(e,t={}){let n=zt();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let c=n;const{length:d}=arguments;for(let f=0,g=d;f<g;f++){const p=arguments[f];if(typeof p=="function"||typeof p=="object"&&p!==null){let m=c.o;m===null&&(c.o=m=new WeakMap);const b=m.get(p);b===void 0?(c=zt(),m.set(p,c)):c=b}else{let m=c.p;m===null&&(c.p=m=new Map);const b=m.get(p);b===void 0?(c=zt(),m.set(p,c)):c=b}}const l=c;let a;if(c.s===Er)a=c.v;else if(a=e.apply(null,arguments),s++,r){const f=o?.deref?.()??o;f!=null&&r(f,a)&&(a=f,s!==0&&s--),o=typeof a=="object"&&a!==null||typeof a=="function"?new Wi(a):a}return l.s=Er,l.v=a,a}return i.clearCache=()=>{n=zt(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function yo(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,c,d={},l=o.pop();typeof l=="object"&&(d=l,l=o.pop()),Mi(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const a={...n,...d},{memoize:f,memoizeOptions:g=[],argsMemoize:p=go,argsMemoizeOptions:m=[]}=a,b=vr(g),R=vr(m),h=Pi(o),x=f(function(){return s++,l.apply(null,arguments)},...b),y=p(function(){i++;const S=ki(h,arguments);return c=x.apply(null,S),c},...R);return Object.assign(y,{resultFunc:l,memoizedResultFunc:x,dependencies:h,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var _i=yo(go),$i=Object.assign((e,t=_i)=>{Ai(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,c,d)=>(i[n[d]]=c,i),{}))},{withTypes:()=>$i});yo({memoize:Ni,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const fe=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(Pt(1));let c;if(e)c=e;else throw new Error("Missing arguments");return c};var wn={exports:{}},Rn={};var Sr;function Ui(){if(Sr)return Rn;Sr=1;var e=zr();function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(f,g){var p=g(),m=r({inst:{value:p,getSnapshot:g}}),b=m[0].inst,R=m[1];return s(function(){b.value=p,b.getSnapshot=g,d(b)&&R({inst:b})},[f,p,g]),o(function(){return d(b)&&R({inst:b}),f(function(){d(b)&&R({inst:b})})},[f]),i(p),p}function d(f){var g=f.getSnapshot;f=f.value;try{var p=g();return!n(f,p)}catch{return!0}}function l(f,g){return g()}var a=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return Rn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:a,Rn}var Cr;function bo(){return Cr||(Cr=1,wn.exports=Ui()),wn.exports}var ji=bo(),vn={exports:{}},En={};var Tr;function zi(){if(Tr)return En;Tr=1;var e=zr(),t=bo();function n(l,a){return l===a&&(l!==0||1/l===1/a)||l!==l&&a!==a}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,d=e.useDebugValue;return En.useSyncExternalStoreWithSelector=function(l,a,f,g,p){var m=s(null);if(m.current===null){var b={hasValue:!1,value:null};m.current=b}else b=m.current;m=c(function(){function h(O){if(!x){if(x=!0,y=O,O=g(O),p!==void 0&&b.hasValue){var M=b.value;if(p(M,O))return v=M}return v=O}if(M=v,r(y,O))return M;var A=g(O);return p!==void 0&&p(M,A)?(y=O,M):(y=O,v=A)}var x=!1,y,v,S=f===void 0?null:f;return[function(){return h(a())},S===null?void 0:function(){return h(S())}]},[a,f,g,p]);var R=o(l,m[0],m[1]);return i(function(){b.hasValue=!0,b.value=R},[R]),d(R),R},En}var Or;function Yi(){return Or||(Or=1,vn.exports=zi()),vn.exports}var Ki=Yi();const qi=ns(19),Gi=qi?Xi:Ji;function ce(e,t,n,r,o){return Gi(e,t,n,r,o)}function Xi(e,t,n,r,o){const s=u.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ji.useSyncExternalStore(e.subscribe,s,s)}function Ji(e,t,n,r,o){return Ki.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class Tt{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 r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){Tt.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Tt.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Tt.prototype.setState.call(this,t)}}class Qi extends Tt{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(t,n){u.useDebugValue(t),J(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;J(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);J(()=>{n.update(t)},[n,...r])}useControlledProp(t,n,r){u.useDebugValue(t);const o=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),J(()=>{s&&!Object.is(o.state[t],n)&&super.setState({...o.state,[t]:n})},[o,t,n,r,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(t,n,r,o)=>{const s=this.selectors[t];return s(this.state,n,r,o)};useState=(t,n,r,o)=>{u.useDebugValue(t);const s=this.selectors[t];return ce(this,s,n,r,o)};useContextCallback(t,n){u.useDebugValue(t);const r=re(n??Ye);this.context[t]=r}useStateSetter(t){const n=u.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const c=o;o=i,n(i,c,this)}})}}const Zi={open:fe(e=>e.open),domReferenceElement:fe(e=>e.domReferenceElement),referenceElement:fe(e=>e.positionReference??e.referenceElement),floatingElement:fe(e=>e.floatingElement),floatingId:fe(e=>e.floatingId)};class ec extends Qi{constructor(t){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:ro(),nested:n,noEmit:r,triggerElements:s},Zi)}setOpen=(t,n)=>{if((!t||!this.state.open||to(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function xo(e,t=!1,n=!1){const[r,o]=u.useState(e&&t?"idle":void 0),[s,i]=u.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),J(()=>{if(!e&&s&&r!=="ending"&&n){const c=pt.request(()=>{o("ending")});return()=>{pt.cancel(c)}}},[e,s,r,n]),J(()=>{if(!e||t)return;const c=pt.request(()=>{o(void 0)});return()=>{pt.cancel(c)}},[t,e]),J(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const c=pt.request(()=>{o("idle")});return()=>{pt.cancel(c)}},[t,e,s,o,r]),u.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}class tc{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elements.delete(r),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 wo(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Nn(),s=un()!=null,i=Ot(()=>new ec({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new tc,floatingId:o,nested:s,noEmit:e.noEmit||!1})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ee(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function nc(e={}){const{nodeId:t,externalTree:n}=e,r=wo(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,c]=u.useState(null),d=u.useRef(null),l=_t(n);J(()=>{s.domReference&&(d.current=s.domReference)},[s.domReference]);const a=bi({...e,elements:{...s,...i&&{reference:i}}}),f=u.useCallback(M=>{const A=Ee(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;c(A),a.refs.setReference(A)},[a.refs]),[g,p]=u.useState(null),[m,b]=u.useState(null);o.useSyncedValue("referenceElement",g),o.useSyncedValue("domReferenceElement",Ee(g)?g:null),o.useSyncedValue("floatingElement",m);const R=u.useCallback(M=>{(Ee(M)||M===null)&&(d.current=M,p(M)),(Ee(a.refs.reference.current)||a.refs.reference.current===null||M!==null&&!Ee(M))&&a.refs.setReference(M)},[a.refs,p]),h=u.useCallback(M=>{b(M),a.refs.setFloating(M)},[a.refs]),x=u.useMemo(()=>({...a.refs,setReference:R,setFloating:h,setPositionReference:f,domReference:d}),[a.refs,R,h,f]),y=u.useMemo(()=>({...a.elements,domReference:s.domReference}),[a.elements,s.domReference]),v=o.useState("open"),S=o.useState("floatingId"),O=u.useMemo(()=>({...a,dataRef:o.context.dataRef,open:v,onOpenChange:o.setOpen,events:o.context.events,floatingId:S,refs:x,elements:y,nodeId:t,rootStore:o}),[a,x,y,t,o,v,S]);return J(()=>{o.context.dataRef.current.floatingContext=O;const M=l?.nodesRef.current.find(A=>A.id===t);M&&(M.context=O)}),u.useMemo(()=>({...a,context:O,refs:x,elements:y,rootStore:o}),[a,x,y,O,o])}function rc(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),r=e.map(l=>l?.item),o=e.map(l=>l?.trigger),s=u.useCallback(l=>Yt(l,e,"reference"),t),i=u.useCallback(l=>Yt(l,e,"floating"),n),c=u.useCallback(l=>Yt(l,e,"item"),r),d=u.useCallback(l=>Yt(l,e,"trigger"),o);return u.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:c,getTriggerProps:d}),[s,i,c,d])}function Yt(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[rs]="");for(const i in e)o&&e&&(i===Yr||i===Kr)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let c;const d=t[i]?.[n];typeof d=="function"?c=e?d(e):null:c=d,c&&Mr(s,c,o,r)}return Mr(s,e,o,r),s}function Mr(e,t,n,r){for(const o in t){const s=t[o];n&&(o===Yr||o===Kr)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(c=>c(...i)).find(c=>c!==void 0))):e[o]=s)}}const oc="Escape";function dn(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Kt(e,t){return dn(t,e===Fn||e===Ht,e===at||e===ut)}function Sn(e,t,n){return dn(t,e===Ht,n?e===at:e===ut)||e==="Enter"||e===" "||e===""}function sc(e,t,n){return dn(t,n?e===at:e===ut,e===Ht)}function ic(e,t,n,r){const o=n?e===ut:e===at,s=e===Fn;return t==="both"||t==="horizontal"&&r&&r>1?e===oc:dn(t,o,s)}function cc(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:c,activeIndex:d,onNavigate:l=()=>{},enabled:a=!0,selectedIndex:f=null,allowEscape:g=!1,loopFocus:p=!1,nested:m=!1,rtl:b=!1,virtual:R=!1,focusItemOnOpen:h="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:y=!0,disabledIndices:v=void 0,orientation:S="vertical",parentOrientation:O,cols:M=1,scrollItemIntoView:A=!0,itemSizes:z,dense:Z=!1,id:G,resetOnPointerLeave:Q=!0,externalTree:U}=t,X=en(o),P=Le(X),F=un(),te=_t(U);J(()=>{i.current.orientation=S},[i,S]);const E=On(s),V=u.useRef(h),I=u.useRef(f??-1),B=u.useRef(null),ye=u.useRef(!0),_=re(C=>{l(I.current===-1?null:I.current,C)}),me=u.useRef(_),se=u.useRef(!!o),q=u.useRef(r),ne=u.useRef(!1),ge=u.useRef(!1),ve=Le(v),ee=Le(r),pe=Le(A),w=Le(f),N=Le(Q),D=re(()=>{function C(ue){R?te?.events.emit("virtualfocus",ue):Xt(ue,{sync:ne.current,preventScroll:!0})}const W=c.current[I.current],L=ge.current;W&&C(W),(ne.current?ue=>ue():requestAnimationFrame)(()=>{const ue=c.current[I.current]||W;if(!ue)return;W||C(ue);const he=pe.current;he&&T&&(L||!ye.current)&&ue.scrollIntoView?.(typeof he=="boolean"?{block:"nearest",inline:"nearest"}:he)})});J(()=>{a&&(r&&o?(I.current=f??-1,V.current&&f!=null&&(ge.current=!0,_())):se.current&&(I.current=-1,me.current()))},[a,r,o,f,_]),J(()=>{if(a){if(!r){ne.current=!1;return}if(o)if(d==null){if(ne.current=!1,w.current!=null)return;if(se.current&&(I.current=-1,D()),(!q.current||!se.current)&&V.current&&(B.current!=null||V.current===!0&&B.current==null)){let C=0;const W=()=>{c.current[0]==null?(C<2&&(C?requestAnimationFrame:queueMicrotask)(W),C+=1):(I.current=B.current==null||Sn(B.current,S,b)||m?mn(c):ar(c),B.current=null,_())};W()}}else Vt(c,d)||(I.current=d,D(),ge.current=!1)}},[a,r,o,d,w,m,c,S,b,_,D,ve]),J(()=>{if(!a||o||!te||R||!se.current)return;const C=te.nodesRef.current,W=C.find(ue=>ue.id===F)?.context?.elements.floating,L=ht(qe(o)),ae=C.some(ue=>ue.context&&Re(ue.context.elements.floating,L));W&&!ae&&ye.current&&W.focus({preventScroll:!0})},[a,o,te,F,R]),J(()=>{me.current=_,q.current=r,se.current=!!o}),J(()=>{r||(B.current=null,V.current=h)},[r,h]);const le=d!=null,T=u.useMemo(()=>{function C(L){if(!ee.current)return;const ae=c.current.indexOf(L.currentTarget);ae!==-1&&I.current!==ae&&(I.current=ae,_(L))}return{onFocus(L){ne.current=!0,C(L)},onClick:({currentTarget:L})=>L.focus({preventScroll:!0}),onMouseMove(L){ne.current=!0,ge.current=!1,x&&C(L)},onPointerLeave(L){if(!ee.current||!ye.current||L.pointerType==="touch")return;ne.current=!0;const ae=L.relatedTarget;!x||c.current.includes(ae)||N.current&&(I.current=-1,_(L),R||P.current?.focus({preventScroll:!0}))}}},[ee,P,x,c,_,N,R]),k=u.useCallback(()=>O??te?.nodesRef.current.find(C=>C.id===F)?.context?.dataRef?.current.orientation,[F,te,O]),Y=re(C=>{if(ye.current=!1,ne.current=!0,C.which===229||!ee.current&&C.currentTarget===P.current)return;if(m&&ic(C.key,S,b,M)){Kt(C.key,k())||ke(C),n.setOpen(!1,Se(pn,C.nativeEvent)),Ne(s)&&(R?te?.events.emit("virtualfocus",s):s.focus());return}const W=I.current,L=mn(c,v),ae=ar(c,v);if(E||(C.key==="Home"&&(ke(C),I.current=L,_(C)),C.key==="End"&&(ke(C),I.current=ae,_(C))),M>1){const ue=z||Array.from({length:c.current.length},()=>({width:1,height:1})),he=Ss(ue,M,Z),de=he.findIndex(Ae=>Ae!=null&&!Ft(c,Ae,v)),be=he.reduce((Ae,De,Ke)=>De!=null&&!Ft(c,De,v)?Ke:Ae,-1),Oe=he[Es({current:he.map(Ae=>Ae!=null?c.current[Ae]:null)},{event:C,orientation:S,loopFocus:p,rtl:b,cols:M,disabledIndices:Ts([...(typeof v!="function"?v:null)||c.current.map((Ae,De)=>Ft(c,De,v)?De:void 0),void 0],he),minIndex:de,maxIndex:be,prevIndex:Cs(I.current>ae?L:I.current,ue,he,M,C.key===Ht?"bl":C.key===(b?at:ut)?"tr":"tl"),stopEvent:!0})];if(Oe!=null&&(I.current=Oe,_(C)),S==="both")return}if(Kt(C.key,S)){if(ke(C),r&&!R&&ht(C.currentTarget.ownerDocument)===C.currentTarget){I.current=Sn(C.key,S,b)?L:ae,_(C);return}Sn(C.key,S,b)?p?W>=ae?g&&W!==c.current.length?I.current=-1:(ne.current=!1,I.current=L):I.current=Pe(c,{startingIndex:W,disabledIndices:v}):I.current=Math.min(ae,Pe(c,{startingIndex:W,disabledIndices:v})):p?W<=L?g&&W!==-1?I.current=c.current.length:(ne.current=!1,I.current=ae):I.current=Pe(c,{startingIndex:W,decrement:!0,disabledIndices:v}):I.current=Math.max(L,Pe(c,{startingIndex:W,decrement:!0,disabledIndices:v})),Vt(c,I.current)&&(I.current=-1),_(C)}}),j=u.useMemo(()=>R&&r&&le&&{"aria-activedescendant":`${G}-${d}`},[R,r,le,G,d]),K=u.useMemo(()=>({"aria-orientation":S==="both"?void 0:S,...E?{}:j,onKeyDown(C){if(C.key==="Tab"&&C.shiftKey&&r&&!R){const W=Qe(C.nativeEvent);if(W&&!Re(P.current,W))return;ke(C),n.setOpen(!1,Se(_n,C.nativeEvent)),Ne(s)&&s.focus();return}Y(C)},onPointerMove(){ye.current=!0}}),[j,Y,P,S,E,n,r,R,s]),$=u.useMemo(()=>{function C(L){h==="auto"&&Zr(L.nativeEvent)&&(V.current=!R)}function W(L){V.current=h,h==="auto"&&eo(L.nativeEvent)&&(V.current=!0)}return{onKeyDown(L){const ae=n.select("open");ye.current=!1;const ue=L.key.startsWith("Arrow"),he=sc(L.key,k(),b),de=Kt(L.key,S),be=(m?he:de)||L.key==="Enter"||L.key.trim()==="";if(R&&ae)return Y(L);if(!(!ae&&!y&&ue)){if(be){const Oe=Kt(L.key,k());B.current=m&&Oe?null:L.key}if(m){he&&(ke(L),ae?(I.current=mn(c,ve.current),_(L)):n.setOpen(!0,Se(pn,L.nativeEvent,L.currentTarget)));return}de&&(w.current!=null&&(I.current=w.current),ke(L),!ae&&y?n.setOpen(!0,Se(pn,L.nativeEvent,L.currentTarget)):Y(L),ae&&_(L))}},onFocus(L){n.select("open")&&!R&&(I.current=-1,_(L))},onPointerDown:W,onPointerEnter:W,onMouseDown:C,onClick:C}},[Y,ve,h,c,m,_,n,y,S,k,b,w,R]),H=u.useMemo(()=>({...j,...$}),[j,$]);return u.useMemo(()=>a?{reference:H,floating:K,item:T,trigger:$}:{},[a,H,K,$,T])}function lc(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.context.dataRef,{listRef:s,activeIndex:i,onMatch:c,onTypingChange:d,enabled:l=!0,findMatch:a=null,resetMs:f=750,ignoreKeys:g=In,selectedIndex:p=null}=t,m=Ge(),b=u.useRef(""),R=u.useRef(p??i??-1),h=u.useRef(null);J(()=>{r&&(m.clear(),h.current=null,b.current="")},[r,m]),J(()=>{r&&b.current===""&&(R.current=p??i??-1)},[r,p,i]);const x=re(O=>{O?o.current.typing||(o.current.typing=O,d?.(O)):o.current.typing&&(o.current.typing=O,d?.(O))}),y=re(O=>{function M(Q,U,X){const P=a?a(U,X):U.find(F=>F?.toLocaleLowerCase().indexOf(X.toLocaleLowerCase())===0);return P?Q.indexOf(P):-1}const A=s.current;if(b.current.length>0&&b.current[0]!==" "&&(M(A,A,b.current)===-1?x(!1):O.key===" "&&ke(O)),A==null||g.includes(O.key)||O.key.length!==1||O.ctrlKey||O.metaKey||O.altKey)return;r&&O.key!==" "&&(ke(O),x(!0)),A.every(Q=>Q?Q[0]?.toLocaleLowerCase()!==Q[1]?.toLocaleLowerCase():!0)&&b.current===O.key&&(b.current="",R.current=h.current),b.current+=O.key,m.start(f,()=>{b.current="",R.current=h.current,x(!1)});const Z=R.current,G=M(A,[...A.slice((Z||0)+1),...A.slice(0,(Z||0)+1)],b.current);G!==-1?(c?.(G),h.current=G):O.key!==" "&&(b.current="",x(!1))}),v=u.useMemo(()=>({onKeyDown:y}),[y]),S=u.useMemo(()=>({onKeyDown:y,onKeyUp(O){O.key===" "&&x(!1)}}),[y,x]);return u.useMemo(()=>l?{reference:v,floating:S}:{},[l,v,S])}const ac=u.createContext(void 0);function uc(){return u.useContext(ac)?.direction??"ltr"}const fc=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:d}=t,{element:l,padding:a=0,offsetParent:f="real"}=st(e,t)||{};if(l==null)return{};const g=no(a),p={x:n,y:r},m=qn(o),b=Kn(m),R=await i.getDimensions(l),h=m==="y",x=h?"top":"left",y=h?"bottom":"right",v=h?"clientHeight":"clientWidth",S=s.reference[b]+s.reference[m]-p[m]-s.floating[b],O=p[m]-s.reference[m],M=f==="real"?await i.getOffsetParent?.(l):c.floating;let A=c.floating[v]||s.floating[b];(!A||!await i.isElement?.(M))&&(A=c.floating[v]||s.floating[b]);const z=S/2-O/2,Z=A/2-R[b]/2-1,G=Math.min(g[x],Z),Q=Math.min(g[y],Z),U=G,X=A-R[b]-Q,P=A/2-R[b]/2+z,F=Pn(U,P,X),te=!d.arrow&&ft(o)!=null&&P!==F&&s.reference[b]/2-(P<U?G:Q)-R[b]/2<0,E=te?P<U?P-U:P-X:0;return{[m]:p[m]+E,data:{[m]:F,centerOffset:P-F-E,...te&&{alignmentOffset:E}},reset:te}}}),dc=(e,t)=>({...fc(e),options:[e,t]}),pc={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Si().fn(e)).data?.referenceHidden||s}}}},Qt={sideX:"left",sideY:"top"},Ol={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,d=We(o),l=d.getComputedStyle(o);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:Qt};const f=await s.getOffsetParent?.(o);let g={width:0,height:0};if(i==="fixed"&&d?.visualViewport)g={width:d.visualViewport.width,height:d.visualViewport.height};else if(f===d){const x=nt(o);g={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await s.isElement?.(f)&&(g=await s.getDimensions(f));const p=Be(c);let m=t,b=n;p==="left"&&(m=g.width-(t+r.width)),p==="top"&&(b=g.height-(n+r.height));const R=p==="left"?"right":Qt.sideX,h=p==="top"?"bottom":Qt.sideY;return{x:m,y:b,data:{sideX:R,sideY:h}}}};function Ro(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Ar(e,t,n){const{rects:r,placement:o}=e;return{side:Ro(t,Be(o),n),align:ft(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function hc(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:d=5,sticky:l=!1,arrowPadding:a=5,disableAnchorTracking:f=!1,keepMounted:g=!1,floatingRootContext:p,mounted:m,collisionAvoidance:b,shiftCrossAxis:R=!1,nodeId:h,adaptiveOrigin:x,lazyFlip:y=!1,externalTree:v}=e,[S,O]=u.useState(null);!m&&S!==null&&O(null);const M=b.side||"flip",A=b.align||"flip",z=b.fallbackAxisSide||"end",Z=typeof t=="function"?t:void 0,G=re(Z),Q=Z?G:t,U=Le(t),P=uc()==="rtl",F=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[r],te=s==="center"?F:`${F}-${s}`;let E=d;const V=1,I=r==="bottom"?V:0,B=r==="top"?V:0,ye=r==="right"?V:0,_=r==="left"?V:0;typeof E=="number"?E={top:E+I,right:E+_,bottom:E+B,left:E+ye}:E&&(E={top:(E.top||0)+I,right:(E.right||0)+_,bottom:(E.bottom||0)+B,left:(E.left||0)+ye});const me={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:E},se=u.useRef(null),q=Le(o),ne=Le(i),ee=[xi(we=>{const Me=Ar(we,r,P),Te=typeof q.current=="function"?q.current(Me):q.current,Ie=typeof ne.current=="function"?ne.current(Me):ne.current;return{mainAxis:Te,crossAxis:Ie,alignmentAxis:Ie}},[typeof o!="function"?o:0,typeof i!="function"?i:0,P,r])],pe=A==="none"&&M!=="shift",w=!pe&&(l||R||M==="shift"),N=M==="none"?null:vi({...me,padding:{top:E.top+V,right:E.right+V,bottom:E.bottom+V,left:E.left+V},mainAxis:!R&&M==="flip",crossAxis:A==="flip"?"alignment":!1,fallbackAxisSideDirection:z}),D=pe?null:wi(we=>{const Me=nt(we.elements.floating).documentElement;return{...me,rootBoundary:R?{x:0,y:0,width:Me.clientWidth,height:Me.clientHeight}:void 0,mainAxis:A!=="none",crossAxis:w,limiter:l||R?void 0:Ri(Te=>{if(!se.current)return{};const{width:Ie,height:Ue}=se.current.getBoundingClientRect(),je=Xe(Be(Te.placement)),rt=je==="y"?Ie:Ue,ot=je==="y"?E.left+E.right:E.top+E.bottom;return{offset:rt/2+ot/2}})}},[me,l,R,E,A]);M==="shift"||A==="shift"||s==="center"?ee.push(D,N):ee.push(N,D),ee.push(Ei({...me,apply({elements:{floating:we},rects:{reference:Me},availableWidth:Te,availableHeight:Ie}){Object.entries({"--available-width":`${Te}px`,"--available-height":`${Ie}px`,"--anchor-width":`${Me.width}px`,"--anchor-height":`${Me.height}px`}).forEach(([Ue,je])=>{we.style.setProperty(Ue,je)})}}),dc(()=>({element:se.current||document.createElement("div"),padding:a,offsetParent:"floating"}),[a]),{name:"transformOrigin",fn(we){const{elements:Me,middlewareData:Te,placement:Ie,rects:Ue,y:je}=we,rt=Be(Ie),ot=Xe(rt),dt=se.current,xt=Te.arrow?.x||0,kt=Te.arrow?.y||0,Lt=dt?.clientWidth||0,ie=dt?.clientHeight||0,xe=xt+Lt/2,Ve=kt+ie/2,He=Math.abs(Te.shift?.y||0),Fe=Ue.reference.height/2,et=typeof o=="function"?o(Ar(we,r,P)):o,er=He>et,$o={top:`${xe}px calc(100% + ${et}px)`,bottom:`${xe}px ${-et}px`,left:`calc(100% + ${et}px) ${Ve}px`,right:`${-et}px ${Ve}px`}[rt],Uo=`${xe}px ${Ue.reference.y+Fe-je}px`;return Me.floating.style.setProperty("--transform-origin",w&&ot==="y"&&er?Uo:$o),{}}},pc,x),J(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);const le=u.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:T,elements:k,x:Y,y:j,middlewareData:K,update:$,placement:H,context:C,isPositioned:W,floatingStyles:L}=nc({rootContext:p,placement:te,middleware:ee,strategy:n,whileElementsMounted:g?void 0:(...we)=>wr(...we,le),nodeId:h,externalTree:v}),{sideX:ae,sideY:ue}=K.adaptiveOrigin||Qt,he=W?n:"fixed",de=u.useMemo(()=>x?{position:he,[ae]:Y,[ue]:j}:{position:he,...L},[x,he,ae,Y,ue,j,L]),be=u.useRef(null);J(()=>{if(!m)return;const we=U.current,Me=typeof we=="function"?we():we,Ie=(Ir(Me)?Me.current:Me)||null||null;Ie!==be.current&&(T.setPositionReference(Ie),be.current=Ie)},[m,T,Q,U]),u.useEffect(()=>{if(!m)return;const we=U.current;typeof we!="function"&&Ir(we)&&we.current!==be.current&&(T.setPositionReference(we.current),be.current=we.current)},[m,T,Q,U]),u.useEffect(()=>{if(g&&m&&k.domReference&&k.floating)return wr(k.domReference,k.floating,$,le)},[g,m,k,$,le]);const Oe=Be(H),Ae=Ro(r,Oe,P),De=ft(H)||"center",Ke=!!K.hide?.referenceHidden;J(()=>{y&&m&&W&&O(Oe)},[y,m,W,Oe]);const _e=u.useMemo(()=>({position:"absolute",top:K.arrow?.y,left:K.arrow?.x}),[K.arrow]),$e=K.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:de,arrowStyles:_e,arrowRef:se,arrowUncentered:$e,side:Ae,align:De,physicalSide:Oe,anchorHidden:Ke,refs:T,context:C,isPositioned:W,update:$}),[de,_e,se,$e,Ae,De,Oe,Ke,T,C,W,$])}function Ir(e){return e!=null&&"current"in e}let Jn=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=or.startingStyle]="startingStyle",e[e.endingStyle=or.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),Ln=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const mc={[Ln.popupOpen]:""},gc={[Ln.popupOpen]:"",[Ln.pressed]:""},yc={[Jn.open]:""},bc={[Jn.closed]:""},xc={[Jn.anchorHidden]:""},Ml={open(e){return e?mc:null}},wc={open(e){return e?gc:null}},vo={open(e){return e?yc:bc},anchorHidden(e){return e?xc:null}};function Rc(e){return Nn(e,"base-ui")}const Eo="ArrowUp",So="ArrowDown",Co="ArrowLeft",To="ArrowRight",Oo="Home",Mo="End",vc=new Set([Co,To]),Ec=new Set([Eo,So]),Sc=new Set([...vc,...Ec]);[...Sc];const Cc=new Set([Eo,So,Co,To,Oo,Mo]),Tc=u.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r?.getBoundingClientRect();s=`polygon(
1
+ import{c as Br,b2 as Tn,b3 as jo,b4 as Fn,b5 as Ht,b6 as at,b7 as ut,ax as Ot,a5 as J,j as Ce,aw as Nn,r as u,aD as qe,b8 as Wt,a4 as re,b9 as On,ba as zo,a7 as Zt,az as Ge,bb as Hn,aG as en,bc as _r,bd as Wn,aY as Ne,aA as Mn,be as ct,bf as ht,aF as Re,ab as $r,aC as Yo,bg as Bn,aR as tr,aT as nr,aV as Ko,bh as qo,aE as Qe,k as Se,aO as _n,bi as Ur,bj as We,aQ as Go,bk as Xo,bl as Ze,aL as Dt,bm as Jo,a9 as Nt,bn as vt,ay as Ee,bo as it,bp as rr,bq as $n,br as Un,bs as Mt,bt as mt,bu as Qo,bv as jr,bw as Zo,bx as Bt,by as ln,s as jn,bz as es,bA as Je,aH as An,aM as ts,ac as an,a3 as Pt,bB as zr,bC as ns,a6 as Ye,bD as pt,bE as rs,bF as Yr,bG as Kr,bH as pn,bI as In,bJ as nt,bK as or,bL as qr,bM as Gr,ad as zn,a8 as Xr,aa as os,g as Jr,h as yt,bN as ss,aI as is,bO as cs,aJ as ls,bP as as,bQ as us,ae as Qr,bR as hn}from"./main-DRcFJLLD.js";const fs=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],vl=Br("check",fs);const ds=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],El=Br("chevron-down",ds);function Et(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...Et(e,o.id,n)])}function sr(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function ke(e){e.preventDefault(),e.stopPropagation()}function ps(e){return"nativeEvent"in e}function Zr(e){return e.mozInputSource===0&&e.isTrusted?!0:Tn&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function eo(e){return jo?!1:!Tn&&e.width===0&&e.height===0||Tn&&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 ir(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function to(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const hs=["top","right","bottom","left"],At=Math.min,ze=Math.max,tn=Math.round,Rt=Math.floor,tt=e=>({x:e,y:e}),ms={left:"right",right:"left",bottom:"top",top:"bottom"};function Pn(e,t,n){return ze(e,At(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Be(e){return e.split("-")[0]}function ft(e){return e.split("-")[1]}function Yn(e){return e==="x"?"y":"x"}function Kn(e){return e==="y"?"height":"width"}function Xe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qn(e){return Yn(Xe(e))}function gs(e,t,n){n===void 0&&(n=!1);const r=ft(e),o=qn(e),s=Kn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=nn(i)),[i,nn(i)]}function ys(e){const t=nn(e);return[kn(e),t,kn(t)]}function kn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const cr=["left","right"],lr=["right","left"],bs=["top","bottom"],xs=["bottom","top"];function ws(e,t,n){switch(e){case"top":case"bottom":return n?t?lr:cr:t?cr:lr;case"left":case"right":return t?bs:xs;default:return[]}}function Rs(e,t,n,r){const o=ft(e);let s=ws(Be(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(kn)))),s}function nn(e){const t=Be(e);return ms[t]+e.slice(t.length)}function vs(e){return{top:0,right:0,bottom:0,left:0,...e}}function no(e){return typeof e!="number"?vs(e):{top:e,right:e,bottom:e,left:e}}function rn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function $t(e,t,n){return Math.floor(e/t)!==n}function Vt(e,t){return t<0||t>=e.current.length}function mn(e,t){return Pe(e,{disabledIndices:t})}function ar(e,t){return Pe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Pe(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&Ft(e,s,r));return s}function Es(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:i,minIndex:c,maxIndex:d,prevIndex:l,stopEvent:a=!1}){let f=l;const g=[],p={};let m=!1;{let h=null,x=-1;e.current.forEach((y,v)=>{if(y==null)return;const S=y.closest('[role="row"]');S&&(m=!0),(S!==h||x===-1)&&(h=S,x+=1,g[x]=[]),g[x].push(v),p[v]=x})}const b=m&&g.length>0&&g.some(h=>h.length!==s);function R(h){if(!b||l===-1)return;const x=p[l];if(x==null)return;const y=g[x].indexOf(l);let v=h==="up"?x-1:x+1;r&&(v<0?v=g.length-1:v>=g.length&&(v=0));const S=new Set;for(;v>=0&&v<g.length&&!S.has(v);){S.add(v);const O=g[v];if(O.length===0){v=h==="up"?v-1:v+1;continue}const M=Math.min(y,O.length-1);for(let A=M;A>=0;A-=1){const z=O[A];if(!Ft(e,z,i))return z}v=h==="up"?v-1:v+1,r&&(v<0?v=g.length-1:v>=g.length&&(v=0))}}if(t.key===Fn){const h=R("up");if(h!==void 0)a&&ke(t),f=h;else{if(a&&ke(t),l===-1)f=d;else if(f=Pe(e,{startingIndex:f,amount:s,decrement:!0,disabledIndices:i}),r&&(l-s<c||f<0)){const x=l%s,y=d%s,v=d-(y-x);y===x?f=d:f=y>x?v:v-s}Vt(e,f)&&(f=l)}}if(t.key===Ht){const h=R("down");h!==void 0?(a&&ke(t),f=h):(a&&ke(t),l===-1?f=c:(f=Pe(e,{startingIndex:l,amount:s,disabledIndices:i}),r&&l+s>d&&(f=Pe(e,{startingIndex:l%s-s,amount:s,disabledIndices:i}))),Vt(e,f)&&(f=l))}if(n==="both"){const h=Rt(l/s);t.key===(o?at:ut)&&(a&&ke(t),l%s!==s-1?(f=Pe(e,{startingIndex:l,disabledIndices:i}),r&&$t(f,s,h)&&(f=Pe(e,{startingIndex:l-l%s-1,disabledIndices:i}))):r&&(f=Pe(e,{startingIndex:l-l%s-1,disabledIndices:i})),$t(f,s,h)&&(f=l)),t.key===(o?ut:at)&&(a&&ke(t),l%s!==0?(f=Pe(e,{startingIndex:l,decrement:!0,disabledIndices:i}),r&&$t(f,s,h)&&(f=Pe(e,{startingIndex:l+(s-l%s),decrement:!0,disabledIndices:i}))):r&&(f=Pe(e,{startingIndex:l+(s-l%s),decrement:!0,disabledIndices:i})),$t(f,s,h)&&(f=l));const x=Rt(d/s)===h;Vt(e,f)&&(r&&x?f=t.key===(o?ut:at)?d:Pe(e,{startingIndex:l-l%s-1,disabledIndices:i}):f=l)}return f}function Ss(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},c)=>{let d=!1;for(n&&(o=0);!d;){const l=[];for(let a=0;a<s;a+=1)for(let f=0;f<i;f+=1)l.push(o+a+f*t);o%t+s<=t&&l.every(a=>r[a]==null)?(l.forEach(a=>{r[a]=c}),d=!0):o+=1}}),[...r]}function Cs(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Ts(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function Ft(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}function Le(e){const t=Ot(Os,e).current;return t.next=e,J(t.effect),t}function Os(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ro(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Ms{nodesRef={current:[]};events=ro();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const oo=u.createContext(null),so=u.createContext(null),un=()=>u.useContext(oo)?.id||null,_t=e=>{const t=u.useContext(so);return e??t};function Sl(e){const t=Nn(),n=_t(e),r=un();return J(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function Cl(e){const{children:t,id:n}=e,r=un();return Ce.jsx(oo.Provider,{value:u.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Tl(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new Ms).current;return Ce.jsx(so.Provider,{value:r,children:t})}let ur=0;function Xt(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ur);const s=()=>e?.focus({preventScroll:n});o?s():ur=requestAnimationFrame(s)}const St={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function fr(e){return e==="inert"?St.inert:e==="aria-hidden"?St["aria-hidden"]:St.none}let Ut=new WeakSet,jt={},gn=0;const io=e=>e&&(e.host||io(e.parentNode)),As=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=io(n);return e.contains(r)?r:null}).filter(n=>n!=null);function Is(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=As(t,e),c=new Set,d=new Set(i),l=[];jt[o]||(jt[o]=new WeakMap);const a=jt[o];i.forEach(f),g(t),c.clear();function f(p){!p||c.has(p)||(c.add(p),p.parentNode&&f(p.parentNode))}function g(p){!p||d.has(p)||[].forEach.call(p.children,m=>{if(Wt(m)!=="script")if(c.has(m))g(m);else{const b=s?m.getAttribute(s):null,R=b!==null&&b!=="false",h=fr(s),x=(h.get(m)||0)+1,y=(a.get(m)||0)+1;h.set(m,x),a.set(m,y),l.push(m),x===1&&R&&Ut.add(m),y===1&&m.setAttribute(o,""),!R&&s&&m.setAttribute(s,s==="inert"?"":"true")}})}return gn+=1,()=>{l.forEach(p=>{const m=fr(s),R=(m.get(p)||0)-1,h=(a.get(p)||0)-1;m.set(p,R),a.set(p,h),R||(!Ut.has(p)&&s&&p.removeAttribute(s),Ut.delete(p)),h||p.removeAttribute(o)}),gn-=1,gn||(St.inert=new WeakMap,St["aria-hidden"]=new WeakMap,St.none=new WeakMap,Ut=new WeakSet,jt={})}}function Ps(e,t=!1,n=!1){const r=qe(e[0]).body;return Is(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}function ks(e,t){const n=We(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 dr=20;let lt=[];function Gn(){lt=lt.filter(e=>e.isConnected)}function Ls(e){Gn(),e&&Wt(e)!=="body"&&(lt.push(e),lt.length>dr&&(lt=lt.slice(-dr)))}function yn(){return Gn(),lt[lt.length-1]}function Ds(e){if(!e)return null;const t=Wn();return Ur(e,t)?e:_r(e,t)[0]||e}function Vs(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Ze(e).display!=="none"}function pr(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=Wn(),o=Xo(e,n).filter(i=>{const c=i.getAttribute("data-tabindex")||"";return Ur(i,n)||i.hasAttribute("data-tabindex")&&!c.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Fs(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:c=!1,modal:d=!0,closeOnFocusOut:l=!0,openInteractionType:a="",getInsideElements:f=()=>[],nextFocusableElement:g,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:b}=e,R="rootStore"in t?t.rootStore:t,h=R.useState("open"),x=R.useState("domReferenceElement"),y=R.useState("floatingElement"),{events:v,dataRef:S}=R.context,O=re(()=>S.current.floatingContext?.nodeId),M=re(f),A=s===!1,z=On(x)&&A,Z=Le(o),G=Le(s),Q=Le(i),U=Le(a),X=_t(b),P=zo(),F=u.useRef(null),te=u.useRef(null),E=u.useRef(!1),V=u.useRef(!1),I=u.useRef(!1),B=u.useRef(-1),ye=u.useRef(""),_=u.useRef(""),me=u.useRef(null),se=u.useRef(null),q=Zt(me,m,P?.beforeInsideRef),ne=Zt(se,P?.afterInsideRef),ge=Ge(),ve=Ge(),ee=Hn(),pe=P!=null,w=en(y),N=re((T=w)=>T?_r(T,Wn()):[]),D=re(T=>{const k=N(T);return Z.current.map(()=>k).filter(Boolean).flat()});u.useEffect(()=>{if(r||!d)return;function T(Y){Y.key==="Tab"&&Re(w,ht(qe(w)))&&N().length===0&&!z&&ke(Y)}const k=qe(w);return k.addEventListener("keydown",T),()=>{k.removeEventListener("keydown",T)}},[r,x,w,d,Z,z,N,D]),u.useEffect(()=>{if(r||!y)return;function T(k){const Y=Qe(k),K=N().indexOf(Y);K!==-1&&(B.current=K)}return y.addEventListener("focusin",T),()=>{y.removeEventListener("focusin",T)}},[r,y,N]),u.useEffect(()=>{if(r||!h)return;const T=qe(w);function k(){I.current=!1}function Y(K){const $=Qe(K),H=Re(y,$)||Re(x,$)||Re(P?.portalNode,$);I.current=!H,_.current=K.pointerType||"keyboard"}function j(){_.current="keyboard"}return T.addEventListener("pointerdown",Y,!0),T.addEventListener("pointerup",k,!0),T.addEventListener("pointercancel",k,!0),T.addEventListener("keydown",j,!0),()=>{T.removeEventListener("pointerdown",Y,!0),T.removeEventListener("pointerup",k,!0),T.removeEventListener("pointercancel",k,!0),T.removeEventListener("keydown",j,!0)}},[r,y,x,w,h,P]),u.useEffect(()=>{if(r||!l)return;function T(){V.current=!0,ve.start(0,()=>{V.current=!1})}function k($){const H=$.relatedTarget,C=$.currentTarget,W=Qe($);queueMicrotask(()=>{const L=O(),ae=R.context.triggerElements,ue=H?.hasAttribute(Mn("focus-guard"))&&[me.current,se.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,ct(p),ct(g)].includes(H),he=!(Re(x,H)||Re(y,H)||Re(H,y)||Re(P?.portalNode,H)||H!=null&&ae.hasElement(H)||ae.hasMatchingElement(de=>Re(de,H))||ue||X&&(Et(X.nodesRef.current,L).find(de=>Re(de.context?.elements.floating,H)||Re(de.context?.elements.domReference,H))||sr(X.nodesRef.current,L).find(de=>[de.context?.elements.floating,en(de.context?.elements.floating)].includes(H)||de.context?.elements.domReference===H)));if(C===x&&w&&pr(w,Z),c&&C!==x&&!Vs(W)&&ht(qe(w))===qe(w).body){if(Ne(w)&&(w.focus(),c==="popup")){ee.request(()=>{w.focus()});return}const de=B.current,be=N(),Oe=be[de]||be[be.length-1]||w;Ne(Oe)&&Oe.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(z||!d)&&H&&he&&!V.current&&(z||H!==yn())&&(E.current=!0,R.setOpen(!1,Se(_n,$)))})}function Y(){I.current||(S.current.insideReactTree=!0,ge.start(0,()=>{S.current.insideReactTree=!1}))}const j=Ne(x)?x:null,K=[];if(!(!y&&!j))return j&&(j.addEventListener("focusout",k),j.addEventListener("pointerdown",T),K.push(()=>{j.removeEventListener("focusout",k),j.removeEventListener("pointerdown",T)})),y&&(y.addEventListener("focusout",k),P&&(y.addEventListener("focusout",Y,!0),K.push(()=>{y.removeEventListener("focusout",Y,!0)})),K.push(()=>{y.removeEventListener("focusout",k)})),()=>{K.forEach($=>{$()})}},[r,x,y,w,d,X,P,R,l,c,N,z,O,Z,S,ge,ve,ee,g,p]),u.useEffect(()=>{if(r||!y||!h)return;const T=Array.from(P?.portalNode?.querySelectorAll(`[${Mn("portal")}]`)||[]),Y=(X?sr(X.nodesRef.current,O()):[]).find($=>On($.context?.elements.domReference||null))?.context?.elements.domReference,j=[y,Y,...T,...M(),F.current,te.current,me.current,se.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,ct(p),ct(g),z?x:null].filter($=>$!=null),K=Ps(j,d||z);return()=>{K()}},[h,r,x,y,d,Z,P,z,X,O,M,g,p]),J(()=>{if(!h||r||!Ne(w))return;const T=qe(w),k=ht(T);queueMicrotask(()=>{const Y=D(w),j=G.current,K=typeof j=="function"?j(U.current||""):j;if(K===void 0||K===!1)return;let $;K===!0||K===null?$=Y[0]||w:$=ct(K),$=$||Y[0]||w,!Re(w,k)&&Xt($,{preventScroll:$===w})})},[r,h,w,A,D,G,U]),J(()=>{if(r||!w)return;const T=qe(w),k=ht(T);Ls(k);function Y($){if($.open||(ye.current=ks($.nativeEvent,_.current)),$.reason===Yo&&$.nativeEvent.type==="mouseleave"&&(E.current=!0),$.reason===Bn)if($.nested)E.current=!1;else if(Zr($.nativeEvent)||eo($.nativeEvent))E.current=!1;else{let H=!1;document.createElement("div").focus({get preventScroll(){return H=!0,!1}}),H?E.current=!1:E.current=!0}}v.on("openchange",Y);const j=T.createElement("span");j.setAttribute("tabindex","-1"),j.setAttribute("aria-hidden","true"),Object.assign(j.style,$r),pe&&x&&x.insertAdjacentElement("afterend",j);function K(){const $=Q.current;let H=typeof $=="function"?$(ye.current):$;if(H===void 0||H===!1)return null;if(H===null&&(H=!0),typeof H=="boolean"){const W=x||yn();return W&&W.isConnected?W:j}const C=x||yn()||j;return ct(H)||C}return()=>{v.off("openchange",Y);const $=ht(T),H=Re(y,$)||X&&Et(X.nodesRef.current,O(),!1).some(W=>Re(W.context?.elements.floating,$)),C=K();queueMicrotask(()=>{const W=Ds(C),L=typeof Q.current!="boolean";Q.current&&!E.current&&Ne(W)&&(!(!L&&W!==$&&$!==T.body)||H)&&W.focus({preventScroll:!0}),j.remove()})}},[r,y,w,Q,S,v,X,pe,x,O]),u.useEffect(()=>{queueMicrotask(()=>{E.current=!1})},[r]),u.useEffect(()=>{if(r||!h)return;function T(Y){Qe(Y)?.closest(`[${Go}]`)&&(V.current=!0)}const k=qe(w);return k.addEventListener("pointerdown",T,!0),()=>{k.removeEventListener("pointerdown",T,!0)}},[r,h,w]),J(()=>{if(!r&&P)return P.setFocusManagerState({modal:d,closeOnFocusOut:l,open:h,onOpenChange:R.setOpen,domReference:x}),()=>{P.setFocusManagerState(null)}},[r,P,d,h,R,l,x]),J(()=>{if(!(r||!w))return pr(w,Z),()=>{queueMicrotask(Gn)}},[r,w,Z]);const le=!r&&(d?!z:!0)&&(pe||d);return Ce.jsxs(u.Fragment,{children:[le&&Ce.jsx(tr,{"data-type":"inside",ref:q,onFocus:T=>{if(d){const k=D();Xt(k[k.length-1])}else P?.portalNode&&(E.current=!1,nr(T,P.portalNode)?Ko(x)?.focus():ct(p??P.beforeOutsideRef)?.focus())}}),n,le&&Ce.jsx(tr,{"data-type":"inside",ref:ne,onFocus:T=>{d?Xt(D()[0]):P?.portalNode&&(l&&(E.current=!0),nr(T,P.portalNode)?qo(x)?.focus():ct(g??P.afterOutsideRef)?.focus())}})]})}function Ns(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:l=0}=t,a=u.useRef(void 0),f=Hn(),g=Ge(),p=u.useMemo(()=>({onPointerDown(m){a.current=m.pointerType},onMouseDown(m){const b=a.current,R=m.nativeEvent,h=n.select("open");if(m.button!==0||s==="click"||ir(b,!0)&&c)return;const x=r.current.openEvent,y=x?.type,v=n.select("domReferenceElement")!==m.currentTarget,S=h&&v||!(h&&i&&(!(x&&d)||y==="click"||y==="mousedown"));if(Jo(R.target)){const M=Se(Dt,R,R.target);S&&b==="touch"&&l>0?g.start(l,()=>{n.setOpen(!0,M)}):n.setOpen(S,M);return}const O=m.currentTarget;f.request(()=>{const M=Se(Dt,R,O);S&&b==="touch"&&l>0?g.start(l,()=>{n.setOpen(!0,M)}):n.setOpen(S,M)})},onClick(m){if(s==="mousedown-only")return;const b=a.current;if(s==="mousedown"&&b){a.current=void 0;return}if(ir(b,!0)&&c)return;const R=n.select("open"),h=r.current.openEvent,x=n.select("domReferenceElement")!==m.currentTarget,y=R&&x||!(R&&i&&(!(h&&d)||to(h))),v=Se(Dt,m.nativeEvent,m.currentTarget);y&&b==="touch"&&l>0?g.start(l,()=>{n.setOpen(!0,v)}):n.setOpen(y,v)},onKeyDown(){a.current=void 0}}),[r,s,c,n,d,i,f,g,l]);return u.useMemo(()=>o?{reference:p}:Nt,[o,p])}function hr(e,t,n){let{reference:r,floating:o}=e;const s=Xe(t),i=qn(t),c=Kn(i),d=Be(t),l=s==="y",a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let p;switch(d){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(ft(t)){case"start":p[i]-=g*(n&&l?-1:1);break;case"end":p[i]+=g*(n&&l?-1:1);break}return p}async function Hs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:d}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:g=!1,padding:p=0}=st(t,e),m=no(p),R=c[g?f==="floating"?"reference":"floating":f],h=rn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:d})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),v=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},S=rn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:y,strategy:d}):x);return{top:(h.top-S.top+m.top)/v.y,bottom:(S.bottom-h.bottom+m.bottom)/v.y,left:(h.left-S.left+m.left)/v.x,right:(S.right-h.right+m.right)/v.x}}const Ws=50,Bs=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Hs},d=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=hr(l,r,d),g=r,p=0;const m={};for(let b=0;b<s.length;b++){const R=s[b];if(!R)continue;const{name:h,fn:x}=R,{x:y,y:v,data:S,reset:O}=await x({x:a,y:f,initialPlacement:r,placement:g,strategy:o,middlewareData:m,rects:l,platform:c,elements:{reference:e,floating:t}});a=y??a,f=v??f,m[h]={...m[h],...S},O&&p<Ws&&(p++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(l=O.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:a,y:f}=hr(l,g,d)),b=-1)}return{x:a,y:f,placement:g,strategy:o,middlewareData:m}},_s=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:d,elements:l}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...R}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Be(o),x=Xe(c),y=Be(c)===c,v=await(d.isRTL==null?void 0:d.isRTL(l.floating)),S=g||(y||!b?[nn(c)]:ys(c)),O=m!=="none";!g&&O&&S.push(...Rs(c,b,m,v));const M=[c,...S],A=await d.detectOverflow(t,R),z=[];let Z=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&z.push(A[h]),f){const X=gs(o,i,v);z.push(A[X[0]],A[X[1]])}if(Z=[...Z,{placement:o,overflows:z}],!z.every(X=>X<=0)){var G,Q;const X=(((G=s.flip)==null?void 0:G.index)||0)+1,P=M[X];if(P&&(!(f==="alignment"?x!==Xe(P):!1)||Z.every(E=>Xe(E.placement)===x?E.overflows[0]>0:!0)))return{data:{index:X,overflows:Z},reset:{placement:P}};let F=(Q=Z.filter(te=>te.overflows[0]<=0).sort((te,E)=>te.overflows[1]-E.overflows[1])[0])==null?void 0:Q.placement;if(!F)switch(p){case"bestFit":{var U;const te=(U=Z.filter(E=>{if(O){const V=Xe(E.placement);return V===x||V==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(V=>V>0).reduce((V,I)=>V+I,0)]).sort((E,V)=>E[1]-V[1])[0])==null?void 0:U[0];te&&(F=te);break}case"initialPlacement":F=c;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function mr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gr(e){return hs.some(t=>e[t]>=0)}const $s=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=mr(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:gr(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=mr(i,n.floating);return{data:{escapedOffsets:c,escaped:gr(c)}}}default:return{}}}}},co=new Set(["left","top"]);async function Us(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Be(n),c=ft(n),d=Xe(n)==="y",l=co.has(i)?-1:1,a=s&&d?-1:1,f=st(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),d?{x:p*a,y:g*l}:{x:g*l,y:p*a}}const js=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,d=await Us(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:s+d.y,data:{...d,placement:i}}}}},zs=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:d={fn:h=>{let{x,y}=h;return{x,y}}},...l}=st(e,t),a={x:n,y:r},f=await s.detectOverflow(t,l),g=Xe(Be(o)),p=Yn(g);let m=a[p],b=a[g];if(i){const h=p==="y"?"top":"left",x=p==="y"?"bottom":"right",y=m+f[h],v=m-f[x];m=Pn(y,m,v)}if(c){const h=g==="y"?"top":"left",x=g==="y"?"bottom":"right",y=b+f[h],v=b-f[x];b=Pn(y,b,v)}const R=d.fn({...t,[p]:m,[g]:b});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[p]:i,[g]:c}}}}}},Ys=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:d=!0,crossAxis:l=!0}=st(e,t),a={x:n,y:r},f=Xe(o),g=Yn(f);let p=a[g],m=a[f];const b=st(c,t),R=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const y=g==="y"?"height":"width",v=s.reference[g]-s.floating[y]+R.mainAxis,S=s.reference[g]+s.reference[y]-R.mainAxis;p<v?p=v:p>S&&(p=S)}if(l){var h,x;const y=g==="y"?"width":"height",v=co.has(Be(o)),S=s.reference[f]-s.floating[y]+(v&&((h=i.offset)==null?void 0:h[f])||0)+(v?0:R.crossAxis),O=s.reference[f]+s.reference[y]+(v?0:((x=i.offset)==null?void 0:x[f])||0)-(v?R.crossAxis:0);m<S?m=S:m>O&&(m=O)}return{[g]:p,[f]:m}}}},Ks=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:d=()=>{},...l}=st(e,t),a=await i.detectOverflow(t,l),f=Be(o),g=ft(o),p=Xe(o)==="y",{width:m,height:b}=s.floating;let R,h;f==="top"||f==="bottom"?(R=f,h=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=f,R=g==="end"?"top":"bottom");const x=b-a.top-a.bottom,y=m-a.left-a.right,v=At(b-a[R],x),S=At(m-a[h],y),O=!t.middlewareData.shift;let M=v,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=x),O&&!g){const Z=ze(a.left,0),G=ze(a.right,0),Q=ze(a.top,0),U=ze(a.bottom,0);p?A=m-2*(Z!==0||G!==0?Z+G:ze(a.left,a.right)):M=b-2*(Q!==0||U!==0?Q+U:ze(a.top,a.bottom))}await d({...t,availableWidth:A,availableHeight:M});const z=await i.getDimensions(c.floating);return m!==z.width||b!==z.height?{reset:{rects:!0}}:{}}}};function lo(e){const t=Ze(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ne(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=tn(n)!==s||tn(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Xn(e){return Ee(e)?e:e.contextElement}function Ct(e){const t=Xn(e);if(!Ne(t))return tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lo(t);let i=(s?tn(n.width):n.width)/r,c=(s?tn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const qs=tt(0);function ao(e){const t=We(e);return!$n()||!t.visualViewport?qs:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==We(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Xn(e);let i=tt(1);t&&(r?Ee(r)&&(i=Ct(r)):i=Ct(e));const c=Gs(s,n,r)?ao(s):tt(0);let d=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,a=o.width/i.x,f=o.height/i.y;if(s){const g=We(s),p=r&&Ee(r)?We(r):r;let m=g,b=rr(m);for(;b&&r&&p!==m;){const R=Ct(b),h=b.getBoundingClientRect(),x=Ze(b),y=h.left+(b.clientLeft+parseFloat(x.paddingLeft))*R.x,v=h.top+(b.clientTop+parseFloat(x.paddingTop))*R.y;d*=R.x,l*=R.y,a*=R.x,f*=R.y,d+=y,l+=v,m=We(b),b=rr(m)}}return rn({width:a,height:f,x:d,y:l})}function fn(e,t){const n=ln(e).scrollLeft;return t?t.left+n:gt(it(e)).left+n}function uo(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-fn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Xs(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?Un(t.floating):!1;if(r===i||c&&s)return n;let d={scrollLeft:0,scrollTop:0},l=tt(1);const a=tt(0),f=Ne(r);if((f||!f&&!s)&&((Wt(r)!=="body"||Bt(i))&&(d=ln(r)),f)){const p=gt(r);l=Ct(r),a.x=p.x+r.clientLeft,a.y=p.y+r.clientTop}const g=i&&!f&&!s?uo(i,d):tt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-d.scrollLeft*l.x+a.x+g.x,y:n.y*l.y-d.scrollTop*l.y+a.y+g.y}}function Js(e){return Array.from(e.getClientRects())}function Qs(e){const t=it(e),n=ln(e),r=e.ownerDocument.body,o=ze(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ze(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+fn(e);const c=-n.scrollTop;return Ze(r).direction==="rtl"&&(i+=ze(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const yr=25;function Zs(e,t){const n=We(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,d=0;if(o){s=o.width,i=o.height;const a=$n();(!a||a&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const l=fn(r);if(l<=0){const a=r.ownerDocument,f=a.body,g=getComputedStyle(f),p=a.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=yr&&(s-=m)}else l<=yr&&(s+=l);return{width:s,height:i,x:c,y:d}}function ei(e,t){const n=gt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ne(e)?Ct(e):tt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,d=o*s.x,l=r*s.y;return{width:i,height:c,x:d,y:l}}function br(e,t,n){let r;if(t==="viewport")r=Zs(e,n);else if(t==="document")r=Qs(it(e));else if(Ee(t))r=ei(t,n);else{const o=ao(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return rn(r)}function fo(e,t){const n=Mt(e);return n===t||!Ee(n)||mt(n)?!1:Ze(n).position==="fixed"||fo(n,t)}function ti(e,t){const n=t.get(e);if(n)return n;let r=vt(e,[],!1).filter(c=>Ee(c)&&Wt(c)!=="body"),o=null;const s=Ze(e).position==="fixed";let i=s?Mt(e):e;for(;Ee(i)&&!mt(i);){const c=Ze(i),d=jr(i);!d&&c.position==="fixed"&&(o=null),(s?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bt(i)&&!d&&fo(e,i))?r=r.filter(a=>a!==i):o=c,i=Mt(i)}return t.set(e,r),r}function ni(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Un(t)?[]:ti(t,this._c):[].concat(n),r],c=br(t,i[0],o);let d=c.top,l=c.right,a=c.bottom,f=c.left;for(let g=1;g<i.length;g++){const p=br(t,i[g],o);d=ze(p.top,d),l=At(p.right,l),a=At(p.bottom,a),f=ze(p.left,f)}return{width:l-f,height:a-d,x:f,y:d}}function ri(e){const{width:t,height:n}=lo(e);return{width:t,height:n}}function oi(e,t,n){const r=Ne(t),o=it(t),s=n==="fixed",i=gt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const d=tt(0);function l(){d.x=fn(o)}if(r||!r&&!s)if((Wt(t)!=="body"||Bt(o))&&(c=ln(t)),r){const p=gt(t,!0,s,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else o&&l();s&&!r&&o&&l();const a=o&&!r&&!s?uo(o,c):tt(0),f=i.left+c.scrollLeft-d.x-a.x,g=i.top+c.scrollTop-d.y-a.y;return{x:f,y:g,width:i.width,height:i.height}}function bn(e){return Ze(e).position==="static"}function xr(e,t){if(!Ne(e)||Ze(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function po(e,t){const n=We(e);if(Un(e))return n;if(!Ne(e)){let o=Mt(e);for(;o&&!mt(o);){if(Ee(o)&&!bn(o))return o;o=Mt(o)}return n}let r=xr(e,t);for(;r&&Qo(r)&&bn(r);)r=xr(r,t);return r&&mt(r)&&bn(r)&&!jr(r)?n:r||Zo(e)||n}const si=async function(e){const t=this.getOffsetParent||po,n=this.getDimensions,r=await n(e.floating);return{reference:oi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ii(e){return Ze(e).direction==="rtl"}const ci={convertOffsetParentRelativeRectToViewportRelativeRect:Xs,getDocumentElement:it,getClippingRect:ni,getOffsetParent:po,getElementRects:si,getClientRects:Js,getDimensions:ri,getScale:Ct,isElement:Ee,isRTL:ii};function ho(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function li(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),s();const l=e.getBoundingClientRect(),{left:a,top:f,width:g,height:p}=l;if(c||t(),!g||!p)return;const m=Rt(f),b=Rt(o.clientWidth-(a+g)),R=Rt(o.clientHeight-(f+p)),h=Rt(a),y={rootMargin:-m+"px "+-b+"px "+-R+"px "+-h+"px",threshold:ze(0,At(1,d))||1};let v=!0;function S(O){const M=O[0].intersectionRatio;if(M!==d){if(!v)return i();M?i(!1,M):r=setTimeout(()=>{i(!1,1e-7)},1e3)}M===1&&!ho(l,e.getBoundingClientRect())&&i(),v=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return i(!0),s}function wr(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,l=Xn(e),a=o||s?[...l?vt(l):[],...t?vt(t):[]]:[];a.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const f=l&&c?li(l,n):null;let g=-1,p=null;i&&(p=new ResizeObserver(h=>{let[x]=h;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),n()}),l&&!d&&p.observe(l),t&&p.observe(t));let m,b=d?gt(e):null;d&&R();function R(){const h=gt(e);b&&!ho(b,h)&&n(),b=h,m=requestAnimationFrame(R)}return n(),()=>{var h;a.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f?.(),(h=p)==null||h.disconnect(),p=null,d&&cancelAnimationFrame(m)}}const ai=js,ui=zs,fi=_s,di=Ks,pi=$s,hi=Ys,mi=(e,t,n)=>{const r=new Map,o={platform:ci,...n},s={...o.platform,_c:r};return Bs(e,t,{...o,platform:s})};var gi=typeof document<"u",yi=function(){},Jt=gi?u.useLayoutEffect:yi;function on(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!on(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!on(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Rr(e,t){const n=mo(e);return Math.round(t*n)/n}function xn(e){const t=u.useRef(e);return Jt(()=>{t.current=e}),t}function bi(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:d,open:l}=e,[a,f]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=u.useState(r);on(g,r)||p(r);const[m,b]=u.useState(null),[R,h]=u.useState(null),x=u.useCallback(E=>{E!==O.current&&(O.current=E,b(E))},[]),y=u.useCallback(E=>{E!==M.current&&(M.current=E,h(E))},[]),v=s||m,S=i||R,O=u.useRef(null),M=u.useRef(null),A=u.useRef(a),z=d!=null,Z=xn(d),G=xn(o),Q=xn(l),U=u.useCallback(()=>{if(!O.current||!M.current)return;const E={placement:t,strategy:n,middleware:g};G.current&&(E.platform=G.current),mi(O.current,M.current,E).then(V=>{const I={...V,isPositioned:Q.current!==!1};X.current&&!on(A.current,I)&&(A.current=I,jn.flushSync(()=>{f(I)}))})},[g,t,n,G,Q]);Jt(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(E=>({...E,isPositioned:!1})))},[l]);const X=u.useRef(!1);Jt(()=>(X.current=!0,()=>{X.current=!1}),[]),Jt(()=>{if(v&&(O.current=v),S&&(M.current=S),v&&S){if(Z.current)return Z.current(v,S,U);U()}},[v,S,U,Z,z]);const P=u.useMemo(()=>({reference:O,floating:M,setReference:x,setFloating:y}),[x,y]),F=u.useMemo(()=>({reference:v,floating:S}),[v,S]),te=u.useMemo(()=>{const E={position:n,left:0,top:0};if(!F.floating)return E;const V=Rr(F.floating,a.x),I=Rr(F.floating,a.y);return c?{...E,transform:"translate("+V+"px, "+I+"px)",...mo(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:I}},[n,c,F.floating,a.x,a.y]);return u.useMemo(()=>({...a,update:U,refs:P,elements:F,floatingStyles:te}),[a,U,P,F,te])}const xi=(e,t)=>{const n=ai(e);return{name:n.name,fn:n.fn,options:[e,t]}},wi=(e,t)=>{const n=ui(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ri=(e,t)=>({fn:hi(e).fn,options:[e,t]}),vi=(e,t)=>{const n=fi(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ei=(e,t)=>{const n=di(e);return{name:n.name,fn:n.fn,options:[e,t]}},Si=(e,t)=>{const n=pi(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ci={intentional:"onClick",sloppy:"onPointerDown"};function Ti(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Oi(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:c,dataRef:d}=n.context,{enabled:l=!0,escapeKey:a=!0,outsidePress:f=!0,outsidePressEvent:g="sloppy",referencePress:p=!1,referencePressEvent:m="sloppy",ancestorScroll:b=!1,bubbles:R,externalTree:h}=t,x=_t(h),y=re(typeof f=="function"?f:()=>!1),v=typeof f=="function"?y:f,S=u.useRef(!1),{escapeKey:O,outsidePress:M}=Ti(R),A=u.useRef(null),z=Ge(),Z=Ge(),G=re(()=>{Z.clear(),d.current.insideReactTree=!1}),Q=u.useRef(!1),U=u.useRef(""),X=re(w=>{U.current=w.pointerType}),P=re(()=>{const w=U.current,N=w==="pen"||!w?"mouse":w,D=typeof g=="function"?g():g;return typeof D=="string"?D:D[N]}),F=re(w=>{if(!r||!l||!a||w.key!=="Escape"||Q.current)return;const N=d.current.floatingContext?.nodeId,D=x?Et(x.nodesRef.current,N):[];if(!O&&D.length>0){let k=!0;if(D.forEach(Y=>{Y.context?.open&&!Y.context.dataRef.current.__escapeKeyBubbles&&(k=!1)}),!k)return}const le=ps(w)?w.nativeEvent:w,T=Se(ts,le);n.setOpen(!1,T),!O&&!T.isPropagationAllowed&&w.stopPropagation()}),te=re(w=>{const N=P();return N==="intentional"&&w.type!=="click"||N==="sloppy"&&w.type==="click"}),E=re(()=>{d.current.insideReactTree=!0,Z.start(0,G)}),V=re((w,N=!1)=>{if(te(w)){G();return}if(d.current.insideReactTree){G();return}if(P()==="intentional"&&N||typeof v=="function"&&!v(w))return;const D=Qe(w),le=`[${Mn("inert")}]`,T=qe(n.select("floatingElement")).querySelectorAll(le),k=n.context.triggerElements;if(D&&(k.hasElement(D)||k.hasMatchingElement(H=>Re(H,D))))return;let Y=Ee(D)?D:null;for(;Y&&!mt(Y);){const H=Mt(Y);if(mt(H)||!Ee(H))break;Y=H}if(T.length&&Ee(D)&&!es(D)&&!Re(D,n.select("floatingElement"))&&Array.from(T).every(H=>!Re(Y,H)))return;if(Ne(D)&&!("touches"in w)){const H=mt(D),C=Ze(D),W=/auto|scroll/,L=H||W.test(C.overflowX),ae=H||W.test(C.overflowY),ue=L&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,he=ae&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,de=C.direction==="rtl",be=he&&(de?w.offsetX<=D.offsetWidth-D.clientWidth:w.offsetX>D.clientWidth),Oe=ue&&w.offsetY>D.clientHeight;if(be||Oe)return}const j=d.current.floatingContext?.nodeId,K=x&&Et(x.nodesRef.current,j).some(H=>Je(w,H.context?.elements.floating));if(Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement"))||K)return;const $=x?Et(x.nodesRef.current,j):[];if($.length>0){let H=!0;if($.forEach(C=>{C.context?.open&&!C.context.dataRef.current.__outsidePressBubbles&&(H=!1)}),!H)return}n.setOpen(!1,Se(Bn,w)),G()}),I=re(w=>{P()!=="sloppy"||w.pointerType==="touch"||!n.select("open")||!l||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement"))||V(w)}),B=re(w=>{if(P()!=="sloppy"||!n.select("open")||!l||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement")))return;const N=w.touches[0];N&&(A.current={startTime:Date.now(),startX:N.clientX,startY:N.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},z.start(1e3,()=>{A.current&&(A.current.dismissOnTouchEnd=!1,A.current.dismissOnMouseDown=!1)}))}),ye=re(w=>{const N=Qe(w);function D(){B(w),N?.removeEventListener(w.type,D)}N?.addEventListener(w.type,D)}),_=re(w=>{const N=S.current;if(S.current=!1,z.clear(),w.type==="mousedown"&&A.current&&!A.current.dismissOnMouseDown)return;const D=Qe(w);function le(){w.type==="pointerdown"?I(w):V(w,N),D?.removeEventListener(w.type,le)}D?.addEventListener(w.type,le)}),me=re(w=>{if(P()!=="sloppy"||!A.current||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement")))return;const N=w.touches[0];if(!N)return;const D=Math.abs(N.clientX-A.current.startX),le=Math.abs(N.clientY-A.current.startY),T=Math.sqrt(D*D+le*le);T>5&&(A.current.dismissOnTouchEnd=!0),T>10&&(V(w),z.clear(),A.current=null)}),se=re(w=>{const N=Qe(w);function D(){me(w),N?.removeEventListener(w.type,D)}N?.addEventListener(w.type,D)}),q=re(w=>{P()!=="sloppy"||!A.current||Je(w,n.select("floatingElement"))||Je(w,n.select("domReferenceElement"))||(A.current.dismissOnTouchEnd&&V(w),z.clear(),A.current=null)}),ne=re(w=>{const N=Qe(w);function D(){q(w),N?.removeEventListener(w.type,D)}N?.addEventListener(w.type,D)});u.useEffect(()=>{if(!r||!l)return;d.current.__escapeKeyBubbles=O,d.current.__outsidePressBubbles=M;const w=new An;function N(Y){n.setOpen(!1,Se(an,Y))}function D(){w.clear(),Q.current=!0}function le(){w.start($n()?5:0,()=>{Q.current=!1})}const T=qe(o);T.addEventListener("pointerdown",X,!0),a&&(T.addEventListener("keydown",F),T.addEventListener("compositionstart",D),T.addEventListener("compositionend",le)),v&&(T.addEventListener("click",_,!0),T.addEventListener("pointerdown",_,!0),T.addEventListener("touchstart",ye,!0),T.addEventListener("touchmove",se,!0),T.addEventListener("touchend",ne,!0),T.addEventListener("mousedown",_,!0));let k=[];return b&&(Ee(i)&&(k=vt(i)),Ee(o)&&(k=k.concat(vt(o))),!Ee(s)&&s&&s.contextElement&&(k=k.concat(vt(s.contextElement)))),k=k.filter(Y=>Y!==T.defaultView?.visualViewport),k.forEach(Y=>{Y.addEventListener("scroll",N,{passive:!0})}),()=>{T.removeEventListener("pointerdown",X,!0),a&&(T.removeEventListener("keydown",F),T.removeEventListener("compositionstart",D),T.removeEventListener("compositionend",le)),v&&(T.removeEventListener("click",_,!0),T.removeEventListener("pointerdown",_,!0),T.removeEventListener("touchstart",ye,!0),T.removeEventListener("touchmove",se,!0),T.removeEventListener("touchend",ne,!0),T.removeEventListener("mousedown",_,!0)),k.forEach(Y=>{Y.removeEventListener("scroll",N)}),w.clear(),S.current=!1}},[d,o,s,i,a,v,r,c,b,l,O,M,F,V,_,I,ye,se,ne,X,n]),u.useEffect(G,[v,G]);const ge=u.useMemo(()=>({onKeyDown:F,...p&&{[Ci[m]]:w=>{n.setOpen(!1,Se(Dt,w.nativeEvent))},...m!=="intentional"&&{onClick(w){n.setOpen(!1,Se(Dt,w.nativeEvent))}}}}),[F,n,p,m]),ve=re(w=>{const N=Qe(w.nativeEvent);!Re(n.select("floatingElement"),N)||w.button!==0||(S.current=!0)}),ee=re(w=>{!r||!l||w.button!==0||(S.current=!0)}),pe=u.useMemo(()=>({onKeyDown:F,onPointerDown:ve,onMouseDown:ve,onMouseUp:ve,onClickCapture:E,onMouseDownCapture(w){E(),ee(w)},onPointerDownCapture(w){E(),ee(w)},onMouseUpCapture:E,onTouchEndCapture:E,onTouchMoveCapture:E}),[F,ve,E,ee]);return u.useMemo(()=>l?{reference:ge,floating:pe,trigger:ge}:{},[l,ge,pe])}var sn=Symbol("NOT_FOUND");function Mi(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Ai(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Ii(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var vr=e=>Array.isArray(e)?e:[e];function Pi(e){const t=Array.isArray(e[0])?e[0]:e;return Ii(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ki(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}function Li(e){let t;return{get(n){return t&&e(t.key,n)?t.value:sn},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Di(e,t){let n=[];function r(c){const d=n.findIndex(l=>t(c,l.key));if(d>-1){const l=n[d];return d>0&&(n.splice(d,1),n.unshift(l)),l.value}return sn}function o(c,d){r(c)===sn&&(n.unshift({key:c,value:d}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var Vi=(e,t)=>e===t;function Fi(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function Ni(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Vi,maxSize:o=1,resultEqualityCheck:s}=n,i=Fi(r);let c=0;const d=o<=1?Li(i):Di(o,i);function l(){let a=d.get(arguments);if(a===sn){if(a=e.apply(null,arguments),c++,s){const g=d.getEntries().find(p=>s(p.value,a));g&&(a=g.value,c!==0&&c--)}d.put(arguments,a)}return a}return l.clearCache=()=>{d.clear(),l.resetResultsCount()},l.resultsCount=()=>c,l.resetResultsCount=()=>{c=0},l}var Hi=class{constructor(e){this.value=e}deref(){return this.value}},Wi=typeof WeakRef<"u"?WeakRef:Hi,Bi=0,Er=1;function zt(){return{s:Bi,v:void 0,o:null,p:null}}function go(e,t={}){let n=zt();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let c=n;const{length:d}=arguments;for(let f=0,g=d;f<g;f++){const p=arguments[f];if(typeof p=="function"||typeof p=="object"&&p!==null){let m=c.o;m===null&&(c.o=m=new WeakMap);const b=m.get(p);b===void 0?(c=zt(),m.set(p,c)):c=b}else{let m=c.p;m===null&&(c.p=m=new Map);const b=m.get(p);b===void 0?(c=zt(),m.set(p,c)):c=b}}const l=c;let a;if(c.s===Er)a=c.v;else if(a=e.apply(null,arguments),s++,r){const f=o?.deref?.()??o;f!=null&&r(f,a)&&(a=f,s!==0&&s--),o=typeof a=="object"&&a!==null||typeof a=="function"?new Wi(a):a}return l.s=Er,l.v=a,a}return i.clearCache=()=>{n=zt(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function yo(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,c,d={},l=o.pop();typeof l=="object"&&(d=l,l=o.pop()),Mi(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const a={...n,...d},{memoize:f,memoizeOptions:g=[],argsMemoize:p=go,argsMemoizeOptions:m=[]}=a,b=vr(g),R=vr(m),h=Pi(o),x=f(function(){return s++,l.apply(null,arguments)},...b),y=p(function(){i++;const S=ki(h,arguments);return c=x.apply(null,S),c},...R);return Object.assign(y,{resultFunc:l,memoizedResultFunc:x,dependencies:h,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var _i=yo(go),$i=Object.assign((e,t=_i)=>{Ai(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,c,d)=>(i[n[d]]=c,i),{}))},{withTypes:()=>$i});yo({memoize:Ni,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const fe=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(Pt(1));let c;if(e)c=e;else throw new Error("Missing arguments");return c};var wn={exports:{}},Rn={};var Sr;function Ui(){if(Sr)return Rn;Sr=1;var e=zr();function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(f,g){var p=g(),m=r({inst:{value:p,getSnapshot:g}}),b=m[0].inst,R=m[1];return s(function(){b.value=p,b.getSnapshot=g,d(b)&&R({inst:b})},[f,p,g]),o(function(){return d(b)&&R({inst:b}),f(function(){d(b)&&R({inst:b})})},[f]),i(p),p}function d(f){var g=f.getSnapshot;f=f.value;try{var p=g();return!n(f,p)}catch{return!0}}function l(f,g){return g()}var a=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return Rn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:a,Rn}var Cr;function bo(){return Cr||(Cr=1,wn.exports=Ui()),wn.exports}var ji=bo(),vn={exports:{}},En={};var Tr;function zi(){if(Tr)return En;Tr=1;var e=zr(),t=bo();function n(l,a){return l===a&&(l!==0||1/l===1/a)||l!==l&&a!==a}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,d=e.useDebugValue;return En.useSyncExternalStoreWithSelector=function(l,a,f,g,p){var m=s(null);if(m.current===null){var b={hasValue:!1,value:null};m.current=b}else b=m.current;m=c(function(){function h(O){if(!x){if(x=!0,y=O,O=g(O),p!==void 0&&b.hasValue){var M=b.value;if(p(M,O))return v=M}return v=O}if(M=v,r(y,O))return M;var A=g(O);return p!==void 0&&p(M,A)?(y=O,M):(y=O,v=A)}var x=!1,y,v,S=f===void 0?null:f;return[function(){return h(a())},S===null?void 0:function(){return h(S())}]},[a,f,g,p]);var R=o(l,m[0],m[1]);return i(function(){b.hasValue=!0,b.value=R},[R]),d(R),R},En}var Or;function Yi(){return Or||(Or=1,vn.exports=zi()),vn.exports}var Ki=Yi();const qi=ns(19),Gi=qi?Xi:Ji;function ce(e,t,n,r,o){return Gi(e,t,n,r,o)}function Xi(e,t,n,r,o){const s=u.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ji.useSyncExternalStore(e.subscribe,s,s)}function Ji(e,t,n,r,o){return Ki.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class Tt{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 r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){Tt.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Tt.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Tt.prototype.setState.call(this,t)}}class Qi extends Tt{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(t,n){u.useDebugValue(t),J(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;J(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);J(()=>{n.update(t)},[n,...r])}useControlledProp(t,n,r){u.useDebugValue(t);const o=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),J(()=>{s&&!Object.is(o.state[t],n)&&super.setState({...o.state,[t]:n})},[o,t,n,r,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(t,n,r,o)=>{const s=this.selectors[t];return s(this.state,n,r,o)};useState=(t,n,r,o)=>{u.useDebugValue(t);const s=this.selectors[t];return ce(this,s,n,r,o)};useContextCallback(t,n){u.useDebugValue(t);const r=re(n??Ye);this.context[t]=r}useStateSetter(t){const n=u.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const c=o;o=i,n(i,c,this)}})}}const Zi={open:fe(e=>e.open),domReferenceElement:fe(e=>e.domReferenceElement),referenceElement:fe(e=>e.positionReference??e.referenceElement),floatingElement:fe(e=>e.floatingElement),floatingId:fe(e=>e.floatingId)};class ec extends Qi{constructor(t){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:ro(),nested:n,noEmit:r,triggerElements:s},Zi)}setOpen=(t,n)=>{if((!t||!this.state.open||to(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function xo(e,t=!1,n=!1){const[r,o]=u.useState(e&&t?"idle":void 0),[s,i]=u.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),J(()=>{if(!e&&s&&r!=="ending"&&n){const c=pt.request(()=>{o("ending")});return()=>{pt.cancel(c)}}},[e,s,r,n]),J(()=>{if(!e||t)return;const c=pt.request(()=>{o(void 0)});return()=>{pt.cancel(c)}},[t,e]),J(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const c=pt.request(()=>{o("idle")});return()=>{pt.cancel(c)}},[t,e,s,o,r]),u.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}class tc{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elements.delete(r),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 wo(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Nn(),s=un()!=null,i=Ot(()=>new ec({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new tc,floatingId:o,nested:s,noEmit:e.noEmit||!1})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ee(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function nc(e={}){const{nodeId:t,externalTree:n}=e,r=wo(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,c]=u.useState(null),d=u.useRef(null),l=_t(n);J(()=>{s.domReference&&(d.current=s.domReference)},[s.domReference]);const a=bi({...e,elements:{...s,...i&&{reference:i}}}),f=u.useCallback(M=>{const A=Ee(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;c(A),a.refs.setReference(A)},[a.refs]),[g,p]=u.useState(null),[m,b]=u.useState(null);o.useSyncedValue("referenceElement",g),o.useSyncedValue("domReferenceElement",Ee(g)?g:null),o.useSyncedValue("floatingElement",m);const R=u.useCallback(M=>{(Ee(M)||M===null)&&(d.current=M,p(M)),(Ee(a.refs.reference.current)||a.refs.reference.current===null||M!==null&&!Ee(M))&&a.refs.setReference(M)},[a.refs,p]),h=u.useCallback(M=>{b(M),a.refs.setFloating(M)},[a.refs]),x=u.useMemo(()=>({...a.refs,setReference:R,setFloating:h,setPositionReference:f,domReference:d}),[a.refs,R,h,f]),y=u.useMemo(()=>({...a.elements,domReference:s.domReference}),[a.elements,s.domReference]),v=o.useState("open"),S=o.useState("floatingId"),O=u.useMemo(()=>({...a,dataRef:o.context.dataRef,open:v,onOpenChange:o.setOpen,events:o.context.events,floatingId:S,refs:x,elements:y,nodeId:t,rootStore:o}),[a,x,y,t,o,v,S]);return J(()=>{o.context.dataRef.current.floatingContext=O;const M=l?.nodesRef.current.find(A=>A.id===t);M&&(M.context=O)}),u.useMemo(()=>({...a,context:O,refs:x,elements:y,rootStore:o}),[a,x,y,O,o])}function rc(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),r=e.map(l=>l?.item),o=e.map(l=>l?.trigger),s=u.useCallback(l=>Yt(l,e,"reference"),t),i=u.useCallback(l=>Yt(l,e,"floating"),n),c=u.useCallback(l=>Yt(l,e,"item"),r),d=u.useCallback(l=>Yt(l,e,"trigger"),o);return u.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:c,getTriggerProps:d}),[s,i,c,d])}function Yt(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[rs]="");for(const i in e)o&&e&&(i===Yr||i===Kr)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let c;const d=t[i]?.[n];typeof d=="function"?c=e?d(e):null:c=d,c&&Mr(s,c,o,r)}return Mr(s,e,o,r),s}function Mr(e,t,n,r){for(const o in t){const s=t[o];n&&(o===Yr||o===Kr)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(c=>c(...i)).find(c=>c!==void 0))):e[o]=s)}}const oc="Escape";function dn(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Kt(e,t){return dn(t,e===Fn||e===Ht,e===at||e===ut)}function Sn(e,t,n){return dn(t,e===Ht,n?e===at:e===ut)||e==="Enter"||e===" "||e===""}function sc(e,t,n){return dn(t,n?e===at:e===ut,e===Ht)}function ic(e,t,n,r){const o=n?e===ut:e===at,s=e===Fn;return t==="both"||t==="horizontal"&&r&&r>1?e===oc:dn(t,o,s)}function cc(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:c,activeIndex:d,onNavigate:l=()=>{},enabled:a=!0,selectedIndex:f=null,allowEscape:g=!1,loopFocus:p=!1,nested:m=!1,rtl:b=!1,virtual:R=!1,focusItemOnOpen:h="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:y=!0,disabledIndices:v=void 0,orientation:S="vertical",parentOrientation:O,cols:M=1,scrollItemIntoView:A=!0,itemSizes:z,dense:Z=!1,id:G,resetOnPointerLeave:Q=!0,externalTree:U}=t,X=en(o),P=Le(X),F=un(),te=_t(U);J(()=>{i.current.orientation=S},[i,S]);const E=On(s),V=u.useRef(h),I=u.useRef(f??-1),B=u.useRef(null),ye=u.useRef(!0),_=re(C=>{l(I.current===-1?null:I.current,C)}),me=u.useRef(_),se=u.useRef(!!o),q=u.useRef(r),ne=u.useRef(!1),ge=u.useRef(!1),ve=Le(v),ee=Le(r),pe=Le(A),w=Le(f),N=Le(Q),D=re(()=>{function C(ue){R?te?.events.emit("virtualfocus",ue):Xt(ue,{sync:ne.current,preventScroll:!0})}const W=c.current[I.current],L=ge.current;W&&C(W),(ne.current?ue=>ue():requestAnimationFrame)(()=>{const ue=c.current[I.current]||W;if(!ue)return;W||C(ue);const he=pe.current;he&&T&&(L||!ye.current)&&ue.scrollIntoView?.(typeof he=="boolean"?{block:"nearest",inline:"nearest"}:he)})});J(()=>{a&&(r&&o?(I.current=f??-1,V.current&&f!=null&&(ge.current=!0,_())):se.current&&(I.current=-1,me.current()))},[a,r,o,f,_]),J(()=>{if(a){if(!r){ne.current=!1;return}if(o)if(d==null){if(ne.current=!1,w.current!=null)return;if(se.current&&(I.current=-1,D()),(!q.current||!se.current)&&V.current&&(B.current!=null||V.current===!0&&B.current==null)){let C=0;const W=()=>{c.current[0]==null?(C<2&&(C?requestAnimationFrame:queueMicrotask)(W),C+=1):(I.current=B.current==null||Sn(B.current,S,b)||m?mn(c):ar(c),B.current=null,_())};W()}}else Vt(c,d)||(I.current=d,D(),ge.current=!1)}},[a,r,o,d,w,m,c,S,b,_,D,ve]),J(()=>{if(!a||o||!te||R||!se.current)return;const C=te.nodesRef.current,W=C.find(ue=>ue.id===F)?.context?.elements.floating,L=ht(qe(o)),ae=C.some(ue=>ue.context&&Re(ue.context.elements.floating,L));W&&!ae&&ye.current&&W.focus({preventScroll:!0})},[a,o,te,F,R]),J(()=>{me.current=_,q.current=r,se.current=!!o}),J(()=>{r||(B.current=null,V.current=h)},[r,h]);const le=d!=null,T=u.useMemo(()=>{function C(L){if(!ee.current)return;const ae=c.current.indexOf(L.currentTarget);ae!==-1&&I.current!==ae&&(I.current=ae,_(L))}return{onFocus(L){ne.current=!0,C(L)},onClick:({currentTarget:L})=>L.focus({preventScroll:!0}),onMouseMove(L){ne.current=!0,ge.current=!1,x&&C(L)},onPointerLeave(L){if(!ee.current||!ye.current||L.pointerType==="touch")return;ne.current=!0;const ae=L.relatedTarget;!x||c.current.includes(ae)||N.current&&(I.current=-1,_(L),R||P.current?.focus({preventScroll:!0}))}}},[ee,P,x,c,_,N,R]),k=u.useCallback(()=>O??te?.nodesRef.current.find(C=>C.id===F)?.context?.dataRef?.current.orientation,[F,te,O]),Y=re(C=>{if(ye.current=!1,ne.current=!0,C.which===229||!ee.current&&C.currentTarget===P.current)return;if(m&&ic(C.key,S,b,M)){Kt(C.key,k())||ke(C),n.setOpen(!1,Se(pn,C.nativeEvent)),Ne(s)&&(R?te?.events.emit("virtualfocus",s):s.focus());return}const W=I.current,L=mn(c,v),ae=ar(c,v);if(E||(C.key==="Home"&&(ke(C),I.current=L,_(C)),C.key==="End"&&(ke(C),I.current=ae,_(C))),M>1){const ue=z||Array.from({length:c.current.length},()=>({width:1,height:1})),he=Ss(ue,M,Z),de=he.findIndex(Ae=>Ae!=null&&!Ft(c,Ae,v)),be=he.reduce((Ae,De,Ke)=>De!=null&&!Ft(c,De,v)?Ke:Ae,-1),Oe=he[Es({current:he.map(Ae=>Ae!=null?c.current[Ae]:null)},{event:C,orientation:S,loopFocus:p,rtl:b,cols:M,disabledIndices:Ts([...(typeof v!="function"?v:null)||c.current.map((Ae,De)=>Ft(c,De,v)?De:void 0),void 0],he),minIndex:de,maxIndex:be,prevIndex:Cs(I.current>ae?L:I.current,ue,he,M,C.key===Ht?"bl":C.key===(b?at:ut)?"tr":"tl"),stopEvent:!0})];if(Oe!=null&&(I.current=Oe,_(C)),S==="both")return}if(Kt(C.key,S)){if(ke(C),r&&!R&&ht(C.currentTarget.ownerDocument)===C.currentTarget){I.current=Sn(C.key,S,b)?L:ae,_(C);return}Sn(C.key,S,b)?p?W>=ae?g&&W!==c.current.length?I.current=-1:(ne.current=!1,I.current=L):I.current=Pe(c,{startingIndex:W,disabledIndices:v}):I.current=Math.min(ae,Pe(c,{startingIndex:W,disabledIndices:v})):p?W<=L?g&&W!==-1?I.current=c.current.length:(ne.current=!1,I.current=ae):I.current=Pe(c,{startingIndex:W,decrement:!0,disabledIndices:v}):I.current=Math.max(L,Pe(c,{startingIndex:W,decrement:!0,disabledIndices:v})),Vt(c,I.current)&&(I.current=-1),_(C)}}),j=u.useMemo(()=>R&&r&&le&&{"aria-activedescendant":`${G}-${d}`},[R,r,le,G,d]),K=u.useMemo(()=>({"aria-orientation":S==="both"?void 0:S,...E?{}:j,onKeyDown(C){if(C.key==="Tab"&&C.shiftKey&&r&&!R){const W=Qe(C.nativeEvent);if(W&&!Re(P.current,W))return;ke(C),n.setOpen(!1,Se(_n,C.nativeEvent)),Ne(s)&&s.focus();return}Y(C)},onPointerMove(){ye.current=!0}}),[j,Y,P,S,E,n,r,R,s]),$=u.useMemo(()=>{function C(L){h==="auto"&&Zr(L.nativeEvent)&&(V.current=!R)}function W(L){V.current=h,h==="auto"&&eo(L.nativeEvent)&&(V.current=!0)}return{onKeyDown(L){const ae=n.select("open");ye.current=!1;const ue=L.key.startsWith("Arrow"),he=sc(L.key,k(),b),de=Kt(L.key,S),be=(m?he:de)||L.key==="Enter"||L.key.trim()==="";if(R&&ae)return Y(L);if(!(!ae&&!y&&ue)){if(be){const Oe=Kt(L.key,k());B.current=m&&Oe?null:L.key}if(m){he&&(ke(L),ae?(I.current=mn(c,ve.current),_(L)):n.setOpen(!0,Se(pn,L.nativeEvent,L.currentTarget)));return}de&&(w.current!=null&&(I.current=w.current),ke(L),!ae&&y?n.setOpen(!0,Se(pn,L.nativeEvent,L.currentTarget)):Y(L),ae&&_(L))}},onFocus(L){n.select("open")&&!R&&(I.current=-1,_(L))},onPointerDown:W,onPointerEnter:W,onMouseDown:C,onClick:C}},[Y,ve,h,c,m,_,n,y,S,k,b,w,R]),H=u.useMemo(()=>({...j,...$}),[j,$]);return u.useMemo(()=>a?{reference:H,floating:K,item:T,trigger:$}:{},[a,H,K,$,T])}function lc(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.context.dataRef,{listRef:s,activeIndex:i,onMatch:c,onTypingChange:d,enabled:l=!0,findMatch:a=null,resetMs:f=750,ignoreKeys:g=In,selectedIndex:p=null}=t,m=Ge(),b=u.useRef(""),R=u.useRef(p??i??-1),h=u.useRef(null);J(()=>{r&&(m.clear(),h.current=null,b.current="")},[r,m]),J(()=>{r&&b.current===""&&(R.current=p??i??-1)},[r,p,i]);const x=re(O=>{O?o.current.typing||(o.current.typing=O,d?.(O)):o.current.typing&&(o.current.typing=O,d?.(O))}),y=re(O=>{function M(Q,U,X){const P=a?a(U,X):U.find(F=>F?.toLocaleLowerCase().indexOf(X.toLocaleLowerCase())===0);return P?Q.indexOf(P):-1}const A=s.current;if(b.current.length>0&&b.current[0]!==" "&&(M(A,A,b.current)===-1?x(!1):O.key===" "&&ke(O)),A==null||g.includes(O.key)||O.key.length!==1||O.ctrlKey||O.metaKey||O.altKey)return;r&&O.key!==" "&&(ke(O),x(!0)),A.every(Q=>Q?Q[0]?.toLocaleLowerCase()!==Q[1]?.toLocaleLowerCase():!0)&&b.current===O.key&&(b.current="",R.current=h.current),b.current+=O.key,m.start(f,()=>{b.current="",R.current=h.current,x(!1)});const Z=R.current,G=M(A,[...A.slice((Z||0)+1),...A.slice(0,(Z||0)+1)],b.current);G!==-1?(c?.(G),h.current=G):O.key!==" "&&(b.current="",x(!1))}),v=u.useMemo(()=>({onKeyDown:y}),[y]),S=u.useMemo(()=>({onKeyDown:y,onKeyUp(O){O.key===" "&&x(!1)}}),[y,x]);return u.useMemo(()=>l?{reference:v,floating:S}:{},[l,v,S])}const ac=u.createContext(void 0);function uc(){return u.useContext(ac)?.direction??"ltr"}const fc=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:d}=t,{element:l,padding:a=0,offsetParent:f="real"}=st(e,t)||{};if(l==null)return{};const g=no(a),p={x:n,y:r},m=qn(o),b=Kn(m),R=await i.getDimensions(l),h=m==="y",x=h?"top":"left",y=h?"bottom":"right",v=h?"clientHeight":"clientWidth",S=s.reference[b]+s.reference[m]-p[m]-s.floating[b],O=p[m]-s.reference[m],M=f==="real"?await i.getOffsetParent?.(l):c.floating;let A=c.floating[v]||s.floating[b];(!A||!await i.isElement?.(M))&&(A=c.floating[v]||s.floating[b]);const z=S/2-O/2,Z=A/2-R[b]/2-1,G=Math.min(g[x],Z),Q=Math.min(g[y],Z),U=G,X=A-R[b]-Q,P=A/2-R[b]/2+z,F=Pn(U,P,X),te=!d.arrow&&ft(o)!=null&&P!==F&&s.reference[b]/2-(P<U?G:Q)-R[b]/2<0,E=te?P<U?P-U:P-X:0;return{[m]:p[m]+E,data:{[m]:F,centerOffset:P-F-E,...te&&{alignmentOffset:E}},reset:te}}}),dc=(e,t)=>({...fc(e),options:[e,t]}),pc={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Si().fn(e)).data?.referenceHidden||s}}}},Qt={sideX:"left",sideY:"top"},Ol={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,d=We(o),l=d.getComputedStyle(o);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:Qt};const f=await s.getOffsetParent?.(o);let g={width:0,height:0};if(i==="fixed"&&d?.visualViewport)g={width:d.visualViewport.width,height:d.visualViewport.height};else if(f===d){const x=nt(o);g={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await s.isElement?.(f)&&(g=await s.getDimensions(f));const p=Be(c);let m=t,b=n;p==="left"&&(m=g.width-(t+r.width)),p==="top"&&(b=g.height-(n+r.height));const R=p==="left"?"right":Qt.sideX,h=p==="top"?"bottom":Qt.sideY;return{x:m,y:b,data:{sideX:R,sideY:h}}}};function Ro(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Ar(e,t,n){const{rects:r,placement:o}=e;return{side:Ro(t,Be(o),n),align:ft(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function hc(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:d=5,sticky:l=!1,arrowPadding:a=5,disableAnchorTracking:f=!1,keepMounted:g=!1,floatingRootContext:p,mounted:m,collisionAvoidance:b,shiftCrossAxis:R=!1,nodeId:h,adaptiveOrigin:x,lazyFlip:y=!1,externalTree:v}=e,[S,O]=u.useState(null);!m&&S!==null&&O(null);const M=b.side||"flip",A=b.align||"flip",z=b.fallbackAxisSide||"end",Z=typeof t=="function"?t:void 0,G=re(Z),Q=Z?G:t,U=Le(t),P=uc()==="rtl",F=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[r],te=s==="center"?F:`${F}-${s}`;let E=d;const V=1,I=r==="bottom"?V:0,B=r==="top"?V:0,ye=r==="right"?V:0,_=r==="left"?V:0;typeof E=="number"?E={top:E+I,right:E+_,bottom:E+B,left:E+ye}:E&&(E={top:(E.top||0)+I,right:(E.right||0)+_,bottom:(E.bottom||0)+B,left:(E.left||0)+ye});const me={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:E},se=u.useRef(null),q=Le(o),ne=Le(i),ee=[xi(we=>{const Me=Ar(we,r,P),Te=typeof q.current=="function"?q.current(Me):q.current,Ie=typeof ne.current=="function"?ne.current(Me):ne.current;return{mainAxis:Te,crossAxis:Ie,alignmentAxis:Ie}},[typeof o!="function"?o:0,typeof i!="function"?i:0,P,r])],pe=A==="none"&&M!=="shift",w=!pe&&(l||R||M==="shift"),N=M==="none"?null:vi({...me,padding:{top:E.top+V,right:E.right+V,bottom:E.bottom+V,left:E.left+V},mainAxis:!R&&M==="flip",crossAxis:A==="flip"?"alignment":!1,fallbackAxisSideDirection:z}),D=pe?null:wi(we=>{const Me=nt(we.elements.floating).documentElement;return{...me,rootBoundary:R?{x:0,y:0,width:Me.clientWidth,height:Me.clientHeight}:void 0,mainAxis:A!=="none",crossAxis:w,limiter:l||R?void 0:Ri(Te=>{if(!se.current)return{};const{width:Ie,height:Ue}=se.current.getBoundingClientRect(),je=Xe(Be(Te.placement)),rt=je==="y"?Ie:Ue,ot=je==="y"?E.left+E.right:E.top+E.bottom;return{offset:rt/2+ot/2}})}},[me,l,R,E,A]);M==="shift"||A==="shift"||s==="center"?ee.push(D,N):ee.push(N,D),ee.push(Ei({...me,apply({elements:{floating:we},rects:{reference:Me},availableWidth:Te,availableHeight:Ie}){Object.entries({"--available-width":`${Te}px`,"--available-height":`${Ie}px`,"--anchor-width":`${Me.width}px`,"--anchor-height":`${Me.height}px`}).forEach(([Ue,je])=>{we.style.setProperty(Ue,je)})}}),dc(()=>({element:se.current||document.createElement("div"),padding:a,offsetParent:"floating"}),[a]),{name:"transformOrigin",fn(we){const{elements:Me,middlewareData:Te,placement:Ie,rects:Ue,y:je}=we,rt=Be(Ie),ot=Xe(rt),dt=se.current,xt=Te.arrow?.x||0,kt=Te.arrow?.y||0,Lt=dt?.clientWidth||0,ie=dt?.clientHeight||0,xe=xt+Lt/2,Ve=kt+ie/2,He=Math.abs(Te.shift?.y||0),Fe=Ue.reference.height/2,et=typeof o=="function"?o(Ar(we,r,P)):o,er=He>et,$o={top:`${xe}px calc(100% + ${et}px)`,bottom:`${xe}px ${-et}px`,left:`calc(100% + ${et}px) ${Ve}px`,right:`${-et}px ${Ve}px`}[rt],Uo=`${xe}px ${Ue.reference.y+Fe-je}px`;return Me.floating.style.setProperty("--transform-origin",w&&ot==="y"&&er?Uo:$o),{}}},pc,x),J(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);const le=u.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:T,elements:k,x:Y,y:j,middlewareData:K,update:$,placement:H,context:C,isPositioned:W,floatingStyles:L}=nc({rootContext:p,placement:te,middleware:ee,strategy:n,whileElementsMounted:g?void 0:(...we)=>wr(...we,le),nodeId:h,externalTree:v}),{sideX:ae,sideY:ue}=K.adaptiveOrigin||Qt,he=W?n:"fixed",de=u.useMemo(()=>x?{position:he,[ae]:Y,[ue]:j}:{position:he,...L},[x,he,ae,Y,ue,j,L]),be=u.useRef(null);J(()=>{if(!m)return;const we=U.current,Me=typeof we=="function"?we():we,Ie=(Ir(Me)?Me.current:Me)||null||null;Ie!==be.current&&(T.setPositionReference(Ie),be.current=Ie)},[m,T,Q,U]),u.useEffect(()=>{if(!m)return;const we=U.current;typeof we!="function"&&Ir(we)&&we.current!==be.current&&(T.setPositionReference(we.current),be.current=we.current)},[m,T,Q,U]),u.useEffect(()=>{if(g&&m&&k.domReference&&k.floating)return wr(k.domReference,k.floating,$,le)},[g,m,k,$,le]);const Oe=Be(H),Ae=Ro(r,Oe,P),De=ft(H)||"center",Ke=!!K.hide?.referenceHidden;J(()=>{y&&m&&W&&O(Oe)},[y,m,W,Oe]);const _e=u.useMemo(()=>({position:"absolute",top:K.arrow?.y,left:K.arrow?.x}),[K.arrow]),$e=K.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:de,arrowStyles:_e,arrowRef:se,arrowUncentered:$e,side:Ae,align:De,physicalSide:Oe,anchorHidden:Ke,refs:T,context:C,isPositioned:W,update:$}),[de,_e,se,$e,Ae,De,Oe,Ke,T,C,W,$])}function Ir(e){return e!=null&&"current"in e}let Jn=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=or.startingStyle]="startingStyle",e[e.endingStyle=or.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),Ln=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const mc={[Ln.popupOpen]:""},gc={[Ln.popupOpen]:"",[Ln.pressed]:""},yc={[Jn.open]:""},bc={[Jn.closed]:""},xc={[Jn.anchorHidden]:""},Ml={open(e){return e?mc:null}},wc={open(e){return e?gc:null}},vo={open(e){return e?yc:bc},anchorHidden(e){return e?xc:null}};function Rc(e){return Nn(e,"base-ui")}const Eo="ArrowUp",So="ArrowDown",Co="ArrowLeft",To="ArrowRight",Oo="Home",Mo="End",vc=new Set([Co,To]),Ec=new Set([Eo,So]),Sc=new Set([...vc,...Ec]);[...Sc];const Cc=new Set([Eo,So,Co,To,Oo,Mo]),Tc=u.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r?.getBoundingClientRect();s=`polygon(
2
2
  0% 0%,
3
3
  100% 0%,
4
4
  100% 100%,
@@ -1 +1 @@
1
- import{c as N,r as c,b as E,f as M,I as f,j as e,o as O,x as h,p as n,q as R,D as T,K as G,N as U,O as P,Q as F,C as $,T as B,U as V,Z as H,V as W,W as Y,Y as K,_ as Z}from"./main-3gBEI6Jl.js";import{a as z,b as v,u as q,L as j}from"./use-limits-display-prefs-D1nT9-mr.js";import{u as J,I as Q}from"./useCurrency-Hhs5jbWw.js";import{S as L}from"./Select-DPE53NmM.js";import{S as y,a as x,b as w,u as C,T as X}from"./use-native-settings-Dh6NzqjY.js";import{D as ee}from"./download-CnzY_EgN.js";import"./SelectItemText-D69v77is.js";import"./Card-BbRYRVXf.js";const te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],ae=N("grip-vertical",te);const ne=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],se=N("languages",ne),re=t=>!t.isLayoutDirty&&t.willUpdate(!1);function k(){const t=new Set,a=new WeakMap,r=()=>t.forEach(re);return{add:s=>{t.add(s),a.set(s,s.addEventListener("willUpdate",r))},remove:s=>{t.delete(s);const i=a.get(s);i&&(i(),a.delete(s)),r()},dirty:r}}const oe=c.createContext(null);function ie(){const t=c.useRef(!1);return E(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function le(){const t=ie(),[a,r]=c.useState(0),s=c.useCallback(()=>{t.current&&r(a+1)},[a]);return[c.useCallback(()=>M.postRender(s),[s]),a]}const S=t=>t===!0,ce=t=>S(t===!0)||t==="id",ue=({children:t,id:a,inherit:r=!0})=>{const s=c.useContext(f),i=c.useContext(oe),[u,d]=le(),g=c.useRef(null),l=s.id||i;g.current===null&&(ce(r)&&l&&(a=a?l+"-"+a:l),g.current={id:a,group:S(r)&&s.group||k()});const m=c.useMemo(()=>({...g.current,forceRender:u}),[d]);return e.jsx(f.Provider,{value:m,children:t})},de=new Set(["cursor","kiro","copilot","kimi"]);function ge({checked:t,onChange:a,ariaLabel:r}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":r,onClick:a,className:h("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:h("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function pe({prefs:t}){const{order:a,visibility:r,toggle:s,moveToward:i}=t,[u,d]=c.useState(null),[g,l]=c.useState(null),m=o=>p=>{d(o),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",o)},D=o=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",u&&u!==o&&g!==o&&(l(o),i(u,o))},I=()=>{d(null),l(null)},_=o=>{o.preventDefault(),d(null),l(null)};return e.jsx(ue,{children:e.jsx("div",{className:"flex flex-col",children:a.map(o=>{const p=r[o]!==!1,b=u===o;return e.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:m(o),onDragOver:D(o),onDragEnd:I,onDrop:_,className:h("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",b&&"opacity-40"),style:{cursor:b?"grabbing":"grab"},children:[e.jsx(ae,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("img",{src:z[o],alt:"",width:18,height:18,className:h("h-[18px] w-[18px] shrink-0 pointer-events-none",de.has(o)&&"dark:invert"),draggable:!1}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:v[o]}),e.jsx("div",{onMouseDown:A=>A.stopPropagation(),draggable:!1,children:e.jsx(ge,{checked:p,onChange:()=>s(o),ariaLabel:`${n("limits.settings.toggle_visible")}: ${v[o]}`})})]},o)})})})}function xe(){return[{value:"light",label:n("settings.appearance.theme.light"),Icon:G},{value:"dark",label:n("settings.appearance.theme.dark"),Icon:U},{value:"system",label:n("settings.appearance.theme.system"),Icon:P}]}function he(){return[{value:B,label:n("settings.appearance.language.system")},{value:V,label:n("settings.appearance.language.english")},{value:H,label:n("settings.appearance.language.chinese")},{value:W,label:n("settings.appearance.language.traditional_chinese")},{value:Y,label:n("settings.appearance.language.japanese")},{value:K,label:n("settings.appearance.language.korean")}]}function me(t){if(!t)return null;try{const a=new Date(t);return Number.isNaN(a.getTime())?null:a.toLocaleString()}catch{return null}}function ye(t,a){const r=n(`settings.appearance.currency.rate_source.${t}`),s=me(a),i=s?n("settings.appearance.currency.rate_updated",{when:s}):n("settings.appearance.currency.rate_never");return`${r} · ${i}`}function be({locale:t,setLocale:a}){const r=he();return e.jsx(L,{value:t,onValueChange:a,options:r,ariaLabel:n("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:e.jsx(se,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function fe({currency:t,setCurrency:a}){const r=F().map(s=>({value:s.code,label:n(s.labelKey)}));return e.jsx(L,{value:t,onValueChange:a,options:r,ariaLabel:n("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function ve({currency:t,rate:a,rateSource:r,rateFetchedAt:s}){if(t===$)return e.jsx(e.Fragment,{children:n("settings.appearance.currency.hint")});const i=ye(r,s);return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:`1 USD = ${a.toFixed(4)} ${t}`}),e.jsx("span",{role:"img","aria-label":i,title:i,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:e.jsx(Q,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function je(){const{theme:t,setTheme:a}=R(),{locale:r,setLocale:s}=T(),{currency:i,rate:u,rateSource:d,rateFetchedAt:g,setCurrency:l}=J();return e.jsxs(y,{title:n("settings.section.appearance"),children:[e.jsx(x,{label:n("settings.appearance.theme.label"),hint:n("settings.appearance.theme.hint"),control:e.jsx(w,{options:xe(),value:t,onChange:a})}),e.jsx(x,{label:n("settings.appearance.language.label"),hint:n("settings.appearance.language.hint"),control:e.jsx(be,{locale:r,setLocale:s})}),e.jsx(x,{label:n("settings.appearance.currency.label"),hint:e.jsx(ve,{currency:i,rate:u,rateSource:d,rateFetchedAt:g}),control:e.jsx(fe,{currency:i,setCurrency:l})})]})}function ke(){const{available:t,settings:a,setSetting:r,runAction:s}=C();if(!t)return null;const i=!!a?.launchAtLogin,u=a?.launchAtLoginSupported!==!1,d=a?.updateStatus||null,g=!!a?.updateBusy,l=!!a?.isSyncing;return e.jsxs(y,{title:n("settings.section.menubar"),children:[u?e.jsx(x,{label:n("settings.menubar.launchAtLogin"),hint:n("settings.menubar.launchAtLoginHint"),control:e.jsx(X,{checked:i,onChange:()=>r("launchAtLogin",!i),ariaLabel:n("settings.menubar.launchAtLogin")})}):null,e.jsx(x,{label:n("settings.menubar.syncNow"),hint:n("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(Z,{className:h("h-3.5 w-3.5",l&&"animate-spin"),"aria-hidden":!0}),l?n("settings.menubar.syncing"):n("settings.menubar.syncNow")]})}),e.jsx(x,{label:n("settings.menubar.updates"),hint:d||void 0,control:e.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.menubar.checkUpdates")]})})]})}function Ne(){const{available:t,settings:a,runAction:r}=C();return t&&a?.version?e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[e.jsxs("span",{children:["TokenTrackerBar v",a.version]}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:()=>r("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]}):null}function Le({prefs:t}){return e.jsx(w,{options:[{value:j.USED,label:n("limits.settings.display_mode_used")},{value:j.REMAINING,label:n("limits.settings.display_mode_remaining")}],value:t.displayMode,onChange:t.setDisplayMode})}function Me(){const t=q();return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("settings.page.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("settings.page.subtitle")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(je,{}),e.jsx(ke,{}),e.jsx(y,{title:n("settings.section.limits"),action:e.jsx(Le,{prefs:t}),children:e.jsx(pe,{prefs:t})})]}),e.jsx(Ne,{})]})})})}export{Me as SettingsPage};
1
+ import{c as N,r as c,b as E,f as M,I as f,j as e,o as O,x as h,p as n,q as R,D as T,K as G,N as U,O as P,Q as F,C as $,T as B,U as V,Z as H,V as W,W as Y,Y as K,_ as Z}from"./main-DRcFJLLD.js";import{a as z,b as v,u as q,L as j}from"./use-limits-display-prefs-2-qYvffB.js";import{u as J,I as Q}from"./useCurrency-BPCF4zUv.js";import{S as L}from"./Select-BPspkl9p.js";import{S as y,a as x,b as w,u as C,T as X}from"./use-native-settings-C1uhDKdL.js";import{D as ee}from"./download-CbZ8YL8m.js";import"./SelectItemText-CX0dWYB1.js";import"./Card-BwY_Qv6N.js";const te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],ae=N("grip-vertical",te);const ne=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],se=N("languages",ne),re=t=>!t.isLayoutDirty&&t.willUpdate(!1);function k(){const t=new Set,a=new WeakMap,r=()=>t.forEach(re);return{add:s=>{t.add(s),a.set(s,s.addEventListener("willUpdate",r))},remove:s=>{t.delete(s);const i=a.get(s);i&&(i(),a.delete(s)),r()},dirty:r}}const oe=c.createContext(null);function ie(){const t=c.useRef(!1);return E(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function le(){const t=ie(),[a,r]=c.useState(0),s=c.useCallback(()=>{t.current&&r(a+1)},[a]);return[c.useCallback(()=>M.postRender(s),[s]),a]}const S=t=>t===!0,ce=t=>S(t===!0)||t==="id",ue=({children:t,id:a,inherit:r=!0})=>{const s=c.useContext(f),i=c.useContext(oe),[u,d]=le(),g=c.useRef(null),l=s.id||i;g.current===null&&(ce(r)&&l&&(a=a?l+"-"+a:l),g.current={id:a,group:S(r)&&s.group||k()});const m=c.useMemo(()=>({...g.current,forceRender:u}),[d]);return e.jsx(f.Provider,{value:m,children:t})},de=new Set(["cursor","kiro","copilot","kimi"]);function ge({checked:t,onChange:a,ariaLabel:r}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":r,onClick:a,className:h("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:h("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function pe({prefs:t}){const{order:a,visibility:r,toggle:s,moveToward:i}=t,[u,d]=c.useState(null),[g,l]=c.useState(null),m=o=>p=>{d(o),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",o)},D=o=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",u&&u!==o&&g!==o&&(l(o),i(u,o))},I=()=>{d(null),l(null)},_=o=>{o.preventDefault(),d(null),l(null)};return e.jsx(ue,{children:e.jsx("div",{className:"flex flex-col",children:a.map(o=>{const p=r[o]!==!1,b=u===o;return e.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:m(o),onDragOver:D(o),onDragEnd:I,onDrop:_,className:h("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",b&&"opacity-40"),style:{cursor:b?"grabbing":"grab"},children:[e.jsx(ae,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("img",{src:z[o],alt:"",width:18,height:18,className:h("h-[18px] w-[18px] shrink-0 pointer-events-none",de.has(o)&&"dark:invert"),draggable:!1}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:v[o]}),e.jsx("div",{onMouseDown:A=>A.stopPropagation(),draggable:!1,children:e.jsx(ge,{checked:p,onChange:()=>s(o),ariaLabel:`${n("limits.settings.toggle_visible")}: ${v[o]}`})})]},o)})})})}function xe(){return[{value:"light",label:n("settings.appearance.theme.light"),Icon:G},{value:"dark",label:n("settings.appearance.theme.dark"),Icon:U},{value:"system",label:n("settings.appearance.theme.system"),Icon:P}]}function he(){return[{value:B,label:n("settings.appearance.language.system")},{value:V,label:n("settings.appearance.language.english")},{value:H,label:n("settings.appearance.language.chinese")},{value:W,label:n("settings.appearance.language.traditional_chinese")},{value:Y,label:n("settings.appearance.language.japanese")},{value:K,label:n("settings.appearance.language.korean")}]}function me(t){if(!t)return null;try{const a=new Date(t);return Number.isNaN(a.getTime())?null:a.toLocaleString()}catch{return null}}function ye(t,a){const r=n(`settings.appearance.currency.rate_source.${t}`),s=me(a),i=s?n("settings.appearance.currency.rate_updated",{when:s}):n("settings.appearance.currency.rate_never");return`${r} · ${i}`}function be({locale:t,setLocale:a}){const r=he();return e.jsx(L,{value:t,onValueChange:a,options:r,ariaLabel:n("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:e.jsx(se,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function fe({currency:t,setCurrency:a}){const r=F().map(s=>({value:s.code,label:n(s.labelKey)}));return e.jsx(L,{value:t,onValueChange:a,options:r,ariaLabel:n("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function ve({currency:t,rate:a,rateSource:r,rateFetchedAt:s}){if(t===$)return e.jsx(e.Fragment,{children:n("settings.appearance.currency.hint")});const i=ye(r,s);return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:`1 USD = ${a.toFixed(4)} ${t}`}),e.jsx("span",{role:"img","aria-label":i,title:i,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:e.jsx(Q,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function je(){const{theme:t,setTheme:a}=R(),{locale:r,setLocale:s}=T(),{currency:i,rate:u,rateSource:d,rateFetchedAt:g,setCurrency:l}=J();return e.jsxs(y,{title:n("settings.section.appearance"),children:[e.jsx(x,{label:n("settings.appearance.theme.label"),hint:n("settings.appearance.theme.hint"),control:e.jsx(w,{options:xe(),value:t,onChange:a})}),e.jsx(x,{label:n("settings.appearance.language.label"),hint:n("settings.appearance.language.hint"),control:e.jsx(be,{locale:r,setLocale:s})}),e.jsx(x,{label:n("settings.appearance.currency.label"),hint:e.jsx(ve,{currency:i,rate:u,rateSource:d,rateFetchedAt:g}),control:e.jsx(fe,{currency:i,setCurrency:l})})]})}function ke(){const{available:t,settings:a,setSetting:r,runAction:s}=C();if(!t)return null;const i=!!a?.launchAtLogin,u=a?.launchAtLoginSupported!==!1,d=a?.updateStatus||null,g=!!a?.updateBusy,l=!!a?.isSyncing;return e.jsxs(y,{title:n("settings.section.menubar"),children:[u?e.jsx(x,{label:n("settings.menubar.launchAtLogin"),hint:n("settings.menubar.launchAtLoginHint"),control:e.jsx(X,{checked:i,onChange:()=>r("launchAtLogin",!i),ariaLabel:n("settings.menubar.launchAtLogin")})}):null,e.jsx(x,{label:n("settings.menubar.syncNow"),hint:n("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(Z,{className:h("h-3.5 w-3.5",l&&"animate-spin"),"aria-hidden":!0}),l?n("settings.menubar.syncing"):n("settings.menubar.syncNow")]})}),e.jsx(x,{label:n("settings.menubar.updates"),hint:d||void 0,control:e.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.menubar.checkUpdates")]})})]})}function Ne(){const{available:t,settings:a,runAction:r}=C();return t&&a?.version?e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[e.jsxs("span",{children:["TokenTrackerBar v",a.version]}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:()=>r("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]}):null}function Le({prefs:t}){return e.jsx(w,{options:[{value:j.USED,label:n("limits.settings.display_mode_used")},{value:j.REMAINING,label:n("limits.settings.display_mode_remaining")}],value:t.displayMode,onChange:t.setDisplayMode})}function Me(){const t=q();return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("settings.page.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("settings.page.subtitle")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(je,{}),e.jsx(ke,{}),e.jsx(y,{title:n("settings.section.limits"),action:e.jsx(Le,{prefs:t}),children:e.jsx(pe,{prefs:t})})]}),e.jsx(Ne,{})]})})})}export{Me as SettingsPage};