tokentracker-cli 1.1.13 → 1.2.1

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 (126) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-DHCKPAgO.js → AchievementBadge-DPlXNqoK.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-BqlGMD7S.js → AchievementsPage-B49wjdK_.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-CTTTR9CN.js → AchievementsSection-DoYMz2Rr.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-e0Iz8ct4.js → BadgeDetailModal-DUCS6K1n.js} +1 -1
  5. package/dashboard/dist/assets/{BotAnimated-BLYZyT1O.js → BotAnimated-C21PdYSf.js} +1 -1
  6. package/dashboard/dist/assets/{Card-EHkn9ktD.js → Card-BU2CqxfU.js} +1 -1
  7. package/dashboard/dist/assets/{CommandPalette-CuSVstX9.js → CommandPalette-O3pOLyJo.js} +1 -1
  8. package/dashboard/dist/assets/CommunityStatsModal-Bt82neQ7.js +1 -0
  9. package/dashboard/dist/assets/{ConfirmModal-pIUQJ7QM.js → ConfirmModal-zUljpLNe.js} +1 -1
  10. package/dashboard/dist/assets/{Controls-CX4Di57j.js → Controls-D56v-YJw.js} +1 -1
  11. package/dashboard/dist/assets/DashboardPage-CKEuFzuc.js +1 -0
  12. package/dashboard/dist/assets/DevicePage-CCIyAYH3.js +1 -0
  13. package/dashboard/dist/assets/{DialogClose-Dn-nxOSp.js → DialogClose-C-QK97qp.js} +1 -1
  14. package/dashboard/dist/assets/DialogDescription-COXweCuc.js +1 -0
  15. package/dashboard/dist/assets/{DialogTitle-DuAY9sfZ.js → DialogTitle-6q0jyME6.js} +1 -1
  16. package/dashboard/dist/assets/{FadeIn-25jNO9JV.js → FadeIn-BUm1z22V.js} +1 -1
  17. package/dashboard/dist/assets/{HeaderGithubStar-0-ne32-S.js → HeaderGithubStar-CxdmloMy.js} +1 -1
  18. package/dashboard/dist/assets/{HoverTooltip-C2Qop8B3.js → HoverTooltip-CrMdGYZj.js} +1 -1
  19. package/dashboard/dist/assets/{IpCheckPage-Q9lwiFdt.js → IpCheckPage-w6UUK_1K.js} +1 -1
  20. package/dashboard/dist/assets/LandingPage-DLDE7wdR.js +2 -0
  21. package/dashboard/dist/assets/{LeaderboardAvatar-CiQrgneF.js → LeaderboardAvatar-BqD4dEvQ.js} +1 -1
  22. package/dashboard/dist/assets/LeaderboardPage-kgHSryiT.js +2 -0
  23. package/dashboard/dist/assets/{LeaderboardProfileModal-CF-MI8rL.js → LeaderboardProfileModal-zLdeOiA3.js} +4 -4
  24. package/dashboard/dist/assets/{LeaderboardProfilePage-DRbLb-fO.js → LeaderboardProfilePage-Fljho5RP.js} +2 -2
  25. package/dashboard/dist/assets/{LimitsPage-lvYidBkz.js → LimitsPage-Do_uJqdQ.js} +2 -2
  26. package/dashboard/dist/assets/{LocalOnlyNotice-CAQTnlaI.js → LocalOnlyNotice-RIj2XT_X.js} +1 -1
  27. package/dashboard/dist/assets/{LoginCard-Ci2Rrsfl.js → LoginCard-Dx6MmGjU.js} +1 -1
  28. package/dashboard/dist/assets/{LoginModal-DhyQPl-V.js → LoginModal-BWaZVRnT.js} +1 -1
  29. package/dashboard/dist/assets/{LoginPage-B6q8P6hE.js → LoginPage-BNkU-riS.js} +1 -1
  30. package/dashboard/dist/assets/{PetPage-82Cldgg6.js → PetPage-CyEgU2Vm.js} +1 -1
  31. package/dashboard/dist/assets/PopoverPopup-CmUIY8lF.js +1 -0
  32. package/dashboard/dist/assets/{ProviderIcon-aLwclDsD.js → ProviderIcon-BSI-1Cy8.js} +1 -1
  33. package/dashboard/dist/assets/{ResetPasswordPage-BlRl_aJr.js → ResetPasswordPage-CUXKkLb4.js} +1 -1
  34. package/dashboard/dist/assets/Select-B6CM0ico.js +1 -0
  35. package/dashboard/dist/assets/SelectItemText-CZ7puxuB.js +1 -0
  36. package/dashboard/dist/assets/{ServiceStatusPage-Pd6dgJua.js → ServiceStatusPage-B4lIs2fc.js} +1 -1
  37. package/dashboard/dist/assets/SessionsPage-BngTWN7Q.css +1 -0
  38. package/dashboard/dist/assets/SessionsPage-D99UfBgy.js +3 -0
  39. package/dashboard/dist/assets/SettingsPage-DT3rld91.js +2 -0
  40. package/dashboard/dist/assets/SkillsPage-Dv47kVCB.js +1 -0
  41. package/dashboard/dist/assets/{TokenGalaxy-BN71jQQ8.js → TokenGalaxy-Bk3kGSGi.js} +2 -2
  42. package/dashboard/dist/assets/TrendMonitor-mB1x3c_o.js +19 -0
  43. package/dashboard/dist/assets/WidgetsPage-BhUArowe.js +1 -0
  44. package/dashboard/dist/assets/{WrappedPage-Cq8DrzLm.js → WrappedPage-DHRmP4Ey.js} +1 -1
  45. package/dashboard/dist/assets/__vite-browser-external-BW1rxvYq.js +45 -0
  46. package/dashboard/dist/assets/__vite-browser-external-gKkiQad5.css +1 -0
  47. package/dashboard/dist/assets/{agent-logos-X7FQq7rz.js → agent-logos-D7f7AMF-.js} +1 -1
  48. package/dashboard/dist/assets/{arrow-up-right-CPxuidzy.js → arrow-up-right-c39fdiDQ.js} +1 -1
  49. package/dashboard/dist/assets/{check-D2K19ObI.js → check-8LQ7IvkH.js} +1 -1
  50. package/dashboard/dist/assets/{composite-BN1UKLj0.js → composite-BgLSXWKA.js} +1 -1
  51. package/dashboard/dist/assets/{download-CpW-TB2h.js → download-x3Gmv-wu.js} +1 -1
  52. package/dashboard/dist/assets/{external-link-ChBchK6G.js → external-link-daw-XTjZ.js} +1 -1
  53. package/dashboard/dist/assets/{flame-f7119ZMd.js → flame-B9o0_EF8.js} +1 -1
  54. package/dashboard/dist/assets/{format-tokens-COrRnk53.js → format-tokens-o9atQGtV.js} +1 -1
  55. package/dashboard/dist/assets/host-mode-GPY2DxE4.js +1 -0
  56. package/dashboard/dist/assets/{icons-Dn9vA9Qu.js → icons-CmM2z-Jt.js} +1 -1
  57. package/dashboard/dist/assets/{index-BCNOKYSO.js → index-Bfgblk6o.js} +1 -1
  58. package/dashboard/dist/assets/{index-CA-94DFW.js → index-CPcJP0uH.js} +1 -1
  59. package/dashboard/dist/assets/{index-CElyhNzh.js → index-CtQOew7C.js} +1 -1
  60. package/dashboard/dist/assets/{info-BHsPBczD.js → info-BaK8Hoi2.js} +1 -1
  61. package/dashboard/dist/assets/{link-2-BHfEWv22.js → link-2-CV3uvMH3.js} +1 -1
  62. package/dashboard/dist/assets/{loader-circle-DTIT1Uk1.js → loader-circle-DYpa-xTZ.js} +1 -1
  63. package/dashboard/dist/assets/{modifiers.esm-CPBla3OK.js → modifiers.esm-Ds4Uh7JO.js} +1 -1
  64. package/dashboard/dist/assets/{monitor-smartphone-CbsYB-S2.js → monitor-smartphone-BbeYHvY-.js} +1 -1
  65. package/dashboard/dist/assets/{plus-CZiNoMsy.js → plus-C9qGVLFv.js} +1 -1
  66. package/dashboard/dist/assets/provider-display-BWYNyitK.js +42 -0
  67. package/dashboard/dist/assets/{react-CZdcuJ28.js → react-CO1HovF5.js} +1 -1
  68. package/dashboard/dist/assets/{search-q2ARMGca.js → search-DBnhkzG_.js} +1 -1
  69. package/dashboard/dist/assets/{skills-api-CIyqyk-w.js → skills-api-BSkbxC8-.js} +1 -1
  70. package/dashboard/dist/assets/{sortable.esm-BztIEZTk.js → sortable.esm-SVl6OixH.js} +1 -1
  71. package/dashboard/dist/assets/{store-DvdXwk-7.js → store-DrEEdO_u.js} +1 -1
  72. package/dashboard/dist/assets/terminal-kUMdPZhq.js +1 -0
  73. package/dashboard/dist/assets/{trash-D0ptaWPk.js → trash-Dd_vbrYo.js} +1 -1
  74. package/dashboard/dist/assets/{use-community-stats-DYibzhAl.js → use-community-stats-Bmlmv4H-.js} +1 -1
  75. package/dashboard/dist/assets/{use-latest-request-guard-viIhH7H5.js → use-latest-request-guard-CqZwzrCW.js} +1 -1
  76. package/dashboard/dist/assets/{use-limits-display-prefs-CbXApWU1.js → use-limits-display-prefs-CDC0MZRY.js} +1 -1
  77. package/dashboard/dist/assets/{use-ordered-list-BBP8hr8y.js → use-ordered-list-DvBI7mUU.js} +1 -1
  78. package/dashboard/dist/assets/{use-pet-settings-CIrPZ9pB.js → use-pet-settings-C_FrqySO.js} +2 -2
  79. package/dashboard/dist/assets/use-reduced-motion-BEOENqBa.js +1 -0
  80. package/dashboard/dist/assets/{use-session-efficiency-pref-2Vb3tJrw.js → use-session-efficiency-pref-D8cAb4A9.js} +1 -1
  81. package/dashboard/dist/assets/{use-transform-CECRFELz.js → use-transform-uSKYTYaW.js} +1 -1
  82. package/dashboard/dist/assets/{use-usage-limits-DEnbjOVG.js → use-usage-limits-DFgOKTtv.js} +1 -1
  83. package/dashboard/dist/assets/{useCurrency-Dh9pUzDO.js → useCurrency-t1iy_pC3.js} +1 -1
  84. package/dashboard/dist/assets/useTokenFormat-0bPjtaaM.js +1 -0
  85. package/dashboard/dist/assets/{zap-BdeAxq64.js → zap-DFM6AsYo.js} +1 -1
  86. package/dashboard/dist/index.html +2 -2
  87. package/dashboard/dist/ip-check.html +2 -2
  88. package/dashboard/dist/leaderboard.html +2 -2
  89. package/dashboard/dist/legal.css +1 -0
  90. package/dashboard/dist/pricing.html +35 -0
  91. package/dashboard/dist/privacy.html +278 -0
  92. package/dashboard/dist/share.html +2 -2
  93. package/dashboard/dist/terms.html +41 -0
  94. package/package.json +1 -1
  95. package/src/lib/codex-rollout-parser.js +5 -0
  96. package/src/lib/local-api.js +5 -1
  97. package/src/lib/pricing/index.js +45 -0
  98. package/src/lib/pricing/seed-snapshot.json +1 -1
  99. package/src/lib/rollout.js +1 -0
  100. package/src/lib/session-analytics.js +74 -18
  101. package/src/lib/session-performance.js +214 -0
  102. package/dashboard/dist/assets/CommunityStatsModal-Cb1vefLE.js +0 -1
  103. package/dashboard/dist/assets/DashboardPage-D1Ox1y3E.js +0 -1
  104. package/dashboard/dist/assets/DevicePage-Q57gBE8A.js +0 -1
  105. package/dashboard/dist/assets/DialogDescription-GXslTq2z.js +0 -1
  106. package/dashboard/dist/assets/LandingPage-iX6E8Flr.js +0 -2
  107. package/dashboard/dist/assets/LeaderboardPage-BIhIA28A.js +0 -2
  108. package/dashboard/dist/assets/PopoverPopup-Btcu7vU0.js +0 -1
  109. package/dashboard/dist/assets/SegmentedControl-2O_XVL8u.js +0 -1
  110. package/dashboard/dist/assets/Select-D5uuRQwh.js +0 -1
  111. package/dashboard/dist/assets/SelectItemText-Bq_ZdWU0.js +0 -1
  112. package/dashboard/dist/assets/SessionsPage-DjHudcn6.js +0 -2
  113. package/dashboard/dist/assets/SettingsPage-DOLhZiBE.js +0 -2
  114. package/dashboard/dist/assets/SkillsPage-D9-ZorB5.js +0 -1
  115. package/dashboard/dist/assets/ToolbarRootContext-B0cqyD1i.js +0 -1
  116. package/dashboard/dist/assets/TrendMonitor-DWxtbzyQ.js +0 -19
  117. package/dashboard/dist/assets/WidgetsPage-BwmJ2Z9d.js +0 -1
  118. package/dashboard/dist/assets/__vite-browser-external-CPMSmJgP.js +0 -45
  119. package/dashboard/dist/assets/__vite-browser-external-DrXtuPP9.css +0 -1
  120. package/dashboard/dist/assets/copy-CSN17qFv.js +0 -1
  121. package/dashboard/dist/assets/host-mode-Bc_iTzHk.js +0 -1
  122. package/dashboard/dist/assets/maximize-2-BmtIBzLu.js +0 -1
  123. package/dashboard/dist/assets/provider-display-CXKRt9q1.js +0 -42
  124. package/dashboard/dist/assets/terminal-CFQOW2Ey.js +0 -1
  125. package/dashboard/dist/assets/use-reduced-motion-Dpq-cKyM.js +0 -1
  126. package/dashboard/dist/assets/useTokenFormat-CoGcVhPP.js +0 -1
