tokentracker-cli 0.34.0 → 0.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dashboard/dist/assets/ActivityHeatmap-HUG2wf_9.js +42 -0
  2. package/dashboard/dist/assets/{Card-aIQklHHp.js → Card-BRdnq8-k.js} +1 -1
  3. package/dashboard/dist/assets/DashboardPage-DJBZEynG.js +19 -0
  4. package/dashboard/dist/assets/{DevicePage-CuqXAWeG.js → DevicePage-BxCHzyu5.js} +1 -1
  5. package/dashboard/dist/assets/{DialogTitle-CNeoqAUd.js → DialogTitle-BF41YVn6.js} +1 -1
  6. package/dashboard/dist/assets/{FadeIn-DLCqO2k7.js → FadeIn-CsYsRptR.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-syBp0TMv.js → HeaderGithubStar-ZoIWfFe6.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-DSp8Gu3p.js → IpCheckPage-CXPYYQEu.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-CdUYfJX9.js → LandingPage-BfcwouBK.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-3zGkgsNt.js → LeaderboardAvatar-CGyaSA7g.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-QWHc3NdM.js → LeaderboardPage-BOQMyVRl.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-D0ylKDm1.js → LeaderboardProfileModal-CNWb6GZA.js} +1 -1
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-CIRXEzq9.js → LeaderboardProfilePage-BrkGee7P.js} +1 -1
  14. package/dashboard/dist/assets/{LimitsPage-BI6OZJ6Z.js → LimitsPage-DYzx9pp5.js} +1 -1
  15. package/dashboard/dist/assets/{LocalOnlyNotice-mpL0e0Yx.js → LocalOnlyNotice-BSlFMNhI.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-DKq55UDn.js → LoginPage-DTCO8G60.js} +1 -1
  17. package/dashboard/dist/assets/PopoverPopup-CAjthIuS.js +1 -0
  18. package/dashboard/dist/assets/{SettingsPage-SW_MynVy.js → SettingsPage-DDlD8qd9.js} +1 -1
  19. package/dashboard/dist/assets/SkillsPage-Cv0CQpGB.js +1 -0
  20. package/dashboard/dist/assets/{WidgetsPage-Bdz7-e2F.js → WidgetsPage-B56qFEsR.js} +1 -1
  21. package/dashboard/dist/assets/{WrappedPage-BuSh90dQ.js → WrappedPage-C9D-6P-R.js} +1 -1
  22. package/dashboard/dist/assets/{agent-logos-gEURrAhk.js → agent-logos-CJ4CQ0HE.js} +1 -1
  23. package/dashboard/dist/assets/{arrow-up-right-DnzcfcLH.js → arrow-up-right-OHDkhx-y.js} +1 -1
  24. package/dashboard/dist/assets/check-BcU6hhFb.js +1 -0
  25. package/dashboard/dist/assets/{chevron-down-A-Yd61uD.js → chevron-down-BVozhieG.js} +1 -1
  26. package/dashboard/dist/assets/{download-LO8eYKuM.js → download-BOwIFon2.js} +1 -1
  27. package/dashboard/dist/assets/{info-C4MiVPvD.js → info-BNlH8ZDr.js} +1 -1
  28. package/dashboard/dist/assets/{main-CmNjwZqb.js → main-BHU0hIWS.js} +2 -2
  29. package/dashboard/dist/assets/{use-limits-display-prefs-DWRnMoYm.js → use-limits-display-prefs-mPyTqsYR.js} +1 -1
  30. package/dashboard/dist/assets/{use-native-settings-6QINkSUb.js → use-native-settings-DbaL1Woo.js} +1 -1
  31. package/dashboard/dist/assets/{use-usage-limits-DRceo1gm.js → use-usage-limits-CUlVKjou.js} +1 -1
  32. package/dashboard/dist/assets/{useCurrency-OWcFD7bX.js → useCurrency-B70A0cjV.js} +1 -1
  33. package/dashboard/dist/index.html +1 -1
  34. package/dashboard/dist/share.html +1 -1
  35. package/package.json +1 -1
  36. package/src/lib/pricing/seed-snapshot.json +1 -1
  37. package/dashboard/dist/assets/ActivityHeatmap-B4zB8pSl.js +0 -42
  38. package/dashboard/dist/assets/DashboardPage-Cgy94Hkz.js +0 -19
  39. package/dashboard/dist/assets/PopoverPopup-hv91V5bk.js +0 -1
  40. package/dashboard/dist/assets/SkillsPage-DteFqehH.js +0 -1
  41. package/dashboard/dist/assets/check-CGdPUCWD.js +0 -1
