tokentracker-cli 0.82.1 → 0.82.2

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 (86) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-CkmyCQlm.js → AchievementBadge-Dz8bedOl.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-B4WDkj4Q.js → AchievementsPage-DYeOB_b5.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-CLA812Vd.js → AchievementsSection-ByvPCFbJ.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-rPrkKVBY.js → BadgeDetailModal-CyfdVn-N.js} +1 -1
  5. package/dashboard/dist/assets/{Card-D4wKdGxL.js → Card-C-9AAzrt.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-BzfSSyf4.js → ClawdAnimated-85mtsgNG.js} +1 -1
  7. package/dashboard/dist/assets/CommunityStatsModal-BcY_bUKs.js +1 -0
  8. package/dashboard/dist/assets/{ConfirmModal-CjKotIxk.js → ConfirmModal-1F-oKSQV.js} +1 -1
  9. package/dashboard/dist/assets/DashboardPage-ClasFW2f.js +1 -0
  10. package/dashboard/dist/assets/{DevicePage-Bwrgs9bf.js → DevicePage-Dz6nuSzK.js} +1 -1
  11. package/dashboard/dist/assets/DialogClose-DoAFJvy1.js +1 -0
  12. package/dashboard/dist/assets/DialogDescription-DHznQh6m.js +1 -0
  13. package/dashboard/dist/assets/DialogTitle-DXvcoQzl.js +1 -0
  14. package/dashboard/dist/assets/{FadeIn-D_skMXdS.js → FadeIn-C8JjNrTO.js} +1 -1
  15. package/dashboard/dist/assets/{HeaderGithubStar-Er3o6s3b.js → HeaderGithubStar-xAchQaWn.js} +1 -1
  16. package/dashboard/dist/assets/{IpCheckPage-CVelrxeM.js → IpCheckPage-BMAw8ydi.js} +1 -1
  17. package/dashboard/dist/assets/{LandingPage-0YKN8fUt.js → LandingPage-DHQemdKQ.js} +1 -1
  18. package/dashboard/dist/assets/{LeaderboardAvatar-BTIhp_Eo.js → LeaderboardAvatar-BJULUEGJ.js} +1 -1
  19. package/dashboard/dist/assets/LeaderboardPage-CwIJH5cz.js +2 -0
  20. package/dashboard/dist/assets/{LeaderboardProfileModal-HATS5y64.js → LeaderboardProfileModal-B2gmyvsz.js} +4 -4
  21. package/dashboard/dist/assets/{LeaderboardProfilePage-mnQke6q-.js → LeaderboardProfilePage-CcPzqTDF.js} +3 -3
  22. package/dashboard/dist/assets/{LimitsPage-OyBAsn4S.js → LimitsPage-BahJx6CU.js} +4 -4
  23. package/dashboard/dist/assets/{LocalOnlyNotice-Dc1CtgPN.js → LocalOnlyNotice-tbkd3Hic.js} +1 -1
  24. package/dashboard/dist/assets/{LoginPage-BXJQ9slu.js → LoginPage-DH94HwWF.js} +1 -1
  25. package/dashboard/dist/assets/PetPage-Bgha7egO.js +1 -0
  26. package/dashboard/dist/assets/PopoverPopup-kRGuXnS1.js +1 -0
  27. package/dashboard/dist/assets/{ResetPasswordPage-Bc15F6XB.js → ResetPasswordPage-DDJBMz-A.js} +1 -1
  28. package/dashboard/dist/assets/{Select-DE6DMSrS.js → Select-DbPDNra5.js} +1 -1
  29. package/dashboard/dist/assets/SelectItemText-D5FrEa78.js +1 -0
  30. package/dashboard/dist/assets/{SettingsPage-C_c9z42f.js → SettingsPage-DC3zR4gl.js} +1 -1
  31. package/dashboard/dist/assets/SkillsPage-CnmtS3f-.js +1 -0
  32. package/dashboard/dist/assets/TrendMonitor-DixWn0Ji.js +19 -0
  33. package/dashboard/dist/assets/WidgetsPage-9TJfxcmr.js +1 -0
  34. package/dashboard/dist/assets/{WrappedPage-wnw_Eknp.js → WrappedPage-DiEg9GtQ.js} +1 -1
  35. package/dashboard/dist/assets/{__vite-browser-external-CHbEWSwX.js → __vite-browser-external-BQjn-jcg.js} +22 -10
  36. package/dashboard/dist/assets/__vite-browser-external-DWSIu6d0.css +1 -0
  37. package/dashboard/dist/assets/{agent-logos-DF4o0Ebm.js → agent-logos-9DPVn5O-.js} +1 -1
  38. package/dashboard/dist/assets/{arrow-up-right-B1yj6nxk.js → arrow-up-right-DRXKp-g8.js} +1 -1
  39. package/dashboard/dist/assets/{check-Dvngccc0.js → check-Bp-cxir1.js} +1 -1
  40. package/dashboard/dist/assets/{copy-D592E6jX.js → copy-eRWKRZgV.js} +1 -1
  41. package/dashboard/dist/assets/{download-HHcFs0Ff.js → download-BYBgztAF.js} +1 -1
  42. package/dashboard/dist/assets/{flame-DCV1yyCQ.js → flame-Dn3di8Oc.js} +1 -1
  43. package/dashboard/dist/assets/{format-tokens-BN3gD2gw.js → format-tokens-CUBOjHb3.js} +1 -1
  44. package/dashboard/dist/assets/{icons-DhvcZGBX.js → icons-DGmKoYrQ.js} +1 -1
  45. package/dashboard/dist/assets/{info-DoeeLajS.js → info-hNxx3heq.js} +1 -1
  46. package/dashboard/dist/assets/{limits-providers-Db3iK5TG.js → limits-providers-DbDbUJlS.js} +1 -1
  47. package/dashboard/dist/assets/{link-2-C4RnhbaI.js → link-2-DLpasKnO.js} +1 -1
  48. package/dashboard/dist/assets/{loader-circle-Cz7QNoOj.js → loader-circle-Dr8XBEwL.js} +1 -1
  49. package/dashboard/dist/assets/provider-display-BaIvawBI.js +42 -0
  50. package/dashboard/dist/assets/{terminal-Bwl-eNY6.js → terminal-XHI11uAB.js} +1 -1
  51. package/dashboard/dist/assets/{trash-2-Ceor8aI2.js → trash-2-B_iuyhQd.js} +1 -1
  52. package/dashboard/dist/assets/{use-community-stats-C0cLdfhQ.js → use-community-stats-DXyHOYbX.js} +1 -1
  53. package/dashboard/dist/assets/{use-limits-display-prefs-B-zzSXHf.js → use-limits-display-prefs-BdFQf_ea.js} +1 -1
  54. package/dashboard/dist/assets/{use-native-settings-CIHg16YZ.js → use-native-settings-Gia9MO-Y.js} +1 -1
  55. package/dashboard/dist/assets/{use-ordered-list-XWE9dLyL.js → use-ordered-list-m5UXCO_e.js} +1 -1
  56. package/dashboard/dist/assets/{use-session-efficiency-pref-DUe7bWPZ.js → use-session-efficiency-pref-wCgbduxT.js} +1 -1
  57. package/dashboard/dist/assets/use-transform-CqiRAEK5.js +1 -0
  58. package/dashboard/dist/assets/use-usage-limits-B-zrEGe6.js +1 -0
  59. package/dashboard/dist/assets/{useCurrency-QqSMR7Ba.js → useCurrency-ko1kI_y1.js} +1 -1
  60. package/dashboard/dist/assets/useScrollLock-C24aFA2G.js +1 -0
  61. package/dashboard/dist/assets/{useTokenFormat-BLfmNxg5.js → useTokenFormat-CNxtNtIi.js} +1 -1
  62. package/dashboard/dist/assets/{zap-DjGiVr-_.js → zap-Dqpw2hFM.js} +1 -1
  63. package/dashboard/dist/index.html +2 -2
  64. package/dashboard/dist/share.html +2 -2
  65. package/package.json +1 -1
  66. package/src/lib/grok-limits.js +203 -25
  67. package/src/lib/local-api.js +34 -0
  68. package/src/lib/pet-packages.js +268 -5
  69. package/src/lib/pricing/seed-snapshot.json +1 -1
  70. package/src/lib/usage-limits.js +9 -1
  71. package/dashboard/dist/assets/CommunityStatsModal-BDgJ6Rdv.js +0 -1
  72. package/dashboard/dist/assets/DashboardPage-C61HPDUg.js +0 -1
  73. package/dashboard/dist/assets/DialogDescription-D0X0v38O.js +0 -1
  74. package/dashboard/dist/assets/DialogTitle-qsUpNlJa.js +0 -1
  75. package/dashboard/dist/assets/LeaderboardPage-bGkIx65M.js +0 -2
  76. package/dashboard/dist/assets/PetPage-DsjNXLBM.js +0 -1
  77. package/dashboard/dist/assets/PopoverPopup-BuSDh9-C.js +0 -1
  78. package/dashboard/dist/assets/SelectItemText-Ca7gf5A0.js +0 -1
  79. package/dashboard/dist/assets/SkillsPage-iR9Slxl2.js +0 -1
  80. package/dashboard/dist/assets/TrendMonitor-C-acyVP7.js +0 -19
  81. package/dashboard/dist/assets/WidgetsPage-DmiqtvrV.js +0 -1
  82. package/dashboard/dist/assets/__vite-browser-external-Cd947_ni.css +0 -1
  83. package/dashboard/dist/assets/provider-display-BvvK0p2x.js +0 -42
  84. package/dashboard/dist/assets/use-transform-DgEhM1tE.js +0 -1
  85. package/dashboard/dist/assets/use-usage-limits-B_NbJCPh.js +0 -1
  86. package/dashboard/dist/assets/useScrollLock-DdUQVKDA.js +0 -1
