@kenz1117/dsh-ui-usage-billing 1.8.9 → 1.8.10
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.
- package/README.en.md +5 -5
- package/README.md +15 -14
- package/lib/client.js +5 -5
- package/lib/index.js +195 -1
- package/lib/types/client/footer-lane.d.ts +65 -0
- package/lib/types/guard.d.ts +17 -0
- package/package.json +67 -65
package/lib/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:`@kenz1117/dsh-ui-usage-billing`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},u=(e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule||!c.call(e,`default`)?i(n,`default`,{value:e,enumerable:!0}):n,e));let d=e("react"),f=e("react-dom"),p=e("@deepseek-ai/dsh-client-ui-primitives");p=u(p,1);let m=e("react/jsx-runtime"),h=e("@deepseek-ai/dsh-client-store");function g(e){return e}function _(e){return g(e)}function v(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=v(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function y(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=v(e))&&(r&&(r+=` `),r+=t);return r}let b=new Map;function x(e,t){let n=Date.now(),r=b.get(e);if(!(r!==void 0&&n-r<3e5)){if(b.set(e,n),t===void 0){console.info(`[usage-billing] swallowed: ${e}`);return}console.info(`[usage-billing] swallowed: ${e}`,t instanceof Error?t.message:t)}}function S(e,t){try{localStorage.setItem(e,t)}catch{x(`display-pref-write-failed`)}}function C(e){try{return localStorage.getItem(e)??void 0}catch{return}}function w(e){let t=C(e);if(t!==void 0)try{return JSON.parse(t)}catch{return}}let T={mode:`combined`,targets:[]},E=`dsh.ui-usage-billing.float`;function ee(){let e=()=>({...T,targets:[...T.targets]}),t=w(E);if(typeof t!=`object`||!t)return e();let n=t;return{mode:n.mode===`subscription`?`subscription`:`combined`,targets:Array.isArray(n.targets)?n.targets.filter(e=>typeof e==`string`):[]}}function te(e){S(E,JSON.stringify(e))}let D={mode:`full`,metric:`money`,span:`day`,showDelta:!0},O=`dsh.ui-usage-billing.card`,ne=`dsh.ui-usage-billing.card-changed`;function k(){let e=w(O);if(typeof e!=`object`||!e)return{...D};let t=e;return{mode:t.mode===`compact`||t.mode===`hidden`?t.mode:`full`,metric:t.metric===`tokens`?`tokens`:`money`,span:t.span===`week`||t.span===`month`?t.span:`day`,showDelta:t.showDelta!==!1}}function A(e){S(O,JSON.stringify(e))}function j(e){let t=t=>{t.key===`dsh.ui-usage-billing.card`&&e()};return window.addEventListener(ne,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(ne,e),window.removeEventListener(`storage`,t)}}function M(e,t){return e===`hidden`&&!t?`compact`:e}let re=`dsh.ui-usage-billing.kpi-range`,N=`dsh.ui-usage-billing.kpi-custom-range`;function ie(){let e=C(re);return e===`today`||e===`7d`||e===`week`||e===`month`||e===`all`||e===`custom`?e:`all`}function ae(e){S(re,e)}function oe(){let e=new Date;e.setDate(e.getDate()-1);let t=e=>String(e).padStart(2,`0`),n=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`;return{start:n,end:n}}function se(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=Number(e.slice(0,4)),n=Number(e.slice(5,7)),r=Number(e.slice(8,10));return t<1e3||n<1||n>12||r<1?!1:r<=new Date(t,n,0).getDate()}function ce(){let e=w(N);if(typeof e==`object`&&e){let t=e;if(se(t.start)&&se(t.end)&&t.start<=t.end)return{start:t.start,end:t.end}}return oe()}function le(e){S(N,JSON.stringify(e))}let ue={hideUnidentified:!0},de=`dsh.ui-usage-billing.sites`;function fe(){let e=w(de);return typeof e!=`object`||!e?{...ue}:{hideUnidentified:e.hideUnidentified!==!1}}function pe(e){S(de,JSON.stringify(e))}let me={hidden:[]},he=`dsh.ui-usage-billing.channels`;function ge(){let e=w(he);if(typeof e!=`object`||!e)return{...me};let t=e.hidden;return Array.isArray(t)?{hidden:t.filter(e=>typeof e==`string`&&e!==``)}:{...me}}function _e(e){S(he,JSON.stringify(e))}let ve={show:!0,position:`toolbar`},ye=`dsh.ui-usage-billing.livecost`,be=`dsh.ui-usage-billing.livecost-pref`;function xe(){let e=w(ye);if(typeof e!=`object`||!e)return{...ve};let t=e;return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`||t.position===`below`?t.position:ve.position}}function Se(e){S(ye,JSON.stringify(e))}let Ce=`dsh.ui-usage-billing.currency`,we=`dsh.ui-usage-billing.currency-pref`;function Te(){let e=C(Ce);return e===`usd`||e===`cny`||e===`eur`?e:`cny`}function Ee(e){S(Ce,e)}let De=`dsh.ui-usage-billing.pinned`,Oe=`dsh.ui-usage-billing.pinned-pref`;function ke(){let e=w(De);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[]}function Ae(e){S(De,JSON.stringify(e))}let P=`dsh.ui-usage-billing.provider-expanded`;function je(){let e=w(P);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&/^(ch|sub|bal):/.test(e)):[]}function Me(e){S(P,JSON.stringify(e))}let F=`dsh.ui-usage-billing.providers-today`;function Ne(){return C(F)===`1`}function Pe(e){S(F,e?`1`:`0`)}let Fe=`dsh.ui-usage-billing.language`;function Ie(){let e=C(Fe);if(e===`en`||e===`zh`)return e;let t=Te()===`usd`?`en`:`zh`;return Le(t),t}function Le(e){S(Fe,e)}function Re(e){let t=ke(),n=t.includes(e)?t.filter(t=>t!==e):[...t,e];return Ae(n),n}let ze=`dsh.ui-usage-billing.prices`;function Be(){let e=w(ze);if(e==null)return[];let t=[],n=(e,n)=>{if(typeof n!=`object`||!n)return;let r=n,i=Number(r.input),a=Number(r.cacheHit),o=Number(r.output);if(![i,a,o].every(e=>Number.isFinite(e)&&e>=0))return;let s=r.offPeak,c;if(typeof s==`object`&&s){let e=s,t=Number(e.input),n=Number(e.cacheHit),r=Number(e.output);[t,n,r].every(e=>Number.isFinite(e)&&e>=0)&&(c={input:t,cacheHit:n,output:r})}t.push({key:e,...typeof r.origin==`string`&&r.origin!==``?{origin:r.origin}:{},input:i,cacheHit:a,output:o,...c===void 0?{}:{offPeak:c},...r.currency===`USD`?{currency:`USD`}:{}})};if(Array.isArray(e))for(let t of e){if(typeof t!=`object`||!t)continue;let e=t;typeof e.key==`string`&&e.key!==``&&n(e.key,t)}else if(typeof e==`object`)for(let[t,r]of Object.entries(e))n(t,r);return t}function Ve(e){S(ze,JSON.stringify(e))}let He={metric:`ttft`},Ue=`dsh.ui-usage-billing.perf`;function We(){let e=w(Ue);if(typeof e!=`object`||!e)return{...He};let t=e;return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}function Ge(e){S(Ue,JSON.stringify(e))}let Ke=`dsh.ui-usage-billing.density`,I=`dsh.ui-usage-billing.density-pref`;function qe(){let e=C(Ke);return e===`compact`||e===`comfortable`?e:`default`}function L(e){S(Ke,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(I,{detail:{density:e}}))}let Je=`dsh.ui-usage-billing.motion`,Ye=`dsh.ui-usage-billing.motion-pref`;function Xe(){let e=C(Je);return e===`off`||e===`subtle`?e:`rich`}function Ze(e){S(Je,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(Ye,{detail:{motion:e}}))}let Qe={enabled:!1,clearAfterEnqueue:!1,showEntry:!0,reuseSourceSession:!1},$e=`dsh.ui-usage-billing.quick-queue`,et=`dsh.ui-usage-billing.quick-queue-pref`;function tt(){let e=w($e);if(typeof e!=`object`||!e)return{...Qe};let t=e;return{enabled:t.enabled===!0,clearAfterEnqueue:t.clearAfterEnqueue===!0,showEntry:t.showEntry!==!1,reuseSourceSession:t.reuseSourceSession===!0}}function nt(e){S($e,JSON.stringify({...tt(),...e})),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(et))}let rt=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(rt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=rt,e.textContent=`:root{--ds-blue:#4f8cff;--ds-cyan:#2dd4bf;--ds-green:#34d399;--ds-amber:#f59e0b;--ds-red:#ef4444;--ds-violet:#a78bfa;--ds-violet-soft:color-mix(in srgb, var(--ds-violet) 14%, transparent);--ds-violet-bg:color-mix(in srgb, var(--ds-violet) 8%, transparent);--ds-violet-strong:color-mix(in srgb, var(--ds-violet) 60%, transparent);--font-num:"JetBrains Mono", "SF Mono", "Menlo", "Consolas", ui-monospace, monospace;--mono:var(--font-num)}body{--dsb:var(--dsw-alias-bg-layer-1);--dsb-2:var(--dsw-alias-bg-layer-2);--dsb-3:var(--dsw-alias-bg-layer-3);--dsb-glass:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 78%,transparent);--dsb-glass-strong:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 88%,transparent);--ds-border:var(--dsw-alias-border-l1);--ds-border-strong:var(--dsw-alias-border-l2);--ds-hi-top:#ffffff0b;--ds-shadow-1:0 1px 0 #ffffff0a inset,0 8px 24px #00000059;--ds-shadow-2:0 1px 0 #ffffff0d inset,0 18px 48px #00000080;--ds-t-1:var(--dsw-alias-label-primary);--ds-t-2:var(--dsw-alias-label-secondary);--ds-t-3:var(--dsw-alias-label-tertiary);--ds-t-4:var(--dsw-alias-label-dimmed);--ds-c-1:#4f8cff;--ds-c-2:#2dd4bf;--ds-c-3:#a78bfa;--ds-c-4:#f59e0b;--ds-c-5:#f472b6;--ds-c-6:#fbbf24;--ds-c-7:#38bdf8;--ds-r-1:8px;--ds-r-2:12px;--ds-r-3:16px;--ds-t-fast:.16s cubic-bezier(.2,.8,.2,1);--ds-t-enter:.24s cubic-bezier(.2,.8,.2,1);--ds-t-pulse:1.2s cubic-bezier(.2,.8,.2,1);--ds-t-countup:.4s cubic-bezier(.22,1,.36,1);--ds-t-scan:.9s cubic-bezier(.2,.8,.2,1);--ds-density-pad-y:10px;--ds-density-pad-x:14px;--ds-density-row-h:32px;--ds-density-font:12px}[data-dsh-billing-density=compact]{--ds-density-pad-y:6px;--ds-density-pad-x:10px;--ds-density-row-h:26px;--ds-density-font:11.5px}[data-dsh-billing-density=comfortable]{--ds-density-pad-y:14px;--ds-density-pad-x:18px;--ds-density-row-h:40px;--ds-density-font:13px}[data-dsh-billing-density=compact] .KFXqYa_panel{padding:8px 10px}[data-dsh-billing-density=compact] .KFXqYa_kpiTile{padding:10px 12px}[data-dsh-billing-density=compact] .KFXqYa_setCard{padding:10px 12px}[data-dsh-billing-density=compact] .KFXqYa_ubCard{padding:10px 12px}[data-dsh-billing-density=compact] .KFXqYa_providerGroup{padding:8px 10px}[data-dsh-billing-density=compact] .KFXqYa_providerStatRow{gap:8px;padding:6px 8px}[data-dsh-billing-density=compact] .KFXqYa_modelTable th,[data-dsh-billing-density=compact] .KFXqYa_modelTable td{padding:6px 8px}[data-dsh-billing-density=compact] .KFXqYa_ubTable th,[data-dsh-billing-density=compact] .KFXqYa_ubTable td{padding:4px 7px}[data-dsh-billing-density=compact] .KFXqYa_dashboardBody{gap:10px;padding:12px 16px 16px}[data-dsh-billing-density=compact] .KFXqYa_tabNav{margin:10px 16px 0}[data-dsh-billing-density=compact] .KFXqYa_hero{gap:8px;padding:12px 14px}[data-dsh-billing-density=compact] .KFXqYa_heroValue{font-size:42px;line-height:46px}[data-dsh-billing-density=comfortable] .KFXqYa_panel{padding:16px 18px}[data-dsh-billing-density=comfortable] .KFXqYa_kpiTile{padding:18px 20px}[data-dsh-billing-density=comfortable] .KFXqYa_setCard{padding:20px 22px}[data-dsh-billing-density=comfortable] .KFXqYa_ubCard{padding:20px 22px}[data-dsh-billing-density=comfortable] .KFXqYa_providerGroup{padding:16px 18px}[data-dsh-billing-density=comfortable] .KFXqYa_providerStatRow{gap:14px;padding:14px 16px}[data-dsh-billing-density=comfortable] .KFXqYa_modelTable th,[data-dsh-billing-density=comfortable] .KFXqYa_modelTable td{padding:13px 14px}[data-dsh-billing-density=comfortable] .KFXqYa_ubTable th,[data-dsh-billing-density=comfortable] .KFXqYa_ubTable td{padding:10px 12px}[data-dsh-billing-density=comfortable] .KFXqYa_dashboardBody{gap:18px;padding:20px 28px 28px}[data-dsh-billing-density=comfortable] .KFXqYa_hero{gap:16px;padding:22px 24px}[data-dsh-billing-density=comfortable] .KFXqYa_heroValue{font-size:56px;line-height:60px}.KFXqYa_railButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);width:36px;height:36px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast);flex:none;justify-content:center;align-items:center;padding:0;display:flex}.KFXqYa_railButton:hover,.KFXqYa_railButton:focus-visible{border-color:var(--ds-blue);color:var(--ds-blue);outline:none}.KFXqYa_railButton svg{width:26px;height:26px}.KFXqYa_triggerBudgetPulse{border-color:color-mix(in srgb, var(--ds-red) 55%, transparent);animation:2s ease-in-out infinite KFXqYa_budgetPulse}.KFXqYa_triggerBudgetOver{animation-duration:1.2s}@keyframes KFXqYa_budgetPulse{0%,to{box-shadow:0 1px 2px #0000000a,0 0 #ef444400}50%{box-shadow:0 1px 2px #0000000a,0 0 0 3px #ef444429}}.KFXqYa_trigger{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:100%;min-width:0;color:var(--ds-t-1);cursor:pointer;text-align:left;transition:border-color var(--ds-t-fast), transform var(--ds-t-fast), box-shadow var(--ds-t-fast);align-items:center;gap:12px;padding:10px 14px;display:flex;position:relative;overflow:hidden;box-shadow:0 1px 2px #0000000a}.KFXqYa_trigger:hover,.KFXqYa_trigger:focus-visible{border-color:var(--ds-border-strong);box-shadow:0 6px 18px -8px color-mix(in srgb, var(--ds-blue) 45%, transparent);outline:none;transform:translateY(-1px)}.KFXqYa_trigger:before{content:"";background:linear-gradient(180deg, var(--ds-hi-top), transparent);pointer-events:none;height:1px;position:absolute;top:0;left:0;right:0}.KFXqYa_trigger:after{content:"";background:linear-gradient(105deg, transparent 42%, color-mix(in srgb, var(--ds-blue) 9%, transparent) 50%, transparent 58%);opacity:0;pointer-events:none;position:absolute;inset:0;transform:translate(-110%)}.KFXqYa_trigger:hover:after,.KFXqYa_trigger:focus-visible:after{animation:.9s ease-out KFXqYa_triggerScan}@keyframes KFXqYa_triggerScan{0%{opacity:0;transform:translate(-110%)}25%{opacity:1}to{opacity:0;transform:translate(110%)}}@media (prefers-reduced-motion:reduce){.KFXqYa_triggerSparkBar,.KFXqYa_trigger:hover:after,.KFXqYa_trigger:focus-visible:after{animation:none}.KFXqYa_triggerGaugeNeedle,.KFXqYa_triggerGaugeArc{transition:none}.KFXqYa_triggerBudgetPulse,.KFXqYa_dashboardModal,.KFXqYa_tabPanel,.KFXqYa_peakAlertPop{animation:none}.KFXqYa_kpiTile,.KFXqYa_heroGaugeArc,.KFXqYa_chartLine,.KFXqYa_chartArea{transition:none;animation:none}}[data-dsh-billing-motion=off] .dsh-billing-root,[data-dsh-billing-motion=off] .dsh-billing-root *,[data-dsh-billing-motion=off] .dsh-billing-root :before,[data-dsh-billing-motion=off] .dsh-billing-root :after{transition:none!important;animation:none!important}[data-dsh-billing-motion=subtle] .dsh-billing-root,[data-dsh-billing-motion=subtle] .dsh-billing-root *,[data-dsh-billing-motion=subtle] .dsh-billing-root :before,[data-dsh-billing-motion=subtle] .dsh-billing-root :after{animation-duration:.001ms!important;animation-iteration-count:1!important}.KFXqYa_triggerIcon{width:32px;height:32px;color:var(--ds-blue);flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_triggerIcon svg{width:30px;height:30px}.KFXqYa_triggerGaugeNeedle{transition:transform 1.1s cubic-bezier(.22,1,.36,1)}.KFXqYa_triggerGaugeArc{transition:stroke-dasharray 1.1s cubic-bezier(.22,1,.36,1)}.KFXqYa_triggerBudgetHot,.KFXqYa_triggerStatsError{color:var(--ds-red)}.KFXqYa_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.KFXqYa_triggerPrimary{flex-direction:column;gap:1px;min-width:0;display:flex}.KFXqYa_triggerValueRow{align-items:baseline;gap:2px;min-width:0;display:flex}.KFXqYa_triggerLabel{color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.KFXqYa_triggerYen{color:var(--ds-t-3);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.KFXqYa_triggerMetric{color:var(--ds-t-1);font-size:22px;font-weight:600;line-height:26px;font-family:var(--font-num);font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.KFXqYa_triggerDelta{font-size:10px;font-weight:600;font-family:var(--font-num);font-variant-numeric:tabular-nums;border-radius:999px;flex:none;align-self:flex-start;align-items:center;gap:1px;padding:1px 5px;display:inline-flex}.KFXqYa_triggerDeltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 14%, transparent)}.KFXqYa_triggerDeltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 14%, transparent)}.KFXqYa_triggerGlow{background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--ds-blue) 40%, transparent), transparent);opacity:0;height:1px;animation:KFXqYa_triggerGlowPulse var(--ds-t-pulse) ease-out 1;position:absolute;bottom:4px;left:0;right:0}@keyframes KFXqYa_triggerGlowPulse{0%{opacity:0;transform:translate(-30%)}30%{opacity:1}to{opacity:0;transform:translate(30%)}}.KFXqYa_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.KFXqYa_triggerSparkBar,.KFXqYa_triggerSparkHot{background:var(--ds-blue);opacity:.6;border-radius:1px 1px 0 0;width:3px}.KFXqYa_triggerSparkHot{opacity:1}.KFXqYa_triggerSparkBar{animation:3.6s ease-in-out infinite KFXqYa_triggerSparkBreath}.KFXqYa_triggerSparkBar:nth-child(2n){animation-delay:-1.2s}.KFXqYa_triggerSparkBar:nth-child(3n){animation-delay:-2.4s}@keyframes KFXqYa_triggerSparkBreath{0%,to{opacity:.6}50%{opacity:.34}}.KFXqYa_triggerWrap{flex:auto;width:100%;min-width:96px;max-width:100%;display:block;position:relative;container:KFXqYa_billing-trigger/inline-size}@container KFXqYa_billing-trigger (width<=210px){.KFXqYa_trigger{box-shadow:none;-webkit-backdrop-filter:none;background:0 0;border:none;border-radius:12px;padding:7px 8px}.KFXqYa_trigger:before,.KFXqYa_trigger:after{display:none}.KFXqYa_trigger:hover,.KFXqYa_trigger:focus-visible{background:var(--dsw-alias-interactive-bg-hover);box-shadow:none;border-color:#0000;transform:none}.KFXqYa_triggerSpark,.KFXqYa_triggerLabel{display:none}}@container KFXqYa_billing-trigger (width<=140px){.KFXqYa_triggerMain{display:none}}.KFXqYa_triggerPop{box-sizing:border-box;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:256px;box-shadow:var(--ds-shadow-2);opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear .16s;z-index:2000;flex-direction:column;gap:5px;padding:10px 12px;display:flex;position:fixed;top:0;left:0;overflow:hidden;transform:translateY(calc(4px - 100%))}.KFXqYa_triggerPop,.KFXqYa_triggerPop *{box-sizing:border-box}.KFXqYa_triggerPop:before{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.KFXqYa_triggerPopShown{opacity:1;visibility:visible;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear 0s;transform:translateY(-100%)}.KFXqYa_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.KFXqYa_popTitle{letter-spacing:.06em;text-transform:uppercase;color:var(--ds-t-3);font-size:12px;font-weight:700;line-height:18px}.KFXqYa_popError{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-red) 30%, transparent);border-radius:8px;flex-direction:column;gap:2px;margin:2px 0 8px;padding:6px 8px;font-size:11px;line-height:15px;display:flex}.KFXqYa_popErrorDetail{color:var(--ds-t-3);word-break:break-word}.KFXqYa_popErrorTitle{font-weight:600}.KFXqYa_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 12px;display:grid}.KFXqYa_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_metricLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.KFXqYa_metricValue{color:var(--ds-t-1);font-size:13px;font-weight:700;line-height:16px;font-family:var(--font-num);font-variant-numeric:tabular-nums;white-space:nowrap}.KFXqYa_metricValueSuccess{color:var(--ds-green)}.KFXqYa_popModel{border-top:1px dashed var(--ds-border);flex-direction:column;gap:6px;margin-top:9px;padding-top:10px;display:flex}.KFXqYa_popModelLabel{color:var(--ds-t-3);font-size:10px;line-height:14px}.KFXqYa_popModelRow{align-items:center;gap:8px;min-width:0;display:flex}.KFXqYa_popDot{border-radius:999px;flex:none;width:6px;height:6px}.KFXqYa_popDotDirect{background:var(--ds-green)}.KFXqYa_popDotSub{background:var(--ds-amber)}.KFXqYa_popDotNeutral{background:var(--ds-t-3)}.KFXqYa_popTagPrimary,.KFXqYa_popTagSub{white-space:nowrap;border-radius:5px;flex:none;align-items:center;height:18px;padding:0 6px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_popTagPrimary{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-blue)}.KFXqYa_popTagSub{background:color-mix(in srgb, var(--ds-amber) 18%, transparent);color:var(--ds-amber)}.KFXqYa_popModelName{color:var(--ds-t-2);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.KFXqYa_popModelStatus{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;margin-left:auto;font-size:11px;font-weight:600;line-height:16px}.KFXqYa_popModelStatusLow{color:var(--ds-red)}.KFXqYa_dashboardModal{border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-2);width:min(760px,100vw - 48px);height:min(760px,88vh);box-shadow:var(--ds-shadow-2);animation:.16s ease-out KFXqYa_dashboardIn}@keyframes KFXqYa_dashboardIn{0%{opacity:0;transform:translateY(4px)scale(.98)}to{opacity:1;transform:none}}div[role=presentation]:has(>.dsh-billing-modal)>div[aria-hidden=true]:first-child{backdrop-filter:blur(8px)saturate(1.25)}.KFXqYa_dashboard{flex-direction:column;width:100%;height:100%;min-height:0;display:flex}.KFXqYa_dashboardHead{border-bottom:1px solid var(--ds-border);border-bottom:1px solid var(--ds-border);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.KFXqYa_dashboardTitle{color:var(--ds-t-1);margin:0;font-size:14px;font-weight:600;line-height:20px}.KFXqYa_dashboardSubtitle{color:var(--ds-t-3);margin:2px 0 0;font-size:11px;line-height:16px}.KFXqYa_closeButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);width:32px;height:32px;color:var(--ds-t-2);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_closeButton:hover{background:var(--dsb-3);color:var(--ds-t-1)}.KFXqYa_closeButton svg{stroke-width:2px;width:16px;height:16px}.KFXqYa_dashboardBody{flex-direction:column;flex:auto;gap:14px;min-height:0;padding:16px 24px 24px;display:flex;overflow-y:auto}.KFXqYa_nativeSettingsRoot{width:100%;min-width:0}.KFXqYa_nativeSettingsDashboard{height:auto}.KFXqYa_dashboardBody.KFXqYa_nativeSettingsBody{flex:none;padding:0;overflow:visible}.KFXqYa_settingsLayout.KFXqYa_nativeSettingsLayout{grid-template-columns:minmax(0,1fr)}.KFXqYa_modalFooter{border-top:1px solid var(--ds-border);color:var(--ds-t-3);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 18px;font-size:11px;line-height:16px;display:flex}.KFXqYa_tabRail{background:var(--dsb);border:1px solid var(--ds-border);border-radius:var(--ds-r-2);flex-direction:column;align-self:start;gap:2px;max-height:min(720px,88vh - 80px);padding:6px;display:flex;position:sticky;top:0;overflow-y:auto}.KFXqYa_tabNav{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);align-items:center;gap:4px;margin:14px 24px 0;padding:4px;display:flex}.KFXqYa_tabButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast), box-shadow var(--ds-t-fast);background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;padding:6px 10px 6px 12px;font-size:12px;font-weight:500;line-height:16px;display:flex}.KFXqYa_tabButton:hover{color:var(--ds-t-2)}.KFXqYa_tabButton:focus-visible{box-shadow:0 0 0 1px var(--ds-border-strong);color:var(--ds-t-2);outline:none}.KFXqYa_tabButtonActive,.KFXqYa_tabButtonActive:hover,.KFXqYa_tabButtonActive:focus-visible{background:var(--dsb-3);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong) inset;font-weight:600}.KFXqYa_tabButton>.KFXqYa_tabRailIcon,.KFXqYa_tabButton>.KFXqYa_tabRailIcon svg{width:12px;height:12px}.KFXqYa_tabNavLabel{line-height:16px}.KFXqYa_tabRailItem{color:var(--ds-t-2);cursor:pointer;text-align:left;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:8px;align-items:center;gap:10px;padding:9px 12px;font-family:inherit;font-size:12.5px;display:flex;position:relative}.KFXqYa_tabRailItem:hover{background:var(--dsb-3);color:var(--ds-t-1)}.KFXqYa_tabRailItem:focus-visible{box-shadow:0 0 0 1.5px var(--ds-border-strong);outline:none}.KFXqYa_tabRailItemActive,.KFXqYa_tabRailItemActive:hover{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-t-1);font-weight:600}.KFXqYa_tabRailItemActive:before{content:"";background:var(--ds-blue);border-radius:0 2px 2px 0;width:2px;position:absolute;top:8px;bottom:8px;left:0}.KFXqYa_tabRailIcon{width:14px;height:14px;color:var(--ds-t-3);flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_tabRailItemActive .KFXqYa_tabRailIcon{color:var(--ds-blue)}.KFXqYa_tabRailIcon svg{width:14px;height:14px}.KFXqYa_tabRailLabel{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.KFXqYa_tabBadge{background:var(--dsb-3);color:var(--ds-t-3)}.KFXqYa_tabBadgeWarn{background:color-mix(in srgb, var(--ds-amber) 18%, transparent);color:var(--ds-amber)}.KFXqYa_tabBadgeHot{background:color-mix(in srgb, var(--ds-red) 18%, transparent);color:var(--ds-red)}.KFXqYa_tabBadgeViolet{background:var(--ds-violet-soft);color:var(--ds-violet)}.KFXqYa_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out KFXqYa_tabPanelIn;display:flex}.KFXqYa_dashboardBody>*,.KFXqYa_tabPanel>*,.KFXqYa_agentSummary,.KFXqYa_agentRow{flex-shrink:0}@keyframes KFXqYa_tabPanelIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.KFXqYa_reconcileNotice{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 78%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 62%, transparent);color:var(--dsw-alias-label-secondary);border-radius:10px;align-items:flex-start;gap:10px;padding:10px 12px;font-size:12px;line-height:1.55;display:flex}.KFXqYa_reconcileIcon{color:var(--dsw-alias-label-tertiary);flex:none;margin-top:1px;display:inline-flex}.KFXqYa_reconcileText{flex:1}.KFXqYa_reconcileDismiss{color:var(--dsw-alias-label-tertiary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 8px;font-size:12px;line-height:1.4;transition:color .15s,background-color .15s}.KFXqYa_reconcileDismiss:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.KFXqYa_hero{border:1px solid var(--ds-border);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);flex-direction:column;gap:12px;padding:18px 20px;display:flex;position:relative;overflow:hidden}.KFXqYa_hero:after{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.KFXqYa_heroTop{justify-content:space-between;align-items:center;gap:24px;display:flex}.KFXqYa_heroMain{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_heroLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:11px;font-weight:500;line-height:15px}.KFXqYa_heroReadout{align-items:baseline;gap:4px;display:flex}.KFXqYa_heroCurrency{font-family:var(--font-num);letter-spacing:-.01em;color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:22px;font-weight:600;line-height:26px}.KFXqYa_heroValue{font-family:var(--font-num);letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--ds-t-1);font-size:52px;font-weight:600;line-height:56px}.KFXqYa_heroMeta{color:var(--ds-t-2);white-space:nowrap;margin-top:2px;font-size:12px;line-height:16px}.KFXqYa_heroGauge{flex-direction:column;flex:none;align-items:center;gap:4px;width:96px;display:flex}.KFXqYa_heroGaugeDial{flex:none;width:96px;height:96px;position:relative}.KFXqYa_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.KFXqYa_heroGaugeTrack{fill:none;stroke:var(--dsb-3);stroke-width:7px}.KFXqYa_heroGaugeArc{fill:none;stroke:var(--ds-blue);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray var(--ds-t-fast)}.KFXqYa_heroGaugeArcOver{stroke:var(--ds-red)}.KFXqYa_heroPred{color:var(--ds-t-3);font-size:11px;font-family:var(--font-num);margin-left:8px}.KFXqYa_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.KFXqYa_heroGaugeRemain{font-family:var(--font-num);letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--ds-t-1);font-size:16px;font-weight:600;line-height:18px}.KFXqYa_heroGaugeRemainOver{color:var(--ds-red)}.KFXqYa_heroGaugeLabel{color:var(--ds-t-3);font-size:11px;line-height:13px}.KFXqYa_heroGaugeSub{font-family:var(--font-num);font-variant-numeric:tabular-nums;color:var(--ds-t-2);white-space:nowrap;font-size:10px;line-height:12px}.KFXqYa_heroSide{border-top:1px solid var(--ds-border);align-items:stretch;padding-top:12px;display:flex}.KFXqYa_heroSideItem{border-left:1px solid var(--ds-border);flex-direction:column;flex:1;gap:2px;min-width:0;padding-left:14px;display:flex}.KFXqYa_heroSideItem:first-child{border-left:none;padding-left:0}.KFXqYa_heroSideLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:13px}.KFXqYa_heroSideValue{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;white-space:nowrap;align-items:baseline;gap:6px;font-size:15px;font-weight:600;line-height:20px;display:inline-flex}.KFXqYa_heroSideSpacer{flex:1;display:block}.KFXqYa_delta{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:2px;margin-left:6px;padding:1px 7px;font-size:10.5px;font-weight:600;line-height:16px;display:inline-flex}.KFXqYa_deltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.KFXqYa_deltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_unpricedHint{border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);background:color-mix(in srgb, var(--ds-amber) 8%, transparent);color:var(--ds-amber);border-radius:8px;align-items:center;gap:8px;padding:8px 12px;font-size:11.5px;font-weight:500;line-height:17px;display:flex}.KFXqYa_unpricedHintBody{flex:1;min-width:0}.KFXqYa_channelVisList{flex-direction:column;gap:6px;display:flex}.KFXqYa_channelVisCell{grid-column:1/-1}.KFXqYa_channelVisRow{align-items:center;gap:8px;min-width:0;display:flex}.KFXqYa_channelVisName{overflow-wrap:anywhere;flex:auto;min-width:0;font-size:12px;line-height:16px}.KFXqYa_channelVisUsage{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px}.KFXqYa_noticeAction{border:1px solid color-mix(in srgb, currentColor 35%, transparent);color:inherit;font:inherit;cursor:pointer;transition:background-color var(--ds-t-fast);background:0 0;border-radius:6px;flex:none;padding:1px 8px;font-size:11px;line-height:15px}.KFXqYa_noticeAction:hover,.KFXqYa_noticeAction:focus-visible{background:color-mix(in srgb, currentColor 12%, transparent);outline:none}.KFXqYa_noticeDismiss{width:18px;height:18px;color:inherit;opacity:.55;cursor:pointer;transition:opacity var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border:0;border-radius:999px;flex:none;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.KFXqYa_noticeDismiss:hover,.KFXqYa_noticeDismiss:focus-visible{opacity:1;background:color-mix(in srgb, currentColor 14%, transparent);outline:none}.KFXqYa_kpiZone{flex-direction:column;gap:8px;display:flex}.KFXqYa_kpiZoneHead{justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_kpiZoneLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.KFXqYa_kpiCustomRange{flex-wrap:wrap;flex-shrink:0;justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_kpiCustomRange label{color:var(--ds-t-3);align-items:center;gap:6px;font-size:11px;line-height:14px;display:inline-flex}.KFXqYa_kpiCustomRange input{border:1px solid var(--ds-border);background:var(--dsb-glass);min-height:28px;color:var(--ds-t-1);color-scheme:light dark;font:inherit;font-family:var(--font-num);border-radius:6px;padding:3px 7px;font-size:11px}.KFXqYa_kpiCustomRange input:focus-visible{outline:2px solid var(--ds-blue);outline-offset:2px}.KFXqYa_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.KFXqYa_kpiTile{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:2px;padding:14px 16px;display:flex;position:relative;overflow:hidden}.KFXqYa_kpiTile:hover{border-color:var(--ds-border-strong)}.KFXqYa_kpiLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:500;line-height:14px}.KFXqYa_kpiValue{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;margin-top:6px;font-size:22px;font-weight:600;line-height:26px}.KFXqYa_kpiGreen{color:var(--ds-green)}.KFXqYa_kpiDetail{font-family:var(--font-num);color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;font-size:11px;line-height:15px;overflow:hidden}.KFXqYa_kpiLabelRow{justify-content:space-between;align-items:center;gap:6px;display:flex}.KFXqYa_kpiDelta{font-size:10px;font-weight:600;font-family:var(--font-num);font-variant-numeric:tabular-nums;border-radius:999px;flex:none;align-items:center;gap:2px;padding:1px 5px;display:inline-flex}.KFXqYa_kpiDeltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 14%, transparent)}.KFXqYa_kpiDeltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 14%, transparent)}.KFXqYa_kpiDeltaFlat{color:var(--ds-t-3);background:var(--dsb-3)}.KFXqYa_kpiSpark{height:12px;margin-top:4px}.KFXqYa_panel{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:8px;padding:12px 14px;display:flex}.KFXqYa_panelHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.KFXqYa_panelHeadControls{align-items:center;gap:8px;display:inline-flex}.KFXqYa_panelTitle{letter-spacing:-.005em;color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:20px}.KFXqYa_panelHint{color:var(--ds-t-3);white-space:nowrap;font-size:11px;line-height:16px}.KFXqYa_rangeToggle{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:8px;gap:2px;padding:2px;display:inline-flex}.KFXqYa_rangeButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:11px;line-height:16px}.KFXqYa_rangeButtonActive{background:var(--dsb-2);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.KFXqYa_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_exportLabel{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_exportButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;padding:4px 12px;font-size:11.5px;line-height:16px}.KFXqYa_exportButton:hover,.KFXqYa_exportButton:focus-visible{border-color:var(--ds-border-strong);color:var(--ds-t-1);outline:none}.KFXqYa_exportButton:disabled{opacity:.45;cursor:not-allowed}.KFXqYa_exportButton:disabled:hover{border-color:var(--ds-border);color:var(--ds-t-2)}.KFXqYa_shareTrack{background:var(--dsb-3);border-radius:4px;height:8px;display:flex;overflow:hidden}.KFXqYa_shareSeg{height:100%;transition:width var(--ds-t-fast)}.KFXqYa_shareSegPeak{background:var(--ds-blue)}.KFXqYa_shareSegOff{background:color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))}.KFXqYa_shareSegUser{background:var(--ds-blue)}.KFXqYa_shareSegAssistant{background:var(--ds-green)}.KFXqYa_shareSegTool{background:var(--ds-amber)}.KFXqYa_shareLegend{align-items:center;gap:16px;display:flex}.KFXqYa_shareItem{color:var(--ds-t-2);align-items:baseline;gap:6px;font-size:11px;line-height:17px;display:inline-flex}.KFXqYa_bucketCost{font-variant-numeric:tabular-nums;align-items:baseline;gap:3px;display:inline-flex}.KFXqYa_bucketOfficial{color:var(--ds-blue);font-weight:600}.KFXqYa_bucketSep{color:var(--ds-t-4)}.KFXqYa_bucketThird{color:var(--ds-t-2)}.KFXqYa_shareDot{border-radius:2px;flex:none;align-self:center;width:8px;height:8px}.KFXqYa_shareValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_budgetInput{width:64px;color:var(--ds-t-1);font-variant-numeric:tabular-nums;text-align:right;background:0 0;border:none;padding:0;font-size:12px;line-height:16px}.KFXqYa_budgetInput:focus-visible{outline:none}.KFXqYa_switch{border:1px solid var(--ds-border-strong);background:color-mix(in srgb, var(--ds-t-1) 10%, var(--dsb-3));cursor:pointer;width:32px;height:18px;transition:background-color var(--ds-t-fast), border-color var(--ds-t-fast);border-radius:999px;flex:none;padding:0;position:relative}.KFXqYa_switchOn{background:var(--ds-blue);border-color:#0000}.KFXqYa_switchKnob{width:12px;height:12px;box-shadow:0 0 0 1px var(--ds-border-strong);transition:transform var(--ds-t-fast);background:#fff;border-radius:50%;position:absolute;top:2px;left:2px}.KFXqYa_switchOn .KFXqYa_switchKnob{transform:translate(14px)}.KFXqYa_budgetFillWarn{background:var(--ds-amber)}.KFXqYa_budgetFillOver{background:var(--ds-red)}.KFXqYa_chartWrap{width:100%;position:relative}.KFXqYa_chartSvg{width:100%;height:auto;display:block}.KFXqYa_chartEmpty{height:140px;color:var(--ds-t-3);justify-content:center;align-items:center;font-size:13px;display:flex}.KFXqYa_emptyRow{text-align:center;color:var(--ds-t-3);padding:28px 0;font-size:13px}.KFXqYa_emptyState{border:1px dashed var(--ds-border);border-radius:var(--ds-r-2);background:color-mix(in srgb, var(--dsb-2) 50%, transparent);text-align:center;flex-direction:column;align-items:center;gap:10px;padding:32px 24px;display:flex}.KFXqYa_emptyIll{width:96px;height:64px;display:inline-block;position:relative}.KFXqYa_emptyIll svg{width:100%;height:100%;display:block}.KFXqYa_emptyIllDot{background:var(--ds-blue);border-radius:50%;width:6px;height:6px;animation:2s ease-in-out infinite KFXqYa_emptyDotPulse;position:absolute;bottom:8px;right:14px}@keyframes KFXqYa_emptyDotPulse{0%,to{box-shadow:0 0 0 4px color-mix(in srgb, var(--ds-blue) 20%, transparent)}50%{box-shadow:0 0 0 10px color-mix(in srgb, var(--ds-blue) 0%, transparent)}}.KFXqYa_emptyTitle{color:var(--ds-t-1);font-size:13px;font-weight:500}.KFXqYa_emptyDesc{color:var(--ds-t-3);max-width:320px;font-size:11.5px;line-height:1.5}.KFXqYa_chartGrid{stroke:var(--ds-border);stroke-width:1px}.KFXqYa_chartAxisLabel{fill:var(--ds-t-3);font-size:10px}.KFXqYa_chartBar{fill:var(--ds-blue);opacity:.7}.KFXqYa_chartBar:hover{opacity:1}.KFXqYa_chartStack{stroke:var(--dsb);stroke-width:.75px}.KFXqYa_chartStack:hover{opacity:.9}.KFXqYa_chartLine{stroke:var(--ds-blue);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.KFXqYa_chartCrosshair{stroke:var(--ds-t-4);stroke-width:1px;stroke-dasharray:3 3}.KFXqYa_chartTooltip{pointer-events:none;z-index:2;border:1px solid var(--ds-border-strong);background:var(--dsb-2);box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;padding:8px 10px;position:absolute;transform:translate(-50%,calc(-100% - 10px))}.KFXqYa_chartTooltipAlignRight{transform:translate(calc(-100% - 8px),calc(-100% - 10px))}.KFXqYa_chartTooltipAlignLeft{transform:translate(8px,calc(-100% - 10px))}.KFXqYa_chartTooltipDate{color:var(--ds-t-1);margin-bottom:3px;font-size:11px;font-weight:600}.KFXqYa_chartTooltipRow{color:var(--ds-t-2);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.KFXqYa_chartTooltipRow strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_chartTooltipHead{justify-content:space-between;align-items:baseline;gap:14px;margin-bottom:3px;display:flex}.KFXqYa_chartTooltipHead .KFXqYa_chartTooltipDate{margin-bottom:0}.KFXqYa_chartTooltipHead strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:11px;font-weight:600}.KFXqYa_chartTooltipSplit{justify-content:space-between;gap:14px}.KFXqYa_chartTooltipLabel{align-items:center;gap:5px;display:flex}.KFXqYa_chartTooltipModelDetail{color:var(--ds-t-3);font-variant-numeric:tabular-nums;margin:-2px 0 4px 13px;font-size:10.5px;line-height:14px}.KFXqYa_chartBarPlaceholder{fill:color-mix(in srgb, var(--ds-t-2) 30%, transparent)}.KFXqYa_chartLegendLine{background:var(--ds-blue);border-radius:2px;width:10px;height:3px;display:inline-block}.KFXqYa_chartLegendBar{background:var(--ds-blue);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.KFXqYa_chartTooltipSwatch{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartLegend{color:var(--ds-t-2);justify-content:flex-end;gap:14px;margin-top:2px;font-size:11px;display:flex}.KFXqYa_chartLegend span{align-items:center;gap:5px;display:inline-flex}.KFXqYa_chartLegendItem{font:inherit;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:5px;padding:0;transition:color .12s;display:inline-flex}.KFXqYa_chartLegendItem:hover{color:var(--ds-t-1)}.KFXqYa_chartLegendItemActive{color:var(--ds-t-1);font-weight:600}.KFXqYa_perfHero{grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:12px;display:grid;container:KFXqYa_billing-perf/inline-size}.KFXqYa_perfHeroCell{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-glass);padding:12px 14px}.KFXqYa_perfHeroLbl{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px;font-weight:500}.KFXqYa_perfHeroVal{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;margin-top:4px;font-size:22px;font-weight:600;line-height:1.15}.KFXqYa_perfHeroUnit{color:var(--ds-t-3);margin-left:3px;font-size:11px;font-weight:500}.KFXqYa_perfHeroBar{background:var(--dsb-3);border-radius:2px;height:4px;margin-top:6px;position:relative;overflow:hidden}.KFXqYa_perfHeroBar i{height:100%;transition:width var(--ds-t-fast);border-radius:2px;display:block}@container KFXqYa_billing-perf (width<=480px){.KFXqYa_perfHero{grid-template-columns:1fr 1fr}}.KFXqYa_perfCompareList{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-glass);margin-top:10px;overflow:hidden}.KFXqYa_perfCompareRow{border-bottom:1px solid var(--ds-border);grid-template-columns:1fr 80px 56px 56px;align-items:center;gap:12px;padding:8px 12px;font-size:12px;display:grid}.KFXqYa_perfCompareRow:last-child{border-bottom:0}.KFXqYa_perfCompareName{text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:8px;min-width:0;font-weight:500;display:inline-flex;overflow:hidden}.KFXqYa_perfCompareDot{border-radius:2px;flex:none;width:8px;height:8px}.KFXqYa_perfCompareBar{background:var(--dsb-3);border-radius:3px;height:6px;position:relative;overflow:hidden}.KFXqYa_perfCompareBar i{height:100%;transition:width var(--ds-t-fast);border-radius:3px;display:block}.KFXqYa_perfCompareNum{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;text-align:right;font-size:11.5px;font-weight:600}.KFXqYa_perfBar{align-items:center;margin:10px 0 2px;display:flex}.KFXqYa_perfChips{flex-wrap:wrap;gap:6px;margin:6px 0 2px;display:flex}.KFXqYa_perfChip{border:1px solid var(--ds-border);background:var(--dsb-3);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), opacity var(--ds-t-fast);border-radius:999px;align-items:center;gap:5px;padding:2px 9px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_perfChip:hover{color:var(--ds-t-1)}.KFXqYa_perfChipOff{opacity:.45}.KFXqYa_perfChipDot{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartHoverDot{stroke:var(--dsb-2);stroke-width:1.5px}.KFXqYa_tableScroll{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);overflow:auto}.KFXqYa_ubAlert{border:1px solid color-mix(in srgb, var(--ds-blue) 30%, transparent);border-radius:var(--ds-r-1);background:color-mix(in srgb, var(--ds-blue) 8%, transparent);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12px;line-height:17px;display:flex}.KFXqYa_ubAlertLeft{align-items:center;gap:8px;display:inline-flex}.KFXqYa_ubRate{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_ubAlertNote{color:var(--ds-t-2);margin:0}.KFXqYa_ubTag,.KFXqYa_ubTagSuccess,.KFXqYa_ubTagNeutral,.KFXqYa_ubTagAlert,.KFXqYa_ubTagPromo{border:1px solid var(--ds-border-strong);white-space:nowrap;border-radius:999px;align-items:center;gap:4px;padding:1px 5px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_ubTag{color:var(--ds-t-2);background:var(--dsb-2)}.KFXqYa_ubTagSuccess{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.KFXqYa_ubTagNeutral{color:var(--ds-t-2);background:var(--dsb-2)}.KFXqYa_ubTagAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 36%, transparent);background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.KFXqYa_ubTagPromo{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent);cursor:help}.KFXqYa_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.KFXqYa_ubExtraName{color:var(--ds-t-2);margin-left:26px}.KFXqYa_ubExtraNote{color:var(--ds-t-3);margin-left:8px;font-size:10px}.KFXqYa_ubCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.KFXqYa_ubCardHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.KFXqYa_ubCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_ubCardSub{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_ubTablewrap{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);overflow:auto}.KFXqYa_ubTablewrapPricing{overscroll-behavior:contain;max-height:min(56vh,520px)}.KFXqYa_ubTablewrapPricing .KFXqYa_ubTable thead th{z-index:1;background:var(--dsb-3);box-shadow:inset 0 -1px 0 var(--ds-border);position:sticky;top:0}.KFXqYa_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12px}.KFXqYa_ubTable th,.KFXqYa_ubTable td{border-bottom:1px solid var(--ds-border);text-align:left;color:var(--ds-t-1);padding:7px 9px}.KFXqYa_ubSearch{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);width:200px;max-width:45%;color:var(--ds-t-1);background:0 0;outline:none;align-self:center;margin-left:auto;padding:5px 9px;font-size:12px;line-height:18px}.KFXqYa_bandDots{flex:none;align-items:center;gap:5px;display:inline-flex}.KFXqYa_bandDot{cursor:pointer;background:0 0;border:1.5px solid;border-radius:999px;flex:none;width:9px;height:9px;padding:0}.KFXqYa_bandDotOn{background:currentColor}.KFXqYa_offPeak{color:var(--ds-blue)}.KFXqYa_soon{color:var(--ds-amber)}.KFXqYa_peak{color:var(--ds-red)}span.KFXqYa_bandDot{cursor:default}.KFXqYa_ubTable th,.KFXqYa_ubTable td:first-child{white-space:normal}.KFXqYa_ubTable tbody tr:last-child td{border-bottom:0}.KFXqYa_ubTable thead th,.KFXqYa_ubTable thead th.KFXqYa_numCol{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;text-align:center;padding:6px 9px;font-size:11px;font-weight:500}.KFXqYa_ubModel{align-items:center;gap:6px;display:inline-flex}.KFXqYa_ubModelName{color:var(--ds-t-1);align-items:center;gap:4px;font-weight:500;display:inline-flex}.KFXqYa_ubChipPeak,.KFXqYa_ubChipOff{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:4px;height:18px;padding:0 6px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_ubChipLabel{font-size:10px;font-weight:600}.KFXqYa_ubChipPeak{background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue)}.KFXqYa_ubChipOff{background:color-mix(in srgb, var(--ds-green) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green)}.KFXqYa_ubNotes{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.KFXqYa_ubNotesItem{align-items:baseline;gap:10px;display:flex}.KFXqYa_ubNotesTerm{color:var(--ds-t-1);flex:0 0 72px;font-size:12px;font-weight:500}.KFXqYa_ubNotesDesc{min-width:0;color:var(--ds-t-2);flex:1;font-size:12px;line-height:17px}.KFXqYa_ubCardControlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.KFXqYa_ubTagError{white-space:nowrap;background:color-mix(in srgb, var(--ds-red) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-red) 36%, transparent);height:18px;color:var(--ds-red);border-radius:999px;align-items:center;padding:0 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_modelTable{border-collapse:collapse;table-layout:fixed;width:100%;min-width:640px;font-size:12px}.KFXqYa_modelTable th:first-child{width:26%}.KFXqYa_modelTable th,.KFXqYa_modelTable td{border-bottom:1px solid var(--ds-border);text-align:left;white-space:nowrap;color:var(--ds-t-1);padding:10px 12px}.KFXqYa_modelTable tbody tr:last-child td{border-bottom:0}.KFXqYa_sessionGroupRow{cursor:pointer}.KFXqYa_sessionGroupRow .KFXqYa_modelName:before{content:"›";color:var(--ds-t-3);margin-right:6px;display:inline-block}.KFXqYa_sessionGroupRow[aria-expanded=true] .KFXqYa_modelName:before{transform:rotate(90deg)}.KFXqYa_sessionGroupRow:focus-visible{outline:2px solid var(--ds-border-strong);outline-offset:-2px}.KFXqYa_sessionChildRow td:first-child{padding-left:30px}.KFXqYa_sessionSubDeepRow td:first-child{padding-left:46px}.KFXqYa_modelTable thead th{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;background:0 0;padding:8px 12px;font-size:11px;font-weight:500}.KFXqYa_modelTable tbody tr{transition:background-color .12s}.KFXqYa_modelTable tbody tr:hover{background:0 0}.KFXqYa_modelTable tbody tr.KFXqYa_modelRowFocusable{cursor:pointer}.KFXqYa_modelTable tbody tr.KFXqYa_modelRowActive,.KFXqYa_modelTable tbody tr.KFXqYa_modelRowActive:hover{background:color-mix(in srgb, var(--ds-blue) 10%, transparent)}.KFXqYa_numCol{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}.KFXqYa_modelTable .KFXqYa_numCol,.KFXqYa_ubTable .KFXqYa_numCol{text-align:right}.KFXqYa_na{color:var(--ds-t-4)}.KFXqYa_unknownHint{color:var(--ds-t-4);margin:0 0 8px;font-size:12px;line-height:18px}.KFXqYa_modelCell{align-items:center;gap:8px;display:inline-flex}.KFXqYa_modelDot{border-radius:2px;flex:none;width:8px;height:8px}.KFXqYa_modelName{color:var(--ds-t-1);font-weight:500;line-height:16px;display:block}.KFXqYa_modelProvider{color:var(--ds-t-3);font-size:10.5px;line-height:14px;display:block}.KFXqYa_modelChannels{flex-wrap:wrap;gap:4px;margin-top:2px;display:flex}.KFXqYa_modelChannelTag{text-overflow:ellipsis;white-space:nowrap;border:1px solid var(--ds-border);max-width:220px;color:var(--ds-t-3);border-radius:4px;padding:0 5px;font-size:10px;line-height:14px;display:inline-block;overflow:hidden}.KFXqYa_siteRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);justify-content:space-between;align-items:center;gap:12px;padding:8px 10px;display:flex}.KFXqYa_siteRowName{align-items:center;gap:8px;min-width:0;display:inline-flex}.KFXqYa_siteKindTag{white-space:nowrap;border:1px solid #0000;border-radius:999px;flex:none;align-items:center;padding:2px 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_siteKindSite{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 36%, transparent);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.KFXqYa_siteKindDirect{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.KFXqYa_siteKindUnknown{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_siteRowTitle{color:var(--ds-t-1);text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.KFXqYa_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_siteRowCost{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:600;line-height:18px}.KFXqYa_siteRowCalls{color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.KFXqYa_siteRowCallsLow{color:var(--ds-red)}.KFXqYa_flatTag{color:var(--ds-t-3);font-size:10.5px;line-height:14px}.KFXqYa_healthDot{border-radius:50%;flex:none;width:6px;height:6px;display:inline-block}.KFXqYa_healthOk{background:var(--ds-green);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-green) 18%, transparent)}.KFXqYa_healthBad{background:var(--ds-red);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-red) 18%, transparent), 0 0 0 1px var(--ds-red) inset}.KFXqYa_healthIdle{border:1.5px solid var(--ds-t-4);background:0 0}.KFXqYa_dashboardRight{align-items:center;gap:8px;min-width:0;display:flex}.KFXqYa_healthBadge{white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_healthBadgeOk{color:var(--ds-green);background:var(--dsb-2)}.KFXqYa_healthBadgeBad{color:var(--ds-red);background:var(--dsb-2)}.KFXqYa_planTag{color:var(--ds-green);white-space:nowrap;align-items:center;gap:4px;font-size:10px;font-weight:500;line-height:14px;display:inline-flex}.KFXqYa_planTagBadge{background:color-mix(in srgb, var(--ds-green) 20%, transparent);border-radius:4px;padding:0 4px;font-size:9px;line-height:12px}.KFXqYa_uncataloguedTag{border:1px solid color-mix(in srgb, var(--ds-amber) 36%, transparent);vertical-align:1px;color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.KFXqYa_estimatedTag{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);vertical-align:1px;color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.KFXqYa_feeBar{color:var(--ds-t-2);font-size:11px;line-height:16px;font-family:var(--font-num);font-variant-numeric:tabular-nums;flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.KFXqYa_feeBarAbove{align-self:center}.KFXqYa_feeInline{font-variant-numeric:tabular-nums;white-space:nowrap;cursor:default;border-radius:999px;align-self:center;align-items:center;gap:5px;height:22px;padding:0 4px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_feeInlineNum{color:var(--ds-t-1);padding-right:6px;font-weight:600}.KFXqYa_feeInlineAlert{background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.KFXqYa_feeInlineAlert .KFXqYa_feeInlineNum{color:var(--ds-amber)}.KFXqYa_feeInlineError{background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_feeInlineError .KFXqYa_feeInlineNum{color:var(--ds-red)}.KFXqYa_feeBar .KFXqYa_feeSep{color:var(--ds-t-4)}.KFXqYa_feeCount{color:var(--ds-t-1);font-weight:600}.KFXqYa_feeSuffix{color:var(--ds-t-3)}.KFXqYa_feeItem{color:var(--ds-t-2);white-space:nowrap}.KFXqYa_feeNum{color:var(--ds-t-1);font-weight:600}.KFXqYa_feeNum[data-tick]{animation:KFXqYa_feeTickFlash var(--ds-t-pulse) ease-out 1}@keyframes KFXqYa_feeTickFlash{0%{text-shadow:0 0 0 color-mix(in srgb, var(--ds-blue) 0%, transparent)}30%{text-shadow:0 0 8px color-mix(in srgb, var(--ds-blue) 60%, transparent)}to{text-shadow:0 0 0 color-mix(in srgb, var(--ds-blue) 0%, transparent)}}.KFXqYa_feeSep{color:var(--ds-t-4)}.KFXqYa_feeChipPrimary,.KFXqYa_feeChipOff,.KFXqYa_feeChipAlert,.KFXqYa_feeChipError{background:var(--dsb-3);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:4px;align-items:center;height:18px;padding:0 6px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_feeChipPrimary{color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.KFXqYa_feeChipOff{color:var(--ds-cyan);background:color-mix(in srgb, var(--ds-cyan) 12%, transparent)}.KFXqYa_feeChipAlert{color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.KFXqYa_feeChipError{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.KFXqYa_providerGroupRecharge{border:1px solid color-mix(in srgb, var(--ds-c-1) 38%, transparent);background:color-mix(in srgb, var(--ds-c-1) 8%, transparent);color:var(--ds-c-1);white-space:nowrap;border-radius:999px;justify-content:center;align-items:center;min-width:48px;padding:1px 8px;font-size:10.5px;font-weight:600;line-height:16px;text-decoration:none;display:inline-flex}.KFXqYa_providerGroupRecharge:empty{background:0 0;border-color:#0000}.KFXqYa_providerGroupRecharge:hover{background:color-mix(in srgb, var(--ds-c-1) 15%, transparent);border-color:color-mix(in srgb, var(--ds-c-1) 60%, transparent)}.KFXqYa_balanceDaysBadge{border:1px solid var(--ds-border-strong);background:var(--dsb-2);min-width:16px;height:16px;color:var(--ds-t-2);cursor:pointer;border-radius:8px;justify-content:center;align-items:center;padding:0 4px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.KFXqYa_balanceDaysBadge:hover{border-color:var(--ds-t-3);color:var(--ds-t-1)}.KFXqYa_balanceDaysBadgeLow{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_balanceDetailPop{z-index:20;background:var(--dsb-2);border:1px solid var(--ds-border-strong);min-width:180px;box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;flex-direction:column;gap:6px;padding:8px 10px;display:inline-flex;position:absolute;top:calc(100% + 6px);right:0}.KFXqYa_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.KFXqYa_balanceDetailTitle{color:var(--ds-t-1);font-size:12px;font-weight:600}.KFXqYa_balanceDetailClose{cursor:pointer;color:var(--ds-t-3);background:0 0;border:none;font-size:14px;line-height:1}.KFXqYa_balanceDetailClose:hover{color:var(--ds-t-1)}.KFXqYa_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.KFXqYa_balanceDetailRow{color:var(--ds-t-2);font-variant-numeric:tabular-nums;justify-content:space-between;gap:16px;font-size:11px;line-height:15px;display:flex}.KFXqYa_balanceDetailLabel{color:var(--ds-t-3)}.KFXqYa_balanceDetailValue{color:var(--ds-t-1);font-weight:500}.KFXqYa_currencyToggle{background:var(--dsw-alias-bg-layer-3);border:none;border-radius:8px;align-items:center;gap:2px;margin-right:8px;padding:2px;display:inline-flex}.KFXqYa_currencyButton{color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:4px 8px;font-size:11px;font-weight:700;line-height:1}.KFXqYa_currencyButtonActive{background:var(--dsb-2);color:var(--dsw-alias-label-primary);box-shadow:0 0 0 1px var(--ds-border-strong)}.KFXqYa_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.KFXqYa_subscriptionCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(12px)saturate(1.3);transition:border-color var(--ds-t-fast);padding:14px 16px;position:relative;overflow:hidden}.KFXqYa_subscriptionCardUpgraded{border-color:color-mix(in srgb, var(--ds-blue) 30%, transparent);border-radius:var(--ds-r-3);background:linear-gradient(135deg, color-mix(in srgb, var(--ds-blue) 8%, transparent), transparent 60%), var(--dsb-glass);-webkit-backdrop-filter:blur(12px)saturate(1.4);padding:16px 18px}.KFXqYa_subscriptionCardUpgraded:after{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-blue) 50%, transparent 90%);opacity:.7;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.KFXqYa_subscriptionCardUpgraded .KFXqYa_subscriptionPct{font-size:18px;font-weight:600}.KFXqYa_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.KFXqYa_subscriptionName{color:var(--ds-t-1);font-size:13px;font-weight:600}.KFXqYa_subscriptionPlan{color:var(--ds-t-2);font-size:11px}.KFXqYa_subscriptionPlan[data-kind=code],.KFXqYa_subscriptionPlan[data-kind=token]{color:var(--ds-t-2);background:var(--dsb-3);border-radius:999px;padding:1px 8px;font-weight:500}.KFXqYa_subscriptionTier{color:var(--ds-t-3);margin-left:6px}.KFXqYa_subscriptionAuto{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:1px 6px;font-size:10px}.KFXqYa_subscriptionStatus{color:var(--ds-t-2);margin-bottom:6px;font-size:11px}.KFXqYa_subscriptionWindow{align-items:center;gap:10px;margin-top:8px;font-size:11px;display:flex}.KFXqYa_subscriptionWindowLabel{color:var(--ds-t-3);flex:0 0 44px}.KFXqYa_subscriptionTrack{background:var(--dsb-3);height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.KFXqYa_subscriptionFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px;display:block}.KFXqYa_subscriptionFillWarn{background:var(--ds-amber)}.KFXqYa_subscriptionFillOver{background:var(--ds-red)}.KFXqYa_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.KFXqYa_subscriptionPct{text-align:right;min-width:52px;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1);flex:none}.KFXqYa_subscriptionExhausted{color:var(--ds-red);min-width:52px;font-weight:600}.KFXqYa_subscriptionReset{color:var(--ds-t-3);white-space:nowrap;flex:none;font-size:10px}.KFXqYa_providerGroupList{flex-direction:column;gap:10px;display:flex}.KFXqYa_providerGroup{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);padding:12px 14px;container:KFXqYa_billing-pg/inline-size}.KFXqYa_providerStatRow{border-radius:var(--ds-r-1);background:var(--dsb-2);border:1px solid var(--ds-border);grid-template-columns:repeat(4,1fr);gap:10px;margin-top:10px;padding:10px 12px;display:grid}.KFXqYa_providerStatCell{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_providerStatLbl{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px;font-weight:500}.KFXqYa_providerStatVal{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:600;overflow:hidden}.KFXqYa_providerStatSub{font-family:var(--font-num);color:var(--ds-t-3);font-size:10.5px}@container KFXqYa_billing-pg (width<=480px){.KFXqYa_providerStatRow{grid-template-columns:1fr 1fr}}.KFXqYa_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:10px;display:flex}.KFXqYa_providerGroupCollapsible{cursor:pointer}.KFXqYa_providerGroupCollapsible .KFXqYa_providerGroupTitle:before{content:"›";color:var(--ds-t-3);margin-right:6px;display:inline-block}.KFXqYa_providerGroupCollapsible[aria-expanded=true] .KFXqYa_providerGroupTitle:before{transform:rotate(90deg)}.KFXqYa_providerGroupCollapsible:focus-visible{outline:2px solid var(--ds-border-strong);outline-offset:2px;border-radius:6px}.KFXqYa_providerCtlRow{align-items:center;gap:12px;margin-bottom:10px;display:flex}.KFXqYa_providerTodayToggle{color:var(--ds-t-3);align-items:center;gap:7px;font-size:11px;display:inline-flex}.KFXqYa_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.KFXqYa_kindBadge{border:1px solid color-mix(in srgb, var(--ds-c-1) 32%, transparent);background:color-mix(in srgb, var(--ds-c-1) 10%, transparent);color:var(--ds-c-1);border-radius:4px;flex:none;padding:1px 6px;font-size:10px;font-weight:600;line-height:15px}.KFXqYa_kindBadgeRelay{border-color:color-mix(in srgb, var(--ds-c-2) 32%, transparent);background:color-mix(in srgb, var(--ds-c-2) 10%, transparent);color:var(--ds-c-2)}.KFXqYa_kindBadgeUnknown{border-color:var(--ds-border);background:color-mix(in srgb, var(--ds-t-3) 12%, transparent);color:var(--ds-t-3)}.KFXqYa_providerGroupName{color:var(--ds-t-1);font-size:13px;font-weight:600;line-height:18px}.KFXqYa_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_providerGroupBadge{border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent);border-radius:999px;justify-content:center;align-items:center;padding:1px 8px;font-size:10px;font-weight:500;line-height:16px;display:inline-flex}.KFXqYa_providerGroupBalance,.KFXqYa_providerGroupCost{color:var(--ds-t-2);font-variant-numeric:tabular-nums;white-space:nowrap;justify-content:flex-end;align-items:baseline;gap:6px;min-width:118px;font-size:12px;line-height:17px;display:inline-flex}.KFXqYa_providerGroupCostLabel{font-size:11px}.KFXqYa_providerGroupCostValue{color:var(--ds-t-1);text-align:right;min-width:56px;font-weight:600}.KFXqYa_providerGroupBalanceLabel{color:var(--ds-t-3);font-size:11px;line-height:17px}.KFXqYa_rounds{margin-top:10px}.KFXqYa_roundsBars{align-items:flex-end;gap:3px;height:124px;padding:16px 2px 0;display:flex;overflow-x:auto}.KFXqYa_roundsBarCol{border-radius:5px 5px 0 0;flex-direction:column;flex:1 0 28px;justify-content:flex-end;align-items:stretch;height:100%;display:flex;position:relative}.KFXqYa_roundsBarColPeak{background:color-mix(in srgb, var(--ds-amber) 16%, transparent)}.KFXqYa_roundsBarColOff{background:var(--dsb-3)}.KFXqYa_roundsBarLabel{text-align:center;color:var(--ds-t-2);white-space:nowrap;text-overflow:ellipsis;max-width:100%;font-size:9px;line-height:1.2;position:absolute;bottom:0;left:0;right:0;overflow:hidden;transform:translateY(-100%)}.KFXqYa_roundsBarWrap{flex:1;align-items:flex-end;min-height:0;display:flex}.KFXqYa_roundsBar{background:var(--ds-blue);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsBarFlagged{background:var(--ds-red);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsFlagMark{background:var(--ds-red);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.KFXqYa_roundsAxis{color:var(--ds-t-3);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.KFXqYa_roundsEmpty{color:var(--ds-t-2);margin-top:10px;font-size:12px}.KFXqYa_heatmap{margin-top:10px}.KFXqYa_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;display:grid}.KFXqYa_heatmapCellEmpty{box-sizing:border-box;border:1px dashed var(--ds-border);height:30px;color:var(--ds-t-4);font-variant-numeric:tabular-nums;background:0 0;border-radius:2px;justify-content:center;align-items:center;font-size:11px;display:flex}.KFXqYa_heatmapCell{font-variant-numeric:tabular-nums;cursor:pointer;border:0;border-radius:2px;justify-content:center;align-items:center;height:30px;padding:0;font-size:11px;display:flex}.KFXqYa_heatmapCell[data-level="0"],.KFXqYa_heatmapCell[data-level="1"],.KFXqYa_heatmapCell[data-level="2"]{color:var(--dsw-alias-label-primary)}.KFXqYa_heatmapCell[data-level="3"],.KFXqYa_heatmapCell[data-level="4"]{color:var(--dsw-static-neutral-bluish-00)}.KFXqYa_heatmapCell[data-today=true],.KFXqYa_heatmapYearCell[data-today=true]{outline:1.5px solid color-mix(in srgb, var(--ds-amber) 70%, transparent);outline-offset:1px;z-index:1}.KFXqYa_heatmapFooter{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-top:10px;font-size:10px;display:flex}.KFXqYa_heatmapLegend{gap:3px;display:inline-flex}.KFXqYa_heatmapLegend i{border-radius:2px;width:14px;height:14px;display:block}.KFXqYa_heatmapHover{font-family:var(--font-num);font-variant-numeric:tabular-nums;margin-left:auto}.KFXqYa_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.KFXqYa_heatmapRangeButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;background:0 0;border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4}.KFXqYa_heatmapRangeButtonActive{background:var(--dsb-2);border-color:var(--ds-border-strong);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.KFXqYa_heatmapYear{flex-direction:column;gap:6px;display:flex}.KFXqYa_heatmapYearBody{align-items:flex-start;gap:6px;display:flex}.KFXqYa_heatmapYearWeekdays{color:var(--ds-t-3);flex:none;grid-template-rows:repeat(7,11px);gap:3px;padding-top:12px;font-size:9px;line-height:11px;display:grid}.KFXqYa_heatmapYearWeekday{white-space:nowrap;text-align:right;height:11px}.KFXqYa_heatmapYearMonths{min-width:max-content;color:var(--ds-t-3);grid-template-columns:repeat(52,11px);gap:3px;font-size:9px;line-height:12px;display:grid;overflow:visible}.KFXqYa_heatmapYearMonth{white-space:nowrap;overflow:visible}.KFXqYa_heatmapYearScroll{padding-bottom:2px;overflow-x:auto}.KFXqYa_heatmapYearGrid{grid-template-rows:repeat(7,11px);grid-auto-flow:column;gap:3px;min-width:max-content;display:grid}.KFXqYa_heatmapYearCell{cursor:pointer;border:0;border-radius:2px;width:11px;height:11px;padding:0}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearWeekdays{grid-template-rows:repeat(7,16px);line-height:16px}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearWeekday{height:16px}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearMonths{grid-template-columns:repeat(26,16px)}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearGrid{grid-template-rows:repeat(7,16px)}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearCell{border-radius:3px;width:16px;height:16px}.KFXqYa_floatSub{flex-direction:column;gap:6px;min-width:0;display:flex}.KFXqYa_floatSubHead{flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;display:flex}.KFXqYa_floatSubName{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:700}.KFXqYa_floatSubPlan{color:var(--dsw-alias-label-secondary);font-size:10px}.KFXqYa_floatSub .KFXqYa_subscriptionWindow{flex-wrap:wrap;gap:4px 10px}.KFXqYa_floatSub .KFXqYa_subscriptionWindowLabel{flex:none}.KFXqYa_floatSub .KFXqYa_subscriptionMeta{min-width:0;max-width:100%}.KFXqYa_floatSub .KFXqYa_subscriptionPct{min-width:0}.KFXqYa_floatSub .KFXqYa_subscriptionReset{white-space:normal;overflow-wrap:anywhere}.KFXqYa_triggerPopEmpty{color:var(--dsw-alias-label-tertiary);padding:2px 0;font-size:11px;line-height:1.5}.KFXqYa_triggerPopSwitcher{justify-content:flex-end;align-items:center;gap:8px;margin-top:2px;display:flex}.KFXqYa_triggerPopSwitchCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:10px}.KFXqYa_floatModeBtn{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;border-radius:10px;flex:1;padding:7px 10px;font-size:12px}.KFXqYa_floatModeBtnOn{border-color:var(--ds-blue);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--ds-blue) 16%, transparent)}.KFXqYa_floatModeBtn:disabled{opacity:.45;cursor:not-allowed}.KFXqYa_rdoRow{justify-content:space-between;align-items:center;gap:8px;margin-top:10px;display:flex}.KFXqYa_rdoLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.KFXqYa_rdoSelect{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;border-radius:10px;align-items:center;gap:5px;padding:5px 8px 5px 10px;font-size:12px;display:inline-flex}.KFXqYa_rdoSelect:hover{background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 85%, transparent)}.KFXqYa_rdoSelect:focus-visible{border-color:var(--ds-blue);outline:none}.KFXqYa_rdoChevron{color:var(--dsw-alias-label-tertiary);transition:transform .15s;display:inline-flex}.KFXqYa_rdoChevronOpen{transform:rotate(180deg)}.KFXqYa_floatTarget{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:5px;font-size:12px;display:inline-flex}.KFXqYa_floatTargetLabel{color:var(--dsw-alias-label-secondary)}.KFXqYa_staleNotice{color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);border-radius:10px;align-items:center;gap:6px;margin:0 0 10px;padding:8px 10px;font-size:11px;display:flex}.KFXqYa_staleNoticeBody{flex:1;min-width:0}.KFXqYa_staleNoticeSub{margin-top:4px;display:block}.KFXqYa_plgHead{align-items:flex-start;gap:12px;display:flex}.KFXqYa_plgIcon{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);width:40px;height:40px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_plgTitle{flex-direction:column;gap:4px;min-width:0;display:flex}.KFXqYa_plgNameRow{align-items:center;gap:8px;display:flex}.KFXqYa_plgName{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_plgTag{height:18px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);white-space:nowrap;border-radius:5px;align-items:center;padding:0 6px;font-size:10px;font-weight:600;display:inline-flex}.KFXqYa_plgDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.KFXqYa_plgGrid{border-top:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding-top:12px;display:grid}.KFXqYa_plgItem{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_plgLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.KFXqYa_plgVal{color:var(--dsw-alias-label-primary);word-break:break-all;font-size:12px;line-height:17px}.KFXqYa_plgLink{color:var(--ds-blue);word-break:break-all;font-size:12px;line-height:17px;text-decoration:none}.KFXqYa_plgLink:hover{text-decoration:underline}.KFXqYa_tokenPanel{flex-direction:column;gap:14px;display:flex}.KFXqYa_tokenModelBar{background:var(--dsw-alias-bg-layer-2);border-radius:999px;height:8px;overflow:hidden}.KFXqYa_tokenModelParts{height:100%;display:flex}.KFXqYa_tokenModelPartIn{background:var(--ds-blue)}.KFXqYa_tokenModelPartOut{background:var(--ds-amber)}.KFXqYa_tokenModelShareRow{align-items:center;gap:6px;display:inline-flex}@media (width<=640px){.KFXqYa_kpiGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.KFXqYa_hero{gap:14px}.KFXqYa_heroTop{flex-direction:column;align-items:flex-start;gap:12px}.KFXqYa_heroGauge{width:72px;height:72px}.KFXqYa_heroSide{gap:12px}.KFXqYa_heroSideSpacer{display:none}}.KFXqYa_peakCard{z-index:2000;border-radius:var(--ds-r-2);border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);min-width:280px;max-width:380px;box-shadow:var(--ds-shadow-2);animation:KFXqYa_peakAlertIn var(--ds-t-fast);flex-direction:column;gap:12px;padding:14px 16px;display:flex;position:fixed}.KFXqYa_peakCardCorner{bottom:18px;right:18px}.KFXqYa_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.KFXqYa_peakCardPeak{color:var(--ds-blue)}.KFXqYa_peakCardOff{color:var(--ds-cyan)}.KFXqYa_peakHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.KFXqYa_peakTag{white-space:nowrap;border-radius:6px;align-items:center;gap:6px;height:20px;padding:0 8px;font-size:11px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_peakTagPrimary{background:var(--dsw-alias-bg-layer-3);color:var(--ds-blue)}.KFXqYa_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--ds-cyan)}.KFXqYa_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.KFXqYa_peakDotPrimary{background:var(--ds-blue)}.KFXqYa_peakDotSuccess{background:var(--ds-cyan)}.KFXqYa_peakClose{width:24px;height:24px;color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;font-size:15px;line-height:1;display:inline-flex}.KFXqYa_peakClose:hover{color:var(--ds-t-1);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_peakCount{font-family:var(--font-num);font-variant-numeric:tabular-nums;font-size:28px;font-weight:600;line-height:1}.KFXqYa_peakCountPrimary{color:var(--ds-blue)}.KFXqYa_peakCountSuccess{color:var(--ds-cyan)}.KFXqYa_peakDesc{color:var(--ds-t-1);margin:4px 0 0;font-size:12px;line-height:18px}@keyframes KFXqYa_peakAlertIn{0%{opacity:0}to{opacity:1}}.KFXqYa_settingsLayout{grid-template-columns:120px 1fr;gap:14px;display:grid;container:KFXqYa_billing-settings/inline-size}.KFXqYa_settingsNav{border-right:1px solid var(--ds-border);flex-direction:column;align-self:start;gap:2px;max-height:min(720px,88vh - 80px);padding-right:14px;display:flex;position:sticky;top:0;overflow-y:auto}.KFXqYa_settingsNavItem{color:var(--ds-t-2);cursor:pointer;text-align:left;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;align-items:center;gap:6px;padding:6px 8px;font-family:inherit;font-size:11.5px;display:flex}.KFXqYa_settingsNavItem:hover{background:var(--dsb-3);color:var(--ds-t-1)}.KFXqYa_settingsNavItem:focus-visible{box-shadow:0 0 0 1.5px var(--ds-border-strong);outline:none}.KFXqYa_settingsNavItemActive{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-t-1);font-weight:600}.KFXqYa_settingsNavIcon{width:12px;height:12px;color:var(--ds-t-3);justify-content:center;align-items:center;display:inline-flex}.KFXqYa_settingsNavItemActive .KFXqYa_settingsNavIcon{color:var(--ds-blue)}.KFXqYa_settingsNavIcon svg{width:12px;height:12px}.KFXqYa_settingsNavItemAdvanced .KFXqYa_settingsNavIcon{color:var(--ds-violet)}.KFXqYa_settingsPane{flex-direction:column;gap:12px;min-width:0;display:flex}@container KFXqYa_billing-settings (width<=540px){.KFXqYa_settingsLayout{grid-template-columns:1fr}.KFXqYa_settingsNav{border-right:none;border-bottom:1px solid var(--ds-border);flex-flow:wrap;max-height:none;padding-bottom:10px;padding-right:0;position:static}}.KFXqYa_densityRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;display:flex}.KFXqYa_densityRow+.KFXqYa_densityRow{margin-top:8px}.KFXqYa_densityLeft{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_densityLeft strong{font-size:12.5px;font-weight:500}.KFXqYa_densityLeft span{color:var(--ds-t-3);font-size:11px}.KFXqYa_densityButtons{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:8px;align-items:center;gap:4px;padding:2px;display:inline-flex}.KFXqYa_densityButton{color:var(--ds-t-2);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;padding:4px 10px;font-family:inherit;font-size:11px}.KFXqYa_densityButton:hover{color:var(--ds-t-1)}.KFXqYa_densityButtonActive{background:var(--dsb-2);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.KFXqYa_densityButtonComfortable.KFXqYa_densityButtonActive{background:var(--ds-violet-bg);color:var(--ds-violet);box-shadow:0 0 0 1px var(--ds-violet-strong)}.KFXqYa_setCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.KFXqYa_setGrid3,.KFXqYa_setGrid2{gap:10px;display:grid}.KFXqYa_setGrid3{grid-template-columns:repeat(3,minmax(0,1fr))}.KFXqYa_setGrid2{grid-template-columns:repeat(2,minmax(0,1fr))}@media (width<=720px){.KFXqYa_setGrid3,.KFXqYa_setGrid2{grid-template-columns:1fr}}.KFXqYa_setCell{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);flex-direction:column;gap:8px;min-width:0;padding:12px 14px;display:flex}.KFXqYa_setHint{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_setCardHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.KFXqYa_setCardMeta{flex-direction:column;gap:4px;min-width:0;display:flex}.KFXqYa_setCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_setCardDesc{color:var(--ds-t-3);margin:0;font-size:11px;line-height:16px}.KFXqYa_ctlCol{flex-direction:column;gap:10px;padding-top:2px;display:flex}.KFXqYa_ctlRow{align-items:center;gap:12px;min-height:28px;display:flex}.KFXqYa_ctlRowStretch{display:flex}.KFXqYa_ctlLabel{color:var(--ds-t-3);flex:0 0 96px;font-size:11px;line-height:16px}.KFXqYa_ctlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.KFXqYa_userPriceRow{border-bottom:1px solid var(--ds-border);align-items:center;gap:10px;padding:8px 0;display:flex}.KFXqYa_userPriceCheck{width:14px;height:14px;accent-color:var(--ds-blue);flex:none;margin:0}.KFXqYa_userPriceBody{flex-direction:column;flex:1;gap:8px;min-width:0;display:flex}.KFXqYa_userPriceLineMeta{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) auto;align-items:end;gap:8px 10px;display:grid}@media (width<=720px){.KFXqYa_userPriceLineMeta{grid-template-columns:repeat(2,minmax(0,1fr))}}.KFXqYa_userPriceLineMeta .KFXqYa_userPriceInput{box-sizing:border-box;width:100%;min-width:0;max-width:none}.KFXqYa_userPriceBody .KFXqYa_ctlGroup{flex-wrap:nowrap}.KFXqYa_userPriceLineMeta .KFXqYa_userPriceField .KFXqYa_ctlLabel{align-items:flex-end;min-height:30px;display:flex}.KFXqYa_userPricePriceLine{border-left:2px solid var(--ds-amber);flex-wrap:wrap;align-items:center;gap:10px;width:calc(100% - 22px);margin-left:10px;padding:2px 0 6px 12px;display:flex}.KFXqYa_userPricePriceLine>.KFXqYa_ctlLabel{color:var(--ds-t-3);flex:0 0 44px;font-size:11px}.KFXqYa_userPricePriceLine .KFXqYa_userPriceInputNum{box-sizing:border-box;flex:1 1 0;width:auto;min-width:120px;max-width:240px}.KFXqYa_userPriceField{flex-direction:column;gap:4px;min-width:0;display:flex}.KFXqYa_userPriceField .KFXqYa_ctlLabel{flex:none;font-size:11px}.KFXqYa_userPriceInput,.KFXqYa_userPriceInputNum{border:1px solid var(--ds-border);background:var(--dsb-3);min-width:96px;max-width:160px;color:var(--ds-t-1);border-radius:6px;padding:4px 8px;font-size:12px;line-height:16px}.KFXqYa_userPriceInputNum{min-width:72px;max-width:88px}.KFXqYa_rdo{color:var(--ds-t-2);cursor:pointer;white-space:nowrap;align-items:center;gap:6px;font-size:12px;line-height:16px;display:inline-flex}.KFXqYa_rdo input{opacity:0;pointer-events:none;position:absolute}.KFXqYa_rdoDot{border:1px solid var(--ds-border-strong);background:var(--dsb-3);border-radius:50%;flex:none;width:14px;height:14px;position:relative}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot{border-color:var(--ds-blue)}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot:after{content:"";background:var(--ds-blue);border-radius:50%;position:absolute;inset:3px}.KFXqYa_inp{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:6px;align-items:center;gap:4px;padding:2px 6px;display:inline-flex}.KFXqYa_affix{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_prog{background:var(--dsb-3);min-width:0;height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.KFXqYa_progFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px}.KFXqYa_btn{border:1px solid var(--ds-border);height:28px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;line-height:16px;display:inline-flex}.KFXqYa_btn:hover{border-color:var(--ds-blue);color:var(--ds-t-1);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.KFXqYa_modelTable tbody td:not(:first-child) tbody td:not(:first-child){text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1)}.KFXqYa_sessionViewer{z-index:30;background:var(--dsb-2);flex-direction:column;gap:10px;padding:20px;display:flex;position:fixed;inset:0;overflow:hidden}.KFXqYa_sessionViewerHead{align-items:center;gap:10px;display:flex}.KFXqYa_sessionViewerTitle{margin:0;font-size:15px;font-weight:600}.KFXqYa_sessionViewerHead .KFXqYa_ubSearch{width:260px;max-width:55%;margin-left:auto}.KFXqYa_sessionViewerList{border:1px solid var(--ds-border);border-radius:var(--ds-r-2,8px);flex:1;min-height:0;overflow:auto}.KFXqYa_dashboard button:focus-visible,.KFXqYa_dashboard input:focus-visible,.KFXqYa_dashboard select:focus-visible,.KFXqYa_dashboard [role=button]:focus-visible,.KFXqYa_dashboard tr[tabindex]:focus-visible,.KFXqYa_trigger:focus-visible,.KFXqYa_railButton:focus-visible{outline:2px solid var(--ds-blue);outline-offset:1px}.KFXqYa_dashboard [hidden]{display:none!important}.KFXqYa_settingsSearch{align-self:stretch;width:100%;max-width:none;margin:0 0 12px}.KFXqYa_modelBudgetList{flex-direction:column;gap:8px;display:flex}.KFXqYa_modelBudgetTitle{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_modelBudgetHint{color:var(--ds-t-3);margin:0;font-size:11px;line-height:16px}.KFXqYa_modelBudgetRow{grid-template-columns:minmax(0,1fr) 56px 84px;align-items:center;gap:8px;display:grid}.KFXqYa_modelBudgetName{text-overflow:ellipsis;white-space:nowrap;color:var(--ds-t-2);font-size:12px;line-height:18px;overflow:hidden}.KFXqYa_modelBudgetCost{text-align:right;color:var(--ds-t-3);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.KFXqYa_helpTip{border:1px solid var(--ds-border);width:14px;height:14px;color:var(--ds-t-3);cursor:help;vertical-align:1px;border-radius:50%;flex:none;justify-content:center;align-items:center;margin-left:6px;font-size:10px;line-height:1;display:inline-flex}.KFXqYa_moreWorkList{flex-direction:column;gap:8px;display:flex}.KFXqYa_moreWorkRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-3);color:inherit;transition:border-color var(--ds-t-fast), background-color var(--ds-t-fast);flex-direction:column;gap:2px;padding:10px 12px;text-decoration:none;display:flex}.KFXqYa_moreWorkRow:hover{border-color:var(--ds-border-strong);background:var(--dsb-2)}.KFXqYa_moreWorkName{color:var(--ds-t-1);font-size:12px;font-weight:600;line-height:18px}.KFXqYa_moreWorkRow:hover .KFXqYa_moreWorkName{color:var(--ds-blue)}.KFXqYa_moreWorkDesc{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_contextEmpty{color:var(--ds-t-3);margin:8px 0;font-size:12px}.KFXqYa_agentSummary{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-2);flex-wrap:wrap;gap:8px 20px;margin-bottom:10px;padding:10px 12px;display:flex}.KFXqYa_agentSummaryItem{align-items:baseline;gap:5px;display:inline-flex}.KFXqYa_agentSummaryValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:15px;font-weight:600}.KFXqYa_agentSummaryLabel{color:var(--ds-t-3);font-size:11px}.KFXqYa_agentTree{flex-direction:column;gap:2px;display:flex}.KFXqYa_agentNode{flex-direction:column;display:flex}.KFXqYa_agentRow{border-radius:var(--ds-r-1);background:var(--dsb-2);align-items:center;gap:8px;padding:5px 8px;display:flex}.KFXqYa_agentKind{color:var(--ds-t-4);flex:none;font-size:10px}.KFXqYa_agentTitle{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--ds-t-1);flex:auto;font-size:12px;overflow:hidden}.KFXqYa_agentCalls{color:var(--ds-t-3);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.KFXqYa_agentCost{color:var(--ds-t-2);font-variant-numeric:tabular-nums;flex:none;font-size:11.5px}.KFXqYa_sessionLink{width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:none;padding:0;display:block}.KFXqYa_sessionLink:hover{color:var(--ds-blue);text-decoration:underline}.KFXqYa_sessionLink:focus-visible{outline:2px solid var(--ds-blue);outline-offset:2px;border-radius:3px}`,document.head.appendChild(e)}var R={affix:`KFXqYa_affix`,agentCalls:`KFXqYa_agentCalls`,agentCost:`KFXqYa_agentCost`,agentKind:`KFXqYa_agentKind`,agentNode:`KFXqYa_agentNode`,agentRow:`KFXqYa_agentRow`,agentSummary:`KFXqYa_agentSummary`,agentSummaryItem:`KFXqYa_agentSummaryItem`,agentSummaryLabel:`KFXqYa_agentSummaryLabel`,agentSummaryValue:`KFXqYa_agentSummaryValue`,agentTitle:`KFXqYa_agentTitle`,agentTree:`KFXqYa_agentTree`,balanceCell:`KFXqYa_balanceCell`,balanceDaysBadge:`KFXqYa_balanceDaysBadge`,balanceDaysBadgeLow:`KFXqYa_balanceDaysBadgeLow`,balanceDetailClose:`KFXqYa_balanceDetailClose`,balanceDetailGrid:`KFXqYa_balanceDetailGrid`,balanceDetailHead:`KFXqYa_balanceDetailHead`,balanceDetailLabel:`KFXqYa_balanceDetailLabel`,balanceDetailPop:`KFXqYa_balanceDetailPop`,balanceDetailRow:`KFXqYa_balanceDetailRow`,balanceDetailTitle:`KFXqYa_balanceDetailTitle`,balanceDetailValue:`KFXqYa_balanceDetailValue`,bandDot:`KFXqYa_bandDot`,bandDotOn:`KFXqYa_bandDotOn`,bandDots:`KFXqYa_bandDots`,"billing-perf":`KFXqYa_billing-perf`,"billing-pg":`KFXqYa_billing-pg`,"billing-settings":`KFXqYa_billing-settings`,"billing-trigger":`KFXqYa_billing-trigger`,btn:`KFXqYa_btn`,bucketCost:`KFXqYa_bucketCost`,bucketOfficial:`KFXqYa_bucketOfficial`,bucketSep:`KFXqYa_bucketSep`,bucketThird:`KFXqYa_bucketThird`,budgetFillOver:`KFXqYa_budgetFillOver`,budgetFillWarn:`KFXqYa_budgetFillWarn`,budgetInput:`KFXqYa_budgetInput`,budgetPulse:`KFXqYa_budgetPulse`,channelVisCell:`KFXqYa_channelVisCell`,channelVisList:`KFXqYa_channelVisList`,channelVisName:`KFXqYa_channelVisName`,channelVisRow:`KFXqYa_channelVisRow`,channelVisUsage:`KFXqYa_channelVisUsage`,chartArea:`KFXqYa_chartArea`,chartAxisLabel:`KFXqYa_chartAxisLabel`,chartBar:`KFXqYa_chartBar`,chartBarPlaceholder:`KFXqYa_chartBarPlaceholder`,chartCrosshair:`KFXqYa_chartCrosshair`,chartEmpty:`KFXqYa_chartEmpty`,chartGrid:`KFXqYa_chartGrid`,chartHoverDot:`KFXqYa_chartHoverDot`,chartLegend:`KFXqYa_chartLegend`,chartLegendBar:`KFXqYa_chartLegendBar`,chartLegendItem:`KFXqYa_chartLegendItem`,chartLegendItemActive:`KFXqYa_chartLegendItemActive`,chartLegendLine:`KFXqYa_chartLegendLine`,chartLine:`KFXqYa_chartLine`,chartStack:`KFXqYa_chartStack`,chartSvg:`KFXqYa_chartSvg`,chartTooltip:`KFXqYa_chartTooltip`,chartTooltipAlignLeft:`KFXqYa_chartTooltipAlignLeft`,chartTooltipAlignRight:`KFXqYa_chartTooltipAlignRight`,chartTooltipDate:`KFXqYa_chartTooltipDate`,chartTooltipHead:`KFXqYa_chartTooltipHead`,chartTooltipLabel:`KFXqYa_chartTooltipLabel`,chartTooltipModelDetail:`KFXqYa_chartTooltipModelDetail`,chartTooltipRow:`KFXqYa_chartTooltipRow`,chartTooltipSplit:`KFXqYa_chartTooltipSplit`,chartTooltipSwatch:`KFXqYa_chartTooltipSwatch`,chartWrap:`KFXqYa_chartWrap`,closeButton:`KFXqYa_closeButton`,contextEmpty:`KFXqYa_contextEmpty`,ctlCol:`KFXqYa_ctlCol`,ctlGroup:`KFXqYa_ctlGroup`,ctlLabel:`KFXqYa_ctlLabel`,ctlRow:`KFXqYa_ctlRow`,ctlRowStretch:`KFXqYa_ctlRowStretch`,currencyButton:`KFXqYa_currencyButton`,currencyButtonActive:`KFXqYa_currencyButtonActive`,currencyToggle:`KFXqYa_currencyToggle`,dashboard:`KFXqYa_dashboard`,dashboardBody:`KFXqYa_dashboardBody`,dashboardHead:`KFXqYa_dashboardHead`,dashboardIn:`KFXqYa_dashboardIn`,dashboardModal:`KFXqYa_dashboardModal`,dashboardRight:`KFXqYa_dashboardRight`,dashboardSubtitle:`KFXqYa_dashboardSubtitle`,dashboardTitle:`KFXqYa_dashboardTitle`,delta:`KFXqYa_delta`,deltaDown:`KFXqYa_deltaDown`,deltaUp:`KFXqYa_deltaUp`,densityButton:`KFXqYa_densityButton`,densityButtonActive:`KFXqYa_densityButtonActive`,densityButtonComfortable:`KFXqYa_densityButtonComfortable`,densityButtons:`KFXqYa_densityButtons`,densityLeft:`KFXqYa_densityLeft`,densityRow:`KFXqYa_densityRow`,emptyDesc:`KFXqYa_emptyDesc`,emptyDotPulse:`KFXqYa_emptyDotPulse`,emptyIll:`KFXqYa_emptyIll`,emptyIllDot:`KFXqYa_emptyIllDot`,emptyRow:`KFXqYa_emptyRow`,emptyState:`KFXqYa_emptyState`,emptyTitle:`KFXqYa_emptyTitle`,estimatedTag:`KFXqYa_estimatedTag`,exportBar:`KFXqYa_exportBar`,exportButton:`KFXqYa_exportButton`,exportLabel:`KFXqYa_exportLabel`,feeBar:`KFXqYa_feeBar`,feeBarAbove:`KFXqYa_feeBarAbove`,feeChipAlert:`KFXqYa_feeChipAlert`,feeChipError:`KFXqYa_feeChipError`,feeChipOff:`KFXqYa_feeChipOff`,feeChipPrimary:`KFXqYa_feeChipPrimary`,feeCount:`KFXqYa_feeCount`,feeInline:`KFXqYa_feeInline`,feeInlineAlert:`KFXqYa_feeInlineAlert`,feeInlineError:`KFXqYa_feeInlineError`,feeInlineNum:`KFXqYa_feeInlineNum`,feeItem:`KFXqYa_feeItem`,feeNum:`KFXqYa_feeNum`,feeSep:`KFXqYa_feeSep`,feeSuffix:`KFXqYa_feeSuffix`,feeTickFlash:`KFXqYa_feeTickFlash`,flatTag:`KFXqYa_flatTag`,floatModeBtn:`KFXqYa_floatModeBtn`,floatModeBtnOn:`KFXqYa_floatModeBtnOn`,floatSub:`KFXqYa_floatSub`,floatSubHead:`KFXqYa_floatSubHead`,floatSubName:`KFXqYa_floatSubName`,floatSubPlan:`KFXqYa_floatSubPlan`,floatTarget:`KFXqYa_floatTarget`,floatTargetLabel:`KFXqYa_floatTargetLabel`,healthBad:`KFXqYa_healthBad`,healthBadge:`KFXqYa_healthBadge`,healthBadgeBad:`KFXqYa_healthBadgeBad`,healthBadgeOk:`KFXqYa_healthBadgeOk`,healthDot:`KFXqYa_healthDot`,healthIdle:`KFXqYa_healthIdle`,healthOk:`KFXqYa_healthOk`,heatmap:`KFXqYa_heatmap`,heatmapCell:`KFXqYa_heatmapCell`,heatmapCellEmpty:`KFXqYa_heatmapCellEmpty`,heatmapFooter:`KFXqYa_heatmapFooter`,heatmapGrid:`KFXqYa_heatmapGrid`,heatmapHalf:`KFXqYa_heatmapHalf`,heatmapHover:`KFXqYa_heatmapHover`,heatmapLegend:`KFXqYa_heatmapLegend`,heatmapRangeButton:`KFXqYa_heatmapRangeButton`,heatmapRangeButtonActive:`KFXqYa_heatmapRangeButtonActive`,heatmapRangeSwitch:`KFXqYa_heatmapRangeSwitch`,heatmapYear:`KFXqYa_heatmapYear`,heatmapYearBody:`KFXqYa_heatmapYearBody`,heatmapYearCell:`KFXqYa_heatmapYearCell`,heatmapYearGrid:`KFXqYa_heatmapYearGrid`,heatmapYearMonth:`KFXqYa_heatmapYearMonth`,heatmapYearMonths:`KFXqYa_heatmapYearMonths`,heatmapYearScroll:`KFXqYa_heatmapYearScroll`,heatmapYearWeekday:`KFXqYa_heatmapYearWeekday`,heatmapYearWeekdays:`KFXqYa_heatmapYearWeekdays`,helpTip:`KFXqYa_helpTip`,hero:`KFXqYa_hero`,heroCurrency:`KFXqYa_heroCurrency`,heroGauge:`KFXqYa_heroGauge`,heroGaugeArc:`KFXqYa_heroGaugeArc`,heroGaugeArcOver:`KFXqYa_heroGaugeArcOver`,heroGaugeCenter:`KFXqYa_heroGaugeCenter`,heroGaugeDial:`KFXqYa_heroGaugeDial`,heroGaugeLabel:`KFXqYa_heroGaugeLabel`,heroGaugeRemain:`KFXqYa_heroGaugeRemain`,heroGaugeRemainOver:`KFXqYa_heroGaugeRemainOver`,heroGaugeSub:`KFXqYa_heroGaugeSub`,heroGaugeSvg:`KFXqYa_heroGaugeSvg`,heroGaugeTrack:`KFXqYa_heroGaugeTrack`,heroLabel:`KFXqYa_heroLabel`,heroMain:`KFXqYa_heroMain`,heroMeta:`KFXqYa_heroMeta`,heroPred:`KFXqYa_heroPred`,heroReadout:`KFXqYa_heroReadout`,heroSide:`KFXqYa_heroSide`,heroSideItem:`KFXqYa_heroSideItem`,heroSideLabel:`KFXqYa_heroSideLabel`,heroSideSpacer:`KFXqYa_heroSideSpacer`,heroSideValue:`KFXqYa_heroSideValue`,heroTop:`KFXqYa_heroTop`,heroValue:`KFXqYa_heroValue`,inp:`KFXqYa_inp`,kindBadge:`KFXqYa_kindBadge`,kindBadgeRelay:`KFXqYa_kindBadgeRelay`,kindBadgeUnknown:`KFXqYa_kindBadgeUnknown`,kpiCustomRange:`KFXqYa_kpiCustomRange`,kpiDelta:`KFXqYa_kpiDelta`,kpiDeltaDown:`KFXqYa_kpiDeltaDown`,kpiDeltaFlat:`KFXqYa_kpiDeltaFlat`,kpiDeltaUp:`KFXqYa_kpiDeltaUp`,kpiDetail:`KFXqYa_kpiDetail`,kpiGreen:`KFXqYa_kpiGreen`,kpiGrid:`KFXqYa_kpiGrid`,kpiLabel:`KFXqYa_kpiLabel`,kpiLabelRow:`KFXqYa_kpiLabelRow`,kpiSpark:`KFXqYa_kpiSpark`,kpiTile:`KFXqYa_kpiTile`,kpiValue:`KFXqYa_kpiValue`,kpiZone:`KFXqYa_kpiZone`,kpiZoneHead:`KFXqYa_kpiZoneHead`,kpiZoneLabel:`KFXqYa_kpiZoneLabel`,metricCell:`KFXqYa_metricCell`,metricGrid:`KFXqYa_metricGrid`,metricLabel:`KFXqYa_metricLabel`,metricValue:`KFXqYa_metricValue`,metricValueSuccess:`KFXqYa_metricValueSuccess`,modalFooter:`KFXqYa_modalFooter`,modelBudgetCost:`KFXqYa_modelBudgetCost`,modelBudgetHint:`KFXqYa_modelBudgetHint`,modelBudgetList:`KFXqYa_modelBudgetList`,modelBudgetName:`KFXqYa_modelBudgetName`,modelBudgetRow:`KFXqYa_modelBudgetRow`,modelBudgetTitle:`KFXqYa_modelBudgetTitle`,modelCell:`KFXqYa_modelCell`,modelChannelTag:`KFXqYa_modelChannelTag`,modelChannels:`KFXqYa_modelChannels`,modelDot:`KFXqYa_modelDot`,modelName:`KFXqYa_modelName`,modelProvider:`KFXqYa_modelProvider`,modelRowActive:`KFXqYa_modelRowActive`,modelRowFocusable:`KFXqYa_modelRowFocusable`,modelTable:`KFXqYa_modelTable`,moreWorkDesc:`KFXqYa_moreWorkDesc`,moreWorkList:`KFXqYa_moreWorkList`,moreWorkName:`KFXqYa_moreWorkName`,moreWorkRow:`KFXqYa_moreWorkRow`,na:`KFXqYa_na`,nativeSettingsBody:`KFXqYa_nativeSettingsBody`,nativeSettingsDashboard:`KFXqYa_nativeSettingsDashboard`,nativeSettingsLayout:`KFXqYa_nativeSettingsLayout`,nativeSettingsRoot:`KFXqYa_nativeSettingsRoot`,noticeAction:`KFXqYa_noticeAction`,noticeDismiss:`KFXqYa_noticeDismiss`,numCol:`KFXqYa_numCol`,offPeak:`KFXqYa_offPeak`,panel:`KFXqYa_panel`,panelHead:`KFXqYa_panelHead`,panelHeadControls:`KFXqYa_panelHeadControls`,panelHint:`KFXqYa_panelHint`,panelTitle:`KFXqYa_panelTitle`,peak:`KFXqYa_peak`,peakAlertIn:`KFXqYa_peakAlertIn`,peakAlertPop:`KFXqYa_peakAlertPop`,peakCard:`KFXqYa_peakCard`,peakCardCenter:`KFXqYa_peakCardCenter`,peakCardCorner:`KFXqYa_peakCardCorner`,peakCardOff:`KFXqYa_peakCardOff`,peakCardPeak:`KFXqYa_peakCardPeak`,peakClose:`KFXqYa_peakClose`,peakCount:`KFXqYa_peakCount`,peakCountPrimary:`KFXqYa_peakCountPrimary`,peakCountSuccess:`KFXqYa_peakCountSuccess`,peakDesc:`KFXqYa_peakDesc`,peakDot:`KFXqYa_peakDot`,peakDotPrimary:`KFXqYa_peakDotPrimary`,peakDotSuccess:`KFXqYa_peakDotSuccess`,peakHead:`KFXqYa_peakHead`,peakTag:`KFXqYa_peakTag`,peakTagPrimary:`KFXqYa_peakTagPrimary`,peakTagSuccess:`KFXqYa_peakTagSuccess`,perfBar:`KFXqYa_perfBar`,perfChip:`KFXqYa_perfChip`,perfChipDot:`KFXqYa_perfChipDot`,perfChipOff:`KFXqYa_perfChipOff`,perfChips:`KFXqYa_perfChips`,perfCompareBar:`KFXqYa_perfCompareBar`,perfCompareDot:`KFXqYa_perfCompareDot`,perfCompareList:`KFXqYa_perfCompareList`,perfCompareName:`KFXqYa_perfCompareName`,perfCompareNum:`KFXqYa_perfCompareNum`,perfCompareRow:`KFXqYa_perfCompareRow`,perfHero:`KFXqYa_perfHero`,perfHeroBar:`KFXqYa_perfHeroBar`,perfHeroCell:`KFXqYa_perfHeroCell`,perfHeroLbl:`KFXqYa_perfHeroLbl`,perfHeroUnit:`KFXqYa_perfHeroUnit`,perfHeroVal:`KFXqYa_perfHeroVal`,planTag:`KFXqYa_planTag`,planTagBadge:`KFXqYa_planTagBadge`,plgDesc:`KFXqYa_plgDesc`,plgGrid:`KFXqYa_plgGrid`,plgHead:`KFXqYa_plgHead`,plgIcon:`KFXqYa_plgIcon`,plgItem:`KFXqYa_plgItem`,plgLabel:`KFXqYa_plgLabel`,plgLink:`KFXqYa_plgLink`,plgName:`KFXqYa_plgName`,plgNameRow:`KFXqYa_plgNameRow`,plgTag:`KFXqYa_plgTag`,plgTitle:`KFXqYa_plgTitle`,plgVal:`KFXqYa_plgVal`,popDot:`KFXqYa_popDot`,popDotDirect:`KFXqYa_popDotDirect`,popDotNeutral:`KFXqYa_popDotNeutral`,popDotSub:`KFXqYa_popDotSub`,popError:`KFXqYa_popError`,popErrorDetail:`KFXqYa_popErrorDetail`,popErrorTitle:`KFXqYa_popErrorTitle`,popHead:`KFXqYa_popHead`,popModel:`KFXqYa_popModel`,popModelLabel:`KFXqYa_popModelLabel`,popModelName:`KFXqYa_popModelName`,popModelRow:`KFXqYa_popModelRow`,popModelStatus:`KFXqYa_popModelStatus`,popModelStatusLow:`KFXqYa_popModelStatusLow`,popTagPrimary:`KFXqYa_popTagPrimary`,popTagSub:`KFXqYa_popTagSub`,popTitle:`KFXqYa_popTitle`,prog:`KFXqYa_prog`,progFill:`KFXqYa_progFill`,providerCtlRow:`KFXqYa_providerCtlRow`,providerGroup:`KFXqYa_providerGroup`,providerGroupBadge:`KFXqYa_providerGroupBadge`,providerGroupBalance:`KFXqYa_providerGroupBalance`,providerGroupBalanceLabel:`KFXqYa_providerGroupBalanceLabel`,providerGroupCollapsible:`KFXqYa_providerGroupCollapsible`,providerGroupCost:`KFXqYa_providerGroupCost`,providerGroupCostLabel:`KFXqYa_providerGroupCostLabel`,providerGroupCostValue:`KFXqYa_providerGroupCostValue`,providerGroupHead:`KFXqYa_providerGroupHead`,providerGroupList:`KFXqYa_providerGroupList`,providerGroupMeta:`KFXqYa_providerGroupMeta`,providerGroupName:`KFXqYa_providerGroupName`,providerGroupRecharge:`KFXqYa_providerGroupRecharge`,providerGroupTitle:`KFXqYa_providerGroupTitle`,providerStatCell:`KFXqYa_providerStatCell`,providerStatLbl:`KFXqYa_providerStatLbl`,providerStatRow:`KFXqYa_providerStatRow`,providerStatSub:`KFXqYa_providerStatSub`,providerStatVal:`KFXqYa_providerStatVal`,providerTodayToggle:`KFXqYa_providerTodayToggle`,railButton:`KFXqYa_railButton`,rangeButton:`KFXqYa_rangeButton`,rangeButtonActive:`KFXqYa_rangeButtonActive`,rangeToggle:`KFXqYa_rangeToggle`,rdo:`KFXqYa_rdo`,rdoChevron:`KFXqYa_rdoChevron`,rdoChevronOpen:`KFXqYa_rdoChevronOpen`,rdoDot:`KFXqYa_rdoDot`,rdoLabel:`KFXqYa_rdoLabel`,rdoRow:`KFXqYa_rdoRow`,rdoSelect:`KFXqYa_rdoSelect`,reconcileDismiss:`KFXqYa_reconcileDismiss`,reconcileIcon:`KFXqYa_reconcileIcon`,reconcileNotice:`KFXqYa_reconcileNotice`,reconcileText:`KFXqYa_reconcileText`,rounds:`KFXqYa_rounds`,roundsAxis:`KFXqYa_roundsAxis`,roundsBar:`KFXqYa_roundsBar`,roundsBarCol:`KFXqYa_roundsBarCol`,roundsBarColOff:`KFXqYa_roundsBarColOff`,roundsBarColPeak:`KFXqYa_roundsBarColPeak`,roundsBarFlagged:`KFXqYa_roundsBarFlagged`,roundsBarLabel:`KFXqYa_roundsBarLabel`,roundsBarWrap:`KFXqYa_roundsBarWrap`,roundsBars:`KFXqYa_roundsBars`,roundsEmpty:`KFXqYa_roundsEmpty`,roundsFlagMark:`KFXqYa_roundsFlagMark`,sessionChildRow:`KFXqYa_sessionChildRow`,sessionGroupRow:`KFXqYa_sessionGroupRow`,sessionLink:`KFXqYa_sessionLink`,sessionSubDeepRow:`KFXqYa_sessionSubDeepRow`,sessionViewer:`KFXqYa_sessionViewer`,sessionViewerHead:`KFXqYa_sessionViewerHead`,sessionViewerList:`KFXqYa_sessionViewerList`,sessionViewerTitle:`KFXqYa_sessionViewerTitle`,setCard:`KFXqYa_setCard`,setCardDesc:`KFXqYa_setCardDesc`,setCardHead:`KFXqYa_setCardHead`,setCardMeta:`KFXqYa_setCardMeta`,setCardTitle:`KFXqYa_setCardTitle`,setCell:`KFXqYa_setCell`,setGrid2:`KFXqYa_setGrid2`,setGrid3:`KFXqYa_setGrid3`,setHint:`KFXqYa_setHint`,settingsLayout:`KFXqYa_settingsLayout`,settingsNav:`KFXqYa_settingsNav`,settingsNavIcon:`KFXqYa_settingsNavIcon`,settingsNavItem:`KFXqYa_settingsNavItem`,settingsNavItemActive:`KFXqYa_settingsNavItemActive`,settingsNavItemAdvanced:`KFXqYa_settingsNavItemAdvanced`,settingsPane:`KFXqYa_settingsPane`,settingsSearch:`KFXqYa_settingsSearch`,shareDot:`KFXqYa_shareDot`,shareItem:`KFXqYa_shareItem`,shareLegend:`KFXqYa_shareLegend`,shareSeg:`KFXqYa_shareSeg`,shareSegAssistant:`KFXqYa_shareSegAssistant`,shareSegOff:`KFXqYa_shareSegOff`,shareSegPeak:`KFXqYa_shareSegPeak`,shareSegTool:`KFXqYa_shareSegTool`,shareSegUser:`KFXqYa_shareSegUser`,shareTrack:`KFXqYa_shareTrack`,shareValue:`KFXqYa_shareValue`,siteKindDirect:`KFXqYa_siteKindDirect`,siteKindSite:`KFXqYa_siteKindSite`,siteKindTag:`KFXqYa_siteKindTag`,siteKindUnknown:`KFXqYa_siteKindUnknown`,siteRow:`KFXqYa_siteRow`,siteRowCalls:`KFXqYa_siteRowCalls`,siteRowCallsLow:`KFXqYa_siteRowCallsLow`,siteRowCost:`KFXqYa_siteRowCost`,siteRowMeta:`KFXqYa_siteRowMeta`,siteRowName:`KFXqYa_siteRowName`,siteRowTitle:`KFXqYa_siteRowTitle`,soon:`KFXqYa_soon`,staleNotice:`KFXqYa_staleNotice`,staleNoticeBody:`KFXqYa_staleNoticeBody`,staleNoticeSub:`KFXqYa_staleNoticeSub`,subscriptionAuto:`KFXqYa_subscriptionAuto`,subscriptionCard:`KFXqYa_subscriptionCard`,subscriptionCardUpgraded:`KFXqYa_subscriptionCardUpgraded`,subscriptionExhausted:`KFXqYa_subscriptionExhausted`,subscriptionFill:`KFXqYa_subscriptionFill`,subscriptionFillOver:`KFXqYa_subscriptionFillOver`,subscriptionFillWarn:`KFXqYa_subscriptionFillWarn`,subscriptionGrid:`KFXqYa_subscriptionGrid`,subscriptionHead:`KFXqYa_subscriptionHead`,subscriptionMeta:`KFXqYa_subscriptionMeta`,subscriptionName:`KFXqYa_subscriptionName`,subscriptionPct:`KFXqYa_subscriptionPct`,subscriptionPlan:`KFXqYa_subscriptionPlan`,subscriptionReset:`KFXqYa_subscriptionReset`,subscriptionStatus:`KFXqYa_subscriptionStatus`,subscriptionTier:`KFXqYa_subscriptionTier`,subscriptionTrack:`KFXqYa_subscriptionTrack`,subscriptionWindow:`KFXqYa_subscriptionWindow`,subscriptionWindowLabel:`KFXqYa_subscriptionWindowLabel`,switch:`KFXqYa_switch`,switchKnob:`KFXqYa_switchKnob`,switchOn:`KFXqYa_switchOn`,tabBadge:`KFXqYa_tabBadge`,tabBadgeHot:`KFXqYa_tabBadgeHot`,tabBadgeViolet:`KFXqYa_tabBadgeViolet`,tabBadgeWarn:`KFXqYa_tabBadgeWarn`,tabButton:`KFXqYa_tabButton`,tabButtonActive:`KFXqYa_tabButtonActive`,tabNav:`KFXqYa_tabNav`,tabNavLabel:`KFXqYa_tabNavLabel`,tabPanel:`KFXqYa_tabPanel`,tabPanelIn:`KFXqYa_tabPanelIn`,tabRail:`KFXqYa_tabRail`,tabRailIcon:`KFXqYa_tabRailIcon`,tabRailItem:`KFXqYa_tabRailItem`,tabRailItemActive:`KFXqYa_tabRailItemActive`,tabRailLabel:`KFXqYa_tabRailLabel`,tableScroll:`KFXqYa_tableScroll`,tokenModelBar:`KFXqYa_tokenModelBar`,tokenModelPartIn:`KFXqYa_tokenModelPartIn`,tokenModelPartOut:`KFXqYa_tokenModelPartOut`,tokenModelParts:`KFXqYa_tokenModelParts`,tokenModelShareRow:`KFXqYa_tokenModelShareRow`,tokenPanel:`KFXqYa_tokenPanel`,trigger:`KFXqYa_trigger`,triggerBudgetHot:`KFXqYa_triggerBudgetHot`,triggerBudgetOver:`KFXqYa_triggerBudgetOver`,triggerBudgetPulse:`KFXqYa_triggerBudgetPulse`,triggerDelta:`KFXqYa_triggerDelta`,triggerDeltaDown:`KFXqYa_triggerDeltaDown`,triggerDeltaUp:`KFXqYa_triggerDeltaUp`,triggerGaugeArc:`KFXqYa_triggerGaugeArc`,triggerGaugeNeedle:`KFXqYa_triggerGaugeNeedle`,triggerGlow:`KFXqYa_triggerGlow`,triggerGlowPulse:`KFXqYa_triggerGlowPulse`,triggerIcon:`KFXqYa_triggerIcon`,triggerLabel:`KFXqYa_triggerLabel`,triggerMain:`KFXqYa_triggerMain`,triggerMetric:`KFXqYa_triggerMetric`,triggerPop:`KFXqYa_triggerPop`,triggerPopEmpty:`KFXqYa_triggerPopEmpty`,triggerPopShown:`KFXqYa_triggerPopShown`,triggerPopSwitchCount:`KFXqYa_triggerPopSwitchCount`,triggerPopSwitcher:`KFXqYa_triggerPopSwitcher`,triggerPrimary:`KFXqYa_triggerPrimary`,triggerScan:`KFXqYa_triggerScan`,triggerSpark:`KFXqYa_triggerSpark`,triggerSparkBar:`KFXqYa_triggerSparkBar`,triggerSparkBreath:`KFXqYa_triggerSparkBreath`,triggerSparkHot:`KFXqYa_triggerSparkHot`,triggerStatsError:`KFXqYa_triggerStatsError`,triggerValueRow:`KFXqYa_triggerValueRow`,triggerWrap:`KFXqYa_triggerWrap`,triggerYen:`KFXqYa_triggerYen`,ubAlert:`KFXqYa_ubAlert`,ubAlertLeft:`KFXqYa_ubAlertLeft`,ubAlertNote:`KFXqYa_ubAlertNote`,ubCard:`KFXqYa_ubCard`,ubCardControlGroup:`KFXqYa_ubCardControlGroup`,ubCardHead:`KFXqYa_ubCardHead`,ubCardSub:`KFXqYa_ubCardSub`,ubCardTitle:`KFXqYa_ubCardTitle`,ubChipLabel:`KFXqYa_ubChipLabel`,ubChipOff:`KFXqYa_ubChipOff`,ubChipPeak:`KFXqYa_ubChipPeak`,ubExtraName:`KFXqYa_ubExtraName`,ubExtraNote:`KFXqYa_ubExtraNote`,ubExtraRow:`KFXqYa_ubExtraRow`,ubModel:`KFXqYa_ubModel`,ubModelName:`KFXqYa_ubModelName`,ubNotes:`KFXqYa_ubNotes`,ubNotesDesc:`KFXqYa_ubNotesDesc`,ubNotesItem:`KFXqYa_ubNotesItem`,ubNotesTerm:`KFXqYa_ubNotesTerm`,ubRate:`KFXqYa_ubRate`,ubSearch:`KFXqYa_ubSearch`,ubTable:`KFXqYa_ubTable`,ubTablewrap:`KFXqYa_ubTablewrap`,ubTablewrapPricing:`KFXqYa_ubTablewrapPricing`,ubTag:`KFXqYa_ubTag`,ubTagAlert:`KFXqYa_ubTagAlert`,ubTagError:`KFXqYa_ubTagError`,ubTagNeutral:`KFXqYa_ubTagNeutral`,ubTagPromo:`KFXqYa_ubTagPromo`,ubTagSuccess:`KFXqYa_ubTagSuccess`,uncataloguedTag:`KFXqYa_uncataloguedTag`,unknownHint:`KFXqYa_unknownHint`,unpricedHint:`KFXqYa_unpricedHint`,unpricedHintBody:`KFXqYa_unpricedHintBody`,userPriceBody:`KFXqYa_userPriceBody`,userPriceCheck:`KFXqYa_userPriceCheck`,userPriceField:`KFXqYa_userPriceField`,userPriceInput:`KFXqYa_userPriceInput`,userPriceInputNum:`KFXqYa_userPriceInputNum`,userPriceLineMeta:`KFXqYa_userPriceLineMeta`,userPricePriceLine:`KFXqYa_userPricePriceLine`,userPriceRow:`KFXqYa_userPriceRow`};let it=`usageBilling`,at={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,monthProjectedHint:`本月已发生 + 近 7 天节奏 × 剩余天数`,liveTurn:`本轮`,liveSession:`会话`,liveSessionSub:`含子 {cost}`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,kpiRange:`统计范围`,avgRangeToday:`今日`,avgRange7d:`近7天`,avgRangeWeek:`本周`,avgRangeMonth:`本月`,avgRangeAll:`累计`,avgRangeCustom:`自定义`,customRangeStart:`开始日期`,customRangeEnd:`结束日期`,trend:`每日费用与调用趋势`,trend7d:`7 天`,trend30d:`30 天`,trendMetric:`趋势指标`,trendMetricCost:`费用`,trendMetricTokens:`Token`,pricingSearch:`搜索模型 / 厂商`,bandPinHint:`点击固定到输入框`,trendEmpty:`暂无趋势数据`,trendTotal:`总计`,roundsUnit:`轮`,healthModelsLive:`{n} 模型可用`,healthVendorsDown:`{n} 厂商失效`,healthVendorsUnavailable:`{n} 厂商不可用`,budget:`本月预算`,budgetRemain:`剩余预算`,budgetAmount:`预算金额`,budgetSummary:`本月已用 {used} / {total};达到 80% 时提醒,达到 100% 时红色脉冲警示`,sessions:`会话明细`,sessionTitle:`标题`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`提供商计费与订阅`,channelUnknown:`未知路由`,directTag:`直连`,relayTag:`中转`,unknownTag:`未知`,unknownChannelHint:`通道未在插件配置中注册,支出主体无法核实,费用不计入口径,仅统计用量。`,planCountUnit:`套餐`,actual:`实际`,pricing:`模型单价表`,input:`输入`,output:`输出`,cacheHit:`缓存命中`,peak:`高峰`,offPeak:`低谷`,flat:`全天统一`,band:`时段`,close:`关闭`,footer:`每 30s 自动轮询 · 仅统计本机 dsh 会话`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`数据更新于`,noData:`暂无计费数据`,todayRate:`今日汇率`,rateLive:`实时`,rateBuiltin:`内置`,pricingSyncedAt:`上次同步`,pricingSyncNow:`立即同步`,pricingSyncing:`同步中…`,promoBadge:`促`,promoUntil:`促销价至 {date},之后自动恢复刊例价`,promoOpenEnded:`厂商未公布截止时间,当前按折扣计价;公告截止后自动恢复刊例价`,pricingTip:`DeepSeek 现行刊例:V4.1 Flash 谷档 未命中 ¥1 / 缓存命中 ¥0.02 / 输出 ¥4;V4 Pro 谷档 未命中 ¥4.5 / 缓存命中 ¥0.15 / 输出 ¥13.5;峰价均为谷价 × 2。工作日 9-12 / 14-18 为高峰价,其余时段(含周末全天)为低谷价;费用按调用时刻计。`,pricingUnit:`单位:人民币 / 每百万 Token`,pricingNotes:`计价说明`,ubPeak:`峰`,ubOff:`谷`,ubStd:`标准`,peakBand:`峰谷分带`,pricingSource:`数据来源`,noteCache:`命中部分按缓存价计费,显著降低成本。`,noteBand:`高峰与空闲时段单价不同,空闲约半价。`,noteSource:`价格来自实时汇率 + 模型定价目录,未收录模型按 0 计并提示。`,balance:`余额`,recharge:`充值`,rechargeHint:`打开该厂商官方平台的充值页`,balanceUnconfigured:`未配置`,balanceUnauthorized:`密钥无效`,balanceUnreachable:`查询失败`,uncatalogued:`未收录`,estimatedPricing:`估算价`,balanceDays:`约可撑 {days} 天`,balanceLowBody:`{name} 余额 {balance},约可撑 {days} 天,请及时充值`,reconcileDrift:`系统监控到{provider}官方余额变动 {spent},本面板记录 {today},差额通常由其它工具或 API 的消耗所致`,reconcileDismiss:`知道了`,subscriptionNotConfigured:`未配置密钥`,subscriptionUnauthorized:`密钥无效`,subscriptionUnavailable:`查询失败`,subscriptionInvalid:`响应异常`,subscriptionRateLimited:`触发限流`,subscriptionSession:`本次`,subscriptionWeekly:`本周`,subscriptionMonthly:`本月`,subscriptionBilling:`计费周期`,subscriptionRemaining:`剩余 {pct}%`,subscriptionExhausted:`已用尽`,subscriptionReset:`{date} 重置`,subscriptionNoApi:`该厂商暂未提供用量查询接口`,floatWindow:`模型用量悬浮窗`,floatModeCombined:`综合`,floatModeSubscription:`订阅卡`,floatMode:`展示模式`,floatTargets:`订阅目标`,floatWindowHint:`悬浮在左下角计费卡上的用量速览;综合=当前样式,订阅卡=每次展示一张订阅额度卡(可切换)。`,floatPrimaryToday:`今日`,floatPrimaryWeek:`本周`,floatPrimaryMonth:`本月`,cardDisplay:`计费卡显示`,cardDisplayHint:`选择侧栏入口的占用方式,并切换主指标与统计范围;完全隐藏后可从宿主设置或 /usage 恢复。隐藏不会停止统计或提醒。`,cardMode:`侧栏入口`,cardModeFull:`完整卡片`,cardModeCompact:`紧凑图标`,cardModeHidden:`完全隐藏`,cardModeHiddenHint:`恢复显示:打开宿主设置 → 用量与费用 → 完整卡片;也可通过 /usage 或「打开用量计费仪表盘」快捷键直接打开仪表盘后恢复。`,cardModeFallback:`当前宿主没有原生设置页或 /usage 入口,完全隐藏已降级为紧凑图标,避免仪表盘无法打开。`,nativeSettingsNav:`用量与费用`,nativeSettingsIntro:`管理侧栏计费入口的显示方式。修改即时生效,并与仪表盘内的设置同步。`,nativeSettingsHiddenHint:`侧栏入口当前已隐藏。选择「完整卡片」或「紧凑图标」即可恢复;隐藏期间也可用「打开用量计费仪表盘」快捷键直接打开面板(绑定在宿主设置 → 快捷键里修改)。统计与提醒一直保持运行。`,shortcutOpenDashboard:`打开用量计费仪表盘`,cardMetric:`主指标`,cardMetricMoney:`金额`,cardMetricTokens:`Token`,cardSpan:`统计范围`,cardSpanDay:`日`,cardSpanWeek:`周`,cardSpanMonth:`月`,cardDeltaBadge:`今日环比徽章`,cardDeltaShow:`显示`,cardDeltaHide:`隐藏`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,balanceStaleNotice:`余额刷新较慢,以下为上一次查询结果`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,费用按目录价重估),模型归属可能有误差`,staleSnapshotNotice:`用量正在重算,以下数据来自上一次计算(可能不是最新,会话标题等以工作区为准)`,statsLoadFailed:`统计数据读取失败,下方数字可能不完整`,unreadableNotice:`{count} 个会话的用量未完整计入(原始日志未动,不会丢失)`,unreadableNoLedgerNotice:`其中 {count} 个无历史存档,用量完全未计入`,unreadableFormatNotice:`其中 {count} 个因会话格式不受当前宿主支持:过新格式升级宿主后自动恢复,过旧格式(如 v0/v3)需先迁移`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;模型可用下拉候选(目录键或模型 id);来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价(协议可省);低谷价三栏填后按峰/谷混合估算,留空=平档`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceOffPeak:`低谷价`,userPriceNormal:`标准价`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemoveSelected:`删除所选`,userPriceSelect:`选择此行`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,sessionSubCost:`含子智能体 {cost}`,sessionSubCalls:`含子智能体 {calls} 次调用`,sessionSubRow:`子智能体`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,currencyEur:`欧元`,language:`界面语言`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabPricing:`费率`,tabSettings:`设置`,budgetHint:`设置月度上限,用于本月预计与超支分段提醒`,peakAlertHint:`在切档前弹窗提醒,可选同步系统通知`,peakAlertDescPeak:`即将进入高峰时段,价格将上调,请提前安排长任务`,peakAlertDescOff:`即将进入平价时段,价格减半,适合运行大批量任务`,peakAlertDescPeakZhipu:`即将进入高峰时段(工作日 14:00–18:00),Coding Plan 额度将按基础积分全额抵扣`,peakAlertDescOffZhipu:`即将进入非高峰时段,Coding Plan 额度按基础积分 5 折抵扣`,peakAlertQueuePeak:`{count} 个排队任务将等待下一低谷;已开始任务继续执行`,peakAlertQueueOff:`{count} 个排队任务将按顺序启动`,export:`导出`,exportCsvDay:`按日 CSV`,exportCsvSession:`按会话 CSV`,exportJson:`全量 JSON`,peakShare:`峰谷时段占比`,peakSharePerCall:`按调用时刻精确判档`,offPeakSavings:`挪谷可省约 {amount}`,perfMax:`最大 TTFT`,weekCost:`本周消耗金额`,roleCost:`费用构成`,roleUser:`用户输入`,roleAssistant:`助手输出`,roleTool:`工具结果`,roleHint:`估算:输出按实测计价,输入按消息长度摊分`,tierPeak:`峰时`,tierOff:`平价`,tierToPeak:`后转峰时`,tierToOff:`后转平价`,tierAlertEnterPeak:`{minutes} 分钟后进入峰时(DeepSeek 高峰价 ×2),不急的调用可稍等`,tierAlertEnterOff:`{minutes} 分钟后进入平价(价格减半)`,tierAlertEnterPeakZhipu:`{minutes} 分钟后进入智谱高峰时段,Coding Plan 额度将全额抵扣`,tierAlertEnterOffZhipu:`{minutes} 分钟后进入智谱非高峰时段,额度按基础积分 5 折抵扣`,peakAlertTitlePeak:`即将进入高峰价`,peakAlertTitleOff:`即将进入平价`,peakAlert:`峰谷切换提醒`,peakAlertLeadMin:`提前量(分钟)`,peakAlertPos:`位置`,peakAlertMode:`提醒模式`,peakAlertPosCorner:`右下角`,peakAlertPosCenter:`屏幕居中`,peakAlertModePeak:`仅进入峰时`,peakAlertModeOff:`仅进入平价`,peakAlertModeBoth:`峰与谷都提醒`,peakAlertWebNotify:`同时发系统通知`,peakAlertPreview:`预览提醒`,planTypeCode:`订阅制`,planTypeToken:`按量`,subscriptionFeePerMonth:`{amount}/月`,triggerToday:`今日消耗金额`,triggerMonth:`当月消耗金额`,triggerMonthTokens:`当月消耗 Token`,triggerTodayTokens:`今日消耗 Token`,triggerWeekTokens:`本周消耗 Token`,subscriptionTag:`订阅`,cellEstimateHint:`本行无按量扣费记录(订阅通道不逐次计费),金额按目录价估算`,free:`免费`,perfSamples:`样本`,perfTtft:`首字延时`,perfP50:`P50`,perfP90:`P90`,perfTps:`生成速度`,perfLatency:`总延迟`,perfEstimated:`估算样本`,perfEmpty:`暂无性能数据`,perfTpsUnit:`tok/s`,perfTitle:`性能`,perfHint:`按模型与按小时聚合;估算样本为工具续写步骤`,perfAll:`全选`,perfChartEmpty:`未选择模型或该指标暂无数据`,heatmapYear:`年`,heatmapHalf:`半年`,heatmapMonth:`月`,metricCost:`费用`,metricTokens:`Token`,heatmapTotal:`合计`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,densityLabel:`显示密度`,densityHint:`紧凑减小行高与留白,舒适加大;切换即时生效`,densityCompact:`紧凑`,densityDefault:`默认`,densityComfortable:`舒适`,motionLabel:`动效强度`,motionHint:`关闭后所有入场与数据更新动画静止,保留基础交互反馈`,motionOff:`关闭`,motionSubtle:`克制`,motionRich:`丰富`,settingsNavDisplayPref:`偏好`,settingsNavBudget:`预算`,settingsNavAlert:`提醒`,settingsNavDisplay:`显示`,settingsNavAdvanced:`高级`,settingsNavAbout:`关于`,settingsSearchPlaceholder:`搜索设置…(如:预算、峰谷、单价)`,settingsSearchEmpty:`没有匹配「{query}」的设置项`,sessionsViewAll:`查看全部 {count} 个会话`,sessionsViewTop:`查看花费前 {count} 个会话`,sessionViewerSearch:`搜索会话…(标题 / 项目 / id)`,modelBudgetTitle:`按模型预算`,modelBudgetHint:`为单个模型设本月上限(人民币元);跨 80% / 100% 各提醒一次,留空 = 不限。`,modelBudgetBody:`「{model}」本月已 {cost}(预算 {budget} 的 {pct}%)`,modelBudgetPlaceholder:`上限`,moreWorksTitle:`更多作品`,adEngramName:`DSH Engram · 记忆宫殿`,adEngramDesc:`跨会话长期记忆:记忆图谱 · 混合检索 · 知识飞轮`,adRainbowName:`RainbowSpeak · 虹语`,adRainbowDesc:`聊天输入框的彩虹流光边框,持续流动的渐变光环`,kpiDescCacheHit:`缓存命中 token ÷ 总输入 token。命中率越高,输入费用越低(缓存读单价约为未命中的 1/10)。`,kpiDescTokens:`总处理 token = 输入 + 输出。缓存读/写已含在输入内,不重复计数(issue #85 口径)。`,kpiDescAvgCost:`统计范围内总费用 ÷ 总调用次数,单次调用的平均开销。`,kpiDescCalls:`统计范围内的 LLM 调用次数(联网搜索估算不含在内)。`,kpiDescReasoning:`思考(reasoning)token ÷ 输出 token。推理模型的思考部分已计费、含在输出内。`,kpiDescIo:`输入 token ÷ 输出 token。比值高通常意味着长上下文 / 多轮复用。`,kpiDescPeak:`统计范围内单日处理 token(输入+输出)最多的一天。`,healthDotLive:`厂商在线`,healthDotFailed:`厂商探活失败`,healthDotUnknown:`厂商状态未知`,settingsSectionDisplay:`显示偏好`,emptyHint:`运行第一次对话后,这里会自动出现按厂商的用量与费用明细`,tokenViewStructure:`按结构`,tokenViewModel:`按模型`,tokenHitShort:`命中`,tokenMissShort:`未命中`,tokenTotal:`总 Token`,tokenShare:`占比`,usageStatsTool:`注入用量查询`,usageStatsToolHint:`让模型可在对话中查询用量/费用;会占用模型每次请求的上下文,coding 场景建议关闭(切换即时生效)`,balanceGranted:`赠金余额`,balanceTopped:`充值余额`,balanceDaily:`日均消耗`,balanceDaysLong:`约可撑`,balanceDaysUnit:`天`,popTodayModel:`主力消耗模型余额`,popTitle:`用量速览`,popNoConsumption:`暂无消耗`,popDirectLead:`直联`,popSubLead:`订阅`,unpricedHint:`{count} 个模型未收录计价,费用已按 0 计:{models}`,channelVisibility:`通道可见性`,channelVisibilityHint:`隐藏的通道不参与统计口径:账单分组、概览数字、趋势与用量随之联动。会话 / 工具 / 角色等没有通道维度的指标仍为全量。`,channelVisibilityShowAll:`全部显示`,channelVisibilityHidden:`已隐藏 {count} 个通道,统计口径已排除其用量`,channelVisibilityEmpty:`暂无通道数据`,unpricedMore:`等 {count} 个`,unpricedFix:`去补价`,searchEstimateHint:`含 {count} 次联网搜索请求的估算费用(每次约 {each};日志无用量事件,按次估算,可在配置 searchCallEstimateCny 调整或关闭)`,siteListDisplay:`中转站列表`,siteListDisplayHint:`隐藏「未识别」占位条目与「未知路由」分组,净化列表`,liveCostBar:`平价消耗胶囊`,liveCostBarHint:`输入框旁的即时代费条,悬浮可看详情`,liveCostBarPosition:`位置`,liveCostBarPosBelow:`输入框下方`,liveCostBarPosAbove:`输入框上方`,liveCostBarPosToolbar:`输入框内部`,exportCsvSite:`按站点 CSV`,panelRelayQuota:`中转站额度`,relayBalance:`余额`,relayNoQuota:`未读出额度`,relayWindowUsed:`已用`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`未识别`,expandAll:`全部展开`,collapseAll:`全部收起`,todayOnly:`仅看今日`,todayNoConsumption:`今日暂无消耗`,commandUsageLabel:`打开计费仪表盘`,commandUsageDescription:`查看今日/本月费用、用量明细与费率`,sessionOpen:`打开会话`,sessionOpenFailed:`无法打开该会话(可能已被删除或不在当前会话列表)`,sessionOpenUnavailable:`当前宿主不支持会话跳转`,tabAgents:`智能体`,agentsSummary:`智能体网络`,agentsCount:`智能体`,agentsDelegations:`委派`,agentsRoots:`对话`,agentsMostExpensive:`最贵的一支`,agentsChainTotal:`链合计`,agentsNoData:`暂无子智能体委派记录`,agentsSubagent:`子智能体`,agentsRoot:`对话`,tabQueue:`队列`,queueSubtitle:`非紧急任务只在 DeepSeek 官方低谷启动,按入队顺序串行执行`,queueUntilPeak:`距高峰`,queueUntilOffPeak:`距低谷`,queueUnsupportedTitle:`当前宿主不支持任务队列`,queueUnsupportedBody:`任务队列需要新版宿主的会话创建、Prompt 提交与结果订阅能力。当前宿主会保持只读降级;用量、费用和峰谷提醒不受影响,也不会创建只排队却无法执行的任务。`,queueSafety:`安全边界:任务开始后即使进入高峰也会继续,不会强行暂停;失败或结果无法确认时不自动重试。`,queueSafetyIsolated:`当前模式:每个任务在独立会话执行,并按宿主现有权限使用工具。`,queueSafetyReuse:`当前模式:任务优先在入队时的来源会话内继续(保留上下文与工作区分组),来源会话不可用时改为新建会话;按宿主现有权限使用工具。`,queueReusePlanned:`计划在会话 {session} 继续(来源会话不可用时改为新建)`,queueReuseDone:`在会话 {session} 继续`,queueFallbackReason:`已改为新建会话:{reason}`,queueReuseModelNote:`沿用来源会话当前模型`,queueWorkspace:`工作区`,queueModel:`官方峰谷模型`,queueNoOptions:`未发现可用工作区或内置 DeepSeek 官方峰谷模型,请先完成宿主配置。中转站同名模型不参与。`,queuePromptLabel:`任务 Prompt`,queuePromptPlaceholder:`描述一个非紧急、可无人值守完成的任务。入队即授权宿主在下一低谷执行。`,queuePrivacy:`队列文件仅当前用户可读;执行后 Prompt 也会进入宿主会话日志(复用来源会话时进入那个会话)。请勿填入密码或密钥。`,queueEnqueue:`加入低谷队列`,queueImport:`导入 JSON`,queueImportHint:`JSON 数组项可为 Prompt 字符串或 { prompt, cwd?, provider?, model? };缺省沿用当前工作区与模型,整批校验后一次入队。`,queueImported:`已导入 {count} 个任务`,queueImportFormat:`导入文件须为非空 JSON 数组,每项是 Prompt 字符串或任务对象`,queueImportTooLarge:`导入文件超过 10 MiB,未读取或写入任何任务`,queueActive:`任务与历史`,queueClearFinished:`清除已结束`,queueEmpty:`队列是空的。加入一个非紧急任务,下一低谷自动开始。`,queueLoading:`正在读取队列…`,queueOpenSession:`查看会话`,queueRemoveQueued:`移出队列`,queueRemoveHistory:`删除记录`,queueStatusQueued:`等待低谷`,queueStatusStarting:`正在启动`,queueStatusRunning:`执行中`,queueStatusCompleted:`已完成`,queueStatusFailed:`需核对`,quickQueueToggle:`低谷队列`,quickQueueEntry:`低谷队列入口`,quickQueueEntryHint:`在输入框旁显示低谷队列按钮与入队控件`,quickQueueReuseEntry:`任务在来源会话继续`,quickQueueReuseEntryHint:`开启后,从会话入队的任务到点时优先在该会话内继续(保留上下文与工作区分组);来源会话已删除、正在使用或已归档时改为新建会话,并在卡片上注明原因。默认关闭。`,quickQueueEnqueue:`入队`,quickQueueEnqueueing:`入队中…`,quickQueueWaiting:`{count} 个等待任务`,quickQueueClear:`入队后清稿`,quickQueueEnqueued:`已加入低谷队列,将按队列规则调度`,quickQueueEmpty:`草稿为空,请先输入任务`,quickQueueBusy:`当前草稿正在提交,请稍后再入队`,quickQueueAttachments:`含附件或引用的草稿暂不支持入队,请改用纯文本`,quickQueueContext:`无法读取当前工作区或模型,请在新版宿主中重试`,quickQueueRoute:`当前工作区或模型不支持低谷队列,请选择官方峰谷模型`,quickQueueDraftChanged:`已入队;草稿已变化,未清空`,quickQueueUnsupported:`当前宿主不支持草稿入队,请升级宿主`,quickQueueFailed:`入队失败:{message}`},ot={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,monthProjectedHint:`Month-to-date + last-7-day pace × days left`,liveTurn:`Turn`,liveSession:`Session`,liveSessionSub:`incl. sub {cost}`,calls:`Calls`,cacheHitRate:`Cache Hit`,tokens:`Tokens`,inputTokens:`Input`,outputTokens:`Output`,avgCost:`Avg cost`,kpiRange:`Range`,avgRangeToday:`Today`,avgRange7d:`7d`,avgRangeWeek:`Week`,avgRangeMonth:`Month`,avgRangeAll:`All`,avgRangeCustom:`Custom`,customRangeStart:`Start date`,customRangeEnd:`End date`,trend:`Daily cost & calls`,trend7d:`7D`,trend30d:`30D`,trendMetric:`Trend metric`,trendMetricCost:`Cost`,trendMetricTokens:`Tokens`,pricingSearch:`Search model or vendor`,bandPinHint:`click to pin to the composer`,trendEmpty:`No trend data yet`,trendTotal:`Total`,roundsUnit:`turns`,healthModelsLive:`{n} models live`,healthVendorsDown:`{n} vendors down`,healthVendorsUnavailable:`{n} vendors unavailable`,budget:`Monthly budget`,budgetRemain:`Remaining`,budgetAmount:`Budget amount`,budgetSummary:`Used {used} / {total} this month; warn at 80%, pulse red at 100%`,sessions:`Sessions`,sessionTitle:`Title`,lastActive:`Last active`,sessionOverflow:`Top {limit} of {total} sessions by cost`,budgetTierBody:`This month {cost} reached {pct}% of the budget {budget}`,models:`Model billing`,providerBilling:`Provider billing & subscriptions`,channelUnknown:`Unknown routes`,directTag:`Direct`,relayTag:`Relay`,unknownTag:`Unknown`,unknownChannelHint:`Channel is not registered in the plugin config; the spending party cannot be verified, so cost stays out of the totals while usage is still counted.`,planCountUnit:`plan(s)`,actual:`Actual`,pricing:`Model pricing`,input:`Input`,output:`Output`,cacheHit:`Cache hit`,peak:`Peak`,offPeak:`Off-peak`,flat:`Flat`,band:`Band`,close:`Close`,footer:`Polls every 30s · local dsh sessions only`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`Updated`,noData:`No billing data yet`,todayRate:`Today rate`,rateLive:`Live`,rateBuiltin:`Built-in`,pricingSyncedAt:`Synced`,pricingSyncNow:`Sync now`,pricingSyncing:`Syncing…`,promoBadge:`Promo`,promoUntil:`Promo price until {date}, then list price resumes automatically`,promoOpenEnded:`End date not announced; billed at the discounted rate until further notice, then list price resumes`,pricingTip:`DeepSeek list rates: V4.1 Flash off-peak ¥1 miss / ¥0.02 cache-hit / ¥4 output; V4 Pro off-peak ¥4.5 miss / ¥0.15 cache-hit / ¥13.5 output; peak = 2× off-peak. Weekday 9-12 / 14-18 bills at peak, all other times (weekends included) at off-peak; billed at call time.`,pricingUnit:`Unit: CNY / per 1M tokens`,pricingNotes:`Pricing notes`,ubPeak:`Peak`,ubOff:`Off`,ubStd:`Std`,peakBand:`Peak/off-peak band`,pricingSource:`Data source`,noteCache:`Cache hits are billed at the cache rate, cutting cost.`,noteBand:`Peak and off-peak prices differ; off-peak is roughly half price.`,noteSource:`Prices come from the live rate + model catalog; unlisted models count as 0 and are flagged.`,balance:`Balance`,recharge:`Top up`,rechargeHint:`Open the vendor's official top-up page`,balanceUnconfigured:`Not set`,balanceUnauthorized:`Bad key`,balanceUnreachable:`Unavailable`,uncatalogued:`Not catalogued`,estimatedPricing:`Estimated`,balanceDays:`~{days} days left`,balanceLowBody:`{name} balance {balance}, ~{days} days left, please top up`,reconcileDrift:`Detected {provider} official balance moved {spent}, this panel recorded {today}; the gap usually comes from other tools or APIs consuming too`,reconcileDismiss:`Got it`,subscriptionNotConfigured:`Key not set`,subscriptionUnauthorized:`Bad key`,subscriptionUnavailable:`Unavailable`,subscriptionInvalid:`Bad response`,subscriptionRateLimited:`Rate limited`,subscriptionSession:`Current`,subscriptionWeekly:`Weekly`,subscriptionMonthly:`Monthly`,subscriptionBilling:`Billing`,subscriptionRemaining:`{pct}% left`,subscriptionExhausted:`Exhausted`,subscriptionReset:`Resets {date}`,subscriptionNoApi:`Provider does not offer a usage API`,floatWindow:`Model usage popover`,floatModeCombined:`Combined`,floatModeSubscription:`Subscription card`,floatMode:`Display mode`,floatTargets:`Targets`,floatWindowHint:`Usage summary floating on the footer card; Combined=current style, Subscription cards=one quota card at a time (switchable).`,floatPrimaryToday:`Today`,floatPrimaryWeek:`Week`,floatPrimaryMonth:`Month`,cardDisplay:`Billing card`,cardDisplayHint:`Choose how much space the sidebar entry uses, then set its metric and range. Restore a hidden entry from native Settings or /usage. Tracking and alerts stay active.`,cardMode:`Sidebar entry`,cardModeFull:`Full card`,cardModeCompact:`Compact icon`,cardModeHidden:`Hidden`,cardModeHiddenHint:`Restore: open native Settings → Usage & billing → Full card, or open the dashboard with /usage or the Open usage billing dashboard shortcut and return to Settings.`,cardModeFallback:`This host has neither native Settings nor /usage, so Hidden falls back to the compact icon to keep the dashboard reachable.`,nativeSettingsNav:`Usage & billing`,nativeSettingsIntro:`Choose how the sidebar billing entry appears. Changes apply immediately and stay in sync with the dashboard settings.`,nativeSettingsHiddenHint:`The sidebar entry is hidden. Choose Full card or Compact icon to restore it; while hidden you can still open the dashboard with the Open usage billing dashboard shortcut (rebind it in native Settings → Shortcuts). Tracking and alerts remain active.`,shortcutOpenDashboard:`Open usage billing dashboard`,cardMetric:`Main metric`,cardMetricMoney:`Cost`,cardMetricTokens:`Tokens`,cardSpan:`Range`,cardSpanDay:`Day`,cardSpanWeek:`Week`,cardSpanMonth:`Month`,cardDeltaBadge:`Day-over-day badge`,cardDeltaShow:`Show`,cardDeltaHide:`Hide`,floatNoTargets:`No subscription selected — pick some in Settings.`,floatNoTargetsHint:`No subscription channel available.`,subscriptionsStale:`Subscription refresh failed — showing cached data`,balanceStaleNotice:`Balance refresh is slow — the figures below come from the last completed query`,staleLedgerNotice:`{count} sessions use legacy-algorithm archives (logs deleted; costs re-estimated at catalog prices); attribution may be off`,staleSnapshotNotice:`Usage is being recomputed; the figures below come from the last completed calculation (session titles may lag the workspace)`,statsLoadFailed:`Failed to read usage data; the figures below may be incomplete`,unreadableNotice:`Usage from {count} sessions is not fully counted (raw logs untouched; no data lost)`,unreadableNoLedgerNotice:`{count} of them have no archived history and are not counted at all`,unreadableFormatNotice:`{count} of them use a session format this host cannot read: newer formats recover after a host upgrade; legacy formats (e.g. v0/v3) need a one-time migration`,tokenCacheWrite:`written`,toolRank:`Tool calls`,toolName:`Tool`,userPrices:`Custom prices`,userPricesHint:`Enter actual per-1M-token prices; main views are re-costed. Pick a model key from the dropdown candidates. Leave source empty for the model default, or enter a relay origin (protocol optional) to price only that source. Fill all three off-peak fields for peak/off-peak estimation; leave them empty for flat pricing.`,userPriceSave:`Save`,userPriceModel:`Model`,userPriceSource:`Source (relay origin)`,userPriceSourceHint:`Empty = default; e.g. https://api.relay.com`,userPriceOffPeak:`Off-peak price`,userPriceNormal:`Standard price`,userPriceCurrency:`Currency`,userPriceAdd:`Add`,userPriceRemoveSelected:`Remove selected`,userPriceSelect:`Select this row`,sessionStaleBadge:`legacy`,sessionUntitled:`Untitled session`,sessionSubCost:`incl. subagents {cost}`,sessionSubCalls:`incl. subagents, {calls} calls`,sessionSubRow:`Subagent`,heatmapLess:`Less`,heatmapMore:`More`,currency:`Currency`,currencyCny:`CNY`,currencyUsd:`USD`,currencyEur:`EUR`,language:`Interface language`,heatmap:`Usage heatmap`,rounds:`Cost per turn`,roundsHint:`Last {count} rounds · bar tops show amount · fill = peak/off-peak`,anomaly:`Cost spike`,model:`Model`,thModel:`Model name`,thInputMiss:`Input (cache miss)`,thInputHit:`Input (cache hit)`,costAbbr:`cost`,tabOverview:`Overview`,tabTrends:`Trends`,tabProviders:`Bills`,tabPricing:`Rates`,tabSettings:`Settings`,budgetHint:`Set a monthly cap for projections and tier alerts`,peakAlertHint:`Alert before a tier switch, optionally via system notification`,peakAlertDescPeak:`About to enter peak hours — prices rise, plan long tasks ahead`,peakAlertDescOff:`About to enter off-peak hours — price halves, ideal for large batches`,peakAlertDescPeakZhipu:`Peak hours soon (weekdays 14:00–18:00) — Coding Plan credits will be deducted at full rate`,peakAlertDescOffZhipu:`Off-peak soon — Coding Plan credits will be deducted at 50% of base credits`,peakAlertQueuePeak:`{count} queued tasks will wait for the next off-peak window; admitted tasks keep running`,peakAlertQueueOff:`{count} queued tasks will start in order`,export:`Export`,exportCsvDay:`Daily CSV`,exportCsvSession:`Sessions CSV`,exportJson:`Full JSON`,peakShare:`Peak vs off-peak`,peakSharePerCall:`per-call attribution, full history`,offPeakSavings:`Shift peak to off-peak: save ~{amount}`,perfMax:`Max TTFT`,weekCost:`This week's spend`,roleCost:`Cost breakdown`,roleUser:`User input`,roleAssistant:`Assistant output`,roleTool:`Tool results`,roleHint:`Estimated: output priced exactly, input split by message size`,tierPeak:`Peak`,tierOff:`Off-peak`,tierToPeak:`until peak`,tierToOff:`until off-peak`,tierAlertEnterPeak:`Peak pricing (2x) starts in {minutes} min — non-urgent calls can wait`,tierAlertEnterOff:`Off-peak pricing (50% off) starts in {minutes} min`,tierAlertEnterPeakZhipu:`Zhipu peak hours in {minutes} min — Coding Plan credits burn at full rate`,tierAlertEnterOffZhipu:`Zhipu off-peak in {minutes} min — credit burn drops to 50%`,peakAlertTitlePeak:`Peak pricing incoming`,peakAlertTitleOff:`Off-peak incoming`,peakAlert:`Peak/off-peak alert`,peakAlertLeadMin:`Lead time (min)`,peakAlertPos:`Position`,peakAlertMode:`Remind mode`,peakAlertPosCorner:`Bottom-right`,peakAlertPosCenter:`Center`,peakAlertModePeak:`Entering peak only`,peakAlertModeOff:`Entering off-peak only`,peakAlertModeBoth:`Both`,peakAlertWebNotify:`Also send system notification`,peakAlertPreview:`Preview alert`,planTypeCode:`Subscription`,planTypeToken:`Usage`,subscriptionFeePerMonth:`{amount}/mo`,triggerToday:`Today's spend`,triggerMonth:`This month's spend`,triggerMonthTokens:`This month's tokens`,triggerTodayTokens:`Today's tokens`,triggerWeekTokens:`This week's tokens`,subscriptionTag:`Plan`,cellEstimateHint:`No pay-as-you-go charge recorded for this row (subscription routes are not billed per call); amount is a catalog-price estimate`,free:`Free`,perfSamples:`Samples`,perfTtft:`TTFT`,perfP50:`P50`,perfP90:`P90`,perfTps:`Speed`,perfLatency:`Total latency`,perfEstimated:`Estimated`,perfEmpty:`No performance data yet`,perfTpsUnit:`tok/s`,perfTitle:`Performance`,perfHint:`Per model & per hour; estimated samples are tool-continuation steps`,perfAll:`All`,perfChartEmpty:`No model selected or no data for this metric`,heatmapYear:`Year`,heatmapHalf:`Half`,heatmapMonth:`Month`,metricCost:`Cost`,metricTokens:`Tokens`,heatmapTotal:`Total`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginAuthor:`Author`,pluginRepository:`Repository`,pluginNpm:`npm`,pluginLicense:`License`,tabToken:`Usage`,tokenExport:`Export tokens`,tokenExportCsv:`Daily token CSV`,tokenReasoningShare:`Reasoning share`,tokenReasoningShort:`reasoning`,tokenIo:`In/out ratio`,tokenPeak:`Peak day`,tokenDaily:`Daily tokens`,tokenByModel:`Tokens by model`,tokenMiss:`Input (cache miss)`,densityLabel:`Display density`,densityHint:`Compact shrinks row height and padding, comfortable adds room; applies instantly`,densityCompact:`Compact`,densityDefault:`Default`,densityComfortable:`Comfortable`,motionLabel:`Motion strength`,motionHint:`Off freezes all entrance and data-update animations; basic interaction feedback remains`,motionOff:`Off`,motionSubtle:`Subtle`,motionRich:`Rich`,settingsNavDisplayPref:`Preferences`,settingsNavBudget:`Budget`,settingsNavAlert:`Alerts`,settingsNavDisplay:`Display`,settingsNavAdvanced:`Advanced`,settingsNavAbout:`About`,settingsSearchPlaceholder:`Search settings… (e.g. budget, peak, price)`,settingsSearchEmpty:`No settings match "{query}"`,sessionsViewAll:`View all {count} sessions`,sessionsViewTop:`View top {count} sessions by cost`,sessionViewerSearch:`Search sessions… (title / project / id)`,modelBudgetTitle:`Per-model budget`,modelBudgetHint:`Set a monthly cap per model (CNY); alerts fire once each at 80% / 100%. Empty = unlimited.`,modelBudgetBody:`"{model}" has spent {cost} this month ({pct}% of {budget})`,modelBudgetPlaceholder:`Cap`,moreWorksTitle:`More plugins`,adEngramName:`DSH Engram · Memory Palace`,adEngramDesc:`Cross-session long-term memory: graph · hybrid retrieval · flywheel`,adRainbowName:`RainbowSpeak`,adRainbowDesc:`A flowing rainbow marquee border for the chat composer`,kpiDescCacheHit:`Cache-hit tokens ÷ total input tokens. Higher hit rate means lower input cost (cache reads are ~1/10 the miss price).`,kpiDescTokens:`Total tokens = input + output. Cache reads/writes are already part of input and are not double-counted (issue #85).`,kpiDescAvgCost:`Total cost ÷ total calls within the selected range — the average cost per call.`,kpiDescCalls:`LLM calls within the selected range (web-search estimates excluded).`,kpiDescReasoning:`Reasoning tokens ÷ output tokens. A reasoning model's thinking is billed and included in output.`,kpiDescIo:`Input tokens ÷ output tokens. A high ratio usually means long context / multi-turn reuse.`,kpiDescPeak:`The day with the most processed tokens (input + output) in the range.`,healthDotLive:`Vendor online`,healthDotFailed:`Vendor probe failed`,healthDotUnknown:`Vendor status unknown`,settingsSectionDisplay:`Display preferences`,emptyHint:`Run your first conversation and per-provider usage and cost breakdown will appear here automatically`,tokenHit:`Input (cache hit)`,tokenOutput:`Output`,tokenViewStructure:`Structure`,tokenViewModel:`By model`,tokenHitShort:`Hit`,tokenMissShort:`Miss`,tokenTotal:`Total tokens`,tokenShare:`Share`,usageStatsTool:`Inject usage-stats tool`,usageStatsToolHint:`Lets the model query usage/cost inside a conversation; it consumes context per request, so keep it off for coding (takes effect immediately)`,balanceGranted:`Granted`,balanceTopped:`Topped up`,balanceDaily:`Daily burn`,balanceDaysLong:`~days left`,balanceDaysUnit:`days`,popTodayModel:`Main model balance`,popTitle:`Usage overview`,popNoConsumption:`No usage yet`,popDirectLead:`Direct`,popSubLead:`Subscription`,unpricedHint:`{count} models not priced; their cost counts as 0: {models}`,channelVisibility:`Channel visibility`,channelVisibilityHint:`Hidden channels are excluded from the statistics scope: billing groups, overview numbers, trends and usage follow along. Session / tool / role metrics have no channel dimension and stay global.`,channelVisibilityShowAll:`Show all`,channelVisibilityHidden:`{count} channel(s) hidden — their usage is excluded from the statistics scope`,channelVisibilityEmpty:`No channel data yet`,unpricedMore:`+{count} more`,unpricedFix:`Set price`,searchEstimateHint:`Includes estimated cost of {count} web-search requests (~{each} each; no usage events logged, per-call estimate; tune via searchCallEstimateCny)`,siteListDisplay:`Relay lists`,siteListDisplayHint:`Hide "unidentified" placeholder rows in the relay quota list`,liveCostBar:`Live cost capsule`,liveCostBarHint:`Live cost bar beside the composer; hover for details`,liveCostBarPosition:`Position`,liveCostBarPosBelow:`Below composer`,liveCostBarPosAbove:`Above composer`,liveCostBarPosToolbar:`Inside composer`,exportCsvSite:`By site CSV`,panelRelayQuota:`Relay quotas`,relayBalance:`Balance`,relayNoQuota:`No quota`,relayWindowUsed:`used`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`Unknown`,expandAll:`Expand all`,collapseAll:`Collapse all`,todayOnly:`Today only`,todayNoConsumption:`No usage today`,commandUsageLabel:`Open the billing dashboard`,commandUsageDescription:`See today/month spend, usage breakdown and rates`,sessionOpen:`Open session`,sessionOpenFailed:`Could not open this session (it may be deleted or absent from the current list)`,sessionOpenUnavailable:`This host does not support session navigation`,tabAgents:`Agents`,agentsSummary:`Agent network`,agentsCount:`agents`,agentsDelegations:`delegations`,agentsRoots:`conversations`,agentsMostExpensive:`costliest chain`,agentsChainTotal:`chain total`,agentsNoData:`No sub-agent delegation records yet`,agentsSubagent:`sub-agent`,agentsRoot:`conversation`,tabQueue:`Queue`,queueSubtitle:`Non-urgent tasks start only during DeepSeek official off-peak hours, one at a time`,queueUntilPeak:`Peak in`,queueUntilOffPeak:`Off-peak in`,queueUnsupportedTitle:`This host does not support the task queue`,queueUnsupportedBody:`The queue requires Session creation, Prompt admission and result streaming from a newer host. This host stays in read-only fallback: usage, billing and band alerts keep working, and no non-executing placeholder tasks are created.`,queueSafety:`Safety: an admitted task continues if peak pricing begins; it is never forcibly paused. Failures and unknown outcomes never auto-retry.`,queueSafetyIsolated:`Current mode: each task runs in its own Session with the host’s existing tool permissions.`,queueSafetyReuse:`Current mode: tasks continue inside the Session they were queued from (keeping its context and workspace grouping) and fall back to a new Session when the source is unavailable, using the host’s existing tool permissions.`,queueReusePlanned:`Will continue in Session {session} (a new Session is used if the source is unavailable)`,queueReuseDone:`Continued in Session {session}`,queueFallbackReason:`Switched to a new Session: {reason}`,queueReuseModelNote:`Uses the source Session’s current model`,queueWorkspace:`Workspace`,queueModel:`Official time-of-day model`,queueNoOptions:`No workspace or built-in DeepSeek official time-of-day model is available. Relay mirrors are not eligible.`,queuePromptLabel:`Task Prompt`,queuePromptPlaceholder:`Describe a non-urgent task that can run unattended. Enqueuing authorizes the host to run it at the next off-peak window.`,queuePrivacy:`The queue file is owner-only; executed Prompts also enter host Session logs (the source Session when it is reused). Do not enter passwords or secrets.`,queueEnqueue:`Enqueue for off-peak`,queueImport:`Import JSON`,queueImportHint:`A JSON array of Prompt strings or { prompt, cwd?, provider?, model? } objects; omitted fields use the current selection. The whole batch is validated before one atomic enqueue.`,queueImported:`Imported {count} tasks`,queueImportFormat:`The import must be a non-empty JSON array of Prompt strings or task objects`,queueImportTooLarge:`The import exceeds 10 MiB; no tasks were read or enqueued`,queueActive:`Tasks & history`,queueClearFinished:`Clear finished`,queueEmpty:`The queue is empty. Add a non-urgent task to start it at the next off-peak window.`,queueLoading:`Loading queue…`,queueOpenSession:`Open Session`,queueRemoveQueued:`Remove`,queueRemoveHistory:`Delete record`,queueStatusQueued:`Waiting`,queueStatusStarting:`Starting`,queueStatusRunning:`Running`,queueStatusCompleted:`Completed`,queueStatusFailed:`Needs review`,quickQueueToggle:`Off-peak queue`,quickQueueEntry:`Off-peak queue entry`,quickQueueEntryHint:`Show the off-peak queue button and enqueue controls beside the composer`,quickQueueReuseEntry:`Continue tasks in the source Session`,quickQueueReuseEntryHint:`When on, a task queued from a Session continues inside that Session at the next off-peak window (keeping its context and workspace grouping). A deleted, busy or archived source falls back to a new Session, with the reason shown on the card. Off by default.`,quickQueueEnqueue:`Enqueue`,quickQueueEnqueueing:`Enqueuing…`,quickQueueWaiting:`{count} waiting tasks`,quickQueueClear:`Clear after enqueue`,quickQueueEnqueued:`Added to the off-peak queue; scheduling follows the queue rules`,quickQueueEmpty:`The draft is empty; enter a task first`,quickQueueBusy:`This draft is being submitted; try enqueueing later`,quickQueueAttachments:`Drafts with attachments or references cannot be queued; use plain text`,quickQueueContext:`Cannot read the current workspace or model; retry on a newer host`,quickQueueRoute:`This workspace or model is not eligible; select an official time-of-day model`,quickQueueDraftChanged:`Enqueued; the draft changed, so it was not cleared`,quickQueueUnsupported:`This host does not support draft enqueueing; upgrade the host`,quickQueueFailed:`Enqueue failed: {message}`},z={"opencode-go":{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},opencode:{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},"kimi-coding":{type:`code`},"zai-coding-cn":{type:`code`},"zai-coding":{type:`code`},commandcode:{type:`code`},"qwen-token-plan":{type:`code`},"qwen-token-plan-cn":{type:`code`},"xiaomi-token-plan-ams":{type:`code`},"xiaomi-token-plan-cn":{type:`code`},"xiaomi-token-plan-sgp":{type:`code`},"volcengine-token-plan":{type:`code`},"ark-token-plan":{type:`code`},"doubao-token-plan":{type:`code`},minimax:{type:`code`},"minimax-cn":{type:`code`},"minimax-token-plan":{type:`code`},"minimax-token-plan-cn":{type:`code`},"hunyuan-token-plan":{type:`code`},"tencent-token-plan":{type:`code`},"hy-token-plan":{type:`code`},"xinghuo-token-plan":{type:`code`},"xfyun-coding":{type:`code`},"spark-coding":{type:`code`},"huawei-token-plan":{type:`code`},"pangu-token-plan":{type:`code`},"huawei-maas-token-plan":{type:`code`},"volcengine-agent-plan":{type:`code`},"ark-agent-plan":{type:`code`},"baidu-token-plan":{type:`code`},"ernie-token-plan":{type:`code`},"wenxin-token-plan":{type:`code`}},B={glm:`zai-coding-cn`,bigmodel:`zai-coding-cn`,zhipu:`zai-coding-cn`,zhipuai:`zai-coding-cn`,zai:`zai-coding`,ark:`volcengine-token-plan`,volcengine:`volcengine-token-plan`,doubao:`doubao-token-plan`,moonshot:`kimi-coding`,kimi:`kimi-coding`,xiaomi:`xiaomi-token-plan-cn`,opencode:`opencode-go`};function st(e){return e===``?e:B[e]??e}function ct(e){let t=z[st(e)];return t?.type===`code`?t.tier:void 0}let lt=[{key:`deepseek-v4-flash`,input:.14,cacheHit:.0028,output:.28},{key:`deepseek-v4-pro`,input:.435,cacheHit:.003625,output:.87},{key:`gpt-5.6-sol`,input:5,cacheHit:.5,output:30},{key:`gpt-5.6-terra`,input:2,cacheHit:.2,output:12},{key:`gpt-5.6-luna`,input:.2,cacheHit:.02,output:1.2},{key:`glm-5.2`,input:1.4,cacheHit:.26,output:4.4},{key:`qwen3.8-max`,input:2,cacheHit:.21,output:6},{key:`kimi-k3`,input:2.82,cacheHit:.28,output:14.08},{key:`grok-4.6`,input:2,cacheHit:.5,output:6},{key:`gemini-2.5-pro`,input:1.25,cacheHit:.125,output:10}],ut,V,dt,H,ft,pt;function mt(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function ht(e,t){return mt(e)===mt(t)}function gt(e){pt=e.length>0?e:void 0}function _t(){return pt}function vt(e){return an(e)}function yt(e,t){let n=U(e,t);if(n!==void 0)return{input:n.input,cacheHit:n.cacheHit,output:n.output,...n.currency===void 0?{}:{currency:n.currency},...n.offPeak===void 0?{}:{offPeak:n.offPeak}}}function U(e,t){if(pt===void 0)return;let n=vt(e),r=W(n),i=e=>vt(e.key)===n||W(e.key)===r;if(t!==void 0){for(let e of pt)if(e.origin!==void 0&&e.origin!==``&&i(e)&&ht(e.origin,t))return e}for(let e of pt)if((e.origin===void 0||e.origin===``)&&i(e))return e}function bt(e){if(pt===void 0)return;let t=vt(e),n=W(t);return pt.find(e=>e.origin!==void 0&&e.origin!==``&&(vt(e.key)===t||W(e.key)===n))}function xt(e){ut=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,V=typeof e.rateEur==`number`&&Number.isFinite(e.rateEur)&&e.rateEur>0?e.rateEur:void 0,dt=e.prices,H=e.extraModels}function St(e){ft=e}function Ct(){return ut??6.79}function wt(){return V??7.71}function Tt(){return{rate:Ct(),live:ut!==void 0}}function Et(){return{rate:wt(),live:V!==void 0}}let Dt=.5;function Ot(e){return e==null||!Number.isFinite(e)?`peak`:kt(e,Nt,!0)}function kt(e,t,n=!1){if(At(e)||n&&Mt(e))return`offPeak`;let r=Math.floor(Ft(e)/6e4);for(let e=0;e+1<t.length;e+=2){let n=t[e]??0,i=t[e+1]??0;if(r>=n&&r<i)return`peak`}return`offPeak`}function At(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}function jt(e){return new Date(e+288e5).toISOString().slice(0,10).replace(/-/g,``)}function Mt(e){return`20260925 20260926 20260927 20261001 20261002 20261003 20261004 20261005 20261006 20261007`.includes(jt(e))}let Nt=[540,720,840,1080],Pt=[840,1080];function Ft(e){return((e+288e5)%864e5+864e5)%864e5}function It(e,t,n=!1){let r=kt(e,t,n),i=Ft(e);for(let a=0;a<10;a++){let o=a*864e5-i;for(let i of t){let a=o+i*6e4;if(!(a<=0)&&kt(e+a,t,n)!==r)return{tier:r,nextSwitchInMs:a}}}let a=t[0]??0;return{tier:r,nextSwitchInMs:864e5-i+a*6e4}}function Lt(e,t,n,r=!1){let{nextSwitchInMs:i}=It(e,t,r);if(i>n)return null;let a=e+i;return{entering:kt(a,t,r),atMs:a}}function Rt(e,t){if(e===void 0||e===``)return`none`;let n=an(e),r=Gt().find(e=>e.key===n)?.provider;return r===`DeepSeek`?`deepseek-metered`:t&&r===`智谱 AI`?`zhipu-coding-plan`:`none`}function zt(e,t){switch(t){case`deepseek-metered`:return It(e,Nt,!0);case`zhipu-coding-plan`:return It(e,Pt);case`none`:return null}}function Bt(e,t,n){switch(t){case`deepseek-metered`:return Lt(e,Nt,n,!0);case`zhipu-coding-plan`:return Lt(e,Pt,n);case`none`:return null}}function Vt(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/60),r=t%60;return n>0?`${n}h${String(r).padStart(2,`0`)}m`:`${r}m`}let Ht=[],Ut={};function Wt(e,t){Ht=e,Ut=t,Jt=void 0}function Gt(){return Ht}function Kt(){return Ut}let qt={key:`other`,name:`其他模型`,provider:`Custom`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:0,cacheHit:0,cacheMiss:0,output:0}};function W(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let Jt;function Yt(){if(Jt!==void 0)return Jt;let e=new Map,t=(t,n)=>{let r=W(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of Ht)t(e.key,e.key);for(let[e,n]of Object.entries(Ut))t(e,n);for(let e of lt)t(e.key,e.key);return Jt=e,e}let Xt,Zt,Qt;function $t(){if(Xt===H)return;let e=new Map,t=new Map;for(let n of H??[]){t.has(n.key)||t.set(n.key,n);let r=W(n.key);r!==``&&!e.has(r)&&e.set(r,n)}Xt=H,Zt=e,Qt=t}function en(){return $t(),Zt??new Map}function tn(){return $t(),Qt??new Map}function nn(e){let t=[],n=e=>{e!==``&&!t.includes(e)&&t.push(e)},r=e=>{let t=e;for(;;){let e=t.replace(/[-_]\d{3,}$/u,``);if(e===t||e===``)return;t=e,n(t)}},i=e.lastIndexOf(`/`);if(i>0&&i<e.length-1){let t=e.slice(i+1);n(t),r(t)}let a=e.split(/[::]/u);if(a.length>1){for(let e=1;e<a.length;e+=1){let t=a.slice(e).join(`:`);n(t),r(t)}for(let e=0;e<a.length-1;e+=1){let t=a.slice(e,a.length-1).join(`:`);n(t),r(t)}}return r(e),t}function rn(e){let t=Kt()[e];if(t!==void 0)return t;let n=W(e);if(n===``)return;let r=Yt().get(n);return r===void 0?en().get(n)?.key:r}function an(e){let t=Kt()[e]??e;if(t===e){let t=W(e);if(t!==``){let e=Yt().get(t);if(e!==void 0)return e;let n=en().get(t);if(n!==void 0)return n.key}for(let t of nn(e)){let e=rn(t);if(e!==void 0)return e}}return t}function on(e){let t=an(e),n=dt?.[t];if(n!==void 0)return n;let r=lt.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function sn(e){let t=an(e),n=Gt().find(e=>e.key===t),r=tn().get(t),i=n??(r===void 0?Gt().find(e=>e.key===`other`)??qt:cn(r)),a=yt(t);if(a!==void 0)return{...i,userPriced:!0,price:{currency:a.currency??`CNY`,input:a.input,cacheHit:a.cacheHit,output:a.output,...a.offPeak===void 0?{}:{offPeak:a.offPeak}}};let o=on(t);if(o===void 0||i.price.offPeak!==void 0)return i;let s=i.price.cacheWrite!==void 0&&i.price.input>0?o.input*(i.price.cacheWrite/i.price.input):void 0;return{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output,...s===void 0?{}:{cacheWrite:s}}}}function cn(e){return{key:e.key,name:e.name,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:e.price.input,cacheHit:e.price.cacheHit,output:e.price.output,...e.price.cacheWrite===void 0?{}:{cacheWrite:e.price.cacheWrite}}}}function ln(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs,r=e.startsAtMs!==void 0&&t<e.startsAtMs;return Number.isFinite(t)&&!n&&!r&&e.factor>=0&&e.factor<1}function un(e,t){let{promo:n}=e;if(n===void 0||!ln(n,t))return e;let r=e=>{let t=n.factors?.[e];return t!==void 0&&t>=0&&t<1?t:n.factor},i=e=>({input:e.input*r(`input`),cacheHit:e.cacheHit*r(`cacheHit`),...e.cacheMiss===void 0?{}:{cacheMiss:e.cacheMiss*r(`cacheMiss`)},...e.cacheWrite===void 0?{}:{cacheWrite:e.cacheWrite*r(`cacheWrite`)},output:e.output*r(`output`)});return{...e,price:{...i(e.price),currency:e.price.currency,...e.price.offPeak===void 0?{}:{offPeak:i(e.price.offPeak)}}}}function dn(e=Date.now()){let t=[...Gt().filter(e=>e.retired!==!0).map(t=>un(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>W(e.key)));for(let e of ft??[]){let i=e.id.toLowerCase();if((()=>{let t=an(e.id);return Gt().find(e=>e.key===t)})()!==void 0)continue;let a=W(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=en().get(a),s;if(o!==void 0)s=cn(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=on(i);s=t===void 0?{key:an(e.id),name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:0,cacheHit:0,output:0},uncatalogued:!0}:{key:i,name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:t.input,cacheHit:t.cacheHit,output:t.output}}}n.add(s.key.toLowerCase()),a!==``&&r.add(a),t.push(s)}return t.map(e=>{let t=yt(e.key);return t===void 0?e:{...e,userPriced:!0,price:{currency:t.currency??`CNY`,input:t.input,cacheHit:t.cacheHit,output:t.output}}})}function fn(e,t,n){let r=t.cacheMiss>0?t.cacheMiss:Math.max(0,t.input-t.cacheHit),i=Math.min(t.cacheWrite??0,r),a=r-i,o=Math.min(t.cacheHit,t.input),s=(a*(e.cacheMiss??e.input)+i*(e.cacheWrite??e.input)+o*e.cacheHit+t.output*e.output)/1e6;return n===`USD`?s*Ct():s}function pn(e,t,n=Dt,r=Date.now()){let i=un(e,r),a=fn(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:fn(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function mn(e){let t=Ct();return t>0?e/t:e}function hn(e,t){if(t===`usd`)return mn(e);if(t===`eur`){let t=wt();return t>0?e/t:e}return e}function G(e,t=`cny`){let n=Number(e),r=t===`usd`?`$`:t===`eur`?`€`:`¥`;return!Number.isFinite(n)||n<=0?`${r}0`:n>=1e3?`${r}${n.toFixed(0)}`:n>=10?`${r}${n.toFixed(1)}`:n>=.1?`${r}${n.toFixed(2)}`:`${r}${n.toFixed(3)}`}function gn(e,t=`CNY`){return`${t===`USD`?`$`:t===`EUR`?`€`:`¥`}${e.toFixed(e>=10?1:2)}`}function _n(e,t,n,r){if(r<=0||!Number.isFinite(r))return e;let i=t===`USD`?e*r:e;if(n===`cny`)return i;if(n===`usd`)return i/r;let a=Et().rate;return a>0?i/a:i}function K(e=Date.now()){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function q(e){return e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function vn(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}function yn(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function bn(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function xn(e){return e.toFixed(2)}function Sn(e){return[`date,calls,input,output,cache_hit,cache_miss,cost_cny`,...Object.keys(e).sort().map(t=>{let n=e[t];return n===void 0?``:[t,n.calls,n.input,n.output,n.cacheHit,n.cacheMiss,xn(n.cost)].join(`,`)})].join(`
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function En(e,t,n){let r=[...n].sort(),i=r[0],a=r.at(-1);return`${e}${i!==void 0&&a!==void 0?`-${i}_${a}`:``}.${t}`}function Dn(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(r),0)}function On(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let J={top:14,right:18,bottom:22,left:46},kn=`var(--ds-blue)`,An=`var(--ds-cyan)`,jn=`var(--ds-amber)`;function Mn(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function Nn(e){let{stats:t,trendDays:n,onTrendDays:r,t:i}=e,a=e.money,o=e.models??[],{byDay:s,byModel:c,total:l}=t,[u,f]=(0,d.useState)(null),[p,h]=(0,d.useState)(`structure`),[g,_]=(0,d.useState)(null),v=t.byDayModels!==void 0,b=e=>{h(e),_(null)},x=(0,d.useMemo)(()=>{let e=t.byRole;if(e===void 0)return[];let n=e.user+e.assistant+e.tool;return n<=0?[]:[{label:i(`roleUser`),value:e.user,seg:R.shareSegUser},{label:i(`roleAssistant`),value:e.assistant,seg:R.shareSegAssistant},{label:i(`roleTool`),value:e.tool,seg:R.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,i]),S=(0,d.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=K(n.getTime()),i=s[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[s,n]),C=(0,d.useMemo)(()=>{let e=[];for(let r=n-1;r>=0;--r){let n=new Date;n.setDate(n.getDate()-r);let i=K(n.getTime()),a=t.byDayModels?.[i],o={},s=0;if(a!==void 0)for(let[e,t]of Object.entries(a)){let n=t.cacheHit??0,r=t.cacheMiss??0,i=t.output??0,a=n+r+i;a<=0||(o[e]={hit:n,miss:r,output:i,total:a},s+=a)}e.push({date:i,models:o,total:s})}return e},[t.byDayModels,n]),w=(0,d.useMemo)(()=>{let e=new Map;for(let t of C)for(let[n,r]of Object.entries(t.models))e.set(n,(e.get(n)??0)+r.total);return[...e.entries()].sort((e,t)=>t[1]-e[1]).map(([e])=>({key:e,name:o.find(t=>t.key===e)?.name??sn(e).name,color:o.find(t=>t.key===e)?.color??`#8b95a3`}))},[C,o]),T=g!==null&&w.some(e=>e.key===g)?g:null,E=e=>{if(v){if(p!==`model`){h(`model`),_(e);return}_(t=>t===e?null:e)}},ee=(0,d.useMemo)(()=>{let e=0;return Object.entries(c).filter(([,e])=>e.calls>0).map(([t,n])=>{let r=n.input+n.output;e+=r;let i=n.cacheHit+n.cacheMiss;return{key:t,name:sn(t).name,input:n.input,output:n.output,reasoning:n.reasoning??0,calls:n.calls,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,cacheHitRate:i>0?n.cacheHit/i*100:0,total:r,share:0}}).sort((e,t)=>t.total-e.total).map(t=>({...t,share:e>0?t.total/e:0}))},[c]),te=(0,d.useMemo)(()=>{let e=new Map;for(let n of Object.values(t.byDayModelsSite??{}))for(let[t,r]of Object.entries(n)){let n=e.get(t)??[];for(let[e,t]of Object.entries(r)){let r=n.find(t=>t.siteKey===e);if(r===void 0){n.push({siteKey:e,tokens:t.input+t.output,cost:t.cost});continue}r.tokens+=t.input+t.output,r.cost+=t.cost}e.set(t,n)}for(let[t,n]of e)e.set(t,[...n].sort((e,t)=>t.tokens-e.tokens));return e},[t.byDayModelsSite]),D=(0,d.useMemo)(()=>{let e=Object.entries(t.byTool??{}),n=e.slice(0,8),r=e.slice(8).reduce((e,[,t])=>e+t,0),i=e.reduce((e,[,t])=>e+t,0);return{top:n,rest:r>0?[[`…`,r]]:[],totalCalls:i}},[t.byTool]),O=(0,d.useMemo)(()=>{let e=S.length;if(e===0)return null;let t=680-J.left-J.right,n=200-J.top-J.bottom,r=Math.max(...p===`model`?C.map(e=>e.total):S.map(e=>e.miss+e.hit+e.output),1),i=e=>J.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?J.left+t/2:J.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l,groupW:a}},[S,C,p]),ne=()=>{Dn(`token-daily-${K()}.csv`,Pn(S),`text/csv`)},k=()=>{Dn(`token-${K()}.json`,Mn(S,ee,C,l),`application/json`)},A=u===null?void 0:S[u],j=u===null?void 0:C[u],M=O===null?0:Math.ceil(80/Math.max(O.groupW,1)),re=u===null||O===null?void 0:u>=O.n-M?R.chartTooltipAlignRight:u<M?R.chartTooltipAlignLeft:void 0;return(0,m.jsxs)(`div`,{className:R.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,m.jsxs)(`div`,{className:R.exportBar,role:`group`,"aria-label":i(`tokenExport`),children:[(0,m.jsx)(`span`,{className:R.exportLabel,children:i(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-token-export-csv`,onClick:ne,children:i(`tokenExportCsv`)}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-token-export-json`,onClick:k,children:i(`exportJson`)})]}),(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-token-daily`,children:[(0,m.jsxs)(`div`,{className:R.panelHead,children:[(0,m.jsx)(`h3`,{className:R.panelTitle,children:i(`tokenDaily`)}),(0,m.jsxs)(`span`,{className:R.panelHeadControls,children:[v&&(0,m.jsx)(`span`,{className:R.rangeToggle,role:`group`,"aria-label":i(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.rangeButton,p===e&&R.rangeButtonActive),"aria-pressed":p===e,onClick:()=>{b(e)},"data-testid":`billing-token-view-${e}`,children:i(e===`structure`?`tokenViewStructure`:`tokenViewModel`)},e))}),(0,m.jsx)(`span`,{className:R.rangeToggle,role:`group`,"aria-label":i(`tokenDaily`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.rangeButton,n===e&&R.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{r(e)},"data-testid":`billing-token-${e}d`,children:i(e===7?`trend7d`:`trend30d`)},e))})]})]}),O===null||p===`model`&&w.length===0?(0,m.jsx)(`div`,{className:R.chartEmpty,children:i(`trendEmpty`)}):(0,m.jsxs)(`div`,{className:R.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:R.chartSvg,role:`img`,"aria-label":i(`tokenDaily`),onMouseLeave:()=>{f(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-J.left)/O.plotW,r=Math.round(n*(O.n-1));f(Math.min(Math.max(r,0),O.n-1))},children:[[0,.5,1].map(e=>{let t=O.max*e,n=O.y(t);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`line`,{x1:J.left,x2:680-J.right,y1:n,y2:n,className:R.chartGrid}),(0,m.jsx)(`text`,{x:J.left-8,y:n+3,textAnchor:`end`,className:R.chartAxisLabel,children:On(t)})]},e)}),p===`structure`?S.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=O.y(0),i=O.y(e.miss),a=O.y(e.miss+e.hit),o=O.y(e.miss+e.hit+e.output);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`rect`,{x:n,y:i,width:O.barW,height:r-i,fill:kn}),(0,m.jsx)(`rect`,{x:n,y:a,width:O.barW,height:i-a,fill:An}),(0,m.jsx)(`rect`,{x:n,y:o,width:O.barW,height:a-o,fill:jn})]},e.date)}):C.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=0;return(0,m.jsx)(`g`,{children:w.map(t=>{let i=e.models[t.key];if(i===void 0)return null;let a=O.y(r);r+=i.total;let o=O.y(r),s=T!==null&&t.key!==T;return(0,m.jsx)(`rect`,{x:n,y:o,width:O.barW,height:a-o,fill:t.color,opacity:s?.15:1},t.key)})},e.date)}),O.indices.map(e=>{let t=S[e];return t===void 0?null:(0,m.jsx)(`text`,{x:O.inner(e),y:194,textAnchor:`middle`,className:R.chartAxisLabel,children:t.date.slice(5)},t.date)}),u!==null&&(0,m.jsx)(`line`,{x1:O.inner(u),x2:O.inner(u),y1:J.top,y2:J.top+O.plotH,className:R.chartCrosshair})]}),u!==null&&p===`structure`&&A!==void 0&&(0,m.jsxs)(`div`,{className:y(R.chartTooltip,re),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(u)/680*100}%`,top:`${O.y(A.miss+A.hit+A.output)/200*100}%`},children:[(0,m.jsxs)(`div`,{className:R.chartTooltipHead,children:[(0,m.jsx)(`span`,{className:R.chartTooltipDate,children:A.date}),(0,m.jsx)(`strong`,{children:(A.miss+A.hit+A.output).toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(R.chartTooltipRow,R.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:R.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:An}}),i(`tokenHit`)]}),(0,m.jsx)(`strong`,{children:A.hit.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(R.chartTooltipRow,R.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:R.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:kn}}),i(`tokenMiss`)]}),(0,m.jsx)(`strong`,{children:A.miss.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(R.chartTooltipRow,R.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:R.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:jn}}),i(`tokenOutput`)]}),(0,m.jsx)(`strong`,{children:A.output.toLocaleString()})]})]}),u!==null&&p===`model`&&j!==void 0&&(0,m.jsxs)(`div`,{className:y(R.chartTooltip,re),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(u)/680*100}%`,top:`${O.y(j.total)/200*100}%`},children:[(0,m.jsxs)(`div`,{className:R.chartTooltipHead,children:[(0,m.jsx)(`span`,{className:R.chartTooltipDate,children:j.date}),(0,m.jsx)(`strong`,{children:j.total.toLocaleString()})]}),w.map(e=>{let t=j.models[e.key];return t===void 0?null:(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:y(R.chartTooltipRow,R.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:R.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,m.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:R.chartTooltipModelDetail,children:[i(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,i(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,i(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,m.jsx)(`div`,{className:R.chartLegend,children:p===`structure`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:kn}}),i(`tokenMiss`)]}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:An}}),i(`tokenHit`)]}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:jn}}),i(`tokenOutput`)]})]}):w.map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(R.chartLegendItem,T===e.key&&R.chartLegendItemActive),"aria-pressed":T===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{E(e.key)},children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-token-models`,children:[(0,m.jsx)(`div`,{className:R.panelHead,children:(0,m.jsx)(`h3`,{className:R.panelTitle,children:i(`tokenByModel`)})}),ee.length===0?(0,m.jsx)(`div`,{className:R.emptyRow,children:i(`noData`)}):(0,m.jsx)(`div`,{className:R.tableScroll,children:(0,m.jsxs)(`table`,{className:R.modelTable,"data-testid":`billing-token-model-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:i(`model`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`inputTokens`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`outputTokens`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`tokenReasoningShort`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`tokenTotal`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`tokenShare`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`calls`)})]})}),(0,m.jsx)(`tbody`,{children:ee.map(t=>(0,m.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:y(v&&R.modelRowFocusable,T===t.key&&R.modelRowActive),"aria-selected":v?T===t.key:void 0,onClick:v?()=>{E(t.key)}:void 0,tabIndex:v?0:void 0,onKeyDown:v?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),E(t.key))}:void 0,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:R.modelName,children:t.name}),(te.get(t.key)??[]).length>0&&(0,m.jsx)(`span`,{className:R.modelChannels,"data-testid":`billing-token-model-channels-${t.key}`,children:(te.get(t.key)??[]).slice(0,3).map(n=>(0,m.jsxs)(`span`,{className:R.modelChannelTag,title:`${e.channelName?.(n.siteKey)??n.siteKey} · ${q(n.tokens)} token · ${a(n.cost)}`,children:[e.channelName?.(n.siteKey)??n.siteKey,` · `,t.total>0?`${(n.tokens/t.total*100).toFixed(0)}%`:`—`]},n.siteKey))})]}),(0,m.jsx)(`td`,{className:R.numCol,children:q(t.input)}),(0,m.jsx)(`td`,{className:R.numCol,children:q(t.output)}),(0,m.jsx)(`td`,{className:R.numCol,children:t.reasoning>0?q(t.reasoning):(0,m.jsx)(`span`,{className:R.na,children:`—`})}),(0,m.jsxs)(`td`,{className:R.numCol,children:[t.cacheHitRate.toFixed(1),`%`]}),(0,m.jsx)(`td`,{className:R.numCol,children:q(t.total)}),(0,m.jsx)(`td`,{className:R.numCol,children:(0,m.jsxs)(`span`,{className:R.tokenModelShareRow,children:[(0,m.jsx)(`span`,{className:R.tokenModelBar,children:(0,m.jsxs)(`span`,{className:R.tokenModelParts,style:{width:`${(t.share*100).toFixed(2)}%`},children:[(0,m.jsx)(`span`,{className:R.tokenModelPartIn,style:{width:`${t.total>0?t.input/t.total*100:0}%`}}),(0,m.jsx)(`span`,{className:R.tokenModelPartOut,style:{width:`${t.total>0?t.output/t.total*100:0}%`}})]})}),(t.share*100).toFixed(1),`%`]})}),(0,m.jsx)(`td`,{className:R.numCol,children:t.calls.toLocaleString()})]},t.key))})]})})]}),D.totalCalls>0&&(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-token-tools`,children:[(0,m.jsx)(`div`,{className:R.panelHead,children:(0,m.jsx)(`h3`,{className:R.panelTitle,children:i(`toolRank`)})}),(0,m.jsx)(`div`,{className:R.tableScroll,children:(0,m.jsxs)(`table`,{className:R.modelTable,"data-testid":`billing-tool-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:i(`toolName`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`calls`)}),(0,m.jsx)(`th`,{className:R.numCol,children:i(`tokenShare`)})]})}),(0,m.jsx)(`tbody`,{children:[...D.top,...D.rest].map(([e,t])=>(0,m.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`span`,{className:R.modelName,children:e})}),(0,m.jsx)(`td`,{className:R.numCol,children:t.toLocaleString()}),(0,m.jsxs)(`td`,{className:R.numCol,children:[(t/D.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),x.length>0&&(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-panel-roles`,children:[(0,m.jsxs)(`div`,{className:R.panelHead,children:[(0,m.jsx)(`h3`,{className:R.panelTitle,children:i(`roleCost`)}),(0,m.jsx)(`span`,{className:R.panelHint,children:i(`roleHint`)})]}),(0,m.jsx)(`div`,{className:R.shareTrack,"data-testid":`billing-role-track`,children:x.map(e=>(0,m.jsx)(`div`,{className:y(R.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,m.jsx)(`div`,{className:R.shareLegend,children:x.map(e=>(0,m.jsxs)(`span`,{className:R.shareItem,children:[(0,m.jsx)(`span`,{className:y(R.shareDot,e.seg)}),e.label,(0,m.jsxs)(`span`,{className:R.shareValue,children:[a(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function Pn(e){return[`date,missInput,cacheHit,output,reasoning,total`,...e.map(e=>`${e.date},${e.miss},${e.hit},${e.output},${e.reasoning},${e.miss+e.hit+e.output}`)].join(`
|
|
5
|
-
`)}let Y={top:18,right:40,bottom:26,left:46};function Fn(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function In(e,t){let n=[];for(let r=0;r<e;r+=t)n.push(r);return e>0&&n[n.length-1]!==e-1&&n.push(e-1),n}let Ln={key:`__total__`,name:``,color:``};function Rn({data:e,models:t=[],currency:n=`cny`,metric:r=`cost`,t:i}){let a=i??(e=>at[e]),[o,s]=(0,d.useState)(null),c=e=>G(hn(e,n),n),l=e=>r===`tokens`?On(e):c(e),u=e=>r===`tokens`?e.tokens??0:e.cost,f=(0,d.useMemo)(()=>{let n=e.length;if(n===0)return null;let i=680-Y.left-Y.right,a=220-Y.top-Y.bottom,o=e=>n===1?Y.left+i/2:Y.left+i*e/(n-1),s=Math.max(...r===`tokens`?e.map(e=>e.tokens??0):e.map(e=>Math.max(e.cost,Object.values(e.byModel??{}).reduce((e,t)=>e+t,0))),1e-4),c=e=>Y.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>Y.top+a-e/l*a,f=i/n,p=Math.min(18,f*.6);return{n,plotW:i,plotH:a,inner:o,yCost:c,yCalls:d,barW:p,bars:e.flatMap((e,n)=>{let i=o(n)-p/2;if(t.length===0||r===`tokens`)return[{date:e.date,model:Ln,x:i,base:0,value:u(e),topRounded:!0}];let a=null;for(let n of t)(e.byModel?.[n.key]??0)>0&&(a=n.key);let s=0;return t.map(t=>{let n=e.byModel?.[t.key]??0,r={date:e.date,model:t,x:i,base:s,value:n,topRounded:t.key===a};return s+=n,r})}),costTicks:[0,.25,.5,.75,1].map(e=>s*e).reverse(),callsTicks:[0,.25,.5,.75,1].map(e=>l*e).reverse(),linePath:e.map((e,t)=>{let n=d(e.calls);return`${t===0?`M`:`L`}${o(t)} ${n}`}).join(` `)}},[e,t,r]);if(f===null)return(0,m.jsx)(`div`,{className:R.chartEmpty,children:a(`trendEmpty`)});let{n:p,plotW:h,plotH:g,inner:_,yCost:v,yCalls:y,barW:b,bars:x,costTicks:S,callsTicks:C,linePath:w}=f,T=o===null?void 0:e[o],E=In(p,Math.max(1,Math.ceil(p/8)));return(0,m.jsxs)(`div`,{className:R.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:R.chartSvg,role:`img`,"aria-label":`Daily cost by model and total calls`,onMouseLeave:()=>{s(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Y.left)/h,r=Math.round(n*(p-1));s(Math.min(Math.max(r,0),p-1))},children:[S.map((e,t)=>{let n=v(e);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`line`,{x1:Y.left,x2:680-Y.right,y1:n,y2:n,className:R.chartGrid}),(0,m.jsx)(`text`,{x:Y.left-8,y:n+3,textAnchor:`end`,className:R.chartAxisLabel,children:l(e)})]},`cost-${t}`)}),x.map(t=>{if(t.value>0)return(0,m.jsx)(`rect`,{x:t.x,y:v(t.base+t.value),width:b,height:v(t.base)-v(t.base+t.value),rx:t.topRounded?2:0,className:t.model.color===``?R.chartBar:R.chartStack,style:t.model.color===``?void 0:{fill:t.model.color}},`${t.date}-${t.model.key}`);let n=e.find(e=>e.date===t.date);return n!==void 0&&n.calls>0&&t.base===0?(0,m.jsx)(`rect`,{x:t.x,y:v(0)-1,width:b,height:1,rx:0,className:R.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,m.jsx)(`path`,{d:w,fill:`none`,className:R.chartLine}),(()=>{let t=K(),n=e.findIndex(e=>e.date===t);return n>=0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`chartAreaGrad`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:`var(--ds-blue)`,stopOpacity:`0.35`}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:`var(--ds-blue)`,stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:`${w} L ${_(e.length-1)} ${y(0)} L ${_(0)} ${y(0)} Z`,fill:`url(#chartAreaGrad)`}),(0,m.jsx)(`line`,{x1:_(n),x2:_(n),y1:Y.top,y2:Y.top+g,stroke:`var(--ds-amber)`,strokeWidth:`1`,strokeDasharray:`3 3`,opacity:`0.6`}),(0,m.jsx)(`text`,{x:_(n)+4,y:Y.top-6,fill:`var(--ds-amber)`,fontSize:`10`,fontFamily:`var(--font-num)`,children:Fn(t)})]}):null})(),C.map((e,t)=>{let n=y(e);return(0,m.jsx)(`text`,{x:680-Y.right+8,y:n+3,textAnchor:`start`,className:R.chartAxisLabel,children:On(e)},`calls-${t}`)}),E.map(t=>{let n=e[t];return n===void 0?null:(0,m.jsx)(`text`,{x:_(t),y:214,textAnchor:`middle`,className:R.chartAxisLabel,children:Fn(n.date)},n.date)}),o!==null&&(0,m.jsx)(`line`,{x1:_(o),x2:_(o),y1:Y.top,y2:Y.top+g,className:R.chartCrosshair})]}),T!==void 0&&o!==null&&(0,m.jsxs)(`div`,{className:R.chartTooltip,style:{left:`${_(o)/680*100}%`,top:`${v(T.cost)/220*100}%`},children:[(0,m.jsx)(`div`,{className:R.chartTooltipDate,children:T.date}),r!==`tokens`&&t.filter(e=>(T.byModel?.[e.key]??0)>0).map(e=>(0,m.jsxs)(`div`,{className:R.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,m.jsx)(`strong`,{children:c(T.byModel?.[e.key]??0)})]},e.key)),(0,m.jsxs)(`div`,{className:R.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:R.chartLegendBar}),a(`trendTotal`),` `,(0,m.jsx)(`strong`,{children:r===`tokens`?On(T.tokens??0):c(T.cost)})]}),(0,m.jsxs)(`div`,{className:R.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:R.chartLegendLine}),a(`calls`),` `,(0,m.jsx)(`strong`,{children:T.calls.toLocaleString()})]})]}),t.length>0&&r!==`tokens`&&(0,m.jsxs)(`div`,{className:R.chartLegend,children:[t.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:R.chartLegendLine}),a(`calls`)]})]})]})}let X={top:14,right:42,bottom:22,left:46};function zn(e){return e.slice(5,13).replace(`T`,` `)}function Bn(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function Vn(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Hn(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Un(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function Wn({perf:e,models:t,t:n}){let[r,i]=(0,d.useState)(()=>We()),[a,o]=(0,d.useState)(null),s=e=>{i(e),Ge(e)},c=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,l=(0,d.useMemo)(()=>e===void 0?[]:Object.entries(e.byModel).map(([e,n])=>({key:e,name:t.find(t=>t.key===e)?.name??e,color:c(e),samples:n.samples,ttftAvg:n.ttftAvg,ttftP50:n.ttftP50,ttftP90:n.ttftP90,...n.ttftMax===void 0?{}:{ttftMax:n.ttftMax},...n.ttftSpikes===void 0?{}:{ttftSpikes:n.ttftSpikes},...n.tpsAvg===void 0?{}:{tpsAvg:n.tpsAvg},latencyAvg:n.latencyAvg,estimatedSamples:n.estimatedSamples})).sort((e,t)=>t.samples-e.samples||t.ttftP90-e.ttftP90),[e,t]),u=(0,d.useMemo)(()=>{if(e===void 0)return[];if(r.models!==void 0){let t=new Set(Object.keys(e.byModel));return r.models.filter(e=>t.has(e))}return l.slice(0,5).map(e=>e.key)},[e,l,r.models]),f=(0,d.useMemo)(()=>{if(e===void 0)return null;let t=Object.keys(e.byHourModel).sort().slice(-48);if(t.length===0)return null;let n=t.length,i=680-X.left-X.right,a=180-X.top-X.bottom,o=e=>n===1?X.left+i/2:X.left+i*e/(n-1),s=new Set(u),c=e=>r.metric===`ttft`?e?.ttftAvg:e?.tpsAvg,d=[],f=0;for(let r of l){if(!s.has(r.key))continue;let i=[];for(let a=0;a<n;a++){let n=t[a];if(n===void 0)continue;let s=c(e.byHourModel[n]?.[r.key]);s===void 0||!Number.isFinite(s)||(i.push({i:a,x:o(a),y:0,v:s}),s>f&&(f=s))}d.push({key:r.key,name:r.name,color:r.color,segments:[],points:i})}let p=d.reduce((e,t)=>e+t.points.length,0);f=Math.max(f,1);let m=e=>X.top+a-e/f*a;for(let e of d){let t=``,n=-2;for(let r of e.points)r.y=m(r.v),t!==``&&r.i!==n+1&&(e.segments.push(t),t=``),t+=`${t===``?`M`:`L`}${r.x} ${r.y} `,n=r.i;t!==``&&e.segments.push(t)}let h=Math.max(1,Math.ceil(n/8)),g=[];for(let e=0;e<n;e+=h)g.push(e);return g[g.length-1]!==n-1&&g.push(n-1),{hourKeys:t,n,plotW:i,plotH:a,inner:o,yOf:m,series:d,ticks:[0,.5,1].map(e=>f*e).reverse(),xTicks:g,totalPoints:p}},[e,l,u,r.metric]);if(e===void 0||l.length===0)return(0,m.jsx)(`div`,{className:R.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)});let p=e=>{let t=u.includes(e)?u.filter(t=>t!==e):[...u,e];s({metric:r.metric,models:t})},h=e=>{s({metric:e,...r.models===void 0?{}:{models:r.models}})},g=a===null||f===null?[]:f.series.flatMap(e=>{let t=e.points.find(e=>e.i===a);return t===void 0?[]:[{key:e.key,name:e.name,color:e.color,v:t.v}]});return(0,m.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[l.length>0&&(()=>{let e=Math.max(...l.map(e=>e.ttftAvg),1),t=Math.max(...l.filter(e=>e.tpsAvg!==void 0).map(e=>e.tpsAvg??0),1),r=Math.max(...l.map(e=>e.latencyAvg),1),i=l.reduce((e,t)=>e+t.samples,0),a=l.length>0?l.reduce((e,t)=>e+t.ttftAvg,0)/l.length:0,o=l.map(e=>e.tpsAvg).filter(e=>e!==void 0),s=o.length>0?o.reduce((e,t)=>e+t,0)/o.length:0,c=l.length>0?l.reduce((e,t)=>e+t.latencyAvg,0)/l.length:0,u=[{lbl:n(`perfSamples`),val:i.toLocaleString(),unit:``,pct:65,color:`var(--ds-blue)`},{lbl:n(`perfTtft`),val:Vn(a),unit:``,pct:a/e*100,color:`var(--ds-green)`},{lbl:n(`perfTps`),val:o.length>0?Hn(s):`—`,unit:``,pct:s/t*100,color:`var(--ds-blue)`},{lbl:n(`perfLatency`),val:Vn(c),unit:``,pct:c/r*100,color:`var(--ds-amber)`}];return(0,m.jsx)(`div`,{className:R.perfHero,"data-testid":`billing-perf-hero`,children:u.map((e,t)=>(0,m.jsxs)(`div`,{className:R.perfHeroCell,children:[(0,m.jsx)(`div`,{className:R.perfHeroLbl,children:e.lbl}),(0,m.jsxs)(`div`,{className:R.perfHeroVal,children:[e.val,e.unit!==``&&(0,m.jsx)(`span`,{className:R.perfHeroUnit,children:e.unit})]}),(0,m.jsx)(`div`,{className:R.perfHeroBar,children:(0,m.jsx)(`i`,{style:{width:`${Math.min(100,e.pct)}%`,background:e.color}})})]},t))})})(),(0,m.jsx)(`div`,{className:R.tableScroll,"data-testid":`billing-perf-table`,children:(0,m.jsxs)(`table`,{className:R.modelTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`model`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfSamples`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfTtft`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfP50`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfP90`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfMax`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfTps`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfLatency`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`perfEstimated`)})]})}),(0,m.jsx)(`tbody`,{children:l.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsxs)(`span`,{className:R.modelCell,children:[(0,m.jsx)(`span`,{className:R.modelDot,style:{background:e.color}}),(0,m.jsx)(`span`,{className:R.modelName,children:e.name})]})}),(0,m.jsx)(`td`,{className:R.numCol,children:e.samples.toLocaleString()}),(0,m.jsx)(`td`,{className:R.numCol,children:Vn(e.ttftAvg)}),(0,m.jsx)(`td`,{className:R.numCol,children:Vn(e.ttftP50)}),(0,m.jsx)(`td`,{className:R.numCol,children:Vn(e.ttftP90)}),(0,m.jsx)(`td`,{className:R.numCol,children:e.ttftMax===void 0?(0,m.jsx)(`span`,{className:R.na,children:`—`}):(0,m.jsxs)(`span`,{children:[Vn(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,m.jsx)(`td`,{className:R.numCol,children:e.tpsAvg===void 0?(0,m.jsx)(`span`,{className:R.na,children:`—`}):Hn(e.tpsAvg)}),(0,m.jsx)(`td`,{className:R.numCol,children:Vn(e.latencyAvg)}),(0,m.jsx)(`td`,{className:R.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,m.jsx)(`span`,{className:R.na,children:`—`})})]},e.key))})]})}),l.length>0&&(()=>{let e=Math.max(...l.map(e=>e.ttftP50),1),t=e=>e<.8?`var(--ds-green)`:e<2?`var(--ds-amber)`:`var(--ds-red)`;return(0,m.jsx)(`div`,{className:R.perfCompareList,"data-testid":`billing-perf-compare`,children:l.map(n=>(0,m.jsxs)(`div`,{className:R.perfCompareRow,children:[(0,m.jsxs)(`div`,{className:R.perfCompareName,children:[(0,m.jsx)(`span`,{className:R.perfCompareDot,style:{background:n.color}}),(0,m.jsx)(`span`,{children:n.name})]}),(0,m.jsx)(`div`,{className:R.perfCompareBar,children:(0,m.jsx)(`i`,{style:{width:`${n.ttftP50/e*100}%`,background:t(n.ttftP50)}})}),(0,m.jsx)(`div`,{className:R.perfCompareNum,children:Vn(n.ttftP50)}),(0,m.jsx)(`div`,{className:R.perfCompareNum,children:n.tpsAvg===void 0?`—`:Hn(n.tpsAvg)})]},n.key))})})(),f!==null&&(0,m.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,m.jsx)(`div`,{className:R.perfBar,children:(0,m.jsx)(`span`,{className:R.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.rangeButton,r.metric===e&&R.rangeButtonActive),"aria-pressed":r.metric===e,"data-testid":`billing-perf-tab-${e}`,onClick:()=>{h(e)},children:e===`ttft`?`${n(`perfTtft`)} (ms)`:`${n(`perfTps`)} (${n(`perfTpsUnit`)})`},e))})}),(0,m.jsxs)(`div`,{className:R.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,m.jsx)(`button`,{type:`button`,className:R.perfChip,"data-testid":`billing-perf-chip-all`,onClick:()=>{s({metric:r.metric,models:l.map(e=>e.key)})},children:n(`perfAll`)}),l.map(e=>{let t=u.includes(e.key);return(0,m.jsxs)(`button`,{type:`button`,className:y(R.perfChip,!t&&R.perfChipOff),style:t?{color:e.color,borderColor:`color-mix(in srgb, ${e.color} 45%, transparent)`}:void 0,"aria-pressed":t,"data-testid":`billing-perf-chip-${e.key}`,onClick:()=>{p(e.key)},children:[(0,m.jsx)(`span`,{className:R.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),f.totalPoints>0?(0,m.jsxs)(`div`,{className:R.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:R.chartSvg,role:`img`,"aria-label":`Hourly perf comparison by model`,onMouseLeave:()=>{o(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-X.left)/f.plotW,r=Math.round(n*(f.n-1));o(Math.min(Math.max(r,0),f.n-1))},children:[f.ticks.map((e,t)=>{let n=f.yOf(e);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`line`,{x1:X.left,x2:680-X.right,y1:n,y2:n,className:R.chartGrid}),(0,m.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:R.chartAxisLabel,children:Bn(e)})]},`tick-${t}`)}),f.series.map(e=>e.segments.map((t,n)=>(0,m.jsx)(`path`,{d:t,fill:`none`,className:R.chartLine,style:{stroke:e.color}},`${e.key}-${n}`))),f.xTicks.map(e=>{let t=f.hourKeys[e];return t===void 0?null:(0,m.jsx)(`text`,{x:f.inner(e),y:174,textAnchor:`middle`,className:R.chartAxisLabel,children:zn(t)},t)}),a!==null&&(0,m.jsx)(`line`,{x1:f.inner(a),x2:f.inner(a),y1:X.top,y2:X.top+f.plotH,className:R.chartCrosshair}),a!==null&&f.series.map(e=>{let t=e.points.find(e=>e.i===a);return t===void 0?null:(0,m.jsx)(`circle`,{cx:t.x,cy:t.y,r:3.5,fill:e.color,className:R.chartHoverDot},`${e.key}-dot`)})]}),a!==null&&g.length>0&&(0,m.jsxs)(`div`,{className:R.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${f.inner(a)/680*100}%`,top:`${(X.top+f.plotH/2)/180*100}%`},children:[(0,m.jsx)(`div`,{className:R.chartTooltipDate,children:zn(f.hourKeys[a]??``)}),g.map(e=>(0,m.jsxs)(`div`,{className:R.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:R.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,m.jsx)(`strong`,{children:Un(e.v,r.metric,n)})]},e.key))]})]}):(0,m.jsx)(`div`,{className:R.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),f===null&&(0,m.jsx)(`div`,{className:R.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let Gn=`@kenz1117/dsh-ui-usage-billing`,Kn=`kenz1117`;function qn({t:e,version:t}){return(0,m.jsxs)(`section`,{className:R.setCard,"data-testid":`billing-plugin-info`,children:[(0,m.jsxs)(`div`,{className:R.plgHead,children:[(0,m.jsx)(`span`,{className:R.plgIcon,"aria-hidden":`true`,children:(0,m.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,m.jsx)(`path`,{d:`M10 3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a2 2 0 0 0 4 0V4a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v1a2 2 0 0 0 4 0 1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0 0 4h1a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1a2 2 0 0 0-4 0 1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 0-4H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 4 0z`})})}),(0,m.jsxs)(`div`,{className:R.plgTitle,children:[(0,m.jsxs)(`div`,{className:R.plgNameRow,children:[(0,m.jsx)(`h3`,{className:R.plgName,children:Gn}),(0,m.jsx)(`span`,{className:R.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,m.jsx)(`p`,{className:R.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,m.jsxs)(`div`,{className:R.plgGrid,children:[(0,m.jsxs)(`div`,{className:R.plgItem,children:[(0,m.jsx)(`span`,{className:R.plgLabel,children:e(`pluginAuthor`)}),(0,m.jsxs)(`a`,{className:R.plgLink,href:`https://github.com/${Kn}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,Kn,`)`]})]}),(0,m.jsxs)(`div`,{className:R.plgItem,children:[(0,m.jsx)(`span`,{className:R.plgLabel,children:e(`pluginRepository`)}),(0,m.jsx)(`a`,{className:R.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,m.jsxs)(`div`,{className:R.plgItem,children:[(0,m.jsx)(`span`,{className:R.plgLabel,children:e(`pluginNpm`)}),(0,m.jsx)(`a`,{className:R.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:Gn})]}),(0,m.jsxs)(`div`,{className:R.plgItem,children:[(0,m.jsx)(`span`,{className:R.plgLabel,children:e(`pluginLicense`)}),(0,m.jsx)(`span`,{className:R.plgVal,children:`MIT`})]})]})]})}function Jn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function Yn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Xn(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}function Zn({rounds:e,flags:t,currency:n,t:r}){let i=(0,d.useMemo)(()=>[...e].sort((e,t)=>e.startedAt-t.startedAt).slice(-40),[e]),a=(0,d.useMemo)(()=>new Set(t.map(e=>`${e.sessionId}:${e.turn}`)),[t]),o=(0,d.useMemo)(()=>Math.max(1e-4,...i.map(e=>e.cost)),[i]);if(i.length===0)return(0,m.jsxs)(`div`,{className:R.roundsEmpty,children:[r(`model`),` —`]});let s=e=>G(hn(e,n),n);return(0,m.jsxs)(`div`,{className:R.rounds,children:[(0,m.jsx)(`div`,{className:R.roundsBars,role:`img`,"aria-label":`cost per turn`,children:i.map(e=>{let t=a.has(`${e.sessionId}:${e.turn}`),n=Math.max(1,e.cost/o*100),i=Rt(e.model,!1)===`deepseek-metered`&&Ot(e.startedAt)===`peak`;return(0,m.jsxs)(`div`,{className:y(R.roundsBarCol,i?R.roundsBarColPeak:R.roundsBarColOff),children:[(0,m.jsx)(`span`,{className:R.roundsBarLabel,style:{bottom:`${n}%`},children:s(e.cost)}),(0,m.jsx)(`div`,{className:R.roundsBarWrap,children:(0,m.jsx)(`div`,{className:t?R.roundsBarFlagged:R.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${r(`model`)} ${e.model} · ${s(e.cost)} · ${Yn(e.startedAt)}${e.endedAt===void 0?``:` → ${Jn(e.endedAt)} (${Xn(e.endedAt-e.startedAt)})`}`,children:t&&(0,m.jsx)(`span`,{className:R.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,m.jsxs)(`div`,{className:R.roundsAxis,children:[(0,m.jsxs)(`span`,{children:[r(`costAbbr`),` `,s(o)]}),(0,m.jsxs)(`span`,{children:[i.length,` `,r(`roundsUnit`)]})]})]})}let Qn=[`color-mix(in srgb, var(--dsb-3) 70%, transparent)`,`color-mix(in srgb, var(--ds-cyan) 30%, var(--dsb-3))`,`color-mix(in srgb, var(--ds-blue) 60%, var(--dsb-3))`,`var(--ds-blue)`,`var(--ds-amber)`],$n=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],er=e=>K(e.getTime());function tr(e,t){let n=new Map;for(let t of e)n.set(t.date,t.value);let r=0;for(let e of n.values())e>r&&(r=e);let i=t.getFullYear(),a=t.getMonth(),o=t.getDate(),s=new Date(i,a+1,0).getDate(),c=new Date(i,a,1).getDay(),l=c+s,u=Math.ceil(l/7),d=[];for(let e=0;e<u;e+=1){let t=[];for(let l=0;l<7;l+=1){let u=e*7+l-c+1;if(u<1){let e=new Date(i,a,u);t.push({date:er(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}if(u>s){let e=new Date(i,a+1,u-s);t.push({date:er(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=new Date(i,a,u),f=er(d),p=n.get(f)??0,m=0;if(p>0&&r>0){let e=Math.ceil(p/r*4);m=Math.min(4,Math.max(1,e))}let h=u>o;t.push({date:f,dayNum:u,value:h?0:p,level:h?0:m,placeholder:h})}d.push(t)}return d}function nr(e,t,n=52){let r=new Map;for(let t of e)r.set(t.date,t.value);let i=0;for(let e of r.values())e>i&&(i=e);let a=er(t),o=new Date(t);o.setHours(0,0,0,0),o.setDate(o.getDate()-o.getDay());let s=new Date(o);s.setDate(o.getDate()-(n-1)*7);let c=[];for(let e=0;e<n;e+=1){let t=[];for(let n=0;n<7;n+=1){let o=new Date(s);o.setDate(s.getDate()+e*7+n);let c=er(o),l=c>a,u=l?0:r.get(c)??0,d=0;if(!l&&u>0&&i>0){let e=Math.ceil(u/i*4);d=Math.min(4,Math.max(1,e))}t.push({date:c,dayNum:o.getDate(),value:u,level:d,placeholder:l})}c.push(t)}return c}function rr({days:e,currency:t,now:n,t:r,range:i=`month`,unit:a=`cost`}){let[o,s]=(0,d.useState)(null),c=e=>G(hn(e,t),t),l=e=>a===`tokens`?q(e):c(e),u=(0,d.useMemo)(()=>tr(e,n??new Date),[e,n]),f=er(n??new Date);if(i!==`month`){let t=nr(e,n??new Date,i===`half`?26:52),a=[],o=-1;return t.forEach((e,t)=>{let n=Number(e[0]?.date.slice(5,7)??0);n!==o&&(a.push({index:t,label:$n[n-1]??``}),o=n)}),(0,m.jsxs)(`div`,{className:R.heatmapYear+(i===`half`?` `+R.heatmapHalf:``),"data-testid":i===`half`?`heatmap-half`:`heatmap-year`,children:[(0,m.jsxs)(`div`,{className:R.heatmapYearBody,children:[(0,m.jsx)(`div`,{className:R.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,m.jsx)(`span`,{className:R.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,m.jsxs)(`div`,{className:R.heatmapYearScroll,children:[(0,m.jsx)(`div`,{className:R.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:a.map(e=>(0,m.jsx)(`span`,{className:R.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,m.jsx)(`div`,{className:R.heatmapYearGrid,role:`img`,"aria-label":`yearly cost heatmap`,"data-testid":`heatmap-year-grid`,children:t.flat().map(e=>(0,m.jsx)(`button`,{type:`button`,className:R.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:Qn[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,tabIndex:-1},e.date))})]})]}),(0,m.jsxs)(`div`,{className:R.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:R.heatmapLegend,children:Qn.map((e,t)=>(0,m.jsx)(`i`,{style:{background:e}},t))}),(0,m.jsx)(`span`,{children:r(`heatmapMore`)})]})]})}return(0,m.jsxs)(`div`,{className:R.heatmap,children:[(0,m.jsx)(`div`,{className:R.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,m.jsx)(`div`,{className:R.heatmapCellEmpty,children:e.dayNum},e.date):(0,m.jsx)(`button`,{type:`button`,className:R.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:Qn[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,onMouseEnter:()=>{s(e)},onMouseLeave:()=>{s(null)},onFocus:()=>{s(e)},onBlur:()=>{s(null)},children:e.dayNum},e.date)))}),(0,m.jsxs)(`div`,{className:R.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:R.heatmapLegend,children:Qn.map((e,t)=>(0,m.jsx)(`i`,{style:{background:e}},t))}),(0,m.jsx)(`span`,{children:r(`heatmapMore`)}),o!==null&&(0,m.jsxs)(`span`,{className:R.heatmapHover,"data-testid":`heatmap-hover`,children:[o.date,` · `,l(o.value)]})]})]})}let ir={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function Z(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function ar(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function or(e,t){let n=t?.window??ir.window,r=t?.threshold??ir.threshold,i=t?.reasonFactor??ir.reasonFactor,a=t?.reasonHitDropPp??ir.reasonHitDropPp,o=[];if(n<=0||r<=0)return o;let s=[],c=[],l=[],u=[];for(let t of e){if(t.cost<=0)continue;let e=t.output,d=t.input,f=ar(t),p=Z(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=Z(c),r=Z(l),s=Z(u);n!==null&&n>0&&e>n*i&&m.push(`output-growth`),r!==null&&r>0&&d>r*i&&m.push(`context-bloat`),s!==null&&f!==null&&f<s-a&&m.push(`cache-hit-drop`),o.push({sessionId:t.sessionId,turn:t.turn,cost:t.cost,reasons:m})}for(s.push(t.cost),c.push(e),l.push(d),f!==null&&u.push(f);s.length>n;)s.shift();for(;c.length>n;)c.shift();for(;l.length>n;)l.shift();for(;u.length>n;)u.shift()}return o}let sr={},cr={};function lr(){return(0,h.defineStore)({init:()=>({enabled:!1,amount:0,tierAlertDays:{},lastBalanceAlertDay:``,lastTierSwitchAt:0,modelBudgets:{},modelTierAlertDays:{}}),persist:`dsh.ui-usage-billing.budget`,actions:{setEnabled:(e,t)=>{e.enabled=t},setAmount:(e,t)=>{e.amount=Number.isFinite(t)&&t>0?t:0},markTierAlerted:(e,t,n)=>{e.tierAlertDays??={};for(let r of t)e.tierAlertDays[String(r)]=n},markBalanceAlerted:(e,t)=>{e.lastBalanceAlertDay=t},markTierSwitchAlerted:(e,t)=>{e.lastTierSwitchAt=t},setModelBudget:(e,t,n)=>{e.modelBudgets??={},Number.isFinite(n)&&n>0?e.modelBudgets[t]=n:delete e.modelBudgets[t]},markModelTierAlerted:(e,t,n)=>{e.modelTierAlertDays??={};for(let r of t)e.modelTierAlertDays[r]=n}}})}function ur(e,t){return e==null?null:Number.isFinite(e.nextSwitchInMs)&&e.nextSwitchInMs<=t?`soon`:e.tier===`peak`?`peak`:`offPeak`}let dr={显式缓存创建:`Explicit cache write`,显式缓存命中:`Explicit cache hit`,长期半价:`Half price`,与标准价一致:`Same as standard`,"限时 5 折":`Limited-time 50% off`};function fr(e,t){return e===void 0||t!==`en`?e:dr[e]??e}function pr(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>e.key.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)||(e.provider??``).toLowerCase().includes(n))}let mr={"智谱 AI":`Zhipu AI`,阿里通义:`Alibaba Qwen`,字节豆包:`ByteDance Doubao`,月之暗面:`Moonshot AI`,小米:`Xiaomi`,百度文心:`Baidu ERNIE`,腾讯混元:`Tencent Hunyuan`,零一万物:`01.AI`,阶跃星辰:`StepFun`,科大讯飞:`iFlytek Spark`,商汤:`SenseNova`,百川智能:`Baichuan`,"小米 Token Plan(海外)":`Xiaomi Token Plan (Global)`,"小米 Token Plan(国内)":`Xiaomi Token Plan (CN)`,"小米 Token Plan(新加坡)":`Xiaomi Token Plan (SG)`,"火山引擎 Token Plan":`Volcengine Token Plan`,"火山方舟 Token Plan":`Volcengine Ark Token Plan`,"豆包 Token Plan":`Doubao Token Plan`,"百度文心 Plan":`Baidu ERNIE Plan`,"MiniMax Token Plan(国内)":`MiniMax Token Plan (CN)`};function hr(e,t){return t===`en`?mr[e]??e:e}let gr={workbuddy:`WorkBuddy`,"workbuddy-ai":`WorkBuddy AI`},_r={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},vr={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function yr(e){try{return new URL(e).host}catch{return e}}function br(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=_r[n];return r===void 0?yr(n):t===`en`?vr[r]??r:r}if(e.startsWith(`direct:`)){let n=e.slice(7);if(/^deepseek(?:-[a-z0-9-]+)?$/i.test(n))return t===`en`?`DeepSeek Official`:`DeepSeek 官方`;let r=gr[n.trim().toLowerCase()];return r===void 0?`${t===`en`?`Direct`:`直连`} · ${n}`:`${t===`en`?`Direct`:`直连`} · ${r}`}}let xr=[`直连 · `,`Direct · `];function Sr(e){for(let t of xr)if(e.startsWith(t))return e.slice(t.length)}let Cr=`dsh-billing-peak-alert-v1`,wr={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function Tr(e,t,n){return t===null||n<=0?e:e===null?{...t,queueCount:n}:e.atMs===t.atMs&&e.entering===t.entering?{...e,queueCount:n}:e}function Er(e,t){if(e===null||e.queueCount===void 0)return e;if(t>0)return e.queueCount===t?e:{...e,queueCount:t};let{queueCount:n,...r}=e;return r}function Dr(){try{let e=localStorage.getItem(Cr);if(e===null)return{...wr};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:wr.mode,r=t.position===`center`?`center`:`bottom-right`;return{enabled:t.enabled===!0,leadMin:typeof t.leadMin==`number`&&Number.isFinite(t.leadMin)?Math.min(30,Math.max(1,Math.round(t.leadMin))):wr.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...wr}}}function Or(e){try{localStorage.setItem(Cr,JSON.stringify(e))}catch{x(`peak-config-storage-unavailable`)}}function kr(e,t,n,r){if(!t.enabled)return null;let i=Bt(e,r,t.leadMin*6e4);return i===null||t.mode===`peak`&&i.entering!==`peak`||t.mode===`offPeak`&&i.entering!==`offPeak`||i.atMs===n?null:{...i,channel:r}}let Ar=[50,80,100],jr=3e4,Mr=`dsh-billing-root`,Nr={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}},Pr=[`#4f8cff`,`#2dd4bf`,`#a78bfa`,`#f59e0b`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#6366f1`,`#f97316`,`#14b8a6`];function Fr({hit:e,config:t,t:n,onDismiss:r}){let[i,a]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),3e4);return()=>clearInterval(e)},[]),(0,d.useEffect)(()=>{i>=e.atMs&&r()},[i,e.atMs,r]),i>=e.atMs)return null;let o=Math.max(1,Math.round((e.atMs-i)/6e4)),s=e.entering,c=n(s===`peak`?`tierPeak`:`tierOff`),l=n(e.channel===`zhipu-coding-plan`?s===`peak`?`peakAlertDescPeakZhipu`:`peakAlertDescOffZhipu`:s===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),u=s===`peak`;return(0,m.jsxs)(`div`,{className:y(R.peakCard,Mr,u?R.peakCardPeak:R.peakCardOff,t.position===`center`?R.peakCardCenter:R.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,m.jsxs)(`div`,{className:R.peakHead,children:[(0,m.jsxs)(`span`,{className:y(R.peakTag,u?R.peakTagPrimary:R.peakTagSuccess),children:[(0,m.jsx)(`span`,{className:y(R.peakDot,u?R.peakDotPrimary:R.peakDotSuccess),"aria-hidden":`true`}),c]}),(0,m.jsx)(`button`,{type:`button`,className:R.peakClose,onClick:r,"aria-label":n(`close`),children:`×`})]}),(0,m.jsxs)(`div`,{className:y(R.peakCount,u?R.peakCountPrimary:R.peakCountSuccess),children:[o,`min`]}),(0,m.jsx)(`p`,{className:R.peakDesc,children:l}),e.queueCount!==void 0&&e.queueCount>0&&(0,m.jsx)(`p`,{className:R.peakDesc,"data-testid":`billing-peak-queue-note`,children:n(s===`peak`?`peakAlertQueuePeak`:`peakAlertQueueOff`,{count:e.queueCount})})]})}let Ir={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},Lr=[{id:`overview`,labelKey:`tabOverview`},{id:`queue`,labelKey:`tabQueue`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`agents`,labelKey:`tabAgents`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],Rr={fill:`none`,"aria-hidden":!0,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`},zr={overview:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:(0,m.jsx)(`path`,{d:`M2 13V3M2 13H14M4 10l4-3 2 2 4-5`})}),queue:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:[(0,m.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h6`}),(0,m.jsx)(`path`,{d:`M12 10v4m-2-2h4`})]}),agents:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`3.5`,r:`2`}),(0,m.jsx)(`circle`,{cx:`3.5`,cy:`12.5`,r:`2`}),(0,m.jsx)(`circle`,{cx:`12.5`,cy:`12.5`,r:`2`}),(0,m.jsx)(`path`,{d:`M8 5.5v2.5M6.5 10.5L5 11.5M9.5 10.5L11 11.5`})]}),providers:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:[(0,m.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,m.jsx)(`path`,{d:`M5 7l2 2 4-4`})]}),token:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:[(0,m.jsx)(`circle`,{cx:`6`,cy:`6`,r:`3`}),(0,m.jsx)(`circle`,{cx:`11`,cy:`11`,r:`3`})]}),trends:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:(0,m.jsx)(`path`,{d:`M2 4l4 4 3-3 5 5M11 10h3V7`})}),pricing:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:[(0,m.jsx)(`path`,{d:`M8 2l6 3v6l-6 3-6-3V5z`}),(0,m.jsx)(`path`,{d:`M8 2v12M2 5h12`})]}),settings:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Rr,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2.5`}),(0,m.jsx)(`path`,{d:`M8 1.5v2M8 12.5v2M1.5 8h2M12.5 8h2`})]})},Br=p,Vr=Br.IconChevronDownOutlineMedium??Br.IconChevronDownOutline14;function Hr(e,t){let n=Object.keys(e).filter(e=>e<=t).sort().slice(-7);return n.length===0?0:n.reduce((t,n)=>t+(e[n]?.cost??0),0)/n.length}function Ur(e,t){let n=t.split(`-`),r=new Date(Number(n[0]),Number(n[1])-1,Number(n[2])),i=0;for(let t=0;t<7;t+=1){let t=`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,`0`)}-${String(r.getDate()).padStart(2,`0`)}`;i+=e[t]?.cost??0,r.setDate(r.getDate()-1)}return i/7}function Wr(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)).reduce((t,n)=>t+(e[n]?.cost??0),0),i=t.split(`-`),a=new Date(Number(i[0]),Number(i[1]),0).getDate(),o=n.startsWith(t)?Number(n.slice(8,10)):a,s=Math.max(0,a-o);return r<=0?Hr(e,n)*s:r+Ur(e,n)*s}function Gr(e){return Object.keys(e).length}function Kr(e,t=Date.now()){let n=0,r=new Date(t);for(;K(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function qr(e){return e.input+e.output}function Jr(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=K(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function Yr(e,t,n=e=>e.cost){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=0;for(let t=0;t<=i;t+=1){let i=new Date(r);i.setDate(i.getDate()-t);let o=e[K(i.getTime())];o!==void 0&&(a+=n(o))}return a}function Xr(e,t,n){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=new Date(r);a.setDate(a.getDate()-i);let o=K(a.getTime()),s=new Date(r);s.setDate(s.getDate()-6);let c=K(s.getTime());return Qr(e,e=>n===`today`?e===t:n===`7d`?e>=c&&e<=t:n===`week`?e>=o&&e<=t:e.startsWith(t.slice(0,7)))}function Zr(e,t,n){return Qr(e,e=>e>=t&&e<=n)}function Qr(e,t){let n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0,u,d=0;for(let[f,p]of Object.entries(e)){if(!t(f))continue;n+=p.cost,r+=p.calls,i+=p.input,a+=p.output,o+=p.cacheHit,s+=p.cacheMiss,c+=p.cacheWrite??0,l+=p.reasoning??0;let e=qr(p);e>d&&(d=e,u=f)}return{cost:n,calls:r,input:i,output:a,cacheHit:o,cacheMiss:s,cacheWrite:c,reasoning:l,peakDay:u,peakTokens:d}}function $r(e,t){let n={};if(e===void 0)return n;for(let[r,i]of Object.entries(e))if(r.startsWith(t))for(let[e,t]of Object.entries(i))n[e]=(n[e]??0)+t.cost;return n}let ei=[80,100];function ti(e,t){if(!(t>0)||!(e>0))return[];let n=e/t*100;return ei.filter(e=>n>=e)}let ni={DeepSeek:[`deepseek`],"智谱 AI":[`zhipu`,`glm`,`z.ai`],阿里通义:[`qwen`,`tongyi`,`dashscope`,`aliyun`],字节豆包:[`doubao`,`volcengine`,`ark`],月之暗面:[`moonshot`,`kimi`],小米:[`xiaomi`,`mi`,`mimo`],MiniMax:[`minimax`],百度文心:[`ernie`,`wenxin`,`qianfan`,`baidu`],腾讯混元:[`hunyuan`,`tencent`],零一万物:[`01.ai`,`lingyi`,`yi`],阶跃星辰:[`step`,`stepfun`,`step-3.7`],科大讯飞:[`spark`,`xfyun`,`iflytek`],商汤:[`sensenova`,`sensetime`],百川智能:[`baichuan`],OpenAI:[`openai`],Google:[`google`,`gemini`],xAI:[`xai`,`grok`],Meta:[`meta`,`llama`],Anthropic:[`claude`,`anthropic`],"Mistral AI":[`mistral`,`ministral`,`devstral`],Cohere:[`cohere`,`command`],美团:[`longcat`,`meituan`],面壁智能:[`minicpm`,`modelbest`],小红书:[`dots`,`rednote`,`xiaohongshu`],云知声:[`unisound`,`u2`]};function Q(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function ri(e,t){if(e.length===0||t.length===0)return!1;if(e===t)return!0;let[n,r]=e.length<=t.length?[e,t]:[t,e];return n.length>=3&&r.includes(n)}function ii(e,t){let n=Q(e),r=Q(t);if(ri(n,r))return!0;let i=ni[e];return i!==void 0&&i.some(e=>ri(Q(e),r))}function ai(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(ni))for(let r of n){let n=Q(r);if(n.length!==0&&(t===n||t.startsWith(`${n}-`)||t.startsWith(`${n}/`)||t.startsWith(`${n}_`)||t.includes(`${n}-`)||t.includes(`${n}/`)||t.includes(`${n}_`)))return e}for(let[e,t]of Object.entries(ni))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let oi={"kimi-coding":`月之暗面`,"zai-coding-cn":`智谱 AI`,"zai-coding":`智谱 AI`,"qwen-token-plan":`阿里通义`,"qwen-token-plan-cn":`阿里通义`,"xiaomi-token-plan-ams":`小米`,"xiaomi-token-plan-cn":`小米`,"xiaomi-token-plan-sgp":`小米`,"volcengine-token-plan":`字节豆包`,"ark-token-plan":`字节豆包`,"doubao-token-plan":`字节豆包`,ernie:`百度文心`,baidu:`百度文心`,wenxin:`百度文心`,minimax:`MiniMax`,"minimax-cn":`MiniMax`,"minimax-token-plan":`MiniMax`,"minimax-token-plan-cn":`MiniMax`,"hunyuan-token-plan":`腾讯混元`,"tencent-token-plan":`腾讯混元`,"hy-token-plan":`腾讯混元`,"xinghuo-token-plan":`讯飞星火`,"xfyun-coding":`讯飞星火`,"spark-coding":`讯飞星火`,"huawei-token-plan":`华为云`,"pangu-token-plan":`华为云`,"huawei-maas-token-plan":`华为云`,"volcengine-agent-plan":`字节豆包`,"ark-agent-plan":`字节豆包`,"baidu-token-plan":`百度文心`,"ernie-token-plan":`百度文心`,"wenxin-token-plan":`百度文心`,opencode:`OpenCode`,"opencode-go":`OpenCode`};function si(e){let t=oi[e];return t===void 0?ai(e)??e:t}let ci=`https://platform.kimi.com/console/pay`,li=`https://open.bigmodel.cn/finance-center/finance/pay`,ui=`https://bailian.console.aliyun.com/`,di=`https://console.volcengine.com/ark`,fi=`https://console.anthropic.com/settings/billing`,pi=`https://console.cloud.google.com/billing`,mi=`https://console.x.ai/`,hi=`https://platform.xiaomimimo.com/console/balance`,gi=`https://console.cloud.tencent.com/expense/recharge`,_i={deepseek:`https://platform.deepseek.com/top_up`,minimax:`https://platform.minimax.cn/console/recharge-records`,moonshot:ci,kimi:ci,zhipu:li,bigmodel:li,qwen:ui,dashscope:ui,doubao:di,volcengine:di,ark:di,openai:`https://platform.openai.com/settings/organization/billing`,anthropic:fi,claude:fi,google:pi,gemini:pi,xai:mi,grok:mi,siliconflow:`https://cloud.siliconflow.cn/account/charge`,hunyuan:gi,tencent:gi,腾讯云:gi,xiaomi:hi,mimo:hi,mi:hi,qianfan:`https://console.bce.baidu.com/qianfan/overview`};function vi(e){let t=_i[e];if(t!==void 0)return t;let n=Object.keys(_i).find(t=>e.startsWith(t));return n===void 0?void 0:_i[n]}function yi(e){let t=Q(e),n=vi(t);if(n!==void 0)return n;for(let[e,n]of Object.entries(ni))if(ri(Q(e),t))for(let e of n){let t=vi(Q(e));if(t!==void 0)return t}}function bi(e){let t=_t();if(t===void 0||e.byDayModels===void 0)return e;let n=Tt().rate,r=e.byDayModelsSite!==void 0,i={},a={},o=new Map,s=0,c=e=>t.some(t=>t.origin!==void 0&&t.origin!==``&&(t.key===e||W(t.key)===W(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=r=>{let a=(t.cacheMiss*r.input+i*r.cacheHit+t.output*r.output)/1e6;return e.currency===`USD`?a*n:a};return e.offPeak===void 0?a(e):a(e)*Dt+a(e.offPeak)*.5};for(let[t,n]of Object.entries(e.byDayModels)){let u=0,d={};for(let[i,a]of Object.entries(n)){let n=yt(i)??bt(i),s=r&&c(i),f;if(s&&e.byDayModelsSite?.[t]?.[i]!==void 0){let r=0;for(let[a,o]of Object.entries(e.byDayModelsSite[t][i])){let e=a.startsWith(`site:`)?a.slice(5):void 0,t=e===void 0?void 0:yt(i,e);r+=l(t??n,o,o.cost)}f=r}else f=l(n,a,a.cost);u+=f,d[i]={...a,cost:f},o.set(i,(o.get(i)??0)+f)}let f=e.byDay[t];f!==void 0&&(i[t]={...f,cost:u}),a[t]=d,s+=u}return{...e,total:{...e.total,cost:s},byDay:i,byDayModels:a,byModel:Object.fromEntries(Object.entries(e.byModel).map(([e,t])=>{let n=o.get(e);return[e,n===void 0?t:{...t,cost:n}]})),unpricedModels:(e.unpricedModels??[]).filter(e=>!yt(e)&&!bt(e))}}function xi(){return{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cacheWrite:0,cost:0}}function Si(e,t){e.calls+=t.calls,e.input+=t.input,e.output+=t.output,e.cacheHit+=t.cacheHit,e.cacheMiss+=t.cacheMiss,e.cacheWrite+=t.cacheWrite??0,e.cost+=t.cost}function Ci(e,t){e.calls-=t.calls,e.input-=t.input,e.output-=t.output,e.cacheHit-=t.cacheHit,e.cacheMiss-=t.cacheMiss,e.cacheWrite=(e.cacheWrite??0)-t.cacheWrite,e.cost-=t.cost}function wi(e){let t=e.byDayModelsSite;if(t===void 0)return[];let n=new Map;for(let e of Object.values(t))for(let t of Object.values(e))for(let[e,r]of Object.entries(t)){let t=n.get(e)??xi();Si(t,r),n.set(e,t)}return[...n.entries()].map(([e,t])=>({siteKey:e,calls:t.calls,input:t.input,output:t.output,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,cost:t.cost})).sort((e,t)=>t.cost===e.cost?e.siteKey.localeCompare(t.siteKey):t.cost-e.cost)}function Ti(e,t){let n=new Map;for(let r of e){let e=t(r.siteKey),i=n.get(e)??{siteKeys:[],calls:0,tokens:0,cost:0};i.siteKeys.push(r.siteKey),i.calls+=r.calls,i.tokens+=r.input+r.output,i.cost+=r.cost,n.set(e,i)}return[...n.entries()].map(([e,t])=>({name:e,...t})).sort((e,t)=>t.cost===e.cost?e.name.localeCompare(t.name,`zh`):t.cost-e.cost)}function Ei(e,t){if(t.size===0)return e;let n=e.byDayModelsSite;if(n===void 0)return e;let r=new Map,i=new Map,a=new Map,o=xi(),s={};for(let[e,c]of Object.entries(n)){let n={};for(let[s,l]of Object.entries(c)){let c={};for(let[n,u]of Object.entries(l)){if(t.has(n)){let t=r.get(e)??new Map,n=t.get(s)??xi();Si(n,u),t.set(s,n),r.set(e,t);let c=i.get(e)??xi();Si(c,u),i.set(e,c);let l=a.get(s)??xi();Si(l,u),a.set(s,l),Si(o,u);continue}c[n]=u}Object.keys(c).length>0&&(n[s]=c)}s[e]=n}let c={};for(let[t,n]of Object.entries(e.byDay)){let e=i.get(t);if(e===void 0){c[t]=n;continue}let r={...n};Ci(r,e),c[t]=r}let l={};for(let[t,n]of Object.entries(e.byDayModels??{})){let e={};for(let[i,a]of Object.entries(n)){let n={...a},o=r.get(t)?.get(i);o!==void 0&&Ci(n,o),e[i]=n}l[t]=e}let u={};for(let[t,n]of Object.entries(e.byModel)){let e={...n},r=a.get(t);r!==void 0&&Ci(e,r),u[t]=e}let d={};for(let[n,r]of Object.entries(e.bySite??{}))t.has(n)||(d[n]=r);let f={...e.total};return Ci(f,o),{...e,total:f,byDay:c,byDayModels:l,byModel:u,bySite:d,byDayModelsSite:s}}async function Di(e,t={}){let{timeoutMs:n=12e3,signal:r,...i}=t,a=new AbortController,o=setTimeout(()=>{a.abort()},n),s=()=>{a.abort()};r!=null&&(r.aborted?a.abort():r.addEventListener(`abort`,s,{once:!0}));try{return await fetch(e,{...i,signal:a.signal})}finally{clearTimeout(o),r?.removeEventListener(`abort`,s)}}let Oi=new Set;function ki(){return typeof Notification<`u`&&Notification.permission===`granted`}function Ai(e,t){Oi.has(e)||(Oi.add(e),Di(`/api/billing/notify-claim`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e})}).then(e=>e.json()).then(e=>{e.claimed!==!1&&t()}).catch(()=>t()))}function ji(e){let t=new Map,n=[];for(let r of e){if(r.title===void 0||r.title===``){n.push(r);continue}let e=t.get(r.title);if(e===void 0){let e={...r,mergedCount:1};t.set(r.title,e),n.push(e);continue}e.children===void 0&&(e.children=[{...e}]),e.children.push({...r}),e.calls+=r.calls,e.cost+=r.cost,e.lastActive=Math.max(e.lastActive,r.lastActive),r.stale===!0&&(e.stale=!0),e.mergedCount=(e.mergedCount??1)+1}return n.sort((e,t)=>t.cost-e.cost||t.lastActive-e.lastActive)}function Mi(e){let t=new Map(e.map(e=>[e.id,e])),n=ji(e.filter(e=>e.parentId===void 0)),r=new Map;for(let e of n){r.set(e.id,e);for(let t of e.children??[])r.set(t.id,e)}let i=new Set,a=new Map,o=(e,t)=>{e.subs===void 0?e.subs=[t]:e.subs.push(t),i.add(t.id),a.set(t.id,e.id)};for(let n of e){if(n.parentId===void 0)continue;let e=t.get(n.parentId);if(e!==void 0&&e.parentId!==void 0&&e.id!==n.id){let t=e.id,r=new Set,i=!1;for(;t!==void 0&&!r.has(t);){if(r.add(t),t===n.id){i=!0;break}t=a.get(t)}if(!i){o(e,n);continue}}let s=new Set,c=n.parentId;for(;c!==void 0&&!s.has(c);){s.add(c);let e=r.get(c);if(e!==void 0){i.has(n.id)||o(e,n);break}c=t.get(c)?.parentId}}let s=e=>e.cost+(e.subCost??0),c=e=>{e.subs?.sort((e,t)=>s(t)-s(e)||t.lastActive-e.lastActive);for(let t of e.subs??[])c(t)};for(let e of n)c(e);let l=e.filter(e=>e.parentId!==void 0&&!i.has(e.id));for(let e of l)c(e);return[...n,...l].sort((e,t)=>t.cost-e.cost||t.lastActive-e.lastActive)}function Ni(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);let n=new Map,r=[];for(let i of e){let e=i.parentId;if(e===void 0||!t.has(e)||Pi(t,i.id)){r.push(i);continue}let a=n.get(e);a===void 0?n.set(e,[i]):a.push(i)}let i=(e,t,r)=>{let a=new Set(r);a.add(e.id);let o=(n.get(e.id)??[]).filter(e=>!r.has(e.id)).map(e=>i(e,t+1,a)).sort((e,t)=>t.chainCost-e.chainCost),s={id:e.id,...e.title===void 0?{}:{title:e.title},...e.cwd===void 0?{}:{cwd:e.cwd},calls:e.calls,cost:e.cost,lastActive:e.lastActive,chainCost:e.cost,chainCalls:e.calls,children:o,depth:t};for(let e of o)s.chainCost+=e.chainCost,s.chainCalls+=e.chainCalls;return s};return r.map(e=>i(e,0,new Set)).sort((e,t)=>t.chainCost-e.chainCost)}function Pi(e,t){let n=new Set([t]),r=e.get(t)?.parentId;for(;r!==void 0;){if(n.has(r))return!0;n.add(r),r=e.get(r)?.parentId}return!1}function Fi(e){let t=0,n=0,r,i=e=>{t+=1,n+=e.children.length,(r===void 0||e.chainCost>r.chainCost)&&(r=e);for(let t of e.children)i(t)};for(let t of e)i(t);return{agents:t,delegations:n,roots:e.length,...r===void 0?{}:{costliest:r}}}function Ii(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n)||(e.cwd??``).toLowerCase().includes(n)||e.id.toLowerCase().includes(n))}function Li(e,t){let n=e.trim().toLowerCase();return n!==``&&!t.some(e=>e.toLowerCase().includes(n))}function Ri(e,t){return e.checked?e.okProviders.some(e=>ii(t,e))?R.healthOk:e.badProviders.some(e=>ii(t,e))?R.healthBad:R.healthIdle:R.healthIdle}function zi(e,t){switch(e){case`ok`:return``;case`not-configured`:return t(`subscriptionNotConfigured`);case`unauthorized`:return t(`subscriptionUnauthorized`);case`rate-limited`:return t(`subscriptionRateLimited`);case`invalid-response`:return t(`subscriptionInvalid`);default:return t(`subscriptionUnavailable`)}}function Bi(e,t){switch(e){case`session`:return t(`subscriptionSession`);case`weekly`:return t(`subscriptionWeekly`);case`monthly`:return t(`subscriptionMonthly`);case`billing`:return t(`subscriptionBilling`)}}function Vi(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let Hi={"new-api":R.siteKindSite,sub2api:R.siteKindDirect,unknown:R.siteKindUnknown},Ui=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function Wi(e){return e.children===void 0?{cost:e.subCost??0,calls:e.subCalls??0}:(e.children??[]).reduce((e,t)=>({cost:e.cost+(t.subCost??0),calls:e.calls+(t.subCalls??0)}),{cost:0,calls:0})}function Gi(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Ki(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let n=t;for(let e of[`sessionListError`,`error`]){let t=n[e];if(typeof t==`string`&&t!==``)return t}return}catch{return}}async function qi(){try{let e=await Di(`/api/billing/usage-stats`),t=await e.text();if(!e.ok)return{ok:!1,reason:Ki(t)??`HTTP ${e.status}`,status:e.status};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{ok:!1,reason:`响应不是统计文档`};if(!(`total`in n))return{ok:!1,reason:Ki(t)??`响应不是统计文档`};let r=n,i=e=>typeof e==`object`&&!!e;return{ok:!0,stats:{total:r.total??Nr.total,byModel:r.byModel??{},byDay:r.byDay??{},...r.byDayModels===void 0?{}:{byDayModels:r.byDayModels},...i(r.byDayModelsSite)?{byDayModelsSite:r.byDayModelsSite}:{},...r.updatedAt===void 0?{}:{updatedAt:r.updatedAt},...r.staleSnapshot===!0?{staleSnapshot:!0}:{},...typeof r.budget==`number`?{budget:r.budget}:{},...typeof r.lowBalanceThreshold==`number`?{lowBalanceThreshold:r.lowBalanceThreshold}:{},...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...typeof r.bySessionTotal==`number`?{bySessionTotal:r.bySessionTotal}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{},...Array.isArray(r.byWorkspace)?{byWorkspace:r.byWorkspace}:{},...i(r.bySite)?{bySite:r.bySite}:{},...i(r.byTier)?{byTier:r.byTier}:{},...i(r.byTool)?{byTool:r.byTool}:{},...Array.isArray(r.unpricedModels)?{unpricedModels:r.unpricedModels}:{},...typeof r.staleLedgerSessions==`number`?{staleLedgerSessions:r.staleLedgerSessions}:{},...typeof r.unreadableSessions==`number`?{unreadableSessions:r.unreadableSessions}:{},...typeof r.unreadableFormatSessions==`number`?{unreadableFormatSessions:r.unreadableFormatSessions}:{},...typeof r.unreadableNoLedgerSessions==`number`?{unreadableNoLedgerSessions:r.unreadableNoLedgerSessions}:{},...typeof r.searchCallEstimateCny==`number`?{searchCallEstimateCny:r.searchCallEstimateCny}:{},...r.byRole!==null&&typeof r.byRole==`object`?{byRole:r.byRole}:{},...r.perf!==null&&typeof r.perf==`object`&&r.perf.byModel!==null&&typeof r.perf.byModel==`object`&&r.perf.byHourModel!==null&&typeof r.perf.byHourModel==`object`?{perf:r.perf}:{},...typeof r.pluginVersion==`string`?{pluginVersion:r.pluginVersion}:{},...typeof r.sessionListError==`string`?{sessionListError:r.sessionListError}:{}}}}catch(e){return{ok:!1,reason:e instanceof Error?e.message:String(e)}}}async function Ji(){try{let e=await Di(`/api/billing/balance`);if(!e.ok)return{balances:[]};let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return{balances:[]};let r=n;return{balances:Array.isArray(r.balances)?r.balances:[],...r.reconcile===void 0?{}:{reconcile:r.reconcile},...r.stale===!0?{stale:!0}:{}}}catch{return{balances:[]}}}async function Yi(){let e=await Di(`/api/billing/subscriptions`);if(!e.ok)throw Error(`subscriptions HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n){let e=n;return{quotas:e.quotas,...e.stale===!0?{stale:!0}:{}}}throw Error(`subscriptions: invalid response`)}async function Xi(){let e=await Di(`/api/billing/relay-quotas`);if(!e.ok)throw Error(`relay-quotas HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`relay-quotas: invalid response`)}async function Zi(){try{let e=await Di(`/api/billing/usage-tool`);if(!e.ok)return;let t=JSON.parse(await e.text());return typeof t.enabled==`boolean`?t.enabled:void 0}catch{return}}async function Qi(e){try{let t=await Di(`/api/billing/usage-tool`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:e})});return t.ok?JSON.parse(await t.text()).ok===!0:!1}catch{return!1}}let $i=!1,ea=0;async function ta(e=0){try{let t=await Di(`/api/billing/pricing`);if(!t.ok){$i=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){$i=!1;return}let i=r;Array.isArray(i.catalog)&&i.catalog.length>0&&i.aliases!==null&&typeof i.aliases==`object`&&Wt(i.catalog,i.aliases);let a=r;if(a.source===`builtin`&&e<3){if(e===0){if($i)return;$i=!0}setTimeout(()=>{ta(e+1)},2e3);return}$i=!1,ea=a.syncedAt??0,xt(a)}catch{$i=!1}}async function na(){try{return(await Di(`/api/billing/pricing/refresh`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`,timeoutMs:3e4})).ok?(await ta(),!0):!1}catch{return!1}}async function ra(e){try{let t=JSON.parse(await e.text());return typeof t.error==`string`?t.error:`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}async function ia(e=!1){let t=await Di(`/api/billing/task-queue${e?`?refresh=1`:``}`);if(!t.ok)throw Error(await ra(t));return await t.json()}async function aa(){let e=await Di(`/api/billing/task-queue-summary`);if(!e.ok)throw Error(await ra(e));return await e.json()}async function oa(e){let t=await Di(`/api/billing/task-queue`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await ra(t));return(await t.json()).snapshot}let sa=`@kenz1117/dsh-ui-usage-billing/TaskQueuePanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(sa)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=sa,e.textContent=`.cQSERa_queuePanel{color:var(--ds-t-1);flex-direction:column;flex-shrink:0;gap:12px;display:flex}.cQSERa_queuePanel *{box-sizing:border-box}.cQSERa_queueHero,.cQSERa_queueComposer,.cQSERa_queueListSection,.cQSERa_queueUnsupported{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-2);flex-shrink:0}.cQSERa_queueHero{justify-content:space-between;align-items:center;gap:16px;padding:16px;display:flex}.cQSERa_queueTitleRow{align-items:center;gap:8px;display:flex}.cQSERa_queueTitle,.cQSERa_queueListHead h3,.cQSERa_queueUnsupported h3{margin:0;font-size:15px;font-weight:650}.cQSERa_queuePreview{background:var(--ds-violet-soft);color:var(--ds-violet);text-transform:uppercase;border-radius:5px;padding:2px 6px;font-size:10px;font-weight:700}.cQSERa_queueSubtitle{color:var(--ds-t-2);margin:5px 0 0;font-size:12px;line-height:1.6}.cQSERa_queueBand{color:var(--ds-t-2);flex-direction:column;flex-shrink:0;align-items:flex-end;gap:3px;font-size:11px;display:flex}.cQSERa_queueBand strong{font-size:13px}.cQSERa_queueBandOff strong{color:var(--ds-green)}.cQSERa_queueBandPeak strong{color:var(--ds-amber)}.cQSERa_queueComposer{flex-direction:column;gap:12px;padding:14px;display:flex}.cQSERa_queueSafety{border-radius:var(--ds-r-1);background:color-mix(in srgb, var(--ds-amber) 8%, transparent);color:var(--ds-t-2);padding:9px 11px;font-size:11px;line-height:1.65}.cQSERa_queueSafetyMode{color:var(--ds-t-3);margin-top:4px;display:block}.cQSERa_queueSelectors{grid-template-columns:1fr 1fr;gap:10px;display:grid}.cQSERa_queueField,.cQSERa_queuePromptField{color:var(--ds-t-2);flex-direction:column;gap:6px;font-size:11px;display:flex}.cQSERa_queueField select,.cQSERa_queuePromptField textarea{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);width:100%;color:var(--ds-t-1);font:inherit}.cQSERa_queueField select{height:34px;padding:0 9px}.cQSERa_queuePromptField textarea{resize:vertical;min-height:112px;padding:10px;line-height:1.55}.cQSERa_queueField select:focus,.cQSERa_queuePromptField textarea:focus{outline:2px solid color-mix(in srgb, var(--ds-blue) 35%, transparent);border-color:var(--ds-blue)}.cQSERa_queueField select:disabled,.cQSERa_queuePromptField textarea:disabled{opacity:.55}.cQSERa_queueComposerFooter{color:var(--ds-t-3);justify-content:space-between;align-items:center;gap:12px;font-size:10px;line-height:1.5;display:flex}.cQSERa_queueComposerActions{flex-shrink:0;align-items:center;gap:8px;display:flex}.cQSERa_queueFileInput{display:none}.cQSERa_queuePrimary,.cQSERa_queueSecondary{border-radius:var(--ds-r-1);cursor:pointer;flex-shrink:0;min-height:34px;padding:0 16px;font-weight:600}.cQSERa_queuePrimary{background:var(--ds-blue);color:#fff;border:0}.cQSERa_queueSecondary{border:1px solid var(--ds-border);background:var(--dsb);color:var(--ds-t-1)}.cQSERa_queuePrimary:disabled,.cQSERa_queueSecondary:disabled{opacity:.45;cursor:not-allowed}.cQSERa_queueListSection{padding:12px 14px}.cQSERa_queueListHead{justify-content:space-between;align-items:center;margin-bottom:8px;display:flex}.cQSERa_queueListHead h3 span{color:var(--ds-t-3);margin-left:4px;font-size:11px;font-weight:500}.cQSERa_queueList{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.cQSERa_queueTask{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);padding:10px}.cQSERa_queueTaskHead{align-items:center;gap:8px;min-width:0;display:flex}.cQSERa_queueStatus{background:var(--dsb-3);color:var(--ds-t-2);border-radius:5px;flex-shrink:0;padding:2px 6px;font-size:10px;font-weight:650}.cQSERa_queueStatus_running,.cQSERa_queueStatus_starting{color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.cQSERa_queueStatus_completed{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.cQSERa_queueStatus_failed{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 10%, transparent)}.cQSERa_queueTaskMeta{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--ds-t-2);font-size:11px;overflow:hidden}.cQSERa_queueTaskTime{color:var(--ds-t-3);flex-shrink:0;margin-left:auto;font-size:10px}.cQSERa_queueTaskTarget{color:var(--ds-t-2);overflow-wrap:anywhere;flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;font-size:11px;line-height:1.5;display:flex}.cQSERa_queueTaskTargetNote{color:var(--ds-t-3);font-size:10px}.cQSERa_queuePrompt{color:var(--ds-t-1);margin-top:8px;font-size:12px;line-height:1.55}.cQSERa_queuePrompt summary{text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden}.cQSERa_queuePrompt pre{background:var(--dsb-2);white-space:pre-wrap;overflow-wrap:anywhere;max-height:240px;font-family:var(--mono);border-radius:6px;margin:8px 0 0;padding:9px;font-size:11px;line-height:1.55;overflow:auto}.cQSERa_queueTaskError{color:var(--ds-red);overflow-wrap:anywhere;margin-top:8px;font-size:11px;line-height:1.5}.cQSERa_queueTaskActions{justify-content:flex-end;gap:10px;margin-top:5px;display:flex}.cQSERa_queueLinkButton{color:var(--ds-blue);cursor:pointer;background:0 0;border:0;padding:2px 0;font-size:11px}.cQSERa_queueLinkButton:disabled{opacity:.45;cursor:not-allowed}.cQSERa_queueEmpty{color:var(--ds-t-3);text-align:center;padding:26px 12px;font-size:12px}.cQSERa_queueUnsupported{padding:22px}.cQSERa_queueUnsupported p{color:var(--ds-t-2);margin:8px 0 0;font-size:12px;line-height:1.7}.cQSERa_queueNotice,.cQSERa_queueNoticeError{border-radius:var(--ds-r-1);overflow-wrap:anywhere;flex-shrink:0;padding:9px 11px;font-size:11px;line-height:1.5}.cQSERa_queueNotice{background:var(--dsb-2);color:var(--ds-t-2)}.cQSERa_queueNoticeError{background:color-mix(in srgb, var(--ds-red) 10%, transparent);color:var(--ds-red)}@media (width<=640px){.cQSERa_queueHero{align-items:flex-start}.cQSERa_queueSelectors{grid-template-columns:1fr}.cQSERa_queueComposerFooter{flex-direction:column;align-items:stretch}.cQSERa_queueComposerActions{flex-wrap:wrap;justify-content:flex-end}.cQSERa_queueTaskTime{display:none}}`,document.head.appendChild(e)}var $={queueBand:`cQSERa_queueBand`,queueBandOff:`cQSERa_queueBandOff`,queueBandPeak:`cQSERa_queueBandPeak`,queueComposer:`cQSERa_queueComposer`,queueComposerActions:`cQSERa_queueComposerActions`,queueComposerFooter:`cQSERa_queueComposerFooter`,queueEmpty:`cQSERa_queueEmpty`,queueField:`cQSERa_queueField`,queueFileInput:`cQSERa_queueFileInput`,queueHero:`cQSERa_queueHero`,queueLinkButton:`cQSERa_queueLinkButton`,queueList:`cQSERa_queueList`,queueListHead:`cQSERa_queueListHead`,queueListSection:`cQSERa_queueListSection`,queueNotice:`cQSERa_queueNotice`,queueNoticeError:`cQSERa_queueNoticeError`,queuePanel:`cQSERa_queuePanel`,queuePreview:`cQSERa_queuePreview`,queuePrimary:`cQSERa_queuePrimary`,queuePrompt:`cQSERa_queuePrompt`,queuePromptField:`cQSERa_queuePromptField`,queueSafety:`cQSERa_queueSafety`,queueSafetyMode:`cQSERa_queueSafetyMode`,queueSecondary:`cQSERa_queueSecondary`,queueSelectors:`cQSERa_queueSelectors`,queueStatus:`cQSERa_queueStatus`,queueStatus_completed:`cQSERa_queueStatus_completed`,queueStatus_failed:`cQSERa_queueStatus_failed`,queueStatus_running:`cQSERa_queueStatus_running`,queueStatus_starting:`cQSERa_queueStatus_starting`,queueSubtitle:`cQSERa_queueSubtitle`,queueTask:`cQSERa_queueTask`,queueTaskActions:`cQSERa_queueTaskActions`,queueTaskError:`cQSERa_queueTaskError`,queueTaskHead:`cQSERa_queueTaskHead`,queueTaskMeta:`cQSERa_queueTaskMeta`,queueTaskTarget:`cQSERa_queueTaskTarget`,queueTaskTargetNote:`cQSERa_queueTaskTargetNote`,queueTaskTime:`cQSERa_queueTaskTime`,queueTitle:`cQSERa_queueTitle`,queueTitleRow:`cQSERa_queueTitleRow`,queueUnsupported:`cQSERa_queueUnsupported`};let ca={queued:`queueStatusQueued`,starting:`queueStatusStarting`,running:`queueStatusRunning`,completed:`queueStatusCompleted`,failed:`queueStatusFailed`};function la(e){return e.status===`completed`||e.status===`failed`}function ua(e,t){return JSON.stringify([e,t])}function da(e){let t=e.startsWith(`session-`)?e.slice(8):e;return t.length<=8?t:t.slice(0,8)}function fa(e,t){let n;try{n=JSON.parse(e)}catch{throw Error(`invalid task import`)}if(!Array.isArray(n)||n.length===0)throw Error(`invalid task import`);return n.map(e=>{if(typeof e==`string`)return{prompt:e,...t};if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`invalid task import`);let n=e;return{prompt:n.prompt,cwd:n.cwd??t.cwd,provider:n.provider??t.provider,model:n.model??t.model}})}function pa({t:e,language:t,navigateToSession:n,sessionTitleOf:r,reuseSourceSession:i}){let[a,o]=(0,d.useState)(),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(``),[f,p]=(0,d.useState)(``),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(),[b,x]=(0,d.useState)(),S=(0,d.useRef)(!0),C=(0,d.useRef)(!1),w=(0,d.useRef)(!1),T=(0,d.useRef)(null),E=(0,d.useCallback)(async()=>{if(!C.current){C.current=!0;try{let e=await ia();S.current&&o(e)}catch(e){S.current&&v(e instanceof Error?e.message:String(e))}finally{C.current=!1}}},[]),[ee,te]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{te(!document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]),(0,d.useEffect)(()=>{if(S.current=!0,!ee)return;E();let e=setInterval(()=>{E()},5e3);return()=>{S.current=!1,clearInterval(e)}},[E,ee]),(0,d.useEffect)(()=>{if(_===void 0)return;let e=window.setTimeout(()=>{v(void 0)},8e3);return()=>{window.clearTimeout(e)}},[_]),(0,d.useEffect)(()=>{if(b===void 0)return;let e=window.setTimeout(()=>{x(void 0)},4e3);return()=>{window.clearTimeout(e)}},[b]),(0,d.useEffect)(()=>{a!==void 0&&(a.workspaces.some(e=>e.path===l)||u(a.workspaces[0]?.path??``),a.models.some(e=>ua(e.provider,e.id)===f)||p(a.models[0]===void 0?``:ua(a.models[0].provider,a.models[0].id)))},[a,l,f]);let D=(0,d.useCallback)(async(e,t=!1)=>{if(h||w.current)return!1;w.current=!0,g(!0),v(void 0),x(void 0);try{let n=await oa(e);return S.current?(o(n),t&&c(``),!0):!1}catch(e){return S.current&&v(e instanceof Error?e.message:String(e)),!1}finally{w.current=!1,g(!1)}},[h]),O=(0,d.useMemo)(()=>a?.tasks.filter(e=>!la(e))??[],[a]),ne=(0,d.useMemo)(()=>a?.tasks.filter(la).slice().reverse()??[],[a]),k=a!==void 0&&a.supported&&a.workspaces.length>0&&a.models.length>0,A=e=>new Date(e).toLocaleString(t===`en`?`en-US`:`zh-CN`),j=()=>{if(s.trim()===``||l===``||f===``)return;let[e,t]=JSON.parse(f);D({action:`enqueue`,prompt:s,cwd:l,provider:e,model:t},!0)},M=async t=>{if(!(t===void 0||!k||h||f===``)){v(void 0),x(void 0);try{if(t.size>10485760){v(e(`queueImportTooLarge`));return}let[n,r]=JSON.parse(f),i=fa(await t.text(),{cwd:l,provider:n,model:r});await D({action:`enqueueMany`,tasks:i})&&S.current&&x(e(`queueImported`,{count:i.length}))}catch{S.current&&v(e(`queueImportFormat`))}}},re=t=>{let r=n(t);x(r===`opened`?void 0:e(r===`unavailable`?`sessionOpenUnavailable`:`sessionOpenFailed`))},N=t=>{let n=a?.workspaces.find(e=>e.path===t.cwd),i=t.reuseSource===!0?t.sourceSessionId:void 0,o=t.sourceSessionId!==void 0&&t.sessionId===t.sourceSessionId,s=e=>r?.(e)??da(e),c=t.fallbackReason===void 0?o?e(`queueReuseDone`,{session:s(t.sessionId)}):i===void 0?void 0:e(`queueReusePlanned`,{session:s(i)}):e(`queueFallbackReason`,{reason:t.fallbackReason}),l=t.fallbackReason===void 0?t.sessionId??i:t.sessionId;return(0,m.jsxs)(`li`,{className:$.queueTask,"data-testid":`queue-task-${t.id}`,children:[(0,m.jsxs)(`div`,{className:$.queueTaskHead,children:[(0,m.jsx)(`span`,{className:y($.queueStatus,$[`queueStatus_${t.status}`]),children:e(ca[t.status])}),(0,m.jsxs)(`span`,{className:$.queueTaskMeta,children:[n?.title??t.cwd,` · `,t.model]}),(0,m.jsx)(`time`,{className:$.queueTaskTime,dateTime:new Date(t.createdAt).toISOString(),children:A(t.createdAt)})]}),c!==void 0&&(0,m.jsxs)(`div`,{className:$.queueTaskTarget,"data-testid":`queue-task-target-${t.id}`,children:[(0,m.jsx)(`span`,{children:c}),o&&(0,m.jsx)(`span`,{className:$.queueTaskTargetNote,children:e(`queueReuseModelNote`)})]}),(0,m.jsxs)(`details`,{className:$.queuePrompt,children:[(0,m.jsx)(`summary`,{children:t.prompt.trim().slice(0,180)||t.prompt.slice(0,180)}),(0,m.jsx)(`pre`,{children:t.prompt})]}),t.error!==void 0&&(0,m.jsx)(`div`,{className:$.queueTaskError,role:`note`,children:t.error}),(0,m.jsxs)(`div`,{className:$.queueTaskActions,children:[l!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:$.queueLinkButton,onClick:()=>{re(l)},children:e(`queueOpenSession`)}),(t.status===`queued`||la(t))&&(0,m.jsx)(`button`,{type:`button`,className:$.queueLinkButton,disabled:h,onClick:()=>{D({action:`remove`,id:t.id})},children:e(t.status===`queued`?`queueRemoveQueued`:`queueRemoveHistory`)})]})]},t.id)};return(0,m.jsxs)(`div`,{className:$.queuePanel,"data-testid":`billing-tab-panel-queue`,children:[(0,m.jsxs)(`section`,{className:$.queueHero,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:$.queueTitleRow,children:[(0,m.jsx)(`h2`,{className:$.queueTitle,children:e(`tabQueue`)}),(0,m.jsx)(`span`,{className:$.queuePreview,children:`Preview`})]}),(0,m.jsx)(`p`,{className:$.queueSubtitle,children:e(`queueSubtitle`)})]}),a?.supported&&(0,m.jsxs)(`div`,{className:y($.queueBand,a.tier===`offPeak`?$.queueBandOff:$.queueBandPeak),children:[(0,m.jsx)(`strong`,{children:e(a.tier===`offPeak`?`offPeak`:`peak`)}),(0,m.jsxs)(`span`,{children:[e(a.tier===`offPeak`?`queueUntilPeak`:`queueUntilOffPeak`),` `,Vt(a.nextSwitchInMs)]})]})]}),_!==void 0&&(0,m.jsx)(`div`,{className:$.queueNoticeError,role:`alert`,children:_}),b!==void 0&&(0,m.jsx)(`div`,{className:$.queueNotice,role:`status`,children:b}),a===void 0?(0,m.jsx)(`div`,{className:$.queueEmpty,children:e(`queueLoading`)}):a.supported?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`section`,{className:$.queueComposer,children:[(0,m.jsxs)(`div`,{className:$.queueSafety,children:[e(`queueSafety`),(0,m.jsx)(`span`,{className:$.queueSafetyMode,children:e(i===!0?`queueSafetyReuse`:`queueSafetyIsolated`)})]}),(0,m.jsxs)(`div`,{className:$.queueSelectors,children:[(0,m.jsxs)(`label`,{className:$.queueField,children:[(0,m.jsx)(`span`,{children:e(`queueWorkspace`)}),(0,m.jsx)(`select`,{value:l,disabled:!k||h,onChange:e=>{u(e.target.value)},children:a.workspaces.map(e=>(0,m.jsx)(`option`,{value:e.path,children:e.title},e.path))})]}),(0,m.jsxs)(`label`,{className:$.queueField,children:[(0,m.jsx)(`span`,{children:e(`queueModel`)}),(0,m.jsx)(`select`,{value:f,disabled:!k||h,onChange:e=>{p(e.target.value)},children:a.models.map(e=>(0,m.jsxs)(`option`,{value:ua(e.provider,e.id),children:[e.providerName,` / `,e.name]},ua(e.provider,e.id)))})]})]}),!k&&(0,m.jsx)(`div`,{className:$.queueNotice,children:a.optionsError??e(`queueNoOptions`)}),(0,m.jsxs)(`label`,{className:$.queuePromptField,children:[(0,m.jsx)(`span`,{children:e(`queuePromptLabel`)}),(0,m.jsx)(`textarea`,{value:s,disabled:!k||h,maxLength:32e3,rows:5,placeholder:e(`queuePromptPlaceholder`),onChange:e=>{c(e.target.value)}})]}),(0,m.jsxs)(`div`,{className:$.queueComposerFooter,children:[(0,m.jsx)(`span`,{children:e(`queuePrivacy`)}),(0,m.jsxs)(`div`,{className:$.queueComposerActions,children:[(0,m.jsx)(`input`,{ref:T,className:$.queueFileInput,"data-testid":`queue-import-file`,type:`file`,accept:`application/json,.json`,disabled:!k||h,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,M(t)}}),(0,m.jsx)(`button`,{type:`button`,className:$.queueSecondary,title:e(`queueImportHint`),disabled:!k||h,onClick:()=>{T.current?.click()},children:e(`queueImport`)}),(0,m.jsx)(`button`,{type:`button`,className:$.queuePrimary,disabled:!k||h||s.trim()===``,onClick:j,children:e(`queueEnqueue`)})]})]})]}),(0,m.jsxs)(`section`,{className:$.queueListSection,children:[(0,m.jsxs)(`div`,{className:$.queueListHead,children:[(0,m.jsxs)(`h3`,{children:[e(`queueActive`),` `,(0,m.jsx)(`span`,{children:O.length})]}),ne.length>0&&(0,m.jsx)(`button`,{type:`button`,className:$.queueLinkButton,disabled:h,onClick:()=>{D({action:`clearFinished`})},children:e(`queueClearFinished`)})]}),O.length===0&&ne.length===0?(0,m.jsx)(`div`,{className:$.queueEmpty,children:e(`queueEmpty`)}):(0,m.jsxs)(`ul`,{className:$.queueList,children:[O.map(N),ne.map(N)]})]})]}):(0,m.jsxs)(`section`,{className:$.queueUnsupported,"data-testid":`queue-unsupported`,children:[(0,m.jsx)(`h3`,{children:e(`queueUnsupportedTitle`)}),(0,m.jsx)(`p`,{children:e(`queueUnsupportedBody`)})]})]})}function ma({window:e,t}){let n=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,m.jsxs)(`div`,{className:R.subscriptionWindow,children:[(0,m.jsx)(`span`,{className:R.subscriptionWindowLabel,children:Bi(e.kind,t)}),(0,m.jsx)(`span`,{className:R.subscriptionTrack,"aria-hidden":`true`,children:(0,m.jsx)(`span`,{className:y(R.subscriptionFill,n>=100&&R.subscriptionFillOver,n>=80&&n<100&&R.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,m.jsxs)(`span`,{className:R.subscriptionMeta,children:[(0,m.jsx)(`span`,{className:y(R.subscriptionPct,r&&R.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,m.jsx)(`span`,{className:R.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${K(new Date(e.resetsAt).getTime())} ${Gi(new Date(e.resetsAt).getTime())}`)})]})]})}function ha({label:e,t}){return(0,m.jsx)(p.Tooltip,{label:e,side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.helpTip,role:`note`,"aria-label":e,children:`?`})})}function ga(e,t){return e===R.healthOk?t(`healthDotLive`):e===R.healthBad?t(`healthDotFailed`):t(`healthDotUnknown`)}function _a(e){let t=t=>G(hn(t,e.currency),e.currency),{wide:n,t:r,onOpen:i,monthCost:a,todayCost:o,weekCost:s,days:c,vendorStatus:l,dash:u,floatPrefs:p,subscriptions:h,cardPrefs:g,monthTokens:_,todayTokens:v,weekTokens:b,budgetPressure:x,deltaPct:S=0,statsError:C}=e,w=(0,d.useMemo)(()=>p.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[p.targets,h]),[T,E]=(0,d.useState)(0),ee=w.length===0?0:Math.min(T,w.length-1),te=w[ee],D=(0,d.useRef)(null),[O,ne]=(0,d.useState)(!1),[k,A]=(0,d.useState)({left:0,top:0});(0,d.useEffect)(()=>{if(!O||p.mode!==`subscription`||w.length<2)return;let e=setInterval(()=>E(e=>(e+1)%w.length),1500);return()=>clearInterval(e)},[O,p.mode,w.length]);let j=(0,d.useRef)(void 0),M=(0,d.useCallback)(()=>{window.clearTimeout(j.current),ne(!0)},[]),re=(0,d.useCallback)(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>ne(!1),120)},[]);(0,d.useEffect)(()=>()=>window.clearTimeout(j.current),[]);let N=(0,d.useCallback)(()=>{let e=D.current?.getBoundingClientRect();e!==void 0&&A({left:e.left,top:e.top-8})},[]);(0,d.useEffect)(()=>{if(!O)return;let e=()=>N();return window.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},[O,N]);let ie=c.length>0?c.reduce((e,t)=>e+t.cost,0)/c.length:0,ae=ie>0?Math.max(0,Math.min(1,o/ie)):0,oe=-80+ae*160,se=(0,m.jsxs)(`svg`,{viewBox:`3.5 10 34 22`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,opacity:.16}),(0,m.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,strokeDasharray:`${(41.9*ae).toFixed(2)} 41.9`,className:R.triggerGaugeArc}),(0,m.jsx)(`path`,{d:`M5.23 26.4 8.18 26.92M10.36 17.51 12.29 19.81M20 14v3M27.71 19.81 29.64 17.51M31.82 26.92 34.77 26.4`,strokeWidth:1.6,opacity:.7}),(0,m.jsx)(`path`,{d:`M7.01 21.5 8.31 22.25M14.87 14.91 15.38 16.31M24.62 16.31 25.13 14.91M31.69 22.25 32.99 21.5`,strokeWidth:1.2,opacity:.38}),(0,m.jsx)(`line`,{x1:`20`,y1:`29`,x2:`20`,y2:`19.5`,strokeWidth:2,className:R.triggerGaugeNeedle,style:{transform:`rotate(${oe}deg)`,transformOrigin:`20px 29px`}}),(0,m.jsx)(`circle`,{cx:`20`,cy:`29`,r:`1.5`,fill:`currentColor`,stroke:`none`})]}),ce=`${r(`title`)} · ${t(g.span===`day`?o:g.span===`week`?s:a)}${C===void 0?``:` · ${r(`statsLoadFailed`)}`}`;if(g.mode===`hidden`)return null;if(!n||g.mode===`compact`)return(0,m.jsx)(`button`,{type:`button`,className:y(R.railButton,Mr,x!==`none`&&R.triggerBudgetPulse,x===`over`&&R.triggerBudgetOver),"data-testid":`billing-rail-button`,onClick:i,title:ce,children:se});let le=g.metric===`tokens`,ue=c.map(e=>le?e.tokens:e.cost),de=Math.max(...ue,0),fe=ue.map(e=>de>0?4+e/de*12:4);return(0,m.jsxs)(`span`,{ref:D,className:y(R.triggerWrap,Mr),onMouseEnter:()=>{N(),M()},onMouseLeave:re,onFocusCapture:()=>{N(),M()},onBlurCapture:()=>ne(!1),children:[(0,m.jsxs)(`button`,{type:`button`,className:y(R.trigger,x!==`none`&&R.triggerBudgetPulse,x===`over`&&R.triggerBudgetOver),"data-testid":`billing-trigger`,onClick:i,title:ce,children:[(0,m.jsx)(`span`,{className:y(R.triggerIcon,x!==`none`&&R.triggerBudgetHot,C!==void 0&&R.triggerStatsError),"data-testid":`billing-trigger-icon`,children:se}),(0,m.jsx)(`span`,{className:R.triggerMain,children:(0,m.jsxs)(`span`,{className:R.triggerPrimary,children:[(0,m.jsx)(`span`,{className:R.triggerLabel,children:le?g.span===`day`?r(`triggerTodayTokens`):g.span===`week`?r(`triggerWeekTokens`):r(`triggerMonthTokens`):g.span===`day`?r(`triggerToday`):g.span===`week`?r(`weekCost`):r(`triggerMonth`)}),(()=>{let e=g.span===`day`?le?v:o:g.span===`week`?le?b:s:le?_:a,n=g.span===`day`?S:0;return le?(0,m.jsx)(`span`,{className:R.triggerMetric,"data-testid":`billing-trigger-span-tokens`,children:q(e)}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{className:R.triggerValueRow,children:[(0,m.jsx)(`span`,{className:R.triggerYen,"aria-hidden":`true`,children:t(e).charAt(0)}),(0,m.jsx)(`span`,{className:R.triggerMetric,"data-testid":`billing-trigger-span-money`,children:t(e).slice(1)})]}),g.showDelta&&n!==0&&(0,m.jsxs)(`span`,{className:y(R.triggerDelta,n>0?R.triggerDeltaUp:R.triggerDeltaDown),"data-testid":`billing-trigger-delta`,children:[n>0?`▲`:`▼`,` `,Math.abs(n).toFixed(1),`%`]}),(0,m.jsx)(`span`,{className:R.triggerGlow,"aria-hidden":`true`})]})})()]})}),(0,m.jsx)(`span`,{className:R.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:fe.map((e,t)=>(0,m.jsx)(`span`,{className:t===fe.length-1?R.triggerSparkHot:R.triggerSparkBar,style:{height:`${e}px`}},c[t]?.date??String(t)))})]}),(0,f.createPortal)((0,m.jsx)(`span`,{className:y(R.triggerPop,Mr,O&&R.triggerPopShown),style:{left:`${k.left}px`,top:`${k.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!O,onMouseEnter:M,onMouseLeave:re,children:p.mode===`subscription`?(0,m.jsx)(m.Fragment,{children:w.length===0?(0,m.jsx)(`span`,{className:R.triggerPopEmpty,children:r(`floatNoTargets`)}):(0,m.jsxs)(m.Fragment,{children:[te!==void 0&&(0,m.jsxs)(`div`,{className:R.floatSub,"data-testid":`billing-float-subscription`,children:[(0,m.jsxs)(`div`,{className:R.floatSubHead,children:[(0,m.jsx)(`span`,{className:R.floatSubName,children:te.displayName}),te.plan!==void 0&&(0,m.jsx)(`span`,{className:R.floatSubPlan,children:te.plan})]}),te.windows.map(e=>(0,m.jsx)(ma,{window:e,t:r},e.kind))]}),w.length>1&&(0,m.jsx)(`span`,{className:R.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,m.jsxs)(`span`,{className:R.triggerPopSwitchCount,children:[ee+1,`/`,w.length]})})]})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:R.popHead,children:(0,m.jsx)(`span`,{className:R.popTitle,children:r(`popTitle`)})}),C!==void 0&&(0,m.jsxs)(`span`,{className:R.popError,"data-testid":`billing-stats-error`,role:`note`,children:[(0,m.jsx)(`span`,{className:R.popErrorTitle,children:r(`statsLoadFailed`)}),(0,m.jsx)(`span`,{className:R.popErrorDetail,children:C})]}),(0,m.jsxs)(`span`,{className:R.metricGrid,children:[(0,m.jsxs)(`span`,{className:R.metricCell,children:[(0,m.jsx)(`span`,{className:R.metricLabel,children:r(`floatPrimaryToday`)}),(0,m.jsx)(`span`,{className:R.metricValue,children:t(o)})]}),(0,m.jsxs)(`span`,{className:R.metricCell,children:[(0,m.jsx)(`span`,{className:R.metricLabel,children:r(`floatPrimaryWeek`)}),(0,m.jsx)(`span`,{className:R.metricValue,children:t(s)})]}),(0,m.jsxs)(`span`,{className:R.metricCell,children:[(0,m.jsx)(`span`,{className:R.metricLabel,children:r(`floatPrimaryMonth`)}),(0,m.jsx)(`span`,{className:R.metricValue,children:t(a)})]}),(0,m.jsxs)(`span`,{className:R.metricCell,children:[(0,m.jsx)(`span`,{className:R.metricLabel,children:r(`input`)}),(0,m.jsx)(`span`,{className:R.metricValue,children:q(u.input)})]}),(0,m.jsxs)(`span`,{className:R.metricCell,children:[(0,m.jsx)(`span`,{className:R.metricLabel,children:r(`output`)}),(0,m.jsx)(`span`,{className:R.metricValue,children:q(u.output)})]}),(0,m.jsxs)(`span`,{className:R.metricCell,children:[(0,m.jsx)(`span`,{className:R.metricLabel,children:r(`cacheHit`)}),(0,m.jsx)(`span`,{className:y(R.metricValue,R.metricValueSuccess),children:vn(u.cacheRead+u.cacheMiss>0?u.cacheRead/(u.cacheRead+u.cacheMiss)*100:0)})]})]}),(0,m.jsxs)(`span`,{className:R.popModel,children:[(0,m.jsx)(`span`,{className:R.popModelLabel,children:r(`popTodayModel`)}),l.direct!==void 0||l.sub!==void 0?(0,m.jsxs)(m.Fragment,{children:[l.direct!==void 0&&(0,m.jsxs)(`span`,{className:R.popModelRow,children:[(0,m.jsx)(`span`,{className:y(R.popDot,R.popDotDirect),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:R.popTagPrimary,children:r(`popDirectLead`)}),(0,m.jsx)(`span`,{className:R.popModelName,children:l.direct.name}),(0,m.jsx)(`span`,{className:y(R.popModelStatus,l.direct.low&&R.popModelStatusLow),children:l.direct.text})]}),l.sub!==void 0&&(0,m.jsxs)(`span`,{className:R.popModelRow,children:[(0,m.jsx)(`span`,{className:y(R.popDot,R.popDotSub),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:R.popTagSub,children:r(`popSubLead`)}),(0,m.jsx)(`span`,{className:R.popModelName,children:l.sub.name}),(0,m.jsx)(`span`,{className:y(R.popModelStatus,l.sub.low&&R.popModelStatusLow),children:l.sub.text})]})]}):(0,m.jsxs)(`span`,{className:R.popModelRow,children:[(0,m.jsx)(`span`,{className:y(R.popDot,R.popDotNeutral),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:R.popModelStatus,children:r(`popNoConsumption`)})]})]})]})}),document.body)]})}function va({balance:e,days:t,dailyBurn:n,money:r,t:i,onClose:a}){let o=t=>t===void 0?void 0:e.currency===`USD`?`$${t.toFixed(2)}`:r(t),s=o(e.totalBalance),c=o(e.grantedBalance),l=o(e.toppedUpBalance);return(0,m.jsxs)(`span`,{className:R.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,onClick:e=>{e.stopPropagation()},children:[(0,m.jsxs)(`span`,{className:R.balanceDetailHead,children:[(0,m.jsx)(`span`,{className:R.balanceDetailTitle,children:e.displayName}),(0,m.jsx)(`button`,{type:`button`,className:R.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,m.jsxs)(`span`,{className:R.balanceDetailGrid,children:[s!==void 0&&(0,m.jsx)(ya,{label:i(`balance`),value:s}),c!==void 0&&(0,m.jsx)(ya,{label:i(`balanceGranted`),value:c}),l!==void 0&&(0,m.jsx)(ya,{label:i(`balanceTopped`),value:l}),(0,m.jsx)(ya,{label:i(`balanceDaily`),value:r(n)}),(0,m.jsx)(ya,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function ya({label:e,value:t}){return(0,m.jsxs)(`span`,{className:R.balanceDetailRow,children:[(0,m.jsx)(`span`,{className:R.balanceDetailLabel,children:e}),(0,m.jsx)(`span`,{className:R.balanceDetailValue,children:t})]})}function ba({userPrices:e,onUserPrices:t,t:n,unpricedIds:r}){let[i,a]=(0,d.useState)(()=>[...e]),[o,s]=(0,d.useState)(new Set),c=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=()=>{a(e=>e.filter((e,t)=>!o.has(t))),s(new Set)},u=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),f=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),p=e=>{let t=i[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},h=(e,t,n)=>a(r=>r.map((r,i)=>{if(i!==e)return r;let a=r.offPeak,o={input:a===void 0?``:String(a.input),cacheHit:a===void 0?``:String(a.cacheHit),output:a===void 0?``:String(a.output),[t]:n},s=[o.input,o.cacheHit,o.output].some(e=>e.trim()!==``),c=[o.input,o.cacheHit,o.output].map(e=>Number(e)),l=s&&c.every(e=>Number.isFinite(e)&&e>=0)&&c.some(e=>e>0),{offPeak:u,...d}=r;return l?{...d,offPeak:{input:c[0]??0,cacheHit:c[1]??0,output:c[2]??0}}:d})),g=()=>t(i.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:mt(e.origin.trim())}}))),_=(0,d.useMemo)(()=>{let e=[];for(let t of dn())e.push(t.key);for(let t of r??[])e.includes(t)||e.push(t);return e},[r]),v=(e,t)=>a(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),[b,x]=(0,d.useState)({}),S=(e,t,n)=>`${e}:${t}:${n}`,C=(e,t,n)=>x(r=>{let i=S(e,t,n);if(r[i]===void 0)return r;let a={...r};return delete a[i],a}),w=e=>Number.isFinite(e)&&e!==0?String(e):``,T=(e,t,n)=>{if(x(r=>({...r,[S(e,`main`,t)]:n})),n===``){u(e,{[t]:0});return}let r=Number(n);Number.isFinite(r)&&r>=0&&u(e,{[t]:r})};return(0,m.jsxs)(`section`,{className:R.setCard,"data-testid":`billing-user-prices`,children:[(0,m.jsx)(`div`,{className:R.setCardHead,children:(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`userPrices`),(0,m.jsx)(ha,{label:n(`userPricesHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:R.ctlCol,children:[(0,m.jsx)(`datalist`,{id:`billing-price-model-keys`,children:_.map(e=>(0,m.jsx)(`option`,{value:e},e))}),i.map((e,t)=>(0,m.jsxs)(`div`,{className:R.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,m.jsx)(`input`,{type:`checkbox`,className:R.userPriceCheck,"data-testid":`billing-user-price-select`,checked:o.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>c(t)}),(0,m.jsxs)(`div`,{className:R.userPriceBody,children:[(0,m.jsxs)(`div`,{className:R.userPriceLineMeta,children:[(0,m.jsxs)(`div`,{className:R.userPriceField,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`userPriceModel`)}),(0,m.jsx)(`input`,{className:R.userPriceInput,"data-testid":`billing-user-price-model`,type:`text`,list:`billing-price-model-keys`,value:e.key,placeholder:`flash`,"aria-label":n(`userPriceModel`),onChange:e=>u(t,{key:e.target.value})})]}),(0,m.jsxs)(`div`,{className:R.userPriceField,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`userPriceSource`)}),(0,m.jsx)(`input`,{className:R.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>u(t,{origin:e.target.value.trim()})})]}),(0,m.jsxs)(`div`,{className:R.userPriceField,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`userPriceCurrency`)}),(0,m.jsxs)(`div`,{className:R.ctlGroup,children:[(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,e.currency!==`USD`&&R.floatModeBtnOn),onClick:()=>v(t,`CNY`),children:`CNY`}),(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,e.currency===`USD`&&R.floatModeBtnOn),onClick:()=>v(t,`USD`),children:`USD`})]})]})]}),[{scope:`main`,label:n(`userPriceNormal`),testid:`billing-user-price-normal`,valueOf:n=>b[S(t,`main`,n)]??w(e[n]),onChange:(e,n)=>T(t,e,n)},{scope:`off`,label:n(`userPriceOffPeak`),testid:`billing-user-price-offpeak`,valueOf:e=>b[S(t,`off`,e)]??p(t)[e],onChange:(e,n)=>{x(r=>({...r,[S(t,`off`,e)]:n})),h(t,e,n)}}].map(e=>(0,m.jsxs)(`div`,{className:R.userPricePriceLine,"data-testid":e.testid,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:e.label}),[`input`,`cacheHit`,`output`].map(r=>{let i=n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`);return(0,m.jsx)(`input`,{className:R.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:i,"aria-label":`${e.label} ${i}`,value:e.valueOf(r),onChange:t=>e.onChange(r,t.target.value),onBlur:()=>C(t,e.scope,r)},r)})]},e.testid))]})]},t)),(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-user-price-add`,onClick:f,children:n(`userPriceAdd`)}),(0,m.jsxs)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:o.size===0,onClick:l,children:[n(`userPriceRemoveSelected`),o.size>0?` (${o.size})`:``]}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-user-price-save`,onClick:g,children:n(`userPriceSave`)})]})]})]})}function xa(e,t,n){if(e.length===0)return``;let r=e.slice(0,3).join(n===`zh`?`、`:`, `),i=e.length-3;return i>0?`${r} ${t(`unpricedMore`,{count:i})}`:r}function Sa({prefs:e,onPrefs:t,groups:n,t:r,money:i}){let a=new Set(e.hidden),o=(e,n)=>{let r=new Set(a);for(let t of e.siteKeys)n?r.add(t):r.delete(t);t({hidden:[...r]})},s=n.filter(e=>e.siteKeys.some(e=>a.has(e))).length;return(0,m.jsxs)(`div`,{className:y(R.setCell,R.channelVisCell),"data-testid":`billing-channel-visibility-setting`,children:[(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[r(`channelVisibility`),(0,m.jsx)(ha,{label:r(`channelVisibilityHint`),t:r})]})}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-channel-visibility-reset`,disabled:e.hidden.length===0,onClick:()=>{t({hidden:[]})},children:r(`channelVisibilityShowAll`)})]}),n.length===0?(0,m.jsx)(`div`,{className:R.setHint,children:r(`channelVisibilityEmpty`)}):(0,m.jsx)(`div`,{className:R.channelVisList,children:n.map(e=>{let t=e.siteKeys.some(e=>a.has(e));return(0,m.jsxs)(`div`,{className:R.channelVisRow,"data-testid":`billing-channel-row-${e.name}`,children:[(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":!t,"aria-label":e.name,"data-testid":`billing-channel-toggle-${e.name}`,className:y(R.switch,!t&&R.switchOn),onClick:()=>{o(e,!t)},children:(0,m.jsx)(`span`,{className:R.switchKnob})}),(0,m.jsx)(`span`,{className:R.channelVisName,title:e.name,children:e.name}),(0,m.jsxs)(`span`,{className:R.channelVisUsage,children:[i(e.cost),` · `,q(e.tokens)]})]},e.name)})}),s>0&&(0,m.jsx)(`div`,{className:R.setHint,"data-testid":`billing-channel-visibility-hint`,children:r(`channelVisibilityHidden`).replace(`{count}`,String(s))})]})}function Ca({stats:e,statsError:t,t:n,onClose:r,embeddedSettings:i=!1,userPrices:a,onUserPrices:o,health:s,balances:c,reconcile:l,quotas:u,relayQuotas:f,currency:h,onCurrency:g,language:_,onLanguage:v,turns:b,renderSlot:x,budgetEnabled:S,budgetAmount:C,onToggleBudget:w,onBudgetAmount:T,modelBudgets:E,monthModelCost:ee,onModelBudget:te,peakConfig:D,onPeakConfig:O,onPreviewPeak:ne,floatPrefs:k,onFloatPrefs:A,cardPrefs:j,onCardPrefs:M,recoveryEntryAvailable:re,sitePrefs:N,onSitePrefs:oe,channelPrefs:se,onChannelPrefs:ue,channelGroups:de,liveCostPrefs:fe,onLiveCostPrefs:pe,quickQueuePrefs:me,onQuickQueuePrefs:he,quotasStale:ge,balanceStale:_e,navigateToSession:ve,sessionTitleOf:ye}){let be=(0,d.useRef)(null),xe=(0,d.useMemo)(()=>Ni(e.bySession??[]),[e.bySession]),Se=(0,d.useMemo)(()=>Fi(xe),[xe]),[Ce,we]=(0,d.useState)(void 0),Te=(0,d.useCallback)(e=>{let t=ve(e);if(t===`opened`){we(void 0);return}we(n(t===`unavailable`?`sessionOpenUnavailable`:`sessionOpenFailed`))},[ve,n]),[Ee,De]=(0,d.useState)(`cost`),{total:Oe,byModel:Ae,byDay:P}=e,[F,Fe]=(0,d.useState)(i?`settings`:`overview`),[Ie,Le]=(0,d.useState)(7),[ze,Be]=(0,d.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),Ve=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},He=(0,d.useCallback)(()=>{let e=Ve();Be(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[Ue,We]=(0,d.useState)(()=>{let e=[`unpriced`,`search-estimate`,`unreadable`],t=new Set,n=new Date,r=e=>String(e).padStart(2,`0`),i=`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}`;try{for(let n of e)window.localStorage.getItem(`dsh-billing:notice-${n}-dismissed`)===i&&t.add(n)}catch{}return t}),Ge=(0,d.useCallback)(e=>{let t=Ve();We(t=>new Set(t).add(e));try{window.localStorage.setItem(`dsh-billing:notice-${e}-dismissed`,t)}catch{}},[]),[Ke,Je]=(0,d.useState)(`month`),[Qe,$e]=(0,d.useState)(`cost`),[et,tt]=(0,d.useState)(qe),[nt,rt]=(0,d.useState)(Xe),[it,at]=(0,d.useState)(`budget`),[ot,z]=(0,d.useState)(``),B=e=>Li(ot,e);(0,d.useEffect)(()=>{let e=be.current;if(F!==`settings`||e===null||typeof IntersectionObserver>`u`)return;let t=Array.from(e.querySelectorAll(`[id^="settings-"]`)).filter(e=>!e.closest(`[hidden]`));if(t.length===0)return;let n=new IntersectionObserver(e=>{let t,n=1/0;for(let r of e){if(!r.isIntersecting)continue;let e=r.boundingClientRect.top;e<n&&(n=e,t=r.target.id)}t!==void 0&&at(t.slice(9))},{rootMargin:`-80px 0px -55% 0px`});for(let e of t)n.observe(e);return()=>{n.disconnect()}},[F]);let st=(0,d.useCallback)(e=>{at(e);let t=be.current?.querySelector(`[id="settings-${e}"]`);if(t==null)return;if(i){t.scrollIntoView({block:`start`,behavior:`smooth`});return}let n=t.closest(`.${R.dashboardBody}`);if(n===null)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+r,behavior:`smooth`})},[i]),lt=(0,d.useCallback)(e=>{tt(e),L(e)},[]),ut=(0,d.useCallback)(e=>{rt(e),Ze(e)},[]);(0,d.useEffect)(()=>{typeof document>`u`||(document.documentElement.dataset.dshBillingDensity=et,document.documentElement.dataset.dshBillingMotion=nt)},[et,nt]),(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;t?.density!==void 0&&tt(t.density)},t=e=>{let t=e.detail;t?.motion!==void 0&&rt(t.motion)};return window.addEventListener(I,e),window.addEventListener(Ye,t),()=>{window.removeEventListener(I,e),window.removeEventListener(Ye,t)}},[]);let[V,dt]=(0,d.useState)(ie),[H,ft]=(0,d.useState)(ce),pt=e=>{let t={...H,...e};t.start!==``&&t.end!==``&&(t.start>t.end&&(e.start===void 0?t.start=t.end:t.end=t.start),ft(t),le(t))},mt=(0,d.useMemo)(()=>u.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[u]),[ht,gt]=(0,d.useState)(),[_t,vt]=(0,d.useState)(new Set),[yt,U]=(0,d.useState)(!1),[bt,xt]=(0,d.useState)(``),St=(0,d.useCallback)(e=>{vt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Ct=(0,d.useMemo)(()=>Mi(e.bySession??[]),[e.bySession]),wt=e=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:R.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:R.numCol,children:W(e.cost)}),(0,m.jsx)(`td`,{className:R.numCol,children:e.lastActive>0?`${K(e.lastActive)} ${Gi(e.lastActive)}`:`—`})]}),Et=(e,t)=>(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:y(R.sessionChildRow,t>0&&R.sessionSubDeepRow),"data-testid":`billing-session-sub-row`,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:y(R.ubTag,R.ubTagNeutral),children:n(`sessionSubRow`)}),(e.subCalls??0)>0&&(0,m.jsx)(`span`,{className:y(R.ubTag,R.ubTagNeutral),"data-testid":`billing-session-sub-chain`,children:e.subCost!==void 0&&e.subCost>0?n(`sessionSubCost`).replace(`{cost}`,W(e.subCost)):n(`sessionSubCalls`).replace(`{calls}`,(e.subCalls??0).toLocaleString())}),(0,m.jsx)(`span`,{className:R.modelProvider,children:e.title??e.id.slice(0,8)})]}),wt(e)]}),e.subs?.map(e=>Et(e,t+1))]},e.id),Dt=(0,d.useMemo)(()=>Ii(e.bySession??[],bt),[e.bySession,bt]),Ot=e.bySession?.length??0,kt=e.bySessionTotal??Ot,At=kt>Ot,jt=(0,d.useMemo)(()=>[...new Set([...Object.keys(ee),...Object.keys(E)])].map(e=>{let t=sn(e);return{key:e,name:t.key===`other`?void 0:t.name,cost:ee[e]??0}}).sort((e,t)=>t.cost-e.cost),[ee,E]),[Mt,Nt]=(0,d.useState)(()=>new Set(je())),Pt=(0,d.useCallback)(e=>{Nt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),Me([...n]),n})},[]),[Ft,It]=(0,d.useState)(()=>Ne()),Lt=(0,d.useCallback)(()=>{It(e=>{let t=!e;return Pe(t),t})},[]),[Bt,Vt]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=!0;return Zi().then(t=>{e&&t!==void 0&&Vt(t)}),()=>{e=!1}},[]);let Ht=(0,d.useCallback)(()=>{let e=!Bt;Vt(e),Qi(e).then(t=>{t||Vt(!e)})},[Bt]),Ut=Tt(),[Wt,Gt]=(0,d.useState)(!1),Kt=(0,d.useCallback)(()=>{Wt||(Gt(!0),na().finally(()=>{Gt(!1)}))},[Wt]),qt=ea,W=e=>G(hn(e,h),h),Jt=h===`usd`?`$`:h===`eur`?`€`:`¥`,Yt=_,Xt=e=>hr(e,Yt),[Zt,Qt]=(0,d.useState)(``),[$t,en]=(0,d.useState)(()=>ke()),[tn,nn]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{let e=setInterval(()=>{nn(Date.now())},3e4);return()=>{clearInterval(e)}},[]);let rn=u.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),an=D.leadMin*6e4,on=(e,t)=>e===0?n(`free`):gn(_n(e,t,h,Ut.rate),h===`usd`?`USD`:h===`eur`?`EUR`:`CNY`),cn=(0,d.useMemo)(()=>or([...b].reverse()),[b]),un={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},fn=un.peak/2,mn=Hr(P,K()),yn=e=>c.find(t=>Q(t.provider)===Q(e)),bn=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),xn=e=>{if(e===void 0)return(0,m.jsx)(`span`,{className:R.na,children:`—`});if(e.error===`unconfigured`)return n(`balanceUnconfigured`);if(e.error===`unauthorized`)return n(`balanceUnauthorized`);if(e.error===`unreachable`)return n(`balanceUnreachable`);if(e.totalBalance===void 0)return(0,m.jsx)(`span`,{className:R.na,children:`—`});let t=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:W(e.totalBalance),r=e.currency===`USD`?e.totalBalance*Ut.rate:e.totalBalance,i=mn>0?Math.floor(r/mn):void 0;return(0,m.jsxs)(`span`,{className:R.balanceCell,children:[(0,m.jsx)(`span`,{children:t}),i!==void 0&&i>=0&&(0,m.jsx)(`button`,{type:`button`,className:y(R.balanceDaysBadge,i<=3&&R.balanceDaysBadgeLow),"data-testid":`billing-balance-days-badge`,title:n(`balanceDays`).replace(`{days}`,String(i)),"aria-label":`${e.displayName} ${n(`balanceDays`).replace(`{days}`,String(i))}`,onClick:t=>{t.stopPropagation(),gt(ht===e.provider?void 0:e.provider)},children:`?`}),ht===e.provider&&(0,m.jsx)(va,{balance:e,days:i??0,dailyBurn:mn,money:W,t:n,onClose:()=>{gt(void 0)}})]})},wn=Object.keys(P).sort(),J=K(),kn=P[J]?.cost??0,An=J.slice(0,7),jn=J.slice(0,4),Mn=wn.reduce((e,t)=>e+(t.startsWith(An)?P[t]?.cost??0:0),0),Pn=wn.reduce((e,t)=>e+(t.startsWith(jn)?P[t]?.cost??0:0),0),Y=(0,d.useMemo)(()=>Wr(P,An,J)+u.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[P,An,J,u]),Fn=(0,d.useMemo)(()=>{if(!(S&&C>0))return null;let e=C-Mn;return{over:e<=0,remainRatio:Math.max(0,Math.min(1,e/C)),remainCny:Math.max(0,e)}},[S,C,Mn]),In=(0,d.useMemo)(()=>{let e=[];for(let t=Ie-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push(K(n.getTime()))}return e},[Ie]),Ln=In.at(-1)??J,X=(0,d.useMemo)(()=>Object.entries(P).map(([e,t])=>({date:e,value:Qe===`tokens`?qr(t):t.cost})),[P,Qe]),zn=(0,d.useMemo)(()=>X.reduce((e,t)=>e+t.value,0),[X]),Bn=Gr(P),Vn=Kr(P),Hn=(0,d.useMemo)(()=>In.map(t=>{let n={},r=e.byDayModels?.[t];if(r!==void 0)for(let[e,t]of Object.entries(r))t.cost>0&&(n[e]=t.cost);let i=P[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:qr(i)}}),[In,P,e.byDayModels]),Un=(0,d.useMemo)(()=>Object.entries(Ae).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=sn(e),r=n.key===`other`,i=r?ai(e):void 0,a={input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,cacheWrite:t.cacheWrite??0,output:t.output};return{key:e,name:r?e:n.name,provider:i??n.provider,calls:t.calls,input:t.input,output:t.output,cacheHitRate:t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0,estimated:pn(n,a),plan:t.plan===!0,...t.cost>0?{actual:t.cost}:{},uncatalogued:r,estimatedPricing:n.estimated===!0,officialCalls:t.officialCalls??0,officialCost:t.officialCost??0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)).map((e,t)=>({...e,color:Pr[t%Pr.length]??`#8b95a3`})),[Ae]),Gn=(0,d.useMemo)(()=>N.hideUnidentified?f.filter(e=>e.kind!==`unknown`):f,[f,N.hideUnidentified]),Kn=(0,d.useCallback)(e=>br(e,Yt)??n(`channelUnknown`),[Yt,n]),Jn=(0,d.useMemo)(()=>{let t=e.byDayModelsSite;if(Ft){let n=K();t={[n]:e.byDayModelsSite?.[n]??{}}}let r=new Map;for(let n of Object.values(t??{}))for(let[t,i]of Object.entries(n))for(let[n,a]of Object.entries(i)){let i=r.get(n);i===void 0&&(i=new Map,r.set(n,i));let o=i.get(t)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cacheWrite:0,cost:0,allPlan:!0};o.calls+=a.calls,o.input+=a.input,o.output+=a.output,o.cacheHit+=a.cacheHit,o.cacheMiss+=a.cacheMiss,o.cacheWrite+=a.cacheWrite??0,o.cost+=a.cost,o.allPlan=o.allPlan&&(a.plan??e.byModel?.[t]?.plan===!0),i.set(t,o)}let i=new Map;for(let[e,t]of r){let n=!e.startsWith(`direct:`)&&!e.startsWith(`site:`),r=[...t.entries()].filter(([,e])=>e.calls>0).map(([e,t],r)=>{let i=sn(e),a=i.key===`other`,o=a?ai(e)??i.provider:i.provider;return{key:e,name:a?e:i.name,provider:o,color:Pr[r%Pr.length]??`#8b95a3`,calls:t.calls,input:t.input,output:t.output,cacheHitRate:t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0,estimated:n?0:pn(i,{input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,cacheWrite:t.cacheWrite,output:t.output}),plan:t.allPlan,...t.cost>0?{actual:t.cost}:{},uncatalogued:a,estimatedPricing:i.estimated===!0,officialCalls:0,officialCost:0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));r.length>0&&i.set(e,r)}let a=e=>br(e,Yt)??n(`channelUnknown`),o=new Map,l=new Map,d=new Map,f=e=>e.startsWith(`direct:`)?`direct`:e.startsWith(`site:`)?`site`:`unknown`,p={direct:2,site:1,unknown:0,vendor:0};for(let[e,t]of i){let n=a(e),r=o.get(n);if(r===void 0)o.set(n,[...t]),l.set(n,f(e)),d.set(n,e);else{r.push(...t),r.sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));let i=l.get(n)??`unknown`,a=f(e);p[a]>p[i]&&(l.set(n,a),d.set(n,e))}}let m=new Map,h=new Map;for(let e of u){if(e.status===`not-configured`)continue;let t=e.displayName??si(e.provider),n=a(`direct:${e.provider}`),r=o.has(t)?t:o.has(n)?n:void 0,i=r??`sub:${si(e.provider)}`;h.set(i,r??si(e.provider));let s=m.get(i);s===void 0?m.set(i,[e]):s.push(e)}let g=e=>e===a(`direct:deepseek`)||e===a(`site:https://api.deepseek.com`)?yn(`deepseek`)??yn(e):yn(e),_=[];for(let[e,t]of o)_.push({id:`ch:${d.get(e)??e}`,name:e,models:t,subscriptions:m.get(e)??[],balance:g(e),dot:Ri(s,t[0]?.provider??``),channelKind:l.get(e)??`unknown`});for(let[e,t]of h)o.has(e)||_.push({id:e,name:t,models:[],subscriptions:m.get(e)??[],balance:yn(t),dot:Ri(s,t),channelKind:`vendor`});let v=new Set(_.flatMap(e=>[Q(e.name),...e.balance===void 0?[]:[Q(e.balance.provider)]]));for(let e of c)v.has(Q(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&_.push({id:`bal:${e.provider}`,name:e.displayName,models:[],subscriptions:[],balance:e,dot:Ri(s,e.displayName),channelKind:`vendor`});return _.filter(e=>N.hideUnidentified&&e.channelKind===`unknown`?!1:!Ft||e.models.length>0).sort((e,t)=>{let n=Ui(t)-Ui(e);return n===0?e.models.length===0&&t.models.length===0?0:t.models.length===0?-1:e.models.length===0?1:e.name.localeCompare(t.name,`zh`):n})},[e.byDayModelsSite,e.byModel,u,c,s,Yt,n,Ft,N.hideUnidentified]),Yn=(0,d.useMemo)(()=>Jn.filter(e=>e.models.length>0||e.subscriptions.length>0).map(e=>e.id),[Jn]),Xn=Yn.length>0&&Yn.every(e=>Mt.has(e)),Qn=()=>{let e=new Set(Xn?[]:Yn);Nt(e),Me([...e])},$n=(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`model`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`calls`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`inputTokens`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`outputTokens`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`actual`)})]})}),er=e=>(0,m.jsx)(`span`,{className:R.modelCell,children:(0,m.jsxs)(`span`,{children:[(0,m.jsxs)(`span`,{className:R.modelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:R.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:n(`uncatalogued`)}),e.estimatedPricing&&(0,m.jsx)(`span`,{className:R.estimatedTag,"data-testid":`billing-estimated-tag`,children:n(`estimatedPricing`)})]}),(0,m.jsx)(`span`,{className:R.modelProvider,children:Xt(e.provider)})]})}),tr=e.bySite?.unknown?.calls??0,nr=Un.reduce((e,t)=>e+t.estimated,0),ir=Oe.cost>0||tr>0?Oe.cost:nr,Z=(0,d.useMemo)(()=>{if(V===`all`){let e,t=0;for(let[n,r]of Object.entries(P)){let i=qr(r);i>t&&(t=i,e=n)}return{cost:ir,calls:Oe.calls,input:Oe.input,output:Oe.output,cacheHit:Oe.cacheHit,cacheMiss:Oe.cacheMiss,cacheWrite:Oe.cacheWrite??0,reasoning:Oe.reasoning??0,peakDay:e,peakTokens:t}}return V===`custom`?Zr(P,H.start,H.end):Xr(P,K(),V)},[V,H,ir,Oe,P]),ar=V===`custom`?H.start===H.end?H.start:`${H.start} – ${H.end}`:n({today:`avgRangeToday`,"7d":`avgRange7d`,week:`avgRangeWeek`,month:`avgRangeMonth`,all:`avgRangeAll`}[V]),sr=(0,d.useMemo)(()=>Un.map(e=>({key:e.key,name:e.name,color:e.color})),[Un]),cr=Hn.length>=2?Hn.at(-2)?.cost??0:0,lr=cr>0?(kn-cr)/cr*100:0,dr=(0,m.jsxs)(`div`,{ref:be,className:y(R.dashboard,Mr,i&&R.nativeSettingsDashboard),"data-testid":i?`native-billing-settings-dashboard`:`billing-dashboard`,children:[!i&&(0,m.jsxs)(`div`,{className:R.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,m.jsxs)(`div`,{children:[x(`billing.dashboard.decor`,{position:`head`}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:R.dashboardTitle,children:n(`title`)}),x(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,m.jsxs)(`p`,{className:R.dashboardSubtitle,children:[n(`lastUpdated`),` `,Ln,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,m.jsxs)(`div`,{className:R.dashboardRight,children:[(0,m.jsx)(`span`,{className:R.currencyToggle,role:`group`,"aria-label":n(`language`),children:[`en`,`zh`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.currencyButton,_===e&&R.currencyButtonActive),"aria-pressed":_===e,"data-testid":`billing-language-${e}`,onClick:()=>{v(e)},children:e===`en`?`EN`:`中`},e))}),(0,m.jsx)(`span`,{className:R.currencyToggle,role:`group`,"aria-label":n(`currency`),children:[`cny`,`usd`,`eur`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.currencyButton,h===e&&R.currencyButtonActive),"aria-pressed":h===e,"data-testid":`billing-currency-${e}`,title:n(e===`cny`?`currencyCny`:e===`usd`?`currencyUsd`:`currencyEur`),onClick:()=>{g(e)},children:e===`cny`?`¥ CNY`:e===`usd`?`$ USD`:`€ EUR`},e))}),s.checked&&(0,m.jsxs)(`span`,{className:y(R.healthBadge,s.available?R.healthBadgeOk:R.healthBadgeBad),children:[(0,m.jsx)(`span`,{className:y(R.healthDot,s.available?R.healthOk:R.healthBad),role:`img`,"aria-label":s.available?n(`healthDotLive`):n(`healthDotFailed`),title:s.available?n(`healthDotLive`):n(`healthDotFailed`)}),s.available?`${n(`healthModelsLive`).replace(`{n}`,String(s.models))}${s.failures>0?` · ${n(`healthVendorsDown`).replace(`{n}`,String(s.failures))}`:``}`:n(`healthVendorsUnavailable`).replace(`{n}`,String(s.failures))]}),(0,m.jsx)(`button`,{type:`button`,className:R.closeButton,"aria-label":n(`close`),"data-testid":`billing-close`,onClick:r,children:(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M18 6 6 18`}),(0,m.jsx)(`path`,{d:`m6 6 12 12`})]})})]})]}),!i&&t!==void 0&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-stats-error`,children:(0,m.jsxs)(`div`,{className:R.staleNoticeBody,children:[(0,m.jsx)(`span`,{children:n(`statsLoadFailed`)}),(0,m.jsx)(`span`,{className:R.staleNoticeSub,children:t})]})}),!i&&e.staleSnapshot===!0&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-stale-snapshot`,children:n(`staleSnapshotNotice`)}),!i&&(0,m.jsx)(`nav`,{className:R.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":n(`title`),children:Lr.map(e=>(0,m.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":F===e.id,"aria-controls":`billing-tab-panel-${e.id}`,className:y(R.tabButton,F===e.id&&R.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{Fe(e.id)},children:[(0,m.jsx)(`span`,{className:R.tabRailIcon,"aria-hidden":`true`,children:zr[e.id]}),(0,m.jsx)(`span`,{className:R.tabNavLabel,children:n(e.labelKey)})]},e.id))}),(0,m.jsxs)(`div`,{className:y(R.dashboardBody,i&&R.nativeSettingsBody),children:[F===`queue`&&(0,m.jsx)(pa,{t:n,language:_,navigateToSession:ve,...ye===void 0?{}:{sessionTitleOf:ye},reuseSourceSession:me.reuseSourceSession}),F===`overview`&&(0,m.jsxs)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[l?.kind===`drift`&&l.spent!==void 0&&ze!==Ve()&&(0,m.jsxs)(`div`,{className:R.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,m.jsx)(`span`,{className:R.reconcileIcon,"aria-hidden":`true`,children:(0,m.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`line`,{x1:`12`,y1:`10`,x2:`12`,y2:`16`}),(0,m.jsx)(`line`,{x1:`12`,y1:`7.5`,x2:`12.01`,y2:`7.5`})]})}),(0,m.jsx)(`span`,{className:R.reconcileText,children:n(`reconcileDrift`).replace(`{provider}`,l.provider??``).replace(`{spent}`,W(l.spent)).replace(`{today}`,W(l.todayOfficialCost??0))}),(0,m.jsx)(`button`,{type:`button`,className:R.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:He,children:n(`reconcileDismiss`)})]}),_e===!0&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-balance-stale`,children:n(`balanceStaleNotice`)}),(0,m.jsxs)(`section`,{className:R.hero,"data-testid":`billing-hero`,children:[x(`billing.dashboard.decor`,{position:`hero`}),(0,m.jsxs)(`div`,{className:R.heroTop,children:[(0,m.jsxs)(`div`,{className:R.heroMain,children:[(0,m.jsx)(`span`,{className:R.heroLabel,"data-testid":`billing-hero-range-label`,children:ar}),(0,m.jsxs)(`div`,{className:R.heroReadout,children:[(0,m.jsx)(`span`,{className:R.heroCurrency,"aria-hidden":`true`,children:Jt}),(0,m.jsx)(`span`,{className:R.heroValue,"data-testid":`billing-hero-range-value`,children:W(Z.cost).slice(1)})]}),(0,m.jsxs)(`span`,{className:R.heroMeta,children:[Z.calls.toLocaleString(),` `,n(`calls`),V===`month`&&Y>0&&(0,m.jsxs)(`span`,{className:R.heroPred,children:[` `,n(`monthProjected`),` `,W(Y)]})]})]}),Fn!==null&&(0,m.jsxs)(`div`,{className:R.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,m.jsxs)(`div`,{className:R.heroGaugeDial,children:[(0,m.jsxs)(`svg`,{className:R.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`heroRingGrad`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`100%`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:`var(--ds-cyan)`}),(0,m.jsx)(`stop`,{offset:`55%`,stopColor:`var(--ds-blue)`}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:`var(--ds-amber)`})]})}),(0,m.jsx)(`circle`,{className:R.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,m.jsx)(`circle`,{className:y(R.heroGaugeArc,Fn.over&&R.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${Fn.remainRatio*326.7} 326.7`},stroke:Fn.over?void 0:`url(#heroRingGrad)`})]}),(0,m.jsxs)(`span`,{className:R.heroGaugeCenter,children:[(0,m.jsxs)(`span`,{className:y(R.heroGaugeRemain,Fn.over&&R.heroGaugeRemainOver),children:[Jt,hn(Fn.remainCny,h).toFixed(2)]}),(0,m.jsx)(`span`,{className:R.heroGaugeLabel,children:n(`budgetRemain`)})]})]}),(0,m.jsxs)(`span`,{className:R.heroGaugeSub,children:[W(Mn),` / `,W(C)]})]})]}),(0,m.jsxs)(`div`,{className:R.heroSide,children:[(0,m.jsxs)(`div`,{className:R.heroSideItem,children:[(0,m.jsx)(`span`,{className:R.heroSideLabel,children:n(`yearCost`)}),(0,m.jsx)(`span`,{className:R.heroSideValue,children:W(Pn)})]}),(0,m.jsxs)(`div`,{className:R.heroSideItem,children:[(0,m.jsx)(`span`,{className:R.heroSideLabel,children:n(`todayCost`)}),(0,m.jsxs)(`span`,{className:R.heroSideValue,children:[W(kn),(0,m.jsxs)(`span`,{className:y(R.delta,lr>=0?R.deltaUp:R.deltaDown),children:[lr>=0?`▲`:`▼`,` `,Math.abs(lr).toFixed(1),`%`]})]})]}),Y>0&&(0,m.jsxs)(`div`,{className:R.heroSideItem,title:n(`monthProjectedHint`),children:[(0,m.jsx)(`span`,{className:R.heroSideLabel,children:n(`monthProjected`)}),(0,m.jsx)(`span`,{className:R.heroSideValue,children:W(Y)})]}),Y<=0&&(0,m.jsx)(`span`,{className:R.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&!Ue.has(`unpriced`)&&(0,m.jsxs)(`div`,{className:R.unpricedHint,"data-testid":`billing-unpriced-hint`,children:[(0,m.jsx)(`span`,{className:R.unpricedHintBody,children:n(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0)).replace(`{models}`,xa(e.unpricedModels??[],n,_))}),(0,m.jsx)(`button`,{type:`button`,className:R.noticeAction,"data-testid":`billing-unpriced-fix`,onClick:()=>{Fe(`settings`),z(_===`zh`?`单价`:`price`)},children:n(`unpricedFix`)}),(0,m.jsx)(`button`,{type:`button`,className:R.noticeDismiss,"data-testid":`billing-unpriced-dismiss`,"aria-label":n(`close`),onClick:()=>{Ge(`unpriced`)},children:`×`})]}),(e.total.searchCalls??0)>0&&!Ue.has(`search-estimate`)&&(0,m.jsxs)(`div`,{className:R.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:[(0,m.jsx)(`span`,{className:R.unpricedHintBody,children:n(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,W(e.searchCallEstimateCny??0))}),(0,m.jsx)(`button`,{type:`button`,className:R.noticeDismiss,"data-testid":`billing-search-estimate-dismiss`,"aria-label":n(`close`),onClick:()=>{Ge(`search-estimate`)},children:`×`})]}),(e.unreadableSessions??0)>0&&!Ue.has(`unreadable`)&&(0,m.jsxs)(`div`,{className:R.staleNotice,"data-testid":`billing-sessions-unreadable`,children:[(0,m.jsxs)(`div`,{className:R.staleNoticeBody,children:[n(`unreadableNotice`).replace(`{count}`,String(e.unreadableSessions)),(e.unreadableNoLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:R.staleNoticeSub,"data-testid":`billing-sessions-no-ledger`,children:n(`unreadableNoLedgerNotice`).replace(`{count}`,String(e.unreadableNoLedgerSessions))}),(e.unreadableFormatSessions??0)>0&&(0,m.jsx)(`div`,{className:R.staleNoticeSub,"data-testid":`billing-sessions-format-unsupported`,children:n(`unreadableFormatNotice`).replace(`{count}`,String(e.unreadableFormatSessions))})]}),(0,m.jsx)(`button`,{type:`button`,className:R.noticeDismiss,"data-testid":`billing-unreadable-dismiss`,"aria-label":n(`close`),onClick:()=>{Ge(`unreadable`)},children:`×`})]}),(0,m.jsxs)(`div`,{className:R.kpiZone,children:[(0,m.jsxs)(`div`,{className:R.kpiZoneHead,children:[(0,m.jsx)(`span`,{className:R.kpiZoneLabel,children:n(`kpiRange`)}),(0,m.jsx)(`div`,{className:R.heatmapRangeSwitch,"data-testid":`billing-kpi-range`,role:`group`,"aria-label":n(`kpiRange`),children:[[`today`,`avgRangeToday`],[`7d`,`avgRange7d`],[`week`,`avgRangeWeek`],[`month`,`avgRangeMonth`],[`all`,`avgRangeAll`],[`custom`,`avgRangeCustom`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,className:y(R.heatmapRangeButton,V===e&&R.heatmapRangeButtonActive),"data-testid":`billing-kpi-range-${e}`,"aria-pressed":V===e,onClick:()=>{dt(e),ae(e)},children:n(t)},e))})]}),V===`custom`&&(0,m.jsxs)(`div`,{className:R.kpiCustomRange,"data-testid":`billing-kpi-custom-range`,children:[(0,m.jsxs)(`label`,{children:[n(`customRangeStart`),(0,m.jsx)(`input`,{type:`date`,value:H.start,max:K(),"data-testid":`billing-kpi-custom-start`,onChange:e=>{pt({start:e.target.value})}})]}),(0,m.jsxs)(`label`,{children:[n(`customRangeEnd`),(0,m.jsx)(`input`,{type:`date`,value:H.end,max:K(),"data-testid":`billing-kpi-custom-end`,onChange:e=>{pt({end:e.target.value})}})]})]}),(0,m.jsx)(`section`,{className:R.kpiGrid,"data-testid":`billing-kpi-grid`,children:(()=>{let e=Object.keys(P).sort().slice(-7),t=K(),r=e.indexOf(t),i=(e,t)=>e[t]??0,a=e.map(e=>P[e]?.cost??0),o=e.map(e=>P[e]?.calls??0),s=e.map(e=>{let t=P[e];return t===void 0?0:qr(t)}),c=e.map(e=>{let t=P[e];return t!==void 0&&t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0}),l=r>0&&i(a,r-1)>0?(i(a,r)-i(a,r-1))/i(a,r-1)*100:0,u=r>0&&i(o,r-1)>0?(i(o,r)-i(o,r-1))/i(o,r-1)*100:0,d=r>0&&i(s,r-1)>0?(i(s,r)-i(s,r-1))/i(s,r-1)*100:0,f=r>0&&i(c,r-1)>0?i(c,r)-i(c,r-1):0,h=(e,t)=>V===`custom`?null:(0,m.jsx)(`svg`,{viewBox:`0 0 28 12`,preserveAspectRatio:`none`,style:{display:`block`,width:`100%`,height:`12px`},children:e.map((n,r)=>{let i=n/Math.max(...e,1)*10,a=r*4;return(0,m.jsx)(`rect`,{x:a,y:12-i,width:`2.5`,height:i,fill:t,opacity:r===e.length-1?1:.6},r)})}),g=e=>V===`custom`?null:(0,m.jsxs)(`span`,{className:y(R.kpiDelta,e>0?R.kpiDeltaUp:e<0?R.kpiDeltaDown:R.kpiDeltaFlat),children:[e>0?`▲`:e<0?`▼`:``,` `,Math.abs(e).toFixed(1),`%`]});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:R.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,m.jsxs)(`div`,{className:R.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescCacheHit`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`cacheHitRate`)})}),g(f)]}),(0,m.jsx)(`span`,{className:y(R.kpiValue,R.kpiGreen),children:vn(Z.cacheHit+Z.cacheMiss>0?Z.cacheHit/(Z.cacheHit+Z.cacheMiss)*100:0)}),(0,m.jsx)(`div`,{className:R.kpiSpark,children:h(c,`var(--ds-cyan)`)}),(0,m.jsxs)(`span`,{className:R.kpiDetail,children:[q(Z.cacheHit),` / `,q(Z.cacheHit+Z.cacheMiss),Z.cacheWrite>0?` · ${n(`tokenCacheWrite`)} ${q(Z.cacheWrite)}`:``]})]}),(0,m.jsxs)(`div`,{className:R.kpiTile,children:[(0,m.jsxs)(`div`,{className:R.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescTokens`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`tokens`)})}),g(d)]}),(0,m.jsx)(`span`,{className:R.kpiValue,children:q(Z.input+Z.output)}),(0,m.jsx)(`div`,{className:R.kpiSpark,children:h(s,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:R.kpiDetail,children:[n(`inputTokens`),` `,q(Z.input),` · `,n(`outputTokens`),` `,q(Z.output)]})]}),(0,m.jsxs)(`div`,{className:R.kpiTile,"data-testid":`billing-kpi-avg`,children:[(0,m.jsxs)(`div`,{className:R.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescAvgCost`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`avgCost`)})}),g(l)]}),(0,m.jsx)(`span`,{className:R.kpiValue,children:W(Z.calls>0?Z.cost/Z.calls:0)}),(0,m.jsx)(`div`,{className:R.kpiSpark,children:h(a,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:R.kpiDetail,children:[n(`calls`),` `,Z.calls.toLocaleString()]})]}),(0,m.jsxs)(`div`,{className:R.kpiTile,children:[(0,m.jsxs)(`div`,{className:R.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescCalls`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`calls`)})}),g(u)]}),(0,m.jsx)(`span`,{className:R.kpiValue,children:Z.calls.toLocaleString()}),(0,m.jsx)(`div`,{className:R.kpiSpark,children:h(o,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:R.kpiDetail,children:[Un.length,` `,n(`models`)]})]}),(0,m.jsxs)(`div`,{className:R.kpiTile,"data-testid":`billing-kpi-think`,children:[(0,m.jsx)(`div`,{className:R.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:n(`kpiDescReasoning`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`tokenReasoningShare`)})})}),(0,m.jsx)(`span`,{className:y(R.kpiValue,R.kpiGreen),children:vn(Z.output>0?Z.reasoning/Z.output*100:0)}),(0,m.jsx)(`span`,{className:R.kpiDetail,children:q(Z.reasoning)})]}),(0,m.jsxs)(`div`,{className:R.kpiTile,"data-testid":`billing-kpi-io`,children:[(0,m.jsx)(`div`,{className:R.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:n(`kpiDescIo`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`tokenIo`)})})}),(0,m.jsx)(`span`,{className:R.kpiValue,children:(Z.output>0?Z.input/Z.output:0).toFixed(2)}),(0,m.jsxs)(`span`,{className:R.kpiDetail,children:[q(Z.input),` / `,q(Z.output)]})]}),(0,m.jsxs)(`div`,{className:R.kpiTile,"data-testid":`billing-kpi-peak`,children:[(0,m.jsx)(`div`,{className:R.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:n(`kpiDescPeak`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.kpiLabel,children:n(`tokenPeak`)})})}),(0,m.jsx)(`span`,{className:R.kpiValue,children:Z.peakTokens>0?On(Z.peakTokens):`—`}),(0,m.jsx)(`span`,{className:R.kpiDetail,children:Z.peakDay??`—`})]})]})})()})]}),(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-panel-heatmap`,children:[(0,m.jsxs)(`div`,{className:R.panelHead,children:[(0,m.jsx)(`h3`,{className:R.panelTitle,children:n(`heatmap`)}),(0,m.jsx)(`div`,{className:R.heatmapRangeSwitch,"data-testid":`billing-heatmap-metric`,role:`group`,"aria-label":n(`heatmap`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.heatmapRangeButton,Qe===e&&R.heatmapRangeButtonActive),"data-testid":`billing-heatmap-metric-${e}`,"aria-pressed":Qe===e,onClick:()=>{$e(e)},children:n(e===`cost`?`metricCost`:`metricTokens`)},e))}),(0,m.jsx)(`div`,{className:R.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":n(`heatmap`),children:[`month`,`half`,`year`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.heatmapRangeButton,Ke===e&&R.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":Ke===e,onClick:()=>{Je(e)},children:n(e===`month`?`heatmapMonth`:e===`half`?`heatmapHalf`:`heatmapYear`)},e))}),(0,m.jsxs)(`span`,{className:R.panelHint,"data-testid":`billing-heatmap-summary`,children:[n(`heatmapTotal`),` `,Qe===`tokens`?q(zn):W(zn),` · `,n(`activeDays`),` `,Bn,` · `,n(`streakDays`),` `,Vn]})]}),(0,m.jsx)(rr,{days:X,currency:h,t:n,range:Ke,unit:Qe})]})]}),F===`agents`&&(0,m.jsxs)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-agents`,children:[(0,m.jsxs)(`section`,{className:R.agentSummary,"data-testid":`billing-agent-summary`,children:[(0,m.jsxs)(`span`,{className:R.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:R.agentSummaryValue,children:String(Se.agents)}),(0,m.jsx)(`span`,{className:R.agentSummaryLabel,children:n(`agentsCount`)})]}),(0,m.jsxs)(`span`,{className:R.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:R.agentSummaryValue,children:String(Se.delegations)}),(0,m.jsx)(`span`,{className:R.agentSummaryLabel,children:n(`agentsDelegations`)})]}),(0,m.jsxs)(`span`,{className:R.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:R.agentSummaryValue,children:String(Se.roots)}),(0,m.jsx)(`span`,{className:R.agentSummaryLabel,children:n(`agentsRoots`)})]}),Se.costliest!==void 0&&Se.costliest.chainCost>0&&(0,m.jsxs)(`span`,{className:R.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:R.agentSummaryValue,children:W(Se.costliest.chainCost)}),(0,m.jsx)(`span`,{className:R.agentSummaryLabel,children:n(`agentsMostExpensive`)})]})]}),xe.length===0||Se.delegations===0?(0,m.jsx)(`p`,{className:R.contextEmpty,"data-testid":`billing-agents-empty`,children:n(`agentsNoData`)}):(0,m.jsx)(`div`,{className:R.agentTree,"data-testid":`billing-agent-tree`,children:(()=>{let e=t=>(0,m.jsxs)(`div`,{className:R.agentNode,children:[(0,m.jsxs)(`div`,{className:R.agentRow,style:{paddingLeft:`${String(t.depth*16)}px`},children:[(0,m.jsx)(`span`,{className:R.agentKind,children:t.depth===0?n(`agentsRoot`):n(`agentsSubagent`)}),(0,m.jsx)(`span`,{className:R.agentTitle,children:t.title??`${n(`sessionUntitled`)} · ${t.id.slice(0,8)}`}),(0,m.jsx)(`span`,{className:R.agentCalls,children:t.calls.toLocaleString()}),(0,m.jsx)(`span`,{className:R.agentCost,children:W(t.cost)}),t.children.length>0&&(0,m.jsxs)(`span`,{className:y(R.ubTag,R.ubTagNeutral),"data-testid":`billing-agent-chain`,children:[n(`agentsChainTotal`),` `,W(t.chainCost)]})]}),t.children.map(e)]},t.id);return xe.map(e)})()})]}),F===`settings`&&(0,m.jsx)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-settings`,children:(0,m.jsxs)(`div`,{className:y(R.settingsLayout,i&&R.nativeSettingsLayout),children:[!i&&(0,m.jsx)(`aside`,{className:R.settingsNav,"data-testid":`billing-settings-nav`,role:`navigation`,"aria-label":`settings`,children:[{id:`display-pref`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:[(0,m.jsx)(`path`,{d:`M5 3v10M11 3v10`}),(0,m.jsx)(`circle`,{cx:`5`,cy:`6.5`,r:`1.8`}),(0,m.jsx)(`circle`,{cx:`11`,cy:`9.5`,r:`1.8`})]}),label:n(`settingsNavDisplayPref`)},{id:`budget`,icon:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,m.jsx)(`path`,{d:`M5 3l3 4 3-4M8 7v6M5.5 9.5h5M5.5 12h5`})}),label:n(`settingsNavBudget`)},{id:`alert`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`path`,{d:`M8 2a4 4 0 0 1 4 4v3l1.5 2.5h-11L4 9V6a4 4 0 0 1 4-4z`}),(0,m.jsx)(`path`,{d:`M6.5 13.5a1.5 1.5 0 0 0 3 0`})]}),label:n(`settingsNavAlert`)},{id:`display`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`}),(0,m.jsx)(`path`,{d:`M8 2a6 6 0 0 1 0 12z`,fill:`currentColor`,stroke:`none`})]}),label:n(`settingsNavDisplay`)},{id:`advanced`,icon:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,m.jsx)(`path`,{d:`M8 2v12M2.8 5l10.4 6M13.2 5L2.8 11`})}),label:n(`settingsNavAdvanced`),advanced:!0},{id:`about`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`}),(0,m.jsx)(`path`,{d:`M8 7.5V11`}),(0,m.jsx)(`circle`,{cx:`8`,cy:`5.2`,r:`0.9`,fill:`currentColor`,stroke:`none`})]}),label:n(`settingsNavAbout`)}].map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(R.settingsNavItem,it===e.id&&R.settingsNavItemActive,e.advanced&&R.settingsNavItemAdvanced),"data-testid":`billing-settings-nav-${e.id}`,onClick:()=>{st(e.id)},children:[(0,m.jsx)(`span`,{className:R.settingsNavIcon,"aria-hidden":`true`,children:e.icon}),e.label]},e.id))}),(0,m.jsxs)(`div`,{className:R.settingsPane,children:[(0,m.jsx)(`input`,{className:y(R.ubSearch,R.settingsSearch),type:`search`,value:ot,placeholder:n(`settingsSearchPlaceholder`),"aria-label":n(`settingsSearchPlaceholder`),"data-testid":`billing-settings-search`,onChange:e=>{z(e.target.value)}}),ot.trim()!==``&&Ea(ot)&&(0,m.jsx)(`p`,{className:R.setCardDesc,"data-testid":`billing-settings-search-empty`,children:n(`settingsSearchEmpty`).replace(`{query}`,ot.trim())}),(0,m.jsxs)(`div`,{hidden:B(Ta.display),className:R.setCard,id:`settings-display-pref`,"data-testid":`billing-density-motion-card`,children:[(0,m.jsx)(`div`,{className:R.setCardHead,children:(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsx)(`h3`,{className:R.setCardTitle,children:n(`settingsSectionDisplay`)})})}),(0,m.jsxs)(`div`,{className:R.densityRow,children:[(0,m.jsxs)(`div`,{className:R.densityLeft,children:[(0,m.jsx)(`strong`,{children:n(`densityLabel`)}),(0,m.jsx)(`span`,{children:n(`densityHint`)})]}),(0,m.jsx)(`div`,{className:R.densityButtons,"data-testid":`billing-density-buttons`,children:[`compact`,`default`,`comfortable`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.densityButton,et===e&&R.densityButtonActive,e===`comfortable`&&R.densityButtonComfortable),"data-testid":`billing-density-${e}`,onClick:()=>{lt(e)},children:n(e===`compact`?`densityCompact`:e==="default"?`densityDefault`:`densityComfortable`)},e))})]}),(0,m.jsxs)(`div`,{className:R.densityRow,children:[(0,m.jsxs)(`div`,{className:R.densityLeft,children:[(0,m.jsx)(`strong`,{children:n(`motionLabel`)}),(0,m.jsx)(`span`,{children:n(`motionHint`)})]}),(0,m.jsx)(`div`,{className:R.densityButtons,"data-testid":`billing-motion-buttons`,children:[`off`,`subtle`,`rich`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.densityButton,nt===e&&R.densityButtonActive),"data-testid":`billing-motion-${e}`,onClick:()=>{ut(e)},children:n(e===`off`?`motionOff`:e===`subtle`?`motionSubtle`:`motionRich`)},e))})]})]}),(0,m.jsxs)(`section`,{hidden:B(Ta.budget),className:R.setCard,"data-testid":`billing-budget`,id:`settings-budget`,children:[(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`budget`),(0,m.jsx)(ha,{label:n(`budgetHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":S,"aria-label":n(`budget`),"data-testid":`billing-budget-toggle`,className:y(R.switch,S&&R.switchOn),onClick:w,children:(0,m.jsx)(`span`,{className:R.switchKnob})})]}),S&&(0,m.jsxs)(`div`,{className:R.ctlCol,children:[(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`budgetAmount`)}),(0,m.jsxs)(`span`,{className:R.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,m.jsx)(`span`,{className:R.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:R.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:C===0?``:C,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${n(`budget`)}(${h===`usd`?`USD`:h===`eur`?`EUR`:`CNY`})`,title:`${n(`budget`)}(${h===`usd`?`USD`:h===`eur`?`EUR`:`CNY`})`,onChange:e=>{T(e.target.valueAsNumber)}})]})]}),C>0&&(()=>{let e=Mn/C*100;return(0,m.jsx)(`div`,{className:R.ctlRowStretch,children:(0,m.jsx)(`div`,{className:R.prog,role:`progressbar`,"aria-valuenow":Math.min(e,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":n(`budget`),"data-testid":`billing-budget-track`,children:(0,m.jsx)(`div`,{className:y(R.progFill,e>=100&&R.budgetFillOver,e>=80&&e<100&&R.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),C>0&&(0,m.jsx)(`p`,{className:R.setCardDesc,"data-testid":`billing-budget-value`,children:n(`budgetSummary`).replace(`{used}`,W(Mn)).replace(`{total}`,W(C))})]}),(0,m.jsxs)(`div`,{className:R.ctlCol,"data-testid":`billing-model-budgets`,children:[(0,m.jsxs)(`span`,{className:R.modelBudgetTitle,children:[n(`modelBudgetTitle`),(0,m.jsx)(ha,{label:n(`modelBudgetHint`),t:n})]}),jt.length===0&&(0,m.jsx)(`p`,{className:R.modelBudgetHint,children:n(`emptyHint`)}),(0,m.jsx)(`div`,{className:R.modelBudgetList,children:jt.map(e=>(0,m.jsxs)(`div`,{className:R.modelBudgetRow,children:[(0,m.jsx)(`span`,{className:R.modelBudgetName,title:e.name??e.key,children:e.name??e.key}),(0,m.jsx)(`span`,{className:R.modelBudgetCost,"data-testid":`billing-model-budget-cost-${e.key}`,children:W(e.cost)}),(0,m.jsxs)(`span`,{className:R.inp,children:[(0,m.jsx)(`span`,{className:R.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:R.budgetInput,type:`number`,min:0,step:1,value:E[e.key]??``,placeholder:n(`modelBudgetPlaceholder`),"aria-label":`${n(`modelBudgetTitle`)} · ${e.name??e.key}`,"data-testid":`billing-model-budget-${e.key}`,onChange:t=>{te(e.key,t.target.valueAsNumber)}})]})]},e.key))})]})]}),(0,m.jsxs)(`section`,{hidden:B(Ta.alert),className:R.setCard,"data-testid":`billing-peak-alert-settings`,id:`settings-alert`,children:[(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`peakAlert`),(0,m.jsx)(ha,{label:n(`peakAlertHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":D.enabled,"aria-label":n(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:y(R.switch,D.enabled&&R.switchOn),onClick:()=>{O({...D,enabled:!D.enabled})},children:(0,m.jsx)(`span`,{className:R.switchKnob})})]}),D.enabled&&(0,m.jsxs)(`div`,{className:R.ctlCol,children:[(0,m.jsxs)(`label`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`peakAlertLeadMin`)}),(0,m.jsx)(`span`,{className:R.inp,children:(0,m.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:D.leadMin,className:R.budgetInput,"aria-label":n(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);O({...D,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):D.leadMin})}})})]}),(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`peakAlertPos`)}),(0,m.jsx)(`div`,{className:R.ctlGroup,role:`radiogroup`,"aria-label":n(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,m.jsxs)(`label`,{className:R.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:D.position===e,onChange:()=>O({...D,position:e})}),(0,m.jsx)(`span`,{className:R.rdoDot,"aria-hidden":`true`}),n(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`peakAlertMode`)}),(0,m.jsx)(`div`,{className:R.ctlGroup,role:`radiogroup`,"aria-label":n(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,m.jsxs)(`label`,{className:R.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:D.mode===e,onChange:()=>O({...D,mode:e})}),(0,m.jsx)(`span`,{className:R.rdoDot,"aria-hidden":`true`}),n(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,m.jsxs)(`label`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`peakAlertWebNotify`)}),(0,m.jsx)(`input`,{type:`checkbox`,checked:D.webNotify,"aria-label":n(`peakAlertWebNotify`),onChange:e=>{O({...D,webNotify:e.target.checked})}})]}),(0,m.jsx)(`div`,{className:R.ctlRow,children:(0,m.jsx)(`button`,{type:`button`,className:R.btn,onClick:ne,children:n(`peakAlertPreview`)})})]})]}),(0,m.jsx)(`section`,{hidden:B(Ta.toggles),className:R.setCard,"data-testid":`billing-toggle-setting`,id:`settings-display`,children:(0,m.jsxs)(`div`,{className:R.setGrid3,children:[(0,m.jsx)(`div`,{className:R.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`usageStatsTool`),(0,m.jsx)(ha,{label:n(`usageStatsToolHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Bt,"aria-label":n(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:y(R.switch,Bt&&R.switchOn),onClick:Ht,children:(0,m.jsx)(`span`,{className:R.switchKnob})})]})}),(0,m.jsxs)(`div`,{className:R.setCell,"data-testid":`billing-livecost-setting`,children:[(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`liveCostBar`),(0,m.jsx)(ha,{label:n(`liveCostBarHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":fe.show,"aria-label":n(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:y(R.switch,fe.show&&R.switchOn),onClick:()=>pe({...fe,show:!fe.show}),children:(0,m.jsx)(`span`,{className:R.switchKnob})})]}),fe.show&&(0,m.jsxs)(`div`,{className:R.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,m.jsx)(`span`,{className:R.rdoLabel,children:n(`liveCostBarPosition`)}),(0,m.jsx)(Oa,{liveCostPrefs:fe,onLiveCostPrefs:pe,t:n})]})]}),(0,m.jsx)(`div`,{className:R.setCell,"data-testid":`billing-site-list-setting`,children:(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`siteListDisplay`),(0,m.jsx)(ha,{label:n(`siteListDisplayHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":N.hideUnidentified,"aria-label":n(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:y(R.switch,N.hideUnidentified&&R.switchOn),onClick:()=>oe({hideUnidentified:!N.hideUnidentified}),children:(0,m.jsx)(`span`,{className:R.switchKnob})})]})}),(0,m.jsx)(Sa,{prefs:se,onPrefs:ue,groups:de,t:n,money:W}),(0,m.jsx)(`div`,{className:R.setCell,"data-testid":`billing-quick-queue-entry-setting`,children:(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`quickQueueEntry`),(0,m.jsx)(ha,{label:n(`quickQueueEntryHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":me.showEntry,"aria-label":n(`quickQueueEntry`),"data-testid":`billing-quick-queue-entry-toggle`,className:y(R.switch,me.showEntry&&R.switchOn),onClick:()=>he({...me,showEntry:!me.showEntry}),children:(0,m.jsx)(`span`,{className:R.switchKnob})})]})}),(0,m.jsx)(`div`,{className:R.setCell,"data-testid":`billing-quick-queue-reuse-setting`,children:(0,m.jsxs)(`div`,{className:R.setCardHead,children:[(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`quickQueueReuseEntry`),(0,m.jsx)(ha,{label:n(`quickQueueReuseEntryHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":me.reuseSourceSession,"aria-label":n(`quickQueueReuseEntry`),"data-testid":`billing-quick-queue-reuse-toggle`,className:y(R.switch,me.reuseSourceSession&&R.switchOn),onClick:()=>he({...me,reuseSourceSession:!me.reuseSourceSession}),children:(0,m.jsx)(`span`,{className:R.switchKnob})})]})})]})}),(0,m.jsx)(`section`,{hidden:B(Ta.displayExtra),className:R.setCard,"data-testid":`billing-display-setting`,id:`settings-display-extra`,children:(0,m.jsxs)(`div`,{className:R.setGrid2,children:[(0,m.jsxs)(`div`,{className:R.setCell,"data-testid":`billing-float-setting`,children:[(0,m.jsx)(`div`,{className:R.setCardHead,children:(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`floatWindow`),(0,m.jsx)(ha,{label:n(`floatWindowHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:R.ctlCol,children:[(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`cardMode`)}),(0,m.jsx)(`div`,{className:R.ctlGroup,"data-testid":`billing-card-mode`,children:[[`full`,`cardModeFull`],[`compact`,`cardModeCompact`],[`hidden`,`cardModeHidden`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,j.mode===e&&R.floatModeBtnOn),"data-testid":`billing-card-mode-${e}`,"aria-pressed":j.mode===e,disabled:e===`hidden`&&!re,title:e===`hidden`&&!re?n(`cardModeFallback`):void 0,onClick:()=>M({...j,mode:e}),children:n(t)},e))})]}),!re&&(0,m.jsx)(`p`,{className:R.setCardDesc,"data-testid":`billing-card-mode-fallback`,children:n(`cardModeFallback`)}),re&&j.mode===`hidden`&&(0,m.jsx)(`p`,{className:R.setCardDesc,"data-testid":`billing-card-mode-hidden-hint`,children:n(`cardModeHiddenHint`)}),(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`floatMode`)}),(0,m.jsxs)(`div`,{className:R.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,k.mode===`combined`&&R.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>A({mode:`combined`,targets:k.targets}),children:n(`floatModeCombined`)}),(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,k.mode===`subscription`&&R.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>A({mode:`subscription`,targets:k.targets}),children:n(`floatModeSubscription`)})]})]}),k.mode===`subscription`&&(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`floatTargets`)}),(0,m.jsxs)(`span`,{className:R.ctlGroup,"data-testid":`billing-float-targets`,children:[mt.map(e=>{let t=k.targets.includes(e.id);return(0,m.jsxs)(`label`,{className:R.floatTarget,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>A({mode:`subscription`,targets:t?k.targets.filter(t=>t!==e.id):[...k.targets,e.id]})}),(0,m.jsx)(`span`,{className:R.floatTargetLabel,children:e.label})]},e.id)}),mt.length===0&&(0,m.jsx)(`span`,{className:R.setCardDesc,children:n(`floatNoTargetsHint`)})]})]})]})]}),(0,m.jsxs)(`div`,{className:R.setCell,"data-testid":`billing-card-setting`,children:[(0,m.jsx)(`div`,{className:R.setCardHead,children:(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsxs)(`h3`,{className:R.setCardTitle,children:[n(`cardDisplay`),(0,m.jsx)(ha,{label:n(`cardDisplayHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:R.ctlCol,children:[(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`cardMetric`)}),(0,m.jsxs)(`div`,{className:R.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,j.metric===`money`&&R.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>M({...j,metric:`money`}),children:n(`cardMetricMoney`)}),(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,j.metric===`tokens`&&R.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>M({...j,metric:`tokens`}),children:n(`cardMetricTokens`)})]})]}),(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`cardSpan`)}),(0,m.jsx)(`div`,{className:R.ctlGroup,"data-testid":`billing-card-span`,children:[[`day`,`cardSpanDay`],[`week`,`cardSpanWeek`],[`month`,`cardSpanMonth`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,j.span===e&&R.floatModeBtnOn),"data-testid":`billing-card-span-${e}`,"aria-pressed":j.span===e,onClick:()=>M({...j,span:e}),children:n(t)},e))})]}),(0,m.jsxs)(`div`,{className:R.ctlRow,children:[(0,m.jsx)(`span`,{className:R.ctlLabel,children:n(`cardDeltaBadge`)}),(0,m.jsxs)(`div`,{className:R.ctlGroup,"data-testid":`billing-card-delta`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,j.showDelta&&R.floatModeBtnOn),"data-testid":`billing-card-delta-show`,"aria-pressed":j.showDelta,onClick:()=>M({...j,showDelta:!0}),children:n(`cardDeltaShow`)}),(0,m.jsx)(`button`,{type:`button`,className:y(R.floatModeBtn,!j.showDelta&&R.floatModeBtnOn),"data-testid":`billing-card-delta-hide`,"aria-pressed":!j.showDelta,onClick:()=>M({...j,showDelta:!1}),children:n(`cardDeltaHide`)})]})]})]})]})]})}),(0,m.jsx)(`div`,{hidden:B(Ta.advanced),id:`settings-advanced`,children:(0,m.jsx)(ba,{userPrices:a,onUserPrices:o,t:n,unpricedIds:e.unpricedModels??[]})}),(0,m.jsx)(`div`,{hidden:B(Ta.about),id:`settings-about`,children:(0,m.jsx)(qn,{t:n,version:e.pluginVersion})}),(0,m.jsxs)(`section`,{hidden:B(Ta.about),className:R.setCard,"data-testid":`billing-more-works`,children:[(0,m.jsx)(`div`,{className:R.setCardHead,children:(0,m.jsx)(`div`,{className:R.setCardMeta,children:(0,m.jsx)(`h3`,{className:R.setCardTitle,children:n(`moreWorksTitle`)})})}),(0,m.jsxs)(`div`,{className:R.moreWorkList,children:[(0,m.jsxs)(`a`,{className:R.moreWorkRow,href:`https://github.com/kenz1117/dsh-engram`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-engram`,children:[(0,m.jsx)(`span`,{className:R.moreWorkName,children:n(`adEngramName`)}),(0,m.jsx)(`span`,{className:R.moreWorkDesc,children:n(`adEngramDesc`)})]}),(0,m.jsxs)(`a`,{className:R.moreWorkRow,href:`https://github.com/kenz1117/dsh-ui-rainbowspeak`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-rainbowspeak`,children:[(0,m.jsx)(`span`,{className:R.moreWorkName,children:n(`adRainbowName`)}),(0,m.jsx)(`span`,{className:R.moreWorkDesc,children:n(`adRainbowDesc`)})]})]})]})]})]})}),F===`trends`&&(0,m.jsxs)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,m.jsxs)(`section`,{className:R.ubCard,"data-testid":`billing-panel-trend`,children:[(0,m.jsxs)(`div`,{className:R.ubCardHead,children:[(0,m.jsx)(`h3`,{className:R.ubCardTitle,children:n(`trend`)}),x(`billing.dashboard.decor`,{position:`trend`}),(0,m.jsxs)(`span`,{className:R.ubCardControlGroup,children:[(0,m.jsx)(`span`,{className:R.rangeToggle,role:`group`,"aria-label":n(`trend`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.rangeButton,Ie===e&&R.rangeButtonActive),"aria-pressed":Ie===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{Le(e)},children:n(e===7?`trend7d`:`trend30d`)},e))}),(0,m.jsx)(`span`,{className:R.rangeToggle,role:`group`,"aria-label":n(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(R.rangeButton,Ee===e&&R.rangeButtonActive),"aria-pressed":Ee===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{De(e)},children:n(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,m.jsx)(`span`,{className:R.ubCardSub,children:Ln})]}),(0,m.jsx)(Rn,{data:Hn,models:sr,currency:h,metric:Ee,t:n})]}),b.length>0&&(0,m.jsxs)(`section`,{className:R.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,m.jsxs)(`div`,{className:R.ubCardHead,children:[(0,m.jsx)(`h3`,{className:R.ubCardTitle,children:n(`rounds`)}),cn.length>0&&(0,m.jsxs)(`span`,{className:R.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[cn.length,` `,n(`anomaly`)]})]}),(0,m.jsx)(`p`,{className:R.ubCardSub,children:n(`roundsHint`).replace(`{count}`,String(b.length))}),(0,m.jsx)(Zn,{rounds:b,flags:cn,currency:h,t:n})]}),e.byTier!==void 0&&(()=>{let e=un.peak+un.offPeak;if(e<=0)return null;let t=un.peak/e*100;return(0,m.jsxs)(`section`,{className:R.ubCard,"data-testid":`billing-panel-share`,children:[(0,m.jsxs)(`div`,{className:R.ubCardHead,children:[(0,m.jsx)(`h3`,{className:R.ubCardTitle,children:n(`peakShare`)}),(0,m.jsx)(`span`,{className:R.ubCardSub,children:n(`peakSharePerCall`)})]}),(0,m.jsxs)(`div`,{className:R.shareTrack,"data-testid":`billing-share-track`,children:[(0,m.jsx)(`div`,{className:y(R.shareSeg,R.shareSegPeak),style:{width:`${t}%`}}),(0,m.jsx)(`div`,{className:y(R.shareSeg,R.shareSegOff),style:{width:`${100-t}%`}})]}),(0,m.jsxs)(`div`,{className:R.shareLegend,children:[(0,m.jsxs)(`span`,{className:R.shareItem,children:[(0,m.jsx)(`span`,{className:R.shareDot,style:{background:`var(--ds-blue)`}}),n(`peak`),(0,m.jsxs)(`span`,{className:R.shareValue,"data-testid":`billing-share-peak`,children:[W(un.peak),` · `,t.toFixed(1),`%`]})]}),(0,m.jsxs)(`span`,{className:R.shareItem,children:[(0,m.jsx)(`span`,{className:R.shareDot,style:{background:`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`}}),n(`offPeak`),(0,m.jsxs)(`span`,{className:R.shareValue,"data-testid":`billing-share-offpeak`,children:[W(un.offPeak),` · `,(100-t).toFixed(1),`%`]})]})]}),fn>0&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-share-savings`,children:n(`offPeakSavings`).replace(`{amount}`,W(fn))})]})})()]}),F===`providers`&&(0,m.jsxs)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[Gn.length>0&&(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,m.jsx)(`div`,{className:R.panelHead,children:(0,m.jsx)(`h3`,{className:R.panelTitle,children:n(`panelRelayQuota`)})}),(0,m.jsx)(`div`,{className:R.providerGroupList,"data-testid":`billing-relay-quotas`,children:Gn.map(e=>(0,m.jsxs)(`div`,{className:R.siteRow,"data-testid":`billing-relay-quota`,children:[(0,m.jsxs)(`span`,{className:R.siteRowName,children:[(0,m.jsx)(`span`,{className:y(R.siteKindTag,Hi[e.kind]),children:Vi(e.kind,n)}),(0,m.jsx)(`span`,{className:R.siteRowTitle,children:e.origin})]}),(0,m.jsxs)(`span`,{className:R.siteRowMeta,children:[e.balance!==void 0&&(0,m.jsxs)(`span`,{className:R.siteRowCost,children:[n(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let t=e.remainingPercent<20;return(0,m.jsxs)(`span`,{className:y(R.siteRowCalls,t&&R.siteRowCallsLow),children:[n(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,m.jsx)(`span`,{className:R.siteRowCalls,children:n(`relayNoQuota`)})]})]},e.route))})]}),(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-panel-providers`,children:[(0,m.jsxs)(`div`,{className:R.panelHead,children:[(0,m.jsx)(`h3`,{className:R.panelTitle,children:n(`providerBilling`)}),x(`billing.dashboard.decor`,{position:`models`}),(0,m.jsx)(`span`,{className:R.panelHint,children:e.updatedAt===void 0?``:`${n(`lastUpdated`)} ${Gi(e.updatedAt)}`})]}),ge&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-subscriptions-stale`,children:n(`subscriptionsStale`)}),(0,m.jsxs)(`div`,{className:R.providerCtlRow,"data-testid":`billing-provider-controls`,children:[(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,disabled:Yn.length===0,onClick:Qn,children:n(Xn?`collapseAll`:`expandAll`)}),(0,m.jsxs)(`span`,{className:R.providerTodayToggle,children:[(0,m.jsx)(`span`,{children:n(`todayOnly`)}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Ft,"data-testid":`billing-provider-today-toggle`,className:y(R.switch,Ft&&R.switchOn),onClick:Lt,children:(0,m.jsx)(`span`,{className:R.switchKnob})})]})]}),Jn.length===0?(0,m.jsxs)(`div`,{className:R.emptyState,"data-testid":`billing-provider-empty`,children:[(0,m.jsxs)(`span`,{className:R.emptyIll,"aria-hidden":`true`,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 96 64`,fill:`none`,children:[(0,m.jsx)(`line`,{x1:`6`,y1:`58`,x2:`90`,y2:`58`,stroke:`var(--ds-border-strong)`,strokeWidth:`1`}),(0,m.jsx)(`line`,{x1:`6`,y1:`6`,x2:`6`,y2:`58`,stroke:`var(--ds-border-strong)`,strokeWidth:`1`}),(0,m.jsx)(`path`,{d:`M14 50 L28 40 L42 44 L56 26 L70 30 L82 14`,stroke:`var(--ds-border-strong)`,strokeWidth:`1.5`,strokeLinecap:`round`,fill:`none`,strokeDasharray:`3 3`})]}),(0,m.jsx)(`span`,{className:R.emptyIllDot})]}),(0,m.jsx)(`span`,{className:R.emptyTitle,children:n(Ft?`todayNoConsumption`:`noData`)}),(0,m.jsx)(`span`,{className:R.emptyDesc,children:n(`emptyHint`)})]}):(0,m.jsx)(`div`,{className:R.providerGroupList,"data-testid":`billing-provider-groups`,children:Jn.map(e=>{let t=e.models.length>0||e.subscriptions.length>0,r=t&&Mt.has(e.id);return(0,m.jsxs)(`div`,{className:R.providerGroup,"data-testid":`billing-provider-group`,children:[(0,m.jsxs)(`div`,{className:y(R.providerGroupHead,t&&R.providerGroupCollapsible),"data-testid":`billing-provider-group-head`,"aria-expanded":t?r:void 0,role:t?`button`:void 0,tabIndex:t?0:void 0,onClick:t?()=>{Pt(e.id)}:void 0,onKeyDown:t?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Pt(e.id))}:void 0,children:[(0,m.jsxs)(`span`,{className:R.providerGroupTitle,children:[(0,m.jsx)(`span`,{className:y(R.healthDot,e.dot),role:`img`,"aria-label":ga(e.dot,n),title:ga(e.dot,n)}),(()=>{let t=Xt(e.name),r=e.channelKind===`direct`?Sr(t):void 0,i=e.channelKind===`direct`?n(`directTag`):e.channelKind===`site`?n(`relayTag`):e.channelKind===`unknown`?n(`unknownTag`):void 0;return(0,m.jsxs)(m.Fragment,{children:[i!==void 0&&(0,m.jsx)(`span`,{className:y(R.kindBadge,e.channelKind===`site`&&R.kindBadgeRelay,e.channelKind===`unknown`&&R.kindBadgeUnknown),"data-testid":`billing-kind-badge`,children:i}),e.channelKind!==`unknown`&&(0,m.jsx)(`span`,{className:R.providerGroupName,children:r??t})]})})(),e.subscriptions.length>0&&(0,m.jsxs)(`span`,{className:R.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` `,n(`planCountUnit`)]})]}),(0,m.jsxs)(`span`,{className:R.providerGroupMeta,children:[(0,m.jsxs)(`span`,{className:R.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,m.jsx)(`span`,{className:R.providerGroupCostLabel,children:n(`cost`)}),e.channelKind===`unknown`?(0,m.jsx)(`span`,{className:R.na,children:`—`}):(0,m.jsx)(`span`,{className:R.providerGroupCostValue,children:W(Ui(e))})]}),!bn(e)&&e.balance!==void 0?(0,m.jsxs)(`span`,{className:R.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,m.jsx)(`span`,{className:R.providerGroupBalanceLabel,children:n(`balance`)}),xn(e.balance)]}):(0,m.jsx)(`span`,{className:R.providerGroupBalance,"aria-hidden":`true`}),yi(e.name)===void 0?(0,m.jsx)(`span`,{className:R.providerGroupRecharge,"aria-hidden":`true`}):(0,m.jsx)(`a`,{className:R.providerGroupRecharge,"data-testid":`billing-group-recharge`,href:yi(e.name),target:`_blank`,rel:`noreferrer`,title:n(`rechargeHint`),"aria-label":`${Xt(e.name)} ${n(`recharge`)}`,onClick:e=>{e.stopPropagation()},children:n(`recharge`)})]})]}),e.models.length>0&&(0,m.jsx)(`div`,{className:R.providerStatRow,"data-testid":`billing-provider-stat-row`,children:(()=>{let t=e.models.reduce((e,t)=>({calls:e.calls+t.calls,input:e.input+t.input,output:e.output+t.output}),{calls:0,input:0,output:0}),r=t.input>0?e.models.reduce((e,t)=>e+t.cacheHitRate,0)/e.models.length:0;return[{lbl:n(`calls`),val:t.calls.toLocaleString(),sub:``},{lbl:n(`inputTokens`),val:q(t.input),sub:r>0?`${n(`cacheHitRate`)} ${r.toFixed(0)}%`:``},{lbl:n(`outputTokens`),val:q(t.output),sub:``},{lbl:n(`cost`),val:W(Ui(e)),sub:e.models.length===1?``:`${e.models.length} ${n(`models`)}`}].map((e,t)=>(0,m.jsxs)(`div`,{className:R.providerStatCell,children:[(0,m.jsx)(`div`,{className:R.providerStatLbl,children:e.lbl}),(0,m.jsx)(`div`,{className:R.providerStatVal,children:e.val}),e.sub!==``&&(0,m.jsx)(`div`,{className:R.providerStatSub,children:e.sub})]},t))})()}),r&&(0,m.jsxs)(m.Fragment,{children:[e.channelKind===`unknown`&&(0,m.jsx)(`p`,{className:R.unknownHint,"data-testid":`billing-unknown-hint`,children:n(`unknownChannelHint`)}),e.models.length>0&&(0,m.jsx)(`div`,{className:R.tableScroll,"data-testid":`billing-table-scroll`,children:(0,m.jsxs)(`table`,{className:R.modelTable,children:[$n,(0,m.jsx)(`tbody`,{children:e.models.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:er(e)}),(0,m.jsx)(`td`,{className:R.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:R.numCol,children:q(e.input)}),(0,m.jsx)(`td`,{className:R.numCol,children:q(e.output)}),(0,m.jsx)(`td`,{className:R.numCol,children:vn(e.cacheHitRate)}),(0,m.jsx)(`td`,{className:R.numCol,children:e.plan?(0,m.jsxs)(`span`,{className:R.planTag,children:[e.estimated>0?(0,m.jsxs)(`span`,{children:[`≈`,W(e.estimated)]}):null,(0,m.jsx)(`span`,{className:R.planTagBadge,"data-testid":`billing-plan-badge`,children:n(`subscriptionTag`)})]}):e.actual===void 0?e.estimated>0?(0,m.jsxs)(`span`,{title:n(`cellEstimateHint`),children:[`≈`,W(e.estimated)]}):(0,m.jsx)(`span`,{className:R.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,m.jsxs)(`span`,{className:R.bucketCost,children:[(0,m.jsx)(`span`,{className:R.bucketOfficial,children:W(t)}),(0,m.jsx)(`span`,{className:R.bucketSep,children:`/`}),(0,m.jsx)(`span`,{className:R.bucketThird,children:W(n)})]}):W(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,m.jsx)(`div`,{className:R.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let t=zi(e.status,n);return(0,m.jsxs)(`div`,{className:y(R.subscriptionCard,R.subscriptionCardUpgraded),"data-testid":`billing-subscription-card`,children:[(0,m.jsxs)(`div`,{className:R.subscriptionHead,children:[(0,m.jsx)(`span`,{className:R.subscriptionName,children:Xt(e.displayName)}),e.planType===`code`&&(()=>{let t=ct(e.provider),r=t===void 0?void 0:n(`subscriptionFeePerMonth`).replace(`{amount}`,t.currency===`USD`?`$${t.amount}`:`¥${t.amount}`);return(0,m.jsxs)(`span`,{className:R.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?n(`subscriptionFeePerMonth`).replace(`{amount}`,W(e.subscriptionAmount)):n(`planTypeCode`)),t?.label!==void 0&&(0,m.jsx)(`span`,{className:R.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:t.label}),t!==void 0&&(0,m.jsx)(`span`,{className:R.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:n(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,m.jsx)(`span`,{className:R.subscriptionPlan,"data-kind":`token`,children:n(`planTypeToken`)}),e.plan!==void 0&&(0,m.jsx)(`span`,{className:R.subscriptionPlan,children:e.plan})]}),t!==``&&(0,m.jsx)(`div`,{className:R.subscriptionStatus,children:t}),e.windows.length===0&&t===``&&(0,m.jsx)(`div`,{className:R.subscriptionStatus,children:n(`subscriptionNoApi`)}),e.windows.map(e=>(0,m.jsx)(ma,{window:e,t:n},e.kind))]},e.provider)})})]})]},e.id)})})]}),(0,m.jsxs)(`div`,{className:R.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":n(`export`),children:[(0,m.jsx)(`span`,{className:R.exportLabel,children:n(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-export-day`,onClick:()=>{Dn(En(`usage-daily`,`csv`,Object.keys(P)),Sn(P),`text/csv`)},children:n(`exportCsvDay`)}),e.bySession!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{Dn(En(`usage-sessions`,`csv`,Object.keys(P)),Tn(e.bySession??[]),`text/csv`)},children:n(`exportCsvSession`)}),e.bySite!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{Dn(En(`usage-sites`,`csv`,Object.keys(P)),Cn(e.bySite??{}),`text/csv`)},children:n(`exportCsvSite`)}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-export-json`,onClick:()=>{Dn(En(`usage-stats`,`json`,Object.keys(P)),JSON.stringify(e,null,2),`application/json`)},children:n(`exportJson`)})]}),e.bySession!==void 0&&(0,m.jsxs)(`section`,{className:R.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,m.jsxs)(`div`,{className:R.ubCardHead,children:[(0,m.jsx)(`h3`,{className:R.ubCardTitle,children:n(`sessions`)}),(0,m.jsx)(`span`,{className:R.ubCardSub,children:e.bySession.length>20?n(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(kt)):`${kt}`}),e.bySession.length>0&&(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-sessions-view-all`,onClick:()=>{U(!0)},children:n(At?`sessionsViewTop`:`sessionsViewAll`).replace(`{count}`,String(e.bySession.length))})]}),(e.staleLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-sessions-stale`,children:n(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,m.jsxs)(`div`,{className:R.ubTablewrap,"data-testid":`billing-sessions-table`,children:[Ce!==void 0&&(0,m.jsx)(`div`,{className:R.staleNotice,"data-testid":`billing-session-nav-notice`,role:`note`,children:Ce}),(0,m.jsxs)(`table`,{className:R.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`sessionTitle`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`calls`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`actual`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[Ct.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:R.emptyRow,children:n(`noData`)})}),Ct.slice(0,20).map(e=>{let t=e.children!==void 0||e.subs!==void 0,r=t&&_t.has(e.id),i=Wi(e);return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:t?R.sessionGroupRow:void 0,"aria-expanded":t?r:void 0,tabIndex:t?0:void 0,onClick:t?()=>{St(e.id)}:void 0,onKeyDown:t?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),St(e.id))}:void 0,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:R.modelName,children:(0,m.jsxs)(`button`,{type:`button`,className:R.sessionLink,"data-testid":`billing-session-open`,title:n(`sessionOpen`),onClick:t=>{t.stopPropagation(),Te(e.id)},children:[e.title??`${n(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]})}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(R.ubTag,R.ubTagNeutral),"data-testid":`billing-session-stale`,children:n(`sessionStaleBadge`)}),(i.calls>0||i.cost>0)&&(0,m.jsx)(`span`,{className:y(R.ubTag,R.ubTagNeutral),"data-testid":`billing-session-sub`,children:i.cost>0?n(`sessionSubCost`).replace(`{cost}`,W(i.cost)):n(`sessionSubCalls`).replace(`{calls}`,i.calls.toLocaleString())})]}),wt(e)]}),r&&e.children?.map(e=>(0,m.jsxs)(`tr`,{className:R.sessionChildRow,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`button`,{type:`button`,className:R.sessionLink,"data-testid":`billing-session-open`,title:n(`sessionOpen`),onClick:t=>{t.stopPropagation(),Te(e.id)},children:(0,m.jsx)(`span`,{className:R.modelProvider,children:e.id.slice(0,8)})})}),wt(e)]},e.id)),r&&e.subs?.map(e=>Et(e,0))]},e.id)})]})]})]}),yt&&(0,m.jsxs)(`div`,{className:R.sessionViewer,"data-testid":`billing-session-viewer`,children:[(0,m.jsxs)(`div`,{className:R.sessionViewerHead,children:[(0,m.jsx)(`h3`,{className:R.sessionViewerTitle,children:n(`sessions`)}),(0,m.jsx)(`input`,{className:R.ubSearch,type:`search`,value:bt,placeholder:n(`sessionViewerSearch`),"aria-label":n(`sessionViewerSearch`),"data-testid":`billing-session-viewer-search`,onChange:e=>{xt(e.target.value)}}),(0,m.jsx)(`button`,{type:`button`,className:R.exportButton,"data-testid":`billing-session-viewer-close`,onClick:()=>{U(!1),xt(``)},children:n(`close`)})]}),(0,m.jsx)(`div`,{className:R.sessionViewerList,"data-testid":`billing-session-viewer-list`,children:(0,m.jsxs)(`table`,{className:R.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`sessionTitle`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`calls`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`actual`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[Dt.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:R.emptyRow,children:n(`noData`)})}),Dt.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsxs)(`td`,{children:[(0,m.jsxs)(`span`,{className:R.modelName,children:[e.title??`${n(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.cwd!==void 0&&(0,m.jsx)(`span`,{className:R.modelProvider,children:wa(e.cwd)}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(R.ubTag,R.ubTagNeutral),children:n(`sessionStaleBadge`)})]}),(0,m.jsx)(`td`,{className:R.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:R.numCol,children:W(e.cost)}),(0,m.jsx)(`td`,{className:R.numCol,children:e.lastActive>0?`${K(e.lastActive)} ${Gi(e.lastActive)}`:`—`})]},e.id))]})]})})]})]})]}),F===`token`&&(0,m.jsxs)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,m.jsx)(Nn,{stats:e,trendDays:Ie,onTrendDays:Le,models:sr,money:W,channelName:Kn,t:n}),e.perf!==void 0&&(0,m.jsxs)(`section`,{className:R.panel,"data-testid":`billing-panel-perf`,children:[(0,m.jsxs)(`div`,{className:R.panelHead,children:[(0,m.jsx)(`h3`,{className:R.panelTitle,children:n(`perfTitle`)}),(0,m.jsx)(`span`,{className:R.panelHint,children:n(`perfHint`)})]}),(0,m.jsx)(Wn,{perf:e.perf,models:sr,t:n})]})]}),F===`pricing`&&(0,m.jsxs)(`div`,{className:R.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:R.ubAlert,role:`note`,children:[(0,m.jsxs)(`div`,{className:R.ubAlertLeft,children:[(0,m.jsxs)(`span`,{className:R.ubRate,"data-testid":`billing-rate`,children:[n(`todayRate`),` 1 USD = `,G(Ut.rate)]}),(0,m.jsx)(`span`,{className:y(R.ubTag,Ut.live?R.ubTagSuccess:R.ubTagNeutral),children:Ut.live?n(`rateLive`):n(`rateBuiltin`)}),qt>0&&(0,m.jsxs)(`span`,{className:R.ubTag,"data-testid":`billing-pricing-synced`,children:[n(`pricingSyncedAt`),` `,new Date(qt).toLocaleTimeString(Yt===`zh`?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}),(0,m.jsx)(`button`,{type:`button`,className:R.heatmapRangeButton,"data-testid":`billing-pricing-sync`,disabled:Wt,onClick:Kt,children:n(Wt?`pricingSyncing`:`pricingSyncNow`)})]}),(0,m.jsx)(`p`,{className:R.ubAlertNote,children:n(`pricingTip`)})]}),(0,m.jsxs)(`section`,{className:R.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:R.ubCardHead,children:[(0,m.jsx)(`h3`,{className:R.ubCardTitle,children:n(`pricing`)}),(0,m.jsx)(`span`,{className:R.ubCardSub,children:n(`pricingUnit`)}),(0,m.jsx)(`input`,{className:R.ubSearch,type:`search`,value:Zt,placeholder:n(`pricingSearch`),"aria-label":n(`pricingSearch`),"data-testid":`billing-pricing-search`,onChange:e=>{Qt(e.target.value)}})]}),(0,m.jsx)(`div`,{className:y(R.ubTablewrap,R.ubTablewrapPricing),"data-testid":`billing-pricing-table`,children:(0,m.jsxs)(`table`,{className:R.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`thModel`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`thInputMiss`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`thInputHit`)}),(0,m.jsx)(`th`,{className:R.numCol,children:n(`output`)}),(0,m.jsx)(`th`,{className:R.numCol,colSpan:2,children:n(`band`)})]})}),(0,m.jsx)(`tbody`,{children:pr(dn(),Zt).map(e=>{let t=e.price.input>0||e.price.output>0;return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsxs)(`span`,{className:R.ubModel,children:[(()=>{let t=ur(zt(tn,Rt(e.key,rn)),an);if(t===null)return null;let r=$t.includes(e.key),i=`${e.name} · ${n(t===`peak`?`peak`:`offPeak`)} · ${n(`bandPinHint`)}`;return(0,m.jsx)(`button`,{type:`button`,className:y(R.bandDot,R[t],r&&R.bandDotOn),"data-testid":`billing-band-dot`,"aria-pressed":r,"aria-label":i,title:i,onClick:()=>{en(Re(e.key)),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.pinned-pref`))}})})(),(0,m.jsxs)(`span`,{className:R.ubModelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:R.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:n(`uncatalogued`)}),e.promo!==void 0&&ln(e.promo,Date.now())&&(0,m.jsx)(p.Tooltip,{label:[e.promo.note,e.promo.endsAtMs===void 0?n(`promoOpenEnded`):n(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()})].filter(Boolean).join(` · `),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:R.ubTagPromo,"data-testid":`billing-price-promo`,children:n(`promoBadge`)})})]})]})}),(0,m.jsx)(`td`,{className:R.numCol,children:t?on(e.price.input,e.price.currency):(0,m.jsx)(`span`,{className:R.na,children:`—`})}),(0,m.jsx)(`td`,{className:R.numCol,children:t?on(e.price.cacheHit,e.price.currency):(0,m.jsx)(`span`,{className:R.na,children:`—`})}),(0,m.jsx)(`td`,{className:R.numCol,children:t?on(e.price.output,e.price.currency):(0,m.jsx)(`span`,{className:R.na,children:`—`})}),t&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:R.numCol,children:(0,m.jsxs)(`span`,{className:R.ubChipPeak,children:[(0,m.jsx)(`span`,{className:R.ubChipLabel,children:e.tierSemantics===`latency`?n(`ubStd`):n(`ubPeak`)}),(0,m.jsxs)(`span`,{children:[on(e.price.input,e.price.currency),`/`,on(e.price.output,e.price.currency)]})]})}),(0,m.jsx)(`td`,{className:R.numCol,children:(0,m.jsxs)(`span`,{className:R.ubChipOff,children:[(0,m.jsx)(`span`,{className:R.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:n(`ubOff`)}),(0,m.jsxs)(`span`,{children:[on(e.price.offPeak.input,e.price.currency),` / `,on(e.price.offPeak.output,e.price.currency)]})]})})]}):(0,m.jsx)(`td`,{className:R.numCol,colSpan:2,children:t?(0,m.jsx)(`span`,{className:R.flatTag,children:n(`flat`)}):(0,m.jsx)(`span`,{className:R.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,m.jsxs)(`tr`,{className:R.ubExtraRow,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:R.ubExtraName,children:fr(t.label,Yt)}),t.note!==void 0&&(0,m.jsx)(`span`,{className:R.ubExtraNote,children:fr(t.note,Yt)})]}),(0,m.jsx)(`td`,{className:R.numCol,children:t.input===void 0?(0,m.jsx)(`span`,{className:R.na,children:`—`}):on(t.input,e.price.currency)}),(0,m.jsx)(`td`,{className:R.numCol,children:(0,m.jsx)(`span`,{className:R.na,children:`—`})}),(0,m.jsx)(`td`,{className:R.numCol,children:t.output===void 0?(0,m.jsx)(`span`,{className:R.na,children:`—`}):on(t.output,e.price.currency)}),(0,m.jsx)(`td`,{className:R.numCol,colSpan:2,children:(0,m.jsx)(`span`,{className:R.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,m.jsxs)(`section`,{className:R.ubCard,children:[(0,m.jsx)(`div`,{className:R.ubCardHead,children:(0,m.jsx)(`h3`,{className:R.ubCardTitle,children:n(`pricingNotes`)})}),(0,m.jsxs)(`ul`,{className:R.ubNotes,children:[(0,m.jsxs)(`li`,{className:R.ubNotesItem,children:[(0,m.jsx)(`span`,{className:R.ubNotesTerm,children:n(`cacheHit`)}),(0,m.jsx)(`span`,{className:R.ubNotesDesc,children:n(`noteCache`)})]}),(0,m.jsxs)(`li`,{className:R.ubNotesItem,children:[(0,m.jsx)(`span`,{className:R.ubNotesTerm,children:n(`peakBand`)}),(0,m.jsx)(`span`,{className:R.ubNotesDesc,children:n(`noteBand`)})]}),(0,m.jsxs)(`li`,{className:R.ubNotesItem,children:[(0,m.jsx)(`span`,{className:R.ubNotesTerm,children:n(`pricingSource`)}),(0,m.jsx)(`span`,{className:R.ubNotesDesc,children:n(`noteSource`)})]})]})]})]}),!i&&x(`billing.dashboard.decor`,{position:`footer`})]}),!i&&(0,m.jsxs)(`footer`,{className:R.modalFooter,"data-testid":`billing-footer`,children:[(0,m.jsx)(`span`,{children:n(`footer`)}),(0,m.jsx)(`span`,{children:n(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]});return i?dr:(0,m.jsx)(p.Modal,{open:!0,onClose:r,title:n(`title`),headless:!0,className:y(R.dashboardModal,`dsh-billing-modal`,Mr),children:dr})}function wa(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??`—`}let Ta={display:[`显示`,`密度`,`动效`,`紧凑`,`舒适`,`克制`,`丰富`,`display`,`density`,`motion`,`compact`,`comfortable`],budget:[`预算`,`金额`,`本月`,`花费`,`进度`,`budget`,`amount`,`spend`,`progress`],alert:[`峰谷`,`峰`,`谷`,`提醒`,`通知`,`预览`,`切换`,`peak`,`off-peak`,`alert`,`notify`,`preview`],toggles:[`usage_stats`,`工具`,`即时代费`,`胶囊`,`中转站`,`站点`,`隐藏`,`低谷`,`队列`,`relay`,`site`,`live`,`cost`,`hide`,`queue`,`off-peak`],displayExtra:[`悬浮`,`订阅`,`计费卡`,`指标`,`环比`,`主数字`,`侧栏`,`入口`,`隐藏`,`通道`,`可见`,`float`,`subscription`,`card`,`metric`,`delta`,`sidebar`,`trigger`,`hidden`,`channel`,`visibility`],advanced:[`自定义`,`单价`,`价格`,`低谷`,`custom`,`price`],about:[`关于`,`版本`,`作者`,`许可`,`仓库`,`about`,`version`,`author`,`license`,`repo`]};function Ea(e){return Object.values(Ta).every(t=>Li(e,t))}let Da=[`below`,`above`,`toolbar`];function Oa({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[r,i]=(0,d.useState)(!1),a={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)},o=Da.map(e=>({id:e,label:a[e]}));return(0,m.jsx)(p.Menu,{open:r,align:`end`,portal:!0,compact:!0,items:o,selectedId:e.position,onSelect:n=>{i(!1);let r=Da.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{i(!1)},anchor:(0,m.jsxs)(`button`,{type:`button`,className:R.rdoSelect,"data-testid":`billing-livecost-position-select`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>{i(!r)},children:[(0,m.jsx)(`span`,{children:a[e.position]}),(0,m.jsx)(`span`,{className:y(R.rdoChevron,r&&R.rdoChevronOpen),"aria-hidden":!0,children:Vr?(0,m.jsx)(Vr,{}):null})]})})}function ka(e){let{t,checkModels:n,publishCosts:r,registerOpen:i,navigateToSession:a,sessionTitleOf:o,renderSlot:s,useStore:c,actions:l,embeddedSettings:u=!1}=e,[f,p]=(0,d.useState)(Nr),[h,g]=(0,d.useState)(void 0),[_,v]=(0,d.useState)(Ir),[y,b]=(0,d.useState)([]),[x,S]=(0,d.useState)(void 0),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)([]),[D,O]=(0,d.useState)(!1),[re,N]=(0,d.useState)([]),[ie,ae]=(0,d.useState)(()=>Te()),[oe,se]=(0,d.useState)(()=>Ie()),ce=(0,d.useCallback)(e=>{se(e),Le(e),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.language-pref`))},[]),le=(0,d.useCallback)(e=>{ae(e),Ee(e),window.dispatchEvent(new CustomEvent(we))},[]),[ue,de]=(0,d.useState)(()=>ee()),me=(0,d.useCallback)(e=>{de(e),te(e)},[]),[he,ve]=(0,d.useState)(()=>fe()),ye=(0,d.useCallback)(e=>{ve(e),pe(e)},[]),[Ce,De]=(0,d.useState)(()=>xe()),Oe=(0,d.useCallback)(e=>{De(e),Se(e),window.dispatchEvent(new CustomEvent(be))},[]),[ke,Ae]=(0,d.useState)(()=>tt());(0,d.useEffect)(()=>{let e=()=>{Ae(tt())};return window.addEventListener(et,e),()=>{window.removeEventListener(et,e)}},[]);let P=(0,d.useCallback)(e=>{let t={...tt(),showEntry:e.showEntry,reuseSourceSession:e.reuseSourceSession};Ae(t),nt({showEntry:t.showEntry,reuseSourceSession:t.reuseSourceSession})},[]),[je,Me]=(0,d.useState)(()=>k());(0,d.useEffect)(()=>j(()=>{Me(k())}),[]);let F=e.recoveryEntryAvailable,Ne=(0,d.useMemo)(()=>({...je,mode:M(je.mode,F)}),[je,F]),Pe=(0,d.useCallback)(e=>{let t={...e,mode:M(e.mode,F)};Me(t),A(t),window.dispatchEvent(new CustomEvent(ne))},[F]),[Fe,Re]=(0,d.useState)(()=>{let e=Be();return gt(e),e}),ze=(0,d.useCallback)(e=>{Re(e),gt(e),Ve(e)},[]),[He,Ue]=(0,d.useState)(()=>ge()),We=(0,d.useCallback)(e=>{Ue(e),_e(e)},[]),Ge=(0,d.useMemo)(()=>new Set(He.hidden),[He.hidden]),Ke=(0,d.useMemo)(()=>Ei(f,Ge),[f,Ge]),I=(0,d.useMemo)(()=>bi(Ke),[Ke,Fe]),qe=oe,L=(0,d.useCallback)((e,n)=>{let r=(qe===`en`?ot:at)[e]??t(e);if(n===void 0)return r;let i=r;for(let[e,t]of Object.entries(n))i=i.replaceAll(`{${e}}`,String(t));return i},[qe,t]),Je=(0,d.useMemo)(()=>Ti(wi(f),e=>br(e,qe)??L(`channelUnknown`)),[f,qe,L]),[Ye,Xe]=(0,d.useState)(!1),Ze=(0,d.useCallback)(()=>{Xe(!1)},[]),Qe=(0,d.useRef)(!1),$e=(0,d.useCallback)((e=!1)=>{Qe.current&&!e||(Qe.current=!0,Promise.all([qi().then(e=>{e.ok?(p(e.stats),g(e.stats.sessionListError)):g(e.reason)}),Ji().then(({balances:e,reconcile:t,stale:n})=>{e.length>0&&b(e),S(t),w(n===!0)}),Yi().then(({quotas:e,stale:t})=>{e.length>0?(E(e),O(t===!0)):O(!1)}).catch(()=>{O(!0)}),Xi().then(e=>{N(e)}).catch(()=>{})]).catch(()=>{}).finally(()=>{Qe.current=!1}))},[]),rt=(0,d.useCallback)(()=>{$e(!0),ta(),Xe(!0)},[$e]);(0,d.useEffect)(()=>{$e(),ta()},[$e]);let[R,it]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{it(!document.hidden),document.hidden||($e(!0),ta())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[$e]),(0,d.useEffect)(()=>{if(!R)return;let e=setInterval(()=>{$e(),ta()},Ye?jr:3e5);return()=>{clearInterval(e)}},[$e,Ye,R]),(0,d.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(v(t),St(t.catalog??[]))}),()=>{e=!1}},[n]);let z=K(),B=Object.entries(I.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),st=I.byDay[z]?.cost??0,ct=new Date;ct.setDate(ct.getDate()-1);let lt=`${ct.getFullYear()}-${String(ct.getMonth()+1).padStart(2,`0`)}-${String(ct.getDate()).padStart(2,`0`)}`,ut=I.byDay[lt]?.cost??0,V=ut>0?(st-ut)/ut*100:0,dt=Yr(I.byDay,z),H=(0,d.useMemo)(()=>Jr(I.byDay).map(e=>{let t=I.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:qr(t)}}),[I.byDay]),ft=Object.entries(I.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+qr(t),0),pt=(()=>{let e=I.byDay[z];return e===void 0?0:qr(e)})(),mt=Yr(I.byDay,z,qr),ht=c(e=>e.enabled),_t=c(e=>e.amount),vt=c(e=>e.tierAlertDays),yt=c(e=>e.lastTierSwitchAt),[U,bt]=(0,d.useState)(()=>Dr()),[xt,Ct]=(0,d.useState)(null),[wt,Et]=(0,d.useState)(null),[Dt,kt]=(0,d.useState)(0),[At,jt]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!U.enabled){kt(0),jt(!1);return}let e=!1,t=!1;jt(!1);let n=()=>{t||(t=!0,aa().then(t=>{e||kt(t.supported?t.queuedCount:0)}).catch(()=>{e||kt(0)}).finally(()=>{t=!1,e||jt(!0)}))};n();let r=setInterval(n,jr);return()=>{e=!0,clearInterval(r)}},[U.enabled]),(0,d.useEffect)(()=>{Ct(e=>Er(e,Dt))},[Dt]);let[Mt,Nt]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{if(!U.enabled)return;let e=setInterval(()=>Nt(Date.now()),jr);return()=>{clearInterval(e)}},[U.enabled]);let Pt=(0,d.useCallback)(e=>{bt(e),Or(e)},[]),Ft=T.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),It=Rt(f.byTurn?.[0]?.model,Ft),Lt=(0,d.useCallback)(()=>{Et({entering:Ot(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4,channel:It})},[It]),zt=_t>0?_t:f.budget??0,Bt=ht&&zt>0?B/zt>=1?`over`:B/zt>=.8?`warn`:`none`:`none`,Vt=(0,d.useCallback)(()=>{let e=!ht;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,ht]);(0,d.useEffect)(()=>{if(!ht||zt<=0)return;let e=B/zt*100,t=Ar.filter(t=>e>=t&&vt?.[String(t)]!==z);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,z),!ki())return;let r=L(`budgetTierBody`).replace(`{cost}`,G(B)).replace(`{budget}`,G(zt)).replace(`{pct}`,String(n));Ai(`budget:${n}:${z}`,()=>{new Notification(L(`budget`),{body:r})})},[ht,zt,B,vt,z,l,L]),(0,d.useEffect)(()=>{if(U.enabled&&!At)return;let e=Tr(kr(Mt,U,yt,It),Dt>0?kr(Mt,U,yt,`deepseek-metered`):null,Dt);if(e===null||(l.markTierSwitchAlerted(e.atMs),Ct(e),!U.webNotify||!ki()))return;let t=Math.max(1,Math.round((e.atMs-Mt)/6e4)),n=L(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=L(e.channel===`zhipu-coding-plan`?e.entering===`peak`?`tierAlertEnterPeakZhipu`:`tierAlertEnterOffZhipu`:e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t)),i=e.queueCount===void 0?``:` ${L(e.entering===`peak`?`peakAlertQueuePeak`:`peakAlertQueueOff`,{count:e.queueCount})}`;Ai(`peak:${e.atMs}`,()=>{new Notification(n,{body:`${r}${i}`})})},[Mt,yt,U,It,Dt,At,l,L]);let Ht=c(e=>e.lastBalanceAlertDay),Ut=c(e=>e.modelBudgets??sr),Wt=c(e=>e.modelTierAlertDays??cr),Gt=(0,d.useMemo)(()=>$r(I.byDayModels,z.slice(0,7)),[I.byDayModels,z]),Kt=I.lowBalanceThreshold??50,qt=(0,d.useMemo)(()=>{if(y.length===0)return;let e=Hr(I.byDay,z),t=Tt().rate;for(let n of y){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=Kt)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[y,I.lowBalanceThreshold,I.byDay,z]);(0,d.useEffect)(()=>{if(qt===void 0||Ht===z||(l.markBalanceAlerted(z),!ki()))return;let e=L(`balanceLowBody`).replace(`{name}`,qt.name).replace(`{balance}`,G(qt.cny)).replace(`{days}`,qt.days===void 0?`—`:String(qt.days));Ai(`balance:${z}`,()=>{new Notification(L(`balance`),{body:e})})},[qt,Ht,z,l,L]),(0,d.useEffect)(()=>{let e=[],t;for(let[n,r]of Object.entries(Ut)){if(!(r>0))continue;let i=Gt[n]??0;for(let a of ti(i,r)){let o=`${n}:${a}`;Wt[o]!==z&&(e.push(o),(t===void 0||a>t.tier)&&(t={model:n,tier:a,cost:i,budget:r}))}}if(e.length===0||t===void 0||(l.markModelTierAlerted(e,z),!ki()))return;let n=L(`modelBudgetBody`).replace(`{model}`,t.model).replace(`{cost}`,G(t.cost)).replace(`{budget}`,G(t.budget)).replace(`{pct}`,String(t.tier));Ai(`model-budget:${t.model}:${t.tier}:${z}`,()=>{new Notification(L(`modelBudgetTitle`),{body:n})})},[Ut,Gt,Wt,z,l,L]);let W=(0,d.useMemo)(()=>{let e=z.slice(0,7),t=new Map;for(let[n,r]of Object.entries(I.byDayModels??{}))if(n.startsWith(e))for(let[e,n]of Object.entries(r)){if(n.cost<=0)continue;let r=sn(e).provider,i=I.byModel?.[e]?.plan===!0,a=t.get(r)??{cost:0,plan:i};a.cost+=n.cost,i||(a.plan=!1),t.set(r,a)}let n,r;for(let e of t){let t=e[1].plan?r:n;(t===void 0||e[1].cost>t[1].cost)&&(e[1].plan?r=e:n=e)}let i=e=>{let t=y.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=y.filter(e=>e.totalBalance!==void 0&&e.error===void 0),t=e[0];return t!==void 0&&e.length===1?i(t.provider):void 0}return{text:t?.error===`unauthorized`?L(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?L(`balanceUnreachable`):L(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:G(t.totalBalance),r=Tt().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<Kt}},a=e=>{let t=T.find(t=>t.displayName===e||si(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:L(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?L(`subscriptionExhausted`):L(`subscriptionRemaining`).replace(`{pct}`,String(n)),low:n<20}},o=n===void 0?void 0:i(n[0]);return{direct:n===void 0||o===void 0?void 0:{name:n[0],...o},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[I.byDayModels,I.byModel,I.lowBalanceThreshold,y,T,z,L]),Jt=(0,d.useMemo)(()=>{let e=I.total;return{input:e.input,output:e.output,cacheRead:e.cacheHit,cacheMiss:e.cacheMiss,calls:e.calls}},[I]);(0,d.useEffect)(()=>{r({todayCost:st,monthCost:B})},[st,B,r]),(0,d.useEffect)(()=>{if(!u)return i(rt)},[u,i,rt]);let Yt=(0,d.useMemo)(()=>f.byTurn??[],[f.byTurn]);return(0,m.jsxs)(m.Fragment,{children:[!u&&(0,m.jsx)(_a,{...e,t:L,currency:ie,onOpen:rt,monthCost:B,todayCost:st,weekCost:dt,days:H,vendorStatus:W,dash:Jt,cardPrefs:Ne,monthTokens:ft,todayTokens:pt,weekTokens:mt,floatPrefs:ue,subscriptions:T,budgetPressure:Bt,deltaPct:V,...h===void 0?{}:{statsError:h}}),(u||Ye)&&(0,m.jsx)(Ca,{stats:I,...h===void 0?{}:{statsError:h},t:L,onClose:Ze,embeddedSettings:u,navigateToSession:a,sessionTitleOf:o,userPrices:Fe,onUserPrices:ze,health:_,balances:y,...x===void 0?{}:{reconcile:x},quotas:T,relayQuotas:re,currency:ie,onCurrency:le,language:oe,onLanguage:ce,turns:Yt,renderSlot:s,budgetEnabled:ht,budgetAmount:zt,modelBudgets:Ut,monthModelCost:Gt,onModelBudget:l.setModelBudget,onToggleBudget:Vt,onBudgetAmount:l.setAmount,peakConfig:U,onPeakConfig:Pt,onPreviewPeak:Lt,floatPrefs:ue,onFloatPrefs:me,cardPrefs:Ne,onCardPrefs:Pe,recoveryEntryAvailable:F,sitePrefs:he,onSitePrefs:ye,channelPrefs:He,onChannelPrefs:We,channelGroups:Je,liveCostPrefs:Ce,onLiveCostPrefs:Oe,quickQueuePrefs:ke,onQuickQueuePrefs:P,quotasStale:D,balanceStale:C}),(xt!==null||wt!==null)&&(0,m.jsx)(Fr,{hit:xt??wt,config:U,t:L,onDismiss:()=>{Ct(null),Et(null)}})]})}function Aa(e){return(0,m.jsx)(`div`,{className:y(R.nativeSettingsRoot,Mr),"data-testid":`native-billing-settings`,children:(0,m.jsx)(ka,{...e,renderSlot:()=>null,wide:!0,embeddedSettings:!0})})}function ja(e,t){if(t===void 0||e?.bySession===void 0)return 0;let n=e.bySession.find(e=>e.id===t);return(n?.cost??0)+(n?.subCost??0)}function Ma(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.subCost??0}function Na(e,t){if(t===void 0||e?.byTurn===void 0)return 0;let n=0,r=-1;for(let i of e.byTurn)i.sessionId===t&&(r===-1||i.turn>r)&&(r=i.turn,n=i.cost);return n}function Pa(e,t=20){let n=[];for(let r of e)if(r.status===`ok`)for(let e of r.windows)e.remainingPercent>t||n.push({name:r.displayName,kind:e.kind,pct:e.remainingPercent});return n.sort((e,t)=>e.pct-t.pct).slice(0,3)}function Fa(e,t){if(t===void 0||e?.byTurn===void 0)return;let n=-1,r;for(let i of e.byTurn)i.sessionId===t&&(n===-1||i.turn>n)&&(n=i.turn,r=i.model);return r}async function Ia(){try{let e=await Di(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return null;let r=n;return{...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{}}}catch{return null}}async function La(){try{let e=await Di(`/api/billing/subscriptions`);if(!e.ok)return[];let t=JSON.parse(await e.text());if(typeof t!=`object`||!t||!(`quotas`in t))return[];let n=t.quotas;return Array.isArray(n)?n:[]}catch{return[]}}function Ra(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function za(e){return!e.running&&!e.promptAttempted&&(e.blank||e.awaitingFirstTurn)}function Ba({hasBandPlan:e}){let[t,n]=(0,d.useState)(()=>ke()),[r,i]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=()=>{n(ke())};window.addEventListener(Oe,e),window.addEventListener(`storage`,e);let t=setInterval(()=>{i(Date.now())},3e4);return()=>{window.removeEventListener(Oe,e),window.removeEventListener(`storage`,e),clearInterval(t)}},[]),t.length===0)return null;let a=Dr().leadMin*6e4,o=t.map(t=>({key:t,state:ur(zt(r,Rt(t,e)),a)})).filter(e=>e.state!==null);return o.length===0?null:(0,m.jsx)(`span`,{className:R.bandDots,"data-testid":`billing-pinned-dots`,children:o.map(e=>(0,m.jsx)(`span`,{className:y(R.bandDot,R.bandDotOn,R[e.state]),role:`img`,"aria-label":e.key,title:e.key},e.key))})}function Va(){let[e,t]=(0,d.useState)(()=>Te());return(0,d.useEffect)(()=>{let e=()=>{t(Te())};return window.addEventListener(we,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(we,e),window.removeEventListener(`storage`,e)}},[]),e}function Ha(){let[e,t]=(0,d.useState)(()=>xe().show),[n,r]=(0,d.useState)(()=>xe().position);return(0,d.useEffect)(()=>{let e=()=>{t(xe().show),r(xe().position)};return window.addEventListener(be,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(be,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function Ua(e,t){let[n,r]=(0,d.useState)(null),[i,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(()=>Date.now()),[c,l]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{l(!document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]),(0,d.useEffect)(()=>{if(!c||!t)return;let e=!1,n=!1,i=()=>{n||(n=!0,e||s(Date.now()),Promise.all([Ia(),La()]).then(([t,n])=>{e||(t!==null&&r(t),a(n))}).catch(()=>{}).finally(()=>{n=!1}))};i();let o=setInterval(i,3e4);return()=>{e=!0,clearInterval(o)}},[e,c,t]);let u=(0,d.useMemo)(()=>ja(n,e),[n,e]),f=(0,d.useMemo)(()=>Ma(n,e),[n,e]),p=(0,d.useMemo)(()=>Na(n,e),[n,e]),m=(0,d.useMemo)(()=>Pa(i),[i]),h=(0,d.useMemo)(()=>Rt(Fa(n,e),i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)),[n,e,i]);return{sessionCost:u,subCost:f,turnCost:p,tier:(0,d.useMemo)(()=>zt(o,h),[o,h]),chips:m,hasBandPlan:i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)}}function Wa({sessionId:e,t,seat:n,session:r}){let{visible:i,position:a}=Ha(),o=i&&a===n&&!(n===`above`&&r!==void 0&&za(r)),{sessionCost:s,subCost:c,turnCost:l,tier:u,chips:d,hasBandPlan:f}=Ua(e,o),p=Va(),h=e=>G(hn(e,p),p),g=s>0||l>0,_=u?.tier===`peak`;return o?(0,m.jsxs)(`span`,{className:n===`above`?y(R.feeBar,R.feeBarAbove,Mr):y(R.feeBar,Mr),"data-testid":`billing-live-cost-bar`,"data-seat":n,children:[(0,m.jsx)(Ba,{hasBandPlan:f}),u!==null&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:_?R.feeChipPrimary:R.feeChipOff,"data-testid":`billing-live-tier`,children:t(_?`tierPeak`:`tierOff`)}),(0,m.jsx)(`span`,{className:R.feeCount,children:Vt(u.nextSwitchInMs)}),(0,m.jsx)(`span`,{className:R.feeSuffix,children:t(_?`tierToOff`:`tierToPeak`)})]}),g&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:R.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:R.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,m.jsx)(`span`,{className:R.feeNum,"data-tick":`turn`,children:h(l)})]}),(0,m.jsx)(`span`,{className:R.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:R.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,m.jsx)(`span`,{className:R.feeNum,"data-tick":`session`,children:h(s)}),c>0&&(0,m.jsx)(`span`,{className:R.feeSuffix,"data-testid":`billing-live-session-sub`,children:t(`liveSessionSub`).replace(`{cost}`,h(c))})]})]}),d.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:R.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:e.pct<=10?R.feeChipError:R.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(Ra(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]}):null}function Ga({sessionId:e,t}){let n=Va(),r=e=>G(hn(e,n),n),{visible:i,position:a}=Ha(),{sessionCost:o,subCost:s,turnCost:c,tier:l,chips:u,hasBandPlan:d}=Ua(e,i&&a===`toolbar`);if(!i||a!==`toolbar`)return null;let f=l?.tier===`peak`,h=u.reduce((e,t)=>Math.min(e,t.pct),100),g=h<=10?R.feeInlineError:h<=20?R.feeInlineAlert:void 0,_=y(R.feeInline,g),v=[...l===null?[]:[`${Vt(l.nextSwitchInMs)} ${t(f?`tierToOff`:`tierToPeak`)}`],`${t(`liveTurn`)} ${r(c)}`,`${t(`liveSession`)} ${r(o)}`,...s>0?[t(`liveSessionSub`).replace(`{cost}`,r(s))]:[],...u.map(e=>`${e.name} ${t(Ra(e.kind))} ${e.pct}%`)].join(` · `);return(0,m.jsx)(p.Tooltip,{label:v,side:`top`,delayMs:500,portal:!0,children:(0,m.jsxs)(`span`,{className:y(_,Mr),"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":v,children:[(0,m.jsx)(Ba,{hasBandPlan:d}),l!==null&&(0,m.jsx)(`span`,{className:f?R.feeChipPrimary:R.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),o>0&&(0,m.jsx)(`span`,{className:R.feeInlineNum,children:r(o)})]})})}let Ka=`@kenz1117/dsh-ui-usage-billing/TaskQueueQuick.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ka)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=Ka,e.textContent=`.HRJ8EG_quickQueue{white-space:nowrap;flex-shrink:0;align-self:center;align-items:center;gap:6px;display:inline-flex;position:relative}.HRJ8EG_quickQueueToggle,.HRJ8EG_quickQueueButton{border:1px solid var(--dsw-alias-border-l1);min-height:24px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border-radius:999px;justify-content:center;align-items:center;gap:5px;padding:0 8px;font-size:11px;line-height:18px;display:inline-flex}.HRJ8EG_quickQueueToggle:hover,.HRJ8EG_quickQueueButton:hover:not(:disabled){border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}.HRJ8EG_quickQueueToggle[aria-checked=true]{border-color:color-mix(in srgb, var(--ds-blue) 45%, transparent);background:color-mix(in srgb, var(--ds-blue) 10%, transparent);color:var(--ds-blue)}.HRJ8EG_quickQueueButton:focus-visible,.HRJ8EG_quickQueueToggle:focus-visible,.HRJ8EG_quickQueueClear input:focus-visible{outline:2px solid var(--ds-blue);outline-offset:2px}.HRJ8EG_quickQueueButton:disabled{cursor:wait;opacity:.65}.HRJ8EG_quickQueueClear{color:var(--dsw-alias-label-tertiary);cursor:pointer;align-items:center;gap:4px;font-size:11px;display:inline-flex}.HRJ8EG_quickQueueClear input{width:13px;height:13px;accent-color:var(--ds-blue);margin:0}.HRJ8EG_quickQueueCount{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);min-width:16px;height:16px;color:var(--ds-blue);font-variant-numeric:tabular-nums;border-radius:999px;justify-content:center;align-items:center;padding:0 4px;font-size:10px;display:inline-flex}.HRJ8EG_quickQueueNotice{z-index:30;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-3);width:max-content;max-width:min(320px,75vw);color:var(--dsw-alias-label-primary);white-space:normal;pointer-events:none;border-radius:8px;padding:7px 10px;font-size:12px;line-height:18px;position:absolute;bottom:calc(100% + 8px);right:0;box-shadow:0 8px 24px #00000038}.HRJ8EG_quickQueueNotice[data-kind=error]{border-color:color-mix(in srgb, var(--ds-red) 45%, transparent);color:var(--ds-red)}`,document.head.appendChild(e)}var qa={quickQueue:`HRJ8EG_quickQueue`,quickQueueButton:`HRJ8EG_quickQueueButton`,quickQueueClear:`HRJ8EG_quickQueueClear`,quickQueueCount:`HRJ8EG_quickQueueCount`,quickQueueNotice:`HRJ8EG_quickQueueNotice`,quickQueueToggle:`HRJ8EG_quickQueueToggle`};let Ja=()=>void 0,Ya=()=>void 0;function Xa(e){return e.tasks.filter(e=>e.status===`queued`).length}function Za(){let[e,t]=(0,d.useState)(()=>tt());return(0,d.useEffect)(()=>{let e=()=>{t(tt())};return window.addEventListener(et,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(et,e),window.removeEventListener(`storage`,e)}},[]),e}function Qa(e){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)(()=>typeof document>`u`||!document.hidden),a=(0,d.useRef)(0),o=(0,d.useCallback)(e=>{a.current+=1,n(Xa(e))},[]);return(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{i(!document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]),(0,d.useEffect)(()=>{if(!e||!r){n(null);return}let t=!1,i=!1,o=()=>{if(i)return;i=!0;let e=a.current;aa().then(r=>{t||e!==a.current||n(r.supported?r.queuedCount:null)}).catch(()=>{}).finally(()=>{i=!1})};o();let s=window.setInterval(o,3e4);return()=>{t=!0,window.clearInterval(s)}},[e,r]),{count:t,applySnapshot:o}}function $a({t:e}){let t=Za();return t.showEntry?(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t.enabled,"aria-label":e(`quickQueueToggle`),className:y(qa.quickQueueToggle,Mr),"data-testid":`quick-queue-toggle`,onClick:()=>{nt({enabled:!t.enabled})},children:e(`quickQueueToggle`)}):null}function eo(e,t){let n=e(t),r=(0,d.useCallback)(e=>n?.subscribe(e)??(()=>{}),[n]),i=(0,d.useCallback)(()=>n?.getSnapshot(),[n]);return(0,d.useSyncExternalStore)(r,i,i)}function to({sessionId:e,t,useInput:n,inputActions:r,projectionFaceOf:i}){let a=Za(),o=(n??Ja)(e=>e),s=eo(i??Ya,`workingDirectory`),c=eo(i??Ya,`modelSelection`)?.next,{count:l,applySnapshot:u}=Qa(a.enabled&&a.showEntry),[f,p]=(0,d.useState)(!1),[h,g]=(0,d.useState)(null),_=(0,d.useRef)(!1),v=(0,d.useRef)(!0),b=(0,d.useRef)({sessionId:e,input:o});if(b.current={sessionId:e,input:o},(0,d.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,d.useEffect)(()=>{if(h===null)return;let e=h.kind===`success`?4e3:8e3,t=window.setTimeout(()=>{g(null)},e);return()=>{window.clearTimeout(t)}},[h]),!a.enabled||!a.showEntry)return null;let x=e=>{g({kind:`error`,text:e})},S=async()=>{if(_.current)return;if(g(null),o===void 0){x(t(`quickQueueUnsupported`));return}let n=o.draft;if(n.trim()===``){x(t(`quickQueueEmpty`));return}if(o.phase!==`plain`){x(t(`quickQueueBusy`));return}if(o.attachmentIds.length>0||o.occurrences.length>0){x(t(`quickQueueAttachments`));return}if(typeof s!=`string`||s===``){x(t(`quickQueueContext`));return}let i=a.clearAfterEnqueue;if(i&&r===void 0){x(t(`quickQueueUnsupported`));return}let l={sessionId:e,prompt:n,draftRev:o.draftRev,cwd:s,clearAfterEnqueue:i,reuseSource:a.reuseSourceSession};_.current=!0,p(!0);try{let e=await ia(!0);if(!e.supported){x(t(`quickQueueUnsupported`));return}let n=c??e.defaultModel;if(n==null){x(t(`quickQueueContext`));return}let i=e.workspaces.some(e=>e.path===l.cwd),a=e.models.some(e=>e.provider===n.provider&&e.id===n.model);if(!i||!a){x(t(`quickQueueRoute`));return}let o=await oa({action:`enqueue`,prompt:l.prompt,cwd:l.cwd,provider:n.provider,model:n.model,sourceSessionId:String(l.sessionId),reuseSource:l.reuseSource});u(o);let s=t(`quickQueueEnqueued`);if(l.clearAfterEnqueue&&r!==void 0){let e=b.current;if(v.current&&e.sessionId===l.sessionId&&e.input?.draft===l.prompt&&e.input.draftRev===l.draftRev&&e.input.phase===`plain`&&e.input.attachmentIds.length===0&&e.input.occurrences.length===0)try{r.setDraft(``)}catch{s=t(`quickQueueDraftChanged`)}else s=t(`quickQueueDraftChanged`)}v.current&&g({kind:`success`,text:s})}catch(e){if(!v.current)return;let n=e instanceof Error?e.message:String(e);x(t(`quickQueueFailed`).replace(`{message}`,n))}finally{_.current=!1,v.current&&p(!1)}};return(0,m.jsxs)(`span`,{className:y(qa.quickQueue,Mr),"data-testid":`quick-queue-controls`,children:[(0,m.jsxs)(`label`,{className:qa.quickQueueClear,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:a.clearAfterEnqueue,disabled:f,onChange:e=>{nt({clearAfterEnqueue:e.target.checked})}}),t(`quickQueueClear`)]}),(0,m.jsxs)(`button`,{type:`button`,className:qa.quickQueueButton,"aria-label":t(`quickQueueEnqueue`),"aria-busy":f,disabled:f,"data-testid":`quick-queue-enqueue`,onClick:()=>{S()},children:[t(f?`quickQueueEnqueueing`:`quickQueueEnqueue`),l!==null&&l>0&&(0,m.jsx)(`span`,{className:qa.quickQueueCount,"data-testid":`quick-queue-count`,"aria-label":t(`quickQueueWaiting`).replace(`{count}`,String(l)),children:l})]}),h!==null&&(0,m.jsx)(`span`,{className:qa.quickQueueNotice,"data-kind":h.kind,role:h.kind===`error`?`alert`:`status`,children:h.text})]})}function no(){let e,t,n=new Set;return{readCosts:()=>e,subscribeCosts:t=>(t(e),n.add(t),()=>{n.delete(t)}),openDashboard:()=>{t?.()},publishCosts:t=>{e=t;for(let e of n)try{e(t)}catch{x(`billing-costs-listener-threw`)}},registerOpen:e=>(t=e,()=>{t===e&&(t=void 0)})}}let ro={enabled:!1,timeout:0};function io(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...ro};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...ro}}}function ao(e){return e.completed===!0||e.running===!1}function oo(e,t){let n=new Set,r=new Set,i,a=e.getSnapshot();for(let e of a.ids){let t=a.byId[e];t!==void 0&&(r.add(String(e)),ao(t)&&n.add(String(e)))}let o=e=>{let{enabled:n,timeout:r}=t();if(n&&!(typeof Notification>`u`)&&Notification.permission===`granted`)try{let t=new Notification(e,{body:e,tag:`dsh-billing-completion`,requireInteraction:r===0});r>0&&(i!==void 0&&clearTimeout(i),i=setTimeout(()=>t.close(),r*1e3))}catch{x(`notification-constructor-failed`)}},s=e.subscribe(()=>{let t=e.getSnapshot(),i=[];for(let e of t.ids){let a=t.byId[e];if(a===void 0)continue;let o=String(e),s=ao(a),c=!r.has(o);c&&r.add(o),s&&!c&&!n.has(o)&&i.push(a.title??a.id??o),s?n.add(o):n.delete(o)}if(i.length>0){let e=i.length===1?i[0]:`${i.length} 个会话已完成`;e!==void 0&&o(e)}});return()=>{s(),i!==void 0&&clearTimeout(i)}}function so(e){let t=e.get(`uiWorkspace`);if(t!==void 0&&typeof t.openSession==`function`)return t}function co(e){let t=e.sessions,n=t?.open;return typeof n==`function`?n.bind(t):void 0}function lo(e){return{available:()=>so(e)!==void 0||co(e)!==void 0,open:t=>{let n=_(t),r=so(e);if(r!==void 0)try{return r.openSession(n),`opened`}catch(e){return x(`session-navigation-open-failed`,e),`failed`}let i=co(e);if(i!==void 0)try{return i(n),`opened`}catch(e){return x(`session-navigation-legacy-open-failed`,e),`failed`}return`unavailable`}}}function uo(e,t){let n=!1,r={name:`usage`,label:t.label,description:t.description,available:()=>!0,ui:{kind:`action`,run:()=>{t.openDashboard()}}};return e.inject([`commandUi`],e=>{e.effect(()=>{try{let t=e.commandUi.register(r);return n=!0,()=>{n=!1,t()}}catch(e){return x(`usage-command-register-failed`,e),()=>{}}},`ui-usage-billing: /usage command`)}),()=>n}let fo=[`slots`,`locale`,`remote`,`sessions`];function po(e){let t=no();e.provide(`billingMetrics`,t);let n=lr();e.effect(()=>e.locale.register(it,{zh:at,en:ot}),`ui-usage-billing: dictionaries`);let r=lo(e),i=uo(e,{openDashboard:()=>{t.openDashboard()},label:()=>Ie()===`en`?ot.commandUsageLabel:at.commandUsageLabel,description:()=>Ie()===`en`?ot.commandUsageDescription:at.commandUsageDescription});e.inject([`shortcuts`],e=>{e.effect(()=>{try{let n=e.shortcuts.register({id:`usage-billing.open-dashboard`,label:()=>Ie()===`en`?ot.shortcutOpenDashboard:at.shortcutOpenDashboard,aliases:[`usage`,`billing`,`dashboard`],defaults:{"desktop:macos":{code:`KeyU`,modifiers:[`primary`,`shift`]},"desktop:windows":{code:`KeyU`,modifiers:[`primary`,`shift`]},"desktop:linux":{code:`KeyU`,modifiers:[`primary`,`shift`]},"web:macos":{code:`KeyU`,modifiers:[`primary`,`shift`]},"web:windows":{code:`KeyU`,modifiers:[`primary`,`shift`]}},regions:[`page`,`editable`],modals:[],resolve:()=>({status:`handled`,run:()=>{t.openDashboard()}})});return()=>{n()}}catch(e){return x(`shortcut-register-failed`,e),()=>{}}},`ui-usage-billing: dashboard shortcut`)});let a=!1,o={store:n,inject:()=>({checkModels:async()=>{try{let[t,n]=await Promise.all([e.remote.llm.listProviders(),e.remote.llm.listConfigurableProviders()]);if(!t.ok||!n.ok)return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]};let r=new Map(n.value.map(e=>[e.provider,e])),i=await Promise.all(t.value.map(async t=>{let n=r.get(t.id);if(n===void 0)return{provider:t,models:[]};let i=await e.remote.llm.discoverModels(n.settingsNs,{provider:t.id});return i.ok?{provider:t,models:i.value}:{provider:t,failed:!0}})),a=[],o=[],s=[],c=0;for(let e of i){if(`failed`in e){s.push(e.provider.name);continue}o.push(e.provider.name),c+=e.models.length;for(let t of e.models)a.push({id:t.id,...typeof t.name==`string`&&t.name!==``?{name:t.name}:{},provider:e.provider.name})}return{checked:!0,available:o.length>0,models:c,failures:s.length,okProviders:o,badProviders:s,catalog:a}}catch{return{checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]}}},publishCosts:e=>{t.publishCosts(e)},registerOpen:e=>t.registerOpen(e),recoveryEntryAvailable:i()||a,navigateToSession:e=>r.open(e),sessionTitleOf:t=>{try{let n=e.sessions.list;if(n===void 0)return;let r=n.getSnapshot().byId?.[t],i=r?.displayTitle??r?.title;return typeof i==`string`&&i.trim()!==``?i:void 0}catch{return}}})};e.slots.inject(`settings.section`,()=>{a=!0;let t=e.slots.register({name:`settings.section`,id:`usage-billing`,order:30,label:()=>Ie()===`en`?ot.nativeSettingsNav:at.nativeSettingsNav,locale:it,...o},Aa);return()=>{a=!1,t()}}),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:it,...o,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}}},ka)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:it,inject:e=>({sessionId:_(e),seat:`below`})},Wa)),e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`usage-billing-cost-above`,order:100,locale:it,inject:e=>({sessionId:_(e),seat:`above`})},Wa)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:it,inject:e=>({sessionId:_(e)})},Ga)),e.slots.inject(`conversation.input.left`,()=>e.slots.register({name:`conversation.input.left`,id:`usage-billing-quick-queue-toggle`,order:20,locale:it},$a)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-quick-queue-enqueue`,order:20,locale:it,inject:t=>({sessionId:_(t),projectionFaceOf:n=>{try{return e.sessions.binding?.(_(t))?.session.projections.faceOf(n)}catch{return}}})},to)),e.effect(()=>oo(e.sessions.list,io),`ui-usage-billing: completion notifier`)}return n.UsageBilling=ka,n.apply=po,n.inject=fo,t.exports}});
|
|
1
|
+
window.__ModuleLoader__.load({id:`@kenz1117/dsh-ui-usage-billing`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},u=(e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule||!c.call(e,`default`)?i(n,`default`,{value:e,enumerable:!0}):n,e));let d=e("react"),f=e("react-dom"),p=e("@deepseek-ai/dsh-client-ui-primitives");p=u(p,1);let m=e("react/jsx-runtime"),h=e("@deepseek-ai/dsh-client-store");function g(e){return e}function _(e){return g(e)}function v(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=v(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function y(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=v(e))&&(r&&(r+=` `),r+=t);return r}let b=new Map;function x(e,t){let n=Date.now(),r=b.get(e);if(!(r!==void 0&&n-r<3e5)){if(b.set(e,n),t===void 0){console.info(`[usage-billing] swallowed: ${e}`);return}console.info(`[usage-billing] swallowed: ${e}`,t instanceof Error?t.message:t)}}function S(e,t){try{localStorage.setItem(e,t)}catch{x(`display-pref-write-failed`)}}function C(e){try{return localStorage.getItem(e)??void 0}catch{return}}function w(e){let t=C(e);if(t!==void 0)try{return JSON.parse(t)}catch{return}}let T={mode:`combined`,targets:[]},E=`dsh.ui-usage-billing.float`;function ee(){let e=()=>({...T,targets:[...T.targets]}),t=w(E);if(typeof t!=`object`||!t)return e();let n=t;return{mode:n.mode===`subscription`?`subscription`:`combined`,targets:Array.isArray(n.targets)?n.targets.filter(e=>typeof e==`string`):[]}}function te(e){S(E,JSON.stringify(e))}let D={mode:`full`,metric:`money`,span:`day`,showDelta:!0},O=`dsh.ui-usage-billing.card`,ne=`dsh.ui-usage-billing.card-changed`;function k(){let e=w(O);if(typeof e!=`object`||!e)return{...D};let t=e;return{mode:t.mode===`compact`||t.mode===`hidden`?t.mode:`full`,metric:t.metric===`tokens`?`tokens`:`money`,span:t.span===`week`||t.span===`month`?t.span:`day`,showDelta:t.showDelta!==!1}}function A(e){S(O,JSON.stringify(e))}function j(e){let t=t=>{t.key===`dsh.ui-usage-billing.card`&&e()};return window.addEventListener(ne,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(ne,e),window.removeEventListener(`storage`,t)}}function re(e,t){return e===`hidden`&&!t?`compact`:e}let ie=`dsh.ui-usage-billing.kpi-range`,ae=`dsh.ui-usage-billing.kpi-custom-range`;function oe(){let e=C(ie);return e===`today`||e===`7d`||e===`week`||e===`month`||e===`all`||e===`custom`?e:`all`}function se(e){S(ie,e)}function ce(){let e=new Date;e.setDate(e.getDate()-1);let t=e=>String(e).padStart(2,`0`),n=`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`;return{start:n,end:n}}function le(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=Number(e.slice(0,4)),n=Number(e.slice(5,7)),r=Number(e.slice(8,10));return t<1e3||n<1||n>12||r<1?!1:r<=new Date(t,n,0).getDate()}function ue(){let e=w(ae);if(typeof e==`object`&&e){let t=e;if(le(t.start)&&le(t.end)&&t.start<=t.end)return{start:t.start,end:t.end}}return ce()}function de(e){S(ae,JSON.stringify(e))}let fe={hideUnidentified:!0},pe=`dsh.ui-usage-billing.sites`;function me(){let e=w(pe);return typeof e!=`object`||!e?{...fe}:{hideUnidentified:e.hideUnidentified!==!1}}function he(e){S(pe,JSON.stringify(e))}let M={hidden:[]},ge=`dsh.ui-usage-billing.channels`;function _e(){let e=w(ge);if(typeof e!=`object`||!e)return{...M};let t=e.hidden;return Array.isArray(t)?{hidden:t.filter(e=>typeof e==`string`&&e!==``)}:{...M}}function ve(e){S(ge,JSON.stringify(e))}let ye={show:!0,position:`toolbar`},be=`dsh.ui-usage-billing.livecost`,xe=`dsh.ui-usage-billing.livecost-pref`;function Se(){let e=w(be);if(typeof e!=`object`||!e)return{...ye};let t=e;return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`||t.position===`below`?t.position:ye.position}}function Ce(e){S(be,JSON.stringify(e))}let we=`dsh.ui-usage-billing.currency`,Te=`dsh.ui-usage-billing.currency-pref`;function Ee(){let e=C(we);return e===`usd`||e===`cny`||e===`eur`?e:`cny`}function De(e){S(we,e)}let Oe=`dsh.ui-usage-billing.pinned`,ke=`dsh.ui-usage-billing.pinned-pref`;function Ae(){let e=w(Oe);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[]}function je(e){S(Oe,JSON.stringify(e))}let N=`dsh.ui-usage-billing.provider-expanded`;function Me(){let e=w(N);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&/^(ch|sub|bal):/.test(e)):[]}function Ne(e){S(N,JSON.stringify(e))}let P=`dsh.ui-usage-billing.providers-today`;function Pe(){return C(P)===`1`}function Fe(e){S(P,e?`1`:`0`)}let Ie=`dsh.ui-usage-billing.language`;function Le(){let e=C(Ie);if(e===`en`||e===`zh`)return e;let t=Ee()===`usd`?`en`:`zh`;return Re(t),t}function Re(e){S(Ie,e)}function ze(e){let t=Ae(),n=t.includes(e)?t.filter(t=>t!==e):[...t,e];return je(n),n}let Be=`dsh.ui-usage-billing.prices`;function Ve(){let e=w(Be);if(e==null)return[];let t=[],n=(e,n)=>{if(typeof n!=`object`||!n)return;let r=n,i=Number(r.input),a=Number(r.cacheHit),o=Number(r.output);if(![i,a,o].every(e=>Number.isFinite(e)&&e>=0))return;let s=r.offPeak,c;if(typeof s==`object`&&s){let e=s,t=Number(e.input),n=Number(e.cacheHit),r=Number(e.output);[t,n,r].every(e=>Number.isFinite(e)&&e>=0)&&(c={input:t,cacheHit:n,output:r})}t.push({key:e,...typeof r.origin==`string`&&r.origin!==``?{origin:r.origin}:{},input:i,cacheHit:a,output:o,...c===void 0?{}:{offPeak:c},...r.currency===`USD`?{currency:`USD`}:{}})};if(Array.isArray(e))for(let t of e){if(typeof t!=`object`||!t)continue;let e=t;typeof e.key==`string`&&e.key!==``&&n(e.key,t)}else if(typeof e==`object`)for(let[t,r]of Object.entries(e))n(t,r);return t}function He(e){S(Be,JSON.stringify(e))}let Ue={metric:`ttft`},We=`dsh.ui-usage-billing.perf`;function Ge(){let e=w(We);if(typeof e!=`object`||!e)return{...Ue};let t=e;return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}function Ke(e){S(We,JSON.stringify(e))}let qe=`dsh.ui-usage-billing.density`,F=`dsh.ui-usage-billing.density-pref`;function Je(){let e=C(qe);return e===`compact`||e===`comfortable`?e:`default`}function I(e){S(qe,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(F,{detail:{density:e}}))}let Ye=`dsh.ui-usage-billing.motion`,Xe=`dsh.ui-usage-billing.motion-pref`;function Ze(){let e=C(Ye);return e===`off`||e===`subtle`?e:`rich`}function Qe(e){S(Ye,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(Xe,{detail:{motion:e}}))}let $e={enabled:!1,clearAfterEnqueue:!1,showEntry:!0,reuseSourceSession:!1},et=`dsh.ui-usage-billing.quick-queue`,tt=`dsh.ui-usage-billing.quick-queue-pref`;function nt(){let e=w(et);if(typeof e!=`object`||!e)return{...$e};let t=e;return{enabled:t.enabled===!0,clearAfterEnqueue:t.clearAfterEnqueue===!0,showEntry:t.showEntry!==!1,reuseSourceSession:t.reuseSourceSession===!0}}function rt(e){S(et,JSON.stringify({...nt(),...e})),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(tt))}let it=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(it)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=it,e.textContent=`:root{--ds-blue:#4f8cff;--ds-cyan:#2dd4bf;--ds-green:#34d399;--ds-amber:#f59e0b;--ds-red:#ef4444;--ds-violet:#a78bfa;--ds-violet-soft:color-mix(in srgb, var(--ds-violet) 14%, transparent);--ds-violet-bg:color-mix(in srgb, var(--ds-violet) 8%, transparent);--ds-violet-strong:color-mix(in srgb, var(--ds-violet) 60%, transparent);--font-num:"JetBrains Mono", "SF Mono", "Menlo", "Consolas", ui-monospace, monospace;--mono:var(--font-num)}body{--dsb:var(--dsw-alias-bg-layer-1);--dsb-2:var(--dsw-alias-bg-layer-2);--dsb-3:var(--dsw-alias-bg-layer-3);--dsb-glass:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 78%,transparent);--dsb-glass-strong:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 88%,transparent);--ds-border:var(--dsw-alias-border-l1);--ds-border-strong:var(--dsw-alias-border-l2);--ds-hi-top:#ffffff0b;--ds-shadow-1:0 1px 0 #ffffff0a inset,0 8px 24px #00000059;--ds-shadow-2:0 1px 0 #ffffff0d inset,0 18px 48px #00000080;--ds-t-1:var(--dsw-alias-label-primary);--ds-t-2:var(--dsw-alias-label-secondary);--ds-t-3:var(--dsw-alias-label-tertiary);--ds-t-4:var(--dsw-alias-label-dimmed);--ds-c-1:#4f8cff;--ds-c-2:#2dd4bf;--ds-c-3:#a78bfa;--ds-c-4:#f59e0b;--ds-c-5:#f472b6;--ds-c-6:#fbbf24;--ds-c-7:#38bdf8;--ds-r-1:8px;--ds-r-2:12px;--ds-r-3:16px;--ds-t-fast:.16s cubic-bezier(.2,.8,.2,1);--ds-t-enter:.24s cubic-bezier(.2,.8,.2,1);--ds-t-pulse:1.2s cubic-bezier(.2,.8,.2,1);--ds-t-countup:.4s cubic-bezier(.22,1,.36,1);--ds-t-scan:.9s cubic-bezier(.2,.8,.2,1);--ds-density-pad-y:10px;--ds-density-pad-x:14px;--ds-density-row-h:32px;--ds-density-font:12px}[data-dsh-billing-density=compact]{--ds-density-pad-y:6px;--ds-density-pad-x:10px;--ds-density-row-h:26px;--ds-density-font:11.5px}[data-dsh-billing-density=comfortable]{--ds-density-pad-y:14px;--ds-density-pad-x:18px;--ds-density-row-h:40px;--ds-density-font:13px}[data-dsh-billing-density=compact] .KFXqYa_panel{padding:8px 10px}[data-dsh-billing-density=compact] .KFXqYa_kpiTile{padding:10px 12px}[data-dsh-billing-density=compact] .KFXqYa_setCard{padding:10px 12px}[data-dsh-billing-density=compact] .KFXqYa_ubCard{padding:10px 12px}[data-dsh-billing-density=compact] .KFXqYa_providerGroup{padding:8px 10px}[data-dsh-billing-density=compact] .KFXqYa_providerStatRow{gap:8px;padding:6px 8px}[data-dsh-billing-density=compact] .KFXqYa_modelTable th,[data-dsh-billing-density=compact] .KFXqYa_modelTable td{padding:6px 8px}[data-dsh-billing-density=compact] .KFXqYa_ubTable th,[data-dsh-billing-density=compact] .KFXqYa_ubTable td{padding:4px 7px}[data-dsh-billing-density=compact] .KFXqYa_dashboardBody{gap:10px;padding:12px 16px 16px}[data-dsh-billing-density=compact] .KFXqYa_tabNav{margin:10px 16px 0}[data-dsh-billing-density=compact] .KFXqYa_hero{gap:8px;padding:12px 14px}[data-dsh-billing-density=compact] .KFXqYa_heroValue{font-size:42px;line-height:46px}[data-dsh-billing-density=comfortable] .KFXqYa_panel{padding:16px 18px}[data-dsh-billing-density=comfortable] .KFXqYa_kpiTile{padding:18px 20px}[data-dsh-billing-density=comfortable] .KFXqYa_setCard{padding:20px 22px}[data-dsh-billing-density=comfortable] .KFXqYa_ubCard{padding:20px 22px}[data-dsh-billing-density=comfortable] .KFXqYa_providerGroup{padding:16px 18px}[data-dsh-billing-density=comfortable] .KFXqYa_providerStatRow{gap:14px;padding:14px 16px}[data-dsh-billing-density=comfortable] .KFXqYa_modelTable th,[data-dsh-billing-density=comfortable] .KFXqYa_modelTable td{padding:13px 14px}[data-dsh-billing-density=comfortable] .KFXqYa_ubTable th,[data-dsh-billing-density=comfortable] .KFXqYa_ubTable td{padding:10px 12px}[data-dsh-billing-density=comfortable] .KFXqYa_dashboardBody{gap:18px;padding:20px 28px 28px}[data-dsh-billing-density=comfortable] .KFXqYa_hero{gap:16px;padding:22px 24px}[data-dsh-billing-density=comfortable] .KFXqYa_heroValue{font-size:56px;line-height:60px}.KFXqYa_railButton{border:1px solid var(--ds-border);background:var(--dsb-2);width:36px;height:36px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast);border-radius:12px;flex:none;justify-content:center;align-items:center;padding:0;display:flex}.KFXqYa_railButton:hover,.KFXqYa_railButton:focus-visible{border-color:var(--ds-blue);color:var(--ds-blue);outline:none}.KFXqYa_railButton svg{width:26px;height:26px}.KFXqYa_triggerBudgetPulse{border-color:color-mix(in srgb, var(--ds-red) 55%, transparent);animation:2s ease-in-out infinite KFXqYa_budgetPulse}.KFXqYa_triggerBudgetOver{animation-duration:1.2s}@keyframes KFXqYa_budgetPulse{0%,to{box-shadow:0 1px 2px #0000000a,0 0 #ef444400}50%{box-shadow:0 1px 2px #0000000a,0 0 0 3px #ef444429}}.KFXqYa_trigger{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:100%;min-width:0;color:var(--ds-t-1);cursor:pointer;text-align:left;transition:border-color var(--ds-t-fast), transform var(--ds-t-fast), box-shadow var(--ds-t-fast);align-items:center;gap:12px;padding:10px 14px;display:flex;position:relative;overflow:hidden;box-shadow:0 1px 2px #0000000a}.KFXqYa_trigger:hover,.KFXqYa_trigger:focus-visible{border-color:var(--ds-border-strong);box-shadow:0 6px 18px -8px color-mix(in srgb, var(--ds-blue) 45%, transparent);outline:none;transform:translateY(-1px)}.KFXqYa_trigger:before{content:"";background:linear-gradient(180deg, var(--ds-hi-top), transparent);pointer-events:none;height:1px;position:absolute;top:0;left:0;right:0}.KFXqYa_trigger:after{content:"";background:linear-gradient(105deg, transparent 42%, color-mix(in srgb, var(--ds-blue) 9%, transparent) 50%, transparent 58%);opacity:0;pointer-events:none;position:absolute;inset:0;transform:translate(-110%)}.KFXqYa_trigger:hover:after,.KFXqYa_trigger:focus-visible:after{animation:.9s ease-out KFXqYa_triggerScan}@keyframes KFXqYa_triggerScan{0%{opacity:0;transform:translate(-110%)}25%{opacity:1}to{opacity:0;transform:translate(110%)}}@media (prefers-reduced-motion:reduce){.KFXqYa_triggerSparkBar,.KFXqYa_trigger:hover:after,.KFXqYa_trigger:focus-visible:after{animation:none}.KFXqYa_triggerGaugeNeedle,.KFXqYa_triggerGaugeArc{transition:none}.KFXqYa_triggerBudgetPulse,.KFXqYa_dashboardModal,.KFXqYa_tabPanel,.KFXqYa_peakAlertPop{animation:none}.KFXqYa_kpiTile,.KFXqYa_heroGaugeArc,.KFXqYa_chartLine,.KFXqYa_chartArea{transition:none;animation:none}}[data-dsh-billing-motion=off] .dsh-billing-root,[data-dsh-billing-motion=off] .dsh-billing-root *,[data-dsh-billing-motion=off] .dsh-billing-root :before,[data-dsh-billing-motion=off] .dsh-billing-root :after{transition:none!important;animation:none!important}[data-dsh-billing-motion=subtle] .dsh-billing-root,[data-dsh-billing-motion=subtle] .dsh-billing-root *,[data-dsh-billing-motion=subtle] .dsh-billing-root :before,[data-dsh-billing-motion=subtle] .dsh-billing-root :after{animation-duration:.001ms!important;animation-iteration-count:1!important}.KFXqYa_triggerIcon{width:32px;height:32px;color:var(--ds-blue);flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_triggerIcon svg{width:30px;height:30px}.KFXqYa_triggerGaugeNeedle{transition:transform 1.1s cubic-bezier(.22,1,.36,1)}.KFXqYa_triggerGaugeArc{transition:stroke-dasharray 1.1s cubic-bezier(.22,1,.36,1)}.KFXqYa_triggerBudgetHot,.KFXqYa_triggerStatsError{color:var(--ds-red)}.KFXqYa_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.KFXqYa_triggerPrimary{flex-direction:column;gap:1px;min-width:0;display:flex}.KFXqYa_triggerValueRow{align-items:baseline;gap:2px;min-width:0;display:flex}.KFXqYa_triggerLabel{color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.KFXqYa_triggerYen{color:var(--ds-t-3);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.KFXqYa_triggerMetric{color:var(--ds-t-1);font-size:22px;font-weight:600;line-height:26px;font-family:var(--font-num);font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.KFXqYa_triggerDelta{font-size:10px;font-weight:600;font-family:var(--font-num);font-variant-numeric:tabular-nums;border-radius:999px;flex:none;align-self:flex-start;align-items:center;gap:1px;padding:1px 5px;display:inline-flex}.KFXqYa_triggerDeltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 14%, transparent)}.KFXqYa_triggerDeltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 14%, transparent)}.KFXqYa_triggerGlow{background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--ds-blue) 40%, transparent), transparent);opacity:0;height:1px;animation:KFXqYa_triggerGlowPulse var(--ds-t-pulse) ease-out 1;position:absolute;bottom:4px;left:0;right:0}@keyframes KFXqYa_triggerGlowPulse{0%{opacity:0;transform:translate(-30%)}30%{opacity:1}to{opacity:0;transform:translate(30%)}}.KFXqYa_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.KFXqYa_triggerSparkBar,.KFXqYa_triggerSparkHot{background:var(--ds-blue);opacity:.6;border-radius:1px 1px 0 0;width:3px}.KFXqYa_triggerSparkHot{opacity:1}.KFXqYa_triggerSparkBar{animation:3.6s ease-in-out infinite KFXqYa_triggerSparkBreath}.KFXqYa_triggerSparkBar:nth-child(2n){animation-delay:-1.2s}.KFXqYa_triggerSparkBar:nth-child(3n){animation-delay:-2.4s}@keyframes KFXqYa_triggerSparkBreath{0%,to{opacity:.6}50%{opacity:.34}}.KFXqYa_triggerWrap{flex:auto;width:100%;min-width:96px;max-width:100%;display:block;position:relative;container:KFXqYa_billing-trigger/inline-size}@container KFXqYa_billing-trigger (width<=210px){.KFXqYa_trigger{box-shadow:none;-webkit-backdrop-filter:none;background:0 0;border:none;border-radius:12px;padding:7px 8px}.KFXqYa_trigger:before,.KFXqYa_trigger:after{display:none}.KFXqYa_trigger:hover,.KFXqYa_trigger:focus-visible{background:var(--dsw-alias-interactive-bg-hover);box-shadow:none;border-color:#0000;transform:none}.KFXqYa_triggerSpark,.KFXqYa_triggerLabel{display:none}}@container KFXqYa_billing-trigger (width<=140px){.KFXqYa_triggerMain{display:none}}.KFXqYa_triggerWrapShared{flex:none;width:36px;min-width:36px;max-width:36px;margin:4px 2px}.KFXqYa_triggerShared{border:1px solid var(--ds-border);background:var(--dsb-2);width:36px;height:36px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast);border-radius:12px;justify-content:center;align-items:center;padding:0;display:flex;position:relative}.KFXqYa_triggerShared:hover,.KFXqYa_triggerShared:focus-visible{border-color:var(--ds-blue);color:var(--ds-blue);outline:none}.KFXqYa_triggerShared .KFXqYa_triggerIcon{width:26px;height:26px}.KFXqYa_triggerShared .KFXqYa_triggerIcon svg{width:24px;height:24px}.KFXqYa_triggerPop{box-sizing:border-box;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:256px;box-shadow:var(--ds-shadow-2);opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear .16s;z-index:2000;flex-direction:column;gap:5px;padding:10px 12px;display:flex;position:fixed;top:0;left:0;overflow:hidden;transform:translateY(calc(4px - 100%))}.KFXqYa_triggerPop,.KFXqYa_triggerPop *{box-sizing:border-box}.KFXqYa_triggerPop:before{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.KFXqYa_triggerPopShown{opacity:1;visibility:visible;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear 0s;transform:translateY(-100%)}.KFXqYa_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.KFXqYa_popTitle{letter-spacing:.06em;text-transform:uppercase;color:var(--ds-t-3);font-size:12px;font-weight:700;line-height:18px}.KFXqYa_popError{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-red) 30%, transparent);border-radius:8px;flex-direction:column;gap:2px;margin:2px 0 8px;padding:6px 8px;font-size:11px;line-height:15px;display:flex}.KFXqYa_popErrorDetail{color:var(--ds-t-3);word-break:break-word}.KFXqYa_popErrorTitle{font-weight:600}.KFXqYa_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 12px;display:grid}.KFXqYa_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_metricLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.KFXqYa_metricValue{color:var(--ds-t-1);font-size:13px;font-weight:700;line-height:16px;font-family:var(--font-num);font-variant-numeric:tabular-nums;white-space:nowrap}.KFXqYa_metricValueSuccess{color:var(--ds-green)}.KFXqYa_popModel{border-top:1px dashed var(--ds-border);flex-direction:column;gap:6px;margin-top:9px;padding-top:10px;display:flex}.KFXqYa_popModelLabel{color:var(--ds-t-3);font-size:10px;line-height:14px}.KFXqYa_popModelRow{align-items:center;gap:8px;min-width:0;display:flex}.KFXqYa_popDot{border-radius:999px;flex:none;width:6px;height:6px}.KFXqYa_popDotDirect{background:var(--ds-green)}.KFXqYa_popDotSub{background:var(--ds-amber)}.KFXqYa_popDotNeutral{background:var(--ds-t-3)}.KFXqYa_popTagPrimary,.KFXqYa_popTagSub{white-space:nowrap;border-radius:5px;flex:none;align-items:center;height:18px;padding:0 6px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_popTagPrimary{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-blue)}.KFXqYa_popTagSub{background:color-mix(in srgb, var(--ds-amber) 18%, transparent);color:var(--ds-amber)}.KFXqYa_popModelName{color:var(--ds-t-2);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.KFXqYa_popModelStatus{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;margin-left:auto;font-size:11px;font-weight:600;line-height:16px}.KFXqYa_popModelStatusLow{color:var(--ds-red)}.KFXqYa_dashboardModal{border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-2);width:min(760px,100vw - 48px);height:min(760px,88vh);box-shadow:var(--ds-shadow-2);animation:.16s ease-out KFXqYa_dashboardIn}@keyframes KFXqYa_dashboardIn{0%{opacity:0;transform:translateY(4px)scale(.98)}to{opacity:1;transform:none}}div[role=presentation]:has(>.dsh-billing-modal)>div[aria-hidden=true]:first-child{backdrop-filter:blur(8px)saturate(1.25)}.KFXqYa_dashboard{flex-direction:column;width:100%;height:100%;min-height:0;display:flex}.KFXqYa_dashboardHead{border-bottom:1px solid var(--ds-border);border-bottom:1px solid var(--ds-border);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.KFXqYa_dashboardTitle{color:var(--ds-t-1);margin:0;font-size:14px;font-weight:600;line-height:20px}.KFXqYa_dashboardSubtitle{color:var(--ds-t-3);margin:2px 0 0;font-size:11px;line-height:16px}.KFXqYa_closeButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);width:32px;height:32px;color:var(--ds-t-2);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_closeButton:hover{background:var(--dsb-3);color:var(--ds-t-1)}.KFXqYa_closeButton svg{stroke-width:2px;width:16px;height:16px}.KFXqYa_dashboardBody{flex-direction:column;flex:auto;gap:14px;min-height:0;padding:16px 24px 24px;display:flex;overflow-y:auto}.KFXqYa_nativeSettingsRoot{width:100%;min-width:0}.KFXqYa_nativeSettingsDashboard{height:auto}.KFXqYa_dashboardBody.KFXqYa_nativeSettingsBody{flex:none;padding:0;overflow:visible}.KFXqYa_settingsLayout.KFXqYa_nativeSettingsLayout{grid-template-columns:minmax(0,1fr)}.KFXqYa_modalFooter{border-top:1px solid var(--ds-border);color:var(--ds-t-3);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 18px;font-size:11px;line-height:16px;display:flex}.KFXqYa_tabRail{background:var(--dsb);border:1px solid var(--ds-border);border-radius:var(--ds-r-2);flex-direction:column;align-self:start;gap:2px;max-height:min(720px,88vh - 80px);padding:6px;display:flex;position:sticky;top:0;overflow-y:auto}.KFXqYa_tabNav{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);align-items:center;gap:4px;margin:14px 24px 0;padding:4px;display:flex}.KFXqYa_tabButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast), box-shadow var(--ds-t-fast);background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;padding:6px 10px 6px 12px;font-size:12px;font-weight:500;line-height:16px;display:flex}.KFXqYa_tabButton:hover{color:var(--ds-t-2)}.KFXqYa_tabButton:focus-visible{box-shadow:0 0 0 1px var(--ds-border-strong);color:var(--ds-t-2);outline:none}.KFXqYa_tabButtonActive,.KFXqYa_tabButtonActive:hover,.KFXqYa_tabButtonActive:focus-visible{background:var(--dsb-3);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong) inset;font-weight:600}.KFXqYa_tabButton>.KFXqYa_tabRailIcon,.KFXqYa_tabButton>.KFXqYa_tabRailIcon svg{width:12px;height:12px}.KFXqYa_tabNavLabel{line-height:16px}.KFXqYa_tabRailItem{color:var(--ds-t-2);cursor:pointer;text-align:left;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:8px;align-items:center;gap:10px;padding:9px 12px;font-family:inherit;font-size:12.5px;display:flex;position:relative}.KFXqYa_tabRailItem:hover{background:var(--dsb-3);color:var(--ds-t-1)}.KFXqYa_tabRailItem:focus-visible{box-shadow:0 0 0 1.5px var(--ds-border-strong);outline:none}.KFXqYa_tabRailItemActive,.KFXqYa_tabRailItemActive:hover{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-t-1);font-weight:600}.KFXqYa_tabRailItemActive:before{content:"";background:var(--ds-blue);border-radius:0 2px 2px 0;width:2px;position:absolute;top:8px;bottom:8px;left:0}.KFXqYa_tabRailIcon{width:14px;height:14px;color:var(--ds-t-3);flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_tabRailItemActive .KFXqYa_tabRailIcon{color:var(--ds-blue)}.KFXqYa_tabRailIcon svg{width:14px;height:14px}.KFXqYa_tabRailLabel{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.KFXqYa_tabBadge{background:var(--dsb-3);color:var(--ds-t-3)}.KFXqYa_tabBadgeWarn{background:color-mix(in srgb, var(--ds-amber) 18%, transparent);color:var(--ds-amber)}.KFXqYa_tabBadgeHot{background:color-mix(in srgb, var(--ds-red) 18%, transparent);color:var(--ds-red)}.KFXqYa_tabBadgeViolet{background:var(--ds-violet-soft);color:var(--ds-violet)}.KFXqYa_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out KFXqYa_tabPanelIn;display:flex}.KFXqYa_dashboardBody>*,.KFXqYa_tabPanel>*,.KFXqYa_agentSummary,.KFXqYa_agentRow{flex-shrink:0}@keyframes KFXqYa_tabPanelIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.KFXqYa_reconcileNotice{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 78%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 62%, transparent);color:var(--dsw-alias-label-secondary);border-radius:10px;align-items:flex-start;gap:10px;padding:10px 12px;font-size:12px;line-height:1.55;display:flex}.KFXqYa_reconcileIcon{color:var(--dsw-alias-label-tertiary);flex:none;margin-top:1px;display:inline-flex}.KFXqYa_reconcileText{flex:1}.KFXqYa_reconcileDismiss{color:var(--dsw-alias-label-tertiary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 8px;font-size:12px;line-height:1.4;transition:color .15s,background-color .15s}.KFXqYa_reconcileDismiss:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.KFXqYa_hero{border:1px solid var(--ds-border);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);flex-direction:column;gap:12px;padding:18px 20px;display:flex;position:relative;overflow:hidden}.KFXqYa_hero:after{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.KFXqYa_heroTop{justify-content:space-between;align-items:center;gap:24px;display:flex}.KFXqYa_heroMain{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_heroLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:11px;font-weight:500;line-height:15px}.KFXqYa_heroReadout{align-items:baseline;gap:4px;display:flex}.KFXqYa_heroCurrency{font-family:var(--font-num);letter-spacing:-.01em;color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:22px;font-weight:600;line-height:26px}.KFXqYa_heroValue{font-family:var(--font-num);letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--ds-t-1);font-size:52px;font-weight:600;line-height:56px}.KFXqYa_heroMeta{color:var(--ds-t-2);white-space:nowrap;margin-top:2px;font-size:12px;line-height:16px}.KFXqYa_heroGauge{flex-direction:column;flex:none;align-items:center;gap:4px;width:96px;display:flex}.KFXqYa_heroGaugeDial{flex:none;width:96px;height:96px;position:relative}.KFXqYa_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.KFXqYa_heroGaugeTrack{fill:none;stroke:var(--dsb-3);stroke-width:7px}.KFXqYa_heroGaugeArc{fill:none;stroke:var(--ds-blue);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray var(--ds-t-fast)}.KFXqYa_heroGaugeArcOver{stroke:var(--ds-red)}.KFXqYa_heroPred{color:var(--ds-t-3);font-size:11px;font-family:var(--font-num);margin-left:8px}.KFXqYa_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.KFXqYa_heroGaugeRemain{font-family:var(--font-num);letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--ds-t-1);font-size:16px;font-weight:600;line-height:18px}.KFXqYa_heroGaugeRemainOver{color:var(--ds-red)}.KFXqYa_heroGaugeLabel{color:var(--ds-t-3);font-size:11px;line-height:13px}.KFXqYa_heroGaugeSub{font-family:var(--font-num);font-variant-numeric:tabular-nums;color:var(--ds-t-2);white-space:nowrap;font-size:10px;line-height:12px}.KFXqYa_heroSide{border-top:1px solid var(--ds-border);align-items:stretch;padding-top:12px;display:flex}.KFXqYa_heroSideItem{border-left:1px solid var(--ds-border);flex-direction:column;flex:1;gap:2px;min-width:0;padding-left:14px;display:flex}.KFXqYa_heroSideItem:first-child{border-left:none;padding-left:0}.KFXqYa_heroSideLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:13px}.KFXqYa_heroSideValue{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;white-space:nowrap;align-items:baseline;gap:6px;font-size:15px;font-weight:600;line-height:20px;display:inline-flex}.KFXqYa_heroSideSpacer{flex:1;display:block}.KFXqYa_delta{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:2px;margin-left:6px;padding:1px 7px;font-size:10.5px;font-weight:600;line-height:16px;display:inline-flex}.KFXqYa_deltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.KFXqYa_deltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_unpricedHint{border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);background:color-mix(in srgb, var(--ds-amber) 8%, transparent);color:var(--ds-amber);border-radius:8px;align-items:center;gap:8px;padding:8px 12px;font-size:11.5px;font-weight:500;line-height:17px;display:flex}.KFXqYa_unpricedHintBody{flex:1;min-width:0}.KFXqYa_channelVisList{flex-direction:column;gap:6px;display:flex}.KFXqYa_channelVisCell{grid-column:1/-1}.KFXqYa_channelVisRow{align-items:center;gap:8px;min-width:0;display:flex}.KFXqYa_channelVisName{overflow-wrap:anywhere;flex:auto;min-width:0;font-size:12px;line-height:16px}.KFXqYa_channelVisUsage{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px}.KFXqYa_noticeAction{border:1px solid color-mix(in srgb, currentColor 35%, transparent);color:inherit;font:inherit;cursor:pointer;transition:background-color var(--ds-t-fast);background:0 0;border-radius:6px;flex:none;padding:1px 8px;font-size:11px;line-height:15px}.KFXqYa_noticeAction:hover,.KFXqYa_noticeAction:focus-visible{background:color-mix(in srgb, currentColor 12%, transparent);outline:none}.KFXqYa_noticeDismiss{width:18px;height:18px;color:inherit;opacity:.55;cursor:pointer;transition:opacity var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border:0;border-radius:999px;flex:none;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.KFXqYa_noticeDismiss:hover,.KFXqYa_noticeDismiss:focus-visible{opacity:1;background:color-mix(in srgb, currentColor 14%, transparent);outline:none}.KFXqYa_kpiZone{flex-direction:column;gap:8px;display:flex}.KFXqYa_kpiZoneHead{justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_kpiZoneLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.KFXqYa_kpiCustomRange{flex-wrap:wrap;flex-shrink:0;justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_kpiCustomRange label{color:var(--ds-t-3);align-items:center;gap:6px;font-size:11px;line-height:14px;display:inline-flex}.KFXqYa_kpiCustomRange input{border:1px solid var(--ds-border);background:var(--dsb-glass);min-height:28px;color:var(--ds-t-1);color-scheme:light dark;font:inherit;font-family:var(--font-num);border-radius:6px;padding:3px 7px;font-size:11px}.KFXqYa_kpiCustomRange input:focus-visible{outline:2px solid var(--ds-blue);outline-offset:2px}.KFXqYa_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.KFXqYa_kpiTile{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:2px;padding:14px 16px;display:flex;position:relative;overflow:hidden}.KFXqYa_kpiTile:hover{border-color:var(--ds-border-strong)}.KFXqYa_kpiLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:500;line-height:14px}.KFXqYa_kpiValue{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;margin-top:6px;font-size:22px;font-weight:600;line-height:26px}.KFXqYa_kpiGreen{color:var(--ds-green)}.KFXqYa_kpiDetail{font-family:var(--font-num);color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;font-size:11px;line-height:15px;overflow:hidden}.KFXqYa_kpiLabelRow{justify-content:space-between;align-items:center;gap:6px;display:flex}.KFXqYa_kpiDelta{font-size:10px;font-weight:600;font-family:var(--font-num);font-variant-numeric:tabular-nums;border-radius:999px;flex:none;align-items:center;gap:2px;padding:1px 5px;display:inline-flex}.KFXqYa_kpiDeltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 14%, transparent)}.KFXqYa_kpiDeltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 14%, transparent)}.KFXqYa_kpiDeltaFlat{color:var(--ds-t-3);background:var(--dsb-3)}.KFXqYa_kpiSpark{height:12px;margin-top:4px}.KFXqYa_panel{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:8px;padding:12px 14px;display:flex}.KFXqYa_panelHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.KFXqYa_panelHeadControls{align-items:center;gap:8px;display:inline-flex}.KFXqYa_panelTitle{letter-spacing:-.005em;color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:20px}.KFXqYa_panelHint{color:var(--ds-t-3);white-space:nowrap;font-size:11px;line-height:16px}.KFXqYa_rangeToggle{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:8px;gap:2px;padding:2px;display:inline-flex}.KFXqYa_rangeButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:11px;line-height:16px}.KFXqYa_rangeButtonActive{background:var(--dsb-2);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.KFXqYa_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_exportLabel{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_exportButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;padding:4px 12px;font-size:11.5px;line-height:16px}.KFXqYa_exportButton:hover,.KFXqYa_exportButton:focus-visible{border-color:var(--ds-border-strong);color:var(--ds-t-1);outline:none}.KFXqYa_exportButton:disabled{opacity:.45;cursor:not-allowed}.KFXqYa_exportButton:disabled:hover{border-color:var(--ds-border);color:var(--ds-t-2)}.KFXqYa_shareTrack{background:var(--dsb-3);border-radius:4px;height:8px;display:flex;overflow:hidden}.KFXqYa_shareSeg{height:100%;transition:width var(--ds-t-fast)}.KFXqYa_shareSegPeak{background:var(--ds-blue)}.KFXqYa_shareSegOff{background:color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))}.KFXqYa_shareSegUser{background:var(--ds-blue)}.KFXqYa_shareSegAssistant{background:var(--ds-green)}.KFXqYa_shareSegTool{background:var(--ds-amber)}.KFXqYa_shareLegend{align-items:center;gap:16px;display:flex}.KFXqYa_shareItem{color:var(--ds-t-2);align-items:baseline;gap:6px;font-size:11px;line-height:17px;display:inline-flex}.KFXqYa_bucketCost{font-variant-numeric:tabular-nums;align-items:baseline;gap:3px;display:inline-flex}.KFXqYa_bucketOfficial{color:var(--ds-blue);font-weight:600}.KFXqYa_bucketSep{color:var(--ds-t-4)}.KFXqYa_bucketThird{color:var(--ds-t-2)}.KFXqYa_shareDot{border-radius:2px;flex:none;align-self:center;width:8px;height:8px}.KFXqYa_shareValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_budgetInput{width:64px;color:var(--ds-t-1);font-variant-numeric:tabular-nums;text-align:right;background:0 0;border:none;padding:0;font-size:12px;line-height:16px}.KFXqYa_budgetInput:focus-visible{outline:none}.KFXqYa_switch{border:1px solid var(--ds-border-strong);background:color-mix(in srgb, var(--ds-t-1) 10%, var(--dsb-3));cursor:pointer;width:32px;height:18px;transition:background-color var(--ds-t-fast), border-color var(--ds-t-fast);border-radius:999px;flex:none;padding:0;position:relative}.KFXqYa_switchOn{background:var(--ds-blue);border-color:#0000}.KFXqYa_switchKnob{width:12px;height:12px;box-shadow:0 0 0 1px var(--ds-border-strong);transition:transform var(--ds-t-fast);background:#fff;border-radius:50%;position:absolute;top:2px;left:2px}.KFXqYa_switchOn .KFXqYa_switchKnob{transform:translate(14px)}.KFXqYa_budgetFillWarn{background:var(--ds-amber)}.KFXqYa_budgetFillOver{background:var(--ds-red)}.KFXqYa_chartWrap{width:100%;position:relative}.KFXqYa_chartSvg{width:100%;height:auto;display:block}.KFXqYa_chartEmpty{height:140px;color:var(--ds-t-3);justify-content:center;align-items:center;font-size:13px;display:flex}.KFXqYa_emptyRow{text-align:center;color:var(--ds-t-3);padding:28px 0;font-size:13px}.KFXqYa_emptyState{border:1px dashed var(--ds-border);border-radius:var(--ds-r-2);background:color-mix(in srgb, var(--dsb-2) 50%, transparent);text-align:center;flex-direction:column;align-items:center;gap:10px;padding:32px 24px;display:flex}.KFXqYa_emptyIll{width:96px;height:64px;display:inline-block;position:relative}.KFXqYa_emptyIll svg{width:100%;height:100%;display:block}.KFXqYa_emptyIllDot{background:var(--ds-blue);border-radius:50%;width:6px;height:6px;animation:2s ease-in-out infinite KFXqYa_emptyDotPulse;position:absolute;bottom:8px;right:14px}@keyframes KFXqYa_emptyDotPulse{0%,to{box-shadow:0 0 0 4px color-mix(in srgb, var(--ds-blue) 20%, transparent)}50%{box-shadow:0 0 0 10px color-mix(in srgb, var(--ds-blue) 0%, transparent)}}.KFXqYa_emptyTitle{color:var(--ds-t-1);font-size:13px;font-weight:500}.KFXqYa_emptyDesc{color:var(--ds-t-3);max-width:320px;font-size:11.5px;line-height:1.5}.KFXqYa_chartGrid{stroke:var(--ds-border);stroke-width:1px}.KFXqYa_chartAxisLabel{fill:var(--ds-t-3);font-size:10px}.KFXqYa_chartBar{fill:var(--ds-blue);opacity:.7}.KFXqYa_chartBar:hover{opacity:1}.KFXqYa_chartStack{stroke:var(--dsb);stroke-width:.75px}.KFXqYa_chartStack:hover{opacity:.9}.KFXqYa_chartLine{stroke:var(--ds-blue);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.KFXqYa_chartCrosshair{stroke:var(--ds-t-4);stroke-width:1px;stroke-dasharray:3 3}.KFXqYa_chartTooltip{pointer-events:none;z-index:2;border:1px solid var(--ds-border-strong);background:var(--dsb-2);box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;padding:8px 10px;position:absolute;transform:translate(-50%,calc(-100% - 10px))}.KFXqYa_chartTooltipAlignRight{transform:translate(calc(-100% - 8px),calc(-100% - 10px))}.KFXqYa_chartTooltipAlignLeft{transform:translate(8px,calc(-100% - 10px))}.KFXqYa_chartTooltipDate{color:var(--ds-t-1);margin-bottom:3px;font-size:11px;font-weight:600}.KFXqYa_chartTooltipRow{color:var(--ds-t-2);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.KFXqYa_chartTooltipRow strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_chartTooltipHead{justify-content:space-between;align-items:baseline;gap:14px;margin-bottom:3px;display:flex}.KFXqYa_chartTooltipHead .KFXqYa_chartTooltipDate{margin-bottom:0}.KFXqYa_chartTooltipHead strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:11px;font-weight:600}.KFXqYa_chartTooltipSplit{justify-content:space-between;gap:14px}.KFXqYa_chartTooltipLabel{align-items:center;gap:5px;display:flex}.KFXqYa_chartTooltipModelDetail{color:var(--ds-t-3);font-variant-numeric:tabular-nums;margin:-2px 0 4px 13px;font-size:10.5px;line-height:14px}.KFXqYa_chartBarPlaceholder{fill:color-mix(in srgb, var(--ds-t-2) 30%, transparent)}.KFXqYa_chartLegendLine{background:var(--ds-blue);border-radius:2px;width:10px;height:3px;display:inline-block}.KFXqYa_chartLegendBar{background:var(--ds-blue);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.KFXqYa_chartTooltipSwatch{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartLegend{color:var(--ds-t-2);justify-content:flex-end;gap:14px;margin-top:2px;font-size:11px;display:flex}.KFXqYa_chartLegend span{align-items:center;gap:5px;display:inline-flex}.KFXqYa_chartLegendItem{font:inherit;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:5px;padding:0;transition:color .12s;display:inline-flex}.KFXqYa_chartLegendItem:hover{color:var(--ds-t-1)}.KFXqYa_chartLegendItemActive{color:var(--ds-t-1);font-weight:600}.KFXqYa_perfHero{grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:12px;display:grid;container:KFXqYa_billing-perf/inline-size}.KFXqYa_perfHeroCell{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-glass);padding:12px 14px}.KFXqYa_perfHeroLbl{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px;font-weight:500}.KFXqYa_perfHeroVal{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;margin-top:4px;font-size:22px;font-weight:600;line-height:1.15}.KFXqYa_perfHeroUnit{color:var(--ds-t-3);margin-left:3px;font-size:11px;font-weight:500}.KFXqYa_perfHeroBar{background:var(--dsb-3);border-radius:2px;height:4px;margin-top:6px;position:relative;overflow:hidden}.KFXqYa_perfHeroBar i{height:100%;transition:width var(--ds-t-fast);border-radius:2px;display:block}@container KFXqYa_billing-perf (width<=480px){.KFXqYa_perfHero{grid-template-columns:1fr 1fr}}.KFXqYa_perfCompareList{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-glass);margin-top:10px;overflow:hidden}.KFXqYa_perfCompareRow{border-bottom:1px solid var(--ds-border);grid-template-columns:1fr 80px 56px 56px;align-items:center;gap:12px;padding:8px 12px;font-size:12px;display:grid}.KFXqYa_perfCompareRow:last-child{border-bottom:0}.KFXqYa_perfCompareName{text-overflow:ellipsis;white-space:nowrap;align-items:center;gap:8px;min-width:0;font-weight:500;display:inline-flex;overflow:hidden}.KFXqYa_perfCompareDot{border-radius:2px;flex:none;width:8px;height:8px}.KFXqYa_perfCompareBar{background:var(--dsb-3);border-radius:3px;height:6px;position:relative;overflow:hidden}.KFXqYa_perfCompareBar i{height:100%;transition:width var(--ds-t-fast);border-radius:3px;display:block}.KFXqYa_perfCompareNum{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;text-align:right;font-size:11.5px;font-weight:600}.KFXqYa_perfBar{align-items:center;margin:10px 0 2px;display:flex}.KFXqYa_perfChips{flex-wrap:wrap;gap:6px;margin:6px 0 2px;display:flex}.KFXqYa_perfChip{border:1px solid var(--ds-border);background:var(--dsb-3);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), opacity var(--ds-t-fast);border-radius:999px;align-items:center;gap:5px;padding:2px 9px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_perfChip:hover{color:var(--ds-t-1)}.KFXqYa_perfChipOff{opacity:.45}.KFXqYa_perfChipDot{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartHoverDot{stroke:var(--dsb-2);stroke-width:1.5px}.KFXqYa_tableScroll{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);overflow:auto}.KFXqYa_ubAlert{border:1px solid color-mix(in srgb, var(--ds-blue) 30%, transparent);border-radius:var(--ds-r-1);background:color-mix(in srgb, var(--ds-blue) 8%, transparent);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12px;line-height:17px;display:flex}.KFXqYa_ubAlertLeft{align-items:center;gap:8px;display:inline-flex}.KFXqYa_ubRate{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_ubAlertNote{color:var(--ds-t-2);margin:0}.KFXqYa_ubTag,.KFXqYa_ubTagSuccess,.KFXqYa_ubTagNeutral,.KFXqYa_ubTagAlert,.KFXqYa_ubTagPromo{border:1px solid var(--ds-border-strong);white-space:nowrap;border-radius:999px;align-items:center;gap:4px;padding:1px 5px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_ubTag{color:var(--ds-t-2);background:var(--dsb-2)}.KFXqYa_ubTagSuccess{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.KFXqYa_ubTagNeutral{color:var(--ds-t-2);background:var(--dsb-2)}.KFXqYa_ubTagAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 36%, transparent);background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.KFXqYa_ubTagPromo{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent);cursor:help}.KFXqYa_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.KFXqYa_ubExtraName{color:var(--ds-t-2);margin-left:26px}.KFXqYa_ubExtraNote{color:var(--ds-t-3);margin-left:8px;font-size:10px}.KFXqYa_ubCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.KFXqYa_ubCardHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.KFXqYa_ubCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_ubCardSub{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_ubTablewrap{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);overflow:auto}.KFXqYa_ubTablewrapPricing{overscroll-behavior:contain;max-height:min(56vh,520px)}.KFXqYa_ubTablewrapPricing .KFXqYa_ubTable thead th{z-index:1;background:var(--dsb-3);box-shadow:inset 0 -1px 0 var(--ds-border);position:sticky;top:0}.KFXqYa_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12px}.KFXqYa_ubTable th,.KFXqYa_ubTable td{border-bottom:1px solid var(--ds-border);text-align:left;color:var(--ds-t-1);padding:7px 9px}.KFXqYa_ubSearch{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);width:200px;max-width:45%;color:var(--ds-t-1);background:0 0;outline:none;align-self:center;margin-left:auto;padding:5px 9px;font-size:12px;line-height:18px}.KFXqYa_bandDots{flex:none;align-items:center;gap:5px;display:inline-flex}.KFXqYa_bandDot{cursor:pointer;background:0 0;border:1.5px solid;border-radius:999px;flex:none;width:9px;height:9px;padding:0}.KFXqYa_bandDotOn{background:currentColor}.KFXqYa_offPeak{color:var(--ds-blue)}.KFXqYa_soon{color:var(--ds-amber)}.KFXqYa_peak{color:var(--ds-red)}span.KFXqYa_bandDot{cursor:default}.KFXqYa_ubTable th,.KFXqYa_ubTable td:first-child{white-space:normal}.KFXqYa_ubTable tbody tr:last-child td{border-bottom:0}.KFXqYa_ubTable thead th,.KFXqYa_ubTable thead th.KFXqYa_numCol{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;text-align:center;padding:6px 9px;font-size:11px;font-weight:500}.KFXqYa_ubModel{align-items:center;gap:6px;display:inline-flex}.KFXqYa_ubModelName{color:var(--ds-t-1);align-items:center;gap:4px;font-weight:500;display:inline-flex}.KFXqYa_ubChipPeak,.KFXqYa_ubChipOff{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:4px;height:18px;padding:0 6px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_ubChipLabel{font-size:10px;font-weight:600}.KFXqYa_ubChipPeak{background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue)}.KFXqYa_ubChipOff{background:color-mix(in srgb, var(--ds-green) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green)}.KFXqYa_ubNotes{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.KFXqYa_ubNotesItem{align-items:baseline;gap:10px;display:flex}.KFXqYa_ubNotesTerm{color:var(--ds-t-1);flex:0 0 72px;font-size:12px;font-weight:500}.KFXqYa_ubNotesDesc{min-width:0;color:var(--ds-t-2);flex:1;font-size:12px;line-height:17px}.KFXqYa_ubCardControlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.KFXqYa_ubTagError{white-space:nowrap;background:color-mix(in srgb, var(--ds-red) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-red) 36%, transparent);height:18px;color:var(--ds-red);border-radius:999px;align-items:center;padding:0 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_modelTable{border-collapse:collapse;table-layout:fixed;width:100%;min-width:640px;font-size:12px}.KFXqYa_modelTable th:first-child{width:26%}.KFXqYa_modelTable th,.KFXqYa_modelTable td{border-bottom:1px solid var(--ds-border);text-align:left;white-space:nowrap;color:var(--ds-t-1);padding:10px 12px}.KFXqYa_modelTable tbody tr:last-child td{border-bottom:0}.KFXqYa_sessionGroupRow{cursor:pointer}.KFXqYa_sessionGroupRow .KFXqYa_modelName:before{content:"›";color:var(--ds-t-3);margin-right:6px;display:inline-block}.KFXqYa_sessionGroupRow[aria-expanded=true] .KFXqYa_modelName:before{transform:rotate(90deg)}.KFXqYa_sessionGroupRow:focus-visible{outline:2px solid var(--ds-border-strong);outline-offset:-2px}.KFXqYa_sessionChildRow td:first-child{padding-left:30px}.KFXqYa_sessionSubDeepRow td:first-child{padding-left:46px}.KFXqYa_modelTable thead th{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;background:0 0;padding:8px 12px;font-size:11px;font-weight:500}.KFXqYa_modelTable tbody tr{transition:background-color .12s}.KFXqYa_modelTable tbody tr:hover{background:0 0}.KFXqYa_modelTable tbody tr.KFXqYa_modelRowFocusable{cursor:pointer}.KFXqYa_modelTable tbody tr.KFXqYa_modelRowActive,.KFXqYa_modelTable tbody tr.KFXqYa_modelRowActive:hover{background:color-mix(in srgb, var(--ds-blue) 10%, transparent)}.KFXqYa_numCol{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}.KFXqYa_modelTable .KFXqYa_numCol,.KFXqYa_ubTable .KFXqYa_numCol{text-align:right}.KFXqYa_na{color:var(--ds-t-4)}.KFXqYa_unknownHint{color:var(--ds-t-4);margin:0 0 8px;font-size:12px;line-height:18px}.KFXqYa_modelCell{align-items:center;gap:8px;display:inline-flex}.KFXqYa_modelDot{border-radius:2px;flex:none;width:8px;height:8px}.KFXqYa_modelName{color:var(--ds-t-1);font-weight:500;line-height:16px;display:block}.KFXqYa_modelProvider{color:var(--ds-t-3);font-size:10.5px;line-height:14px;display:block}.KFXqYa_modelChannels{flex-wrap:wrap;gap:4px;margin-top:2px;display:flex}.KFXqYa_modelChannelTag{text-overflow:ellipsis;white-space:nowrap;border:1px solid var(--ds-border);max-width:220px;color:var(--ds-t-3);border-radius:4px;padding:0 5px;font-size:10px;line-height:14px;display:inline-block;overflow:hidden}.KFXqYa_siteRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);justify-content:space-between;align-items:center;gap:12px;padding:8px 10px;display:flex}.KFXqYa_siteRowName{align-items:center;gap:8px;min-width:0;display:inline-flex}.KFXqYa_siteKindTag{white-space:nowrap;border:1px solid #0000;border-radius:999px;flex:none;align-items:center;padding:2px 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_siteKindSite{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 36%, transparent);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.KFXqYa_siteKindDirect{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.KFXqYa_siteKindUnknown{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_siteRowTitle{color:var(--ds-t-1);text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.KFXqYa_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_siteRowCost{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:600;line-height:18px}.KFXqYa_siteRowCalls{color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.KFXqYa_siteRowCallsLow{color:var(--ds-red)}.KFXqYa_flatTag{color:var(--ds-t-3);font-size:10.5px;line-height:14px}.KFXqYa_healthDot{border-radius:50%;flex:none;width:6px;height:6px;display:inline-block}.KFXqYa_healthOk{background:var(--ds-green);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-green) 18%, transparent)}.KFXqYa_healthBad{background:var(--ds-red);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-red) 18%, transparent), 0 0 0 1px var(--ds-red) inset}.KFXqYa_healthIdle{border:1.5px solid var(--ds-t-4);background:0 0}.KFXqYa_dashboardRight{align-items:center;gap:8px;min-width:0;display:flex}.KFXqYa_healthBadge{white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_healthBadgeOk{color:var(--ds-green);background:var(--dsb-2)}.KFXqYa_healthBadgeBad{color:var(--ds-red);background:var(--dsb-2)}.KFXqYa_planTag{color:var(--ds-green);white-space:nowrap;align-items:center;gap:4px;font-size:10px;font-weight:500;line-height:14px;display:inline-flex}.KFXqYa_planTagBadge{background:color-mix(in srgb, var(--ds-green) 20%, transparent);border-radius:4px;padding:0 4px;font-size:9px;line-height:12px}.KFXqYa_uncataloguedTag{border:1px solid color-mix(in srgb, var(--ds-amber) 36%, transparent);vertical-align:1px;color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.KFXqYa_estimatedTag{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);vertical-align:1px;color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.KFXqYa_feeBar{color:var(--ds-t-2);font-size:11px;line-height:16px;font-family:var(--font-num);font-variant-numeric:tabular-nums;flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.KFXqYa_feeBarAbove{align-self:center}.KFXqYa_feeInline{font-variant-numeric:tabular-nums;white-space:nowrap;cursor:default;border-radius:999px;align-self:center;align-items:center;gap:5px;height:22px;padding:0 4px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_feeInlineNum{color:var(--ds-t-1);padding-right:6px;font-weight:600}.KFXqYa_feeInlineAlert{background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.KFXqYa_feeInlineAlert .KFXqYa_feeInlineNum{color:var(--ds-amber)}.KFXqYa_feeInlineError{background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_feeInlineError .KFXqYa_feeInlineNum{color:var(--ds-red)}.KFXqYa_feeBar .KFXqYa_feeSep{color:var(--ds-t-4)}.KFXqYa_feeCount{color:var(--ds-t-1);font-weight:600}.KFXqYa_feeSuffix{color:var(--ds-t-3)}.KFXqYa_feeItem{color:var(--ds-t-2);white-space:nowrap}.KFXqYa_feeNum{color:var(--ds-t-1);font-weight:600}.KFXqYa_feeNum[data-tick]{animation:KFXqYa_feeTickFlash var(--ds-t-pulse) ease-out 1}@keyframes KFXqYa_feeTickFlash{0%{text-shadow:0 0 0 color-mix(in srgb, var(--ds-blue) 0%, transparent)}30%{text-shadow:0 0 8px color-mix(in srgb, var(--ds-blue) 60%, transparent)}to{text-shadow:0 0 0 color-mix(in srgb, var(--ds-blue) 0%, transparent)}}.KFXqYa_feeSep{color:var(--ds-t-4)}.KFXqYa_feeChipPrimary,.KFXqYa_feeChipOff,.KFXqYa_feeChipAlert,.KFXqYa_feeChipError{background:var(--dsb-3);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:4px;align-items:center;height:18px;padding:0 6px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_feeChipPrimary{color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.KFXqYa_feeChipOff{color:var(--ds-cyan);background:color-mix(in srgb, var(--ds-cyan) 12%, transparent)}.KFXqYa_feeChipAlert{color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.KFXqYa_feeChipError{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.KFXqYa_providerGroupRecharge{border:1px solid color-mix(in srgb, var(--ds-c-1) 38%, transparent);background:color-mix(in srgb, var(--ds-c-1) 8%, transparent);color:var(--ds-c-1);white-space:nowrap;border-radius:999px;justify-content:center;align-items:center;min-width:48px;padding:1px 8px;font-size:10.5px;font-weight:600;line-height:16px;text-decoration:none;display:inline-flex}.KFXqYa_providerGroupRecharge:empty{background:0 0;border-color:#0000}.KFXqYa_providerGroupRecharge:hover{background:color-mix(in srgb, var(--ds-c-1) 15%, transparent);border-color:color-mix(in srgb, var(--ds-c-1) 60%, transparent)}.KFXqYa_balanceDaysBadge{border:1px solid var(--ds-border-strong);background:var(--dsb-2);min-width:16px;height:16px;color:var(--ds-t-2);cursor:pointer;border-radius:8px;justify-content:center;align-items:center;padding:0 4px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.KFXqYa_balanceDaysBadge:hover{border-color:var(--ds-t-3);color:var(--ds-t-1)}.KFXqYa_balanceDaysBadgeLow{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.KFXqYa_balanceDetailPop{z-index:20;background:var(--dsb-2);border:1px solid var(--ds-border-strong);min-width:180px;box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;flex-direction:column;gap:6px;padding:8px 10px;display:inline-flex;position:absolute;top:calc(100% + 6px);right:0}.KFXqYa_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.KFXqYa_balanceDetailTitle{color:var(--ds-t-1);font-size:12px;font-weight:600}.KFXqYa_balanceDetailClose{cursor:pointer;color:var(--ds-t-3);background:0 0;border:none;font-size:14px;line-height:1}.KFXqYa_balanceDetailClose:hover{color:var(--ds-t-1)}.KFXqYa_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.KFXqYa_balanceDetailRow{color:var(--ds-t-2);font-variant-numeric:tabular-nums;justify-content:space-between;gap:16px;font-size:11px;line-height:15px;display:flex}.KFXqYa_balanceDetailLabel{color:var(--ds-t-3)}.KFXqYa_balanceDetailValue{color:var(--ds-t-1);font-weight:500}.KFXqYa_currencyToggle{background:var(--dsw-alias-bg-layer-3);border:none;border-radius:8px;align-items:center;gap:2px;margin-right:8px;padding:2px;display:inline-flex}.KFXqYa_currencyButton{color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:4px 8px;font-size:11px;font-weight:700;line-height:1}.KFXqYa_currencyButtonActive{background:var(--dsb-2);color:var(--dsw-alias-label-primary);box-shadow:0 0 0 1px var(--ds-border-strong)}.KFXqYa_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.KFXqYa_subscriptionCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(12px)saturate(1.3);transition:border-color var(--ds-t-fast);padding:14px 16px;position:relative;overflow:hidden}.KFXqYa_subscriptionCardUpgraded{border-color:color-mix(in srgb, var(--ds-blue) 30%, transparent);border-radius:var(--ds-r-3);background:linear-gradient(135deg, color-mix(in srgb, var(--ds-blue) 8%, transparent), transparent 60%), var(--dsb-glass);-webkit-backdrop-filter:blur(12px)saturate(1.4);padding:16px 18px}.KFXqYa_subscriptionCardUpgraded:after{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-blue) 50%, transparent 90%);opacity:.7;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.KFXqYa_subscriptionCardUpgraded .KFXqYa_subscriptionPct{font-size:18px;font-weight:600}.KFXqYa_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.KFXqYa_subscriptionName{color:var(--ds-t-1);font-size:13px;font-weight:600}.KFXqYa_subscriptionPlan{color:var(--ds-t-2);font-size:11px}.KFXqYa_subscriptionPlan[data-kind=code],.KFXqYa_subscriptionPlan[data-kind=token]{color:var(--ds-t-2);background:var(--dsb-3);border-radius:999px;padding:1px 8px;font-weight:500}.KFXqYa_subscriptionTier{color:var(--ds-t-3);margin-left:6px}.KFXqYa_subscriptionAuto{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:1px 6px;font-size:10px}.KFXqYa_subscriptionStatus{color:var(--ds-t-2);margin-bottom:6px;font-size:11px}.KFXqYa_subscriptionWindow{align-items:center;gap:10px;margin-top:8px;font-size:11px;display:flex}.KFXqYa_subscriptionWindowLabel{color:var(--ds-t-3);flex:0 0 44px}.KFXqYa_subscriptionTrack{background:var(--dsb-3);height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.KFXqYa_subscriptionFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px;display:block}.KFXqYa_subscriptionFillWarn{background:var(--ds-amber)}.KFXqYa_subscriptionFillOver{background:var(--ds-red)}.KFXqYa_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.KFXqYa_subscriptionPct{text-align:right;min-width:52px;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1);flex:none}.KFXqYa_subscriptionExhausted{color:var(--ds-red);min-width:52px;font-weight:600}.KFXqYa_subscriptionReset{color:var(--ds-t-3);white-space:nowrap;flex:none;font-size:10px}.KFXqYa_providerGroupList{flex-direction:column;gap:10px;display:flex}.KFXqYa_providerGroup{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);padding:12px 14px;container:KFXqYa_billing-pg/inline-size}.KFXqYa_providerStatRow{border-radius:var(--ds-r-1);background:var(--dsb-2);border:1px solid var(--ds-border);grid-template-columns:repeat(4,1fr);gap:10px;margin-top:10px;padding:10px 12px;display:grid}.KFXqYa_providerStatCell{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_providerStatLbl{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px;font-weight:500}.KFXqYa_providerStatVal{font-family:var(--font-num);color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;font-size:16px;font-weight:600;overflow:hidden}.KFXqYa_providerStatSub{font-family:var(--font-num);color:var(--ds-t-3);font-size:10.5px}@container KFXqYa_billing-pg (width<=480px){.KFXqYa_providerStatRow{grid-template-columns:1fr 1fr}}.KFXqYa_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:10px;display:flex}.KFXqYa_providerGroupCollapsible{cursor:pointer}.KFXqYa_providerGroupCollapsible .KFXqYa_providerGroupTitle:before{content:"›";color:var(--ds-t-3);margin-right:6px;display:inline-block}.KFXqYa_providerGroupCollapsible[aria-expanded=true] .KFXqYa_providerGroupTitle:before{transform:rotate(90deg)}.KFXqYa_providerGroupCollapsible:focus-visible{outline:2px solid var(--ds-border-strong);outline-offset:2px;border-radius:6px}.KFXqYa_providerCtlRow{align-items:center;gap:12px;margin-bottom:10px;display:flex}.KFXqYa_providerTodayToggle{color:var(--ds-t-3);align-items:center;gap:7px;font-size:11px;display:inline-flex}.KFXqYa_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.KFXqYa_kindBadge{border:1px solid color-mix(in srgb, var(--ds-c-1) 32%, transparent);background:color-mix(in srgb, var(--ds-c-1) 10%, transparent);color:var(--ds-c-1);border-radius:4px;flex:none;padding:1px 6px;font-size:10px;font-weight:600;line-height:15px}.KFXqYa_kindBadgeRelay{border-color:color-mix(in srgb, var(--ds-c-2) 32%, transparent);background:color-mix(in srgb, var(--ds-c-2) 10%, transparent);color:var(--ds-c-2)}.KFXqYa_kindBadgeUnknown{border-color:var(--ds-border);background:color-mix(in srgb, var(--ds-t-3) 12%, transparent);color:var(--ds-t-3)}.KFXqYa_providerGroupName{color:var(--ds-t-1);font-size:13px;font-weight:600;line-height:18px}.KFXqYa_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_providerGroupBadge{border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent);border-radius:999px;justify-content:center;align-items:center;padding:1px 8px;font-size:10px;font-weight:500;line-height:16px;display:inline-flex}.KFXqYa_providerGroupBalance,.KFXqYa_providerGroupCost{color:var(--ds-t-2);font-variant-numeric:tabular-nums;white-space:nowrap;justify-content:flex-end;align-items:baseline;gap:6px;min-width:118px;font-size:12px;line-height:17px;display:inline-flex}.KFXqYa_providerGroupCostLabel{font-size:11px}.KFXqYa_providerGroupCostValue{color:var(--ds-t-1);text-align:right;min-width:56px;font-weight:600}.KFXqYa_providerGroupBalanceLabel{color:var(--ds-t-3);font-size:11px;line-height:17px}.KFXqYa_rounds{margin-top:10px}.KFXqYa_roundsBars{align-items:flex-end;gap:3px;height:124px;padding:16px 2px 0;display:flex;overflow-x:auto}.KFXqYa_roundsBarCol{border-radius:5px 5px 0 0;flex-direction:column;flex:1 0 28px;justify-content:flex-end;align-items:stretch;height:100%;display:flex;position:relative}.KFXqYa_roundsBarColPeak{background:color-mix(in srgb, var(--ds-amber) 16%, transparent)}.KFXqYa_roundsBarColOff{background:var(--dsb-3)}.KFXqYa_roundsBarLabel{text-align:center;color:var(--ds-t-2);white-space:nowrap;text-overflow:ellipsis;max-width:100%;font-size:9px;line-height:1.2;position:absolute;bottom:0;left:0;right:0;overflow:hidden;transform:translateY(-100%)}.KFXqYa_roundsBarWrap{flex:1;align-items:flex-end;min-height:0;display:flex}.KFXqYa_roundsBar{background:var(--ds-blue);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsBarFlagged{background:var(--ds-red);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsFlagMark{background:var(--ds-red);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.KFXqYa_roundsAxis{color:var(--ds-t-3);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.KFXqYa_roundsEmpty{color:var(--ds-t-2);margin-top:10px;font-size:12px}.KFXqYa_heatmap{margin-top:10px}.KFXqYa_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;display:grid}.KFXqYa_heatmapCellEmpty{box-sizing:border-box;border:1px dashed var(--ds-border);height:30px;color:var(--ds-t-4);font-variant-numeric:tabular-nums;background:0 0;border-radius:2px;justify-content:center;align-items:center;font-size:11px;display:flex}.KFXqYa_heatmapCell{font-variant-numeric:tabular-nums;cursor:pointer;border:0;border-radius:2px;justify-content:center;align-items:center;height:30px;padding:0;font-size:11px;display:flex}.KFXqYa_heatmapCell[data-level="0"],.KFXqYa_heatmapCell[data-level="1"],.KFXqYa_heatmapCell[data-level="2"]{color:var(--dsw-alias-label-primary)}.KFXqYa_heatmapCell[data-level="3"],.KFXqYa_heatmapCell[data-level="4"]{color:var(--dsw-static-neutral-bluish-00)}.KFXqYa_heatmapCell[data-today=true],.KFXqYa_heatmapYearCell[data-today=true]{outline:1.5px solid color-mix(in srgb, var(--ds-amber) 70%, transparent);outline-offset:1px;z-index:1}.KFXqYa_heatmapFooter{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-top:10px;font-size:10px;display:flex}.KFXqYa_heatmapLegend{gap:3px;display:inline-flex}.KFXqYa_heatmapLegend i{border-radius:2px;width:14px;height:14px;display:block}.KFXqYa_heatmapHover{font-family:var(--font-num);font-variant-numeric:tabular-nums;margin-left:auto}.KFXqYa_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.KFXqYa_heatmapRangeButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;background:0 0;border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4}.KFXqYa_heatmapRangeButtonActive{background:var(--dsb-2);border-color:var(--ds-border-strong);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.KFXqYa_heatmapYear{flex-direction:column;gap:6px;display:flex}.KFXqYa_heatmapYearBody{align-items:flex-start;gap:6px;display:flex}.KFXqYa_heatmapYearWeekdays{color:var(--ds-t-3);flex:none;grid-template-rows:repeat(7,11px);gap:3px;padding-top:12px;font-size:9px;line-height:11px;display:grid}.KFXqYa_heatmapYearWeekday{white-space:nowrap;text-align:right;height:11px}.KFXqYa_heatmapYearMonths{min-width:max-content;color:var(--ds-t-3);grid-template-columns:repeat(52,11px);gap:3px;font-size:9px;line-height:12px;display:grid;overflow:visible}.KFXqYa_heatmapYearMonth{white-space:nowrap;overflow:visible}.KFXqYa_heatmapYearScroll{padding-bottom:2px;overflow-x:auto}.KFXqYa_heatmapYearGrid{grid-template-rows:repeat(7,11px);grid-auto-flow:column;gap:3px;min-width:max-content;display:grid}.KFXqYa_heatmapYearCell{cursor:pointer;border:0;border-radius:2px;width:11px;height:11px;padding:0}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearWeekdays{grid-template-rows:repeat(7,16px);line-height:16px}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearWeekday{height:16px}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearMonths{grid-template-columns:repeat(26,16px)}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearGrid{grid-template-rows:repeat(7,16px)}.KFXqYa_heatmapHalf .KFXqYa_heatmapYearCell{border-radius:3px;width:16px;height:16px}.KFXqYa_floatSub{flex-direction:column;gap:6px;min-width:0;display:flex}.KFXqYa_floatSubHead{flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;display:flex}.KFXqYa_floatSubName{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:700}.KFXqYa_floatSubPlan{color:var(--dsw-alias-label-secondary);font-size:10px}.KFXqYa_floatSub .KFXqYa_subscriptionWindow{flex-wrap:wrap;gap:4px 10px}.KFXqYa_floatSub .KFXqYa_subscriptionWindowLabel{flex:none}.KFXqYa_floatSub .KFXqYa_subscriptionMeta{min-width:0;max-width:100%}.KFXqYa_floatSub .KFXqYa_subscriptionPct{min-width:0}.KFXqYa_floatSub .KFXqYa_subscriptionReset{white-space:normal;overflow-wrap:anywhere}.KFXqYa_triggerPopEmpty{color:var(--dsw-alias-label-tertiary);padding:2px 0;font-size:11px;line-height:1.5}.KFXqYa_triggerPopSwitcher{justify-content:flex-end;align-items:center;gap:8px;margin-top:2px;display:flex}.KFXqYa_triggerPopSwitchCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:10px}.KFXqYa_floatModeBtn{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;border-radius:10px;flex:1;padding:7px 10px;font-size:12px}.KFXqYa_floatModeBtnOn{border-color:var(--ds-blue);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--ds-blue) 16%, transparent)}.KFXqYa_floatModeBtn:disabled{opacity:.45;cursor:not-allowed}.KFXqYa_rdoRow{justify-content:space-between;align-items:center;gap:8px;margin-top:10px;display:flex}.KFXqYa_rdoLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.KFXqYa_rdoSelect{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;border-radius:10px;align-items:center;gap:5px;padding:5px 8px 5px 10px;font-size:12px;display:inline-flex}.KFXqYa_rdoSelect:hover{background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 85%, transparent)}.KFXqYa_rdoSelect:focus-visible{border-color:var(--ds-blue);outline:none}.KFXqYa_rdoChevron{color:var(--dsw-alias-label-tertiary);transition:transform .15s;display:inline-flex}.KFXqYa_rdoChevronOpen{transform:rotate(180deg)}.KFXqYa_floatTarget{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:5px;font-size:12px;display:inline-flex}.KFXqYa_floatTargetLabel{color:var(--dsw-alias-label-secondary)}.KFXqYa_staleNotice{color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);border-radius:10px;align-items:center;gap:6px;margin:0 0 10px;padding:8px 10px;font-size:11px;display:flex}.KFXqYa_staleNoticeBody{flex:1;min-width:0}.KFXqYa_staleNoticeSub{margin-top:4px;display:block}.KFXqYa_plgHead{align-items:flex-start;gap:12px;display:flex}.KFXqYa_plgIcon{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);width:40px;height:40px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_plgTitle{flex-direction:column;gap:4px;min-width:0;display:flex}.KFXqYa_plgNameRow{align-items:center;gap:8px;display:flex}.KFXqYa_plgName{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_plgTag{height:18px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);white-space:nowrap;border-radius:5px;align-items:center;padding:0 6px;font-size:10px;font-weight:600;display:inline-flex}.KFXqYa_plgDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.KFXqYa_plgGrid{border-top:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding-top:12px;display:grid}.KFXqYa_plgItem{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_plgLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.KFXqYa_plgVal{color:var(--dsw-alias-label-primary);word-break:break-all;font-size:12px;line-height:17px}.KFXqYa_plgLink{color:var(--ds-blue);word-break:break-all;font-size:12px;line-height:17px;text-decoration:none}.KFXqYa_plgLink:hover{text-decoration:underline}.KFXqYa_tokenPanel{flex-direction:column;gap:14px;display:flex}.KFXqYa_tokenModelBar{background:var(--dsw-alias-bg-layer-2);border-radius:999px;height:8px;overflow:hidden}.KFXqYa_tokenModelParts{height:100%;display:flex}.KFXqYa_tokenModelPartIn{background:var(--ds-blue)}.KFXqYa_tokenModelPartOut{background:var(--ds-amber)}.KFXqYa_tokenModelShareRow{align-items:center;gap:6px;display:inline-flex}@media (width<=640px){.KFXqYa_kpiGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.KFXqYa_hero{gap:14px}.KFXqYa_heroTop{flex-direction:column;align-items:flex-start;gap:12px}.KFXqYa_heroGauge{width:72px;height:72px}.KFXqYa_heroSide{gap:12px}.KFXqYa_heroSideSpacer{display:none}}.KFXqYa_peakCard{z-index:2000;border-radius:var(--ds-r-2);border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);min-width:280px;max-width:380px;box-shadow:var(--ds-shadow-2);animation:KFXqYa_peakAlertIn var(--ds-t-fast);flex-direction:column;gap:12px;padding:14px 16px;display:flex;position:fixed}.KFXqYa_peakCardCorner{bottom:18px;right:18px}.KFXqYa_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.KFXqYa_peakCardPeak{color:var(--ds-blue)}.KFXqYa_peakCardOff{color:var(--ds-cyan)}.KFXqYa_peakHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.KFXqYa_peakTag{white-space:nowrap;border-radius:6px;align-items:center;gap:6px;height:20px;padding:0 8px;font-size:11px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_peakTagPrimary{background:var(--dsw-alias-bg-layer-3);color:var(--ds-blue)}.KFXqYa_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--ds-cyan)}.KFXqYa_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.KFXqYa_peakDotPrimary{background:var(--ds-blue)}.KFXqYa_peakDotSuccess{background:var(--ds-cyan)}.KFXqYa_peakClose{width:24px;height:24px;color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;font-size:15px;line-height:1;display:inline-flex}.KFXqYa_peakClose:hover{color:var(--ds-t-1);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_peakCount{font-family:var(--font-num);font-variant-numeric:tabular-nums;font-size:28px;font-weight:600;line-height:1}.KFXqYa_peakCountPrimary{color:var(--ds-blue)}.KFXqYa_peakCountSuccess{color:var(--ds-cyan)}.KFXqYa_peakDesc{color:var(--ds-t-1);margin:4px 0 0;font-size:12px;line-height:18px}@keyframes KFXqYa_peakAlertIn{0%{opacity:0}to{opacity:1}}.KFXqYa_settingsLayout{grid-template-columns:120px 1fr;gap:14px;display:grid;container:KFXqYa_billing-settings/inline-size}.KFXqYa_settingsNav{border-right:1px solid var(--ds-border);flex-direction:column;align-self:start;gap:2px;max-height:min(720px,88vh - 80px);padding-right:14px;display:flex;position:sticky;top:0;overflow-y:auto}.KFXqYa_settingsNavItem{color:var(--ds-t-2);cursor:pointer;text-align:left;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;align-items:center;gap:6px;padding:6px 8px;font-family:inherit;font-size:11.5px;display:flex}.KFXqYa_settingsNavItem:hover{background:var(--dsb-3);color:var(--ds-t-1)}.KFXqYa_settingsNavItem:focus-visible{box-shadow:0 0 0 1.5px var(--ds-border-strong);outline:none}.KFXqYa_settingsNavItemActive{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-t-1);font-weight:600}.KFXqYa_settingsNavIcon{width:12px;height:12px;color:var(--ds-t-3);justify-content:center;align-items:center;display:inline-flex}.KFXqYa_settingsNavItemActive .KFXqYa_settingsNavIcon{color:var(--ds-blue)}.KFXqYa_settingsNavIcon svg{width:12px;height:12px}.KFXqYa_settingsNavItemAdvanced .KFXqYa_settingsNavIcon{color:var(--ds-violet)}.KFXqYa_settingsPane{flex-direction:column;gap:12px;min-width:0;display:flex}@container KFXqYa_billing-settings (width<=540px){.KFXqYa_settingsLayout{grid-template-columns:1fr}.KFXqYa_settingsNav{border-right:none;border-bottom:1px solid var(--ds-border);flex-flow:wrap;max-height:none;padding-bottom:10px;padding-right:0;position:static}}.KFXqYa_densityRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;display:flex}.KFXqYa_densityRow+.KFXqYa_densityRow{margin-top:8px}.KFXqYa_densityLeft{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_densityLeft strong{font-size:12.5px;font-weight:500}.KFXqYa_densityLeft span{color:var(--ds-t-3);font-size:11px}.KFXqYa_densityButtons{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:8px;align-items:center;gap:4px;padding:2px;display:inline-flex}.KFXqYa_densityButton{color:var(--ds-t-2);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;padding:4px 10px;font-family:inherit;font-size:11px}.KFXqYa_densityButton:hover{color:var(--ds-t-1)}.KFXqYa_densityButtonActive{background:var(--dsb-2);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.KFXqYa_densityButtonComfortable.KFXqYa_densityButtonActive{background:var(--ds-violet-bg);color:var(--ds-violet);box-shadow:0 0 0 1px var(--ds-violet-strong)}.KFXqYa_setCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.KFXqYa_setGrid3,.KFXqYa_setGrid2{gap:10px;display:grid}.KFXqYa_setGrid3{grid-template-columns:repeat(3,minmax(0,1fr))}.KFXqYa_setGrid2{grid-template-columns:repeat(2,minmax(0,1fr))}@media (width<=720px){.KFXqYa_setGrid3,.KFXqYa_setGrid2{grid-template-columns:1fr}}.KFXqYa_setCell{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);flex-direction:column;gap:8px;min-width:0;padding:12px 14px;display:flex}.KFXqYa_setHint{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_setCardHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.KFXqYa_setCardMeta{flex-direction:column;gap:4px;min-width:0;display:flex}.KFXqYa_setCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_setCardDesc{color:var(--ds-t-3);margin:0;font-size:11px;line-height:16px}.KFXqYa_ctlCol{flex-direction:column;gap:10px;padding-top:2px;display:flex}.KFXqYa_ctlRow{align-items:center;gap:12px;min-height:28px;display:flex}.KFXqYa_ctlRowStretch{display:flex}.KFXqYa_ctlLabel{color:var(--ds-t-3);flex:0 0 96px;font-size:11px;line-height:16px}.KFXqYa_ctlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.KFXqYa_userPriceRow{border-bottom:1px solid var(--ds-border);align-items:center;gap:10px;padding:8px 0;display:flex}.KFXqYa_userPriceCheck{width:14px;height:14px;accent-color:var(--ds-blue);flex:none;margin:0}.KFXqYa_userPriceBody{flex-direction:column;flex:1;gap:8px;min-width:0;display:flex}.KFXqYa_userPriceLineMeta{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) auto;align-items:end;gap:8px 10px;display:grid}@media (width<=720px){.KFXqYa_userPriceLineMeta{grid-template-columns:repeat(2,minmax(0,1fr))}}.KFXqYa_userPriceLineMeta .KFXqYa_userPriceInput{box-sizing:border-box;width:100%;min-width:0;max-width:none}.KFXqYa_userPriceBody .KFXqYa_ctlGroup{flex-wrap:nowrap}.KFXqYa_userPriceLineMeta .KFXqYa_userPriceField .KFXqYa_ctlLabel{align-items:flex-end;min-height:30px;display:flex}.KFXqYa_userPricePriceLine{border-left:2px solid var(--ds-amber);flex-wrap:wrap;align-items:center;gap:10px;width:calc(100% - 22px);margin-left:10px;padding:2px 0 6px 12px;display:flex}.KFXqYa_userPricePriceLine>.KFXqYa_ctlLabel{color:var(--ds-t-3);flex:0 0 44px;font-size:11px}.KFXqYa_userPricePriceLine .KFXqYa_userPriceInputNum{box-sizing:border-box;flex:1 1 0;width:auto;min-width:120px;max-width:240px}.KFXqYa_userPriceField{flex-direction:column;gap:4px;min-width:0;display:flex}.KFXqYa_userPriceField .KFXqYa_ctlLabel{flex:none;font-size:11px}.KFXqYa_userPriceInput,.KFXqYa_userPriceInputNum{border:1px solid var(--ds-border);background:var(--dsb-3);min-width:96px;max-width:160px;color:var(--ds-t-1);border-radius:6px;padding:4px 8px;font-size:12px;line-height:16px}.KFXqYa_userPriceInputNum{min-width:72px;max-width:88px}.KFXqYa_rdo{color:var(--ds-t-2);cursor:pointer;white-space:nowrap;align-items:center;gap:6px;font-size:12px;line-height:16px;display:inline-flex}.KFXqYa_rdo input{opacity:0;pointer-events:none;position:absolute}.KFXqYa_rdoDot{border:1px solid var(--ds-border-strong);background:var(--dsb-3);border-radius:50%;flex:none;width:14px;height:14px;position:relative}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot{border-color:var(--ds-blue)}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot:after{content:"";background:var(--ds-blue);border-radius:50%;position:absolute;inset:3px}.KFXqYa_inp{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:6px;align-items:center;gap:4px;padding:2px 6px;display:inline-flex}.KFXqYa_affix{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_prog{background:var(--dsb-3);min-width:0;height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.KFXqYa_progFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px}.KFXqYa_btn{border:1px solid var(--ds-border);height:28px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;line-height:16px;display:inline-flex}.KFXqYa_btn:hover{border-color:var(--ds-blue);color:var(--ds-t-1);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.KFXqYa_modelTable tbody td:not(:first-child) tbody td:not(:first-child){text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1)}.KFXqYa_sessionViewer{z-index:30;background:var(--dsb-2);flex-direction:column;gap:10px;padding:20px;display:flex;position:fixed;inset:0;overflow:hidden}.KFXqYa_sessionViewerHead{align-items:center;gap:10px;display:flex}.KFXqYa_sessionViewerTitle{margin:0;font-size:15px;font-weight:600}.KFXqYa_sessionViewerHead .KFXqYa_ubSearch{width:260px;max-width:55%;margin-left:auto}.KFXqYa_sessionViewerList{border:1px solid var(--ds-border);border-radius:var(--ds-r-2,8px);flex:1;min-height:0;overflow:auto}.KFXqYa_dashboard button:focus-visible,.KFXqYa_dashboard input:focus-visible,.KFXqYa_dashboard select:focus-visible,.KFXqYa_dashboard [role=button]:focus-visible,.KFXqYa_dashboard tr[tabindex]:focus-visible,.KFXqYa_trigger:focus-visible,.KFXqYa_railButton:focus-visible{outline:2px solid var(--ds-blue);outline-offset:1px}.KFXqYa_dashboard [hidden]{display:none!important}.KFXqYa_settingsSearch{align-self:stretch;width:100%;max-width:none;margin:0 0 12px}.KFXqYa_modelBudgetList{flex-direction:column;gap:8px;display:flex}.KFXqYa_modelBudgetTitle{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_modelBudgetHint{color:var(--ds-t-3);margin:0;font-size:11px;line-height:16px}.KFXqYa_modelBudgetRow{grid-template-columns:minmax(0,1fr) 56px 84px;align-items:center;gap:8px;display:grid}.KFXqYa_modelBudgetName{text-overflow:ellipsis;white-space:nowrap;color:var(--ds-t-2);font-size:12px;line-height:18px;overflow:hidden}.KFXqYa_modelBudgetCost{text-align:right;color:var(--ds-t-3);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.KFXqYa_helpTip{border:1px solid var(--ds-border);width:14px;height:14px;color:var(--ds-t-3);cursor:help;vertical-align:1px;border-radius:50%;flex:none;justify-content:center;align-items:center;margin-left:6px;font-size:10px;line-height:1;display:inline-flex}.KFXqYa_moreWorkList{flex-direction:column;gap:8px;display:flex}.KFXqYa_moreWorkRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-3);color:inherit;transition:border-color var(--ds-t-fast), background-color var(--ds-t-fast);flex-direction:column;gap:2px;padding:10px 12px;text-decoration:none;display:flex}.KFXqYa_moreWorkRow:hover{border-color:var(--ds-border-strong);background:var(--dsb-2)}.KFXqYa_moreWorkName{color:var(--ds-t-1);font-size:12px;font-weight:600;line-height:18px}.KFXqYa_moreWorkRow:hover .KFXqYa_moreWorkName{color:var(--ds-blue)}.KFXqYa_moreWorkDesc{color:var(--ds-t-3);font-size:11px;line-height:16px}.KFXqYa_contextEmpty{color:var(--ds-t-3);margin:8px 0;font-size:12px}.KFXqYa_agentSummary{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-2);flex-wrap:wrap;gap:8px 20px;margin-bottom:10px;padding:10px 12px;display:flex}.KFXqYa_agentSummaryItem{align-items:baseline;gap:5px;display:inline-flex}.KFXqYa_agentSummaryValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:15px;font-weight:600}.KFXqYa_agentSummaryLabel{color:var(--ds-t-3);font-size:11px}.KFXqYa_agentTree{flex-direction:column;gap:2px;display:flex}.KFXqYa_agentNode{flex-direction:column;display:flex}.KFXqYa_agentRow{border-radius:var(--ds-r-1);background:var(--dsb-2);align-items:center;gap:8px;padding:5px 8px;display:flex}.KFXqYa_agentKind{color:var(--ds-t-4);flex:none;font-size:10px}.KFXqYa_agentTitle{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--ds-t-1);flex:auto;font-size:12px;overflow:hidden}.KFXqYa_agentCalls{color:var(--ds-t-3);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.KFXqYa_agentCost{color:var(--ds-t-2);font-variant-numeric:tabular-nums;flex:none;font-size:11.5px}.KFXqYa_sessionLink{width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:none;padding:0;display:block}.KFXqYa_sessionLink:hover{color:var(--ds-blue);text-decoration:underline}.KFXqYa_sessionLink:focus-visible{outline:2px solid var(--ds-blue);outline-offset:2px;border-radius:3px}`,document.head.appendChild(e)}var L={affix:`KFXqYa_affix`,agentCalls:`KFXqYa_agentCalls`,agentCost:`KFXqYa_agentCost`,agentKind:`KFXqYa_agentKind`,agentNode:`KFXqYa_agentNode`,agentRow:`KFXqYa_agentRow`,agentSummary:`KFXqYa_agentSummary`,agentSummaryItem:`KFXqYa_agentSummaryItem`,agentSummaryLabel:`KFXqYa_agentSummaryLabel`,agentSummaryValue:`KFXqYa_agentSummaryValue`,agentTitle:`KFXqYa_agentTitle`,agentTree:`KFXqYa_agentTree`,balanceCell:`KFXqYa_balanceCell`,balanceDaysBadge:`KFXqYa_balanceDaysBadge`,balanceDaysBadgeLow:`KFXqYa_balanceDaysBadgeLow`,balanceDetailClose:`KFXqYa_balanceDetailClose`,balanceDetailGrid:`KFXqYa_balanceDetailGrid`,balanceDetailHead:`KFXqYa_balanceDetailHead`,balanceDetailLabel:`KFXqYa_balanceDetailLabel`,balanceDetailPop:`KFXqYa_balanceDetailPop`,balanceDetailRow:`KFXqYa_balanceDetailRow`,balanceDetailTitle:`KFXqYa_balanceDetailTitle`,balanceDetailValue:`KFXqYa_balanceDetailValue`,bandDot:`KFXqYa_bandDot`,bandDotOn:`KFXqYa_bandDotOn`,bandDots:`KFXqYa_bandDots`,"billing-perf":`KFXqYa_billing-perf`,"billing-pg":`KFXqYa_billing-pg`,"billing-settings":`KFXqYa_billing-settings`,"billing-trigger":`KFXqYa_billing-trigger`,btn:`KFXqYa_btn`,bucketCost:`KFXqYa_bucketCost`,bucketOfficial:`KFXqYa_bucketOfficial`,bucketSep:`KFXqYa_bucketSep`,bucketThird:`KFXqYa_bucketThird`,budgetFillOver:`KFXqYa_budgetFillOver`,budgetFillWarn:`KFXqYa_budgetFillWarn`,budgetInput:`KFXqYa_budgetInput`,budgetPulse:`KFXqYa_budgetPulse`,channelVisCell:`KFXqYa_channelVisCell`,channelVisList:`KFXqYa_channelVisList`,channelVisName:`KFXqYa_channelVisName`,channelVisRow:`KFXqYa_channelVisRow`,channelVisUsage:`KFXqYa_channelVisUsage`,chartArea:`KFXqYa_chartArea`,chartAxisLabel:`KFXqYa_chartAxisLabel`,chartBar:`KFXqYa_chartBar`,chartBarPlaceholder:`KFXqYa_chartBarPlaceholder`,chartCrosshair:`KFXqYa_chartCrosshair`,chartEmpty:`KFXqYa_chartEmpty`,chartGrid:`KFXqYa_chartGrid`,chartHoverDot:`KFXqYa_chartHoverDot`,chartLegend:`KFXqYa_chartLegend`,chartLegendBar:`KFXqYa_chartLegendBar`,chartLegendItem:`KFXqYa_chartLegendItem`,chartLegendItemActive:`KFXqYa_chartLegendItemActive`,chartLegendLine:`KFXqYa_chartLegendLine`,chartLine:`KFXqYa_chartLine`,chartStack:`KFXqYa_chartStack`,chartSvg:`KFXqYa_chartSvg`,chartTooltip:`KFXqYa_chartTooltip`,chartTooltipAlignLeft:`KFXqYa_chartTooltipAlignLeft`,chartTooltipAlignRight:`KFXqYa_chartTooltipAlignRight`,chartTooltipDate:`KFXqYa_chartTooltipDate`,chartTooltipHead:`KFXqYa_chartTooltipHead`,chartTooltipLabel:`KFXqYa_chartTooltipLabel`,chartTooltipModelDetail:`KFXqYa_chartTooltipModelDetail`,chartTooltipRow:`KFXqYa_chartTooltipRow`,chartTooltipSplit:`KFXqYa_chartTooltipSplit`,chartTooltipSwatch:`KFXqYa_chartTooltipSwatch`,chartWrap:`KFXqYa_chartWrap`,closeButton:`KFXqYa_closeButton`,contextEmpty:`KFXqYa_contextEmpty`,ctlCol:`KFXqYa_ctlCol`,ctlGroup:`KFXqYa_ctlGroup`,ctlLabel:`KFXqYa_ctlLabel`,ctlRow:`KFXqYa_ctlRow`,ctlRowStretch:`KFXqYa_ctlRowStretch`,currencyButton:`KFXqYa_currencyButton`,currencyButtonActive:`KFXqYa_currencyButtonActive`,currencyToggle:`KFXqYa_currencyToggle`,dashboard:`KFXqYa_dashboard`,dashboardBody:`KFXqYa_dashboardBody`,dashboardHead:`KFXqYa_dashboardHead`,dashboardIn:`KFXqYa_dashboardIn`,dashboardModal:`KFXqYa_dashboardModal`,dashboardRight:`KFXqYa_dashboardRight`,dashboardSubtitle:`KFXqYa_dashboardSubtitle`,dashboardTitle:`KFXqYa_dashboardTitle`,delta:`KFXqYa_delta`,deltaDown:`KFXqYa_deltaDown`,deltaUp:`KFXqYa_deltaUp`,densityButton:`KFXqYa_densityButton`,densityButtonActive:`KFXqYa_densityButtonActive`,densityButtonComfortable:`KFXqYa_densityButtonComfortable`,densityButtons:`KFXqYa_densityButtons`,densityLeft:`KFXqYa_densityLeft`,densityRow:`KFXqYa_densityRow`,emptyDesc:`KFXqYa_emptyDesc`,emptyDotPulse:`KFXqYa_emptyDotPulse`,emptyIll:`KFXqYa_emptyIll`,emptyIllDot:`KFXqYa_emptyIllDot`,emptyRow:`KFXqYa_emptyRow`,emptyState:`KFXqYa_emptyState`,emptyTitle:`KFXqYa_emptyTitle`,estimatedTag:`KFXqYa_estimatedTag`,exportBar:`KFXqYa_exportBar`,exportButton:`KFXqYa_exportButton`,exportLabel:`KFXqYa_exportLabel`,feeBar:`KFXqYa_feeBar`,feeBarAbove:`KFXqYa_feeBarAbove`,feeChipAlert:`KFXqYa_feeChipAlert`,feeChipError:`KFXqYa_feeChipError`,feeChipOff:`KFXqYa_feeChipOff`,feeChipPrimary:`KFXqYa_feeChipPrimary`,feeCount:`KFXqYa_feeCount`,feeInline:`KFXqYa_feeInline`,feeInlineAlert:`KFXqYa_feeInlineAlert`,feeInlineError:`KFXqYa_feeInlineError`,feeInlineNum:`KFXqYa_feeInlineNum`,feeItem:`KFXqYa_feeItem`,feeNum:`KFXqYa_feeNum`,feeSep:`KFXqYa_feeSep`,feeSuffix:`KFXqYa_feeSuffix`,feeTickFlash:`KFXqYa_feeTickFlash`,flatTag:`KFXqYa_flatTag`,floatModeBtn:`KFXqYa_floatModeBtn`,floatModeBtnOn:`KFXqYa_floatModeBtnOn`,floatSub:`KFXqYa_floatSub`,floatSubHead:`KFXqYa_floatSubHead`,floatSubName:`KFXqYa_floatSubName`,floatSubPlan:`KFXqYa_floatSubPlan`,floatTarget:`KFXqYa_floatTarget`,floatTargetLabel:`KFXqYa_floatTargetLabel`,healthBad:`KFXqYa_healthBad`,healthBadge:`KFXqYa_healthBadge`,healthBadgeBad:`KFXqYa_healthBadgeBad`,healthBadgeOk:`KFXqYa_healthBadgeOk`,healthDot:`KFXqYa_healthDot`,healthIdle:`KFXqYa_healthIdle`,healthOk:`KFXqYa_healthOk`,heatmap:`KFXqYa_heatmap`,heatmapCell:`KFXqYa_heatmapCell`,heatmapCellEmpty:`KFXqYa_heatmapCellEmpty`,heatmapFooter:`KFXqYa_heatmapFooter`,heatmapGrid:`KFXqYa_heatmapGrid`,heatmapHalf:`KFXqYa_heatmapHalf`,heatmapHover:`KFXqYa_heatmapHover`,heatmapLegend:`KFXqYa_heatmapLegend`,heatmapRangeButton:`KFXqYa_heatmapRangeButton`,heatmapRangeButtonActive:`KFXqYa_heatmapRangeButtonActive`,heatmapRangeSwitch:`KFXqYa_heatmapRangeSwitch`,heatmapYear:`KFXqYa_heatmapYear`,heatmapYearBody:`KFXqYa_heatmapYearBody`,heatmapYearCell:`KFXqYa_heatmapYearCell`,heatmapYearGrid:`KFXqYa_heatmapYearGrid`,heatmapYearMonth:`KFXqYa_heatmapYearMonth`,heatmapYearMonths:`KFXqYa_heatmapYearMonths`,heatmapYearScroll:`KFXqYa_heatmapYearScroll`,heatmapYearWeekday:`KFXqYa_heatmapYearWeekday`,heatmapYearWeekdays:`KFXqYa_heatmapYearWeekdays`,helpTip:`KFXqYa_helpTip`,hero:`KFXqYa_hero`,heroCurrency:`KFXqYa_heroCurrency`,heroGauge:`KFXqYa_heroGauge`,heroGaugeArc:`KFXqYa_heroGaugeArc`,heroGaugeArcOver:`KFXqYa_heroGaugeArcOver`,heroGaugeCenter:`KFXqYa_heroGaugeCenter`,heroGaugeDial:`KFXqYa_heroGaugeDial`,heroGaugeLabel:`KFXqYa_heroGaugeLabel`,heroGaugeRemain:`KFXqYa_heroGaugeRemain`,heroGaugeRemainOver:`KFXqYa_heroGaugeRemainOver`,heroGaugeSub:`KFXqYa_heroGaugeSub`,heroGaugeSvg:`KFXqYa_heroGaugeSvg`,heroGaugeTrack:`KFXqYa_heroGaugeTrack`,heroLabel:`KFXqYa_heroLabel`,heroMain:`KFXqYa_heroMain`,heroMeta:`KFXqYa_heroMeta`,heroPred:`KFXqYa_heroPred`,heroReadout:`KFXqYa_heroReadout`,heroSide:`KFXqYa_heroSide`,heroSideItem:`KFXqYa_heroSideItem`,heroSideLabel:`KFXqYa_heroSideLabel`,heroSideSpacer:`KFXqYa_heroSideSpacer`,heroSideValue:`KFXqYa_heroSideValue`,heroTop:`KFXqYa_heroTop`,heroValue:`KFXqYa_heroValue`,inp:`KFXqYa_inp`,kindBadge:`KFXqYa_kindBadge`,kindBadgeRelay:`KFXqYa_kindBadgeRelay`,kindBadgeUnknown:`KFXqYa_kindBadgeUnknown`,kpiCustomRange:`KFXqYa_kpiCustomRange`,kpiDelta:`KFXqYa_kpiDelta`,kpiDeltaDown:`KFXqYa_kpiDeltaDown`,kpiDeltaFlat:`KFXqYa_kpiDeltaFlat`,kpiDeltaUp:`KFXqYa_kpiDeltaUp`,kpiDetail:`KFXqYa_kpiDetail`,kpiGreen:`KFXqYa_kpiGreen`,kpiGrid:`KFXqYa_kpiGrid`,kpiLabel:`KFXqYa_kpiLabel`,kpiLabelRow:`KFXqYa_kpiLabelRow`,kpiSpark:`KFXqYa_kpiSpark`,kpiTile:`KFXqYa_kpiTile`,kpiValue:`KFXqYa_kpiValue`,kpiZone:`KFXqYa_kpiZone`,kpiZoneHead:`KFXqYa_kpiZoneHead`,kpiZoneLabel:`KFXqYa_kpiZoneLabel`,metricCell:`KFXqYa_metricCell`,metricGrid:`KFXqYa_metricGrid`,metricLabel:`KFXqYa_metricLabel`,metricValue:`KFXqYa_metricValue`,metricValueSuccess:`KFXqYa_metricValueSuccess`,modalFooter:`KFXqYa_modalFooter`,modelBudgetCost:`KFXqYa_modelBudgetCost`,modelBudgetHint:`KFXqYa_modelBudgetHint`,modelBudgetList:`KFXqYa_modelBudgetList`,modelBudgetName:`KFXqYa_modelBudgetName`,modelBudgetRow:`KFXqYa_modelBudgetRow`,modelBudgetTitle:`KFXqYa_modelBudgetTitle`,modelCell:`KFXqYa_modelCell`,modelChannelTag:`KFXqYa_modelChannelTag`,modelChannels:`KFXqYa_modelChannels`,modelDot:`KFXqYa_modelDot`,modelName:`KFXqYa_modelName`,modelProvider:`KFXqYa_modelProvider`,modelRowActive:`KFXqYa_modelRowActive`,modelRowFocusable:`KFXqYa_modelRowFocusable`,modelTable:`KFXqYa_modelTable`,moreWorkDesc:`KFXqYa_moreWorkDesc`,moreWorkList:`KFXqYa_moreWorkList`,moreWorkName:`KFXqYa_moreWorkName`,moreWorkRow:`KFXqYa_moreWorkRow`,na:`KFXqYa_na`,nativeSettingsBody:`KFXqYa_nativeSettingsBody`,nativeSettingsDashboard:`KFXqYa_nativeSettingsDashboard`,nativeSettingsLayout:`KFXqYa_nativeSettingsLayout`,nativeSettingsRoot:`KFXqYa_nativeSettingsRoot`,noticeAction:`KFXqYa_noticeAction`,noticeDismiss:`KFXqYa_noticeDismiss`,numCol:`KFXqYa_numCol`,offPeak:`KFXqYa_offPeak`,panel:`KFXqYa_panel`,panelHead:`KFXqYa_panelHead`,panelHeadControls:`KFXqYa_panelHeadControls`,panelHint:`KFXqYa_panelHint`,panelTitle:`KFXqYa_panelTitle`,peak:`KFXqYa_peak`,peakAlertIn:`KFXqYa_peakAlertIn`,peakAlertPop:`KFXqYa_peakAlertPop`,peakCard:`KFXqYa_peakCard`,peakCardCenter:`KFXqYa_peakCardCenter`,peakCardCorner:`KFXqYa_peakCardCorner`,peakCardOff:`KFXqYa_peakCardOff`,peakCardPeak:`KFXqYa_peakCardPeak`,peakClose:`KFXqYa_peakClose`,peakCount:`KFXqYa_peakCount`,peakCountPrimary:`KFXqYa_peakCountPrimary`,peakCountSuccess:`KFXqYa_peakCountSuccess`,peakDesc:`KFXqYa_peakDesc`,peakDot:`KFXqYa_peakDot`,peakDotPrimary:`KFXqYa_peakDotPrimary`,peakDotSuccess:`KFXqYa_peakDotSuccess`,peakHead:`KFXqYa_peakHead`,peakTag:`KFXqYa_peakTag`,peakTagPrimary:`KFXqYa_peakTagPrimary`,peakTagSuccess:`KFXqYa_peakTagSuccess`,perfBar:`KFXqYa_perfBar`,perfChip:`KFXqYa_perfChip`,perfChipDot:`KFXqYa_perfChipDot`,perfChipOff:`KFXqYa_perfChipOff`,perfChips:`KFXqYa_perfChips`,perfCompareBar:`KFXqYa_perfCompareBar`,perfCompareDot:`KFXqYa_perfCompareDot`,perfCompareList:`KFXqYa_perfCompareList`,perfCompareName:`KFXqYa_perfCompareName`,perfCompareNum:`KFXqYa_perfCompareNum`,perfCompareRow:`KFXqYa_perfCompareRow`,perfHero:`KFXqYa_perfHero`,perfHeroBar:`KFXqYa_perfHeroBar`,perfHeroCell:`KFXqYa_perfHeroCell`,perfHeroLbl:`KFXqYa_perfHeroLbl`,perfHeroUnit:`KFXqYa_perfHeroUnit`,perfHeroVal:`KFXqYa_perfHeroVal`,planTag:`KFXqYa_planTag`,planTagBadge:`KFXqYa_planTagBadge`,plgDesc:`KFXqYa_plgDesc`,plgGrid:`KFXqYa_plgGrid`,plgHead:`KFXqYa_plgHead`,plgIcon:`KFXqYa_plgIcon`,plgItem:`KFXqYa_plgItem`,plgLabel:`KFXqYa_plgLabel`,plgLink:`KFXqYa_plgLink`,plgName:`KFXqYa_plgName`,plgNameRow:`KFXqYa_plgNameRow`,plgTag:`KFXqYa_plgTag`,plgTitle:`KFXqYa_plgTitle`,plgVal:`KFXqYa_plgVal`,popDot:`KFXqYa_popDot`,popDotDirect:`KFXqYa_popDotDirect`,popDotNeutral:`KFXqYa_popDotNeutral`,popDotSub:`KFXqYa_popDotSub`,popError:`KFXqYa_popError`,popErrorDetail:`KFXqYa_popErrorDetail`,popErrorTitle:`KFXqYa_popErrorTitle`,popHead:`KFXqYa_popHead`,popModel:`KFXqYa_popModel`,popModelLabel:`KFXqYa_popModelLabel`,popModelName:`KFXqYa_popModelName`,popModelRow:`KFXqYa_popModelRow`,popModelStatus:`KFXqYa_popModelStatus`,popModelStatusLow:`KFXqYa_popModelStatusLow`,popTagPrimary:`KFXqYa_popTagPrimary`,popTagSub:`KFXqYa_popTagSub`,popTitle:`KFXqYa_popTitle`,prog:`KFXqYa_prog`,progFill:`KFXqYa_progFill`,providerCtlRow:`KFXqYa_providerCtlRow`,providerGroup:`KFXqYa_providerGroup`,providerGroupBadge:`KFXqYa_providerGroupBadge`,providerGroupBalance:`KFXqYa_providerGroupBalance`,providerGroupBalanceLabel:`KFXqYa_providerGroupBalanceLabel`,providerGroupCollapsible:`KFXqYa_providerGroupCollapsible`,providerGroupCost:`KFXqYa_providerGroupCost`,providerGroupCostLabel:`KFXqYa_providerGroupCostLabel`,providerGroupCostValue:`KFXqYa_providerGroupCostValue`,providerGroupHead:`KFXqYa_providerGroupHead`,providerGroupList:`KFXqYa_providerGroupList`,providerGroupMeta:`KFXqYa_providerGroupMeta`,providerGroupName:`KFXqYa_providerGroupName`,providerGroupRecharge:`KFXqYa_providerGroupRecharge`,providerGroupTitle:`KFXqYa_providerGroupTitle`,providerStatCell:`KFXqYa_providerStatCell`,providerStatLbl:`KFXqYa_providerStatLbl`,providerStatRow:`KFXqYa_providerStatRow`,providerStatSub:`KFXqYa_providerStatSub`,providerStatVal:`KFXqYa_providerStatVal`,providerTodayToggle:`KFXqYa_providerTodayToggle`,railButton:`KFXqYa_railButton`,rangeButton:`KFXqYa_rangeButton`,rangeButtonActive:`KFXqYa_rangeButtonActive`,rangeToggle:`KFXqYa_rangeToggle`,rdo:`KFXqYa_rdo`,rdoChevron:`KFXqYa_rdoChevron`,rdoChevronOpen:`KFXqYa_rdoChevronOpen`,rdoDot:`KFXqYa_rdoDot`,rdoLabel:`KFXqYa_rdoLabel`,rdoRow:`KFXqYa_rdoRow`,rdoSelect:`KFXqYa_rdoSelect`,reconcileDismiss:`KFXqYa_reconcileDismiss`,reconcileIcon:`KFXqYa_reconcileIcon`,reconcileNotice:`KFXqYa_reconcileNotice`,reconcileText:`KFXqYa_reconcileText`,rounds:`KFXqYa_rounds`,roundsAxis:`KFXqYa_roundsAxis`,roundsBar:`KFXqYa_roundsBar`,roundsBarCol:`KFXqYa_roundsBarCol`,roundsBarColOff:`KFXqYa_roundsBarColOff`,roundsBarColPeak:`KFXqYa_roundsBarColPeak`,roundsBarFlagged:`KFXqYa_roundsBarFlagged`,roundsBarLabel:`KFXqYa_roundsBarLabel`,roundsBarWrap:`KFXqYa_roundsBarWrap`,roundsBars:`KFXqYa_roundsBars`,roundsEmpty:`KFXqYa_roundsEmpty`,roundsFlagMark:`KFXqYa_roundsFlagMark`,sessionChildRow:`KFXqYa_sessionChildRow`,sessionGroupRow:`KFXqYa_sessionGroupRow`,sessionLink:`KFXqYa_sessionLink`,sessionSubDeepRow:`KFXqYa_sessionSubDeepRow`,sessionViewer:`KFXqYa_sessionViewer`,sessionViewerHead:`KFXqYa_sessionViewerHead`,sessionViewerList:`KFXqYa_sessionViewerList`,sessionViewerTitle:`KFXqYa_sessionViewerTitle`,setCard:`KFXqYa_setCard`,setCardDesc:`KFXqYa_setCardDesc`,setCardHead:`KFXqYa_setCardHead`,setCardMeta:`KFXqYa_setCardMeta`,setCardTitle:`KFXqYa_setCardTitle`,setCell:`KFXqYa_setCell`,setGrid2:`KFXqYa_setGrid2`,setGrid3:`KFXqYa_setGrid3`,setHint:`KFXqYa_setHint`,settingsLayout:`KFXqYa_settingsLayout`,settingsNav:`KFXqYa_settingsNav`,settingsNavIcon:`KFXqYa_settingsNavIcon`,settingsNavItem:`KFXqYa_settingsNavItem`,settingsNavItemActive:`KFXqYa_settingsNavItemActive`,settingsNavItemAdvanced:`KFXqYa_settingsNavItemAdvanced`,settingsPane:`KFXqYa_settingsPane`,settingsSearch:`KFXqYa_settingsSearch`,shareDot:`KFXqYa_shareDot`,shareItem:`KFXqYa_shareItem`,shareLegend:`KFXqYa_shareLegend`,shareSeg:`KFXqYa_shareSeg`,shareSegAssistant:`KFXqYa_shareSegAssistant`,shareSegOff:`KFXqYa_shareSegOff`,shareSegPeak:`KFXqYa_shareSegPeak`,shareSegTool:`KFXqYa_shareSegTool`,shareSegUser:`KFXqYa_shareSegUser`,shareTrack:`KFXqYa_shareTrack`,shareValue:`KFXqYa_shareValue`,siteKindDirect:`KFXqYa_siteKindDirect`,siteKindSite:`KFXqYa_siteKindSite`,siteKindTag:`KFXqYa_siteKindTag`,siteKindUnknown:`KFXqYa_siteKindUnknown`,siteRow:`KFXqYa_siteRow`,siteRowCalls:`KFXqYa_siteRowCalls`,siteRowCallsLow:`KFXqYa_siteRowCallsLow`,siteRowCost:`KFXqYa_siteRowCost`,siteRowMeta:`KFXqYa_siteRowMeta`,siteRowName:`KFXqYa_siteRowName`,siteRowTitle:`KFXqYa_siteRowTitle`,soon:`KFXqYa_soon`,staleNotice:`KFXqYa_staleNotice`,staleNoticeBody:`KFXqYa_staleNoticeBody`,staleNoticeSub:`KFXqYa_staleNoticeSub`,subscriptionAuto:`KFXqYa_subscriptionAuto`,subscriptionCard:`KFXqYa_subscriptionCard`,subscriptionCardUpgraded:`KFXqYa_subscriptionCardUpgraded`,subscriptionExhausted:`KFXqYa_subscriptionExhausted`,subscriptionFill:`KFXqYa_subscriptionFill`,subscriptionFillOver:`KFXqYa_subscriptionFillOver`,subscriptionFillWarn:`KFXqYa_subscriptionFillWarn`,subscriptionGrid:`KFXqYa_subscriptionGrid`,subscriptionHead:`KFXqYa_subscriptionHead`,subscriptionMeta:`KFXqYa_subscriptionMeta`,subscriptionName:`KFXqYa_subscriptionName`,subscriptionPct:`KFXqYa_subscriptionPct`,subscriptionPlan:`KFXqYa_subscriptionPlan`,subscriptionReset:`KFXqYa_subscriptionReset`,subscriptionStatus:`KFXqYa_subscriptionStatus`,subscriptionTier:`KFXqYa_subscriptionTier`,subscriptionTrack:`KFXqYa_subscriptionTrack`,subscriptionWindow:`KFXqYa_subscriptionWindow`,subscriptionWindowLabel:`KFXqYa_subscriptionWindowLabel`,switch:`KFXqYa_switch`,switchKnob:`KFXqYa_switchKnob`,switchOn:`KFXqYa_switchOn`,tabBadge:`KFXqYa_tabBadge`,tabBadgeHot:`KFXqYa_tabBadgeHot`,tabBadgeViolet:`KFXqYa_tabBadgeViolet`,tabBadgeWarn:`KFXqYa_tabBadgeWarn`,tabButton:`KFXqYa_tabButton`,tabButtonActive:`KFXqYa_tabButtonActive`,tabNav:`KFXqYa_tabNav`,tabNavLabel:`KFXqYa_tabNavLabel`,tabPanel:`KFXqYa_tabPanel`,tabPanelIn:`KFXqYa_tabPanelIn`,tabRail:`KFXqYa_tabRail`,tabRailIcon:`KFXqYa_tabRailIcon`,tabRailItem:`KFXqYa_tabRailItem`,tabRailItemActive:`KFXqYa_tabRailItemActive`,tabRailLabel:`KFXqYa_tabRailLabel`,tableScroll:`KFXqYa_tableScroll`,tokenModelBar:`KFXqYa_tokenModelBar`,tokenModelPartIn:`KFXqYa_tokenModelPartIn`,tokenModelPartOut:`KFXqYa_tokenModelPartOut`,tokenModelParts:`KFXqYa_tokenModelParts`,tokenModelShareRow:`KFXqYa_tokenModelShareRow`,tokenPanel:`KFXqYa_tokenPanel`,trigger:`KFXqYa_trigger`,triggerBudgetHot:`KFXqYa_triggerBudgetHot`,triggerBudgetOver:`KFXqYa_triggerBudgetOver`,triggerBudgetPulse:`KFXqYa_triggerBudgetPulse`,triggerDelta:`KFXqYa_triggerDelta`,triggerDeltaDown:`KFXqYa_triggerDeltaDown`,triggerDeltaUp:`KFXqYa_triggerDeltaUp`,triggerGaugeArc:`KFXqYa_triggerGaugeArc`,triggerGaugeNeedle:`KFXqYa_triggerGaugeNeedle`,triggerGlow:`KFXqYa_triggerGlow`,triggerGlowPulse:`KFXqYa_triggerGlowPulse`,triggerIcon:`KFXqYa_triggerIcon`,triggerLabel:`KFXqYa_triggerLabel`,triggerMain:`KFXqYa_triggerMain`,triggerMetric:`KFXqYa_triggerMetric`,triggerPop:`KFXqYa_triggerPop`,triggerPopEmpty:`KFXqYa_triggerPopEmpty`,triggerPopShown:`KFXqYa_triggerPopShown`,triggerPopSwitchCount:`KFXqYa_triggerPopSwitchCount`,triggerPopSwitcher:`KFXqYa_triggerPopSwitcher`,triggerPrimary:`KFXqYa_triggerPrimary`,triggerScan:`KFXqYa_triggerScan`,triggerShared:`KFXqYa_triggerShared`,triggerSpark:`KFXqYa_triggerSpark`,triggerSparkBar:`KFXqYa_triggerSparkBar`,triggerSparkBreath:`KFXqYa_triggerSparkBreath`,triggerSparkHot:`KFXqYa_triggerSparkHot`,triggerStatsError:`KFXqYa_triggerStatsError`,triggerValueRow:`KFXqYa_triggerValueRow`,triggerWrap:`KFXqYa_triggerWrap`,triggerWrapShared:`KFXqYa_triggerWrapShared`,triggerYen:`KFXqYa_triggerYen`,ubAlert:`KFXqYa_ubAlert`,ubAlertLeft:`KFXqYa_ubAlertLeft`,ubAlertNote:`KFXqYa_ubAlertNote`,ubCard:`KFXqYa_ubCard`,ubCardControlGroup:`KFXqYa_ubCardControlGroup`,ubCardHead:`KFXqYa_ubCardHead`,ubCardSub:`KFXqYa_ubCardSub`,ubCardTitle:`KFXqYa_ubCardTitle`,ubChipLabel:`KFXqYa_ubChipLabel`,ubChipOff:`KFXqYa_ubChipOff`,ubChipPeak:`KFXqYa_ubChipPeak`,ubExtraName:`KFXqYa_ubExtraName`,ubExtraNote:`KFXqYa_ubExtraNote`,ubExtraRow:`KFXqYa_ubExtraRow`,ubModel:`KFXqYa_ubModel`,ubModelName:`KFXqYa_ubModelName`,ubNotes:`KFXqYa_ubNotes`,ubNotesDesc:`KFXqYa_ubNotesDesc`,ubNotesItem:`KFXqYa_ubNotesItem`,ubNotesTerm:`KFXqYa_ubNotesTerm`,ubRate:`KFXqYa_ubRate`,ubSearch:`KFXqYa_ubSearch`,ubTable:`KFXqYa_ubTable`,ubTablewrap:`KFXqYa_ubTablewrap`,ubTablewrapPricing:`KFXqYa_ubTablewrapPricing`,ubTag:`KFXqYa_ubTag`,ubTagAlert:`KFXqYa_ubTagAlert`,ubTagError:`KFXqYa_ubTagError`,ubTagNeutral:`KFXqYa_ubTagNeutral`,ubTagPromo:`KFXqYa_ubTagPromo`,ubTagSuccess:`KFXqYa_ubTagSuccess`,uncataloguedTag:`KFXqYa_uncataloguedTag`,unknownHint:`KFXqYa_unknownHint`,unpricedHint:`KFXqYa_unpricedHint`,unpricedHintBody:`KFXqYa_unpricedHintBody`,userPriceBody:`KFXqYa_userPriceBody`,userPriceCheck:`KFXqYa_userPriceCheck`,userPriceField:`KFXqYa_userPriceField`,userPriceInput:`KFXqYa_userPriceInput`,userPriceInputNum:`KFXqYa_userPriceInputNum`,userPriceLineMeta:`KFXqYa_userPriceLineMeta`,userPricePriceLine:`KFXqYa_userPricePriceLine`,userPriceRow:`KFXqYa_userPriceRow`};let at=`usageBilling`,ot={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,monthProjectedHint:`本月已发生 + 近 7 天节奏 × 剩余天数`,liveTurn:`本轮`,liveSession:`会话`,liveSessionSub:`含子 {cost}`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,kpiRange:`统计范围`,avgRangeToday:`今日`,avgRange7d:`近7天`,avgRangeWeek:`本周`,avgRangeMonth:`本月`,avgRangeAll:`累计`,avgRangeCustom:`自定义`,customRangeStart:`开始日期`,customRangeEnd:`结束日期`,trend:`每日费用与调用趋势`,trend7d:`7 天`,trend30d:`30 天`,trendMetric:`趋势指标`,trendMetricCost:`费用`,trendMetricTokens:`Token`,pricingSearch:`搜索模型 / 厂商`,bandPinHint:`点击固定到输入框`,trendEmpty:`暂无趋势数据`,trendTotal:`总计`,roundsUnit:`轮`,healthModelsLive:`{n} 模型可用`,healthVendorsDown:`{n} 厂商失效`,healthVendorsUnavailable:`{n} 厂商不可用`,budget:`本月预算`,budgetRemain:`剩余预算`,budgetAmount:`预算金额`,budgetSummary:`本月已用 {used} / {total};达到 80% 时提醒,达到 100% 时红色脉冲警示`,sessions:`会话明细`,sessionTitle:`标题`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`提供商计费与订阅`,channelUnknown:`未知路由`,directTag:`直连`,relayTag:`中转`,unknownTag:`未知`,unknownChannelHint:`通道未在插件配置中注册,支出主体无法核实,费用不计入口径,仅统计用量。`,planCountUnit:`套餐`,actual:`实际`,pricing:`模型单价表`,input:`输入`,output:`输出`,cacheHit:`缓存命中`,peak:`高峰`,offPeak:`低谷`,flat:`全天统一`,band:`时段`,close:`关闭`,footer:`每 30s 自动轮询 · 仅统计本机 dsh 会话`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`数据更新于`,noData:`暂无计费数据`,todayRate:`今日汇率`,rateLive:`实时`,rateBuiltin:`内置`,pricingSyncedAt:`上次同步`,pricingSyncNow:`立即同步`,pricingSyncing:`同步中…`,promoBadge:`促`,promoUntil:`促销价至 {date},之后自动恢复刊例价`,promoOpenEnded:`厂商未公布截止时间,当前按折扣计价;公告截止后自动恢复刊例价`,pricingTip:`DeepSeek 现行刊例:V4.1 Flash 谷档 未命中 ¥1 / 缓存命中 ¥0.02 / 输出 ¥4;V4 Pro 谷档 未命中 ¥4.5 / 缓存命中 ¥0.15 / 输出 ¥13.5;峰价均为谷价 × 2。工作日 9-12 / 14-18 为高峰价,其余时段(含周末全天)为低谷价;费用按调用时刻计。`,pricingUnit:`单位:人民币 / 每百万 Token`,pricingNotes:`计价说明`,ubPeak:`峰`,ubOff:`谷`,ubStd:`标准`,peakBand:`峰谷分带`,pricingSource:`数据来源`,noteCache:`命中部分按缓存价计费,显著降低成本。`,noteBand:`高峰与空闲时段单价不同,空闲约半价。`,noteSource:`价格来自实时汇率 + 模型定价目录,未收录模型按 0 计并提示。`,balance:`余额`,recharge:`充值`,rechargeHint:`打开该厂商官方平台的充值页`,balanceUnconfigured:`未配置`,balanceUnauthorized:`密钥无效`,balanceUnreachable:`查询失败`,uncatalogued:`未收录`,estimatedPricing:`估算价`,balanceDays:`约可撑 {days} 天`,balanceLowBody:`{name} 余额 {balance},约可撑 {days} 天,请及时充值`,reconcileDrift:`系统监控到{provider}官方余额变动 {spent},本面板记录 {today},差额通常由其它工具或 API 的消耗所致`,reconcileDismiss:`知道了`,subscriptionNotConfigured:`未配置密钥`,subscriptionUnauthorized:`密钥无效`,subscriptionUnavailable:`查询失败`,subscriptionInvalid:`响应异常`,subscriptionRateLimited:`触发限流`,subscriptionSession:`本次`,subscriptionWeekly:`本周`,subscriptionMonthly:`本月`,subscriptionBilling:`计费周期`,subscriptionRemaining:`剩余 {pct}%`,subscriptionExhausted:`已用尽`,subscriptionReset:`{date} 重置`,subscriptionNoApi:`该厂商暂未提供用量查询接口`,floatWindow:`模型用量悬浮窗`,floatModeCombined:`综合`,floatModeSubscription:`订阅卡`,floatMode:`展示模式`,floatTargets:`订阅目标`,floatWindowHint:`悬浮在左下角计费卡上的用量速览;综合=当前样式,订阅卡=每次展示一张订阅额度卡(可切换)。`,floatPrimaryToday:`今日`,floatPrimaryWeek:`本周`,floatPrimaryMonth:`本月`,cardDisplay:`计费卡显示`,cardDisplayHint:`选择侧栏入口的占用方式,并切换主指标与统计范围;完全隐藏后可从宿主设置或 /usage 恢复。隐藏不会停止统计或提醒。`,cardMode:`侧栏入口`,cardModeFull:`完整卡片`,cardModeCompact:`紧凑图标`,cardModeHidden:`完全隐藏`,cardModeHiddenHint:`恢复显示:打开宿主设置 → 用量与费用 → 完整卡片;也可通过 /usage 或「打开用量计费仪表盘」快捷键直接打开仪表盘后恢复。`,cardModeFallback:`当前宿主没有原生设置页或 /usage 入口,完全隐藏已降级为紧凑图标,避免仪表盘无法打开。`,nativeSettingsNav:`用量与费用`,nativeSettingsIntro:`管理侧栏计费入口的显示方式。修改即时生效,并与仪表盘内的设置同步。`,nativeSettingsHiddenHint:`侧栏入口当前已隐藏。选择「完整卡片」或「紧凑图标」即可恢复;隐藏期间也可用「打开用量计费仪表盘」快捷键直接打开面板(绑定在宿主设置 → 快捷键里修改)。统计与提醒一直保持运行。`,shortcutOpenDashboard:`打开用量计费仪表盘`,cardMetric:`主指标`,cardMetricMoney:`金额`,cardMetricTokens:`Token`,cardSpan:`统计范围`,cardSpanDay:`日`,cardSpanWeek:`周`,cardSpanMonth:`月`,cardDeltaBadge:`今日环比徽章`,cardDeltaShow:`显示`,cardDeltaHide:`隐藏`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,balanceStaleNotice:`余额刷新较慢,以下为上一次查询结果`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,费用按目录价重估),模型归属可能有误差`,staleSnapshotNotice:`用量正在重算,以下数据来自上一次计算(可能不是最新,会话标题等以工作区为准)`,statsLoadFailed:`统计数据读取失败,下方数字可能不完整`,unreadableNotice:`{count} 个会话的用量未完整计入(原始日志未动,不会丢失)`,unreadableNoLedgerNotice:`其中 {count} 个无历史存档,用量完全未计入`,unreadableFormatNotice:`其中 {count} 个因会话格式不受当前宿主支持:过新格式升级宿主后自动恢复,过旧格式(如 v0/v3)需先迁移`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;模型可用下拉候选(目录键或模型 id);来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价(协议可省);低谷价三栏填后按峰/谷混合估算,留空=平档`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceOffPeak:`低谷价`,userPriceNormal:`标准价`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemoveSelected:`删除所选`,userPriceSelect:`选择此行`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,sessionSubCost:`含子智能体 {cost}`,sessionSubCalls:`含子智能体 {calls} 次调用`,sessionSubRow:`子智能体`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,currencyEur:`欧元`,language:`界面语言`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabPricing:`费率`,tabSettings:`设置`,budgetHint:`设置月度上限,用于本月预计与超支分段提醒`,peakAlertHint:`在切档前弹窗提醒,可选同步系统通知`,peakAlertDescPeak:`即将进入高峰时段,价格将上调,请提前安排长任务`,peakAlertDescOff:`即将进入平价时段,价格减半,适合运行大批量任务`,peakAlertDescPeakZhipu:`即将进入高峰时段(工作日 14:00–18:00),Coding Plan 额度将按基础积分全额抵扣`,peakAlertDescOffZhipu:`即将进入非高峰时段,Coding Plan 额度按基础积分 5 折抵扣`,peakAlertQueuePeak:`{count} 个排队任务将等待下一低谷;已开始任务继续执行`,peakAlertQueueOff:`{count} 个排队任务将按顺序启动`,export:`导出`,exportCsvDay:`按日 CSV`,exportCsvSession:`按会话 CSV`,exportJson:`全量 JSON`,peakShare:`峰谷时段占比`,peakSharePerCall:`按调用时刻精确判档`,offPeakSavings:`挪谷可省约 {amount}`,perfMax:`最大 TTFT`,weekCost:`本周消耗金额`,roleCost:`费用构成`,roleUser:`用户输入`,roleAssistant:`助手输出`,roleTool:`工具结果`,roleHint:`估算:输出按实测计价,输入按消息长度摊分`,tierPeak:`峰时`,tierOff:`平价`,tierToPeak:`后转峰时`,tierToOff:`后转平价`,tierAlertEnterPeak:`{minutes} 分钟后进入峰时(DeepSeek 高峰价 ×2),不急的调用可稍等`,tierAlertEnterOff:`{minutes} 分钟后进入平价(价格减半)`,tierAlertEnterPeakZhipu:`{minutes} 分钟后进入智谱高峰时段,Coding Plan 额度将全额抵扣`,tierAlertEnterOffZhipu:`{minutes} 分钟后进入智谱非高峰时段,额度按基础积分 5 折抵扣`,peakAlertTitlePeak:`即将进入高峰价`,peakAlertTitleOff:`即将进入平价`,peakAlert:`峰谷切换提醒`,peakAlertLeadMin:`提前量(分钟)`,peakAlertPos:`位置`,peakAlertMode:`提醒模式`,peakAlertPosCorner:`右下角`,peakAlertPosCenter:`屏幕居中`,peakAlertModePeak:`仅进入峰时`,peakAlertModeOff:`仅进入平价`,peakAlertModeBoth:`峰与谷都提醒`,peakAlertWebNotify:`同时发系统通知`,peakAlertPreview:`预览提醒`,planTypeCode:`订阅制`,planTypeToken:`按量`,subscriptionFeePerMonth:`{amount}/月`,triggerToday:`今日消耗金额`,triggerMonth:`当月消耗金额`,triggerMonthTokens:`当月消耗 Token`,triggerTodayTokens:`今日消耗 Token`,triggerWeekTokens:`本周消耗 Token`,subscriptionTag:`订阅`,cellEstimateHint:`本行无按量扣费记录(订阅通道不逐次计费),金额按目录价估算`,free:`免费`,perfSamples:`样本`,perfTtft:`首字延时`,perfP50:`P50`,perfP90:`P90`,perfTps:`生成速度`,perfLatency:`总延迟`,perfEstimated:`估算样本`,perfEmpty:`暂无性能数据`,perfTpsUnit:`tok/s`,perfTitle:`性能`,perfHint:`按模型与按小时聚合;估算样本为工具续写步骤`,perfAll:`全选`,perfChartEmpty:`未选择模型或该指标暂无数据`,heatmapYear:`年`,heatmapHalf:`半年`,heatmapMonth:`月`,metricCost:`费用`,metricTokens:`Token`,heatmapTotal:`合计`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,densityLabel:`显示密度`,densityHint:`紧凑减小行高与留白,舒适加大;切换即时生效`,densityCompact:`紧凑`,densityDefault:`默认`,densityComfortable:`舒适`,motionLabel:`动效强度`,motionHint:`关闭后所有入场与数据更新动画静止,保留基础交互反馈`,motionOff:`关闭`,motionSubtle:`克制`,motionRich:`丰富`,settingsNavDisplayPref:`偏好`,settingsNavBudget:`预算`,settingsNavAlert:`提醒`,settingsNavDisplay:`显示`,settingsNavAdvanced:`高级`,settingsNavAbout:`关于`,settingsSearchPlaceholder:`搜索设置…(如:预算、峰谷、单价)`,settingsSearchEmpty:`没有匹配「{query}」的设置项`,sessionsViewAll:`查看全部 {count} 个会话`,sessionsViewTop:`查看花费前 {count} 个会话`,sessionViewerSearch:`搜索会话…(标题 / 项目 / id)`,modelBudgetTitle:`按模型预算`,modelBudgetHint:`为单个模型设本月上限(人民币元);跨 80% / 100% 各提醒一次,留空 = 不限。`,modelBudgetBody:`「{model}」本月已 {cost}(预算 {budget} 的 {pct}%)`,modelBudgetPlaceholder:`上限`,moreWorksTitle:`更多作品`,adEngramName:`DSH Engram · 记忆宫殿`,adEngramDesc:`跨会话长期记忆:记忆图谱 · 混合检索 · 知识飞轮`,adRainbowName:`RainbowSpeak · 虹语`,adRainbowDesc:`聊天输入框的彩虹流光边框,持续流动的渐变光环`,kpiDescCacheHit:`缓存命中 token ÷ 总输入 token。命中率越高,输入费用越低(缓存读单价约为未命中的 1/10)。`,kpiDescTokens:`总处理 token = 输入 + 输出。缓存读/写已含在输入内,不重复计数(issue #85 口径)。`,kpiDescAvgCost:`统计范围内总费用 ÷ 总调用次数,单次调用的平均开销。`,kpiDescCalls:`统计范围内的 LLM 调用次数(联网搜索估算不含在内)。`,kpiDescReasoning:`思考(reasoning)token ÷ 输出 token。推理模型的思考部分已计费、含在输出内。`,kpiDescIo:`输入 token ÷ 输出 token。比值高通常意味着长上下文 / 多轮复用。`,kpiDescPeak:`统计范围内单日处理 token(输入+输出)最多的一天。`,healthDotLive:`厂商在线`,healthDotFailed:`厂商探活失败`,healthDotUnknown:`厂商状态未知`,settingsSectionDisplay:`显示偏好`,emptyHint:`运行第一次对话后,这里会自动出现按厂商的用量与费用明细`,tokenViewStructure:`按结构`,tokenViewModel:`按模型`,tokenHitShort:`命中`,tokenMissShort:`未命中`,tokenTotal:`总 Token`,tokenShare:`占比`,usageStatsTool:`注入用量查询`,usageStatsToolHint:`让模型可在对话中查询用量/费用;会占用模型每次请求的上下文,coding 场景建议关闭(切换即时生效)`,balanceGranted:`赠金余额`,balanceTopped:`充值余额`,balanceDaily:`日均消耗`,balanceDaysLong:`约可撑`,balanceDaysUnit:`天`,popTodayModel:`主力消耗模型余额`,popTitle:`用量速览`,popNoConsumption:`暂无消耗`,popDirectLead:`直联`,popSubLead:`订阅`,unpricedHint:`{count} 个模型未收录计价,费用已按 0 计:{models}`,channelVisibility:`通道可见性`,channelVisibilityHint:`隐藏的通道不参与统计口径:账单分组、概览数字、趋势与用量随之联动。会话 / 工具 / 角色等没有通道维度的指标仍为全量。`,channelVisibilityShowAll:`全部显示`,channelVisibilityHidden:`已隐藏 {count} 个通道,统计口径已排除其用量`,channelVisibilityEmpty:`暂无通道数据`,unpricedMore:`等 {count} 个`,unpricedFix:`去补价`,searchEstimateHint:`含 {count} 次联网搜索请求的估算费用(每次约 {each};日志无用量事件,按次估算,可在配置 searchCallEstimateCny 调整或关闭)`,siteListDisplay:`中转站列表`,siteListDisplayHint:`隐藏「未识别」占位条目与「未知路由」分组,净化列表`,liveCostBar:`平价消耗胶囊`,liveCostBarHint:`输入框旁的即时代费条,悬浮可看详情`,liveCostBarPosition:`位置`,liveCostBarPosBelow:`输入框下方`,liveCostBarPosAbove:`输入框上方`,liveCostBarPosToolbar:`输入框内部`,exportCsvSite:`按站点 CSV`,panelRelayQuota:`中转站额度`,relayBalance:`余额`,relayNoQuota:`未读出额度`,relayWindowUsed:`已用`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`未识别`,expandAll:`全部展开`,collapseAll:`全部收起`,todayOnly:`仅看今日`,todayNoConsumption:`今日暂无消耗`,commandUsageLabel:`打开计费仪表盘`,commandUsageDescription:`查看今日/本月费用、用量明细与费率`,sessionOpen:`打开会话`,sessionOpenFailed:`无法打开该会话(可能已被删除或不在当前会话列表)`,sessionOpenUnavailable:`当前宿主不支持会话跳转`,tabAgents:`智能体`,agentsSummary:`智能体网络`,agentsCount:`智能体`,agentsDelegations:`委派`,agentsRoots:`对话`,agentsMostExpensive:`最贵的一支`,agentsChainTotal:`链合计`,agentsNoData:`暂无子智能体委派记录`,agentsSubagent:`子智能体`,agentsRoot:`对话`,tabQueue:`队列`,queueSubtitle:`非紧急任务只在 DeepSeek 官方低谷启动,按入队顺序串行执行`,queueUntilPeak:`距高峰`,queueUntilOffPeak:`距低谷`,queueUnsupportedTitle:`当前宿主不支持任务队列`,queueUnsupportedBody:`任务队列需要新版宿主的会话创建、Prompt 提交与结果订阅能力。当前宿主会保持只读降级;用量、费用和峰谷提醒不受影响,也不会创建只排队却无法执行的任务。`,queueSafety:`安全边界:任务开始后即使进入高峰也会继续,不会强行暂停;失败或结果无法确认时不自动重试。`,queueSafetyIsolated:`当前模式:每个任务在独立会话执行,并按宿主现有权限使用工具。`,queueSafetyReuse:`当前模式:任务优先在入队时的来源会话内继续(保留上下文与工作区分组),来源会话不可用时改为新建会话;按宿主现有权限使用工具。`,queueReusePlanned:`计划在会话 {session} 继续(来源会话不可用时改为新建)`,queueReuseDone:`在会话 {session} 继续`,queueFallbackReason:`已改为新建会话:{reason}`,queueReuseModelNote:`沿用来源会话当前模型`,queueWorkspace:`工作区`,queueModel:`官方峰谷模型`,queueNoOptions:`未发现可用工作区或内置 DeepSeek 官方峰谷模型,请先完成宿主配置。中转站同名模型不参与。`,queuePromptLabel:`任务 Prompt`,queuePromptPlaceholder:`描述一个非紧急、可无人值守完成的任务。入队即授权宿主在下一低谷执行。`,queuePrivacy:`队列文件仅当前用户可读;执行后 Prompt 也会进入宿主会话日志(复用来源会话时进入那个会话)。请勿填入密码或密钥。`,queueEnqueue:`加入低谷队列`,queueImport:`导入 JSON`,queueImportHint:`JSON 数组项可为 Prompt 字符串或 { prompt, cwd?, provider?, model? };缺省沿用当前工作区与模型,整批校验后一次入队。`,queueImported:`已导入 {count} 个任务`,queueImportFormat:`导入文件须为非空 JSON 数组,每项是 Prompt 字符串或任务对象`,queueImportTooLarge:`导入文件超过 10 MiB,未读取或写入任何任务`,queueActive:`任务与历史`,queueClearFinished:`清除已结束`,queueEmpty:`队列是空的。加入一个非紧急任务,下一低谷自动开始。`,queueLoading:`正在读取队列…`,queueOpenSession:`查看会话`,queueRemoveQueued:`移出队列`,queueRemoveHistory:`删除记录`,queueStatusQueued:`等待低谷`,queueStatusStarting:`正在启动`,queueStatusRunning:`执行中`,queueStatusCompleted:`已完成`,queueStatusFailed:`需核对`,quickQueueToggle:`低谷队列`,quickQueueEntry:`低谷队列入口`,quickQueueEntryHint:`在输入框旁显示低谷队列按钮与入队控件`,quickQueueReuseEntry:`任务在来源会话继续`,quickQueueReuseEntryHint:`开启后,从会话入队的任务到点时优先在该会话内继续(保留上下文与工作区分组);来源会话已删除、正在使用或已归档时改为新建会话,并在卡片上注明原因。默认关闭。`,quickQueueEnqueue:`入队`,quickQueueEnqueueing:`入队中…`,quickQueueWaiting:`{count} 个等待任务`,quickQueueClear:`入队后清稿`,quickQueueEnqueued:`已加入低谷队列,将按队列规则调度`,quickQueueEmpty:`草稿为空,请先输入任务`,quickQueueBusy:`当前草稿正在提交,请稍后再入队`,quickQueueAttachments:`含附件或引用的草稿暂不支持入队,请改用纯文本`,quickQueueContext:`无法读取当前工作区或模型,请在新版宿主中重试`,quickQueueRoute:`当前工作区或模型不支持低谷队列,请选择官方峰谷模型`,quickQueueDraftChanged:`已入队;草稿已变化,未清空`,quickQueueUnsupported:`当前宿主不支持草稿入队,请升级宿主`,quickQueueFailed:`入队失败:{message}`},st={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,monthProjectedHint:`Month-to-date + last-7-day pace × days left`,liveTurn:`Turn`,liveSession:`Session`,liveSessionSub:`incl. sub {cost}`,calls:`Calls`,cacheHitRate:`Cache Hit`,tokens:`Tokens`,inputTokens:`Input`,outputTokens:`Output`,avgCost:`Avg cost`,kpiRange:`Range`,avgRangeToday:`Today`,avgRange7d:`7d`,avgRangeWeek:`Week`,avgRangeMonth:`Month`,avgRangeAll:`All`,avgRangeCustom:`Custom`,customRangeStart:`Start date`,customRangeEnd:`End date`,trend:`Daily cost & calls`,trend7d:`7D`,trend30d:`30D`,trendMetric:`Trend metric`,trendMetricCost:`Cost`,trendMetricTokens:`Tokens`,pricingSearch:`Search model or vendor`,bandPinHint:`click to pin to the composer`,trendEmpty:`No trend data yet`,trendTotal:`Total`,roundsUnit:`turns`,healthModelsLive:`{n} models live`,healthVendorsDown:`{n} vendors down`,healthVendorsUnavailable:`{n} vendors unavailable`,budget:`Monthly budget`,budgetRemain:`Remaining`,budgetAmount:`Budget amount`,budgetSummary:`Used {used} / {total} this month; warn at 80%, pulse red at 100%`,sessions:`Sessions`,sessionTitle:`Title`,lastActive:`Last active`,sessionOverflow:`Top {limit} of {total} sessions by cost`,budgetTierBody:`This month {cost} reached {pct}% of the budget {budget}`,models:`Model billing`,providerBilling:`Provider billing & subscriptions`,channelUnknown:`Unknown routes`,directTag:`Direct`,relayTag:`Relay`,unknownTag:`Unknown`,unknownChannelHint:`Channel is not registered in the plugin config; the spending party cannot be verified, so cost stays out of the totals while usage is still counted.`,planCountUnit:`plan(s)`,actual:`Actual`,pricing:`Model pricing`,input:`Input`,output:`Output`,cacheHit:`Cache hit`,peak:`Peak`,offPeak:`Off-peak`,flat:`Flat`,band:`Band`,close:`Close`,footer:`Polls every 30s · local dsh sessions only`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`Updated`,noData:`No billing data yet`,todayRate:`Today rate`,rateLive:`Live`,rateBuiltin:`Built-in`,pricingSyncedAt:`Synced`,pricingSyncNow:`Sync now`,pricingSyncing:`Syncing…`,promoBadge:`Promo`,promoUntil:`Promo price until {date}, then list price resumes automatically`,promoOpenEnded:`End date not announced; billed at the discounted rate until further notice, then list price resumes`,pricingTip:`DeepSeek list rates: V4.1 Flash off-peak ¥1 miss / ¥0.02 cache-hit / ¥4 output; V4 Pro off-peak ¥4.5 miss / ¥0.15 cache-hit / ¥13.5 output; peak = 2× off-peak. Weekday 9-12 / 14-18 bills at peak, all other times (weekends included) at off-peak; billed at call time.`,pricingUnit:`Unit: CNY / per 1M tokens`,pricingNotes:`Pricing notes`,ubPeak:`Peak`,ubOff:`Off`,ubStd:`Std`,peakBand:`Peak/off-peak band`,pricingSource:`Data source`,noteCache:`Cache hits are billed at the cache rate, cutting cost.`,noteBand:`Peak and off-peak prices differ; off-peak is roughly half price.`,noteSource:`Prices come from the live rate + model catalog; unlisted models count as 0 and are flagged.`,balance:`Balance`,recharge:`Top up`,rechargeHint:`Open the vendor's official top-up page`,balanceUnconfigured:`Not set`,balanceUnauthorized:`Bad key`,balanceUnreachable:`Unavailable`,uncatalogued:`Not catalogued`,estimatedPricing:`Estimated`,balanceDays:`~{days} days left`,balanceLowBody:`{name} balance {balance}, ~{days} days left, please top up`,reconcileDrift:`Detected {provider} official balance moved {spent}, this panel recorded {today}; the gap usually comes from other tools or APIs consuming too`,reconcileDismiss:`Got it`,subscriptionNotConfigured:`Key not set`,subscriptionUnauthorized:`Bad key`,subscriptionUnavailable:`Unavailable`,subscriptionInvalid:`Bad response`,subscriptionRateLimited:`Rate limited`,subscriptionSession:`Current`,subscriptionWeekly:`Weekly`,subscriptionMonthly:`Monthly`,subscriptionBilling:`Billing`,subscriptionRemaining:`{pct}% left`,subscriptionExhausted:`Exhausted`,subscriptionReset:`Resets {date}`,subscriptionNoApi:`Provider does not offer a usage API`,floatWindow:`Model usage popover`,floatModeCombined:`Combined`,floatModeSubscription:`Subscription card`,floatMode:`Display mode`,floatTargets:`Targets`,floatWindowHint:`Usage summary floating on the footer card; Combined=current style, Subscription cards=one quota card at a time (switchable).`,floatPrimaryToday:`Today`,floatPrimaryWeek:`Week`,floatPrimaryMonth:`Month`,cardDisplay:`Billing card`,cardDisplayHint:`Choose how much space the sidebar entry uses, then set its metric and range. Restore a hidden entry from native Settings or /usage. Tracking and alerts stay active.`,cardMode:`Sidebar entry`,cardModeFull:`Full card`,cardModeCompact:`Compact icon`,cardModeHidden:`Hidden`,cardModeHiddenHint:`Restore: open native Settings → Usage & billing → Full card, or open the dashboard with /usage or the Open usage billing dashboard shortcut and return to Settings.`,cardModeFallback:`This host has neither native Settings nor /usage, so Hidden falls back to the compact icon to keep the dashboard reachable.`,nativeSettingsNav:`Usage & billing`,nativeSettingsIntro:`Choose how the sidebar billing entry appears. Changes apply immediately and stay in sync with the dashboard settings.`,nativeSettingsHiddenHint:`The sidebar entry is hidden. Choose Full card or Compact icon to restore it; while hidden you can still open the dashboard with the Open usage billing dashboard shortcut (rebind it in native Settings → Shortcuts). Tracking and alerts remain active.`,shortcutOpenDashboard:`Open usage billing dashboard`,cardMetric:`Main metric`,cardMetricMoney:`Cost`,cardMetricTokens:`Tokens`,cardSpan:`Range`,cardSpanDay:`Day`,cardSpanWeek:`Week`,cardSpanMonth:`Month`,cardDeltaBadge:`Day-over-day badge`,cardDeltaShow:`Show`,cardDeltaHide:`Hide`,floatNoTargets:`No subscription selected — pick some in Settings.`,floatNoTargetsHint:`No subscription channel available.`,subscriptionsStale:`Subscription refresh failed — showing cached data`,balanceStaleNotice:`Balance refresh is slow — the figures below come from the last completed query`,staleLedgerNotice:`{count} sessions use legacy-algorithm archives (logs deleted; costs re-estimated at catalog prices); attribution may be off`,staleSnapshotNotice:`Usage is being recomputed; the figures below come from the last completed calculation (session titles may lag the workspace)`,statsLoadFailed:`Failed to read usage data; the figures below may be incomplete`,unreadableNotice:`Usage from {count} sessions is not fully counted (raw logs untouched; no data lost)`,unreadableNoLedgerNotice:`{count} of them have no archived history and are not counted at all`,unreadableFormatNotice:`{count} of them use a session format this host cannot read: newer formats recover after a host upgrade; legacy formats (e.g. v0/v3) need a one-time migration`,tokenCacheWrite:`written`,toolRank:`Tool calls`,toolName:`Tool`,userPrices:`Custom prices`,userPricesHint:`Enter actual per-1M-token prices; main views are re-costed. Pick a model key from the dropdown candidates. Leave source empty for the model default, or enter a relay origin (protocol optional) to price only that source. Fill all three off-peak fields for peak/off-peak estimation; leave them empty for flat pricing.`,userPriceSave:`Save`,userPriceModel:`Model`,userPriceSource:`Source (relay origin)`,userPriceSourceHint:`Empty = default; e.g. https://api.relay.com`,userPriceOffPeak:`Off-peak price`,userPriceNormal:`Standard price`,userPriceCurrency:`Currency`,userPriceAdd:`Add`,userPriceRemoveSelected:`Remove selected`,userPriceSelect:`Select this row`,sessionStaleBadge:`legacy`,sessionUntitled:`Untitled session`,sessionSubCost:`incl. subagents {cost}`,sessionSubCalls:`incl. subagents, {calls} calls`,sessionSubRow:`Subagent`,heatmapLess:`Less`,heatmapMore:`More`,currency:`Currency`,currencyCny:`CNY`,currencyUsd:`USD`,currencyEur:`EUR`,language:`Interface language`,heatmap:`Usage heatmap`,rounds:`Cost per turn`,roundsHint:`Last {count} rounds · bar tops show amount · fill = peak/off-peak`,anomaly:`Cost spike`,model:`Model`,thModel:`Model name`,thInputMiss:`Input (cache miss)`,thInputHit:`Input (cache hit)`,costAbbr:`cost`,tabOverview:`Overview`,tabTrends:`Trends`,tabProviders:`Bills`,tabPricing:`Rates`,tabSettings:`Settings`,budgetHint:`Set a monthly cap for projections and tier alerts`,peakAlertHint:`Alert before a tier switch, optionally via system notification`,peakAlertDescPeak:`About to enter peak hours — prices rise, plan long tasks ahead`,peakAlertDescOff:`About to enter off-peak hours — price halves, ideal for large batches`,peakAlertDescPeakZhipu:`Peak hours soon (weekdays 14:00–18:00) — Coding Plan credits will be deducted at full rate`,peakAlertDescOffZhipu:`Off-peak soon — Coding Plan credits will be deducted at 50% of base credits`,peakAlertQueuePeak:`{count} queued tasks will wait for the next off-peak window; admitted tasks keep running`,peakAlertQueueOff:`{count} queued tasks will start in order`,export:`Export`,exportCsvDay:`Daily CSV`,exportCsvSession:`Sessions CSV`,exportJson:`Full JSON`,peakShare:`Peak vs off-peak`,peakSharePerCall:`per-call attribution, full history`,offPeakSavings:`Shift peak to off-peak: save ~{amount}`,perfMax:`Max TTFT`,weekCost:`This week's spend`,roleCost:`Cost breakdown`,roleUser:`User input`,roleAssistant:`Assistant output`,roleTool:`Tool results`,roleHint:`Estimated: output priced exactly, input split by message size`,tierPeak:`Peak`,tierOff:`Off-peak`,tierToPeak:`until peak`,tierToOff:`until off-peak`,tierAlertEnterPeak:`Peak pricing (2x) starts in {minutes} min — non-urgent calls can wait`,tierAlertEnterOff:`Off-peak pricing (50% off) starts in {minutes} min`,tierAlertEnterPeakZhipu:`Zhipu peak hours in {minutes} min — Coding Plan credits burn at full rate`,tierAlertEnterOffZhipu:`Zhipu off-peak in {minutes} min — credit burn drops to 50%`,peakAlertTitlePeak:`Peak pricing incoming`,peakAlertTitleOff:`Off-peak incoming`,peakAlert:`Peak/off-peak alert`,peakAlertLeadMin:`Lead time (min)`,peakAlertPos:`Position`,peakAlertMode:`Remind mode`,peakAlertPosCorner:`Bottom-right`,peakAlertPosCenter:`Center`,peakAlertModePeak:`Entering peak only`,peakAlertModeOff:`Entering off-peak only`,peakAlertModeBoth:`Both`,peakAlertWebNotify:`Also send system notification`,peakAlertPreview:`Preview alert`,planTypeCode:`Subscription`,planTypeToken:`Usage`,subscriptionFeePerMonth:`{amount}/mo`,triggerToday:`Today's spend`,triggerMonth:`This month's spend`,triggerMonthTokens:`This month's tokens`,triggerTodayTokens:`Today's tokens`,triggerWeekTokens:`This week's tokens`,subscriptionTag:`Plan`,cellEstimateHint:`No pay-as-you-go charge recorded for this row (subscription routes are not billed per call); amount is a catalog-price estimate`,free:`Free`,perfSamples:`Samples`,perfTtft:`TTFT`,perfP50:`P50`,perfP90:`P90`,perfTps:`Speed`,perfLatency:`Total latency`,perfEstimated:`Estimated`,perfEmpty:`No performance data yet`,perfTpsUnit:`tok/s`,perfTitle:`Performance`,perfHint:`Per model & per hour; estimated samples are tool-continuation steps`,perfAll:`All`,perfChartEmpty:`No model selected or no data for this metric`,heatmapYear:`Year`,heatmapHalf:`Half`,heatmapMonth:`Month`,metricCost:`Cost`,metricTokens:`Tokens`,heatmapTotal:`Total`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginAuthor:`Author`,pluginRepository:`Repository`,pluginNpm:`npm`,pluginLicense:`License`,tabToken:`Usage`,tokenExport:`Export tokens`,tokenExportCsv:`Daily token CSV`,tokenReasoningShare:`Reasoning share`,tokenReasoningShort:`reasoning`,tokenIo:`In/out ratio`,tokenPeak:`Peak day`,tokenDaily:`Daily tokens`,tokenByModel:`Tokens by model`,tokenMiss:`Input (cache miss)`,densityLabel:`Display density`,densityHint:`Compact shrinks row height and padding, comfortable adds room; applies instantly`,densityCompact:`Compact`,densityDefault:`Default`,densityComfortable:`Comfortable`,motionLabel:`Motion strength`,motionHint:`Off freezes all entrance and data-update animations; basic interaction feedback remains`,motionOff:`Off`,motionSubtle:`Subtle`,motionRich:`Rich`,settingsNavDisplayPref:`Preferences`,settingsNavBudget:`Budget`,settingsNavAlert:`Alerts`,settingsNavDisplay:`Display`,settingsNavAdvanced:`Advanced`,settingsNavAbout:`About`,settingsSearchPlaceholder:`Search settings… (e.g. budget, peak, price)`,settingsSearchEmpty:`No settings match "{query}"`,sessionsViewAll:`View all {count} sessions`,sessionsViewTop:`View top {count} sessions by cost`,sessionViewerSearch:`Search sessions… (title / project / id)`,modelBudgetTitle:`Per-model budget`,modelBudgetHint:`Set a monthly cap per model (CNY); alerts fire once each at 80% / 100%. Empty = unlimited.`,modelBudgetBody:`"{model}" has spent {cost} this month ({pct}% of {budget})`,modelBudgetPlaceholder:`Cap`,moreWorksTitle:`More plugins`,adEngramName:`DSH Engram · Memory Palace`,adEngramDesc:`Cross-session long-term memory: graph · hybrid retrieval · flywheel`,adRainbowName:`RainbowSpeak`,adRainbowDesc:`A flowing rainbow marquee border for the chat composer`,kpiDescCacheHit:`Cache-hit tokens ÷ total input tokens. Higher hit rate means lower input cost (cache reads are ~1/10 the miss price).`,kpiDescTokens:`Total tokens = input + output. Cache reads/writes are already part of input and are not double-counted (issue #85).`,kpiDescAvgCost:`Total cost ÷ total calls within the selected range — the average cost per call.`,kpiDescCalls:`LLM calls within the selected range (web-search estimates excluded).`,kpiDescReasoning:`Reasoning tokens ÷ output tokens. A reasoning model's thinking is billed and included in output.`,kpiDescIo:`Input tokens ÷ output tokens. A high ratio usually means long context / multi-turn reuse.`,kpiDescPeak:`The day with the most processed tokens (input + output) in the range.`,healthDotLive:`Vendor online`,healthDotFailed:`Vendor probe failed`,healthDotUnknown:`Vendor status unknown`,settingsSectionDisplay:`Display preferences`,emptyHint:`Run your first conversation and per-provider usage and cost breakdown will appear here automatically`,tokenHit:`Input (cache hit)`,tokenOutput:`Output`,tokenViewStructure:`Structure`,tokenViewModel:`By model`,tokenHitShort:`Hit`,tokenMissShort:`Miss`,tokenTotal:`Total tokens`,tokenShare:`Share`,usageStatsTool:`Inject usage-stats tool`,usageStatsToolHint:`Lets the model query usage/cost inside a conversation; it consumes context per request, so keep it off for coding (takes effect immediately)`,balanceGranted:`Granted`,balanceTopped:`Topped up`,balanceDaily:`Daily burn`,balanceDaysLong:`~days left`,balanceDaysUnit:`days`,popTodayModel:`Main model balance`,popTitle:`Usage overview`,popNoConsumption:`No usage yet`,popDirectLead:`Direct`,popSubLead:`Subscription`,unpricedHint:`{count} models not priced; their cost counts as 0: {models}`,channelVisibility:`Channel visibility`,channelVisibilityHint:`Hidden channels are excluded from the statistics scope: billing groups, overview numbers, trends and usage follow along. Session / tool / role metrics have no channel dimension and stay global.`,channelVisibilityShowAll:`Show all`,channelVisibilityHidden:`{count} channel(s) hidden — their usage is excluded from the statistics scope`,channelVisibilityEmpty:`No channel data yet`,unpricedMore:`+{count} more`,unpricedFix:`Set price`,searchEstimateHint:`Includes estimated cost of {count} web-search requests (~{each} each; no usage events logged, per-call estimate; tune via searchCallEstimateCny)`,siteListDisplay:`Relay lists`,siteListDisplayHint:`Hide "unidentified" placeholder rows in the relay quota list`,liveCostBar:`Live cost capsule`,liveCostBarHint:`Live cost bar beside the composer; hover for details`,liveCostBarPosition:`Position`,liveCostBarPosBelow:`Below composer`,liveCostBarPosAbove:`Above composer`,liveCostBarPosToolbar:`Inside composer`,exportCsvSite:`By site CSV`,panelRelayQuota:`Relay quotas`,relayBalance:`Balance`,relayNoQuota:`No quota`,relayWindowUsed:`used`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`Unknown`,expandAll:`Expand all`,collapseAll:`Collapse all`,todayOnly:`Today only`,todayNoConsumption:`No usage today`,commandUsageLabel:`Open the billing dashboard`,commandUsageDescription:`See today/month spend, usage breakdown and rates`,sessionOpen:`Open session`,sessionOpenFailed:`Could not open this session (it may be deleted or absent from the current list)`,sessionOpenUnavailable:`This host does not support session navigation`,tabAgents:`Agents`,agentsSummary:`Agent network`,agentsCount:`agents`,agentsDelegations:`delegations`,agentsRoots:`conversations`,agentsMostExpensive:`costliest chain`,agentsChainTotal:`chain total`,agentsNoData:`No sub-agent delegation records yet`,agentsSubagent:`sub-agent`,agentsRoot:`conversation`,tabQueue:`Queue`,queueSubtitle:`Non-urgent tasks start only during DeepSeek official off-peak hours, one at a time`,queueUntilPeak:`Peak in`,queueUntilOffPeak:`Off-peak in`,queueUnsupportedTitle:`This host does not support the task queue`,queueUnsupportedBody:`The queue requires Session creation, Prompt admission and result streaming from a newer host. This host stays in read-only fallback: usage, billing and band alerts keep working, and no non-executing placeholder tasks are created.`,queueSafety:`Safety: an admitted task continues if peak pricing begins; it is never forcibly paused. Failures and unknown outcomes never auto-retry.`,queueSafetyIsolated:`Current mode: each task runs in its own Session with the host’s existing tool permissions.`,queueSafetyReuse:`Current mode: tasks continue inside the Session they were queued from (keeping its context and workspace grouping) and fall back to a new Session when the source is unavailable, using the host’s existing tool permissions.`,queueReusePlanned:`Will continue in Session {session} (a new Session is used if the source is unavailable)`,queueReuseDone:`Continued in Session {session}`,queueFallbackReason:`Switched to a new Session: {reason}`,queueReuseModelNote:`Uses the source Session’s current model`,queueWorkspace:`Workspace`,queueModel:`Official time-of-day model`,queueNoOptions:`No workspace or built-in DeepSeek official time-of-day model is available. Relay mirrors are not eligible.`,queuePromptLabel:`Task Prompt`,queuePromptPlaceholder:`Describe a non-urgent task that can run unattended. Enqueuing authorizes the host to run it at the next off-peak window.`,queuePrivacy:`The queue file is owner-only; executed Prompts also enter host Session logs (the source Session when it is reused). Do not enter passwords or secrets.`,queueEnqueue:`Enqueue for off-peak`,queueImport:`Import JSON`,queueImportHint:`A JSON array of Prompt strings or { prompt, cwd?, provider?, model? } objects; omitted fields use the current selection. The whole batch is validated before one atomic enqueue.`,queueImported:`Imported {count} tasks`,queueImportFormat:`The import must be a non-empty JSON array of Prompt strings or task objects`,queueImportTooLarge:`The import exceeds 10 MiB; no tasks were read or enqueued`,queueActive:`Tasks & history`,queueClearFinished:`Clear finished`,queueEmpty:`The queue is empty. Add a non-urgent task to start it at the next off-peak window.`,queueLoading:`Loading queue…`,queueOpenSession:`Open Session`,queueRemoveQueued:`Remove`,queueRemoveHistory:`Delete record`,queueStatusQueued:`Waiting`,queueStatusStarting:`Starting`,queueStatusRunning:`Running`,queueStatusCompleted:`Completed`,queueStatusFailed:`Needs review`,quickQueueToggle:`Off-peak queue`,quickQueueEntry:`Off-peak queue entry`,quickQueueEntryHint:`Show the off-peak queue button and enqueue controls beside the composer`,quickQueueReuseEntry:`Continue tasks in the source Session`,quickQueueReuseEntryHint:`When on, a task queued from a Session continues inside that Session at the next off-peak window (keeping its context and workspace grouping). A deleted, busy or archived source falls back to a new Session, with the reason shown on the card. Off by default.`,quickQueueEnqueue:`Enqueue`,quickQueueEnqueueing:`Enqueuing…`,quickQueueWaiting:`{count} waiting tasks`,quickQueueClear:`Clear after enqueue`,quickQueueEnqueued:`Added to the off-peak queue; scheduling follows the queue rules`,quickQueueEmpty:`The draft is empty; enter a task first`,quickQueueBusy:`This draft is being submitted; try enqueueing later`,quickQueueAttachments:`Drafts with attachments or references cannot be queued; use plain text`,quickQueueContext:`Cannot read the current workspace or model; retry on a newer host`,quickQueueRoute:`This workspace or model is not eligible; select an official time-of-day model`,quickQueueDraftChanged:`Enqueued; the draft changed, so it was not cleared`,quickQueueUnsupported:`This host does not support draft enqueueing; upgrade the host`,quickQueueFailed:`Enqueue failed: {message}`},R={"opencode-go":{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},opencode:{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},"kimi-coding":{type:`code`},"zai-coding-cn":{type:`code`},"zai-coding":{type:`code`},commandcode:{type:`code`},"qwen-token-plan":{type:`code`},"qwen-token-plan-cn":{type:`code`},"xiaomi-token-plan-ams":{type:`code`},"xiaomi-token-plan-cn":{type:`code`},"xiaomi-token-plan-sgp":{type:`code`},"volcengine-token-plan":{type:`code`},"ark-token-plan":{type:`code`},"doubao-token-plan":{type:`code`},minimax:{type:`code`},"minimax-cn":{type:`code`},"minimax-token-plan":{type:`code`},"minimax-token-plan-cn":{type:`code`},"hunyuan-token-plan":{type:`code`},"tencent-token-plan":{type:`code`},"hy-token-plan":{type:`code`},"xinghuo-token-plan":{type:`code`},"xfyun-coding":{type:`code`},"spark-coding":{type:`code`},"huawei-token-plan":{type:`code`},"pangu-token-plan":{type:`code`},"huawei-maas-token-plan":{type:`code`},"volcengine-agent-plan":{type:`code`},"ark-agent-plan":{type:`code`},"baidu-token-plan":{type:`code`},"ernie-token-plan":{type:`code`},"wenxin-token-plan":{type:`code`}},z={glm:`zai-coding-cn`,bigmodel:`zai-coding-cn`,zhipu:`zai-coding-cn`,zhipuai:`zai-coding-cn`,zai:`zai-coding`,ark:`volcengine-token-plan`,volcengine:`volcengine-token-plan`,doubao:`doubao-token-plan`,moonshot:`kimi-coding`,kimi:`kimi-coding`,xiaomi:`xiaomi-token-plan-cn`,opencode:`opencode-go`};function ct(e){return e===``?e:z[e]??e}function lt(e){let t=R[ct(e)];return t?.type===`code`?t.tier:void 0}let ut=[{key:`deepseek-v4-flash`,input:.14,cacheHit:.0028,output:.28},{key:`deepseek-v4-pro`,input:.435,cacheHit:.003625,output:.87},{key:`gpt-5.6-sol`,input:5,cacheHit:.5,output:30},{key:`gpt-5.6-terra`,input:2,cacheHit:.2,output:12},{key:`gpt-5.6-luna`,input:.2,cacheHit:.02,output:1.2},{key:`glm-5.2`,input:1.4,cacheHit:.26,output:4.4},{key:`qwen3.8-max`,input:2,cacheHit:.21,output:6},{key:`kimi-k3`,input:2.82,cacheHit:.28,output:14.08},{key:`grok-4.6`,input:2,cacheHit:.5,output:6},{key:`gemini-2.5-pro`,input:1.25,cacheHit:.125,output:10}],dt,B,ft,V,pt,mt;function ht(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function gt(e,t){return ht(e)===ht(t)}function _t(e){mt=e.length>0?e:void 0}function vt(){return mt}function yt(e){return on(e)}function bt(e,t){let n=H(e,t);if(n!==void 0)return{input:n.input,cacheHit:n.cacheHit,output:n.output,...n.currency===void 0?{}:{currency:n.currency},...n.offPeak===void 0?{}:{offPeak:n.offPeak}}}function H(e,t){if(mt===void 0)return;let n=yt(e),r=U(n),i=e=>yt(e.key)===n||U(e.key)===r;if(t!==void 0){for(let e of mt)if(e.origin!==void 0&&e.origin!==``&&i(e)&>(e.origin,t))return e}for(let e of mt)if((e.origin===void 0||e.origin===``)&&i(e))return e}function xt(e){if(mt===void 0)return;let t=yt(e),n=U(t);return mt.find(e=>e.origin!==void 0&&e.origin!==``&&(yt(e.key)===t||U(e.key)===n))}function St(e){dt=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,B=typeof e.rateEur==`number`&&Number.isFinite(e.rateEur)&&e.rateEur>0?e.rateEur:void 0,ft=e.prices,V=e.extraModels}function Ct(e){pt=e}function wt(){return dt??6.79}function Tt(){return B??7.71}function Et(){return{rate:wt(),live:dt!==void 0}}function Dt(){return{rate:Tt(),live:B!==void 0}}let Ot=.5;function kt(e){return e==null||!Number.isFinite(e)?`peak`:At(e,Pt,!0)}function At(e,t,n=!1){if(jt(e)||n&&Nt(e))return`offPeak`;let r=Math.floor(It(e)/6e4);for(let e=0;e+1<t.length;e+=2){let n=t[e]??0,i=t[e+1]??0;if(r>=n&&r<i)return`peak`}return`offPeak`}function jt(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}function Mt(e){return new Date(e+288e5).toISOString().slice(0,10).replace(/-/g,``)}function Nt(e){return`20260925 20260926 20260927 20261001 20261002 20261003 20261004 20261005 20261006 20261007`.includes(Mt(e))}let Pt=[540,720,840,1080],Ft=[840,1080];function It(e){return((e+288e5)%864e5+864e5)%864e5}function Lt(e,t,n=!1){let r=At(e,t,n),i=It(e);for(let a=0;a<10;a++){let o=a*864e5-i;for(let i of t){let a=o+i*6e4;if(!(a<=0)&&At(e+a,t,n)!==r)return{tier:r,nextSwitchInMs:a}}}let a=t[0]??0;return{tier:r,nextSwitchInMs:864e5-i+a*6e4}}function Rt(e,t,n,r=!1){let{nextSwitchInMs:i}=Lt(e,t,r);if(i>n)return null;let a=e+i;return{entering:At(a,t,r),atMs:a}}function zt(e,t){if(e===void 0||e===``)return`none`;let n=on(e),r=Kt().find(e=>e.key===n)?.provider;return r===`DeepSeek`?`deepseek-metered`:t&&r===`智谱 AI`?`zhipu-coding-plan`:`none`}function Bt(e,t){switch(t){case`deepseek-metered`:return Lt(e,Pt,!0);case`zhipu-coding-plan`:return Lt(e,Ft);case`none`:return null}}function Vt(e,t,n){switch(t){case`deepseek-metered`:return Rt(e,Pt,n,!0);case`zhipu-coding-plan`:return Rt(e,Ft,n);case`none`:return null}}function Ht(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/60),r=t%60;return n>0?`${n}h${String(r).padStart(2,`0`)}m`:`${r}m`}let Ut=[],Wt={};function Gt(e,t){Ut=e,Wt=t,Yt=void 0}function Kt(){return Ut}function qt(){return Wt}let Jt={key:`other`,name:`其他模型`,provider:`Custom`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:0,cacheHit:0,cacheMiss:0,output:0}};function U(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let Yt;function Xt(){if(Yt!==void 0)return Yt;let e=new Map,t=(t,n)=>{let r=U(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of Ut)t(e.key,e.key);for(let[e,n]of Object.entries(Wt))t(e,n);for(let e of ut)t(e.key,e.key);return Yt=e,e}let Zt,Qt,$t;function en(){if(Zt===V)return;let e=new Map,t=new Map;for(let n of V??[]){t.has(n.key)||t.set(n.key,n);let r=U(n.key);r!==``&&!e.has(r)&&e.set(r,n)}Zt=V,Qt=e,$t=t}function tn(){return en(),Qt??new Map}function nn(){return en(),$t??new Map}function rn(e){let t=[],n=e=>{e!==``&&!t.includes(e)&&t.push(e)},r=e=>{let t=e;for(;;){let e=t.replace(/[-_]\d{3,}$/u,``);if(e===t||e===``)return;t=e,n(t)}},i=e.lastIndexOf(`/`);if(i>0&&i<e.length-1){let t=e.slice(i+1);n(t),r(t)}let a=e.split(/[::]/u);if(a.length>1){for(let e=1;e<a.length;e+=1){let t=a.slice(e).join(`:`);n(t),r(t)}for(let e=0;e<a.length-1;e+=1){let t=a.slice(e,a.length-1).join(`:`);n(t),r(t)}}return r(e),t}function an(e){let t=qt()[e];if(t!==void 0)return t;let n=U(e);if(n===``)return;let r=Xt().get(n);return r===void 0?tn().get(n)?.key:r}function on(e){let t=qt()[e]??e;if(t===e){let t=U(e);if(t!==``){let e=Xt().get(t);if(e!==void 0)return e;let n=tn().get(t);if(n!==void 0)return n.key}for(let t of rn(e)){let e=an(t);if(e!==void 0)return e}}return t}function sn(e){let t=on(e),n=ft?.[t];if(n!==void 0)return n;let r=ut.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function cn(e){let t=on(e),n=Kt().find(e=>e.key===t),r=nn().get(t),i=n??(r===void 0?Kt().find(e=>e.key===`other`)??Jt:ln(r)),a=bt(t);if(a!==void 0)return{...i,userPriced:!0,price:{currency:a.currency??`CNY`,input:a.input,cacheHit:a.cacheHit,output:a.output,...a.offPeak===void 0?{}:{offPeak:a.offPeak}}};let o=sn(t);if(o===void 0||i.price.offPeak!==void 0)return i;let s=i.price.cacheWrite!==void 0&&i.price.input>0?o.input*(i.price.cacheWrite/i.price.input):void 0;return{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output,...s===void 0?{}:{cacheWrite:s}}}}function ln(e){return{key:e.key,name:e.name,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:e.price.input,cacheHit:e.price.cacheHit,output:e.price.output,...e.price.cacheWrite===void 0?{}:{cacheWrite:e.price.cacheWrite}}}}function un(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs,r=e.startsAtMs!==void 0&&t<e.startsAtMs;return Number.isFinite(t)&&!n&&!r&&e.factor>=0&&e.factor<1}function dn(e,t){let{promo:n}=e;if(n===void 0||!un(n,t))return e;let r=e=>{let t=n.factors?.[e];return t!==void 0&&t>=0&&t<1?t:n.factor},i=e=>({input:e.input*r(`input`),cacheHit:e.cacheHit*r(`cacheHit`),...e.cacheMiss===void 0?{}:{cacheMiss:e.cacheMiss*r(`cacheMiss`)},...e.cacheWrite===void 0?{}:{cacheWrite:e.cacheWrite*r(`cacheWrite`)},output:e.output*r(`output`)});return{...e,price:{...i(e.price),currency:e.price.currency,...e.price.offPeak===void 0?{}:{offPeak:i(e.price.offPeak)}}}}function fn(e=Date.now()){let t=[...Kt().filter(e=>e.retired!==!0).map(t=>dn(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>U(e.key)));for(let e of pt??[]){let i=e.id.toLowerCase();if((()=>{let t=on(e.id);return Kt().find(e=>e.key===t)})()!==void 0)continue;let a=U(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=tn().get(a),s;if(o!==void 0)s=ln(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=sn(i);s=t===void 0?{key:on(e.id),name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:0,cacheHit:0,output:0},uncatalogued:!0}:{key:i,name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:t.input,cacheHit:t.cacheHit,output:t.output}}}n.add(s.key.toLowerCase()),a!==``&&r.add(a),t.push(s)}return t.map(e=>{let t=bt(e.key);return t===void 0?e:{...e,userPriced:!0,price:{currency:t.currency??`CNY`,input:t.input,cacheHit:t.cacheHit,output:t.output}}})}function pn(e,t,n){let r=t.cacheMiss>0?t.cacheMiss:Math.max(0,t.input-t.cacheHit),i=Math.min(t.cacheWrite??0,r),a=r-i,o=Math.min(t.cacheHit,t.input),s=(a*(e.cacheMiss??e.input)+i*(e.cacheWrite??e.input)+o*e.cacheHit+t.output*e.output)/1e6;return n===`USD`?s*wt():s}function mn(e,t,n=Ot,r=Date.now()){let i=dn(e,r),a=pn(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:pn(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function hn(e){let t=wt();return t>0?e/t:e}function gn(e,t){if(t===`usd`)return hn(e);if(t===`eur`){let t=Tt();return t>0?e/t:e}return e}function W(e,t=`cny`){let n=Number(e),r=t===`usd`?`$`:t===`eur`?`€`:`¥`;return!Number.isFinite(n)||n<=0?`${r}0`:n>=1e3?`${r}${n.toFixed(0)}`:n>=10?`${r}${n.toFixed(1)}`:n>=.1?`${r}${n.toFixed(2)}`:`${r}${n.toFixed(3)}`}function _n(e,t=`CNY`){return`${t===`USD`?`$`:t===`EUR`?`€`:`¥`}${e.toFixed(e>=10?1:2)}`}function vn(e,t,n,r){if(r<=0||!Number.isFinite(r))return e;let i=t===`USD`?e*r:e;if(n===`cny`)return i;if(n===`usd`)return i/r;let a=Dt().rate;return a>0?i/a:i}function G(e=Date.now()){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function K(e){return e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function yn(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}function bn(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function xn(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function Sn(e){return e.toFixed(2)}function Cn(e){return[`date,calls,input,output,cache_hit,cache_miss,cost_cny`,...Object.keys(e).sort().map(t=>{let n=e[t];return n===void 0?``:[t,n.calls,n.input,n.output,n.cacheHit,n.cacheMiss,Sn(n.cost)].join(`,`)})].join(`
|
|
2
|
+
`)}function wn(e){return[`site,kind,calls,cost_cny`,...Object.entries(e).map(([e,t])=>{let n=e.startsWith(`site:`)?e.slice(5):e.startsWith(`direct:`)?e.slice(7):`unknown`,r=e.startsWith(`site:`)?`site`:e.startsWith(`direct:`)?`direct`:`unknown`;return[bn(xn(n)),r,t.calls,Sn(t.cost)].join(`,`)})].join(`
|
|
3
|
+
`)}function Tn(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function En(e){return[`session_id,title,project,calls,cost_cny,last_active,parent_id,sub_calls,sub_cost_cny`,...e.map(e=>[bn(xn(e.id)),bn(xn(e.title??``)),bn(xn(Tn(e.cwd))),e.calls,Sn(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``,e.parentId??``,e.subCalls??``,e.subCost===void 0?``:Sn(e.subCost)].join(`,`))].join(`
|
|
4
|
+
`)}function Dn(e,t,n){let r=[...n].sort(),i=r[0],a=r.at(-1);return`${e}${i!==void 0&&a!==void 0?`-${i}_${a}`:``}.${t}`}function On(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(r),0)}function kn(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let q={top:14,right:18,bottom:22,left:46},An=`var(--ds-blue)`,jn=`var(--ds-cyan)`,Mn=`var(--ds-amber)`;function Nn(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function Pn(e){let{stats:t,trendDays:n,onTrendDays:r,t:i}=e,a=e.money,o=e.models??[],{byDay:s,byModel:c,total:l}=t,[u,f]=(0,d.useState)(null),[p,h]=(0,d.useState)(`structure`),[g,_]=(0,d.useState)(null),v=t.byDayModels!==void 0,b=e=>{h(e),_(null)},x=(0,d.useMemo)(()=>{let e=t.byRole;if(e===void 0)return[];let n=e.user+e.assistant+e.tool;return n<=0?[]:[{label:i(`roleUser`),value:e.user,seg:L.shareSegUser},{label:i(`roleAssistant`),value:e.assistant,seg:L.shareSegAssistant},{label:i(`roleTool`),value:e.tool,seg:L.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,i]),S=(0,d.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=G(n.getTime()),i=s[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[s,n]),C=(0,d.useMemo)(()=>{let e=[];for(let r=n-1;r>=0;--r){let n=new Date;n.setDate(n.getDate()-r);let i=G(n.getTime()),a=t.byDayModels?.[i],o={},s=0;if(a!==void 0)for(let[e,t]of Object.entries(a)){let n=t.cacheHit??0,r=t.cacheMiss??0,i=t.output??0,a=n+r+i;a<=0||(o[e]={hit:n,miss:r,output:i,total:a},s+=a)}e.push({date:i,models:o,total:s})}return e},[t.byDayModels,n]),w=(0,d.useMemo)(()=>{let e=new Map;for(let t of C)for(let[n,r]of Object.entries(t.models))e.set(n,(e.get(n)??0)+r.total);return[...e.entries()].sort((e,t)=>t[1]-e[1]).map(([e])=>({key:e,name:o.find(t=>t.key===e)?.name??cn(e).name,color:o.find(t=>t.key===e)?.color??`#8b95a3`}))},[C,o]),T=g!==null&&w.some(e=>e.key===g)?g:null,E=e=>{if(v){if(p!==`model`){h(`model`),_(e);return}_(t=>t===e?null:e)}},ee=(0,d.useMemo)(()=>{let e=0;return Object.entries(c).filter(([,e])=>e.calls>0).map(([t,n])=>{let r=n.input+n.output;e+=r;let i=n.cacheHit+n.cacheMiss;return{key:t,name:cn(t).name,input:n.input,output:n.output,reasoning:n.reasoning??0,calls:n.calls,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,cacheHitRate:i>0?n.cacheHit/i*100:0,total:r,share:0}}).sort((e,t)=>t.total-e.total).map(t=>({...t,share:e>0?t.total/e:0}))},[c]),te=(0,d.useMemo)(()=>{let e=new Map;for(let n of Object.values(t.byDayModelsSite??{}))for(let[t,r]of Object.entries(n)){let n=e.get(t)??[];for(let[e,t]of Object.entries(r)){let r=n.find(t=>t.siteKey===e);if(r===void 0){n.push({siteKey:e,tokens:t.input+t.output,cost:t.cost});continue}r.tokens+=t.input+t.output,r.cost+=t.cost}e.set(t,n)}for(let[t,n]of e)e.set(t,[...n].sort((e,t)=>t.tokens-e.tokens));return e},[t.byDayModelsSite]),D=(0,d.useMemo)(()=>{let e=Object.entries(t.byTool??{}),n=e.slice(0,8),r=e.slice(8).reduce((e,[,t])=>e+t,0),i=e.reduce((e,[,t])=>e+t,0);return{top:n,rest:r>0?[[`…`,r]]:[],totalCalls:i}},[t.byTool]),O=(0,d.useMemo)(()=>{let e=S.length;if(e===0)return null;let t=680-q.left-q.right,n=200-q.top-q.bottom,r=Math.max(...p===`model`?C.map(e=>e.total):S.map(e=>e.miss+e.hit+e.output),1),i=e=>q.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?q.left+t/2:q.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l,groupW:a}},[S,C,p]),ne=()=>{On(`token-daily-${G()}.csv`,Fn(S),`text/csv`)},k=()=>{On(`token-${G()}.json`,Nn(S,ee,C,l),`application/json`)},A=u===null?void 0:S[u],j=u===null?void 0:C[u],re=O===null?0:Math.ceil(80/Math.max(O.groupW,1)),ie=u===null||O===null?void 0:u>=O.n-re?L.chartTooltipAlignRight:u<re?L.chartTooltipAlignLeft:void 0;return(0,m.jsxs)(`div`,{className:L.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,m.jsxs)(`div`,{className:L.exportBar,role:`group`,"aria-label":i(`tokenExport`),children:[(0,m.jsx)(`span`,{className:L.exportLabel,children:i(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-token-export-csv`,onClick:ne,children:i(`tokenExportCsv`)}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-token-export-json`,onClick:k,children:i(`exportJson`)})]}),(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-token-daily`,children:[(0,m.jsxs)(`div`,{className:L.panelHead,children:[(0,m.jsx)(`h3`,{className:L.panelTitle,children:i(`tokenDaily`)}),(0,m.jsxs)(`span`,{className:L.panelHeadControls,children:[v&&(0,m.jsx)(`span`,{className:L.rangeToggle,role:`group`,"aria-label":i(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.rangeButton,p===e&&L.rangeButtonActive),"aria-pressed":p===e,onClick:()=>{b(e)},"data-testid":`billing-token-view-${e}`,children:i(e===`structure`?`tokenViewStructure`:`tokenViewModel`)},e))}),(0,m.jsx)(`span`,{className:L.rangeToggle,role:`group`,"aria-label":i(`tokenDaily`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.rangeButton,n===e&&L.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{r(e)},"data-testid":`billing-token-${e}d`,children:i(e===7?`trend7d`:`trend30d`)},e))})]})]}),O===null||p===`model`&&w.length===0?(0,m.jsx)(`div`,{className:L.chartEmpty,children:i(`trendEmpty`)}):(0,m.jsxs)(`div`,{className:L.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:L.chartSvg,role:`img`,"aria-label":i(`tokenDaily`),onMouseLeave:()=>{f(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-q.left)/O.plotW,r=Math.round(n*(O.n-1));f(Math.min(Math.max(r,0),O.n-1))},children:[[0,.5,1].map(e=>{let t=O.max*e,n=O.y(t);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`line`,{x1:q.left,x2:680-q.right,y1:n,y2:n,className:L.chartGrid}),(0,m.jsx)(`text`,{x:q.left-8,y:n+3,textAnchor:`end`,className:L.chartAxisLabel,children:kn(t)})]},e)}),p===`structure`?S.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=O.y(0),i=O.y(e.miss),a=O.y(e.miss+e.hit),o=O.y(e.miss+e.hit+e.output);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`rect`,{x:n,y:i,width:O.barW,height:r-i,fill:An}),(0,m.jsx)(`rect`,{x:n,y:a,width:O.barW,height:i-a,fill:jn}),(0,m.jsx)(`rect`,{x:n,y:o,width:O.barW,height:a-o,fill:Mn})]},e.date)}):C.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=0;return(0,m.jsx)(`g`,{children:w.map(t=>{let i=e.models[t.key];if(i===void 0)return null;let a=O.y(r);r+=i.total;let o=O.y(r),s=T!==null&&t.key!==T;return(0,m.jsx)(`rect`,{x:n,y:o,width:O.barW,height:a-o,fill:t.color,opacity:s?.15:1},t.key)})},e.date)}),O.indices.map(e=>{let t=S[e];return t===void 0?null:(0,m.jsx)(`text`,{x:O.inner(e),y:194,textAnchor:`middle`,className:L.chartAxisLabel,children:t.date.slice(5)},t.date)}),u!==null&&(0,m.jsx)(`line`,{x1:O.inner(u),x2:O.inner(u),y1:q.top,y2:q.top+O.plotH,className:L.chartCrosshair})]}),u!==null&&p===`structure`&&A!==void 0&&(0,m.jsxs)(`div`,{className:y(L.chartTooltip,ie),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(u)/680*100}%`,top:`${O.y(A.miss+A.hit+A.output)/200*100}%`},children:[(0,m.jsxs)(`div`,{className:L.chartTooltipHead,children:[(0,m.jsx)(`span`,{className:L.chartTooltipDate,children:A.date}),(0,m.jsx)(`strong`,{children:(A.miss+A.hit+A.output).toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(L.chartTooltipRow,L.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:L.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:jn}}),i(`tokenHit`)]}),(0,m.jsx)(`strong`,{children:A.hit.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(L.chartTooltipRow,L.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:L.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:An}}),i(`tokenMiss`)]}),(0,m.jsx)(`strong`,{children:A.miss.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(L.chartTooltipRow,L.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:L.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:Mn}}),i(`tokenOutput`)]}),(0,m.jsx)(`strong`,{children:A.output.toLocaleString()})]})]}),u!==null&&p===`model`&&j!==void 0&&(0,m.jsxs)(`div`,{className:y(L.chartTooltip,ie),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(u)/680*100}%`,top:`${O.y(j.total)/200*100}%`},children:[(0,m.jsxs)(`div`,{className:L.chartTooltipHead,children:[(0,m.jsx)(`span`,{className:L.chartTooltipDate,children:j.date}),(0,m.jsx)(`strong`,{children:j.total.toLocaleString()})]}),w.map(e=>{let t=j.models[e.key];return t===void 0?null:(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:y(L.chartTooltipRow,L.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:L.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,m.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:L.chartTooltipModelDetail,children:[i(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,i(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,i(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,m.jsx)(`div`,{className:L.chartLegend,children:p===`structure`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:An}}),i(`tokenMiss`)]}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:jn}}),i(`tokenHit`)]}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:Mn}}),i(`tokenOutput`)]})]}):w.map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(L.chartLegendItem,T===e.key&&L.chartLegendItemActive),"aria-pressed":T===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{E(e.key)},children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-token-models`,children:[(0,m.jsx)(`div`,{className:L.panelHead,children:(0,m.jsx)(`h3`,{className:L.panelTitle,children:i(`tokenByModel`)})}),ee.length===0?(0,m.jsx)(`div`,{className:L.emptyRow,children:i(`noData`)}):(0,m.jsx)(`div`,{className:L.tableScroll,children:(0,m.jsxs)(`table`,{className:L.modelTable,"data-testid":`billing-token-model-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:i(`model`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`inputTokens`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`outputTokens`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`tokenReasoningShort`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`tokenTotal`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`tokenShare`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`calls`)})]})}),(0,m.jsx)(`tbody`,{children:ee.map(t=>(0,m.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:y(v&&L.modelRowFocusable,T===t.key&&L.modelRowActive),"aria-selected":v?T===t.key:void 0,onClick:v?()=>{E(t.key)}:void 0,tabIndex:v?0:void 0,onKeyDown:v?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),E(t.key))}:void 0,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:L.modelName,children:t.name}),(te.get(t.key)??[]).length>0&&(0,m.jsx)(`span`,{className:L.modelChannels,"data-testid":`billing-token-model-channels-${t.key}`,children:(te.get(t.key)??[]).slice(0,3).map(n=>(0,m.jsxs)(`span`,{className:L.modelChannelTag,title:`${e.channelName?.(n.siteKey)??n.siteKey} · ${K(n.tokens)} token · ${a(n.cost)}`,children:[e.channelName?.(n.siteKey)??n.siteKey,` · `,t.total>0?`${(n.tokens/t.total*100).toFixed(0)}%`:`—`]},n.siteKey))})]}),(0,m.jsx)(`td`,{className:L.numCol,children:K(t.input)}),(0,m.jsx)(`td`,{className:L.numCol,children:K(t.output)}),(0,m.jsx)(`td`,{className:L.numCol,children:t.reasoning>0?K(t.reasoning):(0,m.jsx)(`span`,{className:L.na,children:`—`})}),(0,m.jsxs)(`td`,{className:L.numCol,children:[t.cacheHitRate.toFixed(1),`%`]}),(0,m.jsx)(`td`,{className:L.numCol,children:K(t.total)}),(0,m.jsx)(`td`,{className:L.numCol,children:(0,m.jsxs)(`span`,{className:L.tokenModelShareRow,children:[(0,m.jsx)(`span`,{className:L.tokenModelBar,children:(0,m.jsxs)(`span`,{className:L.tokenModelParts,style:{width:`${(t.share*100).toFixed(2)}%`},children:[(0,m.jsx)(`span`,{className:L.tokenModelPartIn,style:{width:`${t.total>0?t.input/t.total*100:0}%`}}),(0,m.jsx)(`span`,{className:L.tokenModelPartOut,style:{width:`${t.total>0?t.output/t.total*100:0}%`}})]})}),(t.share*100).toFixed(1),`%`]})}),(0,m.jsx)(`td`,{className:L.numCol,children:t.calls.toLocaleString()})]},t.key))})]})})]}),D.totalCalls>0&&(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-token-tools`,children:[(0,m.jsx)(`div`,{className:L.panelHead,children:(0,m.jsx)(`h3`,{className:L.panelTitle,children:i(`toolRank`)})}),(0,m.jsx)(`div`,{className:L.tableScroll,children:(0,m.jsxs)(`table`,{className:L.modelTable,"data-testid":`billing-tool-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:i(`toolName`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`calls`)}),(0,m.jsx)(`th`,{className:L.numCol,children:i(`tokenShare`)})]})}),(0,m.jsx)(`tbody`,{children:[...D.top,...D.rest].map(([e,t])=>(0,m.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`span`,{className:L.modelName,children:e})}),(0,m.jsx)(`td`,{className:L.numCol,children:t.toLocaleString()}),(0,m.jsxs)(`td`,{className:L.numCol,children:[(t/D.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),x.length>0&&(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-panel-roles`,children:[(0,m.jsxs)(`div`,{className:L.panelHead,children:[(0,m.jsx)(`h3`,{className:L.panelTitle,children:i(`roleCost`)}),(0,m.jsx)(`span`,{className:L.panelHint,children:i(`roleHint`)})]}),(0,m.jsx)(`div`,{className:L.shareTrack,"data-testid":`billing-role-track`,children:x.map(e=>(0,m.jsx)(`div`,{className:y(L.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,m.jsx)(`div`,{className:L.shareLegend,children:x.map(e=>(0,m.jsxs)(`span`,{className:L.shareItem,children:[(0,m.jsx)(`span`,{className:y(L.shareDot,e.seg)}),e.label,(0,m.jsxs)(`span`,{className:L.shareValue,children:[a(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function Fn(e){return[`date,missInput,cacheHit,output,reasoning,total`,...e.map(e=>`${e.date},${e.miss},${e.hit},${e.output},${e.reasoning},${e.miss+e.hit+e.output}`)].join(`
|
|
5
|
+
`)}let J={top:18,right:40,bottom:26,left:46};function In(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function Ln(e,t){let n=[];for(let r=0;r<e;r+=t)n.push(r);return e>0&&n[n.length-1]!==e-1&&n.push(e-1),n}let Rn={key:`__total__`,name:``,color:``};function zn({data:e,models:t=[],currency:n=`cny`,metric:r=`cost`,t:i}){let a=i??(e=>ot[e]),[o,s]=(0,d.useState)(null),c=e=>W(gn(e,n),n),l=e=>r===`tokens`?kn(e):c(e),u=e=>r===`tokens`?e.tokens??0:e.cost,f=(0,d.useMemo)(()=>{let n=e.length;if(n===0)return null;let i=680-J.left-J.right,a=220-J.top-J.bottom,o=e=>n===1?J.left+i/2:J.left+i*e/(n-1),s=Math.max(...r===`tokens`?e.map(e=>e.tokens??0):e.map(e=>Math.max(e.cost,Object.values(e.byModel??{}).reduce((e,t)=>e+t,0))),1e-4),c=e=>J.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>J.top+a-e/l*a,f=i/n,p=Math.min(18,f*.6);return{n,plotW:i,plotH:a,inner:o,yCost:c,yCalls:d,barW:p,bars:e.flatMap((e,n)=>{let i=o(n)-p/2;if(t.length===0||r===`tokens`)return[{date:e.date,model:Rn,x:i,base:0,value:u(e),topRounded:!0}];let a=null;for(let n of t)(e.byModel?.[n.key]??0)>0&&(a=n.key);let s=0;return t.map(t=>{let n=e.byModel?.[t.key]??0,r={date:e.date,model:t,x:i,base:s,value:n,topRounded:t.key===a};return s+=n,r})}),costTicks:[0,.25,.5,.75,1].map(e=>s*e).reverse(),callsTicks:[0,.25,.5,.75,1].map(e=>l*e).reverse(),linePath:e.map((e,t)=>{let n=d(e.calls);return`${t===0?`M`:`L`}${o(t)} ${n}`}).join(` `)}},[e,t,r]);if(f===null)return(0,m.jsx)(`div`,{className:L.chartEmpty,children:a(`trendEmpty`)});let{n:p,plotW:h,plotH:g,inner:_,yCost:v,yCalls:y,barW:b,bars:x,costTicks:S,callsTicks:C,linePath:w}=f,T=o===null?void 0:e[o],E=Ln(p,Math.max(1,Math.ceil(p/8)));return(0,m.jsxs)(`div`,{className:L.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:L.chartSvg,role:`img`,"aria-label":`Daily cost by model and total calls`,onMouseLeave:()=>{s(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-J.left)/h,r=Math.round(n*(p-1));s(Math.min(Math.max(r,0),p-1))},children:[S.map((e,t)=>{let n=v(e);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`line`,{x1:J.left,x2:680-J.right,y1:n,y2:n,className:L.chartGrid}),(0,m.jsx)(`text`,{x:J.left-8,y:n+3,textAnchor:`end`,className:L.chartAxisLabel,children:l(e)})]},`cost-${t}`)}),x.map(t=>{if(t.value>0)return(0,m.jsx)(`rect`,{x:t.x,y:v(t.base+t.value),width:b,height:v(t.base)-v(t.base+t.value),rx:t.topRounded?2:0,className:t.model.color===``?L.chartBar:L.chartStack,style:t.model.color===``?void 0:{fill:t.model.color}},`${t.date}-${t.model.key}`);let n=e.find(e=>e.date===t.date);return n!==void 0&&n.calls>0&&t.base===0?(0,m.jsx)(`rect`,{x:t.x,y:v(0)-1,width:b,height:1,rx:0,className:L.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,m.jsx)(`path`,{d:w,fill:`none`,className:L.chartLine}),(()=>{let t=G(),n=e.findIndex(e=>e.date===t);return n>=0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`chartAreaGrad`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:`var(--ds-blue)`,stopOpacity:`0.35`}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:`var(--ds-blue)`,stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:`${w} L ${_(e.length-1)} ${y(0)} L ${_(0)} ${y(0)} Z`,fill:`url(#chartAreaGrad)`}),(0,m.jsx)(`line`,{x1:_(n),x2:_(n),y1:J.top,y2:J.top+g,stroke:`var(--ds-amber)`,strokeWidth:`1`,strokeDasharray:`3 3`,opacity:`0.6`}),(0,m.jsx)(`text`,{x:_(n)+4,y:J.top-6,fill:`var(--ds-amber)`,fontSize:`10`,fontFamily:`var(--font-num)`,children:In(t)})]}):null})(),C.map((e,t)=>{let n=y(e);return(0,m.jsx)(`text`,{x:680-J.right+8,y:n+3,textAnchor:`start`,className:L.chartAxisLabel,children:kn(e)},`calls-${t}`)}),E.map(t=>{let n=e[t];return n===void 0?null:(0,m.jsx)(`text`,{x:_(t),y:214,textAnchor:`middle`,className:L.chartAxisLabel,children:In(n.date)},n.date)}),o!==null&&(0,m.jsx)(`line`,{x1:_(o),x2:_(o),y1:J.top,y2:J.top+g,className:L.chartCrosshair})]}),T!==void 0&&o!==null&&(0,m.jsxs)(`div`,{className:L.chartTooltip,style:{left:`${_(o)/680*100}%`,top:`${v(T.cost)/220*100}%`},children:[(0,m.jsx)(`div`,{className:L.chartTooltipDate,children:T.date}),r!==`tokens`&&t.filter(e=>(T.byModel?.[e.key]??0)>0).map(e=>(0,m.jsxs)(`div`,{className:L.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,m.jsx)(`strong`,{children:c(T.byModel?.[e.key]??0)})]},e.key)),(0,m.jsxs)(`div`,{className:L.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:L.chartLegendBar}),a(`trendTotal`),` `,(0,m.jsx)(`strong`,{children:r===`tokens`?kn(T.tokens??0):c(T.cost)})]}),(0,m.jsxs)(`div`,{className:L.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:L.chartLegendLine}),a(`calls`),` `,(0,m.jsx)(`strong`,{children:T.calls.toLocaleString()})]})]}),t.length>0&&r!==`tokens`&&(0,m.jsxs)(`div`,{className:L.chartLegend,children:[t.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:L.chartLegendLine}),a(`calls`)]})]})]})}let Y={top:14,right:42,bottom:22,left:46};function Bn(e){return e.slice(5,13).replace(`T`,` `)}function Vn(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function Hn(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Un(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Wn(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function Gn({perf:e,models:t,t:n}){let[r,i]=(0,d.useState)(()=>Ge()),[a,o]=(0,d.useState)(null),s=e=>{i(e),Ke(e)},c=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,l=(0,d.useMemo)(()=>e===void 0?[]:Object.entries(e.byModel).map(([e,n])=>({key:e,name:t.find(t=>t.key===e)?.name??e,color:c(e),samples:n.samples,ttftAvg:n.ttftAvg,ttftP50:n.ttftP50,ttftP90:n.ttftP90,...n.ttftMax===void 0?{}:{ttftMax:n.ttftMax},...n.ttftSpikes===void 0?{}:{ttftSpikes:n.ttftSpikes},...n.tpsAvg===void 0?{}:{tpsAvg:n.tpsAvg},latencyAvg:n.latencyAvg,estimatedSamples:n.estimatedSamples})).sort((e,t)=>t.samples-e.samples||t.ttftP90-e.ttftP90),[e,t]),u=(0,d.useMemo)(()=>{if(e===void 0)return[];if(r.models!==void 0){let t=new Set(Object.keys(e.byModel));return r.models.filter(e=>t.has(e))}return l.slice(0,5).map(e=>e.key)},[e,l,r.models]),f=(0,d.useMemo)(()=>{if(e===void 0)return null;let t=Object.keys(e.byHourModel).sort().slice(-48);if(t.length===0)return null;let n=t.length,i=680-Y.left-Y.right,a=180-Y.top-Y.bottom,o=e=>n===1?Y.left+i/2:Y.left+i*e/(n-1),s=new Set(u),c=e=>r.metric===`ttft`?e?.ttftAvg:e?.tpsAvg,d=[],f=0;for(let r of l){if(!s.has(r.key))continue;let i=[];for(let a=0;a<n;a++){let n=t[a];if(n===void 0)continue;let s=c(e.byHourModel[n]?.[r.key]);s===void 0||!Number.isFinite(s)||(i.push({i:a,x:o(a),y:0,v:s}),s>f&&(f=s))}d.push({key:r.key,name:r.name,color:r.color,segments:[],points:i})}let p=d.reduce((e,t)=>e+t.points.length,0);f=Math.max(f,1);let m=e=>Y.top+a-e/f*a;for(let e of d){let t=``,n=-2;for(let r of e.points)r.y=m(r.v),t!==``&&r.i!==n+1&&(e.segments.push(t),t=``),t+=`${t===``?`M`:`L`}${r.x} ${r.y} `,n=r.i;t!==``&&e.segments.push(t)}let h=Math.max(1,Math.ceil(n/8)),g=[];for(let e=0;e<n;e+=h)g.push(e);return g[g.length-1]!==n-1&&g.push(n-1),{hourKeys:t,n,plotW:i,plotH:a,inner:o,yOf:m,series:d,ticks:[0,.5,1].map(e=>f*e).reverse(),xTicks:g,totalPoints:p}},[e,l,u,r.metric]);if(e===void 0||l.length===0)return(0,m.jsx)(`div`,{className:L.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)});let p=e=>{let t=u.includes(e)?u.filter(t=>t!==e):[...u,e];s({metric:r.metric,models:t})},h=e=>{s({metric:e,...r.models===void 0?{}:{models:r.models}})},g=a===null||f===null?[]:f.series.flatMap(e=>{let t=e.points.find(e=>e.i===a);return t===void 0?[]:[{key:e.key,name:e.name,color:e.color,v:t.v}]});return(0,m.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[l.length>0&&(()=>{let e=Math.max(...l.map(e=>e.ttftAvg),1),t=Math.max(...l.filter(e=>e.tpsAvg!==void 0).map(e=>e.tpsAvg??0),1),r=Math.max(...l.map(e=>e.latencyAvg),1),i=l.reduce((e,t)=>e+t.samples,0),a=l.length>0?l.reduce((e,t)=>e+t.ttftAvg,0)/l.length:0,o=l.map(e=>e.tpsAvg).filter(e=>e!==void 0),s=o.length>0?o.reduce((e,t)=>e+t,0)/o.length:0,c=l.length>0?l.reduce((e,t)=>e+t.latencyAvg,0)/l.length:0,u=[{lbl:n(`perfSamples`),val:i.toLocaleString(),unit:``,pct:65,color:`var(--ds-blue)`},{lbl:n(`perfTtft`),val:Hn(a),unit:``,pct:a/e*100,color:`var(--ds-green)`},{lbl:n(`perfTps`),val:o.length>0?Un(s):`—`,unit:``,pct:s/t*100,color:`var(--ds-blue)`},{lbl:n(`perfLatency`),val:Hn(c),unit:``,pct:c/r*100,color:`var(--ds-amber)`}];return(0,m.jsx)(`div`,{className:L.perfHero,"data-testid":`billing-perf-hero`,children:u.map((e,t)=>(0,m.jsxs)(`div`,{className:L.perfHeroCell,children:[(0,m.jsx)(`div`,{className:L.perfHeroLbl,children:e.lbl}),(0,m.jsxs)(`div`,{className:L.perfHeroVal,children:[e.val,e.unit!==``&&(0,m.jsx)(`span`,{className:L.perfHeroUnit,children:e.unit})]}),(0,m.jsx)(`div`,{className:L.perfHeroBar,children:(0,m.jsx)(`i`,{style:{width:`${Math.min(100,e.pct)}%`,background:e.color}})})]},t))})})(),(0,m.jsx)(`div`,{className:L.tableScroll,"data-testid":`billing-perf-table`,children:(0,m.jsxs)(`table`,{className:L.modelTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`model`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfSamples`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfTtft`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfP50`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfP90`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfMax`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfTps`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfLatency`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`perfEstimated`)})]})}),(0,m.jsx)(`tbody`,{children:l.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsxs)(`span`,{className:L.modelCell,children:[(0,m.jsx)(`span`,{className:L.modelDot,style:{background:e.color}}),(0,m.jsx)(`span`,{className:L.modelName,children:e.name})]})}),(0,m.jsx)(`td`,{className:L.numCol,children:e.samples.toLocaleString()}),(0,m.jsx)(`td`,{className:L.numCol,children:Hn(e.ttftAvg)}),(0,m.jsx)(`td`,{className:L.numCol,children:Hn(e.ttftP50)}),(0,m.jsx)(`td`,{className:L.numCol,children:Hn(e.ttftP90)}),(0,m.jsx)(`td`,{className:L.numCol,children:e.ttftMax===void 0?(0,m.jsx)(`span`,{className:L.na,children:`—`}):(0,m.jsxs)(`span`,{children:[Hn(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,m.jsx)(`td`,{className:L.numCol,children:e.tpsAvg===void 0?(0,m.jsx)(`span`,{className:L.na,children:`—`}):Un(e.tpsAvg)}),(0,m.jsx)(`td`,{className:L.numCol,children:Hn(e.latencyAvg)}),(0,m.jsx)(`td`,{className:L.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,m.jsx)(`span`,{className:L.na,children:`—`})})]},e.key))})]})}),l.length>0&&(()=>{let e=Math.max(...l.map(e=>e.ttftP50),1),t=e=>e<.8?`var(--ds-green)`:e<2?`var(--ds-amber)`:`var(--ds-red)`;return(0,m.jsx)(`div`,{className:L.perfCompareList,"data-testid":`billing-perf-compare`,children:l.map(n=>(0,m.jsxs)(`div`,{className:L.perfCompareRow,children:[(0,m.jsxs)(`div`,{className:L.perfCompareName,children:[(0,m.jsx)(`span`,{className:L.perfCompareDot,style:{background:n.color}}),(0,m.jsx)(`span`,{children:n.name})]}),(0,m.jsx)(`div`,{className:L.perfCompareBar,children:(0,m.jsx)(`i`,{style:{width:`${n.ttftP50/e*100}%`,background:t(n.ttftP50)}})}),(0,m.jsx)(`div`,{className:L.perfCompareNum,children:Hn(n.ttftP50)}),(0,m.jsx)(`div`,{className:L.perfCompareNum,children:n.tpsAvg===void 0?`—`:Un(n.tpsAvg)})]},n.key))})})(),f!==null&&(0,m.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,m.jsx)(`div`,{className:L.perfBar,children:(0,m.jsx)(`span`,{className:L.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.rangeButton,r.metric===e&&L.rangeButtonActive),"aria-pressed":r.metric===e,"data-testid":`billing-perf-tab-${e}`,onClick:()=>{h(e)},children:e===`ttft`?`${n(`perfTtft`)} (ms)`:`${n(`perfTps`)} (${n(`perfTpsUnit`)})`},e))})}),(0,m.jsxs)(`div`,{className:L.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,m.jsx)(`button`,{type:`button`,className:L.perfChip,"data-testid":`billing-perf-chip-all`,onClick:()=>{s({metric:r.metric,models:l.map(e=>e.key)})},children:n(`perfAll`)}),l.map(e=>{let t=u.includes(e.key);return(0,m.jsxs)(`button`,{type:`button`,className:y(L.perfChip,!t&&L.perfChipOff),style:t?{color:e.color,borderColor:`color-mix(in srgb, ${e.color} 45%, transparent)`}:void 0,"aria-pressed":t,"data-testid":`billing-perf-chip-${e.key}`,onClick:()=>{p(e.key)},children:[(0,m.jsx)(`span`,{className:L.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),f.totalPoints>0?(0,m.jsxs)(`div`,{className:L.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:L.chartSvg,role:`img`,"aria-label":`Hourly perf comparison by model`,onMouseLeave:()=>{o(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Y.left)/f.plotW,r=Math.round(n*(f.n-1));o(Math.min(Math.max(r,0),f.n-1))},children:[f.ticks.map((e,t)=>{let n=f.yOf(e);return(0,m.jsxs)(`g`,{children:[(0,m.jsx)(`line`,{x1:Y.left,x2:680-Y.right,y1:n,y2:n,className:L.chartGrid}),(0,m.jsx)(`text`,{x:Y.left-8,y:n+3,textAnchor:`end`,className:L.chartAxisLabel,children:Vn(e)})]},`tick-${t}`)}),f.series.map(e=>e.segments.map((t,n)=>(0,m.jsx)(`path`,{d:t,fill:`none`,className:L.chartLine,style:{stroke:e.color}},`${e.key}-${n}`))),f.xTicks.map(e=>{let t=f.hourKeys[e];return t===void 0?null:(0,m.jsx)(`text`,{x:f.inner(e),y:174,textAnchor:`middle`,className:L.chartAxisLabel,children:Bn(t)},t)}),a!==null&&(0,m.jsx)(`line`,{x1:f.inner(a),x2:f.inner(a),y1:Y.top,y2:Y.top+f.plotH,className:L.chartCrosshair}),a!==null&&f.series.map(e=>{let t=e.points.find(e=>e.i===a);return t===void 0?null:(0,m.jsx)(`circle`,{cx:t.x,cy:t.y,r:3.5,fill:e.color,className:L.chartHoverDot},`${e.key}-dot`)})]}),a!==null&&g.length>0&&(0,m.jsxs)(`div`,{className:L.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${f.inner(a)/680*100}%`,top:`${(Y.top+f.plotH/2)/180*100}%`},children:[(0,m.jsx)(`div`,{className:L.chartTooltipDate,children:Bn(f.hourKeys[a]??``)}),g.map(e=>(0,m.jsxs)(`div`,{className:L.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:L.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,m.jsx)(`strong`,{children:Wn(e.v,r.metric,n)})]},e.key))]})]}):(0,m.jsx)(`div`,{className:L.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),f===null&&(0,m.jsx)(`div`,{className:L.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let Kn=`@kenz1117/dsh-ui-usage-billing`,qn=`kenz1117`;function Jn({t:e,version:t}){return(0,m.jsxs)(`section`,{className:L.setCard,"data-testid":`billing-plugin-info`,children:[(0,m.jsxs)(`div`,{className:L.plgHead,children:[(0,m.jsx)(`span`,{className:L.plgIcon,"aria-hidden":`true`,children:(0,m.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,m.jsx)(`path`,{d:`M10 3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a2 2 0 0 0 4 0V4a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v1a2 2 0 0 0 4 0 1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0 0 4h1a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1a2 2 0 0 0-4 0 1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 0-4H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 4 0z`})})}),(0,m.jsxs)(`div`,{className:L.plgTitle,children:[(0,m.jsxs)(`div`,{className:L.plgNameRow,children:[(0,m.jsx)(`h3`,{className:L.plgName,children:Kn}),(0,m.jsx)(`span`,{className:L.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,m.jsx)(`p`,{className:L.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,m.jsxs)(`div`,{className:L.plgGrid,children:[(0,m.jsxs)(`div`,{className:L.plgItem,children:[(0,m.jsx)(`span`,{className:L.plgLabel,children:e(`pluginAuthor`)}),(0,m.jsxs)(`a`,{className:L.plgLink,href:`https://github.com/${qn}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,qn,`)`]})]}),(0,m.jsxs)(`div`,{className:L.plgItem,children:[(0,m.jsx)(`span`,{className:L.plgLabel,children:e(`pluginRepository`)}),(0,m.jsx)(`a`,{className:L.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,m.jsxs)(`div`,{className:L.plgItem,children:[(0,m.jsx)(`span`,{className:L.plgLabel,children:e(`pluginNpm`)}),(0,m.jsx)(`a`,{className:L.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:Kn})]}),(0,m.jsxs)(`div`,{className:L.plgItem,children:[(0,m.jsx)(`span`,{className:L.plgLabel,children:e(`pluginLicense`)}),(0,m.jsx)(`span`,{className:L.plgVal,children:`MIT`})]})]})]})}function Yn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function Xn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Zn(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}function Qn({rounds:e,flags:t,currency:n,t:r}){let i=(0,d.useMemo)(()=>[...e].sort((e,t)=>e.startedAt-t.startedAt).slice(-40),[e]),a=(0,d.useMemo)(()=>new Set(t.map(e=>`${e.sessionId}:${e.turn}`)),[t]),o=(0,d.useMemo)(()=>Math.max(1e-4,...i.map(e=>e.cost)),[i]);if(i.length===0)return(0,m.jsxs)(`div`,{className:L.roundsEmpty,children:[r(`model`),` —`]});let s=e=>W(gn(e,n),n);return(0,m.jsxs)(`div`,{className:L.rounds,children:[(0,m.jsx)(`div`,{className:L.roundsBars,role:`img`,"aria-label":`cost per turn`,children:i.map(e=>{let t=a.has(`${e.sessionId}:${e.turn}`),n=Math.max(1,e.cost/o*100),i=zt(e.model,!1)===`deepseek-metered`&&kt(e.startedAt)===`peak`;return(0,m.jsxs)(`div`,{className:y(L.roundsBarCol,i?L.roundsBarColPeak:L.roundsBarColOff),children:[(0,m.jsx)(`span`,{className:L.roundsBarLabel,style:{bottom:`${n}%`},children:s(e.cost)}),(0,m.jsx)(`div`,{className:L.roundsBarWrap,children:(0,m.jsx)(`div`,{className:t?L.roundsBarFlagged:L.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${r(`model`)} ${e.model} · ${s(e.cost)} · ${Xn(e.startedAt)}${e.endedAt===void 0?``:` → ${Yn(e.endedAt)} (${Zn(e.endedAt-e.startedAt)})`}`,children:t&&(0,m.jsx)(`span`,{className:L.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,m.jsxs)(`div`,{className:L.roundsAxis,children:[(0,m.jsxs)(`span`,{children:[r(`costAbbr`),` `,s(o)]}),(0,m.jsxs)(`span`,{children:[i.length,` `,r(`roundsUnit`)]})]})]})}let $n=[`color-mix(in srgb, var(--dsb-3) 70%, transparent)`,`color-mix(in srgb, var(--ds-cyan) 30%, var(--dsb-3))`,`color-mix(in srgb, var(--ds-blue) 60%, var(--dsb-3))`,`var(--ds-blue)`,`var(--ds-amber)`],er=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],tr=e=>G(e.getTime());function nr(e,t){let n=new Map;for(let t of e)n.set(t.date,t.value);let r=0;for(let e of n.values())e>r&&(r=e);let i=t.getFullYear(),a=t.getMonth(),o=t.getDate(),s=new Date(i,a+1,0).getDate(),c=new Date(i,a,1).getDay(),l=c+s,u=Math.ceil(l/7),d=[];for(let e=0;e<u;e+=1){let t=[];for(let l=0;l<7;l+=1){let u=e*7+l-c+1;if(u<1){let e=new Date(i,a,u);t.push({date:tr(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}if(u>s){let e=new Date(i,a+1,u-s);t.push({date:tr(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=new Date(i,a,u),f=tr(d),p=n.get(f)??0,m=0;if(p>0&&r>0){let e=Math.ceil(p/r*4);m=Math.min(4,Math.max(1,e))}let h=u>o;t.push({date:f,dayNum:u,value:h?0:p,level:h?0:m,placeholder:h})}d.push(t)}return d}function rr(e,t,n=52){let r=new Map;for(let t of e)r.set(t.date,t.value);let i=0;for(let e of r.values())e>i&&(i=e);let a=tr(t),o=new Date(t);o.setHours(0,0,0,0),o.setDate(o.getDate()-o.getDay());let s=new Date(o);s.setDate(o.getDate()-(n-1)*7);let c=[];for(let e=0;e<n;e+=1){let t=[];for(let n=0;n<7;n+=1){let o=new Date(s);o.setDate(s.getDate()+e*7+n);let c=tr(o),l=c>a,u=l?0:r.get(c)??0,d=0;if(!l&&u>0&&i>0){let e=Math.ceil(u/i*4);d=Math.min(4,Math.max(1,e))}t.push({date:c,dayNum:o.getDate(),value:u,level:d,placeholder:l})}c.push(t)}return c}function ir({days:e,currency:t,now:n,t:r,range:i=`month`,unit:a=`cost`}){let[o,s]=(0,d.useState)(null),c=e=>W(gn(e,t),t),l=e=>a===`tokens`?K(e):c(e),u=(0,d.useMemo)(()=>nr(e,n??new Date),[e,n]),f=tr(n??new Date);if(i!==`month`){let t=rr(e,n??new Date,i===`half`?26:52),a=[],o=-1;return t.forEach((e,t)=>{let n=Number(e[0]?.date.slice(5,7)??0);n!==o&&(a.push({index:t,label:er[n-1]??``}),o=n)}),(0,m.jsxs)(`div`,{className:L.heatmapYear+(i===`half`?` `+L.heatmapHalf:``),"data-testid":i===`half`?`heatmap-half`:`heatmap-year`,children:[(0,m.jsxs)(`div`,{className:L.heatmapYearBody,children:[(0,m.jsx)(`div`,{className:L.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,m.jsx)(`span`,{className:L.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,m.jsxs)(`div`,{className:L.heatmapYearScroll,children:[(0,m.jsx)(`div`,{className:L.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:a.map(e=>(0,m.jsx)(`span`,{className:L.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,m.jsx)(`div`,{className:L.heatmapYearGrid,role:`img`,"aria-label":`yearly cost heatmap`,"data-testid":`heatmap-year-grid`,children:t.flat().map(e=>(0,m.jsx)(`button`,{type:`button`,className:L.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:$n[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,tabIndex:-1},e.date))})]})]}),(0,m.jsxs)(`div`,{className:L.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:L.heatmapLegend,children:$n.map((e,t)=>(0,m.jsx)(`i`,{style:{background:e}},t))}),(0,m.jsx)(`span`,{children:r(`heatmapMore`)})]})]})}return(0,m.jsxs)(`div`,{className:L.heatmap,children:[(0,m.jsx)(`div`,{className:L.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,m.jsx)(`div`,{className:L.heatmapCellEmpty,children:e.dayNum},e.date):(0,m.jsx)(`button`,{type:`button`,className:L.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:$n[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,onMouseEnter:()=>{s(e)},onMouseLeave:()=>{s(null)},onFocus:()=>{s(e)},onBlur:()=>{s(null)},children:e.dayNum},e.date)))}),(0,m.jsxs)(`div`,{className:L.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:L.heatmapLegend,children:$n.map((e,t)=>(0,m.jsx)(`i`,{style:{background:e}},t))}),(0,m.jsx)(`span`,{children:r(`heatmapMore`)}),o!==null&&(0,m.jsxs)(`span`,{className:L.heatmapHover,"data-testid":`heatmap-hover`,children:[o.date,` · `,l(o.value)]})]})]})}let ar={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function X(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function or(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function sr(e,t){let n=t?.window??ar.window,r=t?.threshold??ar.threshold,i=t?.reasonFactor??ar.reasonFactor,a=t?.reasonHitDropPp??ar.reasonHitDropPp,o=[];if(n<=0||r<=0)return o;let s=[],c=[],l=[],u=[];for(let t of e){if(t.cost<=0)continue;let e=t.output,d=t.input,f=or(t),p=X(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=X(c),r=X(l),s=X(u);n!==null&&n>0&&e>n*i&&m.push(`output-growth`),r!==null&&r>0&&d>r*i&&m.push(`context-bloat`),s!==null&&f!==null&&f<s-a&&m.push(`cache-hit-drop`),o.push({sessionId:t.sessionId,turn:t.turn,cost:t.cost,reasons:m})}for(s.push(t.cost),c.push(e),l.push(d),f!==null&&u.push(f);s.length>n;)s.shift();for(;c.length>n;)c.shift();for(;l.length>n;)l.shift();for(;u.length>n;)u.shift()}return o}let cr={},lr={};function ur(){return(0,h.defineStore)({init:()=>({enabled:!1,amount:0,tierAlertDays:{},lastBalanceAlertDay:``,lastTierSwitchAt:0,modelBudgets:{},modelTierAlertDays:{}}),persist:`dsh.ui-usage-billing.budget`,actions:{setEnabled:(e,t)=>{e.enabled=t},setAmount:(e,t)=>{e.amount=Number.isFinite(t)&&t>0?t:0},markTierAlerted:(e,t,n)=>{e.tierAlertDays??={};for(let r of t)e.tierAlertDays[String(r)]=n},markBalanceAlerted:(e,t)=>{e.lastBalanceAlertDay=t},markTierSwitchAlerted:(e,t)=>{e.lastTierSwitchAt=t},setModelBudget:(e,t,n)=>{e.modelBudgets??={},Number.isFinite(n)&&n>0?e.modelBudgets[t]=n:delete e.modelBudgets[t]},markModelTierAlerted:(e,t,n)=>{e.modelTierAlertDays??={};for(let r of t)e.modelTierAlertDays[r]=n}}})}function dr(e,t){return e==null?null:Number.isFinite(e.nextSwitchInMs)&&e.nextSwitchInMs<=t?`soon`:e.tier===`peak`?`peak`:`offPeak`}let fr={显式缓存创建:`Explicit cache write`,显式缓存命中:`Explicit cache hit`,长期半价:`Half price`,与标准价一致:`Same as standard`,"限时 5 折":`Limited-time 50% off`};function pr(e,t){return e===void 0||t!==`en`?e:fr[e]??e}function mr(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>e.key.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)||(e.provider??``).toLowerCase().includes(n))}let hr={"智谱 AI":`Zhipu AI`,阿里通义:`Alibaba Qwen`,字节豆包:`ByteDance Doubao`,月之暗面:`Moonshot AI`,小米:`Xiaomi`,百度文心:`Baidu ERNIE`,腾讯混元:`Tencent Hunyuan`,零一万物:`01.AI`,阶跃星辰:`StepFun`,科大讯飞:`iFlytek Spark`,商汤:`SenseNova`,百川智能:`Baichuan`,"小米 Token Plan(海外)":`Xiaomi Token Plan (Global)`,"小米 Token Plan(国内)":`Xiaomi Token Plan (CN)`,"小米 Token Plan(新加坡)":`Xiaomi Token Plan (SG)`,"火山引擎 Token Plan":`Volcengine Token Plan`,"火山方舟 Token Plan":`Volcengine Ark Token Plan`,"豆包 Token Plan":`Doubao Token Plan`,"百度文心 Plan":`Baidu ERNIE Plan`,"MiniMax Token Plan(国内)":`MiniMax Token Plan (CN)`};function gr(e,t){return t===`en`?hr[e]??e:e}let _r={workbuddy:`WorkBuddy`,"workbuddy-ai":`WorkBuddy AI`},vr={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},yr={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function br(e){try{return new URL(e).host}catch{return e}}function xr(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=vr[n];return r===void 0?br(n):t===`en`?yr[r]??r:r}if(e.startsWith(`direct:`)){let n=e.slice(7);if(/^deepseek(?:-[a-z0-9-]+)?$/i.test(n))return t===`en`?`DeepSeek Official`:`DeepSeek 官方`;let r=_r[n.trim().toLowerCase()];return r===void 0?`${t===`en`?`Direct`:`直连`} · ${n}`:`${t===`en`?`Direct`:`直连`} · ${r}`}}let Sr=[`直连 · `,`Direct · `];function Cr(e){for(let t of Sr)if(e.startsWith(t))return e.slice(t.length)}function wr(e){let t=e;for(;t!==null&&t.parentElement!==null;){let e=t.parentElement;if(e===document.body||e===document.documentElement)return null;let n=getComputedStyle(e);if(n.display!==`contents`&&n.display.includes(`flex`))return e;t=e}return null}function Tr(e,t){let n=e.clientWidth>0,r=0,i=e=>{if(e.contains(t))return;let a=getComputedStyle(e);if(a.display!==`none`&&a.visibility!==`hidden`&&a.position!==`absolute`&&a.position!==`fixed`){if(a.display===`contents`){for(let t of Array.from(e.children))i(t);return}if(n){let t=e.getBoundingClientRect();if(t.width===0&&t.height===0)return}r+=1}};for(let t of Array.from(e.children))i(t);return r}function Er(e){let t=wr(e);return t===null?{row:null,stacked:!1,neighbors:0}:{row:t,stacked:getComputedStyle(t).flexDirection===`column`,neighbors:Tr(t,e)}}function Dr(e){return e.row===null?`card`:e.stacked||e.neighbors>0?`icon`:`card`}function Or(e,t){let n,r=()=>{let r=Dr(Er(e));r!==n&&(n=r,t(r))},i=wr(e),a=typeof ResizeObserver==`function`?new ResizeObserver(()=>r()):void 0,o=typeof MutationObserver==`function`?new MutationObserver(()=>r()):void 0;return a?.observe(e),i!==null&&(a?.observe(i),o?.observe(i,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`,`hidden`]})),window.addEventListener(`resize`,r),r(),{dispose(){a?.disconnect(),o?.disconnect(),window.removeEventListener(`resize`,r)}}}let kr=`dsh-billing-peak-alert-v1`,Ar={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function jr(e,t,n){return t===null||n<=0?e:e===null?{...t,queueCount:n}:e.atMs===t.atMs&&e.entering===t.entering?{...e,queueCount:n}:e}function Mr(e,t){if(e===null||e.queueCount===void 0)return e;if(t>0)return e.queueCount===t?e:{...e,queueCount:t};let{queueCount:n,...r}=e;return r}function Nr(){try{let e=localStorage.getItem(kr);if(e===null)return{...Ar};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:Ar.mode,r=t.position===`center`?`center`:`bottom-right`;return{enabled:t.enabled===!0,leadMin:typeof t.leadMin==`number`&&Number.isFinite(t.leadMin)?Math.min(30,Math.max(1,Math.round(t.leadMin))):Ar.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...Ar}}}function Pr(e){try{localStorage.setItem(kr,JSON.stringify(e))}catch{x(`peak-config-storage-unavailable`)}}function Fr(e,t,n,r){if(!t.enabled)return null;let i=Vt(e,r,t.leadMin*6e4);return i===null||t.mode===`peak`&&i.entering!==`peak`||t.mode===`offPeak`&&i.entering!==`offPeak`||i.atMs===n?null:{...i,channel:r}}let Ir=[50,80,100],Lr=3e4,Rr=`dsh-billing-root`,zr={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}},Br=[`#4f8cff`,`#2dd4bf`,`#a78bfa`,`#f59e0b`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#6366f1`,`#f97316`,`#14b8a6`];function Vr({hit:e,config:t,t:n,onDismiss:r}){let[i,a]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),3e4);return()=>clearInterval(e)},[]),(0,d.useEffect)(()=>{i>=e.atMs&&r()},[i,e.atMs,r]),i>=e.atMs)return null;let o=Math.max(1,Math.round((e.atMs-i)/6e4)),s=e.entering,c=n(s===`peak`?`tierPeak`:`tierOff`),l=n(e.channel===`zhipu-coding-plan`?s===`peak`?`peakAlertDescPeakZhipu`:`peakAlertDescOffZhipu`:s===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),u=s===`peak`;return(0,m.jsxs)(`div`,{className:y(L.peakCard,Rr,u?L.peakCardPeak:L.peakCardOff,t.position===`center`?L.peakCardCenter:L.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,m.jsxs)(`div`,{className:L.peakHead,children:[(0,m.jsxs)(`span`,{className:y(L.peakTag,u?L.peakTagPrimary:L.peakTagSuccess),children:[(0,m.jsx)(`span`,{className:y(L.peakDot,u?L.peakDotPrimary:L.peakDotSuccess),"aria-hidden":`true`}),c]}),(0,m.jsx)(`button`,{type:`button`,className:L.peakClose,onClick:r,"aria-label":n(`close`),children:`×`})]}),(0,m.jsxs)(`div`,{className:y(L.peakCount,u?L.peakCountPrimary:L.peakCountSuccess),children:[o,`min`]}),(0,m.jsx)(`p`,{className:L.peakDesc,children:l}),e.queueCount!==void 0&&e.queueCount>0&&(0,m.jsx)(`p`,{className:L.peakDesc,"data-testid":`billing-peak-queue-note`,children:n(s===`peak`?`peakAlertQueuePeak`:`peakAlertQueueOff`,{count:e.queueCount})})]})}let Hr={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},Ur=[{id:`overview`,labelKey:`tabOverview`},{id:`queue`,labelKey:`tabQueue`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`agents`,labelKey:`tabAgents`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],Wr={fill:`none`,"aria-hidden":!0,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`},Gr={overview:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:(0,m.jsx)(`path`,{d:`M2 13V3M2 13H14M4 10l4-3 2 2 4-5`})}),queue:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:[(0,m.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h6`}),(0,m.jsx)(`path`,{d:`M12 10v4m-2-2h4`})]}),agents:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`3.5`,r:`2`}),(0,m.jsx)(`circle`,{cx:`3.5`,cy:`12.5`,r:`2`}),(0,m.jsx)(`circle`,{cx:`12.5`,cy:`12.5`,r:`2`}),(0,m.jsx)(`path`,{d:`M8 5.5v2.5M6.5 10.5L5 11.5M9.5 10.5L11 11.5`})]}),providers:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:[(0,m.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,m.jsx)(`path`,{d:`M5 7l2 2 4-4`})]}),token:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:[(0,m.jsx)(`circle`,{cx:`6`,cy:`6`,r:`3`}),(0,m.jsx)(`circle`,{cx:`11`,cy:`11`,r:`3`})]}),trends:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:(0,m.jsx)(`path`,{d:`M2 4l4 4 3-3 5 5M11 10h3V7`})}),pricing:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:[(0,m.jsx)(`path`,{d:`M8 2l6 3v6l-6 3-6-3V5z`}),(0,m.jsx)(`path`,{d:`M8 2v12M2 5h12`})]}),settings:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...Wr,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2.5`}),(0,m.jsx)(`path`,{d:`M8 1.5v2M8 12.5v2M1.5 8h2M12.5 8h2`})]})},Kr=p,qr=Kr.IconChevronDownOutlineMedium??Kr.IconChevronDownOutline14;function Jr(e,t){let n=Object.keys(e).filter(e=>e<=t).sort().slice(-7);return n.length===0?0:n.reduce((t,n)=>t+(e[n]?.cost??0),0)/n.length}function Yr(e,t){let n=t.split(`-`),r=new Date(Number(n[0]),Number(n[1])-1,Number(n[2])),i=0;for(let t=0;t<7;t+=1){let t=`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,`0`)}-${String(r.getDate()).padStart(2,`0`)}`;i+=e[t]?.cost??0,r.setDate(r.getDate()-1)}return i/7}function Xr(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)).reduce((t,n)=>t+(e[n]?.cost??0),0),i=t.split(`-`),a=new Date(Number(i[0]),Number(i[1]),0).getDate(),o=n.startsWith(t)?Number(n.slice(8,10)):a,s=Math.max(0,a-o);return r<=0?Jr(e,n)*s:r+Yr(e,n)*s}function Zr(e){return Object.keys(e).length}function Qr(e,t=Date.now()){let n=0,r=new Date(t);for(;G(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function $r(e){return e.input+e.output}function ei(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=G(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function ti(e,t,n=e=>e.cost){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=0;for(let t=0;t<=i;t+=1){let i=new Date(r);i.setDate(i.getDate()-t);let o=e[G(i.getTime())];o!==void 0&&(a+=n(o))}return a}function ni(e,t,n){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=new Date(r);a.setDate(a.getDate()-i);let o=G(a.getTime()),s=new Date(r);s.setDate(s.getDate()-6);let c=G(s.getTime());return ii(e,e=>n===`today`?e===t:n===`7d`?e>=c&&e<=t:n===`week`?e>=o&&e<=t:e.startsWith(t.slice(0,7)))}function ri(e,t,n){return ii(e,e=>e>=t&&e<=n)}function ii(e,t){let n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0,u,d=0;for(let[f,p]of Object.entries(e)){if(!t(f))continue;n+=p.cost,r+=p.calls,i+=p.input,a+=p.output,o+=p.cacheHit,s+=p.cacheMiss,c+=p.cacheWrite??0,l+=p.reasoning??0;let e=$r(p);e>d&&(d=e,u=f)}return{cost:n,calls:r,input:i,output:a,cacheHit:o,cacheMiss:s,cacheWrite:c,reasoning:l,peakDay:u,peakTokens:d}}function ai(e,t){let n={};if(e===void 0)return n;for(let[r,i]of Object.entries(e))if(r.startsWith(t))for(let[e,t]of Object.entries(i))n[e]=(n[e]??0)+t.cost;return n}let oi=[80,100];function si(e,t){if(!(t>0)||!(e>0))return[];let n=e/t*100;return oi.filter(e=>n>=e)}let ci={DeepSeek:[`deepseek`],"智谱 AI":[`zhipu`,`glm`,`z.ai`],阿里通义:[`qwen`,`tongyi`,`dashscope`,`aliyun`],字节豆包:[`doubao`,`volcengine`,`ark`],月之暗面:[`moonshot`,`kimi`],小米:[`xiaomi`,`mi`,`mimo`],MiniMax:[`minimax`],百度文心:[`ernie`,`wenxin`,`qianfan`,`baidu`],腾讯混元:[`hunyuan`,`tencent`],零一万物:[`01.ai`,`lingyi`,`yi`],阶跃星辰:[`step`,`stepfun`,`step-3.7`],科大讯飞:[`spark`,`xfyun`,`iflytek`],商汤:[`sensenova`,`sensetime`],百川智能:[`baichuan`],OpenAI:[`openai`],Google:[`google`,`gemini`],xAI:[`xai`,`grok`],Meta:[`meta`,`llama`],Anthropic:[`claude`,`anthropic`],"Mistral AI":[`mistral`,`ministral`,`devstral`],Cohere:[`cohere`,`command`],美团:[`longcat`,`meituan`],面壁智能:[`minicpm`,`modelbest`],小红书:[`dots`,`rednote`,`xiaohongshu`],云知声:[`unisound`,`u2`]};function Z(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function li(e,t){if(e.length===0||t.length===0)return!1;if(e===t)return!0;let[n,r]=e.length<=t.length?[e,t]:[t,e];return n.length>=3&&r.includes(n)}function ui(e,t){let n=Z(e),r=Z(t);if(li(n,r))return!0;let i=ci[e];return i!==void 0&&i.some(e=>li(Z(e),r))}function di(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(ci))for(let r of n){let n=Z(r);if(n.length!==0&&(t===n||t.startsWith(`${n}-`)||t.startsWith(`${n}/`)||t.startsWith(`${n}_`)||t.includes(`${n}-`)||t.includes(`${n}/`)||t.includes(`${n}_`)))return e}for(let[e,t]of Object.entries(ci))for(let r of t){let t=Z(r);if(!(t.length<4)&&n.includes(t))return e}}}let fi={"kimi-coding":`月之暗面`,"zai-coding-cn":`智谱 AI`,"zai-coding":`智谱 AI`,"qwen-token-plan":`阿里通义`,"qwen-token-plan-cn":`阿里通义`,"xiaomi-token-plan-ams":`小米`,"xiaomi-token-plan-cn":`小米`,"xiaomi-token-plan-sgp":`小米`,"volcengine-token-plan":`字节豆包`,"ark-token-plan":`字节豆包`,"doubao-token-plan":`字节豆包`,ernie:`百度文心`,baidu:`百度文心`,wenxin:`百度文心`,minimax:`MiniMax`,"minimax-cn":`MiniMax`,"minimax-token-plan":`MiniMax`,"minimax-token-plan-cn":`MiniMax`,"hunyuan-token-plan":`腾讯混元`,"tencent-token-plan":`腾讯混元`,"hy-token-plan":`腾讯混元`,"xinghuo-token-plan":`讯飞星火`,"xfyun-coding":`讯飞星火`,"spark-coding":`讯飞星火`,"huawei-token-plan":`华为云`,"pangu-token-plan":`华为云`,"huawei-maas-token-plan":`华为云`,"volcengine-agent-plan":`字节豆包`,"ark-agent-plan":`字节豆包`,"baidu-token-plan":`百度文心`,"ernie-token-plan":`百度文心`,"wenxin-token-plan":`百度文心`,opencode:`OpenCode`,"opencode-go":`OpenCode`};function pi(e){let t=fi[e];return t===void 0?di(e)??e:t}let mi=`https://platform.kimi.com/console/pay`,hi=`https://open.bigmodel.cn/finance-center/finance/pay`,gi=`https://bailian.console.aliyun.com/`,_i=`https://console.volcengine.com/ark`,vi=`https://console.anthropic.com/settings/billing`,yi=`https://console.cloud.google.com/billing`,bi=`https://console.x.ai/`,xi=`https://platform.xiaomimimo.com/console/balance`,Si=`https://console.cloud.tencent.com/expense/recharge`,Ci={deepseek:`https://platform.deepseek.com/top_up`,minimax:`https://platform.minimax.cn/console/recharge-records`,moonshot:mi,kimi:mi,zhipu:hi,bigmodel:hi,qwen:gi,dashscope:gi,doubao:_i,volcengine:_i,ark:_i,openai:`https://platform.openai.com/settings/organization/billing`,anthropic:vi,claude:vi,google:yi,gemini:yi,xai:bi,grok:bi,siliconflow:`https://cloud.siliconflow.cn/account/charge`,hunyuan:Si,tencent:Si,腾讯云:Si,xiaomi:xi,mimo:xi,mi:xi,qianfan:`https://console.bce.baidu.com/qianfan/overview`};function wi(e){let t=Ci[e];if(t!==void 0)return t;let n=Object.keys(Ci).find(t=>e.startsWith(t));return n===void 0?void 0:Ci[n]}function Ti(e){let t=Z(e),n=wi(t);if(n!==void 0)return n;for(let[e,n]of Object.entries(ci))if(li(Z(e),t))for(let e of n){let t=wi(Z(e));if(t!==void 0)return t}}function Ei(e){let t=vt();if(t===void 0||e.byDayModels===void 0)return e;let n=Et().rate,r=e.byDayModelsSite!==void 0,i={},a={},o=new Map,s=0,c=e=>t.some(t=>t.origin!==void 0&&t.origin!==``&&(t.key===e||U(t.key)===U(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=r=>{let a=(t.cacheMiss*r.input+i*r.cacheHit+t.output*r.output)/1e6;return e.currency===`USD`?a*n:a};return e.offPeak===void 0?a(e):a(e)*Ot+a(e.offPeak)*.5};for(let[t,n]of Object.entries(e.byDayModels)){let u=0,d={};for(let[i,a]of Object.entries(n)){let n=bt(i)??xt(i),s=r&&c(i),f;if(s&&e.byDayModelsSite?.[t]?.[i]!==void 0){let r=0;for(let[a,o]of Object.entries(e.byDayModelsSite[t][i])){let e=a.startsWith(`site:`)?a.slice(5):void 0,t=e===void 0?void 0:bt(i,e);r+=l(t??n,o,o.cost)}f=r}else f=l(n,a,a.cost);u+=f,d[i]={...a,cost:f},o.set(i,(o.get(i)??0)+f)}let f=e.byDay[t];f!==void 0&&(i[t]={...f,cost:u}),a[t]=d,s+=u}return{...e,total:{...e.total,cost:s},byDay:i,byDayModels:a,byModel:Object.fromEntries(Object.entries(e.byModel).map(([e,t])=>{let n=o.get(e);return[e,n===void 0?t:{...t,cost:n}]})),unpricedModels:(e.unpricedModels??[]).filter(e=>!bt(e)&&!xt(e))}}function Di(){return{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cacheWrite:0,cost:0}}function Oi(e,t){e.calls+=t.calls,e.input+=t.input,e.output+=t.output,e.cacheHit+=t.cacheHit,e.cacheMiss+=t.cacheMiss,e.cacheWrite+=t.cacheWrite??0,e.cost+=t.cost}function ki(e,t){e.calls-=t.calls,e.input-=t.input,e.output-=t.output,e.cacheHit-=t.cacheHit,e.cacheMiss-=t.cacheMiss,e.cacheWrite=(e.cacheWrite??0)-t.cacheWrite,e.cost-=t.cost}function Ai(e){let t=e.byDayModelsSite;if(t===void 0)return[];let n=new Map;for(let e of Object.values(t))for(let t of Object.values(e))for(let[e,r]of Object.entries(t)){let t=n.get(e)??Di();Oi(t,r),n.set(e,t)}return[...n.entries()].map(([e,t])=>({siteKey:e,calls:t.calls,input:t.input,output:t.output,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,cost:t.cost})).sort((e,t)=>t.cost===e.cost?e.siteKey.localeCompare(t.siteKey):t.cost-e.cost)}function ji(e,t){let n=new Map;for(let r of e){let e=t(r.siteKey),i=n.get(e)??{siteKeys:[],calls:0,tokens:0,cost:0};i.siteKeys.push(r.siteKey),i.calls+=r.calls,i.tokens+=r.input+r.output,i.cost+=r.cost,n.set(e,i)}return[...n.entries()].map(([e,t])=>({name:e,...t})).sort((e,t)=>t.cost===e.cost?e.name.localeCompare(t.name,`zh`):t.cost-e.cost)}function Mi(e,t){if(t.size===0)return e;let n=e.byDayModelsSite;if(n===void 0)return e;let r=new Map,i=new Map,a=new Map,o=Di(),s={};for(let[e,c]of Object.entries(n)){let n={};for(let[s,l]of Object.entries(c)){let c={};for(let[n,u]of Object.entries(l)){if(t.has(n)){let t=r.get(e)??new Map,n=t.get(s)??Di();Oi(n,u),t.set(s,n),r.set(e,t);let c=i.get(e)??Di();Oi(c,u),i.set(e,c);let l=a.get(s)??Di();Oi(l,u),a.set(s,l),Oi(o,u);continue}c[n]=u}Object.keys(c).length>0&&(n[s]=c)}s[e]=n}let c={};for(let[t,n]of Object.entries(e.byDay)){let e=i.get(t);if(e===void 0){c[t]=n;continue}let r={...n};ki(r,e),c[t]=r}let l={};for(let[t,n]of Object.entries(e.byDayModels??{})){let e={};for(let[i,a]of Object.entries(n)){let n={...a},o=r.get(t)?.get(i);o!==void 0&&ki(n,o),e[i]=n}l[t]=e}let u={};for(let[t,n]of Object.entries(e.byModel)){let e={...n},r=a.get(t);r!==void 0&&ki(e,r),u[t]=e}let d={};for(let[n,r]of Object.entries(e.bySite??{}))t.has(n)||(d[n]=r);let f={...e.total};return ki(f,o),{...e,total:f,byDay:c,byDayModels:l,byModel:u,bySite:d,byDayModelsSite:s}}async function Q(e,t={}){let{timeoutMs:n=12e3,signal:r,...i}=t,a=new AbortController,o=setTimeout(()=>{a.abort()},n),s=()=>{a.abort()};r!=null&&(r.aborted?a.abort():r.addEventListener(`abort`,s,{once:!0}));try{return await fetch(e,{...i,signal:a.signal})}finally{clearTimeout(o),r?.removeEventListener(`abort`,s)}}let Ni=new Set;function Pi(){return typeof Notification<`u`&&Notification.permission===`granted`}function Fi(e,t){Ni.has(e)||(Ni.add(e),Q(`/api/billing/notify-claim`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e})}).then(e=>e.json()).then(e=>{e.claimed!==!1&&t()}).catch(()=>t()))}function Ii(e){let t=new Map,n=[];for(let r of e){if(r.title===void 0||r.title===``){n.push(r);continue}let e=t.get(r.title);if(e===void 0){let e={...r,mergedCount:1};t.set(r.title,e),n.push(e);continue}e.children===void 0&&(e.children=[{...e}]),e.children.push({...r}),e.calls+=r.calls,e.cost+=r.cost,e.lastActive=Math.max(e.lastActive,r.lastActive),r.stale===!0&&(e.stale=!0),e.mergedCount=(e.mergedCount??1)+1}return n.sort((e,t)=>t.cost-e.cost||t.lastActive-e.lastActive)}function Li(e){let t=new Map(e.map(e=>[e.id,e])),n=Ii(e.filter(e=>e.parentId===void 0)),r=new Map;for(let e of n){r.set(e.id,e);for(let t of e.children??[])r.set(t.id,e)}let i=new Set,a=new Map,o=(e,t)=>{e.subs===void 0?e.subs=[t]:e.subs.push(t),i.add(t.id),a.set(t.id,e.id)};for(let n of e){if(n.parentId===void 0)continue;let e=t.get(n.parentId);if(e!==void 0&&e.parentId!==void 0&&e.id!==n.id){let t=e.id,r=new Set,i=!1;for(;t!==void 0&&!r.has(t);){if(r.add(t),t===n.id){i=!0;break}t=a.get(t)}if(!i){o(e,n);continue}}let s=new Set,c=n.parentId;for(;c!==void 0&&!s.has(c);){s.add(c);let e=r.get(c);if(e!==void 0){i.has(n.id)||o(e,n);break}c=t.get(c)?.parentId}}let s=e=>e.cost+(e.subCost??0),c=e=>{e.subs?.sort((e,t)=>s(t)-s(e)||t.lastActive-e.lastActive);for(let t of e.subs??[])c(t)};for(let e of n)c(e);let l=e.filter(e=>e.parentId!==void 0&&!i.has(e.id));for(let e of l)c(e);return[...n,...l].sort((e,t)=>t.cost-e.cost||t.lastActive-e.lastActive)}function Ri(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);let n=new Map,r=[];for(let i of e){let e=i.parentId;if(e===void 0||!t.has(e)||zi(t,i.id)){r.push(i);continue}let a=n.get(e);a===void 0?n.set(e,[i]):a.push(i)}let i=(e,t,r)=>{let a=new Set(r);a.add(e.id);let o=(n.get(e.id)??[]).filter(e=>!r.has(e.id)).map(e=>i(e,t+1,a)).sort((e,t)=>t.chainCost-e.chainCost),s={id:e.id,...e.title===void 0?{}:{title:e.title},...e.cwd===void 0?{}:{cwd:e.cwd},calls:e.calls,cost:e.cost,lastActive:e.lastActive,chainCost:e.cost,chainCalls:e.calls,children:o,depth:t};for(let e of o)s.chainCost+=e.chainCost,s.chainCalls+=e.chainCalls;return s};return r.map(e=>i(e,0,new Set)).sort((e,t)=>t.chainCost-e.chainCost)}function zi(e,t){let n=new Set([t]),r=e.get(t)?.parentId;for(;r!==void 0;){if(n.has(r))return!0;n.add(r),r=e.get(r)?.parentId}return!1}function Bi(e){let t=0,n=0,r,i=e=>{t+=1,n+=e.children.length,(r===void 0||e.chainCost>r.chainCost)&&(r=e);for(let t of e.children)i(t)};for(let t of e)i(t);return{agents:t,delegations:n,roots:e.length,...r===void 0?{}:{costliest:r}}}function Vi(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n)||(e.cwd??``).toLowerCase().includes(n)||e.id.toLowerCase().includes(n))}function Hi(e,t){let n=e.trim().toLowerCase();return n!==``&&!t.some(e=>e.toLowerCase().includes(n))}function Ui(e,t){return e.checked?e.okProviders.some(e=>ui(t,e))?L.healthOk:e.badProviders.some(e=>ui(t,e))?L.healthBad:L.healthIdle:L.healthIdle}function Wi(e,t){switch(e){case`ok`:return``;case`not-configured`:return t(`subscriptionNotConfigured`);case`unauthorized`:return t(`subscriptionUnauthorized`);case`rate-limited`:return t(`subscriptionRateLimited`);case`invalid-response`:return t(`subscriptionInvalid`);default:return t(`subscriptionUnavailable`)}}function Gi(e,t){switch(e){case`session`:return t(`subscriptionSession`);case`weekly`:return t(`subscriptionWeekly`);case`monthly`:return t(`subscriptionMonthly`);case`billing`:return t(`subscriptionBilling`)}}function Ki(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let qi={"new-api":L.siteKindSite,sub2api:L.siteKindDirect,unknown:L.siteKindUnknown},Ji=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function Yi(e){return e.children===void 0?{cost:e.subCost??0,calls:e.subCalls??0}:(e.children??[]).reduce((e,t)=>({cost:e.cost+(t.subCost??0),calls:e.calls+(t.subCalls??0)}),{cost:0,calls:0})}function Xi(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Zi(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let n=t;for(let e of[`sessionListError`,`error`]){let t=n[e];if(typeof t==`string`&&t!==``)return t}return}catch{return}}async function Qi(){try{let e=await Q(`/api/billing/usage-stats`),t=await e.text();if(!e.ok)return{ok:!1,reason:Zi(t)??`HTTP ${e.status}`,status:e.status};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{ok:!1,reason:`响应不是统计文档`};if(!(`total`in n))return{ok:!1,reason:Zi(t)??`响应不是统计文档`};let r=n,i=e=>typeof e==`object`&&!!e;return{ok:!0,stats:{total:r.total??zr.total,byModel:r.byModel??{},byDay:r.byDay??{},...r.byDayModels===void 0?{}:{byDayModels:r.byDayModels},...i(r.byDayModelsSite)?{byDayModelsSite:r.byDayModelsSite}:{},...r.updatedAt===void 0?{}:{updatedAt:r.updatedAt},...r.staleSnapshot===!0?{staleSnapshot:!0}:{},...typeof r.budget==`number`?{budget:r.budget}:{},...typeof r.lowBalanceThreshold==`number`?{lowBalanceThreshold:r.lowBalanceThreshold}:{},...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...typeof r.bySessionTotal==`number`?{bySessionTotal:r.bySessionTotal}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{},...Array.isArray(r.byWorkspace)?{byWorkspace:r.byWorkspace}:{},...i(r.bySite)?{bySite:r.bySite}:{},...i(r.byTier)?{byTier:r.byTier}:{},...i(r.byTool)?{byTool:r.byTool}:{},...Array.isArray(r.unpricedModels)?{unpricedModels:r.unpricedModels}:{},...typeof r.staleLedgerSessions==`number`?{staleLedgerSessions:r.staleLedgerSessions}:{},...typeof r.unreadableSessions==`number`?{unreadableSessions:r.unreadableSessions}:{},...typeof r.unreadableFormatSessions==`number`?{unreadableFormatSessions:r.unreadableFormatSessions}:{},...typeof r.unreadableNoLedgerSessions==`number`?{unreadableNoLedgerSessions:r.unreadableNoLedgerSessions}:{},...typeof r.searchCallEstimateCny==`number`?{searchCallEstimateCny:r.searchCallEstimateCny}:{},...r.byRole!==null&&typeof r.byRole==`object`?{byRole:r.byRole}:{},...r.perf!==null&&typeof r.perf==`object`&&r.perf.byModel!==null&&typeof r.perf.byModel==`object`&&r.perf.byHourModel!==null&&typeof r.perf.byHourModel==`object`?{perf:r.perf}:{},...typeof r.pluginVersion==`string`?{pluginVersion:r.pluginVersion}:{},...typeof r.sessionListError==`string`?{sessionListError:r.sessionListError}:{}}}}catch(e){return{ok:!1,reason:e instanceof Error?e.message:String(e)}}}async function $i(){try{let e=await Q(`/api/billing/balance`);if(!e.ok)return{balances:[]};let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return{balances:[]};let r=n;return{balances:Array.isArray(r.balances)?r.balances:[],...r.reconcile===void 0?{}:{reconcile:r.reconcile},...r.stale===!0?{stale:!0}:{}}}catch{return{balances:[]}}}async function ea(){let e=await Q(`/api/billing/subscriptions`);if(!e.ok)throw Error(`subscriptions HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n){let e=n;return{quotas:e.quotas,...e.stale===!0?{stale:!0}:{}}}throw Error(`subscriptions: invalid response`)}async function ta(){let e=await Q(`/api/billing/relay-quotas`);if(!e.ok)throw Error(`relay-quotas HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`relay-quotas: invalid response`)}async function na(){try{let e=await Q(`/api/billing/usage-tool`);if(!e.ok)return;let t=JSON.parse(await e.text());return typeof t.enabled==`boolean`?t.enabled:void 0}catch{return}}async function ra(e){try{let t=await Q(`/api/billing/usage-tool`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:e})});return t.ok?JSON.parse(await t.text()).ok===!0:!1}catch{return!1}}let ia=!1,aa=0;async function oa(e=0){try{let t=await Q(`/api/billing/pricing`);if(!t.ok){ia=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){ia=!1;return}let i=r;Array.isArray(i.catalog)&&i.catalog.length>0&&i.aliases!==null&&typeof i.aliases==`object`&&Gt(i.catalog,i.aliases);let a=r;if(a.source===`builtin`&&e<3){if(e===0){if(ia)return;ia=!0}setTimeout(()=>{oa(e+1)},2e3);return}ia=!1,aa=a.syncedAt??0,St(a)}catch{ia=!1}}async function sa(){try{return(await Q(`/api/billing/pricing/refresh`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`,timeoutMs:3e4})).ok?(await oa(),!0):!1}catch{return!1}}async function ca(e){try{let t=JSON.parse(await e.text());return typeof t.error==`string`?t.error:`HTTP ${e.status}`}catch{return`HTTP ${e.status}`}}async function la(e=!1){let t=await Q(`/api/billing/task-queue${e?`?refresh=1`:``}`);if(!t.ok)throw Error(await ca(t));return await t.json()}async function ua(){let e=await Q(`/api/billing/task-queue-summary`);if(!e.ok)throw Error(await ca(e));return await e.json()}async function da(e){let t=await Q(`/api/billing/task-queue`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await ca(t));return(await t.json()).snapshot}let fa=`@kenz1117/dsh-ui-usage-billing/TaskQueuePanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(fa)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=fa,e.textContent=`.cQSERa_queuePanel{color:var(--ds-t-1);flex-direction:column;flex-shrink:0;gap:12px;display:flex}.cQSERa_queuePanel *{box-sizing:border-box}.cQSERa_queueHero,.cQSERa_queueComposer,.cQSERa_queueListSection,.cQSERa_queueUnsupported{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-2);flex-shrink:0}.cQSERa_queueHero{justify-content:space-between;align-items:center;gap:16px;padding:16px;display:flex}.cQSERa_queueTitleRow{align-items:center;gap:8px;display:flex}.cQSERa_queueTitle,.cQSERa_queueListHead h3,.cQSERa_queueUnsupported h3{margin:0;font-size:15px;font-weight:650}.cQSERa_queuePreview{background:var(--ds-violet-soft);color:var(--ds-violet);text-transform:uppercase;border-radius:5px;padding:2px 6px;font-size:10px;font-weight:700}.cQSERa_queueSubtitle{color:var(--ds-t-2);margin:5px 0 0;font-size:12px;line-height:1.6}.cQSERa_queueBand{color:var(--ds-t-2);flex-direction:column;flex-shrink:0;align-items:flex-end;gap:3px;font-size:11px;display:flex}.cQSERa_queueBand strong{font-size:13px}.cQSERa_queueBandOff strong{color:var(--ds-green)}.cQSERa_queueBandPeak strong{color:var(--ds-amber)}.cQSERa_queueComposer{flex-direction:column;gap:12px;padding:14px;display:flex}.cQSERa_queueSafety{border-radius:var(--ds-r-1);background:color-mix(in srgb, var(--ds-amber) 8%, transparent);color:var(--ds-t-2);padding:9px 11px;font-size:11px;line-height:1.65}.cQSERa_queueSafetyMode{color:var(--ds-t-3);margin-top:4px;display:block}.cQSERa_queueSelectors{grid-template-columns:1fr 1fr;gap:10px;display:grid}.cQSERa_queueField,.cQSERa_queuePromptField{color:var(--ds-t-2);flex-direction:column;gap:6px;font-size:11px;display:flex}.cQSERa_queueField select,.cQSERa_queuePromptField textarea{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);width:100%;color:var(--ds-t-1);font:inherit}.cQSERa_queueField select{height:34px;padding:0 9px}.cQSERa_queuePromptField textarea{resize:vertical;min-height:112px;padding:10px;line-height:1.55}.cQSERa_queueField select:focus,.cQSERa_queuePromptField textarea:focus{outline:2px solid color-mix(in srgb, var(--ds-blue) 35%, transparent);border-color:var(--ds-blue)}.cQSERa_queueField select:disabled,.cQSERa_queuePromptField textarea:disabled{opacity:.55}.cQSERa_queueComposerFooter{color:var(--ds-t-3);justify-content:space-between;align-items:center;gap:12px;font-size:10px;line-height:1.5;display:flex}.cQSERa_queueComposerActions{flex-shrink:0;align-items:center;gap:8px;display:flex}.cQSERa_queueFileInput{display:none}.cQSERa_queuePrimary,.cQSERa_queueSecondary{border-radius:var(--ds-r-1);cursor:pointer;flex-shrink:0;min-height:34px;padding:0 16px;font-weight:600}.cQSERa_queuePrimary{background:var(--ds-blue);color:#fff;border:0}.cQSERa_queueSecondary{border:1px solid var(--ds-border);background:var(--dsb);color:var(--ds-t-1)}.cQSERa_queuePrimary:disabled,.cQSERa_queueSecondary:disabled{opacity:.45;cursor:not-allowed}.cQSERa_queueListSection{padding:12px 14px}.cQSERa_queueListHead{justify-content:space-between;align-items:center;margin-bottom:8px;display:flex}.cQSERa_queueListHead h3 span{color:var(--ds-t-3);margin-left:4px;font-size:11px;font-weight:500}.cQSERa_queueList{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.cQSERa_queueTask{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);padding:10px}.cQSERa_queueTaskHead{align-items:center;gap:8px;min-width:0;display:flex}.cQSERa_queueStatus{background:var(--dsb-3);color:var(--ds-t-2);border-radius:5px;flex-shrink:0;padding:2px 6px;font-size:10px;font-weight:650}.cQSERa_queueStatus_running,.cQSERa_queueStatus_starting{color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.cQSERa_queueStatus_completed{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.cQSERa_queueStatus_failed{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 10%, transparent)}.cQSERa_queueTaskMeta{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--ds-t-2);font-size:11px;overflow:hidden}.cQSERa_queueTaskTime{color:var(--ds-t-3);flex-shrink:0;margin-left:auto;font-size:10px}.cQSERa_queueTaskTarget{color:var(--ds-t-2);overflow-wrap:anywhere;flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;font-size:11px;line-height:1.5;display:flex}.cQSERa_queueTaskTargetNote{color:var(--ds-t-3);font-size:10px}.cQSERa_queuePrompt{color:var(--ds-t-1);margin-top:8px;font-size:12px;line-height:1.55}.cQSERa_queuePrompt summary{text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden}.cQSERa_queuePrompt pre{background:var(--dsb-2);white-space:pre-wrap;overflow-wrap:anywhere;max-height:240px;font-family:var(--mono);border-radius:6px;margin:8px 0 0;padding:9px;font-size:11px;line-height:1.55;overflow:auto}.cQSERa_queueTaskError{color:var(--ds-red);overflow-wrap:anywhere;margin-top:8px;font-size:11px;line-height:1.5}.cQSERa_queueTaskActions{justify-content:flex-end;gap:10px;margin-top:5px;display:flex}.cQSERa_queueLinkButton{color:var(--ds-blue);cursor:pointer;background:0 0;border:0;padding:2px 0;font-size:11px}.cQSERa_queueLinkButton:disabled{opacity:.45;cursor:not-allowed}.cQSERa_queueEmpty{color:var(--ds-t-3);text-align:center;padding:26px 12px;font-size:12px}.cQSERa_queueUnsupported{padding:22px}.cQSERa_queueUnsupported p{color:var(--ds-t-2);margin:8px 0 0;font-size:12px;line-height:1.7}.cQSERa_queueNotice,.cQSERa_queueNoticeError{border-radius:var(--ds-r-1);overflow-wrap:anywhere;flex-shrink:0;padding:9px 11px;font-size:11px;line-height:1.5}.cQSERa_queueNotice{background:var(--dsb-2);color:var(--ds-t-2)}.cQSERa_queueNoticeError{background:color-mix(in srgb, var(--ds-red) 10%, transparent);color:var(--ds-red)}@media (width<=640px){.cQSERa_queueHero{align-items:flex-start}.cQSERa_queueSelectors{grid-template-columns:1fr}.cQSERa_queueComposerFooter{flex-direction:column;align-items:stretch}.cQSERa_queueComposerActions{flex-wrap:wrap;justify-content:flex-end}.cQSERa_queueTaskTime{display:none}}`,document.head.appendChild(e)}var $={queueBand:`cQSERa_queueBand`,queueBandOff:`cQSERa_queueBandOff`,queueBandPeak:`cQSERa_queueBandPeak`,queueComposer:`cQSERa_queueComposer`,queueComposerActions:`cQSERa_queueComposerActions`,queueComposerFooter:`cQSERa_queueComposerFooter`,queueEmpty:`cQSERa_queueEmpty`,queueField:`cQSERa_queueField`,queueFileInput:`cQSERa_queueFileInput`,queueHero:`cQSERa_queueHero`,queueLinkButton:`cQSERa_queueLinkButton`,queueList:`cQSERa_queueList`,queueListHead:`cQSERa_queueListHead`,queueListSection:`cQSERa_queueListSection`,queueNotice:`cQSERa_queueNotice`,queueNoticeError:`cQSERa_queueNoticeError`,queuePanel:`cQSERa_queuePanel`,queuePreview:`cQSERa_queuePreview`,queuePrimary:`cQSERa_queuePrimary`,queuePrompt:`cQSERa_queuePrompt`,queuePromptField:`cQSERa_queuePromptField`,queueSafety:`cQSERa_queueSafety`,queueSafetyMode:`cQSERa_queueSafetyMode`,queueSecondary:`cQSERa_queueSecondary`,queueSelectors:`cQSERa_queueSelectors`,queueStatus:`cQSERa_queueStatus`,queueStatus_completed:`cQSERa_queueStatus_completed`,queueStatus_failed:`cQSERa_queueStatus_failed`,queueStatus_running:`cQSERa_queueStatus_running`,queueStatus_starting:`cQSERa_queueStatus_starting`,queueSubtitle:`cQSERa_queueSubtitle`,queueTask:`cQSERa_queueTask`,queueTaskActions:`cQSERa_queueTaskActions`,queueTaskError:`cQSERa_queueTaskError`,queueTaskHead:`cQSERa_queueTaskHead`,queueTaskMeta:`cQSERa_queueTaskMeta`,queueTaskTarget:`cQSERa_queueTaskTarget`,queueTaskTargetNote:`cQSERa_queueTaskTargetNote`,queueTaskTime:`cQSERa_queueTaskTime`,queueTitle:`cQSERa_queueTitle`,queueTitleRow:`cQSERa_queueTitleRow`,queueUnsupported:`cQSERa_queueUnsupported`};let pa={queued:`queueStatusQueued`,starting:`queueStatusStarting`,running:`queueStatusRunning`,completed:`queueStatusCompleted`,failed:`queueStatusFailed`};function ma(e){return e.status===`completed`||e.status===`failed`}function ha(e,t){return JSON.stringify([e,t])}function ga(e){let t=e.startsWith(`session-`)?e.slice(8):e;return t.length<=8?t:t.slice(0,8)}function _a(e,t){let n;try{n=JSON.parse(e)}catch{throw Error(`invalid task import`)}if(!Array.isArray(n)||n.length===0)throw Error(`invalid task import`);return n.map(e=>{if(typeof e==`string`)return{prompt:e,...t};if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`invalid task import`);let n=e;return{prompt:n.prompt,cwd:n.cwd??t.cwd,provider:n.provider??t.provider,model:n.model??t.model}})}function va({t:e,language:t,navigateToSession:n,sessionTitleOf:r,reuseSourceSession:i}){let[a,o]=(0,d.useState)(),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(``),[f,p]=(0,d.useState)(``),[h,g]=(0,d.useState)(!1),[_,v]=(0,d.useState)(),[b,x]=(0,d.useState)(),S=(0,d.useRef)(!0),C=(0,d.useRef)(!1),w=(0,d.useRef)(!1),T=(0,d.useRef)(null),E=(0,d.useCallback)(async()=>{if(!C.current){C.current=!0;try{let e=await la();S.current&&o(e)}catch(e){S.current&&v(e instanceof Error?e.message:String(e))}finally{C.current=!1}}},[]),[ee,te]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{te(!document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]),(0,d.useEffect)(()=>{if(S.current=!0,!ee)return;E();let e=setInterval(()=>{E()},5e3);return()=>{S.current=!1,clearInterval(e)}},[E,ee]),(0,d.useEffect)(()=>{if(_===void 0)return;let e=window.setTimeout(()=>{v(void 0)},8e3);return()=>{window.clearTimeout(e)}},[_]),(0,d.useEffect)(()=>{if(b===void 0)return;let e=window.setTimeout(()=>{x(void 0)},4e3);return()=>{window.clearTimeout(e)}},[b]),(0,d.useEffect)(()=>{a!==void 0&&(a.workspaces.some(e=>e.path===l)||u(a.workspaces[0]?.path??``),a.models.some(e=>ha(e.provider,e.id)===f)||p(a.models[0]===void 0?``:ha(a.models[0].provider,a.models[0].id)))},[a,l,f]);let D=(0,d.useCallback)(async(e,t=!1)=>{if(h||w.current)return!1;w.current=!0,g(!0),v(void 0),x(void 0);try{let n=await da(e);return S.current?(o(n),t&&c(``),!0):!1}catch(e){return S.current&&v(e instanceof Error?e.message:String(e)),!1}finally{w.current=!1,g(!1)}},[h]),O=(0,d.useMemo)(()=>a?.tasks.filter(e=>!ma(e))??[],[a]),ne=(0,d.useMemo)(()=>a?.tasks.filter(ma).slice().reverse()??[],[a]),k=a!==void 0&&a.supported&&a.workspaces.length>0&&a.models.length>0,A=e=>new Date(e).toLocaleString(t===`en`?`en-US`:`zh-CN`),j=()=>{if(s.trim()===``||l===``||f===``)return;let[e,t]=JSON.parse(f);D({action:`enqueue`,prompt:s,cwd:l,provider:e,model:t},!0)},re=async t=>{if(!(t===void 0||!k||h||f===``)){v(void 0),x(void 0);try{if(t.size>10485760){v(e(`queueImportTooLarge`));return}let[n,r]=JSON.parse(f),i=_a(await t.text(),{cwd:l,provider:n,model:r});await D({action:`enqueueMany`,tasks:i})&&S.current&&x(e(`queueImported`,{count:i.length}))}catch{S.current&&v(e(`queueImportFormat`))}}},ie=t=>{let r=n(t);x(r===`opened`?void 0:e(r===`unavailable`?`sessionOpenUnavailable`:`sessionOpenFailed`))},ae=t=>{let n=a?.workspaces.find(e=>e.path===t.cwd),i=t.reuseSource===!0?t.sourceSessionId:void 0,o=t.sourceSessionId!==void 0&&t.sessionId===t.sourceSessionId,s=e=>r?.(e)??ga(e),c=t.fallbackReason===void 0?o?e(`queueReuseDone`,{session:s(t.sessionId)}):i===void 0?void 0:e(`queueReusePlanned`,{session:s(i)}):e(`queueFallbackReason`,{reason:t.fallbackReason}),l=t.fallbackReason===void 0?t.sessionId??i:t.sessionId;return(0,m.jsxs)(`li`,{className:$.queueTask,"data-testid":`queue-task-${t.id}`,children:[(0,m.jsxs)(`div`,{className:$.queueTaskHead,children:[(0,m.jsx)(`span`,{className:y($.queueStatus,$[`queueStatus_${t.status}`]),children:e(pa[t.status])}),(0,m.jsxs)(`span`,{className:$.queueTaskMeta,children:[n?.title??t.cwd,` · `,t.model]}),(0,m.jsx)(`time`,{className:$.queueTaskTime,dateTime:new Date(t.createdAt).toISOString(),children:A(t.createdAt)})]}),c!==void 0&&(0,m.jsxs)(`div`,{className:$.queueTaskTarget,"data-testid":`queue-task-target-${t.id}`,children:[(0,m.jsx)(`span`,{children:c}),o&&(0,m.jsx)(`span`,{className:$.queueTaskTargetNote,children:e(`queueReuseModelNote`)})]}),(0,m.jsxs)(`details`,{className:$.queuePrompt,children:[(0,m.jsx)(`summary`,{children:t.prompt.trim().slice(0,180)||t.prompt.slice(0,180)}),(0,m.jsx)(`pre`,{children:t.prompt})]}),t.error!==void 0&&(0,m.jsx)(`div`,{className:$.queueTaskError,role:`note`,children:t.error}),(0,m.jsxs)(`div`,{className:$.queueTaskActions,children:[l!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:$.queueLinkButton,onClick:()=>{ie(l)},children:e(`queueOpenSession`)}),(t.status===`queued`||ma(t))&&(0,m.jsx)(`button`,{type:`button`,className:$.queueLinkButton,disabled:h,onClick:()=>{D({action:`remove`,id:t.id})},children:e(t.status===`queued`?`queueRemoveQueued`:`queueRemoveHistory`)})]})]},t.id)};return(0,m.jsxs)(`div`,{className:$.queuePanel,"data-testid":`billing-tab-panel-queue`,children:[(0,m.jsxs)(`section`,{className:$.queueHero,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:$.queueTitleRow,children:[(0,m.jsx)(`h2`,{className:$.queueTitle,children:e(`tabQueue`)}),(0,m.jsx)(`span`,{className:$.queuePreview,children:`Preview`})]}),(0,m.jsx)(`p`,{className:$.queueSubtitle,children:e(`queueSubtitle`)})]}),a?.supported&&(0,m.jsxs)(`div`,{className:y($.queueBand,a.tier===`offPeak`?$.queueBandOff:$.queueBandPeak),children:[(0,m.jsx)(`strong`,{children:e(a.tier===`offPeak`?`offPeak`:`peak`)}),(0,m.jsxs)(`span`,{children:[e(a.tier===`offPeak`?`queueUntilPeak`:`queueUntilOffPeak`),` `,Ht(a.nextSwitchInMs)]})]})]}),_!==void 0&&(0,m.jsx)(`div`,{className:$.queueNoticeError,role:`alert`,children:_}),b!==void 0&&(0,m.jsx)(`div`,{className:$.queueNotice,role:`status`,children:b}),a===void 0?(0,m.jsx)(`div`,{className:$.queueEmpty,children:e(`queueLoading`)}):a.supported?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`section`,{className:$.queueComposer,children:[(0,m.jsxs)(`div`,{className:$.queueSafety,children:[e(`queueSafety`),(0,m.jsx)(`span`,{className:$.queueSafetyMode,children:e(i===!0?`queueSafetyReuse`:`queueSafetyIsolated`)})]}),(0,m.jsxs)(`div`,{className:$.queueSelectors,children:[(0,m.jsxs)(`label`,{className:$.queueField,children:[(0,m.jsx)(`span`,{children:e(`queueWorkspace`)}),(0,m.jsx)(`select`,{value:l,disabled:!k||h,onChange:e=>{u(e.target.value)},children:a.workspaces.map(e=>(0,m.jsx)(`option`,{value:e.path,children:e.title},e.path))})]}),(0,m.jsxs)(`label`,{className:$.queueField,children:[(0,m.jsx)(`span`,{children:e(`queueModel`)}),(0,m.jsx)(`select`,{value:f,disabled:!k||h,onChange:e=>{p(e.target.value)},children:a.models.map(e=>(0,m.jsxs)(`option`,{value:ha(e.provider,e.id),children:[e.providerName,` / `,e.name]},ha(e.provider,e.id)))})]})]}),!k&&(0,m.jsx)(`div`,{className:$.queueNotice,children:a.optionsError??e(`queueNoOptions`)}),(0,m.jsxs)(`label`,{className:$.queuePromptField,children:[(0,m.jsx)(`span`,{children:e(`queuePromptLabel`)}),(0,m.jsx)(`textarea`,{value:s,disabled:!k||h,maxLength:32e3,rows:5,placeholder:e(`queuePromptPlaceholder`),onChange:e=>{c(e.target.value)}})]}),(0,m.jsxs)(`div`,{className:$.queueComposerFooter,children:[(0,m.jsx)(`span`,{children:e(`queuePrivacy`)}),(0,m.jsxs)(`div`,{className:$.queueComposerActions,children:[(0,m.jsx)(`input`,{ref:T,className:$.queueFileInput,"data-testid":`queue-import-file`,type:`file`,accept:`application/json,.json`,disabled:!k||h,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,re(t)}}),(0,m.jsx)(`button`,{type:`button`,className:$.queueSecondary,title:e(`queueImportHint`),disabled:!k||h,onClick:()=>{T.current?.click()},children:e(`queueImport`)}),(0,m.jsx)(`button`,{type:`button`,className:$.queuePrimary,disabled:!k||h||s.trim()===``,onClick:j,children:e(`queueEnqueue`)})]})]})]}),(0,m.jsxs)(`section`,{className:$.queueListSection,children:[(0,m.jsxs)(`div`,{className:$.queueListHead,children:[(0,m.jsxs)(`h3`,{children:[e(`queueActive`),` `,(0,m.jsx)(`span`,{children:O.length})]}),ne.length>0&&(0,m.jsx)(`button`,{type:`button`,className:$.queueLinkButton,disabled:h,onClick:()=>{D({action:`clearFinished`})},children:e(`queueClearFinished`)})]}),O.length===0&&ne.length===0?(0,m.jsx)(`div`,{className:$.queueEmpty,children:e(`queueEmpty`)}):(0,m.jsxs)(`ul`,{className:$.queueList,children:[O.map(ae),ne.map(ae)]})]})]}):(0,m.jsxs)(`section`,{className:$.queueUnsupported,"data-testid":`queue-unsupported`,children:[(0,m.jsx)(`h3`,{children:e(`queueUnsupportedTitle`)}),(0,m.jsx)(`p`,{children:e(`queueUnsupportedBody`)})]})]})}function ya({window:e,t}){let n=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,m.jsxs)(`div`,{className:L.subscriptionWindow,children:[(0,m.jsx)(`span`,{className:L.subscriptionWindowLabel,children:Gi(e.kind,t)}),(0,m.jsx)(`span`,{className:L.subscriptionTrack,"aria-hidden":`true`,children:(0,m.jsx)(`span`,{className:y(L.subscriptionFill,n>=100&&L.subscriptionFillOver,n>=80&&n<100&&L.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,m.jsxs)(`span`,{className:L.subscriptionMeta,children:[(0,m.jsx)(`span`,{className:y(L.subscriptionPct,r&&L.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,m.jsx)(`span`,{className:L.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${G(new Date(e.resetsAt).getTime())} ${Xi(new Date(e.resetsAt).getTime())}`)})]})]})}function ba({label:e,t}){return(0,m.jsx)(p.Tooltip,{label:e,side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.helpTip,role:`note`,"aria-label":e,children:`?`})})}function xa(e,t){return e===L.healthOk?t(`healthDotLive`):e===L.healthBad?t(`healthDotFailed`):t(`healthDotUnknown`)}function Sa(e){let t=t=>W(gn(t,e.currency),e.currency),{wide:n,t:r,onOpen:i,monthCost:a,todayCost:o,weekCost:s,days:c,vendorStatus:l,dash:u,floatPrefs:p,subscriptions:h,cardPrefs:g,monthTokens:_,todayTokens:v,weekTokens:b,budgetPressure:x,deltaPct:S=0,statsError:C}=e,w=(0,d.useMemo)(()=>p.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[p.targets,h]),[T,E]=(0,d.useState)(0),ee=w.length===0?0:Math.min(T,w.length-1),te=w[ee],D=(0,d.useRef)(null),[O,ne]=(0,d.useState)(null),k=(0,d.useCallback)(e=>{D.current=e,ne(e)},[]),[A,j]=(0,d.useState)(!1),[re,ie]=(0,d.useState)({left:0,top:0}),[ae,oe]=(0,d.useState)(`card`);(0,d.useLayoutEffect)(()=>{if(O===null)return;let e=Or(O,oe);return()=>e.dispose()},[O]),(0,d.useEffect)(()=>{if(!A||p.mode!==`subscription`||w.length<2)return;let e=setInterval(()=>E(e=>(e+1)%w.length),1500);return()=>clearInterval(e)},[A,p.mode,w.length]);let se=(0,d.useRef)(void 0),ce=(0,d.useCallback)(()=>{window.clearTimeout(se.current),j(!0)},[]),le=(0,d.useCallback)(()=>{window.clearTimeout(se.current),se.current=window.setTimeout(()=>j(!1),120)},[]);(0,d.useEffect)(()=>()=>window.clearTimeout(se.current),[]);let ue=(0,d.useCallback)(()=>{let e=D.current?.getBoundingClientRect();e!==void 0&&ie({left:e.left,top:e.top-8})},[]);(0,d.useEffect)(()=>{if(!A)return;let e=()=>ue();return window.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},[A,ue]);let de=c.length>0?c.reduce((e,t)=>e+t.cost,0)/c.length:0,fe=de>0?Math.max(0,Math.min(1,o/de)):0,pe=-80+fe*160,me=(0,m.jsxs)(`svg`,{viewBox:`3.5 10 34 22`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,opacity:.16}),(0,m.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,strokeDasharray:`${(41.9*fe).toFixed(2)} 41.9`,className:L.triggerGaugeArc}),(0,m.jsx)(`path`,{d:`M5.23 26.4 8.18 26.92M10.36 17.51 12.29 19.81M20 14v3M27.71 19.81 29.64 17.51M31.82 26.92 34.77 26.4`,strokeWidth:1.6,opacity:.7}),(0,m.jsx)(`path`,{d:`M7.01 21.5 8.31 22.25M14.87 14.91 15.38 16.31M24.62 16.31 25.13 14.91M31.69 22.25 32.99 21.5`,strokeWidth:1.2,opacity:.38}),(0,m.jsx)(`line`,{x1:`20`,y1:`29`,x2:`20`,y2:`19.5`,strokeWidth:2,className:L.triggerGaugeNeedle,style:{transform:`rotate(${pe}deg)`,transformOrigin:`20px 29px`}}),(0,m.jsx)(`circle`,{cx:`20`,cy:`29`,r:`1.5`,fill:`currentColor`,stroke:`none`})]}),he=`${r(`title`)} · ${t(g.span===`day`?o:g.span===`week`?s:a)}${C===void 0?``:` · ${r(`statsLoadFailed`)}`}`;if(g.mode===`hidden`)return null;if(!n||g.mode===`compact`)return(0,m.jsx)(`button`,{type:`button`,className:y(L.railButton,Rr,x!==`none`&&L.triggerBudgetPulse,x===`over`&&L.triggerBudgetOver),"data-testid":`billing-rail-button`,onClick:i,title:he,children:me});let M=g.metric===`tokens`,ge=c.map(e=>M?e.tokens:e.cost),_e=Math.max(...ge,0),ve=ge.map(e=>_e>0?4+e/_e*12:4),ye=ae===`icon`;return(0,m.jsxs)(`span`,{ref:k,className:y(L.triggerWrap,ye&&L.triggerWrapShared,Rr),onMouseEnter:()=>{ue(),ce()},onMouseLeave:le,onFocusCapture:()=>{ue(),ce()},onBlurCapture:()=>j(!1),children:[ye?(0,m.jsx)(`button`,{type:`button`,className:y(L.triggerShared,x!==`none`&&L.triggerBudgetPulse,x===`over`&&L.triggerBudgetOver),"data-testid":`billing-trigger-shared`,"aria-label":he,onClick:i,title:he,children:(0,m.jsx)(`span`,{className:y(L.triggerIcon,x!==`none`&&L.triggerBudgetHot,C!==void 0&&L.triggerStatsError),"data-testid":`billing-trigger-icon`,children:me})}):(0,m.jsxs)(`button`,{type:`button`,className:y(L.trigger,x!==`none`&&L.triggerBudgetPulse,x===`over`&&L.triggerBudgetOver),"data-testid":`billing-trigger`,onClick:i,title:he,children:[(0,m.jsx)(`span`,{className:y(L.triggerIcon,x!==`none`&&L.triggerBudgetHot,C!==void 0&&L.triggerStatsError),"data-testid":`billing-trigger-icon`,children:me}),(0,m.jsx)(`span`,{className:L.triggerMain,children:(0,m.jsxs)(`span`,{className:L.triggerPrimary,children:[(0,m.jsx)(`span`,{className:L.triggerLabel,children:M?g.span===`day`?r(`triggerTodayTokens`):g.span===`week`?r(`triggerWeekTokens`):r(`triggerMonthTokens`):g.span===`day`?r(`triggerToday`):g.span===`week`?r(`weekCost`):r(`triggerMonth`)}),(()=>{let e=g.span===`day`?M?v:o:g.span===`week`?M?b:s:M?_:a,n=g.span===`day`?S:0;return M?(0,m.jsx)(`span`,{className:L.triggerMetric,"data-testid":`billing-trigger-span-tokens`,children:K(e)}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{className:L.triggerValueRow,children:[(0,m.jsx)(`span`,{className:L.triggerYen,"aria-hidden":`true`,children:t(e).charAt(0)}),(0,m.jsx)(`span`,{className:L.triggerMetric,"data-testid":`billing-trigger-span-money`,children:t(e).slice(1)})]}),g.showDelta&&n!==0&&(0,m.jsxs)(`span`,{className:y(L.triggerDelta,n>0?L.triggerDeltaUp:L.triggerDeltaDown),"data-testid":`billing-trigger-delta`,children:[n>0?`▲`:`▼`,` `,Math.abs(n).toFixed(1),`%`]}),(0,m.jsx)(`span`,{className:L.triggerGlow,"aria-hidden":`true`})]})})()]})}),(0,m.jsx)(`span`,{className:L.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:ve.map((e,t)=>(0,m.jsx)(`span`,{className:t===ve.length-1?L.triggerSparkHot:L.triggerSparkBar,style:{height:`${e}px`}},c[t]?.date??String(t)))})]}),(0,f.createPortal)((0,m.jsx)(`span`,{className:y(L.triggerPop,Rr,A&&L.triggerPopShown),style:{left:`${re.left}px`,top:`${re.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!A,onMouseEnter:ce,onMouseLeave:le,children:p.mode===`subscription`?(0,m.jsx)(m.Fragment,{children:w.length===0?(0,m.jsx)(`span`,{className:L.triggerPopEmpty,children:r(`floatNoTargets`)}):(0,m.jsxs)(m.Fragment,{children:[te!==void 0&&(0,m.jsxs)(`div`,{className:L.floatSub,"data-testid":`billing-float-subscription`,children:[(0,m.jsxs)(`div`,{className:L.floatSubHead,children:[(0,m.jsx)(`span`,{className:L.floatSubName,children:te.displayName}),te.plan!==void 0&&(0,m.jsx)(`span`,{className:L.floatSubPlan,children:te.plan})]}),te.windows.map(e=>(0,m.jsx)(ya,{window:e,t:r},e.kind))]}),w.length>1&&(0,m.jsx)(`span`,{className:L.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,m.jsxs)(`span`,{className:L.triggerPopSwitchCount,children:[ee+1,`/`,w.length]})})]})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:L.popHead,children:(0,m.jsx)(`span`,{className:L.popTitle,children:r(`popTitle`)})}),C!==void 0&&(0,m.jsxs)(`span`,{className:L.popError,"data-testid":`billing-stats-error`,role:`note`,children:[(0,m.jsx)(`span`,{className:L.popErrorTitle,children:r(`statsLoadFailed`)}),(0,m.jsx)(`span`,{className:L.popErrorDetail,children:C})]}),(0,m.jsxs)(`span`,{className:L.metricGrid,children:[(0,m.jsxs)(`span`,{className:L.metricCell,children:[(0,m.jsx)(`span`,{className:L.metricLabel,children:r(`floatPrimaryToday`)}),(0,m.jsx)(`span`,{className:L.metricValue,children:t(o)})]}),(0,m.jsxs)(`span`,{className:L.metricCell,children:[(0,m.jsx)(`span`,{className:L.metricLabel,children:r(`floatPrimaryWeek`)}),(0,m.jsx)(`span`,{className:L.metricValue,children:t(s)})]}),(0,m.jsxs)(`span`,{className:L.metricCell,children:[(0,m.jsx)(`span`,{className:L.metricLabel,children:r(`floatPrimaryMonth`)}),(0,m.jsx)(`span`,{className:L.metricValue,children:t(a)})]}),(0,m.jsxs)(`span`,{className:L.metricCell,children:[(0,m.jsx)(`span`,{className:L.metricLabel,children:r(`input`)}),(0,m.jsx)(`span`,{className:L.metricValue,children:K(u.input)})]}),(0,m.jsxs)(`span`,{className:L.metricCell,children:[(0,m.jsx)(`span`,{className:L.metricLabel,children:r(`output`)}),(0,m.jsx)(`span`,{className:L.metricValue,children:K(u.output)})]}),(0,m.jsxs)(`span`,{className:L.metricCell,children:[(0,m.jsx)(`span`,{className:L.metricLabel,children:r(`cacheHit`)}),(0,m.jsx)(`span`,{className:y(L.metricValue,L.metricValueSuccess),children:yn(u.cacheRead+u.cacheMiss>0?u.cacheRead/(u.cacheRead+u.cacheMiss)*100:0)})]})]}),(0,m.jsxs)(`span`,{className:L.popModel,children:[(0,m.jsx)(`span`,{className:L.popModelLabel,children:r(`popTodayModel`)}),l.direct!==void 0||l.sub!==void 0?(0,m.jsxs)(m.Fragment,{children:[l.direct!==void 0&&(0,m.jsxs)(`span`,{className:L.popModelRow,children:[(0,m.jsx)(`span`,{className:y(L.popDot,L.popDotDirect),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:L.popTagPrimary,children:r(`popDirectLead`)}),(0,m.jsx)(`span`,{className:L.popModelName,children:l.direct.name}),(0,m.jsx)(`span`,{className:y(L.popModelStatus,l.direct.low&&L.popModelStatusLow),children:l.direct.text})]}),l.sub!==void 0&&(0,m.jsxs)(`span`,{className:L.popModelRow,children:[(0,m.jsx)(`span`,{className:y(L.popDot,L.popDotSub),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:L.popTagSub,children:r(`popSubLead`)}),(0,m.jsx)(`span`,{className:L.popModelName,children:l.sub.name}),(0,m.jsx)(`span`,{className:y(L.popModelStatus,l.sub.low&&L.popModelStatusLow),children:l.sub.text})]})]}):(0,m.jsxs)(`span`,{className:L.popModelRow,children:[(0,m.jsx)(`span`,{className:y(L.popDot,L.popDotNeutral),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:L.popModelStatus,children:r(`popNoConsumption`)})]})]})]})}),document.body)]})}function Ca({balance:e,days:t,dailyBurn:n,money:r,t:i,onClose:a}){let o=t=>t===void 0?void 0:e.currency===`USD`?`$${t.toFixed(2)}`:r(t),s=o(e.totalBalance),c=o(e.grantedBalance),l=o(e.toppedUpBalance);return(0,m.jsxs)(`span`,{className:L.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,onClick:e=>{e.stopPropagation()},children:[(0,m.jsxs)(`span`,{className:L.balanceDetailHead,children:[(0,m.jsx)(`span`,{className:L.balanceDetailTitle,children:e.displayName}),(0,m.jsx)(`button`,{type:`button`,className:L.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,m.jsxs)(`span`,{className:L.balanceDetailGrid,children:[s!==void 0&&(0,m.jsx)(wa,{label:i(`balance`),value:s}),c!==void 0&&(0,m.jsx)(wa,{label:i(`balanceGranted`),value:c}),l!==void 0&&(0,m.jsx)(wa,{label:i(`balanceTopped`),value:l}),(0,m.jsx)(wa,{label:i(`balanceDaily`),value:r(n)}),(0,m.jsx)(wa,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function wa({label:e,value:t}){return(0,m.jsxs)(`span`,{className:L.balanceDetailRow,children:[(0,m.jsx)(`span`,{className:L.balanceDetailLabel,children:e}),(0,m.jsx)(`span`,{className:L.balanceDetailValue,children:t})]})}function Ta({userPrices:e,onUserPrices:t,t:n,unpricedIds:r}){let[i,a]=(0,d.useState)(()=>[...e]),[o,s]=(0,d.useState)(new Set),c=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=()=>{a(e=>e.filter((e,t)=>!o.has(t))),s(new Set)},u=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),f=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),p=e=>{let t=i[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},h=(e,t,n)=>a(r=>r.map((r,i)=>{if(i!==e)return r;let a=r.offPeak,o={input:a===void 0?``:String(a.input),cacheHit:a===void 0?``:String(a.cacheHit),output:a===void 0?``:String(a.output),[t]:n},s=[o.input,o.cacheHit,o.output].some(e=>e.trim()!==``),c=[o.input,o.cacheHit,o.output].map(e=>Number(e)),l=s&&c.every(e=>Number.isFinite(e)&&e>=0)&&c.some(e=>e>0),{offPeak:u,...d}=r;return l?{...d,offPeak:{input:c[0]??0,cacheHit:c[1]??0,output:c[2]??0}}:d})),g=()=>t(i.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:ht(e.origin.trim())}}))),_=(0,d.useMemo)(()=>{let e=[];for(let t of fn())e.push(t.key);for(let t of r??[])e.includes(t)||e.push(t);return e},[r]),v=(e,t)=>a(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),[b,x]=(0,d.useState)({}),S=(e,t,n)=>`${e}:${t}:${n}`,C=(e,t,n)=>x(r=>{let i=S(e,t,n);if(r[i]===void 0)return r;let a={...r};return delete a[i],a}),w=e=>Number.isFinite(e)&&e!==0?String(e):``,T=(e,t,n)=>{if(x(r=>({...r,[S(e,`main`,t)]:n})),n===``){u(e,{[t]:0});return}let r=Number(n);Number.isFinite(r)&&r>=0&&u(e,{[t]:r})};return(0,m.jsxs)(`section`,{className:L.setCard,"data-testid":`billing-user-prices`,children:[(0,m.jsx)(`div`,{className:L.setCardHead,children:(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`userPrices`),(0,m.jsx)(ba,{label:n(`userPricesHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:L.ctlCol,children:[(0,m.jsx)(`datalist`,{id:`billing-price-model-keys`,children:_.map(e=>(0,m.jsx)(`option`,{value:e},e))}),i.map((e,t)=>(0,m.jsxs)(`div`,{className:L.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,m.jsx)(`input`,{type:`checkbox`,className:L.userPriceCheck,"data-testid":`billing-user-price-select`,checked:o.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>c(t)}),(0,m.jsxs)(`div`,{className:L.userPriceBody,children:[(0,m.jsxs)(`div`,{className:L.userPriceLineMeta,children:[(0,m.jsxs)(`div`,{className:L.userPriceField,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`userPriceModel`)}),(0,m.jsx)(`input`,{className:L.userPriceInput,"data-testid":`billing-user-price-model`,type:`text`,list:`billing-price-model-keys`,value:e.key,placeholder:`flash`,"aria-label":n(`userPriceModel`),onChange:e=>u(t,{key:e.target.value})})]}),(0,m.jsxs)(`div`,{className:L.userPriceField,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`userPriceSource`)}),(0,m.jsx)(`input`,{className:L.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>u(t,{origin:e.target.value.trim()})})]}),(0,m.jsxs)(`div`,{className:L.userPriceField,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`userPriceCurrency`)}),(0,m.jsxs)(`div`,{className:L.ctlGroup,children:[(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,e.currency!==`USD`&&L.floatModeBtnOn),onClick:()=>v(t,`CNY`),children:`CNY`}),(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,e.currency===`USD`&&L.floatModeBtnOn),onClick:()=>v(t,`USD`),children:`USD`})]})]})]}),[{scope:`main`,label:n(`userPriceNormal`),testid:`billing-user-price-normal`,valueOf:n=>b[S(t,`main`,n)]??w(e[n]),onChange:(e,n)=>T(t,e,n)},{scope:`off`,label:n(`userPriceOffPeak`),testid:`billing-user-price-offpeak`,valueOf:e=>b[S(t,`off`,e)]??p(t)[e],onChange:(e,n)=>{x(r=>({...r,[S(t,`off`,e)]:n})),h(t,e,n)}}].map(e=>(0,m.jsxs)(`div`,{className:L.userPricePriceLine,"data-testid":e.testid,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:e.label}),[`input`,`cacheHit`,`output`].map(r=>{let i=n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`);return(0,m.jsx)(`input`,{className:L.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:i,"aria-label":`${e.label} ${i}`,value:e.valueOf(r),onChange:t=>e.onChange(r,t.target.value),onBlur:()=>C(t,e.scope,r)},r)})]},e.testid))]})]},t)),(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-user-price-add`,onClick:f,children:n(`userPriceAdd`)}),(0,m.jsxs)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:o.size===0,onClick:l,children:[n(`userPriceRemoveSelected`),o.size>0?` (${o.size})`:``]}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-user-price-save`,onClick:g,children:n(`userPriceSave`)})]})]})]})}function Ea(e,t,n){if(e.length===0)return``;let r=e.slice(0,3).join(n===`zh`?`、`:`, `),i=e.length-3;return i>0?`${r} ${t(`unpricedMore`,{count:i})}`:r}function Da({prefs:e,onPrefs:t,groups:n,t:r,money:i}){let a=new Set(e.hidden),o=(e,n)=>{let r=new Set(a);for(let t of e.siteKeys)n?r.add(t):r.delete(t);t({hidden:[...r]})},s=n.filter(e=>e.siteKeys.some(e=>a.has(e))).length;return(0,m.jsxs)(`div`,{className:y(L.setCell,L.channelVisCell),"data-testid":`billing-channel-visibility-setting`,children:[(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[r(`channelVisibility`),(0,m.jsx)(ba,{label:r(`channelVisibilityHint`),t:r})]})}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-channel-visibility-reset`,disabled:e.hidden.length===0,onClick:()=>{t({hidden:[]})},children:r(`channelVisibilityShowAll`)})]}),n.length===0?(0,m.jsx)(`div`,{className:L.setHint,children:r(`channelVisibilityEmpty`)}):(0,m.jsx)(`div`,{className:L.channelVisList,children:n.map(e=>{let t=e.siteKeys.some(e=>a.has(e));return(0,m.jsxs)(`div`,{className:L.channelVisRow,"data-testid":`billing-channel-row-${e.name}`,children:[(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":!t,"aria-label":e.name,"data-testid":`billing-channel-toggle-${e.name}`,className:y(L.switch,!t&&L.switchOn),onClick:()=>{o(e,!t)},children:(0,m.jsx)(`span`,{className:L.switchKnob})}),(0,m.jsx)(`span`,{className:L.channelVisName,title:e.name,children:e.name}),(0,m.jsxs)(`span`,{className:L.channelVisUsage,children:[i(e.cost),` · `,K(e.tokens)]})]},e.name)})}),s>0&&(0,m.jsx)(`div`,{className:L.setHint,"data-testid":`billing-channel-visibility-hint`,children:r(`channelVisibilityHidden`).replace(`{count}`,String(s))})]})}function Oa({stats:e,statsError:t,t:n,onClose:r,embeddedSettings:i=!1,userPrices:a,onUserPrices:o,health:s,balances:c,reconcile:l,quotas:u,relayQuotas:f,currency:h,onCurrency:g,language:_,onLanguage:v,turns:b,renderSlot:x,budgetEnabled:S,budgetAmount:C,onToggleBudget:w,onBudgetAmount:T,modelBudgets:E,monthModelCost:ee,onModelBudget:te,peakConfig:D,onPeakConfig:O,onPreviewPeak:ne,floatPrefs:k,onFloatPrefs:A,cardPrefs:j,onCardPrefs:re,recoveryEntryAvailable:ie,sitePrefs:ae,onSitePrefs:ce,channelPrefs:le,onChannelPrefs:fe,channelGroups:pe,liveCostPrefs:me,onLiveCostPrefs:he,quickQueuePrefs:M,onQuickQueuePrefs:ge,quotasStale:_e,balanceStale:ve,navigateToSession:ye,sessionTitleOf:be}){let xe=(0,d.useRef)(null),Se=(0,d.useMemo)(()=>Ri(e.bySession??[]),[e.bySession]),Ce=(0,d.useMemo)(()=>Bi(Se),[Se]),[we,Te]=(0,d.useState)(void 0),Ee=(0,d.useCallback)(e=>{let t=ye(e);if(t===`opened`){Te(void 0);return}Te(n(t===`unavailable`?`sessionOpenUnavailable`:`sessionOpenFailed`))},[ye,n]),[De,Oe]=(0,d.useState)(`cost`),{total:ke,byModel:je,byDay:N}=e,[P,Ie]=(0,d.useState)(i?`settings`:`overview`),[Le,Re]=(0,d.useState)(7),[Be,Ve]=(0,d.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),He=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},Ue=(0,d.useCallback)(()=>{let e=He();Ve(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[We,Ge]=(0,d.useState)(()=>{let e=[`unpriced`,`search-estimate`,`unreadable`],t=new Set,n=new Date,r=e=>String(e).padStart(2,`0`),i=`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}`;try{for(let n of e)window.localStorage.getItem(`dsh-billing:notice-${n}-dismissed`)===i&&t.add(n)}catch{}return t}),Ke=(0,d.useCallback)(e=>{let t=He();Ge(t=>new Set(t).add(e));try{window.localStorage.setItem(`dsh-billing:notice-${e}-dismissed`,t)}catch{}},[]),[qe,Ye]=(0,d.useState)(`month`),[$e,et]=(0,d.useState)(`cost`),[tt,nt]=(0,d.useState)(Je),[rt,it]=(0,d.useState)(Ze),[at,ot]=(0,d.useState)(`budget`),[st,R]=(0,d.useState)(``),z=e=>Hi(st,e);(0,d.useEffect)(()=>{let e=xe.current;if(P!==`settings`||e===null||typeof IntersectionObserver>`u`)return;let t=Array.from(e.querySelectorAll(`[id^="settings-"]`)).filter(e=>!e.closest(`[hidden]`));if(t.length===0)return;let n=new IntersectionObserver(e=>{let t,n=1/0;for(let r of e){if(!r.isIntersecting)continue;let e=r.boundingClientRect.top;e<n&&(n=e,t=r.target.id)}t!==void 0&&ot(t.slice(9))},{rootMargin:`-80px 0px -55% 0px`});for(let e of t)n.observe(e);return()=>{n.disconnect()}},[P]);let ct=(0,d.useCallback)(e=>{ot(e);let t=xe.current?.querySelector(`[id="settings-${e}"]`);if(t==null)return;if(i){t.scrollIntoView({block:`start`,behavior:`smooth`});return}let n=t.closest(`.${L.dashboardBody}`);if(n===null)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+r,behavior:`smooth`})},[i]),ut=(0,d.useCallback)(e=>{nt(e),I(e)},[]),dt=(0,d.useCallback)(e=>{it(e),Qe(e)},[]);(0,d.useEffect)(()=>{typeof document>`u`||(document.documentElement.dataset.dshBillingDensity=tt,document.documentElement.dataset.dshBillingMotion=rt)},[tt,rt]),(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;t?.density!==void 0&&nt(t.density)},t=e=>{let t=e.detail;t?.motion!==void 0&&it(t.motion)};return window.addEventListener(F,e),window.addEventListener(Xe,t),()=>{window.removeEventListener(F,e),window.removeEventListener(Xe,t)}},[]);let[B,ft]=(0,d.useState)(oe),[V,pt]=(0,d.useState)(ue),mt=e=>{let t={...V,...e};t.start!==``&&t.end!==``&&(t.start>t.end&&(e.start===void 0?t.start=t.end:t.end=t.start),pt(t),de(t))},ht=(0,d.useMemo)(()=>u.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[u]),[gt,_t]=(0,d.useState)(),[vt,yt]=(0,d.useState)(new Set),[bt,H]=(0,d.useState)(!1),[xt,St]=(0,d.useState)(``),Ct=(0,d.useCallback)(e=>{yt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),wt=(0,d.useMemo)(()=>Li(e.bySession??[]),[e.bySession]),Tt=e=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:L.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:L.numCol,children:U(e.cost)}),(0,m.jsx)(`td`,{className:L.numCol,children:e.lastActive>0?`${G(e.lastActive)} ${Xi(e.lastActive)}`:`—`})]}),Dt=(e,t)=>(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:y(L.sessionChildRow,t>0&&L.sessionSubDeepRow),"data-testid":`billing-session-sub-row`,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:y(L.ubTag,L.ubTagNeutral),children:n(`sessionSubRow`)}),(e.subCalls??0)>0&&(0,m.jsx)(`span`,{className:y(L.ubTag,L.ubTagNeutral),"data-testid":`billing-session-sub-chain`,children:e.subCost!==void 0&&e.subCost>0?n(`sessionSubCost`).replace(`{cost}`,U(e.subCost)):n(`sessionSubCalls`).replace(`{calls}`,(e.subCalls??0).toLocaleString())}),(0,m.jsx)(`span`,{className:L.modelProvider,children:e.title??e.id.slice(0,8)})]}),Tt(e)]}),e.subs?.map(e=>Dt(e,t+1))]},e.id),Ot=(0,d.useMemo)(()=>Vi(e.bySession??[],xt),[e.bySession,xt]),kt=e.bySession?.length??0,At=e.bySessionTotal??kt,jt=At>kt,Mt=(0,d.useMemo)(()=>[...new Set([...Object.keys(ee),...Object.keys(E)])].map(e=>{let t=cn(e);return{key:e,name:t.key===`other`?void 0:t.name,cost:ee[e]??0}}).sort((e,t)=>t.cost-e.cost),[ee,E]),[Nt,Pt]=(0,d.useState)(()=>new Set(Me())),Ft=(0,d.useCallback)(e=>{Pt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),Ne([...n]),n})},[]),[It,Lt]=(0,d.useState)(()=>Pe()),Rt=(0,d.useCallback)(()=>{Lt(e=>{let t=!e;return Fe(t),t})},[]),[Vt,Ht]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=!0;return na().then(t=>{e&&t!==void 0&&Ht(t)}),()=>{e=!1}},[]);let Ut=(0,d.useCallback)(()=>{let e=!Vt;Ht(e),ra(e).then(t=>{t||Ht(!e)})},[Vt]),Wt=Et(),[Gt,Kt]=(0,d.useState)(!1),qt=(0,d.useCallback)(()=>{Gt||(Kt(!0),sa().finally(()=>{Kt(!1)}))},[Gt]),Jt=aa,U=e=>W(gn(e,h),h),Yt=h===`usd`?`$`:h===`eur`?`€`:`¥`,Xt=_,Zt=e=>gr(e,Xt),[Qt,$t]=(0,d.useState)(``),[en,tn]=(0,d.useState)(()=>Ae()),[nn,rn]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{let e=setInterval(()=>{rn(Date.now())},3e4);return()=>{clearInterval(e)}},[]);let an=u.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),on=D.leadMin*6e4,sn=(e,t)=>e===0?n(`free`):_n(vn(e,t,h,Wt.rate),h===`usd`?`USD`:h===`eur`?`EUR`:`CNY`),ln=(0,d.useMemo)(()=>sr([...b].reverse()),[b]),dn={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},pn=dn.peak/2,hn=Jr(N,G()),bn=e=>c.find(t=>Z(t.provider)===Z(e)),xn=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),Sn=e=>{if(e===void 0)return(0,m.jsx)(`span`,{className:L.na,children:`—`});if(e.error===`unconfigured`)return n(`balanceUnconfigured`);if(e.error===`unauthorized`)return n(`balanceUnauthorized`);if(e.error===`unreachable`)return n(`balanceUnreachable`);if(e.totalBalance===void 0)return(0,m.jsx)(`span`,{className:L.na,children:`—`});let t=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:U(e.totalBalance),r=e.currency===`USD`?e.totalBalance*Wt.rate:e.totalBalance,i=hn>0?Math.floor(r/hn):void 0;return(0,m.jsxs)(`span`,{className:L.balanceCell,children:[(0,m.jsx)(`span`,{children:t}),i!==void 0&&i>=0&&(0,m.jsx)(`button`,{type:`button`,className:y(L.balanceDaysBadge,i<=3&&L.balanceDaysBadgeLow),"data-testid":`billing-balance-days-badge`,title:n(`balanceDays`).replace(`{days}`,String(i)),"aria-label":`${e.displayName} ${n(`balanceDays`).replace(`{days}`,String(i))}`,onClick:t=>{t.stopPropagation(),_t(gt===e.provider?void 0:e.provider)},children:`?`}),gt===e.provider&&(0,m.jsx)(Ca,{balance:e,days:i??0,dailyBurn:hn,money:U,t:n,onClose:()=>{_t(void 0)}})]})},Tn=Object.keys(N).sort(),q=G(),An=N[q]?.cost??0,jn=q.slice(0,7),Mn=q.slice(0,4),Nn=Tn.reduce((e,t)=>e+(t.startsWith(jn)?N[t]?.cost??0:0),0),Fn=Tn.reduce((e,t)=>e+(t.startsWith(Mn)?N[t]?.cost??0:0),0),J=(0,d.useMemo)(()=>Xr(N,jn,q)+u.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[N,jn,q,u]),In=(0,d.useMemo)(()=>{if(!(S&&C>0))return null;let e=C-Nn;return{over:e<=0,remainRatio:Math.max(0,Math.min(1,e/C)),remainCny:Math.max(0,e)}},[S,C,Nn]),Ln=(0,d.useMemo)(()=>{let e=[];for(let t=Le-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push(G(n.getTime()))}return e},[Le]),Rn=Ln.at(-1)??q,Y=(0,d.useMemo)(()=>Object.entries(N).map(([e,t])=>({date:e,value:$e===`tokens`?$r(t):t.cost})),[N,$e]),Bn=(0,d.useMemo)(()=>Y.reduce((e,t)=>e+t.value,0),[Y]),Vn=Zr(N),Hn=Qr(N),Un=(0,d.useMemo)(()=>Ln.map(t=>{let n={},r=e.byDayModels?.[t];if(r!==void 0)for(let[e,t]of Object.entries(r))t.cost>0&&(n[e]=t.cost);let i=N[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:$r(i)}}),[Ln,N,e.byDayModels]),Wn=(0,d.useMemo)(()=>Object.entries(je).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=cn(e),r=n.key===`other`,i=r?di(e):void 0,a={input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,cacheWrite:t.cacheWrite??0,output:t.output};return{key:e,name:r?e:n.name,provider:i??n.provider,calls:t.calls,input:t.input,output:t.output,cacheHitRate:t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0,estimated:mn(n,a),plan:t.plan===!0,...t.cost>0?{actual:t.cost}:{},uncatalogued:r,estimatedPricing:n.estimated===!0,officialCalls:t.officialCalls??0,officialCost:t.officialCost??0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)).map((e,t)=>({...e,color:Br[t%Br.length]??`#8b95a3`})),[je]),Kn=(0,d.useMemo)(()=>ae.hideUnidentified?f.filter(e=>e.kind!==`unknown`):f,[f,ae.hideUnidentified]),qn=(0,d.useCallback)(e=>xr(e,Xt)??n(`channelUnknown`),[Xt,n]),Yn=(0,d.useMemo)(()=>{let t=e.byDayModelsSite;if(It){let n=G();t={[n]:e.byDayModelsSite?.[n]??{}}}let r=new Map;for(let n of Object.values(t??{}))for(let[t,i]of Object.entries(n))for(let[n,a]of Object.entries(i)){let i=r.get(n);i===void 0&&(i=new Map,r.set(n,i));let o=i.get(t)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cacheWrite:0,cost:0,allPlan:!0};o.calls+=a.calls,o.input+=a.input,o.output+=a.output,o.cacheHit+=a.cacheHit,o.cacheMiss+=a.cacheMiss,o.cacheWrite+=a.cacheWrite??0,o.cost+=a.cost,o.allPlan=o.allPlan&&(a.plan??e.byModel?.[t]?.plan===!0),i.set(t,o)}let i=new Map;for(let[e,t]of r){let n=!e.startsWith(`direct:`)&&!e.startsWith(`site:`),r=[...t.entries()].filter(([,e])=>e.calls>0).map(([e,t],r)=>{let i=cn(e),a=i.key===`other`,o=a?di(e)??i.provider:i.provider;return{key:e,name:a?e:i.name,provider:o,color:Br[r%Br.length]??`#8b95a3`,calls:t.calls,input:t.input,output:t.output,cacheHitRate:t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0,estimated:n?0:mn(i,{input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,cacheWrite:t.cacheWrite,output:t.output}),plan:t.allPlan,...t.cost>0?{actual:t.cost}:{},uncatalogued:a,estimatedPricing:i.estimated===!0,officialCalls:0,officialCost:0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));r.length>0&&i.set(e,r)}let a=e=>xr(e,Xt)??n(`channelUnknown`),o=new Map,l=new Map,d=new Map,f=e=>e.startsWith(`direct:`)?`direct`:e.startsWith(`site:`)?`site`:`unknown`,p={direct:2,site:1,unknown:0,vendor:0};for(let[e,t]of i){let n=a(e),r=o.get(n);if(r===void 0)o.set(n,[...t]),l.set(n,f(e)),d.set(n,e);else{r.push(...t),r.sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));let i=l.get(n)??`unknown`,a=f(e);p[a]>p[i]&&(l.set(n,a),d.set(n,e))}}let m=new Map,h=new Map;for(let e of u){if(e.status===`not-configured`)continue;let t=e.displayName??pi(e.provider),n=a(`direct:${e.provider}`),r=o.has(t)?t:o.has(n)?n:void 0,i=r??`sub:${pi(e.provider)}`;h.set(i,r??pi(e.provider));let s=m.get(i);s===void 0?m.set(i,[e]):s.push(e)}let g=e=>e===a(`direct:deepseek`)||e===a(`site:https://api.deepseek.com`)?bn(`deepseek`)??bn(e):bn(e),_=[];for(let[e,t]of o)_.push({id:`ch:${d.get(e)??e}`,name:e,models:t,subscriptions:m.get(e)??[],balance:g(e),dot:Ui(s,t[0]?.provider??``),channelKind:l.get(e)??`unknown`});for(let[e,t]of h)o.has(e)||_.push({id:e,name:t,models:[],subscriptions:m.get(e)??[],balance:bn(t),dot:Ui(s,t),channelKind:`vendor`});let v=new Set(_.flatMap(e=>[Z(e.name),...e.balance===void 0?[]:[Z(e.balance.provider)]]));for(let e of c)v.has(Z(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&_.push({id:`bal:${e.provider}`,name:e.displayName,models:[],subscriptions:[],balance:e,dot:Ui(s,e.displayName),channelKind:`vendor`});return _.filter(e=>ae.hideUnidentified&&e.channelKind===`unknown`?!1:!It||e.models.length>0).sort((e,t)=>{let n=Ji(t)-Ji(e);return n===0?e.models.length===0&&t.models.length===0?0:t.models.length===0?-1:e.models.length===0?1:e.name.localeCompare(t.name,`zh`):n})},[e.byDayModelsSite,e.byModel,u,c,s,Xt,n,It,ae.hideUnidentified]),Xn=(0,d.useMemo)(()=>Yn.filter(e=>e.models.length>0||e.subscriptions.length>0).map(e=>e.id),[Yn]),Zn=Xn.length>0&&Xn.every(e=>Nt.has(e)),$n=()=>{let e=new Set(Zn?[]:Xn);Pt(e),Ne([...e])},er=(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`model`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`calls`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`inputTokens`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`outputTokens`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`actual`)})]})}),tr=e=>(0,m.jsx)(`span`,{className:L.modelCell,children:(0,m.jsxs)(`span`,{children:[(0,m.jsxs)(`span`,{className:L.modelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:L.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:n(`uncatalogued`)}),e.estimatedPricing&&(0,m.jsx)(`span`,{className:L.estimatedTag,"data-testid":`billing-estimated-tag`,children:n(`estimatedPricing`)})]}),(0,m.jsx)(`span`,{className:L.modelProvider,children:Zt(e.provider)})]})}),nr=e.bySite?.unknown?.calls??0,rr=Wn.reduce((e,t)=>e+t.estimated,0),ar=ke.cost>0||nr>0?ke.cost:rr,X=(0,d.useMemo)(()=>{if(B===`all`){let e,t=0;for(let[n,r]of Object.entries(N)){let i=$r(r);i>t&&(t=i,e=n)}return{cost:ar,calls:ke.calls,input:ke.input,output:ke.output,cacheHit:ke.cacheHit,cacheMiss:ke.cacheMiss,cacheWrite:ke.cacheWrite??0,reasoning:ke.reasoning??0,peakDay:e,peakTokens:t}}return B===`custom`?ri(N,V.start,V.end):ni(N,G(),B)},[B,V,ar,ke,N]),or=B===`custom`?V.start===V.end?V.start:`${V.start} – ${V.end}`:n({today:`avgRangeToday`,"7d":`avgRange7d`,week:`avgRangeWeek`,month:`avgRangeMonth`,all:`avgRangeAll`}[B]),cr=(0,d.useMemo)(()=>Wn.map(e=>({key:e.key,name:e.name,color:e.color})),[Wn]),lr=Un.length>=2?Un.at(-2)?.cost??0:0,ur=lr>0?(An-lr)/lr*100:0,fr=(0,m.jsxs)(`div`,{ref:xe,className:y(L.dashboard,Rr,i&&L.nativeSettingsDashboard),"data-testid":i?`native-billing-settings-dashboard`:`billing-dashboard`,children:[!i&&(0,m.jsxs)(`div`,{className:L.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,m.jsxs)(`div`,{children:[x(`billing.dashboard.decor`,{position:`head`}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:L.dashboardTitle,children:n(`title`)}),x(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,m.jsxs)(`p`,{className:L.dashboardSubtitle,children:[n(`lastUpdated`),` `,Rn,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,m.jsxs)(`div`,{className:L.dashboardRight,children:[(0,m.jsx)(`span`,{className:L.currencyToggle,role:`group`,"aria-label":n(`language`),children:[`en`,`zh`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.currencyButton,_===e&&L.currencyButtonActive),"aria-pressed":_===e,"data-testid":`billing-language-${e}`,onClick:()=>{v(e)},children:e===`en`?`EN`:`中`},e))}),(0,m.jsx)(`span`,{className:L.currencyToggle,role:`group`,"aria-label":n(`currency`),children:[`cny`,`usd`,`eur`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.currencyButton,h===e&&L.currencyButtonActive),"aria-pressed":h===e,"data-testid":`billing-currency-${e}`,title:n(e===`cny`?`currencyCny`:e===`usd`?`currencyUsd`:`currencyEur`),onClick:()=>{g(e)},children:e===`cny`?`¥ CNY`:e===`usd`?`$ USD`:`€ EUR`},e))}),s.checked&&(0,m.jsxs)(`span`,{className:y(L.healthBadge,s.available?L.healthBadgeOk:L.healthBadgeBad),children:[(0,m.jsx)(`span`,{className:y(L.healthDot,s.available?L.healthOk:L.healthBad),role:`img`,"aria-label":s.available?n(`healthDotLive`):n(`healthDotFailed`),title:s.available?n(`healthDotLive`):n(`healthDotFailed`)}),s.available?`${n(`healthModelsLive`).replace(`{n}`,String(s.models))}${s.failures>0?` · ${n(`healthVendorsDown`).replace(`{n}`,String(s.failures))}`:``}`:n(`healthVendorsUnavailable`).replace(`{n}`,String(s.failures))]}),(0,m.jsx)(`button`,{type:`button`,className:L.closeButton,"aria-label":n(`close`),"data-testid":`billing-close`,onClick:r,children:(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M18 6 6 18`}),(0,m.jsx)(`path`,{d:`m6 6 12 12`})]})})]})]}),!i&&t!==void 0&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-stats-error`,children:(0,m.jsxs)(`div`,{className:L.staleNoticeBody,children:[(0,m.jsx)(`span`,{children:n(`statsLoadFailed`)}),(0,m.jsx)(`span`,{className:L.staleNoticeSub,children:t})]})}),!i&&e.staleSnapshot===!0&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-stale-snapshot`,children:n(`staleSnapshotNotice`)}),!i&&(0,m.jsx)(`nav`,{className:L.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":n(`title`),children:Ur.map(e=>(0,m.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":P===e.id,"aria-controls":`billing-tab-panel-${e.id}`,className:y(L.tabButton,P===e.id&&L.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{Ie(e.id)},children:[(0,m.jsx)(`span`,{className:L.tabRailIcon,"aria-hidden":`true`,children:Gr[e.id]}),(0,m.jsx)(`span`,{className:L.tabNavLabel,children:n(e.labelKey)})]},e.id))}),(0,m.jsxs)(`div`,{className:y(L.dashboardBody,i&&L.nativeSettingsBody),children:[P===`queue`&&(0,m.jsx)(va,{t:n,language:_,navigateToSession:ye,...be===void 0?{}:{sessionTitleOf:be},reuseSourceSession:M.reuseSourceSession}),P===`overview`&&(0,m.jsxs)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[l?.kind===`drift`&&l.spent!==void 0&&Be!==He()&&(0,m.jsxs)(`div`,{className:L.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,m.jsx)(`span`,{className:L.reconcileIcon,"aria-hidden":`true`,children:(0,m.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`line`,{x1:`12`,y1:`10`,x2:`12`,y2:`16`}),(0,m.jsx)(`line`,{x1:`12`,y1:`7.5`,x2:`12.01`,y2:`7.5`})]})}),(0,m.jsx)(`span`,{className:L.reconcileText,children:n(`reconcileDrift`).replace(`{provider}`,l.provider??``).replace(`{spent}`,U(l.spent)).replace(`{today}`,U(l.todayOfficialCost??0))}),(0,m.jsx)(`button`,{type:`button`,className:L.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:Ue,children:n(`reconcileDismiss`)})]}),ve===!0&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-balance-stale`,children:n(`balanceStaleNotice`)}),(0,m.jsxs)(`section`,{className:L.hero,"data-testid":`billing-hero`,children:[x(`billing.dashboard.decor`,{position:`hero`}),(0,m.jsxs)(`div`,{className:L.heroTop,children:[(0,m.jsxs)(`div`,{className:L.heroMain,children:[(0,m.jsx)(`span`,{className:L.heroLabel,"data-testid":`billing-hero-range-label`,children:or}),(0,m.jsxs)(`div`,{className:L.heroReadout,children:[(0,m.jsx)(`span`,{className:L.heroCurrency,"aria-hidden":`true`,children:Yt}),(0,m.jsx)(`span`,{className:L.heroValue,"data-testid":`billing-hero-range-value`,children:U(X.cost).slice(1)})]}),(0,m.jsxs)(`span`,{className:L.heroMeta,children:[X.calls.toLocaleString(),` `,n(`calls`),B===`month`&&J>0&&(0,m.jsxs)(`span`,{className:L.heroPred,children:[` `,n(`monthProjected`),` `,U(J)]})]})]}),In!==null&&(0,m.jsxs)(`div`,{className:L.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,m.jsxs)(`div`,{className:L.heroGaugeDial,children:[(0,m.jsxs)(`svg`,{className:L.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`heroRingGrad`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`100%`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:`var(--ds-cyan)`}),(0,m.jsx)(`stop`,{offset:`55%`,stopColor:`var(--ds-blue)`}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:`var(--ds-amber)`})]})}),(0,m.jsx)(`circle`,{className:L.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,m.jsx)(`circle`,{className:y(L.heroGaugeArc,In.over&&L.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${In.remainRatio*326.7} 326.7`},stroke:In.over?void 0:`url(#heroRingGrad)`})]}),(0,m.jsxs)(`span`,{className:L.heroGaugeCenter,children:[(0,m.jsxs)(`span`,{className:y(L.heroGaugeRemain,In.over&&L.heroGaugeRemainOver),children:[Yt,gn(In.remainCny,h).toFixed(2)]}),(0,m.jsx)(`span`,{className:L.heroGaugeLabel,children:n(`budgetRemain`)})]})]}),(0,m.jsxs)(`span`,{className:L.heroGaugeSub,children:[U(Nn),` / `,U(C)]})]})]}),(0,m.jsxs)(`div`,{className:L.heroSide,children:[(0,m.jsxs)(`div`,{className:L.heroSideItem,children:[(0,m.jsx)(`span`,{className:L.heroSideLabel,children:n(`yearCost`)}),(0,m.jsx)(`span`,{className:L.heroSideValue,children:U(Fn)})]}),(0,m.jsxs)(`div`,{className:L.heroSideItem,children:[(0,m.jsx)(`span`,{className:L.heroSideLabel,children:n(`todayCost`)}),(0,m.jsxs)(`span`,{className:L.heroSideValue,children:[U(An),(0,m.jsxs)(`span`,{className:y(L.delta,ur>=0?L.deltaUp:L.deltaDown),children:[ur>=0?`▲`:`▼`,` `,Math.abs(ur).toFixed(1),`%`]})]})]}),J>0&&(0,m.jsxs)(`div`,{className:L.heroSideItem,title:n(`monthProjectedHint`),children:[(0,m.jsx)(`span`,{className:L.heroSideLabel,children:n(`monthProjected`)}),(0,m.jsx)(`span`,{className:L.heroSideValue,children:U(J)})]}),J<=0&&(0,m.jsx)(`span`,{className:L.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&!We.has(`unpriced`)&&(0,m.jsxs)(`div`,{className:L.unpricedHint,"data-testid":`billing-unpriced-hint`,children:[(0,m.jsx)(`span`,{className:L.unpricedHintBody,children:n(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0)).replace(`{models}`,Ea(e.unpricedModels??[],n,_))}),(0,m.jsx)(`button`,{type:`button`,className:L.noticeAction,"data-testid":`billing-unpriced-fix`,onClick:()=>{Ie(`settings`),R(_===`zh`?`单价`:`price`)},children:n(`unpricedFix`)}),(0,m.jsx)(`button`,{type:`button`,className:L.noticeDismiss,"data-testid":`billing-unpriced-dismiss`,"aria-label":n(`close`),onClick:()=>{Ke(`unpriced`)},children:`×`})]}),(e.total.searchCalls??0)>0&&!We.has(`search-estimate`)&&(0,m.jsxs)(`div`,{className:L.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:[(0,m.jsx)(`span`,{className:L.unpricedHintBody,children:n(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,U(e.searchCallEstimateCny??0))}),(0,m.jsx)(`button`,{type:`button`,className:L.noticeDismiss,"data-testid":`billing-search-estimate-dismiss`,"aria-label":n(`close`),onClick:()=>{Ke(`search-estimate`)},children:`×`})]}),(e.unreadableSessions??0)>0&&!We.has(`unreadable`)&&(0,m.jsxs)(`div`,{className:L.staleNotice,"data-testid":`billing-sessions-unreadable`,children:[(0,m.jsxs)(`div`,{className:L.staleNoticeBody,children:[n(`unreadableNotice`).replace(`{count}`,String(e.unreadableSessions)),(e.unreadableNoLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:L.staleNoticeSub,"data-testid":`billing-sessions-no-ledger`,children:n(`unreadableNoLedgerNotice`).replace(`{count}`,String(e.unreadableNoLedgerSessions))}),(e.unreadableFormatSessions??0)>0&&(0,m.jsx)(`div`,{className:L.staleNoticeSub,"data-testid":`billing-sessions-format-unsupported`,children:n(`unreadableFormatNotice`).replace(`{count}`,String(e.unreadableFormatSessions))})]}),(0,m.jsx)(`button`,{type:`button`,className:L.noticeDismiss,"data-testid":`billing-unreadable-dismiss`,"aria-label":n(`close`),onClick:()=>{Ke(`unreadable`)},children:`×`})]}),(0,m.jsxs)(`div`,{className:L.kpiZone,children:[(0,m.jsxs)(`div`,{className:L.kpiZoneHead,children:[(0,m.jsx)(`span`,{className:L.kpiZoneLabel,children:n(`kpiRange`)}),(0,m.jsx)(`div`,{className:L.heatmapRangeSwitch,"data-testid":`billing-kpi-range`,role:`group`,"aria-label":n(`kpiRange`),children:[[`today`,`avgRangeToday`],[`7d`,`avgRange7d`],[`week`,`avgRangeWeek`],[`month`,`avgRangeMonth`],[`all`,`avgRangeAll`],[`custom`,`avgRangeCustom`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,className:y(L.heatmapRangeButton,B===e&&L.heatmapRangeButtonActive),"data-testid":`billing-kpi-range-${e}`,"aria-pressed":B===e,onClick:()=>{ft(e),se(e)},children:n(t)},e))})]}),B===`custom`&&(0,m.jsxs)(`div`,{className:L.kpiCustomRange,"data-testid":`billing-kpi-custom-range`,children:[(0,m.jsxs)(`label`,{children:[n(`customRangeStart`),(0,m.jsx)(`input`,{type:`date`,value:V.start,max:G(),"data-testid":`billing-kpi-custom-start`,onChange:e=>{mt({start:e.target.value})}})]}),(0,m.jsxs)(`label`,{children:[n(`customRangeEnd`),(0,m.jsx)(`input`,{type:`date`,value:V.end,max:G(),"data-testid":`billing-kpi-custom-end`,onChange:e=>{mt({end:e.target.value})}})]})]}),(0,m.jsx)(`section`,{className:L.kpiGrid,"data-testid":`billing-kpi-grid`,children:(()=>{let e=Object.keys(N).sort().slice(-7),t=G(),r=e.indexOf(t),i=(e,t)=>e[t]??0,a=e.map(e=>N[e]?.cost??0),o=e.map(e=>N[e]?.calls??0),s=e.map(e=>{let t=N[e];return t===void 0?0:$r(t)}),c=e.map(e=>{let t=N[e];return t!==void 0&&t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0}),l=r>0&&i(a,r-1)>0?(i(a,r)-i(a,r-1))/i(a,r-1)*100:0,u=r>0&&i(o,r-1)>0?(i(o,r)-i(o,r-1))/i(o,r-1)*100:0,d=r>0&&i(s,r-1)>0?(i(s,r)-i(s,r-1))/i(s,r-1)*100:0,f=r>0&&i(c,r-1)>0?i(c,r)-i(c,r-1):0,h=(e,t)=>B===`custom`?null:(0,m.jsx)(`svg`,{viewBox:`0 0 28 12`,preserveAspectRatio:`none`,style:{display:`block`,width:`100%`,height:`12px`},children:e.map((n,r)=>{let i=n/Math.max(...e,1)*10,a=r*4;return(0,m.jsx)(`rect`,{x:a,y:12-i,width:`2.5`,height:i,fill:t,opacity:r===e.length-1?1:.6},r)})}),g=e=>B===`custom`?null:(0,m.jsxs)(`span`,{className:y(L.kpiDelta,e>0?L.kpiDeltaUp:e<0?L.kpiDeltaDown:L.kpiDeltaFlat),children:[e>0?`▲`:e<0?`▼`:``,` `,Math.abs(e).toFixed(1),`%`]});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:L.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,m.jsxs)(`div`,{className:L.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescCacheHit`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`cacheHitRate`)})}),g(f)]}),(0,m.jsx)(`span`,{className:y(L.kpiValue,L.kpiGreen),children:yn(X.cacheHit+X.cacheMiss>0?X.cacheHit/(X.cacheHit+X.cacheMiss)*100:0)}),(0,m.jsx)(`div`,{className:L.kpiSpark,children:h(c,`var(--ds-cyan)`)}),(0,m.jsxs)(`span`,{className:L.kpiDetail,children:[K(X.cacheHit),` / `,K(X.cacheHit+X.cacheMiss),X.cacheWrite>0?` · ${n(`tokenCacheWrite`)} ${K(X.cacheWrite)}`:``]})]}),(0,m.jsxs)(`div`,{className:L.kpiTile,children:[(0,m.jsxs)(`div`,{className:L.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescTokens`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`tokens`)})}),g(d)]}),(0,m.jsx)(`span`,{className:L.kpiValue,children:K(X.input+X.output)}),(0,m.jsx)(`div`,{className:L.kpiSpark,children:h(s,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:L.kpiDetail,children:[n(`inputTokens`),` `,K(X.input),` · `,n(`outputTokens`),` `,K(X.output)]})]}),(0,m.jsxs)(`div`,{className:L.kpiTile,"data-testid":`billing-kpi-avg`,children:[(0,m.jsxs)(`div`,{className:L.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescAvgCost`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`avgCost`)})}),g(l)]}),(0,m.jsx)(`span`,{className:L.kpiValue,children:U(X.calls>0?X.cost/X.calls:0)}),(0,m.jsx)(`div`,{className:L.kpiSpark,children:h(a,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:L.kpiDetail,children:[n(`calls`),` `,X.calls.toLocaleString()]})]}),(0,m.jsxs)(`div`,{className:L.kpiTile,children:[(0,m.jsxs)(`div`,{className:L.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:n(`kpiDescCalls`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`calls`)})}),g(u)]}),(0,m.jsx)(`span`,{className:L.kpiValue,children:X.calls.toLocaleString()}),(0,m.jsx)(`div`,{className:L.kpiSpark,children:h(o,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:L.kpiDetail,children:[Wn.length,` `,n(`models`)]})]}),(0,m.jsxs)(`div`,{className:L.kpiTile,"data-testid":`billing-kpi-think`,children:[(0,m.jsx)(`div`,{className:L.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:n(`kpiDescReasoning`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`tokenReasoningShare`)})})}),(0,m.jsx)(`span`,{className:y(L.kpiValue,L.kpiGreen),children:yn(X.output>0?X.reasoning/X.output*100:0)}),(0,m.jsx)(`span`,{className:L.kpiDetail,children:K(X.reasoning)})]}),(0,m.jsxs)(`div`,{className:L.kpiTile,"data-testid":`billing-kpi-io`,children:[(0,m.jsx)(`div`,{className:L.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:n(`kpiDescIo`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`tokenIo`)})})}),(0,m.jsx)(`span`,{className:L.kpiValue,children:(X.output>0?X.input/X.output:0).toFixed(2)}),(0,m.jsxs)(`span`,{className:L.kpiDetail,children:[K(X.input),` / `,K(X.output)]})]}),(0,m.jsxs)(`div`,{className:L.kpiTile,"data-testid":`billing-kpi-peak`,children:[(0,m.jsx)(`div`,{className:L.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:n(`kpiDescPeak`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.kpiLabel,children:n(`tokenPeak`)})})}),(0,m.jsx)(`span`,{className:L.kpiValue,children:X.peakTokens>0?kn(X.peakTokens):`—`}),(0,m.jsx)(`span`,{className:L.kpiDetail,children:X.peakDay??`—`})]})]})})()})]}),(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-panel-heatmap`,children:[(0,m.jsxs)(`div`,{className:L.panelHead,children:[(0,m.jsx)(`h3`,{className:L.panelTitle,children:n(`heatmap`)}),(0,m.jsx)(`div`,{className:L.heatmapRangeSwitch,"data-testid":`billing-heatmap-metric`,role:`group`,"aria-label":n(`heatmap`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.heatmapRangeButton,$e===e&&L.heatmapRangeButtonActive),"data-testid":`billing-heatmap-metric-${e}`,"aria-pressed":$e===e,onClick:()=>{et(e)},children:n(e===`cost`?`metricCost`:`metricTokens`)},e))}),(0,m.jsx)(`div`,{className:L.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":n(`heatmap`),children:[`month`,`half`,`year`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.heatmapRangeButton,qe===e&&L.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":qe===e,onClick:()=>{Ye(e)},children:n(e===`month`?`heatmapMonth`:e===`half`?`heatmapHalf`:`heatmapYear`)},e))}),(0,m.jsxs)(`span`,{className:L.panelHint,"data-testid":`billing-heatmap-summary`,children:[n(`heatmapTotal`),` `,$e===`tokens`?K(Bn):U(Bn),` · `,n(`activeDays`),` `,Vn,` · `,n(`streakDays`),` `,Hn]})]}),(0,m.jsx)(ir,{days:Y,currency:h,t:n,range:qe,unit:$e})]})]}),P===`agents`&&(0,m.jsxs)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-agents`,children:[(0,m.jsxs)(`section`,{className:L.agentSummary,"data-testid":`billing-agent-summary`,children:[(0,m.jsxs)(`span`,{className:L.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:L.agentSummaryValue,children:String(Ce.agents)}),(0,m.jsx)(`span`,{className:L.agentSummaryLabel,children:n(`agentsCount`)})]}),(0,m.jsxs)(`span`,{className:L.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:L.agentSummaryValue,children:String(Ce.delegations)}),(0,m.jsx)(`span`,{className:L.agentSummaryLabel,children:n(`agentsDelegations`)})]}),(0,m.jsxs)(`span`,{className:L.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:L.agentSummaryValue,children:String(Ce.roots)}),(0,m.jsx)(`span`,{className:L.agentSummaryLabel,children:n(`agentsRoots`)})]}),Ce.costliest!==void 0&&Ce.costliest.chainCost>0&&(0,m.jsxs)(`span`,{className:L.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:L.agentSummaryValue,children:U(Ce.costliest.chainCost)}),(0,m.jsx)(`span`,{className:L.agentSummaryLabel,children:n(`agentsMostExpensive`)})]})]}),Se.length===0||Ce.delegations===0?(0,m.jsx)(`p`,{className:L.contextEmpty,"data-testid":`billing-agents-empty`,children:n(`agentsNoData`)}):(0,m.jsx)(`div`,{className:L.agentTree,"data-testid":`billing-agent-tree`,children:(()=>{let e=t=>(0,m.jsxs)(`div`,{className:L.agentNode,children:[(0,m.jsxs)(`div`,{className:L.agentRow,style:{paddingLeft:`${String(t.depth*16)}px`},children:[(0,m.jsx)(`span`,{className:L.agentKind,children:t.depth===0?n(`agentsRoot`):n(`agentsSubagent`)}),(0,m.jsx)(`span`,{className:L.agentTitle,children:t.title??`${n(`sessionUntitled`)} · ${t.id.slice(0,8)}`}),(0,m.jsx)(`span`,{className:L.agentCalls,children:t.calls.toLocaleString()}),(0,m.jsx)(`span`,{className:L.agentCost,children:U(t.cost)}),t.children.length>0&&(0,m.jsxs)(`span`,{className:y(L.ubTag,L.ubTagNeutral),"data-testid":`billing-agent-chain`,children:[n(`agentsChainTotal`),` `,U(t.chainCost)]})]}),t.children.map(e)]},t.id);return Se.map(e)})()})]}),P===`settings`&&(0,m.jsx)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-settings`,children:(0,m.jsxs)(`div`,{className:y(L.settingsLayout,i&&L.nativeSettingsLayout),children:[!i&&(0,m.jsx)(`aside`,{className:L.settingsNav,"data-testid":`billing-settings-nav`,role:`navigation`,"aria-label":`settings`,children:[{id:`display-pref`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:[(0,m.jsx)(`path`,{d:`M5 3v10M11 3v10`}),(0,m.jsx)(`circle`,{cx:`5`,cy:`6.5`,r:`1.8`}),(0,m.jsx)(`circle`,{cx:`11`,cy:`9.5`,r:`1.8`})]}),label:n(`settingsNavDisplayPref`)},{id:`budget`,icon:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,m.jsx)(`path`,{d:`M5 3l3 4 3-4M8 7v6M5.5 9.5h5M5.5 12h5`})}),label:n(`settingsNavBudget`)},{id:`alert`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,m.jsx)(`path`,{d:`M8 2a4 4 0 0 1 4 4v3l1.5 2.5h-11L4 9V6a4 4 0 0 1 4-4z`}),(0,m.jsx)(`path`,{d:`M6.5 13.5a1.5 1.5 0 0 0 3 0`})]}),label:n(`settingsNavAlert`)},{id:`display`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`}),(0,m.jsx)(`path`,{d:`M8 2a6 6 0 0 1 0 12z`,fill:`currentColor`,stroke:`none`})]}),label:n(`settingsNavDisplay`)},{id:`advanced`,icon:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,m.jsx)(`path`,{d:`M8 2v12M2.8 5l10.4 6M13.2 5L2.8 11`})}),label:n(`settingsNavAdvanced`),advanced:!0},{id:`about`,icon:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`}),(0,m.jsx)(`path`,{d:`M8 7.5V11`}),(0,m.jsx)(`circle`,{cx:`8`,cy:`5.2`,r:`0.9`,fill:`currentColor`,stroke:`none`})]}),label:n(`settingsNavAbout`)}].map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(L.settingsNavItem,at===e.id&&L.settingsNavItemActive,e.advanced&&L.settingsNavItemAdvanced),"data-testid":`billing-settings-nav-${e.id}`,onClick:()=>{ct(e.id)},children:[(0,m.jsx)(`span`,{className:L.settingsNavIcon,"aria-hidden":`true`,children:e.icon}),e.label]},e.id))}),(0,m.jsxs)(`div`,{className:L.settingsPane,children:[(0,m.jsx)(`input`,{className:y(L.ubSearch,L.settingsSearch),type:`search`,value:st,placeholder:n(`settingsSearchPlaceholder`),"aria-label":n(`settingsSearchPlaceholder`),"data-testid":`billing-settings-search`,onChange:e=>{R(e.target.value)}}),st.trim()!==``&&ja(st)&&(0,m.jsx)(`p`,{className:L.setCardDesc,"data-testid":`billing-settings-search-empty`,children:n(`settingsSearchEmpty`).replace(`{query}`,st.trim())}),(0,m.jsxs)(`div`,{hidden:z(Aa.display),className:L.setCard,id:`settings-display-pref`,"data-testid":`billing-density-motion-card`,children:[(0,m.jsx)(`div`,{className:L.setCardHead,children:(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsx)(`h3`,{className:L.setCardTitle,children:n(`settingsSectionDisplay`)})})}),(0,m.jsxs)(`div`,{className:L.densityRow,children:[(0,m.jsxs)(`div`,{className:L.densityLeft,children:[(0,m.jsx)(`strong`,{children:n(`densityLabel`)}),(0,m.jsx)(`span`,{children:n(`densityHint`)})]}),(0,m.jsx)(`div`,{className:L.densityButtons,"data-testid":`billing-density-buttons`,children:[`compact`,`default`,`comfortable`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.densityButton,tt===e&&L.densityButtonActive,e===`comfortable`&&L.densityButtonComfortable),"data-testid":`billing-density-${e}`,onClick:()=>{ut(e)},children:n(e===`compact`?`densityCompact`:e==="default"?`densityDefault`:`densityComfortable`)},e))})]}),(0,m.jsxs)(`div`,{className:L.densityRow,children:[(0,m.jsxs)(`div`,{className:L.densityLeft,children:[(0,m.jsx)(`strong`,{children:n(`motionLabel`)}),(0,m.jsx)(`span`,{children:n(`motionHint`)})]}),(0,m.jsx)(`div`,{className:L.densityButtons,"data-testid":`billing-motion-buttons`,children:[`off`,`subtle`,`rich`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.densityButton,rt===e&&L.densityButtonActive),"data-testid":`billing-motion-${e}`,onClick:()=>{dt(e)},children:n(e===`off`?`motionOff`:e===`subtle`?`motionSubtle`:`motionRich`)},e))})]})]}),(0,m.jsxs)(`section`,{hidden:z(Aa.budget),className:L.setCard,"data-testid":`billing-budget`,id:`settings-budget`,children:[(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`budget`),(0,m.jsx)(ba,{label:n(`budgetHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":S,"aria-label":n(`budget`),"data-testid":`billing-budget-toggle`,className:y(L.switch,S&&L.switchOn),onClick:w,children:(0,m.jsx)(`span`,{className:L.switchKnob})})]}),S&&(0,m.jsxs)(`div`,{className:L.ctlCol,children:[(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`budgetAmount`)}),(0,m.jsxs)(`span`,{className:L.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,m.jsx)(`span`,{className:L.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:L.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:C===0?``:C,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${n(`budget`)}(${h===`usd`?`USD`:h===`eur`?`EUR`:`CNY`})`,title:`${n(`budget`)}(${h===`usd`?`USD`:h===`eur`?`EUR`:`CNY`})`,onChange:e=>{T(e.target.valueAsNumber)}})]})]}),C>0&&(()=>{let e=Nn/C*100;return(0,m.jsx)(`div`,{className:L.ctlRowStretch,children:(0,m.jsx)(`div`,{className:L.prog,role:`progressbar`,"aria-valuenow":Math.min(e,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":n(`budget`),"data-testid":`billing-budget-track`,children:(0,m.jsx)(`div`,{className:y(L.progFill,e>=100&&L.budgetFillOver,e>=80&&e<100&&L.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),C>0&&(0,m.jsx)(`p`,{className:L.setCardDesc,"data-testid":`billing-budget-value`,children:n(`budgetSummary`).replace(`{used}`,U(Nn)).replace(`{total}`,U(C))})]}),(0,m.jsxs)(`div`,{className:L.ctlCol,"data-testid":`billing-model-budgets`,children:[(0,m.jsxs)(`span`,{className:L.modelBudgetTitle,children:[n(`modelBudgetTitle`),(0,m.jsx)(ba,{label:n(`modelBudgetHint`),t:n})]}),Mt.length===0&&(0,m.jsx)(`p`,{className:L.modelBudgetHint,children:n(`emptyHint`)}),(0,m.jsx)(`div`,{className:L.modelBudgetList,children:Mt.map(e=>(0,m.jsxs)(`div`,{className:L.modelBudgetRow,children:[(0,m.jsx)(`span`,{className:L.modelBudgetName,title:e.name??e.key,children:e.name??e.key}),(0,m.jsx)(`span`,{className:L.modelBudgetCost,"data-testid":`billing-model-budget-cost-${e.key}`,children:U(e.cost)}),(0,m.jsxs)(`span`,{className:L.inp,children:[(0,m.jsx)(`span`,{className:L.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:L.budgetInput,type:`number`,min:0,step:1,value:E[e.key]??``,placeholder:n(`modelBudgetPlaceholder`),"aria-label":`${n(`modelBudgetTitle`)} · ${e.name??e.key}`,"data-testid":`billing-model-budget-${e.key}`,onChange:t=>{te(e.key,t.target.valueAsNumber)}})]})]},e.key))})]})]}),(0,m.jsxs)(`section`,{hidden:z(Aa.alert),className:L.setCard,"data-testid":`billing-peak-alert-settings`,id:`settings-alert`,children:[(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`peakAlert`),(0,m.jsx)(ba,{label:n(`peakAlertHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":D.enabled,"aria-label":n(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:y(L.switch,D.enabled&&L.switchOn),onClick:()=>{O({...D,enabled:!D.enabled})},children:(0,m.jsx)(`span`,{className:L.switchKnob})})]}),D.enabled&&(0,m.jsxs)(`div`,{className:L.ctlCol,children:[(0,m.jsxs)(`label`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`peakAlertLeadMin`)}),(0,m.jsx)(`span`,{className:L.inp,children:(0,m.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:D.leadMin,className:L.budgetInput,"aria-label":n(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);O({...D,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):D.leadMin})}})})]}),(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`peakAlertPos`)}),(0,m.jsx)(`div`,{className:L.ctlGroup,role:`radiogroup`,"aria-label":n(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,m.jsxs)(`label`,{className:L.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:D.position===e,onChange:()=>O({...D,position:e})}),(0,m.jsx)(`span`,{className:L.rdoDot,"aria-hidden":`true`}),n(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`peakAlertMode`)}),(0,m.jsx)(`div`,{className:L.ctlGroup,role:`radiogroup`,"aria-label":n(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,m.jsxs)(`label`,{className:L.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:D.mode===e,onChange:()=>O({...D,mode:e})}),(0,m.jsx)(`span`,{className:L.rdoDot,"aria-hidden":`true`}),n(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,m.jsxs)(`label`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`peakAlertWebNotify`)}),(0,m.jsx)(`input`,{type:`checkbox`,checked:D.webNotify,"aria-label":n(`peakAlertWebNotify`),onChange:e=>{O({...D,webNotify:e.target.checked})}})]}),(0,m.jsx)(`div`,{className:L.ctlRow,children:(0,m.jsx)(`button`,{type:`button`,className:L.btn,onClick:ne,children:n(`peakAlertPreview`)})})]})]}),(0,m.jsx)(`section`,{hidden:z(Aa.toggles),className:L.setCard,"data-testid":`billing-toggle-setting`,id:`settings-display`,children:(0,m.jsxs)(`div`,{className:L.setGrid3,children:[(0,m.jsx)(`div`,{className:L.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`usageStatsTool`),(0,m.jsx)(ba,{label:n(`usageStatsToolHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Vt,"aria-label":n(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:y(L.switch,Vt&&L.switchOn),onClick:Ut,children:(0,m.jsx)(`span`,{className:L.switchKnob})})]})}),(0,m.jsxs)(`div`,{className:L.setCell,"data-testid":`billing-livecost-setting`,children:[(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`liveCostBar`),(0,m.jsx)(ba,{label:n(`liveCostBarHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":me.show,"aria-label":n(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:y(L.switch,me.show&&L.switchOn),onClick:()=>he({...me,show:!me.show}),children:(0,m.jsx)(`span`,{className:L.switchKnob})})]}),me.show&&(0,m.jsxs)(`div`,{className:L.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,m.jsx)(`span`,{className:L.rdoLabel,children:n(`liveCostBarPosition`)}),(0,m.jsx)(Na,{liveCostPrefs:me,onLiveCostPrefs:he,t:n})]})]}),(0,m.jsx)(`div`,{className:L.setCell,"data-testid":`billing-site-list-setting`,children:(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`siteListDisplay`),(0,m.jsx)(ba,{label:n(`siteListDisplayHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":ae.hideUnidentified,"aria-label":n(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:y(L.switch,ae.hideUnidentified&&L.switchOn),onClick:()=>ce({hideUnidentified:!ae.hideUnidentified}),children:(0,m.jsx)(`span`,{className:L.switchKnob})})]})}),(0,m.jsx)(Da,{prefs:le,onPrefs:fe,groups:pe,t:n,money:U}),(0,m.jsx)(`div`,{className:L.setCell,"data-testid":`billing-quick-queue-entry-setting`,children:(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`quickQueueEntry`),(0,m.jsx)(ba,{label:n(`quickQueueEntryHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":M.showEntry,"aria-label":n(`quickQueueEntry`),"data-testid":`billing-quick-queue-entry-toggle`,className:y(L.switch,M.showEntry&&L.switchOn),onClick:()=>ge({...M,showEntry:!M.showEntry}),children:(0,m.jsx)(`span`,{className:L.switchKnob})})]})}),(0,m.jsx)(`div`,{className:L.setCell,"data-testid":`billing-quick-queue-reuse-setting`,children:(0,m.jsxs)(`div`,{className:L.setCardHead,children:[(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`quickQueueReuseEntry`),(0,m.jsx)(ba,{label:n(`quickQueueReuseEntryHint`),t:n})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":M.reuseSourceSession,"aria-label":n(`quickQueueReuseEntry`),"data-testid":`billing-quick-queue-reuse-toggle`,className:y(L.switch,M.reuseSourceSession&&L.switchOn),onClick:()=>ge({...M,reuseSourceSession:!M.reuseSourceSession}),children:(0,m.jsx)(`span`,{className:L.switchKnob})})]})})]})}),(0,m.jsx)(`section`,{hidden:z(Aa.displayExtra),className:L.setCard,"data-testid":`billing-display-setting`,id:`settings-display-extra`,children:(0,m.jsxs)(`div`,{className:L.setGrid2,children:[(0,m.jsxs)(`div`,{className:L.setCell,"data-testid":`billing-float-setting`,children:[(0,m.jsx)(`div`,{className:L.setCardHead,children:(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`floatWindow`),(0,m.jsx)(ba,{label:n(`floatWindowHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:L.ctlCol,children:[(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`cardMode`)}),(0,m.jsx)(`div`,{className:L.ctlGroup,"data-testid":`billing-card-mode`,children:[[`full`,`cardModeFull`],[`compact`,`cardModeCompact`],[`hidden`,`cardModeHidden`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,j.mode===e&&L.floatModeBtnOn),"data-testid":`billing-card-mode-${e}`,"aria-pressed":j.mode===e,disabled:e===`hidden`&&!ie,title:e===`hidden`&&!ie?n(`cardModeFallback`):void 0,onClick:()=>re({...j,mode:e}),children:n(t)},e))})]}),!ie&&(0,m.jsx)(`p`,{className:L.setCardDesc,"data-testid":`billing-card-mode-fallback`,children:n(`cardModeFallback`)}),ie&&j.mode===`hidden`&&(0,m.jsx)(`p`,{className:L.setCardDesc,"data-testid":`billing-card-mode-hidden-hint`,children:n(`cardModeHiddenHint`)}),(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`floatMode`)}),(0,m.jsxs)(`div`,{className:L.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,k.mode===`combined`&&L.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>A({mode:`combined`,targets:k.targets}),children:n(`floatModeCombined`)}),(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,k.mode===`subscription`&&L.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>A({mode:`subscription`,targets:k.targets}),children:n(`floatModeSubscription`)})]})]}),k.mode===`subscription`&&(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`floatTargets`)}),(0,m.jsxs)(`span`,{className:L.ctlGroup,"data-testid":`billing-float-targets`,children:[ht.map(e=>{let t=k.targets.includes(e.id);return(0,m.jsxs)(`label`,{className:L.floatTarget,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>A({mode:`subscription`,targets:t?k.targets.filter(t=>t!==e.id):[...k.targets,e.id]})}),(0,m.jsx)(`span`,{className:L.floatTargetLabel,children:e.label})]},e.id)}),ht.length===0&&(0,m.jsx)(`span`,{className:L.setCardDesc,children:n(`floatNoTargetsHint`)})]})]})]})]}),(0,m.jsxs)(`div`,{className:L.setCell,"data-testid":`billing-card-setting`,children:[(0,m.jsx)(`div`,{className:L.setCardHead,children:(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsxs)(`h3`,{className:L.setCardTitle,children:[n(`cardDisplay`),(0,m.jsx)(ba,{label:n(`cardDisplayHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:L.ctlCol,children:[(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`cardMetric`)}),(0,m.jsxs)(`div`,{className:L.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,j.metric===`money`&&L.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>re({...j,metric:`money`}),children:n(`cardMetricMoney`)}),(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,j.metric===`tokens`&&L.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>re({...j,metric:`tokens`}),children:n(`cardMetricTokens`)})]})]}),(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`cardSpan`)}),(0,m.jsx)(`div`,{className:L.ctlGroup,"data-testid":`billing-card-span`,children:[[`day`,`cardSpanDay`],[`week`,`cardSpanWeek`],[`month`,`cardSpanMonth`]].map(([e,t])=>(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,j.span===e&&L.floatModeBtnOn),"data-testid":`billing-card-span-${e}`,"aria-pressed":j.span===e,onClick:()=>re({...j,span:e}),children:n(t)},e))})]}),(0,m.jsxs)(`div`,{className:L.ctlRow,children:[(0,m.jsx)(`span`,{className:L.ctlLabel,children:n(`cardDeltaBadge`)}),(0,m.jsxs)(`div`,{className:L.ctlGroup,"data-testid":`billing-card-delta`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,j.showDelta&&L.floatModeBtnOn),"data-testid":`billing-card-delta-show`,"aria-pressed":j.showDelta,onClick:()=>re({...j,showDelta:!0}),children:n(`cardDeltaShow`)}),(0,m.jsx)(`button`,{type:`button`,className:y(L.floatModeBtn,!j.showDelta&&L.floatModeBtnOn),"data-testid":`billing-card-delta-hide`,"aria-pressed":!j.showDelta,onClick:()=>re({...j,showDelta:!1}),children:n(`cardDeltaHide`)})]})]})]})]})]})}),(0,m.jsx)(`div`,{hidden:z(Aa.advanced),id:`settings-advanced`,children:(0,m.jsx)(Ta,{userPrices:a,onUserPrices:o,t:n,unpricedIds:e.unpricedModels??[]})}),(0,m.jsx)(`div`,{hidden:z(Aa.about),id:`settings-about`,children:(0,m.jsx)(Jn,{t:n,version:e.pluginVersion})}),(0,m.jsxs)(`section`,{hidden:z(Aa.about),className:L.setCard,"data-testid":`billing-more-works`,children:[(0,m.jsx)(`div`,{className:L.setCardHead,children:(0,m.jsx)(`div`,{className:L.setCardMeta,children:(0,m.jsx)(`h3`,{className:L.setCardTitle,children:n(`moreWorksTitle`)})})}),(0,m.jsxs)(`div`,{className:L.moreWorkList,children:[(0,m.jsxs)(`a`,{className:L.moreWorkRow,href:`https://github.com/kenz1117/dsh-engram`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-engram`,children:[(0,m.jsx)(`span`,{className:L.moreWorkName,children:n(`adEngramName`)}),(0,m.jsx)(`span`,{className:L.moreWorkDesc,children:n(`adEngramDesc`)})]}),(0,m.jsxs)(`a`,{className:L.moreWorkRow,href:`https://github.com/kenz1117/dsh-ui-rainbowspeak`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-rainbowspeak`,children:[(0,m.jsx)(`span`,{className:L.moreWorkName,children:n(`adRainbowName`)}),(0,m.jsx)(`span`,{className:L.moreWorkDesc,children:n(`adRainbowDesc`)})]})]})]})]})]})}),P===`trends`&&(0,m.jsxs)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,m.jsxs)(`section`,{className:L.ubCard,"data-testid":`billing-panel-trend`,children:[(0,m.jsxs)(`div`,{className:L.ubCardHead,children:[(0,m.jsx)(`h3`,{className:L.ubCardTitle,children:n(`trend`)}),x(`billing.dashboard.decor`,{position:`trend`}),(0,m.jsxs)(`span`,{className:L.ubCardControlGroup,children:[(0,m.jsx)(`span`,{className:L.rangeToggle,role:`group`,"aria-label":n(`trend`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.rangeButton,Le===e&&L.rangeButtonActive),"aria-pressed":Le===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{Re(e)},children:n(e===7?`trend7d`:`trend30d`)},e))}),(0,m.jsx)(`span`,{className:L.rangeToggle,role:`group`,"aria-label":n(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(L.rangeButton,De===e&&L.rangeButtonActive),"aria-pressed":De===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{Oe(e)},children:n(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,m.jsx)(`span`,{className:L.ubCardSub,children:Rn})]}),(0,m.jsx)(zn,{data:Un,models:cr,currency:h,metric:De,t:n})]}),b.length>0&&(0,m.jsxs)(`section`,{className:L.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,m.jsxs)(`div`,{className:L.ubCardHead,children:[(0,m.jsx)(`h3`,{className:L.ubCardTitle,children:n(`rounds`)}),ln.length>0&&(0,m.jsxs)(`span`,{className:L.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[ln.length,` `,n(`anomaly`)]})]}),(0,m.jsx)(`p`,{className:L.ubCardSub,children:n(`roundsHint`).replace(`{count}`,String(b.length))}),(0,m.jsx)(Qn,{rounds:b,flags:ln,currency:h,t:n})]}),e.byTier!==void 0&&(()=>{let e=dn.peak+dn.offPeak;if(e<=0)return null;let t=dn.peak/e*100;return(0,m.jsxs)(`section`,{className:L.ubCard,"data-testid":`billing-panel-share`,children:[(0,m.jsxs)(`div`,{className:L.ubCardHead,children:[(0,m.jsx)(`h3`,{className:L.ubCardTitle,children:n(`peakShare`)}),(0,m.jsx)(`span`,{className:L.ubCardSub,children:n(`peakSharePerCall`)})]}),(0,m.jsxs)(`div`,{className:L.shareTrack,"data-testid":`billing-share-track`,children:[(0,m.jsx)(`div`,{className:y(L.shareSeg,L.shareSegPeak),style:{width:`${t}%`}}),(0,m.jsx)(`div`,{className:y(L.shareSeg,L.shareSegOff),style:{width:`${100-t}%`}})]}),(0,m.jsxs)(`div`,{className:L.shareLegend,children:[(0,m.jsxs)(`span`,{className:L.shareItem,children:[(0,m.jsx)(`span`,{className:L.shareDot,style:{background:`var(--ds-blue)`}}),n(`peak`),(0,m.jsxs)(`span`,{className:L.shareValue,"data-testid":`billing-share-peak`,children:[U(dn.peak),` · `,t.toFixed(1),`%`]})]}),(0,m.jsxs)(`span`,{className:L.shareItem,children:[(0,m.jsx)(`span`,{className:L.shareDot,style:{background:`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`}}),n(`offPeak`),(0,m.jsxs)(`span`,{className:L.shareValue,"data-testid":`billing-share-offpeak`,children:[U(dn.offPeak),` · `,(100-t).toFixed(1),`%`]})]})]}),pn>0&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-share-savings`,children:n(`offPeakSavings`).replace(`{amount}`,U(pn))})]})})()]}),P===`providers`&&(0,m.jsxs)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[Kn.length>0&&(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,m.jsx)(`div`,{className:L.panelHead,children:(0,m.jsx)(`h3`,{className:L.panelTitle,children:n(`panelRelayQuota`)})}),(0,m.jsx)(`div`,{className:L.providerGroupList,"data-testid":`billing-relay-quotas`,children:Kn.map(e=>(0,m.jsxs)(`div`,{className:L.siteRow,"data-testid":`billing-relay-quota`,children:[(0,m.jsxs)(`span`,{className:L.siteRowName,children:[(0,m.jsx)(`span`,{className:y(L.siteKindTag,qi[e.kind]),children:Ki(e.kind,n)}),(0,m.jsx)(`span`,{className:L.siteRowTitle,children:e.origin})]}),(0,m.jsxs)(`span`,{className:L.siteRowMeta,children:[e.balance!==void 0&&(0,m.jsxs)(`span`,{className:L.siteRowCost,children:[n(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let t=e.remainingPercent<20;return(0,m.jsxs)(`span`,{className:y(L.siteRowCalls,t&&L.siteRowCallsLow),children:[n(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,m.jsx)(`span`,{className:L.siteRowCalls,children:n(`relayNoQuota`)})]})]},e.route))})]}),(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-panel-providers`,children:[(0,m.jsxs)(`div`,{className:L.panelHead,children:[(0,m.jsx)(`h3`,{className:L.panelTitle,children:n(`providerBilling`)}),x(`billing.dashboard.decor`,{position:`models`}),(0,m.jsx)(`span`,{className:L.panelHint,children:e.updatedAt===void 0?``:`${n(`lastUpdated`)} ${Xi(e.updatedAt)}`})]}),_e&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-subscriptions-stale`,children:n(`subscriptionsStale`)}),(0,m.jsxs)(`div`,{className:L.providerCtlRow,"data-testid":`billing-provider-controls`,children:[(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,disabled:Xn.length===0,onClick:$n,children:n(Zn?`collapseAll`:`expandAll`)}),(0,m.jsxs)(`span`,{className:L.providerTodayToggle,children:[(0,m.jsx)(`span`,{children:n(`todayOnly`)}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":It,"data-testid":`billing-provider-today-toggle`,className:y(L.switch,It&&L.switchOn),onClick:Rt,children:(0,m.jsx)(`span`,{className:L.switchKnob})})]})]}),Yn.length===0?(0,m.jsxs)(`div`,{className:L.emptyState,"data-testid":`billing-provider-empty`,children:[(0,m.jsxs)(`span`,{className:L.emptyIll,"aria-hidden":`true`,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 96 64`,fill:`none`,children:[(0,m.jsx)(`line`,{x1:`6`,y1:`58`,x2:`90`,y2:`58`,stroke:`var(--ds-border-strong)`,strokeWidth:`1`}),(0,m.jsx)(`line`,{x1:`6`,y1:`6`,x2:`6`,y2:`58`,stroke:`var(--ds-border-strong)`,strokeWidth:`1`}),(0,m.jsx)(`path`,{d:`M14 50 L28 40 L42 44 L56 26 L70 30 L82 14`,stroke:`var(--ds-border-strong)`,strokeWidth:`1.5`,strokeLinecap:`round`,fill:`none`,strokeDasharray:`3 3`})]}),(0,m.jsx)(`span`,{className:L.emptyIllDot})]}),(0,m.jsx)(`span`,{className:L.emptyTitle,children:n(It?`todayNoConsumption`:`noData`)}),(0,m.jsx)(`span`,{className:L.emptyDesc,children:n(`emptyHint`)})]}):(0,m.jsx)(`div`,{className:L.providerGroupList,"data-testid":`billing-provider-groups`,children:Yn.map(e=>{let t=e.models.length>0||e.subscriptions.length>0,r=t&&Nt.has(e.id);return(0,m.jsxs)(`div`,{className:L.providerGroup,"data-testid":`billing-provider-group`,children:[(0,m.jsxs)(`div`,{className:y(L.providerGroupHead,t&&L.providerGroupCollapsible),"data-testid":`billing-provider-group-head`,"aria-expanded":t?r:void 0,role:t?`button`:void 0,tabIndex:t?0:void 0,onClick:t?()=>{Ft(e.id)}:void 0,onKeyDown:t?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Ft(e.id))}:void 0,children:[(0,m.jsxs)(`span`,{className:L.providerGroupTitle,children:[(0,m.jsx)(`span`,{className:y(L.healthDot,e.dot),role:`img`,"aria-label":xa(e.dot,n),title:xa(e.dot,n)}),(()=>{let t=Zt(e.name),r=e.channelKind===`direct`?Cr(t):void 0,i=e.channelKind===`direct`?n(`directTag`):e.channelKind===`site`?n(`relayTag`):e.channelKind===`unknown`?n(`unknownTag`):void 0;return(0,m.jsxs)(m.Fragment,{children:[i!==void 0&&(0,m.jsx)(`span`,{className:y(L.kindBadge,e.channelKind===`site`&&L.kindBadgeRelay,e.channelKind===`unknown`&&L.kindBadgeUnknown),"data-testid":`billing-kind-badge`,children:i}),e.channelKind!==`unknown`&&(0,m.jsx)(`span`,{className:L.providerGroupName,children:r??t})]})})(),e.subscriptions.length>0&&(0,m.jsxs)(`span`,{className:L.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` `,n(`planCountUnit`)]})]}),(0,m.jsxs)(`span`,{className:L.providerGroupMeta,children:[(0,m.jsxs)(`span`,{className:L.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,m.jsx)(`span`,{className:L.providerGroupCostLabel,children:n(`cost`)}),e.channelKind===`unknown`?(0,m.jsx)(`span`,{className:L.na,children:`—`}):(0,m.jsx)(`span`,{className:L.providerGroupCostValue,children:U(Ji(e))})]}),!xn(e)&&e.balance!==void 0?(0,m.jsxs)(`span`,{className:L.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,m.jsx)(`span`,{className:L.providerGroupBalanceLabel,children:n(`balance`)}),Sn(e.balance)]}):(0,m.jsx)(`span`,{className:L.providerGroupBalance,"aria-hidden":`true`}),Ti(e.name)===void 0?(0,m.jsx)(`span`,{className:L.providerGroupRecharge,"aria-hidden":`true`}):(0,m.jsx)(`a`,{className:L.providerGroupRecharge,"data-testid":`billing-group-recharge`,href:Ti(e.name),target:`_blank`,rel:`noreferrer`,title:n(`rechargeHint`),"aria-label":`${Zt(e.name)} ${n(`recharge`)}`,onClick:e=>{e.stopPropagation()},children:n(`recharge`)})]})]}),e.models.length>0&&(0,m.jsx)(`div`,{className:L.providerStatRow,"data-testid":`billing-provider-stat-row`,children:(()=>{let t=e.models.reduce((e,t)=>({calls:e.calls+t.calls,input:e.input+t.input,output:e.output+t.output}),{calls:0,input:0,output:0}),r=t.input>0?e.models.reduce((e,t)=>e+t.cacheHitRate,0)/e.models.length:0;return[{lbl:n(`calls`),val:t.calls.toLocaleString(),sub:``},{lbl:n(`inputTokens`),val:K(t.input),sub:r>0?`${n(`cacheHitRate`)} ${r.toFixed(0)}%`:``},{lbl:n(`outputTokens`),val:K(t.output),sub:``},{lbl:n(`cost`),val:U(Ji(e)),sub:e.models.length===1?``:`${e.models.length} ${n(`models`)}`}].map((e,t)=>(0,m.jsxs)(`div`,{className:L.providerStatCell,children:[(0,m.jsx)(`div`,{className:L.providerStatLbl,children:e.lbl}),(0,m.jsx)(`div`,{className:L.providerStatVal,children:e.val}),e.sub!==``&&(0,m.jsx)(`div`,{className:L.providerStatSub,children:e.sub})]},t))})()}),r&&(0,m.jsxs)(m.Fragment,{children:[e.channelKind===`unknown`&&(0,m.jsx)(`p`,{className:L.unknownHint,"data-testid":`billing-unknown-hint`,children:n(`unknownChannelHint`)}),e.models.length>0&&(0,m.jsx)(`div`,{className:L.tableScroll,"data-testid":`billing-table-scroll`,children:(0,m.jsxs)(`table`,{className:L.modelTable,children:[er,(0,m.jsx)(`tbody`,{children:e.models.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:tr(e)}),(0,m.jsx)(`td`,{className:L.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:L.numCol,children:K(e.input)}),(0,m.jsx)(`td`,{className:L.numCol,children:K(e.output)}),(0,m.jsx)(`td`,{className:L.numCol,children:yn(e.cacheHitRate)}),(0,m.jsx)(`td`,{className:L.numCol,children:e.plan?(0,m.jsxs)(`span`,{className:L.planTag,children:[e.estimated>0?(0,m.jsxs)(`span`,{children:[`≈`,U(e.estimated)]}):null,(0,m.jsx)(`span`,{className:L.planTagBadge,"data-testid":`billing-plan-badge`,children:n(`subscriptionTag`)})]}):e.actual===void 0?e.estimated>0?(0,m.jsxs)(`span`,{title:n(`cellEstimateHint`),children:[`≈`,U(e.estimated)]}):(0,m.jsx)(`span`,{className:L.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,m.jsxs)(`span`,{className:L.bucketCost,children:[(0,m.jsx)(`span`,{className:L.bucketOfficial,children:U(t)}),(0,m.jsx)(`span`,{className:L.bucketSep,children:`/`}),(0,m.jsx)(`span`,{className:L.bucketThird,children:U(n)})]}):U(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,m.jsx)(`div`,{className:L.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let t=Wi(e.status,n);return(0,m.jsxs)(`div`,{className:y(L.subscriptionCard,L.subscriptionCardUpgraded),"data-testid":`billing-subscription-card`,children:[(0,m.jsxs)(`div`,{className:L.subscriptionHead,children:[(0,m.jsx)(`span`,{className:L.subscriptionName,children:Zt(e.displayName)}),e.planType===`code`&&(()=>{let t=lt(e.provider),r=t===void 0?void 0:n(`subscriptionFeePerMonth`).replace(`{amount}`,t.currency===`USD`?`$${t.amount}`:`¥${t.amount}`);return(0,m.jsxs)(`span`,{className:L.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?n(`subscriptionFeePerMonth`).replace(`{amount}`,U(e.subscriptionAmount)):n(`planTypeCode`)),t?.label!==void 0&&(0,m.jsx)(`span`,{className:L.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:t.label}),t!==void 0&&(0,m.jsx)(`span`,{className:L.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:n(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,m.jsx)(`span`,{className:L.subscriptionPlan,"data-kind":`token`,children:n(`planTypeToken`)}),e.plan!==void 0&&(0,m.jsx)(`span`,{className:L.subscriptionPlan,children:e.plan})]}),t!==``&&(0,m.jsx)(`div`,{className:L.subscriptionStatus,children:t}),e.windows.length===0&&t===``&&(0,m.jsx)(`div`,{className:L.subscriptionStatus,children:n(`subscriptionNoApi`)}),e.windows.map(e=>(0,m.jsx)(ya,{window:e,t:n},e.kind))]},e.provider)})})]})]},e.id)})})]}),(0,m.jsxs)(`div`,{className:L.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":n(`export`),children:[(0,m.jsx)(`span`,{className:L.exportLabel,children:n(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-export-day`,onClick:()=>{On(Dn(`usage-daily`,`csv`,Object.keys(N)),Cn(N),`text/csv`)},children:n(`exportCsvDay`)}),e.bySession!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{On(Dn(`usage-sessions`,`csv`,Object.keys(N)),En(e.bySession??[]),`text/csv`)},children:n(`exportCsvSession`)}),e.bySite!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{On(Dn(`usage-sites`,`csv`,Object.keys(N)),wn(e.bySite??{}),`text/csv`)},children:n(`exportCsvSite`)}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-export-json`,onClick:()=>{On(Dn(`usage-stats`,`json`,Object.keys(N)),JSON.stringify(e,null,2),`application/json`)},children:n(`exportJson`)})]}),e.bySession!==void 0&&(0,m.jsxs)(`section`,{className:L.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,m.jsxs)(`div`,{className:L.ubCardHead,children:[(0,m.jsx)(`h3`,{className:L.ubCardTitle,children:n(`sessions`)}),(0,m.jsx)(`span`,{className:L.ubCardSub,children:e.bySession.length>20?n(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(At)):`${At}`}),e.bySession.length>0&&(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-sessions-view-all`,onClick:()=>{H(!0)},children:n(jt?`sessionsViewTop`:`sessionsViewAll`).replace(`{count}`,String(e.bySession.length))})]}),(e.staleLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-sessions-stale`,children:n(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,m.jsxs)(`div`,{className:L.ubTablewrap,"data-testid":`billing-sessions-table`,children:[we!==void 0&&(0,m.jsx)(`div`,{className:L.staleNotice,"data-testid":`billing-session-nav-notice`,role:`note`,children:we}),(0,m.jsxs)(`table`,{className:L.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`sessionTitle`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`calls`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`actual`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[wt.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:L.emptyRow,children:n(`noData`)})}),wt.slice(0,20).map(e=>{let t=e.children!==void 0||e.subs!==void 0,r=t&&vt.has(e.id),i=Yi(e);return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:t?L.sessionGroupRow:void 0,"aria-expanded":t?r:void 0,tabIndex:t?0:void 0,onClick:t?()=>{Ct(e.id)}:void 0,onKeyDown:t?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Ct(e.id))}:void 0,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:L.modelName,children:(0,m.jsxs)(`button`,{type:`button`,className:L.sessionLink,"data-testid":`billing-session-open`,title:n(`sessionOpen`),onClick:t=>{t.stopPropagation(),Ee(e.id)},children:[e.title??`${n(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]})}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(L.ubTag,L.ubTagNeutral),"data-testid":`billing-session-stale`,children:n(`sessionStaleBadge`)}),(i.calls>0||i.cost>0)&&(0,m.jsx)(`span`,{className:y(L.ubTag,L.ubTagNeutral),"data-testid":`billing-session-sub`,children:i.cost>0?n(`sessionSubCost`).replace(`{cost}`,U(i.cost)):n(`sessionSubCalls`).replace(`{calls}`,i.calls.toLocaleString())})]}),Tt(e)]}),r&&e.children?.map(e=>(0,m.jsxs)(`tr`,{className:L.sessionChildRow,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`button`,{type:`button`,className:L.sessionLink,"data-testid":`billing-session-open`,title:n(`sessionOpen`),onClick:t=>{t.stopPropagation(),Ee(e.id)},children:(0,m.jsx)(`span`,{className:L.modelProvider,children:e.id.slice(0,8)})})}),Tt(e)]},e.id)),r&&e.subs?.map(e=>Dt(e,0))]},e.id)})]})]})]}),bt&&(0,m.jsxs)(`div`,{className:L.sessionViewer,"data-testid":`billing-session-viewer`,children:[(0,m.jsxs)(`div`,{className:L.sessionViewerHead,children:[(0,m.jsx)(`h3`,{className:L.sessionViewerTitle,children:n(`sessions`)}),(0,m.jsx)(`input`,{className:L.ubSearch,type:`search`,value:xt,placeholder:n(`sessionViewerSearch`),"aria-label":n(`sessionViewerSearch`),"data-testid":`billing-session-viewer-search`,onChange:e=>{St(e.target.value)}}),(0,m.jsx)(`button`,{type:`button`,className:L.exportButton,"data-testid":`billing-session-viewer-close`,onClick:()=>{H(!1),St(``)},children:n(`close`)})]}),(0,m.jsx)(`div`,{className:L.sessionViewerList,"data-testid":`billing-session-viewer-list`,children:(0,m.jsxs)(`table`,{className:L.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`sessionTitle`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`calls`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`actual`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[Ot.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:L.emptyRow,children:n(`noData`)})}),Ot.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsxs)(`td`,{children:[(0,m.jsxs)(`span`,{className:L.modelName,children:[e.title??`${n(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.cwd!==void 0&&(0,m.jsx)(`span`,{className:L.modelProvider,children:ka(e.cwd)}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(L.ubTag,L.ubTagNeutral),children:n(`sessionStaleBadge`)})]}),(0,m.jsx)(`td`,{className:L.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:L.numCol,children:U(e.cost)}),(0,m.jsx)(`td`,{className:L.numCol,children:e.lastActive>0?`${G(e.lastActive)} ${Xi(e.lastActive)}`:`—`})]},e.id))]})]})})]})]})]}),P===`token`&&(0,m.jsxs)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,m.jsx)(Pn,{stats:e,trendDays:Le,onTrendDays:Re,models:cr,money:U,channelName:qn,t:n}),e.perf!==void 0&&(0,m.jsxs)(`section`,{className:L.panel,"data-testid":`billing-panel-perf`,children:[(0,m.jsxs)(`div`,{className:L.panelHead,children:[(0,m.jsx)(`h3`,{className:L.panelTitle,children:n(`perfTitle`)}),(0,m.jsx)(`span`,{className:L.panelHint,children:n(`perfHint`)})]}),(0,m.jsx)(Gn,{perf:e.perf,models:cr,t:n})]})]}),P===`pricing`&&(0,m.jsxs)(`div`,{className:L.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:L.ubAlert,role:`note`,children:[(0,m.jsxs)(`div`,{className:L.ubAlertLeft,children:[(0,m.jsxs)(`span`,{className:L.ubRate,"data-testid":`billing-rate`,children:[n(`todayRate`),` 1 USD = `,W(Wt.rate)]}),(0,m.jsx)(`span`,{className:y(L.ubTag,Wt.live?L.ubTagSuccess:L.ubTagNeutral),children:Wt.live?n(`rateLive`):n(`rateBuiltin`)}),Jt>0&&(0,m.jsxs)(`span`,{className:L.ubTag,"data-testid":`billing-pricing-synced`,children:[n(`pricingSyncedAt`),` `,new Date(Jt).toLocaleTimeString(Xt===`zh`?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}),(0,m.jsx)(`button`,{type:`button`,className:L.heatmapRangeButton,"data-testid":`billing-pricing-sync`,disabled:Gt,onClick:qt,children:n(Gt?`pricingSyncing`:`pricingSyncNow`)})]}),(0,m.jsx)(`p`,{className:L.ubAlertNote,children:n(`pricingTip`)})]}),(0,m.jsxs)(`section`,{className:L.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:L.ubCardHead,children:[(0,m.jsx)(`h3`,{className:L.ubCardTitle,children:n(`pricing`)}),(0,m.jsx)(`span`,{className:L.ubCardSub,children:n(`pricingUnit`)}),(0,m.jsx)(`input`,{className:L.ubSearch,type:`search`,value:Qt,placeholder:n(`pricingSearch`),"aria-label":n(`pricingSearch`),"data-testid":`billing-pricing-search`,onChange:e=>{$t(e.target.value)}})]}),(0,m.jsx)(`div`,{className:y(L.ubTablewrap,L.ubTablewrapPricing),"data-testid":`billing-pricing-table`,children:(0,m.jsxs)(`table`,{className:L.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`thModel`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`thInputMiss`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`thInputHit`)}),(0,m.jsx)(`th`,{className:L.numCol,children:n(`output`)}),(0,m.jsx)(`th`,{className:L.numCol,colSpan:2,children:n(`band`)})]})}),(0,m.jsx)(`tbody`,{children:mr(fn(),Qt).map(e=>{let t=e.price.input>0||e.price.output>0;return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsxs)(`span`,{className:L.ubModel,children:[(()=>{let t=dr(Bt(nn,zt(e.key,an)),on);if(t===null)return null;let r=en.includes(e.key),i=`${e.name} · ${n(t===`peak`?`peak`:`offPeak`)} · ${n(`bandPinHint`)}`;return(0,m.jsx)(`button`,{type:`button`,className:y(L.bandDot,L[t],r&&L.bandDotOn),"data-testid":`billing-band-dot`,"aria-pressed":r,"aria-label":i,title:i,onClick:()=>{tn(ze(e.key)),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.pinned-pref`))}})})(),(0,m.jsxs)(`span`,{className:L.ubModelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:L.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:n(`uncatalogued`)}),e.promo!==void 0&&un(e.promo,Date.now())&&(0,m.jsx)(p.Tooltip,{label:[e.promo.note,e.promo.endsAtMs===void 0?n(`promoOpenEnded`):n(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()})].filter(Boolean).join(` · `),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:L.ubTagPromo,"data-testid":`billing-price-promo`,children:n(`promoBadge`)})})]})]})}),(0,m.jsx)(`td`,{className:L.numCol,children:t?sn(e.price.input,e.price.currency):(0,m.jsx)(`span`,{className:L.na,children:`—`})}),(0,m.jsx)(`td`,{className:L.numCol,children:t?sn(e.price.cacheHit,e.price.currency):(0,m.jsx)(`span`,{className:L.na,children:`—`})}),(0,m.jsx)(`td`,{className:L.numCol,children:t?sn(e.price.output,e.price.currency):(0,m.jsx)(`span`,{className:L.na,children:`—`})}),t&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:L.numCol,children:(0,m.jsxs)(`span`,{className:L.ubChipPeak,children:[(0,m.jsx)(`span`,{className:L.ubChipLabel,children:e.tierSemantics===`latency`?n(`ubStd`):n(`ubPeak`)}),(0,m.jsxs)(`span`,{children:[sn(e.price.input,e.price.currency),`/`,sn(e.price.output,e.price.currency)]})]})}),(0,m.jsx)(`td`,{className:L.numCol,children:(0,m.jsxs)(`span`,{className:L.ubChipOff,children:[(0,m.jsx)(`span`,{className:L.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:n(`ubOff`)}),(0,m.jsxs)(`span`,{children:[sn(e.price.offPeak.input,e.price.currency),` / `,sn(e.price.offPeak.output,e.price.currency)]})]})})]}):(0,m.jsx)(`td`,{className:L.numCol,colSpan:2,children:t?(0,m.jsx)(`span`,{className:L.flatTag,children:n(`flat`)}):(0,m.jsx)(`span`,{className:L.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,m.jsxs)(`tr`,{className:L.ubExtraRow,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:L.ubExtraName,children:pr(t.label,Xt)}),t.note!==void 0&&(0,m.jsx)(`span`,{className:L.ubExtraNote,children:pr(t.note,Xt)})]}),(0,m.jsx)(`td`,{className:L.numCol,children:t.input===void 0?(0,m.jsx)(`span`,{className:L.na,children:`—`}):sn(t.input,e.price.currency)}),(0,m.jsx)(`td`,{className:L.numCol,children:(0,m.jsx)(`span`,{className:L.na,children:`—`})}),(0,m.jsx)(`td`,{className:L.numCol,children:t.output===void 0?(0,m.jsx)(`span`,{className:L.na,children:`—`}):sn(t.output,e.price.currency)}),(0,m.jsx)(`td`,{className:L.numCol,colSpan:2,children:(0,m.jsx)(`span`,{className:L.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,m.jsxs)(`section`,{className:L.ubCard,children:[(0,m.jsx)(`div`,{className:L.ubCardHead,children:(0,m.jsx)(`h3`,{className:L.ubCardTitle,children:n(`pricingNotes`)})}),(0,m.jsxs)(`ul`,{className:L.ubNotes,children:[(0,m.jsxs)(`li`,{className:L.ubNotesItem,children:[(0,m.jsx)(`span`,{className:L.ubNotesTerm,children:n(`cacheHit`)}),(0,m.jsx)(`span`,{className:L.ubNotesDesc,children:n(`noteCache`)})]}),(0,m.jsxs)(`li`,{className:L.ubNotesItem,children:[(0,m.jsx)(`span`,{className:L.ubNotesTerm,children:n(`peakBand`)}),(0,m.jsx)(`span`,{className:L.ubNotesDesc,children:n(`noteBand`)})]}),(0,m.jsxs)(`li`,{className:L.ubNotesItem,children:[(0,m.jsx)(`span`,{className:L.ubNotesTerm,children:n(`pricingSource`)}),(0,m.jsx)(`span`,{className:L.ubNotesDesc,children:n(`noteSource`)})]})]})]})]}),!i&&x(`billing.dashboard.decor`,{position:`footer`})]}),!i&&(0,m.jsxs)(`footer`,{className:L.modalFooter,"data-testid":`billing-footer`,children:[(0,m.jsx)(`span`,{children:n(`footer`)}),(0,m.jsx)(`span`,{children:n(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]});return i?fr:(0,m.jsx)(p.Modal,{open:!0,onClose:r,title:n(`title`),headless:!0,className:y(L.dashboardModal,`dsh-billing-modal`,Rr),children:fr})}function ka(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??`—`}let Aa={display:[`显示`,`密度`,`动效`,`紧凑`,`舒适`,`克制`,`丰富`,`display`,`density`,`motion`,`compact`,`comfortable`],budget:[`预算`,`金额`,`本月`,`花费`,`进度`,`budget`,`amount`,`spend`,`progress`],alert:[`峰谷`,`峰`,`谷`,`提醒`,`通知`,`预览`,`切换`,`peak`,`off-peak`,`alert`,`notify`,`preview`],toggles:[`usage_stats`,`工具`,`即时代费`,`胶囊`,`中转站`,`站点`,`隐藏`,`低谷`,`队列`,`relay`,`site`,`live`,`cost`,`hide`,`queue`,`off-peak`],displayExtra:[`悬浮`,`订阅`,`计费卡`,`指标`,`环比`,`主数字`,`侧栏`,`入口`,`隐藏`,`通道`,`可见`,`float`,`subscription`,`card`,`metric`,`delta`,`sidebar`,`trigger`,`hidden`,`channel`,`visibility`],advanced:[`自定义`,`单价`,`价格`,`低谷`,`custom`,`price`],about:[`关于`,`版本`,`作者`,`许可`,`仓库`,`about`,`version`,`author`,`license`,`repo`]};function ja(e){return Object.values(Aa).every(t=>Hi(e,t))}let Ma=[`below`,`above`,`toolbar`];function Na({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[r,i]=(0,d.useState)(!1),a={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)},o=Ma.map(e=>({id:e,label:a[e]}));return(0,m.jsx)(p.Menu,{open:r,align:`end`,portal:!0,compact:!0,items:o,selectedId:e.position,onSelect:n=>{i(!1);let r=Ma.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{i(!1)},anchor:(0,m.jsxs)(`button`,{type:`button`,className:L.rdoSelect,"data-testid":`billing-livecost-position-select`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>{i(!r)},children:[(0,m.jsx)(`span`,{children:a[e.position]}),(0,m.jsx)(`span`,{className:y(L.rdoChevron,r&&L.rdoChevronOpen),"aria-hidden":!0,children:qr?(0,m.jsx)(qr,{}):null})]})})}function Pa(e){let{t,checkModels:n,publishCosts:r,registerOpen:i,navigateToSession:a,sessionTitleOf:o,renderSlot:s,useStore:c,actions:l,embeddedSettings:u=!1}=e,[f,p]=(0,d.useState)(zr),[h,g]=(0,d.useState)(void 0),[_,v]=(0,d.useState)(Hr),[y,b]=(0,d.useState)([]),[x,S]=(0,d.useState)(void 0),[C,w]=(0,d.useState)(!1),[T,E]=(0,d.useState)([]),[D,O]=(0,d.useState)(!1),[ie,ae]=(0,d.useState)([]),[oe,se]=(0,d.useState)(()=>Ee()),[ce,le]=(0,d.useState)(()=>Le()),ue=(0,d.useCallback)(e=>{le(e),Re(e),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.language-pref`))},[]),de=(0,d.useCallback)(e=>{se(e),De(e),window.dispatchEvent(new CustomEvent(Te))},[]),[fe,pe]=(0,d.useState)(()=>ee()),M=(0,d.useCallback)(e=>{pe(e),te(e)},[]),[ge,ye]=(0,d.useState)(()=>me()),be=(0,d.useCallback)(e=>{ye(e),he(e)},[]),[we,Oe]=(0,d.useState)(()=>Se()),ke=(0,d.useCallback)(e=>{Oe(e),Ce(e),window.dispatchEvent(new CustomEvent(xe))},[]),[Ae,je]=(0,d.useState)(()=>nt());(0,d.useEffect)(()=>{let e=()=>{je(nt())};return window.addEventListener(tt,e),()=>{window.removeEventListener(tt,e)}},[]);let N=(0,d.useCallback)(e=>{let t={...nt(),showEntry:e.showEntry,reuseSourceSession:e.reuseSourceSession};je(t),rt({showEntry:t.showEntry,reuseSourceSession:t.reuseSourceSession})},[]),[Me,Ne]=(0,d.useState)(()=>k());(0,d.useEffect)(()=>j(()=>{Ne(k())}),[]);let P=e.recoveryEntryAvailable,Pe=(0,d.useMemo)(()=>({...Me,mode:re(Me.mode,P)}),[Me,P]),Fe=(0,d.useCallback)(e=>{let t={...e,mode:re(e.mode,P)};Ne(t),A(t),window.dispatchEvent(new CustomEvent(ne))},[P]),[Ie,ze]=(0,d.useState)(()=>{let e=Ve();return _t(e),e}),Be=(0,d.useCallback)(e=>{ze(e),_t(e),He(e)},[]),[Ue,We]=(0,d.useState)(()=>_e()),Ge=(0,d.useCallback)(e=>{We(e),ve(e)},[]),Ke=(0,d.useMemo)(()=>new Set(Ue.hidden),[Ue.hidden]),qe=(0,d.useMemo)(()=>Mi(f,Ke),[f,Ke]),F=(0,d.useMemo)(()=>Ei(qe),[qe,Ie]),Je=ce,I=(0,d.useCallback)((e,n)=>{let r=(Je===`en`?st:ot)[e]??t(e);if(n===void 0)return r;let i=r;for(let[e,t]of Object.entries(n))i=i.replaceAll(`{${e}}`,String(t));return i},[Je,t]),Ye=(0,d.useMemo)(()=>ji(Ai(f),e=>xr(e,Je)??I(`channelUnknown`)),[f,Je,I]),[Xe,Ze]=(0,d.useState)(!1),Qe=(0,d.useCallback)(()=>{Ze(!1)},[]),$e=(0,d.useRef)(!1),et=(0,d.useCallback)((e=!1)=>{$e.current&&!e||($e.current=!0,Promise.all([Qi().then(e=>{e.ok?(p(e.stats),g(e.stats.sessionListError)):g(e.reason)}),$i().then(({balances:e,reconcile:t,stale:n})=>{e.length>0&&b(e),S(t),w(n===!0)}),ea().then(({quotas:e,stale:t})=>{e.length>0?(E(e),O(t===!0)):O(!1)}).catch(()=>{O(!0)}),ta().then(e=>{ae(e)}).catch(()=>{})]).catch(()=>{}).finally(()=>{$e.current=!1}))},[]),it=(0,d.useCallback)(()=>{et(!0),oa(),Ze(!0)},[et]);(0,d.useEffect)(()=>{et(),oa()},[et]);let[L,at]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{at(!document.hidden),document.hidden||(et(!0),oa())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[et]),(0,d.useEffect)(()=>{if(!L)return;let e=setInterval(()=>{et(),oa()},Xe?Lr:3e5);return()=>{clearInterval(e)}},[et,Xe,L]),(0,d.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(v(t),Ct(t.catalog??[]))}),()=>{e=!1}},[n]);let R=G(),z=Object.entries(F.byDay).filter(([e])=>e.startsWith(R.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),ct=F.byDay[R]?.cost??0,lt=new Date;lt.setDate(lt.getDate()-1);let ut=`${lt.getFullYear()}-${String(lt.getMonth()+1).padStart(2,`0`)}-${String(lt.getDate()).padStart(2,`0`)}`,dt=F.byDay[ut]?.cost??0,B=dt>0?(ct-dt)/dt*100:0,ft=ti(F.byDay,R),V=(0,d.useMemo)(()=>ei(F.byDay).map(e=>{let t=F.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:$r(t)}}),[F.byDay]),pt=Object.entries(F.byDay).filter(([e])=>e.startsWith(R.slice(0,7))).reduce((e,[,t])=>e+$r(t),0),mt=(()=>{let e=F.byDay[R];return e===void 0?0:$r(e)})(),ht=ti(F.byDay,R,$r),gt=c(e=>e.enabled),vt=c(e=>e.amount),yt=c(e=>e.tierAlertDays),bt=c(e=>e.lastTierSwitchAt),[H,xt]=(0,d.useState)(()=>Nr()),[St,wt]=(0,d.useState)(null),[Tt,Dt]=(0,d.useState)(null),[Ot,At]=(0,d.useState)(0),[jt,Mt]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!H.enabled){At(0),Mt(!1);return}let e=!1,t=!1;Mt(!1);let n=()=>{t||(t=!0,ua().then(t=>{e||At(t.supported?t.queuedCount:0)}).catch(()=>{e||At(0)}).finally(()=>{t=!1,e||Mt(!0)}))};n();let r=setInterval(n,Lr);return()=>{e=!0,clearInterval(r)}},[H.enabled]),(0,d.useEffect)(()=>{wt(e=>Mr(e,Ot))},[Ot]);let[Nt,Pt]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{if(!H.enabled)return;let e=setInterval(()=>Pt(Date.now()),Lr);return()=>{clearInterval(e)}},[H.enabled]);let Ft=(0,d.useCallback)(e=>{xt(e),Pr(e)},[]),It=T.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),Lt=zt(f.byTurn?.[0]?.model,It),Rt=(0,d.useCallback)(()=>{Dt({entering:kt(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4,channel:Lt})},[Lt]),Bt=vt>0?vt:f.budget??0,Vt=gt&&Bt>0?z/Bt>=1?`over`:z/Bt>=.8?`warn`:`none`:`none`,Ht=(0,d.useCallback)(()=>{let e=!gt;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,gt]);(0,d.useEffect)(()=>{if(!gt||Bt<=0)return;let e=z/Bt*100,t=Ir.filter(t=>e>=t&&yt?.[String(t)]!==R);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,R),!Pi())return;let r=I(`budgetTierBody`).replace(`{cost}`,W(z)).replace(`{budget}`,W(Bt)).replace(`{pct}`,String(n));Fi(`budget:${n}:${R}`,()=>{new Notification(I(`budget`),{body:r})})},[gt,Bt,z,yt,R,l,I]),(0,d.useEffect)(()=>{if(H.enabled&&!jt)return;let e=jr(Fr(Nt,H,bt,Lt),Ot>0?Fr(Nt,H,bt,`deepseek-metered`):null,Ot);if(e===null||(l.markTierSwitchAlerted(e.atMs),wt(e),!H.webNotify||!Pi()))return;let t=Math.max(1,Math.round((e.atMs-Nt)/6e4)),n=I(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=I(e.channel===`zhipu-coding-plan`?e.entering===`peak`?`tierAlertEnterPeakZhipu`:`tierAlertEnterOffZhipu`:e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t)),i=e.queueCount===void 0?``:` ${I(e.entering===`peak`?`peakAlertQueuePeak`:`peakAlertQueueOff`,{count:e.queueCount})}`;Fi(`peak:${e.atMs}`,()=>{new Notification(n,{body:`${r}${i}`})})},[Nt,bt,H,Lt,Ot,jt,l,I]);let Ut=c(e=>e.lastBalanceAlertDay),Wt=c(e=>e.modelBudgets??cr),Gt=c(e=>e.modelTierAlertDays??lr),Kt=(0,d.useMemo)(()=>ai(F.byDayModels,R.slice(0,7)),[F.byDayModels,R]),qt=F.lowBalanceThreshold??50,Jt=(0,d.useMemo)(()=>{if(y.length===0)return;let e=Jr(F.byDay,R),t=Et().rate;for(let n of y){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=qt)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[y,F.lowBalanceThreshold,F.byDay,R]);(0,d.useEffect)(()=>{if(Jt===void 0||Ut===R||(l.markBalanceAlerted(R),!Pi()))return;let e=I(`balanceLowBody`).replace(`{name}`,Jt.name).replace(`{balance}`,W(Jt.cny)).replace(`{days}`,Jt.days===void 0?`—`:String(Jt.days));Fi(`balance:${R}`,()=>{new Notification(I(`balance`),{body:e})})},[Jt,Ut,R,l,I]),(0,d.useEffect)(()=>{let e=[],t;for(let[n,r]of Object.entries(Wt)){if(!(r>0))continue;let i=Kt[n]??0;for(let a of si(i,r)){let o=`${n}:${a}`;Gt[o]!==R&&(e.push(o),(t===void 0||a>t.tier)&&(t={model:n,tier:a,cost:i,budget:r}))}}if(e.length===0||t===void 0||(l.markModelTierAlerted(e,R),!Pi()))return;let n=I(`modelBudgetBody`).replace(`{model}`,t.model).replace(`{cost}`,W(t.cost)).replace(`{budget}`,W(t.budget)).replace(`{pct}`,String(t.tier));Fi(`model-budget:${t.model}:${t.tier}:${R}`,()=>{new Notification(I(`modelBudgetTitle`),{body:n})})},[Wt,Kt,Gt,R,l,I]);let U=(0,d.useMemo)(()=>{let e=R.slice(0,7),t=new Map;for(let[n,r]of Object.entries(F.byDayModels??{}))if(n.startsWith(e))for(let[e,n]of Object.entries(r)){if(n.cost<=0)continue;let r=cn(e).provider,i=F.byModel?.[e]?.plan===!0,a=t.get(r)??{cost:0,plan:i};a.cost+=n.cost,i||(a.plan=!1),t.set(r,a)}let n,r;for(let e of t){let t=e[1].plan?r:n;(t===void 0||e[1].cost>t[1].cost)&&(e[1].plan?r=e:n=e)}let i=e=>{let t=y.find(t=>Z(t.provider)===Z(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=y.filter(e=>e.totalBalance!==void 0&&e.error===void 0),t=e[0];return t!==void 0&&e.length===1?i(t.provider):void 0}return{text:t?.error===`unauthorized`?I(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?I(`balanceUnreachable`):I(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:W(t.totalBalance),r=Et().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<qt}},a=e=>{let t=T.find(t=>t.displayName===e||pi(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:I(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?I(`subscriptionExhausted`):I(`subscriptionRemaining`).replace(`{pct}`,String(n)),low:n<20}},o=n===void 0?void 0:i(n[0]);return{direct:n===void 0||o===void 0?void 0:{name:n[0],...o},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[F.byDayModels,F.byModel,F.lowBalanceThreshold,y,T,R,I]),Yt=(0,d.useMemo)(()=>{let e=F.total;return{input:e.input,output:e.output,cacheRead:e.cacheHit,cacheMiss:e.cacheMiss,calls:e.calls}},[F]);(0,d.useEffect)(()=>{r({todayCost:ct,monthCost:z})},[ct,z,r]),(0,d.useEffect)(()=>{if(!u)return i(it)},[u,i,it]);let Xt=(0,d.useMemo)(()=>f.byTurn??[],[f.byTurn]);return(0,m.jsxs)(m.Fragment,{children:[!u&&(0,m.jsx)(Sa,{...e,t:I,currency:oe,onOpen:it,monthCost:z,todayCost:ct,weekCost:ft,days:V,vendorStatus:U,dash:Yt,cardPrefs:Pe,monthTokens:pt,todayTokens:mt,weekTokens:ht,floatPrefs:fe,subscriptions:T,budgetPressure:Vt,deltaPct:B,...h===void 0?{}:{statsError:h}}),(u||Xe)&&(0,m.jsx)(Oa,{stats:F,...h===void 0?{}:{statsError:h},t:I,onClose:Qe,embeddedSettings:u,navigateToSession:a,sessionTitleOf:o,userPrices:Ie,onUserPrices:Be,health:_,balances:y,...x===void 0?{}:{reconcile:x},quotas:T,relayQuotas:ie,currency:oe,onCurrency:de,language:ce,onLanguage:ue,turns:Xt,renderSlot:s,budgetEnabled:gt,budgetAmount:Bt,modelBudgets:Wt,monthModelCost:Kt,onModelBudget:l.setModelBudget,onToggleBudget:Ht,onBudgetAmount:l.setAmount,peakConfig:H,onPeakConfig:Ft,onPreviewPeak:Rt,floatPrefs:fe,onFloatPrefs:M,cardPrefs:Pe,onCardPrefs:Fe,recoveryEntryAvailable:P,sitePrefs:ge,onSitePrefs:be,channelPrefs:Ue,onChannelPrefs:Ge,channelGroups:Ye,liveCostPrefs:we,onLiveCostPrefs:ke,quickQueuePrefs:Ae,onQuickQueuePrefs:N,quotasStale:D,balanceStale:C}),(St!==null||Tt!==null)&&(0,m.jsx)(Vr,{hit:St??Tt,config:H,t:I,onDismiss:()=>{wt(null),Dt(null)}})]})}function Fa(e){return(0,m.jsx)(`div`,{className:y(L.nativeSettingsRoot,Rr),"data-testid":`native-billing-settings`,children:(0,m.jsx)(Pa,{...e,renderSlot:()=>null,wide:!0,embeddedSettings:!0})})}function Ia(e,t){if(t===void 0||e?.bySession===void 0)return 0;let n=e.bySession.find(e=>e.id===t);return(n?.cost??0)+(n?.subCost??0)}function La(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.subCost??0}function Ra(e,t){if(t===void 0||e?.byTurn===void 0)return 0;let n=0,r=-1;for(let i of e.byTurn)i.sessionId===t&&(r===-1||i.turn>r)&&(r=i.turn,n=i.cost);return n}function za(e,t=20){let n=[];for(let r of e)if(r.status===`ok`)for(let e of r.windows)e.remainingPercent>t||n.push({name:r.displayName,kind:e.kind,pct:e.remainingPercent});return n.sort((e,t)=>e.pct-t.pct).slice(0,3)}function Ba(e,t){if(t===void 0||e?.byTurn===void 0)return;let n=-1,r;for(let i of e.byTurn)i.sessionId===t&&(n===-1||i.turn>n)&&(n=i.turn,r=i.model);return r}async function Va(){try{let e=await Q(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return null;let r=n;return{...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{}}}catch{return null}}async function Ha(){try{let e=await Q(`/api/billing/subscriptions`);if(!e.ok)return[];let t=JSON.parse(await e.text());if(typeof t!=`object`||!t||!(`quotas`in t))return[];let n=t.quotas;return Array.isArray(n)?n:[]}catch{return[]}}function Ua(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function Wa(e){return!e.running&&!e.promptAttempted&&(e.blank||e.awaitingFirstTurn)}function Ga({hasBandPlan:e}){let[t,n]=(0,d.useState)(()=>Ae()),[r,i]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=()=>{n(Ae())};window.addEventListener(ke,e),window.addEventListener(`storage`,e);let t=setInterval(()=>{i(Date.now())},3e4);return()=>{window.removeEventListener(ke,e),window.removeEventListener(`storage`,e),clearInterval(t)}},[]),t.length===0)return null;let a=Nr().leadMin*6e4,o=t.map(t=>({key:t,state:dr(Bt(r,zt(t,e)),a)})).filter(e=>e.state!==null);return o.length===0?null:(0,m.jsx)(`span`,{className:L.bandDots,"data-testid":`billing-pinned-dots`,children:o.map(e=>(0,m.jsx)(`span`,{className:y(L.bandDot,L.bandDotOn,L[e.state]),role:`img`,"aria-label":e.key,title:e.key},e.key))})}function Ka(){let[e,t]=(0,d.useState)(()=>Ee());return(0,d.useEffect)(()=>{let e=()=>{t(Ee())};return window.addEventListener(Te,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Te,e),window.removeEventListener(`storage`,e)}},[]),e}function qa(){let[e,t]=(0,d.useState)(()=>Se().show),[n,r]=(0,d.useState)(()=>Se().position);return(0,d.useEffect)(()=>{let e=()=>{t(Se().show),r(Se().position)};return window.addEventListener(xe,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(xe,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function Ja(e,t){let[n,r]=(0,d.useState)(null),[i,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(()=>Date.now()),[c,l]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{l(!document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]),(0,d.useEffect)(()=>{if(!c||!t)return;let e=!1,n=!1,i=()=>{n||(n=!0,e||s(Date.now()),Promise.all([Va(),Ha()]).then(([t,n])=>{e||(t!==null&&r(t),a(n))}).catch(()=>{}).finally(()=>{n=!1}))};i();let o=setInterval(i,3e4);return()=>{e=!0,clearInterval(o)}},[e,c,t]);let u=(0,d.useMemo)(()=>Ia(n,e),[n,e]),f=(0,d.useMemo)(()=>La(n,e),[n,e]),p=(0,d.useMemo)(()=>Ra(n,e),[n,e]),m=(0,d.useMemo)(()=>za(i),[i]),h=(0,d.useMemo)(()=>zt(Ba(n,e),i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)),[n,e,i]);return{sessionCost:u,subCost:f,turnCost:p,tier:(0,d.useMemo)(()=>Bt(o,h),[o,h]),chips:m,hasBandPlan:i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)}}function Ya({sessionId:e,t,seat:n,session:r}){let{visible:i,position:a}=qa(),o=i&&a===n&&!(n===`above`&&r!==void 0&&Wa(r)),{sessionCost:s,subCost:c,turnCost:l,tier:u,chips:d,hasBandPlan:f}=Ja(e,o),p=Ka(),h=e=>W(gn(e,p),p),g=s>0||l>0,_=u?.tier===`peak`;return o?(0,m.jsxs)(`span`,{className:n===`above`?y(L.feeBar,L.feeBarAbove,Rr):y(L.feeBar,Rr),"data-testid":`billing-live-cost-bar`,"data-seat":n,children:[(0,m.jsx)(Ga,{hasBandPlan:f}),u!==null&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:_?L.feeChipPrimary:L.feeChipOff,"data-testid":`billing-live-tier`,children:t(_?`tierPeak`:`tierOff`)}),(0,m.jsx)(`span`,{className:L.feeCount,children:Ht(u.nextSwitchInMs)}),(0,m.jsx)(`span`,{className:L.feeSuffix,children:t(_?`tierToOff`:`tierToPeak`)})]}),g&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:L.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:L.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,m.jsx)(`span`,{className:L.feeNum,"data-tick":`turn`,children:h(l)})]}),(0,m.jsx)(`span`,{className:L.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:L.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,m.jsx)(`span`,{className:L.feeNum,"data-tick":`session`,children:h(s)}),c>0&&(0,m.jsx)(`span`,{className:L.feeSuffix,"data-testid":`billing-live-session-sub`,children:t(`liveSessionSub`).replace(`{cost}`,h(c))})]})]}),d.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:L.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:e.pct<=10?L.feeChipError:L.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(Ua(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]}):null}function Xa({sessionId:e,t}){let n=Ka(),r=e=>W(gn(e,n),n),{visible:i,position:a}=qa(),{sessionCost:o,subCost:s,turnCost:c,tier:l,chips:u,hasBandPlan:d}=Ja(e,i&&a===`toolbar`);if(!i||a!==`toolbar`)return null;let f=l?.tier===`peak`,h=u.reduce((e,t)=>Math.min(e,t.pct),100),g=h<=10?L.feeInlineError:h<=20?L.feeInlineAlert:void 0,_=y(L.feeInline,g),v=[...l===null?[]:[`${Ht(l.nextSwitchInMs)} ${t(f?`tierToOff`:`tierToPeak`)}`],`${t(`liveTurn`)} ${r(c)}`,`${t(`liveSession`)} ${r(o)}`,...s>0?[t(`liveSessionSub`).replace(`{cost}`,r(s))]:[],...u.map(e=>`${e.name} ${t(Ua(e.kind))} ${e.pct}%`)].join(` · `);return(0,m.jsx)(p.Tooltip,{label:v,side:`top`,delayMs:500,portal:!0,children:(0,m.jsxs)(`span`,{className:y(_,Rr),"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":v,children:[(0,m.jsx)(Ga,{hasBandPlan:d}),l!==null&&(0,m.jsx)(`span`,{className:f?L.feeChipPrimary:L.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),o>0&&(0,m.jsx)(`span`,{className:L.feeInlineNum,children:r(o)})]})})}let Za=`@kenz1117/dsh-ui-usage-billing/TaskQueueQuick.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Za)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=Za,e.textContent=`.HRJ8EG_quickQueue{white-space:nowrap;flex-shrink:0;align-self:center;align-items:center;gap:6px;display:inline-flex;position:relative}.HRJ8EG_quickQueueToggle,.HRJ8EG_quickQueueButton{border:1px solid var(--dsw-alias-border-l1);min-height:24px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border-radius:999px;justify-content:center;align-items:center;gap:5px;padding:0 8px;font-size:11px;line-height:18px;display:inline-flex}.HRJ8EG_quickQueueToggle:hover,.HRJ8EG_quickQueueButton:hover:not(:disabled){border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}.HRJ8EG_quickQueueToggle[aria-checked=true]{border-color:color-mix(in srgb, var(--ds-blue) 45%, transparent);background:color-mix(in srgb, var(--ds-blue) 10%, transparent);color:var(--ds-blue)}.HRJ8EG_quickQueueButton:focus-visible,.HRJ8EG_quickQueueToggle:focus-visible,.HRJ8EG_quickQueueClear input:focus-visible{outline:2px solid var(--ds-blue);outline-offset:2px}.HRJ8EG_quickQueueButton:disabled{cursor:wait;opacity:.65}.HRJ8EG_quickQueueClear{color:var(--dsw-alias-label-tertiary);cursor:pointer;align-items:center;gap:4px;font-size:11px;display:inline-flex}.HRJ8EG_quickQueueClear input{width:13px;height:13px;accent-color:var(--ds-blue);margin:0}.HRJ8EG_quickQueueCount{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);min-width:16px;height:16px;color:var(--ds-blue);font-variant-numeric:tabular-nums;border-radius:999px;justify-content:center;align-items:center;padding:0 4px;font-size:10px;display:inline-flex}.HRJ8EG_quickQueueNotice{z-index:30;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-3);width:max-content;max-width:min(320px,75vw);color:var(--dsw-alias-label-primary);white-space:normal;pointer-events:none;border-radius:8px;padding:7px 10px;font-size:12px;line-height:18px;position:absolute;bottom:calc(100% + 8px);right:0;box-shadow:0 8px 24px #00000038}.HRJ8EG_quickQueueNotice[data-kind=error]{border-color:color-mix(in srgb, var(--ds-red) 45%, transparent);color:var(--ds-red)}`,document.head.appendChild(e)}var Qa={quickQueue:`HRJ8EG_quickQueue`,quickQueueButton:`HRJ8EG_quickQueueButton`,quickQueueClear:`HRJ8EG_quickQueueClear`,quickQueueCount:`HRJ8EG_quickQueueCount`,quickQueueNotice:`HRJ8EG_quickQueueNotice`,quickQueueToggle:`HRJ8EG_quickQueueToggle`};let $a=()=>void 0,eo=()=>void 0;function to(e){return e.tasks.filter(e=>e.status===`queued`).length}function no(){let[e,t]=(0,d.useState)(()=>nt());return(0,d.useEffect)(()=>{let e=()=>{t(nt())};return window.addEventListener(tt,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(tt,e),window.removeEventListener(`storage`,e)}},[]),e}function ro(e){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)(()=>typeof document>`u`||!document.hidden),a=(0,d.useRef)(0),o=(0,d.useCallback)(e=>{a.current+=1,n(to(e))},[]);return(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{i(!document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[]),(0,d.useEffect)(()=>{if(!e||!r){n(null);return}let t=!1,i=!1,o=()=>{if(i)return;i=!0;let e=a.current;ua().then(r=>{t||e!==a.current||n(r.supported?r.queuedCount:null)}).catch(()=>{}).finally(()=>{i=!1})};o();let s=window.setInterval(o,3e4);return()=>{t=!0,window.clearInterval(s)}},[e,r]),{count:t,applySnapshot:o}}function io({t:e}){let t=no();return t.showEntry?(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t.enabled,"aria-label":e(`quickQueueToggle`),className:y(Qa.quickQueueToggle,Rr),"data-testid":`quick-queue-toggle`,onClick:()=>{rt({enabled:!t.enabled})},children:e(`quickQueueToggle`)}):null}function ao(e,t){let n=e(t),r=(0,d.useCallback)(e=>n?.subscribe(e)??(()=>{}),[n]),i=(0,d.useCallback)(()=>n?.getSnapshot(),[n]);return(0,d.useSyncExternalStore)(r,i,i)}function oo({sessionId:e,t,useInput:n,inputActions:r,projectionFaceOf:i}){let a=no(),o=(n??$a)(e=>e),s=ao(i??eo,`workingDirectory`),c=ao(i??eo,`modelSelection`)?.next,{count:l,applySnapshot:u}=ro(a.enabled&&a.showEntry),[f,p]=(0,d.useState)(!1),[h,g]=(0,d.useState)(null),_=(0,d.useRef)(!1),v=(0,d.useRef)(!0),b=(0,d.useRef)({sessionId:e,input:o});if(b.current={sessionId:e,input:o},(0,d.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,d.useEffect)(()=>{if(h===null)return;let e=h.kind===`success`?4e3:8e3,t=window.setTimeout(()=>{g(null)},e);return()=>{window.clearTimeout(t)}},[h]),!a.enabled||!a.showEntry)return null;let x=e=>{g({kind:`error`,text:e})},S=async()=>{if(_.current)return;if(g(null),o===void 0){x(t(`quickQueueUnsupported`));return}let n=o.draft;if(n.trim()===``){x(t(`quickQueueEmpty`));return}if(o.phase!==`plain`){x(t(`quickQueueBusy`));return}if(o.attachmentIds.length>0||o.occurrences.length>0){x(t(`quickQueueAttachments`));return}if(typeof s!=`string`||s===``){x(t(`quickQueueContext`));return}let i=a.clearAfterEnqueue;if(i&&r===void 0){x(t(`quickQueueUnsupported`));return}let l={sessionId:e,prompt:n,draftRev:o.draftRev,cwd:s,clearAfterEnqueue:i,reuseSource:a.reuseSourceSession};_.current=!0,p(!0);try{let e=await la(!0);if(!e.supported){x(t(`quickQueueUnsupported`));return}let n=c??e.defaultModel;if(n==null){x(t(`quickQueueContext`));return}let i=e.workspaces.some(e=>e.path===l.cwd),a=e.models.some(e=>e.provider===n.provider&&e.id===n.model);if(!i||!a){x(t(`quickQueueRoute`));return}let o=await da({action:`enqueue`,prompt:l.prompt,cwd:l.cwd,provider:n.provider,model:n.model,sourceSessionId:String(l.sessionId),reuseSource:l.reuseSource});u(o);let s=t(`quickQueueEnqueued`);if(l.clearAfterEnqueue&&r!==void 0){let e=b.current;if(v.current&&e.sessionId===l.sessionId&&e.input?.draft===l.prompt&&e.input.draftRev===l.draftRev&&e.input.phase===`plain`&&e.input.attachmentIds.length===0&&e.input.occurrences.length===0)try{r.setDraft(``)}catch{s=t(`quickQueueDraftChanged`)}else s=t(`quickQueueDraftChanged`)}v.current&&g({kind:`success`,text:s})}catch(e){if(!v.current)return;let n=e instanceof Error?e.message:String(e);x(t(`quickQueueFailed`).replace(`{message}`,n))}finally{_.current=!1,v.current&&p(!1)}};return(0,m.jsxs)(`span`,{className:y(Qa.quickQueue,Rr),"data-testid":`quick-queue-controls`,children:[(0,m.jsxs)(`label`,{className:Qa.quickQueueClear,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:a.clearAfterEnqueue,disabled:f,onChange:e=>{rt({clearAfterEnqueue:e.target.checked})}}),t(`quickQueueClear`)]}),(0,m.jsxs)(`button`,{type:`button`,className:Qa.quickQueueButton,"aria-label":t(`quickQueueEnqueue`),"aria-busy":f,disabled:f,"data-testid":`quick-queue-enqueue`,onClick:()=>{S()},children:[t(f?`quickQueueEnqueueing`:`quickQueueEnqueue`),l!==null&&l>0&&(0,m.jsx)(`span`,{className:Qa.quickQueueCount,"data-testid":`quick-queue-count`,"aria-label":t(`quickQueueWaiting`).replace(`{count}`,String(l)),children:l})]}),h!==null&&(0,m.jsx)(`span`,{className:Qa.quickQueueNotice,"data-kind":h.kind,role:h.kind===`error`?`alert`:`status`,children:h.text})]})}function so(){let e,t,n=new Set;return{readCosts:()=>e,subscribeCosts:t=>(t(e),n.add(t),()=>{n.delete(t)}),openDashboard:()=>{t?.()},publishCosts:t=>{e=t;for(let e of n)try{e(t)}catch{x(`billing-costs-listener-threw`)}},registerOpen:e=>(t=e,()=>{t===e&&(t=void 0)})}}let co={enabled:!1,timeout:0};function lo(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...co};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...co}}}function uo(e){return e.completed===!0||e.running===!1}function fo(e,t){let n=new Set,r=new Set,i,a=e.getSnapshot();for(let e of a.ids){let t=a.byId[e];t!==void 0&&(r.add(String(e)),uo(t)&&n.add(String(e)))}let o=e=>{let{enabled:n,timeout:r}=t();if(n&&!(typeof Notification>`u`)&&Notification.permission===`granted`)try{let t=new Notification(e,{body:e,tag:`dsh-billing-completion`,requireInteraction:r===0});r>0&&(i!==void 0&&clearTimeout(i),i=setTimeout(()=>t.close(),r*1e3))}catch{x(`notification-constructor-failed`)}},s=e.subscribe(()=>{let t=e.getSnapshot(),i=[];for(let e of t.ids){let a=t.byId[e];if(a===void 0)continue;let o=String(e),s=uo(a),c=!r.has(o);c&&r.add(o),s&&!c&&!n.has(o)&&i.push(a.title??a.id??o),s?n.add(o):n.delete(o)}if(i.length>0){let e=i.length===1?i[0]:`${i.length} 个会话已完成`;e!==void 0&&o(e)}});return()=>{s(),i!==void 0&&clearTimeout(i)}}function po(e){let t=e.get(`uiWorkspace`);if(t!==void 0&&typeof t.openSession==`function`)return t}function mo(e){let t=e.sessions,n=t?.open;return typeof n==`function`?n.bind(t):void 0}function ho(e){return{available:()=>po(e)!==void 0||mo(e)!==void 0,open:t=>{let n=_(t),r=po(e);if(r!==void 0)try{return r.openSession(n),`opened`}catch(e){return x(`session-navigation-open-failed`,e),`failed`}let i=mo(e);if(i!==void 0)try{return i(n),`opened`}catch(e){return x(`session-navigation-legacy-open-failed`,e),`failed`}return`unavailable`}}}function go(e,t){let n=!1,r={name:`usage`,label:t.label,description:t.description,available:()=>!0,ui:{kind:`action`,run:()=>{t.openDashboard()}}};return e.inject([`commandUi`],e=>{e.effect(()=>{try{let t=e.commandUi.register(r);return n=!0,()=>{n=!1,t()}}catch(e){return x(`usage-command-register-failed`,e),()=>{}}},`ui-usage-billing: /usage command`)}),()=>n}let _o=[`slots`,`locale`,`remote`,`sessions`];function vo(e){let t=so();e.provide(`billingMetrics`,t);let n=ur();e.effect(()=>e.locale.register(at,{zh:ot,en:st}),`ui-usage-billing: dictionaries`);let r=ho(e),i=go(e,{openDashboard:()=>{t.openDashboard()},label:()=>Le()===`en`?st.commandUsageLabel:ot.commandUsageLabel,description:()=>Le()===`en`?st.commandUsageDescription:ot.commandUsageDescription});e.inject([`shortcuts`],e=>{e.effect(()=>{try{let n=e.shortcuts.register({id:`usage-billing.open-dashboard`,label:()=>Le()===`en`?st.shortcutOpenDashboard:ot.shortcutOpenDashboard,aliases:[`usage`,`billing`,`dashboard`],defaults:{"desktop:macos":{code:`KeyD`,modifiers:[`primary`,`shift`]},"desktop:windows":{code:`KeyD`,modifiers:[`primary`,`shift`]},"desktop:linux":{code:`KeyD`,modifiers:[`primary`,`shift`]},"web:macos":{code:`KeyD`,modifiers:[`primary`,`shift`]},"web:windows":{code:`KeyD`,modifiers:[`primary`,`shift`]}},regions:[`page`,`editable`],modals:[],resolve:()=>({status:`handled`,run:()=>{t.openDashboard()}})});return()=>{n()}}catch(e){return x(`shortcut-register-failed`,e),()=>{}}},`ui-usage-billing: dashboard shortcut`)});let a=!1,o={store:n,inject:()=>({checkModels:async()=>{try{let[t,n]=await Promise.all([e.remote.llm.listProviders(),e.remote.llm.listConfigurableProviders()]);if(!t.ok||!n.ok)return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]};let r=new Map(n.value.map(e=>[e.provider,e])),i=await Promise.all(t.value.map(async t=>{let n=r.get(t.id);if(n===void 0)return{provider:t,models:[]};let i=await e.remote.llm.discoverModels(n.settingsNs,{provider:t.id});return i.ok?{provider:t,models:i.value}:{provider:t,failed:!0}})),a=[],o=[],s=[],c=0;for(let e of i){if(`failed`in e){s.push(e.provider.name);continue}o.push(e.provider.name),c+=e.models.length;for(let t of e.models)a.push({id:t.id,...typeof t.name==`string`&&t.name!==``?{name:t.name}:{},provider:e.provider.name})}return{checked:!0,available:o.length>0,models:c,failures:s.length,okProviders:o,badProviders:s,catalog:a}}catch{return{checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]}}},publishCosts:e=>{t.publishCosts(e)},registerOpen:e=>t.registerOpen(e),recoveryEntryAvailable:i()||a,navigateToSession:e=>r.open(e),sessionTitleOf:t=>{try{let n=e.sessions.list;if(n===void 0)return;let r=n.getSnapshot().byId?.[t],i=r?.displayTitle??r?.title;return typeof i==`string`&&i.trim()!==``?i:void 0}catch{return}}})};e.slots.inject(`settings.section`,()=>{a=!0;let t=e.slots.register({name:`settings.section`,id:`usage-billing`,order:30,label:()=>Le()===`en`?st.nativeSettingsNav:ot.nativeSettingsNav,locale:at,...o},Fa);return()=>{a=!1,t()}}),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:25,locale:at,...o,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}}},Pa)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:at,inject:e=>({sessionId:_(e),seat:`below`})},Ya)),e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`usage-billing-cost-above`,order:100,locale:at,inject:e=>({sessionId:_(e),seat:`above`})},Ya)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:at,inject:e=>({sessionId:_(e)})},Xa)),e.slots.inject(`conversation.input.left`,()=>e.slots.register({name:`conversation.input.left`,id:`usage-billing-quick-queue-toggle`,order:20,locale:at},io)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-quick-queue-enqueue`,order:20,locale:at,inject:t=>({sessionId:_(t),projectionFaceOf:n=>{try{return e.sessions.binding?.(_(t))?.session.projections.faceOf(n)}catch{return}}})},oo)),e.effect(()=>fo(e.sessions.list,lo),`ui-usage-billing: completion notifier`)}return n.UsageBilling=Pa,n.apply=vo,n.inject=_o,t.exports}});
|
|
6
6
|
//# sourceMappingURL=client.js.map
|