@@ -1 +1 @@
1
- import{R as l,j as c,N as h}from"./main-CmNjwZqb.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};
1
+ import{R as l,j as c,M as h}from"./main-BHU0hIWS.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};
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-D0ylKDm1.js","assets/main-CmNjwZqb.js","assets/main-Ctn8FyBC.css","assets/useCurrency-OWcFD7bX.js","assets/LeaderboardAvatar-3zGkgsNt.js","assets/ActivityHeatmap-B4zB8pSl.js","assets/info-C4MiVPvD.js","assets/arrow-up-right-DnzcfcLH.js","assets/check-CGdPUCWD.js","assets/DialogTitle-CNeoqAUd.js"])))=>i.map(i=>d[i]);
2
- import{c as Qr,r as i,R as re,M as qe,j as l,N as L,A as y,ak as en,al as tn,O as rn,Q as nn,am as on,i as an,f as sn,an as ln,ao as cn,ap as Et,V as dn,aq as un,m as fn,P as gn,L as hn,D as bn,a6 as kr,B as pn,ar as mn,as as xn,at as Qt,au as vn,_ as yn,E as wn}from"./main-CmNjwZqb.js";import{u as kn}from"./useCurrency-OWcFD7bX.js";import{L as Lt}from"./LeaderboardAvatar-3zGkgsNt.js";import{C as Sn}from"./chevron-down-A-Yd61uD.js";const Nn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Cn=Qr("arrow-right",Nn);function Rn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.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 Wt(e){return"nodeType"in e}function ne(e){var t,r;return e?$e(e)?e:Wt(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Xt(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:Wt(e)?Xt(e)?e:at(e)||Sr(e)?e.ownerDocument:document:document:document}const we=Nt?i.useLayoutEffect:i.useEffect;function Ht(e){const t=i.useRef(e);return we(()=>{t.current=e}),i.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 Dn(){const e=i.useRef(null),t=i.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=i.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function et(e,t){t===void 0&&(t=[e]);const r=i.useRef(e);return we(()=>{r.current!==e&&(r.current=e)},t),r}function it(e,t){const r=i.useRef();return i.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function vt(e){const t=Ht(e),r=i.useRef(null),n=i.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Ot(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let Mt={};function st(e,t){return i.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,s)=>{const c=Object.entries(s);for(const[d,u]of c){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=Nr(1),tt=Nr(-1);function jn(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 En(e){if(!e)return!1;const{TouchEvent:t}=ne(e.target);return t&&e instanceof t}function Pt(e){if(En(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 jn(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 Mn(e){return e.matches(er)?e:e.querySelector(er)}const _n={display:"none"};function An(e){let{id:t,value:r}=e;return re.createElement("div",{id:t,style:_n},r)}function In(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 Tn(){const[e,t]=i.useState("");return{announce:i.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Cr=i.createContext(null);function Ln(e){const t=i.useContext(Cr);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function On(){const[e]=i.useState(()=>new Set),t=i.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[i.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,a)})},[e]),t]}const Pn={draggable:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-CNWb6GZA.js","assets/main-BHU0hIWS.js","assets/main-Ctn8FyBC.css","assets/useCurrency-B70A0cjV.js","assets/LeaderboardAvatar-CGyaSA7g.js","assets/ActivityHeatmap-HUG2wf_9.js","assets/info-BNlH8ZDr.js","assets/arrow-up-right-OHDkhx-y.js","assets/check-BcU6hhFb.js","assets/DialogTitle-BF41YVn6.js"])))=>i.map(i=>d[i]);
2
+ import{c as Qr,r as i,R as re,aj as qe,j as l,M as L,A as y,ak as en,al as tn,N as rn,O as nn,am as on,i as an,f as sn,an as ln,ao as cn,ap as Et,U as dn,aq as un,m as fn,P as gn,L as hn,D as bn,a5 as kr,B as pn,ar as mn,as as xn,at as Qt,au as vn,_ as yn,E as wn}from"./main-BHU0hIWS.js";import{u as kn}from"./useCurrency-B70A0cjV.js";import{L as Lt}from"./LeaderboardAvatar-CGyaSA7g.js";import{C as Sn}from"./chevron-down-BVozhieG.js";const Nn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Cn=Qr("arrow-right",Nn);function Rn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.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 Wt(e){return"nodeType"in e}function ne(e){var t,r;return e?$e(e)?e:Wt(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Xt(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:Wt(e)?Xt(e)?e:at(e)||Sr(e)?e.ownerDocument:document:document:document}const we=Nt?i.useLayoutEffect:i.useEffect;function Ht(e){const t=i.useRef(e);return we(()=>{t.current=e}),i.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 Dn(){const e=i.useRef(null),t=i.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=i.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function et(e,t){t===void 0&&(t=[e]);const r=i.useRef(e);return we(()=>{r.current!==e&&(r.current=e)},t),r}function it(e,t){const r=i.useRef();return i.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function vt(e){const t=Ht(e),r=i.useRef(null),n=i.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Ot(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let Mt={};function st(e,t){return i.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,s)=>{const c=Object.entries(s);for(const[d,u]of c){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=Nr(1),tt=Nr(-1);function jn(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 En(e){if(!e)return!1;const{TouchEvent:t}=ne(e.target);return t&&e instanceof t}function Pt(e){if(En(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 jn(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 Mn(e){return e.matches(er)?e:e.querySelector(er)}const _n={display:"none"};function An(e){let{id:t,value:r}=e;return re.createElement("div",{id:t,style:_n},r)}function In(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 Tn(){const[e,t]=i.useState("");return{announce:i.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Cr=i.createContext(null);function Ln(e){const t=i.useContext(Cr);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function On(){const[e]=i.useState(()=>new Set),t=i.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[i.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,a)})},[e]),t]}const Pn={draggable:`
3
3
  To pick up a draggable item, press the space bar.
4
4
  While dragging, use the arrow keys to move the item.
5
5
  Press space again to drop the item in its new position, or press escape to cancel.
6
- `},zn={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 Bn(e){let{announcements:t=zn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Pn}=e;const{announce:a,announcement:s}=Tn(),c=st("DndLiveRegion"),[d,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),Ln(i.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(An,{id:n,value:o.draggable}),re.createElement(In,{id:c,announcement:s}));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 i.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Kn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.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 $n(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 Fn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=nr(t,t.left,t.top),a=[];for(const s of n){const{id:c}=s,d=r.get(c);if(d){const u=Rr(nr(d),o);a.push({id:c,data:{droppableContainer:s,value:u}})}}return a.sort(Dr)},Un=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t),a=[];for(const s of n){const{id:c}=s,d=r.get(c);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:c,data:{droppableContainer:s,value:f}})}}return a.sort(Dr)};function Yn(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),s=o-n,c=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=s*c,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const Wn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,c=r.get(s);if(c){const d=Yn(c,t);d>0&&o.push({id:s,data:{droppableContainer:a,value:d}})}}return o.sort($n)};function Xn(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 Hn(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((s,c)=>({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...r})}}const Gn=Hn(1);function Vn(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 qn(e,t,r){const n=Vn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:c}=n,d=e.left-s-(1-o)*parseFloat(r),u=e.top-c-(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 Jn={ignoreTransform:!1};function Ue(e,t){t===void 0&&(t=Jn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=ne(e).getComputedStyle(e);u&&(r=qn(r,u,g))}const{top:n,left:o,width:a,height:s,bottom:c,right:d}=r;return{top:n,left:o,width:a,height:s,bottom:c,right:d}}function or(e){return Ue(e,{ignoreTransform:!0})}function Zn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Qn(e,t){return t===void 0&&(t=ne(e).getComputedStyle(e)),t.position==="fixed"}function eo(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(Xt(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&&eo(o,a)&&r.push(o),Qn(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:Wt(e)?Xt(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,s=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:c,maxScroll:n,minScroll:t}}const to={x:.2,y:.2};function ro(e,t,r,n,o){let{top:a,left:s,right:c,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=to);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&&c>=t.right-m.width?(b.x=F.Forward,w.x=n*Math.abs((t.right-m.width-c)/m.width)):!f&&s<=t.left+m.width&&(b.x=F.Backward,w.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:b,speed:w}}function no(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}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 oo(e){return e.reduce((t,r)=>t+_r(r),0)}function ao(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 so=[["x",["left","right"],oo],["y",["top","bottom"],ao]];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,s,c]of so)for(const d of s)Object.defineProperty(this,d,{get:()=>{const u=c(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 lo(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 fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function ar(e){e.preventDefault()}function co(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]},uo=(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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.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:s=uo,scrollBehavior:c="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=s(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=no(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:c});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:c});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:c});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:c});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:s}=e.nativeEvent;if(n.start.includes(s)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ir(e){return!!(e&&"distance"in e)}function sr(e){return!!(e&&"delay"in e)}class Jt{constructor(t,r,n){var o;n===void 0&&(n=lo(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:s}=a;this.props=t,this.events=r,this.document=Fe(s),this.documentListeners=new Je(this.document),this.listeners=new Je(n),this.windowListeners=new Je(ne(s)),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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,ar),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,ar),this.documentListeners.add(fe.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(sr(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(ir(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(fe.Click,co,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:c}}=a;if(!o)return;const d=(r=Pt(t))!=null?r:me,u=tt(o,d);if(!n&&c){if(ir(c)){if(c.tolerance!=null&&At(u,c.tolerance))return this.handleCancel();if(At(u,c.distance))return this.handleStart()}if(sr(c)&&At(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),s(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 fo={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,fo,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 go={move:{name:"mousemove"},end:{name:"mouseup"}};var Bt;(function(e){e[e.RightClick=2]="RightClick"})(Bt||(Bt={}));class ho extends Jt{constructor(t){super(t,go,Fe(t.event.target))}}ho.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 bo 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(){}}}bo.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 po(e){let{acceleration:t,activator:r=Ze.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:c=wt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=xo({delta:f,disabled:!a}),[w,m]=Dn(),x=i.useRef({x:0,y:0}),k=i.useRef({x:0,y:0}),S=i.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=i.useRef(null),C=i.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)},[]),_=i.useMemo(()=>c===wt.TreeOrder?[...u].reverse():u,[c,u]);i.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}=ro(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,s),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,s,JSON.stringify(S),JSON.stringify(b),w,u,_,g,JSON.stringify(p)])}const mo={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function xo(e){let{delta:t,disabled:r}=e;const n=Ot(t);return it(o=>{if(r||!n||!o)return mo;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 vo(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return it(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function yo(e,t){return i.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.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 wo(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=i.useState(null),{frequency:c,measure:d,strategy:u}=o,g=i.useRef(e),f=x(),p=et(f),b=i.useCallback(function(k){k===void 0&&(k=[]),!p.current&&s(S=>S===null?k:S.concat(k.filter(v=>!S.includes(v))))},[p]),w=i.useRef(null),m=it(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 i.useEffect(()=>{g.current=e},[e]),i.useEffect(()=>{f||b()},[r,f]),i.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),i.useEffect(()=>{f||typeof c!="number"||w.current!==null||(w.current=setTimeout(()=>{b(),w.current=null},c))},[c,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 it(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ko(e,t){return Pr(e,t)}function So(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function Rt(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function No(e){return new Vt(Ue(e),e)}function cr(e,t,r){t===void 0&&(t=No);const[n,o]=i.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 s=So({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}}}}),c=Rt({callback:a});return we(()=>{a(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),n}function Co(e){const t=Pr(e);return Er(e,t)}const dr=[];function Ro(e){const t=i.useRef(e),r=it(n=>e?n&&n!==dr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ct(e):dr,[e]);return i.useEffect(()=>{t.current=e},[e]),r}function Do(e){const[t,r]=i.useState(null),n=i.useRef(e),o=i.useCallback(a=>{const s=_t(a.target);s&&r(c=>c?(c.set(s,zt(s)),new Map(c)):null)},[]);return i.useEffect(()=>{const a=n.current;if(e!==a){s(a);const c=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,zt(u)]):null}).filter(d=>d!=null);r(c.length?new Map(c):null),n.current=e}return()=>{s(e),s(a)};function s(c){c.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Ke(a,s),me):Lr(e):me,[e,t])}function ur(e,t){t===void 0&&(t=[]);const r=i.useRef(null);return i.useEffect(()=>{r.current=null},t),i.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 jo(e){i.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 Eo(e,t){return i.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function zr(e){return i.useMemo(()=>e?Zn(e):null,[e])}const fr=[];function Mo(e,t){t===void 0&&(t=Ue);const[r]=e,n=zr(r?ne(r):null),[o,a]=i.useState(fr);function s(){a(()=>e.length?e.map(d=>Ir(d)?n:new Vt(t(d),d)):fr)}const c=Rt({callback:s});return we(()=>{c?.disconnect(),s(),e.forEach(d=>c?.observe(d))},[e]),o}function _o(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return at(t)?t:e}function Ao(e){let{measure:t}=e;const[r,n]=i.useState(null),o=i.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}),s=i.useCallback(u=>{const g=_o(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[c,d]=vt(s);return i.useMemo(()=>({nodeRef:c,rect:r,setRef:d}),[r,c,d])}const Io=[{sensor:Zt,options:{}},{sensor:qt,options:{}}],To={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 Lo={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},Oo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Dt=i.createContext(Oo),Br=i.createContext(Lo);function Po(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qe}}}function zo(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 s=new Qe(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}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 Bo(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=i.useContext(Dt),a=Ot(n),s=Ot(r?.id);return i.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!Gt(a)||document.activeElement===a.target)return;const c=o.get(s);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=Mn(g);if(f){f.focus();break}}})}},[n,t,o,s,a]),null}function Ko(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function $o(e){return i.useMemo(()=>({draggable:{...xt.draggable,...e?.draggable},droppable:{...xt.droppable,...e?.droppable},dragOverlay:{...xt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fo(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=i.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;we(()=>{if(!s&&!c||!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(s||(f.x=0),c||(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,s,c,n,r])}const Kr=i.createContext({...me,scaleX:1,scaleY:1});var Ie;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ie||(Ie={}));const Uo=i.memo(function(t){var r,n,o,a;let{id:s,accessibility:c,autoScroll:d=!0,children:u,sensors:g=Io,collisionDetection:f=Wn,measuring:p,modifiers:b,...w}=t;const m=i.useReducer(zo,void 0,Po),[x,k]=m,[S,v]=On(),[C,_]=i.useState(Ie.Uninitialized),R=C===Ie.Initialized,{draggable:{active:N,nodes:D,translate:P},droppable:{containers:I}}=x,j=N!=null?D.get(N):null,oe=i.useRef({initial:null,translated:null}),Z=i.useMemo(()=>{var B;return N!=null?{id:N,data:(B=j?.data)!=null?B:To,rect:oe}:null},[N,j]),ae=i.useRef(null),[ke,Pe]=i.useState(null),[V,Te]=i.useState(null),ge=et(w,Object.values(w)),Le=st("DndDescribedBy",s),ze=i.useMemo(()=>I.getEnabled(),[I]),U=$o(p),{droppableRects:ce,measureDroppableContainers:K,measuringScheduled:Oe}=wo(ze,{dragging:R,dependencies:[P.x,P.y],config:U.droppable}),Y=vo(D,N),he=i.useMemo(()=>V?Pt(V):null,[V]),T=Me(),q=ko(Y,U.draggable.measure);Fo({activeNode:N!=null?D.get(N):null,config:T.layoutShiftCompensation,initialRect:q,measure:U.draggable.measure});const M=cr(Y,U.draggable.measure,q),Se=cr(Y?Y.parentElement:null),O=i.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),W=I.getNodeFor((r=O.current.over)==null?void 0:r.id),Q=Ao({measure:U.dragOverlay.measure}),De=(n=Q.nodeRef.current)!=null?n:Y,ie=R?(o=Q.rect)!=null?o:M:null,lt=!!(Q.nodeRef.current&&Q.rect),Ye=Co(lt?null:M),Be=zr(De?ne(De):null),be=Ro(R?W??Y:null),de=Mo(be),Ne=Ko(b,{transform:{x:P.x-Ye.x,y:P.y-Ye.y,scaleX:1,scaleY:1},activatorEvent:V,active:Z,activeNodeRect:M,containerNodeRect:Se,draggingNodeRect:ie,over:O.current.over,overlayNodeRect:Q.rect,scrollableAncestors:be,scrollableAncestorRects:de,windowRect:Be}),ct=he?Ke(he,P):null,We=Do(be),dt=ur(We),ut=ur(We,[M]),Ce=Ke(Ne,dt),xe=ie?Gn(ie,Ne):null,ue=Z&&xe?f({active:Z,collisionRect:xe,droppableRects:ce,droppableContainers:ze,pointerCoordinates:ct}):null,ft=jr(ue,"id"),[ve,gt]=i.useState(null),ht=lt?Ne:Ke(Ne,ut),bt=Xn(ht,(a=ve?.rect)!=null?a:null,M),je=i.useRef(null),Ee=i.useCallback((B,J)=>{let{sensor:z,options:ee}=J;if(ae.current==null)return;const se=D.get(ae.current);if(!se)return;const te=B.nativeEvent,le=new z({active:ae.current,activeNode:se,event:te,options:ee,context:O,onAbort(X){if(!D.get(X))return;const{onDragAbort:ye}=ge.current,Re={id:X};ye?.(Re),S({type:"onDragAbort",event:Re})},onPending(X,_e,ye,Re){if(!D.get(X))return;const{onDragPending:Ge}=ge.current,Ae={id:X,constraint:_e,initialCoordinates:ye,offset:Re};Ge?.(Ae),S({type:"onDragPending",event:Ae})},onStart(X){const _e=ae.current;if(_e==null)return;const ye=D.get(_e);if(!ye)return;const{onDragStart:Re}=ge.current,He={activatorEvent:te,active:{id:_e,data:ye.data,rect:oe}};qe.unstable_batchedUpdates(()=>{Re?.(He),_(Ie.Initializing),k({type:$.DragStart,initialCoordinates:X,active:_e}),S({type:"onDragStart",event:He}),Pe(je.current),Te(te)})},onMove(X){k({type:$.DragMove,coordinates:X})},onEnd:G($.DragEnd),onCancel:G($.DragCancel)});je.current=le;function G(X){return async function(){const{active:ye,collisions:Re,over:He,scrollAdjustedTranslate:Ge}=O.current;let Ae=null;if(ye&&Ge){const{cancelDrop:Ve}=ge.current;Ae={activatorEvent:te,active:ye,collisions:Re,delta:Ge,over:He},X===$.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Ae))&&(X=$.DragCancel)}ae.current=null,qe.unstable_batchedUpdates(()=>{k({type:X}),_(Ie.Uninitialized),gt(null),Pe(null),Te(null),je.current=null;const Ve=X===$.DragEnd?"onDragEnd":"onDragCancel";if(Ae){const jt=ge.current[Ve];jt?.(Ae),S({type:Ve,event:Ae})}})}}},[D]),Xe=i.useCallback((B,J)=>(z,ee)=>{const se=z.nativeEvent,te=D.get(ee);if(ae.current!==null||!te||se.dndKit||se.defaultPrevented)return;const le={active:te};B(z,J.options,le)===!0&&(se.dndKit={capturedBy:J.sensor},ae.current=ee,Ee(z,J))},[D,Ee]),h=yo(g,Xe);jo(g),we(()=>{M&&C===Ie.Initializing&&_(Ie.Initialized)},[M,C]),i.useEffect(()=>{const{onDragMove:B}=ge.current,{active:J,activatorEvent:z,collisions:ee,over:se}=O.current;if(!J||!z)return;const te={active:J,activatorEvent:z,collisions:ee,delta:{x:Ce.x,y:Ce.y},over:se};qe.unstable_batchedUpdates(()=>{B?.(te),S({type:"onDragMove",event:te})})},[Ce.x,Ce.y]),i.useEffect(()=>{const{active:B,activatorEvent:J,collisions:z,droppableContainers:ee,scrollAdjustedTranslate:se}=O.current;if(!B||ae.current==null||!J||!se)return;const{onDragOver:te}=ge.current,le=ee.get(ft),G=le&&le.rect.current?{id:le.id,rect:le.rect.current,data:le.data,disabled:le.disabled}:null,X={active:B,activatorEvent:J,collisions:z,delta:{x:se.x,y:se.y},over:G};qe.unstable_batchedUpdates(()=>{gt(G),te?.(X),S({type:"onDragOver",event:X})})},[ft]),we(()=>{O.current={activatorEvent:V,active:Z,activeNode:Y,collisionRect:xe,collisions:ue,droppableRects:ce,draggableNodes:D,draggingNode:De,draggingNodeRect:ie,droppableContainers:I,over:ve,scrollableAncestors:be,scrollAdjustedTranslate:Ce},oe.current={initial:ie,translated:xe}},[Z,Y,ue,xe,D,De,ie,ce,I,ve,be,Ce]),po({...T,delta:P,draggingRect:xe,pointerCoordinates:ct,scrollableAncestors:be,scrollableAncestorRects:de});const A=i.useMemo(()=>({active:Z,activeNode:Y,activeNodeRect:M,activatorEvent:V,collisions:ue,containerNodeRect:Se,dragOverlay:Q,draggableNodes:D,droppableContainers:I,droppableRects:ce,over:ve,measureDroppableContainers:K,scrollableAncestors:be,scrollableAncestorRects:de,measuringConfiguration:U,measuringScheduled:Oe,windowRect:Be}),[Z,Y,M,V,ue,Se,Q,D,I,ce,ve,K,be,de,U,Oe,Be]),H=i.useMemo(()=>({activatorEvent:V,activators:h,active:Z,activeNodeRect:M,ariaDescribedById:{draggable:Le},dispatch:k,draggableNodes:D,over:ve,measureDroppableContainers:K}),[V,h,Z,M,k,Le,D,ve,K]);return re.createElement(Cr.Provider,{value:v},re.createElement(Dt.Provider,{value:H},re.createElement(Br.Provider,{value:A},re.createElement(Kr.Provider,{value:bt},u)),re.createElement(Bo,{disabled:c?.restoreFocus===!1})),re.createElement(Bn,{...c,hiddenTextDescribedById:Le}));function Me(){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}}}),Yo=i.createContext(null),gr="button",Wo="Draggable";function Xo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=st(Wo),{activators:s,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=i.useContext(Dt),{role:b=gr,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=d?.id===t,k=i.useContext(x?Kr:Yo),[S,v]=vt(),[C,_]=vt(),R=Eo(s,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=i.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:c,activeNodeRect:u,attributes:D,isDragging:x,listeners:n?void 0:R,node:S,over:p,setNodeRef:v,setActivatorNodeRef:_,transform:k}}function Ho(){return i.useContext(Br)}const Go="Droppable",Vo={timeout:25};function qo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=st(Go),{active:s,dispatch:c,over:d,measureDroppableContainers:u}=i.useContext(Dt),g=i.useRef({disabled:r}),f=i.useRef(!1),p=i.useRef(null),b=i.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={...Vo,...o},k=et(m??n),S=i.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||!s}),C=i.useCallback((D,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),D&&v.observe(D))},[v]),[_,R]=vt(C),N=et(t);return i.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),i.useEffect(()=>(c({type:$.RegisterDroppable,element:{id:n,key:a,disabled:r,node:_,rect:p,data:N}}),()=>c({type:$.UnregisterDroppable,key:a,id:n})),[n]),i.useEffect(()=>{r!==g.current.disabled&&(c({type:$.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,c]),{active:s,rect:p,isOver:d?.id===n,node:_,over:d,setNodeRef:R}}const Jo=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 Zo(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 Qo(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 ea(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const mt={scaleX:1,scaleY:1},ta=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:s}=e;const c=(t=r[o])!=null?t:n;if(!c)return null;const d=ra(r,s,o);if(s===o){const u=r[a];return u?{x:o<a?u.left+u.width-(c.left+c.width):u.left-c.left,y:0,...mt}:null}return s>o&&s<=a?{x:-c.width-d,y:0,...mt}:s<o&&s>=a?{x:c.width+d,y:0,...mt}:{x:0,y:0,...mt}};function ra(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),s=t[o],c=a[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.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 na(e){let{children:t,id:r,items:n,strategy:o=Fr,disabled:a=!1}=e;const{active:s,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:g}=Ho(),f=st(Ur,r),p=c.rect!==null,b=i.useMemo(()=>n.map(R=>typeof R=="object"&&"id"in R?R.id:R),[n]),w=s!=null,m=s?b.indexOf(s.id):-1,x=u?b.indexOf(u.id):-1,k=i.useRef(b),S=!Qo(b,k.current),v=x!==-1&&m===-1||S,C=ea(a);we(()=>{S&&w&&g(b)},[S,b,w,g]),i.useEffect(()=>{k.current=b},[b]);const _=i.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Zo(b,d),strategy:o}),[m,f,C.draggable,C.droppable,v,b,x,d,p,o]);return re.createElement(Yr.Provider,{value:_},t)}const oa=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return $r(r,n,o).indexOf(t)},aa=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!n||c!==a&&o===s?!1:r?!0:s!==o&&t===d},ia={duration:200,easing:"ease"},Wr="transform",sa=rt.Transition.toString({property:Wr,duration:0,easing:"linear"}),la={roleDescription:"sortable"};function ca(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=i.useState(null),c=i.useRef(r);return we(()=>{if(!t&&r!==c.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)&&s(g)}}r!==c.current&&(c.current=r)},[t,r,n,o]),i.useEffect(()=>{a&&s(null)},[a]),a}function da(e){let{animateLayoutChanges:t=aa,attributes:r,disabled:n,data:o,getNewIndex:a=oa,id:s,strategy:c,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}=i.useContext(Yr),v=ua(n,b),C=g.indexOf(s),_=i.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),R=i.useMemo(()=>g.slice(g.indexOf(s)),[g,s]),{rect:N,node:D,isOver:P,setNodeRef:I}=qo({id:s,data:_,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:j,activatorEvent:oe,activeNodeRect:Z,attributes:ae,setNodeRef:ke,listeners:Pe,isDragging:V,over:Te,setActivatorNodeRef:ge,transform:Le}=Xo({id:s,data:_,attributes:{...la,...r},disabled:v.draggable}),ze=Rn(I,ke),U=!!j,ce=U&&!w&&pt(p)&&pt(x),K=!k&&V,Oe=K&&ce?Le:null,he=ce?Oe??(c??S)({rects:m,activeNodeRect:Z,activeIndex:p,overIndex:x,index:C}):null,T=pt(p)&&pt(x)?a({id:s,items:g,activeIndex:p,overIndex:x}):C,q=j?.id,M=i.useRef({activeId:q,items:g,newIndex:T,containerId:f}),Se=g!==M.current.items,O=t({active:j,containerId:f,isDragging:V,isSorting:U,id:s,index:C,items:g,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),W=ca({disabled:!O,index:C,node:D,rect:N});return i.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]),i.useEffect(()=>{if(q===M.current.activeId)return;if(q&&!M.current.activeId){M.current.activeId=q;return}const De=setTimeout(()=>{M.current.activeId=q},50);return()=>clearTimeout(De)},[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:Te,setNodeRef:ze,setActivatorNodeRef:ge,setDroppableNodeRef:I,setDraggableNodeRef:ke,transform:W??he,transition:Q()};function Q(){if(W||Se&&M.current.newIndex===C)return sa;if(!(K&&!Gt(oe)||!u)&&(U||O))return rt.Transition.toString({...u,property:Wr})}}function ua(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 fa=[E.Down,E.Right,E.Up,E.Left],ga=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:c}}=t;if(fa.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=Un({collisionRect:n,droppableRects:o,droppableContainers:d});let g=jr(u,"id");if(g===s?.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)=>c[N]!==R),k=Xr(f,p),S=ha(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 Xr(e,t){return!kt(e)||!kt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ha(e,t){return!kt(e)||!kt(t)||!Xr(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 ba(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),s=[];let c=null;for(const d of a)c!=null&&d-c>1&&s.push(null),s.push(d),c=d;return s}function pa({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,s=r?o<n:!0;return{canPrev:a,canNext:s,safePage:o,safeTotal:n}}function ma({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(s=>!!s?.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 xa(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 va=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function ya({iconSrc:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?l.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${va.has(e)?"dark:invert":""}`}):null,l.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}],Hr="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 l.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function wa({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 l.jsxs("tr",{className:"group",children:[l.jsx("td",{className:L($t(!1),"!group-hover:bg-transparent"),children:l.jsx(pe,{className:"h-4 w-6"})}),l.jsx("td",{className:L(Ft(!1),"!group-hover:bg-transparent"),children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(pe,{className:"h-8 w-8 min-w-8 rounded-full"}),l.jsx(pe,{className:L("h-4",t)})]})}),l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(pe,{className:L("h-4",r)})}),l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(pe,{className:"h-4 w-12"})}),St.map(o=>l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(pe,{className:L("h-4",n)})},o.key))]})}function ka({rows:e=10}){return l.jsx("div",{className:"w-full overflow-x-auto",children:l.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[l.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:L(Hr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(pe,{className:"h-3.5 w-6"})}),l.jsx("th",{className:L(Gr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(pe,{className:"h-3.5 w-12"})}),l.jsx("th",{className:"px-4 py-4",children:l.jsx(pe,{className:"h-3.5 w-10"})}),l.jsx("th",{className:"px-4 py-4",children:l.jsx(pe,{className:"h-3.5 w-14"})}),St.map(t=>l.jsx("th",{className:"px-4 py-4",children:l.jsx(pe,{className:"h-3.5 w-12"})},t.key))]})}),l.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,r)=>l.jsx(wa,{index:r},r))})]})})}function Sa({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:s,transition:c,isDragging:d}=da({id:e}),u=rt.Transform.toString(s)||"";i.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=c||"",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,c,d]);const g={transform:u,transition:c,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 l.jsx("th",{ref:a,style:g,className:L(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...o,children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.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:l.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[l.jsx("circle",{cx:"2",cy:"2",r:"1"}),l.jsx("circle",{cx:"6",cy:"2",r:"1"}),l.jsx("circle",{cx:"2",cy:"7",r:"1"}),l.jsx("circle",{cx:"6",cy:"7",r:"1"}),l.jsx("circle",{cx:"2",cy:"12",r:"1"}),l.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),r]})})}const Vr="tokentracker.leaderboard.columnOrder.v1";function Na(){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 Ca(e){const t=i.useMemo(()=>e.join("|"),[e]),[r,n]=i.useState(()=>hr(Na(),e));i.useEffect(()=>{n(s=>{const c=hr(s,e);return c.length===s.length&&c.every((u,g)=>u===s[g])?s:(Tt(c),c)})},[t,e]);const o=i.useCallback((s,c)=>{!s||!c||s===c||n(d=>{const u=d.indexOf(s),g=d.indexOf(c);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=i.useCallback(()=>{Tt(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function Ra(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 Da(e){const t=qr(e);return t?t.toLowerCase()==="anonymous":!0}function ja({me:e,totalEntries:t,meLabel:r,onOpenProfile:n,onJumpToMe:o,canJump:a,className:s}){const c=e&&typeof e.rank=="number"?e.rank:null;if(!c)return null;const d=Number(t)||0,u=Ra(c,d),g=qr(e?.display_name),f=!g||Da(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 l.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]",s),children:[l.jsx(Lt,{size:"sm",avatarUrl:e?.avatar_url,displayName:f,seed:p}),l.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}),l.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",c.toLocaleString()]}),u!=null&&l.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?l.jsx(Cn,{"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"}):l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),l.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const Ea=i.lazy(()=>yn(()=>import("./LeaderboardProfileModal-D0ylKDm1.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 Ma(){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=pn(t),a=t===wn?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 l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:bn(e)}),l.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=>l.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 _a={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=_a[e];return r?l.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}):l.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 Aa(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 Ia(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 l.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[l.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:l.jsx(gn,{provider:"GITHUB",size:16})}),l.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:[l.jsx("span",{className:"block",children:y("leaderboard.github.tooltipAction")}),l.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[y("leaderboard.github.tooltipPrefix")," ",l.jsx(hn,{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 za({auth:e,signedIn:t,sessionSoftExpired:r}){const n=en(),o=tn(),{openLoginModal:a}=rn(),{signedIn:s,loading:c,user:d}=nn(),{currency:u,rate:g}=kn(),f=i.useMemo(()=>on(),[]),p=an(),b=t&&!r,w=i.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=i.useMemo(()=>St.map(h=>h.key),[]),{order:v,reorder:C}=Ca(S),_=i.useMemo(()=>{const h=new Map;for(const A of St)h.set(A.key,A);return h},[]),R=i.useMemo(()=>v.map(h=>_.get(h)).filter(Boolean),[v,_]),N=Kn(tr(Zt,{activationConstraint:{distance:6}}),tr(qt,{coordinateGetter:ga})),D=i.useCallback(h=>{const{active:A,over:H}=h;!H||A.id===H.id||C(String(A.id),String(H.id))},[C]),[P,I]=i.useState(1),[j,oe]=i.useState(Ma),[Z,ae]=i.useState(null),ke=i.useCallback(h=>{typeof h=="string"&&h.trim()&&ae(h.trim())},[]),Pe=i.useCallback(()=>ae(null),[]),V=i.useCallback(h=>{const A=Ut.includes(h)?h:Yt;oe(A),I(1);try{window.localStorage.setItem(Jr,String(A))}catch{}},[]),[Te,ge]=i.useState(0),[Le,ze]=i.useState(()=>ln()),[U,ce]=i.useState(!1),K=i.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 H=new URLSearchParams(n?.search||"");H.set("period",A),I(1),o(`${n?.pathname||"/leaderboard"}?${H.toString()}`,{replace:!0})};i.useEffect(()=>{c||p||s||a()},[s,c,p,a]),i.useEffect(()=>{I(1)},[K]);const Y=i.useMemo(()=>(ot(P,{min:1,max:1e6,fallback:1})-1)*j,[P,j]),he=i.useMemo(()=>p?"mock":c?"unavailable":s?"cloud":t?"local":f?"public":"unavailable",[c,s,f,p,t]),T=i.useMemo(()=>cn({accessMode:he,baseUrl:f,mockEnabled:p,userId:d?.id||null,period:K,pageSize:j,offset:Y}),[d?.id,he,f,Y,p,j,K]),[q,M]=i.useState(()=>{const h=Et(T);return h?{loading:!1,error:null,data:h.data,contextKey:T}:{loading:!1,error:null,data:null,contextKey:null}});i.useEffect(()=>{if(!f&&!p||!p&&he==="unavailable"){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 H=await dn({userId:d?.id||null,period:K,limit:j,offset:Y});A&&(un(H,{activeContextKey:T,contextKey:T,source:Te>0?"manual-refresh":"page-load"}),M({loading:!1,error:null,data:H,contextKey:T}))})().catch(H=>{if(!A)return;const Me=Aa(H);M(B=>B.contextKey===T?{...B,loading:!1,error:Me}:{loading:!1,error:Me,data:null,contextKey:T})}),()=>{A=!1}},[f,he,d?.id,T,Y,Te,p,K,j]);const Se=i.useMemo(()=>q.contextKey===T?null:Et(T),[T,q.contextKey]),O=i.useMemo(()=>q.contextKey===T?q:Se?{loading:!1,error:null,data:Se.data,contextKey:T}:{loading:!!(f||p)&&he!=="unavailable",error:null,data:null,contextKey:T},[he,f,T,q,p,Se]),W=O.data,Q=W?.total_pages??null,De=W?.total_entries??0,ie=W?.page??P,lt=i.useMemo(()=>ba(ie,Q),[ie,Q]),Ye=W?.from||null,Be=W?.to||null,be=W?.generated_at||null,de=W?.me||null,Ne=y("leaderboard.me_label"),ct=y("leaderboard.anon_label"),We=y("leaderboard.period.week"),dt=y("leaderboard.period.month"),ut=y("leaderboard.period.total"),Ce=K==="month"?dt:K==="total"?ut:We,xe=i.useMemo(()=>{const h=Array.isArray(W?.entries)?W.entries:[];return ma({entries:h,me:de,meLabel:Ne})},[W?.entries,de,Ne]),ue=i.useMemo(()=>xa(de?.rank,j),[de?.rank,j]),ft=ue!=null&&ue===ie,ve=i.useCallback(()=>{ue!=null&&I(ue)},[ue]),gt=async()=>{ce(!0);try{mn(!0),ze(!0),await xn(()=>Qt(m));const h=await Qt(m);h&&await vn({accessToken:h,period:K,source:"leaderboard-enable-sync"}),ge(A=>A+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ce(!1)}},{canPrev:ht,canNext:bt}=pa({page:ie,totalPages:Q}),je=Array.isArray(xe)&&xe.length!==0;let Ee=null;O.loading&&!je?Ee=l.jsx(ka,{rows:j}):O.error&&!je?Ee=l.jsx("div",{className:"px-6 py-12 text-center",children:l.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):je?Ee=l.jsx(Uo,{sensors:N,collisionDetection:Fn,modifiers:[Jo],onDragEnd:D,children:l.jsx("div",{className:"w-full overflow-x-auto",children:l.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[l.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:L(Hr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.rank")}),l.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")}),l.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")}),l.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")}),l.jsx(na,{items:v,strategy:ta,children:R.map(h=>l.jsx(Sa,{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:l.jsx(ya,{iconSrc:h.icon,label:y(h.copyKey)})},h.key))})]})}),l.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 l.jsx("tr",{"aria-hidden":"true",children:l.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 H=!!h?.is_me,Me=typeof h?.user_id=="string"?h.user_id:null,B=Zr(h?.display_name),J=Ia(B)?ct:B,z=H?Ne:J,ee=!!Me,le=ee?{role:"button",tabIndex:0,onClick:ee?()=>ke(Me):void 0,onKeyDown:ee?G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),ke(Me))}:void 0,"aria-label":y("leaderboard.profile_modal.row_aria",{name:z})}:{};if(H){const G=!!h?.is_pinned;return l.jsxs("tr",{...le,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:[l.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:l.jsx(xr,{rank:h?.rank,placeholder:k})}),l.jsx("td",{className:Ft(!0),children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),l.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:z}),h?.github_url&&l.jsx(wr,{githubUrl:h.github_url})]})}),l.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:l.jsx(pr,{value:h?.total_tokens})}),l.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 l.jsxs("tr",{...le,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:[l.jsx("td",{className:L($t(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(xr,{rank:h?.rank,placeholder:k})}),l.jsx("td",{className:Ft(!1),children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),l.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:z}),h?.github_url&&l.jsx(wr,{githubUrl:h.github_url})]})}),l.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:l.jsx(pr,{value:h?.total_tokens})}),l.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}`)})})]})})}):Ee=l.jsx("div",{className:"px-6 py-12 text-center",children:l.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let Xe=null;return typeof Q=="number"?Xe=lt.map((h,A)=>h==null?l.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:y("leaderboard.pagination.ellipsis")},`ellipsis-${A}`):l.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}`)):Xe=l.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.pagination.page_unknown",{page:String(ie)})}),l.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[l.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:l.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[l.jsxs("div",{className:"mb-5 sm:mb-6",children:[l.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")}),l.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:Ce,from:Ye,to:Be}):y("leaderboard.range_loading",{period:Ce}),be&&l.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})})]})]}),l.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-row items-center justify-between gap-3",children:[l.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 l.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:[l.jsx("span",{className:"relative z-10",children:h==="week"?We:h==="month"?dt:ut}),A&&l.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)})}),l.jsx(ja,{me:de,totalEntries:De,meLabel:Ne,onOpenProfile:de?.user_id?()=>ke(de.user_id):void 0,onJumpToMe:ve,canJump:ue!=null&&!ft&&!O.loading,className:"shrink-0"})]}),!t&&l.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[l.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.signin_prompt")}),l.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&&!Le&&l.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[l.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.sync_prompt")}),l.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")})]}),l.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[O.error&&je?l.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:l.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):null,Ee,l.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:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[l.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),l.jsxs("div",{className:"relative",children:[l.jsx("select",{id:"leaderboard-page-size",value:j,onChange:h=>V(Number(h.target.value)),disabled:O.loading,className:"appearance-none pl-3 pr-8 py-1 rounded-md bg-white dark:bg-oai-gray-950 border border-oai-gray-300 dark:border-oai-gray-700 text-oai-gray-700 dark:text-oai-gray-300 hover:border-oai-gray-400 dark:hover:border-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500 disabled:opacity-50 transition-colors",children:Ut.map(h=>l.jsx("option",{value:h,children:h},h))}),l.jsx(Sn,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:2,"aria-hidden":"true"})]})]}),l.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),l.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")}),l.jsx("div",{className:"flex flex-wrap items-center gap-1",children:Xe}),l.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")})]})]})]})}),l.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:l.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:[l.jsx("p",{children:y("landing.v2.footer.line")}),l.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")})]})}),l.jsx(i.Suspense,{fallback:null,children:l.jsx(Ea,{isOpen:!!Z,userId:Z,period:K,accessToken:m,onClose:Pe})})]})}export{za as LeaderboardPage};
6
+ `},zn={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 Bn(e){let{announcements:t=zn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Pn}=e;const{announce:a,announcement:s}=Tn(),c=st("DndLiveRegion"),[d,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),Ln(i.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(An,{id:n,value:o.draggable}),re.createElement(In,{id:c,announcement:s}));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 i.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Kn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.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 $n(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 Fn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=nr(t,t.left,t.top),a=[];for(const s of n){const{id:c}=s,d=r.get(c);if(d){const u=Rr(nr(d),o);a.push({id:c,data:{droppableContainer:s,value:u}})}}return a.sort(Dr)},Un=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t),a=[];for(const s of n){const{id:c}=s,d=r.get(c);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:c,data:{droppableContainer:s,value:f}})}}return a.sort(Dr)};function Yn(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),s=o-n,c=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=s*c,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const Wn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,c=r.get(s);if(c){const d=Yn(c,t);d>0&&o.push({id:s,data:{droppableContainer:a,value:d}})}}return o.sort($n)};function Xn(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 Hn(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((s,c)=>({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...r})}}const Gn=Hn(1);function Vn(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 qn(e,t,r){const n=Vn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:c}=n,d=e.left-s-(1-o)*parseFloat(r),u=e.top-c-(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 Jn={ignoreTransform:!1};function Ue(e,t){t===void 0&&(t=Jn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=ne(e).getComputedStyle(e);u&&(r=qn(r,u,g))}const{top:n,left:o,width:a,height:s,bottom:c,right:d}=r;return{top:n,left:o,width:a,height:s,bottom:c,right:d}}function or(e){return Ue(e,{ignoreTransform:!0})}function Zn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Qn(e,t){return t===void 0&&(t=ne(e).getComputedStyle(e)),t.position==="fixed"}function eo(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(Xt(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&&eo(o,a)&&r.push(o),Qn(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:Wt(e)?Xt(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,s=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:c,maxScroll:n,minScroll:t}}const to={x:.2,y:.2};function ro(e,t,r,n,o){let{top:a,left:s,right:c,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=to);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&&c>=t.right-m.width?(b.x=F.Forward,w.x=n*Math.abs((t.right-m.width-c)/m.width)):!f&&s<=t.left+m.width&&(b.x=F.Backward,w.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:b,speed:w}}function no(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}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 oo(e){return e.reduce((t,r)=>t+_r(r),0)}function ao(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 so=[["x",["left","right"],oo],["y",["top","bottom"],ao]];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,s,c]of so)for(const d of s)Object.defineProperty(this,d,{get:()=>{const u=c(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 lo(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 fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function ar(e){e.preventDefault()}function co(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]},uo=(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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.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:s=uo,scrollBehavior:c="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=s(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=no(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:c});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:c});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:c});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:c});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:s}=e.nativeEvent;if(n.start.includes(s)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ir(e){return!!(e&&"distance"in e)}function sr(e){return!!(e&&"delay"in e)}class Jt{constructor(t,r,n){var o;n===void 0&&(n=lo(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:s}=a;this.props=t,this.events=r,this.document=Fe(s),this.documentListeners=new Je(this.document),this.listeners=new Je(n),this.windowListeners=new Je(ne(s)),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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,ar),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,ar),this.documentListeners.add(fe.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(sr(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(ir(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(fe.Click,co,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:c}}=a;if(!o)return;const d=(r=Pt(t))!=null?r:me,u=tt(o,d);if(!n&&c){if(ir(c)){if(c.tolerance!=null&&At(u,c.tolerance))return this.handleCancel();if(At(u,c.distance))return this.handleStart()}if(sr(c)&&At(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),s(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 fo={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,fo,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 go={move:{name:"mousemove"},end:{name:"mouseup"}};var Bt;(function(e){e[e.RightClick=2]="RightClick"})(Bt||(Bt={}));class ho extends Jt{constructor(t){super(t,go,Fe(t.event.target))}}ho.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 bo 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(){}}}bo.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 po(e){let{acceleration:t,activator:r=Ze.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:c=wt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=xo({delta:f,disabled:!a}),[w,m]=Dn(),x=i.useRef({x:0,y:0}),k=i.useRef({x:0,y:0}),S=i.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=i.useRef(null),C=i.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)},[]),_=i.useMemo(()=>c===wt.TreeOrder?[...u].reverse():u,[c,u]);i.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}=ro(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,s),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,s,JSON.stringify(S),JSON.stringify(b),w,u,_,g,JSON.stringify(p)])}const mo={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function xo(e){let{delta:t,disabled:r}=e;const n=Ot(t);return it(o=>{if(r||!n||!o)return mo;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 vo(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return it(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function yo(e,t){return i.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.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 wo(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=i.useState(null),{frequency:c,measure:d,strategy:u}=o,g=i.useRef(e),f=x(),p=et(f),b=i.useCallback(function(k){k===void 0&&(k=[]),!p.current&&s(S=>S===null?k:S.concat(k.filter(v=>!S.includes(v))))},[p]),w=i.useRef(null),m=it(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 i.useEffect(()=>{g.current=e},[e]),i.useEffect(()=>{f||b()},[r,f]),i.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),i.useEffect(()=>{f||typeof c!="number"||w.current!==null||(w.current=setTimeout(()=>{b(),w.current=null},c))},[c,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 it(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ko(e,t){return Pr(e,t)}function So(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function Rt(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function No(e){return new Vt(Ue(e),e)}function cr(e,t,r){t===void 0&&(t=No);const[n,o]=i.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 s=So({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}}}}),c=Rt({callback:a});return we(()=>{a(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),n}function Co(e){const t=Pr(e);return Er(e,t)}const dr=[];function Ro(e){const t=i.useRef(e),r=it(n=>e?n&&n!==dr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ct(e):dr,[e]);return i.useEffect(()=>{t.current=e},[e]),r}function Do(e){const[t,r]=i.useState(null),n=i.useRef(e),o=i.useCallback(a=>{const s=_t(a.target);s&&r(c=>c?(c.set(s,zt(s)),new Map(c)):null)},[]);return i.useEffect(()=>{const a=n.current;if(e!==a){s(a);const c=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,zt(u)]):null}).filter(d=>d!=null);r(c.length?new Map(c):null),n.current=e}return()=>{s(e),s(a)};function s(c){c.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Ke(a,s),me):Lr(e):me,[e,t])}function ur(e,t){t===void 0&&(t=[]);const r=i.useRef(null);return i.useEffect(()=>{r.current=null},t),i.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 jo(e){i.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 Eo(e,t){return i.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function zr(e){return i.useMemo(()=>e?Zn(e):null,[e])}const fr=[];function Mo(e,t){t===void 0&&(t=Ue);const[r]=e,n=zr(r?ne(r):null),[o,a]=i.useState(fr);function s(){a(()=>e.length?e.map(d=>Ir(d)?n:new Vt(t(d),d)):fr)}const c=Rt({callback:s});return we(()=>{c?.disconnect(),s(),e.forEach(d=>c?.observe(d))},[e]),o}function _o(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return at(t)?t:e}function Ao(e){let{measure:t}=e;const[r,n]=i.useState(null),o=i.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}),s=i.useCallback(u=>{const g=_o(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[c,d]=vt(s);return i.useMemo(()=>({nodeRef:c,rect:r,setRef:d}),[r,c,d])}const Io=[{sensor:Zt,options:{}},{sensor:qt,options:{}}],To={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 Lo={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},Oo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Dt=i.createContext(Oo),Br=i.createContext(Lo);function Po(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qe}}}function zo(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 s=new Qe(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}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 Bo(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=i.useContext(Dt),a=Ot(n),s=Ot(r?.id);return i.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!Gt(a)||document.activeElement===a.target)return;const c=o.get(s);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=Mn(g);if(f){f.focus();break}}})}},[n,t,o,s,a]),null}function Ko(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function $o(e){return i.useMemo(()=>({draggable:{...xt.draggable,...e?.draggable},droppable:{...xt.droppable,...e?.droppable},dragOverlay:{...xt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fo(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=i.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;we(()=>{if(!s&&!c||!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(s||(f.x=0),c||(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,s,c,n,r])}const Kr=i.createContext({...me,scaleX:1,scaleY:1});var Ie;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ie||(Ie={}));const Uo=i.memo(function(t){var r,n,o,a;let{id:s,accessibility:c,autoScroll:d=!0,children:u,sensors:g=Io,collisionDetection:f=Wn,measuring:p,modifiers:b,...w}=t;const m=i.useReducer(zo,void 0,Po),[x,k]=m,[S,v]=On(),[C,_]=i.useState(Ie.Uninitialized),R=C===Ie.Initialized,{draggable:{active:N,nodes:D,translate:P},droppable:{containers:I}}=x,j=N!=null?D.get(N):null,oe=i.useRef({initial:null,translated:null}),Z=i.useMemo(()=>{var B;return N!=null?{id:N,data:(B=j?.data)!=null?B:To,rect:oe}:null},[N,j]),ae=i.useRef(null),[ke,Pe]=i.useState(null),[V,Te]=i.useState(null),ge=et(w,Object.values(w)),Le=st("DndDescribedBy",s),ze=i.useMemo(()=>I.getEnabled(),[I]),U=$o(p),{droppableRects:ce,measureDroppableContainers:K,measuringScheduled:Oe}=wo(ze,{dragging:R,dependencies:[P.x,P.y],config:U.droppable}),Y=vo(D,N),he=i.useMemo(()=>V?Pt(V):null,[V]),T=Me(),q=ko(Y,U.draggable.measure);Fo({activeNode:N!=null?D.get(N):null,config:T.layoutShiftCompensation,initialRect:q,measure:U.draggable.measure});const M=cr(Y,U.draggable.measure,q),Se=cr(Y?Y.parentElement:null),O=i.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),W=I.getNodeFor((r=O.current.over)==null?void 0:r.id),Q=Ao({measure:U.dragOverlay.measure}),De=(n=Q.nodeRef.current)!=null?n:Y,ie=R?(o=Q.rect)!=null?o:M:null,lt=!!(Q.nodeRef.current&&Q.rect),Ye=Co(lt?null:M),Be=zr(De?ne(De):null),be=Ro(R?W??Y:null),de=Mo(be),Ne=Ko(b,{transform:{x:P.x-Ye.x,y:P.y-Ye.y,scaleX:1,scaleY:1},activatorEvent:V,active:Z,activeNodeRect:M,containerNodeRect:Se,draggingNodeRect:ie,over:O.current.over,overlayNodeRect:Q.rect,scrollableAncestors:be,scrollableAncestorRects:de,windowRect:Be}),ct=he?Ke(he,P):null,We=Do(be),dt=ur(We),ut=ur(We,[M]),Ce=Ke(Ne,dt),xe=ie?Gn(ie,Ne):null,ue=Z&&xe?f({active:Z,collisionRect:xe,droppableRects:ce,droppableContainers:ze,pointerCoordinates:ct}):null,ft=jr(ue,"id"),[ve,gt]=i.useState(null),ht=lt?Ne:Ke(Ne,ut),bt=Xn(ht,(a=ve?.rect)!=null?a:null,M),je=i.useRef(null),Ee=i.useCallback((B,J)=>{let{sensor:z,options:ee}=J;if(ae.current==null)return;const se=D.get(ae.current);if(!se)return;const te=B.nativeEvent,le=new z({active:ae.current,activeNode:se,event:te,options:ee,context:O,onAbort(X){if(!D.get(X))return;const{onDragAbort:ye}=ge.current,Re={id:X};ye?.(Re),S({type:"onDragAbort",event:Re})},onPending(X,_e,ye,Re){if(!D.get(X))return;const{onDragPending:Ge}=ge.current,Ae={id:X,constraint:_e,initialCoordinates:ye,offset:Re};Ge?.(Ae),S({type:"onDragPending",event:Ae})},onStart(X){const _e=ae.current;if(_e==null)return;const ye=D.get(_e);if(!ye)return;const{onDragStart:Re}=ge.current,He={activatorEvent:te,active:{id:_e,data:ye.data,rect:oe}};qe.unstable_batchedUpdates(()=>{Re?.(He),_(Ie.Initializing),k({type:$.DragStart,initialCoordinates:X,active:_e}),S({type:"onDragStart",event:He}),Pe(je.current),Te(te)})},onMove(X){k({type:$.DragMove,coordinates:X})},onEnd:G($.DragEnd),onCancel:G($.DragCancel)});je.current=le;function G(X){return async function(){const{active:ye,collisions:Re,over:He,scrollAdjustedTranslate:Ge}=O.current;let Ae=null;if(ye&&Ge){const{cancelDrop:Ve}=ge.current;Ae={activatorEvent:te,active:ye,collisions:Re,delta:Ge,over:He},X===$.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Ae))&&(X=$.DragCancel)}ae.current=null,qe.unstable_batchedUpdates(()=>{k({type:X}),_(Ie.Uninitialized),gt(null),Pe(null),Te(null),je.current=null;const Ve=X===$.DragEnd?"onDragEnd":"onDragCancel";if(Ae){const jt=ge.current[Ve];jt?.(Ae),S({type:Ve,event:Ae})}})}}},[D]),Xe=i.useCallback((B,J)=>(z,ee)=>{const se=z.nativeEvent,te=D.get(ee);if(ae.current!==null||!te||se.dndKit||se.defaultPrevented)return;const le={active:te};B(z,J.options,le)===!0&&(se.dndKit={capturedBy:J.sensor},ae.current=ee,Ee(z,J))},[D,Ee]),h=yo(g,Xe);jo(g),we(()=>{M&&C===Ie.Initializing&&_(Ie.Initialized)},[M,C]),i.useEffect(()=>{const{onDragMove:B}=ge.current,{active:J,activatorEvent:z,collisions:ee,over:se}=O.current;if(!J||!z)return;const te={active:J,activatorEvent:z,collisions:ee,delta:{x:Ce.x,y:Ce.y},over:se};qe.unstable_batchedUpdates(()=>{B?.(te),S({type:"onDragMove",event:te})})},[Ce.x,Ce.y]),i.useEffect(()=>{const{active:B,activatorEvent:J,collisions:z,droppableContainers:ee,scrollAdjustedTranslate:se}=O.current;if(!B||ae.current==null||!J||!se)return;const{onDragOver:te}=ge.current,le=ee.get(ft),G=le&&le.rect.current?{id:le.id,rect:le.rect.current,data:le.data,disabled:le.disabled}:null,X={active:B,activatorEvent:J,collisions:z,delta:{x:se.x,y:se.y},over:G};qe.unstable_batchedUpdates(()=>{gt(G),te?.(X),S({type:"onDragOver",event:X})})},[ft]),we(()=>{O.current={activatorEvent:V,active:Z,activeNode:Y,collisionRect:xe,collisions:ue,droppableRects:ce,draggableNodes:D,draggingNode:De,draggingNodeRect:ie,droppableContainers:I,over:ve,scrollableAncestors:be,scrollAdjustedTranslate:Ce},oe.current={initial:ie,translated:xe}},[Z,Y,ue,xe,D,De,ie,ce,I,ve,be,Ce]),po({...T,delta:P,draggingRect:xe,pointerCoordinates:ct,scrollableAncestors:be,scrollableAncestorRects:de});const A=i.useMemo(()=>({active:Z,activeNode:Y,activeNodeRect:M,activatorEvent:V,collisions:ue,containerNodeRect:Se,dragOverlay:Q,draggableNodes:D,droppableContainers:I,droppableRects:ce,over:ve,measureDroppableContainers:K,scrollableAncestors:be,scrollableAncestorRects:de,measuringConfiguration:U,measuringScheduled:Oe,windowRect:Be}),[Z,Y,M,V,ue,Se,Q,D,I,ce,ve,K,be,de,U,Oe,Be]),H=i.useMemo(()=>({activatorEvent:V,activators:h,active:Z,activeNodeRect:M,ariaDescribedById:{draggable:Le},dispatch:k,draggableNodes:D,over:ve,measureDroppableContainers:K}),[V,h,Z,M,k,Le,D,ve,K]);return re.createElement(Cr.Provider,{value:v},re.createElement(Dt.Provider,{value:H},re.createElement(Br.Provider,{value:A},re.createElement(Kr.Provider,{value:bt},u)),re.createElement(Bo,{disabled:c?.restoreFocus===!1})),re.createElement(Bn,{...c,hiddenTextDescribedById:Le}));function Me(){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}}}),Yo=i.createContext(null),gr="button",Wo="Draggable";function Xo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=st(Wo),{activators:s,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=i.useContext(Dt),{role:b=gr,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=d?.id===t,k=i.useContext(x?Kr:Yo),[S,v]=vt(),[C,_]=vt(),R=Eo(s,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=i.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:c,activeNodeRect:u,attributes:D,isDragging:x,listeners:n?void 0:R,node:S,over:p,setNodeRef:v,setActivatorNodeRef:_,transform:k}}function Ho(){return i.useContext(Br)}const Go="Droppable",Vo={timeout:25};function qo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=st(Go),{active:s,dispatch:c,over:d,measureDroppableContainers:u}=i.useContext(Dt),g=i.useRef({disabled:r}),f=i.useRef(!1),p=i.useRef(null),b=i.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={...Vo,...o},k=et(m??n),S=i.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||!s}),C=i.useCallback((D,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),D&&v.observe(D))},[v]),[_,R]=vt(C),N=et(t);return i.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),i.useEffect(()=>(c({type:$.RegisterDroppable,element:{id:n,key:a,disabled:r,node:_,rect:p,data:N}}),()=>c({type:$.UnregisterDroppable,key:a,id:n})),[n]),i.useEffect(()=>{r!==g.current.disabled&&(c({type:$.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,c]),{active:s,rect:p,isOver:d?.id===n,node:_,over:d,setNodeRef:R}}const Jo=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 Zo(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 Qo(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 ea(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const mt={scaleX:1,scaleY:1},ta=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:s}=e;const c=(t=r[o])!=null?t:n;if(!c)return null;const d=ra(r,s,o);if(s===o){const u=r[a];return u?{x:o<a?u.left+u.width-(c.left+c.width):u.left-c.left,y:0,...mt}:null}return s>o&&s<=a?{x:-c.width-d,y:0,...mt}:s<o&&s>=a?{x:c.width+d,y:0,...mt}:{x:0,y:0,...mt}};function ra(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),s=t[o],c=a[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.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 na(e){let{children:t,id:r,items:n,strategy:o=Fr,disabled:a=!1}=e;const{active:s,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:g}=Ho(),f=st(Ur,r),p=c.rect!==null,b=i.useMemo(()=>n.map(R=>typeof R=="object"&&"id"in R?R.id:R),[n]),w=s!=null,m=s?b.indexOf(s.id):-1,x=u?b.indexOf(u.id):-1,k=i.useRef(b),S=!Qo(b,k.current),v=x!==-1&&m===-1||S,C=ea(a);we(()=>{S&&w&&g(b)},[S,b,w,g]),i.useEffect(()=>{k.current=b},[b]);const _=i.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Zo(b,d),strategy:o}),[m,f,C.draggable,C.droppable,v,b,x,d,p,o]);return re.createElement(Yr.Provider,{value:_},t)}const oa=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return $r(r,n,o).indexOf(t)},aa=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!n||c!==a&&o===s?!1:r?!0:s!==o&&t===d},ia={duration:200,easing:"ease"},Wr="transform",sa=rt.Transition.toString({property:Wr,duration:0,easing:"linear"}),la={roleDescription:"sortable"};function ca(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=i.useState(null),c=i.useRef(r);return we(()=>{if(!t&&r!==c.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)&&s(g)}}r!==c.current&&(c.current=r)},[t,r,n,o]),i.useEffect(()=>{a&&s(null)},[a]),a}function da(e){let{animateLayoutChanges:t=aa,attributes:r,disabled:n,data:o,getNewIndex:a=oa,id:s,strategy:c,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}=i.useContext(Yr),v=ua(n,b),C=g.indexOf(s),_=i.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),R=i.useMemo(()=>g.slice(g.indexOf(s)),[g,s]),{rect:N,node:D,isOver:P,setNodeRef:I}=qo({id:s,data:_,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:j,activatorEvent:oe,activeNodeRect:Z,attributes:ae,setNodeRef:ke,listeners:Pe,isDragging:V,over:Te,setActivatorNodeRef:ge,transform:Le}=Xo({id:s,data:_,attributes:{...la,...r},disabled:v.draggable}),ze=Rn(I,ke),U=!!j,ce=U&&!w&&pt(p)&&pt(x),K=!k&&V,Oe=K&&ce?Le:null,he=ce?Oe??(c??S)({rects:m,activeNodeRect:Z,activeIndex:p,overIndex:x,index:C}):null,T=pt(p)&&pt(x)?a({id:s,items:g,activeIndex:p,overIndex:x}):C,q=j?.id,M=i.useRef({activeId:q,items:g,newIndex:T,containerId:f}),Se=g!==M.current.items,O=t({active:j,containerId:f,isDragging:V,isSorting:U,id:s,index:C,items:g,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),W=ca({disabled:!O,index:C,node:D,rect:N});return i.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]),i.useEffect(()=>{if(q===M.current.activeId)return;if(q&&!M.current.activeId){M.current.activeId=q;return}const De=setTimeout(()=>{M.current.activeId=q},50);return()=>clearTimeout(De)},[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:Te,setNodeRef:ze,setActivatorNodeRef:ge,setDroppableNodeRef:I,setDraggableNodeRef:ke,transform:W??he,transition:Q()};function Q(){if(W||Se&&M.current.newIndex===C)return sa;if(!(K&&!Gt(oe)||!u)&&(U||O))return rt.Transition.toString({...u,property:Wr})}}function ua(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 fa=[E.Down,E.Right,E.Up,E.Left],ga=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:c}}=t;if(fa.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=Un({collisionRect:n,droppableRects:o,droppableContainers:d});let g=jr(u,"id");if(g===s?.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)=>c[N]!==R),k=Xr(f,p),S=ha(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 Xr(e,t){return!kt(e)||!kt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ha(e,t){return!kt(e)||!kt(t)||!Xr(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 ba(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),s=[];let c=null;for(const d of a)c!=null&&d-c>1&&s.push(null),s.push(d),c=d;return s}function pa({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,s=r?o<n:!0;return{canPrev:a,canNext:s,safePage:o,safeTotal:n}}function ma({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(s=>!!s?.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 xa(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 va=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function ya({iconSrc:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?l.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${va.has(e)?"dark:invert":""}`}):null,l.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}],Hr="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 l.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function wa({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 l.jsxs("tr",{className:"group",children:[l.jsx("td",{className:L($t(!1),"!group-hover:bg-transparent"),children:l.jsx(pe,{className:"h-4 w-6"})}),l.jsx("td",{className:L(Ft(!1),"!group-hover:bg-transparent"),children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(pe,{className:"h-8 w-8 min-w-8 rounded-full"}),l.jsx(pe,{className:L("h-4",t)})]})}),l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(pe,{className:L("h-4",r)})}),l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(pe,{className:"h-4 w-12"})}),St.map(o=>l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(pe,{className:L("h-4",n)})},o.key))]})}function ka({rows:e=10}){return l.jsx("div",{className:"w-full overflow-x-auto",children:l.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[l.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:L(Hr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(pe,{className:"h-3.5 w-6"})}),l.jsx("th",{className:L(Gr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(pe,{className:"h-3.5 w-12"})}),l.jsx("th",{className:"px-4 py-4",children:l.jsx(pe,{className:"h-3.5 w-10"})}),l.jsx("th",{className:"px-4 py-4",children:l.jsx(pe,{className:"h-3.5 w-14"})}),St.map(t=>l.jsx("th",{className:"px-4 py-4",children:l.jsx(pe,{className:"h-3.5 w-12"})},t.key))]})}),l.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,r)=>l.jsx(wa,{index:r},r))})]})})}function Sa({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:s,transition:c,isDragging:d}=da({id:e}),u=rt.Transform.toString(s)||"";i.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=c||"",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,c,d]);const g={transform:u,transition:c,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 l.jsx("th",{ref:a,style:g,className:L(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...o,children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.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:l.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[l.jsx("circle",{cx:"2",cy:"2",r:"1"}),l.jsx("circle",{cx:"6",cy:"2",r:"1"}),l.jsx("circle",{cx:"2",cy:"7",r:"1"}),l.jsx("circle",{cx:"6",cy:"7",r:"1"}),l.jsx("circle",{cx:"2",cy:"12",r:"1"}),l.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),r]})})}const Vr="tokentracker.leaderboard.columnOrder.v1";function Na(){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 Ca(e){const t=i.useMemo(()=>e.join("|"),[e]),[r,n]=i.useState(()=>hr(Na(),e));i.useEffect(()=>{n(s=>{const c=hr(s,e);return c.length===s.length&&c.every((u,g)=>u===s[g])?s:(Tt(c),c)})},[t,e]);const o=i.useCallback((s,c)=>{!s||!c||s===c||n(d=>{const u=d.indexOf(s),g=d.indexOf(c);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=i.useCallback(()=>{Tt(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function Ra(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 Da(e){const t=qr(e);return t?t.toLowerCase()==="anonymous":!0}function ja({me:e,totalEntries:t,meLabel:r,onOpenProfile:n,onJumpToMe:o,canJump:a,className:s}){const c=e&&typeof e.rank=="number"?e.rank:null;if(!c)return null;const d=Number(t)||0,u=Ra(c,d),g=qr(e?.display_name),f=!g||Da(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 l.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]",s),children:[l.jsx(Lt,{size:"sm",avatarUrl:e?.avatar_url,displayName:f,seed:p}),l.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}),l.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",c.toLocaleString()]}),u!=null&&l.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?l.jsx(Cn,{"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"}):l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),l.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const Ea=i.lazy(()=>yn(()=>import("./LeaderboardProfileModal-CNWb6GZA.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 Ma(){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=pn(t),a=t===wn?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 l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:bn(e)}),l.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=>l.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 _a={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=_a[e];return r?l.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}):l.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 Aa(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 Ia(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 l.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[l.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:l.jsx(gn,{provider:"GITHUB",size:16})}),l.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:[l.jsx("span",{className:"block",children:y("leaderboard.github.tooltipAction")}),l.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[y("leaderboard.github.tooltipPrefix")," ",l.jsx(hn,{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 za({auth:e,signedIn:t,sessionSoftExpired:r}){const n=en(),o=tn(),{openLoginModal:a}=rn(),{signedIn:s,loading:c,user:d}=nn(),{currency:u,rate:g}=kn(),f=i.useMemo(()=>on(),[]),p=an(),b=t&&!r,w=i.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=i.useMemo(()=>St.map(h=>h.key),[]),{order:v,reorder:C}=Ca(S),_=i.useMemo(()=>{const h=new Map;for(const A of St)h.set(A.key,A);return h},[]),R=i.useMemo(()=>v.map(h=>_.get(h)).filter(Boolean),[v,_]),N=Kn(tr(Zt,{activationConstraint:{distance:6}}),tr(qt,{coordinateGetter:ga})),D=i.useCallback(h=>{const{active:A,over:H}=h;!H||A.id===H.id||C(String(A.id),String(H.id))},[C]),[P,I]=i.useState(1),[j,oe]=i.useState(Ma),[Z,ae]=i.useState(null),ke=i.useCallback(h=>{typeof h=="string"&&h.trim()&&ae(h.trim())},[]),Pe=i.useCallback(()=>ae(null),[]),V=i.useCallback(h=>{const A=Ut.includes(h)?h:Yt;oe(A),I(1);try{window.localStorage.setItem(Jr,String(A))}catch{}},[]),[Te,ge]=i.useState(0),[Le,ze]=i.useState(()=>ln()),[U,ce]=i.useState(!1),K=i.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 H=new URLSearchParams(n?.search||"");H.set("period",A),I(1),o(`${n?.pathname||"/leaderboard"}?${H.toString()}`,{replace:!0})};i.useEffect(()=>{c||p||s||a()},[s,c,p,a]),i.useEffect(()=>{I(1)},[K]);const Y=i.useMemo(()=>(ot(P,{min:1,max:1e6,fallback:1})-1)*j,[P,j]),he=i.useMemo(()=>p?"mock":c?"unavailable":s?"cloud":t?"local":f?"public":"unavailable",[c,s,f,p,t]),T=i.useMemo(()=>cn({accessMode:he,baseUrl:f,mockEnabled:p,userId:d?.id||null,period:K,pageSize:j,offset:Y}),[d?.id,he,f,Y,p,j,K]),[q,M]=i.useState(()=>{const h=Et(T);return h?{loading:!1,error:null,data:h.data,contextKey:T}:{loading:!1,error:null,data:null,contextKey:null}});i.useEffect(()=>{if(!f&&!p||!p&&he==="unavailable"){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 H=await dn({userId:d?.id||null,period:K,limit:j,offset:Y});A&&(un(H,{activeContextKey:T,contextKey:T,source:Te>0?"manual-refresh":"page-load"}),M({loading:!1,error:null,data:H,contextKey:T}))})().catch(H=>{if(!A)return;const Me=Aa(H);M(B=>B.contextKey===T?{...B,loading:!1,error:Me}:{loading:!1,error:Me,data:null,contextKey:T})}),()=>{A=!1}},[f,he,d?.id,T,Y,Te,p,K,j]);const Se=i.useMemo(()=>q.contextKey===T?null:Et(T),[T,q.contextKey]),O=i.useMemo(()=>q.contextKey===T?q:Se?{loading:!1,error:null,data:Se.data,contextKey:T}:{loading:!!(f||p)&&he!=="unavailable",error:null,data:null,contextKey:T},[he,f,T,q,p,Se]),W=O.data,Q=W?.total_pages??null,De=W?.total_entries??0,ie=W?.page??P,lt=i.useMemo(()=>ba(ie,Q),[ie,Q]),Ye=W?.from||null,Be=W?.to||null,be=W?.generated_at||null,de=W?.me||null,Ne=y("leaderboard.me_label"),ct=y("leaderboard.anon_label"),We=y("leaderboard.period.week"),dt=y("leaderboard.period.month"),ut=y("leaderboard.period.total"),Ce=K==="month"?dt:K==="total"?ut:We,xe=i.useMemo(()=>{const h=Array.isArray(W?.entries)?W.entries:[];return ma({entries:h,me:de,meLabel:Ne})},[W?.entries,de,Ne]),ue=i.useMemo(()=>xa(de?.rank,j),[de?.rank,j]),ft=ue!=null&&ue===ie,ve=i.useCallback(()=>{ue!=null&&I(ue)},[ue]),gt=async()=>{ce(!0);try{mn(!0),ze(!0),await xn(()=>Qt(m));const h=await Qt(m);h&&await vn({accessToken:h,period:K,source:"leaderboard-enable-sync"}),ge(A=>A+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ce(!1)}},{canPrev:ht,canNext:bt}=pa({page:ie,totalPages:Q}),je=Array.isArray(xe)&&xe.length!==0;let Ee=null;O.loading&&!je?Ee=l.jsx(ka,{rows:j}):O.error&&!je?Ee=l.jsx("div",{className:"px-6 py-12 text-center",children:l.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):je?Ee=l.jsx(Uo,{sensors:N,collisionDetection:Fn,modifiers:[Jo],onDragEnd:D,children:l.jsx("div",{className:"w-full overflow-x-auto",children:l.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[l.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:L(Hr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.rank")}),l.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")}),l.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")}),l.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")}),l.jsx(na,{items:v,strategy:ta,children:R.map(h=>l.jsx(Sa,{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:l.jsx(ya,{iconSrc:h.icon,label:y(h.copyKey)})},h.key))})]})}),l.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 l.jsx("tr",{"aria-hidden":"true",children:l.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 H=!!h?.is_me,Me=typeof h?.user_id=="string"?h.user_id:null,B=Zr(h?.display_name),J=Ia(B)?ct:B,z=H?Ne:J,ee=!!Me,le=ee?{role:"button",tabIndex:0,onClick:ee?()=>ke(Me):void 0,onKeyDown:ee?G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),ke(Me))}:void 0,"aria-label":y("leaderboard.profile_modal.row_aria",{name:z})}:{};if(H){const G=!!h?.is_pinned;return l.jsxs("tr",{...le,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:[l.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:l.jsx(xr,{rank:h?.rank,placeholder:k})}),l.jsx("td",{className:Ft(!0),children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),l.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:z}),h?.github_url&&l.jsx(wr,{githubUrl:h.github_url})]})}),l.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:l.jsx(pr,{value:h?.total_tokens})}),l.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 l.jsxs("tr",{...le,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:[l.jsx("td",{className:L($t(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(xr,{rank:h?.rank,placeholder:k})}),l.jsx("td",{className:Ft(!1),children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),l.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:z}),h?.github_url&&l.jsx(wr,{githubUrl:h.github_url})]})}),l.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:l.jsx(pr,{value:h?.total_tokens})}),l.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}`)})})]})})}):Ee=l.jsx("div",{className:"px-6 py-12 text-center",children:l.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let Xe=null;return typeof Q=="number"?Xe=lt.map((h,A)=>h==null?l.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:y("leaderboard.pagination.ellipsis")},`ellipsis-${A}`):l.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}`)):Xe=l.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.pagination.page_unknown",{page:String(ie)})}),l.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[l.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:l.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[l.jsxs("div",{className:"mb-5 sm:mb-6",children:[l.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")}),l.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:Ce,from:Ye,to:Be}):y("leaderboard.range_loading",{period:Ce}),be&&l.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})})]})]}),l.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-row items-center justify-between gap-3",children:[l.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 l.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:[l.jsx("span",{className:"relative z-10",children:h==="week"?We:h==="month"?dt:ut}),A&&l.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)})}),l.jsx(ja,{me:de,totalEntries:De,meLabel:Ne,onOpenProfile:de?.user_id?()=>ke(de.user_id):void 0,onJumpToMe:ve,canJump:ue!=null&&!ft&&!O.loading,className:"shrink-0"})]}),!t&&l.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[l.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.signin_prompt")}),l.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&&!Le&&l.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[l.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.sync_prompt")}),l.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")})]}),l.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[O.error&&je?l.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:l.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):null,Ee,l.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:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[l.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),l.jsxs("div",{className:"relative",children:[l.jsx("select",{id:"leaderboard-page-size",value:j,onChange:h=>V(Number(h.target.value)),disabled:O.loading,className:"appearance-none pl-3 pr-8 py-1 rounded-md bg-white dark:bg-oai-gray-950 border border-oai-gray-300 dark:border-oai-gray-700 text-oai-gray-700 dark:text-oai-gray-300 hover:border-oai-gray-400 dark:hover:border-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500 disabled:opacity-50 transition-colors",children:Ut.map(h=>l.jsx("option",{value:h,children:h},h))}),l.jsx(Sn,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:2,"aria-hidden":"true"})]})]}),l.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),l.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")}),l.jsx("div",{className:"flex flex-wrap items-center gap-1",children:Xe}),l.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")})]})]})]})}),l.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:l.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:[l.jsx("p",{children:y("landing.v2.footer.line")}),l.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")})]})}),l.jsx(i.Suspense,{fallback:null,children:l.jsx(Ea,{isOpen:!!Z,userId:Z,period:K,accessToken:m,onClose:Pe})})]})}export{za as LeaderboardPage};
@@ -1,4 +1,4 @@
1
- import{c as D,r as g,cp as Q,j as e,A as n,cq as V,at as ee,cr as ae,N as c,Q as re,cs as te,ck as se,L as ie,l as oe,P as T,X as ne,D as I,C as le,a7 as de}from"./main-CmNjwZqb.js";import{u as ce}from"./useCurrency-OWcFD7bX.js";import{L as W}from"./LeaderboardAvatar-3zGkgsNt.js";import{A as me}from"./ActivityHeatmap-B4zB8pSl.js";import{A as F}from"./arrow-up-right-DnzcfcLH.js";import{C as xe}from"./check-CGdPUCWD.js";import{D as ge,a as pe,b as he,c as fe,d as be,e as ue}from"./DialogTitle-CNeoqAUd.js";import"./info-C4MiVPvD.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 H(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(H(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,q=Math.cos(S)*A,G=Math.sin(S)*A-(10+Math.random()*15),X=Math.random()*360-180,J=6+Math.random()*8,Y=o[Math.floor(Math.random()*o.length)],Z=x[Math.floor(Math.random()*x.length)],K=++N.current;f.push({id:K,tx:q,ty:G,rot:X,size:J,color:Y,shape:Z})}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,!H(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:`
1
+ import{c as D,r as g,cp as V,j as e,A as n,cq as Q,at as ee,cr as ae,M as c,O as re,cs as te,ck as se,L as ie,l as oe,P as T,X as ne,D as I,C as le,a6 as de}from"./main-BHU0hIWS.js";import{u as ce}from"./useCurrency-B70A0cjV.js";import{L as W}from"./LeaderboardAvatar-CGyaSA7g.js";import{A as me}from"./ActivityHeatmap-HUG2wf_9.js";import{A as F}from"./arrow-up-right-OHDkhx-y.js";import{C as xe}from"./check-BcU6hhFb.js";import{D as ge,a as pe,b as he,c as fe,d as be,e as ue}from"./DialogTitle-BF41YVn6.js";import"./info-BNlH8ZDr.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 H(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(H(a)),V({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,q=Math.cos(S)*A,G=Math.sin(S)*A-(10+Math.random()*15),X=Math.random()*360-180,J=6+Math.random()*8,Y=o[Math.floor(Math.random()*o.length)],Z=x[Math.floor(Math.random()*x.length)],K=++N.current;f.push({id:K,tx:q,ty:G,rot:X,size:J,color:Y,shape:Z})}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 Q({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,!H(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
2
  @keyframes tt-like-pop {
3
3
  0% { transform: scale(1); }
4
4
  25% { transform: scale(0.75); }
@@ -1 +1 @@
1
- import{r as d,j as e,K as j,O as w,Q as N,L as k,av as L,A as s,a8 as I}from"./main-CmNjwZqb.js";import{u as T}from"./useCurrency-OWcFD7bX.js";import{H as M}from"./HeaderGithubStar-syBp0TMv.js";import{useLeaderboardProfileData as C,ProfileSkeleton as _,ProfileContent as E}from"./LeaderboardProfileModal-D0ylKDm1.js";import"./LeaderboardAvatar-3zGkgsNt.js";import"./ActivityHeatmap-B4zB8pSl.js";import"./info-C4MiVPvD.js";import"./arrow-up-right-DnzcfcLH.js";import"./check-CGdPUCWD.js";import"./DialogTitle-CNeoqAUd.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 Q({auth:a,signedIn:h,sessionSoftExpired:g,userId:m}){const{currency:u,rate:p}=T(),{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(M,{})})]}),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{Q as LeaderboardProfilePage};
1
+ import{r as d,j as e,K as j,N as w,O as N,L as k,av as L,A as s,a7 as I}from"./main-BHU0hIWS.js";import{u as T}from"./useCurrency-B70A0cjV.js";import{H as M}from"./HeaderGithubStar-ZoIWfFe6.js";import{useLeaderboardProfileData as C,ProfileSkeleton as _,ProfileContent as E}from"./LeaderboardProfileModal-CNWb6GZA.js";import"./LeaderboardAvatar-CGyaSA7g.js";import"./ActivityHeatmap-HUG2wf_9.js";import"./info-BNlH8ZDr.js";import"./arrow-up-right-OHDkhx-y.js";import"./check-BcU6hhFb.js";import"./DialogTitle-BF41YVn6.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}=T(),{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(M,{})})]}),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};
@@ -1,2 +1,2 @@
1
- import{j as i,N as h,A as s,r as j,ax as v,i as k,L as N,ay as L}from"./main-CmNjwZqb.js";import{u as P}from"./use-usage-limits-DRceo1gm.js";import{u as C}from"./use-limits-display-prefs-DWRnMoYm.js";import{C as g}from"./Card-aIQklHHp.js";import{F as E}from"./FadeIn-DLCqO2k7.js";import{L as O}from"./LocalOnlyNotice-mpL0e0Yx.js";import"./arrow-up-right-DnzcfcLH.js";import"./download-LO8eYKuM.js";const T=[3,2,3,3,2,2,3];function m({className:n}){return i.jsx("div",{className:h("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",n)})}function R(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(m,{className:"h-3 w-12 shrink-0"}),i.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(m,{className:"h-3 w-[30px] shrink-0"}),i.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function S({bars:n,index:e}){const r=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(m,{className:h("h-4",r)})]}),Array.from({length:n},(a,l)=>i.jsx(R,{},l))]})}function A(){return i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(m,{className:"h-3.5 w-28"}),T.map((n,e)=>i.jsx(S,{bars:n,index:e},e))]})})}function t(n){if(!n)return null;const e=typeof n=="number"?n*1e3:Date.parse(n);if(!Number.isFinite(e))return null;const r=e-Date.now();if(r<=0)return s("shared.time.now");const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const l=Math.floor(a/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function I(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function o({label:n,pct:e,reset:r}){const a=Math.max(0,Math.min(100,Number(e)||0)),l=Math.round(a),u=a>0&&l===0?Math.max(a,.35):a,x=a>0&&l===0?"<1":String(l);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:n}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${I(l)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:a>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),r?i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r}):null]})}function d({name:n,icon:e,children:r}){const l=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:l}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n})]}),r]})}const M=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],D={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:n,tone:e="neutral"}){const r=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:n})}function H(n,e){const r=D[n];if(!r)return null;if(!e?.configured)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},n);if(e.error)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},n);switch(n){case"claude":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.five_hour?i.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?i.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?i.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"kiro":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx($,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function $({defaultDir:n}){const[e,r]=j.useState(!1),l=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${n||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
1
+ import{j as i,M as h,A as s,r as j,ax as v,i as k,L as N,ay as L}from"./main-BHU0hIWS.js";import{u as P}from"./use-usage-limits-CUlVKjou.js";import{u as C}from"./use-limits-display-prefs-mPyTqsYR.js";import{C as g}from"./Card-BRdnq8-k.js";import{F as E}from"./FadeIn-CsYsRptR.js";import{L as O}from"./LocalOnlyNotice-BSlFMNhI.js";import"./arrow-up-right-OHDkhx-y.js";import"./download-BOwIFon2.js";const T=[3,2,3,3,2,2,3];function m({className:n}){return i.jsx("div",{className:h("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",n)})}function R(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(m,{className:"h-3 w-12 shrink-0"}),i.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(m,{className:"h-3 w-[30px] shrink-0"}),i.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function S({bars:n,index:e}){const r=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(m,{className:h("h-4",r)})]}),Array.from({length:n},(a,l)=>i.jsx(R,{},l))]})}function A(){return i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(m,{className:"h-3.5 w-28"}),T.map((n,e)=>i.jsx(S,{bars:n,index:e},e))]})})}function t(n){if(!n)return null;const e=typeof n=="number"?n*1e3:Date.parse(n);if(!Number.isFinite(e))return null;const r=e-Date.now();if(r<=0)return s("shared.time.now");const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const l=Math.floor(a/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function I(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function o({label:n,pct:e,reset:r}){const a=Math.max(0,Math.min(100,Number(e)||0)),l=Math.round(a),u=a>0&&l===0?Math.max(a,.35):a,x=a>0&&l===0?"<1":String(l);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:n}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${I(l)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:a>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),r?i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r}):null]})}function d({name:n,icon:e,children:r}){const l=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:l}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n})]}),r]})}const M=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],D={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:n,tone:e="neutral"}){const r=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:n})}function H(n,e){const r=D[n];if(!r)return null;if(!e?.configured)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},n);if(e.error)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},n);switch(n){case"claude":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.five_hour?i.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?i.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?i.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"kiro":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx($,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function $({defaultDir:n}){const[e,r]=j.useState(!1),l=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${n||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
2
2
  `),u=async()=>{try{await navigator.clipboard.writeText(l),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:s("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:s("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:l}),i.jsx("button",{type:"button",onClick:u,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?s("limits.copilot.otelHint.copied"):s("limits.copilot.otelHint.copy")})]})}function F({claude:n,codex:e,cursor:r,gemini:a,kimi:l,kiro:u,antigravity:x,copilot:b,order:w,visibility:_}){const f={claude:n,codex:e,cursor:r,gemini:a,kimi:l,kiro:u,antigravity:x,copilot:b},y=(Array.isArray(w)&&w.length>0?w:M).filter(p=>!_||_[p]!==!1).map(p=>H(p,f[p])).filter(Boolean);return i.jsx(E,{delay:.15,children:i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s("limits.panel.title")}),y.length>0?y:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const B=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function J(){const n=v(),{data:e,error:r,isLoading:a}=P(n?{initialRefresh:!0,initialState:n,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),l=C();return!B&&!k()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(O,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:s("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:s("limits.page.subtitle")})]}),i.jsx(N,{to:"/settings","aria-label":s("limits.page.openSettings"),title:s("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(L,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(A,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:r})}):null,i.jsx(F,{claude:e?.claude,codex:e?.codex,cursor:e?.cursor,gemini:e?.gemini,kimi:e?.kimi,kiro:e?.kiro,antigravity:e?.antigravity,copilot:e?.copilot,order:l.order,visibility:l.visibility})]})]})})})}export{J as LimitsPage};
@@ -1 +1 @@
1
- import{j as e,A as t}from"./main-CmNjwZqb.js";import{A as r}from"./arrow-up-right-DnzcfcLH.js";import{D as o}from"./download-LO8eYKuM.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
1
+ import{j as e,A as t}from"./main-BHU0hIWS.js";import{A as r}from"./arrow-up-right-OHDkhx-y.js";import{D as o}from"./download-BOwIFon2.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};