tokentracker-cli 0.5.73 → 0.5.75

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/dashboard/dist/assets/{Card-D_q1XGfK.js → Card-D-EuRzLE.js} +1 -1
  2. package/dashboard/dist/assets/DashboardPage-DP4h327m.js +12 -0
  3. package/dashboard/dist/assets/{FadeIn-ClpHby-T.js → FadeIn-Nqb2FeSu.js} +1 -1
  4. package/dashboard/dist/assets/{IpCheckPage-B5TpHE6G.js → IpCheckPage-DKErP77B.js} +1 -1
  5. package/dashboard/dist/assets/LeaderboardPage-D_DqH7v4.js +5 -0
  6. package/dashboard/dist/assets/{LeaderboardProfilePage-C8xexZ08.js → LeaderboardProfilePage-B4U6R6TW.js} +1 -1
  7. package/dashboard/dist/assets/{LimitsPage-CERWQyIU.js → LimitsPage-WP9IFHnS.js} +1 -1
  8. package/dashboard/dist/assets/ProviderIcon-CiAX7O9R.js +1 -0
  9. package/dashboard/dist/assets/SettingsPage-BzWrP1qX.js +1 -0
  10. package/dashboard/dist/assets/{WidgetsPage-Cmr2tbD7.js → WidgetsPage-BbV32pxZ.js} +1 -1
  11. package/dashboard/dist/assets/{download-M8e1PJC-.js → download-CXIEU-zL.js} +1 -1
  12. package/dashboard/dist/assets/{leaderboard-columns-Dcg9r7R2.js → leaderboard-columns-DIsoAppd.js} +1 -1
  13. package/dashboard/dist/assets/main-DRf20yyJ.css +1 -0
  14. package/dashboard/dist/assets/{main-D1VdJk4V.js → main-_yO2TZgj.js} +12 -3
  15. package/dashboard/dist/assets/{use-limits-display-prefs-CSj55sfK.js → use-limits-display-prefs-CogaUGYH.js} +1 -1
  16. package/dashboard/dist/assets/{use-usage-limits-BuWINUAm.js → use-usage-limits-Didh7hvY.js} +1 -1
  17. package/dashboard/dist/index.html +2 -2
  18. package/dashboard/dist/share.html +2 -2
  19. package/package.json +1 -1
  20. package/src/commands/serve.js +7 -2
  21. package/dashboard/dist/assets/DashboardPage-CuBSoNgI.js +0 -12
  22. package/dashboard/dist/assets/LeaderboardPage-BOrtGeIf.js +0 -5
  23. package/dashboard/dist/assets/SettingsPage-DUwt4x-H.js +0 -1
  24. package/dashboard/dist/assets/main-CNzfq4Ln.css +0 -1
