tokentracker-cli 1.3.5 → 1.3.7

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 (123) hide show
  1. package/THIRD_PARTY_NOTICES.md +39 -0
  2. package/dashboard/dist/THIRD_PARTY_NOTICES.txt +39 -0
  3. package/dashboard/dist/assets/{AchievementBadge-Dazs3pEa.js → AchievementBadge-B6Ys-Iv6.js} +1 -1
  4. package/dashboard/dist/assets/{AchievementsPage-LWnxZvmw.js → AchievementsPage-C7EJYb05.js} +2 -2
  5. package/dashboard/dist/assets/{AchievementsSection-BLqczmU9.js → AchievementsSection-KjJeaWDP.js} +1 -1
  6. package/dashboard/dist/assets/{BadgeDetailModal-B_n4aj2S.js → BadgeDetailModal-BdoapwT5.js} +1 -1
  7. package/dashboard/dist/assets/{BotAnimated-KDWI_YcZ.js → BotAnimated-coLP7eiI.js} +1 -1
  8. package/dashboard/dist/assets/{Card-BYoxd4OC.js → Card-CMShFKqX.js} +1 -1
  9. package/dashboard/dist/assets/{CloudCheckoutPage-BR2_B03P.js → CloudCheckoutPage-DQ16a4Ui.js} +1 -1
  10. package/dashboard/dist/assets/CloudPage-D1PEMzr2.js +2 -0
  11. package/dashboard/dist/assets/{CloudUsageExport-C_DqZKo1.js → CloudUsageExport-Dn7_qVGy.js} +1 -1
  12. package/dashboard/dist/assets/{CommandPalette-DkCaIQI4.js → CommandPalette-t3sXFKqr.js} +1 -1
  13. package/dashboard/dist/assets/{CommunityStatsModal-pX9OePi4.js → CommunityStatsModal-DHyreMHY.js} +1 -1
  14. package/dashboard/dist/assets/{ConfirmModal-tkgZwz4u.js → ConfirmModal-DiguIoDY.js} +1 -1
  15. package/dashboard/dist/assets/{Controls-MTUhGWy8.js → Controls-D6267L_q.js} +1 -1
  16. package/dashboard/dist/assets/{DashboardPage-SOx-A7lH.js → DashboardPage-0xC6i2rZ.js} +1 -1
  17. package/dashboard/dist/assets/{DateRangePopover-B-BMOm3O.js → DateRangePopover-CVZTfOUX.js} +1 -1
  18. package/dashboard/dist/assets/{DevicePage-DSK9lm7v.js → DevicePage-BagH0rTy.js} +1 -1
  19. package/dashboard/dist/assets/{DialogClose-uVUNu4rg.js → DialogClose-IWs31AbB.js} +1 -1
  20. package/dashboard/dist/assets/DialogDescription-JwE-wyWI.js +1 -0
  21. package/dashboard/dist/assets/{DialogTitle-B-VifiA3.js → DialogTitle-CI8xcLkd.js} +1 -1
  22. package/dashboard/dist/assets/ElectricLogo-CakZnEiu.js +282 -0
  23. package/dashboard/dist/assets/ElectricLogo-D0wiAojj.css +1 -0
  24. package/dashboard/dist/assets/{FadeIn-B6lrj4uo.js → FadeIn-BJiqknMG.js} +1 -1
  25. package/dashboard/dist/assets/{HeaderGithubStar-Cx5zOhXa.js → HeaderGithubStar-Bo6VoGCl.js} +1 -1
  26. package/dashboard/dist/assets/{HoverTooltip-DY1ENf69.js → HoverTooltip-DjJmYzbc.js} +1 -1
  27. package/dashboard/dist/assets/{IpCheckPage-D6TEq64d.js → IpCheckPage-Cp2ELhP8.js} +1 -1
  28. package/dashboard/dist/assets/{LandingPage-OdZUfq--.js → LandingPage-gvBFMTKh.js} +2 -2
  29. package/dashboard/dist/assets/{LeaderboardPage-DCK5xcAt.js → LeaderboardPage-CbWwclwl.js} +2 -2
  30. package/dashboard/dist/assets/{LeaderboardProBadge-CBXJ1u_m.js → LeaderboardProBadge-QK4hLmn1.js} +1 -1
  31. package/dashboard/dist/assets/{LeaderboardProfileModal-Ccdzb7QK.js → LeaderboardProfileModal-DuggTNlv.js} +3 -3
  32. package/dashboard/dist/assets/{LeaderboardProfilePage-CFXlZ0fL.js → LeaderboardProfilePage-CZZAm33s.js} +1 -1
  33. package/dashboard/dist/assets/{LimitsPage-5krjm-g9.js → LimitsPage-DJkws70g.js} +1 -1
  34. package/dashboard/dist/assets/{LocalOnlyNotice-Rk1B8PaZ.js → LocalOnlyNotice-Cf9NPAL1.js} +1 -1
  35. package/dashboard/dist/assets/{LoginCard-DTTIm8vk.js → LoginCard-s3qsEOET.js} +1 -1
  36. package/dashboard/dist/assets/{LoginModal-BNcDdjfr.js → LoginModal-BTLHl4eP.js} +1 -1
  37. package/dashboard/dist/assets/{LoginPage-CQgXP7Ee.js → LoginPage-DDqQpy85.js} +1 -1
  38. package/dashboard/dist/assets/{PetPage-Cw_kAPRs.js → PetPage-D4P5yDL8.js} +1 -1
  39. package/dashboard/dist/assets/{PopoverPopup-NYiGE8A2.js → PopoverPopup-B_fwRpm_.js} +1 -1
  40. package/dashboard/dist/assets/{ProviderIcon-Bp7iFJ_m.js → ProviderIcon-B1oef_V8.js} +1 -1
  41. package/dashboard/dist/assets/{ResetPasswordPage-Cf9kAWDW.js → ResetPasswordPage-BduujSou.js} +1 -1
  42. package/dashboard/dist/assets/{Select-kIcvQFAo.js → Select-ClkKzKsi.js} +1 -1
  43. package/dashboard/dist/assets/{SelectItemText-BpIsAg3b.js → SelectItemText-D_4VNKEi.js} +1 -1
  44. package/dashboard/dist/assets/{SelfHostPage-Ch2vvSwI.js → SelfHostPage-CDNLHmOx.js} +1 -1
  45. package/dashboard/dist/assets/{ServiceStatusPage-hoYBvGbu.js → ServiceStatusPage-V1exv7gK.js} +1 -1
  46. package/dashboard/dist/assets/{SessionsPage-BzRB6q-Z.js → SessionsPage-BR5gBSc1.js} +2 -2
  47. package/dashboard/dist/assets/SettingsPage-LJJCS1G0.js +2 -0
  48. package/dashboard/dist/assets/{SkillsPage-CkqThTZL.js → SkillsPage-D0oeWRew.js} +1 -1
  49. package/dashboard/dist/assets/{TokenGalaxy-eLG-UIZY.js → TokenGalaxy-h5USfWnF.js} +1 -1
  50. package/dashboard/dist/assets/{TooltipPopup-bnMJyilQ.js → TooltipPopup-1KxZ_iHu.js} +1 -1
  51. package/dashboard/dist/assets/{TrendMonitor-X7-aGzIv.js → TrendMonitor-gMTrGZzH.js} +1 -1
  52. package/dashboard/dist/assets/{WidgetsPage-CGznIzrW.js → WidgetsPage-xghIyvm_.js} +1 -1
  53. package/dashboard/dist/assets/{WrappedPage-p31-uUoF.js → WrappedPage-O4zzP87x.js} +1 -1
  54. package/dashboard/dist/assets/__vite-browser-external-DKVGjnxf.js +45 -0
  55. package/dashboard/dist/assets/__vite-browser-external-DvNSoTb8.css +1 -0
  56. package/dashboard/dist/assets/{agent-logos-2TVT3fIE.js → agent-logos-CyXPIQ5S.js} +1 -1
  57. package/dashboard/dist/assets/{arrow-left-DL0hAp_7.js → arrow-left-BqMZ7dgK.js} +1 -1
  58. package/dashboard/dist/assets/{arrow-right-DFCpnV_9.js → arrow-right-D2cfRUf2.js} +1 -1
  59. package/dashboard/dist/assets/{arrow-up-right-DLvfE0Wu.js → arrow-up-right-DSJpQHMH.js} +1 -1
  60. package/dashboard/dist/assets/{calendar-days-B0aDoKSG.js → calendar-days-Cpu5CPAM.js} +1 -1
  61. package/dashboard/dist/assets/{check-C_cfrxiz.js → check-BTSG8HIW.js} +1 -1
  62. package/dashboard/dist/assets/{chevron-down-Ck8ml43e.js → chevron-down-0nuZGQbD.js} +1 -1
  63. package/dashboard/dist/assets/{cloud-checkout-PYnwNfdH.js → cloud-checkout-Jv0vhd5v.js} +1 -1
  64. package/dashboard/dist/assets/{composite-INW-ELWX.js → composite-_t6vz49X.js} +1 -1
  65. package/dashboard/dist/assets/{download-B7uokeIo.js → download-CzxvhDR9.js} +1 -1
  66. package/dashboard/dist/assets/{external-link-CI3crg4K.js → external-link-BwKhoPLM.js} +1 -1
  67. package/dashboard/dist/assets/{flame-DCzvFKV1.js → flame-Bni4FlSO.js} +1 -1
  68. package/dashboard/dist/assets/{format-tokens-CSTEYK2m.js → format-tokens-BLPhLm4w.js} +1 -1
  69. package/dashboard/dist/assets/{gift-dEHDFMc6.js → gift-lj3smodH.js} +1 -1
  70. package/dashboard/dist/assets/{host-mode-r2SW9Mdv.js → host-mode-DluVCV7W.js} +1 -1
  71. package/dashboard/dist/assets/{icons-q-3zvEkh.js → icons-BThVE2Zq.js} +1 -1
  72. package/dashboard/dist/assets/{index-CyHYj9XI.js → index-CETYrL7R.js} +1 -1
  73. package/dashboard/dist/assets/{index-BbrsgHf4.js → index-CarMa6Pv.js} +1 -1
  74. package/dashboard/dist/assets/{index-BV7qwUw4.js → index-D_ERbEBI.js} +1 -1
  75. package/dashboard/dist/assets/{info-BBdY9hV4.js → info-DSgWF_40.js} +1 -1
  76. package/dashboard/dist/assets/{link-2-CLPePfXs.js → link-2-C7H_UH8Q.js} +1 -1
  77. package/dashboard/dist/assets/{loader-circle-ETrjzfmn.js → loader-circle-B2ln5DKm.js} +1 -1
  78. package/dashboard/dist/assets/{modifiers.esm-DHqnp2ol.js → modifiers.esm-DHEGy9eE.js} +1 -1
  79. package/dashboard/dist/assets/{monitor-smartphone-D1kdzrdb.js → monitor-smartphone-BI3aJPNi.js} +1 -1
  80. package/dashboard/dist/assets/{play-Cxp-ronD.js → play-CVxzAkNo.js} +1 -1
  81. package/dashboard/dist/assets/{plus-4n94VzDK.js → plus-UGoZah-U.js} +1 -1
  82. package/dashboard/dist/assets/{provider-display-CRlbeO7t.js → provider-display-C-ibpm5u.js} +1 -1
  83. package/dashboard/dist/assets/{react-DlHjGQFN.js → react-_bbDNdaT.js} +1 -1
  84. package/dashboard/dist/assets/{safePolygon-CVZ27a2_.js → safePolygon-DeLf2a7a.js} +1 -1
  85. package/dashboard/dist/assets/{search-BDPr56_h.js → search-BzL7DvcZ.js} +1 -1
  86. package/dashboard/dist/assets/{server-Bm7fHvVa.js → server-BsilXoLs.js} +1 -1
  87. package/dashboard/dist/assets/{shield-check-DtT8ACzI.js → shield-check-Dx8cSMB0.js} +1 -1
  88. package/dashboard/dist/assets/{skills-api-Dc1-2qu6.js → skills-api-CnOpyIPR.js} +1 -1
  89. package/dashboard/dist/assets/{sortable.esm-B-qN-Xk2.js → sortable.esm-DrIfxJ2p.js} +1 -1
  90. package/dashboard/dist/assets/{store-gHeBU8dQ.js → store-CjkDYjXp.js} +1 -1
  91. package/dashboard/dist/assets/{terminal-D4VZbvhg.js → terminal-CExBqXDx.js} +1 -1
  92. package/dashboard/dist/assets/{trash-BZtLAFQy.js → trash-DSHRpaMy.js} +1 -1
  93. package/dashboard/dist/assets/{use-community-stats-BdqndrbB.js → use-community-stats-B1W63PCE.js} +1 -1
  94. package/dashboard/dist/assets/{use-latest-request-guard-DhGg1cDS.js → use-latest-request-guard-8-lur0NI.js} +1 -1
  95. package/dashboard/dist/assets/{use-limits-display-prefs-D3HOcRFv.js → use-limits-display-prefs-Dq0e_5PV.js} +1 -1
  96. package/dashboard/dist/assets/{use-native-settings-BniKwA_n.js → use-native-settings-CkPyWn4W.js} +1 -1
  97. package/dashboard/dist/assets/{use-ordered-list-b09H7EHq.js → use-ordered-list-Cul7GZDv.js} +1 -1
  98. package/dashboard/dist/assets/{use-pet-settings-CPZdlq_e.js → use-pet-settings-DkNURWe6.js} +2 -2
  99. package/dashboard/dist/assets/use-reduced-motion-CkHJN2uY.js +1 -0
  100. package/dashboard/dist/assets/{use-transform-CIdxjmI8.js → use-transform-DzUhSbxH.js} +1 -1
  101. package/dashboard/dist/assets/{use-usage-limits-eJlU65yY.js → use-usage-limits-3ZkgTe7n.js} +1 -1
  102. package/dashboard/dist/assets/{useCurrency-CM22CmAq.js → useCurrency-EbqxSlEF.js} +1 -1
  103. package/dashboard/dist/assets/{usePositioner-B3l2ulTw.js → usePositioner-cTX1WPQP.js} +1 -1
  104. package/dashboard/dist/assets/{useTokenFormat-D7nzgxKw.js → useTokenFormat-CanmWK4w.js} +1 -1
  105. package/dashboard/dist/assets/{zap-Daxct1WV.js → zap-DQHYg9o6.js} +1 -1
  106. package/dashboard/dist/index.html +2 -2
  107. package/dashboard/dist/ip-check.html +2 -2
  108. package/dashboard/dist/leaderboard.html +2 -2
  109. package/dashboard/dist/share.html +2 -2
  110. package/dashboard/dist/token-tracker-bolt-outline.svg +3 -0
  111. package/dashboard/dist/token-tracker-bolt.svg +3 -0
  112. package/package.json +1 -1
  113. package/src/cli.js +1 -1
  114. package/src/lib/pricing/seed-snapshot.json +1 -1
  115. package/src/lib/rollout.js +49 -16
  116. package/src/lib/session-analytics.js +546 -52
  117. package/src/lib/session-performance.js +24 -1
  118. package/dashboard/dist/assets/CloudPage-DL5RkJKK.js +0 -1
  119. package/dashboard/dist/assets/DialogDescription-DBqGGWNj.js +0 -1
  120. package/dashboard/dist/assets/SettingsPage-DRl2uX-i.js +0 -2
  121. package/dashboard/dist/assets/__vite-browser-external-2g_4s3ot.js +0 -45
  122. package/dashboard/dist/assets/__vite-browser-external-LpFw4zXh.css +0 -1
  123. package/dashboard/dist/assets/use-reduced-motion-D1gcKJUo.js +0 -1
