tokentracker-cli 0.35.1 → 0.36.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.
- package/dashboard/dist/assets/{ActivityHeatmap-HUG2wf_9.js → ActivityHeatmap-AynZXL9H.js} +1 -1
- package/dashboard/dist/assets/{Card-BRdnq8-k.js → Card-DnMSvw-8.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-DJBZEynG.js → DashboardPage-BQdAuoZy.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-BxCHzyu5.js → DevicePage-C8Hu0_B2.js} +1 -1
- package/dashboard/dist/assets/DialogTitle-e9pHSnUF.js +12 -0
- package/dashboard/dist/assets/{FadeIn-CsYsRptR.js → FadeIn-DJV5b6ny.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-ZoIWfFe6.js → HeaderGithubStar-D5NO9Zqo.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CXPYYQEu.js → IpCheckPage-ChrS22kx.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-BfcwouBK.js → LandingPage-P5ooRJZy.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-CGyaSA7g.js → LeaderboardAvatar-8qHGUAlc.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BOQMyVRl.js → LeaderboardPage-CAydwGf5.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-CNWb6GZA.js → LeaderboardProfileModal-gx27y6wc.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-BrkGee7P.js → LeaderboardProfilePage-CLTi0y1L.js} +1 -1
- package/dashboard/dist/assets/LimitsPage-C0Bfsa5L.js +2 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-BSlFMNhI.js → LocalOnlyNotice-D1MjhvWF.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DTCO8G60.js → LoginPage-CQskrfGA.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-CAjthIuS.js → PopoverPopup-Bsx_BMXc.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-C_zwPu_u.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-Cv0CQpGB.js → SkillsPage-BlgwZHg5.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-B56qFEsR.js → WidgetsPage-DnSe3_0m.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-C9D-6P-R.js → WrappedPage-vB9Bkmn4.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-CJ4CQ0HE.js → agent-logos-KnLTt2lz.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-OHDkhx-y.js → arrow-up-right-DVke2dP8.js} +1 -1
- package/dashboard/dist/assets/check-D09jAT1P.js +1 -0
- package/dashboard/dist/assets/{chevron-down-BVozhieG.js → chevron-down-BGAP09jB.js} +1 -1
- package/dashboard/dist/assets/{download-BOwIFon2.js → download-DNvHArM6.js} +1 -1
- package/dashboard/dist/assets/{info-BNlH8ZDr.js → info-KP-YTZRI.js} +1 -1
- package/dashboard/dist/assets/{main-BHU0hIWS.js → main-BY8UDgbs.js} +7 -3
- package/dashboard/dist/assets/use-limits-display-prefs-F5oc24jY.js +1 -0
- package/dashboard/dist/assets/{use-native-settings-DbaL1Woo.js → use-native-settings-ByQaUuE2.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CUlVKjou.js → use-usage-limits-DtqJe6kn.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B70A0cjV.js → useCurrency-CRhabGRo.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/subscriptions.js +25 -13
- package/src/lib/usage-limits.js +40 -9
- package/dashboard/dist/assets/DialogTitle-BF41YVn6.js +0 -12
- package/dashboard/dist/assets/LimitsPage-DYzx9pp5.js +0 -2
- package/dashboard/dist/assets/SettingsPage-DDlD8qd9.js +0 -1
- package/dashboard/dist/assets/check-BcU6hhFb.js +0 -1
- package/dashboard/dist/assets/use-limits-display-prefs-mPyTqsYR.js +0 -1
package/src/lib/subscriptions.js
CHANGED
|
@@ -10,10 +10,19 @@ const { probeOpenclawSessionPluginState } = require("./openclaw-session-plugin")
|
|
|
10
10
|
const OPENAI_AUTH_CLAIM = "https://api.openai.com/auth";
|
|
11
11
|
const MACOS_SECURITY_BIN = "/usr/bin/security";
|
|
12
12
|
const CLAUDE_CODE_KEYCHAIN_SERVICES = ["Claude Code-credentials"];
|
|
13
|
-
// On Linux, Claude Code persists the same OAuth payload as a plain
|
|
14
|
-
//
|
|
15
|
-
//
|
|
13
|
+
// On Linux and Windows, Claude Code persists the same OAuth payload as a plain
|
|
14
|
+
// JSON file instead of the macOS Keychain — at ~/.claude/.credentials.json on
|
|
15
|
+
// Linux and %USERPROFILE%\.claude\.credentials.json on Windows (both resolve via
|
|
16
|
+
// os.homedir()). The payload shape is identical:
|
|
17
|
+
// { claudeAiOauth: { accessToken, subscriptionType, ... } }
|
|
16
18
|
const CLAUDE_CODE_CREDENTIALS_FILE = ".credentials.json";
|
|
19
|
+
// Platforms where Claude Code stores credentials in the plain JSON file above
|
|
20
|
+
// rather than the macOS Keychain.
|
|
21
|
+
const CLAUDE_CODE_CREDENTIALS_FILE_PLATFORMS = new Set(["linux", "win32"]);
|
|
22
|
+
|
|
23
|
+
function usesClaudeCodeCredentialsFile(platform) {
|
|
24
|
+
return CLAUDE_CODE_CREDENTIALS_FILE_PLATFORMS.has(platform);
|
|
25
|
+
}
|
|
17
26
|
|
|
18
27
|
function normalizeString(value) {
|
|
19
28
|
if (typeof value !== "string") return null;
|
|
@@ -197,7 +206,7 @@ function readMacosKeychainPassword({ service, securityRunner, timeoutMs } = {})
|
|
|
197
206
|
return trimmed.length > 0 ? trimmed : null;
|
|
198
207
|
}
|
|
199
208
|
|
|
200
|
-
function
|
|
209
|
+
function readClaudeCodeCredentialsFile({ home, fsReader } = {}) {
|
|
201
210
|
const homeDir = typeof home === "string" && home ? home : os.homedir();
|
|
202
211
|
const credPath = path.join(homeDir, ".claude", CLAUDE_CODE_CREDENTIALS_FILE);
|
|
203
212
|
const reader = typeof fsReader === "function" ? fsReader : fs.readFileSync;
|
|
@@ -228,11 +237,12 @@ function detectClaudeCodeCredentialsPresence({ platform, securityRunner, home, f
|
|
|
228
237
|
return null;
|
|
229
238
|
}
|
|
230
239
|
|
|
231
|
-
if (platform
|
|
240
|
+
if (!usesClaudeCodeCredentialsFile(platform)) return null;
|
|
232
241
|
|
|
233
|
-
// Linux: credentials live in
|
|
234
|
-
// Existence-only: just check that the
|
|
235
|
-
|
|
242
|
+
// Linux/Windows: credentials live in the .credentials.json file (mode 0600 on
|
|
243
|
+
// Linux; user-profile ACLs on Windows). Existence-only: just check that the
|
|
244
|
+
// file is readable and contains the OAuth key.
|
|
245
|
+
const raw = readClaudeCodeCredentialsFile({ home, fsReader });
|
|
236
246
|
if (!raw) return null;
|
|
237
247
|
try {
|
|
238
248
|
const payload = JSON.parse(raw);
|
|
@@ -270,8 +280,8 @@ function detectClaudeCodeSubscriptionDetails({ platform, securityRunner, home, f
|
|
|
270
280
|
const raw = readMacosKeychainPassword({ service, securityRunner });
|
|
271
281
|
if (raw) rawPayloads.push(raw);
|
|
272
282
|
}
|
|
273
|
-
} else if (platform
|
|
274
|
-
const raw =
|
|
283
|
+
} else if (usesClaudeCodeCredentialsFile(platform)) {
|
|
284
|
+
const raw = readClaudeCodeCredentialsFile({ home, fsReader });
|
|
275
285
|
if (raw) rawPayloads.push(raw);
|
|
276
286
|
} else {
|
|
277
287
|
return null;
|
|
@@ -369,10 +379,11 @@ function readClaudeCodeAccessToken({ platform, securityRunner, home, fsReader }
|
|
|
369
379
|
return null;
|
|
370
380
|
}
|
|
371
381
|
|
|
372
|
-
if (platform
|
|
382
|
+
if (!usesClaudeCodeCredentialsFile(platform)) return null;
|
|
373
383
|
|
|
374
|
-
// Linux: Claude Code stores the OAuth payload as a JSON file
|
|
375
|
-
|
|
384
|
+
// Linux/Windows: Claude Code stores the OAuth payload as a JSON file
|
|
385
|
+
// (mode 0600 on Linux; user-profile ACLs on Windows).
|
|
386
|
+
const raw = readClaudeCodeCredentialsFile({ home, fsReader });
|
|
376
387
|
if (!raw) return null;
|
|
377
388
|
try {
|
|
378
389
|
const payload = JSON.parse(raw);
|
|
@@ -435,6 +446,7 @@ async function readCodexAuthBundle({ home, env } = {}) {
|
|
|
435
446
|
|
|
436
447
|
module.exports = {
|
|
437
448
|
collectLocalSubscriptions,
|
|
449
|
+
detectClaudeCodeSubscriptionDetails,
|
|
438
450
|
readClaudeCodeAccessToken,
|
|
439
451
|
readCodexAccessToken,
|
|
440
452
|
readCodexAuthBundle,
|
package/src/lib/usage-limits.js
CHANGED
|
@@ -6,6 +6,7 @@ const http = require("node:http");
|
|
|
6
6
|
const https = require("node:https");
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
|
+
detectClaudeCodeSubscriptionDetails,
|
|
9
10
|
readClaudeCodeAccessToken,
|
|
10
11
|
readCodexAccessToken,
|
|
11
12
|
readCodexAuthBundle,
|
|
@@ -1598,6 +1599,33 @@ async function fetchAntigravityLimits({ home, commandRunner, requestFn, timeoutM
|
|
|
1598
1599
|
}
|
|
1599
1600
|
}
|
|
1600
1601
|
|
|
1602
|
+
function toTitleCase(s) {
|
|
1603
|
+
return s.split(/\s+/).filter(Boolean)
|
|
1604
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ");
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
// Normalize a plan tier name: free/empty/placeholder -> null; otherwise strip the
|
|
1608
|
+
// leading brand word and Title Case the rest.
|
|
1609
|
+
function normalizePlanLabel(raw, brand) {
|
|
1610
|
+
if (raw == null) return null;
|
|
1611
|
+
let s = String(raw).trim();
|
|
1612
|
+
if (!s) return null;
|
|
1613
|
+
const lower = s.toLowerCase();
|
|
1614
|
+
if (["free", "none", "unknown"].includes(lower)) return null;
|
|
1615
|
+
if (brand && lower === brand.toLowerCase()) return null; // e.g. Kiro defaults plan_name to "Kiro" when parse fails
|
|
1616
|
+
if (brand) {
|
|
1617
|
+
s = s.replace(new RegExp("^" + brand + "\\s+", "i"), "").trim();
|
|
1618
|
+
if (!s) return null;
|
|
1619
|
+
}
|
|
1620
|
+
return toTitleCase(s);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// Attach plan_label only to a configured, error-free provider object (immutable).
|
|
1624
|
+
function withPlanLabel(obj, raw, brand) {
|
|
1625
|
+
if (!obj || !obj.configured || obj.error) return obj;
|
|
1626
|
+
return { ...obj, plan_label: normalizePlanLabel(raw, brand) };
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1601
1629
|
async function getUsageLimits({
|
|
1602
1630
|
home,
|
|
1603
1631
|
env,
|
|
@@ -1614,10 +1642,12 @@ async function getUsageLimits({
|
|
|
1614
1642
|
return cache.data;
|
|
1615
1643
|
}
|
|
1616
1644
|
|
|
1617
|
-
const [claudeToken, codexAuth] = await Promise.all([
|
|
1645
|
+
const [claudeToken, claudeSubscription, codexAuth] = await Promise.all([
|
|
1618
1646
|
Promise.resolve().then(() => readClaudeCodeAccessToken({ platform, securityRunner, home })),
|
|
1647
|
+
Promise.resolve().then(() => detectClaudeCodeSubscriptionDetails({ platform, securityRunner, home })),
|
|
1619
1648
|
readCodexAuthBundle({ home, env }),
|
|
1620
1649
|
]);
|
|
1650
|
+
const claudePlanType = claudeSubscription?.planType || null;
|
|
1621
1651
|
|
|
1622
1652
|
// Proactively refresh Codex tokens that are >8 days stale, mirroring CodexBar's
|
|
1623
1653
|
// CodexTokenRefresher.swift. Without this, users who logged in once and didn't run
|
|
@@ -1724,14 +1754,14 @@ async function getUsageLimits({
|
|
|
1724
1754
|
|
|
1725
1755
|
const data = {
|
|
1726
1756
|
fetched_at: new Date(nowMs).toISOString(),
|
|
1727
|
-
claude,
|
|
1728
|
-
codex,
|
|
1729
|
-
cursor,
|
|
1730
|
-
kimi,
|
|
1731
|
-
gemini,
|
|
1732
|
-
kiro,
|
|
1733
|
-
antigravity,
|
|
1734
|
-
copilot,
|
|
1757
|
+
claude: withPlanLabel(claude, claudePlanType, "Claude"),
|
|
1758
|
+
codex: withPlanLabel(codex, codex.plan_type, "Codex"),
|
|
1759
|
+
cursor: withPlanLabel(cursor, cursor.membership_type, "Cursor"),
|
|
1760
|
+
kimi: withPlanLabel(kimi, kimi.subscription_type || kimi.membership_level, "Kimi"),
|
|
1761
|
+
gemini: withPlanLabel(gemini, gemini.account_plan, "Gemini"),
|
|
1762
|
+
kiro: withPlanLabel(kiro, kiro.plan_name, "Kiro"),
|
|
1763
|
+
antigravity: withPlanLabel(antigravity, antigravity.account_plan, "Antigravity"),
|
|
1764
|
+
copilot: withPlanLabel(copilot, copilot.plan_name, "Copilot"),
|
|
1735
1765
|
};
|
|
1736
1766
|
|
|
1737
1767
|
cache = { data, fetchedAt: nowMs };
|
|
@@ -1744,6 +1774,7 @@ function resetUsageLimitsCache() {
|
|
|
1744
1774
|
|
|
1745
1775
|
module.exports = {
|
|
1746
1776
|
getUsageLimits,
|
|
1777
|
+
normalizePlanLabel,
|
|
1747
1778
|
resetUsageLimitsCache,
|
|
1748
1779
|
extractGeminiOauthClientCredentials,
|
|
1749
1780
|
loadKimiCredentials,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{ct as rt,cu as mn,ba as Be,aW as $,j as ne,b_ as _e,r as d,a_ as Z,bX as Wt,aY as A,aX as mt,cv as hn,bd as ht,b4 as je,bn,aV as st,cw as jt,cx as at,b1 as Ee,b$ as it,cy as se,aZ as we,a$ as K,bf as En,c1 as yn,bh as Vt,c9 as bt,cb as Et,cd as vn,cz as Sn,b2 as ee,b as de,b3 as Rn,cA as Bt,bo as Ke,c8 as Tn,cB as Cn,bP as _t,b9 as ae,bT as ze,bS as xn,cC as wn,cD as Q,bM as Xe,c2 as ct,bK as yt,c4 as On,bQ as In,bg as kn,b6 as lt,cE as Kt,cF as Mn,b7 as Yt,cG as le,bb as $t,b8 as We,cH as Pn,cI as Ht,cJ as Gt,cK as vt,a as Ye,br as dt,bk as Fn,bm as Ln,bi as Ie,cL as Ut,bY as qt,bp as Dn,c7 as Nn}from"./main-BHU0hIWS.js";function ye(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...ye(e,r.id,n)])}function St(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function An(e){e.preventDefault(),e.stopPropagation()}function Wn(e){return"nativeEvent"in e}function jn(e){return e.mozInputSource===0&&e.isTrusted?!0:rt&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Vn(e){return mn?!1:!rt&&e.width===0&&e.height===0||rt&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function gr(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Bn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Fe(e){const t=Be(_n,e).current;return t.next=e,$(t.effect),t}function _n(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function zt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Kn{nodesRef={current:[]};events=zt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Xt=d.createContext(null),Jt=d.createContext(null),$e=()=>d.useContext(Xt)?.id||null,ft=e=>{const t=d.useContext(Jt);return e??t};function mr(e){const t=_e(),n=ft(e),o=$e();return $(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function hr(e){const{children:t,id:n}=e,o=$e();return ne.jsx(Xt.Provider,{value:d.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function br(e){const{children:t,externalTree:n}=e,o=Be(()=>n??new Kn).current;return ne.jsx(Jt.Provider,{value:o,children:t})}let Rt=0;function Je(e,t={}){const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Rt);const s=()=>e?.focus({preventScroll:n});r?s():Rt=requestAnimationFrame(s)}const ve={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Tt(e){return e==="inert"?ve.inert:e==="aria-hidden"?ve["aria-hidden"]:ve.none}let Le=new WeakSet,De={},Qe=0;const Qt=e=>e&&(e.host||Qt(e.parentNode)),Yn=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Qt(n);return e.contains(o)?o:null}).filter(n=>n!=null);function $n(e,t,n,o){const r="data-base-ui-inert",s=o?"inert":n?"aria-hidden":null,u=Yn(t,e),a=new Set,i=new Set(u),l=[];De[r]||(De[r]=new WeakMap);const b=De[r];u.forEach(f),p(t),a.clear();function f(g){!g||a.has(g)||(a.add(g),g.parentNode&&f(g.parentNode))}function p(g){!g||i.has(g)||[].forEach.call(g.children,h=>{if(Wt(h)!=="script")if(a.has(h))p(h);else{const y=s?h.getAttribute(s):null,C=y!==null&&y!=="false",O=Tt(s),v=(O.get(h)||0)+1,R=(b.get(h)||0)+1;O.set(h,v),b.set(h,R),l.push(h),v===1&&C&&Le.add(h),R===1&&h.setAttribute(r,""),!C&&s&&h.setAttribute(s,s==="inert"?"":"true")}})}return Qe+=1,()=>{l.forEach(g=>{const h=Tt(s),C=(h.get(g)||0)-1,O=(b.get(g)||0)-1;h.set(g,C),b.set(g,O),C||(!Le.has(g)&&s&&g.removeAttribute(s),Le.delete(g)),O||g.removeAttribute(r)}),Qe-=1,Qe||(ve.inert=new WeakMap,ve["aria-hidden"]=new WeakMap,ve.none=new WeakMap,Le=new WeakSet,De={})}}function Hn(e,t=!1,n=!1){const o=Z(e[0]).body;return $n(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}function Gn(e,t){const n=Ke(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Ct=20;let ie=[];function pt(){ie=ie.filter(e=>e.isConnected)}function Un(e){pt(),e&&Wt(e)!=="body"&&(ie.push(e),ie.length>Ct&&(ie=ie.slice(-Ct)))}function Ze(){return pt(),ie[ie.length-1]}function qn(e){if(!e)return null;const t=at();return Bt(e,t)?e:jt(e,t)[0]||e}function zn(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():_t(e).display!=="none"}function xt(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=at(),r=Cn(e,n).filter(u=>{const a=u.getAttribute("data-tabindex")||"";return Bt(u,n)||u.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Xn(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],initialFocus:s=!0,returnFocus:u=!0,restoreFocus:a=!1,modal:i=!0,closeOnFocusOut:l=!0,openInteractionType:b="",getInsideElements:f=()=>[],nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:h,externalTree:y}=e,C="rootStore"in t?t.rootStore:t,O=C.useState("open"),v=C.useState("domReferenceElement"),R=C.useState("floatingElement"),{events:N,dataRef:F}=C.context,M=A(()=>F.current.floatingContext?.nodeId),B=A(f),L=s===!1,V=mt(v)&&L,W=Fe(r),_=Fe(s),q=Fe(u),Re=Fe(b),G=ft(y),k=hn(),re=d.useRef(null),He=d.useRef(null),Y=d.useRef(!1),oe=d.useRef(!1),fe=d.useRef(!1),ke=d.useRef(-1),pe=d.useRef(""),J=d.useRef(""),Te=d.useRef(null),ce=d.useRef(null),Ge=ht(Te,h,k?.beforeInsideRef),Ce=ht(ce,k?.afterInsideRef),ge=je(),ue=je(),me=bn(),he=k!=null,c=st(R),w=A((m=c)=>m?jt(m,at()):[]),E=A(m=>{const T=w(m);return W.current.map(()=>T).filter(Boolean).flat()});d.useEffect(()=>{if(o||!i)return;function m(I){I.key==="Tab"&&K(c,we(Z(c)))&&w().length===0&&!V&&An(I)}const T=Z(c);return T.addEventListener("keydown",m),()=>{T.removeEventListener("keydown",m)}},[o,v,c,i,W,V,w,E]),d.useEffect(()=>{if(o||!R)return;function m(T){const I=ee(T),j=w().indexOf(I);j!==-1&&(ke.current=j)}return R.addEventListener("focusin",m),()=>{R.removeEventListener("focusin",m)}},[o,R,w]),d.useEffect(()=>{if(o||!O)return;const m=Z(c);function T(){fe.current=!1}function I(j){const x=ee(j),S=K(R,x)||K(v,x)||K(k?.portalNode,x);fe.current=!S,J.current=j.pointerType||"keyboard"}function D(){J.current="keyboard"}return m.addEventListener("pointerdown",I,!0),m.addEventListener("pointerup",T,!0),m.addEventListener("pointercancel",T,!0),m.addEventListener("keydown",D,!0),()=>{m.removeEventListener("pointerdown",I,!0),m.removeEventListener("pointerup",T,!0),m.removeEventListener("pointercancel",T,!0),m.removeEventListener("keydown",D,!0)}},[o,R,v,c,O,k]),d.useEffect(()=>{if(o||!l)return;function m(){oe.current=!0,ue.start(0,()=>{oe.current=!1})}function T(x){const S=x.relatedTarget,z=x.currentTarget,U=ee(x);queueMicrotask(()=>{const be=M(),Me=C.context.triggerElements,Ue=S?.hasAttribute(it("focus-guard"))&&[Te.current,ce.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,se(g),se(p)].includes(S),qe=!(K(v,S)||K(R,S)||K(S,R)||K(k?.portalNode,S)||S!=null&&Me.hasElement(S)||Me.hasMatchingElement(X=>K(X,S))||Ue||G&&(ye(G.nodesRef.current,be).find(X=>K(X.context?.elements.floating,S)||K(X.context?.elements.domReference,S))||St(G.nodesRef.current,be).find(X=>[X.context?.elements.floating,st(X.context?.elements.floating)].includes(S)||X.context?.elements.domReference===S)));if(z===v&&c&&xt(c,W),a&&z!==v&&!zn(U)&&we(Z(c))===Z(c).body){if(Ee(c)&&(c.focus(),a==="popup")){me.request(()=>{c.focus()});return}const X=ke.current,xe=w(),Pe=xe[X]||xe[xe.length-1]||c;Ee(Pe)&&Pe.focus()}if(F.current.insideReactTree){F.current.insideReactTree=!1;return}(V||!i)&&S&&qe&&!oe.current&&(V||S!==Ze())&&(Y.current=!0,C.setOpen(!1,de(Rn,x)))})}function I(){fe.current||(F.current.insideReactTree=!0,ge.start(0,()=>{F.current.insideReactTree=!1}))}const D=Ee(v)?v:null,j=[];if(!(!R&&!D))return D&&(D.addEventListener("focusout",T),D.addEventListener("pointerdown",m),j.push(()=>{D.removeEventListener("focusout",T),D.removeEventListener("pointerdown",m)})),R&&(R.addEventListener("focusout",T),k&&(R.addEventListener("focusout",I,!0),j.push(()=>{R.removeEventListener("focusout",I,!0)})),j.push(()=>{R.removeEventListener("focusout",T)})),()=>{j.forEach(x=>{x()})}},[o,v,R,c,i,G,k,C,l,a,w,V,M,W,F,ge,ue,me,p,g]),d.useEffect(()=>{if(o||!R||!O)return;const m=Array.from(k?.portalNode?.querySelectorAll(`[${it("portal")}]`)||[]),I=(G?St(G.nodesRef.current,M()):[]).find(x=>mt(x.context?.elements.domReference||null))?.context?.elements.domReference,D=[R,I,...m,...B(),re.current,He.current,Te.current,ce.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,se(g),se(p),V?v:null].filter(x=>x!=null),j=Hn(D,i||V);return()=>{j()}},[O,o,v,R,i,W,k,V,G,M,B,p,g]),$(()=>{if(!O||o||!Ee(c))return;const m=Z(c),T=we(m);queueMicrotask(()=>{const I=E(c),D=_.current,j=typeof D=="function"?D(Re.current||""):D;if(j===void 0||j===!1)return;let x;j===!0||j===null?x=I[0]||c:x=se(j),x=x||I[0]||c,!K(c,T)&&Je(x,{preventScroll:x===c})})},[o,O,c,L,E,_,Re]),$(()=>{if(o||!c)return;const m=Z(c),T=we(m);Un(T);function I(x){if(x.open||(pe.current=Gn(x.nativeEvent,J.current)),x.reason===yn&&x.nativeEvent.type==="mouseleave"&&(Y.current=!0),x.reason===Vt)if(x.nested)Y.current=!1;else if(jn(x.nativeEvent)||Vn(x.nativeEvent))Y.current=!1;else{let S=!1;document.createElement("div").focus({get preventScroll(){return S=!0,!1}}),S?Y.current=!1:Y.current=!0}}N.on("openchange",I);const D=m.createElement("span");D.setAttribute("tabindex","-1"),D.setAttribute("aria-hidden","true"),Object.assign(D.style,En),he&&v&&v.insertAdjacentElement("afterend",D);function j(){const x=q.current;let S=typeof x=="function"?x(pe.current):x;if(S===void 0||S===!1)return null;if(S===null&&(S=!0),typeof S=="boolean"){const U=v||Ze();return U&&U.isConnected?U:D}const z=v||Ze()||D;return se(S)||z}return()=>{N.off("openchange",I);const x=we(m),S=K(R,x)||G&&ye(G.nodesRef.current,M(),!1).some(U=>K(U.context?.elements.floating,x)),z=j();queueMicrotask(()=>{const U=qn(z),be=typeof q.current!="boolean";q.current&&!Y.current&&Ee(U)&&(!(!be&&U!==x&&x!==m.body)||S)&&U.focus({preventScroll:!0}),D.remove()})}},[o,R,c,q,F,N,G,he,v,M]),d.useEffect(()=>{queueMicrotask(()=>{Y.current=!1})},[o]),d.useEffect(()=>{if(o||!O)return;function m(I){ee(I)?.closest(`[${Tn}]`)&&(oe.current=!0)}const T=Z(c);return T.addEventListener("pointerdown",m,!0),()=>{T.removeEventListener("pointerdown",m,!0)}},[o,O,c]),$(()=>{if(!o&&k)return k.setFocusManagerState({modal:i,closeOnFocusOut:l,open:O,onOpenChange:C.setOpen,domReference:v}),()=>{k.setFocusManagerState(null)}},[o,k,i,O,C,l,v]),$(()=>{if(!(o||!c))return xt(c,W),()=>{queueMicrotask(pt)}},[o,c,W]);const H=!o&&(i?!V:!0)&&(he||i);return ne.jsxs(d.Fragment,{children:[H&&ne.jsx(bt,{"data-type":"inside",ref:Ge,onFocus:m=>{if(i){const T=E();Je(T[T.length-1])}else k?.portalNode&&(Y.current=!1,Et(m,k.portalNode)?vn(v)?.focus():se(g??k.beforeOutsideRef)?.focus())}}),n,H&&ne.jsx(bt,{"data-type":"inside",ref:Ce,onFocus:m=>{i?Je(E()[0]):k?.portalNode&&(l&&(Y.current=!0),Et(m,k.portalNode)?Sn(v)?.focus():se(p??k.afterOutsideRef)?.focus())}})]})}const Jn={intentional:"onClick",sloppy:"onPointerDown"};function Qn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Zn(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("referenceElement"),u=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:i}=n.context,{enabled:l=!0,escapeKey:b=!0,outsidePress:f=!0,outsidePressEvent:p="sloppy",referencePress:g=!1,referencePressEvent:h="sloppy",ancestorScroll:y=!1,bubbles:C,externalTree:O}=t,v=ft(O),R=A(typeof f=="function"?f:()=>!1),N=typeof f=="function"?R:f,F=d.useRef(!1),{escapeKey:M,outsidePress:B}=Qn(C),L=d.useRef(null),V=je(),W=je(),_=A(()=>{W.clear(),i.current.insideReactTree=!1}),q=d.useRef(!1),Re=d.useRef(""),G=A(c=>{Re.current=c.pointerType}),k=A(()=>{const c=Re.current,w=c==="pen"||!c?"mouse":c,E=typeof p=="function"?p():p;return typeof E=="string"?E:E[w]}),re=A(c=>{if(!o||!l||!b||c.key!=="Escape"||q.current)return;const w=i.current.floatingContext?.nodeId,E=v?ye(v.nodesRef.current,w):[];if(!M&&E.length>0){let T=!0;if(E.forEach(I=>{I.context?.open&&!I.context.dataRef.current.__escapeKeyBubbles&&(T=!1)}),!T)return}const H=Wn(c)?c.nativeEvent:c,m=de(On,H);n.setOpen(!1,m),!M&&!m.isPropagationAllowed&&c.stopPropagation()}),He=A(c=>{const w=k();return w==="intentional"&&c.type!=="click"||w==="sloppy"&&c.type==="click"}),Y=A(()=>{i.current.insideReactTree=!0,W.start(0,_)}),oe=A((c,w=!1)=>{if(He(c)){_();return}if(i.current.insideReactTree){_();return}if(k()==="intentional"&&w||typeof N=="function"&&!N(c))return;const E=ee(c),H=`[${it("inert")}]`,m=Z(n.select("floatingElement")).querySelectorAll(H),T=n.context.triggerElements;if(E&&(T.hasElement(E)||T.hasMatchingElement(S=>K(S,E))))return;let I=ae(E)?E:null;for(;I&&!ze(I);){const S=xn(I);if(ze(S)||!ae(S))break;I=S}if(m.length&&ae(E)&&!wn(E)&&!K(E,n.select("floatingElement"))&&Array.from(m).every(S=>!K(I,S)))return;if(Ee(E)&&!("touches"in c)){const S=ze(E),z=_t(E),U=/auto|scroll/,be=S||U.test(z.overflowX),Me=S||U.test(z.overflowY),Ue=be&&E.clientWidth>0&&E.scrollWidth>E.clientWidth,qe=Me&&E.clientHeight>0&&E.scrollHeight>E.clientHeight,X=z.direction==="rtl",xe=qe&&(X?c.offsetX<=E.offsetWidth-E.clientWidth:c.offsetX>E.clientWidth),Pe=Ue&&c.offsetY>E.clientHeight;if(xe||Pe)return}const D=i.current.floatingContext?.nodeId,j=v&&ye(v.nodesRef.current,D).some(S=>Q(c,S.context?.elements.floating));if(Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement"))||j)return;const x=v?ye(v.nodesRef.current,D):[];if(x.length>0){let S=!0;if(x.forEach(z=>{z.context?.open&&!z.context.dataRef.current.__outsidePressBubbles&&(S=!1)}),!S)return}n.setOpen(!1,de(Vt,c)),_()}),fe=A(c=>{k()!=="sloppy"||c.pointerType==="touch"||!n.select("open")||!l||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement"))||oe(c)}),ke=A(c=>{if(k()!=="sloppy"||!n.select("open")||!l||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement")))return;const w=c.touches[0];w&&(L.current={startTime:Date.now(),startX:w.clientX,startY:w.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},V.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}),pe=A(c=>{const w=ee(c);function E(){ke(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)}),J=A(c=>{const w=F.current;if(F.current=!1,V.clear(),c.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)return;const E=ee(c);function H(){c.type==="pointerdown"?fe(c):oe(c,w),E?.removeEventListener(c.type,H)}E?.addEventListener(c.type,H)}),Te=A(c=>{if(k()!=="sloppy"||!L.current||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement")))return;const w=c.touches[0];if(!w)return;const E=Math.abs(w.clientX-L.current.startX),H=Math.abs(w.clientY-L.current.startY),m=Math.sqrt(E*E+H*H);m>5&&(L.current.dismissOnTouchEnd=!0),m>10&&(oe(c),V.clear(),L.current=null)}),ce=A(c=>{const w=ee(c);function E(){Te(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)}),Ge=A(c=>{k()!=="sloppy"||!L.current||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement"))||(L.current.dismissOnTouchEnd&&oe(c),V.clear(),L.current=null)}),Ce=A(c=>{const w=ee(c);function E(){Ge(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)});d.useEffect(()=>{if(!o||!l)return;i.current.__escapeKeyBubbles=M,i.current.__outsidePressBubbles=B;const c=new ct;function w(I){n.setOpen(!1,de(kn,I))}function E(){c.clear(),q.current=!0}function H(){c.start(In()?5:0,()=>{q.current=!1})}const m=Z(r);m.addEventListener("pointerdown",G,!0),b&&(m.addEventListener("keydown",re),m.addEventListener("compositionstart",E),m.addEventListener("compositionend",H)),N&&(m.addEventListener("click",J,!0),m.addEventListener("pointerdown",J,!0),m.addEventListener("touchstart",pe,!0),m.addEventListener("touchmove",ce,!0),m.addEventListener("touchend",Ce,!0),m.addEventListener("mousedown",J,!0));let T=[];return y&&(ae(u)&&(T=Xe(u)),ae(r)&&(T=T.concat(Xe(r))),!ae(s)&&s&&s.contextElement&&(T=T.concat(Xe(s.contextElement)))),T=T.filter(I=>I!==m.defaultView?.visualViewport),T.forEach(I=>{I.addEventListener("scroll",w,{passive:!0})}),()=>{m.removeEventListener("pointerdown",G,!0),b&&(m.removeEventListener("keydown",re),m.removeEventListener("compositionstart",E),m.removeEventListener("compositionend",H)),N&&(m.removeEventListener("click",J,!0),m.removeEventListener("pointerdown",J,!0),m.removeEventListener("touchstart",pe,!0),m.removeEventListener("touchmove",ce,!0),m.removeEventListener("touchend",Ce,!0),m.removeEventListener("mousedown",J,!0)),T.forEach(I=>{I.removeEventListener("scroll",w)}),c.clear(),F.current=!1}},[i,r,s,u,b,N,o,a,y,l,M,B,re,oe,J,fe,pe,ce,Ce,G,n]),d.useEffect(_,[N,_]);const ge=d.useMemo(()=>({onKeyDown:re,...g&&{[Jn[h]]:c=>{n.setOpen(!1,de(yt,c.nativeEvent))},...h!=="intentional"&&{onClick(c){n.setOpen(!1,de(yt,c.nativeEvent))}}}}),[re,n,g,h]),ue=A(c=>{const w=ee(c.nativeEvent);!K(n.select("floatingElement"),w)||c.button!==0||(F.current=!0)}),me=A(c=>{!o||!l||c.button!==0||(F.current=!0)}),he=d.useMemo(()=>({onKeyDown:re,onPointerDown:ue,onMouseDown:ue,onMouseUp:ue,onClickCapture:Y,onMouseDownCapture(c){Y(),me(c)},onPointerDownCapture(c){Y(),me(c)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[re,ue,Y,me]);return d.useMemo(()=>l?{reference:ge,floating:he,trigger:ge}:{},[l,ge,he])}var Ve=Symbol("NOT_FOUND");function eo(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function to(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function no(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${n}]`)}}var wt=e=>Array.isArray(e)?e:[e];function oo(e){const t=Array.isArray(e[0])?e[0]:e;return no(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ro(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}function so(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Ve},put(n,o){t={key:n,value:o}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function io(e,t){let n=[];function o(a){const i=n.findIndex(l=>t(a,l.key));if(i>-1){const l=n[i];return i>0&&(n.splice(i,1),n.unshift(l)),l.value}return Ve}function r(a,i){o(a)===Ve&&(n.unshift({key:a,value:i}),n.length>e&&n.pop())}function s(){return n}function u(){n=[]}return{get:o,put:r,getEntries:s,clear:u}}var co=(e,t)=>e===t;function uo(e){return function(n,o){if(n===null||o===null||n.length!==o.length)return!1;const{length:r}=n;for(let s=0;s<r;s++)if(!e(n[s],o[s]))return!1;return!0}}function ao(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:o=co,maxSize:r=1,resultEqualityCheck:s}=n,u=uo(o);let a=0;const i=r<=1?so(u):io(r,u);function l(){let b=i.get(arguments);if(b===Ve){if(b=e.apply(null,arguments),a++,s){const p=i.getEntries().find(g=>s(g.value,b));p&&(b=p.value,a!==0&&a--)}i.put(arguments,b)}return b}return l.clearCache=()=>{i.clear(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}var lo=class{constructor(e){this.value=e}deref(){return this.value}},fo=typeof WeakRef<"u"?WeakRef:lo,po=0,Ot=1;function Ne(){return{s:po,v:void 0,o:null,p:null}}function Zt(e,t={}){let n=Ne();const{resultEqualityCheck:o}=t;let r,s=0;function u(){let a=n;const{length:i}=arguments;for(let f=0,p=i;f<p;f++){const g=arguments[f];if(typeof g=="function"||typeof g=="object"&&g!==null){let h=a.o;h===null&&(a.o=h=new WeakMap);const y=h.get(g);y===void 0?(a=Ne(),h.set(g,a)):a=y}else{let h=a.p;h===null&&(a.p=h=new Map);const y=h.get(g);y===void 0?(a=Ne(),h.set(g,a)):a=y}}const l=a;let b;if(a.s===Ot)b=a.v;else if(b=e.apply(null,arguments),s++,o){const f=r?.deref?.()??r;f!=null&&o(f,b)&&(b=f,s!==0&&s--),r=typeof b=="object"&&b!==null||typeof b=="function"?new fo(b):b}return l.s=Ot,l.v=b,b}return u.clearCache=()=>{n=Ne(),u.resetResultsCount()},u.resultsCount=()=>s,u.resetResultsCount=()=>{s=0},u}function en(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...r)=>{let s=0,u=0,a,i={},l=r.pop();typeof l=="object"&&(i=l,l=r.pop()),eo(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const b={...n,...i},{memoize:f,memoizeOptions:p=[],argsMemoize:g=Zt,argsMemoizeOptions:h=[]}=b,y=wt(p),C=wt(h),O=oo(r),v=f(function(){return s++,l.apply(null,arguments)},...y),R=g(function(){u++;const F=ro(O,arguments);return a=v.apply(null,F),a},...C);return Object.assign(R,{resultFunc:l,memoizedResultFunc:v,dependencies:O,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:g})};return Object.assign(o,{withTypes:()=>o}),o}var go=en(Zt),mo=Object.assign((e,t=go)=>{to(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),o=n.map(s=>e[s]);return t(o,(...s)=>s.reduce((u,a,i)=>(u[n[i]]=a,u),{}))},{withTypes:()=>mo});en({memoize:ao,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const P=(e,t,n,o,r,s,...u)=>{if(u.length>0)throw new Error(lt(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var et={exports:{}},tt={};var It;function ho(){if(It)return tt;It=1;var e=Kt();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function a(f,p){var g=p(),h=o({inst:{value:g,getSnapshot:p}}),y=h[0].inst,C=h[1];return s(function(){y.value=g,y.getSnapshot=p,i(y)&&C({inst:y})},[f,g,p]),r(function(){return i(y)&&C({inst:y}),f(function(){i(y)&&C({inst:y})})},[f]),u(g),g}function i(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function l(f,p){return p()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return tt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,tt}var kt;function tn(){return kt||(kt=1,et.exports=ho()),et.exports}var bo=tn(),nt={exports:{}},ot={};var Mt;function Eo(){if(Mt)return ot;Mt=1;var e=Kt(),t=tn();function n(l,b){return l===b&&(l!==0||1/l===1/b)||l!==l&&b!==b}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,u=e.useEffect,a=e.useMemo,i=e.useDebugValue;return ot.useSyncExternalStoreWithSelector=function(l,b,f,p,g){var h=s(null);if(h.current===null){var y={hasValue:!1,value:null};h.current=y}else y=h.current;h=a(function(){function O(M){if(!v){if(v=!0,R=M,M=p(M),g!==void 0&&y.hasValue){var B=y.value;if(g(B,M))return N=B}return N=M}if(B=N,o(R,M))return B;var L=p(M);return g!==void 0&&g(B,L)?(R=M,B):(R=M,N=L)}var v=!1,R,N,F=f===void 0?null:f;return[function(){return O(b())},F===null?void 0:function(){return O(F())}]},[b,f,p,g]);var C=r(l,h[0],h[1]);return u(function(){y.hasValue=!0,y.value=C},[C]),i(C),C},ot}var Pt;function yo(){return Pt||(Pt=1,nt.exports=Eo()),nt.exports}var vo=yo();const So=Mn(19),Ro=So?Co:xo;function To(e,t,n,o,r){return Ro(e,t,n,o,r)}function Co(e,t,n,o,r){const s=d.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return bo.useSyncExternalStore(e.subscribe,s,s)}function xo(e,t,n,o,r){return vo.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class Oe{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){Oe.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Oe.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Oe.prototype.setState.call(this,t)}}class nn extends Oe{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}controlledValues=new Map;useSyncedValue(t,n){d.useDebugValue(t),$(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const o=this;$(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);$(()=>{n.update(t)},[n,...o])}useControlledProp(t,n,o){d.useDebugValue(t);const r=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],o)&&super.setState({...this.state,[t]:o})),$(()=>{s&&!Object.is(r.state[t],n)&&super.setState({...r.state,[t]:n})},[r,t,n,o,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.update(n)}setState(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.setState({...this.state,...n})}select=(t,n,o,r)=>{const s=this.selectors[t];return s(this.state,n,o,r)};useState=(t,n,o,r)=>{d.useDebugValue(t);const s=this.selectors[t];return To(this,s,n,o,r)};useContextCallback(t,n){d.useDebugValue(t);const o=A(n??Yt);this.context[t]=o}useStateSetter(t){const n=d.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const u=o(s);if(!Object.is(r,u)){const a=r;r=u,n(u,a,this)}})}}const wo={open:P(e=>e.open),domReferenceElement:P(e=>e.domReferenceElement),referenceElement:P(e=>e.positionReference??e.referenceElement),floatingElement:P(e=>e.floatingElement),floatingId:P(e=>e.floatingId)};class on extends nn{constructor(t){const{nested:n,noEmit:o,onOpenChange:r,triggerElements:s,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:zt(),nested:n,noEmit:o,triggerElements:s},wo)}setOpen=(t,n)=>{if((!t||!this.state.open||Bn(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(t,n)}}function Oo(e,t=!1,n=!1){const[o,r]=d.useState(e&&t?"idle":void 0),[s,u]=d.useState(e);return e&&!s&&(u(!0),r("starting")),!e&&s&&o!=="ending"&&!n&&r("ending"),!e&&!s&&o==="ending"&&r(void 0),$(()=>{if(!e&&s&&o!=="ending"&&n){const a=le.request(()=>{r("ending")});return()=>{le.cancel(a)}}},[e,s,o,n]),$(()=>{if(!e||t)return;const a=le.request(()=>{r(void 0)});return()=>{le.cancel(a)}},[t,e]),$(()=>{if(!e||!t)return;e&&s&&o!=="idle"&&r("starting");const a=le.request(()=>{r("idle")});return()=>{le.cancel(a)}},[t,e,s,r,o]),d.useMemo(()=>({mounted:s,setMounted:u,transitionStatus:o}),[s,o])}function Io(e,t){const n=d.useRef(null),o=d.useRef(null);return d.useCallback(r=>{if(e!==void 0){if(n.current!==null){const s=n.current,u=o.current,a=t.context.triggerElements.getById(s);u&&a===u&&t.context.triggerElements.delete(s),n.current=null,o.current=null}r!==null&&(n.current=e,o.current=r,t.context.triggerElements.add(e,r))}},[t,e])}function Er(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Io(e,n),u=A(a=>{if(s(a),!a||!n.select("open"))return;const i=n.select("activeTriggerId");if(i===e){n.update({activeTriggerElement:a,...o});return}i==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...o})});return $(()=>{r&&n.update({activeTriggerElement:t.current,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:r}}function ko(e){const t=e.useState("open");$(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[o,r]=n.value;e.update({activeTriggerId:o,activeTriggerElement:r})}}},[t,e])}function Mo(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=Oo(e);t.useSyncedValues({mounted:o,transitionStatus:s});const u=A(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return $t({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:s}}class rn{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const o=this.idMap.get(t);o!==n&&(o!==void 0&&this.elements.delete(o),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function Po(){return new on({open:!1,floatingElement:null,referenceElement:null,triggerElements:new rn,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Fo(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Po(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:We,inactiveTriggerProps:We,popupProps:We}}const Lo={open:P(e=>e.open),mounted:P(e=>e.mounted),transitionStatus:P(e=>e.transitionStatus),floatingRootContext:P(e=>e.floatingRootContext),preventUnmountingOnClose:P(e=>e.preventUnmountingOnClose),payload:P(e=>e.payload),activeTriggerId:P(e=>e.activeTriggerId),activeTriggerElement:P(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:P((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:P((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:P((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:P((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:P(e=>e.popupProps),popupElement:P(e=>e.popupElement),positionerElement:P(e=>e.positionerElement)};function Do(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:r}=e,s=_e(),u=$e()!=null,a=t.useState("open"),i=t.useState("activeTriggerElement"),l=t.useState(o?"popupElement":"positionerElement"),b=t.context.triggerElements,f=Be(()=>new on({open:a,referenceElement:i,floatingElement:l,triggerElements:b,onOpenChange:r,floatingId:s,nested:u,noEmit:n})).current;return $(()=>{const p={open:a,floatingId:s,referenceElement:i,floatingElement:l};ae(i)&&(p.domReferenceElement=i),f.state.positionReference===f.state.referenceElement&&(p.positionReference=i),f.update(p)},[a,s,i,l,f]),f.context.onOpenChange=r,f.context.nested=u,f.context.noEmit=n,f}function No(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),o=e.map(l=>l?.item),r=e.map(l=>l?.trigger),s=d.useCallback(l=>Ae(l,e,"reference"),t),u=d.useCallback(l=>Ae(l,e,"floating"),n),a=d.useCallback(l=>Ae(l,e,"item"),o),i=d.useCallback(l=>Ae(l,e,"trigger"),r);return d.useMemo(()=>({getReferenceProps:s,getFloatingProps:u,getItemProps:a,getTriggerProps:i}),[s,u,a,i])}function Ae(e,t,n){const o=new Map,r=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Pn]="");for(const u in e)r&&e&&(u===Ht||u===Gt)||(s[u]=e[u]);for(let u=0;u<t.length;u+=1){let a;const i=t[u]?.[n];typeof i=="function"?a=e?i(e):null:a=i,a&&Ft(s,a,r,o)}return Ft(s,e,r,o),s}function Ft(e,t,n,o){for(const r in t){const s=t[r];n&&(r===Ht||r===Gt)||(r.startsWith("on")?(o.has(r)||o.set(r,[]),typeof s=="function"&&(o.get(r)?.push(s),e[r]=(...u)=>o.get(r)?.map(a=>a(...u)).find(a=>a!==void 0))):e[r]=s)}}const Ao=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Wo(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingId"),s=n.useState("domReferenceElement"),u=n.useState("floatingElement"),{enabled:a=!0,role:i="dialog"}=t,l=_e(),b=s?.id||l,f=d.useMemo(()=>st(u)?.id||r,[u,r]),p=Ao.get(i)??i,h=$e()!=null,y=d.useMemo(()=>p==="tooltip"||i==="label"?We:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&h&&{role:"menuitem"},...i==="select"&&{"aria-autocomplete":"none"},...i==="combobox"&&{"aria-autocomplete":"list"}},[p,h,i]),C=d.useMemo(()=>p==="tooltip"||i==="label"?{[`aria-${i==="label"?"labelledby":"describedby"}`]:o?f:void 0}:{...y,"aria-expanded":o?"true":"false","aria-controls":o?f:void 0,...p==="menu"&&{id:b}},[p,f,o,b,i,y]),O=d.useMemo(()=>{const R={id:f,...p&&{role:p}};return p==="tooltip"||i==="label"?R:{...R,...p==="menu"&&{"aria-labelledby":b}}},[p,f,b,i]),v=d.useCallback(({active:R,selected:N})=>{const F={role:"option",...R&&{id:`${f}-fui-option`}};switch(i){case"select":case"combobox":return{...F,"aria-selected":N}}return{}},[f,i]);return d.useMemo(()=>a?{reference:C,floating:O,item:v,trigger:y}:{},[a,C,O,y,v])}let te=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=vt.startingStyle]="startingStyle",e[e.endingStyle=vt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),ut=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const jo={[ut.popupOpen]:""},Vo={[ut.popupOpen]:"",[ut.pressed]:""},Bo={[te.open]:""},_o={[te.closed]:""},Ko={[te.anchorHidden]:""},yr={open(e){return e?jo:null}},vr={open(e){return e?Vo:null}},gt={open(e){return e?Bo:_o},anchorHidden(e){return e?Ko:null}},sn=d.createContext(void 0);function Se(e){const t=d.useContext(sn);if(e===!1&&t===void 0)throw new Error(lt(27));return t}const Yo={...gt,...dt},Sr=d.forwardRef(function(t,n){const{render:o,className:r,forceRender:s=!1,...u}=t,{store:a}=Se(),i=a.useState("open"),l=a.useState("nested"),b=a.useState("mounted"),f=a.useState("transitionStatus"),p=d.useMemo(()=>({open:i,transitionStatus:f}),[i,f]);return Ye("div",t,{state:p,ref:[a.context.backdropRef,n],stateAttributesMapping:Yo,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:s||!l})});function $o(e){return _e(e,"base-ui")}let Ho=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Go=(function(e){return e[e.open=te.open]="open",e[e.closed=te.closed]="closed",e[e.startingStyle=te.startingStyle]="startingStyle",e[e.endingStyle=te.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const cn=d.createContext(void 0);function un(){const e=d.useContext(cn);if(e===void 0)throw new Error(lt(26));return e}const an="ArrowUp",ln="ArrowDown",dn="ArrowLeft",fn="ArrowRight",pn="Home",gn="End",Uo=new Set([dn,fn]),qo=new Set([an,ln]),zo=new Set([...Uo,...qo]);[...zo];const Xo=new Set([an,ln,dn,fn,pn,gn]),Jo={...gt,...dt,nestedDialogOpen(e){return e?{[Go.nestedDialogOpen]:""}:null}},Rr=d.forwardRef(function(t,n){const{className:o,finalFocus:r,initialFocus:s,render:u,...a}=t,{store:i}=Se(),l=i.useState("descriptionElementId"),b=i.useState("disablePointerDismissal"),f=i.useState("floatingRootContext"),p=i.useState("popupProps"),g=i.useState("modal"),h=i.useState("mounted"),y=i.useState("nested"),C=i.useState("nestedOpenDialogCount"),O=i.useState("open"),v=i.useState("openMethod"),R=i.useState("titleElementId"),N=i.useState("transitionStatus"),F=i.useState("role");un(),$t({open:O,ref:i.context.popupRef,onComplete(){O&&i.context.onOpenChangeComplete?.(!0)}});function M(_){return _==="touch"?i.context.popupRef.current:!0}const B=s===void 0?M:s,L=C>0,V=d.useMemo(()=>({open:O,nested:y,transitionStatus:N,nestedDialogOpen:L}),[O,y,N,L]),W=Ye("div",t,{state:V,props:[p,{"aria-labelledby":R??void 0,"aria-describedby":l??void 0,role:F,tabIndex:-1,hidden:!h,onKeyDown(_){Xo.has(_.key)&&_.stopPropagation()},style:{[Ho.nestedDialogs]:C}},a],ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],stateAttributesMapping:Jo});return ne.jsx(Xn,{context:f,openInteractionType:v,disabled:!h,closeOnFocusOut:!b,initialFocus:B,returnFocus:r,modal:g!==!1,restoreFocus:"popup",children:W})}),Qo=d.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const u=o?.getBoundingClientRect();s=`polygon(
|
|
2
|
-
0% 0%,
|
|
3
|
-
100% 0%,
|
|
4
|
-
100% 100%,
|
|
5
|
-
0% 100%,
|
|
6
|
-
0% 0%,
|
|
7
|
-
${u.left}px ${u.top}px,
|
|
8
|
-
${u.left}px ${u.bottom}px,
|
|
9
|
-
${u.right}px ${u.bottom}px,
|
|
10
|
-
${u.right}px ${u.top}px,
|
|
11
|
-
${u.left}px ${u.top}px
|
|
12
|
-
)`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),Tr=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=Se(),u=s.useState("mounted"),a=s.useState("modal"),i=s.useState("open");return u||o?ne.jsx(cn.Provider,{value:o,children:ne.jsxs(Fn,{ref:n,...r,children:[u&&a===!0&&ne.jsx(Qo,{ref:s.context.internalBackdropRef,inert:Ln(!i)}),t.children]})}):null});let Lt={},Dt={},Nt="";function Zo(e){if(typeof document>"u")return!1;const t=Ie(e);return Ke(t).innerWidth-t.documentElement.clientWidth>0}function er(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=Ie(e).documentElement,r={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const s=o.offsetWidth;o.style.overflowY="hidden";const u=o.offsetWidth;return Object.assign(o.style,r),s===u}function tr(e){const t=Ie(e),n=t.documentElement,o=t.body,r=qt(n)?n:o,s=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=s}}function nr(e){const t=Ie(e),n=t.documentElement,o=t.body,r=Ke(n);let s=0,u=0,a=!1;const i=le.create();if(Dn&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){const p=r.getComputedStyle(n),g=r.getComputedStyle(o),C=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,u=n.scrollLeft,Lt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Nt=n.style.scrollBehavior,Dt={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const O=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,R=p.overflowY==="scroll"||g.overflowY==="scroll",N=p.overflowX==="scroll"||g.overflowX==="scroll",F=Math.max(0,r.innerWidth-o.clientWidth),M=Math.max(0,r.innerHeight-o.clientHeight),B=parseFloat(g.marginTop)+parseFloat(g.marginBottom),L=parseFloat(g.marginLeft)+parseFloat(g.marginRight),V=qt(n)?n:o;if(a=er(e),a){n.style.scrollbarGutter=C,V.style.overflowY="hidden",V.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(O||R)&&(n.style.overflowY="scroll"),(v||N)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:B||M?`calc(100dvh - ${B+M}px)`:"100dvh",width:L||F?`calc(100vw - ${L+F}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=u,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function b(){Object.assign(n.style,Lt),Object.assign(o.style,Dt),a||(n.scrollTop=s,n.scrollLeft=u,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Nt)}function f(){b(),i.request(l)}return l(),r.addEventListener("resize",f),()=>{i.cancel(),b(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",f)}}class or{lockCount=0;restore=null;timeoutLock=ct.create();timeoutUnlock=ct.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const o=Ie(t).documentElement,r=Ke(o).getComputedStyle(o).overflowY;if(r==="hidden"||r==="clip"){this.restore=Yt;return}const s=Ut||!Zo(t);this.restore=s?tr(t):nr(t)}}const rr=new or;function sr(e=!0,t=null){$(()=>{if(e)return rr.acquire(t)},[e,t])}function ir(e){const t=d.useRef(""),n=d.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:d.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r&&e(r,r.pointerType),e(r,t.current),t.current=""},[e]),onPointerDown:n}}function cr(e){const[t,n]=d.useState(null),o=A((a,i)=>{e||n(i||(Ut?"touch":""))}),r=d.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:u}=ir(o);return d.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:s,onPointerDown:u}}),[t,r,s,u])}function ur(e){const{store:t,parentContext:n,actionsRef:o}=e,r=t.useState("open"),s=t.useState("disablePointerDismissal"),u=t.useState("modal"),a=t.useState("popupElement"),{openMethod:i,triggerProps:l,reset:b}=cr(r);ko(t);const{forceUnmount:f}=Mo(r,t,()=>{b()}),p=A(W=>{const _=de(W);return _.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},_}),g=d.useCallback(()=>{t.setOpen(!1,p(Nn))},[t,p]);d.useImperativeHandle(o,()=>({unmount:f,close:g}),[f,g]);const h=Do({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[y,C]=d.useState(0),O=y===0,v=Wo(h),R=Zn(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(W){if("button"in W&&W.button!==0||"touches"in W&&W.touches.length!==1)return!1;const _=ee(W);if(O&&!s){const q=_;return u&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===q||t.context.backdropRef.current===q||K(q,a)&&!q?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});sr(r&&u===!0,a);const{getReferenceProps:N,getFloatingProps:F,getTriggerProps:M}=No([v,R]);t.useContextCallback("onNestedDialogOpen",W=>{C(W+1)}),t.useContextCallback("onNestedDialogClose",()=>{C(0)}),d.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(y),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,y]);const B=d.useMemo(()=>N(l),[N,l]),L=d.useMemo(()=>M(l),[M,l]),V=d.useMemo(()=>F(),[F]);t.useSyncedValues({openMethod:i,activeTriggerProps:B,inactiveTriggerProps:L,popupProps:V,floatingRootContext:h,nestedOpenDialogCount:y})}const ar={...Lo,modal:P(e=>e.modal),nested:P(e=>e.nested),nestedOpenDialogCount:P(e=>e.nestedOpenDialogCount),disablePointerDismissal:P(e=>e.disablePointerDismissal),openMethod:P(e=>e.openMethod),descriptionElementId:P(e=>e.descriptionElementId),titleElementId:P(e=>e.titleElementId),viewportElement:P(e=>e.viewportElement),role:P(e=>e.role)};class lr extends nn{constructor(t){super(dr(t),{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),triggerElements:new rn,onOpenChange:void 0,onOpenChangeComplete:void 0},ar)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const o={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const r={open:t},s=n.trigger?.id??null;(s||t)&&(r.activeTriggerId=s,r.activeTriggerElement=n.trigger??null),this.update(r)}}function dr(e={}){return{...Fo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function Cr(e){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,disablePointerDismissal:u=!1,modal:a=!0,actionsRef:i,handle:l,triggerId:b,defaultTriggerId:f=null}=e,p=Se(!0),g=!!p,h=Be(()=>l?.store??new lr({open:n??o,activeTriggerId:b!==void 0?b:f,modal:a,disablePointerDismissal:u,nested:g})).current;h.useControlledProp("open",n,o),h.useControlledProp("activeTriggerId",b,f),h.useSyncedValues({disablePointerDismissal:u,nested:g,modal:a}),h.useContextCallback("onOpenChange",r),h.useContextCallback("onOpenChangeComplete",s);const y=h.useState("payload");ur({store:h,actionsRef:i,parentContext:p?.store.context});const C=d.useMemo(()=>({store:h}),[h]);return ne.jsx(sn.Provider,{value:C,children:typeof t=="function"?t({payload:y}):t})}let At=(function(e){return e[e.open=te.open]="open",e[e.closed=te.closed]="closed",e[e.startingStyle=te.startingStyle]="startingStyle",e[e.endingStyle=te.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const fr={...gt,...dt,nested(e){return e?{[At.nested]:""}:null},nestedDialogOpen(e){return e?{[At.nestedDialogOpen]:""}:null}},xr=d.forwardRef(function(t,n){const{className:o,render:r,children:s,...u}=t,a=un(),{store:i}=Se(),l=i.useState("open"),b=i.useState("nested"),f=i.useState("transitionStatus"),p=i.useState("nestedOpenDialogCount"),g=i.useState("mounted"),h=p>0,y=d.useMemo(()=>({open:l,nested:b,transitionStatus:f,nestedDialogOpen:h}),[l,b,f,h]);return Ye("div",t,{enabled:a||g,state:y,ref:[n,i.useStateSetter("viewportElement")],stateAttributesMapping:fr,props:[{role:"presentation",hidden:!g,children:s},u]})}),wr=d.forwardRef(function(t,n){const{render:o,className:r,id:s,...u}=t,{store:a}=Se(),i=$o(s);return a.useSyncedValueWithCleanup("titleElementId",i),Ye("h2",t,{ref:n,props:[{id:i},u]})});export{on as A,ye as B,Xo as C,Cr as D,Lo as E,Xn as F,Fo as G,br as H,Qo as I,ko as J,Mo as K,Do as L,Wo as M,Er as N,mr as O,rn as P,hr as Q,nn as R,Oe as S,Tr as a,Sr as b,xr as c,Rr as d,wr as e,Fe as f,$e as g,ft as h,Je as i,jn as j,Vn as k,$o as l,P as m,Oo as n,cr as o,To as p,Zn as q,No as r,An as s,vr as t,Se as u,yr as v,sr as w,gt as x,gr as y,Bn as z};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as i,M as h,A as s,r as j,ax as v,i as k,L as N,ay as L}from"./main-BHU0hIWS.js";import{u as P}from"./use-usage-limits-CUlVKjou.js";import{u as C}from"./use-limits-display-prefs-mPyTqsYR.js";import{C as g}from"./Card-BRdnq8-k.js";import{F as E}from"./FadeIn-CsYsRptR.js";import{L as O}from"./LocalOnlyNotice-BSlFMNhI.js";import"./arrow-up-right-OHDkhx-y.js";import"./download-BOwIFon2.js";const T=[3,2,3,3,2,2,3];function m({className:n}){return i.jsx("div",{className:h("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",n)})}function R(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(m,{className:"h-3 w-12 shrink-0"}),i.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(m,{className:"h-3 w-[30px] shrink-0"}),i.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function S({bars:n,index:e}){const r=e%3===0?"w-24":e%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(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(m,{className:h("h-4",r)})]}),Array.from({length:n},(a,l)=>i.jsx(R,{},l))]})}function A(){return i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(m,{className:"h-3.5 w-28"}),T.map((n,e)=>i.jsx(S,{bars:n,index:e},e))]})})}function t(n){if(!n)return null;const e=typeof n=="number"?n*1e3:Date.parse(n);if(!Number.isFinite(e))return null;const r=e-Date.now();if(r<=0)return s("shared.time.now");const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const l=Math.floor(a/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function I(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function o({label:n,pct:e,reset:r}){const a=Math.max(0,Math.min(100,Number(e)||0)),l=Math.round(a),u=a>0&&l===0?Math.max(a,.35):a,x=a>0&&l===0?"<1":String(l);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:n}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${I(l)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:a>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",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}):null]})}function d({name:n,icon:e,children:r}){const l=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:l}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n})]}),r]})}const M=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],D={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:n,tone:e="neutral"}){const r=e==="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:n})}function H(n,e){const r=D[n];if(!r)return null;if(!e?.configured)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},n);if(e.error)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},n);switch(n){case"claude":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.five_hour?i.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?i.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?i.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"kiro":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx($,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function $({defaultDir:n}){const[e,r]=j.useState(!1),l=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${n||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
-
`),u=async()=>{try{await navigator.clipboard.writeText(l),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:s("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:s("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:l}),i.jsx("button",{type:"button",onClick:u,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:e?s("limits.copilot.otelHint.copied"):s("limits.copilot.otelHint.copy")})]})}function F({claude:n,codex:e,cursor:r,gemini:a,kimi:l,kiro:u,antigravity:x,copilot:b,order:w,visibility:_}){const f={claude:n,codex:e,cursor:r,gemini:a,kimi:l,kiro:u,antigravity:x,copilot:b},y=(Array.isArray(w)&&w.length>0?w:M).filter(p=>!_||_[p]!==!1).map(p=>H(p,f[p])).filter(Boolean);return i.jsx(E,{delay:.15,children:i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s("limits.panel.title")}),y.length>0?y:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const B=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function J(){const n=v(),{data:e,error:r,isLoading:a}=P(n?{initialRefresh:!0,initialState:n,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),l=C();return!B&&!k()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(O,{})}):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:s("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:s("limits.page.subtitle")})]}),i.jsx(N,{to:"/settings","aria-label":s("limits.page.openSettings"),title:s("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(L,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(A,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:r})}):null,i.jsx(F,{claude:e?.claude,codex:e?.codex,cursor:e?.cursor,gemini:e?.gemini,kimi:e?.kimi,kiro:e?.kiro,antigravity:e?.antigravity,copilot:e?.copilot,order:l.order,visibility:l.visibility})]})]})})})}export{J as LimitsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,r as l,ag as J,aa as Y,aC as L,j as t,m as O,M as x,A as s,O as Q,an as q,aD as X,ar as ee,as as te,at as A,aE as ne,aF as ae,N as ie,R as se,J as oe,K as re,V as le,aG as ce,aH as ue,aI as de,aJ as ge,E as he,aK as pe,aL as be,aM as me,aN as fe,aO as xe,aP as ye,aQ as ve,a8 as ke}from"./main-BHU0hIWS.js";import{L as je,a as G,u as Ne}from"./use-limits-display-prefs-mPyTqsYR.js";import{S as k,T as j,a as m,b as Se,u as I}from"./use-native-settings-DbaL1Woo.js";import{C as we}from"./check-BcU6hhFb.js";import{u as Ce}from"./useCurrency-B70A0cjV.js";import{C as P}from"./chevron-down-BVozhieG.js";import{I as Le}from"./info-BNlH8ZDr.js";import{D as Ge}from"./download-BOwIFon2.js";import"./Card-BRdnq8-k.js";const Ee=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=v("activity",Ee);const Ae=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ie=v("copy",Ae);const Pe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],_e=v("grip-vertical",Pe);const De=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Te=v("languages",De);const Me=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ue=v("log-out",Me);const Re=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Fe=v("pencil",Re),He=e=>!e.isLayoutDirty&&e.willUpdate(!1);function E(){const e=new Set,n=new WeakMap,i=()=>e.forEach(He);return{add:a=>{e.add(a),n.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=n.get(a);o&&(o(),n.delete(a)),i()},dirty:i}}const $e=l.createContext(null);function Be(){const e=l.useRef(!1);return J(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ze(){const e=Be(),[n,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(n+1)},[n]);return[l.useCallback(()=>Y.postRender(a),[a]),n]}const _=e=>e===!0,Ve=e=>_(e===!0)||e==="id",Ke=({children:e,id:n,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext($e),[r,c]=ze(),u=l.useRef(null),g=a.id||o;u.current===null&&(Ve(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:_(i)&&a.group||E()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:h,children:e})},Ze=new Set(["cursor","kiro","copilot","kimi"]);function We({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Je({prefs:e}){const{order:n,visibility:i,toggle:a,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},b=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},y=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(Ke,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:b(d),onDragEnd:f,onDrop:y,className:x("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[t.jsx(_e,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),t.jsx("img",{src:je[d],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",Ze.has(d)&&"dark:invert"),draggable:!1}),t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:G[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(We,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${G[d]}`})})]},d)})})})}function Ye(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function qe(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function Xe(e,n,i){const[a,o]=l.useState(()=>q()),r=n&&i&&X(),c=l.useCallback(async()=>{const u=!a;if(ee(u),o(u),!!u)try{await te(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function et(e){const[n,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,b]=l.useState(null),[f,y]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[U,C]=l.useState(""),[R,F]=l.useState(""),[H,$]=l.useState(!1),[B,z]=l.useState(null),V=l.useMemo(()=>Ye(e),[e]),K=l.useMemo(()=>Qe(e),[e]),Z=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),W=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:b,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:V,editingGithub:H,editingName:f,email:K,githubError:B,githubInput:R,githubUrl:U,loadSetters:W,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:b,setEditingGithub:$,setEditingName:y,setGithubError:z,setGithubInput:F,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:Z}}function tt(e,n,i){l.useEffect(()=>{if(!n)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await A({getAccessToken:e});if(!a||!o)return;const r=await ne({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,n,i])}function nt(e,n){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await A({getAccessToken:e});if(!c)return!1;const u=await ae({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{n.setProfileSaving(!1)}},[e,n])}function at(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function it(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function st(e,n){const i=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function ot(e,n){const i=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await n({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[n,e]),a=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:a}}function rt(e,n){const i=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),a=l.useCallback(async()=>{const r=qe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:a,handleShowGithubToggle:i,startEditingGithub:o}}function lt(){const e=Q(),n=et(e.user),i=Xe(e.getAccessToken,e.enabled,e.signedIn);tt(e.getAccessToken,e.signedIn,n.loadSetters);const a=nt(e.getAccessToken,n),o=st(n,a),r=ot(n,a),c=rt(n,a);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:at(n,{...o,...r}),github:it(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function D({disabled:e,onCancel:n,onSave:i,saveLabel:a=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:a}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function ct({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:a,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),t.jsx(D,{disabled:a||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function ut({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),t.jsx(D,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?s("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function T({disabled:e=!1,label:n,onClick:i,title:a}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function M({actions:e,editing:n,editor:i,hint:a,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),n?null:e]})})}function dt({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function gt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:b,setNameInput:f,startEditingName:y}=e,d=n?s("settings.account.displayNameAnonymousHint"):i||a;return t.jsx(M,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ct,{nameInput:u,setEditingName:b,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:t.jsx(dt,{name:e})})}function ht({github:e}){const{editingGithub:n,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:f,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(M,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(ut,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:f}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{label:s("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function pt(){const{openLoginModal:e}=ie();return t.jsx(k,{title:s("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function bt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(gt,{name:e}),t.jsx(ht,{github:n})]})}function mt(){const e=lt();return e.enabled?e.signedIn?t.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(xt,{onSignOut:e.signOut}),children:[t.jsx(ft,{userId:e.userId}),t.jsx(yt,{settings:e}),t.jsx(vt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(kt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(pt,{}):null}function ft({userId:e}){const[n,i]=se.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[n?t.jsx(we,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function xt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Ue,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function yt({settings:e}){return e.showLocalCloudSync?t.jsx(m,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function vt({checked:e,disabled:n,onChange:i}){return t.jsx(m,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function kt({visible:e,name:n,github:i}){return t.jsx(oe,{initial:!1,children:e?t.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(bt,{name:n,github:i})},"public-profile-fields"):null})}function jt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:s("settings.appearance.theme.system"),Icon:de}]}function Nt(){return[{value:pe,label:s("settings.appearance.language.system")},{value:be,label:s("settings.appearance.language.english")},{value:me,label:s("settings.appearance.language.chinese")},{value:fe,label:s("settings.appearance.language.traditional_chinese")},{value:xe,label:s("settings.appearance.language.japanese")},{value:ye,label:s("settings.appearance.language.korean")}]}function St(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function wt(e,n){const i=s(`settings.appearance.currency.rate_source.${e}`),a=St(n),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Ct({locale:e,setLocale:n}){const i=Nt();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx(Te,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.language.label"),className:x("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-8 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 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:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))}),t.jsx(P,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Lt({currency:e,setCurrency:n}){const i=ge();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:x("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 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:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),t.jsx(P,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Gt({currency:e,rate:n,rateSource:i,rateFetchedAt:a}){if(e===he)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=wt(i,a);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Et(){const{theme:e,setTheme:n}=re(),{locale:i,setLocale:a}=le(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ce();return t.jsxs(k,{title:s("settings.section.appearance"),children:[t.jsx(m,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(Se,{options:jt(),value:e,onChange:n})}),t.jsx(m,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(Ct,{locale:i,setLocale:a})}),t.jsx(m,{label:s("settings.appearance.currency.label"),hint:t.jsx(Gt,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Lt,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:n,setSetting:i,runAction:a}=I();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:s("settings.section.menubar"),children:[r?t.jsx(m,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(m,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>a("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(ve,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(m,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function At(){const{available:e,settings:n,runAction:i}=I(),a=e&&n?.version;return t.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[a?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,t.jsxs("a",{href:ke,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function Ht(){const e=Ne();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Et,{}),t.jsx(Ot,{}),t.jsx(mt,{}),t.jsx(k,{title:s("settings.section.limits"),children:t.jsx(Je,{prefs:e})})]}),t.jsx(At,{})]})})})}export{Ht as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-BHU0hIWS.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a}from"./main-BHU0hIWS.js";const d=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],S={claude:"Claude",codex:"Codex",cursor:"Cursor",gemini:"Gemini",kimi:"Kimi",kiro:"Kiro",copilot:"GitHub Copilot",antigravity:"Antigravity"},v={claude:"/brand-logos/claude-code.svg",codex:"/brand-logos/codex.svg",cursor:"/brand-logos/cursor.svg",gemini:"/brand-logos/gemini.svg",kimi:"/brand-logos/kimi.svg",kiro:"/brand-logos/kiro.svg",copilot:"/brand-logos/copilot.svg",antigravity:"/brand-logos/antigravity.svg"},l="tt.limits.providerOrder",g="tt.limits.providerVisibility";function w(){if(typeof window>"u")return[...d];try{const i=window.localStorage.getItem(l);if(!i)return[...d];const s=JSON.parse(i);if(!Array.isArray(s))return[...d];const r=s.filter(c=>d.includes(c));for(const c of d)r.includes(c)||r.push(c);return r}catch{return[...d]}}function y(){const i=Object.fromEntries(d.map(s=>[s,!0]));if(typeof window>"u")return i;try{const s=window.localStorage.getItem(g);if(!s)return i;const r=JSON.parse(s);if(!r||typeof r!="object")return i;const c={...i};for(const u of d)typeof r[u]=="boolean"&&(c[u]=r[u]);return c}catch{return i}}function C(){const[i,s]=a.useState(w),[r,c]=a.useState(y);a.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(l,JSON.stringify(i))}catch{}},[i]),a.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(g,JSON.stringify(r))}catch{}},[r]),a.useEffect(()=>{if(typeof window>"u")return;const o=t=>{t.key===l&&s(w()),t.key===g&&c(y())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[]);const u=a.useCallback(o=>{c(t=>({...t,[o]:!t[o]}))},[]),b=a.useCallback(o=>{s(t=>{const e=t.indexOf(o);if(e<=0)return t;const n=[...t];return[n[e-1],n[e]]=[n[e],n[e-1]],n})},[]),p=a.useCallback(o=>{s(t=>{const e=t.indexOf(o);if(e<0||e>=t.length-1)return t;const n=[...t];return[n[e],n[e+1]]=[n[e+1],n[e]],n})},[]),O=a.useCallback((o,t)=>{o!==t&&s(e=>{const n=e.indexOf(o),m=e.indexOf(t);if(n<0||m<0)return e;const f=[...e],[I]=f.splice(n,1);return f.splice(m,0,I),f})},[]),k=a.useCallback(()=>{s([...d]),c(Object.fromEntries(d.map(o=>[o,!0])))},[]),x=a.useMemo(()=>i.filter(o=>r[o]!==!1),[i,r]);return{order:i,visibility:r,visibleOrdered:x,toggle:u,moveUp:b,moveDown:p,moveToward:O,reset:k}}export{v as L,S as a,C as u};
|