@@ -0,0 +1 @@
1
+ import{q as Vo,bt as ko,r as a,bO as Pt,bk as bt,aJ as Wn,bV as Ho,E as dt,x as Ae,bm as Ee,cO as et,bG as Je,c3 as Qe,aS as Ie,cP as rn,c1 as Lt,c0 as Jt,cQ as _o,cR as Nn,cS as Bo,bK as sn,c7 as $n,cT as _t,cU as Qt,cV as yn,cW as Un,a6 as Wo,bL as No,bh as gt,aL as X,bP as zn,bM as $o,bl as te,cX as Rn,cY as zt,cZ as bn,bS as jt,bn as rt,aK as Ge,c_ as wn,c$ as St,bw as jn,bU as qn,d0 as Bt,d1 as Wt,d2 as Yn,d3 as cn,b_ as Uo,d4 as zo,d5 as Zt,d6 as jo,w as ct,c6 as qo,aE as ht,bf as ue,j as Re,aG as ln,aQ as en,aP as Yo,aT as Ko,aU as Xo,aV as Dt,aM as Go,bT as Jo,bI as Qo,v as Kn,d7 as Zo,aH as er,d8 as tr,aI as nr,bp as or,d9 as rr,aF as Xn,da as qt}from"./__vite-browser-external-BW1rxvYq.js";import{o as Yt,D as Gn,r as Jn,F as sr,P as ir,q as Qn,v as De,E as cr,G as $e,H as Zn,a as eo,f as lr,u as ar,n as to,e as ur,d as fr,z as dr,I as pr,b as gr,C as mr}from"./composite-BgLSXWKA.js";const no={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};no.node;const Vi=Vo(no),mt=Math.min,ze=Math.max,Ft=Math.round,vt=Math.floor,je=e=>({x:e,y:e}),hr={left:"right",right:"left",bottom:"top",top:"bottom"};function oo(e,t,n){return ze(e,mt(t,n))}function Ze(e,t){return typeof e=="function"?e(t):e}function Pe(e){return e.split("-")[0]}function qe(e){return e.split("-")[1]}function an(e){return e==="x"?"y":"x"}function un(e){return e==="y"?"height":"width"}function Oe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fn(e){return an(Oe(e))}function xr(e,t,n){n===void 0&&(n=!1);const o=qe(e),r=fn(e),s=un(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Vt(i)),[i,Vt(i)]}function yr(e){const t=Vt(e);return[tn(e),t,tn(t)]}function tn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Sn=["left","right"],vn=["right","left"],Rr=["top","bottom"],br=["bottom","top"];function wr(e,t,n){switch(e){case"top":case"bottom":return n?t?vn:Sn:t?Sn:vn;case"left":case"right":return t?Rr:br;default:return[]}}function Sr(e,t,n,o){const r=qe(e);let s=wr(Pe(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(tn)))),s}function Vt(e){const t=Pe(e);return hr[t]+e.slice(t.length)}function vr(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function ro(e){return typeof e!="number"?vr(e):{top:e,right:e,bottom:e,left:e}}function wt(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function yt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Cr(e,t={}){const{enabled:n=!0,event:o="click",toggle:r=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:l=ko}=t,f="rootStore"in e?e.rootStore:e,p=f.context.dataRef,d=a.useRef(void 0),m=Pt(),u=bt(),h=a.useMemo(()=>{function y(g,S,C,x){const b=Ae(l,S,C);g&&x==="touch"&&c>0?u.start(c,()=>{f.setOpen(!0,b)}):f.setOpen(g,b)}function R(g,S,C){const x=p.current.openEvent,b=f.select("domReferenceElement")!==S;return g&&b||!g||!r?!0:x&&i?!C(x.type):!1}return{onPointerDown(g){d.current=Yt(g.pointerType,!0)&&Gn(g.nativeEvent)?"virtual":g.pointerType},onMouseDown(g){const S=d.current,C=g.nativeEvent,x=f.select("open");if(g.button!==0||o==="click"||Yt(S,!0)&&s)return;const b=R(x,g.currentTarget,v=>v==="click"||v==="mousedown"),E=Wn(C);if(Ho(E)){y(b,C,E,S);return}const w=g.currentTarget;m.request(()=>{y(b,C,w,S)})},onClick(g){if(o==="mousedown-only")return;const S=d.current;if(o==="mousedown"&&S){d.current=void 0;return}if(Yt(S,!0)&&s)return;const C=f.select("open"),x=R(C,g.currentTarget,b=>b==="click"||b==="mousedown"||b==="keydown"||b==="keyup");y(x,g.nativeEvent,g.currentTarget,S)},onKeyDown(){d.current=void 0}}},[p,o,s,l,f,i,r,m,u,c]);return a.useMemo(()=>n?{reference:h}:dt,[n,h])}function Cn(e,t,n){let{reference:o,floating:r}=e;const s=Oe(t),i=fn(t),c=un(i),l=Pe(t),f=s==="y",p=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let u;switch(l){case"top":u={x:p,y:o.y-r.height};break;case"bottom":u={x:p,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:d};break;case"left":u={x:o.x-r.width,y:d};break;default:u={x:o.x,y:o.y}}const h=qe(t);return h&&(u[i]+=m*(h==="end"?1:-1)*(n&&f?-1:1)),u}async function Er(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:l}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:m=!1,padding:u=0}=Ze(t,e),h=ro(u),R=c[m?d==="floating"?"reference":"floating":d],g=wt(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:p,strategy:l})),S=d==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),x=await(s.isElement==null?void 0:s.isElement(C))&&await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1},b=wt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:S,offsetParent:C,strategy:l}):S);return{top:(g.top-b.top+h.top)/x.y,bottom:(b.bottom-g.bottom+h.bottom)/x.y,left:(g.left-b.left+h.left)/x.x,right:(b.right-g.right+h.right)/x.x}}const Ar=50,Ir=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Er},l=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:p,y:d}=Cn(f,o,l),m=o,u=0;const h={};for(let y=0;y<s.length;y++){const R=s[y];if(!R)continue;const{name:g,fn:S}=R,{x:C,y:x,data:b,reset:E}=await S({x:p,y:d,initialPlacement:o,placement:m,strategy:r,middlewareData:h,rects:f,platform:c,elements:{reference:e,floating:t}});p=C??p,d=x??d,h[g]={...h[g],...b},E&&u<Ar&&(u++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(f=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):E.rects),{x:p,y:d}=Cn(f,m,l)),y=-1)}return{x:p,y:d,placement:m,strategy:r,middlewareData:h}},Tr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:l,elements:f}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:y=!0,...R}=Ze(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=Pe(r),S=Oe(c),C=Pe(c)===c,x=await(l.isRTL==null?void 0:l.isRTL(f.floating)),b=m||(C||!y?[Vt(c)]:yr(c)),E=h!=="none";!m&&E&&b.push(...Sr(c,y,h,x));const w=[c,...b],v=await l.detectOverflow(t,R),D=[];let O=((o=s.flip)==null?void 0:o.overflows)||[];if(p&&D.push(v[g]),d){const F=xr(r,i,x);D.push(v[F[0]],v[F[1]])}if(O=[...O,{placement:r,overflows:D}],!D.every(F=>F<=0)){var V,$;const F=(((V=s.flip)==null?void 0:V.index)||0)+1,U=w[F];if(U&&(!(d==="alignment"?S!==Oe(U):!1)||O.every(I=>Oe(I.placement)===S?I.overflows[0]>0:!0)))return{data:{index:F,overflows:O},reset:{placement:U}};let z=($=O.filter(W=>W.overflows[0]<=0).sort((W,I)=>W.overflows[1]-I.overflows[1])[0])==null?void 0:$.placement;if(!z)switch(u){case"bestFit":{var M;const W=(M=O.filter(I=>{if(E){const H=Oe(I.placement);return H===S||H==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,A)=>H+A,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:M[0];W&&(z=W);break}case"initialPlacement":z=c;break}if(r!==z)return{reset:{placement:z}}}return{}}}},so=new Set(["left","top"]);async function Mr(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Pe(n),c=qe(n),l=Oe(n)==="y",f=so.has(i)?-1:1,p=s&&l?-1:1,d=Ze(t,e);let{mainAxis:m,crossAxis:u,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(u=c==="end"?h*-1:h),l?{x:u*p,y:m*f}:{x:m*f,y:u*p}}const Or=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=t,l=await Mr(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:i}}}}},Pr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:l={fn:S=>{let{x:C,y:x}=S;return{x:C,y:x}}},...f}=Ze(e,t),p={x:n,y:o},d=await s.detectOverflow(t,f),m=Oe(r),u=an(m);let h=p[u],y=p[m];const R=(S,C)=>oo(C+d[S==="y"?"top":"left"],C,C-d[S==="y"?"bottom":"right"]);i&&(h=R(u,h)),c&&(y=R(m,y));const g=l.fn({...t,[u]:h,[m]:y});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[u]:i,[m]:c}}}}}},Lr=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;const{x:r,y:s,placement:i,rects:c,middlewareData:l}=t,{offset:f=0,mainAxis:p=!0,crossAxis:d=!0}=Ze(e,t),m={x:r,y:s},u=Oe(i),h=an(u);let y=m[h],R=m[u];const g=Ze(f,t),S=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:(n=g.mainAxis)!=null?n:0,crossAxis:(o=g.crossAxis)!=null?o:0};if(p){const b=h==="y"?"height":"width",E=c.reference[h]-c.floating[b]+S.mainAxis,w=c.reference[h]+c.reference[b]-S.mainAxis;y<E?y=E:y>w&&(y=w)}if(d){var C,x;const b=h==="y"?"width":"height",E=so.has(Pe(i)),w=c.reference[u]-c.floating[b]+(E&&((C=l.offset)==null?void 0:C[u])||0)+(E?0:S.crossAxis),v=c.reference[u]+c.reference[b]+(E?0:((x=l.offset)==null?void 0:x[u])||0)-(E?S.crossAxis:0);R<w?R=w:R>v&&(R=v)}return{[h]:y,[u]:R}}}},Dr=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:r,elements:s}=t,{apply:i=()=>{},...c}=Ze(e,t),l=await r.detectOverflow(t,c),f=Pe(n),p=qe(n),d=Oe(n)==="y",{width:m,height:u}=o.floating;let h,y;f==="top"||f==="bottom"?(h=f,y=p===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(y=f,h=p==="end"?"top":"bottom");const R=u-l.top-l.bottom,g=m-l.left-l.right,S=mt(u-l[h],R),C=mt(m-l[y],g),x=t.middlewareData.shift,b=!x;let E=S,w=C;x!=null&&x.enabled.x&&(w=g),x!=null&&x.enabled.y&&(E=R),b&&!p&&(d?w=m-2*ze(l.left,l.right):E=u-2*ze(l.top,l.bottom)),await i({...t,availableWidth:w,availableHeight:E});const v=await r.getDimensions(s.floating);return m!==v.width||u!==v.height?{reset:{rects:!0}}:{}}}};function io(e){const t=Qe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Je(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,c=Ft(n)!==s||Ft(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function dn(e){return Ee(e)?e:e.contextElement}function pt(e){const t=dn(e);if(!Je(t))return je(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=io(t);let i=(s?Ft(n.width):n.width)/o,c=(s?Ft(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Fr=je(0);function co(e){const t=Ie(e);return!Un()||!t.visualViewport?Fr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vr(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ie(e)}function st(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=dn(e);let i=je(1);t&&(o?Ee(o)&&(i=pt(o)):i=pt(e));const c=Vr(s,n,o)?co(s):je(0);let l=(r.left+c.x)/i.x,f=(r.top+c.y)/i.y,p=r.width/i.x,d=r.height/i.y;if(s&&o){const m=Ie(s),u=Ee(o)?Ie(o):o;let h=m,y=yn(h);for(;y&&u!==h;){const R=pt(y),g=y.getBoundingClientRect(),S=Qe(y),C=g.left+(y.clientLeft+parseFloat(S.paddingLeft))*R.x,x=g.top+(y.clientTop+parseFloat(S.paddingTop))*R.y;l*=R.x,f*=R.y,p*=R.x,d*=R.y,l+=C,f+=x,h=Ie(y),y=yn(h)}}return wt({width:p,height:d,x:l,y:f})}function Nt(e,t){const n=_t(e).scrollLeft;return t?t.left+n:st(et(e)).left+n}function lo(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Nt(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function kr(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=et(o),c=t?rn(t.floating):!1;if(o===i||c&&s)return n;let l={scrollLeft:0,scrollTop:0},f=je(1);const p=je(0),d=Je(o);if((d||!s)&&((sn(o)!=="body"||$n(i))&&(l=_t(o)),d)){const u=st(o);f=pt(o),p.x=u.x+o.clientLeft,p.y=u.y+o.clientTop}const m=i&&!d&&!s?lo(i,l):je(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-l.scrollLeft*f.x+p.x+m.x,y:n.y*f.y-l.scrollTop*f.y+p.y+m.y}}function Hr(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function _r(e){const t=_t(e),n=e.ownerDocument.body,o=ze(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=ze(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Nt(e);const i=-t.scrollTop;return Qe(n).direction==="rtl"&&(s+=ze(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:i}}const Br=25;function Wr(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",r=Ie(e),s=et(e),i=r.visualViewport;let c=s.clientWidth,l=s.clientHeight,f=0,p=0;if(i){const m=!Un()||t==="fixed";o?m||(f=-i.offsetLeft,p=-i.offsetTop):(c=i.width,l=i.height,m&&(f=i.offsetLeft,p=i.offsetTop))}if(Nt(s)<=0){const m=s.ownerDocument,u=m.body,h=getComputedStyle(u),y=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,R=Math.abs(s.clientWidth-u.clientWidth-y),g=getComputedStyle(s).scrollbarGutter==="stable both-edges"?R/2:R;g<=Br&&(c-=g)}return{width:c,height:l,x:f,y:p}}function Nr(e,t){const n=st(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=pt(e),i=e.clientWidth*s.x,c=e.clientHeight*s.y,l=r*s.x,f=o*s.y;return{width:i,height:c,x:l,y:f}}function En(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=Wr(e,n,t);else if(t==="document")o=_r(et(e));else if(Ee(t))o=Nr(t,n);else{const r=co(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return wt(o)}function $r(e,t){const n=t.get(e);if(n)return n;let o=Qt(e,[],!1).filter(c=>Ee(c)&&sn(c)!=="body"),r=null;const s=Qe(e).position==="fixed";let i=s?Lt(e):e;for(;Ee(i)&&!Jt(i);){const c=Qe(i),l=Nn(i),f=r?r.position:s?"fixed":"";!l&&(f==="fixed"||f==="absolute"&&c.position==="static")?o=o.filter(d=>d!==i):r=c,i=Lt(i)}return t.set(e,o),o}function Ur(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?rn(t)?[]:$r(t,this._c):[].concat(n),o],c=En(t,i[0],r);let l=c.top,f=c.right,p=c.bottom,d=c.left;for(let m=1;m<i.length;m++){const u=En(t,i[m],r);l=ze(u.top,l),f=mt(u.right,f),p=mt(u.bottom,p),d=ze(u.left,d)}return{width:f-d,height:p-l,x:d,y:l}}function zr(e){const{width:t,height:n}=io(e);return{width:t,height:n}}function jr(e,t,n){const o=Je(t),r=et(t),s=n==="fixed",i=st(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=je(0);if((o||!s)&&((sn(t)!=="body"||$n(r))&&(c=_t(t)),o)){const m=st(t,!0,s,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}!o&&r&&(l.x=Nt(r));const f=r&&!o&&!s?lo(r,c):je(0),p=i.left+c.scrollLeft-l.x-f.x,d=i.top+c.scrollTop-l.y-f.y;return{x:p,y:d,width:i.width,height:i.height}}function Kt(e){return Qe(e).position==="static"}function An(e,t){if(!Je(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return et(e)===n&&(n=n.ownerDocument.body),n}function ao(e,t){const n=Ie(e);if(rn(e))return n;if(!Je(e)){let r=Lt(e);for(;r&&!Jt(r);){if(Ee(r)&&!Kt(r))return r;r=Lt(r)}return n}let o=An(e,t);for(;o&&_o(o)&&Kt(o);)o=An(o,t);return o&&Jt(o)&&Kt(o)&&!Nn(o)?n:o||Bo(e)||n}const qr=async function(e){const t=this.getOffsetParent||ao,n=this.getDimensions,o=await n(e.floating);return{reference:jr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Yr(e){return Qe(e).direction==="rtl"}const uo={convertOffsetParentRelativeRectToViewportRelativeRect:kr,getDocumentElement:et,getClippingRect:Ur,getOffsetParent:ao,getElementRects:qr,getClientRects:Hr,getDimensions:zr,getScale:pt,isElement:Ee,isRTL:Yr};function fo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kr(e,t,n){let o=null,r;const s=et(e);function i(){var p;clearTimeout(r),(p=o)==null||p.disconnect(),o=null}function c(p,d){p===void 0&&(p=!1),d===void 0&&(d=1),i();const m=e.getBoundingClientRect(),{left:u,top:h,width:y,height:R}=m;if(p||t(),!y||!R)return;const g=vt(h),S=vt(s.clientWidth-(u+y)),C=vt(s.clientHeight-(h+R)),x=vt(u),E={rootMargin:-g+"px "+-S+"px "+-C+"px "+-x+"px",threshold:ze(0,mt(1,d))||1};let w=!0;function v(D){const O=D[0].intersectionRatio;if(!fo(m,e.getBoundingClientRect()))return c();if(O!==d){if(!w)return c();O?c(!1,O):r=setTimeout(()=>{c(!1,1e-7)},1e3)}w=!1}try{o=new IntersectionObserver(v,{...E,root:s.ownerDocument})}catch{o=new IntersectionObserver(v,E)}o.observe(e)}const l=Ie(e),f=()=>c(n);return l.addEventListener("resize",f),c(!0),()=>{l.removeEventListener("resize",f),i()}}function In(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,f=dn(e),p=r||s?[...f?Qt(f):[],...t?Qt(t):[]]:[];p.forEach(g=>{r&&g.addEventListener("scroll",n),s&&g.addEventListener("resize",n)});const d=f&&c?Kr(f,n,s):null;let m=-1,u=null;i&&(u=new ResizeObserver(g=>{let[S]=g;S&&S.target===f&&u&&t&&(u.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=u)==null||C.observe(t)})),n()}),f&&!l&&u.observe(f),t&&u.observe(t));let h,y=l?st(e):null;l&&R();function R(){const g=st(e);y&&!fo(y,g)&&n(),y=g,h=requestAnimationFrame(R)}return n(),()=>{var g;p.forEach(S=>{r&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),d?.(),(g=u)==null||g.disconnect(),u=null,l&&cancelAnimationFrame(h)}}const Xr=Or,Gr=Pr,Jr=Tr,Qr=Dr,Zr=Lr,es=(e,t,n)=>{const o=new Map,r=n??{},s={...uo,...r.platform,_c:o};return Ir(e,t,{...r,platform:s})};var ts=typeof document<"u",ns=function(){},Mt=ts?a.useLayoutEffect:ns;function kt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!kt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!kt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function po(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tn(e,t){const n=po(e);return Math.round(t*n)/n}function Xt(e){const t=a.useRef(e);return Mt(()=>{t.current=e}),t}function os(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:l,open:f}=e,[p,d]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,u]=a.useState(o);kt(m,o)||u(o);const[h,y]=a.useState(null),[R,g]=a.useState(null),S=a.useCallback(I=>{I!==E.current&&(E.current=I,y(I))},[]),C=a.useCallback(I=>{I!==w.current&&(w.current=I,g(I))},[]),x=s||h,b=i||R,E=a.useRef(null),w=a.useRef(null),v=a.useRef(p),D=l!=null,O=Xt(l),V=Xt(r),$=Xt(f),M=a.useCallback(()=>{if(!E.current||!w.current)return;const I={placement:t,strategy:n,middleware:m};V.current&&(I.platform=V.current),es(E.current,w.current,I).then(H=>{const A={...H,isPositioned:$.current!==!1};F.current&&!kt(v.current,A)&&(v.current=A,Wo.flushSync(()=>{d(A)}))})},[m,t,n,V,$]);Mt(()=>{f===!1&&v.current.isPositioned&&(v.current.isPositioned=!1,d(I=>({...I,isPositioned:!1})))},[f]);const F=a.useRef(!1);Mt(()=>(F.current=!0,()=>{F.current=!1}),[]),Mt(()=>{if(x&&(E.current=x),b&&(w.current=b),x&&b){if(O.current)return O.current(x,b,M);M()}},[x,b,M,O,D]);const U=a.useMemo(()=>({reference:E,floating:w,setReference:S,setFloating:C}),[S,C]),z=a.useMemo(()=>({reference:x,floating:b}),[x,b]),W=a.useMemo(()=>{const I={position:n,left:0,top:0};if(!z.floating)return I;const H=Tn(z.floating,p.x),A=Tn(z.floating,p.y);return c?{...I,transform:"translate("+H+"px, "+A+"px)",...po(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:A}},[n,c,z.floating,p.x,p.y]);return a.useMemo(()=>({...p,update:M,refs:U,elements:z,floatingStyles:W}),[p,M,U,z,W])}const rs=(e,t)=>{const n=Xr(e);return{name:n.name,fn:n.fn,options:[e,t]}},ss=(e,t)=>{const n=Gr(e);return{name:n.name,fn:n.fn,options:[e,t]}},is=(e,t)=>({fn:Zr(e).fn,options:[e,t]}),cs=(e,t)=>{const n=Jr(e);return{name:n.name,fn:n.fn,options:[e,t]}},ls=(e,t)=>{const n=Qr(e);return{name:n.name,fn:n.fn,options:[e,t]}};function as(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=No(),s=Jn()!=null,i=gt(()=>new sr({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new ir,floatingId:r,syncOnly:!1,nested:s})).current;return X(()=>{const c={open:t,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=Ee(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function us(e){return fs(e,e.rootContext)}function fs(e,t){const{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),c=t.useState("open"),l=t.useState("floatingId"),[f,p]=a.useState(null),[d,m]=a.useState(void 0),[u,h]=a.useState(void 0),y=a.useRef(null),R=Qn(o),g=a.useMemo(()=>({reference:r,floating:s,domReference:i}),[r,s,i]),S=os({...e,elements:{...g,...f&&{reference:f}}}),C=Ee(d)?d:null,x=u===void 0?t.state.floatingElement:u;t.useSyncedValue("referenceElement",d??null),t.useSyncedValue("domReferenceElement",d===void 0?i:C),t.useSyncedValue("floatingElement",x);const b=a.useCallback(V=>{const $=Ee(V)?{getBoundingClientRect:()=>V.getBoundingClientRect(),getClientRects:()=>V.getClientRects(),contextElement:V}:V;p($),S.refs.setReference($)},[S.refs]),E=a.useCallback(V=>{(Ee(V)||V===null)&&(y.current=V,m(V)),(Ee(S.refs.reference.current)||S.refs.reference.current===null||V!==null&&!Ee(V))&&S.refs.setReference(V)},[S.refs,m]),w=a.useCallback(V=>{h(V),S.refs.setFloating(V)},[S.refs]),v=a.useMemo(()=>({...S.refs,setReference:E,setFloating:w,setPositionReference:b,domReference:y}),[S.refs,E,w,b]),D=a.useMemo(()=>({...S.elements,domReference:i}),[S.elements,i]),O=a.useMemo(()=>({...S,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:l,refs:v,elements:D,nodeId:n,rootStore:t}),[S,v,D,n,t,c,l]);return X(()=>{i&&(y.current=i)},[i]),X(()=>{t.context.dataRef.current.floatingContext=O;const V=R?.nodesRef.current.find($=>$.id===n);V&&(V.context=O)}),a.useMemo(()=>({...S,context:O,refs:v,elements:D,rootStore:t}),[S,v,D,O,t])}const ds="Escape";function Mn(e){return qn&&e.movementX===0&&e.movementY===0}function $t(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ct(e,t){return $t(t,e===Yn||e===cn,e===Bt||e===Wt)}function Gt(e,t,n){return $t(t,e===cn,n?e===Bt:e===Wt)||e==="Enter"||e===" "||e===""}function ps(e,t,n){return $t(t,n?e===Bt:e===Wt,e===cn)}function gs(e,t,n,o){const r=n?e===Wt:e===Bt,s=e===Yn;return t==="both"||t==="horizontal"&&o?e===ds:$t(t,r,s)}function ms(e,t){const{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:l=!1,nested:f=!1,rtl:p=!1,virtual:d=!1,focusItemOnOpen:m="auto",focusItemOnHover:u=!0,openOnArrowKeyDown:h=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:g,id:S,resetOnPointerLeave:C=!0,externalTree:x,grid:b}=t,E=b!=null,w="rootStore"in e?e.rootStore:e,v=w.useState("open"),D=w.useState("floatingElement"),O=w.useState("domReferenceElement"),V=w.context.dataRef,$=zn(D),M=$o(O),F=De($),U=Jn(),z=Qn(x),W=a.useRef(m),I=a.useRef(i??-1),H=a.useRef(null),A=a.useRef(!0),k=te(T=>{r(I.current===-1?null:I.current,T)}),N=a.useRef(!!D),P=a.useRef(v),B=a.useRef(!1),ne=a.useRef(!1),ie=a.useRef(null),ce=De(y),le=De(v),re=De(i),Q=De(C),fe=Pt(),K=Pt(),G=te(()=>{function T(q){d?z?.events.emit("virtualfocus",q):ie.current=cr(q,{sync:B.current,preventScroll:!0})}const L=n.current[I.current],ee=ne.current;L&&T(L),(B.current?q=>q():q=>fe.request(q))(()=>{const q=n.current[I.current]||L;if(!q)return;L||T(q),ae&&(ee||!A.current)&&q.scrollIntoView?.({block:"nearest",inline:"nearest"})})});X(()=>{V.current.orientation=R},[V,R]),X(()=>{s&&(v&&D?(I.current=i??-1,W.current&&i!=null&&(ne.current=!0,k())):N.current&&(I.current=-1,k()))},[s,v,D,i,k]),X(()=>{if(s){if(!v){B.current=!1;return}if(D)if(o==null){if(B.current=!1,re.current!=null)return;if(N.current&&(I.current=-1,G()),(!P.current||!N.current)&&W.current&&(H.current!=null||W.current===!0&&H.current==null)){let T=0;const L=()=>{n.current[0]==null?(T<2&&(T?_=>K.request(_):queueMicrotask)(L),T+=1):(I.current=H.current==null||Gt(H.current,R,p)||f?zt(n):bn(n),H.current=null,k())};L()}}else Rn(n.current,o)||(I.current=o,G(),ne.current=!1)}},[s,v,D,o,re,f,n,R,p,k,G,K]),X(()=>{if(!s||D||!z||d||!N.current)return;const T=z.nodesRef.current,L=T.find(q=>q.id===U)?.context?.elements.floating,ee=jt(rt(O??L??null)),_=T.some(q=>q.context&&Ge(q.context.elements.floating,ee));L&&!_&&A.current&&L.focus({preventScroll:!0})},[s,D,O,z,U,d]),X(()=>{P.current=v,N.current=!!D}),X(()=>{v||(H.current=null,W.current=m)},[v,m]);const de=o!=null,J=te(T=>{if(!le.current)return;const L=n.current.indexOf(T.currentTarget);L!==-1&&(I.current!==L||o!==L)&&(I.current=L,k(T))}),be=te(()=>g??z?.nodesRef.current.find(T=>T.id===U)?.context?.dataRef?.current.orientation),Se=te(()=>zt(n,ce.current)),me=te(T=>{if(A.current=!1,B.current=!0,T.which===229||!le.current&&T.currentTarget===F.current)return;if(f&&gs(T.key,R,p,E)){Ct(T.key,be())||$e(T),w.setOpen(!1,Ae(wn,T.nativeEvent)),Je(O)&&(d?z?.events.emit("virtualfocus",O):O.focus());return}const L=I.current,ee=zt(n,y),_=bn(n,y);if(M||(T.key==="Home"&&($e(T),I.current=ee,k(T)),T.key==="End"&&($e(T),I.current=_,k(T))),b!=null){const q=b(T,I.current,n,R,l,p,y,ee,_);if(q!=null&&(I.current=q,k(T)),R==="both")return}if(Ct(T.key,R)){if($e(T),v&&!d&&jt(T.currentTarget.ownerDocument)===T.currentTarget){I.current=Gt(T.key,R,p)?ee:_,k(T);return}Gt(T.key,R,p)?l?L>=_?c&&L!==n.current.length?I.current=-1:(B.current=!1,I.current=ee):I.current=St(n.current,{startingIndex:L,disabledIndices:y}):I.current=Math.min(_,St(n.current,{startingIndex:L,disabledIndices:y})):l?L<=ee?c&&L!==-1?I.current=n.current.length:(B.current=!1,I.current=_):I.current=St(n.current,{startingIndex:L,decrement:!0,disabledIndices:y}):I.current=Math.max(ee,St(n.current,{startingIndex:L,decrement:!0,disabledIndices:y})),Rn(n.current,I.current)&&(I.current=-1),k(T)}}),ae=a.useMemo(()=>({onFocus(L){B.current=!0,J(L)},onClick:({currentTarget:L})=>L.focus({preventScroll:!0}),onMouseMove(L){Mn(L)||(B.current=!0,ne.current=!1,u&&J(L))},onPointerLeave(L){if(!le.current||!A.current||L.pointerType==="touch")return;B.current=!0;const ee=L.relatedTarget;if(!(!u||n.current.includes(ee))&&Q.current&&(ie.current?.(),ie.current=null,I.current=-1,k(L),!d)){const _=F.current,q=jt(rt(_));_&&Ge(_,q)&&_.focus({preventScroll:!0})}}}),[J,le,F,u,n,k,Q,d]),xe=a.useMemo(()=>d&&v&&de&&{"aria-activedescendant":`${S}-${o}`},[d,v,de,S,o]),ge=a.useMemo(()=>({...M?{}:xe,onKeyDown(T){if(T.key==="Tab"&&T.shiftKey&&v&&!d){const L=Wn(T.nativeEvent);if(L&&!Ge(F.current,L))return;$e(T),w.setOpen(!1,Ae(jn,T.nativeEvent)),Je(O)&&O.focus();return}me(T)},onPointerMove(T){Mn(T)||(A.current=!0)}}),[xe,me,F,M,w,v,d,O]),Z=a.useMemo(()=>{function T(_){w.setOpen(!0,Ae(wn,_.nativeEvent,_.currentTarget))}function L(_){m==="auto"&&Zn(_.nativeEvent)&&(W.current=!d)}function ee(_){W.current=m,m==="auto"&&Gn(_.nativeEvent)&&(W.current=!0)}return{onKeyDown(_){const q=w.select("open");A.current=!1;const ye=_.key.startsWith("Arrow"),Ve=ps(_.key,be(),p),Te=Ct(_.key,R),ve=(f?Ve:Te)||_.key==="Enter"||_.key.trim()==="";if(d&&q)return me(_);if(!(!q&&!h&&ye)){if(ve){const ke=Ct(_.key,be());H.current=f&&ke?null:_.key}if(f){Ve&&($e(_),q?(I.current=Se(),k(_)):T(_));return}Te&&(re.current!=null&&(I.current=re.current),$e(_),!q&&h?T(_):me(_),q&&k(_))}},onFocus(_){w.select("open")&&!d&&(I.current=-1,k(_))},onPointerDown:ee,onPointerEnter:ee,onMouseDown:L,onClick:L}},[me,m,Se,f,k,w,h,R,be,p,re,d]),Fe=a.useMemo(()=>({...xe,...Z}),[xe,Z]);return a.useMemo(()=>s?{reference:Fe,floating:ge,item:ae,trigger:Z}:{},[s,Fe,ge,Z,ae])}function hs(e,t){const{listRef:n,elementsRef:o,activeIndex:r,onMatch:s,disabledIndices:i,onTyping:c,enabled:l=!0,resetMs:f=750,selectedIndex:p=null}=t,d="rootStore"in e?e.rootStore:e,m=d.useState("open"),u=bt(),h=a.useRef(""),y=a.useRef(p??r??-1),R=a.useRef(null),g=te(x=>{function b(F){return o?.current[F]}function E(F){const U=b(F);return U&&!Uo(U)||U?.matches(":disabled")?!1:i==null||!zo(Zt,F,i)}function w(F,U,z=0){if(F.length===0)return-1;const W=(z%F.length+F.length)%F.length,I=U.toLowerCase();for(let H=0;H<F.length;H+=1){const A=(W+H)%F.length;if(!(!F[A]?.toLowerCase().startsWith(I)||!E(A)))return A}return-1}const v=n.current;if(h.current.length>0&&x.key===" "&&($e(x),c?.(!0)),h.current.length>0&&h.current[0]!==" "&&w(v,h.current)===-1&&x.key!==" "&&c?.(!1),v==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;m&&x.key!==" "&&($e(x),c?.(!0));const D=h.current==="";D&&(y.current=p??r??-1),v.every((F,U)=>F&&E(U)?F[0]?.toLowerCase()!==F[1]?.toLowerCase():!0)&&h.current===x.key&&(h.current="",y.current=R.current),h.current+=x.key,u.start(f,()=>{h.current="",y.current=R.current,c?.(!1)});const $=((D?p??r??-1:y.current)??0)+1,M=w(v,h.current,$);M!==-1?(s?.(M),R.current=M):x.key!==" "&&(h.current="",c?.(!1))}),S=te(x=>{const b=x.relatedTarget,E=d.select("domReferenceElement"),w=d.select("floatingElement");Ge(E,b)||Ge(w,b)||(u.clear(),h.current="",y.current=R.current,c?.(!1))});X(()=>{!m&&p!==null||(u.clear(),R.current=null,h.current!==""&&(h.current=""))},[m,p,u]);const C=a.useMemo(()=>({onKeyDown:g,onBlur:S}),[g,S]);return a.useMemo(()=>l?{reference:C,floating:C}:{},[l,C])}const xs=a.createContext(void 0);function go(){return a.useContext(xs)?.direction??"ltr"}const ys=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:l}=t,{element:f,padding:p=0,offsetParent:d="real"}=Ze(e,t)||{};if(f==null)return{};const m=ro(p),u={x:n,y:o},h=fn(r),y=un(h),R=await i.getDimensions(f),g=h==="y",S=g?"top":"left",C=g?"bottom":"right",x=g?"clientHeight":"clientWidth",b=s.reference[y]+s.reference[h]-u[h]-s.floating[y],E=u[h]-s.reference[h],w=d==="real"?await i.getOffsetParent?.(f):c.floating;let v=c.floating[x]||s.floating[y];(!v||!await i.isElement?.(w))&&(v=c.floating[x]||s.floating[y]);const D=b/2-E/2,O=v/2-R[y]/2-1,V=Math.min(m[S],O),$=Math.min(m[C],O),M=V,F=v-R[y]-$,U=v/2-R[y]/2+D,z=oo(M,U,F),W=!l.arrow&&qe(r)!=null&&U!==z&&s.reference[y]/2-(U<M?V:$)-R[y]/2<0,I=W?U<M?U-M:U-F:0;return{[h]:u[h]+I,data:{[h]:z,centerOffset:U-z-I,...W&&{alignmentOffset:I}},reset:W}}}),Rs=(e,t)=>{const{name:n,fn:o}=ys(e);return{name:n,fn:o,options:[e,t]}},bs={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},ws={sideX:"left",sideY:"top"},Ss="--available-width",vs="--available-height",Cs="--anchor-width",Es="--anchor-height",As="--transform-origin",On=Ss,Pn=vs;function mo(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Ln(e,t,n){const{rects:o,placement:r}=e;return{side:mo(t,Pe(r),n),align:qe(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Is(e){return Ts(e,us)}function Ts(e,t){const{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,collisionBoundary:l,collisionPadding:f=5,sticky:p=!1,arrowPadding:d=5,disableAnchorTracking:m=!1,inline:u,keepMounted:h=!1,floatingRootContext:y,mounted:R,collisionAvoidance:g,shift:S,nodeId:C,adaptiveOrigin:x,lazyFlip:b=!1,externalTree:E}=e,[w,v]=a.useState(null);!R&&w!==null&&v(null);const D=g.side||"flip",O=g.align||"flip",V=g.fallbackAxisSide||"end",$=S?.crossAxis??!1,M=S?.rootBoundary,F=typeof n=="function"?n:void 0,U=te(F),z=F?U:n,W=De(n),I=De(R),A=go()==="rtl",k=w||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":A?"left":"right","inline-start":A?"right":"left"}[r],N=i==="center"?k:`${k}-${i}`;let P=f;typeof P=="number"?P={top:P,right:P,bottom:P,left:P}:P&&(P={top:P.top||0,right:P.right||0,bottom:P.bottom||0,left:P.left||0});const B=1,ne=r==="bottom"?B:0,ie=r==="top"?B:0,ce=r==="right"?B:0,le=r==="left"?B:0,re={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:P},Q=a.useRef(null),fe=De(s),K=De(c),G=typeof s!="function"?s:0,de=typeof c!="function"?c:0,J=[];u&&J.push(u),J.push(rs(j=>{const se=Ln(j,r,A),pe=typeof fe.current=="function"?fe.current(se):fe.current,he=typeof K.current=="function"?K.current(se):K.current;return{mainAxis:pe,crossAxis:he,alignmentAxis:he}},[G,de,A,r]));const be=O==="none"&&D!=="shift",Se=!be&&(p||$||D==="shift"),me=D==="none"?null:cs({...re,padding:{top:P.top+B+ne,right:P.right+B+le,bottom:P.bottom+B+ie,left:P.left+B+ce},mainAxis:!$&&D==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:V}),ae=be?null:ss({...re,rootBoundary:M,mainAxis:O!=="none",crossAxis:Se,limiter:p||$?void 0:is(j=>{if(!Q.current)return{};const{width:se,height:pe}=Q.current.getBoundingClientRect(),he=Oe(Pe(j.placement)),Le=he==="y"?se:pe,Ce=he==="y"?P.left+P.right:P.top+P.bottom;return{offset:Le/2+Ce/2}})},[re,p,$,M,P,O]);D==="shift"||O==="shift"||i==="center"?J.push(ae,me):J.push(me,ae),J.push(ls({...re,apply({elements:{floating:j},availableWidth:se,availableHeight:pe,rects:he}){if(!I.current)return;const Le=j.style;Le.setProperty(On,`${se}px`),Le.setProperty(Pn,`${pe}px`);const Ce=Ie(j).devicePixelRatio||1,{x:ut,y:Xe,width:tt,height:Be}=he.reference,Y=(Math.round((ut+tt)*Ce)-Math.round(ut*Ce))/Ce,oe=(Math.round((Xe+Be)*Ce)-Math.round(Xe*Ce))/Ce;Le.setProperty(Cs,`${Y}px`),Le.setProperty(Es,`${oe}px`)}}),Rs(j=>({element:Q.current||rt(j.elements.floating).createElement("div"),padding:Q.current?d:0,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(j){const{elements:{floating:se},middlewareData:pe,placement:he,platform:Le,rects:Ce,y:ut}=j,Xe=Pe(he),tt=qe(he),Be=Oe(Xe)==="y",Y=Q.current,oe=typeof s=="function"?s(Ln(j,r,A)):s;let Ne;if(!Y&&tt&&Math.abs(Be?pe.shift?.x||0:pe.shift?.y||0)<=1)Ne=tt==="start"===(Be&&Le.isRTL?.(se)===!0)?"100%":"0%";else{const ot=Be?pe.arrow?.x||0:pe.arrow?.y||0,xt=Be?Y?.clientWidth||0:Y?.clientHeight||0;Ne=`${ot+xt/2}px`}let nt=Xe==="top"||Xe==="left"?`calc(100% + ${oe}px)`:`${-oe}px`;return Se&&Be&&Math.abs(pe.shift?.y||0)>oe&&(nt=`${Ce.reference.y+Ce.reference.height/2-ut}px`),se.style.setProperty(As,Be?`${Ne} ${nt}`:`${nt} ${Ne}`),{}}},bs,x),X(()=>{!R&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[R,y]);const xe=a.useMemo(()=>({ancestorScroll:!m,elementResize:!m&&typeof ResizeObserver<"u",layoutShift:!m&&typeof IntersectionObserver<"u"}),[m]),{refs:ge,elements:Z,x:Fe,y:T,middlewareData:L,update:ee,placement:_,context:q,isPositioned:ye,floatingStyles:Ve}=t({rootContext:y,open:h?R:void 0,placement:N,middleware:J,strategy:o,whileElementsMounted:h?void 0:(...j)=>In(...j,xe),nodeId:C,externalTree:E}),{sideX:Te,sideY:ve}=L.adaptiveOrigin||ws,ke=ye?o:"fixed",Ye=a.useMemo(()=>{let j;return ye?x?j={position:ke,[Te]:Fe,[ve]:T}:j={...Ve,position:ke}:j={position:ke,top:0,left:0},j[On]="100vw",j[Pn]="100vh",ye||(j.opacity=0),j},[x,ke,Te,Fe,ve,T,Ve,ye]),He=a.useRef(null);X(()=>{if(!R)return;const j=W.current,se=typeof j=="function"?j():j,he=(Dn(se)?se.current:se)||null||null;he!==He.current&&(ge.setPositionReference(he),He.current=he)},[R,ge,z,W]),a.useEffect(()=>{if(!R)return;const j=W.current;typeof j!="function"&&Dn(j)&&j.current!==He.current&&(ge.setPositionReference(j.current),He.current=j.current)},[R,ge,z,W]),a.useEffect(()=>{if(h&&R&&Z.reference&&Z.floating)return In(Z.reference,Z.floating,ee,xe)},[h,R,Z,ee,xe]);const Me=Pe(_),We=mo(r,Me,A),Ke=qe(_)||"center",at=!!L.hide?.referenceHidden;X(()=>{b&&R&&ye&&Me!==k&&v(Me)},[b,R,ye,Me,k]);const _e=a.useMemo(()=>({position:"absolute",top:L.arrow?.y,left:L.arrow?.x}),[L.arrow]),we=L.arrow?.centerOffset!==0;return a.useMemo(()=>({positionerStyles:Ye,arrowStyles:_e,arrowRef:Q,arrowUncentered:we,side:We,align:Ke,physicalSide:Me,anchorHidden:at,refs:ge,context:q,isPositioned:ye,update:ee}),[Ye,_e,Q,we,We,Ke,Me,at,ge,q,ye,ee])}function Dn(e){return e!=null&&"current"in e}function ho(e){return e==="starting"?jo:dt}function Ms(e,t,{styles:n,transitionStatus:o,props:r,refs:s,hidden:i,inert:c=!1}){const l={...n};return c&&(l.pointerEvents="none"),ct("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:l},ho(o),r],stateAttributesMapping:eo})}function Os(e){const t=a.useRef(""),n=a.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:a.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function xo(e,t){const n=a.useRef(e),o=te(t);X(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}function Ps(e,t){const n=te((s,i)=>{(typeof e=="function"?e():e)||t(i||(qo?"touch":""))}),{onClick:o,onPointerDown:r}=Os(n);return a.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function Ls(e){const[t,n]=a.useState(null),o=Ps(e,n);return xo(e,r=>{r&&!e&&n(null)}),a.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const Ds=20;function Fs(e,t,n,o){const[r,s]=a.useState(!1);X(()=>{if(!e||!t||n==null){s(!1);return}const i=rt(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-Ds)},[e,t,n]),lr(e&&(!t||r),o)}const Vs=a.createContext(void 0);function ks(e){return a.useContext(Vs)}function Hs(e){const[t,n]=a.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function _s(e){const t=a.useRef(!0);t.current&&(t.current=!1,e())}function Bs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Fn({controlled:e,default:t,name:n,state:o="value"}){const{current:r}=a.useRef(e!==void 0),[s,i]=a.useState(t),c=r&&e!==void 0?e:s,l=a.useCallback(f=>{r||i(f)},[]);return[c,l]}const yo=a.createContext(void 0),Ro=a.createContext(void 0),bo=a.createContext(void 0);function lt(){const e=a.useContext(yo);if(e===void 0)throw new Error(ht(60));return e}function pn(){const e=a.useContext(Ro);if(e===void 0)throw new Error(ht(101));return e}function wo(){const e=a.useContext(bo);if(e===void 0)throw new Error(ht(61));return e}const Ws="data-valid",Ns="data-invalid",$s={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Us={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},zs={disabled:!1,...Us},js={valid(e){return e===null?null:e?{[Ws]:""}:{[Ns]:""}}},qs={invalid:void 0,name:void 0,validityData:{state:$s,errors:[],error:"",value:"",initialValue:null},setValidityData:ue,disabled:void 0,setTouched:ue,setDirty:ue,setFilled:ue,setFocused:ue,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:zs,registerFieldControl:ue,validation:{getValidationProps:(e,t=dt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:ue,getInputControl:()=>null,commit:async()=>{},change:ue}},Ys=a.createContext(qs);function gn(e=!0){const t=a.useContext(Ys);if(t.setValidityData===ue&&!e)throw new Error(ht(28));return t}function Ks(e,t,n,o,r=!0,s){const{registerFieldControl:i}=gn(),c=gt(()=>Symbol());X(()=>{const l=c.current;if(!r){i(l,void 0);return}i(l,{controlRef:e,getValue:o,id:t,name:s,value:n})},[e,r,o,t,s,i,c,n]),X(()=>{const l=c.current;return()=>{i(l,void 0)}},[i,c])}const Xs=a.createContext({controlId:void 0,registerControlId:ue,resetControlId:ue,labelId:void 0,setLabelId:ue,messageIds:[],setMessageIds:ue,getDescriptionProps:e=>e});function So(){return a.useContext(Xs)}function vo(e={}){const{id:t,enabled:n=!0}=e,{controlId:o,registerControlId:r,resetControlId:s}=So(),i=ar(),c=gt(()=>Symbol()),l=a.useRef(!1),f=a.useRef(!1),p=te(()=>{!l.current||r===ue||(l.current=!1,r(c.current,void 0))});return X(()=>{if(!n||r===ue){p();return}let d;if(t!==void 0)f.current=!0,d=t;else if(f.current)d=i;else{s();return}if(d===void 0){p();return}l.current=!0,r(c.current,d)},[t,n,r,s,i,c,p]),X(()=>p,[p]),(n?o:void 0)??t??i}function Gs(e,t,n=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let r=0;r<o;r+=1)if(!n(e[r],t[r]))return!1;return!0}const Co=(e,t)=>Object.is(e,t);function it(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Js(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Gs(e,t,(o,r)=>it(o,r,n)):e!==t}function nn(e,t,n){return e?e.some(o=>o===void 0?!1:it(t,o,n)):!1}function Ot(e,t,n){return e?e.findIndex(o=>o===void 0?!1:it(o,t,n)):-1}function Qs(e,t){if(t!==Co)return o=>nn(e,o,t);const n=new Set(e);return n.delete(void 0),o=>n.has(o)&&(o!==0||e.some(r=>Object.is(o,r)))}function Eo(e,t,n,o){const r=o&&Array.isArray(t)?e.findIndex(Qs(t,n)):Ot(e,t,n);return r===-1?null:r}function Zs(e,t,n,o,r,s){return nn(o,t,r)?s!=null&&e>s&&nn(o,n[s],r)?s:e:e===s?Eo(n,o,r,!0):s}function ei(e,t,n){return e.filter(o=>!it(t,o,n))}function on(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function ti(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function Ao(e){return ti(e?.[0])}function ni(e){return Ao(e)?e.flatMap(t=>t.items):e}function oi(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Ao(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Io(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 on(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?on(e.value):on(e)}function To(e,t,n){function o(){return Io(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const s=ni(t);if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function ri(e,t,n){return e.reduce((o,r,s)=>(s>0&&o.push(", "),o.push(Re.jsx(a.Fragment,{children:To(r,t,n)},s)),o),[])}const si={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,o)!==""},hasNullItemLabel:(e,t)=>t?oi(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(r=>it(t,r,n)):it(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},ii=a.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:ue,validationMode:"onSubmit",submitCountRef:{current:0}});function ci(){return a.useContext(ii)}const Ue=1;function Mo(e,t){return Math.max(0,e-t)}function li(e,t){if(t<=0)return 0;const n=yt(e,0,t),o=n,r=t-n,s=o<=Ue,i=r<=Ue;return s&&i?o<=r?0:t:s?0:i?t:n}function ki(e){const{id:t,value:n,defaultValue:o=null,onValueChange:r,open:s,defaultOpen:i=!1,onOpenChange:c,name:l,form:f,autoComplete:p,disabled:d=!1,readOnly:m=!1,required:u=!1,modal:h=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:g,items:S,multiple:C=!1,itemToStringLabel:x,itemToStringValue:b,isItemEqualToValue:E=Co,highlightItemOnHover:w=!0,children:v}=e,{clearErrors:D}=ci(),{setDirty:O,setTouched:V,setFocused:$,validityData:M,setFilled:F,name:U,disabled:z,validation:W,validationMode:I}=gn(),H=vo({id:t}),A=z||d,k=U??l,[N,P]=Fn({controlled:n,default:C?o??Zt:o,name:"Select",state:"value"}),[B,ne]=Fn({controlled:s,default:i,name:"Select",state:"open"}),ie=a.useRef([]),ce=a.useRef([]),le=a.useRef(null),re=a.useRef(null),Q=a.useRef(0),fe=a.useRef(null),K=a.useRef([]),G=a.useRef(!1),de=a.useRef(null),J=a.useRef(null),be=a.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Se=a.useRef(!1),me=a.useRef(N),{mounted:ae,setMounted:xe,transitionStatus:ge}=to(B),{openMethod:Z,triggerProps:Fe}=Ls(B),T=gt(()=>new Go({id:H,labelId:void 0,modal:h,multiple:C,itemToStringLabel:x,itemToStringValue:b,isItemEqualToValue:E,value:N,open:B,mounted:ae,transitionStatus:ge,items:S,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:dt,triggerProps:dt,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ue,setOpen:ue,handleScrollArrowVisibility:ue,onOpenChangeComplete:ue,listRef:ie,popupRef:le,scrollHandlerRef:re,scrollArrowsMountedCountRef:Q,valueRef:fe,valuesRef:K,labelsRef:ce,typingRef:G,selectionRef:be,firstItemTextRef:de,selectedItemTextRef:J,alignItemWithTriggerActiveRef:Se,initialValueRef:me},si)).current,L=T.useState("activeIndex"),ee=T.useState("selectedIndex"),_=T.useState("triggerElement"),q=T.useState("positionerElement"),ye=Hs(Z),Ve=Z??ye,Te=a.useMemo(()=>C?"":ft(N,b),[C,N,b]),ve=a.useMemo(()=>C&&Array.isArray(N)?N.map(Y=>ft(Y,b)):ft(N,b),[C,N,b]),ke=De(_),Ye=te(()=>ve);Ks(ke,H,N,Ye,!A,l);const He=C?Array.isArray(N)&&N.length>0:N!=null&&Te!=="";X(()=>{F(He)},[He,F]),X(function(){const oe=Eo(K.current,N,E,C);oe===null&&(J.current=null),!B&&T.set("selectedIndex",oe)},[C,B,N,E,T]),xo(N,()=>{D(k),O(Js(N,M.initialValue,E)),W.change(N)});const Me=te((Y,oe)=>{c?.(Y,oe),!oe.isCanceled&&(ne(Y),!Y&&(oe.reason===jn||oe.reason===Jo)&&(V(!0),$(!1),I==="onBlur"&&W.commit(N)))}),We=te(()=>{xe(!1),T.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),g?.(!1)});ln({enabled:!y,open:B,ref:le,onComplete(){B||We()}}),a.useImperativeHandle(y,()=>({unmount:We}),[We]);const Ke=te((Y,oe)=>{r?.(Y,oe),!oe.isCanceled&&P(Y)}),at=te(Y=>{const oe=Mo(Y.scrollHeight,Y.clientHeight),Ne=li(Y.scrollTop,oe),nt=Ne>0,ot=Ne<oe;T.set("scrollUpArrowVisible",nt),T.set("scrollDownArrowVisible",ot)}),_e=as({open:B,onOpenChange:Me,elements:{reference:_,floating:q}}),we=Cr(_e,{enabled:!A,event:"mousedown"}),j=ur(_e),se=ms(_e,{enabled:!A,listRef:ie,activeIndex:L,selectedIndex:ee,disabledIndices:Zt,onNavigate(Y){Y===null&&!B||T.set("activeIndex",Y)},focusItemOnHover:w}),pe=hs(_e,{enabled:!A&&(B||!m&&!C),listRef:ce,activeIndex:L,selectedIndex:ee,disabledIndices:Y=>Bs(ie.current[Y]),onMatch(Y){B?T.set("activeIndex",Y):Ke(K.current[Y],Ae(Dt))},onTyping(Y){G.current=Y}}),he=a.useMemo(()=>en(pe.reference,se.reference,j.reference,we.reference,Fe),[we.reference,pe.reference,se.reference,j.reference,Fe]),Le=a.useMemo(()=>en(fr,pe.floating,se.floating,j.floating),[pe.floating,se.floating,j.floating]),Ce=se.item??dt;T.useContextCallback("setValue",Ke),T.useContextCallback("setOpen",Me),T.useContextCallback("handleScrollArrowVisibility",at),T.useContextCallback("onOpenChangeComplete",g),_s(()=>{T.update({popupProps:Le,triggerProps:he})}),T.useSyncedValues({id:H,modal:h,multiple:C,value:N,open:B,mounted:ae,transitionStatus:ge,popupProps:Le,triggerProps:he,items:S,itemToStringLabel:x,itemToStringValue:b,isItemEqualToValue:E,openMethod:Ve});const ut=a.useMemo(()=>({disabled:A,readOnly:m,required:u,multiple:C,highlightItemOnHover:w,itemProps:Ce}),[A,m,u,C,w,Ce]),Xe=Yo(R,W.inputRef),tt=C?void 0:k,Be=a.useMemo(()=>!C||!Array.isArray(N)||!k?null:N.map(Y=>{const oe=ft(Y,b);return Re.jsx("input",{type:"hidden",form:f,name:k,value:oe,disabled:A},oe)}),[C,N,f,k,b,A]);return Re.jsxs(yo.Provider,{value:T,children:[Re.jsx(Ro.Provider,{value:ut,children:Re.jsx(bo.Provider,{value:_e,children:v})}),Re.jsx("input",{...W.getValidationProps(A,{onFocus(){T.state.triggerElement?.focus({focusVisible:!0})},onChange(Y){if(Y.nativeEvent.defaultPrevented||A||m)return;const oe=Y.currentTarget.value,Ne=Ae(Dt,Y.nativeEvent);function nt(){if(C)return;const ot=oe.toLowerCase();let xt=K.current.findIndex(Ut=>ft(Ut,b).toLowerCase()===ot||Io(Ut,x).toLowerCase()===ot);xt===-1&&(xt=K.current.findIndex((Ut,Fo)=>{const xn=ce.current[Fo];return xn!=null&&xn.toLowerCase()===ot}));const hn=K.current[xt];hn!=null&&Ke(hn,Ne)}T.set("forceMount",!0),queueMicrotask(nt)}}),id:H&&tt==null?`${H}-hidden-input`:void 0,form:f,name:tt,autoComplete:p,value:Te,disabled:A,required:u&&!(C&&He),readOnly:m,ref:Xe,style:k?Ko:Xo,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})}function ai(e,t){return e??t}const Et=5;function ui(e,t){const n=fi(t);return e.clientX>=n.left-Et&&e.clientX<=n.right+Et&&e.clientY>=n.top-Et&&e.clientY<=n.bottom+Et}function fi(e){const t=e.getBoundingClientRect(),n=Ie(e);if(Qo)return t;const o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;const i=parseFloat(o.width)||0,c=parseFloat(o.height)||0,l=parseFloat(r.width)||0,f=parseFloat(r.height)||0,p=Math.max(t.width,i,l),d=Math.max(t.height,c,f),m=p-t.width,u=d-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-u/2,bottom:t.bottom+u/2}}const di="data-popup-side",pi=400,gi={...dr,...js,popupSide:e=>e?{[di]:e}:null,value:()=>null},Hi=a.forwardRef(function(t,n){const{render:o,className:r,id:s,disabled:i=!1,nativeButton:c=!0,style:l,...f}=t,{setTouched:p,setFocused:d,validationMode:m,validation:u,state:h,disabled:y}=gn(),{labelId:R}=So(),g=lt(),{readOnly:S,required:C,disabled:x}=pn(),b=y||x||i,E=g.useState("open"),w=g.useState("mounted"),v=g.useState("value"),D=g.useState("triggerProps"),O=g.useState("positionerElement"),V=g.useState("listElement"),$=g.useState("popupSide"),M=g.useState("id"),F=g.useState("labelId"),U=g.useState("hasSelectedValue"),z=w&&O?$:null,W=s??M,I=ai(R,F);vo({id:s});const H=De(O),A=a.useRef(null),{getButtonProps:k,buttonRef:N}=Kn({disabled:b,native:c}),P=g.useStateSetter("triggerElement"),B=bt(),ne=bt(),ie=bt();a.useEffect(()=>{if(E)return ie.start(pi,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ie.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ne.clear()},[E,g,ne,ie]);const ce=en(D,{id:W,role:"combobox","aria-expanded":E,"aria-haspopup":"listbox","aria-controls":E?V?.id??zn(O)?.id:void 0,"aria-labelledby":I,"aria-readonly":S||void 0,"aria-required":C||void 0,tabIndex:b?-1:0,onFocus(Q){d(!0),E&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,Ae(Dt,Q.nativeEvent)),B.start(0,()=>{g.set("forceMount",!0)})},onBlur(Q){Ge(O,Q.relatedTarget)||(p(!0),d(!1),m==="onBlur"&&u.commit(v))},onMouseDown(Q){if(E)return;const fe=rt(Q.currentTarget);function K(G){if(!A.current)return;const de=G.target;Ge(A.current,de)||Ge(H.current,de)||ui(G,A.current)||g.context.setOpen(!1,Ae(Zo,G))}ne.start(0,()=>{fe.addEventListener("mouseup",K,{once:!0})})}},f,k),le=u.getValidationProps(b,ce);le.role="combobox";const re={...h,open:E,disabled:b,value:v,readOnly:S,popupSide:z,placeholder:!U};return ct("button",t,{ref:[n,A,N,P],state:re,stateAttributesMapping:gi,props:le})}),mi={value:()=>null},_i=a.forwardRef(function(t,n){const{className:o,render:r,children:s,placeholder:i,style:c,...l}=t,f=lt(),p=f.useState("value"),d=f.useState("items"),m=f.useState("itemToStringLabel"),u=f.useState("hasSelectedValue"),h=!u&&i!=null&&s==null,y=f.useState("hasNullItemLabel",h),R={value:p,placeholder:!u};let g=null;return typeof s=="function"?g=s(p):s!=null?g=s:h&&!y?g=i:Array.isArray(p)?g=ri(p,d,m):g=To(p,d,m),ct("span",t,{state:R,ref:[n,f.context.valueRef],props:[{children:g},l],stateAttributesMapping:mi})}),Bi=a.forwardRef(function(t,n){const o=lt(),r=o.useState("mounted"),s=o.useState("forceMount");return r||s?Re.jsx(er,{ref:n,...t}):null}),Oo=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function hi(){return a.useContext(Oo)}function xi(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=te(r),[,i]=a.useState(!1),c=gt(Ri).current,l=gt(yi).current,f=a.useRef(0),p=a.useRef(!0),d=a.useRef(null),m=a.useRef(null),u=te(()=>{p.current||(p.current=!0,i(b=>!b))}),h=te((b,E)=>{l.set(b,E),u()}),y=te(b=>{l.delete(b),u()}),R=te(b=>{const E=new Map;return n.current.length=0,o&&(o.current.length=0),b.forEach(w=>{E.set(w.element,{...w.registration.metadata??{},index:w.index}),n.current[w.index]=w.element,o&&(o.current[w.index]=w.registration.label!==void 0?w.registration.label:w.registration.textRef?.current?.textContent??w.element.textContent)}),f.current=n.current.length,E});function g(b){if(m.current?.disconnect(),m.current=null,typeof MutationObserver!="function"||b.length<2)return;const E=new MutationObserver(v=>{if(!Si(v))return;let D=null;for(const O of b)if(O.isConnected){if(D&&Po(D,O)>0){E.disconnect(),u();return}D=O}});m.current=E;const w=new Set;for(let v=1;v<b.length;v+=1){const D=wi(b[v-1],b[v]);D&&w.add(D)}w.forEach(v=>E.observe(v,{childList:!0}))}const S=te(()=>{const[b,E]=bi(l),w=R(b),v=d.current,D=!v||v.length!==b.length||b.some((O,V)=>{const $=v[V];return O.index!==$.index||O.element!==$.element||O.registration.index!==$.registration.index||O.registration.metadata!==$.registration.metadata});g(E),d.current=b,p.current=!1,D&&(c.forEach(O=>O(w)),s(w))});X(()=>(!p.current&&d.current&&R(d.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,R]),X(()=>{p.current&&S()}),X(()=>()=>{m.current?.disconnect(),p.current=!0},[]);const C=te(b=>(c.add(b),()=>{c.delete(b)})),x=a.useMemo(()=>({register:h,unregister:y,subscribeMapChange:C,nextIndexRef:f}),[h,y,C,f]);return Re.jsx(Oo.Provider,{value:x,children:t})}function yi(){return new Map}function Ri(){return new Set}function bi(e){const t=new Set,n=[],o=[];e.forEach((s,i)=>{if(!i.isConnected)return;const c=s.index,l={index:c??-1,element:i,registration:s};c===null?o.push(l):c>=0&&(t.add(c),n.push(l))});let r=0;return o.sort((s,i)=>Po(s.element,i.element)),o.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,o.map(s=>s.element)]}function wi(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Si(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function Po(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Lo=a.createContext(void 0);function vi(){const e=a.useContext(Lo);if(!e)throw new Error(ht(59));return e}function Ht(e,t){e&&Object.assign(e.style,t)}const Ci={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ei={position:"fixed"},Wi=a.forwardRef(function(t,n){const{anchor:o,className:r,render:s,positionMethod:i,side:c,align:l,sideOffset:f,alignOffset:p,collisionBoundary:d="clipping-ancestors",collisionPadding:m,arrowPadding:u,sticky:h,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:g=tr,style:S,...C}=t,x=lt(),b=wo(),E=x.useState("open"),w=x.useState("mounted"),v=x.useState("modal"),D=x.useState("value"),O=x.useState("openMethod"),V=x.useState("positionerElement"),$=x.useState("triggerElement"),M=x.useState("isItemEqualToValue"),F=x.useState("transitionStatus"),U=a.useRef(null),z=a.useRef(null),[W,I]=a.useState(R),H=w&&W&&O!=="touch";!w&&W!==R&&I(R),a.useImperativeHandle(x.context.alignItemWithTriggerActiveRef,()=>H),Fs((H||v)&&E,O==="touch",V,$);const A=Is({anchor:o,floatingRootContext:b,positionMethod:i,mounted:w,side:c,sideOffset:f,align:l,alignOffset:p,arrowPadding:u,collisionBoundary:d,collisionPadding:m,sticky:h,disableAnchorTracking:y??H,collisionAvoidance:g,keepMounted:!0}),k=H?"none":A.side,N=H?Ei:A.positionerStyles,P={open:E,side:k,align:A.align,anchorHidden:A.anchorHidden};X(()=>{x.set("popupSide",A.side)},[x,A.side]);const B=x.useStateSetter("positionerElement"),ne=Ms(t,P,{styles:N,transitionStatus:F,props:C,refs:[n,B],hidden:!w,inert:!E}),ie=a.useRef(0),ce=te(re=>{if(x.context.valuesRef.current.length===0)return;const Q=ie.current;ie.current=re.size;const fe=Ae(Dt);if(Q!==0&&!x.state.multiple&&D!==null&&Ot(x.context.valuesRef.current,D,M)===-1){const G=x.context.initialValueRef.current,J=G!=null&&Ot(x.context.valuesRef.current,G,M)!==-1?G:null;x.context.setValue(J,fe),J===null&&(x.set("selectedIndex",null),x.context.selectedItemTextRef.current=null)}if(Q!==0&&x.state.multiple&&Array.isArray(D)){const K=D.filter(G=>Ot(x.context.valuesRef.current,G,M)!==-1);K.length!==D.length&&(x.context.setValue(K,fe),K.length===0&&(x.set("selectedIndex",null),x.context.selectedItemTextRef.current=null))}if(E&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const K={height:""};Ht(V,K),Ht(x.context.popupRef.current,K)}}),le=a.useMemo(()=>({...A,side:k,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:I,scrollUpArrowRef:U,scrollDownArrowRef:z}),[A,k,H,I]);return Re.jsx(xi,{elementsRef:x.context.listRef,labelsRef:x.context.labelsRef,onMapChange:ce,children:Re.jsxs(Lo.Provider,{value:le,children:[w&&v&&Re.jsx(pr,{inert:nr(!E),cutout:$}),ne]})})}),At="base-ui-disable-scrollbar",Vn={className:At,getElement(e){return Re.jsx("style",{nonce:e,href:At,precedence:"base-ui:low",children:`.${At}{scrollbar-width:none}.${At}::-webkit-scrollbar{display:none}`})}},Ai=a.createContext(void 0),Ii={disableStyleElements:!1};function Ti(){return a.useContext(Ai)??Ii}const kn="--transform-origin",Mi={...eo,...Xn},Ni=a.forwardRef(function(t,n){const{render:o,className:r,style:s,finalFocus:i,...c}=t,l=lt(),{multiple:f,readOnly:p,highlightItemOnHover:d}=pn(),m=wo(),{side:u,align:h,alignItemWithTriggerActive:y,isPositioned:R,setControlledAlignItemWithTrigger:g}=vi(),S=ks()!=null,C=go(),{nonce:x,disableStyleElements:b}=Ti(),E=l.useState("id"),w=l.useState("open"),v=l.useState("openMethod"),D=l.useState("mounted"),O=l.useState("popupProps"),V=l.useState("transitionStatus"),$=l.useState("triggerElement"),M=l.useState("positionerElement"),F=l.useState("listElement"),U=a.useRef(!1),z=a.useRef(!1),W=a.useRef({}),I=Pt(),H=te(P=>{if(!M||!l.context.popupRef.current||!z.current)return;const B=M.style.top==="0px",ne=M.style.bottom==="0px";if(U.current||!y||!B&&!ne){l.context.handleScrollArrowVisibility(P);return}const ie=_n(M),ce=Rt(M.getBoundingClientRect().height,"y",ie),le=rt(M),re=Ie(M),Q=re.getComputedStyle(M),fe=parseFloat(Q.marginTop),K=parseFloat(Q.marginBottom),G=Hn(re.getComputedStyle(l.context.popupRef.current)),de=Math.min(le.documentElement.clientHeight-fe-K,G),J=P.scrollTop,be=It(P);let Se=null;const me=Z=>{M.style.height=`${Z}px`},ae=B?be-J:J,xe=Math.min(ce+ae,de);if(ae<=Ue){const Z=yt(ae,0,de-ce);Z>0&&me(ce+Z),P.scrollTop=B?be:0,de-(ce+Z)<=Ue&&(U.current=!0),l.context.handleScrollArrowVisibility(P);return}if(de-xe>Ue)Se=B?1/0:0;else if(ne&&J<be){const Z=ce+ae-de;Se=J-(ae-Z)}const ge=Math.ceil(xe);if(ge!==0&&me(ge),Se!=null){const Z=yt(Se,0,It(P));Math.abs(P.scrollTop-Z)>Ue&&(P.scrollTop=Z)}ge>=de-Ue&&(U.current=!0),l.context.handleScrollArrowVisibility(P)});a.useImperativeHandle(l.context.scrollHandlerRef,()=>H,[H]),ln({open:w,ref:l.context.popupRef,onComplete(){w&&l.context.onOpenChangeComplete(!0)}});const A={open:w,transitionStatus:V,side:u,align:h};X(()=>{!M||!l.context.popupRef.current||Object.keys(W.current).length||(W.current={top:M.style.top||"0",left:M.style.left||"0",right:M.style.right,height:M.style.height,bottom:M.style.bottom,minHeight:M.style.minHeight,maxHeight:M.style.maxHeight,marginTop:M.style.marginTop,marginBottom:M.style.marginBottom})},[l,M]),X(()=>{w||y||(z.current=!1,U.current=!1,Ht(M,W.current))},[w,y,M]),X(()=>{const P=l.context.popupRef.current;if(!w||!$||!M||!P||y&&!R||l.state.transitionStatus==="ending")return;if(z.current=!0,P.style.removeProperty(kn),!y){I.request(()=>l.context.handleScrollArrowVisibility(F||P));return}const B=Oi(P);try{let ne=l.context.selectedItemTextRef.current;ne?.isConnected||(ne=!l.select("hasSelectedValue")&&l.context.firstItemTextRef.current?.isConnected?l.context.firstItemTextRef.current:null);const ie=l.context.valueRef.current,ce=Ie(M),le=ce.getComputedStyle(M),re=ce.getComputedStyle(P),Q=rt($),fe=_n($),K=Tt($.getBoundingClientRect(),fe),G=Tt(M.getBoundingClientRect(),fe),de=K.height,J=F||P,be=J.scrollHeight,Se=parseFloat(re.borderBottomWidth),me=parseFloat(le.marginTop)||10,ae=parseFloat(le.marginBottom)||10,xe=parseFloat(le.minHeight)||100,ge=Hn(re),Z=5,Fe=5,T=20,L=Q.documentElement.clientHeight-me-ae,ee=Q.documentElement.clientWidth,_=L-K.bottom+de;let q,ye=C==="rtl"?K.right-G.width:K.left,Ve=0;if(ne&&ie){const we=Tt(ie.getBoundingClientRect(),fe);q=Tt(ne.getBoundingClientRect(),fe),ye=G.left+(C==="rtl"?we.right-q.right:we.left-q.left);const j=we.top-K.top+we.height/2;Ve=q.top-G.top+q.height/2-j}const Te=_+Ve+ae+Se;let ve=Math.min(L,Te);const ke=L-me-ae,Ye=Te-ve,He=ee-Fe;M.style.left=`${yt(ye,Z,He-G.width)}px`,M.style.height=`${ve}px`,M.style.maxHeight="none",M.style.marginTop=`${me}px`,M.style.marginBottom=`${ae}px`,P.style.height="100%";const Me=It(J),We=Ye>=Me-Ue;We&&(ve=Math.min(L,G.height)-(Ye-Me));const Ke=K.top<T||K.bottom>L-T||Math.ceil(ve)+Ue<Math.min(be,xe),at=(ce.visualViewport?.scale??1)!==1&&qn;if(Ke||at){Ht(M,W.current),g(!1);return}const _e=Math.max(xe,ve);if(We){const we=Math.max(0,L-Te);M.style.top=G.height>=ke?"0":`${we}px`,M.style.height=`${ve}px`,J.scrollTop=It(J)}else M.style.bottom="0",J.scrollTop=Ye;if(q){const we=G.top,j=G.height,se=q.top+q.height/2,pe=yt(j>0?(se-we)/j*100:50,0,100);P.style.setProperty(kn,`50% ${pe}%`)}(_e===L||ve>=ge)&&(U.current=!0),l.context.handleScrollArrowVisibility(J),d&&l.state.selectedIndex===null&&l.state.activeIndex===null&&l.context.listRef.current[0]!=null&&l.set("activeIndex",0)}finally{B()}},[l,w,M,$,y,g,I,F,d,C,R]),a.useEffect(()=>{if(!y||!M||!w)return;const P=Ie(M);function B(ne){l.context.setOpen(!1,Ae(rr,ne))}return or(P,"resize",B)},[l,y,M,w]);const k={...F?{role:"presentation"}:{role:"listbox","aria-multiselectable":f||void 0,"aria-readonly":p||void 0,id:`${E}-list`},onKeyDown(P){S&&mr.has(P.key)&&P.stopPropagation()},onScroll(P){F||H(P.currentTarget)},...y&&{style:F?{height:"100%"}:Ci},className:!F&&y?Vn.className:void 0},N=ct("div",t,{ref:[n,l.context.popupRef],state:A,stateAttributesMapping:Mi,props:[O,k,ho(V),c]});return Re.jsxs(a.Fragment,{children:[!b&&Vn.getElement(x),Re.jsx(gr,{context:m,modal:!1,disabled:!D,openInteractionType:v,returnFocus:i,restoreFocus:!0,children:N})]})});function Hn(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function It(e){return Mo(e.scrollHeight,e.clientHeight)}function _n(e){return uo.getScale(e)}function Rt(e,t,n){return e/n[t]}function Tt(e,t){return wt({x:Rt(e.x,"x",t),y:Rt(e.y,"y",t),width:Rt(e.width,"x",t),height:Rt(e.height,"y",t)})}const Bn=[["transform","none"],["scale","1"],["translate","0 0"]];function Oi(e){const{style:t}=e,n={};for(const[o,r]of Bn)n[o]=t.getPropertyValue(o),t.setProperty(o,r,"important");return()=>{for(const[o]of Bn){const r=n[o];r?t.setProperty(o,r):t.removeProperty(o)}}}function Pi(e={}){const{guess:t,label:n,metadata:o,textRef:r,index:s}=e,{register:i,unregister:c,subscribeMapChange:l,nextIndexRef:f}=hi(),p=a.useRef(-1),[d,m]=a.useState(s==null&&t?()=>{if(p.current===-1){const R=f.current;f.current+=1,p.current=R}return p.current}:-1),u=s??d,h=a.useRef(null),y=a.useCallback(R=>{const g=h.current;g&&c(g),h.current=R,R&&i(R,{metadata:o??null,index:s??null,label:n,textRef:r})},[s,i,c,o,n,r]);return X(()=>{if(s==null)return l(R=>{const g=h.current?R.get(h.current)?.index:null;g!=null&&m(g)})},[s,l]),{ref:y,index:u}}const Do=a.createContext(void 0);function mn(){const e=a.useContext(Do);if(!e)throw new Error(ht(57));return e}const $i=a.memo(a.forwardRef(function(t,n){const{render:o,className:r,style:s,value:i=null,label:c,disabled:l=!1,nativeButton:f=!1,...p}=t,d=a.useRef(null),m=Pi({guess:!0,label:c,textRef:d}),u=lt(),{itemProps:h,multiple:y,disabled:R,readOnly:g}=pn(),S=R||l,C=u.useState("isActive",m.index),x=u.useState("open"),b=u.useState("isSelected",i),E=u.useState("isSelectedByFocus",m.index),w=u.useState("isItemEqualToValue"),v=m.index,D=a.useRef(null);X(()=>{const A=u.context.valuesRef.current;return A[v]=i,()=>{delete A[v]}},[v,i,u]),X(()=>{const A=u.state.value,k=u.state.selectedIndex;let N=k,P;y&&Array.isArray(A)?(N=Zs(v,i,u.context.valuesRef.current,A,w,k),P=N===v,v===k&&!P&&(u.context.selectedItemTextRef.current=null)):(P=A!==void 0&&it(i,A,w),P&&(N=v)),u.set("selectedIndex",N),P&&d.current&&(u.context.selectedItemTextRef.current=d.current)},[v,y,w,u,i]);const O=a.useRef("mouse"),V=a.useRef(!1),{getButtonProps:$,buttonRef:M}=Kn({disabled:S,focusableWhenDisabled:!0,native:f,composite:!0}),F={disabled:S,selected:b,highlighted:C};function U(A){if(R||g)return;const k=u.state.value;if(y){const N=Array.isArray(k)?k:[],P=b?ei(N,i,w):[...N,i];u.context.setValue(P,Ae(qt,A))}else u.context.setValue(i,Ae(qt,A)),u.context.setOpen(!1,Ae(qt,A))}function z(){u.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":b,tabIndex:x&&C?0:-1,onKeyDown(A){u.set("activeIndex",v),A.key===" "&&u.context.typingRef.current&&A.preventDefault()},onClick(A){const k=O.current!=="touch",N=A.nativeEvent.pointerType,P=k&&Zn(A.nativeEvent)&&(N!==void 0||C),B=k&&!P&&!V.current;V.current=!1,!(S||B)&&U(A.nativeEvent)},onPointerEnter(A){O.current=A.pointerType},onPointerMove(A){if(A.pointerType==="mouse"&&A.buttons===1){const k=u.context.selectionRef.current;k.dragY+=A.movementY,k.dragY**2>=64&&(k.allowUnselectedMouseUp=!0)}},onPointerDown(A){O.current=A.pointerType,V.current=!0,z()},onMouseUp(){if(z(),S||O.current==="touch"||V.current)return;const A=!u.context.selectionRef.current.allowSelectedMouseUp&&b,k=!u.context.selectionRef.current.allowUnselectedMouseUp&&!b;A||k||(V.current=!0,D.current?.click(),V.current=!1)}},I=ct("div",t,{ref:[M,n,m.ref,D],state:F,props:[h,W,p,$]}),H=a.useMemo(()=>({selected:b,index:v,textRef:d,selectedByFocus:E}),[b,v,d,E]);return Re.jsx(Do.Provider,{value:H,children:I})})),Ui=a.forwardRef(function(t,n){const{selected:o}=mn();return t.keepMounted||o?Re.jsx(Li,{...t,ref:n}):null}),Li=a.memo(a.forwardRef((e,t)=>{const{render:n,className:o,style:r,keepMounted:s,...i}=e,{selected:c}=mn(),l=a.useRef(null),{transitionStatus:f,setMounted:p}=to(c),m=ct("span",e,{ref:[t,l],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:Xn});return ln({batch:!0,enabled:!c,open:c,ref:l,onComplete(){c||p(!1)}}),m})),zi=a.memo(a.forwardRef(function(t,n){const{index:o,textRef:r,selectedByFocus:s}=mn(),i=lt(),{render:c,className:l,style:f,...p}=t,d=a.useCallback(u=>{u&&(o===0&&(i.context.firstItemTextRef.current=u),s&&(i.context.selectedItemTextRef.current=u))},[i,o,s]);return ct("div",t,{ref:[d,n,r],props:p})}));export{ho as A,Vi as C,Ci as L,ki as S,pn as a,vi as b,Hi as c,_i as d,Bi as e,Wi as f,Ni as g,$i as h,Ui as i,zi as j,js as k,ci as l,gn as m,So as n,vo as o,Fn as p,Ks as q,xo as r,Vn as s,Cr as t,lt as u,Ps as v,Is as w,Fs as x,Ms as y,ks as z};
@@ -1 +1 @@
1
- import{r as d,c as n,j as t,R as h}from"./__vite-browser-external-CPMSmJgP.js";import{P as f}from"./ProviderIcon-aLwclDsD.js";import{E as b}from"./external-link-ChBchK6G.js";const x=[{id:"claude",name:"Claude",icon:"CLAUDE",apiUrl:"https://status.claude.com/api/v2/status.json",pageUrl:"https://status.claude.com"},{id:"openai",name:"OpenAI / Codex",icon:"CODEX",apiUrl:"https://status.openai.com/api/v2/status.json",pageUrl:"https://status.openai.com"},{id:"cursor",name:"Cursor",icon:"CURSOR",apiUrl:"https://status.cursor.com/api/v2/status.json",pageUrl:"https://status.cursor.com"},{id:"github",name:"GitHub / Copilot",icon:"GITHUB",apiUrl:"https://www.githubstatus.com/api/v2/status.json",pageUrl:"https://www.githubstatus.com"},{id:"gemini",name:"Gemini",icon:"GEMINI",kind:"google",serviceName:"Gemini",apiUrl:"https://www.google.com/appsstatus/dashboard/incidents.json",pageUrl:"https://www.google.com/appsstatus/dashboard"},{id:"kimi",name:"Kimi / Moonshot",icon:"KIMI",apiUrl:"https://status.moonshot.cn/api/v2/status.json",pageUrl:"https://status.moonshot.cn"},{id:"minimax",name:"MiniMax",icon:"MINIMAX",apiUrl:"https://status.minimaxi.com/api/v2/status.json",pageUrl:"https://status.minimaxi.com"},{id:"zed",name:"Zed",icon:"ZED",kind:"instatus",apiUrl:"https://status.zed.dev/summary.json",pageUrl:"https://status.zed.dev"}],w=6e4,y=8e3,j=new Set(["none","minor","major","critical"]),g={none:{dot:"bg-emerald-500",text:"text-emerald-600 dark:text-emerald-400"},minor:{dot:"bg-yellow-500",text:"text-yellow-600 dark:text-yellow-400"},major:{dot:"bg-orange-500",text:"text-orange-600 dark:text-orange-400"},critical:{dot:"bg-red-500",text:"text-red-600 dark:text-red-400"},unknown:{dot:"bg-oai-gray-400",text:"text-oai-gray-500 dark:text-oai-gray-400"}};function k(e){switch(e){case"none":return n("status.state.none");case"minor":return n("status.state.minor");case"major":return n("status.state.major");case"critical":return n("status.state.critical");default:return n("status.state.unknown")}}const v={low:"minor",medium:"major",high:"critical"},N={MAJOROUTAGE:"critical",PARTIALOUTAGE:"major",DEGRADEDPERFORMANCE:"minor"};function A(e){const a=e?.page?.status;if(typeof a!="string")throw new Error("Unexpected payload");if(a==="UP")return{indicator:"none",description:"",updatedAt:null};const s=Array.isArray(e?.activeIncidents)?e.activeIncidents:[],r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=N[i?.impact]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i?.name||"",updatedAt:i?.updated||null})}return o||{indicator:"minor",description:"",updatedAt:null}}function I(e,a){if(!Array.isArray(e))throw new Error("Unexpected payload");const s=e.filter(i=>i&&!i.end&&(i.service_name===a||Array.isArray(i.affected_products)&&i.affected_products.some(c=>c?.title===a)));if(s.length===0)return{indicator:"none",description:"",updatedAt:null};const r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=v[i.severity]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i.external_desc||"",updatedAt:i.modified||null})}return o}async function E(e){try{const a=await fetch(e.apiUrl,{cache:"no-store",signal:AbortSignal.timeout(y)});if(!a.ok)throw new Error(`HTTP ${a.status}`);const s=await a.json();if(e.kind==="google")return I(s,e.serviceName);if(e.kind==="instatus")return A(s);const r=s?.status?.indicator;if(!j.has(r))throw new Error("Unexpected payload");return{indicator:r,description:typeof s?.status?.description=="string"?s.status.description:"",updatedAt:typeof s?.page?.updated_at=="string"?s.page.updated_at:null}}catch{return{indicator:"unknown",description:"",updatedAt:null}}}function U({provider:e,result:a}){const s=g[a?.indicator]||g.unknown,r=a==null;return t.jsxs("a",{href:e.pageUrl,target:"_blank",rel:"noreferrer","aria-label":n("status.open_page",{provider:e.name}),title:n("status.open_page",{provider:e.name}),className:"group block no-underline text-inherit rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4 sm:p-5 transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(f,{provider:e.icon,size:20}),t.jsx("span",{className:"font-medium text-sm sm:text-base truncate",children:e.name})]}),t.jsx("span",{"aria-hidden":!0,className:"shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-lg text-oai-gray-400 transition-colors group-hover:text-oai-black dark:group-hover:text-white",children:t.jsx(b,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r?t.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-300 dark:bg-oai-gray-700 animate-pulse","aria-hidden":!0}):t.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":!0,children:[a.indicator!=="none"&&a.indicator!=="unknown"?t.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 ${s.dot}`}):null,t.jsx("span",{className:`relative inline-flex h-2 w-2 rounded-full ${s.dot}`})]}),t.jsx("span",{className:`text-sm font-medium ${r?"text-oai-gray-400":s.text}`,children:r?n("status.state.checking"):k(a.indicator)})]}),!r&&a.description&&a.indicator!=="none"?t.jsx("p",{className:"mt-2 text-xs text-oai-gray-500 dark:text-oai-gray-400 break-words",children:a.description}):null]})}function T(){const[e,a]=d.useState({}),[s,r]=d.useState(null),[o,i]=d.useState(!1),c=d.useRef(!0),u=d.useCallback(async()=>{i(!0);const l=await Promise.all(x.map(async p=>[p.id,await E(p)]));c.current&&(a(Object.fromEntries(l)),r(new Date),i(!1))},[]);d.useEffect(()=>{c.current=!0,u();const l=setInterval(()=>{u()},w);return()=>{c.current=!1,clearInterval(l)}},[u]);const m=d.useMemo(()=>s?n("status.last_checked",{time:s.toLocaleTimeString()}):null,[s]);return t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.service_status")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("status.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[m?t.jsx("span",{className:"hidden sm:inline text-xs text-oai-gray-400 dark:text-oai-gray-500",children:m}):null,t.jsx("button",{type:"button",onClick:()=>{u()},disabled:o,"aria-label":n("status.refresh"),title:n("status.refresh"),className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50",children:t.jsx(h,{className:`h-4 w-4 ${o?"animate-spin":""}`,"aria-hidden":!0})})]})]}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:x.map(l=>t.jsx(U,{provider:l,result:e[l.id]??null},l.id))}),t.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n("status.page.source_note")})]})})})}export{x as STATUS_PROVIDERS,T as ServiceStatusPage,T as default};
1
+ import{r as d,c as n,j as t,R as h}from"./__vite-browser-external-BW1rxvYq.js";import{P as f}from"./ProviderIcon-BSI-1Cy8.js";import{E as b}from"./external-link-daw-XTjZ.js";const x=[{id:"claude",name:"Claude",icon:"CLAUDE",apiUrl:"https://status.claude.com/api/v2/status.json",pageUrl:"https://status.claude.com"},{id:"openai",name:"OpenAI / Codex",icon:"CODEX",apiUrl:"https://status.openai.com/api/v2/status.json",pageUrl:"https://status.openai.com"},{id:"cursor",name:"Cursor",icon:"CURSOR",apiUrl:"https://status.cursor.com/api/v2/status.json",pageUrl:"https://status.cursor.com"},{id:"github",name:"GitHub / Copilot",icon:"GITHUB",apiUrl:"https://www.githubstatus.com/api/v2/status.json",pageUrl:"https://www.githubstatus.com"},{id:"gemini",name:"Gemini",icon:"GEMINI",kind:"google",serviceName:"Gemini",apiUrl:"https://www.google.com/appsstatus/dashboard/incidents.json",pageUrl:"https://www.google.com/appsstatus/dashboard"},{id:"kimi",name:"Kimi / Moonshot",icon:"KIMI",apiUrl:"https://status.moonshot.cn/api/v2/status.json",pageUrl:"https://status.moonshot.cn"},{id:"minimax",name:"MiniMax",icon:"MINIMAX",apiUrl:"https://status.minimaxi.com/api/v2/status.json",pageUrl:"https://status.minimaxi.com"},{id:"zed",name:"Zed",icon:"ZED",kind:"instatus",apiUrl:"https://status.zed.dev/summary.json",pageUrl:"https://status.zed.dev"}],w=6e4,y=8e3,j=new Set(["none","minor","major","critical"]),g={none:{dot:"bg-emerald-500",text:"text-emerald-600 dark:text-emerald-400"},minor:{dot:"bg-yellow-500",text:"text-yellow-600 dark:text-yellow-400"},major:{dot:"bg-orange-500",text:"text-orange-600 dark:text-orange-400"},critical:{dot:"bg-red-500",text:"text-red-600 dark:text-red-400"},unknown:{dot:"bg-oai-gray-400",text:"text-oai-gray-500 dark:text-oai-gray-400"}};function k(e){switch(e){case"none":return n("status.state.none");case"minor":return n("status.state.minor");case"major":return n("status.state.major");case"critical":return n("status.state.critical");default:return n("status.state.unknown")}}const v={low:"minor",medium:"major",high:"critical"},N={MAJOROUTAGE:"critical",PARTIALOUTAGE:"major",DEGRADEDPERFORMANCE:"minor"};function A(e){const a=e?.page?.status;if(typeof a!="string")throw new Error("Unexpected payload");if(a==="UP")return{indicator:"none",description:"",updatedAt:null};const s=Array.isArray(e?.activeIncidents)?e.activeIncidents:[],r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=N[i?.impact]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i?.name||"",updatedAt:i?.updated||null})}return o||{indicator:"minor",description:"",updatedAt:null}}function I(e,a){if(!Array.isArray(e))throw new Error("Unexpected payload");const s=e.filter(i=>i&&!i.end&&(i.service_name===a||Array.isArray(i.affected_products)&&i.affected_products.some(c=>c?.title===a)));if(s.length===0)return{indicator:"none",description:"",updatedAt:null};const r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=v[i.severity]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i.external_desc||"",updatedAt:i.modified||null})}return o}async function E(e){try{const a=await fetch(e.apiUrl,{cache:"no-store",signal:AbortSignal.timeout(y)});if(!a.ok)throw new Error(`HTTP ${a.status}`);const s=await a.json();if(e.kind==="google")return I(s,e.serviceName);if(e.kind==="instatus")return A(s);const r=s?.status?.indicator;if(!j.has(r))throw new Error("Unexpected payload");return{indicator:r,description:typeof s?.status?.description=="string"?s.status.description:"",updatedAt:typeof s?.page?.updated_at=="string"?s.page.updated_at:null}}catch{return{indicator:"unknown",description:"",updatedAt:null}}}function U({provider:e,result:a}){const s=g[a?.indicator]||g.unknown,r=a==null;return t.jsxs("a",{href:e.pageUrl,target:"_blank",rel:"noreferrer","aria-label":n("status.open_page",{provider:e.name}),title:n("status.open_page",{provider:e.name}),className:"group block no-underline text-inherit rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4 sm:p-5 transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(f,{provider:e.icon,size:20}),t.jsx("span",{className:"font-medium text-sm sm:text-base truncate",children:e.name})]}),t.jsx("span",{"aria-hidden":!0,className:"shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-lg text-oai-gray-400 transition-colors group-hover:text-oai-black dark:group-hover:text-white",children:t.jsx(b,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r?t.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-300 dark:bg-oai-gray-700 animate-pulse","aria-hidden":!0}):t.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":!0,children:[a.indicator!=="none"&&a.indicator!=="unknown"?t.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 ${s.dot}`}):null,t.jsx("span",{className:`relative inline-flex h-2 w-2 rounded-full ${s.dot}`})]}),t.jsx("span",{className:`text-sm font-medium ${r?"text-oai-gray-400":s.text}`,children:r?n("status.state.checking"):k(a.indicator)})]}),!r&&a.description&&a.indicator!=="none"?t.jsx("p",{className:"mt-2 text-xs text-oai-gray-500 dark:text-oai-gray-400 break-words",children:a.description}):null]})}function T(){const[e,a]=d.useState({}),[s,r]=d.useState(null),[o,i]=d.useState(!1),c=d.useRef(!0),u=d.useCallback(async()=>{i(!0);const l=await Promise.all(x.map(async p=>[p.id,await E(p)]));c.current&&(a(Object.fromEntries(l)),r(new Date),i(!1))},[]);d.useEffect(()=>{c.current=!0,u();const l=setInterval(()=>{u()},w);return()=>{c.current=!1,clearInterval(l)}},[u]);const m=d.useMemo(()=>s?n("status.last_checked",{time:s.toLocaleTimeString()}):null,[s]);return t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.service_status")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("status.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[m?t.jsx("span",{className:"hidden sm:inline text-xs text-oai-gray-400 dark:text-oai-gray-500",children:m}):null,t.jsx("button",{type:"button",onClick:()=>{u()},disabled:o,"aria-label":n("status.refresh"),title:n("status.refresh"),className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50",children:t.jsx(h,{className:`h-4 w-4 ${o?"animate-spin":""}`,"aria-hidden":!0})})]})]}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:x.map(l=>t.jsx(U,{provider:l,result:e[l.id]??null},l.id))}),t.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n("status.page.source_note")})]})})})}export{x as STATUS_PROVIDERS,T as ServiceStatusPage,T as default};
@@ -0,0 +1 @@
1
+ .sessions-row-grid{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:12px;align-items:start}.sessions-row-identity{grid-column:1;grid-row:1}.sessions-row-metrics{grid-column:1 / -1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.sessions-row-action{grid-column:2;grid-row:1}.sessions-row-action:disabled{opacity:.4}.sessions-row-value{min-width:0}.sessions-row-meta{-moz-column-gap:12px;column-gap:12px}@media(max-width:767px){.sessions-row-metrics dt{font-size:11px;line-height:16px}.sessions-row-metrics dd{margin-top:0}}.sessions-row-nested .sessions-row-identity,.sessions-thread-models{padding-left:16px}.sessions-list-header{display:none}.sessions-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sessions-toolbar-search{grid-column:1 / -1}.sessions-filter-trigger{border-radius:6px}.sessions-filter-trigger>svg:last-child{margin-left:auto}.sessions-model-filter>svg:first-of-type{display:none}.sessions-kpis>div{min-width:0}@media(min-width:640px){.sessions-kpis>div+div{border-left:1px solid rgb(229 229 229);padding-left:16px}:root.dark .sessions-kpis>div+div{border-left-color:#262626}}@media(min-width:768px){.sessions-row-grid{grid-template-columns:minmax(0,1fr) 72px 80px 96px 32px;gap:16px}.sessions-row-metrics{display:contents}.sessions-row-meta{-moz-column-gap:0;column-gap:0}.sessions-meta-item+.sessions-meta-item:before{content:"·";padding:0 6px}.sessions-row-value{text-align:right}.sessions-row-action{grid-column:5;margin-top:-6px}@media(hover:hover){.sessions-row .sessions-row-action:not(:focus-visible){opacity:0}.sessions-row:hover .sessions-row-action:not(:disabled){opacity:1}.sessions-row:hover .sessions-row-action:disabled{opacity:.4}}.sessions-row-nested .sessions-row-identity,.sessions-thread-models{padding-left:30px}.sessions-list-header{display:grid}}@media(min-width:1024px){.sessions-toolbar{grid-template-columns:minmax(0,1fr) repeat(4,minmax(0,168px))}.sessions-toolbar-search{grid-column:auto}}
@@ -0,0 +1,3 @@
1
+ import{q as Te,r as n,j as e,e as B,c as s,J as Le,X as Fe,l as _,ac as be,H as ke,R as cs,d as pe,aB as ds,ak as Z}from"./__vite-browser-external-BW1rxvYq.js";import{L as us,I as ms}from"./LocalOnlyNotice-RIj2XT_X.js";import{S as ne}from"./Select-B6CM0ico.js";import{C as xs}from"./SelectItemText-CZ7puxuB.js";import{S as Re}from"./search-DBnhkzG_.js";import{C as gs}from"./check-8LQ7IvkH.js";import{P as Oe,a as Ee,b as Ie,c as $e,d as Pe}from"./PopoverPopup-CmUIY8lF.js";import{P as Ae}from"./ProviderIcon-BSI-1Cy8.js";import{H as hs}from"./HoverTooltip-CrMdGYZj.js";import{u as ye}from"./useCurrency-t1iy_pC3.js";import{i as ps,C as fs}from"./host-mode-GPY2DxE4.js";import{I as bs}from"./info-BaK8Hoi2.js";import{L as ys}from"./loader-circle-DYpa-xTZ.js";import"./arrow-up-right-c39fdiDQ.js";import"./download-x3Gmv-wu.js";import"./composite-BgLSXWKA.js";import"./store-DrEEdO_u.js";const qe={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};qe.node;const _s=Te(qe);const Ke={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Ke.node;const ks=Te(Ke),js="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function je({options:a,value:t,onChange:r,allValue:o="all",allLabel:d,searchPlaceholder:g,emptyLabel:m,ariaLabel:b,disabled:y=!1,className:j=""}){const[v,w]=n.useState(!1),[N,f]=n.useState(""),[k,p]=n.useState(-1),L=n.useRef(null),C=`${n.useId()}-listbox`,P=t===o?d:a.find(u=>u.value===t)?.label??t,M=N.trim().toLowerCase(),T=n.useMemo(()=>M?a.filter(u=>u.label.toLowerCase().includes(M)):a,[a,M]),S=n.useMemo(()=>[{value:o,label:d},...T],[o,d,T]),O=k>=0&&k<S.length?S[k]:null,A=u=>{r(u),w(!1),f(""),p(-1)};n.useEffect(()=>{v&&L.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[v,k]);const J=u=>{if(u.key==="ArrowDown"||u.key==="ArrowUp"){u.preventDefault();const D=u.key==="ArrowDown";p(R=>{const l=S.length;return l?D?R>=l-1?0:R+1:R<=0?l-1:R-1:-1});return}if(u.key==="Enter"){const D=O||(M&&T.length?T[0]:null);if(!D)return;u.preventDefault(),A(D.value)}};return e.jsxs(Oe,{open:v,onOpenChange:u=>{w(u),p(-1),u||f("")},children:[e.jsxs(Ee,{disabled:y,"aria-label":b,className:B("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==o?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",j),children:[e.jsx(ks,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:P}),e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(Ie,{children:e.jsx($e,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(Pe,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx(Re,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":C,"aria-activedescendant":O?`${C}-${k}`:void 0,value:N,onChange:u=>{f(u.target.value),p(-1)},onKeyDown:J,placeholder:g,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:L,id:C,role:"listbox","aria-label":b,className:"max-h-64 overflow-y-auto",children:[S.map((u,D)=>e.jsxs("button",{id:`${C}-${D}`,type:"button",role:"option","aria-selected":t===u.value,"data-active":D===k?"true":void 0,onMouseEnter:()=>p(D),onClick:()=>A(u.value),className:B(js,t===u.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",D===k&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:u.label}),t===u.value?e.jsx(gs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},u.value)),T.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:m}):null]})]})})})]})}const vs="tokentracker-sessions";async function ws(a={}){const t=new URL(`/functions/${vs}`,window.location.origin);a.from&&t.searchParams.set("from",a.from),a.to&&t.searchParams.set("to",a.to),a.limit&&t.searchParams.set("limit",String(a.limit)),a.refresh&&t.searchParams.set("refresh","1");const r=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await r.json().catch(()=>null);if(!r.ok){const d=r.status===404?s("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,g=new Error(o?.error||d);throw g.status=r.status,g}return o}function Ue(a,t,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const d=r?{hour:"2-digit",minute:"2-digit"}:{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Date(o).toLocaleString(t||void 0,d)}catch{const g=new Date(o).toISOString();return r?g.slice(11,16):g.slice(0,16).replace("T"," ")}}function ze(a){const t=Number(a);if(!Number.isFinite(t)||t<=0)return null;const r=Math.round(t/6e4);if(r<60)return s("sessions.duration.minutes",{minutes:r});const o=Math.floor(r/60),d=r%60;return s("sessions.duration.hours",{hours:o,minutes:d})}function te(a){return W(a?.own_total_tokens??a?.total_tokens)}function ae(a){return W(a?.own_cost_usd??a?.cost_usd)}function W(a){const t=Number(a);return Number.isFinite(t)&&t>=0?t:0}function V(a){const t=Array.isArray(a?.model_usage)?a.model_usage.filter(r=>r&&typeof r.model=="string"&&r.model):[];return t.length?t:[{model:a?.model||"",total_tokens:te(a),cost_usd:ae(a),performance:a?.performance}]}function Ns(a){const t={estimated_output_tokens:0,estimated_duration_ms:0,estimated_request_count:0,estimated_tokens_per_second:null,first_response_total_ms:0,first_response_sample_count:0,first_response_ms:null};for(const r of a){const o=r?.performance;if(!o)continue;const d=W(o.estimated_duration_ms),g=W(o.estimated_output_tokens),m=W(o.estimated_request_count);d>0&&g>0&&m>0&&(t.estimated_output_tokens+=g,t.estimated_duration_ms+=d,t.estimated_request_count+=m);const b=W(o.first_response_sample_count),y=W(o.first_response_total_ms);b>0&&y>0&&(t.first_response_total_ms+=y,t.first_response_sample_count+=b)}return t.estimated_duration_ms>0&&(t.estimated_tokens_per_second=t.estimated_output_tokens*1e3/t.estimated_duration_ms),t.first_response_sample_count>0&&(t.first_response_ms=t.first_response_total_ms/t.first_response_sample_count),t}function Ge(a){const t=new Set,r=a.filter(o=>t.has(o.session_hash)?!1:(t.add(o.session_hash),!0));return{count:r.length,tokens:r.reduce((o,d)=>o+te(d),0),cost:r.reduce((o,d)=>o+ae(d),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Ns(r)}}function fe(a){const t=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(t)?t:0}function Ss(a,t){return[...a].sort((r,o)=>(t==="cost"?ae(o)-ae(r):t==="tokens"?te(o)-te(r):0)||fe(o)-fe(r))}function le(a){const t=fe(a);if(!t)return"";const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}function Cs(a,t){const r=new Map;for(const o of a){const d=t==="project"?o.project_key||"":le(o),g=r.get(d)||{key:d,sessions:[]};g.sessions.push(o),r.set(d,g)}return[...r.values()]}function Ms(a){const t=new URLSearchParams(a),r=t.get("source"),o=m=>{const b=t.get(m)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(b))return"";const y=new Date(`${b}T00:00:00`);return Number.isFinite(y.getTime())&&le({ended_at:y.toISOString()})===b?b:""},d=o("from"),g=o("to");return{source:["claude","codex","grok"].includes(r)?r:"all",model:t.get("model")||"all",from:d,to:g}}function Ds(a,t,r){let o=t?new Date(`${t}T00:00:00`).getTime():0,d=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>d&&(o=new Date(`${r}T00:00:00`).getTime(),d=new Date(`${t}T23:59:59.999`).getTime());const g=Date.parse(a.ended_at||a.started_at||""),m=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(g)||g>=o)&&(!Number.isFinite(m)||m<=d)}function se({performance:a,className:t=""}){const r=Number(a?.estimated_tokens_per_second),o=Number(a?.estimated_request_count||0);return!Number.isFinite(r)||r<=0||o<=0?null:e.jsx("span",{className:t,title:`${s("sessions.performance.samples",{count:o})}
2
+ ${s("sessions.performance.method")}`,children:s("sessions.performance.speed",{speed:Number(r.toFixed(1))})})}const Ts=[{key:"input_tokens",label:()=>s("dashboard.projects.detail.comp_input")},{key:"cached_input_tokens",label:()=>s("dashboard.projects.detail.comp_cached")},{key:"cache_creation_input_tokens",label:()=>s("dashboard.projects.detail.comp_cache_write")},{key:"output_tokens",label:()=>s("dashboard.projects.detail.comp_output")},{key:"reasoning_output_tokens",label:()=>s("dashboard.projects.detail.comp_reasoning")}],Ls=[{key:"turns",label:()=>s("sessions.col.turns")},{key:"edit_turns",label:()=>s("sessions.col.edits")},{key:"retry_turns",label:()=>s("sessions.detail.retries")},{key:"subagent_calls",label:()=>s("sessions.card.subagents")},{key:"tool_calls",grokOnly:!0,label:()=>s("sessions.detail.tools")},{key:"tool_failures",grokOnly:!0,label:()=>s("sessions.detail.tool_failures")},{key:"error_count",grokOnly:!0,label:()=>s("sessions.detail.errors")},{key:"model_calls",grokOnly:!0,label:()=>s("sessions.detail.model_calls")},{key:"compaction_count",grokOnly:!0,label:()=>s("sessions.detail.compactions")}];function Fs(a){return a==="provider_reported"?s("sessions.detail.cost_reported"):a==="model_pricing"?s("sessions.detail.cost_estimated"):a==="mixed"?s("sessions.detail.cost_mixed"):s("sessions.detail.cost_unknown")}function ve(a){return String(a||"").startsWith("litellm")?s("sessions.detail.pricing_litellm"):String(a||"").startsWith("curated")?s("sessions.detail.pricing_curated"):null}function Rs(a,t){return t||Number(a)>0}function we({label:a,children:t}){return e.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[e.jsx("dt",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:a}),e.jsx("dd",{className:"min-w-0 break-words text-right text-sm tabular-nums text-oai-black dark:text-white",children:t})]})}function ie({label:a,title:t,className:r="",children:o}){return e.jsxs("div",{className:`min-w-0 border-oai-gray-200 px-3 py-2.5 dark:border-oai-gray-800 ${r}`,title:t,children:[e.jsx("dt",{className:"truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"mt-0.5 truncate text-base font-medium tabular-nums text-oai-black dark:text-white",children:o})]})}function Os({session:a,subagents:t=[],onClose:r}){const o=n.useRef(null),d=n.useRef(null),{currency:g,rate:m}=ye(),{resolvedLocale:b}=Le(),y=l=>be(l,{currency:g,rate:m}),j=V(a),v=n.useMemo(()=>Ge(t),[t]),w=te(a),N=ae(a),f=Number(a.subagent_total_tokens??v.tokens),k=Number(a.subagent_cost_usd??v.cost),p=a.performance,L=Number(p?.estimated_tokens_per_second)>0&&Number(p?.estimated_request_count)>0,C=Number(p?.first_response_sample_count)>0&&p?.first_response_ms!=null&&Number.isFinite(Number(p.first_response_ms)),P=C?{seconds:(Number(p.first_response_ms)/1e3).toFixed(2),count:p.first_response_sample_count}:null,M=Number(a.reasoning_output_tokens)>0,T=a.source==="grok",S=T&&Number(a.context_window_tokens)>0;n.useEffect(()=>{const l=document.activeElement,E=document.body.style.overflow;document.body.style.overflow="hidden",o.current?.focus();const I=F=>{if(F.key==="Escape"&&(F.preventDefault(),r()),F.key!=="Tab")return;const K=Array.from(d.current?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), summary, [tabindex="0"]')||[]),X=K[0],Y=K[K.length-1];X?F.shiftKey&&(document.activeElement===X||!d.current?.contains(document.activeElement))?(F.preventDefault(),Y.focus()):!F.shiftKey&&(document.activeElement===Y||!d.current?.contains(document.activeElement))&&(F.preventDefault(),X.focus()):(F.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I),document.body.style.overflow=E,l instanceof HTMLElement&&l.isConnected&&l.focus()}},[r]);const O=f>0||k>0,A=a.cost_is_partial||O&&v.costIsPartial,J=[{label:s("sessions.detail.own"),tokens:w,cost:N,partial:a.cost_is_partial},{label:s("sessions.detail.subagents"),tokens:f,cost:k,partial:v.costIsPartial}],u=a.agent_nickname||a.title||a.project_key||s("sessions.project.unknown"),D=ze(a.duration_ms),R=[a.project_key&&a.project_key!==u?a.project_key:null,Ue(a.started_at,b),D].filter(Boolean);return e.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/20 dark:bg-black/40",onClick:l=>{l.target===l.currentTarget&&r()},children:e.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-label":s("sessions.detail.title"),tabIndex:-1,className:"flex h-full w-full max-w-[36rem] flex-col border-l border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("header",{className:"flex shrink-0 items-start gap-3 border-b border-oai-gray-200 px-5 py-4 dark:border-oai-gray-800",children:[e.jsx("span",{className:"shrink-0 pt-0.5 text-oai-gray-600 dark:text-oai-gray-300",children:e.jsx(Ae,{provider:String(a.source||"").toUpperCase(),size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"break-words text-base font-semibold leading-6 text-oai-black dark:text-white",children:u}),e.jsx("p",{className:"mt-0.5 break-words text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:R.join(" · ")})]}),e.jsx("button",{ref:o,type:"button",onClick:r,"aria-label":s("sessions.detail.close"),className:"-mr-2 -mt-1 flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white sm:h-9 sm:w-9",children:e.jsx(Fe,{size:18,"aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 py-5",children:[e.jsxs("section",{"aria-label":s("sessions.detail.consumption"),children:[e.jsxs("dl",{className:"grid grid-cols-2 overflow-hidden rounded-lg border border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx(ie,{label:s("sessions.col.tokens"),children:_(w+f)}),e.jsxs(ie,{label:s("sessions.col.cost"),className:"border-l",children:[A?"≥":"",y(N+k)]}),e.jsx(ie,{label:s("sessions.summary.speed"),className:"border-t",title:L?s("sessions.performance.samples",{count:p.estimated_request_count}):s("sessions.detail.no_speed"),children:L?e.jsx(se,{performance:p}):"—"}),e.jsx(ie,{label:s("sessions.performance.first_response"),className:"border-l border-t",title:s("sessions.performance.first_response_method"),children:C?Number(p.first_response_sample_count)===1?s("sessions.performance.first_response_value_single",P):s("sessions.performance.first_response_value",P):"—"})]}),O?e.jsx("dl",{className:"mt-3 space-y-1.5",children:J.map(l=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"text-oai-gray-600 dark:text-oai-gray-300",children:l.label}),e.jsx("dd",{className:"text-right tabular-nums",children:_(l.tokens)}),e.jsxs("dd",{className:"text-right tabular-nums",children:[l.partial?"≥":"",y(l.cost)]})]},l.label))}):null,e.jsxs("p",{className:"mt-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:[s("sessions.detail.cost_source")," · ",Fs(a.cost_source),a.cost_is_partial?e.jsxs("span",{className:"text-amber-700 dark:text-amber-300",children:[" · ",s("sessions.cost.partial_title")]}):null,a.usage_is_incomplete?e.jsxs("span",{className:"text-amber-700 dark:text-amber-300",children:[" · ",s("sessions.badge.partial_usage")]}):null]})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-white",children:s("sessions.detail.tokens")}),e.jsx("dl",{className:"mt-2 grid grid-cols-1 gap-x-8 gap-y-1.5 sm:grid-cols-2",children:Ts.map(({key:l,label:E})=>e.jsx(we,{label:E(),children:a[l]==null?"—":_(a[l])},l))})]}),e.jsxs("section",{className:"mt-6",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-white",children:s("sessions.detail.models")}),e.jsx("span",{className:"text-right text-xs text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0,children:s("sessions.col.tokens")}),e.jsx("span",{className:"text-right text-xs text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0,children:s("sessions.col.cost")})]}),e.jsx("ul",{className:"mt-1 divide-y divide-oai-gray-100 dark:divide-oai-gray-800/70",children:j.map(l=>{const E=l.pricing?.status==="unpriced",I=a.cost_source==="provider_reported"&&j.length===1,F=I?N:l.cost_usd,K=Rs(F,I);return e.jsxs("li",{className:"py-2.5",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"min-w-0 break-words text-oai-black dark:text-white",children:l.model||s("sessions.model.unknown")}),e.jsx("span",{className:"text-right tabular-nums",children:_(l.total_tokens)}),e.jsx("span",{className:"text-right tabular-nums",children:E&&!K?"—":y(F)})]}),l.pricing?e.jsxs("details",{className:"group text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsxs("summary",{className:"flex min-h-10 cursor-pointer list-none items-center gap-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 sm:min-h-0 sm:pt-1 [&::-webkit-details-marker]:hidden",children:[e.jsx(se,{performance:l.performance,className:"tabular-nums"}),e.jsx("span",{className:"underline decoration-dotted underline-offset-4 group-open:no-underline",children:s("sessions.detail.pricing_details")})]}),e.jsxs("div",{className:"space-y-1 pt-1.5 leading-5",children:[E?e.jsx("p",{children:s("sessions.detail.pricing_unpriced")}):null,l.pricing.status==="free"?e.jsx("p",{children:s("sessions.detail.pricing_free")}):null,l.pricing.status==="priced"?e.jsx("p",{children:s("sessions.detail.pricing_rates",{input:l.pricing.input,output:l.pricing.output,cacheRead:l.pricing.cache_read,cacheWrite:l.pricing.cache_write})}):null,ve(l.pricing.source)?e.jsx("p",{children:ve(l.pricing.source)}):null]})]}):e.jsx(se,{performance:l.performance,className:"block pt-1 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400"})]},l.model)})})]}),e.jsxs("details",{className:"mt-5 border-t border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center rounded text-sm font-medium text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white",children:s("sessions.detail.signals")}),e.jsx("dl",{className:"grid grid-cols-1 gap-x-8 gap-y-1.5 pb-4 sm:grid-cols-2",children:Ls.map(({key:l,label:E,grokOnly:I})=>e.jsx(we,{label:E(),children:typeof a[l]=="number"&&(!I||T)?_(a[l]):s("sessions.detail.not_recorded")},l))}),T&&a.usage_precision?e.jsx("p",{className:"pb-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.grok.runtime_breakdown",{calls:_(a.model_calls),seconds:(Number(a.api_duration_ms||0)/1e3).toFixed(1),tools:_(a.tool_calls),errors:_(a.error_count)})}):null,S?e.jsx("p",{className:"pb-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.grok.context_breakdown",{used:_(a.context_tokens_used),window:_(a.context_window_tokens),percent:Number(a.context_usage_percent||0).toFixed(0)})}):null]}),e.jsxs("details",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center rounded text-sm font-medium text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white",children:s("sessions.detail.identifiers")}),e.jsxs("dl",{className:"space-y-3 pb-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.detail.session_id")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.session_id||a.session_hash})]}),a.project_ref?e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.detail.local_path")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.project_ref})]}):null,a.resume_command?e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.detail.resume_command")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.resume_command})]}):null]})]}),e.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-oai-gray-200 pt-4 text-xs leading-5 text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[L?e.jsx("p",{children:s("sessions.performance.method")}):null,M?e.jsx("p",{children:s("sessions.detail.reasoning_note")}):null,e.jsx("p",{children:s("sessions.privacy")})]})]})]})})}const Ne=ps(),Se=[],he=100,Es=[{id:"all",label:()=>s("usage.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"grok",label:()=>"Grok"}],He=[{id:"all",days:0,label:()=>s("sessions.filter.range_label_all")},{id:"7d",days:7,label:()=>s("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>s("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>s("sessions.filter.range_90d")}];function Is(a){const t=He.find(o=>o.id===a)?.days||0;if(!t)return 0;const r=new Date;return r.setDate(r.getDate()-(t-1)),r.setHours(0,0,0,0),r.getTime()}function $s(a,t){if(!t)return!0;const r=Date.parse(a.ended_at||a.started_at||"");return Number.isFinite(r)?r>=t:!0}function Ps(a){const t=Date.parse(a.started_at||"");return!Number.isFinite(t)||le({started_at:a.started_at})===le(a)}function Ce(a){const t=V(a);return t.length===1?t[0].model||s("sessions.model.unknown"):t.map(r=>`${r.model} ${_(Number(r.total_tokens||0))}`).join(" · ")}async function Me(a){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(a),!0;const t=document.createElement("textarea");t.value=a,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const r=document.execCommand("copy");return document.body.removeChild(t),r}const De=pe.memo(function({session:t,locale:r,nested:o=!1,timeOnly:d=!1,childCount:g=0,expanded:m=!1,onToggle:b,onDetail:y}){const{currency:j,rate:v}=ye(),w=String(t.source||"").toUpperCase(),N=ze(t.duration_ms),f=t.resume_command,k=t.project_key||s("sessions.project.unknown"),p=o||t.thread_kind==="subagent",L=p?t.agent_nickname||t.agent_role||t.title||k:t.title||k,C=t.usage_is_incomplete?s("sessions.badge.partial_usage"):t.cost_is_partial?s("sessions.badge.partial_cost"):null,P=t.project_ref?`${t.project_ref}
3
+ ${s("sessions.project.copy_hint")}`:void 0,M=async()=>{if(t.project_ref)try{await Me(t.project_ref)?Z({title:s("sessions.project.copied")}):Z({title:s("sessions.project.copy_failed")})}catch{Z({title:s("sessions.project.copy_failed")})}},T=O=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(hs,{text:P,placement:"bottom"}),e.jsx("button",{type:"button",onClick:M,"aria-label":s("sessions.project.copy_aria",{project:k}),className:B("max-w-full truncate rounded text-left underline decoration-dotted decoration-oai-gray-300 underline-offset-4 hover:decoration-oai-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:decoration-oai-gray-600 dark:hover:decoration-oai-gray-400",O),children:k})]}),S=async()=>{if(f)try{await Me(f)?Z({title:s("sessions.resume.copied")}):Z({title:s("sessions.resume.copy_failed")})}catch{Z({title:s("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:B("sessions-row sessions-row-grid py-3",o&&"sessions-row-nested"),children:[e.jsxs("div",{className:"sessions-row-identity flex min-w-0 items-start gap-3",children:[e.jsx("span",{className:"shrink-0 pt-2 text-oai-gray-600 dark:text-oai-gray-300 md:pt-0.5",children:e.jsx(Ae,{provider:w,size:o?16:18})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("button",{type:"button",onClick:()=>y(t),"aria-label":s("sessions.detail.open_aria",{title:L}),title:L,className:"min-h-9 max-w-full truncate rounded text-left text-sm font-medium text-oai-black underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white md:min-h-0",children:L}),e.jsxs("div",{className:"sessions-row-meta mt-0.5 flex min-w-0 flex-wrap items-center gap-y-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full",children:t.project_ref?T("min-h-6 inline-flex items-center md:min-h-0"):e.jsx("span",{className:"truncate",children:k})}),e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full truncate",title:Ce(t),children:Ce(t)}),e.jsx("span",{className:"sessions-meta-item tabular-nums",children:Ue(t.started_at,r,{timeOnly:d&&Ps(t)})}),N?e.jsx("span",{className:"sessions-meta-item tabular-nums",children:N}):null,p?e.jsxs("span",{className:"sessions-meta-item",children:[s("sessions.badge.subagent"),t.agent_role?` · ${t.agent_role}`:""]}):null,t.first_pass?e.jsx("span",{className:"sessions-meta-item text-emerald-700 dark:text-emerald-300",children:s("sessions.badge.first_pass")}):null,C?e.jsx("span",{className:"sessions-meta-item text-amber-700 dark:text-amber-300",children:C}):null,t.cost_source==="provider_reported"?e.jsx("span",{className:"sessions-meta-item",children:s("sessions.badge.reported_cost")}):null,g?e.jsxs("button",{type:"button",onClick:()=>b(t.session_hash),"aria-expanded":m,className:"-mx-1.5 inline-flex min-h-8 items-center md:-my-1 md:ml-2 md:mr-0 gap-0.5 rounded px-1.5 font-medium text-oai-gray-700 hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white md:min-h-6",children:[e.jsx(ds,{className:B("h-3.5 w-3.5 transition-transform",m&&"rotate-90"),"aria-hidden":!0}),m?s("sessions.thread.collapse",{count:g}):s("sessions.thread.expand",{count:g})]}):null]})]})]}),e.jsxs("dl",{className:"sessions-row-metrics",children:[e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:s("sessions.col.tokens")}),e.jsxs("dd",{title:Number(t.subagent_total_tokens)?s("sessions.thread.tokens_summary",{own:_(t.own_total_tokens),subagents:_(t.subagent_total_tokens),combined:_(t.combined_total_tokens)}):void 0,className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",children:[_(t.total_tokens),Number(t.subagent_total_tokens)?e.jsxs("span",{className:"mt-0.5 block text-xs text-oai-gray-500 dark:text-oai-gray-400",children:["Σ ",_(t.combined_total_tokens)]}):null]})]}),e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:s("sessions.col.cost")}),e.jsxs("dd",{className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",title:t.cost_is_partial?s("sessions.cost.partial_title"):void 0,children:[t.cost_is_partial?"≥":"",be(t.cost_usd,{currency:j,rate:v})]})]}),e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:s("sessions.col.speed")}),e.jsx("dd",{className:"mt-1 min-h-5 text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 md:mt-0",children:e.jsx(se,{performance:t.performance})})]})]}),e.jsx("button",{type:"button",onClick:S,disabled:!f,title:f||s("sessions.resume.unavailable"),"aria-label":f?s("sessions.resume.copy_aria",{command:f}):s("sessions.resume.unavailable"),className:"sessions-row-action inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:cursor-not-allowed dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white md:h-8 md:w-8",children:e.jsx(fs,{className:"h-4 w-4","aria-hidden":!0})})]})});function As({sessions:a,selectedModel:t,onSelect:r}){const{groups:o,totalTokens:d}=n.useMemo(()=>{const m=new Map;let b=0;for(const y of a)for(const j of V(y)){const v=j.model||s("sessions.model.unknown"),w=Number(j.total_tokens||0),N=m.get(v)||{model:v,count:0,tokens:0};N.count+=1,N.tokens+=w,b+=w,m.set(v,N)}return{groups:[...m.values()].sort((y,j)=>j.tokens-y.tokens),totalTokens:b}},[a]);function g(m){return B("min-h-10 rounded-md border px-2.5 text-xs tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 md:min-h-7",m?"border-oai-brand-500 bg-oai-brand-50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-300":"border-oai-gray-200 text-oai-gray-600 hover:bg-oai-gray-100 dark:border-oai-gray-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800")}return e.jsx("li",{className:"sessions-thread-models py-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"mr-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.thread.model_usage")}),e.jsx("button",{type:"button","aria-pressed":t==="all",onClick:()=>r("all"),className:g(t==="all"),children:s("sessions.thread.model_all",{count:a.length,tokens:_(d)})}),o.map(m=>e.jsx("button",{type:"button","aria-pressed":t===m.model,onClick:()=>r(m.model),className:g(t===m.model),children:s("sessions.thread.model_item",{model:m.model,count:m.count,tokens:_(m.tokens)})},m.model))]})})}function at(){const[a]=n.useState(()=>Ms(window.location.search)),[t,r]=n.useState(null),[o,d]=n.useState(null),[g,m]=n.useState(!0),[b,y]=n.useState(!1),[j,v]=n.useState(a.source),[w,N]=n.useState(a.model),[f,k]=n.useState(a.from||a.to?"custom":"all"),[p,L]=n.useState(a.from),[C,P]=n.useState(a.to),[M,T]=n.useState("all"),[S,O]=n.useState("time"),[A,J]=n.useState("recent"),[u,D]=n.useState(null),[R,l]=n.useState(""),[E,I]=n.useState(he),[F,K]=n.useState(()=>new Set),[X,Y]=n.useState(()=>new Map),re=n.useRef(0),{resolvedLocale:G}=Le(),{currency:We,rate:Ve}=ye(),oe=n.useCallback(async(i=!1)=>{const x=++re.current;i?y(!0):m(!0),d(null);try{const c=await ws({refresh:i});x===re.current&&r(c)}catch(c){x===re.current&&d(c?.message||String(c))}finally{x===re.current&&(m(!1),y(!1))}},[]);n.useEffect(()=>{Ne||ke()?oe(!1):m(!1)},[oe]);const $=t?.sessions||Se,Be=n.useMemo(()=>{const i=new Set,x=[];for(const c of $){const h=c.project_key;!h||i.has(h)||(i.add(h),x.push({value:h,label:h}))}return x.sort((c,h)=>c.label.localeCompare(h.label))},[$]),Qe=n.useMemo(()=>{const i=new Set;for(const x of $)for(const c of V(x))c.model&&i.add(c.model);return[...i].sort().map(x=>({value:x,label:x}))},[$]),ce=n.useDeferredValue(R),U=n.useMemo(()=>{const i=ce.trim().toLowerCase(),x=Is(f);return $.filter(c=>{if(j!=="all"&&c.source!==j||M!=="all"&&c.project_key!==M||w!=="all"&&!V(c).some(z=>z.model===w))return!1;if(f==="custom"){if(!Ds(c,p,C))return!1}else if(!$s(c,x))return!1;if(!i)return!0;const h=V(c).map(z=>z.model).join(" ");return`${c.title||""} ${c.project_key||""} ${h} ${c.agent_nickname||""} ${c.agent_role||""} ${c.project_ref||""} ${c.session_id||""}`.toLowerCase().includes(i)})},[$,j,M,w,f,p,C,ce]),Q=n.useMemo(()=>Ge(U),[U]),H=n.useMemo(()=>{const i=new Set(U.map(h=>h.session_hash)),x=new Map,c=[];for(const h of Ss(U,A)){const q=h.root_session_hash||h.parent_session_hash;if(h.parent_session_hash&&q&&i.has(q)){const z=x.get(q)||[];z.push(h),x.set(q,z)}else c.push(h)}return{roots:c,childrenByRoot:x,foldedCount:U.length-c.length}},[U,A]),de=j!=="all"||w!=="all"||f!=="all"||M!=="all"||R.trim()!=="";n.useEffect(()=>{I(he),K(new Set),Y(new Map)},[j,M,w,f,p,C,ce,A,S,$]);const ue=n.useMemo(()=>H.roots.slice(0,E),[H.roots,E]),Ze=n.useMemo(()=>Cs(ue,S),[ue,S]),Je=n.useMemo(()=>u?$.filter(i=>i.session_hash!==u.session_hash&&(i.root_session_hash===u.session_hash||i.parent_session_hash===u.session_hash)):Se,[$,u]),Xe=n.useCallback(()=>D(null),[]),me=n.useCallback(i=>{k(i),i!=="custom"&&(L(""),P(""))},[]),Ye=n.useCallback(()=>{v("all"),N("all"),T("all"),l(""),me("all")},[me]),xe=H.roots.length>ue.length,ge=n.useCallback(()=>I(i=>i+he),[]),es=n.useCallback(i=>{K(x=>{const c=new Set(x);return c.has(i)?c.delete(i):c.add(i),c})},[]),ss=n.useCallback((i,x)=>{Y(c=>{const h=new Map(c);return x==="all"?h.delete(i):h.set(i,x),h})},[]),_e=n.useRef(null);n.useEffect(()=>{if(!xe||typeof IntersectionObserver>"u")return;const i=_e.current;if(!i)return;const x=new IntersectionObserver(c=>{c.some(h=>h.isIntersecting)&&ge()},{rootMargin:"400px"});return x.observe(i),()=>x.disconnect()},[xe,ge]);const ts=n.useMemo(()=>Es.map(i=>({value:i.id,label:i.label()})),[G]),as=n.useMemo(()=>[...He.map(i=>({value:i.id,label:i.label()})),{value:"custom",label:s("sessions.filter.range_custom")}],[G]),rs=n.useMemo(()=>[{value:"time",label:s("sessions.group.time")},{value:"project",label:s("sessions.group.project")}],[G]),os=n.useMemo(()=>[{value:"recent",label:s("sessions.sort.recent")},{value:"cost",label:s("sessions.sort.cost")},{value:"tokens",label:s("sessions.sort.tokens")}],[G]),ns=Number(t?.session_count)>Number(t?.returned_count);return!Ne&&!ke()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(us,{})}):e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("header",{className:"mb-8 flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:s("sessions.page.summary")})]}),e.jsx("button",{type:"button",onClick:()=>{oe(!0)},disabled:b||g,"aria-label":s("sessions.page.refresh"),title:s("sessions.page.refresh"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-oai-gray-200 text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(cs,{className:B("h-4 w-4",b&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-6 space-y-3",children:[e.jsxs("div",{className:"sessions-toolbar",children:[e.jsxs("div",{className:"sessions-toolbar-search relative",children:[e.jsx(Re,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),e.jsx(ms,{type:"search",value:R,onChange:i=>l(i.target.value),onKeyDown:i=>{i.key==="Escape"&&R&&(i.preventDefault(),l(""))},"aria-label":s("sessions.action.search_aria"),placeholder:s("sessions.search.placeholder"),className:"h-11 pl-10 pr-12 text-sm !bg-white dark:!bg-oai-gray-900 !border-oai-gray-200 placeholder:!text-oai-gray-500 dark:!border-oai-gray-800 dark:placeholder:!text-oai-gray-400 sm:h-9 [&::-webkit-search-cancel-button]:appearance-none"}),R?e.jsx("button",{type:"button",onMouseDown:i=>i.preventDefault(),onClick:()=>l(""),"aria-label":s("sessions.action.search_clear"),className:"absolute right-0 top-0 flex h-11 w-11 items-center justify-center rounded-md text-oai-gray-600 hover:bg-oai-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 sm:h-9 sm:w-9",children:e.jsx(Fe,{className:"h-4 w-4","aria-hidden":!0})}):null]}),e.jsx(ne,{ariaLabel:s("sessions.filter.source_aria"),options:ts,value:j,onValueChange:v,className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(ne,{ariaLabel:s("sessions.filter.range_aria"),options:as,value:f,onValueChange:me,leadingIcon:e.jsx(_s,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(je,{options:Be,value:M,onChange:T,allLabel:s("sessions.filter.project_all"),searchPlaceholder:s("sessions.filter.project_search"),emptyLabel:s("sessions.filter.project_empty"),ariaLabel:s("sessions.filter.project_aria"),className:"sessions-filter-trigger !h-11 !w-full !max-w-none !px-3 !text-sm !font-normal sm:!h-9 !bg-white !text-oai-black dark:!bg-oai-gray-900 dark:!text-white [&>svg]:!text-oai-gray-500 dark:[&>svg]:!text-oai-gray-400"}),e.jsx(je,{options:Qe,value:w,onChange:N,allLabel:s("sessions.filter.model_all"),searchPlaceholder:s("sessions.filter.model_search"),emptyLabel:s("sessions.filter.model_empty"),ariaLabel:s("sessions.filter.model_aria"),className:"sessions-filter-trigger sessions-model-filter !h-11 !w-full !max-w-none !px-3 !text-sm !font-normal sm:!h-9 !bg-white !text-oai-black dark:!bg-oai-gray-900 dark:!text-white [&>svg]:!text-oai-gray-500 dark:[&>svg]:!text-oai-gray-400"})]}),f==="custom"?e.jsxs("div",{className:"grid max-w-lg grid-cols-2 gap-3",children:[e.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"mb-1 block",children:s("sessions.filter.from")}),e.jsx("input",{type:"date","aria-label":s("sessions.filter.from"),value:p,onChange:i=>L(i.target.value),className:"h-11 w-full min-w-0 rounded-md border border-oai-gray-200 bg-white px-3 text-sm outline-none focus:ring-2 focus:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:h-10"})]}),e.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"mb-1 block",children:s("sessions.filter.to")}),e.jsx("input",{type:"date","aria-label":s("sessions.filter.to"),value:C,onChange:i=>P(i.target.value),className:"h-11 w-full min-w-0 rounded-md border border-oai-gray-200 bg-white px-3 text-sm outline-none focus:ring-2 focus:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:h-10"})]})]}):null]}),!g&&t?e.jsxs("section",{className:"mb-6 flex items-start gap-3 rounded-lg border border-oai-gray-200 px-4 py-3 dark:border-oai-gray-800",children:[e.jsxs("dl",{className:"sessions-kpis grid min-w-0 flex-1 grid-cols-2 gap-y-3 sm:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.summary.count")}),e.jsx("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:_(Q.count)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.col.tokens")}),e.jsx("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:_(Q.tokens)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.col.cost")}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[Q.costIsPartial?"≥":"",be(Q.cost,{currency:We,rate:Ve})]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.summary.speed")}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[e.jsx(se,{performance:Q.performance}),Q.performance.estimated_tokens_per_second==null?"—":null]})]})]}),e.jsxs(Oe,{children:[e.jsx(Ee,{"aria-label":s("sessions.summary.scope_help"),className:"-mr-2 flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 hover:bg-oai-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 sm:h-8 sm:w-8",children:e.jsx(bs,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(Ie,{children:e.jsx($e,{side:"bottom",align:"end",sideOffset:8,className:"z-[60]",children:e.jsx(Pe,{className:"max-w-xs rounded-lg border border-oai-gray-200 bg-white p-4 text-sm leading-6 text-oai-gray-700 outline-none dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:s("sessions.summary.scope")})})})]})]}):null,e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:H.foldedCount>0?s("sessions.thread.result_count",{roots:H.roots.length,subagents:H.foldedCount}):s("sessions.filter.result_count",{filtered:U.length,total:$.length})}),de?e.jsx("button",{type:"button",onClick:Ye,className:"inline-flex min-h-10 items-center rounded text-oai-gray-700 underline decoration-oai-gray-300 underline-offset-4 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-200 dark:decoration-oai-gray-600 dark:hover:text-white sm:min-h-0",children:s("sessions.filter.clear")}):null]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ne,{ariaLabel:s("sessions.group.aria"),options:rs,value:S,onValueChange:O,className:"sessions-filter-trigger h-11 min-w-0 max-w-40 px-2.5 text-xs sm:h-8"}),e.jsx(ne,{ariaLabel:s("sessions.sort.aria"),options:os,value:A,onValueChange:J,className:"sessions-filter-trigger h-11 min-w-0 max-w-44 px-2.5 text-xs sm:h-8",align:"end"})]})]}),ns?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.truncated",{shown:t.returned_count,total:t.session_count})}):null,o&&!t?e.jsxs("div",{className:"rounded-xl border border-dashed border-red-300 py-16 text-center dark:border-red-500/40",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:s("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o}),e.jsx("button",{type:"button",onClick:()=>{oe(!1)},className:"mt-4 inline-flex h-11 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:s("sessions.error.retry")})]}):g?e.jsxs("div",{className:"flex items-center gap-2 py-16 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(ys,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),s("sessions.loading")]}):U.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-oai-gray-200 py-16 text-center dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:de?s("sessions.empty.filtered_title"):s("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:de?s("sessions.empty.filtered_body"):s("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[o?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:o})}):null,e.jsxs("div",{className:"sessions-row-grid sessions-list-header border-b border-oai-gray-200 py-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400","aria-hidden":!0,children:[e.jsx("span",{children:s("sessions.col.session")}),e.jsx("span",{className:"text-right",children:s("sessions.col.tokens")}),e.jsx("span",{className:"text-right",children:s("sessions.col.cost")}),e.jsx("span",{className:"text-right",children:s("sessions.col.speed")}),e.jsx("span",{className:"sr-only",children:s("sessions.col.actions")})]}),e.jsx("ul",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:Ze.map(i=>e.jsxs(pe.Fragment,{children:[e.jsx("li",{className:"pb-2 pt-5",children:e.jsx("h2",{className:"break-words text-xs font-medium text-oai-gray-900 dark:text-oai-gray-100",children:S==="project"?i.key||s("sessions.project.unknown"):i.key?new Date(`${i.key}T12:00:00`).toLocaleDateString(G||void 0,{year:"numeric",month:"short",day:"numeric"}):s("sessions.group.unknown_date")})}),i.sessions.map(x=>{const c=H.childrenByRoot.get(x.session_hash)||[],h=F.has(x.session_hash),q=X.get(x.session_hash)||"all",z=q==="all"?c:c.filter(function(is){return V(is).some(ls=>ls.model===q)});return e.jsxs(pe.Fragment,{children:[e.jsx(De,{session:x,locale:G,timeOnly:S==="time",childCount:c.length,expanded:h,onToggle:es,onDetail:D}),h&&c.length?e.jsx(As,{sessions:c,selectedModel:q,onSelect:ee=>ss(x.session_hash,ee)}):null,h?z.map(ee=>e.jsx(De,{session:ee,locale:G,nested:!0,timeOnly:S==="time",onDetail:D},ee.session_hash)):null]},x.session_hash)})]},i.key))}),xe?e.jsx("div",{ref:_e,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:ge,className:"inline-flex h-11 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:s("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-8 max-w-3xl text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.privacy")})]})}),u?e.jsx(Os,{session:u,subagents:Je,onClose:Xe}):null]})}export{at as SessionsPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/__vite-browser-external-BW1rxvYq.js","assets/__vite-browser-external-gKkiQad5.css"])))=>i.map(i=>d[i]);
2
+ import{q as I,j as t,e as _,c as n,a as ye,r as d,at as ve,az as ke,aA as je,a9 as X,aY as Se,aZ as we,a_ as Ne,u as Ce,d as H,a2 as Ee,J as ee,n as U,a$ as V,m as B,b0 as Ae,b1 as Pe,Z as te,b2 as Oe,t as Le,b3 as _e,b4 as Te,b5 as Ie,b6 as Ge,b7 as Re,b8 as De,b9 as Ue,ba as ne,L as Me,R as He,bb as Fe,bc as $e,ak as z,_ as Ve,h as Be,f as ze,bd as Ke,be as qe,aD as We}from"./__vite-browser-external-BW1rxvYq.js";import{a as Ze,b as K,s as Ye,K as Je,P as Qe,D as Xe,c as et,S as tt,v as nt,u as at,C as st}from"./sortable.esm-SVl6OixH.js";import{a as it}from"./modifiers.esm-Ds4Uh7JO.js";import{d as q,l as W,u as ot,b as Z}from"./use-limits-display-prefs-CDC0MZRY.js";import{P as rt}from"./ProviderIcon-BSI-1Cy8.js";import{m as ae}from"./react-CO1HovF5.js";import{a as O,T as j,b,S as T,u as R}from"./Controls-D56v-YJw.js";import{P as lt,u as ct,a as ut}from"./use-session-efficiency-pref-D8cAb4A9.js";import{C as dt}from"./check-8LQ7IvkH.js";import{C as gt,i as pt}from"./host-mode-GPY2DxE4.js";import{A as se}from"./index-CPcJP0uH.js";import{u as ht}from"./useCurrency-t1iy_pC3.js";import{u as mt}from"./useTokenFormat-0bPjtaaM.js";import{S as F}from"./Select-B6CM0ico.js";import{I as bt}from"./info-BaK8Hoi2.js";import{C as ft}from"./ConfirmModal-zUljpLNe.js";import{A as xt}from"./arrow-up-right-c39fdiDQ.js";import{D as yt}from"./download-x3Gmv-wu.js";import"./Card-BU2CqxfU.js";import"./SelectItemText-CZ7puxuB.js";import"./composite-BgLSXWKA.js";import"./DialogTitle-6q0jyME6.js";import"./store-DrEEdO_u.js";import"./DialogDescription-COXweCuc.js";const ie={name:"flask-conical",size:24,node:[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]};ie.node;const vt=I(ie);const oe={name:"grip-vertical",size:24,node:[["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"}]]};oe.node;const kt=I(oe);const re={name:"languages",size:24,node:[["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"}]]};re.node;const jt=I(re);const le={name:"log-out",size:24,node:[["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"}]]};le.node;const St=I(le);const ce={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};ce.node;const wt=I(ce);const ue={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};ue.node;const Nt=I(ue),Ct="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Et({checked:e,onChange:a,ariaLabel:s}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,onClick:a,className:_("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:_("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function At({id:e,visible:a,onToggle:s}){const{attributes:i,listeners:o,setNodeRef:r,transform:l,transition:c,isDragging:u}=at({id:e}),h={transform:st.Transform.toString(l)||void 0,transition:c,zIndex:u?20:void 0};return t.jsxs("div",{ref:r,style:h,className:_("flex items-center gap-3 py-2 rounded-md select-none touch-none","cursor-grab active:cursor-grabbing","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u&&"relative bg-oai-gray-100 dark:bg-oai-gray-800"),...i,...o,children:[t.jsx(kt,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),q(e)?t.jsx(rt,{provider:q(e),size:18,className:_("pointer-events-none",Ct)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200",children:W(e)}),t.jsx("div",{onPointerDown:p=>p.stopPropagation(),children:t.jsx(Et,{checked:a,onChange:s,ariaLabel:`${n("limits.settings.toggle_visible")}: ${W(e)}`})})]})}function Pt({prefs:e}){const{order:a,visibility:s,toggle:i,moveToward:o}=e,r=Ze(K(Qe,{activationConstraint:{distance:6}}),K(Je,{coordinateGetter:Ye})),l=({active:c,over:u})=>{u&&c.id!==u.id&&o(c.id,u.id)};return t.jsx(Xe,{sensors:r,collisionDetection:et,modifiers:[it],onDragEnd:l,children:t.jsx(tt,{items:a,strategy:nt,children:t.jsx("div",{className:"flex flex-col",children:a.map(c=>t.jsx(At,{id:c,visible:s[c]!==!1,onToggle:()=>i(c)},c))})})})}function Ot(e){if(!e||typeof e!="object")return"";const a=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},s=e.profile&&typeof e.profile=="object"?e.profile:{},i=a.full_name||a.name||s.name||a.user_name||a.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Lt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function _t(e){const a=typeof e=="string"?e.trim():"";if(!a)return null;const s=a.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=a.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=s?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function $(e,a){console.warn(`[tokentracker] settings ${e}:`,a)}function Tt(e,a,s){const[i,o]=d.useState(()=>ve()),r=a&&s&&Ne(),l=d.useCallback(async()=>{const c=!i;if(ke(c),o(c),!!c)try{await je(()=>e())}catch(u){$("cloud sync",u)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:l,showLocalCloudSync:r}}function It(e){const[a,s]=d.useState(!1),[i,o]=d.useState(!1),[r,l]=d.useState(!1),[c,u]=d.useState(!1),[h,p]=d.useState(null),[g,m]=d.useState(!1),[v,k]=d.useState(""),[P,y]=d.useState(!1),[w,N]=d.useState(""),[f,S]=d.useState(""),[L,x]=d.useState(!1),[E,D]=d.useState(null),G=d.useMemo(()=>Ot(e),[e]),be=d.useMemo(()=>Lt(e),[e]),fe=d.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),xe=d.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:p,setGithubUrl:N,setProfileLoading:l,setPublicProfileOn:s,setShowGithubOn:y}),[]);return{anonymousOn:i,customDisplayName:h,displayName:G,editingGithub:L,editingName:g,email:be,githubError:E,githubInput:f,githubUrl:w,loadSetters:xe,nameInput:v,profileLoading:r,profileSaving:c,publicProfileOn:a,setAnonymousOn:o,setCustomDisplayName:p,setEditingGithub:x,setEditingName:m,setGithubError:D,setGithubInput:S,setGithubUrl:N,setNameInput:k,setProfileLoading:l,setProfileSaving:u,setPublicProfileOn:s,setShowGithubOn:y,showGithubOn:P,userId:fe}}function Gt(e,a,s){d.useEffect(()=>{if(!a)return;let i=!0;return s.setProfileLoading(!0),(async()=>{try{const o=await X({getAccessToken:e});if(!i||!o)return;const r=await Se({accessToken:o});if(!i)return;s.setPublicProfileOn(!!r?.enabled),s.setAnonymousOn(!!r?.anonymous),r?.display_name&&s.setCustomDisplayName(r.display_name),s.setShowGithubOn(!!r?.show_github_url),s.setGithubUrl(r?.github_url||"")}catch(o){$("load public profile",o)}finally{i&&s.setProfileLoading(!1)}})(),()=>{i=!1}},[e,a,s])}function Rt(e,a){return d.useCallback(async(s,{label:i,onError:o,onSuccess:r}={})=>{if(a.profileSaving)return!1;a.setProfileSaving(!0);try{const l=await X({getAccessToken:e});if(!l)return!1;const c=await we({accessToken:l,...s});return r?.(c),!0}catch(l){return o?o(l):$(i||"mutate profile",l),!1}finally{a.setProfileSaving(!1)}},[e,a])}function Dt(e,a){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:a.handleAnonymousToggle,handleSaveName:a.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:a.startEditingName}}function Ut(e,a){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:a.handleSaveGithub,handleShowGithubToggle:a.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:a.startEditingGithub}}function Mt(e,a){const s=d.useCallback(async()=>{const o=!e.publicProfileOn;await a({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[a,e]);return{handleAnonymousToggle:d.useCallback(async()=>{const o=!e.anonymousOn;await a({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[a,e]),handlePublicProfileToggle:s}}function Ht(e,a,s){const i=d.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await a({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),s?.()}})},[a,e,s]),o=d.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function Ft(e,a){const s=d.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await a({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[a,e]),i=d.useCallback(async()=>{const r=_t(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(n("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await a({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||n("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[a,e]),o=d.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:s,startEditingGithub:o}}function $t(){const e=ye(),a=It(e.user),s=Tt(e.getAccessToken,e.enabled,e.signedIn);Gt(e.getAccessToken,e.signedIn,a.loadSetters);const i=Rt(e.getAccessToken,a),o=Mt(a,i),r=Ht(a,i,e.refreshDisplayName),l=Ft(a,i);return{...e,...s,email:a.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:a.userId,name:Dt(a,{...o,...r}),github:Ut(a,l),profileLoading:a.profileLoading,profileSaving:a.profileSaving,publicProfileOn:a.publicProfileOn}}function de({disabled:e,onCancel:a,onSave:s,saveLabel:i=n("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:s,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:i}),t.jsx("button",{type:"button",onClick:a,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:n("settings.account.cancel")})]})}function Vt({nameInput:e,setEditingName:a,setNameInput:s,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&a(!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:n("settings.account.displayName")}),t.jsx(de,{disabled:i||!e.trim(),onCancel:()=>a(!1),onSave:o,saveLabel:i?n("settings.account.saving"):void 0})]})}function Bt({githubError:e,githubInput:a,handleSaveGithub:s,profileSaving:i,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:a,onChange:c=>{l(c.target.value),e&&r(null)},onKeyDown:c=>{c.key==="Enter"&&s(),c.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:n("settings.account.githubUrlPlaceholder")}),t.jsx(de,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:s,saveLabel:i?n("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 ge({disabled:e=!1,label:a,onClick:s,title:i}){return t.jsxs("button",{type:"button",onClick:s,disabled:e,title:i,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(lt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a]})}function pe({actions:e,editing:a,editor:s,hint:i,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}),a?s:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),a?null:e]})})}function zt({name:e}){const a=e.anonymousOn?n("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ge,{disabled:e.anonymousOn,label:n("settings.account.edit"),onClick:e.startEditingName,title:a}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:n("settings.account.displayName")})]})}function Kt({name:e}){const{anonymousOn:a,customDisplayName:s,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:c,profileLoading:u,profileSaving:h,setEditingName:p,setNameInput:g,startEditingName:m}=e,v=a?n("settings.account.displayNameAnonymousHint"):s||i;return t.jsx(pe,{label:n("settings.account.displayName"),editing:o,hint:v,editor:t.jsx(Vt,{nameInput:c,setEditingName:p,setNameInput:g,profileSaving:h,handleSaveName:l}),actions:t.jsx(zt,{name:e})})}function qt({github:e}){const{editingGithub:a,githubError:s,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:c,profileSaving:u,setEditingGithub:h,setGithubError:p,setGithubInput:g,showGithubOn:m,startEditingGithub:v}=e;return t.jsx(t.Fragment,{children:t.jsx(pe,{label:n("settings.account.githubUrl"),editing:a,hint:o||n("settings.account.githubUrlHint"),editor:t.jsx(Bt,{githubError:s,githubInput:i,handleSaveGithub:r,profileSaving:u,setEditingGithub:h,setGithubError:p,setGithubInput:g}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ge,{label:n("settings.account.edit"),onClick:v}),t.jsx(j,{checked:m,onChange:l,disabled:c||u,ariaLabel:n("settings.account.githubUrl")})]})})})}function Wt(){const{openLoginModal:e}=Ce();return t.jsx(O,{title:n("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:n("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:n("settings.account.signIn")})]})})}function Zt({name:e,github:a}){return t.jsxs(t.Fragment,{children:[t.jsx(Kt,{name:e}),t.jsx(qt,{github:a})]})}function Yt(){const e=$t();return e.enabled?e.signedIn?t.jsxs(O,{title:n("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Qt,{onSignOut:e.signOut}),children:[t.jsx(Jt,{userId:e.userId}),t.jsx(Xt,{settings:e}),t.jsx(en,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(tn,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(Wt,{}):null}function Jt({userId:e}){const[a,s]=H.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),s(!0),globalThis.setTimeout(()=>s(!1),1200)}catch{s(!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:n("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:i,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":n("settings.account.copyUserId"),children:[a?t.jsx(dt,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(gt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a?n("settings.account.copied"):n("settings.account.copy")]})]})}function Qt({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(St,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.account.signOut")]})}function Xt({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:n("settings.account.cloudSync"),hint:n("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:n("settings.account.cloudSync")})}):null}function en({checked:e,disabled:a,onChange:s}){return t.jsx(b,{label:n("settings.account.publicProfile"),hint:n("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:s,disabled:a,ariaLabel:n("settings.account.publicProfile")})})}function tn({visible:e,name:a,github:s}){return t.jsx(se,{initial:!1,children:e?t.jsx(ae.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(Zt,{name:a,github:s})},"public-profile-fields"):null})}function nn(){return[{value:"light",label:n("settings.appearance.theme.light"),Icon:Ae},{value:"dark",label:n("settings.appearance.theme.dark"),Icon:Pe},{value:"system",label:n("settings.appearance.theme.system"),Icon:te}]}function an(){return[{value:_e,label:n("settings.appearance.language.system")},{value:Te,label:n("settings.appearance.language.english")},{value:Ie,label:n("settings.appearance.language.chinese")},{value:Ge,label:n("settings.appearance.language.traditional_chinese")},{value:Re,label:n("settings.appearance.language.japanese")},{value:De,label:n("settings.appearance.language.korean")},{value:Ue,label:n("settings.appearance.language.german")}]}function sn(e){if(!e)return null;try{const a=new Date(e);return Number.isNaN(a.getTime())?null:a.toLocaleString()}catch{return null}}function on(e,a){const s=n(`settings.appearance.currency.rate_source.${e}`),i=sn(a),o=i?n("settings.appearance.currency.rate_updated",{when:i}):n("settings.appearance.currency.rate_never");return`${s} · ${o}`}function rn({locale:e,setLocale:a}){const s=an();return t.jsx(F,{value:e,onValueChange:a,options:s,ariaLabel:n("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(jt,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function ln({currency:e,setCurrency:a}){const s=Oe().map(i=>({value:i.code,label:n(i.labelKey)}));return t.jsx(F,{value:e,onValueChange:a,options:s,ariaLabel:n("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function cn({currency:e,rate:a,rateSource:s,rateFetchedAt:i}){if(e===Le)return t.jsx(t.Fragment,{children:n("settings.appearance.currency.hint")});const o=on(s,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${a.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(bt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function un(){const{theme:e,setTheme:a}=Ee(),{locale:s,setLocale:i}=ee(),{currency:o,rate:r,rateSource:l,rateFetchedAt:c,setCurrency:u}=ht(),{mode:h,setMode:p,unitSystem:g,setUnitSystem:m,grouping:v,setGrouping:k}=mt();return t.jsxs(O,{title:n("settings.section.appearance"),children:[t.jsx(b,{label:n("settings.appearance.theme.label"),hint:n("settings.appearance.theme.hint"),control:t.jsx(T,{options:nn(),value:e,onChange:a})}),t.jsx(b,{label:n("settings.appearance.language.label"),hint:n("settings.appearance.language.hint"),control:t.jsx(rn,{locale:s,setLocale:i})}),t.jsx(b,{label:n("settings.appearance.currency.label"),hint:t.jsx(cn,{currency:o,rate:r,rateSource:l,rateFetchedAt:c}),control:t.jsx(ln,{currency:o,setCurrency:u})}),t.jsx(b,{label:n("settings.appearance.token_format.label"),hint:n("settings.appearance.token_format.hint"),control:t.jsx(T,{options:[{value:U.COMPACT,label:n("settings.appearance.token_format.compact")},{value:U.FULL,label:n("settings.appearance.token_format.full")}],value:h,onChange:p})}),t.jsx(b,{label:n("settings.appearance.token_unit.label"),hint:n("settings.appearance.token_unit.hint"),control:t.jsx(T,{disabled:h!==U.COMPACT,options:[{value:V.ENGLISH,label:n("settings.appearance.token_unit.english")},{value:V.CHINESE,label:n("settings.appearance.token_unit.chinese")}],value:g,onChange:m})}),t.jsx(b,{label:n("settings.appearance.token_grouping.label"),hint:n("settings.appearance.token_grouping.hint"),control:t.jsx(T,{options:[{value:B.THOUSAND,label:n("settings.appearance.token_grouping.thousand")},{value:B.WAN,label:n("settings.appearance.token_grouping.wan")}],value:v,onChange:k})})]})}function M({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:n(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:n("qpd.card.badge")})]})}function dn(){const{enabled:e,toggle:a}=ct(),{enabled:s,toggle:i}=ut(),{available:o,settings:r,setSetting:l}=R(),c=o&&!!r?.dynamicIslandSupported,u=!!r?.dynamicIslandEnabled;return t.jsxs(O,{title:n("settings.section.labs"),children:[c&&t.jsxs(t.Fragment,{children:[t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.island.label"}),hint:n("settings.labs.island.hint"),control:t.jsx(j,{checked:u,onChange:()=>l("dynamicIslandEnabled",!u),ariaLabel:n("settings.labs.island.aria")})}),u&&t.jsx(b,{label:n("settings.labs.island_hide_menubar.label"),hint:n("settings.labs.island_hide_menubar.hint"),control:t.jsx(j,{checked:!!r?.hideMenuBarIcon,onChange:()=>l("hideMenuBarIcon",!r?.hideMenuBarIcon),ariaLabel:n("settings.labs.island_hide_menubar.aria")})})]}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.qpd.label"}),hint:n("settings.labs.qpd.hint"),control:t.jsx(j,{checked:e,onChange:a,ariaLabel:n("settings.labs.qpd.aria")})}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.sessions.label"}),hint:n("settings.labs.sessions.hint"),control:t.jsx(j,{checked:s,onChange:i,ariaLabel:n("settings.labs.sessions.aria")})})]})}function gn(){const{available:e,settings:a,setSetting:s,runAction:i}=R();if(!e)return null;const o=ne(),r=!!a?.launchAtLogin,l=a?.toastOnReset!==!1,c=a?.confettiOnReset!==!1,u=a?.launchAtLoginSupported!==!1,h=a?.autoUpdateEnabled!==!1,p=a?.updateStatus||null,g=!!a?.updateBusy,m=!!a?.isSyncing;return t.jsxs(O,{title:n("settings.section.menubar"),children:[o?null:t.jsxs(t.Fragment,{children:[t.jsx(b,{label:n("settings.menubar.appearance"),hint:n("settings.menubar.appearanceHint"),control:t.jsxs(Me,{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:[n("settings.menubar.appearanceLink"),t.jsx(xt,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(b,{label:n("settings.menubar.toastOnReset"),hint:n("settings.menubar.toastOnResetHint"),control:t.jsx(j,{checked:l,onChange:()=>s("toastOnReset",!l),ariaLabel:n("settings.menubar.toastOnReset")})}),t.jsx(b,{label:n("settings.menubar.confettiOnReset"),hint:n("settings.menubar.confettiOnResetHint"),control:t.jsx(j,{checked:c,onChange:()=>s("confettiOnReset",!c),ariaLabel:n("settings.menubar.confettiOnReset")})})]}),u?t.jsx(b,{label:n("settings.menubar.launchAtLogin"),hint:n("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:r,onChange:()=>s("launchAtLogin",!r),ariaLabel:n("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:n("settings.menubar.syncNow"),hint:n("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:m,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(He,{className:_("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?n("settings.menubar.syncing"):n("settings.menubar.syncNow")]})}),t.jsx(b,{label:n("settings.menubar.autoUpdate"),hint:n("settings.menubar.autoUpdateHint"),control:t.jsx(j,{checked:h,onChange:()=>s("autoUpdateEnabled",!h),ariaLabel:n("settings.menubar.autoUpdate")})}),t.jsx(b,{label:n("settings.menubar.updates"),hint:p||void 0,control:t.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(yt,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.menubar.checkUpdates")]})})]})}function pn(e,a){function s(r){return r.replace(/^v/,"").split(".").map(Number)}const i=s(e),o=s(a);for(let r=0;r<Math.max(i.length,o.length);r++){const l=i[r]||0,c=o[r]||0;if(l<c)return!0;if(l>c)return!1}return!1}function hn(){const{available:e,settings:a,runAction:s}=R(),i=e&&a?.version,o=a?.platform||"macos",[r,l]=H.useState(!1),[c,u]=H.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:h}=ee(),p="1.2.1",g=async()=>{l(!0);try{const y=await fetch("https://api.github.com/repos/xiufengsun/TokenTracker/releases/latest");if(!y.ok)throw new Error("Failed to fetch");const w=await y.json(),N=w.tag_name;pn(p,N)?u({open:!0,latestVersion:N,htmlUrl:w.html_url}):z({title:n("settings.menubar.updates.upToDate")})}catch(y){console.error("Check updates failed:",y),z({title:n("settings.menubar.updates.failed")})}finally{l(!1)}},m=n("settings.menubar.updates.modalTitle"),v=n("settings.menubar.updates.modalDescription",{version:c.latestVersion}),k=n("settings.menubar.updates.modalConfirm"),P=n("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:[i?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:o==="windows"?n("settings.menubar.updates.footerCore",{version:a.version}):n("settings.menubar.updates.footerCombined",{barVersion:a.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>s("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:n("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:g,disabled:r,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:r?n("settings.menubar.updates.checking"):n("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Fe,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($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.footer.statusPage")]})]}),t.jsx(ft,{open:c.open,title:m,description:v,confirmLabel:k,cancelLabel:P,onConfirm:()=>{window.open(c.htmlUrl,"_blank"),u(y=>({...y,open:!1}))},onCancel:()=>u(y=>({...y,open:!1}))})]})}const mn=()=>[{value:"system",label:n("settings.network.mode.system")},{value:"manual",label:n("settings.network.mode.manual")},{value:"off",label:n("settings.network.mode.off")}],bn=()=>[{value:"http",label:n("settings.network.protocol.http")},{value:"https",label:n("settings.network.protocol.https")},{value:"socks5",label:n("settings.network.protocol.socks5")}],Y="w-full 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";function J(e){const a={},s=String(e.host||"").trim();(!s||/:\/\//.test(s)||s.includes("/"))&&(a.host=n("settings.network.error.host"));const i=String(e.port??"").trim(),o=Number(i);return(!i||!/^\d+$/.test(i)||!Number.isInteger(o)||o<1||o>65535)&&(a.port=n("settings.network.error.port")),a}function fn({proxySettings:e}){const{config:a,save:s,testConnection:i}=e,[o,r]=d.useState(()=>({mode:a.mode,protocol:a.protocol||"http",host:a.host||"",port:a.port||""})),[l,c]=d.useState({}),[u,h]=d.useState(!1),[p,g]=d.useState(""),[m,v]=d.useState(null),[k,P]=d.useState(!1),[y,w]=d.useState(null);d.useEffect(()=>{r({mode:a.mode,protocol:a.protocol||"http",host:a.host||"",port:a.port||""})},[a.mode,a.protocol,a.host,a.port]);const N=d.useMemo(()=>a.effective==="manual"?n("settings.network.effective.manual"):a.effective==="env"?n("settings.network.effective.env"):a.effective==="system"?n("settings.network.effective.system"):a.effective==="blocked"?n("settings.network.effective.blocked"):n("settings.network.effective.none"),[a.effective]),f=x=>{r(E=>({...E,...x})),c({}),g(""),v(null),w(null)},S=async()=>{if(o.mode==="manual"){const x=J(o);if(Object.keys(x).length){c(x);return}}h(!0),g(""),v(null);try{await s(o),g("saved")}catch(x){g("error"),v(x)}finally{h(!1)}},L=async()=>{const x=J(o);if(Object.keys(x).length){c(x);return}P(!0),w(null);try{const E=await i(o);w(E)}catch(E){w({ok:!1,error:E?.message||String(E)})}finally{P(!1)}};return t.jsxs(O,{title:n("settings.section.network"),subtitle:N,children:[a.applyError?t.jsx("p",{role:"alert",className:"mb-3 text-xs text-red-600 dark:text-red-400",children:n("settings.network.apply_error",{error:a.applyError})}):null,t.jsx(b,{label:n("settings.network.mode.label"),hint:n("settings.network.mode.hint"),control:t.jsx(T,{options:mn(),value:o.mode,onChange:x=>f({mode:x})})}),t.jsx(se,{initial:!1,children:o.mode==="manual"?t.jsxs(ae.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(b,{label:n("settings.network.protocol.label"),control:t.jsx(F,{value:o.protocol,onValueChange:x=>f({protocol:x}),options:bn(),ariaLabel:n("settings.network.protocol.label"),className:"px-2.5 py-1.5 text-xs font-medium"})}),t.jsx(b,{label:n("settings.network.host.label"),hint:l.host,control:t.jsx("input",{type:"text",value:o.host,onChange:x=>f({host:x.target.value}),placeholder:n("settings.network.host.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":l.host?!0:void 0,"aria-label":n("settings.network.host.label"),className:Y})}),t.jsx(b,{label:n("settings.network.port.label"),hint:l.port,control:t.jsx("input",{type:"text",inputMode:"numeric",value:o.port,onChange:x=>f({port:x.target.value}),placeholder:n("settings.network.port.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":l.port?!0:void 0,"aria-label":n("settings.network.port.label"),className:Y})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 py-3",children:[t.jsx("button",{type:"button",onClick:L,disabled:k||u,className:"rounded-md border border-oai-gray-200 px-3 py-1.5 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:k?n("settings.network.test.testing"):n("settings.network.test")}),t.jsx("button",{type:"button",onClick:S,disabled:u||k,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:u?n("settings.network.saving"):n("settings.network.save")})]}),y?t.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:y.ok?n("settings.network.test.ok",{status:String(y.status??"")}):n("settings.network.test.fail",{error:y.error||""})}):null]},"manual-proxy-fields"):t.jsx("div",{className:"flex justify-end py-3",children:t.jsx("button",{type:"button",onClick:S,disabled:u,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:u?n("settings.network.saving"):n("settings.network.save")})},"non-manual-save")}),p==="saved"?t.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("settings.network.saved")}):null,p==="error"?t.jsx("p",{role:"alert",className:"py-2 text-xs text-red-600 dark:text-red-400",children:m?.unprotected?n("settings.network.save_error_unprotected",{error:m?.message||String(m||"")}):n("settings.network.save_error",{error:m?.message||String(m||"")})}):null]})}const he="/functions/tokentracker-proxy-config",xn="/functions/tokentracker-proxy-test",yn={mode:"system",protocol:"http",host:"",port:"",effective:"none",applyError:null};function me(e){return!e||typeof e.mode!="string"?null:{mode:e.mode,protocol:typeof e.protocol=="string"?e.protocol:"http",host:typeof e.host=="string"?e.host:"",port:e.port==null||e.port===0?"":String(e.port),effective:typeof e.effective=="string"?e.effective:"none",applyError:typeof e.applyError=="string"&&e.applyError.trim()?e.applyError:null}}async function vn(){const e=await fetch(he,{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!e.ok)return null;const a=await e.json().catch(()=>null);return me(a)}async function Q(){const{getLocalApiAuthHeaders:e}=await Ve(async()=>{const{getLocalApiAuthHeaders:a}=await import("./__vite-browser-external-BW1rxvYq.js").then(s=>s.dg);return{getLocalApiAuthHeaders:a}},__vite__mapDeps([0,1]));return e()}function kn(){const[e,a]=d.useState(!1),[s,i]=d.useState(!0),[o,r]=d.useState(yn);d.useEffect(()=>{if(!pt()){a(!1),i(!1);return}let u=!1;return(async()=>{try{const h=await vn();if(u)return;if(!h){a(!1),i(!1);return}r(h),a(!0),i(!1)}catch{u||(a(!1),i(!1))}})(),()=>{u=!0}},[]);const l=d.useCallback(async u=>{const h=await Q(),p=await fetch(he,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...h},cache:"no-store",body:JSON.stringify({mode:u.mode,protocol:u.protocol,host:u.host,port:u.port===""?0:Number(u.port)})}),g=await p.json().catch(()=>null);if(!p.ok){const v=g&&typeof g.error=="string"?g.error:`HTTP ${p.status}`;throw new Error(v)}const m=me(g);if(m&&r(m),g&&g.ok===!1){const v=g&&typeof g.applyError=="string"&&g.applyError||g&&typeof g.error=="string"&&g.error||`HTTP ${p.status}`,k=new Error(v);throw g.unprotected===!0&&(k.unprotected=!0),k}return m||g},[]),c=d.useCallback(async u=>{const h=await Q(),p=await fetch(xn,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...h},cache:"no-store",body:JSON.stringify({protocol:u.protocol,host:u.host,port:u.port===""?0:Number(u.port)})}),g=await p.json().catch(()=>null);if(!g||typeof g.ok!="boolean")throw new Error(g&&typeof g.error=="string"?g.error:`HTTP ${p.status}`);return g},[]);return{available:e,loading:s,config:o,save:l,testConnection:c}}const C={APPEARANCE:"appearance",NATIVE_APP:"native-app",NETWORK:"network",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"},A={PERSONAL:"personal",APP:"app",DEVELOPER:"developer"};function jn({prefs:e}){return t.jsx(T,{options:[{value:Z.USED,label:n("limits.settings.display_mode_used")},{value:Z.REMAINING,label:n("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function qn(){const e=ot(),{available:a,settings:s,setSetting:i}=R(),o=kn(),{available:r}=o,l=s?.toastOnReset!==!1,c=s?.confettiOnReset!==!1,u=ne()||s?.platform==="windows",[h,p]=Be(),g=ze(),m=h.get("section"),k=Object.values(C).includes(m)&&(m!==C.NATIVE_APP||a)&&(m!==C.NETWORK||r)?m:C.APPEARANCE,P=f=>{const S=new URLSearchParams(h);f===C.APPEARANCE?S.delete("section"):S.set("section",f),p(S,{replace:!0})},y=[{id:C.APPEARANCE,label:n("settings.section.appearance"),description:n("settings.section.appearance.description"),group:A.PERSONAL,Icon:wt,content:t.jsx(un,{})},...a?[{id:C.NATIVE_APP,label:n("settings.section.menubar"),description:n("settings.section.menubar.description"),group:A.APP,Icon:te,content:t.jsx(gn,{})}]:[],...r?[{id:C.NETWORK,label:n("settings.section.network"),description:n("settings.section.network.description"),group:A.APP,Icon:Ke,content:t.jsx(fn,{proxySettings:o})}]:[],{id:C.ACCOUNT,label:n("settings.section.account"),description:n("settings.section.account.description"),group:A.PERSONAL,Icon:Nt,content:t.jsx(Yt,{})},{id:C.LIMITS,label:n("settings.section.limits"),description:n("settings.section.limits.description"),group:A.APP,Icon:qe,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(O,{title:n("settings.section.limits"),children:[t.jsx(b,{label:n("limits.settings.display_mode_label"),control:t.jsx(jn,{prefs:e})}),u?null:t.jsxs(t.Fragment,{children:[t.jsx(b,{label:n("settings.menubar.toastOnReset"),hint:n("settings.menubar.toastOnResetHint"),control:t.jsx(j,{checked:l,disabled:!a,onChange:()=>i("toastOnReset",!l),ariaLabel:n("settings.menubar.toastOnReset")})}),t.jsx(b,{label:n("settings.menubar.confettiOnReset"),hint:n("settings.menubar.confettiOnResetHint"),control:t.jsx(j,{checked:c,disabled:!a,onChange:()=>i("confettiOnReset",!c),ariaLabel:n("settings.menubar.confettiOnReset")})})]}),t.jsx(b,{label:n("settings.limits.showSubscriptions"),hint:n("settings.limits.showSubscriptionsHint"),control:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{type:"button",onClick:()=>g("/limits?openSubscriptions=1"),"aria-label":n("limits.page.openSubscriptions"),title:n("limits.page.openSubscriptions"),className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(We,{size:14,"aria-hidden":!0})}),t.jsx(j,{checked:e.showSubscriptions!==!1,onChange:()=>e.setShowSubscriptions(!e.showSubscriptions),ariaLabel:n("settings.limits.showSubscriptions")})]})})]}),t.jsx(O,{title:n("settings.limits.providers"),children:t.jsx(Pt,{prefs:e})})]})},{id:C.LABS,label:n("settings.section.labs"),description:n("settings.section.labs.description"),group:A.DEVELOPER,Icon:vt,content:t.jsx(dn,{})}],w=[{id:A.PERSONAL,label:n("settings.nav.group.personal")},{id:A.APP,label:n("settings.nav.group.app")},{id:A.DEVELOPER,label:n("settings.nav.group.developer")}].map(f=>({...f,sections:y.filter(S=>S.group===f.id)})).filter(f=>f.sections.length>0);let N=y[0];for(const f of y)if(f.id===k){N=f;break}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 w-full max-w-5xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-7 max-w-2xl",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("settings.page.subtitle")})]}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[14rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 rounded-xl border border-oai-gray-200 bg-oai-gray-50/70 p-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 md:border-0 md:bg-transparent md:p-0 md:dark:bg-transparent",children:t.jsx("nav",{"aria-label":n("settings.page.title"),className:"flex gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-4 md:overflow-visible",children:w.map(({id:f,label:S,sections:L})=>t.jsxs("div",{className:"flex shrink-0 gap-1 md:block",children:[t.jsx("div",{className:"hidden px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-oai-gray-400 dark:text-oai-gray-500 md:block",children:S}),t.jsx("div",{className:"flex gap-1 md:flex-col",children:L.map(({id:x,label:E,Icon:D})=>{const G=k===x;return t.jsxs("button",{id:`settings-nav-${x}`,type:"button","aria-current":G?"page":void 0,"aria-controls":`settings-panel-${x}`,onClick:()=>P(x),className:_("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",G?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[t.jsx(D,{className:_("h-4 w-4 shrink-0",G?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:E})]},x)})})]},f))})}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-4 border-b border-oai-gray-200 pb-4 dark:border-oai-gray-800",children:[t.jsx("h2",{className:"text-xl font-semibold tracking-tight text-oai-black dark:text-white",children:N.label}),t.jsx("p",{className:"mt-1 text-sm leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:N.description})]}),y.map(({id:f,label:S,content:L})=>t.jsx("section",{id:`settings-panel-${f}`,"aria-labelledby":`settings-nav-${f}`,"aria-label":S,"data-settings-panel":f,hidden:k!==f,children:L},f)),t.jsx(hn,{})]})]})]})})})}export{qn as SettingsPage};