tokentracker-cli 0.77.2 → 0.78.0

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 (80) hide show
  1. package/README.de.md +21 -0
  2. package/README.md +21 -0
  3. package/dashboard/dist/assets/ActivityHeatmap-5352XxLR.js +42 -0
  4. package/dashboard/dist/assets/{Card-D_aKGDr7.js → Card-Ca_hYHhx.js} +1 -1
  5. package/dashboard/dist/assets/{ClawdAnimated-vRiBiNhb.js → ClawdAnimated-DSgOS5ND.js} +1 -1
  6. package/dashboard/dist/assets/{CommunityStatsModal-CjetJZ-5.js → CommunityStatsModal-o8uQVQxu.js} +1 -1
  7. package/dashboard/dist/assets/ConfirmModal-D1hi9XUf.js +1 -0
  8. package/dashboard/dist/assets/Controls-CwnKP56V.js +1 -0
  9. package/dashboard/dist/assets/DashboardPage-CDv0TIOL.js +19 -0
  10. package/dashboard/dist/assets/{DevicePage-YAo4ert4.js → DevicePage-BlfIHcZX.js} +1 -1
  11. package/dashboard/dist/assets/DialogClose-CismfYwe.js +1 -0
  12. package/dashboard/dist/assets/DialogDescription-DWKp1yez.js +1 -0
  13. package/dashboard/dist/assets/{DialogTitle-CA5znwms.js → DialogTitle-DuuTVbUb.js} +1 -1
  14. package/dashboard/dist/assets/{FadeIn--ff4ZbC-.js → FadeIn-DpnitRKo.js} +1 -1
  15. package/dashboard/dist/assets/{HeaderGithubStar-CTZvanhz.js → HeaderGithubStar-D6zy-ADl.js} +1 -1
  16. package/dashboard/dist/assets/{IpCheckPage-Bg47gNVu.js → IpCheckPage-yUNp0VNe.js} +1 -1
  17. package/dashboard/dist/assets/{LandingPage-DZ8Mz38n.js → LandingPage-BvmpAaVn.js} +1 -1
  18. package/dashboard/dist/assets/LeaderboardAvatar-2WTIeXye.js +1 -0
  19. package/dashboard/dist/assets/LeaderboardPage-Bq3-VO7w.js +2 -0
  20. package/dashboard/dist/assets/{LeaderboardProfileModal-CfVMENby.js → LeaderboardProfileModal-DH0EEK6q.js} +3 -3
  21. package/dashboard/dist/assets/{LeaderboardProfilePage-C4bGXJCE.js → LeaderboardProfilePage-uJAng2JE.js} +3 -3
  22. package/dashboard/dist/assets/{LimitsPage-BAQ10X55.js → LimitsPage-D8UohgJm.js} +2 -2
  23. package/dashboard/dist/assets/{LocalOnlyNotice-gtHCn7Mx.js → LocalOnlyNotice-Dv_BnDVV.js} +1 -1
  24. package/dashboard/dist/assets/{LoginPage-TXvIBzoW.js → LoginPage-D6b6DZU3.js} +1 -1
  25. package/dashboard/dist/assets/PetPage-DfpBkuCa.js +1 -0
  26. package/dashboard/dist/assets/{PopoverPopup-CQxxgUXk.js → PopoverPopup-CjzdZn-9.js} +1 -1
  27. package/dashboard/dist/assets/{ResetPasswordPage-tN0tmSfP.js → ResetPasswordPage-BnOCFkwe.js} +1 -1
  28. package/dashboard/dist/assets/Select-CHtQAiLD.js +1 -0
  29. package/dashboard/dist/assets/{SelectItemText-2LjzGvo5.js → SelectItemText-Vjqvf8wO.js} +1 -1
  30. package/dashboard/dist/assets/SettingsPage-B-iHGL4q.js +1 -0
  31. package/dashboard/dist/assets/SkillsPage-DtG2aV-q.js +1 -0
  32. package/dashboard/dist/assets/WidgetsPage-4kqTtWfK.js +1 -0
  33. package/dashboard/dist/assets/{WrappedPage-YxshTScX.js → WrappedPage-DMMRpani.js} +1 -1
  34. package/dashboard/dist/assets/agent-logos-D0vYkEpX.js +1 -0
  35. package/dashboard/dist/assets/{arrow-up-right-Bm3t-iA0.js → arrow-up-right-BAQYGZkR.js} +1 -1
  36. package/dashboard/dist/assets/check-C3RPBZiS.js +1 -0
  37. package/dashboard/dist/assets/{copy-DUNz-xWm.js → copy-gG_BLBs8.js} +1 -1
  38. package/dashboard/dist/assets/{download-COSLX73O.js → download-BQOcg3gT.js} +1 -1
  39. package/dashboard/dist/assets/{format-tokens-CR28AiQO.js → format-tokens-CGK6lQAf.js} +1 -1
  40. package/dashboard/dist/assets/{info-Cm7V_KDO.js → info-C_BrDrcq.js} +1 -1
  41. package/dashboard/dist/assets/{link-2-CYqDGrkv.js → link-2-DFwCBbIZ.js} +1 -1
  42. package/dashboard/dist/assets/{loader-circle-6XAdy2ec.js → loader-circle-BMFI_BJ8.js} +1 -1
  43. package/dashboard/dist/assets/main-Dy8Y_qst.css +1 -0
  44. package/dashboard/dist/assets/main-w0hAaCsy.js +1190 -0
  45. package/dashboard/dist/assets/{trash-2-DKLewOQb.js → trash-2-GeZ6IzgV.js} +1 -1
  46. package/dashboard/dist/assets/{use-community-stats-AdPaun74.js → use-community-stats-pC8cmVof.js} +1 -1
  47. package/dashboard/dist/assets/{use-limits-display-prefs-Bau4ykMw.js → use-limits-display-prefs-DnFpPcA3.js} +1 -1
  48. package/dashboard/dist/assets/use-native-settings-CvcOSUhn.js +1 -0
  49. package/dashboard/dist/assets/{use-ordered-list-BVaEJaWa.js → use-ordered-list-CbMroVZ8.js} +2 -2
  50. package/dashboard/dist/assets/{use-quality-per-dollar-pref-Htlc-uFe.js → use-quality-per-dollar-pref-Bn3Al6yX.js} +1 -1
  51. package/dashboard/dist/assets/{use-usage-limits-BnzWTJQS.js → use-usage-limits-D08q_Dr8.js} +1 -1
  52. package/dashboard/dist/assets/{useCurrency-bd6TLRsc.js → useCurrency-h3kqF52v.js} +1 -1
  53. package/dashboard/dist/assets/{useScrollLock-ajoWrfku.js → useScrollLock-9au2731u.js} +1 -1
  54. package/dashboard/dist/index.html +2 -2
  55. package/dashboard/dist/share.html +2 -2
  56. package/package.json +1 -1
  57. package/src/commands/status.js +119 -12
  58. package/src/commands/sync.js +158 -83
  59. package/src/lib/install-resolver.js +1 -0
  60. package/src/lib/local-api.js +202 -56
  61. package/src/lib/pricing/seed-snapshot.json +1 -1
  62. package/src/lib/rollout.js +18 -2
  63. package/dashboard/dist/assets/ActivityHeatmap-CH6m_ZJM.js +0 -42
  64. package/dashboard/dist/assets/ConfirmModal-C6bZw6FZ.js +0 -1
  65. package/dashboard/dist/assets/Controls-Cj22oGL3.js +0 -1
  66. package/dashboard/dist/assets/DashboardPage-DPxiQkQw.js +0 -19
  67. package/dashboard/dist/assets/DialogClose-hhTDeRp1.js +0 -1
  68. package/dashboard/dist/assets/DialogDescription-gxEpcUbJ.js +0 -1
  69. package/dashboard/dist/assets/LeaderboardAvatar-3T57GKKK.js +0 -1
  70. package/dashboard/dist/assets/LeaderboardPage-wP_yCU9I.js +0 -2
  71. package/dashboard/dist/assets/PetPage-Dj1jrxYe.js +0 -1
  72. package/dashboard/dist/assets/Select-DnbHYPS4.js +0 -1
  73. package/dashboard/dist/assets/SettingsPage-DosKS_L6.js +0 -1
  74. package/dashboard/dist/assets/SkillsPage-DaCJ25vT.js +0 -1
  75. package/dashboard/dist/assets/WidgetsPage-CCGemQVD.js +0 -1
  76. package/dashboard/dist/assets/agent-logos-SeuxwQsp.js +0 -1
  77. package/dashboard/dist/assets/check-D8Owfjyw.js +0 -1
  78. package/dashboard/dist/assets/main-BCstrDYE.js +0 -1172
  79. package/dashboard/dist/assets/main-BYdJ5vWR.css +0 -1
  80. package/dashboard/dist/assets/use-native-settings-CidwlprT.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as i,a0 as R,N as n,U as C,r as b,$ as Y,aL as q,l as J,L as Q,aM as Z}from"./main-BCstrDYE.js";import{u as ee}from"./use-usage-limits-BnzWTJQS.js";import{L as p,a as te,l as v,b as ie,u as re}from"./use-limits-display-prefs-Bau4ykMw.js";import{C as D}from"./Card-D_aKGDr7.js";import{F as ae}from"./FadeIn--ff4ZbC-.js";import{L as ne}from"./LocalOnlyNotice-gtHCn7Mx.js";import"./arrow-up-right-Bm3t-iA0.js";import"./download-COSLX73O.js";const oe=[3,2,3,3,2,2,3];function g({className:e}){return i.jsx("div",{className:R("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function le(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(g,{className:"h-3 w-12 shrink-0"}),i.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(g,{className:"h-3 w-[30px] shrink-0"}),i.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function se({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(g,{className:R("h-4",r)})]}),Array.from({length:e},(o,a)=>i.jsx(le,{},a))]})}function de(){return i.jsx(D,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(g,{className:"h-3.5 w-28"}),oe.map((e,t)=>i.jsx(se,{bars:e,index:t},t))]})})}function ce(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function ue(e,t,r=.03){return e>t+r}function me(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function xe(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function _(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function pe({usedPercent:e,windowSeconds:t,resetMs:r,mode:o,now:a=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return d;const c=Math.max(0,(r-a)/1e3),l=ce(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=ue(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=me((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const E=100;function O(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ye(e){return Math.max(0,Math.min(E,Math.round(e)))}function ge(e){return new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function he(e,t,r){if(e==null||e>=t)return E;const o=t-e,a=t-r;return ye(a/o*E)}function be(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function we(e,{now:t}={}){if(!e||typeof e!="object")return null;const r=be(e);if(r===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],a=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of o){const c=O(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ge(c),expiresMs:c,percent:he(O(d?.granted_at),c,a)})}return r===0?null:s.length>0?{kind:"rows",availableCount:r??s.length,rows:s}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const T={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(r=>({key:`scoped-${r.label}`,label:r.label,window:r,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},fe="shrink-0 text-oai-black dark:text-oai-white";function _e(e){const t=_(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return n("shared.time.now");const o=Math.floor(r/6e4);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function ke(e,t){const r=t===p.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function k(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function j(e){const t=Math.max(0,Math.min(100,Number(e)||0)),r=Math.round(t);return t>0&&r===0?n("limits.bar.sub_one_percent"):String(r)}function N(e){const t=Number(e);return Number.isFinite(t)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:t>=100?0:2}).format(t):null}function ve(e){if(!e||typeof e!="object")return null;const t=N(e.used_credits),r=N(e.limit_credits),o=N(e.remaining_credits);return!t||!r||!o?null:n("limits.codex_credits.detail",{used:t,limit:r,remaining:o})}function je(e,t){return pe({usedPercent:f(e.window,e.pctField),windowSeconds:xe(e,e.window),resetMs:_(k(e.window,e.resetField)),mode:t})}function A(e){return Number.isFinite(e)?new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Ne(e,t,r){const o=[$(e,t,r)],a=_(k(e.window,e.resetField)),s=A(a);if(s&&o.push(n("limits.hover.resets_at",{time:s})),e.key==="credits"){const d=ve(e.window);d&&o.push(d)}return o.join(`
1
+ import{j as i,W as R,N as n,V as C,r as b,Z as Y,aM as q,l as Z,L as J,aN as Q}from"./main-w0hAaCsy.js";import{u as ee}from"./use-usage-limits-D08q_Dr8.js";import{L as p,a as te,l as v,b as ie,u as re}from"./use-limits-display-prefs-DnFpPcA3.js";import{C as D}from"./Card-Ca_hYHhx.js";import{F as ae}from"./FadeIn-DpnitRKo.js";import{L as ne}from"./LocalOnlyNotice-Dv_BnDVV.js";import"./arrow-up-right-BAQYGZkR.js";import"./download-BQOcg3gT.js";const oe=[3,2,3,3,2,2,3];function g({className:e}){return i.jsx("div",{className:R("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function le(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(g,{className:"h-3 w-12 shrink-0"}),i.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(g,{className:"h-3 w-[30px] shrink-0"}),i.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function se({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(g,{className:R("h-4",r)})]}),Array.from({length:e},(o,a)=>i.jsx(le,{},a))]})}function de(){return i.jsx(D,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(g,{className:"h-3.5 w-28"}),oe.map((e,t)=>i.jsx(se,{bars:e,index:t},t))]})})}function ce(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function ue(e,t,r=.03){return e>t+r}function me(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function xe(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function _(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function pe({usedPercent:e,windowSeconds:t,resetMs:r,mode:o,now:a=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return d;const c=Math.max(0,(r-a)/1e3),l=ce(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=ue(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=me((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const E=100;function O(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ye(e){return Math.max(0,Math.min(E,Math.round(e)))}function ge(e){return new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function he(e,t,r){if(e==null||e>=t)return E;const o=t-e,a=t-r;return ye(a/o*E)}function be(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function we(e,{now:t}={}){if(!e||typeof e!="object")return null;const r=be(e);if(r===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],a=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of o){const c=O(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ge(c),expiresMs:c,percent:he(O(d?.granted_at),c,a)})}return r===0?null:s.length>0?{kind:"rows",availableCount:r??s.length,rows:s}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const T={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(r=>({key:`scoped-${r.label}`,label:r.label,window:r,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},fe="shrink-0 text-oai-black dark:text-oai-white";function _e(e){const t=_(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return n("shared.time.now");const o=Math.floor(r/6e4);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function ke(e,t){const r=t===p.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function k(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function j(e){const t=Math.max(0,Math.min(100,Number(e)||0)),r=Math.round(t);return t>0&&r===0?n("limits.bar.sub_one_percent"):String(r)}function N(e){const t=Number(e);return Number.isFinite(t)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:t>=100?0:2}).format(t):null}function ve(e){if(!e||typeof e!="object")return null;const t=N(e.used_credits),r=N(e.limit_credits),o=N(e.remaining_credits);return!t||!r||!o?null:n("limits.codex_credits.detail",{used:t,limit:r,remaining:o})}function je(e,t){return pe({usedPercent:f(e.window,e.pctField),windowSeconds:xe(e,e.window),resetMs:_(k(e.window,e.resetField)),mode:t})}function A(e){return Number.isFinite(e)?new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Ne(e,t,r){const o=[$(e,t,r)],a=_(k(e.window,e.resetField)),s=A(a);if(s&&o.push(n("limits.hover.resets_at",{time:s})),e.key==="credits"){const d=ve(e.window);d&&o.push(d)}return o.join(`
2
2
  `)}function G({text:e}){return e?i.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 Me({label:e,pct:t,reset:r,mode:o=p.USED,pacePercent:a=null,paceOver:s=!1,title:d=null}){const c=Math.max(0,Math.min(100,Number(t)||0)),l=o===p.REMAINING?100-c:c,u=Math.round(l),m=l>0&&u===0?Math.max(l,.35):l;let x=String(u);l>0&&u===0&&(x=n("limits.bar.sub_one_percent"));const h=a==null?null:Math.max(0,Math.min(100,a));return i.jsxs("div",{className:"group relative flex items-center gap-2",children:[i.jsx(G,{text:d}),i.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}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${ke(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:l>0?"3px":0}}),h!=null&&i.jsxs(i.Fragment,{children:[i.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"}}),i.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),i.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:[x,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function $(e,t,r){const o=e.label??n(e.labelKey),a=r===p.REMAINING,s=l=>a?100-l:l;if(t.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),u=j(s(l));return a?n("limits.explain.remaining",{label:o,used:u}):n("limits.explain.used",{label:o,used:u})}if(t.paceOver){if(t.runsOutEta)return n("limits.explain.ahead_eta",{label:o,eta:t.runsOutEta});const l=j(s(t.projectedEnd??100));return n(a?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const d=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),c=j(s(t.projectedEnd??d));return n(a?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:c})}function Ee({rows:e,mode:t}){if(e.length===0)return null;const r=t===p.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:a})=>{const s=A(_(k(o.window,o.resetField)));return i.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[$(o,a,t),s?i.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",n("limits.hover.resets_at",{time:s})]}):null]},o.key)}),i.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:n(r?"limits.explain.body_remaining":"limits.explain.body")})]})}function Se(e){if(!e)return null;const t=Date.now()-new Date(e).getTime();if(t<0)return null;const r=Math.floor(t/6e4);if(r<1)return n("shared.time.now");if(r<60)return n("shared.time.m_ago",{n:r});const o=Math.floor(r/60);if(o<24)return n("shared.time.h_ago",{n:o});const a=Math.floor(o/24);return n("shared.time.d_ago",{n:a})}function S({name:e,providerId:t,children:r,expandable:o=!1,expanded:a=!1,onToggle:s,badge:d=null}){const c=ie(t),l=i.jsxs("div",{className:"flex items-center gap-1.5",children:[c?i.jsx(Y,{provider:c,size:14,className:fe}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),d]});return o?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":a,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,r]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,r]})}const Pe=te;function w({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function Ie({rows:e,mode:t,extra:r=null}){const o=e.length===0&&!r;return i.jsxs(i.Fragment,{children:[e.map(({spec:a,pace:s})=>i.jsx(Me,{label:a.label??n(a.labelKey),pct:f(a.window,a.pctField),reset:_e(k(a.window,a.resetField)),mode:t,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Ne(a,s,t)},a.key)),o?i.jsx(w,{children:n("limits.status.no_data")}):null,r]})}function Fe(e){if(!Number.isFinite(e.expiresMs))return null;const t=Math.floor((e.expiresMs-Date.now())/864e5);return t<0?null:t===0?n("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):n("limits.reset_bank.hover_detail",{date:e.expiresAt,days:t})}function Le({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[i.jsx(G,{text:Fe(e)}),i.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}),i.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${t}%`,minWidth:t>0?"3px":0}})}),i.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 Oe({model:e}){const t=e.kind==="count_only"?n("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[i.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.codex_reset_bank.title")}),t?i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t}):e.rows.map(r=>i.jsx(Le,{row:r},r.key))]})}function Ke(e,t){if(e==="codex_meta"){const r=we(t.reset_credits);return r?i.jsx(Oe,{model:r}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(w,{children:n("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(De,{defaultDir:t.otel_default_dir}):null}function Re(e,t,r,o,a,s,d=null){const c=T[e];if(!c)return null;const l=c.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:je(m,o)})),u=Ke(c.extra,t);return i.jsxs(S,{name:r,providerId:e,expandable:l.length>0,expanded:a,onToggle:s,badge:d,children:[i.jsx(Ie,{mode:o,rows:l,extra:u}),a?i.jsx(Ee,{rows:l,mode:o}):null]},e)}function Ce(e,t,r,o,a){if(!T[e])return null;if(!t?.configured)return i.jsxs(S,{name:v(e),providerId:e,children:[i.jsx(w,{children:n("limits.status.not_connected")}),e==="opencodeGo"?i.jsx(K,{}):null]},e);if(t.error)return i.jsxs(S,{name:v(e),providerId:e,children:[i.jsx(w,{tone:"error",children:n("shared.error.prefix",{error:t.error})}),e==="opencodeGo"?i.jsx(K,{}):null]},e);const s=v(e),d=t.plan_label?`${s} ${t.plan_label}`:s;let c=null;if(e==="antigravity")if(t.cached){const l=Se(t.cached_at);c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:u=>u.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-oai-gray-100 dark:bg-oai-gray-800 border border-oai-gray-200/50 dark:border-oai-gray-700/50 text-oai-gray-500 dark:text-oai-gray-400 leading-normal",children:[i.jsx("span",{className:"h-1 w-1 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"}),n("limits.label.antigravity_cached"),l?i.jsxs(i.Fragment,{children:[" · ",l]}):null]}),i.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:[n("limits.tooltip.antigravity_cached"),i.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"})]})]})}else c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 leading-normal",children:[i.jsxs("span",{className:"relative flex h-1 w-1",children:[i.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1 w-1 bg-emerald-500"})]}),n("limits.label.antigravity_live")]}),i.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:[n("limits.tooltip.antigravity_live"),i.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"})]})]});return Re(e,t,d,r,o,a,c)}function De({defaultDir:e}){const[t,r]=b.useState(!1),a=["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
3
  `),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),i.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:a}),i.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:t?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function M({n:e,children:t}){return i.jsxs("li",{className:"flex gap-2.5",children:[i.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}),i.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:t})]})}function Te(){return i.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:i.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function K(){const[e,t]=b.useState(!1),r=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
4
- `),o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:n("limits.opencodeGo.setupHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:n("limits.opencodeGo.setupHint.subtitle")}),i.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[i.jsxs(M,{n:"1",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step1")}),i.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.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:[n("limits.opencodeGo.setupHint.cta"),i.jsx(Te,{})]})]}),i.jsxs(M,{n:"2",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step2")}),i.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_workspace")}),i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_cookie")})]})]}),i.jsxs(M,{n:"3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:n("limits.opencodeGo.setupHint.step3")}),i.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?n("limits.opencodeGo.setupHint.copied"):n("limits.opencodeGo.setupHint.copy")})]}),i.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:r}),i.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Ae(e){const[t,r]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const a=o.querySelectorAll("[data-limit-label]");let s=0,d=null;if(a.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(a[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of a)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);r(l=>l===c?l:c)}),t}function Ge({claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m,order:x,visibility:h,displayMode:H}){const z={claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m},P=b.useRef(null),I=Ae(P),[W,B]=b.useState(null),U=Array.isArray(x)&&x.length>0?x:Pe,F=H===p.REMAINING?p.REMAINING:p.USED,V=F===p.REMAINING?n("limits.settings.display_mode_remaining"):n("limits.settings.display_mode_used"),L=U.filter(y=>!h||h[y]!==!1).map(y=>Ce(y,z[y],F,W===y,()=>B(X=>X===y?null:y))).filter(Boolean);return i.jsx(ae,{delay:.15,children:i.jsx(D,{children:i.jsxs("div",{ref:P,className:"flex flex-col gap-3",style:I>0?{"--tt-limits-label-w":`${I}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[n("limits.panel.title"),n("limits.panel.mode_separator"),V]}),L.length>0?L:i.jsx(w,{children:n("limits.status.all_hidden")})]})})})}const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function qe(){const e=q(),{data:t,error:r,isLoading:o}=ee(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=re();return!$e&&!J()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(ne,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),i.jsx(Q,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("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:i.jsx(Z,{className:"h-4 w-4","aria-hidden":!0})})]}),o?i.jsx(de,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:r})}):null,i.jsx(Ge,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,opencodeGo:t?.opencodeGo,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{qe as LimitsPage};
4
+ `),o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:n("limits.opencodeGo.setupHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:n("limits.opencodeGo.setupHint.subtitle")}),i.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[i.jsxs(M,{n:"1",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step1")}),i.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.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:[n("limits.opencodeGo.setupHint.cta"),i.jsx(Te,{})]})]}),i.jsxs(M,{n:"2",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step2")}),i.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_workspace")}),i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_cookie")})]})]}),i.jsxs(M,{n:"3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:n("limits.opencodeGo.setupHint.step3")}),i.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?n("limits.opencodeGo.setupHint.copied"):n("limits.opencodeGo.setupHint.copy")})]}),i.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:r}),i.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Ae(e){const[t,r]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const a=o.querySelectorAll("[data-limit-label]");let s=0,d=null;if(a.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(a[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of a)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);r(l=>l===c?l:c)}),t}function Ge({claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m,order:x,visibility:h,displayMode:H}){const z={claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m},P=b.useRef(null),I=Ae(P),[W,B]=b.useState(null),U=Array.isArray(x)&&x.length>0?x:Pe,F=H===p.REMAINING?p.REMAINING:p.USED,V=F===p.REMAINING?n("limits.settings.display_mode_remaining"):n("limits.settings.display_mode_used"),L=U.filter(y=>!h||h[y]!==!1).map(y=>Ce(y,z[y],F,W===y,()=>B(X=>X===y?null:y))).filter(Boolean);return i.jsx(ae,{delay:.15,children:i.jsx(D,{children:i.jsxs("div",{ref:P,className:"flex flex-col gap-3",style:I>0?{"--tt-limits-label-w":`${I}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[n("limits.panel.title"),n("limits.panel.mode_separator"),V]}),L.length>0?L:i.jsx(w,{children:n("limits.status.all_hidden")})]})})})}const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function qe(){const e=q(),{data:t,error:r,isLoading:o}=ee(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=re();return!$e&&!Z()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(ne,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),i.jsx(J,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("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:i.jsx(Q,{className:"h-4 w-4","aria-hidden":!0})})]}),o?i.jsx(de,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:r})}):null,i.jsx(Ge,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,opencodeGo:t?.opencodeGo,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{qe as LimitsPage};
@@ -1 +1 @@
1
- import{j as e,N as t}from"./main-BCstrDYE.js";import{A as r}from"./arrow-up-right-Bm3t-iA0.js";import{D as o}from"./download-COSLX73O.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,N as t}from"./main-w0hAaCsy.js";import{A as r}from"./arrow-up-right-BAQYGZkR.js";import{D as o}from"./download-BQOcg3gT.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{aw as p,aO as w,a2 as v,r,N as s,j as e,L as y,a5 as j}from"./main-BCstrDYE.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{ax as p,aP as w,a4 as v,r,N as s,j as e,L as y,a7 as j}from"./main-w0hAaCsy.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{c as S,aJ as R,d6 as B,r as n,d7 as q,d8 as F,d9 as H,da as E,N as i,j as e,W as h,b4 as O}from"./main-w0hAaCsy.js";import{T as $,b as W}from"./Controls-CwnKP56V.js";import{n as J,C as M}from"./ClawdAnimated-DSgOS5ND.js";import{F as T}from"./FadeIn-DpnitRKo.js";import{L as X}from"./link-2-DFwCBbIZ.js";import{L as Y}from"./loader-circle-BMFI_BJ8.js";import{T as Z}from"./trash-2-GeZ6IzgV.js";import"./Card-Ca_hYHhx.js";const G=[["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"}]],Q=S("file-archive",G);const ee=[["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"}]],te=S("monitor-up",ee);const ae=[["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"}]],re=S("upload",ae);const ie=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],se=S("zap",ie),oe={visible:!1,character:"clawd",size:"medium"};function ne(){const t=R()&&B(),[a,s]=n.useState(oe);n.useEffect(()=>{if(!t)return;const d=q(o=>{s({visible:!!o.visible,character:J(o.character),size:["small","medium","large"].includes(o.size)?o.size:"medium"})});return F(),d},[t]);const l=n.useCallback((d,o)=>{s(x=>({...x,[d]:o})),t&&H(d,o)},[t]);return{available:t,settings:a,setSetting:l}}const y=[{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 P(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 le(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await P(t);return[...y,...Array.isArray(a.pets)?a.pets:[]]}async function _(t){const a=await E();return P(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function de(t){return _({action:"install_url",url:t})}async function I(t){const a=await E();return P(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function ce(t){return _({action:"remove",id:t})}let C=y;function pe(){const[t,a]=n.useState(C),[s,l]=n.useState(!0),[d,o]=n.useState(!1),x=n.useCallback(async()=>{l(!0);try{const p=await le();return C=p,a(p),o(!0),p}catch{return C=y,a(y),o(!1),y}finally{l(!1)}},[]);return n.useEffect(()=>{x()},[x]),{pets:t,loading:s,available:d,refresh:x}}const me={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 xe(){const t=i("pet.import.subtitle"),a="codex-pets.net",s=t.indexOf(a);return s<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,s),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(s+a.length)]})}const k=[{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 ue({character:t,selected:a,onSelect:s,onRemove:l,removeDisabled:d}){const o=t.nameKey?i(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:s,"aria-pressed":a,className:h("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:h("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",me[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(M,{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:o}),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:i("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]})]})]}),l?e.jsx("button",{type:"button",disabled:d,onClick:l,"aria-label":`${i("pet.import.remove")} · ${o}`,className:h("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(Z,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function ge({pet:t,state:a,onStateChange:s}){const[l,d]=n.useState(null),o=n.useRef(null),x=k.find(function(u){return u.id===a}),p=i(x?.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:c=>{if(t?.spriteVersionNumber!==2||!o.current)return;const u=o.current.getBoundingClientRect(),v=c.clientX-(u.left+u.width/2),m=c.clientY-(u.top+u.height/2),j=(Math.atan2(v,-m)*180/Math.PI+360)%360;d(Math.round(j/22.5)%16)},onPointerLeave:()=>d(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:i("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}),p]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:o,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(M,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:l})})})}),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":i("pet.preview.states"),children:k.map(c=>e.jsxs("button",{type:"button",onClick:()=>s(c.id),"aria-pressed":a===c.id,className:h("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===c.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:i(c.labelKey)}),e.jsx("span",{className:h("h-1 w-1 rounded-full transition-colors duration-200",a===c.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},c.id))})})]})}function Ne(){const{available:t,settings:a,setSetting:s}=ne(),{pets:l,loading:d,available:o,refresh:x}=pe(),[p,c]=n.useState(""),[u,v]=n.useState(""),[m,j]=n.useState(!1),[L,z]=n.useState("idle-living"),[A,K]=n.useState(!0),f=a.character||"clawd",U=l.find(r=>r.id===f)||l[0],w=m?{kind:"busy",text:i("pet.import.busy")}:u?{kind:"error",text:u}:null;n.useEffect(()=>{!d&&l.length>0&&!l.some(r=>r.id===f)&&s("character","clawd")},[d,l,f,s]);async function N(r,g=i("pet.import.success")){j(!0),v("");try{const b=await r();await x(),b?.pet?.id&&s("character",b.pet.id),O({title:g,timeout:4e3}),c("")}catch(b){v(b?.message||i("pet.import.failed"))}finally{j(!1)}}n.useEffect(()=>{if(!A)return;const r=window.setInterval(()=>{z(g=>{const b=k.findIndex(D=>D.id===g);return k[(b+1)%k.length].id})},5e3);return()=>window.clearInterval(r)},[A]);const V=[{value:"small",label:i("pet.size.small")},{value:"medium",label:i("pet.size.medium")},{value:"large",label:i("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(T,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:i("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:i("pet.page.subtitle")})]})}),e.jsx(T,{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(ge,{pet:U,state:L,onStateChange:r=>{K(!1),z(r)}}),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:i("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:l.map(r=>e.jsx(ue,{character:r,selected:f===r.id,onSelect:()=>s("character",r.id),removeDisabled:m,onRemove:o&&r.custom?()=>N(async()=>(await ce(r.id),f===r.id&&s("character","clawd"),null),i("pet.import.removed")):void 0},r.id))})]}),o?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(re,{className:"h-4 w-4 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:i("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(xe,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:r=>{r.preventDefault(),!m&&p.trim()&&N(()=>de(p))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(X,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:p,onChange:r=>c(r.target.value),"aria-label":i("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:m||!p.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:[m?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,i("pet.import.add")]})]}),e.jsxs("label",{onDragOver:r=>r.preventDefault(),onDrop:r=>{if(r.preventDefault(),m)return;const g=r.dataTransfer?.files?.[0];g&&N(()=>I(g))},className:h("mt-2 flex h-9 w-full 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",m&&"pointer-events-none opacity-40"),children:[e.jsx(Q,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:m,onChange:r=>{const g=r.target.files?.[0];g&&N(()=>I(g)),r.target.value=""}})]}),w?e.jsx("p",{role:w.kind==="error"?"alert":"status",className:h("mt-2 text-xs",w.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:w.text}):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(te,{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:i("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:i("pet.controls.show")}),e.jsx($,{checked:a.visible,onChange:()=>s("visible",!a.visible),disabled:!t,ariaLabel:i("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(W,{options:V,value:a.size,onChange:r=>s("size",r),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(se,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i("pet.controls.native_only")]})]})]})})]})})})}export{Ne as PetPage};
@@ -1 +1 @@
1
- import{c as Xe,bc as Ue,bF as Ke,bG as le,bH as We,bI as ne,ba as ge,r as m,bJ as Z,bK as me,bL as he,bM as oe,bN as be,bO as qe,bP as we,bQ as Q,bl as J,bR as W,aG as ue,bb as pe,bS as Qe,bT as Ee,bU as $e,bV as Je,bW as Ze,bX as Te,bY as q,j as Y,bZ as ze,bh as Me,bg as et,b_ as tt,b$ as nt,c0 as ot,c1 as st,bd as rt,b9 as Le,c2 as it,c3 as ye,c4 as at,c5 as ct,c6 as lt,c7 as ut,bn as ft,c8 as dt,bo as pt}from"./main-BCstrDYE.js";import{i as Pe,b as He,c as Ae,g as ve,d as se,P as gt,e as mt,f as ht,s as Et,F as Tt,h as Pt,j as vt,k as Ct,l as bt,m as Rt,n as Be,o as St,u as Ot,p as It,q as Mt,t as yt,r as xt,I as Ft,v as kt,w as wt,x as Lt,C as Ht,y as At}from"./useScrollLock-ajoWrfku.js";import{f as Bt,p as Dt,g as _t}from"./DialogTitle-CA5znwms.js";import{p as Nt,q as jt,r as Yt,t as Gt,v as Vt,w as Xt,x as Ut,y as Kt}from"./SelectItemText-2LjzGvo5.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tn=Xe("chevron-right",Wt);function qt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function Ce(e,n,t){const l=qt(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 Re{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 Re}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 _e(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 Ne(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $t(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=He(),O=Ae(),h=Ne(o),j=We(),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()&&Z(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,C=h.handleCloseOptions?.getScope?.()??A??P??x.closest("[data-rootownerid]")??d.body;return _e(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(b){const M=Ce(l,"close",h.pointerType),_=()=>{o.setOpen(!1,J(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(b){const M=be(b);if(!qe(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 A(b){if(x()&&r){r.events.on("floating.closed",P);return}if(we(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&Z(_)&&ve(r.nodesRef.current,M,!1).some(X=>Q(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),B()&&!u()&&a(b)}}function P(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,J(W,b)),r.events.emit("floating.closed",b)})}const C=E;return he(C&&oe(C,"mouseenter",F),C&&oe(C,"mouseleave",A),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 Zt(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=He(c),a=Ne(u),d=m.useRef(!1),F=se(i),A=se(l),P=se(p),C=se(t),b=se(j),M=se(h),_=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),V=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!Q(s,T);if(!Z(L))return!1;const f=L;return R.hasMatchingElement(H=>Q(H,f))&&(!s||!Q(s,f))}),N=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(()=>N,[N]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,N(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,N]),m.useEffect(()=>{if(!t)return;function s(f,H=!0){const D=Ce(A.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f)}):H&&(a.openChangeTimeout.clear(),u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!Z(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const H=xe(P.current),D=Ce(A.current,"open",a.pointerType),G=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(Z(G)&&!u.context.triggerElements.hasElement(G)){for(const Ie of u.context.triggerElements.elements())if(Q(Ie,G)){k=Ie;break}}Z(U)&&Z(I)&&!u.context.triggerElements.hasElement(U)&&Q(U,I)&&(k=I);const v=k==null?!1:X(I,k,G),$=u.select("open"),z=M.current?.()??u.select("transitionStatus")==="ending",K=!$&&z&&d.current,ee=!v&&Z(k)&&Z(I)&&Q(I,k)&&K,te=H>0&&!D,Ve=v&&($||K)||ee,Oe=!$||v;if(Ve){V()&&u.setOpen(!0,J(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&V()&&u.setOpen(!0,J(W,f,k))}):Oe&&V()&&u.setOpen(!0,J(W,f,k)))}function R(f){if(_()){w();return}N();const H=u.select("domReferenceElement"),D=me(H);a.restTimeout.clear(),a.restTimeoutPending=!1;const G=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&G){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...G,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),C.current&&!_()&&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",R)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",R))},[N,w,B,A,u,t,F,a,r,X,_,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,R=T.currentTarget,f=u.select("domReferenceElement"),H=u.select("open"),D=X(f,R,T.target);if(o&&!Pe(a.pointerType))return;if(H&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;_e(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const G=xe(P.current);if(H&&!D||G===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&V()&&u.setOpen(!0,J(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&H?U():(a.restTimeoutPending=!0,a.restTimeout.start(G,U))}}},[t,a,_,X,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(),A=F-B;if(j===null||u===null||A===0)return j=a,u=d,B=F,!1;const P=a-j,C=d-u,b=P*P+C*C,M=A*A*zt;return j=a,u=d,B=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,A=E.floating;if(!F||!A||O==null||i==null||o==null)return;const{clientX:P,clientY:C}=d,b=be(d),M=d.type==="mouseleave",_=Q(A,b),V=Q(F,b);if(_&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&Z(d.relatedTarget)&&Q(A,d.relatedTarget))return;function X(){return!!(r&&ve(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=A.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,H=(R?w:s).left,D=(R?w:s).right,G=(f?w:s).top,U=(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){N();return}let I=!1;switch(O){case"top":I=ce(P,C,H,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,C,H,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,C,s.right-1,U,w.left+1,G);break;case"right":I=ce(P,C,w.right-1,U,s.left+1,G);break}if(I)return;if(h&&!en(P,C,w)){N();return}if(!M&&g(P,C)){N();return}let k=!1;switch(O){case"top":{const v=R?y/2:y*4,$=R||T?i+v:i-v,z=R?i-v:T?i+v:i-v,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(P,C,$,K,z,K,s.left,ee,s.right,te);break}case"bottom":{const v=R?y/2:y*4,$=R||T?i+v:i-v,z=R?i-v:T?i+v:i-v,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(P,C,$,K,z,K,s.left,ee,s.right,te);break}case"left":{const v=f?y/2:y*4,$=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,$,K,z);break}case"right":{const v=f?y/2:y*4,$=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,$,K,z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};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{..._t(),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:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(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===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===$e||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(Ze,()=>{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=Ae()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:B}=bt(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 Y.jsxs(je.Provider,{value:a,children:[x&&Y.jsx(sn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function Pn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function sn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(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),A=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:C,isMountedByThisTrigger:b}=It(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),V=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Zt(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=Nt(d,{enabled:d!=null,stickIfOpen:_}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:L,buttonRef:R}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:D,handleFocusTargetFocus:G}=an(g,P),I=Le("button",n,{state:{disabled:p,open:F},ref:[R,t,C,P],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":A},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:H,onFocus:D}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:G})]}):Y.jsx(m.Fragment,{children:I},x)}),Ye=m.createContext(void 0);function cn(){const e=m.useContext(Ye);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?Y.jsx(Ye.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function ln(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const bn=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(),A=xt(),P=d.useState("floatingRootContext"),C=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),V=d.useState("modal"),X=d.useState("openMethod"),N=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(N,!1,!1),f=Yt({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:A,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),H=P.useState("domReferenceElement");ge(()=>{const I=H,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const v=new AbortController;return R(()=>{d.set("instantType","trigger-change")},v.signal),()=>{v.abort()}}},[H,R,d]),Gt(b&&V===!0&&M!==W,X==="touch",N,_);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),G={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,G,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!C,inert:!b});return Y.jsxs(Ge.Provider,{value:f,children:[C&&V===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),Y.jsx(kt,{id:A,children:U})]})}),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 Y.jsx(un.Provider,{value:n,children:t})}const pn={...At,...pt},Rn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=ln(),O=Ut()!=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"),A=c.useState("modal"),P=c.useState("mounted"),C=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),_=M.useState("floatingId"),V=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??_;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),$t(M,{enabled:X&&!V,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=A!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(H=>{c.set("popupElement",H)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Le("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(H){O&&Ht.has(H.key)&&H.stopPropagation()}},Kt(x),S],stateAttributesMapping:pn});return Y.jsx(Lt,{context:M,openInteractionType:B,modal:T,disabled:!P||C===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(dn,{value:h,children:f})})});export{Tn as C,Pn as P,vn as a,Cn as b,bn as c,Rn as d};
1
+ import{c as Xe,bd as Ue,bG as Ke,bH as le,bI as We,bJ as ne,bb as ge,r as m,bK as Z,bL as me,bM as he,bN as oe,bO as be,bP as qe,bQ as we,bR as Q,bm as J,bS as W,aH as ue,bc as pe,bT as Qe,bU as Ee,bV as $e,bW as Je,bX as Ze,bY as Te,bZ as q,j as Y,b_ as ze,bi as Me,bh as et,b$ as tt,c0 as nt,c1 as ot,c2 as st,be as rt,ba as Le,c3 as it,c4 as ye,c5 as at,c6 as ct,c7 as lt,c8 as ut,bo as ft,c9 as dt,bp as pt}from"./main-w0hAaCsy.js";import{i as Pe,b as He,c as Ae,g as ve,d as se,P as gt,e as mt,f as ht,s as Et,F as Tt,h as Pt,j as vt,k as Ct,l as bt,m as Rt,n as Be,o as St,u as Ot,p as It,q as Mt,t as yt,r as xt,I as Ft,v as kt,w as wt,x as Lt,C as Ht,y as At}from"./useScrollLock-9au2731u.js";import{f as Bt,p as Dt,g as _t}from"./DialogTitle-DuuTVbUb.js";import{p as Nt,q as jt,r as Yt,t as Vt,v as Gt,w as Xt,x as Ut,y as Kt}from"./SelectItemText-Vjqvf8wO.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tn=Xe("chevron-right",Wt);function qt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function Ce(e,n,t){const l=qt(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 Re{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 Re}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 _e(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 Ne(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $t(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=He(),O=Ae(),h=Ne(o),j=We(),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()&&Z(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,C=h.handleCloseOptions?.getScope?.()??A??P??x.closest("[data-rootownerid]")??d.body;return _e(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(b){const M=Ce(l,"close",h.pointerType),_=()=>{o.setOpen(!1,J(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(b){const M=be(b);if(!qe(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 A(b){if(x()&&r){r.events.on("floating.closed",P);return}if(we(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&Z(_)&&ve(r.nodesRef.current,M,!1).some(X=>Q(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),B()&&!u()&&a(b)}}function P(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,J(W,b)),r.events.emit("floating.closed",b)})}const C=E;return he(C&&oe(C,"mouseenter",F),C&&oe(C,"mouseleave",A),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 Zt(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=He(c),a=Ne(u),d=m.useRef(!1),F=se(i),A=se(l),P=se(p),C=se(t),b=se(j),M=se(h),_=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!Q(s,T);if(!Z(L))return!1;const f=L;return R.hasMatchingElement(H=>Q(H,f))&&(!s||!Q(s,f))}),N=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(()=>N,[N]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,N(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,N]),m.useEffect(()=>{if(!t)return;function s(f,H=!0){const D=Ce(A.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f)}):H&&(a.openChangeTimeout.clear(),u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!Z(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const H=xe(P.current),D=Ce(A.current,"open",a.pointerType),V=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(Z(V)&&!u.context.triggerElements.hasElement(V)){for(const Ie of u.context.triggerElements.elements())if(Q(Ie,V)){k=Ie;break}}Z(U)&&Z(I)&&!u.context.triggerElements.hasElement(U)&&Q(U,I)&&(k=I);const v=k==null?!1:X(I,k,V),$=u.select("open"),z=M.current?.()??u.select("transitionStatus")==="ending",K=!$&&z&&d.current,ee=!v&&Z(k)&&Z(I)&&Q(I,k)&&K,te=H>0&&!D,Ge=v&&($||K)||ee,Oe=!$||v;if(Ge){G()&&u.setOpen(!0,J(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&G()&&u.setOpen(!0,J(W,f,k))}):Oe&&G()&&u.setOpen(!0,J(W,f,k)))}function R(f){if(_()){w();return}N();const H=u.select("domReferenceElement"),D=me(H);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&V){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...V,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),C.current&&!_()&&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",R)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",R))},[N,w,B,A,u,t,F,a,r,X,_,o,E,P,S,x,C,O,M,G]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,R=T.currentTarget,f=u.select("domReferenceElement"),H=u.select("open"),D=X(f,R,T.target);if(o&&!Pe(a.pointerType))return;if(H&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;_e(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const V=xe(P.current);if(H&&!D||V===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&G()&&u.setOpen(!0,J(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&H?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,_,X,o,u,P,G])}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(),A=F-B;if(j===null||u===null||A===0)return j=a,u=d,B=F,!1;const P=a-j,C=d-u,b=P*P+C*C,M=A*A*zt;return j=a,u=d,B=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,A=E.floating;if(!F||!A||O==null||i==null||o==null)return;const{clientX:P,clientY:C}=d,b=be(d),M=d.type==="mouseleave",_=Q(A,b),G=Q(F,b);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&Z(d.relatedTarget)&&Q(A,d.relatedTarget))return;function X(){return!!(r&&ve(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=A.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,H=(R?w:s).left,D=(R?w:s).right,V=(f?w:s).top,U=(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){N();return}let I=!1;switch(O){case"top":I=ce(P,C,H,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,C,H,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,C,s.right-1,U,w.left+1,V);break;case"right":I=ce(P,C,w.right-1,U,s.left+1,V);break}if(I)return;if(h&&!en(P,C,w)){N();return}if(!M&&g(P,C)){N();return}let k=!1;switch(O){case"top":{const v=R?y/2:y*4,$=R||T?i+v:i-v,z=R?i-v:T?i+v:i-v,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(P,C,$,K,z,K,s.left,ee,s.right,te);break}case"bottom":{const v=R?y/2:y*4,$=R||T?i+v:i-v,z=R?i-v:T?i+v:i-v,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(P,C,$,K,z,K,s.left,ee,s.right,te);break}case"left":{const v=f?y/2:y*4,$=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,$,K,z);break}case"right":{const v=f?y/2:y*4,$=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,$,K,z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};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{..._t(),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:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(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===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===$e||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(Ze,()=>{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=Ae()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:B}=bt(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 Y.jsxs(je.Provider,{value:a,children:[x&&Y.jsx(sn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function Pn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function sn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(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),A=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:C,isMountedByThisTrigger:b}=It(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Zt(d,{enabled:!p&&d!=null&&r&&(G!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:tn(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=Nt(d,{enabled:d!=null,stickIfOpen:_}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:L,buttonRef:R}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:D,handleFocusTargetFocus:V}=an(g,P),I=Le("button",n,{state:{disabled:p,open:F},ref:[R,t,C,P],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":A},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:H,onFocus:D}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},x)}),Ye=m.createContext(void 0);function cn(){const e=m.useContext(Ye);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?Y.jsx(Ye.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ve=m.createContext(void 0);function ln(){const e=m.useContext(Ve);if(!e)throw new Error(pe(46));return e}const bn=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(),A=xt(),P=d.useState("floatingRootContext"),C=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),N=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(N,!1,!1),f=Yt({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:A,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),H=P.useState("domReferenceElement");ge(()=>{const I=H,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const v=new AbortController;return R(()=>{d.set("instantType","trigger-change")},v.signal),()=>{v.abort()}}},[H,R,d]),Vt(b&&G===!0&&M!==W,X==="touch",N,_);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Gt(n,V,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!C,inert:!b});return Y.jsxs(Ve.Provider,{value:f,children:[C&&G===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),Y.jsx(kt,{id:A,children:U})]})}),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 Y.jsx(un.Provider,{value:n,children:t})}const pn={...At,...pt},Rn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=ln(),O=Ut()!=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"),A=c.useState("modal"),P=c.useState("mounted"),C=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),_=M.useState("floatingId"),G=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??_;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),$t(M,{enabled:X&&!G,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=A!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(H=>{c.set("popupElement",H)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Le("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(H){O&&Ht.has(H.key)&&H.stopPropagation()}},Kt(x),S],stateAttributesMapping:pn});return Y.jsx(Lt,{context:M,openInteractionType:B,modal:T,disabled:!P||C===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(dn,{value:h,children:f})})});export{Tn as C,Pn as P,vn as a,Cn as b,bn as c,Rn as d};
@@ -1 +1 @@
1
- import{aO as d,a2 as m,r as t,j as e,L as l,N as o,a5 as x}from"./main-BCstrDYE.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{aP as d,a4 as m,r as t,j as e,L as l,N as o,a7 as x}from"./main-w0hAaCsy.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};
@@ -0,0 +1 @@
1
+ import{r as v,b9 as l,bJ as w,ba as k,j as e,W as x}from"./main-w0hAaCsy.js";import{u as j,z as N,s as i,L as C,A as E,S as I,h as R,i as T,C as A,j as L,k as P,l as _,m as z,o as D,n as G}from"./SelectItemText-Vjqvf8wO.js";import{C as M}from"./check-C3RPBZiS.js";const O=v.forwardRef(function(t,s){const{render:n,className:p,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 H({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,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:p,"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(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align: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(O,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(z,{value:a.value,disabled:a.disabled,className:({selected:f,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",f?"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(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};