tokentracker-cli 0.83.2 → 0.83.3

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 (82) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-BrSr5pjk.js → AchievementBadge-BEk-hvfD.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-za-wqAO2.js → AchievementsPage-kLeXpzIX.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-CGRVm1uS.js → AchievementsSection-BtDWuZ8m.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-D1XDT2dG.js → BadgeDetailModal-BEgI_98J.js} +1 -1
  5. package/dashboard/dist/assets/{Card-DX2Wwm9U.js → Card-DvOwwAzG.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-D6JzFu8y.js → ClawdAnimated-B_T5A9tJ.js} +1 -1
  7. package/dashboard/dist/assets/{CommandPalette-NWiETwtS.js → CommandPalette-BqAHVsZU.js} +1 -1
  8. package/dashboard/dist/assets/{CommunityStatsModal-D4FdxAWd.js → CommunityStatsModal-g6EL03ZU.js} +1 -1
  9. package/dashboard/dist/assets/{ConfirmModal-SAheZUAv.js → ConfirmModal-C7nLLif7.js} +1 -1
  10. package/dashboard/dist/assets/DashboardPage-riwGRfNO.js +1 -0
  11. package/dashboard/dist/assets/{DevicePage-Cf-PHRlL.js → DevicePage-DMs07QPT.js} +1 -1
  12. package/dashboard/dist/assets/{DialogClose-pg5pVOeD.js → DialogClose-Dlh20IoO.js} +1 -1
  13. package/dashboard/dist/assets/DialogDescription-BkWNYqG-.js +1 -0
  14. package/dashboard/dist/assets/{DialogTitle-Im7ESzoS.js → DialogTitle-C6n2pohw.js} +1 -1
  15. package/dashboard/dist/assets/{FadeIn-CGGFraHR.js → FadeIn-9jciDZsH.js} +1 -1
  16. package/dashboard/dist/assets/{HeaderGithubStar-DRTZXRsx.js → HeaderGithubStar-DWOEAlWe.js} +1 -1
  17. package/dashboard/dist/assets/{IpCheckPage-Dn62HUZu.js → IpCheckPage-BrsvUoQe.js} +1 -1
  18. package/dashboard/dist/assets/{LandingPage-CLsljoir.js → LandingPage-rlam9dyu.js} +2 -2
  19. package/dashboard/dist/assets/{LeaderboardAvatar-DktI_89h.js → LeaderboardAvatar-BtMM-6cC.js} +1 -1
  20. package/dashboard/dist/assets/{LeaderboardPage-t87ElnDI.js → LeaderboardPage-AhwAfNL9.js} +2 -2
  21. package/dashboard/dist/assets/{LeaderboardProfileModal-DN7HurS3.js → LeaderboardProfileModal-DBMJkIPl.js} +3 -3
  22. package/dashboard/dist/assets/{LeaderboardProfilePage-CprOXLXX.js → LeaderboardProfilePage-B2S8pmDd.js} +1 -1
  23. package/dashboard/dist/assets/{LimitsPage-DRX3XMYx.js → LimitsPage-iwfTTvqG.js} +1 -1
  24. package/dashboard/dist/assets/{LocalOnlyNotice-B8BtIdAA.js → LocalOnlyNotice-DL72G1p9.js} +1 -1
  25. package/dashboard/dist/assets/{LoginCard-OoduGJmK.js → LoginCard-6lOxJlws.js} +1 -1
  26. package/dashboard/dist/assets/{LoginModal-DoDoCpr6.js → LoginModal-C1ldxgZv.js} +1 -1
  27. package/dashboard/dist/assets/{LoginPage-Dn2KMisI.js → LoginPage-Cz6lrheW.js} +1 -1
  28. package/dashboard/dist/assets/{PetPage-CVaG5H3O.js → PetPage-CfFyzGFY.js} +1 -1
  29. package/dashboard/dist/assets/{PopoverPopup-B2HqJNaq.js → PopoverPopup-qAngi4Xc.js} +1 -1
  30. package/dashboard/dist/assets/{ProviderIcon-BYl1Yyf3.js → ProviderIcon-I5z4CMY3.js} +1 -1
  31. package/dashboard/dist/assets/{ResetPasswordPage-DWfgvuvR.js → ResetPasswordPage-A5bHmTUi.js} +1 -1
  32. package/dashboard/dist/assets/{Select-ClnnGJY1.js → Select-DDInV6Vc.js} +1 -1
  33. package/dashboard/dist/assets/{SelectItemText-iaFWq7GD.js → SelectItemText-DIsD6lWR.js} +1 -1
  34. package/dashboard/dist/assets/{SettingsPage-zwAOWRur.js → SettingsPage-BUCnJfRg.js} +1 -1
  35. package/dashboard/dist/assets/{SkillsPage-BB96nB2i.js → SkillsPage-BhsGmLpr.js} +1 -1
  36. package/dashboard/dist/assets/{TokenGalaxy-9_VJKdPr.js → TokenGalaxy-j5bHVfYv.js} +1 -1
  37. package/dashboard/dist/assets/TrendMonitor-ifxuzprQ.js +19 -0
  38. package/dashboard/dist/assets/{WidgetsPage-CjAT6p0C.js → WidgetsPage-QZS8jTR0.js} +1 -1
  39. package/dashboard/dist/assets/{WrappedPage-ba6teG1N.js → WrappedPage-CzlxH4gJ.js} +1 -1
  40. package/dashboard/dist/assets/__vite-browser-external-C44tPAD-.css +1 -0
  41. package/dashboard/dist/assets/{__vite-browser-external-DWKjPxnU.js → __vite-browser-external-hJyUffEJ.js} +2 -2
  42. package/dashboard/dist/assets/{agent-logos-HCzl7U8i.js → agent-logos-WXnblKNu.js} +1 -1
  43. package/dashboard/dist/assets/{arrow-up-right-TvEj8NTT.js → arrow-up-right-WGuMZ7yP.js} +1 -1
  44. package/dashboard/dist/assets/{check-Cz3lYRiR.js → check-DQswISeD.js} +1 -1
  45. package/dashboard/dist/assets/{copy-CTtF84H9.js → copy-6aPUSNsw.js} +1 -1
  46. package/dashboard/dist/assets/{download-B5WAY6Nh.js → download-DL3wQKU1.js} +1 -1
  47. package/dashboard/dist/assets/{flame-Cja4F8Mj.js → flame-BY3LUnQc.js} +1 -1
  48. package/dashboard/dist/assets/{format-tokens-UavRPN4W.js → format-tokens-DUXqRlZ8.js} +1 -1
  49. package/dashboard/dist/assets/{icons-BW2vjmu_.js → icons-CT3DYBKd.js} +1 -1
  50. package/dashboard/dist/assets/{index-BnzrUY9J.js → index-BcTWurhn.js} +1 -1
  51. package/dashboard/dist/assets/{index-Bfxr6erc.js → index-BsgZcvQd.js} +1 -1
  52. package/dashboard/dist/assets/{index-0w19KMWl.js → index-pza5Zl32.js} +1 -1
  53. package/dashboard/dist/assets/{info-F-75j15K.js → info-CuyReqZo.js} +1 -1
  54. package/dashboard/dist/assets/{limits-providers-8NsMiLNP.js → limits-providers-FnlIwbBy.js} +1 -1
  55. package/dashboard/dist/assets/{link-2-C_eJlLvb.js → link-2-dgMFFrBX.js} +1 -1
  56. package/dashboard/dist/assets/{loader-circle-BjzQhjhO.js → loader-circle-D2Erh-me.js} +1 -1
  57. package/dashboard/dist/assets/{provider-display-D1zp03ID.js → provider-display-DXMQRWSr.js} +1 -1
  58. package/dashboard/dist/assets/{react-Nv3-bJyw.js → react-w-68N3xj.js} +1 -1
  59. package/dashboard/dist/assets/{skills-api-DazKXxME.js → skills-api-CkMNAsEg.js} +1 -1
  60. package/dashboard/dist/assets/{terminal-DBXjwlTm.js → terminal-CJMbTjNB.js} +1 -1
  61. package/dashboard/dist/assets/{trash-2-DLG8hKJm.js → trash-2-VaWsdH7y.js} +1 -1
  62. package/dashboard/dist/assets/{use-community-stats-BQB72xAN.js → use-community-stats-DdAUa2P5.js} +1 -1
  63. package/dashboard/dist/assets/{use-limits-display-prefs-CH8MmjYf.js → use-limits-display-prefs-DJUffL2_.js} +1 -1
  64. package/dashboard/dist/assets/{use-native-settings-__RhxrW5.js → use-native-settings-CiYsT_Ip.js} +1 -1
  65. package/dashboard/dist/assets/{use-ordered-list-AhnqpdnT.js → use-ordered-list-B12VdEap.js} +1 -1
  66. package/dashboard/dist/assets/use-reduced-motion-C6xgTm9r.js +1 -0
  67. package/dashboard/dist/assets/{use-session-efficiency-pref-CCYtJ_cN.js → use-session-efficiency-pref-rHhQnzAS.js} +1 -1
  68. package/dashboard/dist/assets/{use-transform-BhcppNI4.js → use-transform-uFbh6Odm.js} +1 -1
  69. package/dashboard/dist/assets/{use-usage-limits-CbA095lv.js → use-usage-limits-DmT_wC1b.js} +1 -1
  70. package/dashboard/dist/assets/{useCurrency-Dt2GqkDm.js → useCurrency-D3_YrrTw.js} +1 -1
  71. package/dashboard/dist/assets/{useScrollLock-C5d53j7C.js → useScrollLock-JHdC5cyV.js} +1 -1
  72. package/dashboard/dist/assets/{useTokenFormat-dnqZK7Z-.js → useTokenFormat-CMYJB7gb.js} +1 -1
  73. package/dashboard/dist/assets/{zap-Bw5OO91s.js → zap-Cr4tl-1M.js} +1 -1
  74. package/dashboard/dist/index.html +2 -2
  75. package/dashboard/dist/share.html +2 -2
  76. package/package.json +1 -1
  77. package/src/lib/pricing/seed-snapshot.json +1 -1
  78. package/dashboard/dist/assets/DashboardPage-CjnBsm3Q.js +0 -1
  79. package/dashboard/dist/assets/DialogDescription-CVuGFYFU.js +0 -1
  80. package/dashboard/dist/assets/TrendMonitor-D9RHcQgH.js +0 -19
  81. package/dashboard/dist/assets/__vite-browser-external-D_0JUhT7.css +0 -1
  82. package/dashboard/dist/assets/use-reduced-motion-CA2IXeeO.js +0 -1