@@ -1,4 +1,4 @@
1
- import{k as G,j as t,b as $,c as r,ae as H,r as b,P as ee,af as te,R as ae,F as ie,L as re,ag as ne,w as oe,o as se,x as C,ah as le}from"./__vite-browser-external-CHbEWSwX.js";import{P as B,c as de,r as v,a as ce,u as ue,b as me,s as xe}from"./use-usage-limits-B_NbJCPh.js";import{L as m,u as pe}from"./use-limits-display-prefs-B-zzSXHf.js";import{C as W}from"./Card-D4wKdGxL.js";import{F as ge}from"./FadeIn-D_skMXdS.js";import{L as fe,l as N,a as he}from"./limits-providers-Db3iK5TG.js";import{L as be}from"./LocalOnlyNotice-Dc1CtgPN.js";import"./arrow-up-right-B1yj6nxk.js";import"./download-HHcFs0Ff.js";const ye=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],ke=G("bell-off",ye);const ve=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],je=G("bell",ve),Ne=[3,2,3,3,2,2,3];function g({className:e}){return t.jsx("div",{className:$("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function we(){return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(g,{className:"h-3 w-12 shrink-0"}),t.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),t.jsx(g,{className:"h-3 w-[30px] shrink-0"}),t.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function _e({bars:e,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),t.jsx(g,{className:$("h-4",i)})]}),Array.from({length:e},(o,n)=>t.jsx(we,{},n))]})}function Me(){return t.jsx(W,{children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(g,{className:"h-3.5 w-28"}),Ne.map((e,a)=>t.jsx(_e,{bars:e,index:a},a))]})})}const I=100;function T(e){const a=Date.parse(e);return Number.isFinite(a)?a:null}function Ee(e){return Math.max(0,Math.min(I,Math.round(e)))}function Ie(e){return new Intl.DateTimeFormat(H(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function Le(e,a,i){if(e==null||e>=a)return I;const o=a-e,n=a-i;return Ee(n/o*I)}function Pe(e){const a=e.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Oe(e,{now:a}={}){if(!e||typeof e!="object")return null;const i=Pe(e);if(i===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),s=[];for(const c of o){const d=T(c?.expires_at);if(d==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:r("limits.codex_reset_bank.row_label",{index:l}),expiresAt:Ie(d),expiresMs:d,percent:Le(T(c?.granted_at),d,n)})}return i===0?null:s.length>0?{kind:"rows",availableCount:i??s.length,rows:s}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const Se="shrink-0 text-oai-black dark:text-oai-white";function Re(e){const a=v(e);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const o=Math.floor(i/6e4);if(o<60)return`${o}m`;const n=Math.floor(o/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Ce(e,a){const i=a===m.REMAINING?100-e:e;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function k(e,a="used_percent"){return e?a==="utilization"?e.utilization:e.used_percent:null}function j(e,a="reset_at"){return e?a==="resets_at"?e.resets_at:e.reset_at:null}function w(e){const a=Math.max(0,Math.min(100,Number(e)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function _(e){const a=Number(e);return Number.isFinite(a)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:a>=100?0:2}).format(a):null}function Te(e){if(!e||typeof e!="object")return null;const a=_(e.used_credits),i=_(e.limit_credits),o=_(e.remaining_credits);return!a||!i||!o?null:r("limits.codex_credits.detail",{used:a,limit:i,remaining:o})}function Ae(e,a){return de({usedPercent:k(e.window,e.pctField),windowSeconds:ce(e,e.window),resetMs:v(j(e.window,e.resetField)),mode:a})}function U(e){return Number.isFinite(e)?new Intl.DateTimeFormat(H(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function De(e,a,i){const o=[K(e,a,i)],n=v(j(e.window,e.resetField)),s=U(n);if(s&&o.push(r("limits.hover.resets_at",{time:s})),e.key==="credits"){const c=Te(e.window);c&&o.push(c)}return o.join(`
2
- `)}function z({text:e}){return e?t.jsx("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:e}):null}function Fe({label:e,pct:a,reset:i,mode:o=m.USED,pacePercent:n=null,paceOver:s=!1,title:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),l=o===m.REMAINING?100-d:d,u=Math.round(l),x=l>0&&u===0?Math.max(l,.35):l;let f=String(u);l>0&&u===0&&(f=r("limits.bar.sub_one_percent"));const h=n==null?null:Math.max(0,Math.min(100,n));return t.jsxs("div",{className:"group relative flex items-center gap-2",children:[t.jsx(z,{text:c}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),t.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[t.jsx("div",{className:`${Ce(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:l>0?"3px":0}}),h!=null&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),t.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),t.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[f,"%"]}),i&&t.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function K(e,a,i){const o=e.label??r(e.labelKey),n=i===m.REMAINING,s=l=>n?100-l:l;if(a.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),u=w(s(l));return n?r("limits.explain.remaining",{label:o,used:u}):r("limits.explain.used",{label:o,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:o,eta:a.runsOutEta});const l=w(s(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const c=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),d=w(s(a.projectedEnd??c));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:d})}function Ge({rows:e,mode:a}){if(e.length===0)return null;const i=a===m.REMAINING;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:n})=>{const s=U(v(j(o.window,o.resetField)));return t.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[K(o,n,a),s?t.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r("limits.hover.resets_at",{time:s})]}):null]},o.key)}),t.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(i?"limits.explain.body_remaining":"limits.explain.body")})]})}function A(e){if(!e)return null;const a=Date.now()-new Date(e).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const o=Math.floor(i/60);if(o<24)return r("shared.time.h_ago",{n:o});const n=Math.floor(o/24);return r("shared.time.d_ago",{n})}const D={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}};function M({label:e,age:a=null,tone:i="live",tooltip:o=null}){const n=D[i]||D.live,s=i==="live";return t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:c=>c.stopPropagation(),children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[s?t.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[t.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),t.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),e,a?t.jsxs(t.Fragment,{children:[" · ",a]}):null]}),o?t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[o,t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function L({name:e,providerId:a,children:i,expandable:o=!1,expanded:n=!1,onToggle:s,badge:c=null}){const d=he(a),l=t.jsxs("div",{className:"flex items-center gap-1.5",children:[d?t.jsx(ee,{provider:d,size:14,className:Se}):null,t.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),c]});return o?t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,i]}):t.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,i]})}const $e=fe;function y({children:e,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return t.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:e})}function He({rows:e,mode:a,extra:i=null}){const o=e.length===0&&!i;return t.jsxs(t.Fragment,{children:[e.map(({spec:n,pace:s})=>t.jsx(Fe,{label:n.label??r(n.labelKey),pct:k(n.window,n.pctField),reset:Re(j(n.window,n.resetField)),mode:a,pacePercent:s.pacePercent,paceOver:s.paceOver,title:De(n,s,a)},n.key)),o?t.jsx(y,{children:r("limits.status.no_data")}):null,i]})}function Be(e){if(!Number.isFinite(e.expiresMs))return null;const a=Math.floor((e.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):r("limits.reset_bank.hover_detail",{date:e.expiresAt,days:a})}function We({row:e}){const a=Math.max(0,Math.min(100,Number(e.percent)||0));return t.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[t.jsx(z,{text:Be(e)}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),t.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:t.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),t.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function Ue({model:e}){const a=e.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[t.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):e.rows.map(i=>t.jsx(We,{row:i},i.key))]})}function ze(e,a){if(e==="codex_meta"){const i=Oe(a.reset_credits);return i?t.jsx(Ue,{model:i}):null}return e==="kimi_parallel"&&a.parallel_limit?t.jsx(y,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})}):e==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?t.jsx(Xe,{defaultDir:a.otel_default_dir}):null}function Ke(e,a,i,o,n,s,c=null){const d=B[e];if(!d)return null;const l=d.windows(a).filter(x=>x.window).map(x=>({spec:x,pace:Ae(x,o)})),u=ze(d.extra,a);return t.jsxs(L,{name:i,providerId:e,expandable:l.length>0,expanded:n,onToggle:s,badge:c,children:[t.jsx(He,{mode:o,rows:l,extra:u}),n?t.jsx(Ge,{rows:l,mode:o}):null]},e)}function Ve(e,a,i,o,n){if(!B[e])return null;if(!a?.configured)return t.jsxs(L,{name:N(e),providerId:e,children:[t.jsx(y,{children:r("limits.status.not_connected")}),e==="opencodeGo"?t.jsx(F,{}):null]},e);if(a.error)return t.jsxs(L,{name:N(e),providerId:e,children:[t.jsx(y,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),e==="opencodeGo"?t.jsx(F,{}):null]},e);const s=N(e),c=a.plan_label?`${s} ${a.plan_label}`:s;let d=null;if(e==="antigravity")if(a.cached){const u=A(a.cached_at);d=t.jsx(M,{label:r("limits.label.antigravity_cached"),age:u,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else d=t.jsx(M,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});const l=a.provenance;return l?.stale&&!d&&(d=t.jsx(M,{label:r("limits.provenance.stale"),age:A(l.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:l.source,confidence:l.confidence})})),Ke(e,a,c,i,o,n,d)}function Xe({defaultDir:e}){const[a,i]=b.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
3
- `),s=async c=>{c.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),t.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function E({n:e,children:a}){return t.jsxs("li",{className:"flex gap-2.5",children:[t.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),t.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function Ye(){return t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function F(){const[e,a]=b.useState(!1),i=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
4
- `),o=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),t.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[t.jsxs(E,{n:"1",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),t.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),t.jsx(Ye,{})]})]}),t.jsxs(E,{n:"2",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")}),t.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_workspace")}),t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_cookie")})]})]}),t.jsxs(E,{n:"3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),t.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),t.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function qe(e){const[a,i]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const n=o.querySelectorAll("[data-limit-label]");let s=0,c=null;if(n.length>0)try{c=document.createElement("canvas").getContext("2d")}catch{c=null}if(c){const l=window.getComputedStyle(n[0]);c.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of n)s=Math.max(s,c.measureText(u.textContent).width)}const d=Math.ceil(s);i(l=>l===d?l:d)}),a}function Je({claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x,order:f,visibility:h,displayMode:V}){const X={claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x},P=b.useRef(null),O=qe(P),[Y,q]=b.useState(null),J=Array.isArray(f)&&f.length>0?f:$e,S=V===m.REMAINING?m.REMAINING:m.USED,Q=S===m.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used"),R=J.filter(p=>!h||h[p]!==!1).map(p=>Ve(p,X[p],S,Y===p,()=>q(Z=>Z===p?null:p))).filter(Boolean);return t.jsx(ge,{delay:.15,children:t.jsx(W,{children:t.jsxs("div",{ref:P,className:"flex flex-col gap-3",style:O>0?{"--tt-limits-label-w":`${O}px`}:void 0,children:[t.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),Q]}),R.length>0?R:t.jsx(y,{children:r("limits.status.all_hidden")})]})})})}const Qe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Ze="x-apple.systempreferences:com.apple.preference.notifications";function et(){const e=oe(),a=se(),i=r("limits.alert.blocked"),o=a?C.button:C.div;return t.jsxs(o,{type:a?"button":void 0,onClick:a?()=>le({type:"action",name:"openURL",value:Ze}):void 0,initial:e?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[t.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),t.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),t.jsx("span",{className:"truncate",children:i}),t.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function ct(){const e=te(),{data:a,error:i,isLoading:o}=ue(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=pe(),s=me();return ae.useEffect(()=>{s.enabled&&a&&xe(a)},[s.enabled,a]),!Qe&&!ie()?t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx(be,{})}):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:r("nav.limits")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.enabled&&s.permissionBlocked?t.jsx(et,{}):null,t.jsx("button",{type:"button",onClick:()=>{s.setEnabled(!s.enabled)},"aria-label":s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${s.enabled&&s.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:s.enabled?t.jsx(je,{className:"h-4 w-4","aria-hidden":!0}):t.jsx(ke,{className:"h-4 w-4","aria-hidden":!0})}),t.jsx(re,{to:"/settings","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 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 no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(ne,{className:"h-4 w-4","aria-hidden":!0})})]})]}),o?t.jsx(Me,{}):t.jsxs(t.Fragment,{children:[i?t.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,t.jsx(Je,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{ct as LimitsPage};
1
+ import{k as G,j as t,b as $,c as r,ah as H,r as b,P as ee,ai as te,R as ae,I as ie,L as re,aj as ne,w as oe,o as se,x as T,ak as le}from"./__vite-browser-external-BQjn-jcg.js";import{P as B,c as de,r as j,a as ce,u as ue,b as me,s as xe}from"./use-usage-limits-B-zrEGe6.js";import{L as m,u as pe}from"./use-limits-display-prefs-BdFQf_ea.js";import{C as W}from"./Card-C-9AAzrt.js";import{F as ge}from"./FadeIn-C8JjNrTO.js";import{L as fe,l as w,a as he}from"./limits-providers-DbDbUJlS.js";import{L as be}from"./LocalOnlyNotice-tbkd3Hic.js";import"./arrow-up-right-DRXKp-g8.js";import"./download-BYBgztAF.js";const ye=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],ke=G("bell-off",ye);const ve=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],je=G("bell",ve),Ne=[3,2,3,3,2,2,3];function g({className:e}){return t.jsx("div",{className:$("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function we(){return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(g,{className:"h-3 w-12 shrink-0"}),t.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),t.jsx(g,{className:"h-3 w-[30px] shrink-0"}),t.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function _e({bars:e,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),t.jsx(g,{className:$("h-4",i)})]}),Array.from({length:e},(o,n)=>t.jsx(we,{},n))]})}function Me(){return t.jsx(W,{children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(g,{className:"h-3.5 w-28"}),Ne.map((e,a)=>t.jsx(_e,{bars:e,index:a},a))]})})}const L=100;function A(e){const a=Date.parse(e);return Number.isFinite(a)?a:null}function Ee(e){return Math.max(0,Math.min(L,Math.round(e)))}function Ie(e){return new Intl.DateTimeFormat(H(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function Le(e,a,i){if(e==null||e>=a)return L;const o=a-e,n=a-i;return Ee(n/o*L)}function Pe(e){const a=e.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Oe(e,{now:a}={}){if(!e||typeof e!="object")return null;const i=Pe(e);if(i===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),s=[];for(const c of o){const d=A(c?.expires_at);if(d==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:r("limits.codex_reset_bank.row_label",{index:l}),expiresAt:Ie(d),expiresMs:d,percent:Le(A(c?.granted_at),d,n)})}return i===0?null:s.length>0?{kind:"rows",availableCount:i??s.length,rows:s}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const Se="shrink-0 text-oai-black dark:text-oai-white";function Ce(e){const a=j(e);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const o=Math.floor(i/6e4);if(o<60)return`${o}m`;const n=Math.floor(o/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Re(e,a){const i=a===m.REMAINING?100-e:e;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function v(e,a="used_percent"){return e?a==="utilization"?e.utilization:e.used_percent:null}function N(e,a="reset_at"){return e?a==="resets_at"?e.resets_at:e.reset_at:null}function _(e){const a=Math.max(0,Math.min(100,Number(e)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function M(e){const a=Number(e);return Number.isFinite(a)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:a>=100?0:2}).format(a):null}function Te(e){if(!e||typeof e!="object")return null;const a=M(e.used_credits),i=M(e.limit_credits),o=M(e.remaining_credits);return!a||!i||!o?null:r("limits.codex_credits.detail",{used:a,limit:i,remaining:o})}function Ae(e,a){return de({usedPercent:v(e.window,e.pctField),windowSeconds:ce(e,e.window),resetMs:j(N(e.window,e.resetField)),mode:a})}function U(e){return Number.isFinite(e)?new Intl.DateTimeFormat(H(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function De(e,a,i){const o=[K(e,a,i)],n=j(N(e.window,e.resetField)),s=U(n);if(s&&o.push(r("limits.hover.resets_at",{time:s})),e.key==="credits"){const c=Te(e.window);c&&o.push(c)}return o.join(`
2
+ `)}function z({text:e}){return e?t.jsx("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:e}):null}function Fe({label:e,pct:a,reset:i,mode:o=m.USED,pacePercent:n=null,paceOver:s=!1,title:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),l=o===m.REMAINING?100-d:d,u=Math.round(l),x=l>0&&u===0?Math.max(l,.35):l;let f=String(u);l>0&&u===0&&(f=r("limits.bar.sub_one_percent"));const h=n==null?null:Math.max(0,Math.min(100,n));return t.jsxs("div",{className:"group relative flex items-center gap-2",children:[t.jsx(z,{text:c}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),t.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[t.jsx("div",{className:`${Re(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:l>0?"3px":0}}),h!=null&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),t.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),t.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[f,"%"]}),i&&t.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function K(e,a,i){const o=e.label??r(e.labelKey),n=i===m.REMAINING,s=l=>n?100-l:l;if(a.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(v(e.window,e.pctField))||0)),u=_(s(l));return n?r("limits.explain.remaining",{label:o,used:u}):r("limits.explain.used",{label:o,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:o,eta:a.runsOutEta});const l=_(s(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const c=Math.max(0,Math.min(100,Number(v(e.window,e.pctField))||0)),d=_(s(a.projectedEnd??c));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:d})}function Ge({rows:e,mode:a}){if(e.length===0)return null;const i=a===m.REMAINING;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:n})=>{const s=U(j(N(o.window,o.resetField)));return t.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[K(o,n,a),s?t.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r("limits.hover.resets_at",{time:s})]}):null]},o.key)}),t.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(i?"limits.explain.body_remaining":"limits.explain.body")})]})}function E(e){if(!e)return null;const a=Date.now()-new Date(e).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const o=Math.floor(i/60);if(o<24)return r("shared.time.h_ago",{n:o});const n=Math.floor(o/24);return r("shared.time.d_ago",{n})}const D={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},$e={claude:"claude",codex:"codex"};function k({label:e,age:a=null,tone:i="live",tooltip:o=null}){const n=D[i]||D.live,s=i==="live";return t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:c=>c.stopPropagation(),children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[s?t.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[t.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),t.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),e,a?t.jsxs(t.Fragment,{children:[" · ",a]}):null]}),o?t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[o,t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function P({name:e,providerId:a,children:i,expandable:o=!1,expanded:n=!1,onToggle:s,badge:c=null}){const d=he(a),l=t.jsxs("div",{className:"flex items-center gap-1.5",children:[d?t.jsx(ee,{provider:d,size:14,className:Se}):null,t.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),c]});return o?t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,i]}):t.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,i]})}const He=fe;function y({children:e,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return t.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:e})}function Be({rows:e,mode:a,extra:i=null}){const o=e.length===0&&!i;return t.jsxs(t.Fragment,{children:[e.map(({spec:n,pace:s})=>t.jsx(Fe,{label:n.label??r(n.labelKey),pct:v(n.window,n.pctField),reset:Ce(N(n.window,n.resetField)),mode:a,pacePercent:s.pacePercent,paceOver:s.paceOver,title:De(n,s,a)},n.key)),o?t.jsx(y,{children:r("limits.status.no_data")}):null,i]})}function We(e){if(!Number.isFinite(e.expiresMs))return null;const a=Math.floor((e.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):r("limits.reset_bank.hover_detail",{date:e.expiresAt,days:a})}function Ue({row:e}){const a=Math.max(0,Math.min(100,Number(e.percent)||0));return t.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[t.jsx(z,{text:We(e)}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),t.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:t.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),t.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function ze({model:e}){const a=e.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[t.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):e.rows.map(i=>t.jsx(Ue,{row:i},i.key))]})}function Ke(e,a){if(e==="codex_meta"){const i=Oe(a.reset_credits);return i?t.jsx(ze,{model:i}):null}return e==="kimi_parallel"&&a.parallel_limit?t.jsx(y,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})}):e==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?t.jsx(Xe,{defaultDir:a.otel_default_dir}):null}function Ve(e,a,i,o,n,s,c=null){const d=B[e];if(!d)return null;const l=d.windows(a).filter(x=>x.window).map(x=>({spec:x,pace:Ae(x,o)})),u=Ke(d.extra,a);return t.jsxs(P,{name:i,providerId:e,expandable:l.length>0,expanded:n,onToggle:s,badge:c,children:[t.jsx(Be,{mode:o,rows:l,extra:u}),n?t.jsx(Ge,{rows:l,mode:o}):null]},e)}function qe(e,a,i,o,n){if(!B[e])return null;if(!a?.configured)return t.jsxs(P,{name:w(e),providerId:e,children:[t.jsx(y,{children:r("limits.status.not_connected")}),e==="opencodeGo"?t.jsx(F,{}):null]},e);if(a.error)return t.jsxs(P,{name:w(e),providerId:e,children:[t.jsx(y,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),e==="opencodeGo"?t.jsx(F,{}):null]},e);const s=w(e),c=a.plan_label?`${s} ${a.plan_label}`:s;let d=null;if(e==="antigravity")if(a.cached){const u=E(a.cached_at);d=t.jsx(k,{label:r("limits.label.antigravity_cached"),age:u,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else d=t.jsx(k,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});if(!d&&a.auth_action_required==="reauth"){const u=$e[e];d=t.jsx(k,{label:r("limits.reauth.badge"),age:E(a.cached_at),tone:"stale",tooltip:u?r("limits.reauth.tooltip",{command:u}):null})}const l=a.provenance;return l?.stale&&!d&&(d=t.jsx(k,{label:r("limits.provenance.stale"),age:E(l.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:l.source,confidence:l.confidence})})),Ve(e,a,c,i,o,n,d)}function Xe({defaultDir:e}){const[a,i]=b.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
3
+ `),s=async c=>{c.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),t.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function I({n:e,children:a}){return t.jsxs("li",{className:"flex gap-2.5",children:[t.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),t.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function Ye(){return t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function F(){const[e,a]=b.useState(!1),i=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
4
+ `),o=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),t.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[t.jsxs(I,{n:"1",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),t.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),t.jsx(Ye,{})]})]}),t.jsxs(I,{n:"2",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")}),t.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_workspace")}),t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_cookie")})]})]}),t.jsxs(I,{n:"3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),t.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),t.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Je(e){const[a,i]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const n=o.querySelectorAll("[data-limit-label]");let s=0,c=null;if(n.length>0)try{c=document.createElement("canvas").getContext("2d")}catch{c=null}if(c){const l=window.getComputedStyle(n[0]);c.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of n)s=Math.max(s,c.measureText(u.textContent).width)}const d=Math.ceil(s);i(l=>l===d?l:d)}),a}function Qe({claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x,order:f,visibility:h,displayMode:V}){const q={claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x},O=b.useRef(null),S=Je(O),[X,Y]=b.useState(null),J=Array.isArray(f)&&f.length>0?f:He,C=V===m.REMAINING?m.REMAINING:m.USED,Q=C===m.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used"),R=J.filter(p=>!h||h[p]!==!1).map(p=>qe(p,q[p],C,X===p,()=>Y(Z=>Z===p?null:p))).filter(Boolean);return t.jsx(ge,{delay:.15,children:t.jsx(W,{children:t.jsxs("div",{ref:O,className:"flex flex-col gap-3",style:S>0?{"--tt-limits-label-w":`${S}px`}:void 0,children:[t.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),Q]}),R.length>0?R:t.jsx(y,{children:r("limits.status.all_hidden")})]})})})}const Ze=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),et="x-apple.systempreferences:com.apple.preference.notifications";function tt(){const e=oe(),a=se(),i=r("limits.alert.blocked"),o=a?T.button:T.div;return t.jsxs(o,{type:a?"button":void 0,onClick:a?()=>le({type:"action",name:"openURL",value:et}):void 0,initial:e?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[t.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),t.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),t.jsx("span",{className:"truncate",children:i}),t.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function ut(){const e=te(),{data:a,error:i,isLoading:o}=ue(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=pe(),s=me();return ae.useEffect(()=>{s.enabled&&a&&xe(a)},[s.enabled,a]),!Ze&&!ie()?t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx(be,{})}):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:r("nav.limits")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.enabled&&s.permissionBlocked?t.jsx(tt,{}):null,t.jsx("button",{type:"button",onClick:()=>{s.setEnabled(!s.enabled)},"aria-label":s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${s.enabled&&s.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:s.enabled?t.jsx(je,{className:"h-4 w-4","aria-hidden":!0}):t.jsx(ke,{className:"h-4 w-4","aria-hidden":!0})}),t.jsx(re,{to:"/settings","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 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 no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(ne,{className:"h-4 w-4","aria-hidden":!0})})]})]}),o?t.jsx(Me,{}):t.jsxs(t.Fragment,{children:[i?t.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,t.jsx(Qe,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{ut as LimitsPage};
@@ -1 +1 @@
1
- import{j as e,c as t}from"./__vite-browser-external-CHbEWSwX.js";import{A as r}from"./arrow-up-right-B1yj6nxk.js";import{D as o}from"./download-HHcFs0Ff.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
1
+ import{j as e,c as t}from"./__vite-browser-external-BQjn-jcg.js";import{A as r}from"./arrow-up-right-DRXKp-g8.js";import{D as o}from"./download-BYBgztAF.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
@@ -1 +1 @@
1
- import{u as p,d as w,e as v,r,c as s,j as e,L as y,f as j}from"./__vite-browser-external-CHbEWSwX.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};
1
+ import{u as p,d as w,e as v,r,c as s,j as e,L as y,f as j}from"./__vite-browser-external-BQjn-jcg.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};
@@ -0,0 +1 @@
1
+ import{k as E,S as re,ao as ie,r as o,ap as se,aq as oe,ar as le,as as q,c as r,j as e,P as ne,b,at as U,X as de}from"./__vite-browser-external-BQjn-jcg.js";import{u as ce,T as O,S as pe}from"./use-native-settings-Gia9MO-Y.js";import{n as xe,C as H}from"./ClawdAnimated-85mtsgNG.js";import{F}from"./FadeIn-C8JjNrTO.js";import{L as me}from"./link-2-DLpasKnO.js";import{L as W}from"./loader-circle-Dr8XBEwL.js";import{Z as ue}from"./zap-Dqpw2hFM.js";import{T as ge}from"./trash-2-B_iuyhQd.js";import{D as be,a as he,b as fe,c as ye,d as ke,e as ve}from"./DialogTitle-DXvcoQzl.js";import{D as je}from"./DialogDescription-DHznQh6m.js";import{D as we}from"./DialogClose-DoAFJvy1.js";import"./Card-C-9AAzrt.js";import"./useScrollLock-C24aFA2G.js";const Ne=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],Se=E("file-archive",Ne);const Ce=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],Pe=E("monitor-up",Ce);const ze=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ie=E("upload",ze),Ae={visible:!1,character:"clawd",size:"medium"};function De(){const t=re()&&ie(),[a,l]=o.useState(Ae);o.useEffect(()=>{if(!t)return;const p=se(s=>{l({visible:!!s.visible,character:xe(s.character),size:["small","medium","large"].includes(s.size)?s.size:"medium"})});return oe(),p},[t]);const d=o.useCallback((p,s)=>{l(m=>({...m,[p]:s})),t&&le(p,s)},[t]);return{available:t,settings:a,setSetting:d}}const k=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function C(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function Te(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return[...k,...Array.isArray(a.pets)?a.pets:[]]}async function M(t){const a=await q();return C(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function Ee(t){return M({action:"install_url",url:t})}async function $(t){const a=await q();return C(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function Me(t){return M({action:"remove",id:t})}async function Le(){const t=await fetch("/functions/tokentracker-pets?scope=codex",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return{importable:Array.isArray(a.importable)?a.importable:[],codexDetected:a.codexDetected===!0}}function _e(t){return M({action:"import_codex",ids:t})}let T=k;function Ke(){const[t,a]=o.useState(T),[l,d]=o.useState(!0),[p,s]=o.useState(!1),m=o.useCallback(async()=>{d(!0);try{const u=await Te();return T=u,a(u),s(!0),u}catch{return T=k,a(k),s(!1),k}finally{d(!1)}},[]);return o.useEffect(()=>{m()},[m]),{pets:t,loading:l,available:p,refresh:m}}const Be={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function Ve(){const t=r("pet.import.subtitle"),a="codex-pets.net",l=t.indexOf(a);return l<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,l),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(l+a.length)]})}const v=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function X({character:t,selected:a,onSelect:l,onRemove:d,removeDisabled:p}){const s=t.nameKey?r(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:l,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",Be[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(H,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:s}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:r("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),d?e.jsx("button",{type:"button",disabled:p,onClick:d,"aria-label":`${r("pet.import.remove")} · ${s}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(ge,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function Re({pet:t,state:a,onStateChange:l}){const[d,p]=o.useState(null),s=o.useRef(null),m=v.find(function(n){return n.id===a}),u=r(m?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:x=>{if(t?.spriteVersionNumber!==2||!s.current)return;const n=s.current.getBoundingClientRect(),h=x.clientX-(n.left+n.width/2),c=x.clientY-(n.top+n.height/2),j=(Math.atan2(h,-c)*180/Math.PI+360)%360;p(Math.round(j/22.5)%16)},onPointerLeave:()=>p(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),u]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:s,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(H,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:d})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":r("pet.preview.states"),children:v.map(x=>e.jsxs("button",{type:"button",onClick:()=>l(x.id),"aria-pressed":a===x.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===x.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:r(x.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===x.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},x.id))})})]})}function Ue({pets:t,busy:a,error:l,onImport:d,onClose:p}){const[s,m]=o.useState(()=>new Set),u=n=>m(h=>{const c=new Set(h);return c.has(n)?c.delete(n):c.add(n),c}),x=t.length!==0&&s.size===t.length;return e.jsx(be,{open:!0,onOpenChange:n=>{!n&&!a&&p()},children:e.jsxs(he,{children:[e.jsx(fe,{className:"fixed inset-0 z-50 bg-black/15 backdrop-blur-md dark:bg-black/40 animate-tt-fade-in"}),e.jsx(ye,{className:"fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6",children:e.jsxs(ke,{className:"relative flex max-h-[86vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-oai-gray-200/50 bg-white/95 shadow-2xl backdrop-blur-2xl dark:border-white/10 dark:bg-oai-gray-900/95 animate-tt-modal",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-oai-gray-200/70 px-5 py-4 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(ve,{className:"text-base font-semibold",children:r("pet.codex.title")}),e.jsx(je,{className:"mt-0.5 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.codex.subtitle")})]}),e.jsx(we,{type:"button",disabled:a,"aria-label":r("pet.codex.close"),className:"shrink-0 rounded-full border border-oai-gray-200/60 p-1.5 text-oai-gray-500 transition-colors hover:text-oai-black disabled:opacity-40 dark:border-oai-gray-800/60 dark:text-oai-gray-400 dark:hover:text-white",children:e.jsx(de,{size:16})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:[t.length===0?e.jsx("p",{className:"py-8 text-center text-sm text-oai-gray-400 dark:text-oai-gray-500",children:r("pet.codex.empty")}):e.jsx("div",{className:"grid grid-cols-2 gap-2.5 sm:grid-cols-3",children:t.map(n=>e.jsx(X,{character:n,selected:s.has(n.id),onSelect:()=>u(n.id)},n.id))}),l?e.jsx("p",{role:"alert",className:"mt-3 text-xs text-red-600 dark:text-red-400",children:l}):null]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-oai-gray-200/70 px-5 py-3 dark:border-oai-gray-800",children:[e.jsx("button",{type:"button",disabled:a||t.length===0,onClick:()=>m(x?new Set:new Set(t.map(n=>n.id))),className:"text-xs font-medium text-oai-gray-500 underline-offset-2 hover:underline disabled:opacity-40 dark:text-oai-gray-400",children:r("pet.codex.select_all")}),e.jsxs("button",{type:"button",disabled:a||s.size===0,onClick:()=>d([...s]),className:"flex h-9 items-center gap-1.5 rounded-lg bg-oai-black px-4 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[a?e.jsx(W,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,s.size>0?`${r("pet.codex.import")} · ${s.size}`:r("pet.codex.import")]})]})]})})]})})}function tt(){const{available:t,settings:a,setSetting:l}=De(),{pets:d,loading:p,available:s,refresh:m}=Ke(),[u,x]=o.useState(""),[n,h]=o.useState(""),[c,j]=o.useState(!1),[L,P]=o.useState([]),[Z,z]=o.useState(!1),[w,_]=o.useState(!1),[J,I]=o.useState(""),[Y,K]=o.useState("idle-living"),[B,G]=o.useState(!0),y=a.character||"clawd",A=ce(),V=A.settings?.menuBarIconStyle==="pet",Q=d.find(i=>i.id===y)||d[0],N=c?{kind:"busy",text:r("pet.import.busy")}:n?{kind:"error",text:n}:null,R=L.length!==0;o.useEffect(()=>{!p&&d.length>0&&!d.some(i=>i.id===y)&&l("character","clawd")},[p,d,y,l]);async function S(i,g=r("pet.import.success")){j(!0),h("");try{const f=await i();await m(),f?.pet?.id&&l("character",f.pet.id),U({title:g,timeout:4e3}),x("")}catch(f){h(f?.message||r("pet.import.failed"))}finally{j(!1)}}const D=o.useCallback(async()=>{if(!s){P([]);return}try{const i=await Le();P(i.importable)}catch{P([])}},[s]);o.useEffect(()=>{D()},[D]);async function ee(i){_(!0),I("");try{return await _e(i),await m(),await D(),U({title:r("pet.codex.imported"),timeout:4e3}),!0}catch(g){return I(g?.message||r("pet.import.failed")),!1}finally{_(!1)}}o.useEffect(()=>{if(!B)return;const i=window.setInterval(()=>{K(g=>{const f=v.findIndex(ae=>ae.id===g);return v[(f+1)%v.length].id})},5e3);return()=>window.clearInterval(i)},[B]);const te=[{value:"small",label:r("pet.size.small")},{value:"medium",label:r("pet.size.medium")},{value:"large",label:r("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(F,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:r("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.page.subtitle")})]})}),e.jsx(F,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(Re,{pet:Q,state:Y,onStateChange:i=>{G(!1),K(i)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:r("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid max-h-72 grid-cols-2 gap-2 overflow-y-auto pr-1 -mr-1",children:d.map(i=>e.jsx(X,{character:i,selected:y===i.id,onSelect:()=>l("character",i.id),removeDisabled:c,onRemove:s&&i.custom?()=>S(async()=>(await Me(i.id),y===i.id&&l("character","clawd"),null),r("pet.import.removed")):void 0},i.id))}),A.available?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 rounded-xl border border-oai-gray-200/70 bg-oai-gray-50/60 px-3 py-2.5 dark:border-oai-gray-800 dark:bg-oai-gray-900/40",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold",children:r("pet.menubar.title")}),e.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.menubar.hint")})]}),e.jsx(O,{checked:V,onChange:()=>A.setSetting("menuBarIconStyle",V?"clawd":"pet"),ariaLabel:r("pet.menubar.title")})]}):null]}),s?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 shrink-0 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:r("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(Ve,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:i=>{i.preventDefault(),!c&&u.trim()&&S(()=>Ee(u))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(me,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:u,onChange:i=>x(i.target.value),"aria-label":r("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:c||!u.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[c?e.jsx(W,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,r("pet.import.add")]})]}),e.jsxs("div",{className:b("mt-2 grid gap-2",R?"grid-cols-2":"grid-cols-1"),children:[R?e.jsxs("button",{type:"button",disabled:c||w,onClick:()=>{I(""),z(!0)},className:b("flex h-9 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",(c||w)&&"pointer-events-none opacity-40"),children:[e.jsx(ne,{provider:"codex",size:14,className:"fill-current"}),r("pet.codex.browse")]}):null,e.jsxs("label",{onDragOver:i=>i.preventDefault(),onDrop:i=>{if(i.preventDefault(),c)return;const g=i.dataTransfer?.files?.[0];g&&S(()=>$(g))},className:b("flex h-9 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",c&&"pointer-events-none opacity-40"),children:[e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:c,onChange:i=>{const g=i.target.files?.[0];g&&S(()=>$(g)),i.target.value=""}})]})]}),N?e.jsx("p",{role:N.kind==="error"?"alert":"status",className:b("mt-2 text-xs",N.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:N.text}):null,Z?e.jsx(Ue,{pets:L,busy:w,error:J,onClose:()=>{w||z(!1)},onImport:async i=>{await ee(i)&&z(!1)}}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:r("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:r("pet.controls.show")}),e.jsx(O,{checked:a.visible,onChange:()=>l("visible",!a.visible),disabled:!t,ariaLabel:r("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:r("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(pe,{options:te,value:a.size,onChange:i=>l("size",i),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(ue,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),r("pet.controls.native_only")]})]})]})})]})})})}export{tt as PetPage};
@@ -0,0 +1 @@
1
+ import{k as Ue,aR as Xe,bv as Ke,bw as le,bx as Qe,Q as ne,aQ as ge,r as m,by as $,bz as me,bA as he,bB as oe,aN as Re,bC as We,bD as we,aO as q,A as J,bE as Q,a0 as ue,aH as pe,aP as qe,bF as Ee,bG as ze,E as Je,bH as $e,bI as Te,aF as W,j as G,aM as Ze,aG as Me,aU as et,bJ as tt,bK as nt,bL as ot,bM as st,y as rt,z as Le,bN as it,bO as ye,aK as at,bP as ct,bQ as lt,aL as ut,aJ as ft,bR as dt,aI as pt}from"./__vite-browser-external-BQjn-jcg.js";import{n as Pe,o as Ae,q as He,r as ve,v as se,P as gt,w as mt,k as ht,s as Et,x as Tt,y as Pt,e as vt,f as Ct,g as Rt,h as bt,a as Be,j as St,u as Ot,z as It,A as Mt,t as yt,B as xt,I as Ft,D as kt,c as wt,d as Lt,b as At,p as Ht}from"./useScrollLock-C24aFA2G.js";import{f as Bt,p as Dt,g as Nt}from"./DialogTitle-DXvcoQzl.js";import{r as _t,t as jt,v as Gt,w as Yt,x as Vt,y as Ut,z as Xt,A as Kt}from"./SelectItemText-D5FrEa78.js";const Qt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tn=Ue("chevron-right",Qt);function Wt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function Ce(e,n,t){const l=Wt(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function qt(e){return e?.includes("mouse")&&e!=="mousedown"}class be{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new be}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function _e(e){const n=e.context.dataRef.current,t=Xe(()=>n.hoverInteractionState??be.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function zt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Ae(),O=He(),h=_e(o),j=Qe(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),B=ne(()=>qt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&B()&&$(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(R=>R.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,C=h.handleCloseOptions?.getScope?.()??H??P??x.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:C,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&ve(r.nodesRef.current,O).length>0)}function a(R){const M=Ce(l,"close",h.pointerType),N=()=>{o.setOpen(!1,J(Q,R)),r?.events.emit("floating.closed",R)};M?h.openChangeTimeout.start(M,N):(h.openChangeTimeout.clear(),N())}function d(R){const M=Re(R);if(!We(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",P),g()}function H(R){if(x()&&r){r.events.on("floating.closed",P);return}if(we(R.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,N=R.relatedTarget;if(!(r&&M&&$(N)&&ve(r.nodesRef.current,M,!1).some(U=>q(U.context?.elements.floating,N)))){if(h.handler){h.handler(R);return}g(),B()&&!u()&&a(R)}}function P(R){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,J(Q,R)),r.events.emit("floating.closed",R)})}const C=E;return he(C&&oe(C,"mouseenter",F),C&&oe(C,"mouseleave",H),C&&oe(C,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",P)})},[t,E,o,c,l,i,B,u,g,h,r,O,j])}const Jt={current:null};function $t(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Jt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,u="rootStore"in e?e.rootStore:e,{dataRef:B,events:g}=u.context,x=Ae(c),a=_e(u),d=m.useRef(!1),F=se(i),H=se(l),P=se(p),C=se(t),R=se(j),M=se(h),N=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),V=ne(()=>R.current?.()!==!1),U=ne((s,T,L)=>{const b=u.context.triggerElements;if(b.hasElement(T))return!s||!q(s,T);if(!$(L))return!1;const f=L;return b.hasMatchingElement(A=>q(A,f))&&(!s||!q(s,f))}),_=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>_,[_]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===Q,_(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,_]),m.useEffect(()=>{if(!t)return;function s(f,A=!0){const D=Ce(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,J(Q,f)),x?.events.emit("floating.closed",f)}):A&&(a.openChangeTimeout.clear(),u.setOpen(!1,J(Q,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!$(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const A=xe(P.current),D=Ce(H.current,"open",a.pointerType),Y=Re(f),X=f.currentTarget??null,I=u.select("domReferenceElement");let k=X;if($(Y)&&!u.context.triggerElements.hasElement(Y)){for(const Ie of u.context.triggerElements.elements())if(q(Ie,Y)){k=Ie;break}}$(X)&&$(I)&&!u.context.triggerElements.hasElement(X)&&q(X,I)&&(k=I);const v=k==null?!1:U(I,k,Y),z=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!z&&Z&&d.current,ee=!v&&$(k)&&$(I)&&q(I,k)&&K,te=A>0&&!D,Ve=v&&(z||K)||ee,Oe=!z||v;if(Ve){V()&&u.setOpen(!0,J(Q,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&V()&&u.setOpen(!0,J(Q,f,k))}):Oe&&V()&&u.setOpen(!0,J(Q,f,k)))}function b(f){if(N()){w();return}_();const A=u.select("domReferenceElement"),D=me(A);a.restTimeout.clear(),a.restTimeoutPending=!1;const Y=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&Y){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...Y,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),_(),C.current&&!N()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!q(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",L,{once:!0}),oe(T,"mouseenter",L),oe(T,"mouseleave",b)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",b))},[_,w,B,H,u,t,F,a,r,U,N,o,E,P,S,x,C,O,M,V]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,b=T.currentTarget,f=u.select("domReferenceElement"),A=u.select("open"),D=U(f,b,T.target);if(o&&!Pe(a.pointerType))return;if(A&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??b.ownerDocument.body;Ne(a,{scopeElement:k,referenceElement:b,floatingElement:I})}}const Y=xe(P.current);if(A&&!D||Y===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function X(){if(a.restTimeoutPending=!1,N())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&V()&&u.setOpen(!0,J(Q,L,b))}a.pointerType==="touch"?ue.flushSync(()=>{X()}):D&&A?X():(a.restTimeoutPending=!0,a.restTimeout.start(Y,X))}}},[t,a,N,U,o,u,P,V])}const Fe=.1,Zt=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,S,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,c)&&(r=!r),ie(e,n,S,c,t,l)&&(r=!r),r}function en(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=S&&n<=c}function tn(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,u=null,B=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),H=F-B;if(j===null||u===null||H===0)return j=a,u=d,B=F,!1;const P=a-j,C=d-u,R=P*P+C*C,M=H*H*Zt;return j=a,u=d,B=F,R<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:P,clientY:C}=d,R=Re(d),M=d.type==="mouseleave",N=q(H,R),V=q(F,R);if(N&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&$(d.relatedTarget)&&q(H,d.relatedTarget))return;function U(){return!!(r&&ve(r.nodesRef.current,c).length>0)}function _(){U()||x()}if(U())return;const w=F.getBoundingClientRect(),s=H.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,b=s.width>w.width,f=s.height>w.height,A=(b?w:s).left,D=(b?w:s).right,Y=(f?w:s).top,X=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){_();return}let I=!1;switch(O){case"top":I=ce(P,C,A,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,C,A,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,C,s.right-1,X,w.left+1,Y);break;case"right":I=ce(P,C,w.right-1,X,s.left+1,Y);break}if(I)return;if(h&&!en(P,C,w)){_();return}if(!M&&g(P,C)){_();return}let k=!1;switch(O){case"top":{const v=b?y/2:y*4,z=b||T?i+v:i-v,Z=b?i-v:T?i+v:i-v,K=o+y+1,ee=T||b?s.bottom-y:s.top,te=T?b?s.bottom-y:s.top:s.bottom-y;k=ae(P,C,z,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const v=b?y/2:y*4,z=b||T?i+v:i-v,Z=b?i-v:T?i+v:i-v,K=o-y,ee=T||b?s.top+y:s.bottom,te=T?b?s.top+y:s.bottom:s.top+y;k=ae(P,C,z,K,Z,K,s.left,ee,s.right,te);break}case"left":{const v=f?y/2:y*4,z=f||L?o+v:o-v,Z=f?o-v:L?o+v:o-v,K=i+y+1,ee=L||f?s.right-y:s.left,te=L?f?s.right-y:s.left:s.right-y;k=ae(P,C,ee,s.top,te,s.bottom,K,z,K,Z);break}case"right":{const v=f?y/2:y*4,z=f||L?o+v:o-v,Z=f?o-v:L?o+v:o-v,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(P,C,K,z,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,_):_()}};return l.__options={...e,blockPointerEvents:n},l}const je=m.createContext(void 0);function re(e){const n=m.useContext(je);if(n===void 0&&!e)throw new Error(pe(47));return n}function nn(){return{...Nt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const on={...Dt,disabled:W(e=>e.disabled),instantType:W(e=>e.instantType),openMethod:W(e=>e.openMethod),openChangeReason:W(e=>e.openChangeReason),modal:W(e=>e.modal),focusManagerModal:W(e=>e.focusManagerModal),stickIfOpen:W(e=>e.stickIfOpen),titleElementId:W(e=>e.titleElementId),descriptionElementId:W(e=>e.descriptionElementId),openOnHover:W(e=>e.openOnHover),closeDelay:W(e=>e.closeDelay),hasViewport:W(e=>e.hasViewport)};class Se extends qe{constructor(n,t,l=!1){const i={...nn(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Bt(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},on)}setOpen=(n,t)=>{const l=t.reason===Q,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===ze||t.reason==null),p=mt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Je&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const S=()=>{const c={open:n,openChangeReason:t.reason};Et(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start($e,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(S)):S(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=ht(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:c=null}=e,r=Se.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:S});Pt(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),u=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:B}=Rt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,J(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return G.jsxs(je.Provider,{value:a,children:[x&&G.jsx(sn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function Pn(e){return re(!0)?G.jsx(ke,{props:e}):G.jsx(Tt,{children:G.jsx(ke,{props:e})})}function sn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=bt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>et(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const rn=300;function an(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&q(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const vn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:c,openOnHover:r=!1,delay:O=rn,closeDelay:h=0,id:j,...u}=n,B=re(!0),g=S?.store??B?.store;if(!g)throw new Error(pe(74));const x=Ot(j),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),H=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:C,isMountedByThisTrigger:R}=It(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),N=g.useState("stickIfOpen"),V=g.useState("openMethod"),U=g.useState("focusManagerModal"),_=$t(d,{enabled:!p&&d!=null&&r&&(V!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:tn(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=_t(d,{enabled:d!=null,stickIfOpen:N}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",R),{getButtonProps:L,buttonRef:b}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:A,handlePreFocusGuardFocus:D,handleFocusTargetFocus:Y}=an(g,P),I=Le("button",n,{state:{disabled:p,open:F},ref:[b,t,C,P],props:[w.reference,_,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,L],stateAttributesMapping:f});return R&&!U?G.jsxs(m.Fragment,{children:[G.jsx(ye,{ref:A,onFocus:D}),G.jsx(m.Fragment,{children:I},x),G.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:Y})]}):G.jsx(m.Fragment,{children:I},x)}),Ge=m.createContext(void 0);function cn(){const e=m.useContext(Ge);if(e===void 0)throw new Error(pe(45));return e}const Cn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?G.jsx(Ge.Provider,{value:l,children:G.jsx(at,{ref:t,...i})}):null}),Ye=m.createContext(void 0);function ln(){const e=m.useContext(Ye);if(!e)throw new Error(pe(46));return e}const Rn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:u=5,sticky:B=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=ct,...a}=n,{store:d}=re(),F=cn(),H=xt(),P=d.useState("floatingRootContext"),C=d.useState("mounted"),R=d.useState("open"),M=d.useState("openChangeReason"),N=d.useState("activeTriggerElement"),V=d.useState("modal"),U=d.useState("openMethod"),_=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),b=lt(_,!1,!1),f=Gt({anchor:p,floatingRootContext:P,positionMethod:E,mounted:C,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Ut:void 0}),A=P.useState("domReferenceElement");ge(()=>{const I=A,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const v=new AbortController;return b(()=>{d.set("instantType","trigger-change")},v.signal),()=>{v.abort()}}},[A,b,d]),Yt(R&&V===!0&&M!==Q,U==="touch",_,N);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),Y={open:R,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},X=Vt(n,Y,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!C,inert:!R});return G.jsxs(Ye.Provider,{value:f,children:[C&&V===!0&&M!==Q&&G.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!R),cutout:N}),G.jsx(kt,{id:H,children:X})]})}),un=m.createContext(void 0);function fn(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function dn(e){const{value:n,children:t}=e;return G.jsx(un.Provider,{value:n,children:t})}const pn={...Ht,...pt},bn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=ln(),O=Xt()!=null,{context:h,hasClosePart:j}=fn(),u=c.useState("open"),B=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),H=c.useState("modal"),P=c.useState("mounted"),C=c.useState("openChangeReason"),R=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),N=M.useState("floatingId"),V=c.useState("disabled"),U=c.useState("openOnHover"),_=c.useState("closeDelay"),w=S.id??N;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),zt(M,{enabled:U&&!V,closeDelay:_});const s=p===void 0?wt(c.context.popupRef):p,T=H!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(A=>{c.set("popupElement",A)},[c]),b={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Le("div",n,{state:b,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(A){O&&At.has(A.key)&&A.stopPropagation()}},Kt(x),S],stateAttributesMapping:pn});return G.jsx(Lt,{context:M,openInteractionType:B,modal:T,disabled:!P||C===Q,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(R)?R:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:G.jsx(dn,{value:h,children:f})})});export{Tn as C,Pn as P,vn as a,Cn as b,Rn as c,bn as d};
@@ -1 +1 @@
1
- import{d,e as m,r as t,j as e,L as l,c as o,f as x}from"./__vite-browser-external-CHbEWSwX.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
1
+ import{d,e as m,r as t,j as e,L as l,c as o,f as x}from"./__vite-browser-external-BQjn-jcg.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
@@ -1 +1 @@
1
- import{r as v,J as l,K as w,y as k,j as e,b as x}from"./__vite-browser-external-CHbEWSwX.js";import{u as j,a as N,s as i,L as C,b as E,S as I,c as R,d as T,C as L,e as A,f as P,g as _,h as D,i as G,j as M}from"./SelectItemText-Ca7gf5A0.js";import{C as O}from"./check-Dvngccc0.js";const V=v.forwardRef(function(t,s){const{render:n,className:f,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),z="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 J({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:f,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:f,"aria-label":n,className:x(z,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:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(L,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(A,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{className:x("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",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(V,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(D,{value:a.value,disabled:a.disabled,className:({selected:p,disabled:m})=>x("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",p?"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",m&&"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(G,{children:e.jsx(O,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(M,{children:a.label})})]},String(a.value)))})})})})]})}export{J as S};
1
+ import{r as v,O as l,Q as w,z as k,j as e,b as x}from"./__vite-browser-external-BQjn-jcg.js";import{u as j,a as N,s as i,L as C,b as E,S as I,c as R,d as T,C as L,e as A,f as P,g as O,h as _,i as z,j as D}from"./SelectItemText-D5FrEa78.js";import{C as G}from"./check-Bp-cxir1.js";const M=v.forwardRef(function(t,s){const{render:n,className:f,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),V="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 Q({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:f,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:f,"aria-label":n,className:x(V,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:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(L,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(A,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(O,{className:x("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",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(M,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:p,disabled:m})=>x("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",p?"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",m&&"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(z,{children:e.jsx(G,{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{Q as S};
@@ -0,0 +1 @@
1
+ import{k as Vr,bF as kr,r as l,ck as Nt,bx as vt,aN as qn,cs as Hr,aG as zt,A as _e,by as Ae,dj as it,dk as rn,bR as nt,cB as rt,aV as Be,dl as un,cz as Ct,cy as _t,dm as Nr,dn as Kn,dp as _r,cg as fn,cG as dn,dq as jt,dr as En,ds as Xn,a0 as Br,ch as Wr,aR as Tt,aQ as J,cl as Gn,ci as Ur,Q as ue,dt as Cn,du as Jt,dv as Tn,cp as Qt,bz as ot,aO as at,dw as An,dx as Mt,bI as Jn,dy as Yt,dz as qt,dA as Qn,dB as pn,dC as $r,cu as zr,dD as on,dE as jr,z as gt,cF as Yr,aH as It,aS as Le,j as Ie,aF as oe,O as z,aJ as gn,aU as sn,aT as qr,aW as Kr,aX as Xr,aY as mn,dF as Gr,cq as Jr,ce as Qr,y as Zn,dG as Zr,aK as eo,dH as to,aL as no,cr as ro,bB as oo,dI as so,aI as er,dJ as Zt}from"./__vite-browser-external-BQjn-jcg.js";import{n as In,q as tr,F as io,P as co,o as nr,v as Ye,E as lo,G as et,H as rr,J as ao,p as or,u as uo,m as sr,h as fo,a as po,l as go,A as mo,i as ho,I as xo,d as yo,b as wo}from"./useScrollLock-C24aFA2G.js";const Ro=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",Ro),bo=["top","right","bottom","left"],wt=Math.min,Ne=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return Ne(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mn=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:Mn:t?Mn:On;case"left":case"right":return t?Co:To;default:return[]}}function Io(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Mo(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Mo(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Rt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Nt(),p=vt(),m=l.useMemo(()=>{function y(h,b,x,w){const S=_e(a,b,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function R(h,b,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==b;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const b=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||In(b,!0)&&s)return;const S=R(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Hr(C)){y(S,x,C,b);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,b)})},onClick(h){if(r==="mousedown-only")return;const b=u.current;if(r==="mousedown"&&b){u.current=void 0;return}if(In(b,!0)&&s)return;const x=f.select("open"),w=R(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,b)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),R=c[d?u==="floating"?"reference":"floating":u],h=At(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:a})),b=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:x,strategy:a}):b);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const R=s[y];if(!R)continue;const{name:h,fn:b}=R,{x,y:w,data:S,reset:C}=await b({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...R}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),b=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Io(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,R),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const I=vo(o,i,w);L.push(T[I[0]],T[I[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(I=>I<=0)){var X,B;const I=(((X=s.flip)==null?void 0:X.index)||0)+1,H=P[I];if(H&&(!(u==="alignment"?b!==je(H):!1)||_.every(E=>je(E.placement)===b?E.overflows[0]>0:!0)))return{data:{index:I,overflows:_},reset:{placement:H}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===b||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return bo.some(t=>e[t]>=0)}const Vo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const Ho=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},No=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:h=>{let{x:b,y:x}=h;return{x:b,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",b=p==="y"?"bottom":"right",x=m+u[h],w=m-u[b];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",b=d==="y"?"bottom":"right",x=y+u[h],w=y-u[b];y=cn(x,y,w)}const R=a.fn({...t,[p]:m,[d]:y});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),R=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+R.mainAxis,S=s.reference[d]+s.reference[x]-R.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,b;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:R.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((b=i.offset)==null?void 0:b[u])||0)-(w?R.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let R,h;u==="top"||u==="bottom"?(R=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,R=d==="end"?"top":"bottom");const b=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[R],b),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=b),C&&!d){const _=Ne(g.left,0),X=Ne(g.right,0),B=Ne(g.top,0),k=Ne(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:Ne(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:Ne(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const R=yt(y),h=y.getBoundingClientRect(),b=rt(y),x=h.left+(y.clientLeft+parseFloat(b.paddingLeft))*R.x,w=h.top+(y.clientTop+parseFloat(b.paddingTop))*R.y;a*=R.x,f*=R.y,g*=R.x,u*=R.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?un(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=Ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=Ne(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=Ne(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=Ne(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Nr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),R=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-R+"px "+-h+"px",threshold:Ne(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Hn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[b]=h;b&&b.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&R();function R(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(R)}return n(),()=>{var h;g.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=Ho,ns=No,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ut(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[R,h]=l.useState(null),b=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||R,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};I.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const I=l.useRef(!1);kt(()=>(I.current=!0,()=>{I.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const H=l.useMemo(()=>({reference:C,floating:P,setReference:b,setFloating:x}),[b,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Nn(Y.floating,g.x),A=Nn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:H,elements:Y,floatingStyles:F}),[g,k,H,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),R=l.useRef(null),h=nr(n),b=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...b,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(R.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:R}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(R.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function Rs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function bs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:h,id:b,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),I=Ye(B),H=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(M=>{o(E.current===-1?null:E.current,M)}),N=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Nt(),ne=Nt(),se=ue(()=>{function M(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&M(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||M(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=R},[X,R]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):N.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(N.current&&(E.current=-1,se()),(!me.current||!N.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let M=0;const D=()=>{n.current[0]==null?(M<2&&(M?V=>ne.request(V):queueMicrotask)(D),M+=1):(E.current=W.current==null||nn(W.current,R,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,R,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!N.current)return;const M=Y.nodesRef.current,D=M.find(G=>G.id===H)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=M.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,H,u]),J(()=>{me.current=T,N.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(M=>{if(!j.current)return;const D=n.current.indexOf(M.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(M))}),de=ue(()=>h??Y?.nodesRef.current.find(M=>M.id===H)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(M=>{if(A.current=!1,q.current=!0,M.which===229||!j.current&&M.currentTarget===I.current)return;if(f&&Rs(M.key,R,g,C)){Pt(M.key,de())||et(M),P.setOpen(!1,_e(An,M.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(M.key==="Home"&&(et(M),E.current=Z,v(M)),M.key==="End"&&(et(M),E.current=V,v(M))),S!=null){const G=S(M,E.current,n,R,a,g,y,Z,V);if(G!=null&&(E.current=G,v(M)),R==="both")return}if(Pt(M.key,R)){if(et(M),T&&!u&&Qt(M.currentTarget.ownerDocument)===M.currentTarget){E.current=nn(M.key,R,g)?Z:V,v(M);return}nn(M.key,R,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=Mt(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,Mt(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(M)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=I.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,I,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${b}-${r}`},[u,T,Se,b,r]),ie=l.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...k?{}:ce,onKeyDown(M){if(M.key==="Tab"&&M.shiftKey&&T&&!u){const D=qn(M.nativeEvent);if(D&&!at(I.current,D))return;et(M),P.setOpen(!1,_e(Jn,M.nativeEvent)),nt(_)&&_.focus();return}te(M)},onPointerMove(){A.current=!0}}),[ce,te,I,R,k,P,T,u,_]),re=l.useMemo(()=>{function M(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Me=Pt(V.key,R),Fe=(f?We:Me)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):M(V));return}Me&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?M(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,R,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),R=l.useRef(null),h=ue(w=>{function S(I){const H=r?.current[I];return!H||zr(H)}function C(I){return S(I)?i==null||!$r(on,I,i):!1}function P(I,H,Y=0){if(I.length===0)return-1;const F=(Y%I.length+I.length)%I.length,E=H.toLowerCase();for(let W=0;W<I.length;W+=1){const A=(F+W)%I.length;if(!(!I[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((I,H)=>I&&C(H)?I[0]?.toLowerCase()!==I[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=R.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=R.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),R.current=k):w.key!==" "&&(m.current="",c?.(!1))}),b=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=R.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),R.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:b}),[h,b]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),R=await i.getDimensions(f),h=m==="y",b=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-R[y]/2-1,X=Math.min(d[b],_),B=Math.min(d[x],_),k=X,I=T-R[y]-B,H=T/2-R[y]/2+L,Y=cn(k,H,I),F=!a.arrow&&ut(o)!=null&&H!==Y&&s.reference[y]/2-(H<k?X:B)-R[y]/2<0,E=F?H<k?H-k:H-I:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:H-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Ts(e)).data?.referenceHidden||s}}}},Ht={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Ht};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const b=ot(o);d={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const R=p==="left"?"right":Ht.sideX,h=p==="top"?"bottom":Ht.sideY;return{x:m,y,data:{sideX:R,sideY:h}}}};function yr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Is(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:R,shiftCrossAxis:h=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=R.side||"flip",L=R.align||"flip",_=R.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,I=Ye(t),H=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,N=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+N,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+N,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,be=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:be,alignmentAxis:be}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:be,height:Te}=O.current.getBoundingClientRect(),Re=je(Ve(ve.placement)),Oe=Re==="y"?be:Te,ze=Re==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:be}){if(!H.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const Re=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=be.reference,Pe=(Math.round((Oe+qe)*Re)-Math.round(Oe*Re))/Re,Ke=(Math.round((ze+ct)*Re)-Math.round(ze*Re))/Re;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:be,rects:Te,y:Re}=ee,Oe=Ve(be),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-Re}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:M,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Hn(...ee,xe),nodeId:b,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Ht,We=Z?n:"fixed",Me=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=I.current,pe=typeof ee=="function"?ee():ee,be=(Bn(pe)?pe.current:pe)||null||null;be!==Fe.current&&(te.setPositionReference(be),Fe.current=be)},[y,te,k,I]),l.useEffect(()=>{if(!y)return;const ee=I.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,I]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Hn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(M),Ue=yr(r,ae,F),$e=ut(M)||"center",He=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Me,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:He,refs:te,context:D,isPositioned:Z,update:$}),[Me,Je,O,Qe,Ue,$e,ae,He,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Ms(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function Rr(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return Rr(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const br=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(br);if(e===null)throw new Error(It(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(It(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},bt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...bt},Hs={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Ns={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:bt.touched,setTouched:Le,dirty:bt.dirty,setDirty:Le,filled:bt.filled,setFilled:Le,focused:bt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Ns);function Rn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(It(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=Rn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Ir(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Ie.jsx(l.Fragment,{children:Ir(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Mr(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=Rt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:h,items:b,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:I,name:H,disabled:Y,validation:F,validationMode:E}=Rn(),W=Cr({id:t}),A=Y||u,v=H??a,[N,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:N,open:q,mounted:te,transitionStatus:ce,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,M=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(N,S),[x,N,S]),Me=l.useMemo(()=>x&&Array.isArray(N)?N.map(K=>ft(K,S)):ft(N,S),[x,N,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Me);Bs(Fe,W,N,ae,!A,a);const Ue=l.useRef(N),$e=x?Array.isArray(N)&&N.length>0:N!=null&&ft(N,S)!=="";J(()=>{N!==Ue.current&&$.set("forceMount",!0)},[$,N]),J(()=>{I($e)},[$e,I]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(N)?N:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,N,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,N,ne,C,$,fe]);function He(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}Rr(N,()=>{L(v),_(He(N)),F.change(N)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(N)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Mr(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),be=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),Re=bs(ve,{enabled:!d&&!A,listRef:he,activeIndex:M,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:M,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,Re.reference,Te.reference,be.reference,re);return W&&(K.id=W),K},[be.reference,Oe.reference,Re.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,Re.floating,Te.floating),[Oe.floating,Re.floating,Te.floating]),ct=Re.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:N,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:b,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,N,q,te,ce,qe,ze,b,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(R,F.inputRef),ht=x&&Array.isArray(N)&&N.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(N)||!v?null:N.map(K=>{const ge=ft(K,S);return Ie.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,N,f,v,S,A]);return Ie.jsx(br.Provider,{value:Pe,children:Ie.jsxs(Sr.Provider,{value:ve,children:[T,Ie.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Hs,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=Rn(),{labelId:y}=Er(),{store:R,setOpen:h,selectionRef:b,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(R,U.open),_=z(R,U.mounted),X=z(R,U.value),B=z(R,U.triggerProps),k=z(R,U.positionerElement),I=z(R,U.listElement),H=z(R,U.popupSide),Y=z(R,U.id),F=z(R,U.labelId),E=z(R,U.hasSelectedValue),W=_&&k?H:null,A=s??Y,v=Js(y,F);Cr({id:A});const N=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{R.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{le.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,b,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?I?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{R.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(N.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Ii=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,R=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let b=null;return typeof s=="function"?b=s(u):s!=null?b=s:!m&&i!=null&&!R?b=i:Array.isArray(u)?b=Ys(u,d,p):b=Ir(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:b},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Mi=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Ie.jsx(ni.Provider,{value:!0,children:Ie.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,b)=>{a.set(h,b??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(b=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);b.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((b,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const R=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Ie.jsx(Or.Provider,{value:R,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(It(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:h=to,style:b,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),I=z(w,U.open),H=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),N=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(R),O=H&&ye&&E!=="touch";!H&&ye!==R&&he(R),J(()=>{H||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,H]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&I,E==="touch",W,A);const j=Is({anchor:r,floatingRootContext:k,positionMethod:o,mounted:H,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:I,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Ms(t,Q,{styles:Ce,transitionStatus:N,props:x,refs:[n,ne],hidden:!H,inert:!I}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(I&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Ie.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Ie.jsxs(Pr.Provider,{value:de,children:[H&&Y&&Ie.jsx(xo,{inert:no(!I),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Ie.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:R,scrollHandlerRef:h,listRef:b,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),I=z(a,U.id),H=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),N=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Nt(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){R();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){R();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,M=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=Rt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),R()},Me=ne?M-$:$,Fe=Math.min(fe+Me,re);if(D=Fe,Me<=tt){We(Me,ne?M:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<M){const ae=fe+Me-re;Z=$-(Me-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:Rt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),R()});l.useImperativeHandle(h,()=>O,[O]),gn({open:H,ref:f,onComplete(){H&&g?.(!0)}});const j={open:H,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{H||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[H,C,v,f]),J(()=>{const Q=f.current;if(!H||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(R),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=N||Q,M=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Me=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let He,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);He=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-He.right:Pe.left-He.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=He.top-ie.top+He.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,be=ee-pe,Te=Ue-Me;v.style.left=`${Rt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const Re=Ft($),Oe=be>=Re-tt;Oe&&(pe=Math.min(ae,ie.height)-(be-Re));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(M,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=be;if(He){const Pe=ie.top,Ke=ie.height,ht=He.top+He.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=Rt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),R(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&b.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,H,v,A,d,p,m,f,R,C,T,he,N,b,x,X,P]),l.useEffect(()=>{if(!C||!v||!H)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,H]);const le={...N?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${I}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){N||O(Q.currentTarget)},...C&&{style:N?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!N&&C?$n.className:void 0},c]});return Ie.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Ie.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Mr(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ri(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),R=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const b=t!==void 0;g.current[p]=b?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const b=y.current?h.get(y.current)?.index:null;b!=null&&m(b)})},[s,a,m]),{ref:R,index:p}}const Lr=l.createContext(void 0);function bn(){const e=l.useContext(Lr);if(!e)throw new Error(It(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=Ri({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:R,selectionRef:h,typingRef:b,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,I=k!==-1,H=l.useRef(null);J(()=>{if(!I)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[I,k,i,x]),J(()=>{if(!I)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[I,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function N(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];R(Ce,_e(Zt,O))}else R(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&b.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&b.current||Q||(Y.current=null,N(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,H.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,H],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:I}),[_,k,u,X,I]);return Ie.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=bn();return r||o?Ie.jsx(bi,{...t,ref:n}):null}),bi=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=bn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=bn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{wr as A,Ei as C,ai as L,Ti as S,li as a,$n as b,Ai as c,Ii as d,Mi as e,Oi as f,Pi as g,Di as h,Li as i,Fi as j,Hs as k,Ks as l,Rn as m,Er as n,Wn as o,Bs as p,Rr as q,Oo as r,U as s,Ps as t,mt as u,Is as v,fi as w,Ms as x,Ci as y,gi as z};