tokentracker-cli 0.5.63 → 0.5.65

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