@@ -1 +1 @@
1
- import{k as Vr,bc as kr,r as l,bx as Ht,b4 as vt,aC as qn,bF as Nr,av as zt,y as _e,b5 as Ae,cv as it,cw as rn,bo as nt,bO as rt,aK as Be,cx as un,bM as Ct,bL as _t,cy as Hr,cz as Kn,cA as _r,bt as fn,bT as dn,cB as jt,cC as En,cD as Xn,Z as Br,bu as Wr,aG as Tt,aF as J,by as Gn,bv as Ur,O as ue,cE as Cn,cF as Jt,cG as Tn,bC as Qt,b6 as ot,aD as at,cH as An,cI as It,bf as Jn,cJ as Yt,cK as qt,cL as Qn,cM as pn,cN as $r,bH as zr,cO as on,cP as jr,x as gt,bS as Yr,aw as Mt,aH as Le,j as Me,au as oe,N as z,ay as gn,aJ as sn,aI as qr,aL as Kr,aM as Xr,aN as mn,cQ as Gr,bD as Jr,br as Qr,w as Zn,cR as Zr,az as eo,cS as to,aA as no,bE as ro,b8 as oo,cT as so,ax as er,cU as Zt}from"./__vite-browser-external-DWKjPxnU.js";import{n as Mn,q as tr,F as io,P as co,o as nr,v as Ye,E as lo,G as et,H as rr,J as ao,p as or,u as uo,m as sr,h as fo,a as po,l as go,A as mo,i as ho,I as xo,d as yo,b as wo}from"./useScrollLock-C5d53j7C.js";const Ro=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",Ro),bo=["top","right","bottom","left"],wt=Math.min,He=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return He(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const In=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:In:t?In:On;case"left":case"right":return t?Co:To;default:return[]}}function Mo(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Io(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Io(e):{top:e,right:e,bottom:e,left:e}}function At(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 Rt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Ht(),p=vt(),m=l.useMemo(()=>{function y(h,b,x,w){const S=_e(a,b,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function R(h,b,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==b;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const b=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||Mn(b,!0)&&s)return;const S=R(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Nr(C)){y(S,x,C,b);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,b)})},onClick(h){if(r==="mousedown-only")return;const b=u.current;if(r==="mousedown"&&b){u.current=void 0;return}if(Mn(b,!0)&&s)return;const x=f.select("open"),w=R(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,b)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),R=c[d?u==="floating"?"reference":"floating":u],h=At(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:f,rootBoundary:g,strategy:a})),b=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:x,strategy:a}):b);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const R=s[y];if(!R)continue;const{name:h,fn:b}=R,{x,y:w,data:S,reset:C}=await b({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=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:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...R}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),b=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Mo(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,R),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const M=vo(o,i,w);L.push(T[M[0]],T[M[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(M=>M<=0)){var X,B;const M=(((X=s.flip)==null?void 0:X.index)||0)+1,N=P[M];if(N&&(!(u==="alignment"?b!==je(N):!1)||_.every(E=>je(E.placement)===b?E.overflows[0]>0:!0)))return{data:{index:M,overflows:_},reset:{placement:N}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===b||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return bo.some(t=>e[t]>=0)}const Vo=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=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const No=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,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},Ho=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:a={fn:h=>{let{x:b,y:x}=h;return{x:b,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",b=p==="y"?"bottom":"right",x=m+u[h],w=m-u[b];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",b=d==="y"?"bottom":"right",x=y+u[h],w=y-u[b];y=cn(x,y,w)}const R=a.fn({...t,[p]:m,[d]:y});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=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:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),R=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+R.mainAxis,S=s.reference[d]+s.reference[x]-R.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,b;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:R.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((b=i.offset)==null?void 0:b[u])||0)-(w?R.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=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:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let R,h;u==="top"||u==="bottom"?(R=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,R=d==="end"?"top":"bottom");const b=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[R],b),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=b),C&&!d){const _=He(g.left,0),X=He(g.right,0),B=He(g.top,0),k=He(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:He(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:He(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const R=yt(y),h=y.getBoundingClientRect(),b=rt(y),x=h.left+(y.clientLeft+parseFloat(b.paddingLeft))*R.x,w=h.top+(y.clientTop+parseFloat(b.paddingTop))*R.y;a*=R.x,f*=R.y,g*=R.x,u*=R.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(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 a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=He(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=He(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=He(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=He(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=He(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Hr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(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,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),R=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-R+"px "+-h+"px",threshold:He(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Nn(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:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[b]=h;b&&b.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&R();function R(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(R)}return n(),()=>{var h;g.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=No,ns=Ho,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(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(!Ut(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)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(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:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[R,h]=l.useState(null),b=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||R,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};M.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const M=l.useRef(!1);kt(()=>(M.current=!0,()=>{M.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const N=l.useMemo(()=>({reference:C,floating:P,setReference:b,setFloating:x}),[b,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Hn(Y.floating,g.x),A=Hn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:N,elements:Y,floatingStyles:F}),[g,k,N,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(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}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),R=l.useRef(null),h=nr(n),b=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...b,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(R.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:R}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(R.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function Rs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function bs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:h,id:b,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),M=Ye(B),N=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(I=>{o(E.current===-1?null:E.current,I)}),H=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Ht(),ne=Ht(),se=ue(()=>{function I(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&I(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||I(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=R},[X,R]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):H.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(H.current&&(E.current=-1,se()),(!me.current||!H.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let I=0;const D=()=>{n.current[0]==null?(I<2&&(I?V=>ne.request(V):queueMicrotask)(D),I+=1):(E.current=W.current==null||nn(W.current,R,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,R,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!H.current)return;const I=Y.nodesRef.current,D=I.find(G=>G.id===N)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=I.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,N,u]),J(()=>{me.current=T,H.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(I=>{if(!j.current)return;const D=n.current.indexOf(I.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(I))}),de=ue(()=>h??Y?.nodesRef.current.find(I=>I.id===N)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(I=>{if(A.current=!1,q.current=!0,I.which===229||!j.current&&I.currentTarget===M.current)return;if(f&&Rs(I.key,R,g,C)){Pt(I.key,de())||et(I),P.setOpen(!1,_e(An,I.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(I.key==="Home"&&(et(I),E.current=Z,v(I)),I.key==="End"&&(et(I),E.current=V,v(I))),S!=null){const G=S(I,E.current,n,R,a,g,y,Z,V);if(G!=null&&(E.current=G,v(I)),R==="both")return}if(Pt(I.key,R)){if(et(I),T&&!u&&Qt(I.currentTarget.ownerDocument)===I.currentTarget){E.current=nn(I.key,R,g)?Z:V,v(I);return}nn(I.key,R,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=It(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,It(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=It(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,It(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(I)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=M.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,M,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${b}-${r}`},[u,T,Se,b,r]),ie=l.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...k?{}:ce,onKeyDown(I){if(I.key==="Tab"&&I.shiftKey&&T&&!u){const D=qn(I.nativeEvent);if(D&&!at(M.current,D))return;et(I),P.setOpen(!1,_e(Jn,I.nativeEvent)),nt(_)&&_.focus();return}te(I)},onPointerMove(){A.current=!0}}),[ce,te,M,R,k,P,T,u,_]),re=l.useMemo(()=>{function I(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Ie=Pt(V.key,R),Fe=(f?We:Ie)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):I(V));return}Ie&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?I(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,R,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),R=l.useRef(null),h=ue(w=>{function S(M){const N=r?.current[M];return!N||zr(N)}function C(M){return S(M)?i==null||!$r(on,M,i):!1}function P(M,N,Y=0){if(M.length===0)return-1;const F=(Y%M.length+M.length)%M.length,E=N.toLowerCase();for(let W=0;W<M.length;W+=1){const A=(F+W)%M.length;if(!(!M[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((M,N)=>M&&C(N)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=R.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=R.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),R.current=k):w.key!==" "&&(m.current="",c?.(!1))}),b=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=R.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),R.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:b}),[h,b]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),R=await i.getDimensions(f),h=m==="y",b=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-R[y]/2-1,X=Math.min(d[b],_),B=Math.min(d[x],_),k=X,M=T-R[y]-B,N=T/2-R[y]/2+L,Y=cn(k,N,M),F=!a.arrow&&ut(o)!=null&&N!==Y&&s.reference[y]/2-(N<k?X:B)-R[y]/2<0,E=F?N<k?N-k:N-M:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:N-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={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 Ts(e)).data?.referenceHidden||s}}}},Nt={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Nt};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const b=ot(o);d={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const R=p==="left"?"right":Nt.sideX,h=p==="top"?"bottom":Nt.sideY;return{x:m,y,data:{sideX:R,sideY:h}}}};function yr(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 _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ms(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:R,shiftCrossAxis:h=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=R.side||"flip",L=R.align||"flip",_=R.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,M=Ye(t),N=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,H=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+H,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+H,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,be=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:be,alignmentAxis:be}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:be,height:Te}=O.current.getBoundingClientRect(),Re=je(Ve(ve.placement)),Oe=Re==="y"?be:Te,ze=Re==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:be}){if(!N.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const Re=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=be.reference,Pe=(Math.round((Oe+qe)*Re)-Math.round(Oe*Re))/Re,Ke=(Math.round((ze+ct)*Re)-Math.round(ze*Re))/Re;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:be,rects:Te,y:Re}=ee,Oe=Ve(be),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-Re}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:I,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Nn(...ee,xe),nodeId:b,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Nt,We=Z?n:"fixed",Ie=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=M.current,pe=typeof ee=="function"?ee():ee,be=(Bn(pe)?pe.current:pe)||null||null;be!==Fe.current&&(te.setPositionReference(be),Fe.current=be)},[y,te,k,M]),l.useEffect(()=>{if(!y)return;const ee=M.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,M]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Nn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(I),Ue=yr(r,ae,F),$e=ut(I)||"center",Ne=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Ie,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:Ne,refs:te,context:D,isPositioned:Z,update:$}),[Ie,Je,O,Qe,Ue,$e,ae,Ne,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Is(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function Rr(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return Rr(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const br=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(br);if(e===null)throw new Error(Mt(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(Mt(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},bt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...bt},Ns={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Hs={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:bt.touched,setTouched:Le,dirty:bt.dirty,setDirty:Le,filled:bt.filled,setFilled:Le,focused:bt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Hs);function Rn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(Mt(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=Rn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Mr(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Me.jsx(l.Fragment,{children:Mr(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Ir(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=Rt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:h,items:b,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:M,name:N,disabled:Y,validation:F,validationMode:E}=Rn(),W=Cr({id:t}),A=Y||u,v=N??a,[H,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:H,open:q,mounted:te,transitionStatus:ce,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,I=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(H,S),[x,H,S]),Ie=l.useMemo(()=>x&&Array.isArray(H)?H.map(K=>ft(K,S)):ft(H,S),[x,H,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Ie);Bs(Fe,W,H,ae,!A,a);const Ue=l.useRef(H),$e=x?Array.isArray(H)&&H.length>0:H!=null&&ft(H,S)!=="";J(()=>{H!==Ue.current&&$.set("forceMount",!0)},[$,H]),J(()=>{M($e)},[$e,M]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(H)?H:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,H,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,H,ne,C,$,fe]);function Ne(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}Rr(H,()=>{L(v),_(Ne(H)),F.change(H)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(H)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Ir(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),be=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),Re=bs(ve,{enabled:!d&&!A,listRef:he,activeIndex:I,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:I,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,Re.reference,Te.reference,be.reference,re);return W&&(K.id=W),K},[be.reference,Oe.reference,Re.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,Re.floating,Te.floating),[Oe.floating,Re.floating,Te.floating]),ct=Re.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:H,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:b,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,H,q,te,ce,qe,ze,b,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(R,F.inputRef),ht=x&&Array.isArray(H)&&H.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(H)||!v?null:H.map(K=>{const ge=ft(K,S);return Me.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,H,f,v,S,A]);return Me.jsx(br.Provider,{value:Pe,children:Me.jsxs(Sr.Provider,{value:ve,children:[T,Me.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Ns,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=Rn(),{labelId:y}=Er(),{store:R,setOpen:h,selectionRef:b,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(R,U.open),_=z(R,U.mounted),X=z(R,U.value),B=z(R,U.triggerProps),k=z(R,U.positionerElement),M=z(R,U.listElement),N=z(R,U.popupSide),Y=z(R,U.id),F=z(R,U.labelId),E=z(R,U.hasSelectedValue),W=_&&k?N:null,A=s??Y,v=Js(y,F);Cr({id:A});const H=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{R.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{le.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,b,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?M?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{R.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(H.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Mi=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,R=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let b=null;return typeof s=="function"?b=s(u):s!=null?b=s:!m&&i!=null&&!R?b=i:Array.isArray(u)?b=Ys(u,d,p):b=Mr(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:b},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Ii=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Me.jsx(ni.Provider,{value:!0,children:Me.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,b)=>{a.set(h,b??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(b=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);b.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((b,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const R=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Me.jsx(Or.Provider,{value:R,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(Mt(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:h=to,style:b,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),M=z(w,U.open),N=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),H=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(R),O=N&&ye&&E!=="touch";!N&&ye!==R&&he(R),J(()=>{N||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,N]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&M,E==="touch",W,A);const j=Ms({anchor:r,floatingRootContext:k,positionMethod:o,mounted:N,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:M,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Is(t,Q,{styles:Ce,transitionStatus:H,props:x,refs:[n,ne],hidden:!N,inert:!M}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(M&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Me.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Me.jsxs(Pr.Provider,{value:de,children:[N&&Y&&Me.jsx(xo,{inert:no(!M),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Me.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:R,scrollHandlerRef:h,listRef:b,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),M=z(a,U.id),N=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),H=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Ht(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){R();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){R();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,I=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=Rt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),R()},Ie=ne?I-$:$,Fe=Math.min(fe+Ie,re);if(D=Fe,Ie<=tt){We(Ie,ne?I:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<I){const ae=fe+Ie-re;Z=$-(Ie-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:Rt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),R()});l.useImperativeHandle(h,()=>O,[O]),gn({open:N,ref:f,onComplete(){N&&g?.(!0)}});const j={open:N,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{N||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[N,C,v,f]),J(()=>{const Q=f.current;if(!N||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(R),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=H||Q,I=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Ie=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let Ne,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);Ne=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-Ne.right:Pe.left-Ne.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=Ne.top-ie.top+Ne.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,be=ee-pe,Te=Ue-Ie;v.style.left=`${Rt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const Re=Ft($),Oe=be>=Re-tt;Oe&&(pe=Math.min(ae,ie.height)-(be-Re));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(I,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=be;if(Ne){const Pe=ie.top,Ke=ie.height,ht=Ne.top+Ne.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=Rt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),R(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&b.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,N,v,A,d,p,m,f,R,C,T,he,H,b,x,X,P]),l.useEffect(()=>{if(!C||!v||!N)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,N]);const le={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${M}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){H||O(Q.currentTarget)},...C&&{style:H?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!H&&C?$n.className:void 0},c]});return Me.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Me.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Ir(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ri(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),R=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const b=t!==void 0;g.current[p]=b?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const b=y.current?h.get(y.current)?.index:null;b!=null&&m(b)})},[s,a,m]),{ref:R,index:p}}const Lr=l.createContext(void 0);function bn(){const e=l.useContext(Lr);if(!e)throw new Error(Mt(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=Ri({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:R,selectionRef:h,typingRef:b,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,M=k!==-1,N=l.useRef(null);J(()=>{if(!M)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[M,k,i,x]),J(()=>{if(!M)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[M,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function H(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];R(Ce,_e(Zt,O))}else R(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&b.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&b.current||Q||(Y.current=null,H(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,N.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,N],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:M}),[_,k,u,X,M]);return Me.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=bn();return r||o?Me.jsx(bi,{...t,ref:n}):null}),bi=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=bn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=bn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{wr as A,Ei as C,ai as L,Ti as S,li as a,$n as b,Ai as c,Mi as d,Ii as e,Oi as f,Pi as g,Di as h,Li as i,Fi as j,Ns as k,Ks as l,Rn as m,Er as n,Wn as o,Bs as p,Rr as q,Oo as r,U as s,Ps as t,mt as u,Ms as v,fi as w,Is as x,Ci as y,gi as z};
1
+ import{k as Vr,bc as kr,r as l,bx as Ht,b4 as vt,aC as qn,bF as Nr,av as zt,y as _e,b5 as Ae,cv as it,cw as rn,bo as nt,bO as rt,aK as Be,cx as un,bM as Ct,bL as _t,cy as Hr,cz as Kn,cA as _r,bt as fn,bT as dn,cB as jt,cC as En,cD as Xn,Z as Br,bu as Wr,aG as Tt,aF as J,by as Gn,bv as Ur,O as ue,cE as Cn,cF as Jt,cG as Tn,bC as Qt,b6 as ot,aD as at,cH as An,cI as It,bf as Jn,cJ as Yt,cK as qt,cL as Qn,cM as pn,cN as $r,bH as zr,cO as on,cP as jr,x as gt,bS as Yr,aw as Mt,aH as Le,j as Me,au as oe,N as z,ay as gn,aJ as sn,aI as qr,aL as Kr,aM as Xr,aN as mn,cQ as Gr,bD as Jr,br as Qr,w as Zn,cR as Zr,az as eo,cS as to,aA as no,bE as ro,b8 as oo,cT as so,ax as er,cU as Zt}from"./__vite-browser-external-hJyUffEJ.js";import{n as Mn,q as tr,F as io,P as co,o as nr,v as Ye,E as lo,G as et,H as rr,J as ao,p as or,u as uo,m as sr,h as fo,a as po,l as go,A as mo,i as ho,I as xo,d as yo,b as wo}from"./useScrollLock-JHdC5cyV.js";const Ro=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",Ro),bo=["top","right","bottom","left"],wt=Math.min,He=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return He(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const In=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:In:t?In:On;case"left":case"right":return t?Co:To;default:return[]}}function Mo(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Io(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Io(e):{top:e,right:e,bottom:e,left:e}}function At(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 Rt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Ht(),p=vt(),m=l.useMemo(()=>{function y(h,b,x,w){const S=_e(a,b,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function R(h,b,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==b;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const b=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||Mn(b,!0)&&s)return;const S=R(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Nr(C)){y(S,x,C,b);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,b)})},onClick(h){if(r==="mousedown-only")return;const b=u.current;if(r==="mousedown"&&b){u.current=void 0;return}if(Mn(b,!0)&&s)return;const x=f.select("open"),w=R(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,b)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),R=c[d?u==="floating"?"reference":"floating":u],h=At(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:f,rootBoundary:g,strategy:a})),b=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:x,strategy:a}):b);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const R=s[y];if(!R)continue;const{name:h,fn:b}=R,{x,y:w,data:S,reset:C}=await b({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=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:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...R}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),b=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Mo(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,R),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const M=vo(o,i,w);L.push(T[M[0]],T[M[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(M=>M<=0)){var X,B;const M=(((X=s.flip)==null?void 0:X.index)||0)+1,N=P[M];if(N&&(!(u==="alignment"?b!==je(N):!1)||_.every(E=>je(E.placement)===b?E.overflows[0]>0:!0)))return{data:{index:M,overflows:_},reset:{placement:N}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===b||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return bo.some(t=>e[t]>=0)}const Vo=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=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const No=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,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},Ho=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:a={fn:h=>{let{x:b,y:x}=h;return{x:b,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",b=p==="y"?"bottom":"right",x=m+u[h],w=m-u[b];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",b=d==="y"?"bottom":"right",x=y+u[h],w=y-u[b];y=cn(x,y,w)}const R=a.fn({...t,[p]:m,[d]:y});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=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:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),R=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+R.mainAxis,S=s.reference[d]+s.reference[x]-R.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,b;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:R.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((b=i.offset)==null?void 0:b[u])||0)-(w?R.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=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:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let R,h;u==="top"||u==="bottom"?(R=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,R=d==="end"?"top":"bottom");const b=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[R],b),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=b),C&&!d){const _=He(g.left,0),X=He(g.right,0),B=He(g.top,0),k=He(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:He(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:He(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const R=yt(y),h=y.getBoundingClientRect(),b=rt(y),x=h.left+(y.clientLeft+parseFloat(b.paddingLeft))*R.x,w=h.top+(y.clientTop+parseFloat(b.paddingTop))*R.y;a*=R.x,f*=R.y,g*=R.x,u*=R.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(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 a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=He(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=He(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=He(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=He(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=He(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Hr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(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,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),R=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-R+"px "+-h+"px",threshold:He(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Nn(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:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[b]=h;b&&b.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&R();function R(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(R)}return n(),()=>{var h;g.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=No,ns=Ho,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(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(!Ut(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)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(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:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[R,h]=l.useState(null),b=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||R,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};M.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const M=l.useRef(!1);kt(()=>(M.current=!0,()=>{M.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const N=l.useMemo(()=>({reference:C,floating:P,setReference:b,setFloating:x}),[b,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Hn(Y.floating,g.x),A=Hn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:N,elements:Y,floatingStyles:F}),[g,k,N,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(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}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),R=l.useRef(null),h=nr(n),b=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...b,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(R.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:R}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(R.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function Rs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function bs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:h,id:b,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),M=Ye(B),N=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(I=>{o(E.current===-1?null:E.current,I)}),H=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Ht(),ne=Ht(),se=ue(()=>{function I(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&I(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||I(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=R},[X,R]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):H.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(H.current&&(E.current=-1,se()),(!me.current||!H.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let I=0;const D=()=>{n.current[0]==null?(I<2&&(I?V=>ne.request(V):queueMicrotask)(D),I+=1):(E.current=W.current==null||nn(W.current,R,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,R,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!H.current)return;const I=Y.nodesRef.current,D=I.find(G=>G.id===N)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=I.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,N,u]),J(()=>{me.current=T,H.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(I=>{if(!j.current)return;const D=n.current.indexOf(I.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(I))}),de=ue(()=>h??Y?.nodesRef.current.find(I=>I.id===N)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(I=>{if(A.current=!1,q.current=!0,I.which===229||!j.current&&I.currentTarget===M.current)return;if(f&&Rs(I.key,R,g,C)){Pt(I.key,de())||et(I),P.setOpen(!1,_e(An,I.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(I.key==="Home"&&(et(I),E.current=Z,v(I)),I.key==="End"&&(et(I),E.current=V,v(I))),S!=null){const G=S(I,E.current,n,R,a,g,y,Z,V);if(G!=null&&(E.current=G,v(I)),R==="both")return}if(Pt(I.key,R)){if(et(I),T&&!u&&Qt(I.currentTarget.ownerDocument)===I.currentTarget){E.current=nn(I.key,R,g)?Z:V,v(I);return}nn(I.key,R,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=It(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,It(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=It(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,It(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(I)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=M.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,M,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${b}-${r}`},[u,T,Se,b,r]),ie=l.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...k?{}:ce,onKeyDown(I){if(I.key==="Tab"&&I.shiftKey&&T&&!u){const D=qn(I.nativeEvent);if(D&&!at(M.current,D))return;et(I),P.setOpen(!1,_e(Jn,I.nativeEvent)),nt(_)&&_.focus();return}te(I)},onPointerMove(){A.current=!0}}),[ce,te,M,R,k,P,T,u,_]),re=l.useMemo(()=>{function I(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Ie=Pt(V.key,R),Fe=(f?We:Ie)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):I(V));return}Ie&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?I(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,R,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),R=l.useRef(null),h=ue(w=>{function S(M){const N=r?.current[M];return!N||zr(N)}function C(M){return S(M)?i==null||!$r(on,M,i):!1}function P(M,N,Y=0){if(M.length===0)return-1;const F=(Y%M.length+M.length)%M.length,E=N.toLowerCase();for(let W=0;W<M.length;W+=1){const A=(F+W)%M.length;if(!(!M[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((M,N)=>M&&C(N)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=R.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=R.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),R.current=k):w.key!==" "&&(m.current="",c?.(!1))}),b=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=R.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),R.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:b}),[h,b]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),R=await i.getDimensions(f),h=m==="y",b=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-R[y]/2-1,X=Math.min(d[b],_),B=Math.min(d[x],_),k=X,M=T-R[y]-B,N=T/2-R[y]/2+L,Y=cn(k,N,M),F=!a.arrow&&ut(o)!=null&&N!==Y&&s.reference[y]/2-(N<k?X:B)-R[y]/2<0,E=F?N<k?N-k:N-M:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:N-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={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 Ts(e)).data?.referenceHidden||s}}}},Nt={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Nt};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const b=ot(o);d={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const R=p==="left"?"right":Nt.sideX,h=p==="top"?"bottom":Nt.sideY;return{x:m,y,data:{sideX:R,sideY:h}}}};function yr(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 _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ms(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:R,shiftCrossAxis:h=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=R.side||"flip",L=R.align||"flip",_=R.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,M=Ye(t),N=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,H=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+H,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+H,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,be=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:be,alignmentAxis:be}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:be,height:Te}=O.current.getBoundingClientRect(),Re=je(Ve(ve.placement)),Oe=Re==="y"?be:Te,ze=Re==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:be}){if(!N.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const Re=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=be.reference,Pe=(Math.round((Oe+qe)*Re)-Math.round(Oe*Re))/Re,Ke=(Math.round((ze+ct)*Re)-Math.round(ze*Re))/Re;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:be,rects:Te,y:Re}=ee,Oe=Ve(be),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-Re}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:I,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Nn(...ee,xe),nodeId:b,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Nt,We=Z?n:"fixed",Ie=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=M.current,pe=typeof ee=="function"?ee():ee,be=(Bn(pe)?pe.current:pe)||null||null;be!==Fe.current&&(te.setPositionReference(be),Fe.current=be)},[y,te,k,M]),l.useEffect(()=>{if(!y)return;const ee=M.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,M]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Nn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(I),Ue=yr(r,ae,F),$e=ut(I)||"center",Ne=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Ie,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:Ne,refs:te,context:D,isPositioned:Z,update:$}),[Ie,Je,O,Qe,Ue,$e,ae,Ne,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Is(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function Rr(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return Rr(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const br=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(br);if(e===null)throw new Error(Mt(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(Mt(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},bt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...bt},Ns={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Hs={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:bt.touched,setTouched:Le,dirty:bt.dirty,setDirty:Le,filled:bt.filled,setFilled:Le,focused:bt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Hs);function Rn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(Mt(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=Rn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Mr(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Me.jsx(l.Fragment,{children:Mr(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Ir(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=Rt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:h,items:b,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:M,name:N,disabled:Y,validation:F,validationMode:E}=Rn(),W=Cr({id:t}),A=Y||u,v=N??a,[H,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:H,open:q,mounted:te,transitionStatus:ce,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,I=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(H,S),[x,H,S]),Ie=l.useMemo(()=>x&&Array.isArray(H)?H.map(K=>ft(K,S)):ft(H,S),[x,H,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Ie);Bs(Fe,W,H,ae,!A,a);const Ue=l.useRef(H),$e=x?Array.isArray(H)&&H.length>0:H!=null&&ft(H,S)!=="";J(()=>{H!==Ue.current&&$.set("forceMount",!0)},[$,H]),J(()=>{M($e)},[$e,M]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(H)?H:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,H,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,H,ne,C,$,fe]);function Ne(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}Rr(H,()=>{L(v),_(Ne(H)),F.change(H)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(H)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Ir(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),be=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),Re=bs(ve,{enabled:!d&&!A,listRef:he,activeIndex:I,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:I,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,Re.reference,Te.reference,be.reference,re);return W&&(K.id=W),K},[be.reference,Oe.reference,Re.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,Re.floating,Te.floating),[Oe.floating,Re.floating,Te.floating]),ct=Re.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:H,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:b,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,H,q,te,ce,qe,ze,b,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(R,F.inputRef),ht=x&&Array.isArray(H)&&H.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(H)||!v?null:H.map(K=>{const ge=ft(K,S);return Me.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,H,f,v,S,A]);return Me.jsx(br.Provider,{value:Pe,children:Me.jsxs(Sr.Provider,{value:ve,children:[T,Me.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Ns,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=Rn(),{labelId:y}=Er(),{store:R,setOpen:h,selectionRef:b,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(R,U.open),_=z(R,U.mounted),X=z(R,U.value),B=z(R,U.triggerProps),k=z(R,U.positionerElement),M=z(R,U.listElement),N=z(R,U.popupSide),Y=z(R,U.id),F=z(R,U.labelId),E=z(R,U.hasSelectedValue),W=_&&k?N:null,A=s??Y,v=Js(y,F);Cr({id:A});const H=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{R.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{le.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,b,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?M?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{R.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(H.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Mi=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,R=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let b=null;return typeof s=="function"?b=s(u):s!=null?b=s:!m&&i!=null&&!R?b=i:Array.isArray(u)?b=Ys(u,d,p):b=Mr(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:b},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Ii=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Me.jsx(ni.Provider,{value:!0,children:Me.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,b)=>{a.set(h,b??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(b=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);b.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((b,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const R=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Me.jsx(Or.Provider,{value:R,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(Mt(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:h=to,style:b,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),M=z(w,U.open),N=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),H=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(R),O=N&&ye&&E!=="touch";!N&&ye!==R&&he(R),J(()=>{N||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,N]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&M,E==="touch",W,A);const j=Ms({anchor:r,floatingRootContext:k,positionMethod:o,mounted:N,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:M,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Is(t,Q,{styles:Ce,transitionStatus:H,props:x,refs:[n,ne],hidden:!N,inert:!M}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(M&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Me.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Me.jsxs(Pr.Provider,{value:de,children:[N&&Y&&Me.jsx(xo,{inert:no(!M),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Me.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:R,scrollHandlerRef:h,listRef:b,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),M=z(a,U.id),N=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),H=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Ht(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){R();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){R();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,I=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=Rt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),R()},Ie=ne?I-$:$,Fe=Math.min(fe+Ie,re);if(D=Fe,Ie<=tt){We(Ie,ne?I:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<I){const ae=fe+Ie-re;Z=$-(Ie-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:Rt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),R()});l.useImperativeHandle(h,()=>O,[O]),gn({open:N,ref:f,onComplete(){N&&g?.(!0)}});const j={open:N,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{N||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[N,C,v,f]),J(()=>{const Q=f.current;if(!N||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(R),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=H||Q,I=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Ie=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let Ne,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);Ne=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-Ne.right:Pe.left-Ne.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=Ne.top-ie.top+Ne.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,be=ee-pe,Te=Ue-Ie;v.style.left=`${Rt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const Re=Ft($),Oe=be>=Re-tt;Oe&&(pe=Math.min(ae,ie.height)-(be-Re));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(I,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=be;if(Ne){const Pe=ie.top,Ke=ie.height,ht=Ne.top+Ne.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=Rt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),R(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&b.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,N,v,A,d,p,m,f,R,C,T,he,H,b,x,X,P]),l.useEffect(()=>{if(!C||!v||!N)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,N]);const le={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${M}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){H||O(Q.currentTarget)},...C&&{style:H?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!H&&C?$n.className:void 0},c]});return Me.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Me.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Ir(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ri(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),R=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const b=t!==void 0;g.current[p]=b?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const b=y.current?h.get(y.current)?.index:null;b!=null&&m(b)})},[s,a,m]),{ref:R,index:p}}const Lr=l.createContext(void 0);function bn(){const e=l.useContext(Lr);if(!e)throw new Error(Mt(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=Ri({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:R,selectionRef:h,typingRef:b,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,M=k!==-1,N=l.useRef(null);J(()=>{if(!M)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[M,k,i,x]),J(()=>{if(!M)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[M,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function H(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];R(Ce,_e(Zt,O))}else R(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&b.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&b.current||Q||(Y.current=null,H(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,N.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,N],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:M}),[_,k,u,X,M]);return Me.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=bn();return r||o?Me.jsx(bi,{...t,ref:n}):null}),bi=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=bn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=bn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{wr as A,Ei as C,ai as L,Ti as S,li as a,$n as b,Ai as c,Mi as d,Ii as e,Oi as f,Pi as g,Di as h,Li as i,Fi as j,Ns as k,Ks as l,Rn as m,Er as n,Wn as o,Bs as p,Rr as q,Oo as r,U as s,Ps as t,mt as u,Ms as v,fi as w,Is as x,Ci as y,gi as z};
@@ -1 +1 @@
1
- import{k as w,r as c,j as t,d as N,c as a,a as ae,am as ie,aQ as se,as as oe,at as re,a1 as U,aR as le,aS as ce,u as ue,R as C,U as de,Y as F,l as G,aT as ge,aU as he,M as pe,aV as me,v as be,aW as fe,aX as xe,aY as ye,aZ as ve,a_ as je,a$ as ke,b0 as Ne,L as Se,aP as we,b1 as Ce,ai as P}from"./__vite-browser-external-DWKjPxnU.js";import{b as Le,g as Ee,L as I,m as R}from"./react-Nv3-bJyw.js";import{u as Ae,L as _}from"./use-limits-display-prefs-CH8MmjYf.js";import{P as Ge}from"./ProviderIcon-BYl1Yyf3.js";import{a as O,l as T}from"./limits-providers-8NsMiLNP.js";import{a as k,T as j,b,S as L,u as H}from"./use-native-settings-__RhxrW5.js";import{P as Pe,u as Ie,a as _e}from"./use-session-efficiency-pref-CCYtJ_cN.js";import{C as Oe}from"./check-Cz3lYRiR.js";import{C as Te}from"./copy-CTtF84H9.js";import{A as De}from"./index-0w19KMWl.js";import{u as Me}from"./useCurrency-Dt2GqkDm.js";import{u as Ue}from"./useTokenFormat-dnqZK7Z-.js";import{S as $}from"./Select-ClnnGJY1.js";import{I as Fe}from"./info-F-75j15K.js";import{C as Re}from"./ConfirmModal-SAheZUAv.js";import{A as He}from"./arrow-up-right-TvEj8NTT.js";import{D as $e}from"./download-B5WAY6Nh.js";import"./Card-DX2Wwm9U.js";import"./SelectItemText-iaFWq7GD.js";import"./useScrollLock-C5d53j7C.js";import"./DialogTitle-Im7ESzoS.js";import"./DialogDescription-CVuGFYFU.js";const Ve=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Be=w("activity",Ve);const ze=[["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"}]],Ke=w("grip-vertical",ze);const Ze=[["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"}]],We=w("languages",Ze);const qe=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ye=w("log-out",qe),Qe=e=>!e.isLayoutDirty&&e.willUpdate(!1);function D(){const e=new Set,n=new WeakMap,i=()=>e.forEach(Qe);return{add:s=>{e.add(s),n.set(s,s.addEventListener("willUpdate",i))},remove:s=>{e.delete(s);const o=n.get(s);o&&(o(),n.delete(s)),i()},dirty:i}}const Je=c.createContext(null);function Xe(){const e=c.useRef(!1);return Le(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function et(){const e=Xe(),[n,i]=c.useState(0),s=c.useCallback(()=>{e.current&&i(n+1)},[n]);return[c.useCallback(()=>Ee.postRender(s),[s]),n]}const V=e=>e===!0,tt=e=>V(e===!0)||e==="id",nt=({children:e,id:n,inherit:i=!0})=>{const s=c.useContext(I),o=c.useContext(Je),[r,l]=et(),u=c.useRef(null),g=s.id||o;u.current===null&&(tt(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:V(i)&&s.group||D()});const h=c.useMemo(()=>({...u.current,forceRender:r}),[l]);return t.jsx(I.Provider,{value:h,children:e})},at="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function it({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:N("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",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function st({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,[r,l]=c.useState(null),[u,g]=c.useState(null),h=d=>f=>{l(d),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("text/plain",d)},m=d=>f=>{f.preventDefault(),f.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{l(null),g(null)},y=d=>{d.preventDefault(),l(null),g(null)};return t.jsx(nt,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const f=i[d]!==!1,p=r===d;return t.jsxs(R.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:x,onDrop:y,className:N("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",p&&"opacity-40"),style:{cursor:p?"grabbing":"grab"},children:[t.jsx(Ke,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),O(d)?t.jsx(Ge,{provider:O(d),size:18,className:N("pointer-events-none",at)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:T(d)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(it,{checked:f,onChange:()=>s(d),ariaLabel:`${a("limits.settings.toggle_visible")}: ${T(d)}`})})]},d)})})})}function ot(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function rt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function lt(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function ct(e,n,i){const[s,o]=c.useState(()=>ie()),r=n&&i&&se(),l=c.useCallback(async()=>{const u=!s;if(oe(u),o(u),!!u)try{await re(()=>e())}catch(g){E("cloud sync",g)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function ut(e){const[n,i]=c.useState(!1),[s,o]=c.useState(!1),[r,l]=c.useState(!1),[u,g]=c.useState(!1),[h,m]=c.useState(null),[x,y]=c.useState(!1),[d,f]=c.useState(""),[p,v]=c.useState(!1),[S,A]=c.useState(""),[Z,W]=c.useState(""),[q,Y]=c.useState(!1),[Q,J]=c.useState(null),X=c.useMemo(()=>ot(e),[e]),ee=c.useMemo(()=>rt(e),[e]),te=c.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),ne=c.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:A,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:v}),[]);return{anonymousOn:s,customDisplayName:h,displayName:X,editingGithub:q,editingName:x,email:ee,githubError:Q,githubInput:Z,githubUrl:S,loadSetters:ne,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:Y,setEditingName:y,setGithubError:J,setGithubInput:W,setGithubUrl:A,setNameInput:f,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:v,showGithubOn:p,userId:te}}function dt(e,n,i){c.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await U({getAccessToken:e});if(!s||!o)return;const r=await le({accessToken:o});if(!s)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function gt(e,n){return c.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await U({getAccessToken:e});if(!l)return!1;const u=await ce({accessToken:l,...i});return r?.(u),!0}catch(l){return o?o(l):E(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function ht(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function pt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function mt(e,n){const i=c.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:c.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function bt(e,n,i){const s=c.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=c.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function ft(e,n){const i=c.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),s=c.useCallback(async()=>{const r=lt(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=c.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function xt(){const e=ae(),n=ut(e.user),i=ct(e.getAccessToken,e.enabled,e.signedIn);dt(e.getAccessToken,e.signedIn,n.loadSetters);const s=gt(e.getAccessToken,n),o=mt(n,s),r=bt(n,s,e.refreshDisplayName),l=ft(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:ht(n,{...o,...r}),github:pt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function B({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function yt({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx(B,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function vt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{l(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx(B,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function z({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,className:"inline-flex h-8 shrink-0 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-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function K({actions:e,editing:n,editor:i,hint:s,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s})]}),n?null:e]})})}function jt({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(z,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function kt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:x,startEditingName:y}=e,d=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(K,{label:a("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(yt,{nameInput:u,setEditingName:m,setNameInput:x,profileSaving:h,handleSaveName:l}),actions:t.jsx(jt,{name:e})})}function Nt({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(t.Fragment,{children:t.jsx(K,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(vt,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(z,{label:a("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:l,disabled:u||g,ariaLabel:a("settings.account.githubUrl")})]})})})}function St(){const{openLoginModal:e}=ue();return t.jsx(k,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function wt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(kt,{name:e}),t.jsx(Nt,{github:n})]})}function Ct(){const e=xt();return e.enabled?e.signedIn?t.jsxs(k,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Et,{onSignOut:e.signOut}),children:[t.jsx(Lt,{userId:e.userId}),t.jsx(At,{settings:e}),t.jsx(Gt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Pt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(St,{}):null}function Lt({userId:e}){const[n,i]=C.useState(!1);if(!e)return null;const s=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 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 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Et({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function At({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Gt({checked:e,disabled:n,onChange:i}){return t.jsx(b,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Pt({visible:e,name:n,github:i}){return t.jsx(De,{initial:!1,children:e?t.jsx(R.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(wt,{name:n,github:i})},"public-profile-fields"):null})}function It(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:ge},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:he},{value:"system",label:a("settings.appearance.theme.system"),Icon:pe}]}function _t(){return[{value:fe,label:a("settings.appearance.language.system")},{value:xe,label:a("settings.appearance.language.english")},{value:ye,label:a("settings.appearance.language.chinese")},{value:ve,label:a("settings.appearance.language.traditional_chinese")},{value:je,label:a("settings.appearance.language.japanese")},{value:ke,label:a("settings.appearance.language.korean")},{value:Ne,label:a("settings.appearance.language.german")}]}function Ot(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Tt(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Ot(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Dt({locale:e,setLocale:n}){const i=_t();return t.jsx($,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(We,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Mt({currency:e,setCurrency:n}){const i=me().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx($,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Ut({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===be)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Tt(i,s);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,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:t.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Ft(){const{theme:e,setTheme:n}=de(),{locale:i,setLocale:s}=F(),{currency:o,rate:r,rateSource:l,rateFetchedAt:u,setCurrency:g}=Me(),{mode:h,setMode:m}=Ue();return t.jsxs(k,{title:a("settings.section.appearance"),children:[t.jsx(b,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(L,{options:It(),value:e,onChange:n})}),t.jsx(b,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(Dt,{locale:i,setLocale:s})}),t.jsx(b,{label:a("settings.appearance.currency.label"),hint:t.jsx(Ut,{currency:o,rate:r,rateSource:l,rateFetchedAt:u}),control:t.jsx(Mt,{currency:o,setCurrency:g})}),t.jsx(b,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(L,{options:[{value:G.COMPACT,label:a("settings.appearance.token_format.compact")},{value:G.FULL,label:a("settings.appearance.token_format.full")}],value:h,onChange:m})})]})}function M({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Rt(){const{enabled:e,toggle:n}=Ie(),{enabled:i,toggle:s}=_e();return t.jsxs(k,{title:a("settings.section.labs"),children:[t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(j,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(j,{checked:i,onChange:s,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Ht(){const{available:e,settings:n,setSetting:i,runAction:s}=H();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,l=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:a("settings.section.menubar"),children:[t.jsx(b,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Se,{to:"/widgets",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 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),r?t.jsx(b,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),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:[t.jsx(we,{className:N("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(b,{label:a("settings.menubar.updates"),hint:l||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:u,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:[t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function $t(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,u=o[r]||0;if(l<u)return!0;if(l>u)return!1}return!1}function Vt(){const{available:e,settings:n,runAction:i}=H(),s=e&&n?.version,[o,r]=C.useState(!1),[l,u]=C.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=F(),h="0.83.2",m=async()=>{r(!0);try{const p=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!p.ok)throw new Error("Failed to fetch");const v=await p.json(),S=v.tag_name;$t(h,S)?u({open:!0,latestVersion:S,htmlUrl:v.html_url}):P({title:a("settings.menubar.updates.upToDate")})}catch(p){console.error("Check updates failed:",p),P({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},x=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),d=a("settings.menubar.updates.modalConfirm"),f=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Ce,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Re,{open:l.open,title:x,description:y,confirmLabel:d,cancelLabel:f,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),u(p=>({...p,open:!1}))},onCancel:()=>u(p=>({...p,open:!1}))})]})}function Bt({prefs:e}){return t.jsx(L,{options:[{value:_.USED,label:a("limits.settings.display_mode_used")},{value:_.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function pn(){const e=Ae();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Ft,{}),t.jsx(Ht,{}),t.jsx(Ct,{}),t.jsx(Rt,{}),t.jsx(k,{title:a("settings.section.limits"),action:t.jsx(Bt,{prefs:e}),children:t.jsx(st,{prefs:e})})]}),t.jsx(Vt,{})]})})})}export{pn as SettingsPage};
1
+ import{k as w,r as c,j as t,d as N,c as a,a as ae,am as ie,aQ as se,as as oe,at as re,a1 as U,aR as le,aS as ce,u as ue,R as C,U as de,Y as F,l as G,aT as ge,aU as he,M as pe,aV as me,v as be,aW as fe,aX as xe,aY as ye,aZ as ve,a_ as je,a$ as ke,b0 as Ne,L as Se,aP as we,b1 as Ce,ai as P}from"./__vite-browser-external-hJyUffEJ.js";import{b as Le,g as Ee,L as I,m as R}from"./react-w-68N3xj.js";import{u as Ae,L as _}from"./use-limits-display-prefs-DJUffL2_.js";import{P as Ge}from"./ProviderIcon-I5z4CMY3.js";import{a as O,l as T}from"./limits-providers-FnlIwbBy.js";import{a as k,T as j,b,S as L,u as H}from"./use-native-settings-CiYsT_Ip.js";import{P as Pe,u as Ie,a as _e}from"./use-session-efficiency-pref-rHhQnzAS.js";import{C as Oe}from"./check-DQswISeD.js";import{C as Te}from"./copy-6aPUSNsw.js";import{A as De}from"./index-pza5Zl32.js";import{u as Me}from"./useCurrency-D3_YrrTw.js";import{u as Ue}from"./useTokenFormat-CMYJB7gb.js";import{S as $}from"./Select-DDInV6Vc.js";import{I as Fe}from"./info-CuyReqZo.js";import{C as Re}from"./ConfirmModal-C7nLLif7.js";import{A as He}from"./arrow-up-right-WGuMZ7yP.js";import{D as $e}from"./download-DL3wQKU1.js";import"./Card-DvOwwAzG.js";import"./SelectItemText-DIsD6lWR.js";import"./useScrollLock-JHdC5cyV.js";import"./DialogTitle-C6n2pohw.js";import"./DialogDescription-BkWNYqG-.js";const Ve=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Be=w("activity",Ve);const ze=[["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"}]],Ke=w("grip-vertical",ze);const Ze=[["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"}]],We=w("languages",Ze);const qe=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ye=w("log-out",qe),Qe=e=>!e.isLayoutDirty&&e.willUpdate(!1);function D(){const e=new Set,n=new WeakMap,i=()=>e.forEach(Qe);return{add:s=>{e.add(s),n.set(s,s.addEventListener("willUpdate",i))},remove:s=>{e.delete(s);const o=n.get(s);o&&(o(),n.delete(s)),i()},dirty:i}}const Je=c.createContext(null);function Xe(){const e=c.useRef(!1);return Le(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function et(){const e=Xe(),[n,i]=c.useState(0),s=c.useCallback(()=>{e.current&&i(n+1)},[n]);return[c.useCallback(()=>Ee.postRender(s),[s]),n]}const V=e=>e===!0,tt=e=>V(e===!0)||e==="id",nt=({children:e,id:n,inherit:i=!0})=>{const s=c.useContext(I),o=c.useContext(Je),[r,l]=et(),u=c.useRef(null),g=s.id||o;u.current===null&&(tt(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:V(i)&&s.group||D()});const h=c.useMemo(()=>({...u.current,forceRender:r}),[l]);return t.jsx(I.Provider,{value:h,children:e})},at="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function it({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:N("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",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function st({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,[r,l]=c.useState(null),[u,g]=c.useState(null),h=d=>f=>{l(d),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("text/plain",d)},m=d=>f=>{f.preventDefault(),f.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{l(null),g(null)},y=d=>{d.preventDefault(),l(null),g(null)};return t.jsx(nt,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const f=i[d]!==!1,p=r===d;return t.jsxs(R.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:x,onDrop:y,className:N("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",p&&"opacity-40"),style:{cursor:p?"grabbing":"grab"},children:[t.jsx(Ke,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),O(d)?t.jsx(Ge,{provider:O(d),size:18,className:N("pointer-events-none",at)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:T(d)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(it,{checked:f,onChange:()=>s(d),ariaLabel:`${a("limits.settings.toggle_visible")}: ${T(d)}`})})]},d)})})})}function ot(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function rt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function lt(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function ct(e,n,i){const[s,o]=c.useState(()=>ie()),r=n&&i&&se(),l=c.useCallback(async()=>{const u=!s;if(oe(u),o(u),!!u)try{await re(()=>e())}catch(g){E("cloud sync",g)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function ut(e){const[n,i]=c.useState(!1),[s,o]=c.useState(!1),[r,l]=c.useState(!1),[u,g]=c.useState(!1),[h,m]=c.useState(null),[x,y]=c.useState(!1),[d,f]=c.useState(""),[p,v]=c.useState(!1),[S,A]=c.useState(""),[Z,W]=c.useState(""),[q,Y]=c.useState(!1),[Q,J]=c.useState(null),X=c.useMemo(()=>ot(e),[e]),ee=c.useMemo(()=>rt(e),[e]),te=c.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),ne=c.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:A,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:v}),[]);return{anonymousOn:s,customDisplayName:h,displayName:X,editingGithub:q,editingName:x,email:ee,githubError:Q,githubInput:Z,githubUrl:S,loadSetters:ne,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:Y,setEditingName:y,setGithubError:J,setGithubInput:W,setGithubUrl:A,setNameInput:f,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:v,showGithubOn:p,userId:te}}function dt(e,n,i){c.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await U({getAccessToken:e});if(!s||!o)return;const r=await le({accessToken:o});if(!s)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function gt(e,n){return c.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await U({getAccessToken:e});if(!l)return!1;const u=await ce({accessToken:l,...i});return r?.(u),!0}catch(l){return o?o(l):E(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function ht(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function pt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function mt(e,n){const i=c.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:c.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function bt(e,n,i){const s=c.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=c.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function ft(e,n){const i=c.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),s=c.useCallback(async()=>{const r=lt(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=c.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function xt(){const e=ae(),n=ut(e.user),i=ct(e.getAccessToken,e.enabled,e.signedIn);dt(e.getAccessToken,e.signedIn,n.loadSetters);const s=gt(e.getAccessToken,n),o=mt(n,s),r=bt(n,s,e.refreshDisplayName),l=ft(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:ht(n,{...o,...r}),github:pt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function B({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function yt({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx(B,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function vt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{l(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx(B,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function z({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,className:"inline-flex h-8 shrink-0 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-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function K({actions:e,editing:n,editor:i,hint:s,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s})]}),n?null:e]})})}function jt({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(z,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function kt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:x,startEditingName:y}=e,d=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(K,{label:a("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(yt,{nameInput:u,setEditingName:m,setNameInput:x,profileSaving:h,handleSaveName:l}),actions:t.jsx(jt,{name:e})})}function Nt({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(t.Fragment,{children:t.jsx(K,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(vt,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(z,{label:a("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:l,disabled:u||g,ariaLabel:a("settings.account.githubUrl")})]})})})}function St(){const{openLoginModal:e}=ue();return t.jsx(k,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function wt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(kt,{name:e}),t.jsx(Nt,{github:n})]})}function Ct(){const e=xt();return e.enabled?e.signedIn?t.jsxs(k,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Et,{onSignOut:e.signOut}),children:[t.jsx(Lt,{userId:e.userId}),t.jsx(At,{settings:e}),t.jsx(Gt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Pt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(St,{}):null}function Lt({userId:e}){const[n,i]=C.useState(!1);if(!e)return null;const s=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 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 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Et({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function At({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Gt({checked:e,disabled:n,onChange:i}){return t.jsx(b,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Pt({visible:e,name:n,github:i}){return t.jsx(De,{initial:!1,children:e?t.jsx(R.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(wt,{name:n,github:i})},"public-profile-fields"):null})}function It(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:ge},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:he},{value:"system",label:a("settings.appearance.theme.system"),Icon:pe}]}function _t(){return[{value:fe,label:a("settings.appearance.language.system")},{value:xe,label:a("settings.appearance.language.english")},{value:ye,label:a("settings.appearance.language.chinese")},{value:ve,label:a("settings.appearance.language.traditional_chinese")},{value:je,label:a("settings.appearance.language.japanese")},{value:ke,label:a("settings.appearance.language.korean")},{value:Ne,label:a("settings.appearance.language.german")}]}function Ot(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Tt(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Ot(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Dt({locale:e,setLocale:n}){const i=_t();return t.jsx($,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(We,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Mt({currency:e,setCurrency:n}){const i=me().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx($,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Ut({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===be)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Tt(i,s);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,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:t.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Ft(){const{theme:e,setTheme:n}=de(),{locale:i,setLocale:s}=F(),{currency:o,rate:r,rateSource:l,rateFetchedAt:u,setCurrency:g}=Me(),{mode:h,setMode:m}=Ue();return t.jsxs(k,{title:a("settings.section.appearance"),children:[t.jsx(b,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(L,{options:It(),value:e,onChange:n})}),t.jsx(b,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(Dt,{locale:i,setLocale:s})}),t.jsx(b,{label:a("settings.appearance.currency.label"),hint:t.jsx(Ut,{currency:o,rate:r,rateSource:l,rateFetchedAt:u}),control:t.jsx(Mt,{currency:o,setCurrency:g})}),t.jsx(b,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(L,{options:[{value:G.COMPACT,label:a("settings.appearance.token_format.compact")},{value:G.FULL,label:a("settings.appearance.token_format.full")}],value:h,onChange:m})})]})}function M({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Rt(){const{enabled:e,toggle:n}=Ie(),{enabled:i,toggle:s}=_e();return t.jsxs(k,{title:a("settings.section.labs"),children:[t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(j,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(j,{checked:i,onChange:s,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Ht(){const{available:e,settings:n,setSetting:i,runAction:s}=H();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,l=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:a("settings.section.menubar"),children:[t.jsx(b,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Se,{to:"/widgets",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 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),r?t.jsx(b,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),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:[t.jsx(we,{className:N("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(b,{label:a("settings.menubar.updates"),hint:l||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:u,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:[t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function $t(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,u=o[r]||0;if(l<u)return!0;if(l>u)return!1}return!1}function Vt(){const{available:e,settings:n,runAction:i}=H(),s=e&&n?.version,[o,r]=C.useState(!1),[l,u]=C.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=F(),h="0.83.3",m=async()=>{r(!0);try{const p=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!p.ok)throw new Error("Failed to fetch");const v=await p.json(),S=v.tag_name;$t(h,S)?u({open:!0,latestVersion:S,htmlUrl:v.html_url}):P({title:a("settings.menubar.updates.upToDate")})}catch(p){console.error("Check updates failed:",p),P({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},x=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),d=a("settings.menubar.updates.modalConfirm"),f=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Ce,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Re,{open:l.open,title:x,description:y,confirmLabel:d,cancelLabel:f,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),u(p=>({...p,open:!1}))},onCancel:()=>u(p=>({...p,open:!1}))})]})}function Bt({prefs:e}){return t.jsx(L,{options:[{value:_.USED,label:a("limits.settings.display_mode_used")},{value:_.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function pn(){const e=Ae();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Ft,{}),t.jsx(Ht,{}),t.jsx(Ct,{}),t.jsx(Rt,{}),t.jsx(k,{title:a("settings.section.limits"),action:t.jsx(Bt,{prefs:e}),children:t.jsx(st,{prefs:e})})]}),t.jsx(Vt,{})]})})})}export{pn as SettingsPage};