@@ -1 +1 @@
1
- import{r as p,J as S,j as e,y as h}from"./__vite-browser-external-2g_4s3ot.js";import{C as v}from"./chevron-down-Ck8ml43e.js";import{C as w}from"./check-C_cfrxiz.js";import{u as k,a as j,b as N,L as C,s as R,S as E,c as I,d as T,e as L,f as P,g as A,h as O,i as _,j as D}from"./SelectItemText-BpIsAg3b.js";const G=p.forwardRef(function(t,s){const{render:i,className:x,style:o,...l}=t,r=k(),{multiple:n,readOnly:c}=j(),{alignItemWithTriggerActive:d}=N(),g=r.useState("hasScrollArrows"),a=r.useState("openMethod"),u={id:`${r.useState("id")}-list`,role:"listbox","aria-multiselectable":n||void 0,"aria-readonly":c||void 0,onScroll(f){r.context.scrollHandlerRef.current?.(f.currentTarget)},...d&&{style:C},className:g&&a!=="touch"?R.className:void 0},y=r.useStateSetter("listElement");return S("div",t,{ref:[s,y],props:[u,l]})}),M="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function H({value:m,onValueChange:t,options:s=[],ariaLabel:i,id:x,disabled:o=!1,leadingIcon:l=null,className:r="",popupClassName:n="",align:c="start",matchTriggerWidth:d=!1}){const g=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:m,items:g,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(I,{id:x,"aria-label":i,className:h(M,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l,e.jsx(T,{className:"truncate"})]}),e.jsx(v,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:c,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(A,{className:h("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",d&&"min-w-[var(--anchor-width)]",n),children:e.jsx(G,{role:"listbox","aria-label":i,children:s.map(a=>e.jsxs(O,{value:a.value,disabled:a.disabled,className:({selected:b,disabled:u})=>h("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",b?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",u&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(_,{children:e.jsx(w,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(D,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};
1
+ import{r as p,J as S,j as e,y as h}from"./__vite-browser-external-DKVGjnxf.js";import{C as v}from"./chevron-down-0nuZGQbD.js";import{C as w}from"./check-BTSG8HIW.js";import{u as k,a as j,b as N,L as C,s as R,S as E,c as I,d as T,e as L,f as P,g as A,h as O,i as _,j as D}from"./SelectItemText-D_4VNKEi.js";const G=p.forwardRef(function(t,s){const{render:i,className:x,style:o,...l}=t,r=k(),{multiple:n,readOnly:c}=j(),{alignItemWithTriggerActive:d}=N(),g=r.useState("hasScrollArrows"),a=r.useState("openMethod"),u={id:`${r.useState("id")}-list`,role:"listbox","aria-multiselectable":n||void 0,"aria-readonly":c||void 0,onScroll(f){r.context.scrollHandlerRef.current?.(f.currentTarget)},...d&&{style:C},className:g&&a!=="touch"?R.className:void 0},y=r.useStateSetter("listElement");return S("div",t,{ref:[s,y],props:[u,l]})}),M="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function H({value:m,onValueChange:t,options:s=[],ariaLabel:i,id:x,disabled:o=!1,leadingIcon:l=null,className:r="",popupClassName:n="",align:c="start",matchTriggerWidth:d=!1}){const g=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:m,items:g,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(I,{id:x,"aria-label":i,className:h(M,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l,e.jsx(T,{className:"truncate"})]}),e.jsx(v,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:c,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(A,{className:h("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",d&&"min-w-[var(--anchor-width)]",n),children:e.jsx(G,{role:"listbox","aria-label":i,children:s.map(a=>e.jsxs(O,{value:a.value,disabled:a.disabled,className:({selected:b,disabled:u})=>h("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",b?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",u&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(_,{children:e.jsx(w,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(D,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};
@@ -1 +1 @@
1
- import{by as En,r as o,d2 as st,a$ as $e,b7 as zt,c9 as wn,K as Ge,N as pe,c$ as vn,aY as ke,b1 as K,b2 as Mn,d3 as Yt,d0 as Pn,b0 as Y,dg as Dt,dh as mt,di as kt,c7 as ht,b3 as Ne,ba as Ee,dj as Nt,bO as Ht,dk as Je,bB as $t,c5 as Gt,dl as ct,dm as ut,dn as Xt,dp as Tt,da as On,dq as An,dr as bt,df as Ln,bi as He,aW as te,j as ae,bN as Et,cb as yt,cg as Vn,ci as Fn,cj as Dn,c3 as it,bx as kn,d5 as Nn,bR as rt,cZ as Hn,M as Jt,J as _e,ds as _n,bJ as Un,dt as Bn,bM as Wn,b5 as jn,du as qn,cf as Zt,dv as xt}from"./__vite-browser-external-2g_4s3ot.js";import{i as St,E as Qt,b as en,F as Kn,P as zn,c as Oe,a as Yn,G as $n,H as Ie,J as tn,B as Gn,u as Xn,D as nn,o as Jn,x as Zn,q as Qn,I as er,w as tr,z as nr,C as rr}from"./composite-INW-ELWX.js";import{u as or,a as sr,b as ir,p as lr,r as cr,g as ur}from"./usePositioner-B3l2ulTw.js";function ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function ar(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:f=0,reason:c=En}=t,y="rootStore"in e?e.rootStore:e,b=y.context.dataRef,x=o.useRef(void 0),w=st(),m=$e(),V=o.useMemo(()=>{function v(d,_,T,p){const a=pe(c,_,T);d&&p==="touch"&&f>0?m.start(f,()=>{y.setOpen(!0,a)}):y.setOpen(d,a)}function C(d,_,T){const p=b.current.openEvent,a=y.select("domReferenceElement")!==_;return d&&a||!d||!s?!0:p&&l?!T(p.type):!1}return{onPointerDown(d){x.current=St(d.pointerType,!0)&&Qt(d.nativeEvent)?"virtual":d.pointerType},onMouseDown(d){const _=x.current,T=d.nativeEvent,p=y.select("open");if(d.button!==0||r==="click"||St(_,!0)&&i)return;const a=C(p,d.currentTarget,S=>S==="click"||S==="mousedown"),O=zt(T);if(wn(O)){v(a,T,O,_);return}const h=d.currentTarget;w.request(()=>{v(a,T,h,_)})},onClick(d){if(r==="mousedown-only")return;const _=x.current;if(r==="mousedown"&&_){x.current=void 0;return}if(St(_,!0)&&i)return;const T=y.select("open"),p=C(T,d.currentTarget,a=>a==="click"||a==="mousedown"||a==="keydown"||a==="keyup");v(p,d.nativeEvent,d.currentTarget,_)},onKeyDown(){x.current=void 0}}},[b,r,i,c,y,l,s,w,m,f]);return o.useMemo(()=>n?{reference:V}:Ge,[n,V])}function fr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=vn(),i=en()!=null,l=ke(()=>new Kn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new zn,floatingId:s,syncOnly:!1,nested:i})).current;return K(()=>{const f={open:t,floatingId:s};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=Mn(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),l.update(f)},[t,s,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}const dr="Escape";function _t(e){return Gt&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ze(e,t){return at(t,e===Xt||e===Tt,e===ct||e===ut)}function Rt(e,t,n){return at(t,e===Tt,n?e===ct:e===ut)||e==="Enter"||e===" "||e===""}function pr(e,t,n){return at(t,n?e===ct:e===ut,e===Tt)}function gr(e,t,n,r){const s=n?e===ut:e===ct,i=e===Xt;return t==="both"||t==="horizontal"&&r?e===dr:at(t,s,i)}function mr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:f=!1,loopFocus:c=!1,nested:y=!1,rtl:b=!1,virtual:x=!1,focusItemOnOpen:w="auto",focusItemOnHover:m=!0,openOnArrowKeyDown:V=!0,disabledIndices:v=void 0,orientation:C="vertical",parentOrientation:d,id:_,resetOnPointerLeave:T=!0,externalTree:p,grid:a}=t,O=a!=null,h="rootStore"in e?e.rootStore:e,S=h.useState("open"),H=h.useState("floatingElement"),D=h.useState("domReferenceElement"),G=h.context.dataRef,$=Yt(H),R=Pn(D),F=Oe($),z=en(),J=Yn(p),q=o.useRef(w),M=o.useRef(l??-1),U=o.useRef(null),g=o.useRef(!0),E=Y(u=>{s(M.current===-1?null:M.current,u)}),A=o.useRef(!!H),L=o.useRef(S),k=o.useRef(!1),X=o.useRef(!1),ne=o.useRef(null),re=Oe(v),se=Oe(S),le=Oe(l),oe=Oe(T),fe=st(),B=st(),j=Y(()=>{function u(N){x?J?.events.emit("virtualfocus",N):ne.current=$n(N,{sync:k.current,preventScroll:!0})}const I=n.current[M.current],Q=X.current;I&&u(I),(k.current?N=>N():N=>fe.request(N))(()=>{const N=n.current[M.current]||I;if(!N)return;I||u(N),ue&&(Q||!g.current)&&N.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{G.current.orientation=C},[G,C]),K(()=>{i&&(S&&H?(M.current=l??-1,q.current&&l!=null&&(X.current=!0,E())):A.current&&(M.current=-1,E()))},[i,S,H,l,E]),K(()=>{if(i){if(!S){k.current=!1;return}if(H)if(r==null){if(k.current=!1,le.current!=null)return;if(A.current&&(M.current=-1,j()),(!L.current||!A.current)&&q.current&&(U.current!=null||q.current===!0&&U.current==null)){let u=0;const I=()=>{n.current[0]==null?(u<2&&(u?P=>B.request(P):queueMicrotask)(I),u+=1):(M.current=U.current==null||Rt(U.current,C,b)||y?mt(n):kt(n),U.current=null,E())};I()}}else Dt(n.current,r)||(M.current=r,j(),X.current=!1)}},[i,S,H,r,le,y,n,C,b,E,j,B]),K(()=>{if(!i||H||!J||x||!A.current)return;const u=J.nodesRef.current,I=u.find(N=>N.id===z)?.context?.elements.floating,Q=ht(Ne(D??I??null)),P=u.some(N=>N.context&&Ee(N.context.elements.floating,Q));I&&!P&&g.current&&I.focus({preventScroll:!0})},[i,H,D,J,z,x]),K(()=>{L.current=S,A.current=!!H}),K(()=>{S||(U.current=null,q.current=w)},[S,w]);const ce=r!=null,Z=Y(u=>{if(!se.current)return;const I=n.current.indexOf(u.currentTarget);I!==-1&&(M.current!==I||r!==I)&&(M.current=I,E(u))}),ge=Y(()=>d??J?.nodesRef.current.find(u=>u.id===z)?.context?.dataRef?.current.orientation),xe=Y(()=>mt(n,re.current)),de=Y(u=>{if(g.current=!1,k.current=!0,u.which===229||!se.current&&u.currentTarget===F.current)return;if(y&&gr(u.key,C,b,O)){Ze(u.key,ge())||Ie(u),h.setOpen(!1,pe(Nt,u.nativeEvent)),Ht(D)&&(x?J?.events.emit("virtualfocus",D):D.focus());return}const I=M.current,Q=mt(n,v),P=kt(n,v);if(R||(u.key==="Home"&&(Ie(u),M.current=Q,E(u)),u.key==="End"&&(Ie(u),M.current=P,E(u))),a!=null){const N=a(u,M.current,n,C,c,b,v,Q,P);if(N!=null&&(M.current=N,E(u)),C==="both")return}if(Ze(u.key,C)){if(Ie(u),S&&!x&&ht(u.currentTarget.ownerDocument)===u.currentTarget){M.current=Rt(u.key,C,b)?Q:P,E(u);return}Rt(u.key,C,b)?c?I>=P?f&&I!==n.current.length?M.current=-1:(k.current=!1,M.current=Q):M.current=Je(n.current,{startingIndex:I,disabledIndices:v}):M.current=Math.min(P,Je(n.current,{startingIndex:I,disabledIndices:v})):c?I<=Q?f&&I!==-1?M.current=n.current.length:(k.current=!1,M.current=P):M.current=Je(n.current,{startingIndex:I,decrement:!0,disabledIndices:v}):M.current=Math.max(Q,Je(n.current,{startingIndex:I,decrement:!0,disabledIndices:v})),Dt(n.current,M.current)&&(M.current=-1),E(u)}}),ue=o.useMemo(()=>({onFocus(I){k.current=!0,Z(I)},onClick:({currentTarget:I})=>I.focus({preventScroll:!0}),onMouseMove(I){_t(I)||(k.current=!0,X.current=!1,m&&Z(I))},onPointerLeave(I){if(!se.current||!g.current||I.pointerType==="touch")return;k.current=!0;const Q=I.relatedTarget;if(!(!m||n.current.includes(Q))&&oe.current&&(ne.current?.(),ne.current=null,M.current=-1,E(I),!x)){const P=F.current,N=ht(Ne(P));P&&Ee(P,N)&&P.focus({preventScroll:!0})}}}),[Z,se,F,m,n,E,oe,x]),me=o.useMemo(()=>x&&S&&ce&&{"aria-activedescendant":`${_}-${r}`},[x,S,ce,_,r]),Se=o.useMemo(()=>({...R?{}:me,onKeyDown(u){if(u.key==="Tab"&&u.shiftKey&&S&&!x){const I=zt(u.nativeEvent);if(I&&!Ee(F.current,I))return;Ie(u),h.setOpen(!1,pe($t,u.nativeEvent)),Ht(D)&&D.focus();return}de(u)},onPointerMove(u){_t(u)||(g.current=!0)}}),[me,de,F,R,h,S,x,D]),ee=o.useMemo(()=>{function u(P){h.setOpen(!0,pe(Nt,P.nativeEvent,P.currentTarget))}function I(P){w==="auto"&&tn(P.nativeEvent)&&(q.current=!x)}function Q(P){q.current=w,w==="auto"&&Qt(P.nativeEvent)&&(q.current=!0)}return{onKeyDown(P){const N=h.select("open");g.current=!1;const ve=P.key.startsWith("Arrow"),Me=pr(P.key,ge(),b),be=Ze(P.key,C),Re=(y?Me:be)||P.key==="Enter"||P.key.trim()==="";if(x&&N)return de(P);if(!(!N&&!V&&ve)){if(Re){const Ue=Ze(P.key,ge());U.current=y&&Ue?null:P.key}if(y){Me&&(Ie(P),N?(M.current=xe(),E(P)):u(P));return}be&&(le.current!=null&&(M.current=le.current),Ie(P),!N&&V?u(P):de(P),N&&E(P))}},onFocus(P){h.select("open")&&!x&&(M.current=-1,E(P))},onPointerDown:Q,onPointerEnter:Q,onMouseDown:I,onClick:I}},[de,w,xe,y,E,h,V,C,ge,b,le,x]),we=o.useMemo(()=>({...me,...ee}),[me,ee]);return o.useMemo(()=>i?{reference:we,floating:Se,item:ue,trigger:ee}:{},[i,we,Se,ee,ue])}function hr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:l,onTyping:f,enabled:c=!0,resetMs:y=750,selectedIndex:b=null}=t,x="rootStore"in e?e.rootStore:e,w=x.useState("open"),m=$e(),V=o.useRef(""),v=o.useRef(b??s??-1),C=o.useRef(null),d=Y(p=>{function a(F){return r?.current[F]}function O(F){const z=a(F);return z&&!On(z)||z?.matches(":disabled")?!1:l==null||!An(bt,F,l)}function h(F,z,J=0){if(F.length===0)return-1;const q=(J%F.length+F.length)%F.length,M=z.toLowerCase();for(let U=0;U<F.length;U+=1){const g=(q+U)%F.length;if(!(!F[g]?.toLowerCase().startsWith(M)||!O(g)))return g}return-1}const S=n.current;if(V.current.length>0&&p.key===" "&&(Ie(p),f?.(!0)),V.current.length>0&&V.current[0]!==" "&&h(S,V.current)===-1&&p.key!==" "&&f?.(!1),S==null||p.key.length!==1||p.ctrlKey||p.metaKey||p.altKey)return;w&&p.key!==" "&&(Ie(p),f?.(!0));const H=V.current==="";H&&(v.current=b??s??-1),S.every((F,z)=>F&&O(z)?F[0]?.toLowerCase()!==F[1]?.toLowerCase():!0)&&V.current===p.key&&(V.current="",v.current=C.current),V.current+=p.key,m.start(y,()=>{V.current="",v.current=C.current,f?.(!1)});const $=((H?b??s??-1:v.current)??0)+1,R=h(S,V.current,$);R!==-1?(i?.(R),C.current=R):p.key!==" "&&(V.current="",f?.(!1))}),_=Y(p=>{const a=p.relatedTarget,O=x.select("domReferenceElement"),h=x.select("floatingElement");Ee(O,a)||Ee(h,a)||(m.clear(),V.current="",v.current=C.current,f?.(!1))});K(()=>{!w&&b!==null||(m.clear(),C.current=null,V.current!==""&&(V.current=""))},[w,b,m]);const T=o.useMemo(()=>({onKeyDown:d,onBlur:_}),[d,_]);return o.useMemo(()=>c?{reference:T,floating:T}:{},[c,T])}function xr(e){const t=o.useRef(""),n=o.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:o.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function rn(e,t){const n=o.useRef(e),r=Y(t);K(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Sr(e,t){const n=Y((i,l)=>{(typeof e=="function"?e():e)||t(l||(Ln?"touch":""))}),{onClick:r,onPointerDown:s}=xr(n);return o.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function Rr(e){const[t,n]=o.useState(null),r=Sr(e,n);return rn(e,s=>{s&&!e&&n(null)}),o.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const br=20;function yr(e,t,n,r){const[s,i]=o.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const l=Ne(n).documentElement.clientWidth,f=n.offsetWidth;i(l>0&&f>0&&f>=l-br)},[e,t,n]),Gn(e&&(!t||s),r)}const Ir=o.createContext(void 0);function Cr(e){return o.useContext(Ir)}function Tr(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function Er(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function wr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ut({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,l]=o.useState(t),f=s&&e!==void 0?e:i,c=o.useCallback(y=>{s||l(y)},[]);return[f,c]}const on=o.createContext(void 0),sn=o.createContext(void 0),ln=o.createContext(void 0);function Le(){const e=o.useContext(on);if(e===void 0)throw new Error(He(60));return e}function wt(){const e=o.useContext(sn);if(e===void 0)throw new Error(He(101));return e}function cn(){const e=o.useContext(ln);if(e===void 0)throw new Error(He(61));return e}const vr="data-valid",Mr="data-invalid",Pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Or={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Ar={disabled:!1,...Or},Lr={valid(e){return e===null?null:e?{[vr]:""}:{[Mr]:""}}},Vr={invalid:void 0,name:void 0,validityData:{state:Pr,errors:[],error:"",value:"",initialValue:null},setValidityData:te,disabled:void 0,setTouched:te,setDirty:te,setFilled:te,setFocused:te,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Ar,registerFieldControl:te,validation:{getValidationProps:(e,t=Ge)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:te,getInputControl:()=>null,commit:async()=>{},change:te}},Fr=o.createContext(Vr);function vt(e=!0){const t=o.useContext(Fr);if(t.setValidityData===te&&!e)throw new Error(He(28));return t}function Dr(e,t,n,r,s=!0,i){const{registerFieldControl:l}=vt(),f=ke(()=>Symbol());K(()=>{const c=f.current;if(!s){l(c,void 0);return}l(c,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,l,f,n]),K(()=>{const c=f.current;return()=>{l(c,void 0)}},[l,f])}const kr=o.createContext({controlId:void 0,registerControlId:te,resetControlId:te,labelId:void 0,setLabelId:te,messageIds:[],setMessageIds:te,getDescriptionProps:e=>e});function un(){return o.useContext(kr)}function an(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=un(),l=Xn(),f=ke(()=>Symbol()),c=o.useRef(!1),y=o.useRef(!1),b=Y(()=>{!c.current||s===te||(c.current=!1,s(f.current,void 0))});return K(()=>{if(!n||s===te){b();return}let x;if(t!==void 0)y.current=!0,x=t;else if(y.current)x=l;else{i();return}if(x===void 0){b();return}c.current=!0,s(f.current,x)},[t,n,s,i,l,f,b]),K(()=>b,[b]),(n?r:void 0)??t??l}function Nr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const fn=(e,t)=>Object.is(e,t);function Ae(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Hr(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Nr(e,t,(r,s)=>Ae(r,s,n)):e!==t}function It(e,t,n){return e?e.some(r=>r===void 0?!1:Ae(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Ae(r,t,n)):-1}function _r(e,t){if(t!==fn)return r=>It(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function dn(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(_r(t,n)):ot(e,t,n);return s===-1?null:s}function Ur(e,t,n,r,s,i){return It(r,t,s)?i!=null&&e>i&&It(r,n[i],s)?i:e:e===i?dn(n,r,s,!0):i}function Br(e,t,n){return e.filter(r=>!Ae(t,r,n))}function Ct(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Wr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function pn(e){return Wr(e?.[0])}function jr(e){return pn(e)?e.flatMap(t=>t.items):e}function qr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(pn(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function gn(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 Ct(e)}function De(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ct(e.value):Ct(e)}function mn(e,t,n){function r(){return gn(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)??r();if(Array.isArray(t)){const i=jr(t);if(e==null||typeof e!="object"){const l=i.find(f=>f.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(f=>f&&f.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function Kr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ae.jsx(o.Fragment,{children:mn(s,t,n)},i)),r),[])}const zr={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:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:De(t,r)!==""},hasNullItemLabel:(e,t)=>t?qr(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,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Ae(t,s,n)):Ae(t,r,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},Yr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:te,validationMode:"onSubmit",submitCountRef:{current:0}});function $r(){return o.useContext(Yr)}const Ce=1;function hn(e,t){return Math.max(0,e-t)}function Gr(e,t){if(t<=0)return 0;const n=ze(e,0,t),r=n,s=t-n,i=r<=Ce,l=s<=Ce;return i&&l?r<=s?0:t:i?0:l?t:n}function To(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:l=!1,onOpenChange:f,name:c,form:y,autoComplete:b,disabled:x=!1,readOnly:w=!1,required:m=!1,modal:V=!0,actionsRef:v,inputRef:C,onOpenChangeComplete:d,items:_,multiple:T=!1,itemToStringLabel:p,itemToStringValue:a,isItemEqualToValue:O=fn,highlightItemOnHover:h=!0,children:S}=e,{clearErrors:H}=$r(),{setDirty:D,setTouched:G,setFocused:$,validityData:R,setFilled:F,name:z,disabled:J,validation:q,validationMode:M}=vt(),U=an({id:t}),g=J||x,E=z??c,[A,L]=Ut({controlled:n,default:T?r??bt:r,name:"Select",state:"value"}),[k,X]=Ut({controlled:i,default:l,name:"Select",state:"open"}),ne=o.useRef([]),re=o.useRef([]),se=o.useRef(null),le=o.useRef(null),oe=o.useRef(0),fe=o.useRef(null),B=o.useRef([]),j=o.useRef(!1),ce=o.useRef(null),Z=o.useRef(null),ge=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=o.useRef(!1),de=o.useRef(A),{mounted:ue,setMounted:me,transitionStatus:Se}=nn(k),{openMethod:ee,triggerProps:we}=Rr(k),u=ke(()=>new kn({id:U,labelId:void 0,modal:V,multiple:T,itemToStringLabel:p,itemToStringValue:a,isItemEqualToValue:O,value:A,open:k,mounted:ue,transitionStatus:Se,items:_,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ge,triggerProps:Ge,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:te,setOpen:te,handleScrollArrowVisibility:te,onOpenChangeComplete:te,listRef:ne,popupRef:se,scrollHandlerRef:le,scrollArrowsMountedCountRef:oe,valueRef:fe,valuesRef:B,labelsRef:re,typingRef:j,selectionRef:ge,firstItemTextRef:ce,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:xe,initialValueRef:de},zr)).current,I=u.useState("activeIndex"),Q=u.useState("selectedIndex"),P=u.useState("triggerElement"),N=u.useState("positionerElement"),ve=Tr(ee),Me=ee??ve,be=o.useMemo(()=>T?"":De(A,a),[T,A,a]),Re=o.useMemo(()=>T&&Array.isArray(A)?A.map(W=>De(W,a)):De(A,a),[T,A,a]),Ue=Oe(P),Be=Y(()=>Re);Dr(Ue,U,A,Be,!g,c);const We=T?Array.isArray(A)&&A.length>0:A!=null&&be!=="";K(()=>{F(We)},[We,F]),K(function(){const ie=dn(B.current,A,O,T);ie===null&&(Z.current=null),!k&&u.set("selectedIndex",ie)},[T,k,A,O,u]),rn(A,()=>{H(E),D(Hr(A,R.initialValue,O)),q.change(A)});const je=Y((W,ie)=>{f?.(W,ie),!ie.isCanceled&&(X(W),!W&&(ie.reason===$t||ie.reason===Nn)&&(G(!0),$(!1),M==="onBlur"&&q.commit(A)))}),Ve=Y(()=>{me(!1),u.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),d?.(!1)});Et({enabled:!v,open:k,ref:se,onComplete(){k||Ve()}}),o.useImperativeHandle(v,()=>({unmount:Ve}),[Ve]);const qe=Y((W,ie)=>{s?.(W,ie),!ie.isCanceled&&L(W)}),ft=Y(W=>{const ie=hn(W.scrollHeight,W.clientHeight),Xe=Gr(W.scrollTop,ie),dt=Xe>0,Ke=Xe<ie;u.set("scrollUpArrowVisible",dt),u.set("scrollDownArrowVisible",Ke)}),Pe=fr({open:k,onOpenChange:je,elements:{reference:P,floating:N}}),he=ar(Pe,{enabled:!g,event:"mousedown"}),ye=Jn(Pe),Te=mr(Pe,{enabled:!g,listRef:ne,activeIndex:I,selectedIndex:Q,disabledIndices:bt,onNavigate(W){W===null&&!k||u.set("activeIndex",W)},focusItemOnHover:h}),Fe=hr(Pe,{enabled:!g&&(k||!w&&!T),listRef:re,activeIndex:I,selectedIndex:Q,disabledIndices:W=>wr(ne.current[W]),onMatch(W){k?u.set("activeIndex",W):qe(B.current[W],pe(it))},onTyping(W){j.current=W}}),Pt=o.useMemo(()=>yt(Fe.reference,Te.reference,ye.reference,he.reference,we),[he.reference,Fe.reference,Te.reference,ye.reference,we]),Ot=o.useMemo(()=>yt(Zn,Fe.floating,Te.floating,ye.floating),[Fe.floating,Te.floating,ye.floating]),At=Te.item??Ge;u.useContextCallback("setValue",qe),u.useContextCallback("setOpen",je),u.useContextCallback("handleScrollArrowVisibility",ft),u.useContextCallback("onOpenChangeComplete",d),Er(()=>{u.update({popupProps:Ot,triggerProps:Pt})}),u.useSyncedValues({id:U,modal:V,multiple:T,value:A,open:k,mounted:ue,transitionStatus:Se,popupProps:Ot,triggerProps:Pt,items:_,itemToStringLabel:p,itemToStringValue:a,isItemEqualToValue:O,openMethod:Me});const yn=o.useMemo(()=>({disabled:g,readOnly:w,required:m,multiple:T,highlightItemOnHover:h,itemProps:At}),[g,w,m,T,h,At]),In=Vn(C,q.inputRef),Lt=T?void 0:E,Cn=o.useMemo(()=>!T||!Array.isArray(A)||!E?null:A.map(W=>{const ie=De(W,a);return ae.jsx("input",{type:"hidden",form:y,name:E,value:ie,disabled:g},ie)}),[T,A,y,E,a,g]);return ae.jsxs(on.Provider,{value:u,children:[ae.jsx(sn.Provider,{value:yn,children:ae.jsx(ln.Provider,{value:Pe,children:S})}),ae.jsx("input",{...q.getValidationProps(g,{onFocus(){u.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented||g||w)return;const ie=W.currentTarget.value,Xe=pe(it,W.nativeEvent);function dt(){if(T)return;const Ke=ie.toLowerCase();let pt=B.current.findIndex(gt=>De(gt,a).toLowerCase()===Ke||gn(gt,p).toLowerCase()===Ke);pt===-1&&(pt=B.current.findIndex((gt,Tn)=>{const Ft=re.current[Tn];return Ft!=null&&Ft.toLowerCase()===Ke}));const Vt=B.current[pt];Vt!=null&&qe(Vt,Xe)}u.set("forceMount",!0),queueMicrotask(dt)}}),id:U&&Lt==null?`${U}-hidden-input`:void 0,form:y,name:Lt,autoComplete:b,value:be,disabled:g,required:m&&!(T&&We),readOnly:w,ref:In,style:E?Fn:Dn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Cn]})}function Xr(e,t){return e??t}const Qe=5;function Jr(e,t){const n=Zr(t);return e.clientX>=n.left-Qe&&e.clientX<=n.right+Qe&&e.clientY>=n.top-Qe&&e.clientY<=n.bottom+Qe}function Zr(e){const t=e.getBoundingClientRect(),n=rt(e);if(Hn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,f=parseFloat(r.height)||0,c=parseFloat(s.width)||0,y=parseFloat(s.height)||0,b=Math.max(t.width,l,c),x=Math.max(t.height,f,y),w=b-t.width,m=x-t.height;return{left:t.left-w/2,right:t.right+w/2,top:t.top-m/2,bottom:t.bottom+m/2}}const Qr="data-popup-side",eo=400,to={...Qn,...Lr,popupSide:e=>e?{[Qr]:e}:null,value:()=>null},Eo=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:l=!1,nativeButton:f=!0,style:c,...y}=t,{setTouched:b,setFocused:x,validationMode:w,validation:m,state:V,disabled:v}=vt(),{labelId:C}=un(),d=Le(),{readOnly:_,required:T,disabled:p}=wt(),a=v||p||l,O=d.useState("open"),h=d.useState("mounted"),S=d.useState("value"),H=d.useState("triggerProps"),D=d.useState("positionerElement"),G=d.useState("listElement"),$=d.useState("popupSide"),R=d.useState("id"),F=d.useState("labelId"),z=d.useState("hasSelectedValue"),J=h&&D?$:null,q=i??R,M=Xr(C,F);an({id:i});const U=Oe(D),g=o.useRef(null),{getButtonProps:E,buttonRef:A}=Jt({disabled:a,native:f}),L=d.useStateSetter("triggerElement"),k=$e(),X=$e(),ne=$e();o.useEffect(()=>{if(O)return ne.start(eo,()=>{d.context.selectionRef.current.allowUnselectedMouseUp=!0,d.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};d.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[O,d,X,ne]);const re=yt(H,{id:q,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?G?.id??Yt(D)?.id:void 0,"aria-labelledby":M,"aria-readonly":_||void 0,"aria-required":T||void 0,tabIndex:a?-1:0,onFocus(oe){x(!0),O&&d.context.alignItemWithTriggerActiveRef.current&&d.context.setOpen(!1,pe(it,oe.nativeEvent)),k.start(0,()=>{d.set("forceMount",!0)})},onBlur(oe){Ee(D,oe.relatedTarget)||(b(!0),x(!1),w==="onBlur"&&m.commit(S))},onMouseDown(oe){if(O)return;const fe=Ne(oe.currentTarget);function B(j){if(!g.current)return;const ce=j.target;Ee(g.current,ce)||Ee(U.current,ce)||Jr(j,g.current)||d.context.setOpen(!1,pe(_n,j))}X.start(0,()=>{fe.addEventListener("mouseup",B,{once:!0})})}},y,E),se=m.getValidationProps(a,re);se.role="combobox";const le={...V,open:O,disabled:a,value:S,readOnly:_,popupSide:J,placeholder:!z};return _e("button",t,{ref:[n,g,A,L],state:le,stateAttributesMapping:to,props:se})}),no={value:()=>null},wo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:l,style:f,...c}=t,y=Le(),b=y.useState("value"),x=y.useState("items"),w=y.useState("itemToStringLabel"),m=y.useState("hasSelectedValue"),V=!m&&l!=null&&i==null,v=y.useState("hasNullItemLabel",V),C={value:b,placeholder:!m};let d=null;return typeof i=="function"?d=i(b):i!=null?d=i:V&&!v?d=l:Array.isArray(b)?d=Kr(b,x,w):d=mn(b,x,w),_e("span",t,{state:C,ref:[n,y.context.valueRef],props:[{children:d},c],stateAttributesMapping:no})}),vo=o.forwardRef(function(t,n){const r=Le(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ae.jsx(Un,{ref:n,...t}):null}),xn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function ro(){return o.useContext(xn)}function oo(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=Y(s),[,l]=o.useState(!1),f=ke(io).current,c=ke(so).current,y=o.useRef(0),b=o.useRef(!0),x=o.useRef(null),w=o.useRef(null),m=Y(()=>{b.current||(b.current=!0,l(a=>!a))}),V=Y((a,O)=>{c.set(a,O),m()}),v=Y(a=>{c.delete(a),m()}),C=Y(a=>{const O=new Map;return n.current.length=0,r&&(r.current.length=0),a.forEach(h=>{O.set(h.element,{...h.registration.metadata??{},index:h.index}),n.current[h.index]=h.element,r&&(r.current[h.index]=h.registration.label!==void 0?h.registration.label:h.registration.textRef?.current?.textContent??h.element.textContent)}),y.current=n.current.length,O});function d(a){if(w.current?.disconnect(),w.current=null,typeof MutationObserver!="function"||a.length<2)return;const O=new MutationObserver(S=>{if(!uo(S))return;let H=null;for(const D of a)if(D.isConnected){if(H&&Sn(H,D)>0){O.disconnect(),m();return}H=D}});w.current=O;const h=new Set;for(let S=1;S<a.length;S+=1){const H=co(a[S-1],a[S]);H&&h.add(H)}h.forEach(S=>O.observe(S,{childList:!0}))}const _=Y(()=>{const[a,O]=lo(c),h=C(a),S=x.current,H=!S||S.length!==a.length||a.some((D,G)=>{const $=S[G];return D.index!==$.index||D.element!==$.element||D.registration.index!==$.registration.index||D.registration.metadata!==$.registration.metadata});d(O),x.current=a,b.current=!1,H&&(f.forEach(D=>D(h)),i(h))});K(()=>(!b.current&&x.current&&C(x.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,C]),K(()=>{b.current&&_()}),K(()=>()=>{w.current?.disconnect(),b.current=!0},[]);const T=Y(a=>(f.add(a),()=>{f.delete(a)})),p=o.useMemo(()=>({register:V,unregister:v,subscribeMapChange:T,nextIndexRef:y}),[V,v,T,y]);return ae.jsx(xn.Provider,{value:p,children:t})}function so(){return new Map}function io(){return new Set}function lo(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const f=i.index,c={index:f??-1,element:l,registration:i};f===null?r.push(c):f>=0&&(t.add(f),n.push(c))});let s=0;return r.sort((i,l)=>Sn(i.element,l.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function co(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function uo(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 Sn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Rn=o.createContext(void 0);function ao(){const e=o.useContext(Rn);if(!e)throw new Error(He(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const fo={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},po={position:"fixed"},Mo=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:l,side:f,align:c,sideOffset:y,alignOffset:b,collisionBoundary:x="clipping-ancestors",collisionPadding:w,arrowPadding:m,sticky:V,disableAnchorTracking:v,alignItemWithTrigger:C=!0,collisionAvoidance:d=Bn,style:_,...T}=t,p=Le(),a=cn(),O=p.useState("open"),h=p.useState("mounted"),S=p.useState("modal"),H=p.useState("value"),D=p.useState("openMethod"),G=p.useState("positionerElement"),$=p.useState("triggerElement"),R=p.useState("isItemEqualToValue"),F=p.useState("transitionStatus"),z=o.useRef(null),J=o.useRef(null),[q,M]=o.useState(C),U=h&&q&&D!=="touch";!h&&q!==C&&M(C),o.useImperativeHandle(p.context.alignItemWithTriggerActiveRef,()=>U),yr((U||S)&&O,D==="touch",G,$);const g=or({anchor:r,floatingRootContext:a,positionMethod:l,mounted:h,side:f,sideOffset:y,align:c,alignOffset:b,arrowPadding:m,collisionBoundary:x,collisionPadding:w,sticky:V,disableAnchorTracking:v??U,collisionAvoidance:d,keepMounted:!0}),E=U?"none":g.side,A=U?po:g.positionerStyles,L={open:O,side:E,align:g.align,anchorHidden:g.anchorHidden};K(()=>{p.set("popupSide",g.side)},[p,g.side]);const k=p.useStateSetter("positionerElement"),X=sr(t,L,{styles:A,transitionStatus:F,props:T,refs:[n,k],hidden:!h,inert:!O}),ne=o.useRef(0),re=Y(le=>{if(p.context.valuesRef.current.length===0)return;const oe=ne.current;ne.current=le.size;const fe=pe(it);if(oe!==0&&!p.state.multiple&&H!==null&&ot(p.context.valuesRef.current,H,R)===-1){const j=p.context.initialValueRef.current,Z=j!=null&&ot(p.context.valuesRef.current,j,R)!==-1?j:null;p.context.setValue(Z,fe),Z===null&&(p.set("selectedIndex",null),p.context.selectedItemTextRef.current=null)}if(oe!==0&&p.state.multiple&&Array.isArray(H)){const B=H.filter(j=>ot(p.context.valuesRef.current,j,R)!==-1);B.length!==H.length&&(p.context.setValue(B,fe),B.length===0&&(p.set("selectedIndex",null),p.context.selectedItemTextRef.current=null))}if(O&&U){p.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const B={height:""};lt(G,B),lt(p.context.popupRef.current,B)}}),se=o.useMemo(()=>({...g,side:E,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:M,scrollUpArrowRef:z,scrollDownArrowRef:J}),[g,E,U,M]);return ae.jsx(oo,{elementsRef:p.context.listRef,labelsRef:p.context.labelsRef,onMapChange:re,children:ae.jsxs(Rn.Provider,{value:se,children:[h&&S&&ae.jsx(er,{inert:Wn(!O),cutout:$}),X]})})}),et="base-ui-disable-scrollbar",Bt={className:et,getElement(e){return ae.jsx("style",{nonce:e,href:et,precedence:"base-ui:low",children:`.${et}{scrollbar-width:none}.${et}::-webkit-scrollbar{display:none}`})}},go=o.createContext(void 0),mo={disableStyleElements:!1};function ho(){return o.useContext(go)??mo}const Wt="--transform-origin",xo={...nr,...Zt},Po=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:l,...f}=t,c=Le(),{multiple:y,readOnly:b,highlightItemOnHover:x}=wt(),w=cn(),{side:m,align:V,alignItemWithTriggerActive:v,isPositioned:C,setControlledAlignItemWithTrigger:d}=ao(),_=Cr()!=null,T=ir(),{nonce:p,disableStyleElements:a}=ho(),O=c.useState("id"),h=c.useState("open"),S=c.useState("openMethod"),H=c.useState("mounted"),D=c.useState("popupProps"),G=c.useState("transitionStatus"),$=c.useState("triggerElement"),R=c.useState("positionerElement"),F=c.useState("listElement"),z=o.useRef(!1),J=o.useRef(!1),q=o.useRef({}),M=st(),U=Y(L=>{if(!R||!c.context.popupRef.current||!J.current)return;const k=R.style.top==="0px",X=R.style.bottom==="0px";if(z.current||!v||!k&&!X){c.context.handleScrollArrowVisibility(L);return}const ne=qt(R),re=Ye(R.getBoundingClientRect().height,"y",ne),se=Ne(R),le=rt(R),oe=le.getComputedStyle(R),fe=parseFloat(oe.marginTop),B=parseFloat(oe.marginBottom),j=jt(le.getComputedStyle(c.context.popupRef.current)),ce=Math.min(se.documentElement.clientHeight-fe-B,j),Z=L.scrollTop,ge=tt(L);let xe=null;const de=ee=>{R.style.height=`${ee}px`},ue=k?ge-Z:Z,me=Math.min(re+ue,ce);if(ue<=Ce){const ee=ze(ue,0,ce-re);ee>0&&de(re+ee),L.scrollTop=k?ge:0,ce-(re+ee)<=Ce&&(z.current=!0),c.context.handleScrollArrowVisibility(L);return}if(ce-me>Ce)xe=k?1/0:0;else if(X&&Z<ge){const ee=re+ue-ce;xe=Z-(ue-ee)}const Se=Math.ceil(me);if(Se!==0&&de(Se),xe!=null){const ee=ze(xe,0,tt(L));Math.abs(L.scrollTop-ee)>Ce&&(L.scrollTop=ee)}Se>=ce-Ce&&(z.current=!0),c.context.handleScrollArrowVisibility(L)});o.useImperativeHandle(c.context.scrollHandlerRef,()=>U,[U]),Et({open:h,ref:c.context.popupRef,onComplete(){h&&c.context.onOpenChangeComplete(!0)}});const g={open:h,transitionStatus:G,side:m,align:V};K(()=>{!R||!c.context.popupRef.current||Object.keys(q.current).length||(q.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),K(()=>{h||v||(J.current=!1,z.current=!1,lt(R,q.current))},[h,v,R]),K(()=>{const L=c.context.popupRef.current;if(!h||!$||!R||!L||v&&!C||c.state.transitionStatus==="ending")return;if(J.current=!0,L.style.removeProperty(Wt),!v){M.request(()=>c.context.handleScrollArrowVisibility(F||L));return}const k=So(L);try{let X=c.context.selectedItemTextRef.current;X?.isConnected||(X=!c.select("hasSelectedValue")&&c.context.firstItemTextRef.current?.isConnected?c.context.firstItemTextRef.current:null);const ne=c.context.valueRef.current,re=rt(R),se=re.getComputedStyle(R),le=re.getComputedStyle(L),oe=Ne($),fe=qt($),B=nt($.getBoundingClientRect(),fe),j=nt(R.getBoundingClientRect(),fe),ce=B.height,Z=F||L,ge=Z.scrollHeight,xe=parseFloat(le.borderBottomWidth),de=parseFloat(se.marginTop)||10,ue=parseFloat(se.marginBottom)||10,me=parseFloat(se.minHeight)||100,Se=jt(le),ee=5,we=5,u=20,I=oe.documentElement.clientHeight-de-ue,Q=oe.documentElement.clientWidth,P=I-B.bottom+ce;let N,ve=T==="rtl"?B.right-j.width:B.left,Me=0;if(X&&ne){const he=nt(ne.getBoundingClientRect(),fe);N=nt(X.getBoundingClientRect(),fe),ve=j.left+(T==="rtl"?he.right-N.right:he.left-N.left);const ye=he.top-B.top+he.height/2;Me=N.top-j.top+N.height/2-ye}const be=P+Me+ue+xe;let Re=Math.min(I,be);const Ue=I-de-ue,Be=be-Re,We=Q-we;R.style.left=`${ze(ve,ee,We-j.width)}px`,R.style.height=`${Re}px`,R.style.maxHeight="none",R.style.marginTop=`${de}px`,R.style.marginBottom=`${ue}px`,L.style.height="100%";const je=tt(Z),Ve=Be>=je-Ce;Ve&&(Re=Math.min(I,j.height)-(Be-je));const qe=B.top<u||B.bottom>I-u||Math.ceil(Re)+Ce<Math.min(ge,me),ft=(re.visualViewport?.scale??1)!==1&&Gt;if(qe||ft){lt(R,q.current),d(!1);return}const Pe=Math.max(me,Re);if(Ve){const he=Math.max(0,I-be);R.style.top=j.height>=Ue?"0":`${he}px`,R.style.height=`${Re}px`,Z.scrollTop=tt(Z)}else R.style.bottom="0",Z.scrollTop=Be;if(N){const he=j.top,ye=j.height,Te=N.top+N.height/2,Fe=ze(ye>0?(Te-he)/ye*100:50,0,100);L.style.setProperty(Wt,`50% ${Fe}%`)}(Pe===I||Re>=Se)&&(z.current=!0),c.context.handleScrollArrowVisibility(Z),x&&c.state.selectedIndex===null&&c.state.activeIndex===null&&c.context.listRef.current[0]!=null&&c.set("activeIndex",0)}finally{k()}},[c,h,R,$,v,d,M,F,x,T,C]),o.useEffect(()=>{if(!v||!R||!h)return;const L=rt(R);function k(X){c.context.setOpen(!1,pe(qn,X))}return jn(L,"resize",k)},[c,v,R,h]);const E={...F?{role:"presentation"}:{role:"listbox","aria-multiselectable":y||void 0,"aria-readonly":b||void 0,id:`${O}-list`},onKeyDown(L){_&&rr.has(L.key)&&L.stopPropagation()},onScroll(L){F||U(L.currentTarget)},...v&&{style:F?{height:"100%"}:fo},className:!F&&v?Bt.className:void 0},A=_e("div",t,{ref:[n,c.context.popupRef],state:g,stateAttributesMapping:xo,props:[D,E,ur(G),f]});return ae.jsxs(o.Fragment,{children:[!a&&Bt.getElement(p),ae.jsx(tr,{context:w,modal:!1,disabled:!H,openInteractionType:S,returnFocus:l,restoreFocus:!0,children:A})]})});function jt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function tt(e){return hn(e.scrollHeight,e.clientHeight)}function qt(e){return lr.getScale(e)}function Ye(e,t,n){return e/n[t]}function nt(e,t){return cr({x:Ye(e.x,"x",t),y:Ye(e.y,"y",t),width:Ye(e.width,"x",t),height:Ye(e.height,"y",t)})}const Kt=[["transform","none"],["scale","1"],["translate","0 0"]];function So(e){const{style:t}=e,n={};for(const[r,s]of Kt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of Kt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function Ro(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:l,unregister:f,subscribeMapChange:c,nextIndexRef:y}=ro(),b=o.useRef(-1),[x,w]=o.useState(i==null&&t?()=>{if(b.current===-1){const C=y.current;y.current+=1,b.current=C}return b.current}:-1),m=i??x,V=o.useRef(null),v=o.useCallback(C=>{const d=V.current;d&&f(d),V.current=C,C&&l(C,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,l,f,r,n,s]);return K(()=>{if(i==null)return c(C=>{const d=V.current?C.get(V.current)?.index:null;d!=null&&w(d)})},[i,c]),{ref:v,index:m}}const bn=o.createContext(void 0);function Mt(){const e=o.useContext(bn);if(!e)throw new Error(He(57));return e}const Oo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:l=null,label:f,disabled:c=!1,nativeButton:y=!1,...b}=t,x=o.useRef(null),w=Ro({guess:!0,label:f,textRef:x}),m=Le(),{itemProps:V,multiple:v,disabled:C,readOnly:d}=wt(),_=C||c,T=m.useState("isActive",w.index),p=m.useState("open"),a=m.useState("isSelected",l),O=m.useState("isSelectedByFocus",w.index),h=m.useState("isItemEqualToValue"),S=w.index,H=o.useRef(null);K(()=>{const g=m.context.valuesRef.current;return g[S]=l,()=>{delete g[S]}},[S,l,m]),K(()=>{const g=m.state.value,E=m.state.selectedIndex;let A=E,L;v&&Array.isArray(g)?(A=Ur(S,l,m.context.valuesRef.current,g,h,E),L=A===S,S===E&&!L&&(m.context.selectedItemTextRef.current=null)):(L=g!==void 0&&Ae(l,g,h),L&&(A=S)),m.set("selectedIndex",A),L&&x.current&&(m.context.selectedItemTextRef.current=x.current)},[S,v,h,m,l]);const D=o.useRef("mouse"),G=o.useRef(!1),{getButtonProps:$,buttonRef:R}=Jt({disabled:_,focusableWhenDisabled:!0,native:y,composite:!0}),F={disabled:_,selected:a,highlighted:T};function z(g){if(C||d)return;const E=m.state.value;if(v){const A=Array.isArray(E)?E:[],L=a?Br(A,l,h):[...A,l];m.context.setValue(L,pe(xt,g))}else m.context.setValue(l,pe(xt,g)),m.context.setOpen(!1,pe(xt,g))}function J(){m.context.selectionRef.current.dragY=0}const q={role:"option","aria-selected":a,tabIndex:p&&T?0:-1,onKeyDown(g){m.set("activeIndex",S),g.key===" "&&m.context.typingRef.current&&g.preventDefault()},onClick(g){const E=D.current!=="touch",A=g.nativeEvent.pointerType,L=E&&tn(g.nativeEvent)&&(A!==void 0||T),k=E&&!L&&!G.current;G.current=!1,!(_||k)&&z(g.nativeEvent)},onPointerEnter(g){D.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const E=m.context.selectionRef.current;E.dragY+=g.movementY,E.dragY**2>=64&&(E.allowUnselectedMouseUp=!0)}},onPointerDown(g){D.current=g.pointerType,G.current=!0,J()},onMouseUp(){if(J(),_||D.current==="touch"||G.current)return;const g=!m.context.selectionRef.current.allowSelectedMouseUp&&a,E=!m.context.selectionRef.current.allowUnselectedMouseUp&&!a;g||E||(G.current=!0,H.current?.click(),G.current=!1)}},M=_e("div",t,{ref:[R,n,w.ref,H],state:F,props:[V,q,b,$]}),U=o.useMemo(()=>({selected:a,index:S,textRef:x,selectedByFocus:O}),[a,S,x,O]);return ae.jsx(bn.Provider,{value:U,children:M})})),Ao=o.forwardRef(function(t,n){const{selected:r}=Mt();return t.keepMounted||r?ae.jsx(bo,{...t,ref:n}):null}),bo=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:s,keepMounted:i,...l}=e,{selected:f}=Mt(),c=o.useRef(null),{transitionStatus:y,setMounted:b}=nn(f),w=_e("span",e,{ref:[t,c],state:{selected:f,transitionStatus:y},props:[{"aria-hidden":!0,children:"✔️"},l],stateAttributesMapping:Zt});return Et({batch:!0,enabled:!f,open:f,ref:c,onComplete(){f||b(!1)}}),w})),Lo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Mt(),l=Le(),{render:f,className:c,style:y,...b}=t,x=o.useCallback(m=>{m&&(r===0&&(l.context.firstItemTextRef.current=m),i&&(l.context.selectedItemTextRef.current=m))},[l,r,i]);return _e("div",t,{ref:[x,n,s],props:b})}));export{fo as L,To as S,wt as a,ao as b,Eo as c,wo as d,vo as e,Mo as f,Po as g,Oo as h,Ao as i,Lo as j,ar as k,Sr as l,yr as m,Cr as n,Lr as o,$r as p,vt as q,un as r,Bt as s,an as t,Le as u,Ut as v,Dr as w,rn as x};
1
+ import{by as En,r as o,d2 as st,a$ as $e,b7 as zt,c9 as wn,K as Ge,N as pe,c$ as vn,aY as ke,b1 as K,b2 as Mn,d3 as Yt,d0 as Pn,b0 as Y,dg as Dt,dh as mt,di as kt,c7 as ht,b3 as Ne,ba as Ee,dj as Nt,bO as Ht,dk as Je,bB as $t,c5 as Gt,dl as ct,dm as ut,dn as Xt,dp as Tt,da as On,dq as An,dr as bt,df as Ln,bi as He,aW as te,j as ae,bN as Et,cb as yt,cg as Vn,ci as Fn,cj as Dn,c3 as it,bx as kn,d5 as Nn,bR as rt,cZ as Hn,M as Jt,J as _e,ds as _n,bJ as Un,dt as Bn,bM as Wn,b5 as jn,du as qn,cf as Zt,dv as xt}from"./__vite-browser-external-DKVGjnxf.js";import{i as St,E as Qt,b as en,F as Kn,P as zn,c as Oe,a as Yn,G as $n,H as Ie,J as tn,B as Gn,u as Xn,D as nn,o as Jn,x as Zn,q as Qn,I as er,w as tr,z as nr,C as rr}from"./composite-_t6vz49X.js";import{u as or,a as sr,b as ir,p as lr,r as cr,g as ur}from"./usePositioner-cTX1WPQP.js";function ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function ar(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:f=0,reason:c=En}=t,y="rootStore"in e?e.rootStore:e,b=y.context.dataRef,x=o.useRef(void 0),w=st(),m=$e(),V=o.useMemo(()=>{function v(d,_,T,p){const a=pe(c,_,T);d&&p==="touch"&&f>0?m.start(f,()=>{y.setOpen(!0,a)}):y.setOpen(d,a)}function C(d,_,T){const p=b.current.openEvent,a=y.select("domReferenceElement")!==_;return d&&a||!d||!s?!0:p&&l?!T(p.type):!1}return{onPointerDown(d){x.current=St(d.pointerType,!0)&&Qt(d.nativeEvent)?"virtual":d.pointerType},onMouseDown(d){const _=x.current,T=d.nativeEvent,p=y.select("open");if(d.button!==0||r==="click"||St(_,!0)&&i)return;const a=C(p,d.currentTarget,S=>S==="click"||S==="mousedown"),O=zt(T);if(wn(O)){v(a,T,O,_);return}const h=d.currentTarget;w.request(()=>{v(a,T,h,_)})},onClick(d){if(r==="mousedown-only")return;const _=x.current;if(r==="mousedown"&&_){x.current=void 0;return}if(St(_,!0)&&i)return;const T=y.select("open"),p=C(T,d.currentTarget,a=>a==="click"||a==="mousedown"||a==="keydown"||a==="keyup");v(p,d.nativeEvent,d.currentTarget,_)},onKeyDown(){x.current=void 0}}},[b,r,i,c,y,l,s,w,m,f]);return o.useMemo(()=>n?{reference:V}:Ge,[n,V])}function fr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=vn(),i=en()!=null,l=ke(()=>new Kn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new zn,floatingId:s,syncOnly:!1,nested:i})).current;return K(()=>{const f={open:t,floatingId:s};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=Mn(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),l.update(f)},[t,s,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}const dr="Escape";function _t(e){return Gt&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ze(e,t){return at(t,e===Xt||e===Tt,e===ct||e===ut)}function Rt(e,t,n){return at(t,e===Tt,n?e===ct:e===ut)||e==="Enter"||e===" "||e===""}function pr(e,t,n){return at(t,n?e===ct:e===ut,e===Tt)}function gr(e,t,n,r){const s=n?e===ut:e===ct,i=e===Xt;return t==="both"||t==="horizontal"&&r?e===dr:at(t,s,i)}function mr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:f=!1,loopFocus:c=!1,nested:y=!1,rtl:b=!1,virtual:x=!1,focusItemOnOpen:w="auto",focusItemOnHover:m=!0,openOnArrowKeyDown:V=!0,disabledIndices:v=void 0,orientation:C="vertical",parentOrientation:d,id:_,resetOnPointerLeave:T=!0,externalTree:p,grid:a}=t,O=a!=null,h="rootStore"in e?e.rootStore:e,S=h.useState("open"),H=h.useState("floatingElement"),D=h.useState("domReferenceElement"),G=h.context.dataRef,$=Yt(H),R=Pn(D),F=Oe($),z=en(),J=Yn(p),q=o.useRef(w),M=o.useRef(l??-1),U=o.useRef(null),g=o.useRef(!0),E=Y(u=>{s(M.current===-1?null:M.current,u)}),A=o.useRef(!!H),L=o.useRef(S),k=o.useRef(!1),X=o.useRef(!1),ne=o.useRef(null),re=Oe(v),se=Oe(S),le=Oe(l),oe=Oe(T),fe=st(),B=st(),j=Y(()=>{function u(N){x?J?.events.emit("virtualfocus",N):ne.current=$n(N,{sync:k.current,preventScroll:!0})}const I=n.current[M.current],Q=X.current;I&&u(I),(k.current?N=>N():N=>fe.request(N))(()=>{const N=n.current[M.current]||I;if(!N)return;I||u(N),ue&&(Q||!g.current)&&N.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{G.current.orientation=C},[G,C]),K(()=>{i&&(S&&H?(M.current=l??-1,q.current&&l!=null&&(X.current=!0,E())):A.current&&(M.current=-1,E()))},[i,S,H,l,E]),K(()=>{if(i){if(!S){k.current=!1;return}if(H)if(r==null){if(k.current=!1,le.current!=null)return;if(A.current&&(M.current=-1,j()),(!L.current||!A.current)&&q.current&&(U.current!=null||q.current===!0&&U.current==null)){let u=0;const I=()=>{n.current[0]==null?(u<2&&(u?P=>B.request(P):queueMicrotask)(I),u+=1):(M.current=U.current==null||Rt(U.current,C,b)||y?mt(n):kt(n),U.current=null,E())};I()}}else Dt(n.current,r)||(M.current=r,j(),X.current=!1)}},[i,S,H,r,le,y,n,C,b,E,j,B]),K(()=>{if(!i||H||!J||x||!A.current)return;const u=J.nodesRef.current,I=u.find(N=>N.id===z)?.context?.elements.floating,Q=ht(Ne(D??I??null)),P=u.some(N=>N.context&&Ee(N.context.elements.floating,Q));I&&!P&&g.current&&I.focus({preventScroll:!0})},[i,H,D,J,z,x]),K(()=>{L.current=S,A.current=!!H}),K(()=>{S||(U.current=null,q.current=w)},[S,w]);const ce=r!=null,Z=Y(u=>{if(!se.current)return;const I=n.current.indexOf(u.currentTarget);I!==-1&&(M.current!==I||r!==I)&&(M.current=I,E(u))}),ge=Y(()=>d??J?.nodesRef.current.find(u=>u.id===z)?.context?.dataRef?.current.orientation),xe=Y(()=>mt(n,re.current)),de=Y(u=>{if(g.current=!1,k.current=!0,u.which===229||!se.current&&u.currentTarget===F.current)return;if(y&&gr(u.key,C,b,O)){Ze(u.key,ge())||Ie(u),h.setOpen(!1,pe(Nt,u.nativeEvent)),Ht(D)&&(x?J?.events.emit("virtualfocus",D):D.focus());return}const I=M.current,Q=mt(n,v),P=kt(n,v);if(R||(u.key==="Home"&&(Ie(u),M.current=Q,E(u)),u.key==="End"&&(Ie(u),M.current=P,E(u))),a!=null){const N=a(u,M.current,n,C,c,b,v,Q,P);if(N!=null&&(M.current=N,E(u)),C==="both")return}if(Ze(u.key,C)){if(Ie(u),S&&!x&&ht(u.currentTarget.ownerDocument)===u.currentTarget){M.current=Rt(u.key,C,b)?Q:P,E(u);return}Rt(u.key,C,b)?c?I>=P?f&&I!==n.current.length?M.current=-1:(k.current=!1,M.current=Q):M.current=Je(n.current,{startingIndex:I,disabledIndices:v}):M.current=Math.min(P,Je(n.current,{startingIndex:I,disabledIndices:v})):c?I<=Q?f&&I!==-1?M.current=n.current.length:(k.current=!1,M.current=P):M.current=Je(n.current,{startingIndex:I,decrement:!0,disabledIndices:v}):M.current=Math.max(Q,Je(n.current,{startingIndex:I,decrement:!0,disabledIndices:v})),Dt(n.current,M.current)&&(M.current=-1),E(u)}}),ue=o.useMemo(()=>({onFocus(I){k.current=!0,Z(I)},onClick:({currentTarget:I})=>I.focus({preventScroll:!0}),onMouseMove(I){_t(I)||(k.current=!0,X.current=!1,m&&Z(I))},onPointerLeave(I){if(!se.current||!g.current||I.pointerType==="touch")return;k.current=!0;const Q=I.relatedTarget;if(!(!m||n.current.includes(Q))&&oe.current&&(ne.current?.(),ne.current=null,M.current=-1,E(I),!x)){const P=F.current,N=ht(Ne(P));P&&Ee(P,N)&&P.focus({preventScroll:!0})}}}),[Z,se,F,m,n,E,oe,x]),me=o.useMemo(()=>x&&S&&ce&&{"aria-activedescendant":`${_}-${r}`},[x,S,ce,_,r]),Se=o.useMemo(()=>({...R?{}:me,onKeyDown(u){if(u.key==="Tab"&&u.shiftKey&&S&&!x){const I=zt(u.nativeEvent);if(I&&!Ee(F.current,I))return;Ie(u),h.setOpen(!1,pe($t,u.nativeEvent)),Ht(D)&&D.focus();return}de(u)},onPointerMove(u){_t(u)||(g.current=!0)}}),[me,de,F,R,h,S,x,D]),ee=o.useMemo(()=>{function u(P){h.setOpen(!0,pe(Nt,P.nativeEvent,P.currentTarget))}function I(P){w==="auto"&&tn(P.nativeEvent)&&(q.current=!x)}function Q(P){q.current=w,w==="auto"&&Qt(P.nativeEvent)&&(q.current=!0)}return{onKeyDown(P){const N=h.select("open");g.current=!1;const ve=P.key.startsWith("Arrow"),Me=pr(P.key,ge(),b),be=Ze(P.key,C),Re=(y?Me:be)||P.key==="Enter"||P.key.trim()==="";if(x&&N)return de(P);if(!(!N&&!V&&ve)){if(Re){const Ue=Ze(P.key,ge());U.current=y&&Ue?null:P.key}if(y){Me&&(Ie(P),N?(M.current=xe(),E(P)):u(P));return}be&&(le.current!=null&&(M.current=le.current),Ie(P),!N&&V?u(P):de(P),N&&E(P))}},onFocus(P){h.select("open")&&!x&&(M.current=-1,E(P))},onPointerDown:Q,onPointerEnter:Q,onMouseDown:I,onClick:I}},[de,w,xe,y,E,h,V,C,ge,b,le,x]),we=o.useMemo(()=>({...me,...ee}),[me,ee]);return o.useMemo(()=>i?{reference:we,floating:Se,item:ue,trigger:ee}:{},[i,we,Se,ee,ue])}function hr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:l,onTyping:f,enabled:c=!0,resetMs:y=750,selectedIndex:b=null}=t,x="rootStore"in e?e.rootStore:e,w=x.useState("open"),m=$e(),V=o.useRef(""),v=o.useRef(b??s??-1),C=o.useRef(null),d=Y(p=>{function a(F){return r?.current[F]}function O(F){const z=a(F);return z&&!On(z)||z?.matches(":disabled")?!1:l==null||!An(bt,F,l)}function h(F,z,J=0){if(F.length===0)return-1;const q=(J%F.length+F.length)%F.length,M=z.toLowerCase();for(let U=0;U<F.length;U+=1){const g=(q+U)%F.length;if(!(!F[g]?.toLowerCase().startsWith(M)||!O(g)))return g}return-1}const S=n.current;if(V.current.length>0&&p.key===" "&&(Ie(p),f?.(!0)),V.current.length>0&&V.current[0]!==" "&&h(S,V.current)===-1&&p.key!==" "&&f?.(!1),S==null||p.key.length!==1||p.ctrlKey||p.metaKey||p.altKey)return;w&&p.key!==" "&&(Ie(p),f?.(!0));const H=V.current==="";H&&(v.current=b??s??-1),S.every((F,z)=>F&&O(z)?F[0]?.toLowerCase()!==F[1]?.toLowerCase():!0)&&V.current===p.key&&(V.current="",v.current=C.current),V.current+=p.key,m.start(y,()=>{V.current="",v.current=C.current,f?.(!1)});const $=((H?b??s??-1:v.current)??0)+1,R=h(S,V.current,$);R!==-1?(i?.(R),C.current=R):p.key!==" "&&(V.current="",f?.(!1))}),_=Y(p=>{const a=p.relatedTarget,O=x.select("domReferenceElement"),h=x.select("floatingElement");Ee(O,a)||Ee(h,a)||(m.clear(),V.current="",v.current=C.current,f?.(!1))});K(()=>{!w&&b!==null||(m.clear(),C.current=null,V.current!==""&&(V.current=""))},[w,b,m]);const T=o.useMemo(()=>({onKeyDown:d,onBlur:_}),[d,_]);return o.useMemo(()=>c?{reference:T,floating:T}:{},[c,T])}function xr(e){const t=o.useRef(""),n=o.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:o.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function rn(e,t){const n=o.useRef(e),r=Y(t);K(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Sr(e,t){const n=Y((i,l)=>{(typeof e=="function"?e():e)||t(l||(Ln?"touch":""))}),{onClick:r,onPointerDown:s}=xr(n);return o.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function Rr(e){const[t,n]=o.useState(null),r=Sr(e,n);return rn(e,s=>{s&&!e&&n(null)}),o.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const br=20;function yr(e,t,n,r){const[s,i]=o.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const l=Ne(n).documentElement.clientWidth,f=n.offsetWidth;i(l>0&&f>0&&f>=l-br)},[e,t,n]),Gn(e&&(!t||s),r)}const Ir=o.createContext(void 0);function Cr(e){return o.useContext(Ir)}function Tr(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function Er(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function wr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ut({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,l]=o.useState(t),f=s&&e!==void 0?e:i,c=o.useCallback(y=>{s||l(y)},[]);return[f,c]}const on=o.createContext(void 0),sn=o.createContext(void 0),ln=o.createContext(void 0);function Le(){const e=o.useContext(on);if(e===void 0)throw new Error(He(60));return e}function wt(){const e=o.useContext(sn);if(e===void 0)throw new Error(He(101));return e}function cn(){const e=o.useContext(ln);if(e===void 0)throw new Error(He(61));return e}const vr="data-valid",Mr="data-invalid",Pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Or={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Ar={disabled:!1,...Or},Lr={valid(e){return e===null?null:e?{[vr]:""}:{[Mr]:""}}},Vr={invalid:void 0,name:void 0,validityData:{state:Pr,errors:[],error:"",value:"",initialValue:null},setValidityData:te,disabled:void 0,setTouched:te,setDirty:te,setFilled:te,setFocused:te,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Ar,registerFieldControl:te,validation:{getValidationProps:(e,t=Ge)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:te,getInputControl:()=>null,commit:async()=>{},change:te}},Fr=o.createContext(Vr);function vt(e=!0){const t=o.useContext(Fr);if(t.setValidityData===te&&!e)throw new Error(He(28));return t}function Dr(e,t,n,r,s=!0,i){const{registerFieldControl:l}=vt(),f=ke(()=>Symbol());K(()=>{const c=f.current;if(!s){l(c,void 0);return}l(c,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,l,f,n]),K(()=>{const c=f.current;return()=>{l(c,void 0)}},[l,f])}const kr=o.createContext({controlId:void 0,registerControlId:te,resetControlId:te,labelId:void 0,setLabelId:te,messageIds:[],setMessageIds:te,getDescriptionProps:e=>e});function un(){return o.useContext(kr)}function an(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=un(),l=Xn(),f=ke(()=>Symbol()),c=o.useRef(!1),y=o.useRef(!1),b=Y(()=>{!c.current||s===te||(c.current=!1,s(f.current,void 0))});return K(()=>{if(!n||s===te){b();return}let x;if(t!==void 0)y.current=!0,x=t;else if(y.current)x=l;else{i();return}if(x===void 0){b();return}c.current=!0,s(f.current,x)},[t,n,s,i,l,f,b]),K(()=>b,[b]),(n?r:void 0)??t??l}function Nr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const fn=(e,t)=>Object.is(e,t);function Ae(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Hr(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Nr(e,t,(r,s)=>Ae(r,s,n)):e!==t}function It(e,t,n){return e?e.some(r=>r===void 0?!1:Ae(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Ae(r,t,n)):-1}function _r(e,t){if(t!==fn)return r=>It(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function dn(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(_r(t,n)):ot(e,t,n);return s===-1?null:s}function Ur(e,t,n,r,s,i){return It(r,t,s)?i!=null&&e>i&&It(r,n[i],s)?i:e:e===i?dn(n,r,s,!0):i}function Br(e,t,n){return e.filter(r=>!Ae(t,r,n))}function Ct(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Wr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function pn(e){return Wr(e?.[0])}function jr(e){return pn(e)?e.flatMap(t=>t.items):e}function qr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(pn(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function gn(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 Ct(e)}function De(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ct(e.value):Ct(e)}function mn(e,t,n){function r(){return gn(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)??r();if(Array.isArray(t)){const i=jr(t);if(e==null||typeof e!="object"){const l=i.find(f=>f.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(f=>f&&f.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function Kr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ae.jsx(o.Fragment,{children:mn(s,t,n)},i)),r),[])}const zr={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:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:De(t,r)!==""},hasNullItemLabel:(e,t)=>t?qr(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,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Ae(t,s,n)):Ae(t,r,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},Yr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:te,validationMode:"onSubmit",submitCountRef:{current:0}});function $r(){return o.useContext(Yr)}const Ce=1;function hn(e,t){return Math.max(0,e-t)}function Gr(e,t){if(t<=0)return 0;const n=ze(e,0,t),r=n,s=t-n,i=r<=Ce,l=s<=Ce;return i&&l?r<=s?0:t:i?0:l?t:n}function To(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:l=!1,onOpenChange:f,name:c,form:y,autoComplete:b,disabled:x=!1,readOnly:w=!1,required:m=!1,modal:V=!0,actionsRef:v,inputRef:C,onOpenChangeComplete:d,items:_,multiple:T=!1,itemToStringLabel:p,itemToStringValue:a,isItemEqualToValue:O=fn,highlightItemOnHover:h=!0,children:S}=e,{clearErrors:H}=$r(),{setDirty:D,setTouched:G,setFocused:$,validityData:R,setFilled:F,name:z,disabled:J,validation:q,validationMode:M}=vt(),U=an({id:t}),g=J||x,E=z??c,[A,L]=Ut({controlled:n,default:T?r??bt:r,name:"Select",state:"value"}),[k,X]=Ut({controlled:i,default:l,name:"Select",state:"open"}),ne=o.useRef([]),re=o.useRef([]),se=o.useRef(null),le=o.useRef(null),oe=o.useRef(0),fe=o.useRef(null),B=o.useRef([]),j=o.useRef(!1),ce=o.useRef(null),Z=o.useRef(null),ge=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=o.useRef(!1),de=o.useRef(A),{mounted:ue,setMounted:me,transitionStatus:Se}=nn(k),{openMethod:ee,triggerProps:we}=Rr(k),u=ke(()=>new kn({id:U,labelId:void 0,modal:V,multiple:T,itemToStringLabel:p,itemToStringValue:a,isItemEqualToValue:O,value:A,open:k,mounted:ue,transitionStatus:Se,items:_,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ge,triggerProps:Ge,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:te,setOpen:te,handleScrollArrowVisibility:te,onOpenChangeComplete:te,listRef:ne,popupRef:se,scrollHandlerRef:le,scrollArrowsMountedCountRef:oe,valueRef:fe,valuesRef:B,labelsRef:re,typingRef:j,selectionRef:ge,firstItemTextRef:ce,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:xe,initialValueRef:de},zr)).current,I=u.useState("activeIndex"),Q=u.useState("selectedIndex"),P=u.useState("triggerElement"),N=u.useState("positionerElement"),ve=Tr(ee),Me=ee??ve,be=o.useMemo(()=>T?"":De(A,a),[T,A,a]),Re=o.useMemo(()=>T&&Array.isArray(A)?A.map(W=>De(W,a)):De(A,a),[T,A,a]),Ue=Oe(P),Be=Y(()=>Re);Dr(Ue,U,A,Be,!g,c);const We=T?Array.isArray(A)&&A.length>0:A!=null&&be!=="";K(()=>{F(We)},[We,F]),K(function(){const ie=dn(B.current,A,O,T);ie===null&&(Z.current=null),!k&&u.set("selectedIndex",ie)},[T,k,A,O,u]),rn(A,()=>{H(E),D(Hr(A,R.initialValue,O)),q.change(A)});const je=Y((W,ie)=>{f?.(W,ie),!ie.isCanceled&&(X(W),!W&&(ie.reason===$t||ie.reason===Nn)&&(G(!0),$(!1),M==="onBlur"&&q.commit(A)))}),Ve=Y(()=>{me(!1),u.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),d?.(!1)});Et({enabled:!v,open:k,ref:se,onComplete(){k||Ve()}}),o.useImperativeHandle(v,()=>({unmount:Ve}),[Ve]);const qe=Y((W,ie)=>{s?.(W,ie),!ie.isCanceled&&L(W)}),ft=Y(W=>{const ie=hn(W.scrollHeight,W.clientHeight),Xe=Gr(W.scrollTop,ie),dt=Xe>0,Ke=Xe<ie;u.set("scrollUpArrowVisible",dt),u.set("scrollDownArrowVisible",Ke)}),Pe=fr({open:k,onOpenChange:je,elements:{reference:P,floating:N}}),he=ar(Pe,{enabled:!g,event:"mousedown"}),ye=Jn(Pe),Te=mr(Pe,{enabled:!g,listRef:ne,activeIndex:I,selectedIndex:Q,disabledIndices:bt,onNavigate(W){W===null&&!k||u.set("activeIndex",W)},focusItemOnHover:h}),Fe=hr(Pe,{enabled:!g&&(k||!w&&!T),listRef:re,activeIndex:I,selectedIndex:Q,disabledIndices:W=>wr(ne.current[W]),onMatch(W){k?u.set("activeIndex",W):qe(B.current[W],pe(it))},onTyping(W){j.current=W}}),Pt=o.useMemo(()=>yt(Fe.reference,Te.reference,ye.reference,he.reference,we),[he.reference,Fe.reference,Te.reference,ye.reference,we]),Ot=o.useMemo(()=>yt(Zn,Fe.floating,Te.floating,ye.floating),[Fe.floating,Te.floating,ye.floating]),At=Te.item??Ge;u.useContextCallback("setValue",qe),u.useContextCallback("setOpen",je),u.useContextCallback("handleScrollArrowVisibility",ft),u.useContextCallback("onOpenChangeComplete",d),Er(()=>{u.update({popupProps:Ot,triggerProps:Pt})}),u.useSyncedValues({id:U,modal:V,multiple:T,value:A,open:k,mounted:ue,transitionStatus:Se,popupProps:Ot,triggerProps:Pt,items:_,itemToStringLabel:p,itemToStringValue:a,isItemEqualToValue:O,openMethod:Me});const yn=o.useMemo(()=>({disabled:g,readOnly:w,required:m,multiple:T,highlightItemOnHover:h,itemProps:At}),[g,w,m,T,h,At]),In=Vn(C,q.inputRef),Lt=T?void 0:E,Cn=o.useMemo(()=>!T||!Array.isArray(A)||!E?null:A.map(W=>{const ie=De(W,a);return ae.jsx("input",{type:"hidden",form:y,name:E,value:ie,disabled:g},ie)}),[T,A,y,E,a,g]);return ae.jsxs(on.Provider,{value:u,children:[ae.jsx(sn.Provider,{value:yn,children:ae.jsx(ln.Provider,{value:Pe,children:S})}),ae.jsx("input",{...q.getValidationProps(g,{onFocus(){u.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented||g||w)return;const ie=W.currentTarget.value,Xe=pe(it,W.nativeEvent);function dt(){if(T)return;const Ke=ie.toLowerCase();let pt=B.current.findIndex(gt=>De(gt,a).toLowerCase()===Ke||gn(gt,p).toLowerCase()===Ke);pt===-1&&(pt=B.current.findIndex((gt,Tn)=>{const Ft=re.current[Tn];return Ft!=null&&Ft.toLowerCase()===Ke}));const Vt=B.current[pt];Vt!=null&&qe(Vt,Xe)}u.set("forceMount",!0),queueMicrotask(dt)}}),id:U&&Lt==null?`${U}-hidden-input`:void 0,form:y,name:Lt,autoComplete:b,value:be,disabled:g,required:m&&!(T&&We),readOnly:w,ref:In,style:E?Fn:Dn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Cn]})}function Xr(e,t){return e??t}const Qe=5;function Jr(e,t){const n=Zr(t);return e.clientX>=n.left-Qe&&e.clientX<=n.right+Qe&&e.clientY>=n.top-Qe&&e.clientY<=n.bottom+Qe}function Zr(e){const t=e.getBoundingClientRect(),n=rt(e);if(Hn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,f=parseFloat(r.height)||0,c=parseFloat(s.width)||0,y=parseFloat(s.height)||0,b=Math.max(t.width,l,c),x=Math.max(t.height,f,y),w=b-t.width,m=x-t.height;return{left:t.left-w/2,right:t.right+w/2,top:t.top-m/2,bottom:t.bottom+m/2}}const Qr="data-popup-side",eo=400,to={...Qn,...Lr,popupSide:e=>e?{[Qr]:e}:null,value:()=>null},Eo=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:l=!1,nativeButton:f=!0,style:c,...y}=t,{setTouched:b,setFocused:x,validationMode:w,validation:m,state:V,disabled:v}=vt(),{labelId:C}=un(),d=Le(),{readOnly:_,required:T,disabled:p}=wt(),a=v||p||l,O=d.useState("open"),h=d.useState("mounted"),S=d.useState("value"),H=d.useState("triggerProps"),D=d.useState("positionerElement"),G=d.useState("listElement"),$=d.useState("popupSide"),R=d.useState("id"),F=d.useState("labelId"),z=d.useState("hasSelectedValue"),J=h&&D?$:null,q=i??R,M=Xr(C,F);an({id:i});const U=Oe(D),g=o.useRef(null),{getButtonProps:E,buttonRef:A}=Jt({disabled:a,native:f}),L=d.useStateSetter("triggerElement"),k=$e(),X=$e(),ne=$e();o.useEffect(()=>{if(O)return ne.start(eo,()=>{d.context.selectionRef.current.allowUnselectedMouseUp=!0,d.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};d.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[O,d,X,ne]);const re=yt(H,{id:q,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?G?.id??Yt(D)?.id:void 0,"aria-labelledby":M,"aria-readonly":_||void 0,"aria-required":T||void 0,tabIndex:a?-1:0,onFocus(oe){x(!0),O&&d.context.alignItemWithTriggerActiveRef.current&&d.context.setOpen(!1,pe(it,oe.nativeEvent)),k.start(0,()=>{d.set("forceMount",!0)})},onBlur(oe){Ee(D,oe.relatedTarget)||(b(!0),x(!1),w==="onBlur"&&m.commit(S))},onMouseDown(oe){if(O)return;const fe=Ne(oe.currentTarget);function B(j){if(!g.current)return;const ce=j.target;Ee(g.current,ce)||Ee(U.current,ce)||Jr(j,g.current)||d.context.setOpen(!1,pe(_n,j))}X.start(0,()=>{fe.addEventListener("mouseup",B,{once:!0})})}},y,E),se=m.getValidationProps(a,re);se.role="combobox";const le={...V,open:O,disabled:a,value:S,readOnly:_,popupSide:J,placeholder:!z};return _e("button",t,{ref:[n,g,A,L],state:le,stateAttributesMapping:to,props:se})}),no={value:()=>null},wo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:l,style:f,...c}=t,y=Le(),b=y.useState("value"),x=y.useState("items"),w=y.useState("itemToStringLabel"),m=y.useState("hasSelectedValue"),V=!m&&l!=null&&i==null,v=y.useState("hasNullItemLabel",V),C={value:b,placeholder:!m};let d=null;return typeof i=="function"?d=i(b):i!=null?d=i:V&&!v?d=l:Array.isArray(b)?d=Kr(b,x,w):d=mn(b,x,w),_e("span",t,{state:C,ref:[n,y.context.valueRef],props:[{children:d},c],stateAttributesMapping:no})}),vo=o.forwardRef(function(t,n){const r=Le(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ae.jsx(Un,{ref:n,...t}):null}),xn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function ro(){return o.useContext(xn)}function oo(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=Y(s),[,l]=o.useState(!1),f=ke(io).current,c=ke(so).current,y=o.useRef(0),b=o.useRef(!0),x=o.useRef(null),w=o.useRef(null),m=Y(()=>{b.current||(b.current=!0,l(a=>!a))}),V=Y((a,O)=>{c.set(a,O),m()}),v=Y(a=>{c.delete(a),m()}),C=Y(a=>{const O=new Map;return n.current.length=0,r&&(r.current.length=0),a.forEach(h=>{O.set(h.element,{...h.registration.metadata??{},index:h.index}),n.current[h.index]=h.element,r&&(r.current[h.index]=h.registration.label!==void 0?h.registration.label:h.registration.textRef?.current?.textContent??h.element.textContent)}),y.current=n.current.length,O});function d(a){if(w.current?.disconnect(),w.current=null,typeof MutationObserver!="function"||a.length<2)return;const O=new MutationObserver(S=>{if(!uo(S))return;let H=null;for(const D of a)if(D.isConnected){if(H&&Sn(H,D)>0){O.disconnect(),m();return}H=D}});w.current=O;const h=new Set;for(let S=1;S<a.length;S+=1){const H=co(a[S-1],a[S]);H&&h.add(H)}h.forEach(S=>O.observe(S,{childList:!0}))}const _=Y(()=>{const[a,O]=lo(c),h=C(a),S=x.current,H=!S||S.length!==a.length||a.some((D,G)=>{const $=S[G];return D.index!==$.index||D.element!==$.element||D.registration.index!==$.registration.index||D.registration.metadata!==$.registration.metadata});d(O),x.current=a,b.current=!1,H&&(f.forEach(D=>D(h)),i(h))});K(()=>(!b.current&&x.current&&C(x.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,C]),K(()=>{b.current&&_()}),K(()=>()=>{w.current?.disconnect(),b.current=!0},[]);const T=Y(a=>(f.add(a),()=>{f.delete(a)})),p=o.useMemo(()=>({register:V,unregister:v,subscribeMapChange:T,nextIndexRef:y}),[V,v,T,y]);return ae.jsx(xn.Provider,{value:p,children:t})}function so(){return new Map}function io(){return new Set}function lo(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const f=i.index,c={index:f??-1,element:l,registration:i};f===null?r.push(c):f>=0&&(t.add(f),n.push(c))});let s=0;return r.sort((i,l)=>Sn(i.element,l.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function co(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function uo(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 Sn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Rn=o.createContext(void 0);function ao(){const e=o.useContext(Rn);if(!e)throw new Error(He(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const fo={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},po={position:"fixed"},Mo=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:l,side:f,align:c,sideOffset:y,alignOffset:b,collisionBoundary:x="clipping-ancestors",collisionPadding:w,arrowPadding:m,sticky:V,disableAnchorTracking:v,alignItemWithTrigger:C=!0,collisionAvoidance:d=Bn,style:_,...T}=t,p=Le(),a=cn(),O=p.useState("open"),h=p.useState("mounted"),S=p.useState("modal"),H=p.useState("value"),D=p.useState("openMethod"),G=p.useState("positionerElement"),$=p.useState("triggerElement"),R=p.useState("isItemEqualToValue"),F=p.useState("transitionStatus"),z=o.useRef(null),J=o.useRef(null),[q,M]=o.useState(C),U=h&&q&&D!=="touch";!h&&q!==C&&M(C),o.useImperativeHandle(p.context.alignItemWithTriggerActiveRef,()=>U),yr((U||S)&&O,D==="touch",G,$);const g=or({anchor:r,floatingRootContext:a,positionMethod:l,mounted:h,side:f,sideOffset:y,align:c,alignOffset:b,arrowPadding:m,collisionBoundary:x,collisionPadding:w,sticky:V,disableAnchorTracking:v??U,collisionAvoidance:d,keepMounted:!0}),E=U?"none":g.side,A=U?po:g.positionerStyles,L={open:O,side:E,align:g.align,anchorHidden:g.anchorHidden};K(()=>{p.set("popupSide",g.side)},[p,g.side]);const k=p.useStateSetter("positionerElement"),X=sr(t,L,{styles:A,transitionStatus:F,props:T,refs:[n,k],hidden:!h,inert:!O}),ne=o.useRef(0),re=Y(le=>{if(p.context.valuesRef.current.length===0)return;const oe=ne.current;ne.current=le.size;const fe=pe(it);if(oe!==0&&!p.state.multiple&&H!==null&&ot(p.context.valuesRef.current,H,R)===-1){const j=p.context.initialValueRef.current,Z=j!=null&&ot(p.context.valuesRef.current,j,R)!==-1?j:null;p.context.setValue(Z,fe),Z===null&&(p.set("selectedIndex",null),p.context.selectedItemTextRef.current=null)}if(oe!==0&&p.state.multiple&&Array.isArray(H)){const B=H.filter(j=>ot(p.context.valuesRef.current,j,R)!==-1);B.length!==H.length&&(p.context.setValue(B,fe),B.length===0&&(p.set("selectedIndex",null),p.context.selectedItemTextRef.current=null))}if(O&&U){p.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const B={height:""};lt(G,B),lt(p.context.popupRef.current,B)}}),se=o.useMemo(()=>({...g,side:E,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:M,scrollUpArrowRef:z,scrollDownArrowRef:J}),[g,E,U,M]);return ae.jsx(oo,{elementsRef:p.context.listRef,labelsRef:p.context.labelsRef,onMapChange:re,children:ae.jsxs(Rn.Provider,{value:se,children:[h&&S&&ae.jsx(er,{inert:Wn(!O),cutout:$}),X]})})}),et="base-ui-disable-scrollbar",Bt={className:et,getElement(e){return ae.jsx("style",{nonce:e,href:et,precedence:"base-ui:low",children:`.${et}{scrollbar-width:none}.${et}::-webkit-scrollbar{display:none}`})}},go=o.createContext(void 0),mo={disableStyleElements:!1};function ho(){return o.useContext(go)??mo}const Wt="--transform-origin",xo={...nr,...Zt},Po=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:l,...f}=t,c=Le(),{multiple:y,readOnly:b,highlightItemOnHover:x}=wt(),w=cn(),{side:m,align:V,alignItemWithTriggerActive:v,isPositioned:C,setControlledAlignItemWithTrigger:d}=ao(),_=Cr()!=null,T=ir(),{nonce:p,disableStyleElements:a}=ho(),O=c.useState("id"),h=c.useState("open"),S=c.useState("openMethod"),H=c.useState("mounted"),D=c.useState("popupProps"),G=c.useState("transitionStatus"),$=c.useState("triggerElement"),R=c.useState("positionerElement"),F=c.useState("listElement"),z=o.useRef(!1),J=o.useRef(!1),q=o.useRef({}),M=st(),U=Y(L=>{if(!R||!c.context.popupRef.current||!J.current)return;const k=R.style.top==="0px",X=R.style.bottom==="0px";if(z.current||!v||!k&&!X){c.context.handleScrollArrowVisibility(L);return}const ne=qt(R),re=Ye(R.getBoundingClientRect().height,"y",ne),se=Ne(R),le=rt(R),oe=le.getComputedStyle(R),fe=parseFloat(oe.marginTop),B=parseFloat(oe.marginBottom),j=jt(le.getComputedStyle(c.context.popupRef.current)),ce=Math.min(se.documentElement.clientHeight-fe-B,j),Z=L.scrollTop,ge=tt(L);let xe=null;const de=ee=>{R.style.height=`${ee}px`},ue=k?ge-Z:Z,me=Math.min(re+ue,ce);if(ue<=Ce){const ee=ze(ue,0,ce-re);ee>0&&de(re+ee),L.scrollTop=k?ge:0,ce-(re+ee)<=Ce&&(z.current=!0),c.context.handleScrollArrowVisibility(L);return}if(ce-me>Ce)xe=k?1/0:0;else if(X&&Z<ge){const ee=re+ue-ce;xe=Z-(ue-ee)}const Se=Math.ceil(me);if(Se!==0&&de(Se),xe!=null){const ee=ze(xe,0,tt(L));Math.abs(L.scrollTop-ee)>Ce&&(L.scrollTop=ee)}Se>=ce-Ce&&(z.current=!0),c.context.handleScrollArrowVisibility(L)});o.useImperativeHandle(c.context.scrollHandlerRef,()=>U,[U]),Et({open:h,ref:c.context.popupRef,onComplete(){h&&c.context.onOpenChangeComplete(!0)}});const g={open:h,transitionStatus:G,side:m,align:V};K(()=>{!R||!c.context.popupRef.current||Object.keys(q.current).length||(q.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),K(()=>{h||v||(J.current=!1,z.current=!1,lt(R,q.current))},[h,v,R]),K(()=>{const L=c.context.popupRef.current;if(!h||!$||!R||!L||v&&!C||c.state.transitionStatus==="ending")return;if(J.current=!0,L.style.removeProperty(Wt),!v){M.request(()=>c.context.handleScrollArrowVisibility(F||L));return}const k=So(L);try{let X=c.context.selectedItemTextRef.current;X?.isConnected||(X=!c.select("hasSelectedValue")&&c.context.firstItemTextRef.current?.isConnected?c.context.firstItemTextRef.current:null);const ne=c.context.valueRef.current,re=rt(R),se=re.getComputedStyle(R),le=re.getComputedStyle(L),oe=Ne($),fe=qt($),B=nt($.getBoundingClientRect(),fe),j=nt(R.getBoundingClientRect(),fe),ce=B.height,Z=F||L,ge=Z.scrollHeight,xe=parseFloat(le.borderBottomWidth),de=parseFloat(se.marginTop)||10,ue=parseFloat(se.marginBottom)||10,me=parseFloat(se.minHeight)||100,Se=jt(le),ee=5,we=5,u=20,I=oe.documentElement.clientHeight-de-ue,Q=oe.documentElement.clientWidth,P=I-B.bottom+ce;let N,ve=T==="rtl"?B.right-j.width:B.left,Me=0;if(X&&ne){const he=nt(ne.getBoundingClientRect(),fe);N=nt(X.getBoundingClientRect(),fe),ve=j.left+(T==="rtl"?he.right-N.right:he.left-N.left);const ye=he.top-B.top+he.height/2;Me=N.top-j.top+N.height/2-ye}const be=P+Me+ue+xe;let Re=Math.min(I,be);const Ue=I-de-ue,Be=be-Re,We=Q-we;R.style.left=`${ze(ve,ee,We-j.width)}px`,R.style.height=`${Re}px`,R.style.maxHeight="none",R.style.marginTop=`${de}px`,R.style.marginBottom=`${ue}px`,L.style.height="100%";const je=tt(Z),Ve=Be>=je-Ce;Ve&&(Re=Math.min(I,j.height)-(Be-je));const qe=B.top<u||B.bottom>I-u||Math.ceil(Re)+Ce<Math.min(ge,me),ft=(re.visualViewport?.scale??1)!==1&&Gt;if(qe||ft){lt(R,q.current),d(!1);return}const Pe=Math.max(me,Re);if(Ve){const he=Math.max(0,I-be);R.style.top=j.height>=Ue?"0":`${he}px`,R.style.height=`${Re}px`,Z.scrollTop=tt(Z)}else R.style.bottom="0",Z.scrollTop=Be;if(N){const he=j.top,ye=j.height,Te=N.top+N.height/2,Fe=ze(ye>0?(Te-he)/ye*100:50,0,100);L.style.setProperty(Wt,`50% ${Fe}%`)}(Pe===I||Re>=Se)&&(z.current=!0),c.context.handleScrollArrowVisibility(Z),x&&c.state.selectedIndex===null&&c.state.activeIndex===null&&c.context.listRef.current[0]!=null&&c.set("activeIndex",0)}finally{k()}},[c,h,R,$,v,d,M,F,x,T,C]),o.useEffect(()=>{if(!v||!R||!h)return;const L=rt(R);function k(X){c.context.setOpen(!1,pe(qn,X))}return jn(L,"resize",k)},[c,v,R,h]);const E={...F?{role:"presentation"}:{role:"listbox","aria-multiselectable":y||void 0,"aria-readonly":b||void 0,id:`${O}-list`},onKeyDown(L){_&&rr.has(L.key)&&L.stopPropagation()},onScroll(L){F||U(L.currentTarget)},...v&&{style:F?{height:"100%"}:fo},className:!F&&v?Bt.className:void 0},A=_e("div",t,{ref:[n,c.context.popupRef],state:g,stateAttributesMapping:xo,props:[D,E,ur(G),f]});return ae.jsxs(o.Fragment,{children:[!a&&Bt.getElement(p),ae.jsx(tr,{context:w,modal:!1,disabled:!H,openInteractionType:S,returnFocus:l,restoreFocus:!0,children:A})]})});function jt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function tt(e){return hn(e.scrollHeight,e.clientHeight)}function qt(e){return lr.getScale(e)}function Ye(e,t,n){return e/n[t]}function nt(e,t){return cr({x:Ye(e.x,"x",t),y:Ye(e.y,"y",t),width:Ye(e.width,"x",t),height:Ye(e.height,"y",t)})}const Kt=[["transform","none"],["scale","1"],["translate","0 0"]];function So(e){const{style:t}=e,n={};for(const[r,s]of Kt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of Kt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function Ro(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:l,unregister:f,subscribeMapChange:c,nextIndexRef:y}=ro(),b=o.useRef(-1),[x,w]=o.useState(i==null&&t?()=>{if(b.current===-1){const C=y.current;y.current+=1,b.current=C}return b.current}:-1),m=i??x,V=o.useRef(null),v=o.useCallback(C=>{const d=V.current;d&&f(d),V.current=C,C&&l(C,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,l,f,r,n,s]);return K(()=>{if(i==null)return c(C=>{const d=V.current?C.get(V.current)?.index:null;d!=null&&w(d)})},[i,c]),{ref:v,index:m}}const bn=o.createContext(void 0);function Mt(){const e=o.useContext(bn);if(!e)throw new Error(He(57));return e}const Oo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:l=null,label:f,disabled:c=!1,nativeButton:y=!1,...b}=t,x=o.useRef(null),w=Ro({guess:!0,label:f,textRef:x}),m=Le(),{itemProps:V,multiple:v,disabled:C,readOnly:d}=wt(),_=C||c,T=m.useState("isActive",w.index),p=m.useState("open"),a=m.useState("isSelected",l),O=m.useState("isSelectedByFocus",w.index),h=m.useState("isItemEqualToValue"),S=w.index,H=o.useRef(null);K(()=>{const g=m.context.valuesRef.current;return g[S]=l,()=>{delete g[S]}},[S,l,m]),K(()=>{const g=m.state.value,E=m.state.selectedIndex;let A=E,L;v&&Array.isArray(g)?(A=Ur(S,l,m.context.valuesRef.current,g,h,E),L=A===S,S===E&&!L&&(m.context.selectedItemTextRef.current=null)):(L=g!==void 0&&Ae(l,g,h),L&&(A=S)),m.set("selectedIndex",A),L&&x.current&&(m.context.selectedItemTextRef.current=x.current)},[S,v,h,m,l]);const D=o.useRef("mouse"),G=o.useRef(!1),{getButtonProps:$,buttonRef:R}=Jt({disabled:_,focusableWhenDisabled:!0,native:y,composite:!0}),F={disabled:_,selected:a,highlighted:T};function z(g){if(C||d)return;const E=m.state.value;if(v){const A=Array.isArray(E)?E:[],L=a?Br(A,l,h):[...A,l];m.context.setValue(L,pe(xt,g))}else m.context.setValue(l,pe(xt,g)),m.context.setOpen(!1,pe(xt,g))}function J(){m.context.selectionRef.current.dragY=0}const q={role:"option","aria-selected":a,tabIndex:p&&T?0:-1,onKeyDown(g){m.set("activeIndex",S),g.key===" "&&m.context.typingRef.current&&g.preventDefault()},onClick(g){const E=D.current!=="touch",A=g.nativeEvent.pointerType,L=E&&tn(g.nativeEvent)&&(A!==void 0||T),k=E&&!L&&!G.current;G.current=!1,!(_||k)&&z(g.nativeEvent)},onPointerEnter(g){D.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const E=m.context.selectionRef.current;E.dragY+=g.movementY,E.dragY**2>=64&&(E.allowUnselectedMouseUp=!0)}},onPointerDown(g){D.current=g.pointerType,G.current=!0,J()},onMouseUp(){if(J(),_||D.current==="touch"||G.current)return;const g=!m.context.selectionRef.current.allowSelectedMouseUp&&a,E=!m.context.selectionRef.current.allowUnselectedMouseUp&&!a;g||E||(G.current=!0,H.current?.click(),G.current=!1)}},M=_e("div",t,{ref:[R,n,w.ref,H],state:F,props:[V,q,b,$]}),U=o.useMemo(()=>({selected:a,index:S,textRef:x,selectedByFocus:O}),[a,S,x,O]);return ae.jsx(bn.Provider,{value:U,children:M})})),Ao=o.forwardRef(function(t,n){const{selected:r}=Mt();return t.keepMounted||r?ae.jsx(bo,{...t,ref:n}):null}),bo=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:s,keepMounted:i,...l}=e,{selected:f}=Mt(),c=o.useRef(null),{transitionStatus:y,setMounted:b}=nn(f),w=_e("span",e,{ref:[t,c],state:{selected:f,transitionStatus:y},props:[{"aria-hidden":!0,children:"✔️"},l],stateAttributesMapping:Zt});return Et({batch:!0,enabled:!f,open:f,ref:c,onComplete(){f||b(!1)}}),w})),Lo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Mt(),l=Le(),{render:f,className:c,style:y,...b}=t,x=o.useCallback(m=>{m&&(r===0&&(l.context.firstItemTextRef.current=m),i&&(l.context.selectedItemTextRef.current=m))},[l,r,i]);return _e("div",t,{ref:[x,n,s],props:b})}));export{fo as L,To as S,wt as a,ao as b,Eo as c,wo as d,vo as e,Mo as f,Po as g,Oo as h,Ao as i,Lo as j,ar as k,Sr as l,yr as m,Cr as n,Lr as o,$r as p,vt as q,un as r,Bt as s,an as t,Le as u,Ut as v,Dr as w,rn as x};
@@ -1 +1 @@
1
- import{r as l,c as s,j as e,L as i,B as a}from"./__vite-browser-external-2g_4s3ot.js";import{A as c}from"./arrow-left-DL0hAp_7.js";import{S as m}from"./server-Bm7fHvVa.js";import{E as o}from"./external-link-CI3crg4K.js";function g(){const r=l.useRef(null);l.useLayoutEffect(()=>{const t=r.current?.parentElement;t&&(t.scrollTop=0)},[]);const n=[[s("self_host.step.backend_title"),s("self_host.step.backend_body")],[s("self_host.step.schema_title"),s("self_host.step.schema_body")],[s("self_host.step.client_title"),s("self_host.step.client_body")]];return e.jsx("div",{ref:r,className:"tt-cloud-theme flex flex-1 flex-col font-oai text-oai-black dark:text-oai-white",children:e.jsxs("main",{className:"mx-auto w-full max-w-3xl px-4 py-8 sm:px-6 sm:py-12",children:[e.jsxs(i,{to:"/cloud",className:"mb-7 inline-flex min-h-10 items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(c,{size:16,"aria-hidden":!0}),s("self_host.back")]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(m,{size:18,"aria-hidden":!0}),e.jsx("span",{children:s("self_host.status")})]}),e.jsx("h1",{className:"text-balance text-3xl font-semibold tracking-tight sm:text-4xl",children:s("self_host.title")}),e.jsx("p",{className:"mt-4 max-w-2xl text-base leading-7 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.subtitle")}),e.jsxs("div",{className:"mt-7 rounded-lg border border-oai-gray-300 p-5 dark:border-oai-gray-700",children:[e.jsx("h2",{className:"text-sm font-semibold",children:s("self_host.preview_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.preview_body")})]}),e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.steps_title")}),e.jsx("ol",{className:"mt-5 list-decimal space-y-6 pl-5 marker:text-oai-gray-500",children:n.map(([t,d])=>e.jsxs("li",{className:"pl-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:d})]},t))})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.responsibility_title")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.responsibility_body")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.community")}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[e.jsxs(a,{as:"a",href:"https://github.com/InsForge/InsForge#self-hosted-docker-compose",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.insforge"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]}),e.jsxs(a,{as:"a",href:"https://github.com/xiufengsun/TokenTracker/tree/main/dashboard/edge-patches",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.source"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]})]})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-base font-semibold",children:s("self_host.managed_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.managed_body")}),e.jsx(a,{as:i,to:"/cloud",className:"mt-4 no-underline",children:s("self_host.link.cloud")})]})]})})}export{g as SelfHostPage};
1
+ import{r as l,c as s,j as e,L as i,B as a}from"./__vite-browser-external-DKVGjnxf.js";import{A as c}from"./arrow-left-BqMZ7dgK.js";import{S as m}from"./server-BsilXoLs.js";import{E as o}from"./external-link-BwKhoPLM.js";function g(){const r=l.useRef(null);l.useLayoutEffect(()=>{const t=r.current?.parentElement;t&&(t.scrollTop=0)},[]);const n=[[s("self_host.step.backend_title"),s("self_host.step.backend_body")],[s("self_host.step.schema_title"),s("self_host.step.schema_body")],[s("self_host.step.client_title"),s("self_host.step.client_body")]];return e.jsx("div",{ref:r,className:"tt-cloud-theme flex flex-1 flex-col font-oai text-oai-black dark:text-oai-white",children:e.jsxs("main",{className:"mx-auto w-full max-w-3xl px-4 py-8 sm:px-6 sm:py-12",children:[e.jsxs(i,{to:"/cloud",className:"mb-7 inline-flex min-h-10 items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(c,{size:16,"aria-hidden":!0}),s("self_host.back")]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(m,{size:18,"aria-hidden":!0}),e.jsx("span",{children:s("self_host.status")})]}),e.jsx("h1",{className:"text-balance text-3xl font-semibold tracking-tight sm:text-4xl",children:s("self_host.title")}),e.jsx("p",{className:"mt-4 max-w-2xl text-base leading-7 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.subtitle")}),e.jsxs("div",{className:"mt-7 rounded-lg border border-oai-gray-300 p-5 dark:border-oai-gray-700",children:[e.jsx("h2",{className:"text-sm font-semibold",children:s("self_host.preview_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.preview_body")})]}),e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.steps_title")}),e.jsx("ol",{className:"mt-5 list-decimal space-y-6 pl-5 marker:text-oai-gray-500",children:n.map(([t,d])=>e.jsxs("li",{className:"pl-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:d})]},t))})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.responsibility_title")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.responsibility_body")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.community")}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[e.jsxs(a,{as:"a",href:"https://github.com/InsForge/InsForge#self-hosted-docker-compose",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.insforge"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]}),e.jsxs(a,{as:"a",href:"https://github.com/xiufengsun/TokenTracker/tree/main/dashboard/edge-patches",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.source"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]})]})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-base font-semibold",children:s("self_host.managed_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.managed_body")}),e.jsx(a,{as:i,to:"/cloud",className:"mt-4 no-underline",children:s("self_host.link.cloud")})]})]})})}export{g as SelfHostPage};
@@ -1 +1 @@
1
- import{r as d,c as n,j as t,R as h}from"./__vite-browser-external-2g_4s3ot.js";import{P as f}from"./ProviderIcon-Bp7iFJ_m.js";import{E as b}from"./external-link-CI3crg4K.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-DKVGjnxf.js";import{P as f}from"./ProviderIcon-B1oef_V8.js";import{E as b}from"./external-link-BwKhoPLM.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,3 +1,3 @@
1
- import{o as Re,r as i,j as e,y as Q,c as s,Z as Oe,X as Ee,i as N,az as ke,W as we,R as ls,V as ye,aM as cs,bc as Y}from"./__vite-browser-external-2g_4s3ot.js";import{L as ds,I as us}from"./LocalOnlyNotice-Rk1B8PaZ.js";import{S as ie}from"./Select-kIcvQFAo.js";import{C as ms}from"./chevron-down-Ck8ml43e.js";import{S as $e}from"./search-BDPr56_h.js";import{C as xs}from"./check-C_cfrxiz.js";import{P as gs,a as hs,b as ps,c as fs,d as bs}from"./PopoverPopup-NYiGE8A2.js";import{P as Pe}from"./ProviderIcon-Bp7iFJ_m.js";import{H as ys}from"./HoverTooltip-DY1ENf69.js";import{u as je}from"./useCurrency-CM22CmAq.js";import{i as _s,C as ks}from"./host-mode-r2SW9Mdv.js";import{L as js}from"./loader-circle-ETrjzfmn.js";import{I as vs}from"./info-BBdY9hV4.js";import{a as ws,b as Ns,c as Ss,d as Cs,e as Ms}from"./TooltipPopup-bnMJyilQ.js";import"./arrow-up-right-DLvfE0Wu.js";import"./download-B7uokeIo.js";import"./SelectItemText-BpIsAg3b.js";import"./composite-INW-ELWX.js";import"./usePositioner-B3l2ulTw.js";import"./store-gHeBU8dQ.js";import"./safePolygon-CVZ27a2_.js";const Ae={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"}]]};Ae.node;const Ts=Re(Ae);const qe={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"}]]};qe.node;const Ds=Re(qe),Ls="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 Ne({options:a,value:t,onChange:r,allValue:o="all",allLabel:u,searchPlaceholder:p,emptyLabel:n,ariaLabel:f,disabled:k=!1,className:j=""}){const[v,w]=i.useState(!1),[x,g]=i.useState(""),[b,y]=i.useState(-1),L=i.useRef(null),S=`${i.useId()}-listbox`,P=t===o?u:a.find(h=>h.value===t)?.label??t,M=x.trim().toLowerCase(),D=i.useMemo(()=>M?a.filter(h=>h.label.toLowerCase().includes(M)):a,[a,M]),C=i.useMemo(()=>[{value:o,label:u},...D],[o,u,D]),R=b>=0&&b<C.length?C[b]:null,A=h=>{r(h),w(!1),g(""),y(-1)};i.useEffect(()=>{v&&L.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[v,b]);const J=h=>{if(h.key==="ArrowDown"||h.key==="ArrowUp"){h.preventDefault();const T=h.key==="ArrowDown";y(I=>{const c=C.length;return c?T?I>=c-1?0:I+1:I<=0?c-1:I-1:-1});return}if(h.key==="Enter"){const T=R||(M&&D.length?D[0]:null);if(!T)return;h.preventDefault(),A(T.value)}};return e.jsxs(gs,{open:v,onOpenChange:h=>{w(h),y(-1),h||g("")},children:[e.jsxs(hs,{disabled:k,"aria-label":f,className:Q("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(Ds,{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(ms,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(ps,{children:e.jsx(fs,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(bs,{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($e,{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":S,"aria-activedescendant":R?`${S}-${b}`:void 0,value:x,onChange:h=>{g(h.target.value),y(-1)},onKeyDown:J,placeholder:p,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:S,role:"listbox","aria-label":f,className:"max-h-64 overflow-y-auto",children:[C.map((h,T)=>e.jsxs("button",{id:`${S}-${T}`,type:"button",role:"option","aria-selected":t===h.value,"data-active":T===b?"true":void 0,onMouseEnter:()=>y(T),onClick:()=>A(h.value),className:Q(Ls,t===h.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",T===b&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:h.label}),t===h.value?e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},h.value)),D.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n}):null]})]})})})]})}const Fs="tokentracker-sessions";async function Is(a={}){const t=new URL(`/functions/${Fs}`,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 u=r.status===404?s("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,p=new Error(o?.error||u);throw p.status=r.status,p}return o}function ze(a,t,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const u=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,u)}catch{const p=new Date(o).toISOString();return r?p.slice(11,16):p.slice(0,16).replace("T"," ")}}function Ge(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),u=r%60;return s("sessions.duration.hours",{hours:o,minutes:u})}function W(a){return E(a?.own_total_tokens??a?.total_tokens)}function Rs(a,t=0,r=1/0){if(!t&&r===1/0)return a;const o=a.map(n=>{if(!Array.isArray(n.usage_buckets))return{...n};const f=n.usage_buckets.filter(x=>{const g=Date.parse(x.timestamp);return g>=t&&g<=r}),k=new Map,j=Object.fromEntries([...ce,...fe].map(x=>[x,0]));let v=0,w=0;for(const x of f){v+=E(x.total_tokens),w+=E(x.cost_usd);const g=k.get(x.model)||{...(n.model_usage||[]).find(b=>b.model===x.model),model:x.model,...Object.fromEntries([...ce,...fe].map(b=>[b,0])),cost_usd:0,selected_models:[],reroute_reasons:[],model_attribution:"selected"};for(const b of[...ce,...fe]){const y=E(x[b]);j[b]+=y,g[b]+=y}g.cost_usd+=E(x.cost_usd);for(const b of["selected_models","reroute_reasons"])Array.isArray(x[b])&&(g[b]=[...new Set([...g[b],...x[b]])]);x.model_attribution==="effective"&&(g.model_attribution="effective"),k.set(x.model,g)}return{...n,...j,total_tokens:v,own_total_tokens:v,cost_usd:w,own_cost_usd:w,model_usage:[...k.values()]}}).filter(n=>!Array.isArray(n.usage_buckets)||W(n)>0),u=new Map;for(const n of o){if(!n.parent_session_hash)continue;const f=u.get(n.parent_session_hash)||[];f.push(n),u.set(n.parent_session_hash,f)}const p=(n,f=new Set)=>{if(f.has(n.session_hash))return{tokens:0,cost:0};const k=new Set(f).add(n.session_hash);let j=W(n),v=Z(n);for(const w of u.get(n.session_hash)||[]){const x=p(w,k);j+=x.tokens,v+=x.cost}return{tokens:j,cost:v}};for(const n of o){const f=p(n);n.combined_total_tokens=f.tokens,n.combined_cost_usd=f.cost,n.subagent_total_tokens=f.tokens-W(n),n.subagent_cost_usd=f.cost-Z(n)}return o}function Z(a){return E(a?.own_cost_usd??a?.cost_usd)}function E(a){const t=Number(a);return Number.isFinite(t)&&t>=0?t:0}const ce=["input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","total_tokens"],fe=["long_context_","priority_","priority_long_context_"].flatMap(a=>ce.filter(t=>t!=="total_tokens").map(t=>a+t));function B(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:W(a),cost_usd:Z(a),performance:a?.performance}]}function Os(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 u=E(o.estimated_duration_ms),p=E(o.estimated_output_tokens),n=E(o.estimated_request_count);u>0&&p>0&&n>0&&(t.estimated_output_tokens+=p,t.estimated_duration_ms+=u,t.estimated_request_count+=n);const f=E(o.first_response_sample_count),k=E(o.first_response_total_ms);f>0&&k>0&&(t.first_response_total_ms+=k,t.first_response_sample_count+=f)}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 Ke(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,u)=>o+W(u),0),cost:r.reduce((o,u)=>o+Z(u),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Os(r)}}function _e(a){const t=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(t)?t:0}function Es(a,t){return[...a].sort((r,o)=>(t==="cost"?Z(o)-Z(r):t==="tokens"?W(o)-W(r):0)||_e(o)-_e(r))}function de(a){const t=_e(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 $s(a,t){const r=new Map;for(const o of a){const u=t==="project"?o.project_key||"":de(o),p=r.get(u)||{key:u,sessions:[]};p.sessions.push(o),r.set(u,p)}return[...r.values()]}function Ps(a){const t=new URLSearchParams(a),r=t.get("source"),o=n=>{const f=t.get(n)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(f))return"";const k=new Date(`${f}T00:00:00`);return Number.isFinite(k.getTime())&&de({ended_at:k.toISOString()})===f?f:""},u=o("from"),p=o("to");return{source:["claude","codex","grok"].includes(r)?r:"all",model:t.get("model")||"all",from:u,to:p}}function As(a,t,r){let o=t?new Date(`${t}T00:00:00`).getTime():0,u=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>u&&(o=new Date(`${r}T00:00:00`).getTime(),u=new Date(`${t}T23:59:59.999`).getTime());const p=Date.parse(a.ended_at||a.started_at||""),n=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(p)||p>=o)&&(!Number.isFinite(n)||n<=u)}function ae({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 qs=[{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")}],zs=[{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 Gs(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 Se(a){return String(a||"").startsWith("litellm")?s("sessions.detail.pricing_litellm"):String(a||"").startsWith("curated")?s("sessions.detail.pricing_curated"):null}function Ks(a,t){return t||Number(a)>0}function Ce({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 le({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 Us({session:a,subagents:t=[],onClose:r}){const o=i.useRef(null),u=i.useRef(null),{currency:p,rate:n}=je(),{resolvedLocale:f}=Oe(),k=c=>ke(c,{currency:p,rate:n}),j=B(a),v=i.useMemo(()=>Ke(t),[t]),w=W(a),x=Z(a),g=Number(a.subagent_total_tokens??v.tokens),b=Number(a.subagent_cost_usd??v.cost),y=a.performance,L=Number(y?.estimated_tokens_per_second)>0&&Number(y?.estimated_request_count)>0,S=Number(y?.first_response_sample_count)>0&&y?.first_response_ms!=null&&Number.isFinite(Number(y.first_response_ms)),P=S?{seconds:(Number(y.first_response_ms)/1e3).toFixed(2),count:y.first_response_sample_count}:null,M=Number(a.reasoning_output_tokens)>0,D=a.source==="grok",C=D&&Number(a.context_window_tokens)>0;i.useEffect(()=>{const c=document.activeElement,O=document.body.style.overflow;document.body.style.overflow="hidden",o.current?.focus();const $=F=>{if(F.key==="Escape"&&(F.preventDefault(),r()),F.key!=="Tab")return;const z=Array.from(u.current?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), summary, [tabindex="0"]')||[]),ee=z[0],se=z[z.length-1];ee?F.shiftKey&&(document.activeElement===ee||!u.current?.contains(document.activeElement))?(F.preventDefault(),se.focus()):!F.shiftKey&&(document.activeElement===se||!u.current?.contains(document.activeElement))&&(F.preventDefault(),ee.focus()):(F.preventDefault(),u.current?.focus())};return window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$),document.body.style.overflow=O,c instanceof HTMLElement&&c.isConnected&&c.focus()}},[r]);const R=g>0||b>0,A=a.cost_is_partial||R&&v.costIsPartial,J=[{label:s("sessions.detail.own"),tokens:w,cost:x,partial:a.cost_is_partial},{label:s("sessions.detail.subagents"),tokens:g,cost:b,partial:v.costIsPartial}],h=a.agent_nickname||a.title||a.project_key||s("sessions.project.unknown"),T=Ge(a.duration_ms),I=[a.project_key&&a.project_key!==h?a.project_key:null,ze(a.started_at,f),T].filter(Boolean);return e.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/20 dark:bg-black/40",onClick:c=>{c.target===c.currentTarget&&r()},children:e.jsxs("div",{ref:u,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("div",{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(Pe,{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:h}),e.jsx("p",{className:"mt-0.5 break-words text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:I.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(Ee,{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(le,{label:s("sessions.col.tokens"),children:N(w+g)}),e.jsxs(le,{label:s("sessions.col.cost"),className:"border-l",children:[A?"≥":"",k(x+b)]}),e.jsx(le,{label:s("sessions.summary.speed"),className:"border-t",title:L?s("sessions.performance.samples",{count:y.estimated_request_count}):s("sessions.detail.no_speed"),children:L?e.jsx(ae,{performance:y}):"—"}),e.jsx(le,{label:s("sessions.performance.first_response"),className:"border-l border-t",title:s("sessions.performance.first_response_method"),children:S?Number(y.first_response_sample_count)===1?s("sessions.performance.first_response_value_single",P):s("sessions.performance.first_response_value",P):"—"})]}),R?e.jsx("dl",{className:"mt-3 space-y-1.5",children:J.map(c=>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:c.label}),e.jsx("dd",{className:"text-right tabular-nums",children:N(c.tokens)}),e.jsxs("dd",{className:"text-right tabular-nums",children:[c.partial?"≥":"",k(c.cost)]})]},c.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")," · ",Gs(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:qs.map(({key:c,label:O})=>e.jsx(Ce,{label:O(),children:a[c]==null?"—":N(a[c])},c))})]}),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(c=>{const O=c.pricing?.status==="unpriced",$=a.cost_source==="provider_reported"&&j.length===1,F=$?x:c.cost_usd,z=Ks(F,$);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:c.model||s("sessions.model.unknown")}),e.jsx("span",{className:"text-right tabular-nums",children:N(c.total_tokens)}),e.jsx("span",{className:"text-right tabular-nums",children:O&&!z?"—":k(F)})]}),c.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(ae,{performance:c.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:[O?e.jsx("p",{children:s("sessions.detail.pricing_unpriced")}):null,c.pricing.status==="free"?e.jsx("p",{children:s("sessions.detail.pricing_free")}):null,c.pricing.status==="priced"?e.jsx("p",{children:s("sessions.detail.pricing_rates",{input:c.pricing.input,output:c.pricing.output,cacheRead:c.pricing.cache_read,cacheWrite:c.pricing.cache_write})}):null,Se(c.pricing.source)?e.jsx("p",{children:Se(c.pricing.source)}):null]})]}):e.jsx(ae,{performance:c.performance,className:"block pt-1 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400"})]},c.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:zs.map(({key:c,label:O,grokOnly:$})=>e.jsx(Ce,{label:O(),children:typeof a[c]=="number"&&(!$||D)?N(a[c]):s("sessions.detail.not_recorded")},c))}),D&&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:N(a.model_calls),seconds:(Number(a.api_duration_ms||0)/1e3).toFixed(1),tools:N(a.tool_calls),errors:N(a.error_count)})}):null,C?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:N(a.context_tokens_used),window:N(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 Me=_s(),Te=[],be=100,Ws=[{id:"all",label:()=>s("usage.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"grok",label:()=>"Grok"}],Ue=[{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 De(a){const t=Ue.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 Hs(a,t){if(!t)return!0;const r=Date.parse(a.ended_at||a.started_at||"");return Number.isFinite(r)?r>=t:!0}function Vs(a){const t=Date.parse(a.started_at||"");return!Number.isFinite(t)||de({started_at:a.started_at})===de(a)}function Le(a){const t=B(a);return t.length===1?t[0].model||s("sessions.model.unknown"):t.map(r=>`${r.model} ${N(Number(r.total_tokens||0))}`).join(" · ")}async function Fe(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}function Bs(){const[a,t]=i.useState(!1),r=i.useId();return e.jsxs(ws,{open:a,onOpenChange:t,children:[e.jsx(Ns,{delay:150,closeDelay:100,closeOnClick:!1,onClick:()=>t(!0),"aria-label":s("sessions.summary.scope_help"),"aria-describedby":a?r:void 0,className:"sessions-summary-help relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white before:absolute before:-inset-2 before:content-['']",children:e.jsx(vs,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx(Ss,{children:e.jsx(Cs,{side:"bottom",align:"end",sideOffset:12,className:"z-[60]",children:e.jsx(Ms,{id:r,role:"tooltip",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")})})})]})}const Ie=ye.memo(function({session:t,locale:r,nested:o=!1,timeOnly:u=!1,childCount:p=0,expanded:n=!1,onToggle:f,onDetail:k}){const{currency:j,rate:v}=je(),w=String(t.source||"").toUpperCase(),x=Ge(t.duration_ms),g=t.resume_command,b=t.project_key||s("sessions.project.unknown"),y=o||t.thread_kind==="subagent",L=y?t.agent_nickname||t.agent_role||t.title||b:t.title||b,S=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}
1
+ import{o as Re,r as i,j as e,y as Q,c as s,Z as Oe,X as Ee,i as N,az as ke,W as we,R as ls,V as ye,aM as cs,bc as Y}from"./__vite-browser-external-DKVGjnxf.js";import{L as ds,I as us}from"./LocalOnlyNotice-Cf9NPAL1.js";import{S as ie}from"./Select-ClkKzKsi.js";import{C as ms}from"./chevron-down-0nuZGQbD.js";import{S as $e}from"./search-BzL7DvcZ.js";import{C as xs}from"./check-BTSG8HIW.js";import{P as gs,a as hs,b as ps,c as fs,d as bs}from"./PopoverPopup-B_fwRpm_.js";import{P as Pe}from"./ProviderIcon-B1oef_V8.js";import{H as ys}from"./HoverTooltip-DjJmYzbc.js";import{u as je}from"./useCurrency-EbqxSlEF.js";import{i as _s,C as ks}from"./host-mode-DluVCV7W.js";import{L as js}from"./loader-circle-B2ln5DKm.js";import{I as vs}from"./info-DSgWF_40.js";import{a as ws,b as Ns,c as Ss,d as Cs,e as Ms}from"./TooltipPopup-1KxZ_iHu.js";import"./arrow-up-right-DSJpQHMH.js";import"./download-CzxvhDR9.js";import"./SelectItemText-D_4VNKEi.js";import"./composite-_t6vz49X.js";import"./usePositioner-cTX1WPQP.js";import"./store-CjkDYjXp.js";import"./safePolygon-DeLf2a7a.js";const Ae={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"}]]};Ae.node;const Ts=Re(Ae);const qe={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"}]]};qe.node;const Ds=Re(qe),Ls="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 Ne({options:a,value:t,onChange:r,allValue:o="all",allLabel:u,searchPlaceholder:p,emptyLabel:n,ariaLabel:f,disabled:k=!1,className:j=""}){const[v,w]=i.useState(!1),[x,g]=i.useState(""),[b,y]=i.useState(-1),L=i.useRef(null),S=`${i.useId()}-listbox`,P=t===o?u:a.find(h=>h.value===t)?.label??t,M=x.trim().toLowerCase(),D=i.useMemo(()=>M?a.filter(h=>h.label.toLowerCase().includes(M)):a,[a,M]),C=i.useMemo(()=>[{value:o,label:u},...D],[o,u,D]),R=b>=0&&b<C.length?C[b]:null,A=h=>{r(h),w(!1),g(""),y(-1)};i.useEffect(()=>{v&&L.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[v,b]);const J=h=>{if(h.key==="ArrowDown"||h.key==="ArrowUp"){h.preventDefault();const T=h.key==="ArrowDown";y(I=>{const c=C.length;return c?T?I>=c-1?0:I+1:I<=0?c-1:I-1:-1});return}if(h.key==="Enter"){const T=R||(M&&D.length?D[0]:null);if(!T)return;h.preventDefault(),A(T.value)}};return e.jsxs(gs,{open:v,onOpenChange:h=>{w(h),y(-1),h||g("")},children:[e.jsxs(hs,{disabled:k,"aria-label":f,className:Q("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(Ds,{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(ms,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(ps,{children:e.jsx(fs,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(bs,{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($e,{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":S,"aria-activedescendant":R?`${S}-${b}`:void 0,value:x,onChange:h=>{g(h.target.value),y(-1)},onKeyDown:J,placeholder:p,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:S,role:"listbox","aria-label":f,className:"max-h-64 overflow-y-auto",children:[C.map((h,T)=>e.jsxs("button",{id:`${S}-${T}`,type:"button",role:"option","aria-selected":t===h.value,"data-active":T===b?"true":void 0,onMouseEnter:()=>y(T),onClick:()=>A(h.value),className:Q(Ls,t===h.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",T===b&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:h.label}),t===h.value?e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},h.value)),D.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n}):null]})]})})})]})}const Fs="tokentracker-sessions";async function Is(a={}){const t=new URL(`/functions/${Fs}`,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 u=r.status===404?s("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,p=new Error(o?.error||u);throw p.status=r.status,p}return o}function ze(a,t,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const u=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,u)}catch{const p=new Date(o).toISOString();return r?p.slice(11,16):p.slice(0,16).replace("T"," ")}}function Ge(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),u=r%60;return s("sessions.duration.hours",{hours:o,minutes:u})}function W(a){return E(a?.own_total_tokens??a?.total_tokens)}function Rs(a,t=0,r=1/0){if(!t&&r===1/0)return a;const o=a.map(n=>{if(!Array.isArray(n.usage_buckets))return{...n};const f=n.usage_buckets.filter(x=>{const g=Date.parse(x.timestamp);return g>=t&&g<=r}),k=new Map,j=Object.fromEntries([...ce,...fe].map(x=>[x,0]));let v=0,w=0;for(const x of f){v+=E(x.total_tokens),w+=E(x.cost_usd);const g=k.get(x.model)||{...(n.model_usage||[]).find(b=>b.model===x.model),model:x.model,...Object.fromEntries([...ce,...fe].map(b=>[b,0])),cost_usd:0,selected_models:[],reroute_reasons:[],model_attribution:"selected"};for(const b of[...ce,...fe]){const y=E(x[b]);j[b]+=y,g[b]+=y}g.cost_usd+=E(x.cost_usd);for(const b of["selected_models","reroute_reasons"])Array.isArray(x[b])&&(g[b]=[...new Set([...g[b],...x[b]])]);x.model_attribution==="effective"&&(g.model_attribution="effective"),k.set(x.model,g)}return{...n,...j,total_tokens:v,own_total_tokens:v,cost_usd:w,own_cost_usd:w,model_usage:[...k.values()]}}).filter(n=>!Array.isArray(n.usage_buckets)||W(n)>0),u=new Map;for(const n of o){if(!n.parent_session_hash)continue;const f=u.get(n.parent_session_hash)||[];f.push(n),u.set(n.parent_session_hash,f)}const p=(n,f=new Set)=>{if(f.has(n.session_hash))return{tokens:0,cost:0};const k=new Set(f).add(n.session_hash);let j=W(n),v=Z(n);for(const w of u.get(n.session_hash)||[]){const x=p(w,k);j+=x.tokens,v+=x.cost}return{tokens:j,cost:v}};for(const n of o){const f=p(n);n.combined_total_tokens=f.tokens,n.combined_cost_usd=f.cost,n.subagent_total_tokens=f.tokens-W(n),n.subagent_cost_usd=f.cost-Z(n)}return o}function Z(a){return E(a?.own_cost_usd??a?.cost_usd)}function E(a){const t=Number(a);return Number.isFinite(t)&&t>=0?t:0}const ce=["input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","total_tokens"],fe=["long_context_","priority_","priority_long_context_"].flatMap(a=>ce.filter(t=>t!=="total_tokens").map(t=>a+t));function B(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:W(a),cost_usd:Z(a),performance:a?.performance}]}function Os(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 u=E(o.estimated_duration_ms),p=E(o.estimated_output_tokens),n=E(o.estimated_request_count);u>0&&p>0&&n>0&&(t.estimated_output_tokens+=p,t.estimated_duration_ms+=u,t.estimated_request_count+=n);const f=E(o.first_response_sample_count),k=E(o.first_response_total_ms);f>0&&k>0&&(t.first_response_total_ms+=k,t.first_response_sample_count+=f)}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 Ke(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,u)=>o+W(u),0),cost:r.reduce((o,u)=>o+Z(u),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Os(r)}}function _e(a){const t=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(t)?t:0}function Es(a,t){return[...a].sort((r,o)=>(t==="cost"?Z(o)-Z(r):t==="tokens"?W(o)-W(r):0)||_e(o)-_e(r))}function de(a){const t=_e(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 $s(a,t){const r=new Map;for(const o of a){const u=t==="project"?o.project_key||"":de(o),p=r.get(u)||{key:u,sessions:[]};p.sessions.push(o),r.set(u,p)}return[...r.values()]}function Ps(a){const t=new URLSearchParams(a),r=t.get("source"),o=n=>{const f=t.get(n)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(f))return"";const k=new Date(`${f}T00:00:00`);return Number.isFinite(k.getTime())&&de({ended_at:k.toISOString()})===f?f:""},u=o("from"),p=o("to");return{source:["claude","codex","grok","zcode"].includes(r)?r:"all",model:t.get("model")||"all",from:u,to:p}}function As(a,t,r){let o=t?new Date(`${t}T00:00:00`).getTime():0,u=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>u&&(o=new Date(`${r}T00:00:00`).getTime(),u=new Date(`${t}T23:59:59.999`).getTime());const p=Date.parse(a.ended_at||a.started_at||""),n=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(p)||p>=o)&&(!Number.isFinite(n)||n<=u)}function ae({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 qs=[{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")}],zs=[{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 Gs(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 Se(a){return String(a||"").startsWith("litellm")?s("sessions.detail.pricing_litellm"):String(a||"").startsWith("curated")?s("sessions.detail.pricing_curated"):null}function Ks(a,t){return t||Number(a)>0}function Ce({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 le({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 Us({session:a,subagents:t=[],onClose:r}){const o=i.useRef(null),u=i.useRef(null),{currency:p,rate:n}=je(),{resolvedLocale:f}=Oe(),k=c=>ke(c,{currency:p,rate:n}),j=B(a),v=i.useMemo(()=>Ke(t),[t]),w=W(a),x=Z(a),g=Number(a.subagent_total_tokens??v.tokens),b=Number(a.subagent_cost_usd??v.cost),y=a.performance,L=Number(y?.estimated_tokens_per_second)>0&&Number(y?.estimated_request_count)>0,S=Number(y?.first_response_sample_count)>0&&y?.first_response_ms!=null&&Number.isFinite(Number(y.first_response_ms)),P=S?{seconds:(Number(y.first_response_ms)/1e3).toFixed(2),count:y.first_response_sample_count}:null,M=Number(a.reasoning_output_tokens)>0,D=a.source==="grok",C=D&&Number(a.context_window_tokens)>0;i.useEffect(()=>{const c=document.activeElement,O=document.body.style.overflow;document.body.style.overflow="hidden",o.current?.focus();const $=F=>{if(F.key==="Escape"&&(F.preventDefault(),r()),F.key!=="Tab")return;const z=Array.from(u.current?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), summary, [tabindex="0"]')||[]),ee=z[0],se=z[z.length-1];ee?F.shiftKey&&(document.activeElement===ee||!u.current?.contains(document.activeElement))?(F.preventDefault(),se.focus()):!F.shiftKey&&(document.activeElement===se||!u.current?.contains(document.activeElement))&&(F.preventDefault(),ee.focus()):(F.preventDefault(),u.current?.focus())};return window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$),document.body.style.overflow=O,c instanceof HTMLElement&&c.isConnected&&c.focus()}},[r]);const R=g>0||b>0,A=a.cost_is_partial||R&&v.costIsPartial,J=[{label:s("sessions.detail.own"),tokens:w,cost:x,partial:a.cost_is_partial},{label:s("sessions.detail.subagents"),tokens:g,cost:b,partial:v.costIsPartial}],h=a.agent_nickname||a.title||a.project_key||s("sessions.project.unknown"),T=Ge(a.duration_ms),I=[a.project_key&&a.project_key!==h?a.project_key:null,ze(a.started_at,f),T].filter(Boolean);return e.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/20 dark:bg-black/40",onClick:c=>{c.target===c.currentTarget&&r()},children:e.jsxs("div",{ref:u,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("div",{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(Pe,{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:h}),e.jsx("p",{className:"mt-0.5 break-words text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:I.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(Ee,{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(le,{label:s("sessions.col.tokens"),children:N(w+g)}),e.jsxs(le,{label:s("sessions.col.cost"),className:"border-l",children:[A?"≥":"",k(x+b)]}),e.jsx(le,{label:s("sessions.summary.speed"),className:"border-t",title:L?s("sessions.performance.samples",{count:y.estimated_request_count}):s("sessions.detail.no_speed"),children:L?e.jsx(ae,{performance:y}):"—"}),e.jsx(le,{label:s("sessions.performance.first_response"),className:"border-l border-t",title:s("sessions.performance.first_response_method"),children:S?Number(y.first_response_sample_count)===1?s("sessions.performance.first_response_value_single",P):s("sessions.performance.first_response_value",P):"—"})]}),R?e.jsx("dl",{className:"mt-3 space-y-1.5",children:J.map(c=>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:c.label}),e.jsx("dd",{className:"text-right tabular-nums",children:N(c.tokens)}),e.jsxs("dd",{className:"text-right tabular-nums",children:[c.partial?"≥":"",k(c.cost)]})]},c.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")," · ",Gs(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:qs.map(({key:c,label:O})=>e.jsx(Ce,{label:O(),children:a[c]==null?"—":N(a[c])},c))})]}),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(c=>{const O=c.pricing?.status==="unpriced",$=a.cost_source==="provider_reported"&&j.length===1,F=$?x:c.cost_usd,z=Ks(F,$);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:c.model||s("sessions.model.unknown")}),e.jsx("span",{className:"text-right tabular-nums",children:N(c.total_tokens)}),e.jsx("span",{className:"text-right tabular-nums",children:O&&!z?"—":k(F)})]}),c.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(ae,{performance:c.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:[O?e.jsx("p",{children:s("sessions.detail.pricing_unpriced")}):null,c.pricing.status==="free"?e.jsx("p",{children:s("sessions.detail.pricing_free")}):null,c.pricing.status==="priced"?e.jsx("p",{children:s("sessions.detail.pricing_rates",{input:c.pricing.input,output:c.pricing.output,cacheRead:c.pricing.cache_read,cacheWrite:c.pricing.cache_write})}):null,Se(c.pricing.source)?e.jsx("p",{children:Se(c.pricing.source)}):null]})]}):e.jsx(ae,{performance:c.performance,className:"block pt-1 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400"})]},c.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:zs.map(({key:c,label:O,grokOnly:$})=>e.jsx(Ce,{label:O(),children:typeof a[c]=="number"&&(!$||D)?N(a[c]):s("sessions.detail.not_recorded")},c))}),D&&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:N(a.model_calls),seconds:(Number(a.api_duration_ms||0)/1e3).toFixed(1),tools:N(a.tool_calls),errors:N(a.error_count)})}):null,C?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:N(a.context_tokens_used),window:N(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 Me=_s(),Te=[],be=100,Ws=[{id:"all",label:()=>s("usage.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"grok",label:()=>"Grok"},{id:"zcode",label:()=>"ZCode"}],Ue=[{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 De(a){const t=Ue.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 Hs(a,t){if(!t)return!0;const r=Date.parse(a.ended_at||a.started_at||"");return Number.isFinite(r)?r>=t:!0}function Vs(a){const t=Date.parse(a.started_at||"");return!Number.isFinite(t)||de({started_at:a.started_at})===de(a)}function Le(a){const t=B(a);return t.length===1?t[0].model||s("sessions.model.unknown"):t.map(r=>`${r.model} ${N(Number(r.total_tokens||0))}`).join(" · ")}async function Fe(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}function Bs(){const[a,t]=i.useState(!1),r=i.useId();return e.jsxs(ws,{open:a,onOpenChange:t,children:[e.jsx(Ns,{delay:150,closeDelay:100,closeOnClick:!1,onClick:()=>t(!0),"aria-label":s("sessions.summary.scope_help"),"aria-describedby":a?r:void 0,className:"sessions-summary-help relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white before:absolute before:-inset-2 before:content-['']",children:e.jsx(vs,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx(Ss,{children:e.jsx(Cs,{side:"bottom",align:"end",sideOffset:12,className:"z-[60]",children:e.jsx(Ms,{id:r,role:"tooltip",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")})})})]})}const Ie=ye.memo(function({session:t,locale:r,nested:o=!1,timeOnly:u=!1,childCount:p=0,expanded:n=!1,onToggle:f,onDetail:k}){const{currency:j,rate:v}=je(),w=String(t.source||"").toUpperCase(),x=Ge(t.duration_ms),g=t.resume_command,b=t.project_key||s("sessions.project.unknown"),y=o||t.thread_kind==="subagent",L=y?t.agent_nickname||t.agent_role||t.title||b:t.title||b,S=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
3
  ${s("sessions.project.copy_hint")}`:void 0,M=async()=>{if(t.project_ref)try{await Fe(t.project_ref)?Y({title:s("sessions.project.copied")}):Y({title:s("sessions.project.copy_failed")})}catch{Y({title:s("sessions.project.copy_failed")})}},D=R=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(ys,{text:P,placement:"bottom"}),e.jsx("button",{type:"button",onClick:M,"aria-label":s("sessions.project.copy_aria",{project:b}),className:Q("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",R),children:b})]}),C=async()=>{if(g)try{await Fe(g)?Y({title:s("sessions.resume.copied")}):Y({title:s("sessions.resume.copy_failed")})}catch{Y({title:s("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:Q("sessions-row sessions-row-grid py-3",o&&"sessions-row-nested"),children:[e.jsxs("div",{className:"sessions-row-identity min-w-0",children:[e.jsx("span",{className:"sessions-row-provider inline-flex items-center justify-center text-oai-gray-600 dark:text-oai-gray-300","aria-hidden":"true",children:e.jsx(Pe,{provider:w,size:o?16:18})}),e.jsxs("div",{className:"contents",children:[e.jsx("button",{type:"button",onClick:()=>k(t),"aria-label":s("sessions.detail.open_aria",{title:L}),title:L,className:"sessions-row-title block min-h-9 min-w-0 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-5",children:L}),e.jsxs("div",{className:"sessions-row-meta 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?D("min-h-6 inline-flex items-center md:min-h-0"):e.jsx("span",{className:"truncate",children:b})}),e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full truncate",title:Le(t),children:Le(t)}),e.jsx("span",{className:"sessions-meta-item tabular-nums",children:ze(t.started_at,r,{timeOnly:u&&Vs(t)})}),x?e.jsx("span",{className:"sessions-meta-item tabular-nums",children:x}):null,Number.isFinite(t.session_store_bytes)?e.jsx("span",{className:"sessions-meta-item tabular-nums",title:s("sessions.storage.tooltip",{metric:s(t.session_store_metric==="allocated"?"sessions.storage.allocated":"sessions.storage.logical"),ratio:Math.round(t.bytes_per_1k_tokens||0).toLocaleString(r)}),children:s("sessions.storage.label",{size:s("sessions.storage.size",{value:(t.session_store_bytes/1024/1024).toLocaleString(r,{maximumFractionDigits:2})})})}):null,y?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,S?e.jsx("span",{className:"sessions-meta-item text-amber-700 dark:text-amber-300",children:S}):null,t.cost_source==="provider_reported"?e.jsx("span",{className:"sessions-meta-item",children:s("sessions.badge.reported_cost")}):null,p?e.jsxs("button",{type:"button",onClick:()=>f(t.session_hash),"aria-expanded":n,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(cs,{className:Q("h-3.5 w-3.5 transition-transform",n&&"rotate-90"),"aria-hidden":!0}),n?s("sessions.thread.collapse",{count:p}):s("sessions.thread.expand",{count:p})]}):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:N(t.own_total_tokens),subagents:N(t.subagent_total_tokens),combined:N(t.combined_total_tokens)}):void 0,className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",children:[N(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:["Σ ",N(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?"≥":"",ke(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(ae,{performance:t.performance})})]})]}),e.jsx("button",{type:"button",onClick:C,disabled:!g,title:g||s("sessions.resume.unavailable"),"aria-label":g?s("sessions.resume.copy_aria",{command:g}):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(ks,{className:"h-4 w-4","aria-hidden":!0})})]})});function Qs({sessions:a,selectedModel:t,onSelect:r}){const{groups:o,totalTokens:u}=i.useMemo(()=>{const n=new Map;let f=0;for(const k of a)for(const j of B(k)){const v=j.model||s("sessions.model.unknown"),w=Number(j.total_tokens||0),x=n.get(v)||{model:v,count:0,tokens:0};x.count+=1,x.tokens+=w,f+=w,n.set(v,x)}return{groups:[...n.values()].sort((k,j)=>j.tokens-k.tokens),totalTokens:f}},[a]);function p(n){return Q("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",n?"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:p(t==="all"),children:s("sessions.thread.model_all",{count:a.length,tokens:N(u)})}),o.map(n=>e.jsx("button",{type:"button","aria-pressed":t===n.model,onClick:()=>r(n.model),className:p(t===n.model),children:s("sessions.thread.model_item",{model:n.model,count:n.count,tokens:N(n.tokens)})},n.model))]})})}function ft(){const[a]=i.useState(()=>Ps(window.location.search)),[t,r]=i.useState(null),[o,u]=i.useState(null),[p,n]=i.useState(!0),[f,k]=i.useState(!1),[j,v]=i.useState(a.source),[w,x]=i.useState(a.model),[g,b]=i.useState(a.from||a.to?"custom":"all"),[y,L]=i.useState(a.from),[S,P]=i.useState(a.to),[M,D]=i.useState("all"),[C,R]=i.useState("time"),[A,J]=i.useState("recent"),[h,T]=i.useState(null),[I,c]=i.useState(""),[O,$]=i.useState(be),[F,z]=i.useState(()=>new Set),[ee,se]=i.useState(()=>new Map),re=i.useRef(0),{resolvedLocale:H}=Oe(),{currency:We,rate:He}=je(),oe=i.useCallback(async(l=!1)=>{const m=++re.current;l?k(!0):n(!0),u(null);try{const d=await Is({refresh:l});m===re.current&&r(d)}catch(d){m===re.current&&u(d?.message||String(d))}finally{m===re.current&&(n(!1),k(!1))}},[]);i.useEffect(()=>{Me||we()?oe(!1):n(!1)},[oe]);const G=t?.sessions||Te,Ve=i.useMemo(()=>{const l=new Set,m=[];for(const d of G){const _=d.project_key;!_||l.has(_)||(l.add(_),m.push({value:_,label:_}))}return m.sort((d,_)=>d.label.localeCompare(_.label))},[G]),Be=i.useMemo(()=>{const l=new Set;for(const m of G)for(const d of B(m))d.model&&l.add(d.model);return[...l].sort().map(m=>({value:m,label:m}))},[G]),ue=i.useDeferredValue(I),ne=i.useMemo(()=>{let m=De(g),d=1/0;return g==="custom"&&(m=y?new Date(`${y}T00:00:00`).getTime():0,d=S?new Date(`${S}T23:59:59.999`).getTime():1/0,m>d&&(m=new Date(`${S}T00:00:00`).getTime(),d=new Date(`${y}T23:59:59.999`).getTime())),Rs(G,m,d)},[G,g,y,S]),K=i.useMemo(()=>{const l=ue.trim().toLowerCase(),m=De(g);return ne.filter(d=>{if(j!=="all"&&d.source!==j||M!=="all"&&d.project_key!==M||w!=="all"&&!B(d).some(U=>U.model===w))return!1;if(g==="custom"){if(!As(d,y,S))return!1}else if(!Hs(d,m))return!1;if(!l)return!0;const _=B(d).map(U=>U.model).join(" ");return`${d.title||""} ${d.project_key||""} ${_} ${d.agent_nickname||""} ${d.agent_role||""} ${d.project_ref||""} ${d.session_id||""}`.toLowerCase().includes(l)})},[ne,j,M,w,g,y,S,ue]),X=i.useMemo(()=>Ke(K),[K]),V=i.useMemo(()=>{const l=new Set(K.map(_=>_.session_hash)),m=new Map,d=[];for(const _ of Es(K,A)){const q=_.root_session_hash||_.parent_session_hash;if(_.parent_session_hash&&q&&l.has(q)){const U=m.get(q)||[];U.push(_),m.set(q,U)}else d.push(_)}return{roots:d,childrenByRoot:m,foldedCount:K.length-d.length}},[K,A]),me=j!=="all"||w!=="all"||g!=="all"||M!=="all"||I.trim()!=="";i.useEffect(()=>{$(be),z(new Set),se(new Map)},[j,M,w,g,y,S,ue,A,C,G]);const xe=i.useMemo(()=>V.roots.slice(0,O),[V.roots,O]),Qe=i.useMemo(()=>$s(xe,C),[xe,C]),Ze=i.useMemo(()=>h?ne.filter(l=>l.session_hash!==h.session_hash&&(l.root_session_hash===h.session_hash||l.parent_session_hash===h.session_hash)):Te,[ne,h]),Xe=i.useCallback(()=>T(null),[]),ge=i.useCallback(l=>{b(l),l!=="custom"&&(L(""),P(""))},[]),Ye=i.useCallback(()=>{v("all"),x("all"),D("all"),c(""),ge("all")},[ge]),he=V.roots.length>xe.length,pe=i.useCallback(()=>$(l=>l+be),[]),Je=i.useCallback(l=>{z(m=>{const d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d})},[]),es=i.useCallback((l,m)=>{se(d=>{const _=new Map(d);return m==="all"?_.delete(l):_.set(l,m),_})},[]),ve=i.useRef(null);i.useEffect(()=>{if(!he||typeof IntersectionObserver>"u")return;const l=ve.current;if(!l)return;const m=new IntersectionObserver(d=>{d.some(_=>_.isIntersecting)&&pe()},{rootMargin:"400px"});return m.observe(l),()=>m.disconnect()},[he,pe]);const ss=i.useMemo(()=>Ws.map(l=>({value:l.id,label:l.label()})),[H]),ts=i.useMemo(()=>[...Ue.map(l=>({value:l.id,label:l.label()})),{value:"custom",label:s("sessions.filter.range_custom")}],[H]),as=i.useMemo(()=>[{value:"time",label:s("sessions.group.time")},{value:"project",label:s("sessions.group.project")}],[H]),rs=i.useMemo(()=>[{value:"recent",label:s("sessions.sort.recent")},{value:"cost",label:s("sessions.sort.cost")},{value:"tokens",label:s("sessions.sort.tokens")}],[H]),os=Number(t?.session_count)>Number(t?.returned_count);return!Me&&!we()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(ds,{})}):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("div",{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:f||p,"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(ls,{className:Q("h-4 w-4",f&&"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($e,{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(us,{type:"search",value:I,onChange:l=>c(l.target.value),onKeyDown:l=>{l.key==="Escape"&&I&&(l.preventDefault(),c(""))},"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"}),I?e.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>c(""),"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(Ee,{className:"h-4 w-4","aria-hidden":!0})}):null]}),e.jsx(ie,{ariaLabel:s("sessions.filter.source_aria"),options:ss,value:j,onValueChange:v,className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(ie,{ariaLabel:s("sessions.filter.range_aria"),options:ts,value:g,onValueChange:ge,leadingIcon:e.jsx(Ts,{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(Ne,{options:Ve,value:M,onChange:D,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(Ne,{options:Be,value:w,onChange:x,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"})]}),g==="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:y,onChange:l=>L(l.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:S,onChange:l=>P(l.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]}),!p&&t?e.jsx("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:N(X.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:N(X.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:[X.costIsPartial?"≥":"",ke(X.cost,{currency:We,rate:He})]})]}),e.jsxs("div",{children:[e.jsxs("dt",{className:"flex items-center gap-1.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:s("sessions.summary.speed")}),e.jsx(Bs,{})]}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[e.jsx(ae,{performance:X.performance}),X.performance.estimated_tokens_per_second==null?"—":null]})]})]})}):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:V.foldedCount>0?s("sessions.thread.result_count",{roots:V.roots.length,subagents:V.foldedCount}):s("sessions.filter.result_count",{filtered:K.length,total:G.length})}),me?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(ie,{ariaLabel:s("sessions.group.aria"),options:as,value:C,onValueChange:R,className:"sessions-filter-trigger h-11 min-w-0 max-w-40 px-2.5 text-xs sm:h-8"}),e.jsx(ie,{ariaLabel:s("sessions.sort.aria"),options:rs,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"})]})]}),os?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")})]}):p?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(js,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),s("sessions.loading")]}):K.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:me?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:me?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:Qe.map(l=>e.jsxs(ye.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:C==="project"?l.key||s("sessions.project.unknown"):l.key?new Date(`${l.key}T12:00:00`).toLocaleDateString(H||void 0,{year:"numeric",month:"short",day:"numeric"}):s("sessions.group.unknown_date")})}),l.sessions.map(m=>{const d=V.childrenByRoot.get(m.session_hash)||[],_=F.has(m.session_hash),q=ee.get(m.session_hash)||"all",U=q==="all"?d:d.filter(function(ns){return B(ns).some(is=>is.model===q)});return e.jsxs(ye.Fragment,{children:[e.jsx(Ie,{session:m,locale:H,timeOnly:C==="time",childCount:d.length,expanded:_,onToggle:Je,onDetail:T}),_&&d.length?e.jsx(Qs,{sessions:d,selectedModel:q,onSelect:te=>es(m.session_hash,te)}):null,_?U.map(te=>e.jsx(Ie,{session:te,locale:H,nested:!0,timeOnly:C==="time",onDetail:T},te.session_hash)):null]},m.session_hash)})]},l.key))}),he?e.jsx("div",{ref:ve,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:pe,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")})]})}),h?e.jsx(Us,{session:h,subagents:Ze,onClose:Xe}):null]})}export{ft as SessionsPage};