tokentracker-cli 0.5.69 → 0.5.71

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 (24) hide show
  1. package/README.md +3 -2
  2. package/dashboard/dist/assets/{Card-ClNKd74W.js → Card-5ebScQbM.js} +1 -1
  3. package/dashboard/dist/assets/{DashboardPage-DiUhik_k.js → DashboardPage-B32RhUB1.js} +2 -2
  4. package/dashboard/dist/assets/{FadeIn-c2wFBL_u.js → FadeIn-CHjFUAEe.js} +1 -1
  5. package/dashboard/dist/assets/{IpCheckPage-UPn-zQGB.js → IpCheckPage-CrbKufId.js} +1 -1
  6. package/dashboard/dist/assets/{LeaderboardPage-ZpuPopCf.js → LeaderboardPage-CVKBhGzY.js} +2 -2
  7. package/dashboard/dist/assets/{LeaderboardProfilePage-C62TdxVy.js → LeaderboardProfilePage-CbpzxvLA.js} +1 -1
  8. package/dashboard/dist/assets/{LimitsPage-CQEaB_b2.js → LimitsPage-BwQ4isbM.js} +1 -1
  9. package/dashboard/dist/assets/{SettingsPage-8RdfHCcA.js → SettingsPage-Y3Znzs1i.js} +1 -1
  10. package/dashboard/dist/assets/{WidgetsPage-DiKFOpFH.js → WidgetsPage-tNojCBaj.js} +1 -1
  11. package/dashboard/dist/assets/{download-BmThIfGZ.js → download-CQASvwEL.js} +1 -1
  12. package/dashboard/dist/assets/leaderboard-columns-DFG1TWe9.js +1 -0
  13. package/dashboard/dist/assets/{main-D49FUfq7.js → main-Cv6YpYdZ.js} +16 -15
  14. package/dashboard/dist/assets/{use-limits-display-prefs-BHo0gzBa.js → use-limits-display-prefs-BUrHqTkA.js} +1 -1
  15. package/dashboard/dist/assets/{use-usage-limits-BGttWixw.js → use-usage-limits-D-gv2i1R.js} +1 -1
  16. package/dashboard/dist/brand-logos/kimi.svg +1 -0
  17. package/dashboard/dist/index.html +1 -1
  18. package/dashboard/dist/share.html +1 -1
  19. package/package.json +1 -1
  20. package/src/commands/init.js +11 -0
  21. package/src/commands/status.js +9 -0
  22. package/src/commands/sync.js +26 -0
  23. package/src/lib/rollout.js +172 -0
  24. package/dashboard/dist/assets/leaderboard-columns-9wPbwNaz.js +0 -1
