@ipv9/tokentracker-cli 0.39.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/LICENSE +21 -0
- package/README.ja.md +464 -0
- package/README.ko.md +464 -0
- package/README.md +476 -0
- package/README.zh-CN.md +469 -0
- package/bin/tracker.js +52 -0
- package/dashboard/dist/app-icon.png +0 -0
- package/dashboard/dist/apple-touch-icon.png +0 -0
- package/dashboard/dist/assets/ActivityHeatmap-BxBGHY1z.js +42 -0
- package/dashboard/dist/assets/Card-GROxUc_6.js +1 -0
- package/dashboard/dist/assets/DashboardPage-BZ5VFoBk.js +19 -0
- package/dashboard/dist/assets/DevicePage-CQts7ivB.js +1 -0
- package/dashboard/dist/assets/DialogTitle-DqFsk26U.js +1 -0
- package/dashboard/dist/assets/FadeIn-HBBXW_3q.js +1 -0
- package/dashboard/dist/assets/HeaderGithubStar-COD2HfaF.js +1 -0
- package/dashboard/dist/assets/IpCheckPage-Cn0l8-BQ.js +15 -0
- package/dashboard/dist/assets/LandingPage-CmV1BMU4.js +4356 -0
- package/dashboard/dist/assets/LeaderboardAvatar-CiIpWZwb.js +1 -0
- package/dashboard/dist/assets/LeaderboardPage-BU0mlR3g.js +6 -0
- package/dashboard/dist/assets/LeaderboardProfileModal-C49_3Xm9.js +72 -0
- package/dashboard/dist/assets/LeaderboardProfilePage-Bh1n0BAM.js +1 -0
- package/dashboard/dist/assets/LimitsPage-fZAmwLWT.js +2 -0
- package/dashboard/dist/assets/LocalOnlyNotice-D3rQdA-P.js +1 -0
- package/dashboard/dist/assets/LoginPage-enO4XP-c.js +1 -0
- package/dashboard/dist/assets/PopoverPopup-pitJEpN1.js +1 -0
- package/dashboard/dist/assets/Select-tT9x4ntD.js +1 -0
- package/dashboard/dist/assets/SelectItemText-C7F7eIm0.js +1 -0
- package/dashboard/dist/assets/SettingsPage-pDasZNU2.js +1 -0
- package/dashboard/dist/assets/SkillsPage-DEu7FY-2.js +1 -0
- package/dashboard/dist/assets/WidgetsPage-DGcO7rbp.js +1 -0
- package/dashboard/dist/assets/WrappedPage-D_1ID213.js +1 -0
- package/dashboard/dist/assets/agent-logos-DXQVg1xy.js +1 -0
- package/dashboard/dist/assets/arrow-up-right-DNLo92Ba.js +1 -0
- package/dashboard/dist/assets/download-DbBBBpJF.js +1 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-BPBWmzPh.woff +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-Ce5q_31Z.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-CJBLNVQT.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-mNhfPmgl.woff +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-DH5Q319x.woff +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-VCNRadI3.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-BKC3PZkM.woff +0 -0
- package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-DdrQ8KBw.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-400-normal-CoULgQGM.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-400-normal-LC9RFr9I.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-500-normal-D3o2eNa9.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-500-normal-DOxI7kZ4.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-700-normal-D6izGJRP.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-700-normal-QGw08Lff.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-900-normal-CmoKXrdK.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-900-normal-Cu5MFKsu.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-Cgks_Qgx.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-CxNRRMGd.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-CQcGuCNt.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-diTenJ8L.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-BX9f1BHp.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-YOllDaLV.woff2 +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-Br6WNUGb.woff +0 -0
- package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-CrmBTzU2.woff2 +0 -0
- package/dashboard/dist/assets/index-BeoRn2gJ.js +2 -0
- package/dashboard/dist/assets/info-Bh5qTz6k.js +1 -0
- package/dashboard/dist/assets/main-BIY3Nj6I.js +969 -0
- package/dashboard/dist/assets/main-G_F9Iu_x.css +1 -0
- package/dashboard/dist/assets/use-limits-display-prefs-B4iJ-bBc.js +1 -0
- package/dashboard/dist/assets/use-native-settings-DHjPFDv8.js +1 -0
- package/dashboard/dist/assets/use-usage-limits-odqe9OY7.js +1 -0
- package/dashboard/dist/assets/useCurrency-BsSZiZMP.js +1 -0
- package/dashboard/dist/assets/useOpenInteractionType-BQhgq4rv.js +12 -0
- package/dashboard/dist/brand-logos/antigravity.svg +1 -0
- package/dashboard/dist/brand-logos/claude-code.svg +1 -0
- package/dashboard/dist/brand-logos/codebuddy.svg +1 -0
- package/dashboard/dist/brand-logos/codex.svg +15 -0
- package/dashboard/dist/brand-logos/copilot.svg +1 -0
- package/dashboard/dist/brand-logos/cursor.svg +1 -0
- package/dashboard/dist/brand-logos/gemini.svg +1 -0
- package/dashboard/dist/brand-logos/grok.svg +1 -0
- package/dashboard/dist/brand-logos/hermes.svg +1 -0
- package/dashboard/dist/brand-logos/kilo.svg +4 -0
- package/dashboard/dist/brand-logos/kimi.svg +1 -0
- package/dashboard/dist/brand-logos/kiro.svg +1 -0
- package/dashboard/dist/brand-logos/openclaw.svg +22 -0
- package/dashboard/dist/brand-logos/opencode.svg +3 -0
- package/dashboard/dist/clawd/happy.svg +161 -0
- package/dashboard/dist/clawd/idle/collapse.svg +101 -0
- package/dashboard/dist/clawd/idle/doze.svg +72 -0
- package/dashboard/dist/clawd/idle/follow.svg +64 -0
- package/dashboard/dist/clawd/idle/living.svg +196 -0
- package/dashboard/dist/clawd/idle/look.svg +115 -0
- package/dashboard/dist/clawd/idle/yawn.svg +158 -0
- package/dashboard/dist/clawd/mini/alert.svg +129 -0
- package/dashboard/dist/clawd/mini/crabwalk.svg +76 -0
- package/dashboard/dist/clawd/mini/enter-sleep.svg +65 -0
- package/dashboard/dist/clawd/mini/enter.svg +115 -0
- package/dashboard/dist/clawd/mini/happy.svg +124 -0
- package/dashboard/dist/clawd/mini/idle-tight.svg +15 -0
- package/dashboard/dist/clawd/mini/idle.svg +83 -0
- package/dashboard/dist/clawd/mini/peek.svg +82 -0
- package/dashboard/dist/clawd/mini/sleep.svg +112 -0
- package/dashboard/dist/clawd/react/double.svg +108 -0
- package/dashboard/dist/clawd/react/drag.svg +102 -0
- package/dashboard/dist/clawd/react/left.svg +102 -0
- package/dashboard/dist/clawd/react/right.svg +102 -0
- package/dashboard/dist/clawd/sleep/collapse-sleep.svg +247 -0
- package/dashboard/dist/clawd/sleep/sleeping.svg +118 -0
- package/dashboard/dist/clawd/sleep/wake.svg +277 -0
- package/dashboard/dist/clawd/static-base.svg +21 -0
- package/dashboard/dist/clawd/status/disconnected.svg +136 -0
- package/dashboard/dist/clawd/status/error.svg +94 -0
- package/dashboard/dist/clawd/status/notification.svg +134 -0
- package/dashboard/dist/clawd/working/building.svg +231 -0
- package/dashboard/dist/clawd/working/carrying.svg +107 -0
- package/dashboard/dist/clawd/working/conducting.svg +118 -0
- package/dashboard/dist/clawd/working/confused.svg +113 -0
- package/dashboard/dist/clawd/working/debugger.svg +91 -0
- package/dashboard/dist/clawd/working/juggling.svg +82 -0
- package/dashboard/dist/clawd/working/overheated.svg +75 -0
- package/dashboard/dist/clawd/working/pushing.svg +125 -0
- package/dashboard/dist/clawd/working/sweeping.svg +79 -0
- package/dashboard/dist/clawd/working/thinking.svg +119 -0
- package/dashboard/dist/clawd/working/typing.svg +153 -0
- package/dashboard/dist/clawd/working/ultrathink.svg +166 -0
- package/dashboard/dist/clawd/working/wizard.svg +98 -0
- package/dashboard/dist/dashboard-dark.png +0 -0
- package/dashboard/dist/favicon-16.png +0 -0
- package/dashboard/dist/favicon-32.png +0 -0
- package/dashboard/dist/favicon.ico +0 -0
- package/dashboard/dist/feed.xml +34 -0
- package/dashboard/dist/icon-192.png +0 -0
- package/dashboard/dist/icon-512.png +0 -0
- package/dashboard/dist/index.html +355 -0
- package/dashboard/dist/llms.txt +53 -0
- package/dashboard/dist/neon_bg.png +0 -0
- package/dashboard/dist/robots.txt +7 -0
- package/dashboard/dist/share.html +140 -0
- package/dashboard/dist/sitemap.xml +27 -0
- package/dashboard/dist/widgets-overview.png +0 -0
- package/package.json +78 -0
- package/scripts/install-local-service.sh +140 -0
- package/scripts/uninstall-local-service.sh +21 -0
- package/src/cli.js +95 -0
- package/src/commands/device-login.js +161 -0
- package/src/commands/diagnostics.js +38 -0
- package/src/commands/doctor.js +96 -0
- package/src/commands/init.js +1195 -0
- package/src/commands/serve.js +351 -0
- package/src/commands/status.js +609 -0
- package/src/commands/sync.js +2285 -0
- package/src/commands/uninstall.js +189 -0
- package/src/commands/wrapped.js +150 -0
- package/src/lib/antigravity-paths.js +48 -0
- package/src/lib/browser-auth.js +281 -0
- package/src/lib/categorizer-utils.js +232 -0
- package/src/lib/claude-categorizer.js +1319 -0
- package/src/lib/claude-config.js +204 -0
- package/src/lib/cli-ui.js +179 -0
- package/src/lib/codex-config.js +350 -0
- package/src/lib/codex-context-breakdown.js +400 -0
- package/src/lib/codex-rollout-parser.js +623 -0
- package/src/lib/codex-token-refresh.js +112 -0
- package/src/lib/cursor-config.js +425 -0
- package/src/lib/debug-flags.js +7 -0
- package/src/lib/diagnostics.js +272 -0
- package/src/lib/doctor.js +338 -0
- package/src/lib/fs.js +91 -0
- package/src/lib/gemini-config.js +288 -0
- package/src/lib/grok-hook.js +351 -0
- package/src/lib/init-flow.js +42 -0
- package/src/lib/local-api.js +1861 -0
- package/src/lib/openclaw-hook.js +420 -0
- package/src/lib/openclaw-session-plugin.js +520 -0
- package/src/lib/opencode-config.js +99 -0
- package/src/lib/passive-mode.js +185 -0
- package/src/lib/pricing/curated-overrides.json +79 -0
- package/src/lib/pricing/index.js +143 -0
- package/src/lib/pricing/litellm-fetcher.js +172 -0
- package/src/lib/pricing/matcher.js +255 -0
- package/src/lib/pricing/seed-snapshot.json +1 -0
- package/src/lib/progress.js +76 -0
- package/src/lib/project-usage-purge.js +106 -0
- package/src/lib/prompt.js +24 -0
- package/src/lib/proxy-env.js +131 -0
- package/src/lib/rollout.js +8442 -0
- package/src/lib/runtime-config.js +122 -0
- package/src/lib/skill-usage.js +267 -0
- package/src/lib/skills-manager.js +1127 -0
- package/src/lib/source-metadata.js +48 -0
- package/src/lib/sqlite-reader.js +136 -0
- package/src/lib/static-server.js +59 -0
- package/src/lib/subscriptions.js +453 -0
- package/src/lib/tracker-paths.js +16 -0
- package/src/lib/upload-throttle.js +148 -0
- package/src/lib/usage-limits.js +1806 -0
- package/src/lib/wrapped-aggregator.js +225 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as l,j as c,N as h}from"./main-BIY3Nj6I.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-C49_3Xm9.js","assets/main-BIY3Nj6I.js","assets/main-G_F9Iu_x.css","assets/useCurrency-BsSZiZMP.js","assets/LeaderboardAvatar-CiIpWZwb.js","assets/ActivityHeatmap-BxBGHY1z.js","assets/info-Bh5qTz6k.js","assets/arrow-up-right-DNLo92Ba.js","assets/useOpenInteractionType-BQhgq4rv.js","assets/DialogTitle-DqFsk26U.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as Qr,r as s,R as re,ak as qe,j as c,N as L,A as y,al as en,am as tn,O as rn,Q as nn,an as on,i as an,f as sn,ao as ln,ap as cn,aq as Et,V as dn,ar as un,m as fn,as as gn,P as hn,L as bn,D as pn,a6 as kr,B as mn,at as xn,au as vn,av as Qt,aw as yn,_ as wn,E as kn}from"./main-BIY3Nj6I.js";import{S as Sn}from"./Select-tT9x4ntD.js";import{u as Nn}from"./useCurrency-BsSZiZMP.js";import{L as Lt}from"./LeaderboardAvatar-CiIpWZwb.js";import"./SelectItemText-C7F7eIm0.js";import"./useOpenInteractionType-BQhgq4rv.js";const Cn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Rn=Qr("arrow-right",Cn);function Dn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $e(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Xt(e){return"nodeType"in e}function ne(e){var t,r;return e?$e(e)?e:Xt(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Ht(e){const{Document:t}=ne(e);return e instanceof t}function at(e){return $e(e)?!1:e instanceof ne(e).HTMLElement}function Sr(e){return e instanceof ne(e).SVGElement}function Fe(e){return e?$e(e)?e.document:Xt(e)?Ht(e)?e:at(e)||Sr(e)?e.ownerDocument:document:document:document}const we=Nt?s.useLayoutEffect:s.useEffect;function Wt(e){const t=s.useRef(e);return we(()=>{t.current=e}),s.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function jn(){const e=s.useRef(null),t=s.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function et(e,t){t===void 0&&(t=[e]);const r=s.useRef(e);return we(()=>{r.current!==e&&(r.current=e)},t),r}function st(e,t){const r=s.useRef();return s.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function vt(e){const t=Wt(e),r=s.useRef(null),n=s.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Ot(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Mt={};function it(e,t){return s.useMemo(()=>{if(t)return t;const r=Mt[e]==null?0:Mt[e]+1;return Mt[e]=r,e+"-"+r},[e,t])}function Nr(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,i)=>{const l=Object.entries(i);for(const[d,u]of l){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=Nr(1),tt=Nr(-1);function En(e){return"clientX"in e&&"clientY"in e}function Gt(e){if(!e)return!1;const{KeyboardEvent:t}=ne(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=ne(e.target);return t&&e instanceof t}function Pt(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return En(e)?{x:e.clientX,y:e.clientY}:null}const rt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[rt.Translate.toString(e),rt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),er="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _n(e){return e.matches(er)?e:e.querySelector(er)}const An={display:"none"};function In(e){let{id:t,value:r}=e;return re.createElement("div",{id:t,style:An},r)}function Tn(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return re.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Ln(){const[e,t]=s.useState("");return{announce:s.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Cr=s.createContext(null);function On(e){const t=s.useContext(Cr);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Pn(){const[e]=s.useState(()=>new Set),t=s.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[s.useCallback(n=>{let{type:o,event:a}=n;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,a)})},[e]),t]}const zn={draggable:`
|
|
3
|
+
To pick up a draggable item, press the space bar.
|
|
4
|
+
While dragging, use the arrow keys to move the item.
|
|
5
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
+
`},Bn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Kn(e){let{announcements:t=Bn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=zn}=e;const{announce:a,announcement:i}=Ln(),l=it("DndLiveRegion"),[d,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),On(s.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:b}=f;t.onDragMove&&a(t.onDragMove({active:p,over:b}))},onDragOver(f){let{active:p,over:b}=f;a(t.onDragOver({active:p,over:b}))},onDragEnd(f){let{active:p,over:b}=f;a(t.onDragEnd({active:p,over:b}))},onDragCancel(f){let{active:p,over:b}=f;a(t.onDragCancel({active:p,over:b}))}}),[a,t])),!d)return null;const g=re.createElement(re.Fragment,null,re.createElement(In,{id:n,value:o.draggable}),re.createElement(Tn,{id:l,announcement:i}));return r?qe.createPortal(g,r):g}var $;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})($||($={}));function yt(){}function tr(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function $n(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const me=Object.freeze({x:0,y:0});function Rr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Dr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Fn(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function rr(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function jr(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function nr(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Un=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=nr(t,t.left,t.top),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=Rr(nr(d),o);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Dr)},Yn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=rr(d),g=o.reduce((p,b,w)=>p+Rr(u[w],b),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:f}})}}return a.sort(Dr)};function Xn(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-n,l=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=i*l,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const Hn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:i}=a,l=r.get(i);if(l){const d=Xn(l,t);d>0&&o.push({id:i,data:{droppableContainer:a,value:d}})}}return o.sort(Fn)};function Wn(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Er(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:me}function Gn(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...r})}}const Vn=Gn(1);function qn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jn(e,t,r){const n=qn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:i,y:l}=n,d=e.left-i-(1-o)*parseFloat(r),u=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:d+g,bottom:u+f,left:d}}const Zn={ignoreTransform:!1};function Ue(e,t){t===void 0&&(t=Zn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=ne(e).getComputedStyle(e);u&&(r=Jn(r,u,g))}const{top:n,left:o,width:a,height:i,bottom:l,right:d}=r;return{top:n,left:o,width:a,height:i,bottom:l,right:d}}function or(e){return Ue(e,{ignoreTransform:!0})}function Qn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function eo(e,t){return t===void 0&&(t=ne(e).getComputedStyle(e)),t.position==="fixed"}function to(e,t){t===void 0&&(t=ne(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function Ct(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(Ht(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!at(o)||Sr(o)||r.includes(o))return r;const a=ne(e).getComputedStyle(o);return o!==e&&to(o,a)&&r.push(o),eo(o,a)?r:n(o.parentNode)}return e?n(e):r}function Mr(e){const[t]=Ct(e,1);return t??null}function _t(e){return!Nt||!e?null:$e(e)?e:Xt(e)?Ht(e)||e===Fe(e).scrollingElement?window:at(e)?e:null:null}function _r(e){return $e(e)?e.scrollX:e.scrollLeft}function Ar(e){return $e(e)?e.scrollY:e.scrollTop}function zt(e){return{x:_r(e),y:Ar(e)}}var F;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(F||(F={}));function Ir(e){return!Nt||!e?!1:e===document.scrollingElement}function Tr(e){const t={x:0,y:0},r=Ir(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:n,minScroll:t}}const ro={x:.2,y:.2};function no(e,t,r,n,o){let{top:a,left:i,right:l,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=ro);const{isTop:u,isBottom:g,isLeft:f,isRight:p}=Tr(e),b={x:0,y:0},w={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(b.y=F.Backward,w.y=n*Math.abs((t.top+m.height-a)/m.height)):!g&&d>=t.bottom-m.height&&(b.y=F.Forward,w.y=n*Math.abs((t.bottom-m.height-d)/m.height)),!p&&l>=t.right-m.width?(b.x=F.Forward,w.x=n*Math.abs((t.right-m.width-l)/m.width)):!f&&i<=t.left+m.width&&(b.x=F.Backward,w.x=n*Math.abs((t.left+m.width-i)/m.width)),{direction:b,speed:w}}function oo(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Lr(e){return e.reduce((t,r)=>Ke(t,zt(r)),me)}function ao(e){return e.reduce((t,r)=>t+_r(r),0)}function so(e){return e.reduce((t,r)=>t+Ar(r),0)}function io(e,t){if(t===void 0&&(t=Ue),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);Mr(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const lo=[["x",["left","right"],ao],["y",["top","bottom"],so]];class Vt{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ct(r),o=Lr(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of lo)for(const d of i)Object.defineProperty(this,d,{get:()=>{const u=l(n),g=o[a]-u;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Je{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function co(e){const{EventTarget:t}=ne(e);return e instanceof t?e:Fe(e)}function At(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var ge;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ge||(ge={}));function ar(e){e.preventDefault()}function uo(e){e.stopPropagation()}var E;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(E||(E={}));const Or={start:[E.Space,E.Enter],cancel:[E.Esc],end:[E.Space,E.Enter,E.Tab]},fo=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case E.Right:return{...r,x:r.x+25};case E.Left:return{...r,x:r.x-25};case E.Down:return{...r,y:r.y+25};case E.Up:return{...r,y:r.y-25}}};class qt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Je(Fe(r)),this.windowListeners=new Je(ne(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ge.Resize,this.handleCancel),this.windowListeners.add(ge.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ge.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&io(n),r(me)}handleKeyDown(t){if(Gt(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Or,coordinateGetter:i=fo,scrollBehavior:l="smooth"}=o,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=n.current,g=u?{x:u.left,y:u.top}:me;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:r,context:n.current,currentCoordinates:g});if(f){const p=tt(f,g),b={x:0,y:0},{scrollableAncestors:w}=n.current;for(const m of w){const x=t.code,{isTop:k,isRight:S,isLeft:v,isBottom:C,maxScroll:_,minScroll:R}=Tr(m),N=oo(m),D={x:Math.min(x===E.Right?N.right-N.width/2:N.right,Math.max(x===E.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(x===E.Down?N.bottom-N.height/2:N.bottom,Math.max(x===E.Down?N.top:N.top+N.height/2,f.y))},P=x===E.Right&&!S||x===E.Left&&!v,I=x===E.Down&&!C||x===E.Up&&!k;if(P&&D.x!==f.x){const j=m.scrollLeft+p.x,oe=x===E.Right&&j<=_.x||x===E.Left&&j>=R.x;if(oe&&!p.y){m.scrollTo({left:j,behavior:l});return}oe?b.x=m.scrollLeft-j:b.x=x===E.Right?m.scrollLeft-_.x:m.scrollLeft-R.x,b.x&&m.scrollBy({left:-b.x,behavior:l});break}else if(I&&D.y!==f.y){const j=m.scrollTop+p.y,oe=x===E.Down&&j<=_.y||x===E.Up&&j>=R.y;if(oe&&!p.x){m.scrollTo({top:j,behavior:l});return}oe?b.y=m.scrollTop-j:b.y=x===E.Down?m.scrollTop-_.y:m.scrollTop-R.y,b.y&&m.scrollBy({top:-b.y,behavior:l});break}}this.handleMove(t,Ke(tt(f,this.referenceCoordinates),b))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qt.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Or,onActivation:o}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(n.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function sr(e){return!!(e&&"distance"in e)}function ir(e){return!!(e&&"delay"in e)}class Jt{constructor(t,r,n){var o;n===void 0&&(n=co(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=Fe(i),this.documentListeners=new Je(this.document),this.listeners=new Je(n),this.windowListeners=new Je(ne(i)),this.initialCoordinates=(o=Pt(a))!=null?o:me,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ge.Resize,this.handleCancel),this.windowListeners.add(ge.DragStart,ar),this.windowListeners.add(ge.VisibilityChange,this.handleCancel),this.windowListeners.add(ge.ContextMenu,ar),this.documentListeners.add(ge.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ir(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(sr(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(ge.Click,uo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ge.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const d=(r=Pt(t))!=null?r:me,u=tt(o,d);if(!n&&l){if(sr(l)){if(l.tolerance!=null&&At(u,l.tolerance))return this.handleCancel();if(At(u,l.distance))return this.handleStart()}if(ir(l)&&At(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),i(d)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===E.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const go={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Zt extends Jt{constructor(t){const{event:r}=t,n=Fe(r.target);super(t,go,n)}}Zt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const ho={move:{name:"mousemove"},end:{name:"mouseup"}};var Bt;(function(e){e[e.RightClick=2]="RightClick"})(Bt||(Bt={}));class bo extends Jt{constructor(t){super(t,ho,Fe(t.event.target))}}bo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Bt.RightClick?!1:(n?.({event:r}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class po extends Jt{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.move.name,t)};function t(){}}}po.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var Ze;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ze||(Ze={}));var wt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(wt||(wt={}));function mo(e){let{acceleration:t,activator:r=Ze.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:i=5,order:l=wt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=vo({delta:f,disabled:!a}),[w,m]=jn(),x=s.useRef({x:0,y:0}),k=s.useRef({x:0,y:0}),S=s.useMemo(()=>{switch(r){case Ze.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Ze.DraggableRect:return o}},[r,o,d]),v=s.useRef(null),C=s.useCallback(()=>{const R=v.current;if(!R)return;const N=x.current.x*k.current.x,D=x.current.y*k.current.y;R.scrollBy(N,D)},[]),_=s.useMemo(()=>l===wt.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(!a||!u.length||!S){m();return}for(const R of _){if(n?.(R)===!1)continue;const N=u.indexOf(R),D=g[N];if(!D)continue;const{direction:P,speed:I}=no(R,D,S,t,p);for(const j of["x","y"])b[j][P[j]]||(I[j]=0,P[j]=0);if(I.x>0||I.y>0){m(),v.current=R,w(C,i),x.current=I,k.current=P;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,C,n,m,a,i,JSON.stringify(S),JSON.stringify(b),w,u,_,g,JSON.stringify(p)])}const xo={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function vo(e){let{delta:t,disabled:r}=e;const n=Ot(t);return st(o=>{if(r||!n||!o)return xo;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[F.Backward]:o.x[F.Backward]||a.x===-1,[F.Forward]:o.x[F.Forward]||a.x===1},y:{[F.Backward]:o.y[F.Backward]||a.y===-1,[F.Forward]:o.y[F.Forward]||a.y===1}}},[r,t,n])}function yo(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return st(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function wo(e,t){return s.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,n)}));return[...r,...a]},[]),[e,t])}var nt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(nt||(nt={}));var Kt;(function(e){e.Optimized="optimized"})(Kt||(Kt={}));const lr=new Map;function ko(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,i]=s.useState(null),{frequency:l,measure:d,strategy:u}=o,g=s.useRef(e),f=x(),p=et(f),b=s.useCallback(function(k){k===void 0&&(k=[]),!p.current&&i(S=>S===null?k:S.concat(k.filter(v=>!S.includes(v))))},[p]),w=s.useRef(null),m=st(k=>{if(f&&!r)return lr;if(!k||k===lr||g.current!==e||a!=null){const S=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){S.set(v.id,v.rect.current);continue}const C=v.node.current,_=C?new Vt(d(C),C):null;v.rect.current=_,_&&S.set(v.id,_)}return S}return k},[e,a,r,f,d]);return s.useEffect(()=>{g.current=e},[e]),s.useEffect(()=>{f||b()},[r,f]),s.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),s.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{b(),w.current=null},l))},[l,f,b,...n]),{droppableRects:m,measureDroppableContainers:b,measuringScheduled:a!=null};function x(){switch(u){case nt.Always:return!1;case nt.BeforeDragging:return r;default:return!r}}}function Pr(e,t){return st(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function So(e,t){return Pr(e,t)}function No(e){let{callback:t,disabled:r}=e;const n=Wt(t),o=s.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Rt(e){let{callback:t,disabled:r}=e;const n=Wt(t),o=s.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Co(e){return new Vt(Ue(e),e)}function cr(e,t,r){t===void 0&&(t=Co);const[n,o]=s.useState(null);function a(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??r)!=null?u:null}const g=t(e);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const i=No({callback(d){if(e)for(const u of d){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=Rt({callback:a});return we(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),n}function Ro(e){const t=Pr(e);return Er(e,t)}const dr=[];function Do(e){const t=s.useRef(e),r=st(n=>e?n&&n!==dr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ct(e):dr,[e]);return s.useEffect(()=>{t.current=e},[e]),r}function jo(e){const[t,r]=s.useState(null),n=s.useRef(e),o=s.useCallback(a=>{const i=_t(a.target);i&&r(l=>l?(l.set(i,zt(i)),new Map(l)):null)},[]);return s.useEffect(()=>{const a=n.current;if(e!==a){i(a);const l=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,zt(u)]):null}).filter(d=>d!=null);r(l.length?new Map(l):null),n.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Ke(a,i),me):Lr(e):me,[e,t])}function ur(e,t){t===void 0&&(t=[]);const r=s.useRef(null);return s.useEffect(()=>{r.current=null},t),s.useEffect(()=>{const n=e!==me;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?tt(e,r.current):me}function Eo(e){s.useEffect(()=>{if(!Nt)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Mo(e,t){return s.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=i=>{a(i,t)},r},{}),[e,t])}function zr(e){return s.useMemo(()=>e?Qn(e):null,[e])}const fr=[];function _o(e,t){t===void 0&&(t=Ue);const[r]=e,n=zr(r?ne(r):null),[o,a]=s.useState(fr);function i(){a(()=>e.length?e.map(d=>Ir(d)?n:new Vt(t(d),d)):fr)}const l=Rt({callback:i});return we(()=>{l?.disconnect(),i(),e.forEach(d=>l?.observe(d))},[e]),o}function Ao(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return at(t)?t:e}function Io(e){let{measure:t}=e;const[r,n]=s.useState(null),o=s.useCallback(u=>{for(const{target:g}of u)if(at(g)){n(f=>{const p=t(g);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Rt({callback:o}),i=s.useCallback(u=>{const g=Ao(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[l,d]=vt(i);return s.useMemo(()=>({nodeRef:l,rect:r,setRef:d}),[r,l,d])}const To=[{sensor:Zt,options:{}},{sensor:qt,options:{}}],Lo={current:{}},xt={draggable:{measure:or},droppable:{measure:or,strategy:nt.WhileDragging,frequency:Kt.Optimized},dragOverlay:{measure:Ue}};class Qe extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Oo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xt,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},Po={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Dt=s.createContext(Po),Br=s.createContext(Oo);function zo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qe}}}function Bo(e,t){switch(t.type){case $.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $.DragEnd:case $.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new Qe(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case $.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new Qe(e.droppable.containers);return i.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case $.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new Qe(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ko(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=s.useContext(Dt),a=Ot(n),i=Ot(r?.id);return s.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!Gt(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:d,node:u}=l;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=_n(g);if(f){f.focus();break}}})}},[n,t,o,i,a]),null}function $o(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function Fo(e){return s.useMemo(()=>({draggable:{...xt.draggable,...e?.draggable},droppable:{...xt.droppable,...e?.droppable},dragOverlay:{...xt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Uo(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=s.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;we(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=r(u),f=Er(g,n);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Mr(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,n,r])}const Kr=s.createContext({...me,scaleX:1,scaleY:1});var Te;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Te||(Te={}));const Yo=s.memo(function(t){var r,n,o,a;let{id:i,accessibility:l,autoScroll:d=!0,children:u,sensors:g=To,collisionDetection:f=Hn,measuring:p,modifiers:b,...w}=t;const m=s.useReducer(Bo,void 0,zo),[x,k]=m,[S,v]=Pn(),[C,_]=s.useState(Te.Uninitialized),R=C===Te.Initialized,{draggable:{active:N,nodes:D,translate:P},droppable:{containers:I}}=x,j=N!=null?D.get(N):null,oe=s.useRef({initial:null,translated:null}),Z=s.useMemo(()=>{var B;return N!=null?{id:N,data:(B=j?.data)!=null?B:Lo,rect:oe}:null},[N,j]),ae=s.useRef(null),[ke,Pe]=s.useState(null),[V,Le]=s.useState(null),he=et(w,Object.values(w)),Se=it("DndDescribedBy",i),ze=s.useMemo(()=>I.getEnabled(),[I]),U=Fo(p),{droppableRects:de,measureDroppableContainers:K,measuringScheduled:Oe}=ko(ze,{dragging:R,dependencies:[P.x,P.y],config:U.droppable}),Y=yo(D,N),se=s.useMemo(()=>V?Pt(V):null,[V]),T=_e(),q=So(Y,U.draggable.measure);Uo({activeNode:N!=null?D.get(N):null,config:T.layoutShiftCompensation,initialRect:q,measure:U.draggable.measure});const M=cr(Y,U.draggable.measure,q),Ne=cr(Y?Y.parentElement:null),O=s.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:de,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X=I.getNodeFor((r=O.current.over)==null?void 0:r.id),Q=Io({measure:U.dragOverlay.measure}),je=(n=Q.nodeRef.current)!=null?n:Y,ie=R?(o=Q.rect)!=null?o:M:null,lt=!!(Q.nodeRef.current&&Q.rect),Ye=Ro(lt?null:M),Be=zr(je?ne(je):null),be=Do(R?X??Y:null),ue=_o(be),Ce=$o(b,{transform:{x:P.x-Ye.x,y:P.y-Ye.y,scaleX:1,scaleY:1},activatorEvent:V,active:Z,activeNodeRect:M,containerNodeRect:Ne,draggingNodeRect:ie,over:O.current.over,overlayNodeRect:Q.rect,scrollableAncestors:be,scrollableAncestorRects:ue,windowRect:Be}),ct=se?Ke(se,P):null,Xe=jo(be),dt=ur(Xe),ut=ur(Xe,[M]),Re=Ke(Ce,dt),xe=ie?Vn(ie,Ce):null,fe=Z&&xe?f({active:Z,collisionRect:xe,droppableRects:de,droppableContainers:ze,pointerCoordinates:ct}):null,ft=jr(fe,"id"),[ve,gt]=s.useState(null),ht=lt?Ce:Ke(Ce,ut),bt=Wn(ht,(a=ve?.rect)!=null?a:null,M),Ee=s.useRef(null),Me=s.useCallback((B,J)=>{let{sensor:z,options:ee}=J;if(ae.current==null)return;const le=D.get(ae.current);if(!le)return;const te=B.nativeEvent,ce=new z({active:ae.current,activeNode:le,event:te,options:ee,context:O,onAbort(H){if(!D.get(H))return;const{onDragAbort:ye}=he.current,De={id:H};ye?.(De),S({type:"onDragAbort",event:De})},onPending(H,Ae,ye,De){if(!D.get(H))return;const{onDragPending:Ge}=he.current,Ie={id:H,constraint:Ae,initialCoordinates:ye,offset:De};Ge?.(Ie),S({type:"onDragPending",event:Ie})},onStart(H){const Ae=ae.current;if(Ae==null)return;const ye=D.get(Ae);if(!ye)return;const{onDragStart:De}=he.current,We={activatorEvent:te,active:{id:Ae,data:ye.data,rect:oe}};qe.unstable_batchedUpdates(()=>{De?.(We),_(Te.Initializing),k({type:$.DragStart,initialCoordinates:H,active:Ae}),S({type:"onDragStart",event:We}),Pe(Ee.current),Le(te)})},onMove(H){k({type:$.DragMove,coordinates:H})},onEnd:G($.DragEnd),onCancel:G($.DragCancel)});Ee.current=ce;function G(H){return async function(){const{active:ye,collisions:De,over:We,scrollAdjustedTranslate:Ge}=O.current;let Ie=null;if(ye&&Ge){const{cancelDrop:Ve}=he.current;Ie={activatorEvent:te,active:ye,collisions:De,delta:Ge,over:We},H===$.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Ie))&&(H=$.DragCancel)}ae.current=null,qe.unstable_batchedUpdates(()=>{k({type:H}),_(Te.Uninitialized),gt(null),Pe(null),Le(null),Ee.current=null;const Ve=H===$.DragEnd?"onDragEnd":"onDragCancel";if(Ie){const jt=he.current[Ve];jt?.(Ie),S({type:Ve,event:Ie})}})}}},[D]),He=s.useCallback((B,J)=>(z,ee)=>{const le=z.nativeEvent,te=D.get(ee);if(ae.current!==null||!te||le.dndKit||le.defaultPrevented)return;const ce={active:te};B(z,J.options,ce)===!0&&(le.dndKit={capturedBy:J.sensor},ae.current=ee,Me(z,J))},[D,Me]),h=wo(g,He);Eo(g),we(()=>{M&&C===Te.Initializing&&_(Te.Initialized)},[M,C]),s.useEffect(()=>{const{onDragMove:B}=he.current,{active:J,activatorEvent:z,collisions:ee,over:le}=O.current;if(!J||!z)return;const te={active:J,activatorEvent:z,collisions:ee,delta:{x:Re.x,y:Re.y},over:le};qe.unstable_batchedUpdates(()=>{B?.(te),S({type:"onDragMove",event:te})})},[Re.x,Re.y]),s.useEffect(()=>{const{active:B,activatorEvent:J,collisions:z,droppableContainers:ee,scrollAdjustedTranslate:le}=O.current;if(!B||ae.current==null||!J||!le)return;const{onDragOver:te}=he.current,ce=ee.get(ft),G=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,H={active:B,activatorEvent:J,collisions:z,delta:{x:le.x,y:le.y},over:G};qe.unstable_batchedUpdates(()=>{gt(G),te?.(H),S({type:"onDragOver",event:H})})},[ft]),we(()=>{O.current={activatorEvent:V,active:Z,activeNode:Y,collisionRect:xe,collisions:fe,droppableRects:de,draggableNodes:D,draggingNode:je,draggingNodeRect:ie,droppableContainers:I,over:ve,scrollableAncestors:be,scrollAdjustedTranslate:Re},oe.current={initial:ie,translated:xe}},[Z,Y,fe,xe,D,je,ie,de,I,ve,be,Re]),mo({...T,delta:P,draggingRect:xe,pointerCoordinates:ct,scrollableAncestors:be,scrollableAncestorRects:ue});const A=s.useMemo(()=>({active:Z,activeNode:Y,activeNodeRect:M,activatorEvent:V,collisions:fe,containerNodeRect:Ne,dragOverlay:Q,draggableNodes:D,droppableContainers:I,droppableRects:de,over:ve,measureDroppableContainers:K,scrollableAncestors:be,scrollableAncestorRects:ue,measuringConfiguration:U,measuringScheduled:Oe,windowRect:Be}),[Z,Y,M,V,fe,Ne,Q,D,I,de,ve,K,be,ue,U,Oe,Be]),W=s.useMemo(()=>({activatorEvent:V,activators:h,active:Z,activeNodeRect:M,ariaDescribedById:{draggable:Se},dispatch:k,draggableNodes:D,over:ve,measureDroppableContainers:K}),[V,h,Z,M,k,Se,D,ve,K]);return re.createElement(Cr.Provider,{value:v},re.createElement(Dt.Provider,{value:W},re.createElement(Br.Provider,{value:A},re.createElement(Kr.Provider,{value:bt},u)),re.createElement(Ko,{disabled:l?.restoreFocus===!1})),re.createElement(Kn,{...l,hiddenTextDescribedById:Se}));function _e(){const B=ke?.autoScrollEnabled===!1,J=typeof d=="object"?d.enabled===!1:d===!1,z=R&&!B&&!J;return typeof d=="object"?{...d,enabled:z}:{enabled:z}}}),Xo=s.createContext(null),gr="button",Ho="Draggable";function Wo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=it(Ho),{activators:i,activatorEvent:l,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=s.useContext(Dt),{role:b=gr,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=d?.id===t,k=s.useContext(x?Kr:Xo),[S,v]=vt(),[C,_]=vt(),R=Mo(i,t),N=et(r);we(()=>(f.set(t,{id:t,key:a,node:S,activatorNode:C,data:N}),()=>{const P=f.get(t);P&&P.key===a&&f.delete(t)}),[f,t]);const D=s.useMemo(()=>({role:b,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&b===gr?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[n,b,m,x,w,g.draggable]);return{active:d,activatorEvent:l,activeNodeRect:u,attributes:D,isDragging:x,listeners:n?void 0:R,node:S,over:p,setNodeRef:v,setActivatorNodeRef:_,transform:k}}function Go(){return s.useContext(Br)}const Vo="Droppable",qo={timeout:25};function Jo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=it(Vo),{active:i,dispatch:l,over:d,measureDroppableContainers:u}=s.useContext(Dt),g=s.useRef({disabled:r}),f=s.useRef(!1),p=s.useRef(null),b=s.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={...qo,...o},k=et(m??n),S=s.useCallback(()=>{if(!f.current){f.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{u(Array.isArray(k.current)?k.current:[k.current]),b.current=null},x)},[x]),v=Rt({callback:S,disabled:w||!i}),C=s.useCallback((D,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),D&&v.observe(D))},[v]),[_,R]=vt(C),N=et(t);return s.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),s.useEffect(()=>(l({type:$.RegisterDroppable,element:{id:n,key:a,disabled:r,node:_,rect:p,data:N}}),()=>l({type:$.UnregisterDroppable,key:a,id:n})),[n]),s.useEffect(()=>{r!==g.current.disabled&&(l({type:$.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,l]),{active:i,rect:p,isOver:d?.id===n,node:_,over:d,setNodeRef:R}}const Zo=e=>{let{transform:t}=e;return{...t,y:0}};function $r(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Qo(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function pt(e){return e!==null&&e>=0}function ea(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function ta(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const mt={scaleX:1,scaleY:1},ra=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:i}=e;const l=(t=r[o])!=null?t:n;if(!l)return null;const d=na(r,i,o);if(i===o){const u=r[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...mt}:null}return i>o&&i<=a?{x:-l.width-d,y:0,...mt}:i<o&&i>=a?{x:l.width+d,y:0,...mt}:{x:0,y:0,...mt}};function na(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return!n||!o&&!a?0:r<t?o?n.left-(o.left+o.width):a.left-(n.left+n.width):a?a.left-(n.left+n.width):n.left-(o.left+o.width)}const Fr=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=$r(t,n,r),i=t[o],l=a[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},Ur="Sortable",Yr=re.createContext({activeIndex:-1,containerId:Ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fr,disabled:{draggable:!1,droppable:!1}});function oa(e){let{children:t,id:r,items:n,strategy:o=Fr,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:d,over:u,measureDroppableContainers:g}=Go(),f=it(Ur,r),p=l.rect!==null,b=s.useMemo(()=>n.map(R=>typeof R=="object"&&"id"in R?R.id:R),[n]),w=i!=null,m=i?b.indexOf(i.id):-1,x=u?b.indexOf(u.id):-1,k=s.useRef(b),S=!ea(b,k.current),v=x!==-1&&m===-1||S,C=ta(a);we(()=>{S&&w&&g(b)},[S,b,w,g]),s.useEffect(()=>{k.current=b},[b]);const _=s.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Qo(b,d),strategy:o}),[m,f,C.draggable,C.droppable,v,b,x,d,p,o]);return re.createElement(Yr.Provider,{value:_},t)}const aa=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return $r(r,n,o).indexOf(t)},sa=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:d,transition:u}=e;return!u||!n||l!==a&&o===i?!1:r?!0:i!==o&&t===d},ia={duration:200,easing:"ease"},Xr="transform",la=rt.Transition.toString({property:Xr,duration:0,easing:"linear"}),ca={roleDescription:"sortable"};function da(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,i]=s.useState(null),l=s.useRef(r);return we(()=>{if(!t&&r!==l.current&&n.current){const d=o.current;if(d){const u=Ue(n.current,{ignoreTransform:!0}),g={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(g.x||g.y)&&i(g)}}r!==l.current&&(l.current=r)},[t,r,n,o]),s.useEffect(()=>{a&&i(null)},[a]),a}function ua(e){let{animateLayoutChanges:t=sa,attributes:r,disabled:n,data:o,getNewIndex:a=aa,id:i,strategy:l,resizeObserverConfig:d,transition:u=ia}=e;const{items:g,containerId:f,activeIndex:p,disabled:b,disableTransforms:w,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:S}=s.useContext(Yr),v=fa(n,b),C=g.indexOf(i),_=s.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),R=s.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:N,node:D,isOver:P,setNodeRef:I}=Jo({id:i,data:_,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:j,activatorEvent:oe,activeNodeRect:Z,attributes:ae,setNodeRef:ke,listeners:Pe,isDragging:V,over:Le,setActivatorNodeRef:he,transform:Se}=Wo({id:i,data:_,attributes:{...ca,...r},disabled:v.draggable}),ze=Dn(I,ke),U=!!j,de=U&&!w&&pt(p)&&pt(x),K=!k&&V,Oe=K&&de?Se:null,se=de?Oe??(l??S)({rects:m,activeNodeRect:Z,activeIndex:p,overIndex:x,index:C}):null,T=pt(p)&&pt(x)?a({id:i,items:g,activeIndex:p,overIndex:x}):C,q=j?.id,M=s.useRef({activeId:q,items:g,newIndex:T,containerId:f}),Ne=g!==M.current.items,O=t({active:j,containerId:f,isDragging:V,isSorting:U,id:i,index:C,items:g,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),X=da({disabled:!O,index:C,node:D,rect:N});return s.useEffect(()=>{U&&M.current.newIndex!==T&&(M.current.newIndex=T),f!==M.current.containerId&&(M.current.containerId=f),g!==M.current.items&&(M.current.items=g)},[U,T,f,g]),s.useEffect(()=>{if(q===M.current.activeId)return;if(q&&!M.current.activeId){M.current.activeId=q;return}const je=setTimeout(()=>{M.current.activeId=q},50);return()=>clearTimeout(je)},[q]),{active:j,activeIndex:p,attributes:ae,data:_,rect:N,index:C,newIndex:T,items:g,isOver:P,isSorting:U,isDragging:V,listeners:Pe,node:D,overIndex:x,over:Le,setNodeRef:ze,setActivatorNodeRef:he,setDroppableNodeRef:I,setDraggableNodeRef:ke,transform:X??se,transition:Q()};function Q(){if(X||Ne&&M.current.newIndex===C)return la;if(!(K&&!Gt(oe)||!u)&&(U||O))return rt.Transition.toString({...u,property:Xr})}}function fa(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function kt(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ga=[E.Down,E.Right,E.Up,E.Left],ha=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(ga.includes(e.code)){if(e.preventDefault(),!r||!n)return;const d=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=o.get(f.id);if(p)switch(e.code){case E.Down:n.top<p.top&&d.push(f);break;case E.Up:n.top>p.top&&d.push(f);break;case E.Left:n.left>p.left&&d.push(f);break;case E.Right:n.left<p.left&&d.push(f);break}});const u=Yn({collisionRect:n,droppableRects:o,droppableContainers:d});let g=jr(u,"id");if(g===i?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(r.id),p=a.get(g),b=p?o.get(p.id):null,w=p?.node.current;if(w&&b&&f&&p){const x=Ct(w).some((R,N)=>l[N]!==R),k=Hr(f,p),S=ba(f,p),v=x||!k?{x:0,y:0}:{x:S?n.width-b.width:0,y:S?n.height-b.height:0},C={x:b.left,y:b.top};return v.x&&v.y?C:tt(C,v)}}}};function Hr(e,t){return!kt(e)||!kt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ba(e,t){return!kt(e)||!kt(t)||!Hr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function ot(e,{min:t,max:r,fallback:n}){const o=Number(e);if(!Number.isFinite(o))return n;const a=Math.floor(o);return a<t?t:a>r?r:a}function pa(e,t){const r=ot(t,{min:0,max:1e6,fallback:0}),n=ot(e,{min:1,max:Math.max(1,r||1),fallback:1});if(r<=1)return[1];const o=new Set([1,r,n-2,n-1,n,n+1,n+2]),a=Array.from(o).filter(d=>Number.isInteger(d)&&d>=1&&d<=r).sort((d,u)=>d-u),i=[];let l=null;for(const d of a)l!=null&&d-l>1&&i.push(null),i.push(d),l=d;return i}function ma({page:e,totalPages:t}){const r=typeof t=="number"&&Number.isFinite(t)&&t>=0,n=r?ot(t,{min:0,max:1e6,fallback:0}):null,o=ot(e,{min:1,max:r?Math.max(1,n||1):1e6,fallback:1}),a=o>1,i=r?o<n:!0;return{canPrev:a,canNext:i,safePage:o,safeTotal:n}}function xa({entries:e,me:t,meLabel:r}){const n=Array.isArray(e)?e:[],o=t&&typeof t.rank=="number"?t.rank:null;return!o||n.some(i=>!!i?.is_me)?n:[{rank:o,is_me:!0,is_pinned:!0,user_id:t?.user_id??null,display_name:r,avatar_url:t?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:t?.gpt_tokens??"0",claude_tokens:t?.claude_tokens??"0",gemini_tokens:t?.gemini_tokens??"0",cursor_tokens:t?.cursor_tokens??"0",opencode_tokens:t?.opencode_tokens??"0",openclaw_tokens:t?.openclaw_tokens??"0",hermes_tokens:t?.hermes_tokens??"0",kiro_tokens:t?.kiro_tokens??"0",copilot_tokens:t?.copilot_tokens??"0",kimi_tokens:t?.kimi_tokens??"0",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0",estimated_cost_usd:t?.estimated_cost_usd??null},...n]}function va(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.ceil(r/n)}const ya=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function wa({iconSrc:e,label:t}){return c.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?c.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${ya.has(e)?"dark:invert":""}`}):null,c.jsx("span",{className:"whitespace-nowrap",children:t})]})}const St=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Wr="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Gr="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function $t(e){return L("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function Ft(e){return L("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function pe({className:e}){return c.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ka({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",r=e<3?"w-16":"w-12",n=e<5?"w-14":"w-10";return c.jsxs("tr",{className:"group",children:[c.jsx("td",{className:L($t(!1),"!group-hover:bg-transparent"),children:c.jsx(pe,{className:"h-4 w-6"})}),c.jsx("td",{className:L(Ft(!1),"!group-hover:bg-transparent"),children:c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(pe,{className:"h-8 w-8 min-w-8 rounded-full"}),c.jsx(pe,{className:L("h-4",t)})]})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(pe,{className:L("h-4",r)})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(pe,{className:"h-4 w-12"})}),St.map(o=>c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(pe,{className:L("h-4",n)})},o.key))]})}function Sa({rows:e=10}){return c.jsx("div",{className:"w-full overflow-x-auto",children:c.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[c.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:c.jsxs("tr",{children:[c.jsx("th",{className:L(Wr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(pe,{className:"h-3.5 w-6"})}),c.jsx("th",{className:L(Gr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(pe,{className:"h-3.5 w-12"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(pe,{className:"h-3.5 w-10"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(pe,{className:"h-3.5 w-14"})}),St.map(t=>c.jsx("th",{className:"px-4 py-4",children:c.jsx(pe,{className:"h-3.5 w-12"})},t.key))]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,r)=>c.jsx(ka,{index:r},r))})]})})}function Na({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:i,transition:l,isDragging:d}=ua({id:e}),u=rt.Transform.toString(i)||"";s.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),p="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(b=>{b.style.transform=u,b.style.transition=l||"",b.style.zIndex=d?"20":"",b.style.position=u?"relative":"",b.style.boxShadow=d?p:""}),()=>{f.forEach(b=>{b.style.transform="",b.style.transition="",b.style.zIndex="",b.style.position="",b.style.boxShadow=""})}},[e,u,l,d]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:d?20:void 0,boxShadow:d?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return c.jsx("th",{ref:a,style:g,className:L(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...o,children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("span",{"aria-hidden":"true",className:L("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",d&&"opacity-100"),children:c.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[c.jsx("circle",{cx:"2",cy:"2",r:"1"}),c.jsx("circle",{cx:"6",cy:"2",r:"1"}),c.jsx("circle",{cx:"2",cy:"7",r:"1"}),c.jsx("circle",{cx:"6",cy:"7",r:"1"}),c.jsx("circle",{cx:"2",cy:"12",r:"1"}),c.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),r]})})}const Vr="tokentracker.leaderboard.columnOrder.v1";function Ca(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Vr);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="string"):null}catch{return null}}function Tt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Vr,JSON.stringify(e))}catch{}}function hr(e,t){if(!e)return t;const r=new Set(t),n=e.filter(a=>r.has(a)),o=t.filter(a=>!n.includes(a));return[...n,...o]}function Ra(e){const t=s.useMemo(()=>e.join("|"),[e]),[r,n]=s.useState(()=>hr(Ca(),e));s.useEffect(()=>{n(i=>{const l=hr(i,e);return l.length===i.length&&l.every((u,g)=>u===i[g])?i:(Tt(l),l)})},[t,e]);const o=s.useCallback((i,l)=>{!i||!l||i===l||n(d=>{const u=d.indexOf(i),g=d.indexOf(l);if(u===-1||g===-1)return d;const f=d.slice(),[p]=f.splice(u,1);return f.splice(g,0,p),Tt(f),f})},[]),a=s.useCallback(()=>{Tt(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function Da(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(r/n*100)))}function qr(e){return typeof e=="string"?e.trim():""}function ja(e){const t=qr(e);return t?t.toLowerCase()==="anonymous":!0}function Ea({me:e,totalEntries:t,meLabel:r,onOpenProfile:n,onJumpToMe:o,canJump:a,className:i}){const l=e&&typeof e.rank=="number"?e.rank:null;if(!l)return null;const d=Number(t)||0,u=Da(l,d),g=qr(e?.display_name),f=!g||ja(g)?r||"You":g,p=e?.user_id||f,b=n||(a?o:null),w=typeof b=="function",m=w?"button":"div",x=w?{type:"button",onClick:b,"aria-label":y(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return c.jsxs(m,{...x,className:L("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none shadow-[0_1px_2px_rgba(0,0,0,0.03)]",w?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] hover:shadow-[0_4px_12px_rgba(0,0,0,0.05)] dark:hover:shadow-[0_4px_20px_rgba(0,0,0,0.25)] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",i),children:[c.jsx(Lt,{size:"sm",avatarUrl:e?.avatar_url,displayName:f,seed:p}),c.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),c.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",l.toLocaleString()]}),u!=null&&c.jsx("span",{className:L("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",u<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:y("leaderboard.summary.percentile",{p:String(u)})}),w?c.jsx(Rn,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):c.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[c.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),c.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const Ma=s.lazy(()=>wn(()=>import("./LeaderboardProfileModal-C49_3Xm9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.LeaderboardProfileModal}))),Ut=[10,20,50,100],Yt=20,Jr="tokentracker:leaderboard:pageSize";function _a(){if(typeof window>"u")return Yt;try{const e=window.localStorage.getItem(Jr),t=Number(e);if(Ut.includes(t))return t}catch{}return Yt}function br(e,t,r){const n=Number(e);if(!Number.isFinite(n)||n<=0)return"-";const o=mn(t),a=t===kn?n:n*r;return a>=1e3?`${o}${Math.round(a).toLocaleString()}`:a>=10?`${o}${Math.round(a)}`:`${o}${a.toFixed(2)}`}function pr({value:e}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"sm:hidden",children:pn(e)}),c.jsx("span",{className:"hidden sm:inline",children:kr(e)})]})}function mr(e,t,r){const n=t?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",o=t?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return r.map(a=>c.jsx("td",{"data-column-key":a.key,className:L("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,o),children:kr(e?.[a.key])},a.key))}const Aa={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function xr({rank:e,placeholder:t}){const r=Aa[e];return r?c.jsx("span",{className:L("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",r.text,r.badge),children:e}):c.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function vr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function Ia(e){if(!e)return y("shared.error.prefix",{error:y("leaderboard.error.unknown")});const t=e?.message||String(e),r=String(t||"").trim()||y("leaderboard.error.unknown");return y("shared.error.prefix",{error:r})}function Zr(e){return typeof e!="string"?"":e.trim()}function Ta(e){const t=Zr(e);return t?t.toLowerCase()==="anonymous":!0}function yr(e,t){const r=typeof e?.user_id=="string"?e.user_id.trim():"";return r||`${e?.rank??""}:${t}`}function wr({githubUrl:e}){return c.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":y("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:c.jsx(hn,{provider:"GITHUB",size:16})}),c.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[c.jsx("span",{className:"block",children:y("leaderboard.github.tooltipAction")}),c.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[y("leaderboard.github.tooltipPrefix")," ",c.jsx(bn,{to:"/settings",onClick:t=>t.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:y("leaderboard.github.tooltipSettingsLink")}),y("leaderboard.github.tooltipSuffix")]})]})]})}function $a({auth:e,signedIn:t,sessionSoftExpired:r}){const n=en(),o=tn(),{openLoginModal:a}=rn(),{signedIn:i,loading:l,user:d}=nn(),{currency:u,rate:g}=Nn(),f=s.useMemo(()=>on(),[]),p=an(),b=t&&!r,w=s.useMemo(()=>b&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,b]),m=b?w:null,x=b&&sn(m),k=y("shared.placeholder.short"),S=s.useMemo(()=>St.map(h=>h.key),[]),{order:v,reorder:C}=Ra(S),_=s.useMemo(()=>{const h=new Map;for(const A of St)h.set(A.key,A);return h},[]),R=s.useMemo(()=>v.map(h=>_.get(h)).filter(Boolean),[v,_]),N=$n(tr(Zt,{activationConstraint:{distance:6}}),tr(qt,{coordinateGetter:ha})),D=s.useCallback(h=>{const{active:A,over:W}=h;!W||A.id===W.id||C(String(A.id),String(W.id))},[C]),[P,I]=s.useState(1),[j,oe]=s.useState(_a),[Z,ae]=s.useState(null),ke=s.useCallback(h=>{typeof h=="string"&&h.trim()&&ae(h.trim())},[]),Pe=s.useCallback(()=>ae(null),[]),V=s.useCallback(h=>{const A=Ut.includes(h)?h:Yt;oe(A),I(1);try{window.localStorage.setItem(Jr,String(A))}catch{}},[]),[Le,he]=s.useState(0),[Se,ze]=s.useState(()=>ln()),[U,de]=s.useState(!1),K=s.useMemo(()=>{const h=new URLSearchParams(n?.search||"");return vr(h.get("period"))||"total"},[n?.search]),Oe=h=>{const A=vr(h);if(!A||A===K)return;const W=new URLSearchParams(n?.search||"");W.set("period",A),I(1),o(`${n?.pathname||"/leaderboard"}?${W.toString()}`,{replace:!0})};s.useEffect(()=>{I(1)},[K]);const Y=s.useMemo(()=>(ot(P,{min:1,max:1e6,fallback:1})-1)*j,[P,j]),se=s.useMemo(()=>{if(p)return"mock";if(l)return"unavailable";const h=gn();return i&&(!h||Se)?"cloud":h?"local":i?"cloud":t?"local":f?"public":"unavailable"},[l,i,Se,f,p,t]),T=s.useMemo(()=>cn({accessMode:se,baseUrl:f,mockEnabled:p,userId:d?.id||null,period:K,pageSize:j,offset:Y}),[d?.id,se,f,Y,p,j,K]),[q,M]=s.useState(()=>{const h=Et(T);return h?{loading:!1,error:null,data:h.data,contextKey:T}:{loading:!1,error:null,data:null,contextKey:null}});s.useEffect(()=>{if(!f&&!p||!p&&(se==="unavailable"||se==="local")){M({loading:!1,error:null,data:null,contextKey:null});return}const h=Et(T);let A=!0;return M(h?{loading:!1,error:null,data:h.data,contextKey:T}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const W=await dn({userId:d?.id||null,period:K,limit:j,offset:Y});A&&(un(W,{activeContextKey:T,contextKey:T,source:Le>0?"manual-refresh":"page-load"}),M({loading:!1,error:null,data:W,contextKey:T}))})().catch(W=>{if(!A)return;const _e=Ia(W);M(B=>B.contextKey===T?{...B,loading:!1,error:_e}:{loading:!1,error:_e,data:null,contextKey:T})}),()=>{A=!1}},[f,se,d?.id,T,Y,Le,p,K,j]);const Ne=s.useMemo(()=>q.contextKey===T?null:Et(T),[T,q.contextKey]),O=s.useMemo(()=>q.contextKey===T?q:Ne?{loading:!1,error:null,data:Ne.data,contextKey:T}:{loading:!!(f||p)&&se!=="unavailable"&&se!=="local",error:null,data:null,contextKey:T},[se,f,T,q,p,Ne]),X=O.data,Q=X?.total_pages??null,je=X?.total_entries??0,ie=X?.page??P,lt=s.useMemo(()=>pa(ie,Q),[ie,Q]),Ye=X?.from||null,Be=X?.to||null,be=X?.generated_at||null,ue=X?.me||null,Ce=y("leaderboard.me_label"),ct=y("leaderboard.anon_label"),Xe=y("leaderboard.period.week"),dt=y("leaderboard.period.month"),ut=y("leaderboard.period.total"),Re=K==="month"?dt:K==="total"?ut:Xe,xe=s.useMemo(()=>{const h=Array.isArray(X?.entries)?X.entries:[];return xa({entries:h,me:ue,meLabel:Ce})},[X?.entries,ue,Ce]),fe=s.useMemo(()=>va(ue?.rank,j),[ue?.rank,j]),ft=fe!=null&&fe===ie,ve=s.useCallback(()=>{fe!=null&&I(fe)},[fe]),gt=async()=>{de(!0);try{xn(!0),ze(!0),await vn(()=>Qt(m));const h=await Qt(m);h&&await yn({accessToken:h,period:K,source:"leaderboard-enable-sync"}),he(A=>A+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{de(!1)}},{canPrev:ht,canNext:bt}=ma({page:ie,totalPages:Q}),Ee=Array.isArray(xe)&&xe.length!==0;let Me=null;O.loading&&!Ee?Me=c.jsx(Sa,{rows:j}):O.error&&!Ee?Me=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):Ee?Me=c.jsx(Yo,{sensors:N,collisionDetection:Un,modifiers:[Zo],onDragEnd:D,children:c.jsx("div",{className:"w-full overflow-x-auto",children:c.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[c.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:c.jsxs("tr",{children:[c.jsx("th",{className:L(Wr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.rank")}),c.jsx("th",{className:L(Gr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.user")}),c.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:y("leaderboard.column.total")}),c.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:y("leaderboard.column.est_cost")}),c.jsx(oa,{items:v,strategy:ra,children:R.map(h=>c.jsx(Na,{id:h.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:c.jsx(wa,{iconSrc:h.icon,label:y(h.copyKey)})},h.key))})]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:xe.map((h,A)=>{if(h?.is_ellipsis){const G=4+R.length;return c.jsx("tr",{"aria-hidden":"true",children:c.jsx("td",{colSpan:G,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${A}`)}const W=!!h?.is_me,_e=typeof h?.user_id=="string"?h.user_id:null,B=Zr(h?.display_name),J=Ta(B)?ct:B,z=W?Ce:J,ee=!!_e,ce=ee?{role:"button",tabIndex:0,onClick:ee?()=>ke(_e):void 0,onKeyDown:ee?G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),ke(_e))}:void 0,"aria-label":y("leaderboard.profile_modal.row_aria",{name:z})}:{};if(W){const G=!!h?.is_pinned;return c.jsxs("tr",{...ce,className:L("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",G?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",ee&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[c.jsx("td",{className:L($t(!0),"relative font-semibold text-oai-brand-600 dark:text-oai-brand-400",G&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:c.jsx(xr,{rank:h?.rank,placeholder:k})}),c.jsx("td",{className:Ft(!0),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),c.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:z}),h?.github_url&&c.jsx(wr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:c.jsx(pr,{value:h?.total_tokens})}),c.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:br(h?.estimated_cost_usd,u,g)}),mr(h,!0,R)]},`row-${h?.rank}-${z}${G?"-pin":""}`)}return c.jsxs("tr",{...ce,className:L("group transition-colors",ee&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[c.jsx("td",{className:L($t(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(xr,{rank:h?.rank,placeholder:k})}),c.jsx("td",{className:Ft(!1),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),c.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:z}),h?.github_url&&c.jsx(wr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:c.jsx(pr,{value:h?.total_tokens})}),c.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:br(h?.estimated_cost_usd,u,g)}),mr(h,!1,R)]},`row-${h?.rank}-${z}`)})})]})})}):Me=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let He=null;return typeof Q=="number"?He=lt.map((h,A)=>h==null?c.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:y("leaderboard.pagination.ellipsis")},`ellipsis-${A}`):c.jsx("button",{className:L("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",h===ie?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>I(h),disabled:O.loading,children:String(h)},`page-${h}`)):He=c.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.pagination.page_unknown",{page:String(ie)})}),c.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[c.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsxs("div",{className:"mb-5 sm:mb-6",children:[c.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:y("leaderboard.title")}),c.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[K==="total"?y("leaderboard.range.total"):Ye&&Be?y("leaderboard.range",{period:Re,from:Ye,to:Be}):y("leaderboard.range_loading",{period:Re}),be&&c.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:y("leaderboard.generated_at",{ts:be})})]})]}),c.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-row items-center justify-between gap-3",children:[c.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative",children:["week","month","total"].map(h=>{const A=K===h;return c.jsxs("button",{onClick:()=>Oe(h),disabled:O.loading,className:L("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",A?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[c.jsx("span",{className:"relative z-10",children:h==="week"?Xe:h==="month"?dt:ut}),A&&c.jsx(fn.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},h)})}),c.jsx(Ea,{me:ue,totalEntries:je,meLabel:Ce,onOpenProfile:ue?.user_id?()=>ke(ue.user_id):void 0,onJumpToMe:ve,canJump:fe!=null&&!ft&&!O.loading,className:"shrink-0"})]}),!t&&c.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.signin_prompt")}),c.jsx("button",{onClick:a,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:y("leaderboard.signin_button")})]}),b&&x&&!Se&&c.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.sync_prompt")}),c.jsx("button",{onClick:gt,disabled:U,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:U?y("leaderboard.sync_button.busy"):y("leaderboard.sync_button.idle")})]}),c.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[O.error&&Ee?c.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:c.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):null,Me,c.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[c.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),c.jsx(Sn,{id:"leaderboard-page-size",value:j,onValueChange:h=>V(Number(h)),disabled:O.loading,ariaLabel:y("leaderboard.pagination.page_size_label"),options:Ut.map(h=>({value:h,label:String(h)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),c.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),c.jsx("button",{className:L("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",ht&&!O.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>I(h=>Math.max(1,h-1)),disabled:!ht||O.loading,children:y("leaderboard.pagination.prev")}),c.jsx("div",{className:"flex flex-wrap items-center gap-1",children:He}),c.jsx("button",{className:L("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",bt&&!O.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>I(h=>h+1),disabled:!bt||O.loading,children:y("leaderboard.pagination.next")})]})]})]})}),c.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[c.jsx("p",{children:y("landing.v2.footer.line")}),c.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:y("landing.v2.nav.github")})]})}),c.jsx(s.Suspense,{fallback:null,children:c.jsx(Ma,{isOpen:!!Z,userId:Z,period:K,accessToken:m,onClose:Pe})})]})}export{$a as LeaderboardPage};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import{c as D,r as g,cJ as Q,j as e,A as n,cK as V,av as ee,cL as ae,N as c,Q as re,cM as te,bR as se,L as ie,l as oe,P as R,X as ne,D as I,C as le,a7 as de}from"./main-BIY3Nj6I.js";import{u as ce}from"./useCurrency-BsSZiZMP.js";import{L as W}from"./LeaderboardAvatar-CiIpWZwb.js";import{A as me}from"./ActivityHeatmap-BxBGHY1z.js";import{A as T}from"./arrow-up-right-DNLo92Ba.js";import{C as xe}from"./useOpenInteractionType-BQhgq4rv.js";import{D as ge,a as pe,b as he,c as fe,d as be,e as ue}from"./DialogTitle-DqFsk26U.js";import"./info-Bh5qTz6k.js";const ye=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ke=D("code-xml",ye);const je=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],ve=D("heart",je);const Ne=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],_e=D("link-2",Ne),C="tokentracker_likes";function F(a){if(!a)return!1;try{const r=localStorage.getItem(C);return r?!!JSON.parse(r)?.[a]:!1}catch{return!1}}function z(a,r){if(a)try{const t=localStorage.getItem(C),s=t?JSON.parse(t):{};r?s[a]=!0:delete s[a],localStorage.setItem(C,JSON.stringify(s))}catch{}}function E({userId:a}){const[r,t]=g.useState(!1),[s,i]=g.useState(0),[l,m]=g.useState(!1),[d,p]=g.useState(!1),[y,k]=g.useState(!1),[j,M]=g.useState([]),[v,b]=g.useState(!1),N=g.useRef(0);g.useEffect(()=>{let o=!1;return a?(m(!1),t(F(a)),Q({userId:a}).then(x=>{o||(i(Number(x?.count)||0),m(!0))}).catch(()=>{o||(i(0),m(!0))}),()=>{o=!0}):(m(!1),()=>{o=!0})},[a]);const _=()=>{k(!0),setTimeout(()=>k(!1),450),b(!0),setTimeout(()=>b(!1),500);const o=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],x=["circle","heart"],f=[];for(let h=0;h<12;h++){const S=(h*30+Math.random()*20-10)*(Math.PI/180),A=45+Math.random()*45,G=Math.cos(S)*A,J=Math.sin(S)*A-(10+Math.random()*15),X=Math.random()*360-180,q=6+Math.random()*8,Y=o[Math.floor(Math.random()*o.length)],K=x[Math.floor(Math.random()*x.length)],Z=++N.current;f.push({id:Z,tx:G,ty:J,rot:X,size:q,color:Y,shape:K})}M(h=>[...h,...f]),setTimeout(()=>{M(h=>h.filter(S=>!f.find(A=>A.id===S.id)))},850)},u=async o=>{p(!0);try{const x=await V({userId:a,delta:o}),f=Number(x?.count);Number.isFinite(f)&&i(f)}catch{t(x=>!x),i(x=>Math.max(0,x-o)),z(a,!F(a))}finally{p(!1)}},w=o=>{o.stopPropagation(),!(!a||!l||d)&&(r?(t(!1),i(x=>Math.max(0,x-1)),z(a,!1),u(-1)):(t(!0),i(x=>x+1),z(a,!0),_(),u(1)))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
+
@keyframes tt-like-pop {
|
|
3
|
+
0% { transform: scale(1); }
|
|
4
|
+
25% { transform: scale(0.75); }
|
|
5
|
+
50% { transform: scale(1.35); }
|
|
6
|
+
75% { transform: scale(0.9); }
|
|
7
|
+
100% { transform: scale(1); }
|
|
8
|
+
}
|
|
9
|
+
@keyframes tt-particle-fly {
|
|
10
|
+
0% {
|
|
11
|
+
transform: translate(0, 0) scale(1) rotate(0deg);
|
|
12
|
+
opacity: 1;
|
|
13
|
+
}
|
|
14
|
+
70% {
|
|
15
|
+
opacity: 0.8;
|
|
16
|
+
}
|
|
17
|
+
100% {
|
|
18
|
+
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
|
|
19
|
+
opacity: 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
@keyframes tt-num-scroll {
|
|
23
|
+
0% { transform: translateY(8px); opacity: 0; }
|
|
24
|
+
100% { transform: translateY(0); opacity: 1; }
|
|
25
|
+
}
|
|
26
|
+
.tt-animate-pop {
|
|
27
|
+
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
|
|
28
|
+
}
|
|
29
|
+
.tt-particle {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 50%;
|
|
32
|
+
left: 50%;
|
|
33
|
+
margin-top: -6px;
|
|
34
|
+
margin-left: -6px;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
z-index: 50;
|
|
37
|
+
}
|
|
38
|
+
.tt-num-anim {
|
|
39
|
+
animation: tt-num-scroll 0.25s ease-out forwards;
|
|
40
|
+
}
|
|
41
|
+
`}}),j.map(o=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${o.tx}px`,"--ty":`${o.ty}px`,"--rot":`${o.rot}deg`,width:`${o.size}px`,height:`${o.size}px`,backgroundColor:o.shape==="circle"?o.color:"transparent",borderRadius:o.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:o.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:o.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},o.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!l||d,"aria-label":r?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${r?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:y?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ve,{size:14,className:`transition-all duration-300 ${r?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${r?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${v?"tt-num-anim":""}`,children:l?s:"·"})]})]})}function we(a,r,t){const s=Number(a);return!Number.isFinite(s)||s<0?"—":s>0&&s<.01?`<${r==="USD"?"$":""}0.01`:le(s,{decimals:2,currency:r,rate:t})}function H(a,r,t){const s=Number(a);if(!Number.isFinite(s)||s<0)return"—";if(s<1e3)return we(s,r,t);const i=r==="USD"?s:s*(t||1);return`${r==="USD"?"$":""}${I(i,{decimals:1})}`}function $(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":I(r,{decimals:1})}function Se(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const t=r.map(i=>({day:i.date,total_tokens:i.total_tokens,models:i.models||null})),s=r[r.length-1]?.date;return oe({dailyRows:t,weeks:52,to:s})}const Ae=`
|
|
42
|
+
@keyframes tt-shimmer {
|
|
43
|
+
100% { transform: translateX(100%); }
|
|
44
|
+
}
|
|
45
|
+
.tt-shimmer-bar {
|
|
46
|
+
position: relative;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
}
|
|
49
|
+
.tt-shimmer-bar::after {
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0; right: 0; bottom: 0; left: 0;
|
|
52
|
+
transform: translateX(-100%);
|
|
53
|
+
background-image: linear-gradient(
|
|
54
|
+
90deg,
|
|
55
|
+
rgba(0, 0, 0, 0) 0%,
|
|
56
|
+
rgba(0, 0, 0, 0.02) 20%,
|
|
57
|
+
rgba(0, 0, 0, 0.06) 60%,
|
|
58
|
+
rgba(0, 0, 0, 0) 100%
|
|
59
|
+
);
|
|
60
|
+
animation: tt-shimmer 1.6s infinite;
|
|
61
|
+
content: '';
|
|
62
|
+
}
|
|
63
|
+
.dark .tt-shimmer-bar::after {
|
|
64
|
+
background-image: linear-gradient(
|
|
65
|
+
90deg,
|
|
66
|
+
rgba(255, 255, 255, 0) 0%,
|
|
67
|
+
rgba(255, 255, 255, 0.02) 20%,
|
|
68
|
+
rgba(255, 255, 255, 0.06) 60%,
|
|
69
|
+
rgba(255, 255, 255, 0) 100%
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
`;function Le({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",t=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:Ae}}),t?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",t?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((s,i)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},i))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((s,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},i))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((s,i)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},i))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((s,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},i))})]})]})]})}function O(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function U({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function L({value:a,label:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function P({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Me({user:a,onClose:r}){const t=O(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(W,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),t&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[e.jsx(R,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",t]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(E,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(ne,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function ze({user:a}){const r=O(a?.github_url),t=Number(a?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(W,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(E,{userId:a.user_id})]}),r?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(R,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",r]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Pe({data:a}){const r=Array.isArray(a)?a:[];return r.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:r.map(t=>{const s=Math.max(0,Math.min(1,Number(t?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx(R,{provider:String(t.source).toUpperCase(),size:14})}),e.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:t.source}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(s*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:$(t.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(s*100).toFixed(0),"%"]})]},t.source)})})}function B({icon:a,label:r,value:t}){const[s,i]=g.useState(!1),l=async()=>{await de(t)&&(i(!0),setTimeout(()=>i(!1),1600))};return e.jsxs("button",{type:"button",onClick:l,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",s?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[s?e.jsx(xe,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:s?n("leaderboard.profile_modal.badge.copied"):r})]})}function Ce({data:a,currency:r,rate:t,onClose:s,variant:i="modal"}){const{user:l,totals:m,streak:d,best_day:p,models:y,by_provider:k,heatmap:j,period:M}=a,v=i==="page",b=g.useMemo(()=>Se(j),[j]),N=y?.favorite?.model_name,_=Number(y?.count)||0,u=re(),w=!!(u?.user?.id&&l?.user_id&&u.user.id===l.user_id),o=l?.user_id?`https://www.tokentracker.cc/u/${l.user_id}`:null,x=l?.user_id?`[}/functions/tokentracker-embed-svg?user_id=${l.user_id}&theme=dark)](${o}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[v?e.jsx(ze,{user:l}):e.jsx(Me,{user:l,onClose:s}),e.jsxs("div",{className:c("space-y-6",v?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(L,{value:$(m?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(L,{value:H(m?.estimated_cost_usd,r,t),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx(L,{value:String(m?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx(L,{value:H(m?.avg_per_day_usd,r,t),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(P,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:d?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",d?.longest_days??0,")"]})]}),e.jsx(P,{label:n("leaderboard.profile_modal.best_day.title"),children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:$(p.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",p.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx(P,{label:n("leaderboard.profile_modal.models.favorite"),children:N?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:N}),_>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:_})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),b&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(U,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(me,{heatmap:b,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(U,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Pe,{data:k})]}),l?.user_id&&(s||w)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[s&&(se()?e.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:s,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(T,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(ie,{to:`/u/${l.user_id}`,onClick:s,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(T,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),w&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{icon:_e,label:n("leaderboard.profile_modal.badge.copy_url"),value:o}),e.jsx(B,{icon:ke,label:n("leaderboard.profile_modal.badge.copy"),value:x})]})]})]})]})}function $e({userId:a,period:r,accessToken:t,enabled:s=!0}){const[i,l]=g.useState({loading:!1,error:null,data:null});return g.useEffect(()=>{if(!s||!a)return;let m=!0;return l({loading:!0,error:null,data:null}),(async()=>{try{const d=t?await ee(t):null;if(!m)return;const p=await ae({accessToken:d,userId:a,period:r||"week"});if(!m)return;l({loading:!1,error:null,data:p})}catch(d){if(!m)return;d?.status===404?l({loading:!1,error:null,data:null}):l({loading:!1,error:d?.message||String(d),data:null})}})(),()=>{m=!1}},[s,a,r,t]),i}function We({isOpen:a,onClose:r,userId:t,period:s,accessToken:i}){const{currency:l,rate:m}=ce(),d=$e({userId:t,period:s,accessToken:i,enabled:a});return e.jsx(ge,{open:a,onOpenChange:p=>{p||r?.()},children:e.jsxs(pe,{children:[e.jsx(he,{className:"cost-modal-backdrop"}),e.jsx(fe,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(be,{className:c("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[e.jsx(ue,{render:e.jsx("h2",{className:"sr-only"}),children:d.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),d.loading&&e.jsx(Le,{}),!d.loading&&d.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!d.loading&&!d.error&&!d.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!d.loading&&!d.error&&d.data&&e.jsx(Ce,{data:d.data,currency:l,rate:m,onClose:r})]})})]})})}export{We as LeaderboardProfileModal,Ce as ProfileContent,Le as ProfileSkeleton,$e as useLeaderboardProfileData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d,j as e,M as j,O as w,Q as N,L as k,ax as L,A as s,a8 as I}from"./main-BIY3Nj6I.js";import{u as M}from"./useCurrency-BsSZiZMP.js";import{H as T}from"./HeaderGithubStar-COD2HfaF.js";import{useLeaderboardProfileData as C,ProfileSkeleton as _,ProfileContent as E}from"./LeaderboardProfileModal-C49_3Xm9.js";import"./LeaderboardAvatar-CiIpWZwb.js";import"./ActivityHeatmap-BxBGHY1z.js";import"./info-Bh5qTz6k.js";import"./arrow-up-right-DNLo92Ba.js";import"./useOpenInteractionType-BQhgq4rv.js";import"./DialogTitle-DqFsk26U.js";const l=18;function y(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2"}),e.jsx("path",{d:"M12 20v2"}),e.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),e.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),e.jsx("path",{d:"M2 12h2"}),e.jsx("path",{d:"M20 12h2"}),e.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),e.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function v(){return e.jsx("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function S(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8"}),e.jsx("path",{d:"M12 17v4"})]})}const P=[{value:"light",label:"Light",Icon:y},{value:"dark",label:"Dark",Icon:v},{value:"system",label:"System",Icon:S}];function O(a){return a==="dark"?v:y}function A({theme:a,resolvedTheme:h,onSetTheme:g,className:m="",direction:u="down",align:p="right"}){const[o,x]=d.useState(!1),c=d.useRef(null),n=d.useCallback(()=>x(!1),[]);d.useEffect(()=>{if(!o)return;const r=i=>{c.current&&!c.current.contains(i.target)&&n()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o,n]),d.useEffect(()=>{if(!o)return;const r=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,n]);const b=O(h);return e.jsxs("div",{ref:c,className:`relative ${m}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":o,onClick:()=>x(r=>!r),className:"flex items-center justify-center w-9 h-9 rounded-lg 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",children:e.jsx(b,{})}),o&&e.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${u==="up"?"bottom-full mb-1":"top-full mt-1"} ${p==="left"?"left-0":"right-0"}`,children:P.map(({value:r,label:i,Icon:f})=>{const t=a===r;return e.jsxs("button",{type:"button",onClick:()=>{g(r),n()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${t?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[e.jsx(f,{}),e.jsx("span",{children:i})]},r)})})]})}function U({auth:a,signedIn:h,sessionSoftExpired:g,userId:m}){const{currency:u,rate:p}=M(),{theme:o,resolvedTheme:x,setTheme:c}=j(),{openLoginModal:n}=w(),{signedIn:b,loading:r}=N(),i=h&&!g,f=d.useMemo(()=>i&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,i]),t=C({userId:m,period:"total",accessToken:f});return e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[e.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:e.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(k,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),e.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),e.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:e.jsx(T,{})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsxs(k,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-lg border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[e.jsx(L,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),e.jsx("span",{children:s("leaderboard.profile.nav.back")})]}),r?e.jsx("div",{className:"h-8 w-16 animate-pulse rounded-lg bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):b?e.jsx(I,{}):e.jsx("button",{type:"button",onClick:n,className:"inline-flex h-8 min-w-[76px] items-center justify-center rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] select-none text-xs font-bold shadow-sm",children:s("header.auth.sign_in_aria")})]})]})}),e.jsx("main",{className:"flex-1 pt-4 pb-10 sm:pt-6 sm:pb-16",children:e.jsx("div",{className:"mx-auto max-w-2xl px-4 sm:px-6",children:e.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[t.loading&&e.jsx(_,{variant:"page"}),!t.loading&&t.error&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:s("leaderboard.profile_modal.error")})}),!t.loading&&!t.error&&!t.data&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.profile_modal.empty")})}),!t.loading&&!t.error&&t.data&&e.jsx(E,{data:t.data,currency:u,rate:p,variant:"page"})]})})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-2xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(A,{theme:o,resolvedTheme:x,onSetTheme:c,direction:"up",align:"right"}),e.jsx(k,{to:"/leaderboard",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:s("leaderboard.profile.nav.back")})]})]})})]})}export{U as LeaderboardProfilePage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as i,N as f,A as s,r as E,az as I,i as P,L as R,aA as C}from"./main-BIY3Nj6I.js";import{u as M}from"./use-usage-limits-odqe9OY7.js";import{L as u,u as O}from"./use-limits-display-prefs-B4iJ-bBc.js";import{C as j}from"./Card-GROxUc_6.js";import{F as T}from"./FadeIn-HBBXW_3q.js";import{L as A}from"./LocalOnlyNotice-D3rQdA-P.js";import"./arrow-up-right-DNLo92Ba.js";import"./download-DbBBBpJF.js";const S=[3,2,3,3,2,2,3];function x({className:n}){return i.jsx("div",{className:f("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",n)})}function D(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(x,{className:"h-3 w-12 shrink-0"}),i.jsx(x,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(x,{className:"h-3 w-[30px] shrink-0"}),i.jsx(x,{className:"h-3 w-6 shrink-0"})]})}function $({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(x,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(x,{className:f("h-4",r)})]}),Array.from({length:n},(t,o)=>i.jsx(D,{},o))]})}function G(){return i.jsx(j,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(x,{className:"h-3.5 w-28"}),S.map((n,e)=>i.jsx($,{bars:n,index:e},e))]})})}function l(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 t=Math.floor(r/6e4);if(t<60)return`${t}m`;const o=Math.floor(t/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function H(n,e){const r=e===u.REMAINING?100-n:n;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function a({label:n,pct:e,reset:r,mode:t=u.USED}){const o=Math.max(0,Math.min(100,Number(e)||0)),d=t===u.REMAINING?100-o:o,p=Math.round(d),y=d>0&&p===0?Math.max(d,.35):d,w=d>0&&p===0?"<1":String(p);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:`${H(d,t)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${y}%`,minWidth:d>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[w,"%"]}),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 m({name:n,icon:e,children:r}){const o=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:o}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n})]}),r]})}const F=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],B={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 U(n,e,r){const t=B[n];if(!t)return null;if(!e?.configured)return i.jsx(m,{name:t.name,icon:t.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},n);if(e.error)return i.jsx(m,{name:t.name,icon:t.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},n);const o=e.plan_label?`${t.name} ${e.plan_label}`:t.name;switch(n){case"claude":return i.jsxs(m,{name:o,icon:t.icon,children:[e.five_hour?i.jsx(a,{label:"5h",pct:e.five_hour.utilization,reset:l(e.five_hour.resets_at),mode:r}):null,e.seven_day?i.jsx(a,{label:"7d",pct:e.seven_day.utilization,reset:l(e.seven_day.resets_at),mode:r}):null,e.seven_day_opus?i.jsx(a,{label:"Opus",pct:e.seven_day_opus.utilization,reset:l(e.seven_day_opus.resets_at),mode:r}):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(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:"5h",pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:"7d",pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:l(e.tertiary_window.reset_at),mode:r}):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(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:"Pro",pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:"Flash",pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:"Lite",pct:e.tertiary_window.used_percent,reset:l(e.tertiary_window.reset_at),mode:r}):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(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:l(e.tertiary_window.reset_at),mode:r}):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(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:"Claude",pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:"G Pro",pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(a,{label:"Flash",pct:e.tertiary_window.used_percent,reset:l(e.tertiary_window.reset_at),mode:r}):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(m,{name:o,icon:t.icon,children:[e.primary_window?i.jsx(a,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:l(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(a,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:l(e.secondary_window.reset_at),mode:r}):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(z,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function z({defaultDir:n}){const[e,r]=E.useState(!1),o=["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
|
+
`),d=async()=>{try{await navigator.clipboard.writeText(o),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:o}),i.jsx("button",{type:"button",onClick:d,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 Y({claude:n,codex:e,cursor:r,gemini:t,kimi:o,kiro:d,antigravity:p,copilot:y,order:w,visibility:h,displayMode:v}){const k={claude:n,codex:e,cursor:r,gemini:t,kimi:o,kiro:d,antigravity:p,copilot:y},N=Array.isArray(w)&&w.length>0?w:F,g=v===u.REMAINING?u.REMAINING:u.USED,L=g===u.REMAINING?s("limits.settings.display_mode_remaining"):s("limits.settings.display_mode_used"),b=N.filter(_=>!h||h[_]!==!1).map(_=>U(_,k[_],g)).filter(Boolean);return i.jsx(T,{delay:.15,children:i.jsx(j,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[s("limits.panel.title"),s("limits.panel.mode_separator"),L]}),b.length>0?b:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const K=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function ie(){const n=I(),{data:e,error:r,isLoading:t}=M(n?{initialRefresh:!0,initialState:n,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),o=O();return!K&&!P()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(A,{})}):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(R,{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(C,{className:"h-4 w-4","aria-hidden":!0})})]}),t?i.jsx(G,{}):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(Y,{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:o.order,visibility:o.visibility,displayMode:o.displayMode})]})]})})})}export{ie as LimitsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,A as t}from"./main-BIY3Nj6I.js";import{A as r}from"./arrow-up-right-DNLo92Ba.js";import{D as o}from"./download-DbBBBpJF.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{am as Y,aC as Z,Q as ee,r,A as s,j as e,L as G,N as v}from"./main-BIY3Nj6I.js";function te(n){const a=new URLSearchParams(n).get("next");return typeof a!="string"||a.length===0||!a.startsWith("/")||a.startsWith("//")?"/dashboard":a}const Q={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function V(n){const a=String(n||"").trim();return Q[a]?Q[a]:a.replace(/-/g," ")}function ie(){const n=Y(),[a,A]=Z(),{enabled:o,loading:g,signedIn:f,refreshUser:C,signInWithPassword:E,signUp:M,signInWithOAuth:I,getPublicAuthConfig:F}=ee(),m=r.useMemo(()=>te(a.toString()),[a]),[l,j]=r.useState("signin"),[x,$]=r.useState(""),[h,H]=r.useState(""),[N,X]=r.useState(""),[k,p]=r.useState(!1),[O,c]=r.useState(null),[U,b]=r.useState(null),[S,B]=r.useState(!0),[_,R]=r.useState([]),[P,T]=r.useState([]),[W,z]=r.useState(8);r.useEffect(()=>{const t=a.get("insforge_status"),i=a.get("insforge_type"),u=a.get("insforge_error");t==="success"&&i==="verify_email"?b(s("login.verify_email_success")):t==="error"&&i==="verify_email"&&u&&b(s("shared.error.prefix",{error:u}))},[a]),r.useEffect(()=>{if(!o){B(!1);return}let t=!0;return(async()=>{const{data:i,error:u}=await F();t&&(u||!i?(R(["google","github"]),T([])):(R(Array.isArray(i.oAuthProviders)?i.oAuthProviders:[]),T(Array.isArray(i.customOAuthProviders)?i.customOAuthProviders:[]),typeof i.passwordMinLength=="number"&&i.passwordMinLength>0&&z(i.passwordMinLength)),B(!1))})(),()=>{t=!1}},[o,F]);const d=r.useMemo(()=>a.get("native")==="1",[a]),y=r.useMemo(()=>a.get("provider")||null,[a]);r.useEffect(()=>{if(!(!o||g)&&f){if(d){window.location.href="/auth/native-callback";return}n(m,{replace:!0})}},[o,g,f,n,m,d]),r.useEffect(()=>{o&&C()},[o,C]);const q=r.useMemo(()=>typeof window>"u"||d?"":`${window.location.origin}/`,[d]),D=r.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),J=r.useCallback(async t=>{t.preventDefault(),c(null),p(!0);try{if(l==="signup"){const{data:u,error:L}=await M({email:x.trim(),password:h,name:N.trim()||void 0,redirectTo:D});if(L){c(L.message||String(L));return}if(u?.requireEmailVerification){b(s("login.verify_email_pending")),j("signin");return}n(m,{replace:!0});return}const{error:i}=await E({email:x.trim(),password:h});if(i){c(i.message||String(i));return}n(m,{replace:!0})}finally{p(!1)}},[l,x,h,N,M,E,n,m,D]),w=r.useCallback(async t=>{c(null),p(!0);try{const{error:i}=await I(t,q);i&&c(i.message||String(i))}finally{p(!1)}},[I,q]);r.useEffect(()=>{if(d&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[d]),r.useEffect(()=>{if(!o||g||f||S||!d||!y)return;[..._,...P].includes(y)&&w(y)},[o,g,f,S,d,y,_,P,w]);const K=r.useCallback(()=>{A(t=>{const i=new URLSearchParams(t);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),b(null)},[A]);return o?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:s("login.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:s("login.subtitle")})]}),U?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:U}),e.jsx("button",{type:"button",onClick:K,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,O?e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:s("shared.error.prefix",{error:O})}):null,e.jsx("div",{className:"space-y-3",children:S?e.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):e.jsxs(e.Fragment,{children:[_.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t)),P.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t))]})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:e.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:s("login.divider")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signin"),c(null)},children:s("login.tab.sign_in")}),e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signup"),c(null)},children:s("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[l==="signup"?e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.name")}),e.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:N,onChange:t=>X(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:s("login.field.name_placeholder")})]}):null,e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.email")}),e.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:x,onChange:t=>$(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.password")}),e.jsx("input",{id:"login-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?W:void 0,value:h,onChange:t=>H(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"?e.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:s("login.password_hint",{min:String(W)})}):null]}),e.jsx("button",{type:"submit",disabled:k||g,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?s("login.submit.sign_up"):s("login.submit.sign_in")})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{ie as LoginPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as ve,r,bn as me,bo as Fe,bp as we,aX as $,b as W,bq as U,br as te,bs as Re,aY as ae,bt as de,bu as Q,ak as ne,bv as Te,aW as re,bw as ue,bx as Le,by as Ae,bz as le,bA as He,bB as je,j as V,bC as Be,u as De,a as pe,bD as Ne,bE as he,bF as _e,bG as Ye,bH as Ge,bI as Ve,bJ as Xe,bK as Ke,bL as Ue,bM as qe,b4 as We,bN as $e,b5 as ze}from"./main-BIY3Nj6I.js";import{i as oe,c as Ce,d as Pe,e as se,g as Je,R as Qe,P as Ze,f as q,F as et,h as tt,j as nt,k as ot,l as Se,u as rt,p as st,t as it,m as ct,I as at,n as ut,o as Oe,q as lt,r as ft}from"./useOpenInteractionType-BQhgq4rv.js";import{p as dt,f as pt,g as gt,h as mt,i as ht,j as Et,k as bt}from"./DialogTitle-DqFsk26U.js";import{p as vt,q as Rt,r as ye,t as Tt,v as Ct}from"./SelectItemText-C7F7eIm0.js";const Pt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xt=ve("chevron-right",Pt);const St=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kt=ve("loader-circle",St);function ie(o,e,t){if(t&&!oe(t))return 0;if(typeof o=="number")return o;if(typeof o=="function"){const l=o();return typeof l=="number"?l:l?.[e]}return o?.[e]}const fe=Fe("safe-polygon"),Ot=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${we}`;function yt(o){return o?!!o.closest(Ot):!1}function Ie(o){const e=r.useRef(void 0),t=r.useRef(!1),l=r.useRef(void 0),E=r.useRef(!0),g=r.useRef(!1),v=r.useRef(()=>{}),k=r.useRef(!1),s=me(),P=me(),i=r.useRef(void 0);return r.useMemo(()=>{const a=o.context.dataRef.current;return a.hoverInteractionState||(a.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:t,handlerRef:l,blockMouseMoveRef:E,performedPointerEventsMutationRef:g,unbindMouseMoveRef:v,restTimeoutPendingRef:k,openChangeTimeout:s,restTimeout:P,handleCloseOptionsRef:i}),a.hoverInteractionState},[o,e,t,l,E,g,v,k,s,P,i])}const It=new Set(["click","mousedown"]);function Mt(o,e={}){const t="rootStore"in o?o.rootStore:o,l=t.useState("open"),E=t.useState("floatingElement"),g=t.useState("domReferenceElement"),{dataRef:v}=t.context,{enabled:k=!0,closeDelay:s=0,externalTree:P}=e,{pointerTypeRef:i,interactedInsideRef:a,handlerRef:L,performedPointerEventsMutationRef:H,unbindMouseMoveRef:F,restTimeoutPendingRef:u,openChangeTimeout:I,handleCloseOptionsRef:D}=Ie(t),f=Ce(P),B=Pe(),M=$(()=>a.current?!0:v.current.openEvent?It.has(v.current.openEvent.type):!1),x=$(()=>{const m=v.current.openEvent?.type;return m?.includes("mouse")&&m!=="mousedown"}),O=r.useCallback((m,w=!0)=>{const c=xt(s,i.current);c&&!L.current?I.start(c,()=>t.setOpen(!1,W(U,m))):w&&(I.clear(),t.setOpen(!1,W(U,m)))},[s,L,t,i,I]),T=$(()=>{F.current(),L.current=void 0}),_=$(()=>{if(H.current){const m=te(E).body;m.style.pointerEvents="",m.removeAttribute(fe),H.current=!1}}),N=$(m=>{const w=Re(m);if(!yt(w)){a.current=!1;return}a.current=!0});ae(()=>{l||(i.current=void 0,u.current=!1,a.current=!1,T(),_())},[l,i,u,a,T,_]),r.useEffect(()=>()=>{T()},[T]),r.useEffect(()=>_,[_]),ae(()=>{if(k&&l&&D.current?.blockPointerEvents&&x()&&de(g)&&E){H.current=!0;const m=te(E).body;m.setAttribute(fe,"");const w=g,c=E,n=f?.nodesRef.current.find(y=>y.id===B)?.context?.elements.floating;return n&&(n.style.pointerEvents=""),m.style.pointerEvents="none",w.style.pointerEvents="auto",c.style.pointerEvents="auto",()=>{m.style.pointerEvents="",w.style.pointerEvents="",c.style.pointerEvents=""}}},[k,l,g,E,D,x,f,B,H]),r.useEffect(()=>{if(!k)return;function m(y){if(M()||!v.current.floatingContext||!t.select("open"))return;const S=t.context.triggerElements;y.relatedTarget&&S.hasElement(y.relatedTarget)||(_(),T(),M()||O(y))}function w(y){I.clear(),_(),L.current?.(y),T()}function c(y){M()||O(y,!1)}const n=E;return n&&(n.addEventListener("mouseleave",m),n.addEventListener("mouseenter",w),n.addEventListener("mouseleave",c),n.addEventListener("pointerdown",N,!0)),()=>{n&&(n.removeEventListener("mouseleave",m),n.removeEventListener("mouseenter",w),n.removeEventListener("mouseleave",c),n.removeEventListener("pointerdown",N,!0))}})}function xt(o,e){return e&&!oe(e)?0:typeof o=="function"?o():o}function ce(o){return typeof o=="function"?o():o}const kt={current:null};function Ft(o,e={}){const t="rootStore"in o?o.rootStore:o,{dataRef:l,events:E}=t.context,{enabled:g=!0,delay:v=0,handleClose:k=null,mouseOnly:s=!1,restMs:P=0,move:i=!0,triggerElementRef:a=kt,externalTree:L,isActiveTrigger:H=!0}=e,F=Ce(L),{pointerTypeRef:u,interactedInsideRef:I,handlerRef:D,blockMouseMoveRef:f,performedPointerEventsMutationRef:B,unbindMouseMoveRef:M,restTimeoutPendingRef:x,openChangeTimeout:O,restTimeout:T,handleCloseOptionsRef:_}=Ie(t),N=se(k),m=se(v),w=se(P);H&&(_.current=N.current?.__options);const c=$(()=>I.current?!0:l.current.openEvent?["click","mousedown"].includes(l.current.openEvent.type):!1),n=r.useCallback((d,p=!0)=>{const R=ie(m.current,"close",u.current);R&&!D.current?O.start(R,()=>t.setOpen(!1,W(U,d))):p&&(O.clear(),t.setOpen(!1,W(U,d)))},[m,D,t,u,O]),y=$(()=>{M.current(),D.current=void 0}),S=$(()=>{if(B.current){const d=te(t.select("domReferenceElement")).body;d.style.pointerEvents="",d.removeAttribute(fe),B.current=!1}});r.useEffect(()=>{if(!g)return;function d(p){p.open||(O.clear(),T.clear(),f.current=!0,x.current=!1)}return E.on("openchange",d),()=>{E.off("openchange",d)}},[g,E,O,T,f,x]);const G=$(d=>{if(c()||!l.current.floatingContext)return;const p=t.context.triggerElements;if(d.relatedTarget&&p.hasElement(d.relatedTarget))return;const R=a.current;N.current?.({...l.current.floatingContext,tree:F,x:d.clientX,y:d.clientY,onClose(){S(),y(),!c()&&R===t.select("domReferenceElement")&&n(d)}})(d)});return r.useEffect(()=>{if(!g)return;const d=a.current??(H?t.select("domReferenceElement"):null);if(!de(d))return;function p(C){if(O.clear(),f.current=!1,s&&!oe(u.current)||ce(w.current)>0&&!ie(m.current,"open"))return;const A=ie(m.current,"open",u.current),Y=t.select("domReferenceElement"),b=t.context.triggerElements,K=(b.hasElement(C.target)||b.hasMatchingElement(J=>Q(J,C.target)))&&(!Y||!Q(Y,C.target)),h=C.currentTarget??null,j=t.select("open"),z=!j||K;K&&j?t.setOpen(!0,W(U,C,h)):A?O.start(A,()=>{z&&t.setOpen(!0,W(U,C,h))}):z&&t.setOpen(!0,W(U,C,h))}function R(C){if(c()){S();return}M.current();const A=t.select("domReferenceElement"),Y=te(A);T.clear(),x.current=!1;const b=t.context.triggerElements;if(C.relatedTarget&&b.hasElement(C.relatedTarget))return;if(N.current&&l.current.floatingContext){t.select("open")||O.clear();const h=a.current;D.current=N.current({...l.current.floatingContext,tree:F,x:C.clientX,y:C.clientY,onClose(){S(),y(),!c()&&h===t.select("domReferenceElement")&&n(C,!0)}});const j=D.current;j(C),Y.addEventListener("mousemove",j),M.current=()=>{Y.removeEventListener("mousemove",j)};return}(u.current!=="touch"||!Q(t.select("floatingElement"),C.relatedTarget))&&n(C)}function X(C){G(C)}return t.select("open")&&d.addEventListener("mouseleave",X),i&&d.addEventListener("mousemove",p,{once:!0}),d.addEventListener("mouseenter",p),d.addEventListener("mouseleave",R),()=>{d.removeEventListener("mouseleave",X),i&&d.removeEventListener("mousemove",p),d.removeEventListener("mouseenter",p),d.removeEventListener("mouseleave",R)}},[y,S,f,l,m,n,t,g,N,G,H,c,s,i,u,w,T,x,O,a,F,M,D]),r.useMemo(()=>{function d(p){u.current=p.pointerType}return{onPointerDown:d,onPointerEnter:d,onMouseMove(p){const{nativeEvent:R}=p,X=p.currentTarget,C=t.select("domReferenceElement"),A=t.context.triggerElements,Y=t.select("open"),b=(A.hasElement(p.target)||A.hasMatchingElement(h=>Q(h,p.target)))&&(!C||!Q(C,p.target));if(s&&!oe(u.current)||Y&&!b||ce(w.current)===0||!b&&x.current&&p.movementX**2+p.movementY**2<2)return;T.clear();function K(){if(x.current=!1,c())return;const h=t.select("open");!f.current&&(!h||b)&&t.setOpen(!0,W(U,R,X))}u.current==="touch"?ne.flushSync(()=>{K()}):b&&Y?K():(x.current=!0,T.start(ce(w.current),K))}}},[f,c,s,t,u,w,T,x])}function Ee(o,e){const[t,l]=o;let E=!1;const g=e.length;for(let v=0,k=g-1;v<g;k=v++){const[s,P]=e[v]||[0,0],[i,a]=e[k]||[0,0];P>=l!=a>=l&&t<=(i-s)*(l-P)/(a-P)+s&&(E=!E)}return E}function wt(o,e){return o[0]>=e.x&&o[0]<=e.x+e.width&&o[1]>=e.y&&o[1]<=e.y+e.height}function Lt(o={}){const{buffer:e=.5,blockPointerEvents:t=!1,requireIntent:l=!0}=o,E=new Te;let g=!1,v=null,k=null,s=typeof performance<"u"?performance.now():0;function P(a,L){const H=performance.now(),F=H-s;if(v===null||k===null||F===0)return v=a,k=L,s=H,null;const u=a-v,I=L-k,f=Math.sqrt(u*u+I*I)/F;return v=a,k=L,s=H,f}const i=({x:a,y:L,placement:H,elements:F,onClose:u,nodeId:I,tree:D})=>function(B){function M(){E.clear(),u()}if(E.clear(),!F.domReference||!F.floating||H==null||a==null||L==null)return;const{clientX:x,clientY:O}=B,T=[x,O],_=Re(B),N=B.type==="mouseleave",m=Q(F.floating,_),w=Q(F.domReference,_),c=F.domReference.getBoundingClientRect(),n=F.floating.getBoundingClientRect(),y=H.split("-")[0],S=a>n.right-n.width/2,G=L>n.bottom-n.height/2,d=wt(T,c),p=n.width>c.width,R=n.height>c.height,X=(p?c:n).left,C=(p?c:n).right,A=(R?c:n).top,Y=(R?c:n).bottom;if(m&&(g=!0,!N))return;if(w&&(g=!1),w&&!N){g=!0;return}if(N&&de(B.relatedTarget)&&Q(F.floating,B.relatedTarget)||D&&Je(D.nodesRef.current,I).some(({context:h})=>h?.open))return;if(y==="top"&&L>=c.bottom-1||y==="bottom"&&L<=c.top+1||y==="left"&&a>=c.right-1||y==="right"&&a<=c.left+1)return M();let b=[];switch(y){case"top":b=[[X,c.top+1],[X,n.bottom-1],[C,n.bottom-1],[C,c.top+1]];break;case"bottom":b=[[X,n.top+1],[X,c.bottom-1],[C,c.bottom-1],[C,n.top+1]];break;case"left":b=[[n.right-1,Y],[n.right-1,A],[c.left+1,A],[c.left+1,Y]];break;case"right":b=[[c.right-1,Y],[c.right-1,A],[n.left+1,A],[n.left+1,Y]];break}function K([h,j]){switch(y){case"top":{const z=[p?h+e/2:S?h+e*4:h-e*4,j+e+1],J=[p?h-e/2:S?h+e*4:h-e*4,j+e+1],Z=[[n.left,S||p?n.bottom-e:n.top],[n.right,S?p?n.bottom-e:n.top:n.bottom-e]];return[z,J,...Z]}case"bottom":{const z=[p?h+e/2:S?h+e*4:h-e*4,j-e],J=[p?h-e/2:S?h+e*4:h-e*4,j-e],Z=[[n.left,S||p?n.top+e:n.bottom],[n.right,S?p?n.top+e:n.bottom:n.top+e]];return[z,J,...Z]}case"left":{const z=[h+e+1,R?j+e/2:G?j+e*4:j-e*4],J=[h+e+1,R?j-e/2:G?j+e*4:j-e*4];return[...[[G||R?n.right-e:n.left,n.top],[G?R?n.right-e:n.left:n.right-e,n.bottom]],z,J]}case"right":{const z=[h-e,R?j+e/2:G?j+e*4:j-e*4],J=[h-e,R?j-e/2:G?j+e*4:j-e*4],Z=[[G||R?n.left+e:n.right,n.top],[G?R?n.left+e:n.right:n.left+e,n.bottom]];return[z,J,...Z]}default:return[]}}if(!Ee([x,O],b)){if(g&&!d)return M();if(!N&&l){const h=P(B.clientX,B.clientY);if(h!==null&&h<.1)return M()}Ee([x,O],K([a,L]))?!g&&l&&E.start(40,M):M()}};return i.__options={blockPointerEvents:t},i}const Me=r.createContext(void 0);function ee(o){const e=r.useContext(Me);if(e===void 0&&!o)throw new Error(re(47));return e}function At(){return{...pt(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const Ht={...dt,disabled:q(o=>o.disabled),instantType:q(o=>o.instantType),openMethod:q(o=>o.openMethod),openChangeReason:q(o=>o.openChangeReason),modal:q(o=>o.modal),stickIfOpen:q(o=>o.stickIfOpen),titleElementId:q(o=>o.titleElementId),descriptionElementId:q(o=>o.descriptionElementId),openOnHover:q(o=>o.openOnHover),closeDelay:q(o=>o.closeDelay),hasViewport:q(o=>o.hasViewport)};class ge extends Qe{constructor(e){const t={...At(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:r.createRef(),beforeContentFocusGuardRef:r.createRef(),stickIfOpenTimeout:new Te,triggerElements:new Ze},Ht)}setOpen=(e,t)=>{const l=t.reason===U,E=t.reason===ue&&t.event.detail===0,g=!e&&(t.reason===Le||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;const v={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit("openchange",v);const s=()=>{const P={open:e,openChangeReason:t.reason},i=t.trigger?.id??null;(i||e)&&(P.activeTriggerId=i,P.activeTriggerElement=t.trigger??null),this.update(P)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Ae,()=>{this.set("stickIfOpen",!1)}),ne.flushSync(s)):s(),E||g?this.set("instantType",E?"click":"dismiss"):t.reason===le?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,t){const l=He(()=>new ge(t)).current,E=e??l;return je(l.disposeEffect),E}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function be({props:o}){const{children:e,open:t,defaultOpen:l=!1,onOpenChange:E,onOpenChangeComplete:g,modal:v=!1,handle:k,triggerId:s,defaultTriggerId:P=null}=o,i=ge.useStore(k?.store,{open:t??l,modal:v,activeTriggerId:s!==void 0?s:P});i.useControlledProp("open",t,l),i.useControlledProp("activeTriggerId",s,P);const a=i.useState("open"),L=i.useState("positionerElement"),H=i.useState("payload"),F=i.useState("openChangeReason");i.useContextCallback("onOpenChange",E),i.useContextCallback("onOpenChangeComplete",g);const{openMethod:u,triggerProps:I,reset:D}=tt(a);gt(i);const{forceUnmount:f}=mt(a,i,()=>{i.update({stickIfOpen:!0,openChangeReason:null}),D()});nt(a&&v===!0&&F!==U&&u!=="touch",L),r.useEffect(()=>{a||i.context.stickIfOpenTimeout.clear()},[i,a]);const B=r.useCallback(S=>{const G=W(S);return G.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},G},[i]),M=r.useCallback(()=>{i.setOpen(!1,B(Be))},[i,B]);r.useImperativeHandle(o.actionsRef,()=>({unmount:f,close:M}),[f,M]);const x=ht({popupStore:i,onOpenChange:i.setOpen}),O=ot(x,{outsidePressEvent:{mouse:v==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),T=Et(x),{getReferenceProps:_,getFloatingProps:N,getTriggerProps:m}=Se([O,T]),w=r.useMemo(()=>_(I),[_,I]),c=r.useMemo(()=>m(I),[m,I]),n=r.useMemo(()=>N(),[N]);i.useSyncedValues({modal:v,openMethod:u,activeTriggerProps:w,inactiveTriggerProps:c,popupProps:n,floatingRootContext:x,nested:Pe()!=null});const y=r.useMemo(()=>({store:i}),[i]);return V.jsx(Me.Provider,{value:y,children:typeof e=="function"?e({payload:H}):e})}function Ut(o){return ee(!0)?V.jsx(be,{props:o}):V.jsx(et,{children:V.jsx(be,{props:o})})}const jt=300,qt=r.forwardRef(function(e,t){const{render:l,className:E,disabled:g=!1,nativeButton:v=!0,handle:k,payload:s,openOnHover:P=!1,delay:i=jt,closeDelay:a=0,id:L,...H}=e,F=ee(!0),u=k?.store??F?.store;if(!u)throw new Error(re(74));const I=rt(L),D=u.useState("isTriggerActive",I),f=u.useState("floatingRootContext"),B=u.useState("isOpenedByTrigger",I),M=r.useRef(null),{registerTrigger:x,isMountedByThisTrigger:O}=bt(I,M,u,{payload:s,disabled:g,openOnHover:P,closeDelay:a}),T=u.useState("openChangeReason"),_=u.useState("stickIfOpen"),N=u.useState("openMethod"),m=Ft(f,{enabled:f!=null&&P&&(N!=="touch"||T!==ue),mouseOnly:!0,move:!1,handleClose:Lt(),restMs:i,delay:{close:a},triggerElementRef:M,isActiveTrigger:D}),w=vt(f,{enabled:f!=null,stickIfOpen:_}),c=Se([w]),n=u.useState("triggerProps",O),y=r.useMemo(()=>({disabled:g,open:B}),[g,B]),{getButtonProps:S,buttonRef:G}=De({disabled:g,native:v}),d=r.useMemo(()=>({open(A){return A&&T===ue?st.open(A):it.open(A)}}),[T]),p=pe("button",e,{state:y,ref:[G,t,x,M],props:[c.getReferenceProps(),m,n,{[Ne]:"",id:I},H,S],stateAttributesMapping:d}),R=r.useRef(null),X=$(A=>{ne.flushSync(()=>{u.setOpen(!1,W(le,A.nativeEvent,A.currentTarget))}),_e(R.current)?.focus()}),C=$(A=>{const Y=u.select("positionerElement");if(Y&&Ye(A,Y))u.context.beforeContentFocusGuardRef.current?.focus();else{ne.flushSync(()=>{u.setOpen(!1,W(le,A.nativeEvent,A.currentTarget))});let b=Ge(u.context.triggerFocusTargetRef.current||M.current);for(;b!==null&&Q(Y,b);){const K=b;if(b=Ve(b),b===K)break}b?.focus()}});return D?V.jsxs(r.Fragment,{children:[V.jsx(he,{ref:R,onFocus:X}),V.jsx(r.Fragment,{children:p},I),V.jsx(he,{ref:u.context.triggerFocusTargetRef,onFocus:C})]}):V.jsx(r.Fragment,{children:p},I)}),xe=r.createContext(void 0);function Bt(){const o=r.useContext(xe);if(o===void 0)throw new Error(re(45));return o}const Wt=r.forwardRef(function(e,t){const{keepMounted:l=!1,...E}=e,{store:g}=ee();return g.useState("mounted")||l?V.jsx(xe.Provider,{value:l,children:V.jsx(Xe,{ref:t,...E,renderGuards:!1})}):null}),ke=r.createContext(void 0);function Dt(){const o=r.useContext(ke);if(!o)throw new Error(re(46));return o}const $t=r.forwardRef(function(e,t){const{render:l,className:E,anchor:g,positionMethod:v="absolute",side:k="bottom",align:s="center",sideOffset:P=0,alignOffset:i=0,collisionBoundary:a="clipping-ancestors",collisionPadding:L=5,arrowPadding:H=5,sticky:F=!1,disableAnchorTracking:u=!1,collisionAvoidance:I=Ke,...D}=e,{store:f}=ee(),B=Bt(),M=ct(),x=f.useState("floatingRootContext"),O=f.useState("mounted"),T=f.useState("open"),_=f.useState("openChangeReason"),N=f.useState("activeTriggerElement"),m=f.useState("modal"),w=f.useState("positionerElement"),c=f.useState("instantType"),n=f.useState("transitionStatus"),y=f.useState("hasViewport"),S=r.useRef(null),G=Ue(w,!1,!1),d=Rt({anchor:g,floatingRootContext:x,positionMethod:v,mounted:O,side:k,sideOffset:P,align:s,alignOffset:i,arrowPadding:H,collisionBoundary:a,collisionPadding:L,sticky:F,disableAnchorTracking:u,keepMounted:B,nodeId:M,collisionAvoidance:I,adaptiveOrigin:y?Tt:void 0}),p=r.useMemo(()=>{const b={};return T||(b.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...d.positionerStyles,...b}}},[T,O,d.positionerStyles]),R=r.useMemo(()=>({props:p,...d}),[p,d]),X=x?.select("domReferenceElement");ae(()=>{const b=X,K=S.current;if(b&&(S.current=b),K&&b&&b!==K){f.set("instantType",void 0);const h=new AbortController;return G(()=>{f.set("instantType","trigger-change")},h.signal),()=>{h.abort()}}},[X,G,f]);const C=r.useMemo(()=>({open:T,side:R.side,align:R.align,anchorHidden:R.anchorHidden,instant:c}),[T,R.side,R.align,R.anchorHidden,c]),A=r.useCallback(b=>{f.set("positionerElement",b)},[f]),Y=pe("div",e,{state:C,props:[R.props,ye(n),D],ref:[t,A],stateAttributesMapping:Oe});return V.jsxs(ke.Provider,{value:R,children:[O&&m===!0&&_!==U&&V.jsx(at,{ref:f.context.internalBackdropRef,inert:qe(!T),cutout:N}),V.jsx(ut,{id:M,children:Y})]})}),Nt={...Oe,...ze},zt=r.forwardRef(function(e,t){const{className:l,render:E,initialFocus:g,finalFocus:v,...k}=e,{store:s}=ee(),P=Dt(),i=Ct()!=null,a=s.useState("open"),L=s.useState("openMethod"),H=s.useState("instantType"),F=s.useState("transitionStatus"),u=s.useState("popupProps"),I=s.useState("titleElementId"),D=s.useState("descriptionElementId"),f=s.useState("modal"),B=s.useState("mounted"),M=s.useState("openChangeReason"),x=s.useState("activeTriggerElement"),O=s.useState("floatingRootContext");We({open:a,ref:s.context.popupRef,onComplete(){a&&s.context.onOpenChangeComplete?.(!0)}});const T=s.useState("disabled"),_=s.useState("openOnHover"),N=s.useState("closeDelay");Mt(O,{enabled:_&&!T,closeDelay:N});function m(S){return S==="touch"?s.context.popupRef.current:!0}const w=g===void 0?m:g,c=r.useMemo(()=>({open:a,side:P.side,align:P.align,instant:H,transitionStatus:F}),[a,P.side,P.align,H,F]),n=r.useCallback(S=>{s.set("popupElement",S)},[s]),y=pe("div",e,{state:c,ref:[t,s.context.popupRef,n],props:[u,{"aria-labelledby":I,"aria-describedby":D,onKeyDown(S){i&&ft.has(S.key)&&S.stopPropagation()}},ye(F),k],stateAttributesMapping:Nt});return V.jsx(lt,{context:O,openInteractionType:L,modal:f==="trap-focus",disabled:!B||M===U,initialFocus:w,returnFocus:v,restoreFocus:"popup",previousFocusableElement:$e(x)?x:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:y})});export{Xt as C,Kt as L,Ut as P,qt as a,Wt as b,$t as c,zt as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as S,aX as v,a as w,j as e,N as y}from"./main-BIY3Nj6I.js";import{u as k,w as j,s as l,L as N,x as C,S as E,h as I,i as R,C as T,j as L,k as A,l as P,m as _,o as D,n as G}from"./SelectItemText-C7F7eIm0.js";import{a as i,C as M}from"./useOpenInteractionType-BQhgq4rv.js";const O=S.forwardRef(function(s,o){const{className:n,render:f,...t}=s,{store:r,scrollHandlerRef:c}=k(),{alignItemWithTriggerActive:d}=j(),g=i(r,l.hasScrollArrows),u=i(r,l.openMethod),h=i(r,l.multiple),m={id:`${i(r,l.id)}-list`,role:"listbox","aria-multiselectable":h||void 0,onScroll(b){c.current?.(b.currentTarget)},...d&&{style:N},className:g&&u!=="touch"?C.className:void 0},x=v(b=>{r.set("listElement",b)});return w("div",s,{ref:[o,x],props:[m,t]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function H({value:p,onValueChange:s,options:o=[],ariaLabel:n,id:f,disabled:t=!1,leadingIcon:r=null,className:c="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=o.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:p,items:h,disabled:t,onValueChange:a=>{!t&&a!=null&&s?.(a)},children:[e.jsxs(I,{id:f,"aria-label":n,className:y(V,t&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",c),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r,e.jsx(R,{className:"truncate"})]}),e.jsx(T,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(A,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(P,{className:y("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(O,{role:"listbox","aria-label":n,children:o.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:m,disabled:x})=>y("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",m?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",x&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};
|