@juliantanx/aiusage-widget 1.5.2 → 1.5.3

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.
@@ -0,0 +1 @@
1
+ var El=Object.defineProperty;var Al=(e,t,l)=>t in e?El(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;var ut=(e,t,l)=>Al(e,typeof t!="symbol"?t+"":t,l);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(o){if(o.ep)return;o.ep=!0;const s=l(o);fetch(o.href,s)}})();function fe(){}function Sl(e){return e()}function jt(){return Object.create(null)}function De(e){e.forEach(Sl)}function Xe(e){return typeof e=="function"}function Ge(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Pl(e){return Object.keys(e).length===0}function r(e,t){e.appendChild(t)}function A(e,t,l){e.insertBefore(t,l||null)}function R(e){e.parentNode&&e.parentNode.removeChild(e)}function ke(e,t){for(let l=0;l<e.length;l+=1)e[l]&&e[l].d(t)}function v(e){return document.createElement(e)}function Y(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function O(e){return document.createTextNode(e)}function L(){return O(" ")}function ve(){return O("")}function de(e,t,l,n){return e.addEventListener(t,l,n),()=>e.removeEventListener(t,l,n)}function i(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}function Bl(e){return Array.from(e.childNodes)}function U(e,t){t=""+t,e.data!==t&&(e.data=t)}function Se(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,"")}function z(e,t,l){e.classList.toggle(t,!!l)}function Nl(e,t,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:t,bubbles:l,cancelable:n})}let Ze;function Qe(e){Ze=e}function yt(){if(!Ze)throw new Error("Function called outside component initialization");return Ze}function Ml(e){yt().$$.on_mount.push(e)}function Il(e){yt().$$.after_update.push(e)}function Ol(){const e=yt();return(t,l,{cancelable:n=!1}={})=>{const o=e.$$.callbacks[t];if(o){const s=Nl(t,l,{cancelable:n});return o.slice().forEach(a=>{a.call(e,s)}),!s.defaultPrevented}return!0}}const ze=[],_t=[];let Ve=[];const qt=[],Ll=Promise.resolve();let mt=!1;function Dl(){mt||(mt=!0,Ll.then(jl))}function Rt(){return Dl(),Ll}function pt(e){Ve.push(e)}const ht=new Set;let We=0;function jl(){if(We!==0)return;const e=Ze;do{try{for(;We<ze.length;){const t=ze[We];We++,Qe(t),Hl(t.$$)}}catch(t){throw ze.length=0,We=0,t}for(Qe(null),ze.length=0,We=0;_t.length;)_t.pop()();for(let t=0;t<Ve.length;t+=1){const l=Ve[t];ht.has(l)||(ht.add(l),l())}Ve.length=0}while(ze.length);for(;qt.length;)qt.pop()();mt=!1,ht.clear(),Qe(e)}function Hl(e){if(e.fragment!==null){e.update(),De(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(pt)}}function Ul(e){const t=[],l=[];Ve.forEach(n=>e.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),Ve=t}const tt=new Set;let Fe;function vt(){Fe={r:0,c:[],p:Fe}}function bt(){Fe.r||De(Fe.c),Fe=Fe.p}function ne(e,t){e&&e.i&&(tt.delete(e),e.i(t))}function _e(e,t,l,n){if(e&&e.o){if(tt.has(e))return;tt.add(e),Fe.c.push(()=>{tt.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function te(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Ee(e){e&&e.c()}function Me(e,t,l){const{fragment:n,after_update:o}=e.$$;n&&n.m(t,l),pt(()=>{const s=e.$$.on_mount.map(Sl).filter(Xe);e.$$.on_destroy?e.$$.on_destroy.push(...s):De(s),e.$$.on_mount=[]}),o.forEach(pt)}function Le(e,t){const l=e.$$;l.fragment!==null&&(Ul(l.after_update),De(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Wl(e,t){e.$$.dirty[0]===-1&&(ze.push(e),Dl(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ke(e,t,l,n,o,s,a=null,h=[-1]){const c=Ze;Qe(e);const u=e.$$={fragment:null,ctx:[],props:s,update:fe,not_equal:o,bound:jt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:jt(),dirty:h,skip_bound:!1,root:t.target||c.$$.root};a&&a(u.root);let f=!1;if(u.ctx=l?l(e,t.props||{},(m,d,...g)=>{const y=g.length?g[0]:d;return u.ctx&&o(u.ctx[m],u.ctx[m]=y)&&(!u.skip_bound&&u.bound[m]&&u.bound[m](y),f&&Wl(e,m)),d}):[],u.update(),f=!0,De(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const m=Bl(t.target);u.fragment&&u.fragment.l(m),m.forEach(R)}else u.fragment&&u.fragment.c();t.intro&&ne(e.$$.fragment),Me(e,t.target,t.anchor),jl()}Qe(c)}class Ye{constructor(){ut(this,"$$");ut(this,"$$set")}$destroy(){Le(this,1),this.$destroy=fe}$on(t,l){if(!Xe(l))return fe;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const o=n.indexOf(l);o!==-1&&n.splice(o,1)}}$set(t){this.$$set&&!Pl(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const zl="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(zl);function Ft(e){let t,l;return{c(){t=v("span"),l=O(e[6]),i(t,"class","status svelte-1c4hcx6")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o&64&&U(l,n[6])},d(n){n&&R(t)}}}function Vl(e){let t,l,n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C,G,P,F,B,N,E,T,D,K,J,H,_=e[6]&&Ft(e);return{c(){t=v("div"),l=v("div"),n=Y("svg"),o=Y("rect"),s=Y("rect"),a=Y("rect"),h=Y("rect"),c=L(),u=v("span"),u.textContent="AIUsage",f=L(),_&&_.c(),m=L(),d=v("div"),g=v("button"),y=Y("svg"),I=Y("path"),V=Y("path"),X=Y("path"),C=Y("path"),G=L(),P=v("button"),F=Y("svg"),B=Y("circle"),N=Y("path"),E=L(),T=v("button"),D=Y("svg"),K=Y("path"),i(o,"width","64"),i(o,"height","64"),i(o,"rx","14"),i(o,"fill","oklch(0.55 0.12 175)"),i(s,"x","10"),i(s,"y","38"),i(s,"width","12"),i(s,"height","16"),i(s,"rx","3"),i(s,"fill","white"),i(a,"x","26"),i(a,"y","26"),i(a,"width","12"),i(a,"height","28"),i(a,"rx","3"),i(a,"fill","white"),i(h,"x","42"),i(h,"y","14"),i(h,"width","12"),i(h,"height","40"),i(h,"rx","3"),i(h,"fill","white"),i(n,"xmlns","http://www.w3.org/2000/svg"),i(n,"width","14"),i(n,"height","14"),i(n,"viewBox","0 0 64 64"),Se(n,"display","block"),Se(n,"border-radius","3px"),i(u,"class","logo svelte-1c4hcx6"),i(l,"class","brand svelte-1c4hcx6"),i(I,"d","M2.5 8a5.5 5.5 0 0 1 9.36-3.93"),i(V,"d","M13.5 8a5.5 5.5 0 0 1-9.36 3.93"),i(X,"d","M12 1.5v3h-3"),i(C,"d","M4 11.5v3h3"),i(y,"width","13"),i(y,"height","13"),i(y,"viewBox","0 0 16 16"),i(y,"fill","none"),i(y,"stroke","currentColor"),i(y,"stroke-width","1.8"),i(y,"stroke-linecap","round"),i(g,"class","icon-btn svelte-1c4hcx6"),i(g,"title",e[3]),i(g,"aria-label",e[3]),i(B,"cx","12"),i(B,"cy","12"),i(B,"r","3"),i(N,"d","M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"),i(F,"width","13"),i(F,"height","13"),i(F,"viewBox","0 0 24 24"),i(F,"fill","none"),i(F,"stroke","currentColor"),i(F,"stroke-width","2"),i(F,"stroke-linecap","round"),i(F,"stroke-linejoin","round"),i(P,"class","icon-btn svelte-1c4hcx6"),i(P,"title",e[4]),i(P,"aria-label",e[4]),i(K,"d","M2 2l8 8M10 2l-8 8"),i(D,"width","11"),i(D,"height","11"),i(D,"viewBox","0 0 12 12"),i(D,"fill","none"),i(D,"stroke","currentColor"),i(D,"stroke-width","1.8"),i(D,"stroke-linecap","round"),i(T,"class","icon-btn svelte-1c4hcx6"),i(T,"title",e[5]),i(T,"aria-label",e[5]),i(d,"class","actions svelte-1c4hcx6"),i(t,"class","header svelte-1c4hcx6")},m(q,w){A(q,t,w),r(t,l),r(l,n),r(n,o),r(n,s),r(n,a),r(n,h),r(l,c),r(l,u),r(l,f),_&&_.m(l,null),r(t,m),r(t,d),r(d,g),r(g,y),r(y,I),r(y,V),r(y,X),r(y,C),r(d,G),r(d,P),r(P,F),r(F,B),r(F,N),r(d,E),r(d,T),r(T,D),r(D,K),J||(H=[de(g,"click",function(){Xe(e[0])&&e[0].apply(this,arguments)}),de(P,"click",function(){Xe(e[2])&&e[2].apply(this,arguments)}),de(T,"click",function(){Xe(e[1])&&e[1].apply(this,arguments)})],J=!0)},p(q,[w]){e=q,e[6]?_?_.p(e,w):(_=Ft(e),_.c(),_.m(l,null)):_&&(_.d(1),_=null),w&8&&i(g,"title",e[3]),w&8&&i(g,"aria-label",e[3]),w&16&&i(P,"title",e[4]),w&16&&i(P,"aria-label",e[4]),w&32&&i(T,"title",e[5]),w&32&&i(T,"aria-label",e[5])},i:fe,o:fe,d(q){q&&R(t),_&&_.d(),J=!1,De(H)}}}function Gl(e,t,l){let{onRefresh:n}=t,{onClose:o}=t,{onToggleSettings:s}=t,{refreshLabel:a}=t,{settingsLabel:h}=t,{closeLabel:c}=t,{statusText:u=""}=t;return e.$$set=f=>{"onRefresh"in f&&l(0,n=f.onRefresh),"onClose"in f&&l(1,o=f.onClose),"onToggleSettings"in f&&l(2,s=f.onToggleSettings),"refreshLabel"in f&&l(3,a=f.refreshLabel),"settingsLabel"in f&&l(4,h=f.settingsLabel),"closeLabel"in f&&l(5,c=f.closeLabel),"statusText"in f&&l(6,u=f.statusText)},[n,o,s,a,h,c,u]}class Kl extends Ye{constructor(t){super(),Ke(this,t,Gl,Vl,Ge,{onRefresh:0,onClose:1,onToggleSettings:2,refreshLabel:3,settingsLabel:4,closeLabel:5,statusText:6})}}function Et(e){let t,l;return{c(){t=v("span"),l=O(e[2]),i(t,"class","sub svelte-1un0gu")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o&4&&U(l,n[2])},d(n){n&&R(t)}}}function Yl(e){let t,l,n,o,s,a,h,c,u=e[2]&&Et(e);return{c(){t=v("div"),l=v("span"),n=O(e[0]),o=L(),s=v("div"),a=v("span"),h=O(e[1]),c=L(),u&&u.c(),i(l,"class","label svelte-1un0gu"),i(a,"class","value svelte-1un0gu"),i(a,"title",e[1]),z(a,"accent",e[3]),i(s,"class","right svelte-1un0gu"),i(t,"class","row svelte-1un0gu")},m(f,m){A(f,t,m),r(t,l),r(l,n),r(t,o),r(t,s),r(s,a),r(a,h),r(s,c),u&&u.m(s,null)},p(f,[m]){m&1&&U(n,f[0]),m&2&&U(h,f[1]),m&2&&i(a,"title",f[1]),m&8&&z(a,"accent",f[3]),f[2]?u?u.p(f,m):(u=Et(f),u.c(),u.m(s,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(f){f&&R(t),u&&u.d()}}}function Xl(e,t,l){let{label:n}=t,{value:o}=t,{sub:s=""}=t,{accent:a=!1}=t;return e.$$set=h=>{"label"in h&&l(0,n=h.label),"value"in h&&l(1,o=h.value),"sub"in h&&l(2,s=h.sub),"accent"in h&&l(3,a=h.accent)},[n,o,s,a]}class dt extends Ye{constructor(t){super(),Ke(this,t,Xl,Yl,Ge,{label:0,value:1,sub:2,accent:3})}}function At(e,t,l){const n=e.slice();return n[7]=t[l],n}function Pt(e,t,l){const n=e.slice();return n[7]=t[l],n}function Ql(e){let t;return{c(){t=v("div"),t.textContent="No token data",i(t,"class","empty svelte-4y3y1j")},m(l,n){A(l,t,n)},p:fe,d(l){l&&R(t)}}}function Zl(e){let t,l,n,o=te(e[0]),s=[];for(let c=0;c<o.length;c+=1)s[c]=Bt(Pt(e,o,c));let a=te(e[0]),h=[];for(let c=0;c<a.length;c+=1)h[c]=Nt(At(e,a,c));return{c(){t=v("div");for(let c=0;c<s.length;c+=1)s[c].c();l=L(),n=v("div");for(let c=0;c<h.length;c+=1)h[c].c();i(t,"class","bar svelte-4y3y1j"),i(n,"class","legend svelte-4y3y1j")},m(c,u){A(c,t,u);for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(t,null);A(c,l,u),A(c,n,u);for(let f=0;f<h.length;f+=1)h[f]&&h[f].m(n,null)},p(c,u){if(u&3){o=te(c[0]);let f;for(f=0;f<o.length;f+=1){const m=Pt(c,o,f);s[f]?s[f].p(m,u):(s[f]=Bt(m),s[f].c(),s[f].m(t,null))}for(;f<s.length;f+=1)s[f].d(1);s.length=o.length}if(u&1){a=te(c[0]);let f;for(f=0;f<a.length;f+=1){const m=At(c,a,f);h[f]?h[f].p(m,u):(h[f]=Nt(m),h[f].c(),h[f].m(n,null))}for(;f<h.length;f+=1)h[f].d(1);h.length=a.length}},d(c){c&&(R(t),R(l),R(n)),ke(s,c),ke(h,c)}}}function Bt(e){let t,l;return{c(){t=v("div"),i(t,"class","segment svelte-4y3y1j"),Se(t,"width",e[7].value/e[1]*100+"%"),Se(t,"background",e[7].color),i(t,"title",l=e[7].label+": "+lt(e[7].value))},m(n,o){A(n,t,o)},p(n,o){o&3&&Se(t,"width",n[7].value/n[1]*100+"%"),o&1&&Se(t,"background",n[7].color),o&1&&l!==(l=n[7].label+": "+lt(n[7].value))&&i(t,"title",l)},d(n){n&&R(t)}}}function Nt(e){let t,l,n,o,s=e[7].label+"",a,h,c,u=lt(e[7].value)+"",f,m;return{c(){t=v("div"),l=v("span"),n=L(),o=v("span"),a=O(s),h=L(),c=v("span"),f=O(u),m=L(),i(l,"class","dot svelte-4y3y1j"),Se(l,"background",e[7].color),i(o,"class","legend-label svelte-4y3y1j"),i(c,"class","legend-value svelte-4y3y1j"),i(t,"class","legend-item svelte-4y3y1j")},m(d,g){A(d,t,g),r(t,l),r(t,n),r(t,o),r(o,a),r(t,h),r(t,c),r(c,f),r(t,m)},p(d,g){g&1&&Se(l,"background",d[7].color),g&1&&s!==(s=d[7].label+"")&&U(a,s),g&1&&u!==(u=lt(d[7].value)+"")&&U(f,u)},d(d){d&&R(t)}}}function Jl(e){let t;function l(s,a){return s[1]>0?Zl:Ql}let n=l(e),o=n(e);return{c(){t=v("div"),o.c(),i(t,"class","breakdown svelte-4y3y1j")},m(s,a){A(s,t,a),o.m(t,null)},p(s,[a]){n===(n=l(s))&&o?o.p(s,a):(o.d(1),o=n(s),o&&(o.c(),o.m(t,null)))},i:fe,o:fe,d(s){s&&R(t),o.d()}}}function lt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function $l(e,t,l){let n,o,{input:s=0}=t,{output:a=0}=t,{cacheRead:h=0}=t,{cacheWrite:c=0}=t,{thinking:u=0}=t;return e.$$set=f=>{"input"in f&&l(2,s=f.input),"output"in f&&l(3,a=f.output),"cacheRead"in f&&l(4,h=f.cacheRead),"cacheWrite"in f&&l(5,c=f.cacheWrite),"thinking"in f&&l(6,u=f.thinking)},e.$$.update=()=>{e.$$.dirty&124&&l(1,n=s+a+h+c+u),e.$$.dirty&124&&l(0,o=[{label:"Input",value:s,color:"var(--chart-input)"},{label:"Output",value:a,color:"var(--chart-output)"},{label:"Cache R",value:h,color:"var(--chart-cache-read)"},{label:"Cache W",value:c,color:"var(--chart-cache-write)"},{label:"Think",value:u,color:"var(--chart-thinking)"}].filter(f=>f.value>0))},[o,n,s,a,h,c,u]}class xl extends Ye{constructor(t){super(),Ke(this,t,$l,Jl,Ge,{input:2,output:3,cacheRead:4,cacheWrite:5,thinking:6})}}const It=[{code:"USD",label:"USD"},{code:"CNY",label:"CNY"}];function ql(e,t,l){return t==="USD"?e:l!=null&&l.rate&&Number.isFinite(l.rate)?e*l.rate:null}function kt(e,t,l,n,o=!1){const s=ql(e,t,n);return s===null?"--":Rl(s,t,l,o)}function Rl(e,t,l,n=!1){const o=n&&Math.abs(e)>=1e3?"compact":"standard",s=e>=100||o==="compact"?0:e>=1?2:e>0?3:0;return new Intl.NumberFormat(l,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",notation:o,minimumFractionDigits:s,maximumFractionDigits:s}).format(e)}function Ot(e,t,l){const n=e.slice();return n[33]=t[l],n}function gt(e){const t=e.slice(),l=t[0][t[6]];t[36]=l;const n=t[21]();t[37]=n;const o=t[23](t[6]);t[38]=o;const s=t[22](t[6]);return t[39]=s,t}function Ht(e,t,l){const n=e.slice();return n[40]=t[l],n}function Ut(e,t,l){const n=e.slice();return n[40]=t[l],n[44]=l,n}function Wt(e){let t,l,n,o,s,a=nl(e[40])+"",h,c;return{c(){t=Y("line"),s=Y("text"),h=O(a),i(t,"x1",pe),i(t,"y1",l=e[15](e[40])),i(t,"x2",n=pe+e[9]),i(t,"y2",o=e[15](e[40])),i(t,"stroke","var(--border)"),i(t,"stroke-width","0.5"),i(t,"stroke-dasharray",e[44]===0?"none":"2,2"),i(s,"x",pe-7),i(s,"y",c=e[15](e[40])+3),i(s,"text-anchor","end"),i(s,"class","y-label svelte-15p89al")},m(u,f){A(u,t,f),A(u,s,f),r(s,h)},p(u,f){f[0]&2048&&l!==(l=u[15](u[40]))&&i(t,"y1",l),f[0]&512&&n!==(n=pe+u[9])&&i(t,"x2",n),f[0]&2048&&o!==(o=u[15](u[40]))&&i(t,"y2",o),f[0]&2048&&a!==(a=nl(u[40])+"")&&U(h,a),f[0]&2048&&c!==(c=u[15](u[40])+3)&&i(s,"y",c)},d(u){u&&(R(t),R(s))}}}function zt(e){let t,l=te(e[10]),n=[];for(let o=0;o<l.length;o+=1)n[o]=Vt(Ht(e,l,o));return{c(){for(let o=0;o<n.length;o+=1)n[o].c();t=ve()},m(o,s){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(o,s);A(o,t,s)},p(o,s){if(s[0]&198144){l=te(o[10]);let a;for(a=0;a<l.length;a+=1){const h=Ht(o,l,a);n[a]?n[a].p(h,s):(n[a]=Vt(h),n[a].c(),n[a].m(t.parentNode,t))}for(;a<n.length;a+=1)n[a].d(1);n.length=l.length}},d(o){o&&R(t),ke(n,o)}}}function Vt(e){let t,l=e[17](e[40])+"",n,o,s;return{c(){t=Y("text"),n=O(l),i(t,"x",o=pe+e[9]+7),i(t,"y",s=e[16](e[40])+3),i(t,"text-anchor","start"),i(t,"class","y-label y-label-cost svelte-15p89al")},m(a,h){A(a,t,h),r(t,n)},p(a,h){h[0]&1024&&l!==(l=a[17](a[40])+"")&&U(n,l),h[0]&512&&o!==(o=pe+a[9]+7)&&i(t,"x",o),h[0]&1024&&s!==(s=a[16](a[40])+3)&&i(t,"y",s)},d(a){a&&R(t)}}}function Gt(e){let t;return{c(){t=Y("path"),i(t,"d",e[12]),i(t,"fill","url(#areaGrad)"),i(t,"clip-path","url(#chartClip)"),i(t,"class","area svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&4096&&i(t,"d",l[12])},d(l){l&&R(t)}}}function Kt(e){let t;return{c(){t=Y("path"),i(t,"d",e[13]),i(t,"fill","none"),i(t,"stroke","var(--chart-cache-read)"),i(t,"stroke-width","1.3"),i(t,"stroke-linecap","round"),i(t,"stroke-linejoin","round"),i(t,"clip-path","url(#chartClip)"),i(t,"class","line cost-line svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&8192&&i(t,"d",l[13])},d(l){l&&R(t)}}}function Yt(e){let t;return{c(){t=Y("path"),i(t,"d",e[4]),i(t,"fill","none"),i(t,"stroke","var(--accent)"),i(t,"stroke-width","1.8"),i(t,"stroke-linecap","round"),i(t,"stroke-linejoin","round"),i(t,"clip-path","url(#chartClip)"),i(t,"class","line svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&16&&i(t,"d",l[4])},d(l){l&&R(t)}}}function Xt(e){let t,l,n,o;return{c(){t=Y("line"),i(t,"x1",l=e[14](e[6])),i(t,"y1",be),i(t,"x2",n=e[14](e[6])),i(t,"y2",o=be+e[2]),i(t,"stroke","var(--text-muted)"),i(t,"stroke-width","0.5"),i(t,"stroke-dasharray","2,2")},m(s,a){A(s,t,a)},p(s,a){a[0]&64&&l!==(l=s[14](s[6]))&&i(t,"x1",l),a[0]&64&&n!==(n=s[14](s[6]))&&i(t,"x2",n),a[0]&4&&o!==(o=be+s[2])&&i(t,"y2",o)},d(s){s&&R(t)}}}function Qt(e){let t,l,n,o,s=e[1]&&Zt(e);return{c(){t=Y("circle"),s&&s.c(),o=ve(),i(t,"cx",l=e[14](e[6])),i(t,"cy",n=e[15](e[3][e[6]])),i(t,"r","4"),i(t,"fill","var(--bg)"),i(t,"stroke","var(--accent)"),i(t,"stroke-width","2")},m(a,h){A(a,t,h),s&&s.m(a,h),A(a,o,h)},p(a,h){h[0]&64&&l!==(l=a[14](a[6]))&&i(t,"cx",l),h[0]&72&&n!==(n=a[15](a[3][a[6]]))&&i(t,"cy",n),a[1]?s?s.p(a,h):(s=Zt(a),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},d(a){a&&(R(t),R(o)),s&&s.d(a)}}}function Zt(e){let t,l,n;return{c(){t=Y("circle"),i(t,"cx",l=e[14](e[6])),i(t,"cy",n=e[16](e[5][e[6]])),i(t,"r","3"),i(t,"fill","var(--bg)"),i(t,"stroke","var(--chart-cache-read)"),i(t,"stroke-width","1.5")},m(o,s){A(o,t,s)},p(o,s){s[0]&64&&l!==(l=o[14](o[6]))&&i(t,"cx",l),s[0]&96&&n!==(n=o[16](o[5][o[6]]))&&i(t,"cy",n)},d(o){o&&R(t)}}}function Jt(e){let t,l,n,o=e[18](e[36].date)+"",s,a,h=ll(e[36].tokens)+"",c,u,f,m=e[1]&&e[36].cost>0&&$t(e);return{c(){t=Y("foreignObject"),l=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n=document.createElementNS("http://www.w3.org/1999/xhtml","span"),s=O(o),a=document.createElementNS("http://www.w3.org/1999/xhtml","span"),c=O(h),m&&m.c(),i(n,"class","tooltip-date svelte-15p89al"),i(a,"class","tooltip-metric token-dot svelte-15p89al"),i(l,"class","tooltip svelte-15p89al"),i(l,"xmlns","http://www.w3.org/1999/xhtml"),z(l,"pointer-left",e[24](e[6])==="left"),z(l,"pointer-right",e[24](e[6])==="right"),i(t,"x",u=e[38]),i(t,"y",f=e[39]),i(t,"width",e[37]),i(t,"height","28"),i(t,"class","tooltip-fo svelte-15p89al")},m(d,g){A(d,t,g),r(t,l),r(l,n),r(n,s),r(l,a),r(a,c),m&&m.m(l,null)},p(d,g){g[0]&65&&o!==(o=d[18](d[36].date)+"")&&U(s,o),g[0]&65&&h!==(h=ll(d[36].tokens)+"")&&U(c,h),d[1]&&d[36].cost>0?m?m.p(d,g):(m=$t(d),m.c(),m.m(l,null)):m&&(m.d(1),m=null),g[0]&16777280&&z(l,"pointer-left",d[24](d[6])==="left"),g[0]&16777280&&z(l,"pointer-right",d[24](d[6])==="right"),g[0]&64&&u!==(u=d[38])&&i(t,"x",u),g[0]&64&&f!==(f=d[39])&&i(t,"y",f)},d(d){d&&R(t),m&&m.d()}}}function $t(e){let t,l=e[20](e[36].cost)+"",n;return{c(){t=document.createElementNS("http://www.w3.org/1999/xhtml","span"),n=O(l),i(t,"class","tooltip-metric cost-dot svelte-15p89al")},m(o,s){A(o,t,s),r(t,n)},p(o,s){s[0]&65&&l!==(l=o[20](o[36].cost)+"")&&U(n,l)},d(o){o&&R(t)}}}function xt(e){let t,l=e[19](e[0][e[33]].date)+"",n,o;return{c(){t=Y("text"),n=O(l),i(t,"x",o=e[14](e[33])),i(t,"y",nt-2),i(t,"text-anchor","middle"),i(t,"class","tick-label svelte-15p89al")},m(s,a){A(s,t,a),r(t,n)},p(s,a){a[0]&257&&l!==(l=s[19](s[0][s[33]].date)+"")&&U(n,l),a[0]&256&&o!==(o=s[14](s[33]))&&i(t,"x",o)},d(s){s&&R(t)}}}function el(e){let t,l=e[0][e[33]]&&xt(e);return{c(){l&&l.c(),t=ve()},m(n,o){l&&l.m(n,o),A(n,t,o)},p(n,o){n[0][n[33]]?l?l.p(n,o):(l=xt(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){n&&R(t),l&&l.d(n)}}}function en(e){let t,l,n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C,G=te(e[11]),P=[];for(let _=0;_<G.length;_+=1)P[_]=Wt(Ut(e,G,_));let F=e[1]&&zt(e),B=e[12]&&Gt(e),N=e[13]&&Kt(e),E=e[4]&&Yt(e),T=e[6]!==null&&Xt(e),D=e[6]!==null&&Qt(e),K=e[6]!==null&&e[0][e[6]]&&Jt(gt(e)),J=te(e[8]),H=[];for(let _=0;_<J.length;_+=1)H[_]=el(Ot(e,J,_));return{c(){t=v("div"),l=Y("svg"),n=Y("defs"),o=Y("linearGradient"),s=Y("stop"),a=Y("stop"),h=Y("clipPath"),c=Y("rect");for(let _=0;_<P.length;_+=1)P[_].c();u=ve(),F&&F.c(),f=ve(),B&&B.c(),m=ve(),N&&N.c(),d=ve(),E&&E.c(),g=ve(),T&&T.c(),y=ve(),D&&D.c(),I=ve(),K&&K.c(),V=ve();for(let _=0;_<H.length;_+=1)H[_].c();i(s,"offset","0%"),i(s,"stop-color","var(--accent)"),i(s,"stop-opacity","0.2"),i(a,"offset","100%"),i(a,"stop-color","var(--accent)"),i(a,"stop-opacity","0.02"),i(o,"id","areaGrad"),i(o,"x1","0"),i(o,"y1","0"),i(o,"x2","0"),i(o,"y2","1"),i(c,"x",pe),i(c,"y",be),i(c,"width",e[9]),i(c,"height",e[2]),i(h,"id","chartClip"),i(l,"viewBox","0 0 "+wt+" "+nt),i(l,"width","100%"),i(l,"height",nt),i(l,"class","chart-svg svelte-15p89al"),i(l,"role","img"),i(l,"aria-label","Token usage trend chart"),z(l,"mounted",e[7]),i(t,"class","chart-wrapper svelte-15p89al")},m(_,q){A(_,t,q),r(t,l),r(l,n),r(n,o),r(o,s),r(o,a),r(n,h),r(h,c);for(let w=0;w<P.length;w+=1)P[w]&&P[w].m(l,null);r(l,u),F&&F.m(l,null),r(l,f),B&&B.m(l,null),r(l,m),N&&N.m(l,null),r(l,d),E&&E.m(l,null),r(l,g),T&&T.m(l,null),r(l,y),D&&D.m(l,null),r(l,I),K&&K.m(l,null),r(l,V);for(let w=0;w<H.length;w+=1)H[w]&&H[w].m(l,null);X||(C=[de(l,"mousemove",e[25]),de(l,"mouseleave",e[26])],X=!0)},p(_,q){if(q[0]&512&&i(c,"width",_[9]),q[0]&4&&i(c,"height",_[2]),q[0]&35328){G=te(_[11]);let w;for(w=0;w<G.length;w+=1){const W=Ut(_,G,w);P[w]?P[w].p(W,q):(P[w]=Wt(W),P[w].c(),P[w].m(l,u))}for(;w<P.length;w+=1)P[w].d(1);P.length=G.length}if(_[1]?F?F.p(_,q):(F=zt(_),F.c(),F.m(l,f)):F&&(F.d(1),F=null),_[12]?B?B.p(_,q):(B=Gt(_),B.c(),B.m(l,m)):B&&(B.d(1),B=null),_[13]?N?N.p(_,q):(N=Kt(_),N.c(),N.m(l,d)):N&&(N.d(1),N=null),_[4]?E?E.p(_,q):(E=Yt(_),E.c(),E.m(l,g)):E&&(E.d(1),E=null),_[6]!==null?T?T.p(_,q):(T=Xt(_),T.c(),T.m(l,y)):T&&(T.d(1),T=null),_[6]!==null?D?D.p(_,q):(D=Qt(_),D.c(),D.m(l,I)):D&&(D.d(1),D=null),_[6]!==null&&_[0][_[6]]?K?K.p(gt(_),q):(K=Jt(gt(_)),K.c(),K.m(l,V)):K&&(K.d(1),K=null),q[0]&540929){J=te(_[8]);let w;for(w=0;w<J.length;w+=1){const W=Ot(_,J,w);H[w]?H[w].p(W,q):(H[w]=el(W),H[w].c(),H[w].m(l,null))}for(;w<H.length;w+=1)H[w].d(1);H.length=J.length}q[0]&128&&z(l,"mounted",_[7])},i:fe,o:fe,d(_){_&&R(t),ke(P,_),F&&F.d(),B&&B.d(),N&&N.d(),E&&E.d(),T&&T.d(),D&&D.d(),K&&K.d(),ke(H,_),X=!1,De(C)}}}const wt=352,nt=126,be=14,tn=18,pe=34,ln=36;function tl(e){if(e<=0)return 1;const t=Math.pow(10,Math.floor(Math.log10(e))),l=e/t;return(l<=1?1:l<=2?2:l<=5?5:10)*t}function ll(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function nl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e5?`${Math.round(e/1e3)}K`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function il(e){return new Date(e+"T00:00:00")}function nn(e,t,l){let n,o,s,a,h,c,u,f,m,d,g,y,{data:I=[]}=t,{showCost:V=!1}=t,{locale:X="en"}=t,{currency:C="USD"}=t,{exchangeRate:G=null}=t,P=null,F=!1;Ml(()=>{requestAnimationFrame(()=>{l(7,F=!0)})});function B(S){return pe+S/Math.max(I.length-1,1)*h}function N(S){return be+c-S/s*c}function E(S){return be+c-S/a*c}function T(S,le){if(S.length<2)return"";const k=S.length,M=S.map((j,ee)=>B(ee)),$=S.map(j=>le(j));if(k===2)return`M${M[0]},${$[0]}L${M[1]},${$[1]}`;const Q=[],x=[];for(let j=0;j<k-1;j++)Q.push(($[j+1]-$[j])/(M[j+1]-M[j]));x.push(Q[0]);for(let j=1;j<k-1;j++)Q[j-1]*Q[j]<=0?x.push(0):x.push((Q[j-1]+Q[j])/2);x.push(Q[k-2]);for(let j=0;j<k-1;j++)if(Math.abs(Q[j])<1e-12)x[j]=0,x[j+1]=0;else{const ee=x[j]/Q[j],ge=x[j+1]/Q[j],ye=ee*ee+ge*ge;if(ye>9){const Te=3/Math.sqrt(ye);x[j]=Te*ee*Q[j],x[j+1]=Te*ge*Q[j]}}let ce=`M${M[0].toFixed(1)},${$[0].toFixed(1)}`;for(let j=0;j<k-1;j++){const ee=(M[j+1]-M[j])/3,ge=M[j]+ee,ye=$[j]+x[j]*ee,Te=M[j+1]-ee,Je=$[j+1]-x[j+1]*ee;ce+=`C${ge.toFixed(1)},${ye.toFixed(1)},${Te.toFixed(1)},${Je.toFixed(1)},${M[j+1].toFixed(1)},${$[j+1].toFixed(1)}`}return ce}function D(S){return Rl(S,C,X,!0)}function K(S){const le=il(S);return new Intl.DateTimeFormat(X,{month:X==="zh"?"numeric":"short",day:"numeric"}).format(le)}function J(S){const le=il(S);return new Intl.DateTimeFormat(X,{month:"numeric",day:"numeric"}).format(le)}function H(S){return kt(S,C,X,G)}function _(){return V?156:116}function q(S){const le=N(n[S]??0)-30;return Math.min(Math.max(le,4),be+c-28)}function w(S){const k=_(),M=B(S),$=W(S)==="right"?M-k-8:M+8;return Math.min(Math.max($,pe),pe+h-k)}function W(S){return B(S)>pe+h/2?"right":"left"}function me(S){const k=S.currentTarget.getBoundingClientRect(),M=(S.clientX-k.left)/k.width*wt;let $=1/0,Q=0;for(let x=0;x<I.length;x++){const ce=Math.abs(B(x)-M);ce<$&&($=ce,Q=x)}l(6,P=Q)}function we(){l(6,P=null)}return e.$$set=S=>{"data"in S&&l(0,I=S.data),"showCost"in S&&l(1,V=S.showCost),"locale"in S&&l(27,X=S.locale),"currency"in S&&l(28,C=S.currency),"exchangeRate"in S&&l(29,G=S.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(3,n=I.map(S=>S.tokens)),e.$$.dirty[0]&805306369&&l(5,o=I.map(S=>ql(S.cost,C,G)??0)),e.$$.dirty[0]&8&&l(31,s=tl(Math.max(...n,1))),e.$$.dirty[0]&32&&l(30,a=tl(Math.max(...o,1))),e.$$.dirty[0]&8&&l(4,u=T(n,N)),e.$$.dirty[0]&34&&l(13,f=V?T(o,E):""),e.$$.dirty[0]&28&&l(12,m=u?`${u}L${B(n.length-1).toFixed(1)},${(be+c).toFixed(1)}L${B(0).toFixed(1)},${(be+c).toFixed(1)}Z`:""),e.$$.dirty[1]&1&&l(11,d=[0,s/2,s]),e.$$.dirty[0]&1073741824&&l(10,g=[0,a/2,a]),e.$$.dirty[0]&1&&l(8,y=I.length<=5?I.map((S,le)=>le):[0,Math.floor(I.length*.25),Math.floor(I.length*.5),Math.floor(I.length*.75),I.length-1])},l(9,h=wt-pe-ln),l(2,c=nt-be-tn),[I,V,c,n,u,o,P,F,y,h,g,d,m,f,B,N,E,D,K,J,H,_,q,w,W,me,we,X,C,G,a,s]}class on extends Ye{constructor(t){super(),Ke(this,t,nn,en,Ge,{data:0,showCost:1,locale:27,currency:28,exchangeRate:29},null,[-1,-1])}}const sn={today:"Today",lastNDays:e=>`Last ${e} days`,tokenBreakdown:"Token breakdown",tokenBreakdownToday:"Token breakdown (Today)",trend:"Trend",topModel:"Top Model",topTool:"Top Tool",sessions:"Sessions",settings:"Settings",theme:"Theme",timeRange:"Time range",refreshInterval:"Refresh interval",display:"Display",currency:"Currency",exchangeRate:"Exchange rate",exchangeRateUpdated:e=>`Updated ${e}`,exchangeRateUnavailable:"Exchange rate unavailable",language:"Language",showCost:"Show cost",tokenBreakdownToggle:"Token breakdown",activityChart:"Activity chart",syncedAt:e=>`Synced ${e}`,themeSystem:"System",themeLight:"Light",themeDark:"Dark",showPanel:"Show Panel",openDashboard:"Open Dashboard",refresh:"Refresh",quit:"Quit",close:"Close",installTitle:"Dashboard Setup",installPreparing:"Preparing...",installInstalling:"Installing @juliantanx/aiusage...",installLaunching:"Starting dashboard...",installDone:"Done! Opening...",installFailed:"Installation failed"},an={today:"今日",lastNDays:e=>`近 ${e} 天`,tokenBreakdown:"Token 分布",tokenBreakdownToday:"Token 分布 (今日)",trend:"趋势",topModel:"常用模型",topTool:"常用工具",sessions:"会话数",settings:"设置",theme:"主题",timeRange:"时间范围",refreshInterval:"刷新间隔",display:"显示",currency:"币种",exchangeRate:"汇率",exchangeRateUpdated:e=>`更新于 ${e}`,exchangeRateUnavailable:"汇率不可用",language:"语言",showCost:"显示费用",tokenBreakdownToggle:"Token 分布",activityChart:"活动图表",syncedAt:e=>`同步于 ${e}`,themeSystem:"跟随系统",themeLight:"浅色",themeDark:"深色",showPanel:"显示面板",openDashboard:"打开仪表盘",refresh:"刷新",quit:"退出",close:"关闭",installTitle:"仪表盘配置",installPreparing:"准备中...",installInstalling:"正在安装 @juliantanx/aiusage...",installLaunching:"正在启动仪表盘...",installDone:"完成!正在打开...",installFailed:"安装失败"},ol={en:sn,zh:an};function Fl(e){return ol[e]??ol.en}function sl(e,t,l){const n=e.slice();return n[22]=t[l],n}function al(e,t,l){const n=e.slice();return n[25]=t[l],n}function rl(e,t,l){const n=e.slice();return n[28]=t[l],n}function fl(e,t,l){const n=e.slice();return n[31]=t[l],n}function cl(e,t,l){const n=e.slice();return n[34]=t[l],n}function ul(e){let t,l,n;function o(){return e[14](e[34])}return{c(){t=v("button"),t.textContent=`${e[34].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].locale===e[34].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&2050&&z(t,"active",e[1].locale===e[34].value)},d(s){s&&R(t),l=!1,n()}}}function hl(e){let t,l,n;function o(){return e[15](e[31])}return{c(){t=v("button"),t.textContent=`${e[31].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].currency===e[31].code)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&2&&z(t,"active",e[1].currency===e[31].code)},d(s){s&&R(t),l=!1,n()}}}function dl(e){var d;let t,l,n=e[2].exchangeRate+"",o,s,a,h,c=e[7](),u,f=c&&rn(e),m=((d=e[0])==null?void 0:d.error)&&gl(e);return{c(){var g;t=v("div"),l=v("span"),o=O(n),s=L(),a=v("strong"),a.textContent=`${e[6]()}`,h=L(),f&&f.c(),u=L(),m&&m.c(),i(a,"class","svelte-198qnem"),i(t,"class","rate-info svelte-198qnem"),z(t,"error",!((g=e[0])!=null&&g.rate))},m(g,y){A(g,t,y),r(t,l),r(l,o),r(t,s),r(t,a),r(t,h),f&&f.m(t,null),r(t,u),m&&m.m(t,null)},p(g,y){var I,V;y[0]&4&&n!==(n=g[2].exchangeRate+"")&&U(o,n),c&&f.p(g,y),(I=g[0])!=null&&I.error?m?m.p(g,y):(m=gl(g),m.c(),m.m(t,null)):m&&(m.d(1),m=null),y[0]&1&&z(t,"error",!((V=g[0])!=null&&V.rate))},d(g){g&&R(t),f&&f.d(),m&&m.d()}}}function rn(e){let t;return{c(){t=v("small"),t.textContent=`${e[7]()}`,i(t,"class","svelte-198qnem")},m(l,n){A(l,t,n)},p:fe,d(l){l&&R(t)}}}function gl(e){let t,l=e[0].error+"",n;return{c(){t=v("small"),n=O(l),i(t,"class","svelte-198qnem")},m(o,s){A(o,t,s),r(t,n)},p(o,s){s[0]&1&&l!==(l=o[0].error+"")&&U(n,l)},d(o){o&&R(t)}}}function _l(e){let t,l=e[28].label+"",n,o,s,a;function h(){return e[16](e[28])}return{c(){t=v("button"),n=O(l),o=L(),i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].theme===e[28].value)},m(c,u){A(c,t,u),r(t,n),r(t,o),s||(a=de(t,"click",h),s=!0)},p(c,u){e=c,u[0]&8&&l!==(l=e[28].label+"")&&U(n,l),u[0]&10&&z(t,"active",e[1].theme===e[28].value)},d(c){c&&R(t),s=!1,a()}}}function ml(e){let t,l,n;function o(){return e[17](e[25])}return{c(){t=v("button"),t.textContent=`${e[25].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].rangeDays===e[25].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&1026&&z(t,"active",e[1].rangeDays===e[25].value)},d(s){s&&R(t),l=!1,n()}}}function pl(e){let t,l,n;function o(){return e[18](e[22])}return{c(){t=v("button"),t.textContent=`${e[22].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].refreshIntervalSec===e[22].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&514&&z(t,"active",e[1].refreshIntervalSec===e[22].value)},d(s){s&&R(t),l=!1,n()}}}function fn(e){let t,l,n,o=e[2].settings+"",s,a,h,c,u,f,m=e[2].language+"",d,g,y,I,V,X,C=e[2].currency+"",G,P,F,B,N,E,T,D=e[2].theme+"",K,J,H,_,q,w,W=e[2].timeRange+"",me,we,S,le,k,M,$=e[2].refreshInterval+"",Q,x,ce,j,ee,ge,ye=e[2].display+"",Te,Je,Ce,Ae,it,$e=e[2].showCost+"",ot,Tt,je,Ct,Pe,st,xe=e[2].tokenBreakdownToggle+"",at,St,qe,Mt,Be,rt,et=e[2].activityChart+"",ft,Lt,Re,ct,Dt,Ne=te(e[11]),ie=[];for(let b=0;b<Ne.length;b+=1)ie[b]=ul(cl(e,Ne,b));let Ie=te(It),oe=[];for(let b=0;b<Ie.length;b+=1)oe[b]=hl(fl(e,Ie,b));let ue=e[1].currency==="CNY"&&dl(e),Oe=te(e[3]),se=[];for(let b=0;b<Oe.length;b+=1)se[b]=_l(rl(e,Oe,b));let He=te(e[10]),ae=[];for(let b=0;b<He.length;b+=1)ae[b]=ml(al(e,He,b));let Ue=te(e[9]),re=[];for(let b=0;b<Ue.length;b+=1)re[b]=pl(sl(e,Ue,b));return{c(){t=v("div"),l=v("div"),n=v("span"),s=O(o),a=L(),h=v("button"),h.innerHTML='<svg width="11" height="11" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2 2l8 8M10 2l-8 8"></path></svg>',c=L(),u=v("div"),f=v("div"),d=O(m),g=L(),y=v("div");for(let b=0;b<ie.length;b+=1)ie[b].c();I=L(),V=v("div"),X=v("div"),G=O(C),P=L(),F=v("div");for(let b=0;b<oe.length;b+=1)oe[b].c();B=L(),ue&&ue.c(),N=L(),E=v("div"),T=v("div"),K=O(D),J=L(),H=v("div");for(let b=0;b<se.length;b+=1)se[b].c();_=L(),q=v("div"),w=v("div"),me=O(W),we=L(),S=v("div");for(let b=0;b<ae.length;b+=1)ae[b].c();le=L(),k=v("div"),M=v("div"),Q=O($),x=L(),ce=v("div");for(let b=0;b<re.length;b+=1)re[b].c();j=L(),ee=v("div"),ge=v("div"),Te=O(ye),Je=L(),Ce=v("div"),Ae=v("label"),it=v("span"),ot=O($e),Tt=L(),je=v("button"),je.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Ct=L(),Pe=v("label"),st=v("span"),at=O(xe),St=L(),qe=v("button"),qe.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Mt=L(),Be=v("label"),rt=v("span"),ft=O(et),Lt=L(),Re=v("button"),Re.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',i(n,"class","settings-title svelte-198qnem"),i(h,"class","back-btn svelte-198qnem"),i(l,"class","settings-header svelte-198qnem"),i(f,"class","section-label svelte-198qnem"),i(y,"class","button-group svelte-198qnem"),i(u,"class","section svelte-198qnem"),i(X,"class","section-label svelte-198qnem"),i(F,"class","button-group svelte-198qnem"),i(V,"class","section svelte-198qnem"),i(T,"class","section-label svelte-198qnem"),i(H,"class","button-group svelte-198qnem"),i(E,"class","section svelte-198qnem"),i(w,"class","section-label svelte-198qnem"),i(S,"class","button-group svelte-198qnem"),i(q,"class","section svelte-198qnem"),i(M,"class","section-label svelte-198qnem"),i(ce,"class","button-group svelte-198qnem"),i(k,"class","section svelte-198qnem"),i(ge,"class","section-label svelte-198qnem"),i(je,"class","toggle svelte-198qnem"),z(je,"on",e[1].showCost),i(Ae,"class","toggle-row svelte-198qnem"),i(qe,"class","toggle svelte-198qnem"),z(qe,"on",e[1].showTokenBreakdown),i(Pe,"class","toggle-row svelte-198qnem"),i(Re,"class","toggle svelte-198qnem"),z(Re,"on",e[1].showHeatmap),i(Be,"class","toggle-row svelte-198qnem"),i(Ce,"class","toggles svelte-198qnem"),i(ee,"class","section svelte-198qnem"),i(t,"class","settings svelte-198qnem")},m(b,Z){A(b,t,Z),r(t,l),r(l,n),r(n,s),r(l,a),r(l,h),r(t,c),r(t,u),r(u,f),r(f,d),r(u,g),r(u,y);for(let p=0;p<ie.length;p+=1)ie[p]&&ie[p].m(y,null);r(t,I),r(t,V),r(V,X),r(X,G),r(V,P),r(V,F);for(let p=0;p<oe.length;p+=1)oe[p]&&oe[p].m(F,null);r(V,B),ue&&ue.m(V,null),r(t,N),r(t,E),r(E,T),r(T,K),r(E,J),r(E,H);for(let p=0;p<se.length;p+=1)se[p]&&se[p].m(H,null);r(t,_),r(t,q),r(q,w),r(w,me),r(q,we),r(q,S);for(let p=0;p<ae.length;p+=1)ae[p]&&ae[p].m(S,null);r(t,le),r(t,k),r(k,M),r(M,Q),r(k,x),r(k,ce);for(let p=0;p<re.length;p+=1)re[p]&&re[p].m(ce,null);r(t,j),r(t,ee),r(ee,ge),r(ge,Te),r(ee,Je),r(ee,Ce),r(Ce,Ae),r(Ae,it),r(it,ot),r(Ae,Tt),r(Ae,je),r(Ce,Ct),r(Ce,Pe),r(Pe,st),r(st,at),r(Pe,St),r(Pe,qe),r(Ce,Mt),r(Ce,Be),r(Be,rt),r(rt,ft),r(Be,Lt),r(Be,Re),ct||(Dt=[de(h,"click",e[13]),de(je,"click",e[19]),de(qe,"click",e[20]),de(Re,"click",e[21])],ct=!0)},p(b,Z){if(Z[0]&4&&o!==(o=b[2].settings+"")&&U(s,o),Z[0]&4&&m!==(m=b[2].language+"")&&U(d,m),Z[0]&2082){Ne=te(b[11]);let p;for(p=0;p<Ne.length;p+=1){const he=cl(b,Ne,p);ie[p]?ie[p].p(he,Z):(ie[p]=ul(he),ie[p].c(),ie[p].m(y,null))}for(;p<ie.length;p+=1)ie[p].d(1);ie.length=Ne.length}if(Z[0]&4&&C!==(C=b[2].currency+"")&&U(G,C),Z[0]&34){Ie=te(It);let p;for(p=0;p<Ie.length;p+=1){const he=fl(b,Ie,p);oe[p]?oe[p].p(he,Z):(oe[p]=hl(he),oe[p].c(),oe[p].m(F,null))}for(;p<oe.length;p+=1)oe[p].d(1);oe.length=Ie.length}if(b[1].currency==="CNY"?ue?ue.p(b,Z):(ue=dl(b),ue.c(),ue.m(V,null)):ue&&(ue.d(1),ue=null),Z[0]&4&&D!==(D=b[2].theme+"")&&U(K,D),Z[0]&42){Oe=te(b[3]);let p;for(p=0;p<Oe.length;p+=1){const he=rl(b,Oe,p);se[p]?se[p].p(he,Z):(se[p]=_l(he),se[p].c(),se[p].m(H,null))}for(;p<se.length;p+=1)se[p].d(1);se.length=Oe.length}if(Z[0]&4&&W!==(W=b[2].timeRange+"")&&U(me,W),Z[0]&1058){He=te(b[10]);let p;for(p=0;p<He.length;p+=1){const he=al(b,He,p);ae[p]?ae[p].p(he,Z):(ae[p]=ml(he),ae[p].c(),ae[p].m(S,null))}for(;p<ae.length;p+=1)ae[p].d(1);ae.length=He.length}if(Z[0]&4&&$!==($=b[2].refreshInterval+"")&&U(Q,$),Z[0]&546){Ue=te(b[9]);let p;for(p=0;p<Ue.length;p+=1){const he=sl(b,Ue,p);re[p]?re[p].p(he,Z):(re[p]=pl(he),re[p].c(),re[p].m(ce,null))}for(;p<re.length;p+=1)re[p].d(1);re.length=Ue.length}Z[0]&4&&ye!==(ye=b[2].display+"")&&U(Te,ye),Z[0]&4&&$e!==($e=b[2].showCost+"")&&U(ot,$e),Z[0]&2&&z(je,"on",b[1].showCost),Z[0]&4&&xe!==(xe=b[2].tokenBreakdownToggle+"")&&U(at,xe),Z[0]&2&&z(qe,"on",b[1].showTokenBreakdown),Z[0]&4&&et!==(et=b[2].activityChart+"")&&U(ft,et),Z[0]&2&&z(Re,"on",b[1].showHeatmap)},i:fe,o:fe,d(b){b&&R(t),ke(ie,b),ke(oe,b),ue&&ue.d(),ke(se,b),ke(ae,b),ke(re,b),ct=!1,De(Dt)}}}function cn(e,t,l){let n,o,{settings:s}=t,{exchangeRate:a=null}=t;const h=Ol();let c={...s};function u(){h("save",c)}function f(){return a!=null&&a.rate?`1 USD = ${a.rate.toFixed(4)} CNY`:n.exchangeRateUnavailable}function m(){if(!(a!=null&&a.fetchedAt))return"";const T=new Date(a.fetchedAt),D=String(T.getHours()).padStart(2,"0"),K=String(T.getMinutes()).padStart(2,"0");return n.exchangeRateUpdated(`${D}:${K}`)}function d(T){typeof c[T]=="boolean"&&(l(1,c={...c,[T]:!c[T]}),u())}const g=[{label:"30s",value:30},{label:"1m",value:60},{label:"5m",value:300},{label:"10m",value:600}],y=[{label:"7d",value:7},{label:"14d",value:14},{label:"30d",value:30},{label:"60d",value:60},{label:"90d",value:90}],I=[{label:"English",value:"en"},{label:"中文",value:"zh"}],V=()=>h("close"),X=T=>{l(1,c={...c,locale:T.value}),u()},C=T=>{l(1,c={...c,currency:T.code}),u()},G=T=>{l(1,c={...c,theme:T.value}),u()},P=T=>{l(1,c={...c,rangeDays:T.value}),u()},F=T=>{l(1,c={...c,refreshIntervalSec:T.value}),u()},B=()=>d("showCost"),N=()=>d("showTokenBreakdown"),E=()=>d("showHeatmap");return e.$$set=T=>{"settings"in T&&l(12,s=T.settings),"exchangeRate"in T&&l(0,a=T.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&2&&l(2,n=Fl(c.locale??"en")),e.$$.dirty[0]&4&&l(3,o=[{label:n.themeSystem,value:"system"},{label:n.themeLight,value:"light"},{label:n.themeDark,value:"dark"}])},[a,c,n,o,h,u,f,m,d,g,y,I,s,V,X,C,G,P,F,B,N,E]}class un extends Ye{constructor(t){super(),Ke(this,t,cn,fn,Ge,{settings:12,exchangeRate:0},null,[-1,-1])}}function vl(e){let t,l,n,o,s,a=e[4].installTitle+"",h,c,u,f,m,d=e[10]&&bl(e);return{c(){t=v("div"),l=v("div"),n=v("div"),o=L(),s=v("div"),h=O(a),c=L(),u=v("div"),f=O(e[11]),m=L(),d&&d.c(),i(n,"class","install-spinner svelte-1sj3khb"),z(n,"hidden",e[3]==="done"||e[3]==="failed"),i(s,"class","install-title svelte-1sj3khb"),i(u,"class","install-message svelte-1sj3khb"),i(l,"class","install-content svelte-1sj3khb"),i(t,"class","install-overlay svelte-1sj3khb"),z(t,"failed",e[3]==="failed"),z(t,"done",e[3]==="done")},m(g,y){A(g,t,y),r(t,l),r(l,n),r(l,o),r(l,s),r(s,h),r(l,c),r(l,u),r(u,f),r(l,m),d&&d.m(l,null)},p(g,y){y[0]&8&&z(n,"hidden",g[3]==="done"||g[3]==="failed"),y[0]&16&&a!==(a=g[4].installTitle+"")&&U(h,a),y[0]&2048&&U(f,g[11]),g[10]?d?d.p(g,y):(d=bl(g),d.c(),d.m(l,null)):d&&(d.d(1),d=null),y[0]&8&&z(t,"failed",g[3]==="failed"),y[0]&8&&z(t,"done",g[3]==="done")},d(g){g&&R(t),d&&d.d()}}}function bl(e){let t,l;return{c(){t=v("div"),l=O(e[10]),i(t,"class","install-error svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&1024&&U(l,n[10])},d(n){n&&R(t)}}}function hn(e){var me,we,S,le;let t,l,n,o,s,a=e[4].today+"",h,c,u,f,m,d,g,y,I,V,X,C,G,P,F,B,N,E,T,D,K,J,H,_=((me=e[1])==null?void 0:me.showCost)&&kl(e),q=((we=e[1])==null?void 0:we.showCost)&&wl(e),w=((S=e[1])==null?void 0:S.showTokenBreakdown)&&e[0]&&yl(e),W=((le=e[1])==null?void 0:le.showHeatmap)&&e[0]&&Tl(e);return E=new dt({props:{label:e[4].topModel,value:e[17],sub:e[16]}}),D=new dt({props:{label:e[4].topTool,value:e[15],sub:e[14]}}),J=new dt({props:{label:e[4].sessions,value:e[13]}}),{c(){t=v("div"),l=v("div"),n=v("div"),o=v("div"),s=v("span"),h=O(a),c=L(),u=v("span"),f=O(e[22]),m=L(),_&&_.c(),d=L(),g=v("div"),y=v("span"),I=O(e[18]),V=L(),X=v("span"),C=O(e[21]),G=L(),q&&q.c(),P=L(),w&&w.c(),F=L(),W&&W.c(),B=L(),N=v("div"),Ee(E.$$.fragment),T=L(),Ee(D.$$.fragment),K=L(),Ee(J.$$.fragment),i(s,"class","metric-label svelte-1sj3khb"),i(u,"class","metric-value svelte-1sj3khb"),i(o,"class","metric svelte-1sj3khb"),i(y,"class","metric-label svelte-1sj3khb"),i(X,"class","metric-value svelte-1sj3khb"),i(g,"class","metric svelte-1sj3khb"),i(n,"class","metric-grid svelte-1sj3khb"),i(l,"class","section svelte-1sj3khb"),i(N,"class","section details svelte-1sj3khb"),i(t,"class","content svelte-1sj3khb")},m(k,M){A(k,t,M),r(t,l),r(l,n),r(n,o),r(o,s),r(s,h),r(o,c),r(o,u),r(u,f),r(o,m),_&&_.m(o,null),r(n,d),r(n,g),r(g,y),r(y,I),r(g,V),r(g,X),r(X,C),r(g,G),q&&q.m(g,null),r(t,P),w&&w.m(t,null),r(t,F),W&&W.m(t,null),r(t,B),r(t,N),Me(E,N,null),r(N,T),Me(D,N,null),r(N,K),Me(J,N,null),H=!0},p(k,M){var ce,j,ee,ge;(!H||M[0]&16)&&a!==(a=k[4].today+"")&&U(h,a),(!H||M[0]&4194304)&&U(f,k[22]),(ce=k[1])!=null&&ce.showCost?_?_.p(k,M):(_=kl(k),_.c(),_.m(o,null)):_&&(_.d(1),_=null),(!H||M[0]&262144)&&U(I,k[18]),(!H||M[0]&2097152)&&U(C,k[21]),(j=k[1])!=null&&j.showCost?q?q.p(k,M):(q=wl(k),q.c(),q.m(g,null)):q&&(q.d(1),q=null),(ee=k[1])!=null&&ee.showTokenBreakdown&&k[0]?w?(w.p(k,M),M[0]&3&&ne(w,1)):(w=yl(k),w.c(),ne(w,1),w.m(t,F)):w&&(vt(),_e(w,1,1,()=>{w=null}),bt()),(ge=k[1])!=null&&ge.showHeatmap&&k[0]?W?(W.p(k,M),M[0]&3&&ne(W,1)):(W=Tl(k),W.c(),ne(W,1),W.m(t,B)):W&&(vt(),_e(W,1,1,()=>{W=null}),bt());const $={};M[0]&16&&($.label=k[4].topModel),M[0]&131072&&($.value=k[17]),M[0]&65536&&($.sub=k[16]),E.$set($);const Q={};M[0]&16&&(Q.label=k[4].topTool),M[0]&32768&&(Q.value=k[15]),M[0]&16384&&(Q.sub=k[14]),D.$set(Q);const x={};M[0]&16&&(x.label=k[4].sessions),M[0]&8192&&(x.value=k[13]),J.$set(x)},i(k){H||(ne(w),ne(W),ne(E.$$.fragment,k),ne(D.$$.fragment,k),ne(J.$$.fragment,k),H=!0)},o(k){_e(w),_e(W),_e(E.$$.fragment,k),_e(D.$$.fragment,k),_e(J.$$.fragment,k),H=!1},d(k){k&&R(t),_&&_.d(),q&&q.d(),w&&w.d(),W&&W.d(),Le(E),Le(D),Le(J)}}}function dn(e){let t,l;return t=new un({props:{settings:e[1],exchangeRate:e[2]}}),t.$on("save",e[24]),t.$on("close",e[26]),{c(){Ee(t.$$.fragment)},m(n,o){Me(t,n,o),l=!0},p(n,o){const s={};o[0]&2&&(s.settings=n[1]),o[0]&4&&(s.exchangeRate=n[2]),t.$set(s)},i(n){l||(ne(t.$$.fragment,n),l=!0)},o(n){_e(t.$$.fragment,n),l=!1},d(n){Le(t,n)}}}function kl(e){let t,l;return{c(){t=v("span"),l=O(e[20]),i(t,"class","metric-cost svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&1048576&&U(l,n[20])},d(n){n&&R(t)}}}function wl(e){let t,l;return{c(){t=v("span"),l=O(e[19]),i(t,"class","metric-cost svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&524288&&U(l,n[19])},d(n){n&&R(t)}}}function yl(e){let t,l,n=e[4].tokenBreakdownToday+"",o,s,a,h;return a=new xl({props:{input:e[0].todayTokens.input,output:e[0].todayTokens.output,cacheRead:e[0].todayTokens.cacheRead,cacheWrite:e[0].todayTokens.cacheWrite,thinking:e[0].todayTokens.thinking}}),{c(){t=v("div"),l=v("div"),o=O(n),s=L(),Ee(a.$$.fragment),i(l,"class","section-title svelte-1sj3khb"),i(t,"class","section svelte-1sj3khb")},m(c,u){A(c,t,u),r(t,l),r(l,o),r(t,s),Me(a,t,null),h=!0},p(c,u){(!h||u[0]&16)&&n!==(n=c[4].tokenBreakdownToday+"")&&U(o,n);const f={};u[0]&1&&(f.input=c[0].todayTokens.input),u[0]&1&&(f.output=c[0].todayTokens.output),u[0]&1&&(f.cacheRead=c[0].todayTokens.cacheRead),u[0]&1&&(f.cacheWrite=c[0].todayTokens.cacheWrite),u[0]&1&&(f.thinking=c[0].todayTokens.thinking),a.$set(f)},i(c){h||(ne(a.$$.fragment,c),h=!0)},o(c){_e(a.$$.fragment,c),h=!1},d(c){c&&R(t),Le(a)}}}function Tl(e){var c;let t,l,n=e[4].trend+"",o,s,a,h;return a=new on({props:{data:e[0].dailyHistory,showCost:((c=e[1])==null?void 0:c.showCost)??!1,locale:e[5],currency:e[6],exchangeRate:e[2]}}),{c(){t=v("div"),l=v("div"),o=O(n),s=L(),Ee(a.$$.fragment),i(l,"class","section-title svelte-1sj3khb"),i(t,"class","section svelte-1sj3khb")},m(u,f){A(u,t,f),r(t,l),r(l,o),r(t,s),Me(a,t,null),h=!0},p(u,f){var d;(!h||f[0]&16)&&n!==(n=u[4].trend+"")&&U(o,n);const m={};f[0]&1&&(m.data=u[0].dailyHistory),f[0]&2&&(m.showCost=((d=u[1])==null?void 0:d.showCost)??!1),f[0]&32&&(m.locale=u[5]),f[0]&64&&(m.currency=u[6]),f[0]&4&&(m.exchangeRate=u[2]),a.$set(m)},i(u){h||(ne(a.$$.fragment,u),h=!0)},o(u){_e(a.$$.fragment,u),h=!1},d(u){u&&R(t),Le(a)}}}function gn(e){let t,l,n,o,s,a,h,c=e[3]&&vl(e);n=new Kl({props:{onRefresh:e[23],onClose:mn,onToggleSettings:e[25],refreshLabel:e[4].refresh,settingsLabel:e[4].settings,closeLabel:e[4].close,statusText:e[12]}});const u=[dn,hn],f=[];function m(d,g){return d[8]&&d[1]?0:1}return s=m(e),a=f[s]=u[s](e),{c(){t=v("div"),c&&c.c(),l=L(),Ee(n.$$.fragment),o=L(),a.c(),i(t,"class","panel svelte-1sj3khb"),z(t,"loading",e[7])},m(d,g){A(d,t,g),c&&c.m(t,null),r(t,l),Me(n,t,null),r(t,o),f[s].m(t,null),e[27](t),h=!0},p(d,g){d[3]?c?c.p(d,g):(c=vl(d),c.c(),c.m(t,l)):c&&(c.d(1),c=null);const y={};g[0]&256&&(y.onToggleSettings=d[25]),g[0]&16&&(y.refreshLabel=d[4].refresh),g[0]&16&&(y.settingsLabel=d[4].settings),g[0]&16&&(y.closeLabel=d[4].close),g[0]&4096&&(y.statusText=d[12]),n.$set(y);let I=s;s=m(d),s===I?f[s].p(d,g):(vt(),_e(f[I],1,1,()=>{f[I]=null}),bt(),a=f[s],a?a.p(d,g):(a=f[s]=u[s](d),a.c()),ne(a,1),a.m(t,null)),(!h||g[0]&128)&&z(t,"loading",d[7])},i(d){h||(ne(n.$$.fragment,d),ne(a),h=!0)},o(d){_e(n.$$.fragment,d),_e(a),h=!1},d(d){d&&R(t),c&&c.d(),Le(n),f[s].d(),e[27](null)}}}function _n(){return typeof navigator<"u"&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Cl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function mn(){window.widget.hideWindow()}function pn(e,t,l){let n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C=null,G=null,P=null,F=_n(),B=!0,N=!1,E,T=0,D=null,K=null;function J(k){return o.lastNDays(k)}function H(k){const M=new Date(k),$=String(M.getHours()).padStart(2,"0"),Q=String(M.getMinutes()).padStart(2,"0");return o.syncedAt(`${$}:${Q}`)}async function _(){l(7,B=!0),l(0,C=await window.widget.getData()),l(7,B=!1)}async function q(){l(1,G=await window.widget.getSettings())}async function w(){l(2,P=await window.widget.getExchangeRate())}async function W(k){l(1,G=await window.widget.saveSettings(k.detail)),_()}function me(){if(!E)return;const k=Math.ceil(E.getBoundingClientRect().height);k<=0||Math.abs(k-T)<2||(T=k,window.widget.resizeWindow(k))}Ml(()=>{_(),q(),w(),window.widget.onDataUpdate(M=>{l(0,C=M),l(7,B=!1)}),window.widget.onInstallStatus(M=>{l(3,D=M.phase),l(10,K=M.error??null),(M.phase==="done"||M.phase==="failed")&&setTimeout(()=>{l(3,D=null),l(10,K=null)},3e3)});const k=new ResizeObserver(()=>me());return k.observe(E),Rt().then(me),()=>k.disconnect()}),Il(()=>{Rt().then(me)});const we=()=>{l(8,N=!N)},S=()=>{l(8,N=!1)};function le(k){_t[k?"unshift":"push"](()=>{E=k,l(9,E)})}return e.$$.update=()=>{var k;e.$$.dirty[0]&2&&l(5,n=(G==null?void 0:G.locale)??F),e.$$.dirty[0]&32&&l(4,o=Fl(n)),e.$$.dirty[0]&2&&l(6,s=(G==null?void 0:G.currency)??"USD"),e.$$.dirty[0]&1&&l(22,a=C?Cl(C.todayTokens.total):"--"),e.$$.dirty[0]&1&&l(21,h=C?Cl(C.rangeTokens.total):"--"),e.$$.dirty[0]&101&&l(20,c=C?kt(C.todayCost,s,n,P):"--"),e.$$.dirty[0]&101&&l(19,u=C?kt(C.rangeCost,s,n,P):"--"),e.$$.dirty[0]&17&&l(18,f=C?J(C.rangeDays):o.lastNDays(30)),e.$$.dirty[0]&1&&l(17,m=C!=null&&C.topModel?C.topModel.name:"--"),e.$$.dirty[0]&1&&l(16,d=C!=null&&C.topModel?`${C.topModel.share}%`:""),e.$$.dirty[0]&1&&l(15,g=((k=C==null?void 0:C.topTool)==null?void 0:k.name)??"--"),e.$$.dirty[0]&1&&l(14,y=C!=null&&C.topTool?`${C.topTool.share}%`:""),e.$$.dirty[0]&1&&l(13,I=C?String(C.sessionCountToday):"--"),e.$$.dirty[0]&1&&l(12,V=C?H(C.lastUpdated):""),e.$$.dirty[0]&24&&l(11,X=D==="installing"?o.installInstalling:D==="launching"?o.installLaunching:D==="done"?o.installDone:D==="failed"?o.installFailed:o.installPreparing)},[C,G,P,D,o,n,s,B,N,E,K,X,V,I,y,g,d,m,f,u,c,h,a,_,W,we,S,le]}class vn extends Ye{constructor(t){super(),Ke(this,t,pn,gn,Ge,{},null,[-1,-1])}}new vn({target:document.getElementById("app")});
@@ -0,0 +1 @@
1
+ .header.svelte-1c4hcx6{display:flex;align-items:center;justify-content:space-between;padding:9px 14px 8px;-webkit-app-region:drag}.brand.svelte-1c4hcx6{display:flex;align-items:center;gap:6px}.logo.svelte-1c4hcx6{font-size:12px;font-weight:600;color:var(--text-primary)}.status.svelte-1c4hcx6{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:8px;line-height:1;color:var(--text-muted);font-variant-numeric:tabular-nums;margin-left:2px;transform:translateY(1px)}.actions.svelte-1c4hcx6{display:flex;gap:2px;-webkit-app-region:no-drag}.icon-btn.svelte-1c4hcx6{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .1s,color .1s;padding:0}.icon-btn.svelte-1c4hcx6:hover{background:var(--bg-hover);color:var(--text-primary)}.row.svelte-1un0gu{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:6px 0}.label.svelte-1un0gu{font-size:11px;font-weight:550;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted);flex:0 0 auto}.right.svelte-1un0gu{display:flex;align-items:baseline;justify-content:flex-end;gap:6px;min-width:0;flex:1 1 auto;text-align:right}.value.svelte-1un0gu{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:13px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;min-width:0;overflow-wrap:anywhere;word-break:break-word}.value.accent.svelte-1un0gu{color:var(--accent)}.sub.svelte-1un0gu{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;color:var(--text-muted);font-variant-numeric:tabular-nums;flex:0 0 auto}.breakdown.svelte-4y3y1j{padding:0}.bar.svelte-4y3y1j{display:flex;height:6px;border-radius:3px;overflow:hidden;gap:1px;margin-bottom:8px}.segment.svelte-4y3y1j{min-width:3px;border-radius:1px}.legend.svelte-4y3y1j{display:grid;grid-template-columns:1fr 1fr;gap:3px 12px}.legend-item.svelte-4y3y1j{display:flex;align-items:center;gap:4px}.dot.svelte-4y3y1j{width:6px;height:6px;border-radius:50%;flex-shrink:0}.legend-label.svelte-4y3y1j{font-size:10px;color:var(--text-muted);flex:1}.legend-value.svelte-4y3y1j{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:550;color:var(--text-secondary);font-variant-numeric:tabular-nums}.empty.svelte-4y3y1j{font-size:10px;color:var(--text-muted);text-align:center;padding:8px 0}.chart-wrapper.svelte-15p89al.svelte-15p89al{position:relative;-webkit-user-select:none;user-select:none}.chart-svg.svelte-15p89al.svelte-15p89al{display:block;cursor:crosshair;overflow:visible}.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:2000;stroke-dashoffset:2000;transition:stroke-dashoffset .8s cubic-bezier(.16,1,.3,1)}.chart-svg.mounted.svelte-15p89al .line.svelte-15p89al{stroke-dashoffset:0}.chart-svg.svelte-15p89al .cost-line.svelte-15p89al{opacity:.75}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:0;transition:opacity .6s cubic-bezier(.16,1,.3,1) .3s}.chart-svg.mounted.svelte-15p89al .area.svelte-15p89al{opacity:1}.tick-label.svelte-15p89al.svelte-15p89al{font-size:8px;fill:var(--text-muted);font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label.svelte-15p89al.svelte-15p89al{font-size:7px;fill:var(--text-muted);opacity:.72;font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label-cost.svelte-15p89al.svelte-15p89al{fill:var(--chart-cache-read);opacity:.78}.tooltip-fo.svelte-15p89al.svelte-15p89al{overflow:visible;pointer-events:none}.tooltip.svelte-15p89al.svelte-15p89al{display:flex;align-items:center;justify-content:center;gap:8px;height:24px;padding:0 8px;border:1px solid var(--border);border-radius:4px;background:var(--surface);box-shadow:0 4px 10px #0000001f;color:var(--text-primary);position:relative;box-sizing:border-box;font-family:Inter,-apple-system,sans-serif;pointer-events:none;white-space:nowrap}.tooltip.svelte-15p89al.svelte-15p89al:after{content:"";position:absolute;top:50%;width:6px;height:6px;border-right:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--surface)}.tooltip.pointer-left.svelte-15p89al.svelte-15p89al:after{left:-4px;transform:translateY(-50%) rotate(135deg)}.tooltip.pointer-right.svelte-15p89al.svelte-15p89al:after{right:-4px;transform:translateY(-50%) rotate(-45deg)}.tooltip-date.svelte-15p89al.svelte-15p89al,.tooltip-metric.svelte-15p89al.svelte-15p89al{position:relative;z-index:1}.tooltip-date.svelte-15p89al.svelte-15p89al{font-size:9px;color:var(--text-secondary);line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al{display:inline-flex;align-items:center;gap:4px;font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--accent);display:inline-block}.cost-dot.svelte-15p89al.svelte-15p89al{color:var(--chart-cache-read)}.cost-dot.svelte-15p89al.svelte-15p89al:before{background:var(--chart-cache-read)}@media (prefers-reduced-motion: reduce){.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:none;stroke-dashoffset:0;transition:none}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:1;transition:none}}.settings.svelte-198qnem.svelte-198qnem{padding:0 14px 14px}.settings-header.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;padding:8px 0 10px}.settings-title.svelte-198qnem.svelte-198qnem{font-size:12px;font-weight:600;color:var(--text-primary)}.back-btn.svelte-198qnem.svelte-198qnem{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center}.back-btn.svelte-198qnem.svelte-198qnem:hover{background:var(--bg-hover);color:var(--text-primary)}.section.svelte-198qnem.svelte-198qnem{margin-bottom:14px}.section-label.svelte-198qnem.svelte-198qnem{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:6px}.button-group.svelte-198qnem.svelte-198qnem{display:flex;gap:0;border-radius:6px;overflow:hidden;border:1px solid var(--border)}.rate-info.svelte-198qnem.svelte-198qnem{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;align-items:baseline;margin-top:6px;color:var(--text-muted);font-size:10px}.rate-info.svelte-198qnem strong.svelte-198qnem{justify-self:end;color:var(--text-secondary);font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;font-variant-numeric:tabular-nums}.rate-info.svelte-198qnem small.svelte-198qnem{grid-column:1 / -1;justify-self:end;font-size:9px;color:var(--text-muted)}.rate-info.error.svelte-198qnem strong.svelte-198qnem{color:var(--text-muted)}.option-btn.svelte-198qnem.svelte-198qnem{flex:1;padding:6px 0;border:none;background:transparent;color:var(--text-secondary);font-size:11px;font-weight:500;cursor:pointer;transition:background .1s,color .1s}.option-btn.svelte-198qnem.svelte-198qnem:not(:last-child){border-right:1px solid var(--border)}.option-btn.active.svelte-198qnem.svelte-198qnem{background:var(--accent);color:#fff}.option-btn.svelte-198qnem.svelte-198qnem:hover:not(.active){background:var(--bg-hover)}.toggles.svelte-198qnem.svelte-198qnem{display:flex;flex-direction:column;gap:8px}.toggle-row.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--text-secondary);cursor:pointer}.toggle.svelte-198qnem.svelte-198qnem{position:relative;width:32px;height:18px;border-radius:9px;border:none;background:var(--border);cursor:pointer;transition:background .15s;padding:0}.toggle.on.svelte-198qnem.svelte-198qnem{background:var(--accent)}.toggle-thumb.svelte-198qnem.svelte-198qnem{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s;display:block}.toggle.on.svelte-198qnem .toggle-thumb.svelte-198qnem{transform:translate(14px)}*{box-sizing:border-box;margin:0;padding:0}html,body{width:100%;height:100%;overflow:hidden}body{background:transparent;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--bg:oklch(.985 .004 175);--surface:oklch(.995 .003 175);--bg-hover:oklch(.955 .008 175);--border:oklch(.92 .008 175);--border-medium:oklch(.87 .01 175);--text-primary:oklch(.18 .012 175);--text-secondary:oklch(.42 .015 175);--text-muted:oklch(.6 .012 175);--accent:oklch(.55 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}@media (prefers-color-scheme: dark){:root{--bg:oklch(.18 .008 175);--surface:oklch(.22 .006 175);--bg-hover:oklch(.26 .01 175);--border:oklch(.3 .01 175);--border-medium:oklch(.35 .012 175);--text-primary:oklch(.94 .006 175);--text-secondary:oklch(.76 .01 175);--text-muted:oklch(.58 .008 175);--accent:oklch(.65 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}}.panel.svelte-1sj3khb.svelte-1sj3khb{position:relative;background:var(--bg);border-radius:10px;border:1px solid var(--border);overflow:hidden;width:100vw;box-shadow:var(--shadow);transition:opacity .15s}.panel.loading.svelte-1sj3khb.svelte-1sj3khb{opacity:.7}.content.svelte-1sj3khb.svelte-1sj3khb{padding:0 14px 8px}.section.svelte-1sj3khb.svelte-1sj3khb{padding:8px 0}.section.svelte-1sj3khb.svelte-1sj3khb:not(:last-child):not(.details){border-bottom:1px solid var(--border)}.section-title.svelte-1sj3khb.svelte-1sj3khb{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:8px}.metric-grid.svelte-1sj3khb.svelte-1sj3khb{display:grid;grid-template-columns:1fr 1fr;gap:12px}.metric.svelte-1sj3khb.svelte-1sj3khb{display:flex;flex-direction:column;gap:2px}.metric-label.svelte-1sj3khb.svelte-1sj3khb{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted)}.metric-value.svelte-1sj3khb.svelte-1sj3khb{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:20px;font-weight:700;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1.2}.metric-cost.svelte-1sj3khb.svelte-1sj3khb{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:11px;font-weight:550;color:var(--accent);font-variant-numeric:tabular-nums}.details.svelte-1sj3khb.svelte-1sj3khb{padding:4px 0}.install-overlay.svelte-1sj3khb.svelte-1sj3khb{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--bg);display:flex;align-items:center;justify-content:center;z-index:100;border-radius:10px}.install-content.svelte-1sj3khb.svelte-1sj3khb{display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px;text-align:center}.install-title.svelte-1sj3khb.svelte-1sj3khb{font-size:13px;font-weight:600;color:var(--text-primary)}.install-message.svelte-1sj3khb.svelte-1sj3khb{font-size:12px;color:var(--text-secondary)}.install-error.svelte-1sj3khb.svelte-1sj3khb{font-size:11px;color:#e74c3c;max-width:280px;word-break:break-word}.install-overlay.done.svelte-1sj3khb .install-message.svelte-1sj3khb{color:var(--accent)}.install-spinner.svelte-1sj3khb.svelte-1sj3khb{width:24px;height:24px;border:2.5px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:svelte-1sj3khb-spin .8s linear infinite}.install-spinner.hidden.svelte-1sj3khb.svelte-1sj3khb{display:none}@keyframes svelte-1sj3khb-spin{to{transform:rotate(360deg)}}
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'" />
7
7
  <title>AIUsage Widget</title>
8
- <script type="module" crossorigin src="./assets/index-BQ2IyMyH.js"></script>
9
- <link rel="stylesheet" crossorigin href="./assets/index-BHRV-uj7.css">
8
+ <script type="module" crossorigin src="./assets/index-CvTfd0Ry.js"></script>
9
+ <link rel="stylesheet" crossorigin href="./assets/index-DJPcmhcI.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juliantanx/aiusage-widget",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "private": false,
5
5
  "description": "System tray widget for AIUsage — view AI token usage from your system tray",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- .header.svelte-1c4hcx6{display:flex;align-items:center;justify-content:space-between;padding:9px 14px 8px;-webkit-app-region:drag}.brand.svelte-1c4hcx6{display:flex;align-items:center;gap:6px}.logo.svelte-1c4hcx6{font-size:12px;font-weight:600;color:var(--text-primary)}.status.svelte-1c4hcx6{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:8px;line-height:1;color:var(--text-muted);font-variant-numeric:tabular-nums;margin-left:2px;transform:translateY(1px)}.actions.svelte-1c4hcx6{display:flex;gap:2px;-webkit-app-region:no-drag}.icon-btn.svelte-1c4hcx6{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .1s,color .1s;padding:0}.icon-btn.svelte-1c4hcx6:hover{background:var(--bg-hover);color:var(--text-primary)}.row.svelte-36ktuv{display:flex;align-items:baseline;justify-content:space-between;padding:6px 0}.label.svelte-36ktuv{font-size:11px;font-weight:550;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted)}.right.svelte-36ktuv{display:flex;align-items:baseline;gap:6px}.value.svelte-36ktuv{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:13px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums}.value.accent.svelte-36ktuv{color:var(--accent)}.sub.svelte-36ktuv{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;color:var(--text-muted);font-variant-numeric:tabular-nums}.breakdown.svelte-4y3y1j{padding:0}.bar.svelte-4y3y1j{display:flex;height:6px;border-radius:3px;overflow:hidden;gap:1px;margin-bottom:8px}.segment.svelte-4y3y1j{min-width:3px;border-radius:1px}.legend.svelte-4y3y1j{display:grid;grid-template-columns:1fr 1fr;gap:3px 12px}.legend-item.svelte-4y3y1j{display:flex;align-items:center;gap:4px}.dot.svelte-4y3y1j{width:6px;height:6px;border-radius:50%;flex-shrink:0}.legend-label.svelte-4y3y1j{font-size:10px;color:var(--text-muted);flex:1}.legend-value.svelte-4y3y1j{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:550;color:var(--text-secondary);font-variant-numeric:tabular-nums}.empty.svelte-4y3y1j{font-size:10px;color:var(--text-muted);text-align:center;padding:8px 0}.chart-wrapper.svelte-15p89al.svelte-15p89al{position:relative;-webkit-user-select:none;user-select:none}.chart-svg.svelte-15p89al.svelte-15p89al{display:block;cursor:crosshair;overflow:visible}.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:2000;stroke-dashoffset:2000;transition:stroke-dashoffset .8s cubic-bezier(.16,1,.3,1)}.chart-svg.mounted.svelte-15p89al .line.svelte-15p89al{stroke-dashoffset:0}.chart-svg.svelte-15p89al .cost-line.svelte-15p89al{opacity:.75}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:0;transition:opacity .6s cubic-bezier(.16,1,.3,1) .3s}.chart-svg.mounted.svelte-15p89al .area.svelte-15p89al{opacity:1}.tick-label.svelte-15p89al.svelte-15p89al{font-size:8px;fill:var(--text-muted);font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label.svelte-15p89al.svelte-15p89al{font-size:7px;fill:var(--text-muted);opacity:.72;font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label-cost.svelte-15p89al.svelte-15p89al{fill:var(--chart-cache-read);opacity:.78}.tooltip-fo.svelte-15p89al.svelte-15p89al{overflow:visible;pointer-events:none}.tooltip.svelte-15p89al.svelte-15p89al{display:flex;align-items:center;justify-content:center;gap:8px;height:24px;padding:0 8px;border:1px solid var(--border);border-radius:4px;background:var(--surface);box-shadow:0 4px 10px #0000001f;color:var(--text-primary);position:relative;box-sizing:border-box;font-family:Inter,-apple-system,sans-serif;pointer-events:none;white-space:nowrap}.tooltip.svelte-15p89al.svelte-15p89al:after{content:"";position:absolute;top:50%;width:6px;height:6px;border-right:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--surface)}.tooltip.pointer-left.svelte-15p89al.svelte-15p89al:after{left:-4px;transform:translateY(-50%) rotate(135deg)}.tooltip.pointer-right.svelte-15p89al.svelte-15p89al:after{right:-4px;transform:translateY(-50%) rotate(-45deg)}.tooltip-date.svelte-15p89al.svelte-15p89al,.tooltip-metric.svelte-15p89al.svelte-15p89al{position:relative;z-index:1}.tooltip-date.svelte-15p89al.svelte-15p89al{font-size:9px;color:var(--text-secondary);line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al{display:inline-flex;align-items:center;gap:4px;font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--accent);display:inline-block}.cost-dot.svelte-15p89al.svelte-15p89al{color:var(--chart-cache-read)}.cost-dot.svelte-15p89al.svelte-15p89al:before{background:var(--chart-cache-read)}@media (prefers-reduced-motion: reduce){.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:none;stroke-dashoffset:0;transition:none}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:1;transition:none}}.settings.svelte-198qnem.svelte-198qnem{padding:0 14px 14px}.settings-header.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;padding:8px 0 10px}.settings-title.svelte-198qnem.svelte-198qnem{font-size:12px;font-weight:600;color:var(--text-primary)}.back-btn.svelte-198qnem.svelte-198qnem{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center}.back-btn.svelte-198qnem.svelte-198qnem:hover{background:var(--bg-hover);color:var(--text-primary)}.section.svelte-198qnem.svelte-198qnem{margin-bottom:14px}.section-label.svelte-198qnem.svelte-198qnem{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:6px}.button-group.svelte-198qnem.svelte-198qnem{display:flex;gap:0;border-radius:6px;overflow:hidden;border:1px solid var(--border)}.rate-info.svelte-198qnem.svelte-198qnem{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;align-items:baseline;margin-top:6px;color:var(--text-muted);font-size:10px}.rate-info.svelte-198qnem strong.svelte-198qnem{justify-self:end;color:var(--text-secondary);font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;font-variant-numeric:tabular-nums}.rate-info.svelte-198qnem small.svelte-198qnem{grid-column:1 / -1;justify-self:end;font-size:9px;color:var(--text-muted)}.rate-info.error.svelte-198qnem strong.svelte-198qnem{color:var(--text-muted)}.option-btn.svelte-198qnem.svelte-198qnem{flex:1;padding:6px 0;border:none;background:transparent;color:var(--text-secondary);font-size:11px;font-weight:500;cursor:pointer;transition:background .1s,color .1s}.option-btn.svelte-198qnem.svelte-198qnem:not(:last-child){border-right:1px solid var(--border)}.option-btn.active.svelte-198qnem.svelte-198qnem{background:var(--accent);color:#fff}.option-btn.svelte-198qnem.svelte-198qnem:hover:not(.active){background:var(--bg-hover)}.toggles.svelte-198qnem.svelte-198qnem{display:flex;flex-direction:column;gap:8px}.toggle-row.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--text-secondary);cursor:pointer}.toggle.svelte-198qnem.svelte-198qnem{position:relative;width:32px;height:18px;border-radius:9px;border:none;background:var(--border);cursor:pointer;transition:background .15s;padding:0}.toggle.on.svelte-198qnem.svelte-198qnem{background:var(--accent)}.toggle-thumb.svelte-198qnem.svelte-198qnem{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s;display:block}.toggle.on.svelte-198qnem .toggle-thumb.svelte-198qnem{transform:translate(14px)}*{box-sizing:border-box;margin:0;padding:0}html,body{width:100%;height:100%;overflow:hidden}body{background:transparent;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--bg:oklch(.985 .004 175);--surface:oklch(.995 .003 175);--bg-hover:oklch(.955 .008 175);--border:oklch(.92 .008 175);--border-medium:oklch(.87 .01 175);--text-primary:oklch(.18 .012 175);--text-secondary:oklch(.42 .015 175);--text-muted:oklch(.6 .012 175);--accent:oklch(.55 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}@media (prefers-color-scheme: dark){:root{--bg:oklch(.18 .008 175);--surface:oklch(.22 .006 175);--bg-hover:oklch(.26 .01 175);--border:oklch(.3 .01 175);--border-medium:oklch(.35 .012 175);--text-primary:oklch(.94 .006 175);--text-secondary:oklch(.76 .01 175);--text-muted:oklch(.58 .008 175);--accent:oklch(.65 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}}.panel.svelte-1sj3khb.svelte-1sj3khb{position:relative;background:var(--bg);border-radius:10px;border:1px solid var(--border);overflow:hidden;width:100vw;box-shadow:var(--shadow);transition:opacity .15s}.panel.loading.svelte-1sj3khb.svelte-1sj3khb{opacity:.7}.content.svelte-1sj3khb.svelte-1sj3khb{padding:0 14px 8px}.section.svelte-1sj3khb.svelte-1sj3khb{padding:8px 0}.section.svelte-1sj3khb.svelte-1sj3khb:not(:last-child):not(.details){border-bottom:1px solid var(--border)}.section-title.svelte-1sj3khb.svelte-1sj3khb{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:8px}.metric-grid.svelte-1sj3khb.svelte-1sj3khb{display:grid;grid-template-columns:1fr 1fr;gap:12px}.metric.svelte-1sj3khb.svelte-1sj3khb{display:flex;flex-direction:column;gap:2px}.metric-label.svelte-1sj3khb.svelte-1sj3khb{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted)}.metric-value.svelte-1sj3khb.svelte-1sj3khb{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:20px;font-weight:700;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1.2}.metric-cost.svelte-1sj3khb.svelte-1sj3khb{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:11px;font-weight:550;color:var(--accent);font-variant-numeric:tabular-nums}.details.svelte-1sj3khb.svelte-1sj3khb{padding:4px 0}.install-overlay.svelte-1sj3khb.svelte-1sj3khb{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--bg);display:flex;align-items:center;justify-content:center;z-index:100;border-radius:10px}.install-content.svelte-1sj3khb.svelte-1sj3khb{display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px;text-align:center}.install-title.svelte-1sj3khb.svelte-1sj3khb{font-size:13px;font-weight:600;color:var(--text-primary)}.install-message.svelte-1sj3khb.svelte-1sj3khb{font-size:12px;color:var(--text-secondary)}.install-error.svelte-1sj3khb.svelte-1sj3khb{font-size:11px;color:#e74c3c;max-width:280px;word-break:break-word}.install-overlay.done.svelte-1sj3khb .install-message.svelte-1sj3khb{color:var(--accent)}.install-spinner.svelte-1sj3khb.svelte-1sj3khb{width:24px;height:24px;border:2.5px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:svelte-1sj3khb-spin .8s linear infinite}.install-spinner.hidden.svelte-1sj3khb.svelte-1sj3khb{display:none}@keyframes svelte-1sj3khb-spin{to{transform:rotate(360deg)}}
@@ -1 +0,0 @@
1
- var El=Object.defineProperty;var Al=(e,t,l)=>t in e?El(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;var ut=(e,t,l)=>Al(e,typeof t!="symbol"?t+"":t,l);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(o){if(o.ep)return;o.ep=!0;const s=l(o);fetch(o.href,s)}})();function fe(){}function Sl(e){return e()}function qt(){return Object.create(null)}function De(e){e.forEach(Sl)}function Xe(e){return typeof e=="function"}function Ge(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Pl(e){return Object.keys(e).length===0}function r(e,t){e.appendChild(t)}function A(e,t,l){e.insertBefore(t,l||null)}function R(e){e.parentNode&&e.parentNode.removeChild(e)}function ke(e,t){for(let l=0;l<e.length;l+=1)e[l]&&e[l].d(t)}function v(e){return document.createElement(e)}function Y(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function O(e){return document.createTextNode(e)}function L(){return O(" ")}function ve(){return O("")}function de(e,t,l,n){return e.addEventListener(t,l,n),()=>e.removeEventListener(t,l,n)}function i(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}function Bl(e){return Array.from(e.childNodes)}function U(e,t){t=""+t,e.data!==t&&(e.data=t)}function Se(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,"")}function z(e,t,l){e.classList.toggle(t,!!l)}function Nl(e,t,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:t,bubbles:l,cancelable:n})}let Ze;function Qe(e){Ze=e}function yt(){if(!Ze)throw new Error("Function called outside component initialization");return Ze}function Ml(e){yt().$$.on_mount.push(e)}function Il(e){yt().$$.after_update.push(e)}function Ol(){const e=yt();return(t,l,{cancelable:n=!1}={})=>{const o=e.$$.callbacks[t];if(o){const s=Nl(t,l,{cancelable:n});return o.slice().forEach(a=>{a.call(e,s)}),!s.defaultPrevented}return!0}}const ze=[],_t=[];let Ve=[];const jt=[],Ll=Promise.resolve();let mt=!1;function Dl(){mt||(mt=!0,Ll.then(ql))}function Rt(){return Dl(),Ll}function pt(e){Ve.push(e)}const ht=new Set;let We=0;function ql(){if(We!==0)return;const e=Ze;do{try{for(;We<ze.length;){const t=ze[We];We++,Qe(t),Hl(t.$$)}}catch(t){throw ze.length=0,We=0,t}for(Qe(null),ze.length=0,We=0;_t.length;)_t.pop()();for(let t=0;t<Ve.length;t+=1){const l=Ve[t];ht.has(l)||(ht.add(l),l())}Ve.length=0}while(ze.length);for(;jt.length;)jt.pop()();mt=!1,ht.clear(),Qe(e)}function Hl(e){if(e.fragment!==null){e.update(),De(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(pt)}}function Ul(e){const t=[],l=[];Ve.forEach(n=>e.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),Ve=t}const tt=new Set;let Fe;function vt(){Fe={r:0,c:[],p:Fe}}function bt(){Fe.r||De(Fe.c),Fe=Fe.p}function ne(e,t){e&&e.i&&(tt.delete(e),e.i(t))}function _e(e,t,l,n){if(e&&e.o){if(tt.has(e))return;tt.add(e),Fe.c.push(()=>{tt.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function te(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Ee(e){e&&e.c()}function Me(e,t,l){const{fragment:n,after_update:o}=e.$$;n&&n.m(t,l),pt(()=>{const s=e.$$.on_mount.map(Sl).filter(Xe);e.$$.on_destroy?e.$$.on_destroy.push(...s):De(s),e.$$.on_mount=[]}),o.forEach(pt)}function Le(e,t){const l=e.$$;l.fragment!==null&&(Ul(l.after_update),De(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Wl(e,t){e.$$.dirty[0]===-1&&(ze.push(e),Dl(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ke(e,t,l,n,o,s,a=null,h=[-1]){const c=Ze;Qe(e);const u=e.$$={fragment:null,ctx:[],props:s,update:fe,not_equal:o,bound:qt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:qt(),dirty:h,skip_bound:!1,root:t.target||c.$$.root};a&&a(u.root);let f=!1;if(u.ctx=l?l(e,t.props||{},(m,d,...g)=>{const y=g.length?g[0]:d;return u.ctx&&o(u.ctx[m],u.ctx[m]=y)&&(!u.skip_bound&&u.bound[m]&&u.bound[m](y),f&&Wl(e,m)),d}):[],u.update(),f=!0,De(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const m=Bl(t.target);u.fragment&&u.fragment.l(m),m.forEach(R)}else u.fragment&&u.fragment.c();t.intro&&ne(e.$$.fragment),Me(e,t.target,t.anchor),ql()}Qe(c)}class Ye{constructor(){ut(this,"$$");ut(this,"$$set")}$destroy(){Le(this,1),this.$destroy=fe}$on(t,l){if(!Xe(l))return fe;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const o=n.indexOf(l);o!==-1&&n.splice(o,1)}}$set(t){this.$$set&&!Pl(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const zl="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(zl);function Ft(e){let t,l;return{c(){t=v("span"),l=O(e[6]),i(t,"class","status svelte-1c4hcx6")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o&64&&U(l,n[6])},d(n){n&&R(t)}}}function Vl(e){let t,l,n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C,G,P,F,B,N,E,T,D,K,J,H,_=e[6]&&Ft(e);return{c(){t=v("div"),l=v("div"),n=Y("svg"),o=Y("rect"),s=Y("rect"),a=Y("rect"),h=Y("rect"),c=L(),u=v("span"),u.textContent="AIUsage",f=L(),_&&_.c(),m=L(),d=v("div"),g=v("button"),y=Y("svg"),I=Y("path"),V=Y("path"),X=Y("path"),C=Y("path"),G=L(),P=v("button"),F=Y("svg"),B=Y("circle"),N=Y("path"),E=L(),T=v("button"),D=Y("svg"),K=Y("path"),i(o,"width","64"),i(o,"height","64"),i(o,"rx","14"),i(o,"fill","oklch(0.55 0.12 175)"),i(s,"x","10"),i(s,"y","38"),i(s,"width","12"),i(s,"height","16"),i(s,"rx","3"),i(s,"fill","white"),i(a,"x","26"),i(a,"y","26"),i(a,"width","12"),i(a,"height","28"),i(a,"rx","3"),i(a,"fill","white"),i(h,"x","42"),i(h,"y","14"),i(h,"width","12"),i(h,"height","40"),i(h,"rx","3"),i(h,"fill","white"),i(n,"xmlns","http://www.w3.org/2000/svg"),i(n,"width","14"),i(n,"height","14"),i(n,"viewBox","0 0 64 64"),Se(n,"display","block"),Se(n,"border-radius","3px"),i(u,"class","logo svelte-1c4hcx6"),i(l,"class","brand svelte-1c4hcx6"),i(I,"d","M2.5 8a5.5 5.5 0 0 1 9.36-3.93"),i(V,"d","M13.5 8a5.5 5.5 0 0 1-9.36 3.93"),i(X,"d","M12 1.5v3h-3"),i(C,"d","M4 11.5v3h3"),i(y,"width","13"),i(y,"height","13"),i(y,"viewBox","0 0 16 16"),i(y,"fill","none"),i(y,"stroke","currentColor"),i(y,"stroke-width","1.8"),i(y,"stroke-linecap","round"),i(g,"class","icon-btn svelte-1c4hcx6"),i(g,"title",e[3]),i(g,"aria-label",e[3]),i(B,"cx","12"),i(B,"cy","12"),i(B,"r","3"),i(N,"d","M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"),i(F,"width","13"),i(F,"height","13"),i(F,"viewBox","0 0 24 24"),i(F,"fill","none"),i(F,"stroke","currentColor"),i(F,"stroke-width","2"),i(F,"stroke-linecap","round"),i(F,"stroke-linejoin","round"),i(P,"class","icon-btn svelte-1c4hcx6"),i(P,"title",e[4]),i(P,"aria-label",e[4]),i(K,"d","M2 2l8 8M10 2l-8 8"),i(D,"width","11"),i(D,"height","11"),i(D,"viewBox","0 0 12 12"),i(D,"fill","none"),i(D,"stroke","currentColor"),i(D,"stroke-width","1.8"),i(D,"stroke-linecap","round"),i(T,"class","icon-btn svelte-1c4hcx6"),i(T,"title",e[5]),i(T,"aria-label",e[5]),i(d,"class","actions svelte-1c4hcx6"),i(t,"class","header svelte-1c4hcx6")},m(j,w){A(j,t,w),r(t,l),r(l,n),r(n,o),r(n,s),r(n,a),r(n,h),r(l,c),r(l,u),r(l,f),_&&_.m(l,null),r(t,m),r(t,d),r(d,g),r(g,y),r(y,I),r(y,V),r(y,X),r(y,C),r(d,G),r(d,P),r(P,F),r(F,B),r(F,N),r(d,E),r(d,T),r(T,D),r(D,K),J||(H=[de(g,"click",function(){Xe(e[0])&&e[0].apply(this,arguments)}),de(P,"click",function(){Xe(e[2])&&e[2].apply(this,arguments)}),de(T,"click",function(){Xe(e[1])&&e[1].apply(this,arguments)})],J=!0)},p(j,[w]){e=j,e[6]?_?_.p(e,w):(_=Ft(e),_.c(),_.m(l,null)):_&&(_.d(1),_=null),w&8&&i(g,"title",e[3]),w&8&&i(g,"aria-label",e[3]),w&16&&i(P,"title",e[4]),w&16&&i(P,"aria-label",e[4]),w&32&&i(T,"title",e[5]),w&32&&i(T,"aria-label",e[5])},i:fe,o:fe,d(j){j&&R(t),_&&_.d(),J=!1,De(H)}}}function Gl(e,t,l){let{onRefresh:n}=t,{onClose:o}=t,{onToggleSettings:s}=t,{refreshLabel:a}=t,{settingsLabel:h}=t,{closeLabel:c}=t,{statusText:u=""}=t;return e.$$set=f=>{"onRefresh"in f&&l(0,n=f.onRefresh),"onClose"in f&&l(1,o=f.onClose),"onToggleSettings"in f&&l(2,s=f.onToggleSettings),"refreshLabel"in f&&l(3,a=f.refreshLabel),"settingsLabel"in f&&l(4,h=f.settingsLabel),"closeLabel"in f&&l(5,c=f.closeLabel),"statusText"in f&&l(6,u=f.statusText)},[n,o,s,a,h,c,u]}class Kl extends Ye{constructor(t){super(),Ke(this,t,Gl,Vl,Ge,{onRefresh:0,onClose:1,onToggleSettings:2,refreshLabel:3,settingsLabel:4,closeLabel:5,statusText:6})}}function Et(e){let t,l;return{c(){t=v("span"),l=O(e[2]),i(t,"class","sub svelte-36ktuv")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o&4&&U(l,n[2])},d(n){n&&R(t)}}}function Yl(e){let t,l,n,o,s,a,h,c,u=e[2]&&Et(e);return{c(){t=v("div"),l=v("span"),n=O(e[0]),o=L(),s=v("div"),a=v("span"),h=O(e[1]),c=L(),u&&u.c(),i(l,"class","label svelte-36ktuv"),i(a,"class","value svelte-36ktuv"),z(a,"accent",e[3]),i(s,"class","right svelte-36ktuv"),i(t,"class","row svelte-36ktuv")},m(f,m){A(f,t,m),r(t,l),r(l,n),r(t,o),r(t,s),r(s,a),r(a,h),r(s,c),u&&u.m(s,null)},p(f,[m]){m&1&&U(n,f[0]),m&2&&U(h,f[1]),m&8&&z(a,"accent",f[3]),f[2]?u?u.p(f,m):(u=Et(f),u.c(),u.m(s,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(f){f&&R(t),u&&u.d()}}}function Xl(e,t,l){let{label:n}=t,{value:o}=t,{sub:s=""}=t,{accent:a=!1}=t;return e.$$set=h=>{"label"in h&&l(0,n=h.label),"value"in h&&l(1,o=h.value),"sub"in h&&l(2,s=h.sub),"accent"in h&&l(3,a=h.accent)},[n,o,s,a]}class dt extends Ye{constructor(t){super(),Ke(this,t,Xl,Yl,Ge,{label:0,value:1,sub:2,accent:3})}}function At(e,t,l){const n=e.slice();return n[7]=t[l],n}function Pt(e,t,l){const n=e.slice();return n[7]=t[l],n}function Ql(e){let t;return{c(){t=v("div"),t.textContent="No token data",i(t,"class","empty svelte-4y3y1j")},m(l,n){A(l,t,n)},p:fe,d(l){l&&R(t)}}}function Zl(e){let t,l,n,o=te(e[0]),s=[];for(let c=0;c<o.length;c+=1)s[c]=Bt(Pt(e,o,c));let a=te(e[0]),h=[];for(let c=0;c<a.length;c+=1)h[c]=Nt(At(e,a,c));return{c(){t=v("div");for(let c=0;c<s.length;c+=1)s[c].c();l=L(),n=v("div");for(let c=0;c<h.length;c+=1)h[c].c();i(t,"class","bar svelte-4y3y1j"),i(n,"class","legend svelte-4y3y1j")},m(c,u){A(c,t,u);for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(t,null);A(c,l,u),A(c,n,u);for(let f=0;f<h.length;f+=1)h[f]&&h[f].m(n,null)},p(c,u){if(u&3){o=te(c[0]);let f;for(f=0;f<o.length;f+=1){const m=Pt(c,o,f);s[f]?s[f].p(m,u):(s[f]=Bt(m),s[f].c(),s[f].m(t,null))}for(;f<s.length;f+=1)s[f].d(1);s.length=o.length}if(u&1){a=te(c[0]);let f;for(f=0;f<a.length;f+=1){const m=At(c,a,f);h[f]?h[f].p(m,u):(h[f]=Nt(m),h[f].c(),h[f].m(n,null))}for(;f<h.length;f+=1)h[f].d(1);h.length=a.length}},d(c){c&&(R(t),R(l),R(n)),ke(s,c),ke(h,c)}}}function Bt(e){let t,l;return{c(){t=v("div"),i(t,"class","segment svelte-4y3y1j"),Se(t,"width",e[7].value/e[1]*100+"%"),Se(t,"background",e[7].color),i(t,"title",l=e[7].label+": "+lt(e[7].value))},m(n,o){A(n,t,o)},p(n,o){o&3&&Se(t,"width",n[7].value/n[1]*100+"%"),o&1&&Se(t,"background",n[7].color),o&1&&l!==(l=n[7].label+": "+lt(n[7].value))&&i(t,"title",l)},d(n){n&&R(t)}}}function Nt(e){let t,l,n,o,s=e[7].label+"",a,h,c,u=lt(e[7].value)+"",f,m;return{c(){t=v("div"),l=v("span"),n=L(),o=v("span"),a=O(s),h=L(),c=v("span"),f=O(u),m=L(),i(l,"class","dot svelte-4y3y1j"),Se(l,"background",e[7].color),i(o,"class","legend-label svelte-4y3y1j"),i(c,"class","legend-value svelte-4y3y1j"),i(t,"class","legend-item svelte-4y3y1j")},m(d,g){A(d,t,g),r(t,l),r(t,n),r(t,o),r(o,a),r(t,h),r(t,c),r(c,f),r(t,m)},p(d,g){g&1&&Se(l,"background",d[7].color),g&1&&s!==(s=d[7].label+"")&&U(a,s),g&1&&u!==(u=lt(d[7].value)+"")&&U(f,u)},d(d){d&&R(t)}}}function Jl(e){let t;function l(s,a){return s[1]>0?Zl:Ql}let n=l(e),o=n(e);return{c(){t=v("div"),o.c(),i(t,"class","breakdown svelte-4y3y1j")},m(s,a){A(s,t,a),o.m(t,null)},p(s,[a]){n===(n=l(s))&&o?o.p(s,a):(o.d(1),o=n(s),o&&(o.c(),o.m(t,null)))},i:fe,o:fe,d(s){s&&R(t),o.d()}}}function lt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function $l(e,t,l){let n,o,{input:s=0}=t,{output:a=0}=t,{cacheRead:h=0}=t,{cacheWrite:c=0}=t,{thinking:u=0}=t;return e.$$set=f=>{"input"in f&&l(2,s=f.input),"output"in f&&l(3,a=f.output),"cacheRead"in f&&l(4,h=f.cacheRead),"cacheWrite"in f&&l(5,c=f.cacheWrite),"thinking"in f&&l(6,u=f.thinking)},e.$$.update=()=>{e.$$.dirty&124&&l(1,n=s+a+h+c+u),e.$$.dirty&124&&l(0,o=[{label:"Input",value:s,color:"var(--chart-input)"},{label:"Output",value:a,color:"var(--chart-output)"},{label:"Cache R",value:h,color:"var(--chart-cache-read)"},{label:"Cache W",value:c,color:"var(--chart-cache-write)"},{label:"Think",value:u,color:"var(--chart-thinking)"}].filter(f=>f.value>0))},[o,n,s,a,h,c,u]}class xl extends Ye{constructor(t){super(),Ke(this,t,$l,Jl,Ge,{input:2,output:3,cacheRead:4,cacheWrite:5,thinking:6})}}const It=[{code:"USD",label:"USD"},{code:"CNY",label:"CNY"}];function jl(e,t,l){return t==="USD"?e:l!=null&&l.rate&&Number.isFinite(l.rate)?e*l.rate:null}function kt(e,t,l,n,o=!1){const s=jl(e,t,n);return s===null?"--":Rl(s,t,l,o)}function Rl(e,t,l,n=!1){const o=n&&Math.abs(e)>=1e3?"compact":"standard",s=e>=100||o==="compact"?0:e>=1?2:e>0?3:0;return new Intl.NumberFormat(l,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",notation:o,minimumFractionDigits:s,maximumFractionDigits:s}).format(e)}function Ot(e,t,l){const n=e.slice();return n[33]=t[l],n}function gt(e){const t=e.slice(),l=t[0][t[6]];t[36]=l;const n=t[21]();t[37]=n;const o=t[23](t[6]);t[38]=o;const s=t[22](t[6]);return t[39]=s,t}function Ht(e,t,l){const n=e.slice();return n[40]=t[l],n}function Ut(e,t,l){const n=e.slice();return n[40]=t[l],n[44]=l,n}function Wt(e){let t,l,n,o,s,a=nl(e[40])+"",h,c;return{c(){t=Y("line"),s=Y("text"),h=O(a),i(t,"x1",pe),i(t,"y1",l=e[15](e[40])),i(t,"x2",n=pe+e[9]),i(t,"y2",o=e[15](e[40])),i(t,"stroke","var(--border)"),i(t,"stroke-width","0.5"),i(t,"stroke-dasharray",e[44]===0?"none":"2,2"),i(s,"x",pe-7),i(s,"y",c=e[15](e[40])+3),i(s,"text-anchor","end"),i(s,"class","y-label svelte-15p89al")},m(u,f){A(u,t,f),A(u,s,f),r(s,h)},p(u,f){f[0]&2048&&l!==(l=u[15](u[40]))&&i(t,"y1",l),f[0]&512&&n!==(n=pe+u[9])&&i(t,"x2",n),f[0]&2048&&o!==(o=u[15](u[40]))&&i(t,"y2",o),f[0]&2048&&a!==(a=nl(u[40])+"")&&U(h,a),f[0]&2048&&c!==(c=u[15](u[40])+3)&&i(s,"y",c)},d(u){u&&(R(t),R(s))}}}function zt(e){let t,l=te(e[10]),n=[];for(let o=0;o<l.length;o+=1)n[o]=Vt(Ht(e,l,o));return{c(){for(let o=0;o<n.length;o+=1)n[o].c();t=ve()},m(o,s){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(o,s);A(o,t,s)},p(o,s){if(s[0]&198144){l=te(o[10]);let a;for(a=0;a<l.length;a+=1){const h=Ht(o,l,a);n[a]?n[a].p(h,s):(n[a]=Vt(h),n[a].c(),n[a].m(t.parentNode,t))}for(;a<n.length;a+=1)n[a].d(1);n.length=l.length}},d(o){o&&R(t),ke(n,o)}}}function Vt(e){let t,l=e[17](e[40])+"",n,o,s;return{c(){t=Y("text"),n=O(l),i(t,"x",o=pe+e[9]+7),i(t,"y",s=e[16](e[40])+3),i(t,"text-anchor","start"),i(t,"class","y-label y-label-cost svelte-15p89al")},m(a,h){A(a,t,h),r(t,n)},p(a,h){h[0]&1024&&l!==(l=a[17](a[40])+"")&&U(n,l),h[0]&512&&o!==(o=pe+a[9]+7)&&i(t,"x",o),h[0]&1024&&s!==(s=a[16](a[40])+3)&&i(t,"y",s)},d(a){a&&R(t)}}}function Gt(e){let t;return{c(){t=Y("path"),i(t,"d",e[12]),i(t,"fill","url(#areaGrad)"),i(t,"clip-path","url(#chartClip)"),i(t,"class","area svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&4096&&i(t,"d",l[12])},d(l){l&&R(t)}}}function Kt(e){let t;return{c(){t=Y("path"),i(t,"d",e[13]),i(t,"fill","none"),i(t,"stroke","var(--chart-cache-read)"),i(t,"stroke-width","1.3"),i(t,"stroke-linecap","round"),i(t,"stroke-linejoin","round"),i(t,"clip-path","url(#chartClip)"),i(t,"class","line cost-line svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&8192&&i(t,"d",l[13])},d(l){l&&R(t)}}}function Yt(e){let t;return{c(){t=Y("path"),i(t,"d",e[4]),i(t,"fill","none"),i(t,"stroke","var(--accent)"),i(t,"stroke-width","1.8"),i(t,"stroke-linecap","round"),i(t,"stroke-linejoin","round"),i(t,"clip-path","url(#chartClip)"),i(t,"class","line svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&16&&i(t,"d",l[4])},d(l){l&&R(t)}}}function Xt(e){let t,l,n,o;return{c(){t=Y("line"),i(t,"x1",l=e[14](e[6])),i(t,"y1",be),i(t,"x2",n=e[14](e[6])),i(t,"y2",o=be+e[2]),i(t,"stroke","var(--text-muted)"),i(t,"stroke-width","0.5"),i(t,"stroke-dasharray","2,2")},m(s,a){A(s,t,a)},p(s,a){a[0]&64&&l!==(l=s[14](s[6]))&&i(t,"x1",l),a[0]&64&&n!==(n=s[14](s[6]))&&i(t,"x2",n),a[0]&4&&o!==(o=be+s[2])&&i(t,"y2",o)},d(s){s&&R(t)}}}function Qt(e){let t,l,n,o,s=e[1]&&Zt(e);return{c(){t=Y("circle"),s&&s.c(),o=ve(),i(t,"cx",l=e[14](e[6])),i(t,"cy",n=e[15](e[3][e[6]])),i(t,"r","4"),i(t,"fill","var(--bg)"),i(t,"stroke","var(--accent)"),i(t,"stroke-width","2")},m(a,h){A(a,t,h),s&&s.m(a,h),A(a,o,h)},p(a,h){h[0]&64&&l!==(l=a[14](a[6]))&&i(t,"cx",l),h[0]&72&&n!==(n=a[15](a[3][a[6]]))&&i(t,"cy",n),a[1]?s?s.p(a,h):(s=Zt(a),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},d(a){a&&(R(t),R(o)),s&&s.d(a)}}}function Zt(e){let t,l,n;return{c(){t=Y("circle"),i(t,"cx",l=e[14](e[6])),i(t,"cy",n=e[16](e[5][e[6]])),i(t,"r","3"),i(t,"fill","var(--bg)"),i(t,"stroke","var(--chart-cache-read)"),i(t,"stroke-width","1.5")},m(o,s){A(o,t,s)},p(o,s){s[0]&64&&l!==(l=o[14](o[6]))&&i(t,"cx",l),s[0]&96&&n!==(n=o[16](o[5][o[6]]))&&i(t,"cy",n)},d(o){o&&R(t)}}}function Jt(e){let t,l,n,o=e[18](e[36].date)+"",s,a,h=ll(e[36].tokens)+"",c,u,f,m=e[1]&&e[36].cost>0&&$t(e);return{c(){t=Y("foreignObject"),l=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n=document.createElementNS("http://www.w3.org/1999/xhtml","span"),s=O(o),a=document.createElementNS("http://www.w3.org/1999/xhtml","span"),c=O(h),m&&m.c(),i(n,"class","tooltip-date svelte-15p89al"),i(a,"class","tooltip-metric token-dot svelte-15p89al"),i(l,"class","tooltip svelte-15p89al"),i(l,"xmlns","http://www.w3.org/1999/xhtml"),z(l,"pointer-left",e[24](e[6])==="left"),z(l,"pointer-right",e[24](e[6])==="right"),i(t,"x",u=e[38]),i(t,"y",f=e[39]),i(t,"width",e[37]),i(t,"height","28"),i(t,"class","tooltip-fo svelte-15p89al")},m(d,g){A(d,t,g),r(t,l),r(l,n),r(n,s),r(l,a),r(a,c),m&&m.m(l,null)},p(d,g){g[0]&65&&o!==(o=d[18](d[36].date)+"")&&U(s,o),g[0]&65&&h!==(h=ll(d[36].tokens)+"")&&U(c,h),d[1]&&d[36].cost>0?m?m.p(d,g):(m=$t(d),m.c(),m.m(l,null)):m&&(m.d(1),m=null),g[0]&16777280&&z(l,"pointer-left",d[24](d[6])==="left"),g[0]&16777280&&z(l,"pointer-right",d[24](d[6])==="right"),g[0]&64&&u!==(u=d[38])&&i(t,"x",u),g[0]&64&&f!==(f=d[39])&&i(t,"y",f)},d(d){d&&R(t),m&&m.d()}}}function $t(e){let t,l=e[20](e[36].cost)+"",n;return{c(){t=document.createElementNS("http://www.w3.org/1999/xhtml","span"),n=O(l),i(t,"class","tooltip-metric cost-dot svelte-15p89al")},m(o,s){A(o,t,s),r(t,n)},p(o,s){s[0]&65&&l!==(l=o[20](o[36].cost)+"")&&U(n,l)},d(o){o&&R(t)}}}function xt(e){let t,l=e[19](e[0][e[33]].date)+"",n,o;return{c(){t=Y("text"),n=O(l),i(t,"x",o=e[14](e[33])),i(t,"y",nt-2),i(t,"text-anchor","middle"),i(t,"class","tick-label svelte-15p89al")},m(s,a){A(s,t,a),r(t,n)},p(s,a){a[0]&257&&l!==(l=s[19](s[0][s[33]].date)+"")&&U(n,l),a[0]&256&&o!==(o=s[14](s[33]))&&i(t,"x",o)},d(s){s&&R(t)}}}function el(e){let t,l=e[0][e[33]]&&xt(e);return{c(){l&&l.c(),t=ve()},m(n,o){l&&l.m(n,o),A(n,t,o)},p(n,o){n[0][n[33]]?l?l.p(n,o):(l=xt(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){n&&R(t),l&&l.d(n)}}}function en(e){let t,l,n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C,G=te(e[11]),P=[];for(let _=0;_<G.length;_+=1)P[_]=Wt(Ut(e,G,_));let F=e[1]&&zt(e),B=e[12]&&Gt(e),N=e[13]&&Kt(e),E=e[4]&&Yt(e),T=e[6]!==null&&Xt(e),D=e[6]!==null&&Qt(e),K=e[6]!==null&&e[0][e[6]]&&Jt(gt(e)),J=te(e[8]),H=[];for(let _=0;_<J.length;_+=1)H[_]=el(Ot(e,J,_));return{c(){t=v("div"),l=Y("svg"),n=Y("defs"),o=Y("linearGradient"),s=Y("stop"),a=Y("stop"),h=Y("clipPath"),c=Y("rect");for(let _=0;_<P.length;_+=1)P[_].c();u=ve(),F&&F.c(),f=ve(),B&&B.c(),m=ve(),N&&N.c(),d=ve(),E&&E.c(),g=ve(),T&&T.c(),y=ve(),D&&D.c(),I=ve(),K&&K.c(),V=ve();for(let _=0;_<H.length;_+=1)H[_].c();i(s,"offset","0%"),i(s,"stop-color","var(--accent)"),i(s,"stop-opacity","0.2"),i(a,"offset","100%"),i(a,"stop-color","var(--accent)"),i(a,"stop-opacity","0.02"),i(o,"id","areaGrad"),i(o,"x1","0"),i(o,"y1","0"),i(o,"x2","0"),i(o,"y2","1"),i(c,"x",pe),i(c,"y",be),i(c,"width",e[9]),i(c,"height",e[2]),i(h,"id","chartClip"),i(l,"viewBox","0 0 "+wt+" "+nt),i(l,"width","100%"),i(l,"height",nt),i(l,"class","chart-svg svelte-15p89al"),i(l,"role","img"),i(l,"aria-label","Token usage trend chart"),z(l,"mounted",e[7]),i(t,"class","chart-wrapper svelte-15p89al")},m(_,j){A(_,t,j),r(t,l),r(l,n),r(n,o),r(o,s),r(o,a),r(n,h),r(h,c);for(let w=0;w<P.length;w+=1)P[w]&&P[w].m(l,null);r(l,u),F&&F.m(l,null),r(l,f),B&&B.m(l,null),r(l,m),N&&N.m(l,null),r(l,d),E&&E.m(l,null),r(l,g),T&&T.m(l,null),r(l,y),D&&D.m(l,null),r(l,I),K&&K.m(l,null),r(l,V);for(let w=0;w<H.length;w+=1)H[w]&&H[w].m(l,null);X||(C=[de(l,"mousemove",e[25]),de(l,"mouseleave",e[26])],X=!0)},p(_,j){if(j[0]&512&&i(c,"width",_[9]),j[0]&4&&i(c,"height",_[2]),j[0]&35328){G=te(_[11]);let w;for(w=0;w<G.length;w+=1){const W=Ut(_,G,w);P[w]?P[w].p(W,j):(P[w]=Wt(W),P[w].c(),P[w].m(l,u))}for(;w<P.length;w+=1)P[w].d(1);P.length=G.length}if(_[1]?F?F.p(_,j):(F=zt(_),F.c(),F.m(l,f)):F&&(F.d(1),F=null),_[12]?B?B.p(_,j):(B=Gt(_),B.c(),B.m(l,m)):B&&(B.d(1),B=null),_[13]?N?N.p(_,j):(N=Kt(_),N.c(),N.m(l,d)):N&&(N.d(1),N=null),_[4]?E?E.p(_,j):(E=Yt(_),E.c(),E.m(l,g)):E&&(E.d(1),E=null),_[6]!==null?T?T.p(_,j):(T=Xt(_),T.c(),T.m(l,y)):T&&(T.d(1),T=null),_[6]!==null?D?D.p(_,j):(D=Qt(_),D.c(),D.m(l,I)):D&&(D.d(1),D=null),_[6]!==null&&_[0][_[6]]?K?K.p(gt(_),j):(K=Jt(gt(_)),K.c(),K.m(l,V)):K&&(K.d(1),K=null),j[0]&540929){J=te(_[8]);let w;for(w=0;w<J.length;w+=1){const W=Ot(_,J,w);H[w]?H[w].p(W,j):(H[w]=el(W),H[w].c(),H[w].m(l,null))}for(;w<H.length;w+=1)H[w].d(1);H.length=J.length}j[0]&128&&z(l,"mounted",_[7])},i:fe,o:fe,d(_){_&&R(t),ke(P,_),F&&F.d(),B&&B.d(),N&&N.d(),E&&E.d(),T&&T.d(),D&&D.d(),K&&K.d(),ke(H,_),X=!1,De(C)}}}const wt=352,nt=126,be=14,tn=18,pe=34,ln=36;function tl(e){if(e<=0)return 1;const t=Math.pow(10,Math.floor(Math.log10(e))),l=e/t;return(l<=1?1:l<=2?2:l<=5?5:10)*t}function ll(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function nl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e5?`${Math.round(e/1e3)}K`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function il(e){return new Date(e+"T00:00:00")}function nn(e,t,l){let n,o,s,a,h,c,u,f,m,d,g,y,{data:I=[]}=t,{showCost:V=!1}=t,{locale:X="en"}=t,{currency:C="USD"}=t,{exchangeRate:G=null}=t,P=null,F=!1;Ml(()=>{requestAnimationFrame(()=>{l(7,F=!0)})});function B(S){return pe+S/Math.max(I.length-1,1)*h}function N(S){return be+c-S/s*c}function E(S){return be+c-S/a*c}function T(S,le){if(S.length<2)return"";const k=S.length,M=S.map((q,ee)=>B(ee)),$=S.map(q=>le(q));if(k===2)return`M${M[0]},${$[0]}L${M[1]},${$[1]}`;const Q=[],x=[];for(let q=0;q<k-1;q++)Q.push(($[q+1]-$[q])/(M[q+1]-M[q]));x.push(Q[0]);for(let q=1;q<k-1;q++)Q[q-1]*Q[q]<=0?x.push(0):x.push((Q[q-1]+Q[q])/2);x.push(Q[k-2]);for(let q=0;q<k-1;q++)if(Math.abs(Q[q])<1e-12)x[q]=0,x[q+1]=0;else{const ee=x[q]/Q[q],ge=x[q+1]/Q[q],ye=ee*ee+ge*ge;if(ye>9){const Te=3/Math.sqrt(ye);x[q]=Te*ee*Q[q],x[q+1]=Te*ge*Q[q]}}let ce=`M${M[0].toFixed(1)},${$[0].toFixed(1)}`;for(let q=0;q<k-1;q++){const ee=(M[q+1]-M[q])/3,ge=M[q]+ee,ye=$[q]+x[q]*ee,Te=M[q+1]-ee,Je=$[q+1]-x[q+1]*ee;ce+=`C${ge.toFixed(1)},${ye.toFixed(1)},${Te.toFixed(1)},${Je.toFixed(1)},${M[q+1].toFixed(1)},${$[q+1].toFixed(1)}`}return ce}function D(S){return Rl(S,C,X,!0)}function K(S){const le=il(S);return new Intl.DateTimeFormat(X,{month:X==="zh"?"numeric":"short",day:"numeric"}).format(le)}function J(S){const le=il(S);return new Intl.DateTimeFormat(X,{month:"numeric",day:"numeric"}).format(le)}function H(S){return kt(S,C,X,G)}function _(){return V?156:116}function j(S){const le=N(n[S]??0)-30;return Math.min(Math.max(le,4),be+c-28)}function w(S){const k=_(),M=B(S),$=W(S)==="right"?M-k-8:M+8;return Math.min(Math.max($,pe),pe+h-k)}function W(S){return B(S)>pe+h/2?"right":"left"}function me(S){const k=S.currentTarget.getBoundingClientRect(),M=(S.clientX-k.left)/k.width*wt;let $=1/0,Q=0;for(let x=0;x<I.length;x++){const ce=Math.abs(B(x)-M);ce<$&&($=ce,Q=x)}l(6,P=Q)}function we(){l(6,P=null)}return e.$$set=S=>{"data"in S&&l(0,I=S.data),"showCost"in S&&l(1,V=S.showCost),"locale"in S&&l(27,X=S.locale),"currency"in S&&l(28,C=S.currency),"exchangeRate"in S&&l(29,G=S.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(3,n=I.map(S=>S.tokens)),e.$$.dirty[0]&805306369&&l(5,o=I.map(S=>jl(S.cost,C,G)??0)),e.$$.dirty[0]&8&&l(31,s=tl(Math.max(...n,1))),e.$$.dirty[0]&32&&l(30,a=tl(Math.max(...o,1))),e.$$.dirty[0]&8&&l(4,u=T(n,N)),e.$$.dirty[0]&34&&l(13,f=V?T(o,E):""),e.$$.dirty[0]&28&&l(12,m=u?`${u}L${B(n.length-1).toFixed(1)},${(be+c).toFixed(1)}L${B(0).toFixed(1)},${(be+c).toFixed(1)}Z`:""),e.$$.dirty[1]&1&&l(11,d=[0,s/2,s]),e.$$.dirty[0]&1073741824&&l(10,g=[0,a/2,a]),e.$$.dirty[0]&1&&l(8,y=I.length<=5?I.map((S,le)=>le):[0,Math.floor(I.length*.25),Math.floor(I.length*.5),Math.floor(I.length*.75),I.length-1])},l(9,h=wt-pe-ln),l(2,c=nt-be-tn),[I,V,c,n,u,o,P,F,y,h,g,d,m,f,B,N,E,D,K,J,H,_,j,w,W,me,we,X,C,G,a,s]}class on extends Ye{constructor(t){super(),Ke(this,t,nn,en,Ge,{data:0,showCost:1,locale:27,currency:28,exchangeRate:29},null,[-1,-1])}}const sn={today:"Today",lastNDays:e=>`Last ${e} days`,tokenBreakdown:"Token breakdown",tokenBreakdownToday:"Token breakdown (Today)",trend:"Trend",topModel:"Top Model",topTool:"Top Tool",sessions:"Sessions",settings:"Settings",theme:"Theme",timeRange:"Time range",refreshInterval:"Refresh interval",display:"Display",currency:"Currency",exchangeRate:"Exchange rate",exchangeRateUpdated:e=>`Updated ${e}`,exchangeRateUnavailable:"Exchange rate unavailable",language:"Language",showCost:"Show cost",tokenBreakdownToggle:"Token breakdown",activityChart:"Activity chart",syncedAt:e=>`Synced ${e}`,themeSystem:"System",themeLight:"Light",themeDark:"Dark",showPanel:"Show Panel",openDashboard:"Open Dashboard",refresh:"Refresh",quit:"Quit",close:"Close",installTitle:"Dashboard Setup",installPreparing:"Preparing...",installInstalling:"Installing @juliantanx/aiusage...",installLaunching:"Starting dashboard...",installDone:"Done! Opening...",installFailed:"Installation failed"},an={today:"今日",lastNDays:e=>`近 ${e} 天`,tokenBreakdown:"Token 分布",tokenBreakdownToday:"Token 分布 (今日)",trend:"趋势",topModel:"常用模型",topTool:"常用工具",sessions:"会话数",settings:"设置",theme:"主题",timeRange:"时间范围",refreshInterval:"刷新间隔",display:"显示",currency:"币种",exchangeRate:"汇率",exchangeRateUpdated:e=>`更新于 ${e}`,exchangeRateUnavailable:"汇率不可用",language:"语言",showCost:"显示费用",tokenBreakdownToggle:"Token 分布",activityChart:"活动图表",syncedAt:e=>`同步于 ${e}`,themeSystem:"跟随系统",themeLight:"浅色",themeDark:"深色",showPanel:"显示面板",openDashboard:"打开仪表盘",refresh:"刷新",quit:"退出",close:"关闭",installTitle:"仪表盘配置",installPreparing:"准备中...",installInstalling:"正在安装 @juliantanx/aiusage...",installLaunching:"正在启动仪表盘...",installDone:"完成!正在打开...",installFailed:"安装失败"},ol={en:sn,zh:an};function Fl(e){return ol[e]??ol.en}function sl(e,t,l){const n=e.slice();return n[22]=t[l],n}function al(e,t,l){const n=e.slice();return n[25]=t[l],n}function rl(e,t,l){const n=e.slice();return n[28]=t[l],n}function fl(e,t,l){const n=e.slice();return n[31]=t[l],n}function cl(e,t,l){const n=e.slice();return n[34]=t[l],n}function ul(e){let t,l,n;function o(){return e[14](e[34])}return{c(){t=v("button"),t.textContent=`${e[34].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].locale===e[34].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&2050&&z(t,"active",e[1].locale===e[34].value)},d(s){s&&R(t),l=!1,n()}}}function hl(e){let t,l,n;function o(){return e[15](e[31])}return{c(){t=v("button"),t.textContent=`${e[31].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].currency===e[31].code)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&2&&z(t,"active",e[1].currency===e[31].code)},d(s){s&&R(t),l=!1,n()}}}function dl(e){var d;let t,l,n=e[2].exchangeRate+"",o,s,a,h,c=e[7](),u,f=c&&rn(e),m=((d=e[0])==null?void 0:d.error)&&gl(e);return{c(){var g;t=v("div"),l=v("span"),o=O(n),s=L(),a=v("strong"),a.textContent=`${e[6]()}`,h=L(),f&&f.c(),u=L(),m&&m.c(),i(a,"class","svelte-198qnem"),i(t,"class","rate-info svelte-198qnem"),z(t,"error",!((g=e[0])!=null&&g.rate))},m(g,y){A(g,t,y),r(t,l),r(l,o),r(t,s),r(t,a),r(t,h),f&&f.m(t,null),r(t,u),m&&m.m(t,null)},p(g,y){var I,V;y[0]&4&&n!==(n=g[2].exchangeRate+"")&&U(o,n),c&&f.p(g,y),(I=g[0])!=null&&I.error?m?m.p(g,y):(m=gl(g),m.c(),m.m(t,null)):m&&(m.d(1),m=null),y[0]&1&&z(t,"error",!((V=g[0])!=null&&V.rate))},d(g){g&&R(t),f&&f.d(),m&&m.d()}}}function rn(e){let t;return{c(){t=v("small"),t.textContent=`${e[7]()}`,i(t,"class","svelte-198qnem")},m(l,n){A(l,t,n)},p:fe,d(l){l&&R(t)}}}function gl(e){let t,l=e[0].error+"",n;return{c(){t=v("small"),n=O(l),i(t,"class","svelte-198qnem")},m(o,s){A(o,t,s),r(t,n)},p(o,s){s[0]&1&&l!==(l=o[0].error+"")&&U(n,l)},d(o){o&&R(t)}}}function _l(e){let t,l=e[28].label+"",n,o,s,a;function h(){return e[16](e[28])}return{c(){t=v("button"),n=O(l),o=L(),i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].theme===e[28].value)},m(c,u){A(c,t,u),r(t,n),r(t,o),s||(a=de(t,"click",h),s=!0)},p(c,u){e=c,u[0]&8&&l!==(l=e[28].label+"")&&U(n,l),u[0]&10&&z(t,"active",e[1].theme===e[28].value)},d(c){c&&R(t),s=!1,a()}}}function ml(e){let t,l,n;function o(){return e[17](e[25])}return{c(){t=v("button"),t.textContent=`${e[25].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].rangeDays===e[25].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&1026&&z(t,"active",e[1].rangeDays===e[25].value)},d(s){s&&R(t),l=!1,n()}}}function pl(e){let t,l,n;function o(){return e[18](e[22])}return{c(){t=v("button"),t.textContent=`${e[22].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].refreshIntervalSec===e[22].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&514&&z(t,"active",e[1].refreshIntervalSec===e[22].value)},d(s){s&&R(t),l=!1,n()}}}function fn(e){let t,l,n,o=e[2].settings+"",s,a,h,c,u,f,m=e[2].language+"",d,g,y,I,V,X,C=e[2].currency+"",G,P,F,B,N,E,T,D=e[2].theme+"",K,J,H,_,j,w,W=e[2].timeRange+"",me,we,S,le,k,M,$=e[2].refreshInterval+"",Q,x,ce,q,ee,ge,ye=e[2].display+"",Te,Je,Ce,Ae,it,$e=e[2].showCost+"",ot,Tt,qe,Ct,Pe,st,xe=e[2].tokenBreakdownToggle+"",at,St,je,Mt,Be,rt,et=e[2].activityChart+"",ft,Lt,Re,ct,Dt,Ne=te(e[11]),ie=[];for(let b=0;b<Ne.length;b+=1)ie[b]=ul(cl(e,Ne,b));let Ie=te(It),oe=[];for(let b=0;b<Ie.length;b+=1)oe[b]=hl(fl(e,Ie,b));let ue=e[1].currency==="CNY"&&dl(e),Oe=te(e[3]),se=[];for(let b=0;b<Oe.length;b+=1)se[b]=_l(rl(e,Oe,b));let He=te(e[10]),ae=[];for(let b=0;b<He.length;b+=1)ae[b]=ml(al(e,He,b));let Ue=te(e[9]),re=[];for(let b=0;b<Ue.length;b+=1)re[b]=pl(sl(e,Ue,b));return{c(){t=v("div"),l=v("div"),n=v("span"),s=O(o),a=L(),h=v("button"),h.innerHTML='<svg width="11" height="11" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2 2l8 8M10 2l-8 8"></path></svg>',c=L(),u=v("div"),f=v("div"),d=O(m),g=L(),y=v("div");for(let b=0;b<ie.length;b+=1)ie[b].c();I=L(),V=v("div"),X=v("div"),G=O(C),P=L(),F=v("div");for(let b=0;b<oe.length;b+=1)oe[b].c();B=L(),ue&&ue.c(),N=L(),E=v("div"),T=v("div"),K=O(D),J=L(),H=v("div");for(let b=0;b<se.length;b+=1)se[b].c();_=L(),j=v("div"),w=v("div"),me=O(W),we=L(),S=v("div");for(let b=0;b<ae.length;b+=1)ae[b].c();le=L(),k=v("div"),M=v("div"),Q=O($),x=L(),ce=v("div");for(let b=0;b<re.length;b+=1)re[b].c();q=L(),ee=v("div"),ge=v("div"),Te=O(ye),Je=L(),Ce=v("div"),Ae=v("label"),it=v("span"),ot=O($e),Tt=L(),qe=v("button"),qe.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Ct=L(),Pe=v("label"),st=v("span"),at=O(xe),St=L(),je=v("button"),je.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Mt=L(),Be=v("label"),rt=v("span"),ft=O(et),Lt=L(),Re=v("button"),Re.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',i(n,"class","settings-title svelte-198qnem"),i(h,"class","back-btn svelte-198qnem"),i(l,"class","settings-header svelte-198qnem"),i(f,"class","section-label svelte-198qnem"),i(y,"class","button-group svelte-198qnem"),i(u,"class","section svelte-198qnem"),i(X,"class","section-label svelte-198qnem"),i(F,"class","button-group svelte-198qnem"),i(V,"class","section svelte-198qnem"),i(T,"class","section-label svelte-198qnem"),i(H,"class","button-group svelte-198qnem"),i(E,"class","section svelte-198qnem"),i(w,"class","section-label svelte-198qnem"),i(S,"class","button-group svelte-198qnem"),i(j,"class","section svelte-198qnem"),i(M,"class","section-label svelte-198qnem"),i(ce,"class","button-group svelte-198qnem"),i(k,"class","section svelte-198qnem"),i(ge,"class","section-label svelte-198qnem"),i(qe,"class","toggle svelte-198qnem"),z(qe,"on",e[1].showCost),i(Ae,"class","toggle-row svelte-198qnem"),i(je,"class","toggle svelte-198qnem"),z(je,"on",e[1].showTokenBreakdown),i(Pe,"class","toggle-row svelte-198qnem"),i(Re,"class","toggle svelte-198qnem"),z(Re,"on",e[1].showHeatmap),i(Be,"class","toggle-row svelte-198qnem"),i(Ce,"class","toggles svelte-198qnem"),i(ee,"class","section svelte-198qnem"),i(t,"class","settings svelte-198qnem")},m(b,Z){A(b,t,Z),r(t,l),r(l,n),r(n,s),r(l,a),r(l,h),r(t,c),r(t,u),r(u,f),r(f,d),r(u,g),r(u,y);for(let p=0;p<ie.length;p+=1)ie[p]&&ie[p].m(y,null);r(t,I),r(t,V),r(V,X),r(X,G),r(V,P),r(V,F);for(let p=0;p<oe.length;p+=1)oe[p]&&oe[p].m(F,null);r(V,B),ue&&ue.m(V,null),r(t,N),r(t,E),r(E,T),r(T,K),r(E,J),r(E,H);for(let p=0;p<se.length;p+=1)se[p]&&se[p].m(H,null);r(t,_),r(t,j),r(j,w),r(w,me),r(j,we),r(j,S);for(let p=0;p<ae.length;p+=1)ae[p]&&ae[p].m(S,null);r(t,le),r(t,k),r(k,M),r(M,Q),r(k,x),r(k,ce);for(let p=0;p<re.length;p+=1)re[p]&&re[p].m(ce,null);r(t,q),r(t,ee),r(ee,ge),r(ge,Te),r(ee,Je),r(ee,Ce),r(Ce,Ae),r(Ae,it),r(it,ot),r(Ae,Tt),r(Ae,qe),r(Ce,Ct),r(Ce,Pe),r(Pe,st),r(st,at),r(Pe,St),r(Pe,je),r(Ce,Mt),r(Ce,Be),r(Be,rt),r(rt,ft),r(Be,Lt),r(Be,Re),ct||(Dt=[de(h,"click",e[13]),de(qe,"click",e[19]),de(je,"click",e[20]),de(Re,"click",e[21])],ct=!0)},p(b,Z){if(Z[0]&4&&o!==(o=b[2].settings+"")&&U(s,o),Z[0]&4&&m!==(m=b[2].language+"")&&U(d,m),Z[0]&2082){Ne=te(b[11]);let p;for(p=0;p<Ne.length;p+=1){const he=cl(b,Ne,p);ie[p]?ie[p].p(he,Z):(ie[p]=ul(he),ie[p].c(),ie[p].m(y,null))}for(;p<ie.length;p+=1)ie[p].d(1);ie.length=Ne.length}if(Z[0]&4&&C!==(C=b[2].currency+"")&&U(G,C),Z[0]&34){Ie=te(It);let p;for(p=0;p<Ie.length;p+=1){const he=fl(b,Ie,p);oe[p]?oe[p].p(he,Z):(oe[p]=hl(he),oe[p].c(),oe[p].m(F,null))}for(;p<oe.length;p+=1)oe[p].d(1);oe.length=Ie.length}if(b[1].currency==="CNY"?ue?ue.p(b,Z):(ue=dl(b),ue.c(),ue.m(V,null)):ue&&(ue.d(1),ue=null),Z[0]&4&&D!==(D=b[2].theme+"")&&U(K,D),Z[0]&42){Oe=te(b[3]);let p;for(p=0;p<Oe.length;p+=1){const he=rl(b,Oe,p);se[p]?se[p].p(he,Z):(se[p]=_l(he),se[p].c(),se[p].m(H,null))}for(;p<se.length;p+=1)se[p].d(1);se.length=Oe.length}if(Z[0]&4&&W!==(W=b[2].timeRange+"")&&U(me,W),Z[0]&1058){He=te(b[10]);let p;for(p=0;p<He.length;p+=1){const he=al(b,He,p);ae[p]?ae[p].p(he,Z):(ae[p]=ml(he),ae[p].c(),ae[p].m(S,null))}for(;p<ae.length;p+=1)ae[p].d(1);ae.length=He.length}if(Z[0]&4&&$!==($=b[2].refreshInterval+"")&&U(Q,$),Z[0]&546){Ue=te(b[9]);let p;for(p=0;p<Ue.length;p+=1){const he=sl(b,Ue,p);re[p]?re[p].p(he,Z):(re[p]=pl(he),re[p].c(),re[p].m(ce,null))}for(;p<re.length;p+=1)re[p].d(1);re.length=Ue.length}Z[0]&4&&ye!==(ye=b[2].display+"")&&U(Te,ye),Z[0]&4&&$e!==($e=b[2].showCost+"")&&U(ot,$e),Z[0]&2&&z(qe,"on",b[1].showCost),Z[0]&4&&xe!==(xe=b[2].tokenBreakdownToggle+"")&&U(at,xe),Z[0]&2&&z(je,"on",b[1].showTokenBreakdown),Z[0]&4&&et!==(et=b[2].activityChart+"")&&U(ft,et),Z[0]&2&&z(Re,"on",b[1].showHeatmap)},i:fe,o:fe,d(b){b&&R(t),ke(ie,b),ke(oe,b),ue&&ue.d(),ke(se,b),ke(ae,b),ke(re,b),ct=!1,De(Dt)}}}function cn(e,t,l){let n,o,{settings:s}=t,{exchangeRate:a=null}=t;const h=Ol();let c={...s};function u(){h("save",c)}function f(){return a!=null&&a.rate?`1 USD = ${a.rate.toFixed(4)} CNY`:n.exchangeRateUnavailable}function m(){if(!(a!=null&&a.fetchedAt))return"";const T=new Date(a.fetchedAt),D=String(T.getHours()).padStart(2,"0"),K=String(T.getMinutes()).padStart(2,"0");return n.exchangeRateUpdated(`${D}:${K}`)}function d(T){typeof c[T]=="boolean"&&(l(1,c={...c,[T]:!c[T]}),u())}const g=[{label:"30s",value:30},{label:"1m",value:60},{label:"5m",value:300},{label:"10m",value:600}],y=[{label:"7d",value:7},{label:"14d",value:14},{label:"30d",value:30},{label:"60d",value:60},{label:"90d",value:90}],I=[{label:"English",value:"en"},{label:"中文",value:"zh"}],V=()=>h("close"),X=T=>{l(1,c={...c,locale:T.value}),u()},C=T=>{l(1,c={...c,currency:T.code}),u()},G=T=>{l(1,c={...c,theme:T.value}),u()},P=T=>{l(1,c={...c,rangeDays:T.value}),u()},F=T=>{l(1,c={...c,refreshIntervalSec:T.value}),u()},B=()=>d("showCost"),N=()=>d("showTokenBreakdown"),E=()=>d("showHeatmap");return e.$$set=T=>{"settings"in T&&l(12,s=T.settings),"exchangeRate"in T&&l(0,a=T.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&2&&l(2,n=Fl(c.locale??"en")),e.$$.dirty[0]&4&&l(3,o=[{label:n.themeSystem,value:"system"},{label:n.themeLight,value:"light"},{label:n.themeDark,value:"dark"}])},[a,c,n,o,h,u,f,m,d,g,y,I,s,V,X,C,G,P,F,B,N,E]}class un extends Ye{constructor(t){super(),Ke(this,t,cn,fn,Ge,{settings:12,exchangeRate:0},null,[-1,-1])}}function vl(e){let t,l,n,o,s,a=e[4].installTitle+"",h,c,u,f,m,d=e[10]&&bl(e);return{c(){t=v("div"),l=v("div"),n=v("div"),o=L(),s=v("div"),h=O(a),c=L(),u=v("div"),f=O(e[11]),m=L(),d&&d.c(),i(n,"class","install-spinner svelte-1sj3khb"),z(n,"hidden",e[3]==="done"||e[3]==="failed"),i(s,"class","install-title svelte-1sj3khb"),i(u,"class","install-message svelte-1sj3khb"),i(l,"class","install-content svelte-1sj3khb"),i(t,"class","install-overlay svelte-1sj3khb"),z(t,"failed",e[3]==="failed"),z(t,"done",e[3]==="done")},m(g,y){A(g,t,y),r(t,l),r(l,n),r(l,o),r(l,s),r(s,h),r(l,c),r(l,u),r(u,f),r(l,m),d&&d.m(l,null)},p(g,y){y[0]&8&&z(n,"hidden",g[3]==="done"||g[3]==="failed"),y[0]&16&&a!==(a=g[4].installTitle+"")&&U(h,a),y[0]&2048&&U(f,g[11]),g[10]?d?d.p(g,y):(d=bl(g),d.c(),d.m(l,null)):d&&(d.d(1),d=null),y[0]&8&&z(t,"failed",g[3]==="failed"),y[0]&8&&z(t,"done",g[3]==="done")},d(g){g&&R(t),d&&d.d()}}}function bl(e){let t,l;return{c(){t=v("div"),l=O(e[10]),i(t,"class","install-error svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&1024&&U(l,n[10])},d(n){n&&R(t)}}}function hn(e){var me,we,S,le;let t,l,n,o,s,a=e[4].today+"",h,c,u,f,m,d,g,y,I,V,X,C,G,P,F,B,N,E,T,D,K,J,H,_=((me=e[1])==null?void 0:me.showCost)&&kl(e),j=((we=e[1])==null?void 0:we.showCost)&&wl(e),w=((S=e[1])==null?void 0:S.showTokenBreakdown)&&e[0]&&yl(e),W=((le=e[1])==null?void 0:le.showHeatmap)&&e[0]&&Tl(e);return E=new dt({props:{label:e[4].topModel,value:e[17],sub:e[16]}}),D=new dt({props:{label:e[4].topTool,value:e[15],sub:e[14]}}),J=new dt({props:{label:e[4].sessions,value:e[13]}}),{c(){t=v("div"),l=v("div"),n=v("div"),o=v("div"),s=v("span"),h=O(a),c=L(),u=v("span"),f=O(e[22]),m=L(),_&&_.c(),d=L(),g=v("div"),y=v("span"),I=O(e[18]),V=L(),X=v("span"),C=O(e[21]),G=L(),j&&j.c(),P=L(),w&&w.c(),F=L(),W&&W.c(),B=L(),N=v("div"),Ee(E.$$.fragment),T=L(),Ee(D.$$.fragment),K=L(),Ee(J.$$.fragment),i(s,"class","metric-label svelte-1sj3khb"),i(u,"class","metric-value svelte-1sj3khb"),i(o,"class","metric svelte-1sj3khb"),i(y,"class","metric-label svelte-1sj3khb"),i(X,"class","metric-value svelte-1sj3khb"),i(g,"class","metric svelte-1sj3khb"),i(n,"class","metric-grid svelte-1sj3khb"),i(l,"class","section svelte-1sj3khb"),i(N,"class","section details svelte-1sj3khb"),i(t,"class","content svelte-1sj3khb")},m(k,M){A(k,t,M),r(t,l),r(l,n),r(n,o),r(o,s),r(s,h),r(o,c),r(o,u),r(u,f),r(o,m),_&&_.m(o,null),r(n,d),r(n,g),r(g,y),r(y,I),r(g,V),r(g,X),r(X,C),r(g,G),j&&j.m(g,null),r(t,P),w&&w.m(t,null),r(t,F),W&&W.m(t,null),r(t,B),r(t,N),Me(E,N,null),r(N,T),Me(D,N,null),r(N,K),Me(J,N,null),H=!0},p(k,M){var ce,q,ee,ge;(!H||M[0]&16)&&a!==(a=k[4].today+"")&&U(h,a),(!H||M[0]&4194304)&&U(f,k[22]),(ce=k[1])!=null&&ce.showCost?_?_.p(k,M):(_=kl(k),_.c(),_.m(o,null)):_&&(_.d(1),_=null),(!H||M[0]&262144)&&U(I,k[18]),(!H||M[0]&2097152)&&U(C,k[21]),(q=k[1])!=null&&q.showCost?j?j.p(k,M):(j=wl(k),j.c(),j.m(g,null)):j&&(j.d(1),j=null),(ee=k[1])!=null&&ee.showTokenBreakdown&&k[0]?w?(w.p(k,M),M[0]&3&&ne(w,1)):(w=yl(k),w.c(),ne(w,1),w.m(t,F)):w&&(vt(),_e(w,1,1,()=>{w=null}),bt()),(ge=k[1])!=null&&ge.showHeatmap&&k[0]?W?(W.p(k,M),M[0]&3&&ne(W,1)):(W=Tl(k),W.c(),ne(W,1),W.m(t,B)):W&&(vt(),_e(W,1,1,()=>{W=null}),bt());const $={};M[0]&16&&($.label=k[4].topModel),M[0]&131072&&($.value=k[17]),M[0]&65536&&($.sub=k[16]),E.$set($);const Q={};M[0]&16&&(Q.label=k[4].topTool),M[0]&32768&&(Q.value=k[15]),M[0]&16384&&(Q.sub=k[14]),D.$set(Q);const x={};M[0]&16&&(x.label=k[4].sessions),M[0]&8192&&(x.value=k[13]),J.$set(x)},i(k){H||(ne(w),ne(W),ne(E.$$.fragment,k),ne(D.$$.fragment,k),ne(J.$$.fragment,k),H=!0)},o(k){_e(w),_e(W),_e(E.$$.fragment,k),_e(D.$$.fragment,k),_e(J.$$.fragment,k),H=!1},d(k){k&&R(t),_&&_.d(),j&&j.d(),w&&w.d(),W&&W.d(),Le(E),Le(D),Le(J)}}}function dn(e){let t,l;return t=new un({props:{settings:e[1],exchangeRate:e[2]}}),t.$on("save",e[24]),t.$on("close",e[26]),{c(){Ee(t.$$.fragment)},m(n,o){Me(t,n,o),l=!0},p(n,o){const s={};o[0]&2&&(s.settings=n[1]),o[0]&4&&(s.exchangeRate=n[2]),t.$set(s)},i(n){l||(ne(t.$$.fragment,n),l=!0)},o(n){_e(t.$$.fragment,n),l=!1},d(n){Le(t,n)}}}function kl(e){let t,l;return{c(){t=v("span"),l=O(e[20]),i(t,"class","metric-cost svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&1048576&&U(l,n[20])},d(n){n&&R(t)}}}function wl(e){let t,l;return{c(){t=v("span"),l=O(e[19]),i(t,"class","metric-cost svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&524288&&U(l,n[19])},d(n){n&&R(t)}}}function yl(e){let t,l,n=e[4].tokenBreakdownToday+"",o,s,a,h;return a=new xl({props:{input:e[0].todayTokens.input,output:e[0].todayTokens.output,cacheRead:e[0].todayTokens.cacheRead,cacheWrite:e[0].todayTokens.cacheWrite,thinking:e[0].todayTokens.thinking}}),{c(){t=v("div"),l=v("div"),o=O(n),s=L(),Ee(a.$$.fragment),i(l,"class","section-title svelte-1sj3khb"),i(t,"class","section svelte-1sj3khb")},m(c,u){A(c,t,u),r(t,l),r(l,o),r(t,s),Me(a,t,null),h=!0},p(c,u){(!h||u[0]&16)&&n!==(n=c[4].tokenBreakdownToday+"")&&U(o,n);const f={};u[0]&1&&(f.input=c[0].todayTokens.input),u[0]&1&&(f.output=c[0].todayTokens.output),u[0]&1&&(f.cacheRead=c[0].todayTokens.cacheRead),u[0]&1&&(f.cacheWrite=c[0].todayTokens.cacheWrite),u[0]&1&&(f.thinking=c[0].todayTokens.thinking),a.$set(f)},i(c){h||(ne(a.$$.fragment,c),h=!0)},o(c){_e(a.$$.fragment,c),h=!1},d(c){c&&R(t),Le(a)}}}function Tl(e){var c;let t,l,n=e[4].trend+"",o,s,a,h;return a=new on({props:{data:e[0].dailyHistory,showCost:((c=e[1])==null?void 0:c.showCost)??!1,locale:e[5],currency:e[6],exchangeRate:e[2]}}),{c(){t=v("div"),l=v("div"),o=O(n),s=L(),Ee(a.$$.fragment),i(l,"class","section-title svelte-1sj3khb"),i(t,"class","section svelte-1sj3khb")},m(u,f){A(u,t,f),r(t,l),r(l,o),r(t,s),Me(a,t,null),h=!0},p(u,f){var d;(!h||f[0]&16)&&n!==(n=u[4].trend+"")&&U(o,n);const m={};f[0]&1&&(m.data=u[0].dailyHistory),f[0]&2&&(m.showCost=((d=u[1])==null?void 0:d.showCost)??!1),f[0]&32&&(m.locale=u[5]),f[0]&64&&(m.currency=u[6]),f[0]&4&&(m.exchangeRate=u[2]),a.$set(m)},i(u){h||(ne(a.$$.fragment,u),h=!0)},o(u){_e(a.$$.fragment,u),h=!1},d(u){u&&R(t),Le(a)}}}function gn(e){let t,l,n,o,s,a,h,c=e[3]&&vl(e);n=new Kl({props:{onRefresh:e[23],onClose:pn,onToggleSettings:e[25],refreshLabel:e[4].refresh,settingsLabel:e[4].settings,closeLabel:e[4].close,statusText:e[12]}});const u=[dn,hn],f=[];function m(d,g){return d[8]&&d[1]?0:1}return s=m(e),a=f[s]=u[s](e),{c(){t=v("div"),c&&c.c(),l=L(),Ee(n.$$.fragment),o=L(),a.c(),i(t,"class","panel svelte-1sj3khb"),z(t,"loading",e[7])},m(d,g){A(d,t,g),c&&c.m(t,null),r(t,l),Me(n,t,null),r(t,o),f[s].m(t,null),e[27](t),h=!0},p(d,g){d[3]?c?c.p(d,g):(c=vl(d),c.c(),c.m(t,l)):c&&(c.d(1),c=null);const y={};g[0]&256&&(y.onToggleSettings=d[25]),g[0]&16&&(y.refreshLabel=d[4].refresh),g[0]&16&&(y.settingsLabel=d[4].settings),g[0]&16&&(y.closeLabel=d[4].close),g[0]&4096&&(y.statusText=d[12]),n.$set(y);let I=s;s=m(d),s===I?f[s].p(d,g):(vt(),_e(f[I],1,1,()=>{f[I]=null}),bt(),a=f[s],a?a.p(d,g):(a=f[s]=u[s](d),a.c()),ne(a,1),a.m(t,null)),(!h||g[0]&128)&&z(t,"loading",d[7])},i(d){h||(ne(n.$$.fragment,d),ne(a),h=!0)},o(d){_e(n.$$.fragment,d),_e(a),h=!1},d(d){d&&R(t),c&&c.d(),Le(n),f[s].d(),e[27](null)}}}function _n(){return typeof navigator<"u"&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Cl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function mn(e){return e.replace(/^(claude-|gpt-|gemini-|deepseek-|qwen-)/i,"").replace(/-\d{8}$/,"")}function pn(){window.widget.hideWindow()}function vn(e,t,l){let n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C=null,G=null,P=null,F=_n(),B=!0,N=!1,E,T=0,D=null,K=null;function J(k){return o.lastNDays(k)}function H(k){const M=new Date(k),$=String(M.getHours()).padStart(2,"0"),Q=String(M.getMinutes()).padStart(2,"0");return o.syncedAt(`${$}:${Q}`)}async function _(){l(7,B=!0),l(0,C=await window.widget.getData()),l(7,B=!1)}async function j(){l(1,G=await window.widget.getSettings())}async function w(){l(2,P=await window.widget.getExchangeRate())}async function W(k){l(1,G=await window.widget.saveSettings(k.detail)),_()}function me(){if(!E)return;const k=Math.ceil(E.getBoundingClientRect().height);k<=0||Math.abs(k-T)<2||(T=k,window.widget.resizeWindow(k))}Ml(()=>{_(),j(),w(),window.widget.onDataUpdate(M=>{l(0,C=M),l(7,B=!1)}),window.widget.onInstallStatus(M=>{l(3,D=M.phase),l(10,K=M.error??null),(M.phase==="done"||M.phase==="failed")&&setTimeout(()=>{l(3,D=null),l(10,K=null)},3e3)});const k=new ResizeObserver(()=>me());return k.observe(E),Rt().then(me),()=>k.disconnect()}),Il(()=>{Rt().then(me)});const we=()=>{l(8,N=!N)},S=()=>{l(8,N=!1)};function le(k){_t[k?"unshift":"push"](()=>{E=k,l(9,E)})}return e.$$.update=()=>{var k;e.$$.dirty[0]&2&&l(5,n=(G==null?void 0:G.locale)??F),e.$$.dirty[0]&32&&l(4,o=Fl(n)),e.$$.dirty[0]&2&&l(6,s=(G==null?void 0:G.currency)??"USD"),e.$$.dirty[0]&1&&l(22,a=C?Cl(C.todayTokens.total):"--"),e.$$.dirty[0]&1&&l(21,h=C?Cl(C.rangeTokens.total):"--"),e.$$.dirty[0]&101&&l(20,c=C?kt(C.todayCost,s,n,P):"--"),e.$$.dirty[0]&101&&l(19,u=C?kt(C.rangeCost,s,n,P):"--"),e.$$.dirty[0]&17&&l(18,f=C?J(C.rangeDays):o.lastNDays(30)),e.$$.dirty[0]&1&&l(17,m=C!=null&&C.topModel?mn(C.topModel.name):"--"),e.$$.dirty[0]&1&&l(16,d=C!=null&&C.topModel?`${C.topModel.share}%`:""),e.$$.dirty[0]&1&&l(15,g=((k=C==null?void 0:C.topTool)==null?void 0:k.name)??"--"),e.$$.dirty[0]&1&&l(14,y=C!=null&&C.topTool?`${C.topTool.share}%`:""),e.$$.dirty[0]&1&&l(13,I=C?String(C.sessionCountToday):"--"),e.$$.dirty[0]&1&&l(12,V=C?H(C.lastUpdated):""),e.$$.dirty[0]&24&&l(11,X=D==="installing"?o.installInstalling:D==="launching"?o.installLaunching:D==="done"?o.installDone:D==="failed"?o.installFailed:o.installPreparing)},[C,G,P,D,o,n,s,B,N,E,K,X,V,I,y,g,d,m,f,u,c,h,a,_,W,we,S,le]}class bn extends Ye{constructor(t){super(),Ke(this,t,vn,gn,Ge,{},null,[-1,-1])}}new bn({target:document.getElementById("app")});