@@ -1 +1 @@
1
- import{aa as s,D as n,ab as d}from"./main-D49FUfq7.js";function v({children:i,delay:t=0,duration:o=.4,y:e=20,className:a="",once:r=!0}){return s()?n.jsx("div",{className:a,children:i}):n.jsx(d.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:o,delay:t,ease:[.25,.1,.25,1]},className:a,children:i})}function x({children:i,staggerDelay:t=.1,initialDelay:o=0,className:e=""}){return s()?n.jsx("div",{className:e,children:i}):n.jsx(d.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:o}}},className:e,children:i})}function h({children:i,className:t="",y:o=20}){return s()?n.jsx("div",{className:t,children:i}):n.jsx(d.div,{variants:{hidden:{opacity:0,y:o},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.25,.1,.25,1]}}},className:t,children:i})}export{v as F,x as S,h as a};
1
+ import{aa as s,D as n,ab as d}from"./main-Cv6YpYdZ.js";function v({children:i,delay:t=0,duration:o=.4,y:e=20,className:a="",once:r=!0}){return s()?n.jsx("div",{className:a,children:i}):n.jsx(d.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:o,delay:t,ease:[.25,.1,.25,1]},className:a,children:i})}function x({children:i,staggerDelay:t=.1,initialDelay:o=0,className:e=""}){return s()?n.jsx("div",{className:e,children:i}):n.jsx(d.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:o}}},className:e,children:i})}function h({children:i,className:t="",y:o=20}){return s()?n.jsx("div",{className:t,children:i}):n.jsx(d.div,{variants:{hidden:{opacity:0,y:o},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.25,.1,.25,1]}}},className:t,children:i})}export{v as F,x as S,h as a};
@@ -1 +1 @@
1
- import{r as i,D as a}from"./main-D49FUfq7.js";function o(){const[s,d]=i.useState(!1);return a.jsxs("div",{className:"h-full relative dark:bg-[#050505]",children:[!s&&a.jsxs("div",{className:"absolute inset-0 p-6 space-y-5 animate-pulse",children:[a.jsx("div",{className:"flex gap-4 justify-center",children:Array.from({length:6}).map((e,r)=>a.jsx("div",{className:"h-4 w-20 rounded bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),a.jsxs("div",{className:"space-y-2 pt-2",children:[a.jsx("div",{className:"h-7 w-72 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),a.jsx("div",{className:"h-4 w-96 rounded bg-oai-gray-200 dark:bg-oai-gray-800"})]}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((e,r)=>a.jsx("div",{className:"h-24 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((e,r)=>a.jsx("div",{className:"h-40 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((e,r)=>a.jsx("div",{className:"h-32 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))})]}),a.jsx("iframe",{src:"https://ip.net.coffee/claude/",title:"Cloud AI IP Check",className:`w-full h-full dark:invert dark:hue-rotate-180 transition-opacity duration-300 ${s?"opacity-100":"opacity-0"}`,style:{border:"none"},onLoad:()=>d(!0)})]})}export{o as default};
1
+ import{r as i,D as a}from"./main-Cv6YpYdZ.js";function o(){const[s,d]=i.useState(!1);return a.jsxs("div",{className:"h-full relative dark:bg-[#050505]",children:[!s&&a.jsxs("div",{className:"absolute inset-0 p-6 space-y-5 animate-pulse",children:[a.jsx("div",{className:"flex gap-4 justify-center",children:Array.from({length:6}).map((e,r)=>a.jsx("div",{className:"h-4 w-20 rounded bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),a.jsxs("div",{className:"space-y-2 pt-2",children:[a.jsx("div",{className:"h-7 w-72 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),a.jsx("div",{className:"h-4 w-96 rounded bg-oai-gray-200 dark:bg-oai-gray-800"})]}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((e,r)=>a.jsx("div",{className:"h-24 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((e,r)=>a.jsx("div",{className:"h-40 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),a.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((e,r)=>a.jsx("div",{className:"h-32 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))})]}),a.jsx("iframe",{src:"https://ip.net.coffee/claude/",title:"Cloud AI IP Check",className:`w-full h-full dark:invert dark:hue-rotate-180 transition-opacity duration-300 ${s?"opacity-100":"opacity-0"}`,style:{border:"none"},onLoad:()=>d(!0)})]})}export{o as default};
@@ -1,5 +1,5 @@
1
- import{r as i,ad as V,S as Ve,D as d,az as O,aA as qn,aB as Jn,ah as Qn,ai as Zn,aC as er,h as tr,j as nr,B as I,aD as rr,am as or,ax as Nt,aE as wt,aF as Kt,aG as Vt,aH as ar}from"./main-D49FUfq7.js";import{L as bn,a as mn,b as dt,l as Et,c as jt,d as sr,e as Gt}from"./leaderboard-columns-9wPbwNaz.js";function ir(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const pt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _t(e){return"nodeType"in e}function G(e){var t,n;return e?Fe(e)?e:_t(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Pt(e){const{Document:t}=G(e);return e instanceof t}function nt(e){return Fe(e)?!1:e instanceof G(e).HTMLElement}function xn(e){return e instanceof G(e).SVGElement}function Ue(e){return e?Fe(e)?e.document:_t(e)?Pt(e)?e:nt(e)||xn(e)?e.ownerDocument:document:document:document}const he=pt?i.useLayoutEffect:i.useEffect;function Bt(e){const t=i.useRef(e);return he(()=>{t.current=e}),i.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function lr(){const e=i.useRef(null),t=i.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=i.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Qe(e,t){t===void 0&&(t=[e]);const n=i.useRef(e);return he(()=>{n.current!==e&&(n.current=e)},t),n}function rt(e,t){const n=i.useRef();return i.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ut(e){const t=Bt(e),n=i.useRef(null),r=i.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Mt(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let kt={};function ot(e,t){return i.useMemo(()=>{if(t)return t;const n=kt[e]==null?0:kt[e]+1;return kt[e]=n,e+"-"+n},[e,t])}function vn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((a,s)=>{const l=Object.entries(s);for(const[c,u]of l){const g=a[c];g!=null&&(a[c]=g+e*u)}return a},{...t})}}const ze=vn(1),Ze=vn(-1);function cr(e){return"clientX"in e&&"clientY"in e}function zt(e){if(!e)return!1;const{KeyboardEvent:t}=G(e.target);return t&&e instanceof t}function dr(e){if(!e)return!1;const{TouchEvent:t}=G(e.target);return t&&e instanceof t}function At(e){if(dr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return cr(e)?{x:e.clientX,y:e.clientY}:null}const et=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[et.Translate.toString(e),et.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ur(e){return e.matches(qt)?e:e.querySelector(qt)}const fr={display:"none"};function gr(e){let{id:t,value:n}=e;return V.createElement("div",{id:t,style:fr},n)}function hr(e){let{id:t,announcement:n,ariaLiveType:r="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 V.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function pr(){const[e,t]=i.useState("");return{announce:i.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const yn=i.createContext(null);function br(e){const t=i.useContext(yn);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mr(){const[e]=i.useState(()=>new Set),t=i.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[i.useCallback(r=>{let{type:o,event:a}=r;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const xr={draggable:`
1
+ import{r as i,ad as V,S as Ve,D as d,az as O,aA as qn,aB as Jn,ah as Qn,ai as Zn,aC as er,h as tr,j as nr,B as I,aD as rr,am as or,ax as Nt,aE as wt,aF as Kt,aG as Vt,aH as ar}from"./main-Cv6YpYdZ.js";import{L as bn,a as mn,b as dt,l as Et,c as jt,d as sr,e as Gt}from"./leaderboard-columns-DFG1TWe9.js";function ir(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const pt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _t(e){return"nodeType"in e}function G(e){var t,n;return e?Fe(e)?e:_t(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Pt(e){const{Document:t}=G(e);return e instanceof t}function nt(e){return Fe(e)?!1:e instanceof G(e).HTMLElement}function xn(e){return e instanceof G(e).SVGElement}function Ue(e){return e?Fe(e)?e.document:_t(e)?Pt(e)?e:nt(e)||xn(e)?e.ownerDocument:document:document:document}const he=pt?i.useLayoutEffect:i.useEffect;function Bt(e){const t=i.useRef(e);return he(()=>{t.current=e}),i.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function lr(){const e=i.useRef(null),t=i.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=i.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Qe(e,t){t===void 0&&(t=[e]);const n=i.useRef(e);return he(()=>{n.current!==e&&(n.current=e)},t),n}function rt(e,t){const n=i.useRef();return i.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ut(e){const t=Bt(e),n=i.useRef(null),r=i.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Mt(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let kt={};function ot(e,t){return i.useMemo(()=>{if(t)return t;const n=kt[e]==null?0:kt[e]+1;return kt[e]=n,e+"-"+n},[e,t])}function vn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((a,s)=>{const l=Object.entries(s);for(const[c,u]of l){const g=a[c];g!=null&&(a[c]=g+e*u)}return a},{...t})}}const ze=vn(1),Ze=vn(-1);function cr(e){return"clientX"in e&&"clientY"in e}function zt(e){if(!e)return!1;const{KeyboardEvent:t}=G(e.target);return t&&e instanceof t}function dr(e){if(!e)return!1;const{TouchEvent:t}=G(e.target);return t&&e instanceof t}function At(e){if(dr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return cr(e)?{x:e.clientX,y:e.clientY}:null}const et=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[et.Translate.toString(e),et.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ur(e){return e.matches(qt)?e:e.querySelector(qt)}const fr={display:"none"};function gr(e){let{id:t,value:n}=e;return V.createElement("div",{id:t,style:fr},n)}function hr(e){let{id:t,announcement:n,ariaLiveType:r="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 V.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function pr(){const[e,t]=i.useState("");return{announce:i.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const yn=i.createContext(null);function br(e){const t=i.useContext(yn);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mr(){const[e]=i.useState(()=>new Set),t=i.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[i.useCallback(r=>{let{type:o,event:a}=r;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const xr={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
5
- `},vr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function yr(e){let{announcements:t=vr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=xr}=e;const{announce:a,announcement:s}=pr(),l=ot("DndLiveRegion"),[c,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),br(i.useMemo(()=>({onDragStart(f){let{active:b}=f;a(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:h}=f;t.onDragMove&&a(t.onDragMove({active:b,over:h}))},onDragOver(f){let{active:b,over:h}=f;a(t.onDragOver({active:b,over:h}))},onDragEnd(f){let{active:b,over:h}=f;a(t.onDragEnd({active:b,over:h}))},onDragCancel(f){let{active:b,over:h}=f;a(t.onDragCancel({active:b,over:h}))}}),[a,t])),!c)return null;const g=V.createElement(V.Fragment,null,V.createElement(gr,{id:r,value:o.draggable}),V.createElement(hr,{id:l,announcement:s}));return n?Ve.createPortal(g,n):g}var P;(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"})(P||(P={}));function ft(){}function Jt(e,t){return i.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function wr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ue=Object.freeze({x:0,y:0});function wn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function kr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Qt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Sn(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Sr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Zt(t,t.left,t.top),a=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const u=wn(Zt(c),o);a.push({id:l,data:{droppableContainer:s,value:u}})}}return a.sort(kn)},Cr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Qt(t),a=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const u=Qt(c),g=o.reduce((b,h,S)=>b+wn(u[S],h),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:f}})}}return a.sort(kn)};function Rr(e,t){const n=Math.max(t.top,e.top),r=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-r,l=a-n;if(r<o&&n<a){const c=t.width*t.height,u=e.width*e.height,g=s*l,f=g/(c+u-g);return Number(f.toFixed(4))}return 0}const Dr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const c=Rr(l,t);c>0&&o.push({id:s,data:{droppableContainer:a,value:c}})}}return o.sort(kr)};function Nr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Cn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Er(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...n})}}const jr=Er(1);function Mr(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 Ar(e,t,n){const r=Mr(t);if(!r)return e;const{scaleX:o,scaleY:a,x:s,y:l}=r,c=e.left-s-(1-o)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:c+g,bottom:u+f,left:c}}const Ir={ignoreTransform:!1};function Xe(e,t){t===void 0&&(t=Ir);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=G(e).getComputedStyle(e);u&&(n=Ar(n,u,g))}const{top:r,left:o,width:a,height:s,bottom:l,right:c}=n;return{top:r,left:o,width:a,height:s,bottom:l,right:c}}function en(e){return Xe(e,{ignoreTransform:!0})}function Tr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Lr(e,t){return t===void 0&&(t=G(e).getComputedStyle(e)),t.position==="fixed"}function Or(e,t){t===void 0&&(t=G(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?n.test(a):!1})}function bt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Pt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!nt(o)||xn(o)||n.includes(o))return n;const a=G(e).getComputedStyle(o);return o!==e&&Or(o,a)&&n.push(o),Lr(o,a)?n:r(o.parentNode)}return e?r(e):n}function Rn(e){const[t]=bt(e,1);return t??null}function St(e){return!pt||!e?null:Fe(e)?e:_t(e)?Pt(e)||e===Ue(e).scrollingElement?window:nt(e)?e:null:null}function Dn(e){return Fe(e)?e.scrollX:e.scrollLeft}function Nn(e){return Fe(e)?e.scrollY:e.scrollTop}function It(e){return{x:Dn(e),y:Nn(e)}}var z;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(z||(z={}));function En(e){return!pt||!e?!1:e===document.scrollingElement}function jn(e){const t={x:0,y:0},n=En(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:s,isRight:l,maxScroll:r,minScroll:t}}const _r={x:.2,y:.2};function Pr(e,t,n,r,o){let{top:a,left:s,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=_r);const{isTop:u,isBottom:g,isLeft:f,isRight:b}=jn(e),h={x:0,y:0},S={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(h.y=z.Backward,S.y=r*Math.abs((t.top+m.height-a)/m.height)):!g&&c>=t.bottom-m.height&&(h.y=z.Forward,S.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!b&&l>=t.right-m.width?(h.x=z.Forward,S.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&s<=t.left+m.width&&(h.x=z.Backward,S.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:S}}function Br(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:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Mn(e){return e.reduce((t,n)=>ze(t,It(n)),ue)}function zr(e){return e.reduce((t,n)=>t+Dn(n),0)}function $r(e){return e.reduce((t,n)=>t+Nn(n),0)}function Fr(e,t){if(t===void 0&&(t=Xe),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Rn(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ur=[["x",["left","right"],zr],["y",["top","bottom"],$r]];class $t{constructor(t,n){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 r=bt(n),o=Mn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of Ur)for(const c of s)Object.defineProperty(this,c,{get:()=>{const u=l(r),g=o[a]-u;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Xr(e){const{EventTarget:t}=G(e);return e instanceof t?e:Ue(e)}function Ct(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(se||(se={}));function tn(e){e.preventDefault()}function Yr(e){e.stopPropagation()}var N;(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"})(N||(N={}));const An={start:[N.Space,N.Enter],cancel:[N.Esc],end:[N.Space,N.Enter,N.Tab]},Wr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N.Right:return{...n,x:n.x+25};case N.Left:return{...n,x:n.x-25};case N.Down:return{...n,y:n.y+25};case N.Up:return{...n,y:n.y-25}}};class Ft{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:n}}=t;this.props=t,this.listeners=new Ge(Ue(n)),this.windowListeners=new Ge(G(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(se.Resize,this.handleCancel),this.windowListeners.add(se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Fr(r),n(ue)}handleKeyDown(t){if(zt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=An,coordinateGetter:s=Wr,scrollBehavior:l="smooth"}=o,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,g=u?{x:u.left,y:u.top}:ue;this.referenceCoordinates||(this.referenceCoordinates=g);const f=s(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=Ze(f,g),h={x:0,y:0},{scrollableAncestors:S}=r.current;for(const m of S){const x=t.code,{isTop:w,isRight:C,isLeft:v,isBottom:R,maxScroll:E,minScroll:j}=jn(m),k=Br(m),y={x:Math.min(x===N.Right?k.right-k.width/2:k.right,Math.max(x===N.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(x===N.Down?k.bottom-k.height/2:k.bottom,Math.max(x===N.Down?k.top:k.top+k.height/2,f.y))},T=x===N.Right&&!C||x===N.Left&&!v,L=x===N.Down&&!R||x===N.Up&&!w;if(T&&y.x!==f.x){const D=m.scrollLeft+b.x,W=x===N.Right&&D<=E.x||x===N.Left&&D>=j.x;if(W&&!b.y){m.scrollTo({left:D,behavior:l});return}W?h.x=m.scrollLeft-D:h.x=x===N.Right?m.scrollLeft-E.x:m.scrollLeft-j.x,h.x&&m.scrollBy({left:-h.x,behavior:l});break}else if(L&&y.y!==f.y){const D=m.scrollTop+b.y,W=x===N.Down&&D<=E.y||x===N.Up&&D>=j.y;if(W&&!b.x){m.scrollTo({top:D,behavior:l});return}W?h.y=m.scrollTop-D:h.y=x===N.Down?m.scrollTop-E.y:m.scrollTop-j.y,h.y&&m.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ze(Ze(f,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ft.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=An,onActivation:o}=t,{active:a}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function nn(e){return!!(e&&"distance"in e)}function rn(e){return!!(e&&"delay"in e)}class Ut{constructor(t,n,r){var o;r===void 0&&(r=Xr(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=n;const{event:a}=t,{target:s}=a;this.props=t,this.events=n,this.document=Ue(s),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(G(s)),this.initialCoordinates=(o=At(a))!=null?o:ue,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:n,bypassActivationConstraint:r}}}=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(se.Resize,this.handleCancel),this.windowListeners.add(se.DragStart,tn),this.windowListeners.add(se.VisibilityChange,this.handleCancel),this.windowListeners.add(se.ContextMenu,tn),this.documentListeners.add(se.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nn(n)){this.handlePending(n);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,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(se.Click,Yr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:l}}=a;if(!o)return;const c=(n=At(t))!=null?n:ue,u=Ze(o,c);if(!r&&l){if(nn(l)){if(l.tolerance!=null&&Ct(u,l.tolerance))return this.handleCancel();if(Ct(u,l.distance))return this.handleStart()}if(rn(l)&&Ct(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),s(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===N.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Hr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xt extends Ut{constructor(t){const{event:n}=t,r=Ue(n.target);super(t,Hr,r)}}Xt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Kr={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class Vr extends Ut{constructor(t){super(t,Kr,Ue(t.event.target))}}Vr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tt.RightClick?!1:(r?.({event:n}),!0)}}];const Rt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Gr extends Ut{constructor(t){super(t,Rt)}static setup(){return window.addEventListener(Rt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rt.move.name,t)};function t(){}}}Gr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var gt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gt||(gt={}));function qr(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:s=5,order:l=gt.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:b}=e;const h=Qr({delta:f,disabled:!a}),[S,m]=lr(),x=i.useRef({x:0,y:0}),w=i.useRef({x:0,y:0}),C=i.useMemo(()=>{switch(n){case qe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qe.DraggableRect:return o}},[n,o,c]),v=i.useRef(null),R=i.useCallback(()=>{const j=v.current;if(!j)return;const k=x.current.x*w.current.x,y=x.current.y*w.current.y;j.scrollBy(k,y)},[]),E=i.useMemo(()=>l===gt.TreeOrder?[...u].reverse():u,[l,u]);i.useEffect(()=>{if(!a||!u.length||!C){m();return}for(const j of E){if(r?.(j)===!1)continue;const k=u.indexOf(j),y=g[k];if(!y)continue;const{direction:T,speed:L}=Pr(j,y,C,t,b);for(const D of["x","y"])h[D][T[D]]||(L[D]=0,T[D]=0);if(L.x>0||L.y>0){m(),v.current=j,S(R,s),x.current=L,w.current=T;return}}x.current={x:0,y:0},w.current={x:0,y:0},m()},[t,R,r,m,a,s,JSON.stringify(C),JSON.stringify(h),S,u,E,g,JSON.stringify(b)])}const Jr={x:{[z.Backward]:!1,[z.Forward]:!1},y:{[z.Backward]:!1,[z.Forward]:!1}};function Qr(e){let{delta:t,disabled:n}=e;const r=Mt(t);return rt(o=>{if(n||!r||!o)return Jr;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[z.Backward]:o.x[z.Backward]||a.x===-1,[z.Forward]:o.x[z.Forward]||a.x===1},y:{[z.Backward]:o.y[z.Backward]||a.y===-1,[z.Forward]:o.y[z.Forward]||a.y===1}}},[n,t,r])}function Zr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return rt(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function eo(e,t){return i.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...a]},[]),[e,t])}var tt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(tt||(tt={}));var Lt;(function(e){e.Optimized="optimized"})(Lt||(Lt={}));const on=new Map;function to(e,t){let{dragging:n,dependencies:r,config:o}=t;const[a,s]=i.useState(null),{frequency:l,measure:c,strategy:u}=o,g=i.useRef(e),f=x(),b=Qe(f),h=i.useCallback(function(w){w===void 0&&(w=[]),!b.current&&s(C=>C===null?w:C.concat(w.filter(v=>!C.includes(v))))},[b]),S=i.useRef(null),m=rt(w=>{if(f&&!n)return on;if(!w||w===on||g.current!==e||a!=null){const C=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){C.set(v.id,v.rect.current);continue}const R=v.node.current,E=R?new $t(c(R),R):null;v.rect.current=E,E&&C.set(v.id,E)}return C}return w},[e,a,n,f,c]);return i.useEffect(()=>{g.current=e},[e]),i.useEffect(()=>{f||h()},[n,f]),i.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),i.useEffect(()=>{f||typeof l!="number"||S.current!==null||(S.current=setTimeout(()=>{h(),S.current=null},l))},[l,f,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:a!=null};function x(){switch(u){case tt.Always:return!1;case tt.BeforeDragging:return n;default:return!n}}}function In(e,t){return rt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function no(e,t){return In(e,t)}function ro(e){let{callback:t,disabled:n}=e;const r=Bt(t),o=i.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function mt(e){let{callback:t,disabled:n}=e;const r=Bt(t),o=i.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function oo(e){return new $t(Xe(e),e)}function an(e,t,n){t===void 0&&(t=oo);const[r,o]=i.useState(null);function a(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const s=ro({callback(c){if(e)for(const u of c){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=mt({callback:a});return he(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),r}function ao(e){const t=In(e);return Cn(e,t)}const sn=[];function so(e){const t=i.useRef(e),n=rt(r=>e?r&&r!==sn&&e&&t.current&&e.parentNode===t.current.parentNode?r:bt(e):sn,[e]);return i.useEffect(()=>{t.current=e},[e]),n}function io(e){const[t,n]=i.useState(null),r=i.useRef(e),o=i.useCallback(a=>{const s=St(a.target);s&&n(l=>l?(l.set(s,It(s)),new Map(l)):null)},[]);return i.useEffect(()=>{const a=r.current;if(e!==a){s(a);const l=e.map(c=>{const u=St(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,It(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{s(e),s(a)};function s(l){l.forEach(c=>{const u=St(c);u?.removeEventListener("scroll",o)})}},[o,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ze(a,s),ue):Mn(e):ue,[e,t])}function ln(e,t){t===void 0&&(t=[]);const n=i.useRef(null);return i.useEffect(()=>{n.current=null},t),i.useEffect(()=>{const r=e!==ue;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ze(e,n.current):ue}function lo(e){i.useEffect(()=>{if(!pt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function co(e,t){return i.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=s=>{a(s,t)},n},{}),[e,t])}function Tn(e){return i.useMemo(()=>e?Tr(e):null,[e])}const cn=[];function uo(e,t){t===void 0&&(t=Xe);const[n]=e,r=Tn(n?G(n):null),[o,a]=i.useState(cn);function s(){a(()=>e.length?e.map(c=>En(c)?r:new $t(t(c),c)):cn)}const l=mt({callback:s});return he(()=>{l?.disconnect(),s(),e.forEach(c=>l?.observe(c))},[e]),o}function fo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nt(t)?t:e}function go(e){let{measure:t}=e;const[n,r]=i.useState(null),o=i.useCallback(u=>{for(const{target:g}of u)if(nt(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),a=mt({callback:o}),s=i.useCallback(u=>{const g=fo(u);a?.disconnect(),g&&a?.observe(g),r(g?t(g):null)},[t,a]),[l,c]=ut(s);return i.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ho=[{sensor:Xt,options:{}},{sensor:Ft,options:{}}],po={current:{}},ct={draggable:{measure:en},droppable:{measure:en,strategy:tt.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:Xe}};class Je extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const bo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ft},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:ft,windowRect:null,measuringScheduled:!1},mo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ft,draggableNodes:new Map,over:null,measureDroppableContainers:ft},xt=i.createContext(mo),Ln=i.createContext(bo);function xo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function vo(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.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 P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case P.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const s=new Je(e.droppable.containers);return s.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case P.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Je(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yo(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=i.useContext(xt),a=Mt(r),s=Mt(n?.id);return i.useEffect(()=>{if(!t&&!r&&a&&s!=null){if(!zt(a)||document.activeElement===a.target)return;const l=o.get(s);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[c.current,u.current]){if(!g)continue;const f=ur(g);if(f){f.focus();break}}})}},[r,t,o,s,a]),null}function wo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function ko(e){return i.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function So(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const a=i.useRef(!1),{x:s,y:l}=typeof o=="boolean"?{x:o,y:o}:o;he(()=>{if(!s&&!l||!t){a.current=!1;return}if(a.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=n(u),f=Cn(g,r);if(s||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=Rn(u);b&&b.scrollBy({top:f.y,left:f.x})}},[t,s,l,r,n])}const On=i.createContext({...ue,scaleX:1,scaleY:1});var Ne;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ne||(Ne={}));const Co=i.memo(function(t){var n,r,o,a;let{id:s,accessibility:l,autoScroll:c=!0,children:u,sensors:g=ho,collisionDetection:f=Dr,measuring:b,modifiers:h,...S}=t;const m=i.useReducer(vo,void 0,xo),[x,w]=m,[C,v]=mr(),[R,E]=i.useState(Ne.Uninitialized),j=R===Ne.Initialized,{draggable:{active:k,nodes:y,translate:T},droppable:{containers:L}}=x,D=k!=null?y.get(k):null,W=i.useRef({initial:null,translated:null}),H=i.useMemo(()=>{var Y;return k!=null?{id:k,data:(Y=D?.data)!=null?Y:po,rect:W}:null},[k,D]),ee=i.useRef(null),[ke,Ee]=i.useState(null),[$,je]=i.useState(null),B=Qe(S,Object.values(S)),Me=ot("DndDescribedBy",s),Le=i.useMemo(()=>L.getEnabled(),[L]),F=ko(b),{droppableRects:_,measureDroppableContainers:te,measuringScheduled:q}=to(Le,{dragging:j,dependencies:[T.x,T.y],config:F.droppable}),K=Zr(y,k),Ae=i.useMemo(()=>$?At($):null,[$]),ie=Gn(),ne=no(K,F.draggable.measure);So({activeNode:k!=null?y.get(k):null,config:ie.layoutShiftCompensation,initialRect:ne,measure:F.draggable.measure});const M=an(K,F.draggable.measure,ne),pe=an(K?K.parentElement:null),re=i.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:_,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),be=L.getNodeFor((n=re.current.over)==null?void 0:n.id),oe=go({measure:F.dragOverlay.measure}),me=(r=oe.nodeRef.current)!=null?r:K,xe=j?(o=oe.rect)!=null?o:M:null,Oe=!!(oe.nodeRef.current&&oe.rect),at=ao(Oe?null:M),Ye=Tn(me?G(me):null),le=so(j?be??K:null),Ie=uo(le),_e=wo(h,{transform:{x:T.x-at.x,y:T.y-at.y,scaleX:1,scaleY:1},activatorEvent:$,active:H,activeNodeRect:M,containerNodeRect:pe,draggingNodeRect:xe,over:re.current.over,overlayNodeRect:oe.rect,scrollableAncestors:le,scrollableAncestorRects:Ie,windowRect:Ye}),Se=Ae?ze(Ae,T):null,Pe=io(le),p=ln(Pe),A=ln(Pe,[M]),X=ze(_e,p),ve=xe?jr(xe,_e):null,Te=H&&ve?f({active:H,collisionRect:ve,droppableRects:_,droppableContainers:Le,pointerCoordinates:Se}):null,ce=Sn(Te,"id"),[ye,Yt]=i.useState(null),Yn=Oe?_e:ze(_e,A),Wn=Nr(Yn,(a=ye?.rect)!=null?a:null,M),vt=i.useRef(null),Wt=i.useCallback((Y,J)=>{let{sensor:Q,options:Ce}=J;if(ee.current==null)return;const ae=y.get(ee.current);if(!ae)return;const Z=Y.nativeEvent,fe=new Q({active:ee.current,activeNode:ae,event:Z,options:Ce,context:re,onAbort(U){if(!y.get(U))return;const{onDragAbort:ge}=B.current,we={id:U};ge?.(we),C({type:"onDragAbort",event:we})},onPending(U,Re,ge,we){if(!y.get(U))return;const{onDragPending:He}=B.current,De={id:U,constraint:Re,initialCoordinates:ge,offset:we};He?.(De),C({type:"onDragPending",event:De})},onStart(U){const Re=ee.current;if(Re==null)return;const ge=y.get(Re);if(!ge)return;const{onDragStart:we}=B.current,We={activatorEvent:Z,active:{id:Re,data:ge.data,rect:W}};Ve.unstable_batchedUpdates(()=>{we?.(We),E(Ne.Initializing),w({type:P.DragStart,initialCoordinates:U,active:Re}),C({type:"onDragStart",event:We}),Ee(vt.current),je(Z)})},onMove(U){w({type:P.DragMove,coordinates:U})},onEnd:Be(P.DragEnd),onCancel:Be(P.DragCancel)});vt.current=fe;function Be(U){return async function(){const{active:ge,collisions:we,over:We,scrollAdjustedTranslate:He}=re.current;let De=null;if(ge&&He){const{cancelDrop:Ke}=B.current;De={activatorEvent:Z,active:ge,collisions:we,delta:He,over:We},U===P.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(De))&&(U=P.DragCancel)}ee.current=null,Ve.unstable_batchedUpdates(()=>{w({type:U}),E(Ne.Uninitialized),Yt(null),Ee(null),je(null),vt.current=null;const Ke=U===P.DragEnd?"onDragEnd":"onDragCancel";if(De){const yt=B.current[Ke];yt?.(De),C({type:Ke,event:De})}})}}},[y]),Hn=i.useCallback((Y,J)=>(Q,Ce)=>{const ae=Q.nativeEvent,Z=y.get(Ce);if(ee.current!==null||!Z||ae.dndKit||ae.defaultPrevented)return;const fe={active:Z};Y(Q,J.options,fe)===!0&&(ae.dndKit={capturedBy:J.sensor},ee.current=Ce,Wt(Q,J))},[y,Wt]),Ht=eo(g,Hn);lo(g),he(()=>{M&&R===Ne.Initializing&&E(Ne.Initialized)},[M,R]),i.useEffect(()=>{const{onDragMove:Y}=B.current,{active:J,activatorEvent:Q,collisions:Ce,over:ae}=re.current;if(!J||!Q)return;const Z={active:J,activatorEvent:Q,collisions:Ce,delta:{x:X.x,y:X.y},over:ae};Ve.unstable_batchedUpdates(()=>{Y?.(Z),C({type:"onDragMove",event:Z})})},[X.x,X.y]),i.useEffect(()=>{const{active:Y,activatorEvent:J,collisions:Q,droppableContainers:Ce,scrollAdjustedTranslate:ae}=re.current;if(!Y||ee.current==null||!J||!ae)return;const{onDragOver:Z}=B.current,fe=Ce.get(ce),Be=fe&&fe.rect.current?{id:fe.id,rect:fe.rect.current,data:fe.data,disabled:fe.disabled}:null,U={active:Y,activatorEvent:J,collisions:Q,delta:{x:ae.x,y:ae.y},over:Be};Ve.unstable_batchedUpdates(()=>{Yt(Be),Z?.(U),C({type:"onDragOver",event:U})})},[ce]),he(()=>{re.current={activatorEvent:$,active:H,activeNode:K,collisionRect:ve,collisions:Te,droppableRects:_,draggableNodes:y,draggingNode:me,draggingNodeRect:xe,droppableContainers:L,over:ye,scrollableAncestors:le,scrollAdjustedTranslate:X},W.current={initial:xe,translated:ve}},[H,K,Te,ve,y,me,xe,_,L,ye,le,X]),qr({...ie,delta:T,draggingRect:ve,pointerCoordinates:Se,scrollableAncestors:le,scrollableAncestorRects:Ie});const Kn=i.useMemo(()=>({active:H,activeNode:K,activeNodeRect:M,activatorEvent:$,collisions:Te,containerNodeRect:pe,dragOverlay:oe,draggableNodes:y,droppableContainers:L,droppableRects:_,over:ye,measureDroppableContainers:te,scrollableAncestors:le,scrollableAncestorRects:Ie,measuringConfiguration:F,measuringScheduled:q,windowRect:Ye}),[H,K,M,$,Te,pe,oe,y,L,_,ye,te,le,Ie,F,q,Ye]),Vn=i.useMemo(()=>({activatorEvent:$,activators:Ht,active:H,activeNodeRect:M,ariaDescribedById:{draggable:Me},dispatch:w,draggableNodes:y,over:ye,measureDroppableContainers:te}),[$,Ht,H,M,w,Me,y,ye,te]);return V.createElement(yn.Provider,{value:v},V.createElement(xt.Provider,{value:Vn},V.createElement(Ln.Provider,{value:Kn},V.createElement(On.Provider,{value:Wn},u)),V.createElement(yo,{disabled:l?.restoreFocus===!1})),V.createElement(yr,{...l,hiddenTextDescribedById:Me}));function Gn(){const Y=ke?.autoScrollEnabled===!1,J=typeof c=="object"?c.enabled===!1:c===!1,Q=j&&!Y&&!J;return typeof c=="object"?{...c,enabled:Q}:{enabled:Q}}}),Ro=i.createContext(null),dn="button",Do="Draggable";function No(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=ot(Do),{activators:s,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:b}=i.useContext(xt),{role:h=dn,roleDescription:S="draggable",tabIndex:m=0}=o??{},x=c?.id===t,w=i.useContext(x?On:Ro),[C,v]=ut(),[R,E]=ut(),j=co(s,t),k=Qe(n);he(()=>(f.set(t,{id:t,key:a,node:C,activatorNode:R,data:k}),()=>{const T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);const y=i.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&h===dn?!0:void 0,"aria-roledescription":S,"aria-describedby":g.draggable}),[r,h,m,x,S,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:y,isDragging:x,listeners:r?void 0:j,node:C,over:b,setNodeRef:v,setActivatorNodeRef:E,transform:w}}function Eo(){return i.useContext(Ln)}const jo="Droppable",Mo={timeout:25};function Ao(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=ot(jo),{active:s,dispatch:l,over:c,measureDroppableContainers:u}=i.useContext(xt),g=i.useRef({disabled:n}),f=i.useRef(!1),b=i.useRef(null),h=i.useRef(null),{disabled:S,updateMeasurementsFor:m,timeout:x}={...Mo,...o},w=Qe(m??r),C=i.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(w.current)?w.current:[w.current]),h.current=null},x)},[x]),v=mt({callback:C,disabled:S||!s}),R=i.useCallback((y,T)=>{v&&(T&&(v.unobserve(T),f.current=!1),y&&v.observe(y))},[v]),[E,j]=ut(R),k=Qe(t);return i.useEffect(()=>{!v||!E.current||(v.disconnect(),f.current=!1,v.observe(E.current))},[E,v]),i.useEffect(()=>(l({type:P.RegisterDroppable,element:{id:r,key:a,disabled:n,node:E,rect:b,data:k}}),()=>l({type:P.UnregisterDroppable,key:a,id:r})),[r]),i.useEffect(()=>{n!==g.current.disabled&&(l({type:P.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,l]),{active:s,rect:b,isOver:c?.id===r,node:E,over:c,setNodeRef:j}}const Io=e=>{let{transform:t}=e;return{...t,y:0}};function _n(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function To(e,t){return e.reduce((n,r,o)=>{const a=t.get(r);return a&&(n[o]=a),n},Array(e.length))}function st(e){return e!==null&&e>=0}function Lo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Oo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const it={scaleX:1,scaleY:1},_o=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:a,index:s}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const c=Po(n,s,o);if(s===o){const u=n[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...it}:null}return s>o&&s<=a?{x:-l.width-c,y:0,...it}:s<o&&s>=a?{x:l.width+c,y:0,...it}:{x:0,y:0,...it}};function Po(e,t,n){const r=e[t],o=e[t-1],a=e[t+1];return!r||!o&&!a?0:n<t?o?r.left-(o.left+o.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(o.left+o.width)}const Pn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=_n(t,r,n),s=t[o],l=a[o];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},Bn="Sortable",zn=V.createContext({activeIndex:-1,containerId:Bn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Pn,disabled:{draggable:!1,droppable:!1}});function Bo(e){let{children:t,id:n,items:r,strategy:o=Pn,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:g}=Eo(),f=ot(Bn,n),b=l.rect!==null,h=i.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),S=s!=null,m=s?h.indexOf(s.id):-1,x=u?h.indexOf(u.id):-1,w=i.useRef(h),C=!Lo(h,w.current),v=x!==-1&&m===-1||C,R=Oo(a);he(()=>{C&&S&&g(h)},[C,h,S,g]),i.useEffect(()=>{w.current=h},[h]);const E=i.useMemo(()=>({activeIndex:m,containerId:f,disabled:R,disableTransforms:v,items:h,overIndex:x,useDragOverlay:b,sortedRects:To(h,c),strategy:o}),[m,f,R.draggable,R.droppable,v,h,x,c,b,o]);return V.createElement(zn.Provider,{value:E},t)}const zo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return _n(n,r,o).indexOf(t)},$o=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:s,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==a&&o===s?!1:n?!0:s!==o&&t===c},Fo={duration:200,easing:"ease"},$n="transform",Uo=et.Transition.toString({property:$n,duration:0,easing:"linear"}),Xo={roleDescription:"sortable"};function Yo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[a,s]=i.useState(null),l=i.useRef(n);return he(()=>{if(!t&&n!==l.current&&r.current){const c=o.current;if(c){const u=Xe(r.current,{ignoreTransform:!0}),g={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(g.x||g.y)&&s(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),i.useEffect(()=>{a&&s(null)},[a]),a}function Wo(e){let{animateLayoutChanges:t=$o,attributes:n,disabled:r,data:o,getNewIndex:a=zo,id:s,strategy:l,resizeObserverConfig:c,transition:u=Fo}=e;const{items:g,containerId:f,activeIndex:b,disabled:h,disableTransforms:S,sortedRects:m,overIndex:x,useDragOverlay:w,strategy:C}=i.useContext(zn),v=Ho(r,h),R=g.indexOf(s),E=i.useMemo(()=>({sortable:{containerId:f,index:R,items:g},...o}),[f,o,R,g]),j=i.useMemo(()=>g.slice(g.indexOf(s)),[g,s]),{rect:k,node:y,isOver:T,setNodeRef:L}=Ao({id:s,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:D,activatorEvent:W,activeNodeRect:H,attributes:ee,setNodeRef:ke,listeners:Ee,isDragging:$,over:je,setActivatorNodeRef:B,transform:Me}=No({id:s,data:E,attributes:{...Xo,...n},disabled:v.draggable}),Le=ir(L,ke),F=!!D,_=F&&!S&&st(b)&&st(x),te=!w&&$,q=te&&_?Me:null,Ae=_?q??(l??C)({rects:m,activeNodeRect:H,activeIndex:b,overIndex:x,index:R}):null,ie=st(b)&&st(x)?a({id:s,items:g,activeIndex:b,overIndex:x}):R,ne=D?.id,M=i.useRef({activeId:ne,items:g,newIndex:ie,containerId:f}),pe=g!==M.current.items,re=t({active:D,containerId:f,isDragging:$,isSorting:F,id:s,index:R,items:g,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),be=Yo({disabled:!re,index:R,node:y,rect:k});return i.useEffect(()=>{F&&M.current.newIndex!==ie&&(M.current.newIndex=ie),f!==M.current.containerId&&(M.current.containerId=f),g!==M.current.items&&(M.current.items=g)},[F,ie,f,g]),i.useEffect(()=>{if(ne===M.current.activeId)return;if(ne&&!M.current.activeId){M.current.activeId=ne;return}const me=setTimeout(()=>{M.current.activeId=ne},50);return()=>clearTimeout(me)},[ne]),{active:D,activeIndex:b,attributes:ee,data:E,rect:k,index:R,newIndex:ie,items:g,isOver:T,isSorting:F,isDragging:$,listeners:Ee,node:y,overIndex:x,over:je,setNodeRef:Le,setActivatorNodeRef:B,setDroppableNodeRef:L,setDraggableNodeRef:ke,transform:be??Ae,transition:oe()};function oe(){if(be||pe&&M.current.newIndex===R)return Uo;if(!(te&&!zt(W)||!u)&&(F||re))return et.Transition.toString({...u,property:$n})}}function Ho(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function ht(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 Ko=[N.Down,N.Right,N.Up,N.Left],Vo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(Ko.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const b=o.get(f.id);if(b)switch(e.code){case N.Down:r.top<b.top&&c.push(f);break;case N.Up:r.top>b.top&&c.push(f);break;case N.Left:r.left>b.left&&c.push(f);break;case N.Right:r.left<b.left&&c.push(f);break}});const u=Cr({collisionRect:r,droppableRects:o,droppableContainers:c});let g=Sn(u,"id");if(g===s?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(n.id),b=a.get(g),h=b?o.get(b.id):null,S=b?.node.current;if(S&&h&&f&&b){const x=bt(S).some((j,k)=>l[k]!==j),w=Fn(f,b),C=Go(f,b),v=x||!w?{x:0,y:0}:{x:C?r.width-h.width:0,y:C?r.height-h.height:0},R={x:h.left,y:h.top};return v.x&&v.y?R:Ze(R,v)}}}};function Fn(e,t){return!ht(e)||!ht(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Go(e,t){return!ht(e)||!ht(t)||!Fn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function $e(e,{min:t,max:n,fallback:r}){const o=Number(e);if(!Number.isFinite(o))return r;const a=Math.floor(o);return a<t?t:a>n?n:a}function qo(e,t){const n=$e(t,{min:0,max:1e6,fallback:0}),r=$e(e,{min:1,max:Math.max(1,n||1),fallback:1});if(n<=1)return[1];const o=new Set([1,n,r-2,r-1,r,r+1,r+2]),a=Array.from(o).filter(c=>Number.isInteger(c)&&c>=1&&c<=n).sort((c,u)=>c-u),s=[];let l=null;for(const c of a)l!=null&&c-l>1&&s.push(null),s.push(c),l=c;return s}function Jo({page:e,totalPages:t}){const n=typeof t=="number"&&Number.isFinite(t)&&t>=0,r=n?$e(t,{min:0,max:1e6,fallback:0}):null,o=$e(e,{min:1,max:n?Math.max(1,r||1):1e6,fallback:1}),a=o>1,s=n?o<r:!0;return{canPrev:a,canNext:s,safePage:o,safeTotal:r}}function Qo({entries:e,me:t,meLabel:n,limit:r}){const o=$e(r,{min:1,max:1e3,fallback:20}),a=Array.isArray(e)?e.slice(0,o):[],s=t&&typeof t.rank=="number"?t.rank:null,l=a.some(h=>!!h?.is_me);if(!s||l)return a;const c={rank:s,is_me:!0,display_name:n,avatar_url:null,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",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0"},u=3,g=4,b=a.filter(h=>!h?.is_me).filter((h,S)=>S!==u).slice();return b.splice(Math.min(g,b.length),0,c),b.slice(0,o)}function de({className:e}){return d.jsx("div",{className:O("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function Zo({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",n=e<3?"w-16":"w-12",r=e<5?"w-14":"w-10";return d.jsxs("tr",{className:"group",children:[d.jsx("td",{className:O(Et(!1),"!group-hover:bg-transparent"),children:d.jsx(de,{className:"h-4 w-6"})}),d.jsx("td",{className:O(jt(!1),"!group-hover:bg-transparent"),children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(de,{className:"h-8 w-8 min-w-8 rounded-full"}),d.jsx(de,{className:O("h-4",t)})]})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:O("h-4",n)})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:"h-4 w-12"})}),dt.map(o=>d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:O("h-4",r)})},o.key))]})}function ea({rows:e=10}){return d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:O(bn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-6"})}),d.jsx("th",{className:O(mn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-12"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-10"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-14"})}),dt.map(t=>d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-12"})},t.key))]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,n)=>d.jsx(Zo,{index:n},n))})]})})}function ta({id:e,thClassName:t,children:n}){const{attributes:r,listeners:o,setNodeRef:a,transform:s,transition:l,isDragging:c}=Wo({id:e}),u=et.Transform.toString(s)||"";i.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),b="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(h=>{h.style.transform=u,h.style.transition=l||"",h.style.zIndex=c?"20":"",h.style.position=u?"relative":"",h.style.boxShadow=c?b:""}),()=>{f.forEach(h=>{h.style.transform="",h.style.transition="",h.style.zIndex="",h.style.position="",h.style.boxShadow=""})}},[e,u,l,c]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:c?20:void 0,boxShadow:c?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return d.jsx("th",{ref:a,style:g,className:O(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...r,...o,children:d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsx("span",{"aria-hidden":"true",className:O("-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",c&&"opacity-100"),children:d.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[d.jsx("circle",{cx:"2",cy:"2",r:"1"}),d.jsx("circle",{cx:"6",cy:"2",r:"1"}),d.jsx("circle",{cx:"2",cy:"7",r:"1"}),d.jsx("circle",{cx:"6",cy:"7",r:"1"}),d.jsx("circle",{cx:"2",cy:"12",r:"1"}),d.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),n]})})}const Un="tokentracker.leaderboard.columnOrder.v1";function na(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Un);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):null}catch{return null}}function Dt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Un,JSON.stringify(e))}catch{}}function un(e,t){if(!e)return t;const n=new Set(t),r=e.filter(a=>n.has(a)),o=t.filter(a=>!r.includes(a));return[...r,...o]}function ra(e){const t=i.useMemo(()=>e.join("|"),[e]),[n,r]=i.useState(()=>un(na(),e));i.useEffect(()=>{r(s=>{const l=un(s,e);return l.length===s.length&&l.every((u,g)=>u===s[g])?s:(Dt(l),l)})},[t,e]);const o=i.useCallback((s,l)=>{!s||!l||s===l||r(c=>{const u=c.indexOf(s),g=c.indexOf(l);if(u===-1||g===-1)return c;const f=c.slice(),[b]=f.splice(u,1);return f.splice(g,0,b),Dt(f),f})},[]),a=i.useCallback(()=>{Dt(e),r(e)},[e]);return{order:n,reorder:o,reset:a}}const lt=20;function fn(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":t>=1e3?`$${Math.round(t).toLocaleString()}`:t>=10?`$${Math.round(t)}`:`$${t.toFixed(2)}`}function gn(e,t,n){const r=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 n.map(a=>d.jsx("td",{"data-column-key":a.key,className:O("px-4 py-4 whitespace-nowrap text-right tabular-nums",r,o),children:Nt(e?.[a.key])},a.key))}const oa={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 hn({rank:e,placeholder:t}){const n=oa[e];return n?d.jsx("span",{className:O("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",n.text,n.badge),children:e}):d.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function Ot(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 I("shared.error.prefix",{error:I("leaderboard.error.unknown")});const t=e?.message||String(e),n=String(t||"").trim()||I("leaderboard.error.unknown");return I("shared.error.prefix",{error:n})}function Xn(e){return typeof e!="string"?"":e.trim()}function sa(e){const t=Xn(e);return t?t.toLowerCase()==="anonymous":!0}function ia(e,t=""){if(typeof e!="string")return null;const n=e.trim().toLowerCase();if(!n)return null;const r=new URLSearchParams(typeof t=="string"?t:""),o=Ot(r.get("period")),a=o?`?period=${o}`:"";return`/share/pv1-${n}${a}`}function pn(e,t){const n=typeof e?.user_id=="string"?e.user_id.trim():"";return n||`${e?.rank??""}:${t}`}function da({auth:e,signedIn:t,sessionSoftExpired:n}){const r=qn(),o=Jn(),{openLoginModal:a}=Qn(),{signedIn:s,loading:l,user:c}=Zn(),u=i.useMemo(()=>er(),[]),g=tr(),f=t&&!n,b=i.useMemo(()=>f&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,f]),h=f?b:null,S=f&&nr(h),m=I("shared.placeholder.short"),x=i.useMemo(()=>dt.map(p=>p.key),[]),{order:w,reorder:C}=ra(x),v=i.useMemo(()=>{const p=new Map;for(const A of dt)p.set(A.key,A);return p},[]),R=i.useMemo(()=>w.map(p=>v.get(p)).filter(Boolean),[w,v]),E=wr(Jt(Xt,{activationConstraint:{distance:6}}),Jt(Ft,{coordinateGetter:Vo})),j=i.useCallback(p=>{const{active:A,over:X}=p;!X||A.id===X.id||C(String(A.id),String(X.id))},[C]),[k,y]=i.useState(1),[T,L]=i.useState(0),[D,W]=i.useState(()=>({loading:!1,error:null,data:null})),[H,ee]=i.useState(()=>rr()),[ke,Ee]=i.useState(!1),[$,je]=i.useState(!1),B=i.useMemo(()=>{const p=new URLSearchParams(r?.search||"");return Ot(p.get("period"))||"total"},[r?.search]),Me=r?.search||"",Le=p=>{const A=Ot(p);if(!A||A===B)return;const X=new URLSearchParams(r?.search||"");X.set("period",A),y(1),o(`${r?.pathname||"/leaderboard"}?${X.toString()}`,{replace:!0})};i.useEffect(()=>{l||g||s||a()},[s,l,g,a]),i.useEffect(()=>{y(1)},[B]);const F=i.useMemo(()=>($e(k,{min:1,max:1e6,fallback:1})-1)*lt,[k]);i.useEffect(()=>{if(!u&&!g)return;let p=!0;return W(A=>({...A,loading:!0,error:null})),(async()=>{const A=await or({userId:c?.id||null,period:B,limit:lt,offset:F});p&&W({loading:!1,error:null,data:A})})().catch(A=>{p&&W({loading:!1,error:aa(A),data:null})}),()=>{p=!1}},[u,c?.id,F,T,g,B]);const _=D.data,te=_?.total_pages??null,q=_?.page??k,K=i.useMemo(()=>qo(q,te),[q,te]),Ae=_?.from||null,ie=_?.to||null,ne=_?.generated_at||null,M=_?.me||null,pe=I("leaderboard.me_label"),re=I("leaderboard.anon_label"),be=I("leaderboard.period.week"),oe=I("leaderboard.period.month"),me=I("leaderboard.period.total"),xe=B==="month"?oe:B==="total"?me:be,Oe=i.useMemo(()=>{const p=Array.isArray(_?.entries)?_.entries:[];return q!==1?p:Qo({entries:p,me:M,meLabel:pe,limit:lt})},[q,_?.entries,M,pe]),at=async()=>{Ee(!0);try{ar(!0),ee(!0),await Kt(()=>wt(h));const p=await wt(h);p&&await Vt({accessToken:p}),L(A=>A+1)}catch(p){console.warn("[tokentracker] sync:",p)}finally{Ee(!1)}},Ye=async()=>{je(!0);try{const p=await wt(h);H&&p&&await Kt(()=>Promise.resolve(p)),p&&await Vt({accessToken:p}),L(A=>A+1)}catch(p){console.warn("[tokentracker] refresh:",p)}finally{je(!1)}},{canPrev:le,canNext:Ie}=Jo({page:q,totalPages:te}),_e=Array.isArray(Oe)&&Oe.length!==0;let Se=null;D.loading?Se=d.jsx(ea,{rows:lt}):D.error?Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:D.error})}):_e?Se=d.jsx(Co,{sensors:E,collisionDetection:Sr,modifiers:[Io],onDragEnd:j,children:d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:O(bn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:I("leaderboard.column.rank")}),d.jsx("th",{className:O(mn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:I("leaderboard.column.user")}),d.jsx("th",{className:"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:I("leaderboard.column.total")}),d.jsx("th",{className:"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:"Est. Cost"}),d.jsx(Bo,{items:w,strategy:_o,children:R.map(p=>d.jsx(ta,{id:p.key,thClassName:"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:d.jsx(sr,{iconSrc:p.icon,label:I(p.copyKey)})},p.key))})]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Oe.map(p=>{const A=!!p?.is_me,X=typeof p?.user_id=="string"?p.user_id:null,ve=Xn(p?.display_name),Te=sa(ve)?re:ve,ce=A?pe:Te;return!!X&&!A&&!!p?.is_public&&ia(X,Me),A?d.jsxs("tr",{className:"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30 bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",children:[d.jsx("td",{className:O(Et(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400"),children:d.jsx(hn,{rank:p?.rank,placeholder:m})}),d.jsx("td",{className:jt(!0),children:d.jsxs("div",{className:"flex min-w-0 max-w-[min(160px,40vw)] items-center gap-4",children:[d.jsx(Gt,{avatarUrl:p?.avatar_url,displayName:ce,seed:pn(p,ce)}),d.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:ce})]})}),d.jsx("td",{className:"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:Nt(p?.total_tokens)}),d.jsx("td",{className:"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:fn(p?.estimated_cost_usd)}),gn(p,!0,R)]},`row-${p?.rank}-${ce}`):d.jsxs("tr",{className:"group transition-colors",children:[d.jsx("td",{className:O(Et(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(hn,{rank:p?.rank,placeholder:m})}),d.jsx("td",{className:jt(!1),children:d.jsxs("div",{className:"flex min-w-0 max-w-[min(160px,40vw)] items-center gap-4",children:[d.jsx(Gt,{avatarUrl:p?.avatar_url,displayName:ce,seed:pn(p,ce)}),d.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:ce})]})}),d.jsx("td",{className:"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:Nt(p?.total_tokens)}),d.jsx("td",{className:"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:fn(p?.estimated_cost_usd)}),gn(p,!1,R)]},`row-${p?.rank}-${ce}`)})})]})})}):Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:I("leaderboard.empty")})});let Pe=null;return typeof te=="number"?Pe=K.map((p,A)=>p==null?d.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:I("leaderboard.pagination.ellipsis")},`ellipsis-${A}`):d.jsx("button",{className:O("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",p===q?"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:()=>y(p),disabled:D.loading,children:String(p)},`page-${p}`)):Pe=d.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:I("leaderboard.pagination.page_unknown",{page:String(q)})}),d.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[d.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:d.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[d.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:I("leaderboard.title")}),d.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[B==="total"?I("leaderboard.range.total"):Ae&&ie?I("leaderboard.range",{period:xe,from:Ae,to:ie}):I("leaderboard.range_loading",{period:xe}),ne&&d.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:I("leaderboard.generated_at",{ts:ne})})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[f&&S&&d.jsx("div",{className:"inline-flex p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-lg",children:d.jsxs("button",{onClick:Ye,disabled:$||D.loading,className:"px-3 py-1.5 text-sm font-medium rounded-md transition-colors text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 hover:text-oai-black dark:hover:text-white disabled:opacity-50 inline-flex items-center gap-1.5",children:[d.jsxs("svg",{className:O("w-4 h-4",$&&"animate-spin"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.5L21 8"}),d.jsx("path",{d:"M21 3v5h-5"}),d.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.5L3 16"}),d.jsx("path",{d:"M3 21v-5h5"})]}),$?"Refreshing":"Refresh"]})}),d.jsx("div",{className:"inline-flex p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-lg",children:["week","month","total"].map(p=>d.jsx("button",{onClick:()=>Le(p),disabled:D.loading,className:O("px-4 py-1.5 text-sm font-medium rounded-md transition-colors",B===p?"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:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:p==="week"?be:p==="month"?oe:me},p))})]})]}),!t&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:"Sign in to join the leaderboard"}),d.jsx("button",{onClick:a,className:"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:"Sign In"})]}),f&&S&&!H&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:"Enable Cloud Sync to appear in rankings"}),d.jsx("button",{onClick:at,disabled:ke,className:"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:ke?"Syncing...":"Enable & Sync"})]}),d.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[Se,d.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{className:O("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",le&&!D.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:()=>y(p=>Math.max(1,p-1)),disabled:!le||D.loading,children:I("leaderboard.pagination.prev")}),d.jsx("button",{className:O("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ie&&!D.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:()=>y(p=>p+1),disabled:!Ie||D.loading,children:I("leaderboard.pagination.next")})]}),d.jsx("div",{className:"flex flex-wrap items-center gap-1",children:Pe})]})]})]})}),d.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:d.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:[d.jsx("p",{children:I("landing.v2.footer.line")}),d.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:I("landing.v2.nav.github")})]})})]})}export{da as LeaderboardPage};
5
+ `},vr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function yr(e){let{announcements:t=vr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=xr}=e;const{announce:a,announcement:s}=pr(),l=ot("DndLiveRegion"),[c,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),br(i.useMemo(()=>({onDragStart(f){let{active:b}=f;a(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:h}=f;t.onDragMove&&a(t.onDragMove({active:b,over:h}))},onDragOver(f){let{active:b,over:h}=f;a(t.onDragOver({active:b,over:h}))},onDragEnd(f){let{active:b,over:h}=f;a(t.onDragEnd({active:b,over:h}))},onDragCancel(f){let{active:b,over:h}=f;a(t.onDragCancel({active:b,over:h}))}}),[a,t])),!c)return null;const g=V.createElement(V.Fragment,null,V.createElement(gr,{id:r,value:o.draggable}),V.createElement(hr,{id:l,announcement:s}));return n?Ve.createPortal(g,n):g}var P;(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"})(P||(P={}));function ft(){}function Jt(e,t){return i.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function wr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ue=Object.freeze({x:0,y:0});function wn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function kr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Qt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Sn(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Sr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Zt(t,t.left,t.top),a=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const u=wn(Zt(c),o);a.push({id:l,data:{droppableContainer:s,value:u}})}}return a.sort(kn)},Cr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Qt(t),a=[];for(const s of r){const{id:l}=s,c=n.get(l);if(c){const u=Qt(c),g=o.reduce((b,h,S)=>b+wn(u[S],h),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:f}})}}return a.sort(kn)};function Rr(e,t){const n=Math.max(t.top,e.top),r=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-r,l=a-n;if(r<o&&n<a){const c=t.width*t.height,u=e.width*e.height,g=s*l,f=g/(c+u-g);return Number(f.toFixed(4))}return 0}const Dr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const c=Rr(l,t);c>0&&o.push({id:s,data:{droppableContainer:a,value:c}})}}return o.sort(kr)};function Nr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Cn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Er(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...n})}}const jr=Er(1);function Mr(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 Ar(e,t,n){const r=Mr(t);if(!r)return e;const{scaleX:o,scaleY:a,x:s,y:l}=r,c=e.left-s-(1-o)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:c+g,bottom:u+f,left:c}}const Ir={ignoreTransform:!1};function Xe(e,t){t===void 0&&(t=Ir);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=G(e).getComputedStyle(e);u&&(n=Ar(n,u,g))}const{top:r,left:o,width:a,height:s,bottom:l,right:c}=n;return{top:r,left:o,width:a,height:s,bottom:l,right:c}}function en(e){return Xe(e,{ignoreTransform:!0})}function Tr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Lr(e,t){return t===void 0&&(t=G(e).getComputedStyle(e)),t.position==="fixed"}function Or(e,t){t===void 0&&(t=G(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?n.test(a):!1})}function bt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Pt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!nt(o)||xn(o)||n.includes(o))return n;const a=G(e).getComputedStyle(o);return o!==e&&Or(o,a)&&n.push(o),Lr(o,a)?n:r(o.parentNode)}return e?r(e):n}function Rn(e){const[t]=bt(e,1);return t??null}function St(e){return!pt||!e?null:Fe(e)?e:_t(e)?Pt(e)||e===Ue(e).scrollingElement?window:nt(e)?e:null:null}function Dn(e){return Fe(e)?e.scrollX:e.scrollLeft}function Nn(e){return Fe(e)?e.scrollY:e.scrollTop}function It(e){return{x:Dn(e),y:Nn(e)}}var z;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(z||(z={}));function En(e){return!pt||!e?!1:e===document.scrollingElement}function jn(e){const t={x:0,y:0},n=En(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:s,isRight:l,maxScroll:r,minScroll:t}}const _r={x:.2,y:.2};function Pr(e,t,n,r,o){let{top:a,left:s,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=_r);const{isTop:u,isBottom:g,isLeft:f,isRight:b}=jn(e),h={x:0,y:0},S={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(h.y=z.Backward,S.y=r*Math.abs((t.top+m.height-a)/m.height)):!g&&c>=t.bottom-m.height&&(h.y=z.Forward,S.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!b&&l>=t.right-m.width?(h.x=z.Forward,S.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&s<=t.left+m.width&&(h.x=z.Backward,S.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:S}}function Br(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:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Mn(e){return e.reduce((t,n)=>ze(t,It(n)),ue)}function zr(e){return e.reduce((t,n)=>t+Dn(n),0)}function $r(e){return e.reduce((t,n)=>t+Nn(n),0)}function Fr(e,t){if(t===void 0&&(t=Xe),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Rn(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ur=[["x",["left","right"],zr],["y",["top","bottom"],$r]];class $t{constructor(t,n){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 r=bt(n),o=Mn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of Ur)for(const c of s)Object.defineProperty(this,c,{get:()=>{const u=l(r),g=o[a]-u;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Xr(e){const{EventTarget:t}=G(e);return e instanceof t?e:Ue(e)}function Ct(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(se||(se={}));function tn(e){e.preventDefault()}function Yr(e){e.stopPropagation()}var N;(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"})(N||(N={}));const An={start:[N.Space,N.Enter],cancel:[N.Esc],end:[N.Space,N.Enter,N.Tab]},Wr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N.Right:return{...n,x:n.x+25};case N.Left:return{...n,x:n.x-25};case N.Down:return{...n,y:n.y+25};case N.Up:return{...n,y:n.y-25}}};class Ft{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:n}}=t;this.props=t,this.listeners=new Ge(Ue(n)),this.windowListeners=new Ge(G(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(se.Resize,this.handleCancel),this.windowListeners.add(se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Fr(r),n(ue)}handleKeyDown(t){if(zt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=An,coordinateGetter:s=Wr,scrollBehavior:l="smooth"}=o,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,g=u?{x:u.left,y:u.top}:ue;this.referenceCoordinates||(this.referenceCoordinates=g);const f=s(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=Ze(f,g),h={x:0,y:0},{scrollableAncestors:S}=r.current;for(const m of S){const x=t.code,{isTop:w,isRight:C,isLeft:v,isBottom:R,maxScroll:E,minScroll:j}=jn(m),k=Br(m),y={x:Math.min(x===N.Right?k.right-k.width/2:k.right,Math.max(x===N.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(x===N.Down?k.bottom-k.height/2:k.bottom,Math.max(x===N.Down?k.top:k.top+k.height/2,f.y))},T=x===N.Right&&!C||x===N.Left&&!v,L=x===N.Down&&!R||x===N.Up&&!w;if(T&&y.x!==f.x){const D=m.scrollLeft+b.x,W=x===N.Right&&D<=E.x||x===N.Left&&D>=j.x;if(W&&!b.y){m.scrollTo({left:D,behavior:l});return}W?h.x=m.scrollLeft-D:h.x=x===N.Right?m.scrollLeft-E.x:m.scrollLeft-j.x,h.x&&m.scrollBy({left:-h.x,behavior:l});break}else if(L&&y.y!==f.y){const D=m.scrollTop+b.y,W=x===N.Down&&D<=E.y||x===N.Up&&D>=j.y;if(W&&!b.x){m.scrollTo({top:D,behavior:l});return}W?h.y=m.scrollTop-D:h.y=x===N.Down?m.scrollTop-E.y:m.scrollTop-j.y,h.y&&m.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ze(Ze(f,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ft.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=An,onActivation:o}=t,{active:a}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function nn(e){return!!(e&&"distance"in e)}function rn(e){return!!(e&&"delay"in e)}class Ut{constructor(t,n,r){var o;r===void 0&&(r=Xr(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=n;const{event:a}=t,{target:s}=a;this.props=t,this.events=n,this.document=Ue(s),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(G(s)),this.initialCoordinates=(o=At(a))!=null?o:ue,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:n,bypassActivationConstraint:r}}}=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(se.Resize,this.handleCancel),this.windowListeners.add(se.DragStart,tn),this.windowListeners.add(se.VisibilityChange,this.handleCancel),this.windowListeners.add(se.ContextMenu,tn),this.documentListeners.add(se.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nn(n)){this.handlePending(n);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,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(se.Click,Yr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:l}}=a;if(!o)return;const c=(n=At(t))!=null?n:ue,u=Ze(o,c);if(!r&&l){if(nn(l)){if(l.tolerance!=null&&Ct(u,l.tolerance))return this.handleCancel();if(Ct(u,l.distance))return this.handleStart()}if(rn(l)&&Ct(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),s(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===N.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Hr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xt extends Ut{constructor(t){const{event:n}=t,r=Ue(n.target);super(t,Hr,r)}}Xt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Kr={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class Vr extends Ut{constructor(t){super(t,Kr,Ue(t.event.target))}}Vr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tt.RightClick?!1:(r?.({event:n}),!0)}}];const Rt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Gr extends Ut{constructor(t){super(t,Rt)}static setup(){return window.addEventListener(Rt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rt.move.name,t)};function t(){}}}Gr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var gt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gt||(gt={}));function qr(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:s=5,order:l=gt.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:b}=e;const h=Qr({delta:f,disabled:!a}),[S,m]=lr(),x=i.useRef({x:0,y:0}),w=i.useRef({x:0,y:0}),C=i.useMemo(()=>{switch(n){case qe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qe.DraggableRect:return o}},[n,o,c]),v=i.useRef(null),R=i.useCallback(()=>{const j=v.current;if(!j)return;const k=x.current.x*w.current.x,y=x.current.y*w.current.y;j.scrollBy(k,y)},[]),E=i.useMemo(()=>l===gt.TreeOrder?[...u].reverse():u,[l,u]);i.useEffect(()=>{if(!a||!u.length||!C){m();return}for(const j of E){if(r?.(j)===!1)continue;const k=u.indexOf(j),y=g[k];if(!y)continue;const{direction:T,speed:L}=Pr(j,y,C,t,b);for(const D of["x","y"])h[D][T[D]]||(L[D]=0,T[D]=0);if(L.x>0||L.y>0){m(),v.current=j,S(R,s),x.current=L,w.current=T;return}}x.current={x:0,y:0},w.current={x:0,y:0},m()},[t,R,r,m,a,s,JSON.stringify(C),JSON.stringify(h),S,u,E,g,JSON.stringify(b)])}const Jr={x:{[z.Backward]:!1,[z.Forward]:!1},y:{[z.Backward]:!1,[z.Forward]:!1}};function Qr(e){let{delta:t,disabled:n}=e;const r=Mt(t);return rt(o=>{if(n||!r||!o)return Jr;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[z.Backward]:o.x[z.Backward]||a.x===-1,[z.Forward]:o.x[z.Forward]||a.x===1},y:{[z.Backward]:o.y[z.Backward]||a.y===-1,[z.Forward]:o.y[z.Forward]||a.y===1}}},[n,t,r])}function Zr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return rt(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function eo(e,t){return i.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...a]},[]),[e,t])}var tt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(tt||(tt={}));var Lt;(function(e){e.Optimized="optimized"})(Lt||(Lt={}));const on=new Map;function to(e,t){let{dragging:n,dependencies:r,config:o}=t;const[a,s]=i.useState(null),{frequency:l,measure:c,strategy:u}=o,g=i.useRef(e),f=x(),b=Qe(f),h=i.useCallback(function(w){w===void 0&&(w=[]),!b.current&&s(C=>C===null?w:C.concat(w.filter(v=>!C.includes(v))))},[b]),S=i.useRef(null),m=rt(w=>{if(f&&!n)return on;if(!w||w===on||g.current!==e||a!=null){const C=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){C.set(v.id,v.rect.current);continue}const R=v.node.current,E=R?new $t(c(R),R):null;v.rect.current=E,E&&C.set(v.id,E)}return C}return w},[e,a,n,f,c]);return i.useEffect(()=>{g.current=e},[e]),i.useEffect(()=>{f||h()},[n,f]),i.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),i.useEffect(()=>{f||typeof l!="number"||S.current!==null||(S.current=setTimeout(()=>{h(),S.current=null},l))},[l,f,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:a!=null};function x(){switch(u){case tt.Always:return!1;case tt.BeforeDragging:return n;default:return!n}}}function In(e,t){return rt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function no(e,t){return In(e,t)}function ro(e){let{callback:t,disabled:n}=e;const r=Bt(t),o=i.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function mt(e){let{callback:t,disabled:n}=e;const r=Bt(t),o=i.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function oo(e){return new $t(Xe(e),e)}function an(e,t,n){t===void 0&&(t=oo);const[r,o]=i.useState(null);function a(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const s=ro({callback(c){if(e)for(const u of c){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=mt({callback:a});return he(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),r}function ao(e){const t=In(e);return Cn(e,t)}const sn=[];function so(e){const t=i.useRef(e),n=rt(r=>e?r&&r!==sn&&e&&t.current&&e.parentNode===t.current.parentNode?r:bt(e):sn,[e]);return i.useEffect(()=>{t.current=e},[e]),n}function io(e){const[t,n]=i.useState(null),r=i.useRef(e),o=i.useCallback(a=>{const s=St(a.target);s&&n(l=>l?(l.set(s,It(s)),new Map(l)):null)},[]);return i.useEffect(()=>{const a=r.current;if(e!==a){s(a);const l=e.map(c=>{const u=St(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,It(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{s(e),s(a)};function s(l){l.forEach(c=>{const u=St(c);u?.removeEventListener("scroll",o)})}},[o,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ze(a,s),ue):Mn(e):ue,[e,t])}function ln(e,t){t===void 0&&(t=[]);const n=i.useRef(null);return i.useEffect(()=>{n.current=null},t),i.useEffect(()=>{const r=e!==ue;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ze(e,n.current):ue}function lo(e){i.useEffect(()=>{if(!pt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function co(e,t){return i.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=s=>{a(s,t)},n},{}),[e,t])}function Tn(e){return i.useMemo(()=>e?Tr(e):null,[e])}const cn=[];function uo(e,t){t===void 0&&(t=Xe);const[n]=e,r=Tn(n?G(n):null),[o,a]=i.useState(cn);function s(){a(()=>e.length?e.map(c=>En(c)?r:new $t(t(c),c)):cn)}const l=mt({callback:s});return he(()=>{l?.disconnect(),s(),e.forEach(c=>l?.observe(c))},[e]),o}function fo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nt(t)?t:e}function go(e){let{measure:t}=e;const[n,r]=i.useState(null),o=i.useCallback(u=>{for(const{target:g}of u)if(nt(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),a=mt({callback:o}),s=i.useCallback(u=>{const g=fo(u);a?.disconnect(),g&&a?.observe(g),r(g?t(g):null)},[t,a]),[l,c]=ut(s);return i.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ho=[{sensor:Xt,options:{}},{sensor:Ft,options:{}}],po={current:{}},ct={draggable:{measure:en},droppable:{measure:en,strategy:tt.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:Xe}};class Je extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const bo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ft},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:ft,windowRect:null,measuringScheduled:!1},mo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ft,draggableNodes:new Map,over:null,measureDroppableContainers:ft},xt=i.createContext(mo),Ln=i.createContext(bo);function xo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function vo(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.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 P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case P.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const s=new Je(e.droppable.containers);return s.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case P.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Je(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yo(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=i.useContext(xt),a=Mt(r),s=Mt(n?.id);return i.useEffect(()=>{if(!t&&!r&&a&&s!=null){if(!zt(a)||document.activeElement===a.target)return;const l=o.get(s);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[c.current,u.current]){if(!g)continue;const f=ur(g);if(f){f.focus();break}}})}},[r,t,o,s,a]),null}function wo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function ko(e){return i.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function So(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const a=i.useRef(!1),{x:s,y:l}=typeof o=="boolean"?{x:o,y:o}:o;he(()=>{if(!s&&!l||!t){a.current=!1;return}if(a.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=n(u),f=Cn(g,r);if(s||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=Rn(u);b&&b.scrollBy({top:f.y,left:f.x})}},[t,s,l,r,n])}const On=i.createContext({...ue,scaleX:1,scaleY:1});var Ne;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ne||(Ne={}));const Co=i.memo(function(t){var n,r,o,a;let{id:s,accessibility:l,autoScroll:c=!0,children:u,sensors:g=ho,collisionDetection:f=Dr,measuring:b,modifiers:h,...S}=t;const m=i.useReducer(vo,void 0,xo),[x,w]=m,[C,v]=mr(),[R,E]=i.useState(Ne.Uninitialized),j=R===Ne.Initialized,{draggable:{active:k,nodes:y,translate:T},droppable:{containers:L}}=x,D=k!=null?y.get(k):null,W=i.useRef({initial:null,translated:null}),H=i.useMemo(()=>{var Y;return k!=null?{id:k,data:(Y=D?.data)!=null?Y:po,rect:W}:null},[k,D]),ee=i.useRef(null),[ke,Ee]=i.useState(null),[$,je]=i.useState(null),B=Qe(S,Object.values(S)),Me=ot("DndDescribedBy",s),Le=i.useMemo(()=>L.getEnabled(),[L]),F=ko(b),{droppableRects:_,measureDroppableContainers:te,measuringScheduled:q}=to(Le,{dragging:j,dependencies:[T.x,T.y],config:F.droppable}),K=Zr(y,k),Ae=i.useMemo(()=>$?At($):null,[$]),ie=Gn(),ne=no(K,F.draggable.measure);So({activeNode:k!=null?y.get(k):null,config:ie.layoutShiftCompensation,initialRect:ne,measure:F.draggable.measure});const M=an(K,F.draggable.measure,ne),pe=an(K?K.parentElement:null),re=i.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:_,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),be=L.getNodeFor((n=re.current.over)==null?void 0:n.id),oe=go({measure:F.dragOverlay.measure}),me=(r=oe.nodeRef.current)!=null?r:K,xe=j?(o=oe.rect)!=null?o:M:null,Oe=!!(oe.nodeRef.current&&oe.rect),at=ao(Oe?null:M),Ye=Tn(me?G(me):null),le=so(j?be??K:null),Ie=uo(le),_e=wo(h,{transform:{x:T.x-at.x,y:T.y-at.y,scaleX:1,scaleY:1},activatorEvent:$,active:H,activeNodeRect:M,containerNodeRect:pe,draggingNodeRect:xe,over:re.current.over,overlayNodeRect:oe.rect,scrollableAncestors:le,scrollableAncestorRects:Ie,windowRect:Ye}),Se=Ae?ze(Ae,T):null,Pe=io(le),p=ln(Pe),A=ln(Pe,[M]),X=ze(_e,p),ve=xe?jr(xe,_e):null,Te=H&&ve?f({active:H,collisionRect:ve,droppableRects:_,droppableContainers:Le,pointerCoordinates:Se}):null,ce=Sn(Te,"id"),[ye,Yt]=i.useState(null),Yn=Oe?_e:ze(_e,A),Wn=Nr(Yn,(a=ye?.rect)!=null?a:null,M),vt=i.useRef(null),Wt=i.useCallback((Y,J)=>{let{sensor:Q,options:Ce}=J;if(ee.current==null)return;const ae=y.get(ee.current);if(!ae)return;const Z=Y.nativeEvent,fe=new Q({active:ee.current,activeNode:ae,event:Z,options:Ce,context:re,onAbort(U){if(!y.get(U))return;const{onDragAbort:ge}=B.current,we={id:U};ge?.(we),C({type:"onDragAbort",event:we})},onPending(U,Re,ge,we){if(!y.get(U))return;const{onDragPending:He}=B.current,De={id:U,constraint:Re,initialCoordinates:ge,offset:we};He?.(De),C({type:"onDragPending",event:De})},onStart(U){const Re=ee.current;if(Re==null)return;const ge=y.get(Re);if(!ge)return;const{onDragStart:we}=B.current,We={activatorEvent:Z,active:{id:Re,data:ge.data,rect:W}};Ve.unstable_batchedUpdates(()=>{we?.(We),E(Ne.Initializing),w({type:P.DragStart,initialCoordinates:U,active:Re}),C({type:"onDragStart",event:We}),Ee(vt.current),je(Z)})},onMove(U){w({type:P.DragMove,coordinates:U})},onEnd:Be(P.DragEnd),onCancel:Be(P.DragCancel)});vt.current=fe;function Be(U){return async function(){const{active:ge,collisions:we,over:We,scrollAdjustedTranslate:He}=re.current;let De=null;if(ge&&He){const{cancelDrop:Ke}=B.current;De={activatorEvent:Z,active:ge,collisions:we,delta:He,over:We},U===P.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(De))&&(U=P.DragCancel)}ee.current=null,Ve.unstable_batchedUpdates(()=>{w({type:U}),E(Ne.Uninitialized),Yt(null),Ee(null),je(null),vt.current=null;const Ke=U===P.DragEnd?"onDragEnd":"onDragCancel";if(De){const yt=B.current[Ke];yt?.(De),C({type:Ke,event:De})}})}}},[y]),Hn=i.useCallback((Y,J)=>(Q,Ce)=>{const ae=Q.nativeEvent,Z=y.get(Ce);if(ee.current!==null||!Z||ae.dndKit||ae.defaultPrevented)return;const fe={active:Z};Y(Q,J.options,fe)===!0&&(ae.dndKit={capturedBy:J.sensor},ee.current=Ce,Wt(Q,J))},[y,Wt]),Ht=eo(g,Hn);lo(g),he(()=>{M&&R===Ne.Initializing&&E(Ne.Initialized)},[M,R]),i.useEffect(()=>{const{onDragMove:Y}=B.current,{active:J,activatorEvent:Q,collisions:Ce,over:ae}=re.current;if(!J||!Q)return;const Z={active:J,activatorEvent:Q,collisions:Ce,delta:{x:X.x,y:X.y},over:ae};Ve.unstable_batchedUpdates(()=>{Y?.(Z),C({type:"onDragMove",event:Z})})},[X.x,X.y]),i.useEffect(()=>{const{active:Y,activatorEvent:J,collisions:Q,droppableContainers:Ce,scrollAdjustedTranslate:ae}=re.current;if(!Y||ee.current==null||!J||!ae)return;const{onDragOver:Z}=B.current,fe=Ce.get(ce),Be=fe&&fe.rect.current?{id:fe.id,rect:fe.rect.current,data:fe.data,disabled:fe.disabled}:null,U={active:Y,activatorEvent:J,collisions:Q,delta:{x:ae.x,y:ae.y},over:Be};Ve.unstable_batchedUpdates(()=>{Yt(Be),Z?.(U),C({type:"onDragOver",event:U})})},[ce]),he(()=>{re.current={activatorEvent:$,active:H,activeNode:K,collisionRect:ve,collisions:Te,droppableRects:_,draggableNodes:y,draggingNode:me,draggingNodeRect:xe,droppableContainers:L,over:ye,scrollableAncestors:le,scrollAdjustedTranslate:X},W.current={initial:xe,translated:ve}},[H,K,Te,ve,y,me,xe,_,L,ye,le,X]),qr({...ie,delta:T,draggingRect:ve,pointerCoordinates:Se,scrollableAncestors:le,scrollableAncestorRects:Ie});const Kn=i.useMemo(()=>({active:H,activeNode:K,activeNodeRect:M,activatorEvent:$,collisions:Te,containerNodeRect:pe,dragOverlay:oe,draggableNodes:y,droppableContainers:L,droppableRects:_,over:ye,measureDroppableContainers:te,scrollableAncestors:le,scrollableAncestorRects:Ie,measuringConfiguration:F,measuringScheduled:q,windowRect:Ye}),[H,K,M,$,Te,pe,oe,y,L,_,ye,te,le,Ie,F,q,Ye]),Vn=i.useMemo(()=>({activatorEvent:$,activators:Ht,active:H,activeNodeRect:M,ariaDescribedById:{draggable:Me},dispatch:w,draggableNodes:y,over:ye,measureDroppableContainers:te}),[$,Ht,H,M,w,Me,y,ye,te]);return V.createElement(yn.Provider,{value:v},V.createElement(xt.Provider,{value:Vn},V.createElement(Ln.Provider,{value:Kn},V.createElement(On.Provider,{value:Wn},u)),V.createElement(yo,{disabled:l?.restoreFocus===!1})),V.createElement(yr,{...l,hiddenTextDescribedById:Me}));function Gn(){const Y=ke?.autoScrollEnabled===!1,J=typeof c=="object"?c.enabled===!1:c===!1,Q=j&&!Y&&!J;return typeof c=="object"?{...c,enabled:Q}:{enabled:Q}}}),Ro=i.createContext(null),dn="button",Do="Draggable";function No(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=ot(Do),{activators:s,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:b}=i.useContext(xt),{role:h=dn,roleDescription:S="draggable",tabIndex:m=0}=o??{},x=c?.id===t,w=i.useContext(x?On:Ro),[C,v]=ut(),[R,E]=ut(),j=co(s,t),k=Qe(n);he(()=>(f.set(t,{id:t,key:a,node:C,activatorNode:R,data:k}),()=>{const T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);const y=i.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&h===dn?!0:void 0,"aria-roledescription":S,"aria-describedby":g.draggable}),[r,h,m,x,S,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:y,isDragging:x,listeners:r?void 0:j,node:C,over:b,setNodeRef:v,setActivatorNodeRef:E,transform:w}}function Eo(){return i.useContext(Ln)}const jo="Droppable",Mo={timeout:25};function Ao(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=ot(jo),{active:s,dispatch:l,over:c,measureDroppableContainers:u}=i.useContext(xt),g=i.useRef({disabled:n}),f=i.useRef(!1),b=i.useRef(null),h=i.useRef(null),{disabled:S,updateMeasurementsFor:m,timeout:x}={...Mo,...o},w=Qe(m??r),C=i.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(w.current)?w.current:[w.current]),h.current=null},x)},[x]),v=mt({callback:C,disabled:S||!s}),R=i.useCallback((y,T)=>{v&&(T&&(v.unobserve(T),f.current=!1),y&&v.observe(y))},[v]),[E,j]=ut(R),k=Qe(t);return i.useEffect(()=>{!v||!E.current||(v.disconnect(),f.current=!1,v.observe(E.current))},[E,v]),i.useEffect(()=>(l({type:P.RegisterDroppable,element:{id:r,key:a,disabled:n,node:E,rect:b,data:k}}),()=>l({type:P.UnregisterDroppable,key:a,id:r})),[r]),i.useEffect(()=>{n!==g.current.disabled&&(l({type:P.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,l]),{active:s,rect:b,isOver:c?.id===r,node:E,over:c,setNodeRef:j}}const Io=e=>{let{transform:t}=e;return{...t,y:0}};function _n(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function To(e,t){return e.reduce((n,r,o)=>{const a=t.get(r);return a&&(n[o]=a),n},Array(e.length))}function st(e){return e!==null&&e>=0}function Lo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Oo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const it={scaleX:1,scaleY:1},_o=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:a,index:s}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const c=Po(n,s,o);if(s===o){const u=n[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...it}:null}return s>o&&s<=a?{x:-l.width-c,y:0,...it}:s<o&&s>=a?{x:l.width+c,y:0,...it}:{x:0,y:0,...it}};function Po(e,t,n){const r=e[t],o=e[t-1],a=e[t+1];return!r||!o&&!a?0:n<t?o?r.left-(o.left+o.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(o.left+o.width)}const Pn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=_n(t,r,n),s=t[o],l=a[o];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},Bn="Sortable",zn=V.createContext({activeIndex:-1,containerId:Bn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Pn,disabled:{draggable:!1,droppable:!1}});function Bo(e){let{children:t,id:n,items:r,strategy:o=Pn,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:g}=Eo(),f=ot(Bn,n),b=l.rect!==null,h=i.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),S=s!=null,m=s?h.indexOf(s.id):-1,x=u?h.indexOf(u.id):-1,w=i.useRef(h),C=!Lo(h,w.current),v=x!==-1&&m===-1||C,R=Oo(a);he(()=>{C&&S&&g(h)},[C,h,S,g]),i.useEffect(()=>{w.current=h},[h]);const E=i.useMemo(()=>({activeIndex:m,containerId:f,disabled:R,disableTransforms:v,items:h,overIndex:x,useDragOverlay:b,sortedRects:To(h,c),strategy:o}),[m,f,R.draggable,R.droppable,v,h,x,c,b,o]);return V.createElement(zn.Provider,{value:E},t)}const zo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return _n(n,r,o).indexOf(t)},$o=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:s,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==a&&o===s?!1:n?!0:s!==o&&t===c},Fo={duration:200,easing:"ease"},$n="transform",Uo=et.Transition.toString({property:$n,duration:0,easing:"linear"}),Xo={roleDescription:"sortable"};function Yo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[a,s]=i.useState(null),l=i.useRef(n);return he(()=>{if(!t&&n!==l.current&&r.current){const c=o.current;if(c){const u=Xe(r.current,{ignoreTransform:!0}),g={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(g.x||g.y)&&s(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),i.useEffect(()=>{a&&s(null)},[a]),a}function Wo(e){let{animateLayoutChanges:t=$o,attributes:n,disabled:r,data:o,getNewIndex:a=zo,id:s,strategy:l,resizeObserverConfig:c,transition:u=Fo}=e;const{items:g,containerId:f,activeIndex:b,disabled:h,disableTransforms:S,sortedRects:m,overIndex:x,useDragOverlay:w,strategy:C}=i.useContext(zn),v=Ho(r,h),R=g.indexOf(s),E=i.useMemo(()=>({sortable:{containerId:f,index:R,items:g},...o}),[f,o,R,g]),j=i.useMemo(()=>g.slice(g.indexOf(s)),[g,s]),{rect:k,node:y,isOver:T,setNodeRef:L}=Ao({id:s,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:D,activatorEvent:W,activeNodeRect:H,attributes:ee,setNodeRef:ke,listeners:Ee,isDragging:$,over:je,setActivatorNodeRef:B,transform:Me}=No({id:s,data:E,attributes:{...Xo,...n},disabled:v.draggable}),Le=ir(L,ke),F=!!D,_=F&&!S&&st(b)&&st(x),te=!w&&$,q=te&&_?Me:null,Ae=_?q??(l??C)({rects:m,activeNodeRect:H,activeIndex:b,overIndex:x,index:R}):null,ie=st(b)&&st(x)?a({id:s,items:g,activeIndex:b,overIndex:x}):R,ne=D?.id,M=i.useRef({activeId:ne,items:g,newIndex:ie,containerId:f}),pe=g!==M.current.items,re=t({active:D,containerId:f,isDragging:$,isSorting:F,id:s,index:R,items:g,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),be=Yo({disabled:!re,index:R,node:y,rect:k});return i.useEffect(()=>{F&&M.current.newIndex!==ie&&(M.current.newIndex=ie),f!==M.current.containerId&&(M.current.containerId=f),g!==M.current.items&&(M.current.items=g)},[F,ie,f,g]),i.useEffect(()=>{if(ne===M.current.activeId)return;if(ne&&!M.current.activeId){M.current.activeId=ne;return}const me=setTimeout(()=>{M.current.activeId=ne},50);return()=>clearTimeout(me)},[ne]),{active:D,activeIndex:b,attributes:ee,data:E,rect:k,index:R,newIndex:ie,items:g,isOver:T,isSorting:F,isDragging:$,listeners:Ee,node:y,overIndex:x,over:je,setNodeRef:Le,setActivatorNodeRef:B,setDroppableNodeRef:L,setDraggableNodeRef:ke,transform:be??Ae,transition:oe()};function oe(){if(be||pe&&M.current.newIndex===R)return Uo;if(!(te&&!zt(W)||!u)&&(F||re))return et.Transition.toString({...u,property:$n})}}function Ho(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function ht(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 Ko=[N.Down,N.Right,N.Up,N.Left],Vo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(Ko.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const b=o.get(f.id);if(b)switch(e.code){case N.Down:r.top<b.top&&c.push(f);break;case N.Up:r.top>b.top&&c.push(f);break;case N.Left:r.left>b.left&&c.push(f);break;case N.Right:r.left<b.left&&c.push(f);break}});const u=Cr({collisionRect:r,droppableRects:o,droppableContainers:c});let g=Sn(u,"id");if(g===s?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(n.id),b=a.get(g),h=b?o.get(b.id):null,S=b?.node.current;if(S&&h&&f&&b){const x=bt(S).some((j,k)=>l[k]!==j),w=Fn(f,b),C=Go(f,b),v=x||!w?{x:0,y:0}:{x:C?r.width-h.width:0,y:C?r.height-h.height:0},R={x:h.left,y:h.top};return v.x&&v.y?R:Ze(R,v)}}}};function Fn(e,t){return!ht(e)||!ht(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Go(e,t){return!ht(e)||!ht(t)||!Fn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function $e(e,{min:t,max:n,fallback:r}){const o=Number(e);if(!Number.isFinite(o))return r;const a=Math.floor(o);return a<t?t:a>n?n:a}function qo(e,t){const n=$e(t,{min:0,max:1e6,fallback:0}),r=$e(e,{min:1,max:Math.max(1,n||1),fallback:1});if(n<=1)return[1];const o=new Set([1,n,r-2,r-1,r,r+1,r+2]),a=Array.from(o).filter(c=>Number.isInteger(c)&&c>=1&&c<=n).sort((c,u)=>c-u),s=[];let l=null;for(const c of a)l!=null&&c-l>1&&s.push(null),s.push(c),l=c;return s}function Jo({page:e,totalPages:t}){const n=typeof t=="number"&&Number.isFinite(t)&&t>=0,r=n?$e(t,{min:0,max:1e6,fallback:0}):null,o=$e(e,{min:1,max:n?Math.max(1,r||1):1e6,fallback:1}),a=o>1,s=n?o<r:!0;return{canPrev:a,canNext:s,safePage:o,safeTotal:r}}function Qo({entries:e,me:t,meLabel:n,limit:r}){const o=$e(r,{min:1,max:1e3,fallback:20}),a=Array.isArray(e)?e.slice(0,o):[],s=t&&typeof t.rank=="number"?t.rank:null,l=a.some(h=>!!h?.is_me);if(!s||l)return a;const c={rank:s,is_me:!0,display_name:n,avatar_url:null,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"},u=3,g=4,b=a.filter(h=>!h?.is_me).filter((h,S)=>S!==u).slice();return b.splice(Math.min(g,b.length),0,c),b.slice(0,o)}function de({className:e}){return d.jsx("div",{className:O("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function Zo({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",n=e<3?"w-16":"w-12",r=e<5?"w-14":"w-10";return d.jsxs("tr",{className:"group",children:[d.jsx("td",{className:O(Et(!1),"!group-hover:bg-transparent"),children:d.jsx(de,{className:"h-4 w-6"})}),d.jsx("td",{className:O(jt(!1),"!group-hover:bg-transparent"),children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(de,{className:"h-8 w-8 min-w-8 rounded-full"}),d.jsx(de,{className:O("h-4",t)})]})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:O("h-4",n)})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:"h-4 w-12"})}),dt.map(o=>d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:O("h-4",r)})},o.key))]})}function ea({rows:e=10}){return d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:O(bn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-6"})}),d.jsx("th",{className:O(mn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-12"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-10"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-14"})}),dt.map(t=>d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-12"})},t.key))]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,n)=>d.jsx(Zo,{index:n},n))})]})})}function ta({id:e,thClassName:t,children:n}){const{attributes:r,listeners:o,setNodeRef:a,transform:s,transition:l,isDragging:c}=Wo({id:e}),u=et.Transform.toString(s)||"";i.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),b="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(h=>{h.style.transform=u,h.style.transition=l||"",h.style.zIndex=c?"20":"",h.style.position=u?"relative":"",h.style.boxShadow=c?b:""}),()=>{f.forEach(h=>{h.style.transform="",h.style.transition="",h.style.zIndex="",h.style.position="",h.style.boxShadow=""})}},[e,u,l,c]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:c?20:void 0,boxShadow:c?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return d.jsx("th",{ref:a,style:g,className:O(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...r,...o,children:d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsx("span",{"aria-hidden":"true",className:O("-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",c&&"opacity-100"),children:d.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[d.jsx("circle",{cx:"2",cy:"2",r:"1"}),d.jsx("circle",{cx:"6",cy:"2",r:"1"}),d.jsx("circle",{cx:"2",cy:"7",r:"1"}),d.jsx("circle",{cx:"6",cy:"7",r:"1"}),d.jsx("circle",{cx:"2",cy:"12",r:"1"}),d.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),n]})})}const Un="tokentracker.leaderboard.columnOrder.v1";function na(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Un);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):null}catch{return null}}function Dt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Un,JSON.stringify(e))}catch{}}function un(e,t){if(!e)return t;const n=new Set(t),r=e.filter(a=>n.has(a)),o=t.filter(a=>!r.includes(a));return[...r,...o]}function ra(e){const t=i.useMemo(()=>e.join("|"),[e]),[n,r]=i.useState(()=>un(na(),e));i.useEffect(()=>{r(s=>{const l=un(s,e);return l.length===s.length&&l.every((u,g)=>u===s[g])?s:(Dt(l),l)})},[t,e]);const o=i.useCallback((s,l)=>{!s||!l||s===l||r(c=>{const u=c.indexOf(s),g=c.indexOf(l);if(u===-1||g===-1)return c;const f=c.slice(),[b]=f.splice(u,1);return f.splice(g,0,b),Dt(f),f})},[]),a=i.useCallback(()=>{Dt(e),r(e)},[e]);return{order:n,reorder:o,reset:a}}const lt=20;function fn(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":t>=1e3?`$${Math.round(t).toLocaleString()}`:t>=10?`$${Math.round(t)}`:`$${t.toFixed(2)}`}function gn(e,t,n){const r=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 n.map(a=>d.jsx("td",{"data-column-key":a.key,className:O("px-4 py-4 whitespace-nowrap text-right tabular-nums",r,o),children:Nt(e?.[a.key])},a.key))}const oa={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 hn({rank:e,placeholder:t}){const n=oa[e];return n?d.jsx("span",{className:O("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",n.text,n.badge),children:e}):d.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function Ot(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 I("shared.error.prefix",{error:I("leaderboard.error.unknown")});const t=e?.message||String(e),n=String(t||"").trim()||I("leaderboard.error.unknown");return I("shared.error.prefix",{error:n})}function Xn(e){return typeof e!="string"?"":e.trim()}function sa(e){const t=Xn(e);return t?t.toLowerCase()==="anonymous":!0}function ia(e,t=""){if(typeof e!="string")return null;const n=e.trim().toLowerCase();if(!n)return null;const r=new URLSearchParams(typeof t=="string"?t:""),o=Ot(r.get("period")),a=o?`?period=${o}`:"";return`/share/pv1-${n}${a}`}function pn(e,t){const n=typeof e?.user_id=="string"?e.user_id.trim():"";return n||`${e?.rank??""}:${t}`}function da({auth:e,signedIn:t,sessionSoftExpired:n}){const r=qn(),o=Jn(),{openLoginModal:a}=Qn(),{signedIn:s,loading:l,user:c}=Zn(),u=i.useMemo(()=>er(),[]),g=tr(),f=t&&!n,b=i.useMemo(()=>f&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,f]),h=f?b:null,S=f&&nr(h),m=I("shared.placeholder.short"),x=i.useMemo(()=>dt.map(p=>p.key),[]),{order:w,reorder:C}=ra(x),v=i.useMemo(()=>{const p=new Map;for(const A of dt)p.set(A.key,A);return p},[]),R=i.useMemo(()=>w.map(p=>v.get(p)).filter(Boolean),[w,v]),E=wr(Jt(Xt,{activationConstraint:{distance:6}}),Jt(Ft,{coordinateGetter:Vo})),j=i.useCallback(p=>{const{active:A,over:X}=p;!X||A.id===X.id||C(String(A.id),String(X.id))},[C]),[k,y]=i.useState(1),[T,L]=i.useState(0),[D,W]=i.useState(()=>({loading:!1,error:null,data:null})),[H,ee]=i.useState(()=>rr()),[ke,Ee]=i.useState(!1),[$,je]=i.useState(!1),B=i.useMemo(()=>{const p=new URLSearchParams(r?.search||"");return Ot(p.get("period"))||"total"},[r?.search]),Me=r?.search||"",Le=p=>{const A=Ot(p);if(!A||A===B)return;const X=new URLSearchParams(r?.search||"");X.set("period",A),y(1),o(`${r?.pathname||"/leaderboard"}?${X.toString()}`,{replace:!0})};i.useEffect(()=>{l||g||s||a()},[s,l,g,a]),i.useEffect(()=>{y(1)},[B]);const F=i.useMemo(()=>($e(k,{min:1,max:1e6,fallback:1})-1)*lt,[k]);i.useEffect(()=>{if(!u&&!g)return;let p=!0;return W(A=>({...A,loading:!0,error:null})),(async()=>{const A=await or({userId:c?.id||null,period:B,limit:lt,offset:F});p&&W({loading:!1,error:null,data:A})})().catch(A=>{p&&W({loading:!1,error:aa(A),data:null})}),()=>{p=!1}},[u,c?.id,F,T,g,B]);const _=D.data,te=_?.total_pages??null,q=_?.page??k,K=i.useMemo(()=>qo(q,te),[q,te]),Ae=_?.from||null,ie=_?.to||null,ne=_?.generated_at||null,M=_?.me||null,pe=I("leaderboard.me_label"),re=I("leaderboard.anon_label"),be=I("leaderboard.period.week"),oe=I("leaderboard.period.month"),me=I("leaderboard.period.total"),xe=B==="month"?oe:B==="total"?me:be,Oe=i.useMemo(()=>{const p=Array.isArray(_?.entries)?_.entries:[];return q!==1?p:Qo({entries:p,me:M,meLabel:pe,limit:lt})},[q,_?.entries,M,pe]),at=async()=>{Ee(!0);try{ar(!0),ee(!0),await Kt(()=>wt(h));const p=await wt(h);p&&await Vt({accessToken:p}),L(A=>A+1)}catch(p){console.warn("[tokentracker] sync:",p)}finally{Ee(!1)}},Ye=async()=>{je(!0);try{const p=await wt(h);H&&p&&await Kt(()=>Promise.resolve(p)),p&&await Vt({accessToken:p}),L(A=>A+1)}catch(p){console.warn("[tokentracker] refresh:",p)}finally{je(!1)}},{canPrev:le,canNext:Ie}=Jo({page:q,totalPages:te}),_e=Array.isArray(Oe)&&Oe.length!==0;let Se=null;D.loading?Se=d.jsx(ea,{rows:lt}):D.error?Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:D.error})}):_e?Se=d.jsx(Co,{sensors:E,collisionDetection:Sr,modifiers:[Io],onDragEnd:j,children:d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:O(bn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:I("leaderboard.column.rank")}),d.jsx("th",{className:O(mn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:I("leaderboard.column.user")}),d.jsx("th",{className:"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:I("leaderboard.column.total")}),d.jsx("th",{className:"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:"Est. Cost"}),d.jsx(Bo,{items:w,strategy:_o,children:R.map(p=>d.jsx(ta,{id:p.key,thClassName:"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:d.jsx(sr,{iconSrc:p.icon,label:I(p.copyKey)})},p.key))})]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Oe.map(p=>{const A=!!p?.is_me,X=typeof p?.user_id=="string"?p.user_id:null,ve=Xn(p?.display_name),Te=sa(ve)?re:ve,ce=A?pe:Te;return!!X&&!A&&!!p?.is_public&&ia(X,Me),A?d.jsxs("tr",{className:"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30 bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",children:[d.jsx("td",{className:O(Et(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400"),children:d.jsx(hn,{rank:p?.rank,placeholder:m})}),d.jsx("td",{className:jt(!0),children:d.jsxs("div",{className:"flex min-w-0 max-w-[min(160px,40vw)] items-center gap-4",children:[d.jsx(Gt,{avatarUrl:p?.avatar_url,displayName:ce,seed:pn(p,ce)}),d.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:ce})]})}),d.jsx("td",{className:"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:Nt(p?.total_tokens)}),d.jsx("td",{className:"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:fn(p?.estimated_cost_usd)}),gn(p,!0,R)]},`row-${p?.rank}-${ce}`):d.jsxs("tr",{className:"group transition-colors",children:[d.jsx("td",{className:O(Et(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(hn,{rank:p?.rank,placeholder:m})}),d.jsx("td",{className:jt(!1),children:d.jsxs("div",{className:"flex min-w-0 max-w-[min(160px,40vw)] items-center gap-4",children:[d.jsx(Gt,{avatarUrl:p?.avatar_url,displayName:ce,seed:pn(p,ce)}),d.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:ce})]})}),d.jsx("td",{className:"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:Nt(p?.total_tokens)}),d.jsx("td",{className:"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:fn(p?.estimated_cost_usd)}),gn(p,!1,R)]},`row-${p?.rank}-${ce}`)})})]})})}):Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:I("leaderboard.empty")})});let Pe=null;return typeof te=="number"?Pe=K.map((p,A)=>p==null?d.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:I("leaderboard.pagination.ellipsis")},`ellipsis-${A}`):d.jsx("button",{className:O("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",p===q?"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:()=>y(p),disabled:D.loading,children:String(p)},`page-${p}`)):Pe=d.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:I("leaderboard.pagination.page_unknown",{page:String(q)})}),d.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[d.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:d.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[d.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:I("leaderboard.title")}),d.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[B==="total"?I("leaderboard.range.total"):Ae&&ie?I("leaderboard.range",{period:xe,from:Ae,to:ie}):I("leaderboard.range_loading",{period:xe}),ne&&d.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:I("leaderboard.generated_at",{ts:ne})})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[f&&S&&d.jsx("div",{className:"inline-flex p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-lg",children:d.jsxs("button",{onClick:Ye,disabled:$||D.loading,className:"px-3 py-1.5 text-sm font-medium rounded-md transition-colors text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 hover:text-oai-black dark:hover:text-white disabled:opacity-50 inline-flex items-center gap-1.5",children:[d.jsxs("svg",{className:O("w-4 h-4",$&&"animate-spin"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M3 12a9 9 0 0 1 15.5-6.5L21 8"}),d.jsx("path",{d:"M21 3v5h-5"}),d.jsx("path",{d:"M21 12a9 9 0 0 1-15.5 6.5L3 16"}),d.jsx("path",{d:"M3 21v-5h5"})]}),$?"Refreshing":"Refresh"]})}),d.jsx("div",{className:"inline-flex p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-lg",children:["week","month","total"].map(p=>d.jsx("button",{onClick:()=>Le(p),disabled:D.loading,className:O("px-4 py-1.5 text-sm font-medium rounded-md transition-colors",B===p?"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:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:p==="week"?be:p==="month"?oe:me},p))})]})]}),!t&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:"Sign in to join the leaderboard"}),d.jsx("button",{onClick:a,className:"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:"Sign In"})]}),f&&S&&!H&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:"Enable Cloud Sync to appear in rankings"}),d.jsx("button",{onClick:at,disabled:ke,className:"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:ke?"Syncing...":"Enable & Sync"})]}),d.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[Se,d.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{className:O("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",le&&!D.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:()=>y(p=>Math.max(1,p-1)),disabled:!le||D.loading,children:I("leaderboard.pagination.prev")}),d.jsx("button",{className:O("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ie&&!D.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:()=>y(p=>p+1),disabled:!Ie||D.loading,children:I("leaderboard.pagination.next")})]}),d.jsx("div",{className:"flex flex-wrap items-center gap-1",children:Pe})]})]})]})}),d.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:d.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:[d.jsx("p",{children:I("landing.v2.footer.line")}),d.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:I("landing.v2.nav.github")})]})})]})}export{da as LeaderboardPage};
@@ -1 +1 @@
1
- import{r as n,D as e,aA as D,C as H,aC as W,h as Y,j as Z,aE as G,aI as J,B as a,az as L,ax as R,a9 as E,aJ as q,aK as F}from"./main-D49FUfq7.js";import{b as B,d as Q,l as V,f as X,e as ee,L as re,g as ae}from"./leaderboard-columns-9wPbwNaz.js";const y=18;function O(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,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 P(){return e.jsx("svg",{"aria-hidden":!0,width:y,height:y,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 te(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,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 oe=[{value:"light",label:"Light",Icon:O},{value:"dark",label:"Dark",Icon:P},{value:"system",label:"System",Icon:te}];function se(r){return r==="dark"?P:O}function ne({theme:r,resolvedTheme:s,onSetTheme:b,className:d="",direction:p="down",align:T="right"}){const[c,k]=n.useState(!1),h=n.useRef(null),i=n.useCallback(()=>k(!1),[]);n.useEffect(()=>{if(!c)return;const t=l=>{h.current&&!h.current.contains(l.target)&&i()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[c,i]),n.useEffect(()=>{if(!c)return;const t=l=>{l.key==="Escape"&&i()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[c,i]);const x=se(s);return e.jsxs("div",{ref:h,className:`relative ${d}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":c,onClick:()=>k(t=>!t),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(x,{})}),c&&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 ${p==="up"?"bottom-full mb-1":"top-full mt-1"} ${T==="left"?"left-0":"right-0"}`,children:oe.map(({value:t,label:l,Icon:j})=>{const m=r===t;return e.jsxs("button",{type:"button",onClick:()=>{b(t),i()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${m?"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(j,{}),e.jsx("span",{children:l})]},t)})})]})}function ie(r){if(!r)return a("shared.error.prefix",{error:a("leaderboard.error.unknown")});const s=r?.message||String(r),b=String(s||"").trim()||a("leaderboard.error.unknown");return a("shared.error.prefix",{error:b})}function le(r){return typeof r!="string"?"":r.trim()}function de(r){if(typeof r!="string")return null;const s=r.trim().toLowerCase();return s==="week"||s==="month"||s==="total"?s:null}function me({auth:r,signedIn:s,sessionSoftExpired:b,userId:d}){const p=D(),{theme:T,resolvedTheme:c,setTheme:k}=H(),h=n.useMemo(()=>W(),[]),i=Y(),x=s&&!b,t=n.useMemo(()=>x&&(typeof r=="function"||typeof r=="string"||r&&typeof r=="object")?r:null,[r,x]),l=x?t:null,j=x&&Z(l),m=n.useMemo(()=>{const o=new URLSearchParams(p?.search||"");return de(o.get("period"))||"week"},[p?.search]),_=p?.search||"",[v,w]=n.useState(()=>({loading:!1,error:null,data:null}));n.useEffect(()=>{if(!h&&!i||!d||!i&&(!x||!j))return;let o=!0;return w(f=>({...f,loading:!0,error:null})),(async()=>{const f=await G(l);if(!o)return;if(!f){w({loading:!1,error:null,data:null});return}const $=await J({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:$})})().catch(f=>{o&&w({loading:!1,error:ie(f),data:null})}),()=>{o=!1}},[x,j,h,l,i,m,d]);const N=v.data,C=N?.from||null,A=N?.to||null,M=N?.generated_at||null,g=N?.entry||null,S=le(g?.display_name)||a("leaderboard.anon_label"),z=a("leaderboard.period.week"),K=a("leaderboard.period.month"),U=a("leaderboard.period.total"),I=m==="month"?K:m==="total"?U:z;let u=null;return d?v.loading?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.loading")})}):v.error?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):g?u=e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:L(re,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:a("leaderboard.column.rank")}),e.jsx("th",{className:L(ae,"font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap"),children:a("leaderboard.column.total")}),B.map(o=>e.jsx("th",{className:"px-4 py-4 font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:e.jsx(Q,{iconSrc:o.icon,label:a(o.copyKey)})},o.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:e.jsxs("tr",{className:"transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("td",{className:L(V(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:g?.rank??a("shared.placeholder.short")}),e.jsx("td",{className:L(X(),"text-oai-gray-700 dark:text-oai-gray-300"),children:R(g?.total_tokens)}),B.map(o=>e.jsx("td",{className:"px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:R(g?.[o.key])},o.key))]})})]})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}),e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-white 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 bg-white/80 dark:bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-200 dark:border-oai-gray-900 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsxs(E,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",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",children:e.jsx(q,{})})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(E,{to:`/leaderboard${_}`,className:"no-underline inline-flex items-center justify-center h-9 px-5 text-sm font-medium rounded-full shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-900 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors",children:a("leaderboard.profile.nav.back")}),e.jsx(ne,{theme:T,resolvedTheme:c,onSetTheme:k}),e.jsx(F,{})]})]})}),e.jsx("main",{className:"flex-1 py-12 sm:py-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-6 mb-10",children:[e.jsx(ee,{avatarUrl:g?.avatar_url,displayName:S,seed:typeof d=="string"?d:S,size:"lg",className:"shrink-0 ring-2 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:S}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[m==="total"?a("leaderboard.range.total"):C&&A?a("leaderboard.range",{period:I,from:C,to:A}):a("leaderboard.range_loading",{period:I}),M&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:a("leaderboard.generated_at",{ts:M})})]})]})]}),e.jsx("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:u})]})}),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-6xl 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:a("landing.v2.footer.line")}),e.jsx(E,{to:`/leaderboard${_}`,className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:a("leaderboard.profile.nav.back")})]})})]})}export{me as LeaderboardProfilePage};
1
+ import{r as n,D as e,aA as D,C as H,aC as W,h as Y,j as Z,aE as G,aI as J,B as a,az as L,ax as R,a9 as E,aJ as q,aK as F}from"./main-Cv6YpYdZ.js";import{b as B,d as Q,l as V,f as X,e as ee,L as re,g as ae}from"./leaderboard-columns-DFG1TWe9.js";const y=18;function O(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,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 P(){return e.jsx("svg",{"aria-hidden":!0,width:y,height:y,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 te(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,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 oe=[{value:"light",label:"Light",Icon:O},{value:"dark",label:"Dark",Icon:P},{value:"system",label:"System",Icon:te}];function se(r){return r==="dark"?P:O}function ne({theme:r,resolvedTheme:s,onSetTheme:b,className:d="",direction:p="down",align:T="right"}){const[c,k]=n.useState(!1),h=n.useRef(null),i=n.useCallback(()=>k(!1),[]);n.useEffect(()=>{if(!c)return;const t=l=>{h.current&&!h.current.contains(l.target)&&i()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[c,i]),n.useEffect(()=>{if(!c)return;const t=l=>{l.key==="Escape"&&i()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[c,i]);const x=se(s);return e.jsxs("div",{ref:h,className:`relative ${d}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":c,onClick:()=>k(t=>!t),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(x,{})}),c&&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 ${p==="up"?"bottom-full mb-1":"top-full mt-1"} ${T==="left"?"left-0":"right-0"}`,children:oe.map(({value:t,label:l,Icon:j})=>{const m=r===t;return e.jsxs("button",{type:"button",onClick:()=>{b(t),i()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${m?"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(j,{}),e.jsx("span",{children:l})]},t)})})]})}function ie(r){if(!r)return a("shared.error.prefix",{error:a("leaderboard.error.unknown")});const s=r?.message||String(r),b=String(s||"").trim()||a("leaderboard.error.unknown");return a("shared.error.prefix",{error:b})}function le(r){return typeof r!="string"?"":r.trim()}function de(r){if(typeof r!="string")return null;const s=r.trim().toLowerCase();return s==="week"||s==="month"||s==="total"?s:null}function me({auth:r,signedIn:s,sessionSoftExpired:b,userId:d}){const p=D(),{theme:T,resolvedTheme:c,setTheme:k}=H(),h=n.useMemo(()=>W(),[]),i=Y(),x=s&&!b,t=n.useMemo(()=>x&&(typeof r=="function"||typeof r=="string"||r&&typeof r=="object")?r:null,[r,x]),l=x?t:null,j=x&&Z(l),m=n.useMemo(()=>{const o=new URLSearchParams(p?.search||"");return de(o.get("period"))||"week"},[p?.search]),_=p?.search||"",[v,w]=n.useState(()=>({loading:!1,error:null,data:null}));n.useEffect(()=>{if(!h&&!i||!d||!i&&(!x||!j))return;let o=!0;return w(f=>({...f,loading:!0,error:null})),(async()=>{const f=await G(l);if(!o)return;if(!f){w({loading:!1,error:null,data:null});return}const $=await J({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:$})})().catch(f=>{o&&w({loading:!1,error:ie(f),data:null})}),()=>{o=!1}},[x,j,h,l,i,m,d]);const N=v.data,C=N?.from||null,A=N?.to||null,M=N?.generated_at||null,g=N?.entry||null,S=le(g?.display_name)||a("leaderboard.anon_label"),z=a("leaderboard.period.week"),K=a("leaderboard.period.month"),U=a("leaderboard.period.total"),I=m==="month"?K:m==="total"?U:z;let u=null;return d?v.loading?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.loading")})}):v.error?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):g?u=e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:L(re,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:a("leaderboard.column.rank")}),e.jsx("th",{className:L(ae,"font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap"),children:a("leaderboard.column.total")}),B.map(o=>e.jsx("th",{className:"px-4 py-4 font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:e.jsx(Q,{iconSrc:o.icon,label:a(o.copyKey)})},o.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:e.jsxs("tr",{className:"transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("td",{className:L(V(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:g?.rank??a("shared.placeholder.short")}),e.jsx("td",{className:L(X(),"text-oai-gray-700 dark:text-oai-gray-300"),children:R(g?.total_tokens)}),B.map(o=>e.jsx("td",{className:"px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:R(g?.[o.key])},o.key))]})})]})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}),e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-white 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 bg-white/80 dark:bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-200 dark:border-oai-gray-900 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsxs(E,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",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",children:e.jsx(q,{})})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(E,{to:`/leaderboard${_}`,className:"no-underline inline-flex items-center justify-center h-9 px-5 text-sm font-medium rounded-full shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-900 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors",children:a("leaderboard.profile.nav.back")}),e.jsx(ne,{theme:T,resolvedTheme:c,onSetTheme:k}),e.jsx(F,{})]})]})}),e.jsx("main",{className:"flex-1 py-12 sm:py-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-6 mb-10",children:[e.jsx(ee,{avatarUrl:g?.avatar_url,displayName:S,seed:typeof d=="string"?d:S,size:"lg",className:"shrink-0 ring-2 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:S}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[m==="total"?a("leaderboard.range.total"):C&&A?a("leaderboard.range",{period:I,from:C,to:A}):a("leaderboard.range_loading",{period:I}),M&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:a("leaderboard.generated_at",{ts:M})})]})]})]}),e.jsx("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:u})]})}),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-6xl 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:a("landing.v2.footer.line")}),e.jsx(E,{to:`/leaderboard${_}`,className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:a("leaderboard.profile.nav.back")})]})})]})}export{me as LeaderboardProfilePage};
@@ -1,2 +1,2 @@
1
- import{D as r,az as y,r as f,B as l,a9 as b,aL as j}from"./main-D49FUfq7.js";import{u as v}from"./use-usage-limits-BGttWixw.js";import{u as k}from"./use-limits-display-prefs-BHo0gzBa.js";import{C as h}from"./Card-ClNKd74W.js";import{F as N}from"./FadeIn-c2wFBL_u.js";const L=[3,2,3,3,2,2,3];function d({className:s}){return r.jsx("div",{className:y("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function P(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(d,{className:"h-3 w-12 shrink-0"}),r.jsx(d,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(d,{className:"h-3 w-[30px] shrink-0"}),r.jsx(d,{className:"h-3 w-6 shrink-0"})]})}function C({bars:s,index:e}){const o=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(d,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(d,{className:y("h-4",o)})]}),Array.from({length:s},(i,a)=>r.jsx(P,{},a))]})}function E(){return r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(d,{className:"h-3.5 w-28"}),L.map((s,e)=>r.jsx(C,{bars:s,index:e},e))]})})}function t(s){if(!s)return null;const e=typeof s=="number"?s*1e3:Date.parse(s);if(!Number.isFinite(e))return null;const o=e-Date.now();if(o<=0)return"now";const i=Math.floor(o/6e4);if(i<60)return`${i}m`;const a=Math.floor(i/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function O(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function n({label:s,pct:e,reset:o}){const i=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(i),x=i>0&&a===0?Math.max(i,.35):i,u=i>0&&a===0?"<1":String(a);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:s}),r.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:`${O(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:i>0?"3px":0}})}),r.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[u,"%"]}),o?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:o}):null]})}function c({name:s,icon:e,children:o}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e?r.jsx("img",{src:e,alt:"",className:a}):null,r.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:s})]}),o]})}const T=["claude","codex","cursor","gemini","kiro","copilot","antigravity"];function R(s,e){if(!(i=>i?.configured&&!i.error)(e))return null;switch(s){case"claude":return r.jsxs(c,{name:"Claude",icon:"/brand-logos/claude-code.svg",children:[e.five_hour?r.jsx(n,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(n,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(n,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null]},"claude");case"codex":return r.jsxs(c,{name:"Codex",icon:"/brand-logos/codex.svg",children:[e.primary_window?r.jsx(n,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null]},"codex");case"cursor":return r.jsxs(c,{name:"Cursor",icon:"/brand-logos/cursor.svg",children:[e.primary_window?r.jsx(n,{label:"Plan",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Auto",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"API",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"cursor");case"gemini":return r.jsxs(c,{name:"Gemini",icon:"/brand-logos/gemini.svg",children:[e.primary_window?r.jsx(n,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"gemini");case"kiro":return r.jsxs(c,{name:"Kiro",icon:"/brand-logos/kiro.svg",children:[e.primary_window?r.jsx(n,{label:"Month",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Bonus",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null]},"kiro");case"antigravity":return r.jsxs(c,{name:"Antigravity",icon:"/brand-logos/antigravity.svg",children:[e.primary_window?r.jsx(n,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"antigravity");case"copilot":return r.jsxs(c,{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg",children:[e.primary_window?r.jsx(n,{label:"Premium",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Chat",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(A,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function A({defaultDir:s}){const[e,o]=f.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${s||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
1
+ import{D as r,az as y,r as f,B as l,a9 as b,aL as j}from"./main-Cv6YpYdZ.js";import{u as v}from"./use-usage-limits-D-gv2i1R.js";import{u as k}from"./use-limits-display-prefs-BUrHqTkA.js";import{C as h}from"./Card-5ebScQbM.js";import{F as N}from"./FadeIn-CHjFUAEe.js";const L=[3,2,3,3,2,2,3];function d({className:s}){return r.jsx("div",{className:y("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function P(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(d,{className:"h-3 w-12 shrink-0"}),r.jsx(d,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(d,{className:"h-3 w-[30px] shrink-0"}),r.jsx(d,{className:"h-3 w-6 shrink-0"})]})}function C({bars:s,index:e}){const o=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(d,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(d,{className:y("h-4",o)})]}),Array.from({length:s},(i,a)=>r.jsx(P,{},a))]})}function E(){return r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(d,{className:"h-3.5 w-28"}),L.map((s,e)=>r.jsx(C,{bars:s,index:e},e))]})})}function t(s){if(!s)return null;const e=typeof s=="number"?s*1e3:Date.parse(s);if(!Number.isFinite(e))return null;const o=e-Date.now();if(o<=0)return"now";const i=Math.floor(o/6e4);if(i<60)return`${i}m`;const a=Math.floor(i/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function O(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function n({label:s,pct:e,reset:o}){const i=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(i),x=i>0&&a===0?Math.max(i,.35):i,u=i>0&&a===0?"<1":String(a);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:s}),r.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:`${O(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:i>0?"3px":0}})}),r.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[u,"%"]}),o?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:o}):null]})}function c({name:s,icon:e,children:o}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e?r.jsx("img",{src:e,alt:"",className:a}):null,r.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:s})]}),o]})}const T=["claude","codex","cursor","gemini","kiro","copilot","antigravity"];function R(s,e){if(!(i=>i?.configured&&!i.error)(e))return null;switch(s){case"claude":return r.jsxs(c,{name:"Claude",icon:"/brand-logos/claude-code.svg",children:[e.five_hour?r.jsx(n,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(n,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(n,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null]},"claude");case"codex":return r.jsxs(c,{name:"Codex",icon:"/brand-logos/codex.svg",children:[e.primary_window?r.jsx(n,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null]},"codex");case"cursor":return r.jsxs(c,{name:"Cursor",icon:"/brand-logos/cursor.svg",children:[e.primary_window?r.jsx(n,{label:"Plan",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Auto",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"API",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"cursor");case"gemini":return r.jsxs(c,{name:"Gemini",icon:"/brand-logos/gemini.svg",children:[e.primary_window?r.jsx(n,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"gemini");case"kiro":return r.jsxs(c,{name:"Kiro",icon:"/brand-logos/kiro.svg",children:[e.primary_window?r.jsx(n,{label:"Month",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Bonus",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null]},"kiro");case"antigravity":return r.jsxs(c,{name:"Antigravity",icon:"/brand-logos/antigravity.svg",children:[e.primary_window?r.jsx(n,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"antigravity");case"copilot":return r.jsxs(c,{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg",children:[e.primary_window?r.jsx(n,{label:"Premium",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Chat",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(A,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function A({defaultDir:s}){const[e,o]=f.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${s||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
2
2
  `),x=async()=>{try{await navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),1600)}catch{}};return r.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:[r.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:l("limits.copilot.otelHint.title")}),r.jsx("div",{className:"mt-0.5 leading-snug",children:l("limits.copilot.otelHint.body")}),r.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),r.jsx("button",{type:"button",onClick:x,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?l("limits.copilot.otelHint.copied"):l("limits.copilot.otelHint.copy")})]})}function I({claude:s,codex:e,cursor:o,gemini:i,kiro:a,antigravity:x,copilot:u,order:p,visibility:w}){const _={claude:s,codex:e,cursor:o,gemini:i,kiro:a,antigravity:x,copilot:u},g=(Array.isArray(p)&&p.length>0?p:T).filter(m=>!w||w[m]!==!1).map(m=>R(m,_[m])).filter(Boolean);return g.length===0?null:r.jsx(N,{delay:.15,children:r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:"Usage Limits"}),g]})})})}function $(){const{data:s,error:e,isLoading:o}=v({initialRefresh:!0}),i=k();return r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:l("nav.limits")}),r.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:l("limits.page.subtitle")})]}),r.jsx(b,{to:"/settings","aria-label":l("limits.page.openSettings"),title:l("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:r.jsx(j,{className:"h-4 w-4","aria-hidden":!0})})]}),o?r.jsx(E,{}):r.jsxs(r.Fragment,{children:[e?r.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:l("shared.error.prefix",{error:e})}):null,r.jsx(I,{claude:s?.claude,codex:s?.codex,cursor:s?.cursor,gemini:s?.gemini,kiro:s?.kiro,antigravity:s?.antigravity,copilot:s?.copilot,order:i.order,visibility:i.visibility})]})]})})})}export{$ as LimitsPage};
@@ -1 +1 @@
1
- import{r as o,b as X,f as Y,aN as R,D as e,e as T,aO as Z,aP as J,aQ as ee,aR as H,aS as te,aT as ae,ab as F,B as s,az as k,C as ne,aU as se,aV as ie,aW as oe,ai as re,ah as ce,aD as le,aE as D,aX as de,aH as ue,aF as ge,aY as P,aj as me,aZ as xe}from"./main-D49FUfq7.js";import{L as he,a as B,u as ye}from"./use-limits-display-prefs-BHo0gzBa.js";import{C as fe}from"./Card-ClNKd74W.js";import{D as be}from"./download-BmThIfGZ.js";const pe=t=>!t.isLayoutDirty&&t.willUpdate(!1);function G(){const t=new Set,a=new WeakMap,n=()=>t.forEach(pe);return{add:i=>{t.add(i),a.set(i,i.addEventListener("willUpdate",n))},remove:i=>{t.delete(i);const r=a.get(i);r&&(r(),a.delete(i)),n()},dirty:n}}const ke=o.createContext(null);function ve(){const t=o.useRef(!1);return X(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function je(){const t=ve(),[a,n]=o.useState(0),i=o.useCallback(()=>{t.current&&n(a+1)},[a]);return[o.useCallback(()=>Y.postRender(i),[i]),a]}const U=t=>t===!0,Ne=t=>U(t===!0)||t==="id",we=({children:t,id:a,inherit:n=!0})=>{const i=o.useContext(R),r=o.useContext(ke),[m,d]=je(),x=o.useRef(null),u=i.id||r;x.current===null&&(Ne(n)&&u&&(a=a?u+"-"+a:u),x.current={id:a,group:U(n)&&i.group||G()});const b=o.useMemo(()=>({...x.current,forceRender:m}),[d]);return e.jsx(R.Provider,{value:b,children:t})};const Se=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ce=T("grip-vertical",Se);const Le=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ie=T("log-out",Le);const De=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ae=T("pencil",De);const Te=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Me=T("refresh-cw",Te);function V(){const[t,a]=o.useState(null),n=Z()&&J();o.useEffect(()=>{if(!n)return;const d=ee(x=>a(x));return H(),d},[n]);const i=o.useCallback((d,x)=>{n&&(a(u=>u&&{...u,[d]:x}),te(d,x))},[n]),r=o.useCallback(d=>{n&&ae(d)},[n]),m=o.useCallback(()=>{n&&H()},[n]);return{available:n,settings:t,setSetting:i,runAction:r,refresh:m}}function Pe({checked:t,onChange:a,ariaLabel:n}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":n,onClick:a,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function Ee({prefs:t}){const{order:a,visibility:n,toggle:i,moveToward:r}=t,[m,d]=o.useState(null),[x,u]=o.useState(null),b=l=>g=>{d(l),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",l)},y=l=>g=>{g.preventDefault(),g.dataTransfer.dropEffect="move",m&&m!==l&&x!==l&&(u(l),r(m,l))},N=()=>{d(null),u(null)},w=l=>{l.preventDefault(),d(null),u(null)};return e.jsx(we,{children:e.jsx("div",{className:"flex flex-col",children:a.map(l=>{const g=n[l]!==!1,f=m===l;return e.jsxs(F.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:b(l),onDragOver:y(l),onDragEnd:N,onDrop:w,className:k("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",f&&"opacity-40"),style:{cursor:f?"grabbing":"grab"},children:[e.jsx(Ce,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("img",{src:he[l],alt:"",width:18,height:18,className:"h-[18px] w-[18px] shrink-0 pointer-events-none",draggable:!1}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:B[l]}),e.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:e.jsx(Pe,{checked:g,onChange:()=>i(l),ariaLabel:`${s("limits.settings.toggle_visible")}: ${B[l]}`})})]},l)})})})}function _e(t){if(!t||typeof t!="object")return"";const a=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=a.full_name||a.name||n.name||a.user_name||a.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function Oe(t){return!t||typeof t!="object"?"":typeof t.email=="string"?t.email.trim():""}function j({checked:t,onChange:a,disabled:n,ariaLabel:i}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":i,onClick:a,disabled:n,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:t,hint:a,control:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:t}),a&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),e.jsx("div",{className:"shrink-0",children:n})]})}function A({title:t,subtitle:a,action:n,children:i}){return e.jsxs(fe,{children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:t}),a&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:a})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}const Re=[{value:"light",labelKey:"settings.appearance.theme.light",Icon:se},{value:"dark",labelKey:"settings.appearance.theme.dark",Icon:ie},{value:"system",labelKey:"settings.appearance.theme.system",Icon:oe}];function He({theme:t,onSetTheme:a}){return e.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900",children:Re.map(({value:n,labelKey:i,Icon:r})=>{const m=t===n;return e.jsxs("button",{type:"button",onClick:()=>a(n),className:k("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",m?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"),"aria-pressed":m,children:[e.jsx(r,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{children:s(i)})]},n)})})}function Be(){const{enabled:t,signedIn:a,user:n,signOut:i,getAccessToken:r}=re(),{openLoginModal:m}=ce(),[d,x]=o.useState(()=>le()),[u,b]=o.useState(!1),[y,N]=o.useState(!1),[w,l]=o.useState(!1),[g,f]=o.useState(!1),[v,E]=o.useState(null),[M,S]=o.useState(!1),[C,_]=o.useState(""),$=t&&a&&xe(),L=o.useMemo(()=>_e(n),[n]),z=o.useMemo(()=>Oe(n),[n]);o.useEffect(()=>{if(!a)return;let c=!0;return l(!0),(async()=>{try{const h=await D({getAccessToken:r});if(!c||!h)return;const I=await de({accessToken:h});if(!c)return;b(!!I?.enabled),N(!!I?.anonymous),I?.display_name&&E(I.display_name)}catch{}finally{c&&l(!1)}})(),()=>{c=!1}},[a,r]);const K=o.useCallback(async()=>{const c=!d;if(ue(c),x(c),c)try{await ge(()=>r())}catch(h){console.warn("[tokentracker] cloud sync:",h)}},[d,r]),W=o.useCallback(async()=>{if(!g){f(!0);try{const c=await D({getAccessToken:r});if(!c)return;const h=!u;await P({accessToken:c,enabled:h}),b(h)}catch{}finally{f(!1)}}},[u,g,r]),q=o.useCallback(async()=>{if(!g){f(!0);try{const c=await D({getAccessToken:r});if(!c)return;const h=!y;await P({accessToken:c,anonymous:h}),N(h)}catch{}finally{f(!1)}}},[y,g,r]),O=o.useCallback(async()=>{if(g)return;const c=C.trim().slice(0,50);if(c){f(!0);try{const h=await D({getAccessToken:r});if(!h)return;await P({accessToken:h,display_name:c}),E(c),S(!1)}catch{}finally{f(!1)}}},[C,g,r]),Q=o.useCallback(()=>{_(v||L),S(!0)},[v,L]);return t?a?e.jsxs(A,{title:s("settings.section.account"),subtitle:z||v||L,action:e.jsxs("button",{type:"button",onClick:()=>i(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors",children:[e.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]}),children:[$&&e.jsx(p,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:e.jsx(j,{checked:d,onChange:K,ariaLabel:s("settings.account.cloudSync")})}),e.jsx(p,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:e.jsx(j,{checked:u,onChange:W,disabled:w||g,ariaLabel:s("settings.account.publicProfile")})}),e.jsx(me,{initial:!1,children:u&&e.jsxs(F.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:[e.jsx("div",{className:"py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.displayName")}),!M&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:v||L}),M&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:c=>_(c.target.value),onKeyDown:c=>{c.key==="Enter"&&O(),c.key==="Escape"&&S(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-transparent px-2.5 py-1.5 text-sm text-oai-black dark:text-white outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500",placeholder:s("settings.account.displayName")}),e.jsx("button",{type:"button",onClick:O,disabled:g||!C.trim(),className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-oai-brand-600 disabled:opacity-50 transition-colors",children:g?s("settings.account.saving"):s("settings.account.save")}),e.jsx("button",{type:"button",onClick:()=>S(!1),className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors",children:s("settings.account.cancel")})]})]}),!M&&e.jsxs("button",{type:"button",onClick:Q,className:"shrink-0 inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:[e.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.edit")]})]})}),e.jsx(p,{label:s("settings.account.anonymous"),hint:s("settings.account.anonymousHint"),control:e.jsx(j,{checked:y,onChange:q,disabled:w||g,ariaLabel:s("settings.account.anonymous")})})]},"public-profile-fields")})]}):e.jsx(A,{title:s("settings.section.account"),children:e.jsxs("div",{className:"flex items-center justify-between py-3 gap-4",children:[e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),e.jsx("button",{type:"button",onClick:m,className:"shrink-0 inline-flex h-8 items-center justify-center rounded-md bg-oai-gray-900 text-white px-4 text-xs font-medium hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:s("settings.account.signIn")})]})}):null}function Ge(){const{available:t,settings:a,setSetting:n,runAction:i}=V();if(!t)return null;const r=!!a?.showStats,m=a?.animatedIcon!==!1,d=!!a?.launchAtLogin,x=a?.launchAtLoginSupported!==!1;a?.version;const u=a?.updateStatus||null,b=!!a?.updateBusy,y=!!a?.isSyncing;return e.jsxs(A,{title:s("settings.section.menubar"),children:[e.jsx(p,{label:s("settings.menubar.showStats"),hint:s("settings.menubar.showStatsHint"),control:e.jsx(j,{checked:r,onChange:()=>n("showStats",!r),ariaLabel:s("settings.menubar.showStats")})}),e.jsx(p,{label:s("settings.menubar.animatedIcon"),hint:s("settings.menubar.animatedIconHint"),control:e.jsx(j,{checked:m,onChange:()=>n("animatedIcon",!m),ariaLabel:s("settings.menubar.animatedIcon")})}),x&&e.jsx(p,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:e.jsx(j,{checked:d,onChange:()=>n("launchAtLogin",!d),ariaLabel:s("settings.menubar.launchAtLogin")})}),e.jsx(p,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:y,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Me,{className:k("h-3.5 w-3.5",y&&"animate-spin"),"aria-hidden":!0}),y?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),e.jsx(p,{label:s("settings.menubar.updates"),hint:u||void 0,control:e.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:b,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(be,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Fe(){const{available:t,settings:a,runAction:n}=V();return!t||!a?.version?null:e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[e.jsxs("span",{children:["TokenTrackerBar v",a.version]}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:()=>n("openAbout"),className:"hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors underline-offset-2 hover:underline",children:"GitHub"})]})}function Ke(){const{theme:t,setTheme:a}=ne(),n=ye();return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex items-center justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white",children:s("settings.page.title")}),e.jsx(He,{theme:t,onSetTheme:a})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ge,{}),e.jsx(Be,{}),e.jsx(A,{title:s("settings.section.limits"),children:e.jsx(Ee,{prefs:n})})]}),e.jsx(Fe,{})]})})})}export{Ke as SettingsPage};
1
+ import{r as o,b as X,f as Y,aN as R,D as e,e as T,aO as Z,aP as J,aQ as ee,aR as H,aS as te,aT as ae,ab as F,B as s,az as k,C as ne,aU as se,aV as ie,aW as oe,ai as re,ah as ce,aD as le,aE as D,aX as de,aH as ue,aF as ge,aY as P,aj as me,aZ as xe}from"./main-Cv6YpYdZ.js";import{L as he,a as B,u as ye}from"./use-limits-display-prefs-BUrHqTkA.js";import{C as fe}from"./Card-5ebScQbM.js";import{D as be}from"./download-CQASvwEL.js";const pe=t=>!t.isLayoutDirty&&t.willUpdate(!1);function G(){const t=new Set,a=new WeakMap,n=()=>t.forEach(pe);return{add:i=>{t.add(i),a.set(i,i.addEventListener("willUpdate",n))},remove:i=>{t.delete(i);const r=a.get(i);r&&(r(),a.delete(i)),n()},dirty:n}}const ke=o.createContext(null);function ve(){const t=o.useRef(!1);return X(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function je(){const t=ve(),[a,n]=o.useState(0),i=o.useCallback(()=>{t.current&&n(a+1)},[a]);return[o.useCallback(()=>Y.postRender(i),[i]),a]}const U=t=>t===!0,Ne=t=>U(t===!0)||t==="id",we=({children:t,id:a,inherit:n=!0})=>{const i=o.useContext(R),r=o.useContext(ke),[m,d]=je(),x=o.useRef(null),u=i.id||r;x.current===null&&(Ne(n)&&u&&(a=a?u+"-"+a:u),x.current={id:a,group:U(n)&&i.group||G()});const b=o.useMemo(()=>({...x.current,forceRender:m}),[d]);return e.jsx(R.Provider,{value:b,children:t})};const Se=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ce=T("grip-vertical",Se);const Le=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ie=T("log-out",Le);const De=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ae=T("pencil",De);const Te=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Me=T("refresh-cw",Te);function V(){const[t,a]=o.useState(null),n=Z()&&J();o.useEffect(()=>{if(!n)return;const d=ee(x=>a(x));return H(),d},[n]);const i=o.useCallback((d,x)=>{n&&(a(u=>u&&{...u,[d]:x}),te(d,x))},[n]),r=o.useCallback(d=>{n&&ae(d)},[n]),m=o.useCallback(()=>{n&&H()},[n]);return{available:n,settings:t,setSetting:i,runAction:r,refresh:m}}function Pe({checked:t,onChange:a,ariaLabel:n}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":n,onClick:a,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function Ee({prefs:t}){const{order:a,visibility:n,toggle:i,moveToward:r}=t,[m,d]=o.useState(null),[x,u]=o.useState(null),b=l=>g=>{d(l),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",l)},y=l=>g=>{g.preventDefault(),g.dataTransfer.dropEffect="move",m&&m!==l&&x!==l&&(u(l),r(m,l))},N=()=>{d(null),u(null)},w=l=>{l.preventDefault(),d(null),u(null)};return e.jsx(we,{children:e.jsx("div",{className:"flex flex-col",children:a.map(l=>{const g=n[l]!==!1,f=m===l;return e.jsxs(F.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:b(l),onDragOver:y(l),onDragEnd:N,onDrop:w,className:k("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",f&&"opacity-40"),style:{cursor:f?"grabbing":"grab"},children:[e.jsx(Ce,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("img",{src:he[l],alt:"",width:18,height:18,className:"h-[18px] w-[18px] shrink-0 pointer-events-none",draggable:!1}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:B[l]}),e.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:e.jsx(Pe,{checked:g,onChange:()=>i(l),ariaLabel:`${s("limits.settings.toggle_visible")}: ${B[l]}`})})]},l)})})})}function _e(t){if(!t||typeof t!="object")return"";const a=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=a.full_name||a.name||n.name||a.user_name||a.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function Oe(t){return!t||typeof t!="object"?"":typeof t.email=="string"?t.email.trim():""}function j({checked:t,onChange:a,disabled:n,ariaLabel:i}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":i,onClick:a,disabled:n,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:t,hint:a,control:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:t}),a&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),e.jsx("div",{className:"shrink-0",children:n})]})}function A({title:t,subtitle:a,action:n,children:i}){return e.jsxs(fe,{children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:t}),a&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:a})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}const Re=[{value:"light",labelKey:"settings.appearance.theme.light",Icon:se},{value:"dark",labelKey:"settings.appearance.theme.dark",Icon:ie},{value:"system",labelKey:"settings.appearance.theme.system",Icon:oe}];function He({theme:t,onSetTheme:a}){return e.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900",children:Re.map(({value:n,labelKey:i,Icon:r})=>{const m=t===n;return e.jsxs("button",{type:"button",onClick:()=>a(n),className:k("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",m?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"),"aria-pressed":m,children:[e.jsx(r,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{children:s(i)})]},n)})})}function Be(){const{enabled:t,signedIn:a,user:n,signOut:i,getAccessToken:r}=re(),{openLoginModal:m}=ce(),[d,x]=o.useState(()=>le()),[u,b]=o.useState(!1),[y,N]=o.useState(!1),[w,l]=o.useState(!1),[g,f]=o.useState(!1),[v,E]=o.useState(null),[M,S]=o.useState(!1),[C,_]=o.useState(""),$=t&&a&&xe(),L=o.useMemo(()=>_e(n),[n]),z=o.useMemo(()=>Oe(n),[n]);o.useEffect(()=>{if(!a)return;let c=!0;return l(!0),(async()=>{try{const h=await D({getAccessToken:r});if(!c||!h)return;const I=await de({accessToken:h});if(!c)return;b(!!I?.enabled),N(!!I?.anonymous),I?.display_name&&E(I.display_name)}catch{}finally{c&&l(!1)}})(),()=>{c=!1}},[a,r]);const K=o.useCallback(async()=>{const c=!d;if(ue(c),x(c),c)try{await ge(()=>r())}catch(h){console.warn("[tokentracker] cloud sync:",h)}},[d,r]),W=o.useCallback(async()=>{if(!g){f(!0);try{const c=await D({getAccessToken:r});if(!c)return;const h=!u;await P({accessToken:c,enabled:h}),b(h)}catch{}finally{f(!1)}}},[u,g,r]),q=o.useCallback(async()=>{if(!g){f(!0);try{const c=await D({getAccessToken:r});if(!c)return;const h=!y;await P({accessToken:c,anonymous:h}),N(h)}catch{}finally{f(!1)}}},[y,g,r]),O=o.useCallback(async()=>{if(g)return;const c=C.trim().slice(0,50);if(c){f(!0);try{const h=await D({getAccessToken:r});if(!h)return;await P({accessToken:h,display_name:c}),E(c),S(!1)}catch{}finally{f(!1)}}},[C,g,r]),Q=o.useCallback(()=>{_(v||L),S(!0)},[v,L]);return t?a?e.jsxs(A,{title:s("settings.section.account"),subtitle:z||v||L,action:e.jsxs("button",{type:"button",onClick:()=>i(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors",children:[e.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]}),children:[$&&e.jsx(p,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:e.jsx(j,{checked:d,onChange:K,ariaLabel:s("settings.account.cloudSync")})}),e.jsx(p,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:e.jsx(j,{checked:u,onChange:W,disabled:w||g,ariaLabel:s("settings.account.publicProfile")})}),e.jsx(me,{initial:!1,children:u&&e.jsxs(F.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:[e.jsx("div",{className:"py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.displayName")}),!M&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:v||L}),M&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:C,onChange:c=>_(c.target.value),onKeyDown:c=>{c.key==="Enter"&&O(),c.key==="Escape"&&S(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-transparent px-2.5 py-1.5 text-sm text-oai-black dark:text-white outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500",placeholder:s("settings.account.displayName")}),e.jsx("button",{type:"button",onClick:O,disabled:g||!C.trim(),className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-oai-brand-600 disabled:opacity-50 transition-colors",children:g?s("settings.account.saving"):s("settings.account.save")}),e.jsx("button",{type:"button",onClick:()=>S(!1),className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors",children:s("settings.account.cancel")})]})]}),!M&&e.jsxs("button",{type:"button",onClick:Q,className:"shrink-0 inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:[e.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.edit")]})]})}),e.jsx(p,{label:s("settings.account.anonymous"),hint:s("settings.account.anonymousHint"),control:e.jsx(j,{checked:y,onChange:q,disabled:w||g,ariaLabel:s("settings.account.anonymous")})})]},"public-profile-fields")})]}):e.jsx(A,{title:s("settings.section.account"),children:e.jsxs("div",{className:"flex items-center justify-between py-3 gap-4",children:[e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),e.jsx("button",{type:"button",onClick:m,className:"shrink-0 inline-flex h-8 items-center justify-center rounded-md bg-oai-gray-900 text-white px-4 text-xs font-medium hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:s("settings.account.signIn")})]})}):null}function Ge(){const{available:t,settings:a,setSetting:n,runAction:i}=V();if(!t)return null;const r=!!a?.showStats,m=a?.animatedIcon!==!1,d=!!a?.launchAtLogin,x=a?.launchAtLoginSupported!==!1;a?.version;const u=a?.updateStatus||null,b=!!a?.updateBusy,y=!!a?.isSyncing;return e.jsxs(A,{title:s("settings.section.menubar"),children:[e.jsx(p,{label:s("settings.menubar.showStats"),hint:s("settings.menubar.showStatsHint"),control:e.jsx(j,{checked:r,onChange:()=>n("showStats",!r),ariaLabel:s("settings.menubar.showStats")})}),e.jsx(p,{label:s("settings.menubar.animatedIcon"),hint:s("settings.menubar.animatedIconHint"),control:e.jsx(j,{checked:m,onChange:()=>n("animatedIcon",!m),ariaLabel:s("settings.menubar.animatedIcon")})}),x&&e.jsx(p,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:e.jsx(j,{checked:d,onChange:()=>n("launchAtLogin",!d),ariaLabel:s("settings.menubar.launchAtLogin")})}),e.jsx(p,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:y,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Me,{className:k("h-3.5 w-3.5",y&&"animate-spin"),"aria-hidden":!0}),y?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),e.jsx(p,{label:s("settings.menubar.updates"),hint:u||void 0,control:e.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:b,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 px-3 text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(be,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Fe(){const{available:t,settings:a,runAction:n}=V();return!t||!a?.version?null:e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[e.jsxs("span",{children:["TokenTrackerBar v",a.version]}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:()=>n("openAbout"),className:"hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors underline-offset-2 hover:underline",children:"GitHub"})]})}function Ke(){const{theme:t,setTheme:a}=ne(),n=ye();return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex items-center justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white",children:s("settings.page.title")}),e.jsx(He,{theme:t,onSetTheme:a})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ge,{}),e.jsx(Be,{}),e.jsx(A,{title:s("settings.section.limits"),children:e.jsx(Ee,{prefs:n})})]}),e.jsx(Fe,{})]})})})}export{Ke as SettingsPage};