@@ -1 +1 @@
1
- import{aa as s,D as n,ab as d}from"./main-D1VdJk4V.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-_yO2TZgj.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-D1VdJk4V.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-_yO2TZgj.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};
@@ -0,0 +1,5 @@
1
+ import{r as i,ad as G,S as Ge,D as d,az as O,aA as Jn,aB as Qn,ah as Zn,ai as er,aC as tr,h as nr,j as rr,B as A,aD as or,am as ar,ax as Nt,a9 as sr,aE as wt,aF as Kt,aG as Gt,aH as ir}from"./main-_yO2TZgj.js";import{P as lr}from"./ProviderIcon-CiAX7O9R.js";import{L as xn,a as mn,b as dt,l as Et,c as jt,d as cr,e as Vt}from"./leaderboard-columns-DIsoAppd.js";function dr(){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 V(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}=V(e);return e instanceof t}function nt(e){return Fe(e)?!1:e instanceof V(e).HTMLElement}function vn(e){return e instanceof V(e).SVGElement}function Ue(e){return e?Fe(e)?e.document:_t(e)?Pt(e)?e:nt(e)||vn(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 ur(){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 yn(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=yn(1),Ze=yn(-1);function fr(e){return"clientX"in e&&"clientY"in e}function zt(e){if(!e)return!1;const{KeyboardEvent:t}=V(e.target);return t&&e instanceof t}function gr(e){if(!e)return!1;const{TouchEvent:t}=V(e.target);return t&&e instanceof t}function At(e){if(gr(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 fr(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 hr(e){return e.matches(qt)?e:e.querySelector(qt)}const pr={display:"none"};function br(e){let{id:t,value:n}=e;return G.createElement("div",{id:t,style:pr},n)}function xr(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 G.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function mr(){const[e,t]=i.useState("");return{announce:i.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const wn=i.createContext(null);function vr(e){const t=i.useContext(wn);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function yr(){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 wr={draggable:`
2
+ To pick up a draggable item, press the space bar.
3
+ While dragging, use the arrow keys to move the item.
4
+ Press space again to drop the item in its new position, or press escape to cancel.
5
+ `},kr={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 Sr(e){let{announcements:t=kr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=wr}=e;const{announce:a,announcement:s}=mr(),l=ot("DndLiveRegion"),[c,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),vr(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=G.createElement(G.Fragment,null,G.createElement(br,{id:r,value:o.draggable}),G.createElement(xr,{id:l,announcement:s}));return n?Ge.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 Cr(){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 kn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Rr(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 Cn(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 Dr=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=kn(Zt(c),o);a.push({id:l,data:{droppableContainer:s,value:u}})}}return a.sort(Sn)},Nr=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+kn(u[S],h),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:f}})}}return a.sort(Sn)};function Er(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 jr=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=Er(l,t);c>0&&o.push({id:s,data:{droppableContainer:a,value:c}})}}return o.sort(Rr)};function Mr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Rn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Ar(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 Ir=Ar(1);function Tr(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 Lr(e,t,n){const r=Tr(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 Or={ignoreTransform:!1};function We(e,t){t===void 0&&(t=Or);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=V(e).getComputedStyle(e);u&&(n=Lr(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 We(e,{ignoreTransform:!0})}function _r(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Pr(e,t){return t===void 0&&(t=V(e).getComputedStyle(e)),t.position==="fixed"}function Br(e,t){t===void 0&&(t=V(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)||vn(o)||n.includes(o))return n;const a=V(e).getComputedStyle(o);return o!==e&&Br(o,a)&&n.push(o),Pr(o,a)?n:r(o.parentNode)}return e?r(e):n}function Dn(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 Nn(e){return Fe(e)?e.scrollX:e.scrollLeft}function En(e){return Fe(e)?e.scrollY:e.scrollTop}function It(e){return{x:Nn(e),y:En(e)}}var z;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(z||(z={}));function jn(e){return!pt||!e?!1:e===document.scrollingElement}function Mn(e){const t={x:0,y:0},n=jn(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 zr={x:.2,y:.2};function $r(e,t,n,r,o){let{top:a,left:s,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=zr);const{isTop:u,isBottom:g,isLeft:f,isRight:b}=Mn(e),h={x:0,y:0},S={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+x.height?(h.y=z.Backward,S.y=r*Math.abs((t.top+x.height-a)/x.height)):!g&&c>=t.bottom-x.height&&(h.y=z.Forward,S.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!b&&l>=t.right-x.width?(h.x=z.Forward,S.x=r*Math.abs((t.right-x.width-l)/x.width)):!f&&s<=t.left+x.width&&(h.x=z.Backward,S.x=r*Math.abs((t.left+x.width-s)/x.width)),{direction:h,speed:S}}function Fr(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 An(e){return e.reduce((t,n)=>ze(t,It(n)),ue)}function Ur(e){return e.reduce((t,n)=>t+Nn(n),0)}function Wr(e){return e.reduce((t,n)=>t+En(n),0)}function Xr(e,t){if(t===void 0&&(t=We),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Dn(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Yr=[["x",["left","right"],Ur],["y",["top","bottom"],Wr]];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=An(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of Yr)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 Ve{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 Hr(e){const{EventTarget:t}=V(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 Kr(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 In={start:[N.Space,N.Enter],cancel:[N.Esc],end:[N.Space,N.Enter,N.Tab]},Gr=(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 Ve(Ue(n)),this.windowListeners=new Ve(V(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&&Xr(r),n(ue)}handleKeyDown(t){if(zt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=In,coordinateGetter:s=Gr,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 x of S){const m=t.code,{isTop:w,isRight:C,isLeft:v,isBottom:R,maxScroll:E,minScroll:j}=Mn(x),k=Fr(x),y={x:Math.min(m===N.Right?k.right-k.width/2:k.right,Math.max(m===N.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(m===N.Down?k.bottom-k.height/2:k.bottom,Math.max(m===N.Down?k.top:k.top+k.height/2,f.y))},T=m===N.Right&&!C||m===N.Left&&!v,L=m===N.Down&&!R||m===N.Up&&!w;if(T&&y.x!==f.x){const D=x.scrollLeft+b.x,Y=m===N.Right&&D<=E.x||m===N.Left&&D>=j.x;if(Y&&!b.y){x.scrollTo({left:D,behavior:l});return}Y?h.x=x.scrollLeft-D:h.x=m===N.Right?x.scrollLeft-E.x:x.scrollLeft-j.x,h.x&&x.scrollBy({left:-h.x,behavior:l});break}else if(L&&y.y!==f.y){const D=x.scrollTop+b.y,Y=m===N.Down&&D<=E.y||m===N.Up&&D>=j.y;if(Y&&!b.x){x.scrollTo({top:D,behavior:l});return}Y?h.y=x.scrollTop-D:h.y=m===N.Down?x.scrollTop-E.y:x.scrollTop-j.y,h.y&&x.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=In,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=Hr(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 Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(V(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,Kr,{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 Vr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Wt extends Ut{constructor(t){const{event:n}=t,r=Ue(n.target);super(t,Vr,r)}}Wt.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 qr={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class Jr extends Ut{constructor(t){super(t,qr,Ue(t.event.target))}}Jr.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 Qr 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(){}}}Qr.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 Zr(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=to({delta:f,disabled:!a}),[S,x]=ur(),m=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=m.current.x*w.current.x,y=m.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){x();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}=$r(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){x(),v.current=j,S(R,s),m.current=L,w.current=T;return}}m.current={x:0,y:0},w.current={x:0,y:0},x()},[t,R,r,x,a,s,JSON.stringify(C),JSON.stringify(h),S,u,E,g,JSON.stringify(b)])}const eo={x:{[z.Backward]:!1,[z.Forward]:!1},y:{[z.Backward]:!1,[z.Forward]:!1}};function to(e){let{delta:t,disabled:n}=e;const r=Mt(t);return rt(o=>{if(n||!r||!o)return eo;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 no(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 ro(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 oo(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=m(),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),x=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:x,measureDroppableContainers:h,measuringScheduled:a!=null};function m(){switch(u){case tt.Always:return!1;case tt.BeforeDragging:return n;default:return!n}}}function Tn(e,t){return rt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ao(e,t){return Tn(e,t)}function so(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 xt(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 io(e){return new $t(We(e),e)}function an(e,t,n){t===void 0&&(t=io);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=so({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=xt({callback:a});return he(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),r}function lo(e){const t=Tn(e);return Rn(e,t)}const sn=[];function co(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 uo(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):An(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 fo(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 go(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 Ln(e){return i.useMemo(()=>e?_r(e):null,[e])}const cn=[];function ho(e,t){t===void 0&&(t=We);const[n]=e,r=Ln(n?V(n):null),[o,a]=i.useState(cn);function s(){a(()=>e.length?e.map(c=>jn(c)?r:new $t(t(c),c)):cn)}const l=xt({callback:s});return he(()=>{l?.disconnect(),s(),e.forEach(c=>l?.observe(c))},[e]),o}function po(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nt(t)?t:e}function bo(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=xt({callback:o}),s=i.useCallback(u=>{const g=po(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 xo=[{sensor:Wt,options:{}},{sensor:Ft,options:{}}],mo={current:{}},ct={draggable:{measure:en},droppable:{measure:en,strategy:tt.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:We}};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 vo={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},yo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ft,draggableNodes:new Map,over:null,measureDroppableContainers:ft},mt=i.createContext(yo),On=i.createContext(vo);function wo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function ko(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 So(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=i.useContext(mt),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=hr(g);if(f){f.focus();break}}})}},[r,t,o,s,a]),null}function Co(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function Ro(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 Do(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=Rn(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=Dn(u);b&&b.scrollBy({top:f.y,left:f.x})}},[t,s,l,r,n])}const _n=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 No=i.memo(function(t){var n,r,o,a;let{id:s,accessibility:l,autoScroll:c=!0,children:u,sensors:g=xo,collisionDetection:f=jr,measuring:b,modifiers:h,...S}=t;const x=i.useReducer(ko,void 0,wo),[m,w]=x,[C,v]=yr(),[R,E]=i.useState(Ne.Uninitialized),j=R===Ne.Initialized,{draggable:{active:k,nodes:y,translate:T},droppable:{containers:L}}=m,D=k!=null?y.get(k):null,Y=i.useRef({initial:null,translated:null}),H=i.useMemo(()=>{var X;return k!=null?{id:k,data:(X=D?.data)!=null?X:mo,rect:Y}: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=Ro(b),{droppableRects:_,measureDroppableContainers:te,measuringScheduled:q}=oo(Le,{dragging:j,dependencies:[T.x,T.y],config:F.droppable}),K=no(y,k),Ae=i.useMemo(()=>$?At($):null,[$]),ie=qn(),ne=ao(K,F.draggable.measure);Do({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=bo({measure:F.dragOverlay.measure}),xe=(r=oe.nodeRef.current)!=null?r:K,me=j?(o=oe.rect)!=null?o:M:null,Oe=!!(oe.nodeRef.current&&oe.rect),at=lo(Oe?null:M),Xe=Ln(xe?V(xe):null),le=co(j?be??K:null),Ie=ho(le),_e=Co(h,{transform:{x:T.x-at.x,y:T.y-at.y,scaleX:1,scaleY:1},activatorEvent:$,active:H,activeNodeRect:M,containerNodeRect:pe,draggingNodeRect:me,over:re.current.over,overlayNodeRect:oe.rect,scrollableAncestors:le,scrollableAncestorRects:Ie,windowRect:Xe}),Se=Ae?ze(Ae,T):null,Pe=uo(le),p=ln(Pe),I=ln(Pe,[M]),W=ze(_e,p),ve=me?Ir(me,_e):null,Te=H&&ve?f({active:H,collisionRect:ve,droppableRects:_,droppableContainers:Le,pointerCoordinates:Se}):null,ce=Cn(Te,"id"),[ye,Xt]=i.useState(null),Yn=Oe?_e:ze(_e,I),Hn=Mr(Yn,(a=ye?.rect)!=null?a:null,M),vt=i.useRef(null),Yt=i.useCallback((X,J)=>{let{sensor:Q,options:Ce}=J;if(ee.current==null)return;const ae=y.get(ee.current);if(!ae)return;const Z=X.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,Ye={activatorEvent:Z,active:{id:Re,data:ge.data,rect:Y}};Ge.unstable_batchedUpdates(()=>{we?.(Ye),E(Ne.Initializing),w({type:P.DragStart,initialCoordinates:U,active:Re}),C({type:"onDragStart",event:Ye}),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:Ye,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:Ye},U===P.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(De))&&(U=P.DragCancel)}ee.current=null,Ge.unstable_batchedUpdates(()=>{w({type:U}),E(Ne.Uninitialized),Xt(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]),Kn=i.useCallback((X,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};X(Q,J.options,fe)===!0&&(ae.dndKit={capturedBy:J.sensor},ee.current=Ce,Yt(Q,J))},[y,Yt]),Ht=ro(g,Kn);fo(g),he(()=>{M&&R===Ne.Initializing&&E(Ne.Initialized)},[M,R]),i.useEffect(()=>{const{onDragMove:X}=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:W.x,y:W.y},over:ae};Ge.unstable_batchedUpdates(()=>{X?.(Z),C({type:"onDragMove",event:Z})})},[W.x,W.y]),i.useEffect(()=>{const{active:X,activatorEvent:J,collisions:Q,droppableContainers:Ce,scrollAdjustedTranslate:ae}=re.current;if(!X||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:X,activatorEvent:J,collisions:Q,delta:{x:ae.x,y:ae.y},over:Be};Ge.unstable_batchedUpdates(()=>{Xt(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:xe,draggingNodeRect:me,droppableContainers:L,over:ye,scrollableAncestors:le,scrollAdjustedTranslate:W},Y.current={initial:me,translated:ve}},[H,K,Te,ve,y,xe,me,_,L,ye,le,W]),Zr({...ie,delta:T,draggingRect:ve,pointerCoordinates:Se,scrollableAncestors:le,scrollableAncestorRects:Ie});const Gn=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:Xe}),[H,K,M,$,Te,pe,oe,y,L,_,ye,te,le,Ie,F,q,Xe]),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 G.createElement(wn.Provider,{value:v},G.createElement(mt.Provider,{value:Vn},G.createElement(On.Provider,{value:Gn},G.createElement(_n.Provider,{value:Hn},u)),G.createElement(So,{disabled:l?.restoreFocus===!1})),G.createElement(Sr,{...l,hiddenTextDescribedById:Me}));function qn(){const X=ke?.autoScrollEnabled===!1,J=typeof c=="object"?c.enabled===!1:c===!1,Q=j&&!X&&!J;return typeof c=="object"?{...c,enabled:Q}:{enabled:Q}}}),Eo=i.createContext(null),dn="button",jo="Draggable";function Mo(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=ot(jo),{activators:s,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:b}=i.useContext(mt),{role:h=dn,roleDescription:S="draggable",tabIndex:x=0}=o??{},m=c?.id===t,w=i.useContext(m?_n:Eo),[C,v]=ut(),[R,E]=ut(),j=go(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:x,"aria-disabled":r,"aria-pressed":m&&h===dn?!0:void 0,"aria-roledescription":S,"aria-describedby":g.draggable}),[r,h,x,m,S,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:y,isDragging:m,listeners:r?void 0:j,node:C,over:b,setNodeRef:v,setActivatorNodeRef:E,transform:w}}function Ao(){return i.useContext(On)}const Io="Droppable",To={timeout:25};function Lo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=ot(Io),{active:s,dispatch:l,over:c,measureDroppableContainers:u}=i.useContext(mt),g=i.useRef({disabled:n}),f=i.useRef(!1),b=i.useRef(null),h=i.useRef(null),{disabled:S,updateMeasurementsFor:x,timeout:m}={...To,...o},w=Qe(x??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},m)},[m]),v=xt({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 Oo=e=>{let{transform:t}=e;return{...t,y:0}};function Pn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function _o(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 Po(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 Bo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const it={scaleX:1,scaleY:1},zo=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=$o(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 $o(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 Bn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=Pn(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}},zn="Sortable",$n=G.createContext({activeIndex:-1,containerId:zn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Bn,disabled:{draggable:!1,droppable:!1}});function Fo(e){let{children:t,id:n,items:r,strategy:o=Bn,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:g}=Ao(),f=ot(zn,n),b=l.rect!==null,h=i.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),S=s!=null,x=s?h.indexOf(s.id):-1,m=u?h.indexOf(u.id):-1,w=i.useRef(h),C=!Po(h,w.current),v=m!==-1&&x===-1||C,R=Bo(a);he(()=>{C&&S&&g(h)},[C,h,S,g]),i.useEffect(()=>{w.current=h},[h]);const E=i.useMemo(()=>({activeIndex:x,containerId:f,disabled:R,disableTransforms:v,items:h,overIndex:m,useDragOverlay:b,sortedRects:_o(h,c),strategy:o}),[x,f,R.draggable,R.droppable,v,h,m,c,b,o]);return G.createElement($n.Provider,{value:E},t)}const Uo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Pn(n,r,o).indexOf(t)},Wo=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},Xo={duration:200,easing:"ease"},Fn="transform",Yo=et.Transition.toString({property:Fn,duration:0,easing:"linear"}),Ho={roleDescription:"sortable"};function Ko(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=We(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 Go(e){let{animateLayoutChanges:t=Wo,attributes:n,disabled:r,data:o,getNewIndex:a=Uo,id:s,strategy:l,resizeObserverConfig:c,transition:u=Xo}=e;const{items:g,containerId:f,activeIndex:b,disabled:h,disableTransforms:S,sortedRects:x,overIndex:m,useDragOverlay:w,strategy:C}=i.useContext($n),v=Vo(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}=Lo({id:s,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:D,activatorEvent:Y,activeNodeRect:H,attributes:ee,setNodeRef:ke,listeners:Ee,isDragging:$,over:je,setActivatorNodeRef:B,transform:Me}=Mo({id:s,data:E,attributes:{...Ho,...n},disabled:v.draggable}),Le=dr(L,ke),F=!!D,_=F&&!S&&st(b)&&st(m),te=!w&&$,q=te&&_?Me:null,Ae=_?q??(l??C)({rects:x,activeNodeRect:H,activeIndex:b,overIndex:m,index:R}):null,ie=st(b)&&st(m)?a({id:s,items:g,activeIndex:b,overIndex:m}):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=Ko({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 xe=setTimeout(()=>{M.current.activeId=ne},50);return()=>clearTimeout(xe)},[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:m,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 Yo;if(!(te&&!zt(Y)||!u)&&(F||re))return et.Transition.toString({...u,property:Fn})}}function Vo(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 qo=[N.Down,N.Right,N.Up,N.Left],Jo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(qo.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=Nr({collisionRect:r,droppableRects:o,droppableContainers:c});let g=Cn(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 m=bt(S).some((j,k)=>l[k]!==j),w=Un(f,b),C=Qo(f,b),v=m||!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 Un(e,t){return!ht(e)||!ht(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Qo(e,t){return!ht(e)||!ht(t)||!Un(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 Zo(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 ea({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 ta({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 na({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 ra({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(xn,"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(na,{index:n},n))})]})})}function oa({id:e,thClassName:t,children:n}){const{attributes:r,listeners:o,setNodeRef:a,transform:s,transition:l,isDragging:c}=Go({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 Wn="tokentracker.leaderboard.columnOrder.v1";function aa(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Wn);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(Wn,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 sa(e){const t=i.useMemo(()=>e.join("|"),[e]),[n,r]=i.useState(()=>un(aa(),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 ia={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=ia[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 la(e){if(!e)return A("shared.error.prefix",{error:A("leaderboard.error.unknown")});const t=e?.message||String(e),n=String(t||"").trim()||A("leaderboard.error.unknown");return A("shared.error.prefix",{error:n})}function Xn(e){return typeof e!="string"?"":e.trim()}function ca(e){const t=Xn(e);return t?t.toLowerCase()==="anonymous":!0}function da(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 bn({githubUrl:e}){return d.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[d.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":A("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:d.jsx(lr,{provider:"GITHUB",size:16})}),d.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[A("leaderboard.github.tooltipPrefix")," ",d.jsx(sr,{to:"/settings",onClick:t=>t.stopPropagation(),className:"underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:A("leaderboard.github.tooltipSettingsLink")})]})]})}function ha({auth:e,signedIn:t,sessionSoftExpired:n}){const r=Jn(),o=Qn(),{openLoginModal:a}=Zn(),{signedIn:s,loading:l,user:c}=er(),u=i.useMemo(()=>tr(),[]),g=nr(),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&&rr(h),x=A("shared.placeholder.short"),m=i.useMemo(()=>dt.map(p=>p.key),[]),{order:w,reorder:C}=sa(m),v=i.useMemo(()=>{const p=new Map;for(const I of dt)p.set(I.key,I);return p},[]),R=i.useMemo(()=>w.map(p=>v.get(p)).filter(Boolean),[w,v]),E=Cr(Jt(Wt,{activationConstraint:{distance:6}}),Jt(Ft,{coordinateGetter:Jo})),j=i.useCallback(p=>{const{active:I,over:W}=p;!W||I.id===W.id||C(String(I.id),String(W.id))},[C]),[k,y]=i.useState(1),[T,L]=i.useState(0),[D,Y]=i.useState(()=>({loading:!1,error:null,data:null})),[H,ee]=i.useState(()=>or()),[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 I=Ot(p);if(!I||I===B)return;const W=new URLSearchParams(r?.search||"");W.set("period",I),y(1),o(`${r?.pathname||"/leaderboard"}?${W.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 Y(I=>({...I,loading:!0,error:null})),(async()=>{const I=await ar({userId:c?.id||null,period:B,limit:lt,offset:F});p&&Y({loading:!1,error:null,data:I})})().catch(I=>{p&&Y({loading:!1,error:la(I),data:null})}),()=>{p=!1}},[u,c?.id,F,T,g,B]);const _=D.data,te=_?.total_pages??null,q=_?.page??k,K=i.useMemo(()=>Zo(q,te),[q,te]),Ae=_?.from||null,ie=_?.to||null,ne=_?.generated_at||null,M=_?.me||null,pe=A("leaderboard.me_label"),re=A("leaderboard.anon_label"),be=A("leaderboard.period.week"),oe=A("leaderboard.period.month"),xe=A("leaderboard.period.total"),me=B==="month"?oe:B==="total"?xe:be,Oe=i.useMemo(()=>{const p=Array.isArray(_?.entries)?_.entries:[];return q!==1?p:ta({entries:p,me:M,meLabel:pe,limit:lt})},[q,_?.entries,M,pe]),at=async()=>{Ee(!0);try{ir(!0),ee(!0),await Kt(()=>wt(h));const p=await wt(h);p&&await Gt({accessToken:p}),L(I=>I+1)}catch(p){console.warn("[tokentracker] sync:",p)}finally{Ee(!1)}},Xe=async()=>{je(!0);try{const p=await wt(h);H&&p&&await Kt(()=>Promise.resolve(p)),p&&await Gt({accessToken:p}),L(I=>I+1)}catch(p){console.warn("[tokentracker] refresh:",p)}finally{je(!1)}},{canPrev:le,canNext:Ie}=ea({page:q,totalPages:te}),_e=Array.isArray(Oe)&&Oe.length!==0;let Se=null;D.loading?Se=d.jsx(ra,{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(No,{sensors:E,collisionDetection:Dr,modifiers:[Oo],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(xn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:A("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:A("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:A("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(Fo,{items:w,strategy:zo,children:R.map(p=>d.jsx(oa,{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(cr,{iconSrc:p.icon,label:A(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 I=!!p?.is_me,W=typeof p?.user_id=="string"?p.user_id:null,ve=Xn(p?.display_name),Te=ca(ve)?re:ve,ce=I?pe:Te;return!!W&&!I&&!!p?.is_public&&da(W,Me),I?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:x})}),d.jsx("td",{className:jt(!0),children:d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx(Vt,{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}),p?.github_url&&d.jsx(bn,{githubUrl:p.github_url})]})}),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:x})}),d.jsx("td",{className:jt(!1),children:d.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[d.jsx(Vt,{avatarUrl:p?.avatar_url,displayName:ce,seed:pn(p,ce)}),p?.github_url&&d.jsx(bn,{githubUrl:p.github_url}),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:A("leaderboard.empty")})});let Pe=null;return typeof te=="number"?Pe=K.map((p,I)=>p==null?d.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:A("leaderboard.pagination.ellipsis")},`ellipsis-${I}`):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:A("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:A("leaderboard.title")}),d.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[B==="total"?A("leaderboard.range.total"):Ae&&ie?A("leaderboard.range",{period:me,from:Ae,to:ie}):A("leaderboard.range_loading",{period:me}),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:A("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:Xe,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:xe},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:A("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:A("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:A("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:A("landing.v2.nav.github")})]})})]})}export{ha 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-D1VdJk4V.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-Dcg9r7R2.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),x=n.useCallback(()=>k(!1),[]);n.useEffect(()=>{if(!c)return;const t=l=>{h.current&&!h.current.contains(l.target)&&x()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[c,x]),n.useEffect(()=>{if(!c)return;const t=l=>{l.key==="Escape"&&x()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[c,x]);const i=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(i,{})}),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),x()},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(),[]),x=Y(),i=s&&!b,t=n.useMemo(()=>i&&(typeof r=="function"||typeof r=="string"||r&&typeof r=="object")?r:null,[r,i]),l=i?t:null,j=i&&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&&!x||!d||i&&!j)return;let o=!0;return w(f=>({...f,loading:!0,error:null})),(async()=>{const f=i?await G(l):null;if(!o)return;const $=await J({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:$})})().catch(f=>{if(o){if(f?.status===404){w({loading:!1,error:null,data:null});return}w({loading:!1,error:ie(f),data:null})}}),()=>{o=!1}},[i,j,h,l,x,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-_yO2TZgj.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-DIsoAppd.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),x=n.useCallback(()=>k(!1),[]);n.useEffect(()=>{if(!c)return;const t=l=>{h.current&&!h.current.contains(l.target)&&x()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[c,x]),n.useEffect(()=>{if(!c)return;const t=l=>{l.key==="Escape"&&x()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[c,x]);const i=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(i,{})}),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),x()},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(),[]),x=Y(),i=s&&!b,t=n.useMemo(()=>i&&(typeof r=="function"||typeof r=="string"||r&&typeof r=="object")?r:null,[r,i]),l=i?t:null,j=i&&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&&!x||!d||i&&!j)return;let o=!0;return w(f=>({...f,loading:!0,error:null})),(async()=>{const f=i?await G(l):null;if(!o)return;const $=await J({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:$})})().catch(f=>{if(o){if(f?.status===404){w({loading:!1,error:null,data:null});return}w({loading:!1,error:ie(f),data:null})}}),()=>{o=!1}},[i,j,h,l,x,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-D1VdJk4V.js";import{u as v}from"./use-usage-limits-BuWINUAm.js";import{u as k}from"./use-limits-display-prefs-CSj55sfK.js";import{C as h}from"./Card-D_q1XGfK.js";import{F as N}from"./FadeIn-ClpHby-T.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-_yO2TZgj.js";import{u as v}from"./use-usage-limits-Didh7hvY.js";import{u as k}from"./use-limits-display-prefs-CogaUGYH.js";import{C as h}from"./Card-D-EuRzLE.js";import{F as N}from"./FadeIn-Nqb2FeSu.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};
@@ -0,0 +1 @@
1
+ import{D as c}from"./main-_yO2TZgj.js";function i({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:n,children:c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function h({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:n,children:c.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function d({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:n,children:c.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function a({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:n,children:c.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function u({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:n,children:c.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function v({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:n,children:c.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function s({size:l=16,className:n=""}){return c.jsxs("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:n,children:[c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function x({size:l=16,className:n=""}){return c.jsx("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"currentColor",className:n,children:c.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}const f={CLAUDE:i,CODEX:h,CURSOR:d,GEMINI:a,GITHUB:x,KIMI:s,KIRO:u,OPENCODE:v};function j({provider:l,size:n=16,color:o,className:r=""}){const t=l?.toUpperCase?.()||"",e=f[t];return e?c.jsx(e,{size:n,className:r}):c.jsx("div",{className:"rounded-full shrink-0",style:{width:n*.5,height:n*.5,backgroundColor:o}})}export{j as P};
@@ -0,0 +1 @@
1
+ import{r as i,b as xe,f as me,aN as X,D as e,e as R,aO as be,aP as ye,aQ as fe,aR as Y,aS as pe,aT as ke,ab as ae,B as n,az as S,C as ve,aU as je,aV as Ne,aW as we,ai as Se,ah as Ce,aD as Le,aE as j,aX as Ie,aH as _e,aF as Ae,aY as I,aj as De,aZ as Te}from"./main-_yO2TZgj.js";import{L as Ee,a as J,u as Me}from"./use-limits-display-prefs-CogaUGYH.js";import{C as Pe}from"./Card-D-EuRzLE.js";import{D as Oe}from"./download-CXIEU-zL.js";const Ge=t=>!t.isLayoutDirty&&t.willUpdate(!1);function ee(){const t=new Set,a=new WeakMap,s=()=>t.forEach(Ge);return{add:o=>{t.add(o),a.set(o,o.addEventListener("willUpdate",s))},remove:o=>{t.delete(o);const c=a.get(o);c&&(c(),a.delete(o)),s()},dirty:s}}const Re=i.createContext(null);function He(){const t=i.useRef(!1);return xe(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Ue(){const t=He(),[a,s]=i.useState(0),o=i.useCallback(()=>{t.current&&s(a+1)},[a]);return[i.useCallback(()=>me.postRender(o),[o]),a]}const ne=t=>t===!0,Be=t=>ne(t===!0)||t==="id",Fe=({children:t,id:a,inherit:s=!0})=>{const o=i.useContext(X),c=i.useContext(Re),[x,u]=Ue(),b=i.useRef(null),g=o.id||c;b.current===null&&(Be(s)&&g&&(a=a?g+"-"+a:g),b.current={id:a,group:ne(s)&&o.group||ee()});const p=i.useMemo(()=>({...b.current,forceRender:x}),[u]);return e.jsx(X.Provider,{value:p,children:t})};const ze=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],$e=R("grip-vertical",ze);const Ve=[["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"}]],Ke=R("log-out",Ve);const We=[["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"}]],te=R("pencil",We);const Ze=[["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"}]],qe=R("refresh-cw",Ze);function se(){const[t,a]=i.useState(null),s=be()&&ye();i.useEffect(()=>{if(!s)return;const u=fe(b=>a(b));return Y(),u},[s]);const o=i.useCallback((u,b)=>{s&&(a(g=>g&&{...g,[u]:b}),pe(u,b))},[s]),c=i.useCallback(u=>{s&&ke(u)},[s]),x=i.useCallback(()=>{s&&Y()},[s]);return{available:s,settings:t,setSetting:o,runAction:c,refresh:x}}function Qe({checked:t,onChange:a,ariaLabel:s}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":s,onClick:a,className:S("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:S("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function Xe({prefs:t}){const{order:a,visibility:s,toggle:o,moveToward:c}=t,[x,u]=i.useState(null),[b,g]=i.useState(null),p=d=>l=>{u(d),l.dataTransfer.effectAllowed="move",l.dataTransfer.setData("text/plain",d)},y=d=>l=>{l.preventDefault(),l.dataTransfer.dropEffect="move",x&&x!==d&&b!==d&&(g(d),c(x,d))},D=()=>{u(null),g(null)},_=d=>{d.preventDefault(),u(null),g(null)};return e.jsx(Fe,{children:e.jsx("div",{className:"flex flex-col",children:a.map(d=>{const l=s[d]!==!1,m=x===d;return e.jsxs(ae.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:p(d),onDragOver:y(d),onDragEnd:D,onDrop:_,className:S("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",m&&"opacity-40"),style:{cursor:m?"grabbing":"grab"},children:[e.jsx($e,{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:Ee[d],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:J[d]}),e.jsx("div",{onMouseDown:C=>C.stopPropagation(),draggable:!1,children:e.jsx(Qe,{checked:l,onChange:()=>o(d),ariaLabel:`${n("limits.settings.toggle_visible")}: ${J[d]}`})})]},d)})})})}function Ye(t){if(!t||typeof t!="object")return"";const a=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},s=t.profile&&typeof t.profile=="object"?t.profile:{},o=a.full_name||a.name||s.name||a.user_name||a.preferred_username;return typeof o=="string"&&o.trim()?o.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function Je(t){return!t||typeof t!="object"?"":typeof t.email=="string"?t.email.trim():""}function w({checked:t,onChange:a,disabled:s,ariaLabel:o}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":o,onClick:a,disabled:s,className:S("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:S("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function N({label:t,hint:a,control:s}){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:s})]})}function G({title:t,subtitle:a,action:s,children:o}){return e.jsxs(Pe,{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})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]}),e.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:o})]})}const et=[{value:"light",labelKey:"settings.appearance.theme.light",Icon:je},{value:"dark",labelKey:"settings.appearance.theme.dark",Icon:Ne},{value:"system",labelKey:"settings.appearance.theme.system",Icon:we}];function tt({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:et.map(({value:s,labelKey:o,Icon:c})=>{const x=t===s;return e.jsxs("button",{type:"button",onClick:()=>a(s),className:S("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",x?"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":x,children:[e.jsx(c,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{children:n(o)})]},s)})})}function at(){const{enabled:t,signedIn:a,user:s,signOut:o,getAccessToken:c}=Se(),{openLoginModal:x}=Ce(),[u,b]=i.useState(()=>Le()),[g,p]=i.useState(!1),[y,D]=i.useState(!1),[_,d]=i.useState(!1),[l,m]=i.useState(!1),[C,V]=i.useState(null),[H,T]=i.useState(!1),[E,K]=i.useState(""),[M,P]=i.useState(!1),[A,U]=i.useState(""),[B,F]=i.useState(""),[z,L]=i.useState(!1),[$,f]=i.useState(null),ie=t&&a&&Te(),O=i.useMemo(()=>Ye(s),[s]),re=i.useMemo(()=>Je(s),[s]);i.useEffect(()=>{if(!a)return;let r=!0;return d(!0),(async()=>{try{const h=await j({getAccessToken:c});if(!r||!h)return;const k=await Ie({accessToken:h});if(!r)return;p(!!k?.enabled),D(!!k?.anonymous),k?.display_name&&V(k.display_name),P(!!k?.show_github_url),U(k?.github_url||"")}catch{}finally{r&&d(!1)}})(),()=>{r=!1}},[a,c]);const oe=i.useCallback(async()=>{const r=!u;if(_e(r),b(r),r)try{await Ae(()=>c())}catch(h){console.warn("[tokentracker] cloud sync:",h)}},[u,c]),ce=i.useCallback(async()=>{if(!l){m(!0);try{const r=await j({getAccessToken:c});if(!r)return;const h=!g;await I({accessToken:r,enabled:h}),p(h)}catch{}finally{m(!1)}}},[g,l,c]),le=i.useCallback(async()=>{if(!l){m(!0);try{const r=await j({getAccessToken:c});if(!r)return;const h=!y;await I({accessToken:r,anonymous:h}),D(h)}catch{}finally{m(!1)}}},[y,l,c]),W=i.useCallback(async()=>{if(l)return;const r=E.trim().slice(0,50);if(r){m(!0);try{const h=await j({getAccessToken:c});if(!h)return;await I({accessToken:h,display_name:r}),V(r),T(!1)}catch{}finally{m(!1)}}},[E,l,c]),de=i.useCallback(()=>{K(C||O),T(!0)},[C,O]),ue=i.useCallback(async()=>{if(!l){if(!M&&!A){L(!0),F(""),f(null);return}m(!0);try{const r=await j({getAccessToken:c});if(!r)return;const h=!M;await I({accessToken:r,show_github_url:h}),P(h)}catch{}finally{m(!1)}}},[M,A,l,c]),Z=i.useCallback(async()=>{if(l)return;const r=B.trim();if(!r){m(!0);try{const v=await j({getAccessToken:c});if(!v)return;await I({accessToken:v,github_url:null,show_github_url:!1}),U(""),P(!1),L(!1),f(null)}finally{m(!1)}return}const h=r.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),k=r.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),q=h?.[1]||k?.[1];if(!q){f(n("settings.account.githubUrlInvalid"));return}const Q=`https://github.com/${q}`;m(!0),f(null);try{const v=await j({getAccessToken:c});if(!v)return;const he=await I({accessToken:v,github_url:Q,show_github_url:!0});U(he?.github_url||Q),P(!0),L(!1)}catch(v){f(v?.message||n("settings.account.githubUrlInvalid"))}finally{m(!1)}},[B,l,c]),ge=i.useCallback(()=>{F(A||""),f(null),L(!0)},[A]);return t?a?e.jsxs(G,{title:n("settings.section.account"),subtitle:re||C||O,action:e.jsxs("button",{type:"button",onClick:()=>o(),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(Ke,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.account.signOut")]}),children:[ie&&e.jsx(N,{label:n("settings.account.cloudSync"),hint:n("settings.account.cloudSyncHint"),control:e.jsx(w,{checked:u,onChange:oe,ariaLabel:n("settings.account.cloudSync")})}),e.jsx(N,{label:n("settings.account.publicProfile"),hint:n("settings.account.publicProfileHint"),control:e.jsx(w,{checked:g,onChange:ce,disabled:_||l,ariaLabel:n("settings.account.publicProfile")})}),e.jsx(De,{initial:!1,children:g&&e.jsxs(ae.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:n("settings.account.displayName")}),!H&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:y?n("settings.account.displayNameAnonymousHint"):C||O}),H&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:E,onChange:r=>K(r.target.value),onKeyDown:r=>{r.key==="Enter"&&W(),r.key==="Escape"&&T(!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:n("settings.account.displayName")}),e.jsx("button",{type:"button",onClick:W,disabled:l||!E.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:l?n("settings.account.saving"):n("settings.account.save")}),e.jsx("button",{type:"button",onClick:()=>T(!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:n("settings.account.cancel")})]})]}),!H&&e.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:de,disabled:y,title:y?n("settings.account.displayNameDisabledWhileAnon"):void 0,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-40 disabled:cursor-not-allowed transition-colors",children:[e.jsx(te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.account.edit")]}),e.jsx(w,{checked:!y,onChange:le,disabled:_||l,ariaLabel:n("settings.account.displayName")})]})]})}),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:n("settings.account.githubUrl")}),!z&&e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate",children:A||n("settings.account.githubUrlHint")}),z&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:B,onChange:r=>{F(r.target.value),$&&f(null)},onKeyDown:r=>{r.key==="Enter"&&Z(),r.key==="Escape"&&(L(!1),f(null))},maxLength:100,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:n("settings.account.githubUrlPlaceholder")}),e.jsx("button",{type:"button",onClick:Z,disabled:l,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:l?n("settings.account.saving"):n("settings.account.save")}),e.jsx("button",{type:"button",onClick:()=>{L(!1),f(null)},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:n("settings.account.cancel")})]}),$&&e.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:$})]})]}),!z&&e.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:ge,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 transition-colors",children:[e.jsx(te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.account.edit")]}),e.jsx(w,{checked:M,onChange:ue,disabled:_||l,ariaLabel:n("settings.account.githubUrl")})]})]})})]},"public-profile-fields")})]}):e.jsx(G,{title:n("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:n("settings.account.signedOutHint")}),e.jsx("button",{type:"button",onClick:x,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:n("settings.account.signIn")})]})}):null}function nt(){const{available:t,settings:a,setSetting:s,runAction:o}=se();if(!t)return null;const c=!!a?.showStats,x=a?.animatedIcon!==!1,u=!!a?.launchAtLogin,b=a?.launchAtLoginSupported!==!1;a?.version;const g=a?.updateStatus||null,p=!!a?.updateBusy,y=!!a?.isSyncing;return e.jsxs(G,{title:n("settings.section.menubar"),children:[e.jsx(N,{label:n("settings.menubar.showStats"),hint:n("settings.menubar.showStatsHint"),control:e.jsx(w,{checked:c,onChange:()=>s("showStats",!c),ariaLabel:n("settings.menubar.showStats")})}),e.jsx(N,{label:n("settings.menubar.animatedIcon"),hint:n("settings.menubar.animatedIconHint"),control:e.jsx(w,{checked:x,onChange:()=>s("animatedIcon",!x),ariaLabel:n("settings.menubar.animatedIcon")})}),b&&e.jsx(N,{label:n("settings.menubar.launchAtLogin"),hint:n("settings.menubar.launchAtLoginHint"),control:e.jsx(w,{checked:u,onChange:()=>s("launchAtLogin",!u),ariaLabel:n("settings.menubar.launchAtLogin")})}),e.jsx(N,{label:n("settings.menubar.syncNow"),hint:n("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>o("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(qe,{className:S("h-3.5 w-3.5",y&&"animate-spin"),"aria-hidden":!0}),y?n("settings.menubar.syncing"):n("settings.menubar.syncNow")]})}),e.jsx(N,{label:n("settings.menubar.updates"),hint:g||void 0,control:e.jsxs("button",{type:"button",onClick:()=>o("checkForUpdates"),disabled:p,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(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.menubar.checkUpdates")]})})]})}function st(){const{available:t,settings:a,runAction:s}=se();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:()=>s("openAbout"),className:"hover:text-oai-gray-700 dark:hover:text-oai-gray-300 transition-colors underline-offset-2 hover:underline",children:"GitHub"})]})}function lt(){const{theme:t,setTheme:a}=ve(),s=Me();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:n("settings.page.title")}),e.jsx(tt,{theme:t,onSetTheme:a})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(nt,{}),e.jsx(at,{}),e.jsx(G,{title:n("settings.section.limits"),children:e.jsx(Xe,{prefs:s})})]}),e.jsx(st,{})]})})})}export{lt as SettingsPage};
@@ -1 +1 @@
1
- import{e as w,D as e,B as n,aT as b,aW as j,r as h,a_ as k,az as v}from"./main-D1VdJk4V.js";import{F as f,S as N,a as W}from"./FadeIn-ClpHby-T.js";import{D as S}from"./download-M8e1PJC-.js";const F=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],C=w("arrow-up-right",F),M=264,A=124,c="ui-rounded, -apple-system, system-ui",m=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],D={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function _(a){return a>=.9?"#E64D4D":a>=.7?"#D9A633":"#33B866"}function g({size:a="sm",children:r}){const s=a==="lg",i=s?560:264,l=s?32:22;return e.jsx("div",{className:v("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${M} / ${A}`,borderRadius:l},children:r})})}function z({size:a="sm"}){const r="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${r} L264,124 L0,124 Z`,i=`sparkArea-${a}`;return e.jsx(g,{size:a,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:r,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const u=(()=>{const s=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const t=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,d=Math.floor(Math.abs(t-Math.floor(t))*100);s.push({w:i,d:l,v:d})}return s})();function p(a,r){return a<18?r?"#262626":"#e5e5e5":a<38?"rgba(10, 132, 255, 0.28)":a<58?"rgba(10, 132, 255, 0.50)":a<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function E(){return e.jsx(g,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!0)},`d-${t.w}-${t.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!1)},`l-${t.w}-${t.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:c,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function $(){const a=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=m[d%m.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.name}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:c,children:t.value}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:x})]},t.name)})})})}function L(){const a=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=D[t.source],y=_(t.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.label}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:t.reset}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},t.label)})})})}function P(){const[a,r]=h.useState("loading");return h.useEffect(()=>{if(typeof window>"u")return;if(k()){r("native");return}const s=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(s)&&!/iphone|ipad/.test(s);r(i?"mac-web":"other")},[]),a}function O(){const a=P();return a==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):a==="native"?e.jsxs("button",{type:"button",onClick:()=>b("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[n("widgets.cta.open_gallery"),e.jsx(C,{className:"h-4 w-4","aria-hidden":"true"})]}):a==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(S,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(j,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.macos_only")]})}const H=[{id:"heatmap",Preview:E,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:$,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:L,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function G(){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-5xl px-4 sm:px-6",children:[e.jsx(f,{y:12,children:e.jsxs("header",{className:"mb-10 flex flex-col gap-6 sm:mb-14 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("widgets.page.title")}),e.jsx("p",{className:"max-w-xl text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("widgets.page.subtitle")})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(O,{})})]})}),e.jsx(f,{y:16,delay:.08,children:e.jsxs("section",{className:"mb-14 sm:mb-16","aria-label":n("widgets.hero.aria"),children:[e.jsx(z,{size:"lg"}),e.jsx("p",{className:"mt-5 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.hero.annotation")})]})}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-5 text-xs font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.section.more")}),e.jsx(N,{staggerDelay:.08,initialDelay:.12,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 sm:gap-5",children:H.map(({id:a,Preview:r,nameKey:s,descKey:i})=>e.jsx(W,{children:e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(r,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:n(s)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:n(i)})]})]})},a))})})]})]})})})}export{G as WidgetsPage};
1
+ import{e as w,D as e,B as n,aT as b,aW as j,r as h,a_ as k,az as v}from"./main-_yO2TZgj.js";import{F as f,S as N,a as W}from"./FadeIn-Nqb2FeSu.js";import{D as S}from"./download-CXIEU-zL.js";const F=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],C=w("arrow-up-right",F),M=264,A=124,c="ui-rounded, -apple-system, system-ui",m=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],D={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function _(a){return a>=.9?"#E64D4D":a>=.7?"#D9A633":"#33B866"}function g({size:a="sm",children:r}){const s=a==="lg",i=s?560:264,l=s?32:22;return e.jsx("div",{className:v("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${M} / ${A}`,borderRadius:l},children:r})})}function z({size:a="sm"}){const r="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${r} L264,124 L0,124 Z`,i=`sparkArea-${a}`;return e.jsx(g,{size:a,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:r,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const u=(()=>{const s=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const t=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,d=Math.floor(Math.abs(t-Math.floor(t))*100);s.push({w:i,d:l,v:d})}return s})();function p(a,r){return a<18?r?"#262626":"#e5e5e5":a<38?"rgba(10, 132, 255, 0.28)":a<58?"rgba(10, 132, 255, 0.50)":a<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function E(){return e.jsx(g,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!0)},`d-${t.w}-${t.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!1)},`l-${t.w}-${t.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:c,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function $(){const a=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=m[d%m.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.name}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:c,children:t.value}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:x})]},t.name)})})})}function L(){const a=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=D[t.source],y=_(t.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.label}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:t.reset}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},t.label)})})})}function P(){const[a,r]=h.useState("loading");return h.useEffect(()=>{if(typeof window>"u")return;if(k()){r("native");return}const s=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(s)&&!/iphone|ipad/.test(s);r(i?"mac-web":"other")},[]),a}function O(){const a=P();return a==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):a==="native"?e.jsxs("button",{type:"button",onClick:()=>b("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[n("widgets.cta.open_gallery"),e.jsx(C,{className:"h-4 w-4","aria-hidden":"true"})]}):a==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(S,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(j,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.macos_only")]})}const H=[{id:"heatmap",Preview:E,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:$,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:L,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function G(){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-5xl px-4 sm:px-6",children:[e.jsx(f,{y:12,children:e.jsxs("header",{className:"mb-10 flex flex-col gap-6 sm:mb-14 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("widgets.page.title")}),e.jsx("p",{className:"max-w-xl text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("widgets.page.subtitle")})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(O,{})})]})}),e.jsx(f,{y:16,delay:.08,children:e.jsxs("section",{className:"mb-14 sm:mb-16","aria-label":n("widgets.hero.aria"),children:[e.jsx(z,{size:"lg"}),e.jsx("p",{className:"mt-5 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.hero.annotation")})]})}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-5 text-xs font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.section.more")}),e.jsx(N,{staggerDelay:.08,initialDelay:.12,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 sm:gap-5",children:H.map(({id:a,Preview:r,nameKey:s,descKey:i})=>e.jsx(W,{children:e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(r,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:n(s)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:n(i)})]})]})},a))})})]})]})})})}export{G as WidgetsPage};
@@ -1 +1 @@
1
- import{e as o}from"./main-D1VdJk4V.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],d=o("download",a);export{d as D};
1
+ import{e as o}from"./main-_yO2TZgj.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],d=o("download",a);export{d as D};
@@ -1 +1 @@
1
- import{ad as l,D as n,az as i}from"./main-D1VdJk4V.js";function y(r){let e=0;const o=String(r??"");for(let a=0;a<o.length;a+=1)e=Math.imul(31,e)+o.charCodeAt(a)|0;return Math.abs(e)%360}function m(r){const e=String(r??"").trim();if(!e)return"?";const o=e.split(/\s+/).filter(Boolean);if(o.length>=2){const a=o[0][0]||"",t=o[1][0]||"";return`${a}${t}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const g={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function h({avatarUrl:r,displayName:e,seed:o,size:a="md",className:t}){const d=g[a]||g.md,b=y(o??e??""),s=typeof r=="string"?r.trim():"",[p,c]=l.useState(!1);return l.useEffect(()=>{c(!1)},[s]),s&&!p?n.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:i("rounded-full object-cover ring-1 ring-white/10",d,t)}):n.jsx("div",{className:i("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,t),style:{backgroundColor:`hsl(${b} 42% 34%)`},"aria-hidden":!0,children:m(e)})}const k=new Set(["/brand-logos/cursor.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function w({iconSrc:r,label:e}){return n.jsxs("span",{className:"inline-flex items-center gap-3",children:[r?n.jsx("img",{src:r,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${k.has(r)?"dark:invert":""}`}):null,n.jsx("span",{className:"whitespace-nowrap",children:e})]})}const x=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:null},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],f="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",_="sticky left-[72px] z-40 min-w-[140px] max-w-[min(180px,35vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",v="sticky left-[72px] z-40 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4";function K(r){return i("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function T(r){return i("sticky left-[72px] z-30 min-w-[140px] max-w-[min(180px,35vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function S(r){return i("sticky left-[72px] z-30 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap","bg-white dark:bg-oai-gray-950")}export{f as L,_ as a,x as b,T as c,w as d,h as e,S as f,v as g,K as l};
1
+ import{ad as l,D as n,az as i}from"./main-_yO2TZgj.js";function y(r){let e=0;const o=String(r??"");for(let a=0;a<o.length;a+=1)e=Math.imul(31,e)+o.charCodeAt(a)|0;return Math.abs(e)%360}function m(r){const e=String(r??"").trim();if(!e)return"?";const o=e.split(/\s+/).filter(Boolean);if(o.length>=2){const a=o[0][0]||"",t=o[1][0]||"";return`${a}${t}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const g={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function h({avatarUrl:r,displayName:e,seed:o,size:a="md",className:t}){const d=g[a]||g.md,b=y(o??e??""),s=typeof r=="string"?r.trim():"",[p,c]=l.useState(!1);return l.useEffect(()=>{c(!1)},[s]),s&&!p?n.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:i("rounded-full object-cover ring-1 ring-white/10",d,t)}):n.jsx("div",{className:i("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,t),style:{backgroundColor:`hsl(${b} 42% 34%)`},"aria-hidden":!0,children:m(e)})}const k=new Set(["/brand-logos/cursor.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function w({iconSrc:r,label:e}){return n.jsxs("span",{className:"inline-flex items-center gap-3",children:[r?n.jsx("img",{src:r,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${k.has(r)?"dark:invert":""}`}):null,n.jsx("span",{className:"whitespace-nowrap",children:e})]})}const x=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:null},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],f="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",_="sticky left-[72px] z-40 min-w-[200px] max-w-[min(260px,45vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",v="sticky left-[72px] z-40 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4";function K(r){return i("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function T(r){return i("sticky left-[72px] z-30 min-w-[200px] max-w-[min(260px,45vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function S(r){return i("sticky left-[72px] z-30 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap","bg-white dark:bg-oai-gray-950")}export{f as L,_ as a,x as b,T as c,w as d,h as e,S as f,v as g,K as l};