@kenz1117/dsh-ui-usage-billing 1.7.1 → 1.7.2
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 +7 -5
- package/README.md +7 -5
- package/lib/client.js +2 -2
- package/lib/index.js +29 -0
- package/lib/types/client/domain/forecast.d.ts +8 -2
- package/lib/types/client/locales.d.ts +1 -1
- package/package.json +1 -1
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:[]},ee=`dsh.ui-usage-billing.float`;function E(){let e=()=>({...T,targets:[...T.targets]}),t=w(ee);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 D(e){S(ee,JSON.stringify(e))}let O={metric:`money`,span:`day`,showDelta:!0},k=`dsh.ui-usage-billing.card`;function te(){let e=w(k);if(typeof e!=`object`||!e)return{...O};let t=e;return{metric:t.metric===`tokens`?`tokens`:`money`,span:t.span===`week`||t.span===`month`?t.span:`day`,showDelta:t.showDelta!==!1}}function A(e){S(k,JSON.stringify(e))}let j=`dsh.ui-usage-billing.kpi-range`;function ne(){let e=C(j);return e===`today`||e===`7d`||e===`week`||e===`month`||e===`all`?e:`all`}function re(e){S(j,e)}let M={hideUnidentified:!0},ie=`dsh.ui-usage-billing.sites`;function ae(){let e=w(ie);return typeof e!=`object`||!e?{...M}:{hideUnidentified:e.hideUnidentified!==!1}}function oe(e){S(ie,JSON.stringify(e))}let se={show:!0,position:`toolbar`},ce=`dsh.ui-usage-billing.livecost`,le=`dsh.ui-usage-billing.livecost-pref`;function N(){let e=w(ce);if(typeof e!=`object`||!e)return{...se};let t=e;return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`||t.position===`below`?t.position:se.position}}function ue(e){S(ce,JSON.stringify(e))}let de=`dsh.ui-usage-billing.currency`,fe=`dsh.ui-usage-billing.currency-pref`;function pe(){let e=C(de);return e===`usd`||e===`cny`||e===`eur`?e:`cny`}function me(e){S(de,e)}let he=`dsh.ui-usage-billing.pinned`,ge=`dsh.ui-usage-billing.pinned-pref`;function _e(){let e=w(he);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[]}function ve(e){S(he,JSON.stringify(e))}let ye=`dsh.ui-usage-billing.provider-expanded`;function be(){let e=w(ye);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&/^(ch|sub|bal):/.test(e)):[]}function xe(e){S(ye,JSON.stringify(e))}let Se=`dsh.ui-usage-billing.providers-today`;function Ce(){return C(Se)===`1`}function we(e){S(Se,e?`1`:`0`)}let P=`dsh.ui-usage-billing.language`;function Te(){let e=C(P);if(e===`en`||e===`zh`)return e;let t=pe()===`usd`?`en`:`zh`;return F(t),t}function F(e){S(P,e)}function I(e){let t=_e(),n=t.includes(e)?t.filter(t=>t!==e):[...t,e];return ve(n),n}let L=`dsh.ui-usage-billing.prices`;function Ee(){let e=w(L);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 De(e){S(L,JSON.stringify(e))}let R={metric:`ttft`},Oe=`dsh.ui-usage-billing.perf`;function ke(){let e=w(Oe);if(typeof e!=`object`||!e)return{...R};let t=e;return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}function Ae(e){S(Oe,JSON.stringify(e))}let je=`dsh.ui-usage-billing.density`,Me=`dsh.ui-usage-billing.density-pref`;function Ne(){let e=C(je);return e===`compact`||e===`comfortable`?e:`default`}function Pe(e){S(je,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(Me,{detail:{density:e}}))}let Fe=`dsh.ui-usage-billing.motion`,z=`dsh.ui-usage-billing.motion-pref`;function Ie(){let e=C(Fe);return e===`off`||e===`subtle`?e:`rich`}function Le(e){S(Fe,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(z,{detail:{motion:e}}))}let Re=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Re)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=Re,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-density=compact]{--ds-density-pad-y:6px;--ds-density-pad-x:10px;--ds-density-row-h:26px;--ds-density-font:11.5px}[data-density=comfortable]{--ds-density-pad-y:14px;--ds-density-pad-x:18px;--ds-density-row-h:40px;--ds-density-font:13px}[data-density=compact] .KFXqYa_panel{padding:8px 10px}[data-density=compact] .KFXqYa_kpiTile{padding:10px 12px}[data-density=compact] .KFXqYa_setCard{padding:10px 12px}[data-density=compact] .KFXqYa_ubCard{padding:10px 12px}[data-density=compact] .KFXqYa_providerGroup{padding:8px 10px}[data-density=compact] .KFXqYa_providerStatRow{gap:8px;padding:6px 8px}[data-density=compact] .KFXqYa_modelTable th,[data-density=compact] .KFXqYa_modelTable td{padding:6px 8px}[data-density=compact] .KFXqYa_ubTable th,[data-density=compact] .KFXqYa_ubTable td{padding:4px 7px}[data-density=compact] .KFXqYa_dashboardBody{gap:10px;padding:12px 16px 16px}[data-density=compact] .KFXqYa_tabNav{margin:10px 16px 0}[data-density=compact] .KFXqYa_hero{gap:8px;padding:12px 14px}[data-density=compact] .KFXqYa_heroValue{font-size:42px;line-height:46px}[data-density=comfortable] .KFXqYa_panel{padding:16px 18px}[data-density=comfortable] .KFXqYa_kpiTile{padding:18px 20px}[data-density=comfortable] .KFXqYa_setCard{padding:20px 22px}[data-density=comfortable] .KFXqYa_ubCard{padding:20px 22px}[data-density=comfortable] .KFXqYa_providerGroup{padding:16px 18px}[data-density=comfortable] .KFXqYa_providerStatRow{gap:14px;padding:14px 16px}[data-density=comfortable] .KFXqYa_modelTable th,[data-density=comfortable] .KFXqYa_modelTable td{padding:13px 14px}[data-density=comfortable] .KFXqYa_ubTable th,[data-density=comfortable] .KFXqYa_ubTable td{padding:10px 12px}[data-density=comfortable] .KFXqYa_dashboardBody{gap:18px;padding:20px 28px 28px}[data-density=comfortable] .KFXqYa_hero{gap:16px;padding:22px 24px}[data-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-motion=off] *,[data-motion=off] :before,[data-motion=off] :after{transition:none!important;animation:none!important}[data-motion=subtle] *,[data-motion=subtle] :before,[data-motion=subtle] :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{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_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_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_contextCard>*,.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_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_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_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_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{border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);backdrop-filter:blur(14px)saturate(1.3);color:var(--ds-t-2);font-size:11px;line-height:16px;font-family:var(--font-num);font-variant-numeric:tabular-nums;border-radius:999px;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;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_feeInline .KFXqYa_feeChipPrimary,.KFXqYa_feeInline .KFXqYa_feeChipOff{height:18px;padding:0 7px}.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{border:1px solid var(--ds-border);background:var(--dsb-3);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;align-items:center;height:20px;padding:0 8px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_feeChipPrimary{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 30%, transparent)}.KFXqYa_feeChipOff{color:var(--ds-cyan);border-color:color-mix(in srgb, var(--ds-cyan) 30%, transparent)}.KFXqYa_feeChipAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 30%, transparent)}.KFXqYa_feeChipError{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 30%, 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_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_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_contextCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-2);flex-direction:column;gap:6px;margin-bottom:12px;padding:10px 12px;display:flex}.KFXqYa_contextHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.KFXqYa_contextTitle{color:var(--ds-t-2);font-size:11px;font-weight:500}.KFXqYa_contextRatio{color:var(--ds-c-1);font-size:12px;font-weight:600}.KFXqYa_contextBar{background:var(--dsb-3);border-radius:3px;height:6px;position:relative;overflow:hidden}.KFXqYa_contextBarFill{background:var(--ds-c-1);border-radius:3px;height:100%;display:block}.KFXqYa_contextBody{align-items:baseline;gap:8px;display:flex}.KFXqYa_contextValue{color:var(--ds-t-1);font-size:18px;font-weight:600}.KFXqYa_contextHint{color:var(--ds-t-3);font-size:11px}.KFXqYa_contextStats{flex-wrap:wrap;gap:6px 18px;margin-top:2px;display:flex}.KFXqYa_contextStat{align-items:baseline;gap:6px;display:inline-flex}.KFXqYa_contextStatLabel{color:var(--ds-t-3);font-size:11px}.KFXqYa_contextStatValue{color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:12px}.KFXqYa_contextBreakdown{flex-direction:column;gap:5px;display:flex}.KFXqYa_contextBreakRow{align-items:center;gap:8px;display:flex}.KFXqYa_contextBreakLabel{color:var(--ds-t-3);flex:0 0 44px;font-size:11px}.KFXqYa_contextBreakTrack{background:var(--dsb-3);border-radius:2px;flex:60px;min-width:40px;height:4px;overflow:hidden}.KFXqYa_contextBreakFill{background:var(--ds-c-2);border-radius:2px;height:100%;display:block}.KFXqYa_contextBreakValue{color:var(--ds-t-2);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.KFXqYa_contextFootnote{color:var(--ds-t-4);margin:4px 0 0;font-size:10.5px;line-height:14px}.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 B={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`,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`,contextBar:`KFXqYa_contextBar`,contextBarFill:`KFXqYa_contextBarFill`,contextBody:`KFXqYa_contextBody`,contextBreakFill:`KFXqYa_contextBreakFill`,contextBreakLabel:`KFXqYa_contextBreakLabel`,contextBreakRow:`KFXqYa_contextBreakRow`,contextBreakTrack:`KFXqYa_contextBreakTrack`,contextBreakValue:`KFXqYa_contextBreakValue`,contextBreakdown:`KFXqYa_contextBreakdown`,contextCard:`KFXqYa_contextCard`,contextEmpty:`KFXqYa_contextEmpty`,contextFootnote:`KFXqYa_contextFootnote`,contextHead:`KFXqYa_contextHead`,contextHint:`KFXqYa_contextHint`,contextRatio:`KFXqYa_contextRatio`,contextStat:`KFXqYa_contextStat`,contextStatLabel:`KFXqYa_contextStatLabel`,contextStatValue:`KFXqYa_contextStatValue`,contextStats:`KFXqYa_contextStats`,contextTitle:`KFXqYa_contextTitle`,contextValue:`KFXqYa_contextValue`,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`,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`,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`,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`,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`,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`,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`,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 ze=`usageBilling`,Be={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,liveSessionSub:`含子 {cost}`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,kpiRange:`统计范围`,avgRangeToday:`今日`,avgRange7d:`近7天`,avgRangeWeek:`本周`,avgRangeMonth:`本月`,avgRangeAll:`累计`,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:`切换左下角计费卡的主指标与主数字统计范围(迷你柱跟随视角,悬浮窗不受影响);「今日环比」徽章太醒目可在此隐藏。`,cardMetric:`主指标`,cardMetricMoney:`金额`,cardMetricTokens:`Token`,cardSpan:`统计范围`,cardSpanDay:`日`,cardSpanWeek:`周`,cardSpanMonth:`月`,cardDeltaBadge:`今日环比徽章`,cardDeltaShow:`显示`,cardDeltaHide:`隐藏`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,balanceStaleNotice:`余额刷新较慢,以下为上一次查询结果`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,staleSnapshotNotice:`用量正在重算,以下数据来自上一次计算(可能不是最新,会话标题等以工作区为准)`,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 折抵扣`,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} 个会话`,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 计`,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:`当前宿主不支持会话跳转`,contextOccupancy:`上下文占用`,contextWindow:`窗口上限 {window}`,contextSystem:`系统`,contextTools:`工具`,contextMessages:`消息`,contextNoData:`上下文占用跟随**当前打开的对话**——请先在一个会话里打开本面板;宿主未上报该投影时同样为空。`,tabContext:`上下文`,tabAgents:`智能体`,contextNextRequest:`下一次请求占用`,contextLastRequest:`最近一次请求占用`,contextComposition:`上下文构成`,contextCompositionHint:`构成项为启发式 token 估算,三项之和不等于下一次请求占用`,agentsSummary:`智能体网络`,agentsCount:`智能体`,agentsDelegations:`委派`,agentsRoots:`对话`,agentsMostExpensive:`最贵的一支`,agentsChainTotal:`链合计`,agentsNoData:`暂无子智能体委派记录`,agentsSubagent:`子智能体`,agentsRoot:`对话`},Ve={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,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`,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:`Switch the bottom-left billing card between cost and token usage, and pick the figure range (sparkline follows; the popover is unaffected). The day-over-day badge can be hidden here.`,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); attribution may be off`,staleSnapshotNotice:`Usage is being recomputed; the figures below come from the last completed calculation (session titles may lag the workspace)`,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`,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`,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`,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`,contextOccupancy:`Context occupancy`,contextWindow:`Window {window}`,contextSystem:`System`,contextTools:`Tools`,contextMessages:`Messages`,contextNoData:`Context occupancy follows the **conversation you currently have open** — open this panel from within a session; it stays empty when the host serves no such projection.`,tabContext:`Context`,tabAgents:`Agents`,contextNextRequest:`Next request occupancy`,contextLastRequest:`Last request occupancy`,contextComposition:`Context composition`,contextCompositionHint:`Composition figures are heuristic token estimates; the three do not sum to the next request occupancy`,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`},He={"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`}},Ue={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 We(e){return e===``?e:Ue[e]??e}function Ge(e){let t=He[We(e)];return t?.type===`code`?t.tier:void 0}let Ke=[{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}],qe,Je,Ye,Xe,Ze,V;function H(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function Qe(e,t){return H(e)===H(t)}function $e(e){V=e.length>0?e:void 0}function et(){return V}function tt(e){return Bt(e)}function nt(e,t){let n=rt(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 rt(e,t){if(V===void 0)return;let n=tt(e),r=W(n),i=e=>tt(e.key)===n||W(e.key)===r;if(t!==void 0){for(let e of V)if(e.origin!==void 0&&e.origin!==``&&i(e)&&Qe(e.origin,t))return e}for(let e of V)if((e.origin===void 0||e.origin===``)&&i(e))return e}function it(e){if(V===void 0)return;let t=tt(e),n=W(t);return V.find(e=>e.origin!==void 0&&e.origin!==``&&(tt(e.key)===t||W(e.key)===n))}function at(e){qe=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,Je=typeof e.rateEur==`number`&&Number.isFinite(e.rateEur)&&e.rateEur>0?e.rateEur:void 0,Ye=e.prices,Xe=e.extraModels}function ot(e){Ze=e}function st(){return qe??6.79}function ct(){return Je??7.71}function lt(){return{rate:st(),live:qe!==void 0}}function ut(){return{rate:ct(),live:Je!==void 0}}let U=.5;function dt(e){return e==null||!Number.isFinite(e)?`peak`:ft(e,gt,!0)}function ft(e,t,n=!1){if(pt(e)||n&&ht(e))return`offPeak`;let r=Math.floor(vt(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 pt(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 ht(e){return`20260925 20260926 20260927 20261001 20261002 20261003 20261004 20261005 20261006 20261007`.includes(mt(e))}let gt=[540,720,840,1080],_t=[840,1080];function vt(e){return((e+288e5)%864e5+864e5)%864e5}function yt(e,t,n=!1){let r=ft(e,t,n),i=vt(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)&&ft(e+a,t,n)!==r)return{tier:r,nextSwitchInMs:a}}}let a=t[0]??0;return{tier:r,nextSwitchInMs:864e5-i+a*6e4}}function bt(e,t,n,r=!1){let{nextSwitchInMs:i}=yt(e,t,r);if(i>n)return null;let a=e+i;return{entering:ft(a,t,r),atMs:a}}function xt(e,t){if(e===void 0||e===``)return`none`;let n=Bt(e),r=Ot().find(e=>e.key===n)?.provider;return r===`DeepSeek`?`deepseek-metered`:t&&r===`智谱 AI`?`zhipu-coding-plan`:`none`}function St(e,t){switch(t){case`deepseek-metered`:return yt(e,gt,!0);case`zhipu-coding-plan`:return yt(e,_t);case`none`:return null}}function Ct(e,t,n){switch(t){case`deepseek-metered`:return bt(e,gt,n,!0);case`zhipu-coding-plan`:return bt(e,_t,n);case`none`:return null}}function wt(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 Tt=[],Et={};function Dt(e,t){Tt=e,Et=t,jt=void 0}function Ot(){return Tt}function kt(){return Et}let At={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 Mt(){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 Tt)t(e.key,e.key);for(let[e,n]of Object.entries(Et))t(e,n);for(let e of Ke)t(e.key,e.key);return jt=e,e}let G,Nt,Pt;function Ft(){if(G===Xe)return;let e=new Map,t=new Map;for(let n of Xe??[]){t.has(n.key)||t.set(n.key,n);let r=W(n.key);r!==``&&!e.has(r)&&e.set(r,n)}G=Xe,Nt=e,Pt=t}function It(){return Ft(),Nt??new Map}function Lt(){return Ft(),Pt??new Map}function Rt(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)}return r(e),t}function zt(e){let t=kt()[e];if(t!==void 0)return t;let n=W(e);if(n===``)return;let r=Mt().get(n);return r===void 0?It().get(n)?.key:r}function Bt(e){let t=kt()[e]??e;if(t===e){let t=W(e);if(t!==``){let e=Mt().get(t);if(e!==void 0)return e;let n=It().get(t);if(n!==void 0)return n.key}for(let t of Rt(e)){let e=zt(t);if(e!==void 0)return e}}return t}function Vt(e){let t=Bt(e),n=Ye?.[t];if(n!==void 0)return n;let r=Ke.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function Ht(e){let t=Bt(e),n=Ot().find(e=>e.key===t),r=Lt().get(t),i=n??(r===void 0?Ot().find(e=>e.key===`other`)??At:Ut(r)),a=nt(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=Vt(t);return o===void 0||i.price.offPeak!==void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function Ut(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}}}function Wt(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>=0&&e.factor<1}function Gt(e,t){let{promo:n}=e;if(n===void 0||!Wt(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`)},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 Kt(e=Date.now()){let t=[...Ot().filter(e=>e.retired!==!0).map(t=>Gt(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>W(e.key)));for(let e of Ze??[]){let i=e.id.toLowerCase();if((()=>{let t=Bt(e.id);return Ot().find(e=>e.key===t)})()!==void 0)continue;let a=W(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=It().get(a),s;if(o!==void 0)s=Ut(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=Vt(i);s=t===void 0?{key:Bt(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=nt(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 qt(e,t,n){let r=t.cacheMiss>0?t.cacheMiss:Math.max(0,t.input-t.cacheHit),i=Math.min(t.cacheHit,t.input),a=(r*(e.cacheMiss??e.input)+i*e.cacheHit+t.output*e.output)/1e6;return n===`USD`?a*st():a}function Jt(e,t,n=U,r=Date.now()){let i=Gt(e,r),a=qt(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:qt(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function Yt(e){let t=st();return t>0?e/t:e}function Xt(e,t){if(t===`usd`)return Yt(e);if(t===`eur`){let t=ct();return t>0?e/t:e}return e}function K(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 Zt(e,t=`CNY`){return`${t===`USD`?`$`:t===`EUR`?`€`:`¥`}${e.toFixed(e>=10?1:2)}`}function Qt(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=ut().rate;return a>0?i/a:i}function q(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 J(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 $t(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}function en(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function tn(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function nn(e){return e.toFixed(2)}function rn(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,nn(n.cost)].join(`,`)})].join(`
|
|
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:[]},ee=`dsh.ui-usage-billing.float`;function E(){let e=()=>({...T,targets:[...T.targets]}),t=w(ee);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 D(e){S(ee,JSON.stringify(e))}let O={metric:`money`,span:`day`,showDelta:!0},k=`dsh.ui-usage-billing.card`;function te(){let e=w(k);if(typeof e!=`object`||!e)return{...O};let t=e;return{metric:t.metric===`tokens`?`tokens`:`money`,span:t.span===`week`||t.span===`month`?t.span:`day`,showDelta:t.showDelta!==!1}}function A(e){S(k,JSON.stringify(e))}let j=`dsh.ui-usage-billing.kpi-range`;function ne(){let e=C(j);return e===`today`||e===`7d`||e===`week`||e===`month`||e===`all`?e:`all`}function re(e){S(j,e)}let M={hideUnidentified:!0},ie=`dsh.ui-usage-billing.sites`;function ae(){let e=w(ie);return typeof e!=`object`||!e?{...M}:{hideUnidentified:e.hideUnidentified!==!1}}function oe(e){S(ie,JSON.stringify(e))}let se={show:!0,position:`toolbar`},ce=`dsh.ui-usage-billing.livecost`,le=`dsh.ui-usage-billing.livecost-pref`;function N(){let e=w(ce);if(typeof e!=`object`||!e)return{...se};let t=e;return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`||t.position===`below`?t.position:se.position}}function ue(e){S(ce,JSON.stringify(e))}let de=`dsh.ui-usage-billing.currency`,fe=`dsh.ui-usage-billing.currency-pref`;function pe(){let e=C(de);return e===`usd`||e===`cny`||e===`eur`?e:`cny`}function me(e){S(de,e)}let he=`dsh.ui-usage-billing.pinned`,ge=`dsh.ui-usage-billing.pinned-pref`;function _e(){let e=w(he);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e!==``):[]}function ve(e){S(he,JSON.stringify(e))}let ye=`dsh.ui-usage-billing.provider-expanded`;function be(){let e=w(ye);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&/^(ch|sub|bal):/.test(e)):[]}function xe(e){S(ye,JSON.stringify(e))}let Se=`dsh.ui-usage-billing.providers-today`;function Ce(){return C(Se)===`1`}function we(e){S(Se,e?`1`:`0`)}let P=`dsh.ui-usage-billing.language`;function Te(){let e=C(P);if(e===`en`||e===`zh`)return e;let t=pe()===`usd`?`en`:`zh`;return F(t),t}function F(e){S(P,e)}function I(e){let t=_e(),n=t.includes(e)?t.filter(t=>t!==e):[...t,e];return ve(n),n}let L=`dsh.ui-usage-billing.prices`;function Ee(){let e=w(L);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 De(e){S(L,JSON.stringify(e))}let R={metric:`ttft`},Oe=`dsh.ui-usage-billing.perf`;function ke(){let e=w(Oe);if(typeof e!=`object`||!e)return{...R};let t=e;return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}function Ae(e){S(Oe,JSON.stringify(e))}let je=`dsh.ui-usage-billing.density`,Me=`dsh.ui-usage-billing.density-pref`;function Ne(){let e=C(je);return e===`compact`||e===`comfortable`?e:`default`}function Pe(e){S(je,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(Me,{detail:{density:e}}))}let Fe=`dsh.ui-usage-billing.motion`,z=`dsh.ui-usage-billing.motion-pref`;function Ie(){let e=C(Fe);return e===`off`||e===`subtle`?e:`rich`}function Le(e){S(Fe,e),typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(z,{detail:{motion:e}}))}let Re=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Re)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=Re,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-density=compact]{--ds-density-pad-y:6px;--ds-density-pad-x:10px;--ds-density-row-h:26px;--ds-density-font:11.5px}[data-density=comfortable]{--ds-density-pad-y:14px;--ds-density-pad-x:18px;--ds-density-row-h:40px;--ds-density-font:13px}[data-density=compact] .KFXqYa_panel{padding:8px 10px}[data-density=compact] .KFXqYa_kpiTile{padding:10px 12px}[data-density=compact] .KFXqYa_setCard{padding:10px 12px}[data-density=compact] .KFXqYa_ubCard{padding:10px 12px}[data-density=compact] .KFXqYa_providerGroup{padding:8px 10px}[data-density=compact] .KFXqYa_providerStatRow{gap:8px;padding:6px 8px}[data-density=compact] .KFXqYa_modelTable th,[data-density=compact] .KFXqYa_modelTable td{padding:6px 8px}[data-density=compact] .KFXqYa_ubTable th,[data-density=compact] .KFXqYa_ubTable td{padding:4px 7px}[data-density=compact] .KFXqYa_dashboardBody{gap:10px;padding:12px 16px 16px}[data-density=compact] .KFXqYa_tabNav{margin:10px 16px 0}[data-density=compact] .KFXqYa_hero{gap:8px;padding:12px 14px}[data-density=compact] .KFXqYa_heroValue{font-size:42px;line-height:46px}[data-density=comfortable] .KFXqYa_panel{padding:16px 18px}[data-density=comfortable] .KFXqYa_kpiTile{padding:18px 20px}[data-density=comfortable] .KFXqYa_setCard{padding:20px 22px}[data-density=comfortable] .KFXqYa_ubCard{padding:20px 22px}[data-density=comfortable] .KFXqYa_providerGroup{padding:16px 18px}[data-density=comfortable] .KFXqYa_providerStatRow{gap:14px;padding:14px 16px}[data-density=comfortable] .KFXqYa_modelTable th,[data-density=comfortable] .KFXqYa_modelTable td{padding:13px 14px}[data-density=comfortable] .KFXqYa_ubTable th,[data-density=comfortable] .KFXqYa_ubTable td{padding:10px 12px}[data-density=comfortable] .KFXqYa_dashboardBody{gap:18px;padding:20px 28px 28px}[data-density=comfortable] .KFXqYa_hero{gap:16px;padding:22px 24px}[data-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-motion=off] *,[data-motion=off] :before,[data-motion=off] :after{transition:none!important;animation:none!important}[data-motion=subtle] *,[data-motion=subtle] :before,[data-motion=subtle] :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{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_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_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_contextCard>*,.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_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_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_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_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{border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);backdrop-filter:blur(14px)saturate(1.3);color:var(--ds-t-2);font-size:11px;line-height:16px;font-family:var(--font-num);font-variant-numeric:tabular-nums;border-radius:999px;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;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_feeInline .KFXqYa_feeChipPrimary,.KFXqYa_feeInline .KFXqYa_feeChipOff{height:18px;padding:0 7px}.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{border:1px solid var(--ds-border);background:var(--dsb-3);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;align-items:center;height:20px;padding:0 8px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_feeChipPrimary{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 30%, transparent)}.KFXqYa_feeChipOff{color:var(--ds-cyan);border-color:color-mix(in srgb, var(--ds-cyan) 30%, transparent)}.KFXqYa_feeChipAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 30%, transparent)}.KFXqYa_feeChipError{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 30%, 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_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_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_contextCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-2);flex-direction:column;gap:6px;margin-bottom:12px;padding:10px 12px;display:flex}.KFXqYa_contextHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.KFXqYa_contextTitle{color:var(--ds-t-2);font-size:11px;font-weight:500}.KFXqYa_contextRatio{color:var(--ds-c-1);font-size:12px;font-weight:600}.KFXqYa_contextBar{background:var(--dsb-3);border-radius:3px;height:6px;position:relative;overflow:hidden}.KFXqYa_contextBarFill{background:var(--ds-c-1);border-radius:3px;height:100%;display:block}.KFXqYa_contextBody{align-items:baseline;gap:8px;display:flex}.KFXqYa_contextValue{color:var(--ds-t-1);font-size:18px;font-weight:600}.KFXqYa_contextHint{color:var(--ds-t-3);font-size:11px}.KFXqYa_contextStats{flex-wrap:wrap;gap:6px 18px;margin-top:2px;display:flex}.KFXqYa_contextStat{align-items:baseline;gap:6px;display:inline-flex}.KFXqYa_contextStatLabel{color:var(--ds-t-3);font-size:11px}.KFXqYa_contextStatValue{color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:12px}.KFXqYa_contextBreakdown{flex-direction:column;gap:5px;display:flex}.KFXqYa_contextBreakRow{align-items:center;gap:8px;display:flex}.KFXqYa_contextBreakLabel{color:var(--ds-t-3);flex:0 0 44px;font-size:11px}.KFXqYa_contextBreakTrack{background:var(--dsb-3);border-radius:2px;flex:60px;min-width:40px;height:4px;overflow:hidden}.KFXqYa_contextBreakFill{background:var(--ds-c-2);border-radius:2px;height:100%;display:block}.KFXqYa_contextBreakValue{color:var(--ds-t-2);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.KFXqYa_contextFootnote{color:var(--ds-t-4);margin:4px 0 0;font-size:10.5px;line-height:14px}.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 B={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`,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`,contextBar:`KFXqYa_contextBar`,contextBarFill:`KFXqYa_contextBarFill`,contextBody:`KFXqYa_contextBody`,contextBreakFill:`KFXqYa_contextBreakFill`,contextBreakLabel:`KFXqYa_contextBreakLabel`,contextBreakRow:`KFXqYa_contextBreakRow`,contextBreakTrack:`KFXqYa_contextBreakTrack`,contextBreakValue:`KFXqYa_contextBreakValue`,contextBreakdown:`KFXqYa_contextBreakdown`,contextCard:`KFXqYa_contextCard`,contextEmpty:`KFXqYa_contextEmpty`,contextFootnote:`KFXqYa_contextFootnote`,contextHead:`KFXqYa_contextHead`,contextHint:`KFXqYa_contextHint`,contextRatio:`KFXqYa_contextRatio`,contextStat:`KFXqYa_contextStat`,contextStatLabel:`KFXqYa_contextStatLabel`,contextStatValue:`KFXqYa_contextStatValue`,contextStats:`KFXqYa_contextStats`,contextTitle:`KFXqYa_contextTitle`,contextValue:`KFXqYa_contextValue`,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`,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`,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`,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`,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`,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`,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`,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 ze=`usageBilling`,Be={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:`累计`,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:`切换左下角计费卡的主指标与主数字统计范围(迷你柱跟随视角,悬浮窗不受影响);「今日环比」徽章太醒目可在此隐藏。`,cardMetric:`主指标`,cardMetricMoney:`金额`,cardMetricTokens:`Token`,cardSpan:`统计范围`,cardSpanDay:`日`,cardSpanWeek:`周`,cardSpanMonth:`月`,cardDeltaBadge:`今日环比徽章`,cardDeltaShow:`显示`,cardDeltaHide:`隐藏`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,balanceStaleNotice:`余额刷新较慢,以下为上一次查询结果`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,staleSnapshotNotice:`用量正在重算,以下数据来自上一次计算(可能不是最新,会话标题等以工作区为准)`,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 折抵扣`,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} 个会话`,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 计`,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:`当前宿主不支持会话跳转`,contextOccupancy:`上下文占用`,contextWindow:`窗口上限 {window}`,contextSystem:`系统`,contextTools:`工具`,contextMessages:`消息`,contextNoData:`上下文占用跟随**当前打开的对话**——请先在一个会话里打开本面板;宿主未上报该投影时同样为空。`,tabContext:`上下文`,tabAgents:`智能体`,contextNextRequest:`下一次请求占用`,contextLastRequest:`最近一次请求占用`,contextComposition:`上下文构成`,contextCompositionHint:`构成项为启发式 token 估算,三项之和不等于下一次请求占用`,agentsSummary:`智能体网络`,agentsCount:`智能体`,agentsDelegations:`委派`,agentsRoots:`对话`,agentsMostExpensive:`最贵的一支`,agentsChainTotal:`链合计`,agentsNoData:`暂无子智能体委派记录`,agentsSubagent:`子智能体`,agentsRoot:`对话`},Ve={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`,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:`Switch the bottom-left billing card between cost and token usage, and pick the figure range (sparkline follows; the popover is unaffected). The day-over-day badge can be hidden here.`,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); attribution may be off`,staleSnapshotNotice:`Usage is being recomputed; the figures below come from the last completed calculation (session titles may lag the workspace)`,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`,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`,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`,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`,contextOccupancy:`Context occupancy`,contextWindow:`Window {window}`,contextSystem:`System`,contextTools:`Tools`,contextMessages:`Messages`,contextNoData:`Context occupancy follows the **conversation you currently have open** — open this panel from within a session; it stays empty when the host serves no such projection.`,tabContext:`Context`,tabAgents:`Agents`,contextNextRequest:`Next request occupancy`,contextLastRequest:`Last request occupancy`,contextComposition:`Context composition`,contextCompositionHint:`Composition figures are heuristic token estimates; the three do not sum to the next request occupancy`,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`},He={"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`}},Ue={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 We(e){return e===``?e:Ue[e]??e}function Ge(e){let t=He[We(e)];return t?.type===`code`?t.tier:void 0}let Ke=[{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}],qe,Je,Ye,Xe,Ze,V;function H(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function Qe(e,t){return H(e)===H(t)}function $e(e){V=e.length>0?e:void 0}function et(){return V}function tt(e){return Bt(e)}function nt(e,t){let n=rt(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 rt(e,t){if(V===void 0)return;let n=tt(e),r=W(n),i=e=>tt(e.key)===n||W(e.key)===r;if(t!==void 0){for(let e of V)if(e.origin!==void 0&&e.origin!==``&&i(e)&&Qe(e.origin,t))return e}for(let e of V)if((e.origin===void 0||e.origin===``)&&i(e))return e}function it(e){if(V===void 0)return;let t=tt(e),n=W(t);return V.find(e=>e.origin!==void 0&&e.origin!==``&&(tt(e.key)===t||W(e.key)===n))}function at(e){qe=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,Je=typeof e.rateEur==`number`&&Number.isFinite(e.rateEur)&&e.rateEur>0?e.rateEur:void 0,Ye=e.prices,Xe=e.extraModels}function ot(e){Ze=e}function st(){return qe??6.79}function ct(){return Je??7.71}function lt(){return{rate:st(),live:qe!==void 0}}function ut(){return{rate:ct(),live:Je!==void 0}}let U=.5;function dt(e){return e==null||!Number.isFinite(e)?`peak`:ft(e,gt,!0)}function ft(e,t,n=!1){if(pt(e)||n&&ht(e))return`offPeak`;let r=Math.floor(vt(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 pt(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 ht(e){return`20260925 20260926 20260927 20261001 20261002 20261003 20261004 20261005 20261006 20261007`.includes(mt(e))}let gt=[540,720,840,1080],_t=[840,1080];function vt(e){return((e+288e5)%864e5+864e5)%864e5}function yt(e,t,n=!1){let r=ft(e,t,n),i=vt(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)&&ft(e+a,t,n)!==r)return{tier:r,nextSwitchInMs:a}}}let a=t[0]??0;return{tier:r,nextSwitchInMs:864e5-i+a*6e4}}function bt(e,t,n,r=!1){let{nextSwitchInMs:i}=yt(e,t,r);if(i>n)return null;let a=e+i;return{entering:ft(a,t,r),atMs:a}}function xt(e,t){if(e===void 0||e===``)return`none`;let n=Bt(e),r=Ot().find(e=>e.key===n)?.provider;return r===`DeepSeek`?`deepseek-metered`:t&&r===`智谱 AI`?`zhipu-coding-plan`:`none`}function St(e,t){switch(t){case`deepseek-metered`:return yt(e,gt,!0);case`zhipu-coding-plan`:return yt(e,_t);case`none`:return null}}function Ct(e,t,n){switch(t){case`deepseek-metered`:return bt(e,gt,n,!0);case`zhipu-coding-plan`:return bt(e,_t,n);case`none`:return null}}function wt(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 Tt=[],Et={};function Dt(e,t){Tt=e,Et=t,jt=void 0}function Ot(){return Tt}function kt(){return Et}let At={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 Mt(){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 Tt)t(e.key,e.key);for(let[e,n]of Object.entries(Et))t(e,n);for(let e of Ke)t(e.key,e.key);return jt=e,e}let G,Nt,Pt;function Ft(){if(G===Xe)return;let e=new Map,t=new Map;for(let n of Xe??[]){t.has(n.key)||t.set(n.key,n);let r=W(n.key);r!==``&&!e.has(r)&&e.set(r,n)}G=Xe,Nt=e,Pt=t}function It(){return Ft(),Nt??new Map}function Lt(){return Ft(),Pt??new Map}function Rt(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)}return r(e),t}function zt(e){let t=kt()[e];if(t!==void 0)return t;let n=W(e);if(n===``)return;let r=Mt().get(n);return r===void 0?It().get(n)?.key:r}function Bt(e){let t=kt()[e]??e;if(t===e){let t=W(e);if(t!==``){let e=Mt().get(t);if(e!==void 0)return e;let n=It().get(t);if(n!==void 0)return n.key}for(let t of Rt(e)){let e=zt(t);if(e!==void 0)return e}}return t}function Vt(e){let t=Bt(e),n=Ye?.[t];if(n!==void 0)return n;let r=Ke.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function Ht(e){let t=Bt(e),n=Ot().find(e=>e.key===t),r=Lt().get(t),i=n??(r===void 0?Ot().find(e=>e.key===`other`)??At:Ut(r)),a=nt(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=Vt(t);return o===void 0||i.price.offPeak!==void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function Ut(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}}}function Wt(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>=0&&e.factor<1}function Gt(e,t){let{promo:n}=e;if(n===void 0||!Wt(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`)},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 Kt(e=Date.now()){let t=[...Ot().filter(e=>e.retired!==!0).map(t=>Gt(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>W(e.key)));for(let e of Ze??[]){let i=e.id.toLowerCase();if((()=>{let t=Bt(e.id);return Ot().find(e=>e.key===t)})()!==void 0)continue;let a=W(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=It().get(a),s;if(o!==void 0)s=Ut(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=Vt(i);s=t===void 0?{key:Bt(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=nt(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 qt(e,t,n){let r=t.cacheMiss>0?t.cacheMiss:Math.max(0,t.input-t.cacheHit),i=Math.min(t.cacheHit,t.input),a=(r*(e.cacheMiss??e.input)+i*e.cacheHit+t.output*e.output)/1e6;return n===`USD`?a*st():a}function Jt(e,t,n=U,r=Date.now()){let i=Gt(e,r),a=qt(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:qt(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function Yt(e){let t=st();return t>0?e/t:e}function Xt(e,t){if(t===`usd`)return Yt(e);if(t===`eur`){let t=ct();return t>0?e/t:e}return e}function K(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 Zt(e,t=`CNY`){return`${t===`USD`?`$`:t===`EUR`?`€`:`¥`}${e.toFixed(e>=10?1:2)}`}function Qt(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=ut().rate;return a>0?i/a:i}function q(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 J(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 $t(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}function en(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function tn(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function nn(e){return e.toFixed(2)}function rn(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,nn(n.cost)].join(`,`)})].join(`
|
|
2
2
|
`)}function an(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[en(tn(n)),r,t.calls,nn(t.cost)].join(`,`)})].join(`
|
|
3
3
|
`)}function on(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function sn(e){return[`session_id,title,project,calls,cost_cny,last_active,parent_id,sub_calls,sub_cost_cny`,...e.map(e=>[en(tn(e.id)),en(tn(e.title??``)),en(tn(on(e.cwd))),e.calls,nn(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``,e.parentId??``,e.subCalls??``,e.subCost===void 0?``:nn(e.subCost)].join(`,`))].join(`
|
|
4
4
|
`)}function cn(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 ln(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 un(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let Y={top:14,right:18,bottom:22,left:46},dn=`var(--ds-blue)`,fn=`var(--ds-cyan)`,pn=`var(--ds-amber)`;function mn(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function hn(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:B.shareSegUser},{label:i(`roleAssistant`),value:e.assistant,seg:B.shareSegAssistant},{label:i(`roleTool`),value:e.tool,seg:B.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=q(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=q(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??Ht(e).name,color:o.find(t=>t.key===e)?.color??`#8b95a3`}))},[C,o]),T=g!==null&&w.some(e=>e.key===g)?g:null,ee=e=>{if(v){if(p!==`model`){h(`model`),_(e);return}_(t=>t===e?null:e)}},E=(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:Ht(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]),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-Y.left-Y.right,n=200-Y.top-Y.bottom,r=Math.max(...p===`model`?C.map(e=>e.total):S.map(e=>e.miss+e.hit+e.output),1),i=e=>Y.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?Y.left+t/2:Y.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]),k=()=>{ln(`token-daily-${q()}.csv`,gn(S),`text/csv`)},te=()=>{ln(`token-${q()}.json`,mn(S,E,C,l),`application/json`)},A=u===null?void 0:S[u],j=u===null?void 0:C[u],ne=O===null?0:Math.ceil(80/Math.max(O.groupW,1)),re=u===null||O===null?void 0:u>=O.n-ne?B.chartTooltipAlignRight:u<ne?B.chartTooltipAlignLeft:void 0;return(0,m.jsxs)(`div`,{className:B.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,m.jsxs)(`div`,{className:B.exportBar,role:`group`,"aria-label":i(`tokenExport`),children:[(0,m.jsx)(`span`,{className:B.exportLabel,children:i(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-token-export-csv`,onClick:k,children:i(`tokenExportCsv`)}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-token-export-json`,onClick:te,children:i(`exportJson`)})]}),(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-token-daily`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:i(`tokenDaily`)}),(0,m.jsxs)(`span`,{className:B.panelHeadControls,children:[v&&(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":i(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,p===e&&B.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:B.rangeToggle,role:`group`,"aria-label":i(`tokenDaily`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,n===e&&B.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:B.chartEmpty,children:i(`trendEmpty`)}):(0,m.jsxs)(`div`,{className:B.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:B.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-Y.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:Y.left,x2:680-Y.right,y1:n,y2:n,className:B.chartGrid}),(0,m.jsx)(`text`,{x:Y.left-8,y:n+3,textAnchor:`end`,className:B.chartAxisLabel,children:un(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:dn}),(0,m.jsx)(`rect`,{x:n,y:a,width:O.barW,height:i-a,fill:fn}),(0,m.jsx)(`rect`,{x:n,y:o,width:O.barW,height:a-o,fill:pn})]},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:B.chartAxisLabel,children:t.date.slice(5)},t.date)}),u!==null&&(0,m.jsx)(`line`,{x1:O.inner(u),x2:O.inner(u),y1:Y.top,y2:Y.top+O.plotH,className:B.chartCrosshair})]}),u!==null&&p===`structure`&&A!==void 0&&(0,m.jsxs)(`div`,{className:y(B.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:B.chartTooltipHead,children:[(0,m.jsx)(`span`,{className:B.chartTooltipDate,children:A.date}),(0,m.jsx)(`strong`,{children:(A.miss+A.hit+A.output).toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(B.chartTooltipRow,B.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:B.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:fn}}),i(`tokenHit`)]}),(0,m.jsx)(`strong`,{children:A.hit.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(B.chartTooltipRow,B.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:B.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:dn}}),i(`tokenMiss`)]}),(0,m.jsx)(`strong`,{children:A.miss.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:y(B.chartTooltipRow,B.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:B.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:pn}}),i(`tokenOutput`)]}),(0,m.jsx)(`strong`,{children:A.output.toLocaleString()})]})]}),u!==null&&p===`model`&&j!==void 0&&(0,m.jsxs)(`div`,{className:y(B.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:B.chartTooltipHead,children:[(0,m.jsx)(`span`,{className:B.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(B.chartTooltipRow,B.chartTooltipSplit),children:[(0,m.jsxs)(`span`,{className:B.chartTooltipLabel,children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,m.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,m.jsxs)(`div`,{className:B.chartTooltipModelDetail,children:[i(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,i(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,i(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,m.jsx)(`div`,{className:B.chartLegend,children:p===`structure`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:dn}}),i(`tokenMiss`)]}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:fn}}),i(`tokenHit`)]}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:pn}}),i(`tokenOutput`)]})]}):w.map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(B.chartLegendItem,T===e.key&&B.chartLegendItemActive),"aria-pressed":T===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{ee(e.key)},children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-token-models`,children:[(0,m.jsx)(`div`,{className:B.panelHead,children:(0,m.jsx)(`h3`,{className:B.panelTitle,children:i(`tokenByModel`)})}),E.length===0?(0,m.jsx)(`div`,{className:B.emptyRow,children:i(`noData`)}):(0,m.jsx)(`div`,{className:B.tableScroll,children:(0,m.jsxs)(`table`,{className:B.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:B.numCol,children:i(`inputTokens`)}),(0,m.jsx)(`th`,{className:B.numCol,children:i(`outputTokens`)}),(0,m.jsx)(`th`,{className:B.numCol,children:i(`tokenReasoningShort`)}),(0,m.jsx)(`th`,{className:B.numCol,children:i(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:B.numCol,children:i(`tokenTotal`)}),(0,m.jsx)(`th`,{className:B.numCol,children:i(`tokenShare`)}),(0,m.jsx)(`th`,{className:B.numCol,children:i(`calls`)})]})}),(0,m.jsx)(`tbody`,{children:E.map(e=>(0,m.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:y(v&&B.modelRowFocusable,T===e.key&&B.modelRowActive),"aria-selected":v?T===e.key:void 0,onClick:v?()=>{ee(e.key)}:void 0,tabIndex:v?0:void 0,onKeyDown:v?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ee(e.key))}:void 0,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`span`,{className:B.modelName,children:e.name})}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.input)}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.output)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.reasoning>0?J(e.reasoning):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsxs)(`td`,{className:B.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.total)}),(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsxs)(`span`,{className:B.tokenModelShareRow,children:[(0,m.jsx)(`span`,{className:B.tokenModelBar,children:(0,m.jsxs)(`span`,{className:B.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,m.jsx)(`span`,{className:B.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,m.jsx)(`span`,{className:B.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),D.totalCalls>0&&(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-token-tools`,children:[(0,m.jsx)(`div`,{className:B.panelHead,children:(0,m.jsx)(`h3`,{className:B.panelTitle,children:i(`toolRank`)})}),(0,m.jsx)(`div`,{className:B.tableScroll,children:(0,m.jsxs)(`table`,{className:B.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:B.numCol,children:i(`calls`)}),(0,m.jsx)(`th`,{className:B.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:B.modelName,children:e})}),(0,m.jsx)(`td`,{className:B.numCol,children:t.toLocaleString()}),(0,m.jsxs)(`td`,{className:B.numCol,children:[(t/D.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),x.length>0&&(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-roles`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:i(`roleCost`)}),(0,m.jsx)(`span`,{className:B.panelHint,children:i(`roleHint`)})]}),(0,m.jsx)(`div`,{className:B.shareTrack,"data-testid":`billing-role-track`,children:x.map(e=>(0,m.jsx)(`div`,{className:y(B.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,m.jsx)(`div`,{className:B.shareLegend,children:x.map(e=>(0,m.jsxs)(`span`,{className:B.shareItem,children:[(0,m.jsx)(`span`,{className:y(B.shareDot,e.seg)}),e.label,(0,m.jsxs)(`span`,{className:B.shareValue,children:[a(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function gn(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
|
-
`)}function _n(){let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}let X={top:18,right:40,bottom:26,left:46};function vn(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function yn(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 bn={key:`__total__`,name:``,color:``};function xn({data:e,models:t=[],currency:n=`cny`,metric:r=`cost`,t:i}){let a=i??(e=>Be[e]),[o,s]=(0,d.useState)(null),c=e=>K(Xt(e,n),n),l=e=>r===`tokens`?un(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-X.left-X.right,a=220-X.top-X.bottom,o=e=>n===1?X.left+i/2:X.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=>X.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>X.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:bn,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:B.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],ee=yn(p,Math.max(1,Math.ceil(p/8)));return(0,m.jsxs)(`div`,{className:B.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:B.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-X.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:X.left,x2:680-X.right,y1:n,y2:n,className:B.chartGrid}),(0,m.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:B.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===``?B.chartBar:B.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:B.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,m.jsx)(`path`,{d:w,fill:`none`,className:B.chartLine}),(()=>{let t=_n(),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:X.top,y2:X.top+g,stroke:`var(--ds-amber)`,strokeWidth:`1`,strokeDasharray:`3 3`,opacity:`0.6`}),(0,m.jsx)(`text`,{x:_(n)+4,y:X.top-6,fill:`var(--ds-amber)`,fontSize:`10`,fontFamily:`var(--font-num)`,children:vn(t)})]}):null})(),C.map((e,t)=>{let n=y(e);return(0,m.jsx)(`text`,{x:680-X.right+8,y:n+3,textAnchor:`start`,className:B.chartAxisLabel,children:un(e)},`calls-${t}`)}),ee.map(t=>{let n=e[t];return n===void 0?null:(0,m.jsx)(`text`,{x:_(t),y:214,textAnchor:`middle`,className:B.chartAxisLabel,children:vn(n.date)},n.date)}),o!==null&&(0,m.jsx)(`line`,{x1:_(o),x2:_(o),y1:X.top,y2:X.top+g,className:B.chartCrosshair})]}),T!==void 0&&o!==null&&(0,m.jsxs)(`div`,{className:B.chartTooltip,style:{left:`${_(o)/680*100}%`,top:`${v(T.cost)/220*100}%`},children:[(0,m.jsx)(`div`,{className:B.chartTooltipDate,children:T.date}),r!==`tokens`&&t.filter(e=>(T.byModel?.[e.key]??0)>0).map(e=>(0,m.jsxs)(`div`,{className:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.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:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.chartLegendBar}),a(`trendTotal`),` `,(0,m.jsx)(`strong`,{children:r===`tokens`?un(T.tokens??0):c(T.cost)})]}),(0,m.jsxs)(`div`,{className:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.chartLegendLine}),a(`calls`),` `,(0,m.jsx)(`strong`,{children:T.calls.toLocaleString()})]})]}),t.length>0&&r!==`tokens`&&(0,m.jsxs)(`div`,{className:B.chartLegend,children:[t.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartLegendLine}),a(`calls`)]})]})]})}let Z={top:14,right:42,bottom:22,left:46};function Sn(e){return e.slice(5,13).replace(`T`,` `)}function Cn(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function wn(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Tn(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function En(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function Dn({perf:e,models:t,t:n}){let[r,i]=(0,d.useState)(()=>ke()),[a,o]=(0,d.useState)(null),s=e=>{i(e),Ae(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-Z.left-Z.right,a=180-Z.top-Z.bottom,o=e=>n===1?Z.left+i/2:Z.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=>Z.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:B.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:wn(a),unit:``,pct:a/e*100,color:`var(--ds-green)`},{lbl:n(`perfTps`),val:o.length>0?Tn(s):`—`,unit:``,pct:s/t*100,color:`var(--ds-blue)`},{lbl:n(`perfLatency`),val:wn(c),unit:``,pct:c/r*100,color:`var(--ds-amber)`}];return(0,m.jsx)(`div`,{className:B.perfHero,"data-testid":`billing-perf-hero`,children:u.map((e,t)=>(0,m.jsxs)(`div`,{className:B.perfHeroCell,children:[(0,m.jsx)(`div`,{className:B.perfHeroLbl,children:e.lbl}),(0,m.jsxs)(`div`,{className:B.perfHeroVal,children:[e.val,e.unit!==``&&(0,m.jsx)(`span`,{className:B.perfHeroUnit,children:e.unit})]}),(0,m.jsx)(`div`,{className:B.perfHeroBar,children:(0,m.jsx)(`i`,{style:{width:`${Math.min(100,e.pct)}%`,background:e.color}})})]},t))})})(),(0,m.jsx)(`div`,{className:B.tableScroll,"data-testid":`billing-perf-table`,children:(0,m.jsxs)(`table`,{className:B.modelTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`model`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfSamples`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfTtft`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfP50`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfP90`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfMax`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfTps`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfLatency`)}),(0,m.jsx)(`th`,{className:B.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:B.modelCell,children:[(0,m.jsx)(`span`,{className:B.modelDot,style:{background:e.color}}),(0,m.jsx)(`span`,{className:B.modelName,children:e.name})]})}),(0,m.jsx)(`td`,{className:B.numCol,children:e.samples.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.ttftAvg)}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.ttftP50)}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.ttftP90)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.ttftMax===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):(0,m.jsxs)(`span`,{children:[wn(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,m.jsx)(`td`,{className:B.numCol,children:e.tpsAvg===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):Tn(e.tpsAvg)}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.latencyAvg)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,m.jsx)(`span`,{className:B.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:B.perfCompareList,"data-testid":`billing-perf-compare`,children:l.map(n=>(0,m.jsxs)(`div`,{className:B.perfCompareRow,children:[(0,m.jsxs)(`div`,{className:B.perfCompareName,children:[(0,m.jsx)(`span`,{className:B.perfCompareDot,style:{background:n.color}}),(0,m.jsx)(`span`,{children:n.name})]}),(0,m.jsx)(`div`,{className:B.perfCompareBar,children:(0,m.jsx)(`i`,{style:{width:`${n.ttftP50/e*100}%`,background:t(n.ttftP50)}})}),(0,m.jsx)(`div`,{className:B.perfCompareNum,children:wn(n.ttftP50)}),(0,m.jsx)(`div`,{className:B.perfCompareNum,children:n.tpsAvg===void 0?`—`:Tn(n.tpsAvg)})]},n.key))})})(),f!==null&&(0,m.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,m.jsx)(`div`,{className:B.perfBar,children:(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,r.metric===e&&B.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:B.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,m.jsx)(`button`,{type:`button`,className:B.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(B.perfChip,!t&&B.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:B.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),f.totalPoints>0?(0,m.jsxs)(`div`,{className:B.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:B.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-Z.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:Z.left,x2:680-Z.right,y1:n,y2:n,className:B.chartGrid}),(0,m.jsx)(`text`,{x:Z.left-8,y:n+3,textAnchor:`end`,className:B.chartAxisLabel,children:Cn(e)})]},`tick-${t}`)}),f.series.map(e=>e.segments.map((t,n)=>(0,m.jsx)(`path`,{d:t,fill:`none`,className:B.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:B.chartAxisLabel,children:Sn(t)},t)}),a!==null&&(0,m.jsx)(`line`,{x1:f.inner(a),x2:f.inner(a),y1:Z.top,y2:Z.top+f.plotH,className:B.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:B.chartHoverDot},`${e.key}-dot`)})]}),a!==null&&g.length>0&&(0,m.jsxs)(`div`,{className:B.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${f.inner(a)/680*100}%`,top:`${(Z.top+f.plotH/2)/180*100}%`},children:[(0,m.jsx)(`div`,{className:B.chartTooltipDate,children:Sn(f.hourKeys[a]??``)}),g.map(e=>(0,m.jsxs)(`div`,{className:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,m.jsx)(`strong`,{children:En(e.v,r.metric,n)})]},e.key))]})]}):(0,m.jsx)(`div`,{className:B.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),f===null&&(0,m.jsx)(`div`,{className:B.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let On=`@kenz1117/dsh-ui-usage-billing`,kn=`kenz1117`;function An({t:e,version:t}){return(0,m.jsxs)(`section`,{className:B.setCard,"data-testid":`billing-plugin-info`,children:[(0,m.jsxs)(`div`,{className:B.plgHead,children:[(0,m.jsx)(`span`,{className:B.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:B.plgTitle,children:[(0,m.jsxs)(`div`,{className:B.plgNameRow,children:[(0,m.jsx)(`h3`,{className:B.plgName,children:On}),(0,m.jsx)(`span`,{className:B.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,m.jsx)(`p`,{className:B.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,m.jsxs)(`div`,{className:B.plgGrid,children:[(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginAuthor`)}),(0,m.jsxs)(`a`,{className:B.plgLink,href:`https://github.com/${kn}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,kn,`)`]})]}),(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginRepository`)}),(0,m.jsx)(`a`,{className:B.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginNpm`)}),(0,m.jsx)(`a`,{className:B.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:On})]}),(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginLicense`)}),(0,m.jsx)(`span`,{className:B.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 Mn(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 Nn(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 Pn({rounds:e,flags:t,currency:n,t:r}){let i=(0,d.useMemo)(()=>e.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:B.roundsEmpty,children:[r(`model`),` —`]});let s=e=>K(Xt(e,n),n);return(0,m.jsxs)(`div`,{className:B.rounds,children:[(0,m.jsx)(`div`,{className:B.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=xt(e.model,!1)===`deepseek-metered`&&dt(e.startedAt)===`peak`;return(0,m.jsxs)(`div`,{className:y(B.roundsBarCol,i?B.roundsBarColPeak:B.roundsBarColOff),children:[(0,m.jsx)(`span`,{className:B.roundsBarLabel,style:{bottom:`${n}%`},children:s(e.cost)}),(0,m.jsx)(`div`,{className:B.roundsBarWrap,children:(0,m.jsx)(`div`,{className:t?B.roundsBarFlagged:B.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${r(`model`)} ${e.model} · ${s(e.cost)} · ${Mn(e.startedAt)}${e.endedAt===void 0?``:` → ${jn(e.endedAt)} (${Nn(e.endedAt-e.startedAt)})`}`,children:t&&(0,m.jsx)(`span`,{className:B.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,m.jsxs)(`div`,{className:B.roundsAxis,children:[(0,m.jsxs)(`span`,{children:[r(`costAbbr`),` `,s(o)]}),(0,m.jsxs)(`span`,{children:[i.length,` `,r(`roundsUnit`)]})]})]})}let Fn=[`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)`],In=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Ln=e=>q(e.getTime());function Rn(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:Ln(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:Ln(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=new Date(i,a,u),f=Ln(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 zn(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=Ln(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=Ln(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 Bn({days:e,currency:t,now:n,t:r,range:i=`month`,unit:a=`cost`}){let[o,s]=(0,d.useState)(null),c=e=>K(Xt(e,t),t),l=e=>a===`tokens`?J(e):c(e),u=(0,d.useMemo)(()=>Rn(e,n??new Date),[e,n]),f=Ln(n??new Date);if(i!==`month`){let t=zn(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:In[n-1]??``}),o=n)}),(0,m.jsxs)(`div`,{className:B.heatmapYear+(i===`half`?` `+B.heatmapHalf:``),"data-testid":i===`half`?`heatmap-half`:`heatmap-year`,children:[(0,m.jsxs)(`div`,{className:B.heatmapYearBody,children:[(0,m.jsx)(`div`,{className:B.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,m.jsx)(`span`,{className:B.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,m.jsxs)(`div`,{className:B.heatmapYearScroll,children:[(0,m.jsx)(`div`,{className:B.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:a.map(e=>(0,m.jsx)(`span`,{className:B.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,m.jsx)(`div`,{className:B.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:B.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:Fn[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,tabIndex:-1},e.date))})]})]}),(0,m.jsxs)(`div`,{className:B.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:B.heatmapLegend,children:Fn.map((e,t)=>(0,m.jsx)(`i`,{style:{background:e}},t))}),(0,m.jsx)(`span`,{children:r(`heatmapMore`)})]})]})}return(0,m.jsxs)(`div`,{className:B.heatmap,children:[(0,m.jsx)(`div`,{className:B.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,m.jsx)(`div`,{className:B.heatmapCellEmpty,children:e.dayNum},e.date):(0,m.jsx)(`button`,{type:`button`,className:B.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:Fn[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:B.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:B.heatmapLegend,children:Fn.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:B.heatmapHover,"data-testid":`heatmap-hover`,children:[o.date,` · `,l(o.value)]})]})]})}let Vn={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function Hn(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function Q(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function Un(e,t){let n=t?.window??Vn.window,r=t?.threshold??Vn.threshold,i=t?.reasonFactor??Vn.reasonFactor,a=t?.reasonHitDropPp??Vn.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=Q(t),p=Hn(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=Hn(c),r=Hn(l),s=Hn(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 Wn={},Gn={};function Kn(){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 qn(e,t){return e==null?null:Number.isFinite(e.nextSwitchInMs)&&e.nextSwitchInMs<=t?`soon`:e.tier===`peak`?`peak`:`offPeak`}let Jn={显式缓存创建:`Explicit cache write`,显式缓存命中:`Explicit cache hit`,长期半价:`Half price`,与标准价一致:`Same as standard`,"限时 5 折":`Limited-time 50% off`};function Yn(e,t){return e===void 0||t!==`en`?e:Jn[e]??e}function Xn(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 Zn={"智谱 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 Qn(e,t){return t===`en`?Zn[e]??e:e}let $n={workbuddy:`WorkBuddy`,"workbuddy-ai":`WorkBuddy AI`},er={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},tr={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function nr(e){try{return new URL(e).host}catch{return e}}function rr(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=er[n];return r===void 0?nr(n):t===`en`?tr[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=$n[n.trim().toLowerCase()];return r===void 0?`${t===`en`?`Direct`:`直连`} · ${n}`:`${t===`en`?`Direct`:`直连`} · ${r}`}}let ir=[`直连 · `,`Direct · `];function ar(e){for(let t of ir)if(e.startsWith(t))return e.slice(t.length)}let or=`dsh-billing-peak-alert-v1`,sr={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function cr(){try{let e=localStorage.getItem(or);if(e===null)return{...sr};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:sr.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))):sr.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...sr}}}function lr(e){try{localStorage.setItem(or,JSON.stringify(e))}catch{x(`peak-config-storage-unavailable`)}}function ur(e,t,n,r){if(!t.enabled)return null;let i=Ct(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}}function dr({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(B.peakCard,u?B.peakCardPeak:B.peakCardOff,t.position===`center`?B.peakCardCenter:B.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,m.jsxs)(`div`,{className:B.peakHead,children:[(0,m.jsxs)(`span`,{className:y(B.peakTag,u?B.peakTagPrimary:B.peakTagSuccess),children:[(0,m.jsx)(`span`,{className:y(B.peakDot,u?B.peakDotPrimary:B.peakDotSuccess),"aria-hidden":`true`}),c]}),(0,m.jsx)(`button`,{type:`button`,className:B.peakClose,onClick:r,"aria-label":n(`close`),children:`×`})]}),(0,m.jsxs)(`div`,{className:y(B.peakCount,u?B.peakCountPrimary:B.peakCountSuccess),children:[o,`min`]}),(0,m.jsx)(`p`,{className:B.peakDesc,children:l})]})}let fr=[50,80,100],pr=3e4,mr={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}},hr=[`#4f8cff`,`#2dd4bf`,`#a78bfa`,`#f59e0b`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#6366f1`,`#f97316`,`#14b8a6`],gr={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},_r=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`context`,labelKey:`tabContext`},{id:`agents`,labelKey:`tabAgents`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],vr={fill:`none`,"aria-hidden":!0,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`},yr={overview:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,...vr,children:(0,m.jsx)(`path`,{d:`M2 13V3M2 13H14M4 10l4-3 2 2 4-5`})}),context:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...vr,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`}),(0,m.jsx)(`path`,{d:`M8 8V2.5M8 8l3.8 2.3`})]}),agents:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...vr,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`,...vr,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`,...vr,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`,...vr,children:(0,m.jsx)(`path`,{d:`M2 4l4 4 3-3 5 5M11 10h3V7`})}),pricing:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...vr,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`,...vr,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,xr=br.IconChevronDownOutlineMedium??br.IconChevronDownOutline14;function Sr(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 Cr(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)),i=t.split(`-`),a=new Date(Number(i[0]),Number(i[1]),0).getDate(),o=r.length>0?r.reduce((t,n)=>t+(e[n]?.cost??0),0)/r.length:Sr(e,n);return o<=0?0:o*a}function wr(e){return Object.keys(e).length}function Tr(e,t=Date.now()){let n=0,r=new Date(t);for(;q(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function Er(e){return e.input+e.output}function Dr(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=q(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function Or(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[q(i.getTime())];o!==void 0&&(a+=n(o))}return a}function kr(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=q(a.getTime()),s=new Date(r);s.setDate(s.getDate()-6);let c=q(s.getTime()),l=0,u=0,d=0,f=0,p=0,m=0,h=0,g,_=0;for(let[r,i]of Object.entries(e)){if(!(n===`today`?r===t:n===`7d`?r>=c&&r<=t:n===`week`?r>=o&&r<=t:r.startsWith(t.slice(0,7))))continue;l+=i.cost,u+=i.calls,d+=i.input,f+=i.output,p+=i.cacheHit,m+=i.cacheMiss,h+=i.reasoning??0;let e=Er(i);e>_&&(_=e,g=r)}return{cost:l,calls:u,input:d,output:f,cacheHit:p,cacheMiss:m,reasoning:h,peakDay:g,peakTokens:_}}function Ar(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 jr=[80,100];function Mr(e,t){if(!(t>0)||!(e>0))return[];let n=e/t*100;return jr.filter(e=>n>=e)}let Nr={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 $(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function Pr(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 Fr(e,t){let n=$(e),r=$(t);if(Pr(n,r))return!0;let i=Nr[e];return i!==void 0&&i.some(e=>Pr($(e),r))}function Ir(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(Nr))for(let r of n){let n=$(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(Nr))for(let r of t){let t=$(r);if(!(t.length<4)&&n.includes(t))return e}}}let Lr={"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 Rr(e){let t=Lr[e];return t===void 0?Ir(e)??e:t}let zr=`https://platform.kimi.com/console/pay`,Br=`https://open.bigmodel.cn/finance-center/finance/pay`,Vr=`https://bailian.console.aliyun.com/`,Hr=`https://console.volcengine.com/ark`,Ur=`https://console.anthropic.com/settings/billing`,Wr=`https://console.cloud.google.com/billing`,Gr=`https://console.x.ai/`,Kr=`https://platform.xiaomimimo.com/console/balance`,qr=`https://console.cloud.tencent.com/expense/recharge`,Jr={deepseek:`https://platform.deepseek.com/top_up`,minimax:`https://platform.minimax.cn/console/recharge-records`,moonshot:zr,kimi:zr,zhipu:Br,bigmodel:Br,qwen:Vr,dashscope:Vr,doubao:Hr,volcengine:Hr,ark:Hr,openai:`https://platform.openai.com/settings/organization/billing`,anthropic:Ur,claude:Ur,google:Wr,gemini:Wr,xai:Gr,grok:Gr,siliconflow:`https://cloud.siliconflow.cn/account/charge`,hunyuan:qr,tencent:qr,腾讯云:qr,xiaomi:Kr,mimo:Kr,mi:Kr,qianfan:`https://console.bce.baidu.com/qianfan/overview`};function Yr(e){let t=Jr[e];if(t!==void 0)return t;let n=Object.keys(Jr).find(t=>e.startsWith(t));return n===void 0?void 0:Jr[n]}function Xr(e){let t=$(e),n=Yr(t);if(n!==void 0)return n;for(let[e,n]of Object.entries(Nr))if(Pr($(e),t))for(let e of n){let t=Yr($(e));if(t!==void 0)return t}}function Zr(e){let t=et();if(t===void 0||e.byDayModels===void 0)return e;let n=lt().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)*U+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=nt(i)??it(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:nt(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=>!nt(e)&&!it(e))}}async function Qr(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 $r=new Set;function ei(){return typeof Notification<`u`&&Notification.permission===`granted`}function ti(e,t){$r.has(e)||($r.add(e),Qr(`/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 ni(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 ri(e){let t=new Map(e.map(e=>[e.id,e])),n=ni(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 ii(){let e,t=new Set;return{publish:n=>{let r=ai(n)?void 0:n;if(e!==r&&!(e!==void 0&&r!==void 0&&oi(e,r))){e=r;for(let n of t)try{n(e)}catch{}}},subscribe:n=>(n(e),t.add(n),()=>{t.delete(n)}),read:()=>e}}function ai(e){return e.projectedTokens===void 0&&e.pressureTokens===void 0&&e.contextWindow===void 0&&e.systemTokens===void 0&&e.toolsTokens===void 0&&e.messageTokens===void 0}function oi(e,t){return e.projectedTokens===t.projectedTokens&&e.pressureTokens===t.pressureTokens&&e.contextWindow===t.contextWindow&&e.systemTokens===t.systemTokens&&e.toolsTokens===t.toolsTokens&&e.messageTokens===t.messageTokens}function si(e){if(e===void 0)return;let t=e.projectedTokens??e.pressureTokens,n=e.contextWindow;if(!(t===void 0||n===void 0||n<=0))return Math.min(1,t/n)}function ci(e){if(e===void 0)return[];let t=[];return e.systemTokens!==void 0&&t.push({key:`system`,tokens:e.systemTokens}),e.toolsTokens!==void 0&&t.push({key:`tools`,tokens:e.toolsTokens}),e.messageTokens!==void 0&&t.push({key:`message`,tokens:e.messageTokens}),t}let li=ii();function ui(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)||di(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 di(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 pi(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 mi(e,t){let n=e.trim().toLowerCase();return n!==``&&!t.some(e=>e.toLowerCase().includes(n))}function hi(e,t){return e.checked?e.okProviders.some(e=>Fr(t,e))?B.healthOk:e.badProviders.some(e=>Fr(t,e))?B.healthBad:B.healthIdle:B.healthIdle}function gi(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 _i(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 yi={"new-api":B.siteKindSite,sub2api:B.siteKindDirect,unknown:B.siteKindUnknown},bi=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function xi(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 Si(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}async function Ci(){try{let e=await Qr(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n||!(`total`in n))return null;let r=n,i=e=>typeof e==`object`&&!!e;return{total:r.total??mr.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}:{},...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}:{}}}catch{return null}}async function wi(){try{let e=await Qr(`/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 Ti(){let e=await Qr(`/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 Ei(){let e=await Qr(`/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 Di(){try{let e=await Qr(`/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 Oi(e){try{let t=await Qr(`/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 ki=!1,Ai=0;async function ji(e=0){try{let t=await Qr(`/api/billing/pricing`);if(!t.ok){ki=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){ki=!1;return}let i=r;Array.isArray(i.catalog)&&i.catalog.length>0&&i.aliases!==null&&typeof i.aliases==`object`&&Dt(i.catalog,i.aliases);let a=r;if(a.source===`builtin`&&e<3){if(e===0){if(ki)return;ki=!0}setTimeout(()=>{ji(e+1)},2e3);return}ki=!1,Ai=a.syncedAt??0,at(a)}catch{ki=!1}}async function Mi(){try{return(await Qr(`/api/billing/pricing/refresh`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`,timeoutMs:3e4})).ok?(await ji(),!0):!1}catch{return!1}}function Ni({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:B.subscriptionWindow,children:[(0,m.jsx)(`span`,{className:B.subscriptionWindowLabel,children:_i(e.kind,t)}),(0,m.jsx)(`span`,{className:B.subscriptionTrack,"aria-hidden":`true`,children:(0,m.jsx)(`span`,{className:y(B.subscriptionFill,n>=100&&B.subscriptionFillOver,n>=80&&n<100&&B.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,m.jsxs)(`span`,{className:B.subscriptionMeta,children:[(0,m.jsx)(`span`,{className:y(B.subscriptionPct,r&&B.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${q(new Date(e.resetsAt).getTime())} ${Si(new Date(e.resetsAt).getTime())}`)})]})]})}function Pi({label:e,t}){return(0,m.jsx)(p.Tooltip,{label:e,side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.helpTip,role:`note`,"aria-label":e,children:`?`})})}function Fi(e,t){return e===B.healthOk?t(`healthDotLive`):e===B.healthBad?t(`healthDotFailed`):t(`healthDotUnknown`)}function Ii(e){let t=t=>K(Xt(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}=e,C=(0,d.useMemo)(()=>p.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[p.targets,h]),[w,T]=(0,d.useState)(0),ee=C.length===0?0:Math.min(w,C.length-1),E=C[ee],D=(0,d.useRef)(null),[O,k]=(0,d.useState)(!1),[te,A]=(0,d.useState)({left:0,top:0});(0,d.useEffect)(()=>{if(!O||p.mode!==`subscription`||C.length<2)return;let e=setInterval(()=>T(e=>(e+1)%C.length),1500);return()=>clearInterval(e)},[O,p.mode,C.length]);let j=(0,d.useRef)(void 0),ne=(0,d.useCallback)(()=>{window.clearTimeout(j.current),k(!0)},[]),re=(0,d.useCallback)(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>k(!1),120)},[]);(0,d.useEffect)(()=>()=>window.clearTimeout(j.current),[]);let M=(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=()=>M();return window.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},[O,M]);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:B.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:B.triggerGaugeNeedle,style:{transform:`rotate(${oe}deg)`,transformOrigin:`20px 29px`}}),(0,m.jsx)(`circle`,{cx:`20`,cy:`29`,r:`1.5`,fill:`currentColor`,stroke:`none`})]});if(!n)return(0,m.jsx)(`button`,{type:`button`,className:y(B.railButton,x!==`none`&&B.triggerBudgetPulse,x===`over`&&B.triggerBudgetOver),"data-testid":`billing-rail-button`,onClick:i,title:`${r(`title`)} · ${t(g.span===`day`?o:g.span===`week`?s:a)}`,children:se});let ce=g.metric===`tokens`,le=c.map(e=>ce?e.tokens:e.cost),N=Math.max(...le,0),ue=le.map(e=>N>0?4+e/N*12:4);return(0,m.jsxs)(`span`,{ref:D,className:B.triggerWrap,onMouseEnter:()=>{M(),ne()},onMouseLeave:re,onFocusCapture:()=>{M(),ne()},onBlurCapture:()=>k(!1),children:[(0,m.jsxs)(`button`,{type:`button`,className:y(B.trigger,x!==`none`&&B.triggerBudgetPulse,x===`over`&&B.triggerBudgetOver),"data-testid":`billing-trigger`,onClick:i,title:`${r(`title`)} · ${t(g.span===`day`?o:g.span===`week`?s:a)}`,children:[(0,m.jsx)(`span`,{className:y(B.triggerIcon,x!==`none`&&B.triggerBudgetHot),"data-testid":`billing-trigger-icon`,children:se}),(0,m.jsx)(`span`,{className:B.triggerMain,children:(0,m.jsxs)(`span`,{className:B.triggerPrimary,children:[(0,m.jsx)(`span`,{className:B.triggerLabel,children:ce?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`?ce?v:o:g.span===`week`?ce?b:s:ce?_:a,n=g.span===`day`?S:0;return ce?(0,m.jsx)(`span`,{className:B.triggerMetric,"data-testid":`billing-trigger-span-tokens`,children:J(e)}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{className:B.triggerValueRow,children:[(0,m.jsx)(`span`,{className:B.triggerYen,"aria-hidden":`true`,children:t(e).charAt(0)}),(0,m.jsx)(`span`,{className:B.triggerMetric,"data-testid":`billing-trigger-span-money`,children:t(e).slice(1)})]}),g.showDelta&&n!==0&&(0,m.jsxs)(`span`,{className:y(B.triggerDelta,n>0?B.triggerDeltaUp:B.triggerDeltaDown),"data-testid":`billing-trigger-delta`,children:[n>0?`▲`:`▼`,` `,Math.abs(n).toFixed(1),`%`]}),(0,m.jsx)(`span`,{className:B.triggerGlow,"aria-hidden":`true`})]})})()]})}),(0,m.jsx)(`span`,{className:B.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:ue.map((e,t)=>(0,m.jsx)(`span`,{className:t===ue.length-1?B.triggerSparkHot:B.triggerSparkBar,style:{height:`${e}px`}},c[t]?.date??String(t)))})]}),(0,f.createPortal)((0,m.jsx)(`span`,{className:y(B.triggerPop,O&&B.triggerPopShown),style:{left:`${te.left}px`,top:`${te.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!O,onMouseEnter:ne,onMouseLeave:re,children:p.mode===`subscription`?(0,m.jsx)(m.Fragment,{children:C.length===0?(0,m.jsx)(`span`,{className:B.triggerPopEmpty,children:r(`floatNoTargets`)}):(0,m.jsxs)(m.Fragment,{children:[E!==void 0&&(0,m.jsxs)(`div`,{className:B.floatSub,"data-testid":`billing-float-subscription`,children:[(0,m.jsxs)(`div`,{className:B.floatSubHead,children:[(0,m.jsx)(`span`,{className:B.floatSubName,children:E.displayName}),E.plan!==void 0&&(0,m.jsx)(`span`,{className:B.floatSubPlan,children:E.plan})]}),E.windows.map(e=>(0,m.jsx)(Ni,{window:e,t:r},e.kind))]}),C.length>1&&(0,m.jsx)(`span`,{className:B.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,m.jsxs)(`span`,{className:B.triggerPopSwitchCount,children:[ee+1,`/`,C.length]})})]})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:B.popHead,children:(0,m.jsx)(`span`,{className:B.popTitle,children:r(`popTitle`)})}),(0,m.jsxs)(`span`,{className:B.metricGrid,children:[(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`floatPrimaryToday`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:t(o)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`floatPrimaryWeek`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:t(s)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`floatPrimaryMonth`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:t(a)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`input`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:J(u.input)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`output`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:J(u.output)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`cacheHit`)}),(0,m.jsx)(`span`,{className:y(B.metricValue,B.metricValueSuccess),children:$t(u.cacheRead+u.cacheMiss>0?u.cacheRead/(u.cacheRead+u.cacheMiss)*100:0)})]})]}),(0,m.jsxs)(`span`,{className:B.popModel,children:[(0,m.jsx)(`span`,{className:B.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:B.popModelRow,children:[(0,m.jsx)(`span`,{className:y(B.popDot,B.popDotDirect),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:B.popTagPrimary,children:r(`popDirectLead`)}),(0,m.jsx)(`span`,{className:B.popModelName,children:l.direct.name}),(0,m.jsx)(`span`,{className:y(B.popModelStatus,l.direct.low&&B.popModelStatusLow),children:l.direct.text})]}),l.sub!==void 0&&(0,m.jsxs)(`span`,{className:B.popModelRow,children:[(0,m.jsx)(`span`,{className:y(B.popDot,B.popDotSub),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:B.popTagSub,children:r(`popSubLead`)}),(0,m.jsx)(`span`,{className:B.popModelName,children:l.sub.name}),(0,m.jsx)(`span`,{className:y(B.popModelStatus,l.sub.low&&B.popModelStatusLow),children:l.sub.text})]})]}):(0,m.jsxs)(`span`,{className:B.popModelRow,children:[(0,m.jsx)(`span`,{className:y(B.popDot,B.popDotNeutral),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:B.popModelStatus,children:r(`popNoConsumption`)})]})]})]})}),document.body)]})}function Li({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:B.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,onClick:e=>{e.stopPropagation()},children:[(0,m.jsxs)(`span`,{className:B.balanceDetailHead,children:[(0,m.jsx)(`span`,{className:B.balanceDetailTitle,children:e.displayName}),(0,m.jsx)(`button`,{type:`button`,className:B.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,m.jsxs)(`span`,{className:B.balanceDetailGrid,children:[s!==void 0&&(0,m.jsx)(Ri,{label:i(`balance`),value:s}),c!==void 0&&(0,m.jsx)(Ri,{label:i(`balanceGranted`),value:c}),l!==void 0&&(0,m.jsx)(Ri,{label:i(`balanceTopped`),value:l}),(0,m.jsx)(Ri,{label:i(`balanceDaily`),value:r(n)}),(0,m.jsx)(Ri,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function Ri({label:e,value:t}){return(0,m.jsxs)(`span`,{className:B.balanceDetailRow,children:[(0,m.jsx)(`span`,{className:B.balanceDetailLabel,children:e}),(0,m.jsx)(`span`,{className:B.balanceDetailValue,children:t})]})}function zi({userPrices:e,onUserPrices:t,t:n}){let[r,i]=(0,d.useState)(()=>[...e]),[a,o]=(0,d.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=()=>{i(e=>e.filter((e,t)=>!a.has(t))),o(new Set)},l=(e,t)=>i(n=>n.map((n,r)=>r===e?{...n,...t}:n)),u=()=>i(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),f=e=>{let t=r[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},p=(e,t,n)=>i(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})),h=()=>t(r.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:H(e.origin.trim())}}))),g=Kt().map(e=>e.key),_=(e,t)=>i(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),[v,b]=(0,d.useState)({}),x=(e,t,n)=>`${e}:${t}:${n}`,S=(e,t,n)=>b(r=>{let i=x(e,t,n);if(r[i]===void 0)return r;let a={...r};return delete a[i],a}),C=e=>Number.isFinite(e)&&e!==0?String(e):``,w=(e,t,n)=>{if(b(r=>({...r,[x(e,`main`,t)]:n})),n===``){l(e,{[t]:0});return}let r=Number(n);Number.isFinite(r)&&r>=0&&l(e,{[t]:r})};return(0,m.jsxs)(`section`,{className:B.setCard,"data-testid":`billing-user-prices`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[n(`userPrices`),(0,m.jsx)(Pi,{label:n(`userPricesHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsx)(`datalist`,{id:`billing-price-model-keys`,children:g.map(e=>(0,m.jsx)(`option`,{value:e},e))}),r.map((e,t)=>(0,m.jsxs)(`div`,{className:B.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,m.jsx)(`input`,{type:`checkbox`,className:B.userPriceCheck,"data-testid":`billing-user-price-select`,checked:a.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>s(t)}),(0,m.jsxs)(`div`,{className:B.userPriceBody,children:[(0,m.jsxs)(`div`,{className:B.userPriceLineMeta,children:[(0,m.jsxs)(`div`,{className:B.userPriceField,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:n(`userPriceModel`)}),(0,m.jsx)(`input`,{className:B.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=>l(t,{key:e.target.value})})]}),(0,m.jsxs)(`div`,{className:B.userPriceField,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:n(`userPriceSource`)}),(0,m.jsx)(`input`,{className:B.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>l(t,{origin:e.target.value.trim()})})]}),(0,m.jsxs)(`div`,{className:B.userPriceField,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:n(`userPriceCurrency`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,e.currency!==`USD`&&B.floatModeBtnOn),onClick:()=>_(t,`CNY`),children:`CNY`}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,e.currency===`USD`&&B.floatModeBtnOn),onClick:()=>_(t,`USD`),children:`USD`})]})]})]}),[{scope:`main`,label:n(`userPriceNormal`),testid:`billing-user-price-normal`,valueOf:n=>v[x(t,`main`,n)]??C(e[n]),onChange:(e,n)=>w(t,e,n)},{scope:`off`,label:n(`userPriceOffPeak`),testid:`billing-user-price-offpeak`,valueOf:e=>v[x(t,`off`,e)]??f(t)[e],onChange:(e,n)=>{b(r=>({...r,[x(t,`off`,e)]:n})),p(t,e,n)}}].map(e=>(0,m.jsxs)(`div`,{className:B.userPricePriceLine,"data-testid":e.testid,children:[(0,m.jsx)(`span`,{className:B.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:B.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:()=>S(t,e.scope,r)},r)})]},e.testid))]})]},t)),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-user-price-add`,onClick:u,children:n(`userPriceAdd`)}),(0,m.jsxs)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:a.size===0,onClick:c,children:[n(`userPriceRemoveSelected`),a.size>0?` (${a.size})`:``]}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-user-price-save`,onClick:h,children:n(`userPriceSave`)})]})]})]})}function Bi({stats:e,t,onClose:n,userPrices:r,onUserPrices:i,health:a,balances:o,reconcile:s,quotas:c,relayQuotas:l,currency:u,onCurrency:f,language:h,onLanguage:g,turns:_,renderSlot:v,budgetEnabled:b,budgetAmount:x,onToggleBudget:S,onBudgetAmount:C,modelBudgets:w,monthModelCost:T,onModelBudget:ee,peakConfig:E,onPeakConfig:D,onPreviewPeak:O,floatPrefs:k,onFloatPrefs:te,cardPrefs:A,onCardPrefs:j,sitePrefs:M,onSitePrefs:ie,liveCostPrefs:ae,onLiveCostPrefs:oe,quotasStale:se,balanceStale:ce,navigateToSession:le}){let N=(0,d.useSyncExternalStore)(li.subscribe,li.read),ue=si(N),de=N?.projectedTokens??N?.pressureTokens,fe=ci(N),pe=(0,d.useMemo)(()=>ui(e.bySession??[]),[e.bySession]),me=(0,d.useMemo)(()=>fi(pe),[pe]),[he,ge]=(0,d.useState)(void 0),ve=(0,d.useCallback)(e=>{let n=le(e);if(n===`opened`){ge(void 0);return}ge(t(n===`unavailable`?`sessionOpenUnavailable`:`sessionOpenFailed`))},[le,t]),[ye,Se]=(0,d.useState)(`cost`),{total:P,byModel:Te,byDay:F}=e,[L,Ee]=(0,d.useState)(`overview`),[De,R]=(0,d.useState)(7),[Oe,ke]=(0,d.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),Ae=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},je=(0,d.useCallback)(()=>{let e=Ae();ke(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[Fe,Re]=(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}),ze=(0,d.useCallback)(e=>{let t=Ae();Re(t=>new Set(t).add(e));try{window.localStorage.setItem(`dsh-billing:notice-${e}-dismissed`,t)}catch{}},[]),[Be,Ve]=(0,d.useState)(`month`),[He,Ue]=(0,d.useState)(`cost`),[We,Ke]=(0,d.useState)(Ne),[qe,Je]=(0,d.useState)(Ie),[Ye,Xe]=(0,d.useState)(`budget`),[Ze,V]=(0,d.useState)(``),H=e=>mi(Ze,e);(0,d.useEffect)(()=>{if(L!==`settings`||typeof IntersectionObserver>`u`)return;let e=Array.from(document.querySelectorAll(`[id^="settings-"]`)).filter(e=>!e.closest(`[hidden]`));if(e.length===0)return;let t=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&&Xe(t.slice(9))},{rootMargin:`-80px 0px -55% 0px`});for(let n of e)t.observe(n);return()=>{t.disconnect()}},[L]);let Qe=(0,d.useCallback)(e=>{if(Xe(e),typeof document>`u`)return;let t=document.getElementById(`settings-${e}`);if(t===null)return;let n=t.closest(`.${B.dashboardBody}`);if(n===null)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+r,behavior:`smooth`})},[]),$e=(0,d.useCallback)(e=>{Ke(e),Pe(e)},[]),et=(0,d.useCallback)(e=>{Je(e),Le(e)},[]);(0,d.useEffect)(()=>{typeof document>`u`||(document.documentElement.dataset.density=We,document.documentElement.dataset.motion=qe)},[We,qe]),(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;t?.density!==void 0&&Ke(t.density)},t=e=>{let t=e.detail;t?.motion!==void 0&&Je(t.motion)};return window.addEventListener(Me,e),window.addEventListener(z,t),()=>{window.removeEventListener(Me,e),window.removeEventListener(z,t)}},[]);let[tt,nt]=(0,d.useState)(ne),rt=(0,d.useMemo)(()=>c.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[c]),[it,at]=(0,d.useState)(),[ot,st]=(0,d.useState)(new Set),[ct,ut]=(0,d.useState)(!1),[U,dt]=(0,d.useState)(``),ft=(0,d.useCallback)(e=>{st(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),pt=(0,d.useMemo)(()=>ri(e.bySession??[]),[e.bySession]),mt=e=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:G(e.cost)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.lastActive>0?`${q(e.lastActive)} ${Si(e.lastActive)}`:`—`})]}),ht=(e,n)=>(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:y(B.sessionChildRow,n>0&&B.sessionSubDeepRow),"data-testid":`billing-session-sub-row`,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),children:t(`sessionSubRow`)}),(e.subCalls??0)>0&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-session-sub-chain`,children:e.subCost!==void 0&&e.subCost>0?t(`sessionSubCost`).replace(`{cost}`,G(e.subCost)):t(`sessionSubCalls`).replace(`{calls}`,(e.subCalls??0).toLocaleString())}),(0,m.jsx)(`span`,{className:B.modelProvider,children:e.title??e.id.slice(0,8)})]}),mt(e)]}),e.subs?.map(e=>ht(e,n+1))]},e.id),gt=(0,d.useMemo)(()=>pi(e.bySession??[],U),[e.bySession,U]),_t=(0,d.useMemo)(()=>[...new Set([...Object.keys(T),...Object.keys(w)])].map(e=>{let t=Ht(e);return{key:e,name:t.key===`other`?void 0:t.name,cost:T[e]??0}}).sort((e,t)=>t.cost-e.cost),[T,w]),[vt,yt]=(0,d.useState)(()=>new Set(be())),bt=(0,d.useCallback)(e=>{yt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),xe([...n]),n})},[]),[Ct,wt]=(0,d.useState)(()=>Ce()),Tt=(0,d.useCallback)(()=>{wt(e=>{let t=!e;return we(t),t})},[]),[Et,Dt]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=!0;return Di().then(t=>{e&&t!==void 0&&Dt(t)}),()=>{e=!1}},[]);let Ot=(0,d.useCallback)(()=>{let e=!Et;Dt(e),Oi(e).then(t=>{t||Dt(!e)})},[Et]),kt=lt(),[At,W]=(0,d.useState)(!1),jt=(0,d.useCallback)(()=>{At||(W(!0),Mi().finally(()=>{W(!1)}))},[At]),Mt=Ai,G=e=>K(Xt(e,u),u),Nt=u===`usd`?`$`:u===`eur`?`€`:`¥`,Pt=h,Ft=e=>Qn(e,Pt),[It,Lt]=(0,d.useState)(``),[Rt,zt]=(0,d.useState)(()=>_e()),[Bt,Vt]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{let e=setInterval(()=>{Vt(Date.now())},3e4);return()=>{clearInterval(e)}},[]);let Ut=c.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),Gt=E.leadMin*6e4,qt=(e,n)=>e===0?t(`free`):Zt(Qt(e,n,u,kt.rate),u===`usd`?`USD`:u===`eur`?`EUR`:`CNY`),Yt=(0,d.useMemo)(()=>Un([..._].reverse()),[_]),en={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},tn=en.peak/2,nn=Sr(F,q()),on=e=>o.find(t=>$(t.provider)===$(e)),Y=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),dn=e=>{if(e===void 0)return(0,m.jsx)(`span`,{className:B.na,children:`—`});if(e.error===`unconfigured`)return t(`balanceUnconfigured`);if(e.error===`unauthorized`)return t(`balanceUnauthorized`);if(e.error===`unreachable`)return t(`balanceUnreachable`);if(e.totalBalance===void 0)return(0,m.jsx)(`span`,{className:B.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:G(e.totalBalance),r=e.currency===`USD`?e.totalBalance*kt.rate:e.totalBalance,i=nn>0?Math.floor(r/nn):void 0;return(0,m.jsxs)(`span`,{className:B.balanceCell,children:[(0,m.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,m.jsx)(`button`,{type:`button`,className:y(B.balanceDaysBadge,i<=3&&B.balanceDaysBadgeLow),"data-testid":`billing-balance-days-badge`,title:t(`balanceDays`).replace(`{days}`,String(i)),"aria-label":`${e.displayName} ${t(`balanceDays`).replace(`{days}`,String(i))}`,onClick:t=>{t.stopPropagation(),at(it===e.provider?void 0:e.provider)},children:`?`}),it===e.provider&&(0,m.jsx)(Li,{balance:e,days:i??0,dailyBurn:nn,money:G,t,onClose:()=>{at(void 0)}})]})},fn=Object.keys(F).sort(),pn=q(),mn=F[pn]?.cost??0,gn=pn.slice(0,7),_n=pn.slice(0,4),X=fn.reduce((e,t)=>e+(t.startsWith(gn)?F[t]?.cost??0:0),0),vn=fn.reduce((e,t)=>e+(t.startsWith(_n)?F[t]?.cost??0:0),0),yn=(0,d.useMemo)(()=>Cr(F,gn,pn)+c.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[F,gn,pn,c]),bn=(0,d.useMemo)(()=>{if(!(b&&x>0))return null;let e=x-X;return{over:e<=0,remainRatio:Math.max(0,Math.min(1,e/x)),remainCny:Math.max(0,e)}},[b,x,X]),Z=(0,d.useMemo)(()=>{let e=[];for(let t=De-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push(q(n.getTime()))}return e},[De]),Sn=Z.at(-1)??pn,Cn=(0,d.useMemo)(()=>Object.entries(F).map(([e,t])=>({date:e,value:He===`tokens`?Er(t):t.cost})),[F,He]),wn=(0,d.useMemo)(()=>Cn.reduce((e,t)=>e+t.value,0),[Cn]),Tn=wr(F),En=Tr(F),On=(0,d.useMemo)(()=>Z.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=F[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:Er(i)}}),[Z,F,e.byDayModels]),kn=(0,d.useMemo)(()=>Object.entries(Te).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=Ht(e),r=n.key===`other`,i=r?Ir(e):void 0,a={input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,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:Jt(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:hr[t%hr.length]??`#8b95a3`})),[Te]),jn=(0,d.useMemo)(()=>M.hideUnidentified?l.filter(e=>e.kind!==`unknown`):l,[l,M.hideUnidentified]),Mn=(0,d.useMemo)(()=>{let n=e.byDayModelsSite;if(Ct){let t=q();n={[t]:e.byDayModelsSite?.[t]??{}}}let r=new Map;for(let t of Object.values(n??{}))for(let[n,i]of Object.entries(t))for(let[t,a]of Object.entries(i)){let i=r.get(t);i===void 0&&(i=new Map,r.set(t,i));let o=i.get(n)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss: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.cost+=a.cost,o.allPlan=o.allPlan&&(a.plan??e.byModel?.[n]?.plan===!0),i.set(n,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=Ht(e),a=i.key===`other`,o=a?Ir(e)??i.provider:i.provider;return{key:e,name:a?e:i.name,provider:o,color:hr[r%hr.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:Jt(i,{input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,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 s=e=>rr(e,Pt)??t(`channelUnknown`),l=new Map,u=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=s(e),r=l.get(n);if(r===void 0)l.set(n,[...t]),u.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=u.get(n)??`unknown`,a=f(e);p[a]>p[i]&&(u.set(n,a),d.set(n,e))}}let m=new Map,h=new Map;for(let e of c){if(e.status===`not-configured`)continue;let t=e.displayName??Rr(e.provider),n=s(`direct:${e.provider}`),r=l.has(t)?t:l.has(n)?n:void 0,i=r??`sub:${Rr(e.provider)}`;h.set(i,r??Rr(e.provider));let a=m.get(i);a===void 0?m.set(i,[e]):a.push(e)}let g=e=>e===s(`direct:deepseek`)||e===s(`site:https://api.deepseek.com`)?on(`deepseek`)??on(e):on(e),_=[];for(let[e,t]of l)_.push({id:`ch:${d.get(e)??e}`,name:e,models:t,subscriptions:m.get(e)??[],balance:g(e),dot:hi(a,t[0]?.provider??``),channelKind:u.get(e)??`unknown`});for(let[e,t]of h)l.has(e)||_.push({id:e,name:t,models:[],subscriptions:m.get(e)??[],balance:on(t),dot:hi(a,t),channelKind:`vendor`});let v=new Set(_.flatMap(e=>[$(e.name),...e.balance===void 0?[]:[$(e.balance.provider)]]));for(let e of o)v.has($(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&_.push({id:`bal:${e.provider}`,name:e.displayName,models:[],subscriptions:[],balance:e,dot:hi(a,e.displayName),channelKind:`vendor`});return _.filter(e=>M.hideUnidentified&&e.channelKind===`unknown`?!1:!Ct||e.models.length>0).sort((e,t)=>{let n=bi(t)-bi(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,c,o,a,Pt,t,Ct,M.hideUnidentified]),Nn=(0,d.useMemo)(()=>Mn.filter(e=>e.models.length>0||e.subscriptions.length>0).map(e=>e.id),[Mn]),Fn=Nn.length>0&&Nn.every(e=>vt.has(e)),In=()=>{let e=new Set(Fn?[]:Nn);yt(e),xe([...e])},Ln=(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`model`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`calls`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`inputTokens`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`outputTokens`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`actual`)})]})}),Rn=e=>(0,m.jsx)(`span`,{className:B.modelCell,children:(0,m.jsxs)(`span`,{children:[(0,m.jsxs)(`span`,{className:B.modelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:B.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,m.jsx)(`span`,{className:B.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,m.jsx)(`span`,{className:B.modelProvider,children:Ft(e.provider)})]})}),zn=e.bySite?.unknown?.calls??0,Vn=kn.reduce((e,t)=>e+t.estimated,0),Hn=P.cost>0||zn>0?P.cost:Vn,Q=(0,d.useMemo)(()=>{if(tt===`all`){let e,t=0;for(let[n,r]of Object.entries(F)){let i=Er(r);i>t&&(t=i,e=n)}return{cost:Hn,calls:P.calls,input:P.input,output:P.output,cacheHit:P.cacheHit,cacheMiss:P.cacheMiss,reasoning:P.reasoning??0,peakDay:e,peakTokens:t}}return kr(F,q(),tt)},[tt,Hn,P,F]),Wn=(0,d.useMemo)(()=>kn.map(e=>({key:e.key,name:e.name,color:e.color})),[kn]),Gn=On.length>=2?On.at(-2)?.cost??0:0,Kn=Gn>0?(mn-Gn)/Gn*100:0;return(0,m.jsx)(p.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:y(B.dashboardModal,`dsh-billing-modal`),children:(0,m.jsxs)(`div`,{className:B.dashboard,"data-testid":`billing-dashboard`,children:[(0,m.jsxs)(`div`,{className:B.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,m.jsxs)(`div`,{children:[v(`billing.dashboard.decor`,{position:`head`}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:B.dashboardTitle,children:t(`title`)}),v(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,m.jsxs)(`p`,{className:B.dashboardSubtitle,children:[t(`lastUpdated`),` `,Sn,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,m.jsxs)(`div`,{className:B.dashboardRight,children:[(0,m.jsx)(`span`,{className:B.currencyToggle,role:`group`,"aria-label":t(`language`),children:[`en`,`zh`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.currencyButton,h===e&&B.currencyButtonActive),"aria-pressed":h===e,"data-testid":`billing-language-${e}`,onClick:()=>{g(e)},children:e===`en`?`EN`:`中`},e))}),(0,m.jsx)(`span`,{className:B.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`,`eur`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.currencyButton,u===e&&B.currencyButtonActive),"aria-pressed":u===e,"data-testid":`billing-currency-${e}`,title:t(e===`cny`?`currencyCny`:e===`usd`?`currencyUsd`:`currencyEur`),onClick:()=>{f(e)},children:e===`cny`?`¥ CNY`:e===`usd`?`$ USD`:`€ EUR`},e))}),a.checked&&(0,m.jsxs)(`span`,{className:y(B.healthBadge,a.available?B.healthBadgeOk:B.healthBadgeBad),children:[(0,m.jsx)(`span`,{className:y(B.healthDot,a.available?B.healthOk:B.healthBad),role:`img`,"aria-label":a.available?t(`healthDotLive`):t(`healthDotFailed`),title:a.available?t(`healthDotLive`):t(`healthDotFailed`)}),a.available?`${t(`healthModelsLive`).replace(`{n}`,String(a.models))}${a.failures>0?` · ${t(`healthVendorsDown`).replace(`{n}`,String(a.failures))}`:``}`:t(`healthVendorsUnavailable`).replace(`{n}`,String(a.failures))]}),(0,m.jsx)(`button`,{type:`button`,className:B.closeButton,"aria-label":t(`close`),"data-testid":`billing-close`,onClick:n,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`})]})})]})]}),e.staleSnapshot===!0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-stale-snapshot`,children:t(`staleSnapshotNotice`)}),(0,m.jsx)(`nav`,{className:B.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:_r.map(e=>(0,m.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":L===e.id,"aria-controls":`billing-tab-panel-${e.id}`,className:y(B.tabButton,L===e.id&&B.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{Ee(e.id)},children:[(0,m.jsx)(`span`,{className:B.tabRailIcon,"aria-hidden":`true`,children:yr[e.id]}),(0,m.jsx)(`span`,{className:B.tabNavLabel,children:t(e.labelKey)})]},e.id))}),(0,m.jsxs)(`div`,{className:B.dashboardBody,children:[L===`overview`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[s?.kind===`drift`&&s.spent!==void 0&&Oe!==Ae()&&(0,m.jsxs)(`div`,{className:B.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,m.jsx)(`span`,{className:B.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:B.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,s.provider??``).replace(`{spent}`,G(s.spent)).replace(`{today}`,G(s.todayOfficialCost??0))}),(0,m.jsx)(`button`,{type:`button`,className:B.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:je,children:t(`reconcileDismiss`)})]}),ce===!0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-balance-stale`,children:t(`balanceStaleNotice`)}),(0,m.jsxs)(`section`,{className:B.hero,"data-testid":`billing-hero`,children:[v(`billing.dashboard.decor`,{position:`hero`}),(0,m.jsxs)(`div`,{className:B.heroTop,children:[(0,m.jsxs)(`div`,{className:B.heroMain,children:[(0,m.jsx)(`span`,{className:B.heroLabel,children:t(`monthCost`)}),(0,m.jsxs)(`div`,{className:B.heroReadout,children:[(0,m.jsx)(`span`,{className:B.heroCurrency,"aria-hidden":`true`,children:Nt}),(0,m.jsx)(`span`,{className:B.heroValue,children:G(X).slice(1)})]}),(0,m.jsxs)(`span`,{className:B.heroMeta,children:[P.calls.toLocaleString(),` `,t(`calls`),yn>0&&(0,m.jsxs)(`span`,{className:B.heroPred,children:[` `,t(`monthProjected`),` `,G(yn)]})]})]}),bn!==null&&(0,m.jsxs)(`div`,{className:B.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,m.jsxs)(`div`,{className:B.heroGaugeDial,children:[(0,m.jsxs)(`svg`,{className:B.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:B.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,m.jsx)(`circle`,{className:y(B.heroGaugeArc,bn.over&&B.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${bn.remainRatio*326.7} 326.7`},stroke:bn.over?void 0:`url(#heroRingGrad)`})]}),(0,m.jsxs)(`span`,{className:B.heroGaugeCenter,children:[(0,m.jsxs)(`span`,{className:y(B.heroGaugeRemain,bn.over&&B.heroGaugeRemainOver),children:[Nt,Xt(bn.remainCny,u).toFixed(2)]}),(0,m.jsx)(`span`,{className:B.heroGaugeLabel,children:t(`budgetRemain`)})]})]}),(0,m.jsxs)(`span`,{className:B.heroGaugeSub,children:[G(X),` / `,G(x)]})]})]}),(0,m.jsxs)(`div`,{className:B.heroSide,children:[(0,m.jsxs)(`div`,{className:B.heroSideItem,children:[(0,m.jsx)(`span`,{className:B.heroSideLabel,children:t(`yearCost`)}),(0,m.jsx)(`span`,{className:B.heroSideValue,children:G(vn)})]}),(0,m.jsxs)(`div`,{className:B.heroSideItem,children:[(0,m.jsx)(`span`,{className:B.heroSideLabel,children:t(`todayCost`)}),(0,m.jsxs)(`span`,{className:B.heroSideValue,children:[G(mn),(0,m.jsxs)(`span`,{className:y(B.delta,Kn>=0?B.deltaUp:B.deltaDown),children:[Kn>=0?`▲`:`▼`,` `,Math.abs(Kn).toFixed(1),`%`]})]})]}),yn>0&&(0,m.jsxs)(`div`,{className:B.heroSideItem,children:[(0,m.jsx)(`span`,{className:B.heroSideLabel,children:t(`monthProjected`)}),(0,m.jsx)(`span`,{className:B.heroSideValue,children:G(yn)})]}),yn<=0&&(0,m.jsx)(`span`,{className:B.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&!Fe.has(`unpriced`)&&(0,m.jsxs)(`div`,{className:B.unpricedHint,"data-testid":`billing-unpriced-hint`,children:[(0,m.jsx)(`span`,{className:B.unpricedHintBody,children:t(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0))}),(0,m.jsx)(`button`,{type:`button`,className:B.noticeDismiss,"data-testid":`billing-unpriced-dismiss`,"aria-label":t(`close`),onClick:()=>{ze(`unpriced`)},children:`×`})]}),(e.total.searchCalls??0)>0&&!Fe.has(`search-estimate`)&&(0,m.jsxs)(`div`,{className:B.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:[(0,m.jsx)(`span`,{className:B.unpricedHintBody,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,G(e.searchCallEstimateCny??0))}),(0,m.jsx)(`button`,{type:`button`,className:B.noticeDismiss,"data-testid":`billing-search-estimate-dismiss`,"aria-label":t(`close`),onClick:()=>{ze(`search-estimate`)},children:`×`})]}),(e.unreadableSessions??0)>0&&!Fe.has(`unreadable`)&&(0,m.jsxs)(`div`,{className:B.staleNotice,"data-testid":`billing-sessions-unreadable`,children:[(0,m.jsxs)(`div`,{className:B.staleNoticeBody,children:[t(`unreadableNotice`).replace(`{count}`,String(e.unreadableSessions)),(e.unreadableNoLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:B.staleNoticeSub,"data-testid":`billing-sessions-no-ledger`,children:t(`unreadableNoLedgerNotice`).replace(`{count}`,String(e.unreadableNoLedgerSessions))}),(e.unreadableFormatSessions??0)>0&&(0,m.jsx)(`div`,{className:B.staleNoticeSub,"data-testid":`billing-sessions-format-unsupported`,children:t(`unreadableFormatNotice`).replace(`{count}`,String(e.unreadableFormatSessions))})]}),(0,m.jsx)(`button`,{type:`button`,className:B.noticeDismiss,"data-testid":`billing-unreadable-dismiss`,"aria-label":t(`close`),onClick:()=>{ze(`unreadable`)},children:`×`})]}),(0,m.jsxs)(`div`,{className:B.kpiZone,children:[(0,m.jsxs)(`div`,{className:B.kpiZoneHead,children:[(0,m.jsx)(`span`,{className:B.kpiZoneLabel,children:t(`kpiRange`)}),(0,m.jsx)(`div`,{className:B.heatmapRangeSwitch,"data-testid":`billing-kpi-range`,role:`group`,"aria-label":t(`kpiRange`),children:[[`today`,`avgRangeToday`],[`7d`,`avgRange7d`],[`week`,`avgRangeWeek`],[`month`,`avgRangeMonth`],[`all`,`avgRangeAll`]].map(([e,n])=>(0,m.jsx)(`button`,{type:`button`,className:y(B.heatmapRangeButton,tt===e&&B.heatmapRangeButtonActive),"data-testid":`billing-kpi-range-${e}`,"aria-pressed":tt===e,onClick:()=>{nt(e),re(e)},children:t(n)},e))})]}),(0,m.jsx)(`section`,{className:B.kpiGrid,"data-testid":`billing-kpi-grid`,children:(()=>{let e=Object.keys(F).sort().slice(-7),n=q(),r=e.indexOf(n),i=(e,t)=>e[t]??0,a=e.map(e=>F[e]?.cost??0),o=e.map(e=>F[e]?.calls??0),s=e.map(e=>{let t=F[e];return t===void 0?0:Er(t)}),c=e.map(e=>{let t=F[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)=>(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=>(0,m.jsxs)(`span`,{className:y(B.kpiDelta,e>0?B.kpiDeltaUp:e<0?B.kpiDeltaDown:B.kpiDeltaFlat),children:[e>0?`▲`:e<0?`▼`:``,` `,Math.abs(e).toFixed(1),`%`]});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescCacheHit`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`cacheHitRate`)})}),g(f)]}),(0,m.jsx)(`span`,{className:y(B.kpiValue,B.kpiGreen),children:$t(Q.cacheHit+Q.cacheMiss>0?Q.cacheHit/(Q.cacheHit+Q.cacheMiss)*100:0)}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(c,`var(--ds-cyan)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[J(Q.cacheHit),` / `,J(Q.cacheHit+Q.cacheMiss),(P.cacheWrite??0)>0?` · ${t(`tokenCacheWrite`)} ${J(P.cacheWrite??0)}`:``]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescTokens`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokens`)})}),g(d)]}),(0,m.jsx)(`span`,{className:B.kpiValue,children:J(Q.input+Q.output)}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(s,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[t(`inputTokens`),` `,J(Q.input),` · `,t(`outputTokens`),` `,J(Q.output)]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-avg`,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescAvgCost`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`avgCost`)})}),g(l)]}),(0,m.jsx)(`span`,{className:B.kpiValue,children:G(Q.calls>0?Q.cost/Q.calls:0)}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(a,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[t(`calls`),` `,Q.calls.toLocaleString()]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescCalls`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`calls`)})}),g(u)]}),(0,m.jsx)(`span`,{className:B.kpiValue,children:Q.calls.toLocaleString()}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(o,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[kn.length,` `,t(`models`)]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-think`,children:[(0,m.jsx)(`div`,{className:B.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:t(`kpiDescReasoning`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokenReasoningShare`)})})}),(0,m.jsx)(`span`,{className:y(B.kpiValue,B.kpiGreen),children:$t(Q.output>0?Q.reasoning/Q.output*100:0)}),(0,m.jsx)(`span`,{className:B.kpiDetail,children:J(Q.reasoning)})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-io`,children:[(0,m.jsx)(`div`,{className:B.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:t(`kpiDescIo`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokenIo`)})})}),(0,m.jsx)(`span`,{className:B.kpiValue,children:(Q.output>0?Q.input/Q.output:0).toFixed(2)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[J(Q.input),` / `,J(Q.output)]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-peak`,children:[(0,m.jsx)(`div`,{className:B.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:t(`kpiDescPeak`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokenPeak`)})})}),(0,m.jsx)(`span`,{className:B.kpiValue,children:Q.peakTokens>0?un(Q.peakTokens):`—`}),(0,m.jsx)(`span`,{className:B.kpiDetail,children:Q.peakDay??`—`})]})]})})()})]}),(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-heatmap`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`heatmap`)}),(0,m.jsx)(`div`,{className:B.heatmapRangeSwitch,"data-testid":`billing-heatmap-metric`,role:`group`,"aria-label":t(`heatmap`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.heatmapRangeButton,He===e&&B.heatmapRangeButtonActive),"data-testid":`billing-heatmap-metric-${e}`,"aria-pressed":He===e,onClick:()=>{Ue(e)},children:t(e===`cost`?`metricCost`:`metricTokens`)},e))}),(0,m.jsx)(`div`,{className:B.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`half`,`year`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.heatmapRangeButton,Be===e&&B.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":Be===e,onClick:()=>{Ve(e)},children:t(e===`month`?`heatmapMonth`:e===`half`?`heatmapHalf`:`heatmapYear`)},e))}),(0,m.jsxs)(`span`,{className:B.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`heatmapTotal`),` `,He===`tokens`?J(wn):G(wn),` · `,t(`activeDays`),` `,Tn,` · `,t(`streakDays`),` `,En]})]}),(0,m.jsx)(Bn,{days:Cn,currency:u,t,range:Be,unit:He})]})]}),L===`context`&&(0,m.jsx)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-context`,children:N===void 0?(0,m.jsx)(`p`,{className:B.contextEmpty,"data-testid":`billing-context-empty`,children:t(`contextNoData`)}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`section`,{className:B.contextCard,"data-testid":`billing-context-card`,children:[(0,m.jsxs)(`div`,{className:B.contextHead,children:[(0,m.jsx)(`span`,{className:B.contextTitle,children:t(`contextOccupancy`)}),ue!==void 0&&(0,m.jsx)(`span`,{className:B.contextRatio,children:`${String(Math.round(ue*100))}%`})]}),ue!==void 0&&(0,m.jsx)(`div`,{className:B.contextBar,"data-testid":`billing-context-bar`,role:`img`,"aria-label":`${t(`contextOccupancy`)} ${String(Math.round(ue*100))}%`,children:(0,m.jsx)(`span`,{className:B.contextBarFill,style:{width:`${String(Math.round(ue*100))}%`}})}),(0,m.jsxs)(`div`,{className:B.contextBody,children:[de!==void 0&&(0,m.jsx)(`span`,{className:B.contextValue,children:J(de)}),N.contextWindow!==void 0&&(0,m.jsx)(`span`,{className:B.contextHint,children:t(`contextWindow`).replace(`{window}`,J(N.contextWindow))})]}),(0,m.jsxs)(`div`,{className:B.contextStats,children:[N.projectedTokens!==void 0&&(0,m.jsxs)(`div`,{className:B.contextStat,children:[(0,m.jsx)(`span`,{className:B.contextStatLabel,children:t(`contextNextRequest`)}),(0,m.jsx)(`span`,{className:B.contextStatValue,children:J(N.projectedTokens)})]}),N.pressureTokens!==void 0&&(0,m.jsxs)(`div`,{className:B.contextStat,children:[(0,m.jsx)(`span`,{className:B.contextStatLabel,children:t(`contextLastRequest`)}),(0,m.jsx)(`span`,{className:B.contextStatValue,children:J(N.pressureTokens)})]})]})]}),fe.length>0&&(0,m.jsxs)(`section`,{className:B.contextCard,"data-testid":`billing-context-breakdown`,children:[(0,m.jsx)(`div`,{className:B.contextHead,children:(0,m.jsx)(`span`,{className:B.contextTitle,children:t(`contextComposition`)})}),(()=>{let e=Math.max(...fe.map(e=>e.tokens),1);return(0,m.jsx)(`div`,{className:B.contextBreakdown,children:fe.map(n=>(0,m.jsxs)(`div`,{className:B.contextBreakRow,children:[(0,m.jsx)(`span`,{className:B.contextBreakLabel,children:t(n.key===`system`?`contextSystem`:n.key===`tools`?`contextTools`:`contextMessages`)}),(0,m.jsx)(`span`,{className:B.contextBreakTrack,children:(0,m.jsx)(`span`,{className:B.contextBreakFill,style:{width:`${String(Math.round(n.tokens/e*100))}%`}})}),(0,m.jsx)(`span`,{className:B.contextBreakValue,children:J(n.tokens)})]},n.key))})})(),(0,m.jsx)(`p`,{className:B.contextFootnote,children:t(`contextCompositionHint`)})]})]})}),L===`agents`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-agents`,children:[(0,m.jsxs)(`section`,{className:B.agentSummary,"data-testid":`billing-agent-summary`,children:[(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:String(me.agents)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsCount`)})]}),(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:String(me.delegations)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsDelegations`)})]}),(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:String(me.roots)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsRoots`)})]}),me.costliest!==void 0&&me.costliest.chainCost>0&&(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:G(me.costliest.chainCost)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsMostExpensive`)})]})]}),pe.length===0||me.delegations===0?(0,m.jsx)(`p`,{className:B.contextEmpty,"data-testid":`billing-agents-empty`,children:t(`agentsNoData`)}):(0,m.jsx)(`div`,{className:B.agentTree,"data-testid":`billing-agent-tree`,children:(()=>{let e=n=>(0,m.jsxs)(`div`,{className:B.agentNode,children:[(0,m.jsxs)(`div`,{className:B.agentRow,style:{paddingLeft:`${String(n.depth*16)}px`},children:[(0,m.jsx)(`span`,{className:B.agentKind,children:n.depth===0?t(`agentsRoot`):t(`agentsSubagent`)}),(0,m.jsx)(`span`,{className:B.agentTitle,children:n.title??`${t(`sessionUntitled`)} · ${n.id.slice(0,8)}`}),(0,m.jsx)(`span`,{className:B.agentCalls,children:n.calls.toLocaleString()}),(0,m.jsx)(`span`,{className:B.agentCost,children:G(n.cost)}),n.children.length>0&&(0,m.jsxs)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-agent-chain`,children:[t(`agentsChainTotal`),` `,G(n.chainCost)]})]}),n.children.map(e)]},n.id);return pe.map(e)})()})]}),L===`settings`&&(0,m.jsx)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-settings`,children:(0,m.jsxs)(`div`,{className:B.settingsLayout,children:[(0,m.jsx)(`aside`,{className:B.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:t(`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:t(`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:t(`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:t(`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:t(`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:t(`settingsNavAbout`)}].map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(B.settingsNavItem,Ye===e.id&&B.settingsNavItemActive,e.advanced&&B.settingsNavItemAdvanced),"data-testid":`billing-settings-nav-${e.id}`,onClick:()=>{Qe(e.id)},children:[(0,m.jsx)(`span`,{className:B.settingsNavIcon,"aria-hidden":`true`,children:e.icon}),e.label]},e.id))}),(0,m.jsxs)(`div`,{className:B.settingsPane,children:[(0,m.jsx)(`input`,{className:y(B.ubSearch,B.settingsSearch),type:`search`,value:Ze,placeholder:t(`settingsSearchPlaceholder`),"aria-label":t(`settingsSearchPlaceholder`),"data-testid":`billing-settings-search`,onChange:e=>{V(e.target.value)}}),Ze.trim()!==``&&Ui(Ze)&&(0,m.jsx)(`p`,{className:B.setCardDesc,"data-testid":`billing-settings-search-empty`,children:t(`settingsSearchEmpty`).replace(`{query}`,Ze.trim())}),(0,m.jsxs)(`div`,{hidden:H(Hi.display),className:B.setCard,id:`settings-display-pref`,"data-testid":`billing-density-motion-card`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsx)(`h3`,{className:B.setCardTitle,children:t(`settingsSectionDisplay`)})})}),(0,m.jsxs)(`div`,{className:B.densityRow,children:[(0,m.jsxs)(`div`,{className:B.densityLeft,children:[(0,m.jsx)(`strong`,{children:t(`densityLabel`)}),(0,m.jsx)(`span`,{children:t(`densityHint`)})]}),(0,m.jsx)(`div`,{className:B.densityButtons,"data-testid":`billing-density-buttons`,children:[`compact`,`default`,`comfortable`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.densityButton,We===e&&B.densityButtonActive,e===`comfortable`&&B.densityButtonComfortable),"data-testid":`billing-density-${e}`,onClick:()=>{$e(e)},children:t(e===`compact`?`densityCompact`:e==="default"?`densityDefault`:`densityComfortable`)},e))})]}),(0,m.jsxs)(`div`,{className:B.densityRow,children:[(0,m.jsxs)(`div`,{className:B.densityLeft,children:[(0,m.jsx)(`strong`,{children:t(`motionLabel`)}),(0,m.jsx)(`span`,{children:t(`motionHint`)})]}),(0,m.jsx)(`div`,{className:B.densityButtons,"data-testid":`billing-motion-buttons`,children:[`off`,`subtle`,`rich`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.densityButton,qe===e&&B.densityButtonActive),"data-testid":`billing-motion-${e}`,onClick:()=>{et(e)},children:t(e===`off`?`motionOff`:e===`subtle`?`motionSubtle`:`motionRich`)},e))})]})]}),(0,m.jsxs)(`section`,{hidden:H(Hi.budget),className:B.setCard,"data-testid":`billing-budget`,id:`settings-budget`,children:[(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`budget`),(0,m.jsx)(Pi,{label:t(`budgetHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":b,"aria-label":t(`budget`),"data-testid":`billing-budget-toggle`,className:y(B.switch,b&&B.switchOn),onClick:S,children:(0,m.jsx)(`span`,{className:B.switchKnob})})]}),b&&(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`budgetAmount`)}),(0,m.jsxs)(`span`,{className:B.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,m.jsx)(`span`,{className:B.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:B.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:x===0?``:x,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${u===`usd`?`USD`:u===`eur`?`EUR`:`CNY`})`,title:`${t(`budget`)}(${u===`usd`?`USD`:u===`eur`?`EUR`:`CNY`})`,onChange:e=>{C(e.target.valueAsNumber)}})]})]}),x>0&&(()=>{let e=X/x*100;return(0,m.jsx)(`div`,{className:B.ctlRowStretch,children:(0,m.jsx)(`div`,{className:B.prog,role:`progressbar`,"aria-valuenow":Math.min(e,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),"data-testid":`billing-budget-track`,children:(0,m.jsx)(`div`,{className:y(B.progFill,e>=100&&B.budgetFillOver,e>=80&&e<100&&B.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),x>0&&(0,m.jsx)(`p`,{className:B.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,G(X)).replace(`{total}`,G(x))})]}),(0,m.jsxs)(`div`,{className:B.ctlCol,"data-testid":`billing-model-budgets`,children:[(0,m.jsxs)(`span`,{className:B.modelBudgetTitle,children:[t(`modelBudgetTitle`),(0,m.jsx)(Pi,{label:t(`modelBudgetHint`),t})]}),_t.length===0&&(0,m.jsx)(`p`,{className:B.modelBudgetHint,children:t(`emptyHint`)}),(0,m.jsx)(`div`,{className:B.modelBudgetList,children:_t.map(e=>(0,m.jsxs)(`div`,{className:B.modelBudgetRow,children:[(0,m.jsx)(`span`,{className:B.modelBudgetName,title:e.name??e.key,children:e.name??e.key}),(0,m.jsx)(`span`,{className:B.modelBudgetCost,"data-testid":`billing-model-budget-cost-${e.key}`,children:G(e.cost)}),(0,m.jsxs)(`span`,{className:B.inp,children:[(0,m.jsx)(`span`,{className:B.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:B.budgetInput,type:`number`,min:0,step:1,value:w[e.key]??``,placeholder:t(`modelBudgetPlaceholder`),"aria-label":`${t(`modelBudgetTitle`)} · ${e.name??e.key}`,"data-testid":`billing-model-budget-${e.key}`,onChange:t=>{ee(e.key,t.target.valueAsNumber)}})]})]},e.key))})]})]}),(0,m.jsxs)(`section`,{hidden:H(Hi.alert),className:B.setCard,"data-testid":`billing-peak-alert-settings`,id:`settings-alert`,children:[(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`peakAlert`),(0,m.jsx)(Pi,{label:t(`peakAlertHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":E.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:y(B.switch,E.enabled&&B.switchOn),onClick:()=>{D({...E,enabled:!E.enabled})},children:(0,m.jsx)(`span`,{className:B.switchKnob})})]}),E.enabled&&(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`label`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,m.jsx)(`span`,{className:B.inp,children:(0,m.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:E.leadMin,className:B.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);D({...E,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):E.leadMin})}})})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertPos`)}),(0,m.jsx)(`div`,{className:B.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,m.jsxs)(`label`,{className:B.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:E.position===e,onChange:()=>D({...E,position:e})}),(0,m.jsx)(`span`,{className:B.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertMode`)}),(0,m.jsx)(`div`,{className:B.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,m.jsxs)(`label`,{className:B.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:E.mode===e,onChange:()=>D({...E,mode:e})}),(0,m.jsx)(`span`,{className:B.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,m.jsxs)(`label`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,m.jsx)(`input`,{type:`checkbox`,checked:E.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{D({...E,webNotify:e.target.checked})}})]}),(0,m.jsx)(`div`,{className:B.ctlRow,children:(0,m.jsx)(`button`,{type:`button`,className:B.btn,onClick:O,children:t(`peakAlertPreview`)})})]})]}),(0,m.jsx)(`section`,{hidden:H(Hi.toggles),className:B.setCard,"data-testid":`billing-toggle-setting`,id:`settings-display`,children:(0,m.jsxs)(`div`,{className:B.setGrid3,children:[(0,m.jsx)(`div`,{className:B.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`usageStatsTool`),(0,m.jsx)(Pi,{label:t(`usageStatsToolHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Et,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:y(B.switch,Et&&B.switchOn),onClick:Ot,children:(0,m.jsx)(`span`,{className:B.switchKnob})})]})}),(0,m.jsxs)(`div`,{className:B.setCell,"data-testid":`billing-livecost-setting`,children:[(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`liveCostBar`),(0,m.jsx)(Pi,{label:t(`liveCostBarHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":ae.show,"aria-label":t(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:y(B.switch,ae.show&&B.switchOn),onClick:()=>oe({...ae,show:!ae.show}),children:(0,m.jsx)(`span`,{className:B.switchKnob})})]}),ae.show&&(0,m.jsxs)(`div`,{className:B.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,m.jsx)(`span`,{className:B.rdoLabel,children:t(`liveCostBarPosition`)}),(0,m.jsx)(Gi,{liveCostPrefs:ae,onLiveCostPrefs:oe,t})]})]}),(0,m.jsx)(`div`,{className:B.setCell,"data-testid":`billing-site-list-setting`,children:(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`siteListDisplay`),(0,m.jsx)(Pi,{label:t(`siteListDisplayHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":M.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:y(B.switch,M.hideUnidentified&&B.switchOn),onClick:()=>ie({hideUnidentified:!M.hideUnidentified}),children:(0,m.jsx)(`span`,{className:B.switchKnob})})]})})]})}),(0,m.jsx)(`section`,{hidden:H(Hi.displayExtra),className:B.setCard,"data-testid":`billing-display-setting`,id:`settings-display-extra`,children:(0,m.jsxs)(`div`,{className:B.setGrid2,children:[(0,m.jsxs)(`div`,{className:B.setCell,"data-testid":`billing-float-setting`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`floatWindow`),(0,m.jsx)(Pi,{label:t(`floatWindowHint`),t})]})})}),(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`floatMode`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,k.mode===`combined`&&B.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>te({mode:`combined`,targets:k.targets}),children:t(`floatModeCombined`)}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,k.mode===`subscription`&&B.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>te({mode:`subscription`,targets:k.targets}),children:t(`floatModeSubscription`)})]})]}),k.mode===`subscription`&&(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`floatTargets`)}),(0,m.jsxs)(`span`,{className:B.ctlGroup,"data-testid":`billing-float-targets`,children:[rt.map(e=>{let t=k.targets.includes(e.id);return(0,m.jsxs)(`label`,{className:B.floatTarget,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>te({mode:`subscription`,targets:t?k.targets.filter(t=>t!==e.id):[...k.targets,e.id]})}),(0,m.jsx)(`span`,{className:B.floatTargetLabel,children:e.label})]},e.id)}),rt.length===0&&(0,m.jsx)(`span`,{className:B.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,m.jsxs)(`div`,{className:B.setCell,"data-testid":`billing-card-setting`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`cardDisplay`),(0,m.jsx)(Pi,{label:t(`cardDisplayHint`),t})]})})}),(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`cardMetric`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.metric===`money`&&B.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>j({...A,metric:`money`}),children:t(`cardMetricMoney`)}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.metric===`tokens`&&B.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>j({...A,metric:`tokens`}),children:t(`cardMetricTokens`)})]})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`cardSpan`)}),(0,m.jsx)(`div`,{className:B.ctlGroup,"data-testid":`billing-card-span`,children:[[`day`,`cardSpanDay`],[`week`,`cardSpanWeek`],[`month`,`cardSpanMonth`]].map(([e,n])=>(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.span===e&&B.floatModeBtnOn),"data-testid":`billing-card-span-${e}`,"aria-pressed":A.span===e,onClick:()=>j({...A,span:e}),children:t(n)},e))})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`cardDeltaBadge`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,"data-testid":`billing-card-delta`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.showDelta&&B.floatModeBtnOn),"data-testid":`billing-card-delta-show`,"aria-pressed":A.showDelta,onClick:()=>j({...A,showDelta:!0}),children:t(`cardDeltaShow`)}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,!A.showDelta&&B.floatModeBtnOn),"data-testid":`billing-card-delta-hide`,"aria-pressed":!A.showDelta,onClick:()=>j({...A,showDelta:!1}),children:t(`cardDeltaHide`)})]})]})]})]})]})}),(0,m.jsx)(`div`,{hidden:H(Hi.advanced),id:`settings-advanced`,children:(0,m.jsx)(zi,{userPrices:r,onUserPrices:i,t})}),(0,m.jsx)(`div`,{hidden:H(Hi.about),id:`settings-about`,children:(0,m.jsx)(An,{t,version:e.pluginVersion})}),(0,m.jsxs)(`section`,{hidden:H(Hi.about),className:B.setCard,"data-testid":`billing-more-works`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsx)(`h3`,{className:B.setCardTitle,children:t(`moreWorksTitle`)})})}),(0,m.jsxs)(`div`,{className:B.moreWorkList,children:[(0,m.jsxs)(`a`,{className:B.moreWorkRow,href:`https://github.com/kenz1117/dsh-engram`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-engram`,children:[(0,m.jsx)(`span`,{className:B.moreWorkName,children:t(`adEngramName`)}),(0,m.jsx)(`span`,{className:B.moreWorkDesc,children:t(`adEngramDesc`)})]}),(0,m.jsxs)(`a`,{className:B.moreWorkRow,href:`https://github.com/kenz1117/dsh-ui-rainbowspeak`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-rainbowspeak`,children:[(0,m.jsx)(`span`,{className:B.moreWorkName,children:t(`adRainbowName`)}),(0,m.jsx)(`span`,{className:B.moreWorkDesc,children:t(`adRainbowDesc`)})]})]})]})]})]})}),L===`trends`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-trend`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`trend`)}),v(`billing.dashboard.decor`,{position:`trend`}),(0,m.jsxs)(`span`,{className:B.ubCardControlGroup,children:[(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,De===e&&B.rangeButtonActive),"aria-pressed":De===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{R(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,ye===e&&B.rangeButtonActive),"aria-pressed":ye===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{Se(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:Sn})]}),(0,m.jsx)(xn,{data:On,models:Wn,currency:u,metric:ye,t})]}),_.length>0&&(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`rounds`)}),Yt.length>0&&(0,m.jsxs)(`span`,{className:B.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[Yt.length,` `,t(`anomaly`)]})]}),(0,m.jsx)(`p`,{className:B.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(_.length))}),(0,m.jsx)(Pn,{rounds:_,flags:Yt,currency:u,t})]}),e.byTier!==void 0&&(()=>{let e=en.peak+en.offPeak;if(e<=0)return null;let n=en.peak/e*100;return(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-share`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`peakShare`)}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,m.jsxs)(`div`,{className:B.shareTrack,"data-testid":`billing-share-track`,children:[(0,m.jsx)(`div`,{className:y(B.shareSeg,B.shareSegPeak),style:{width:`${n}%`}}),(0,m.jsx)(`div`,{className:y(B.shareSeg,B.shareSegOff),style:{width:`${100-n}%`}})]}),(0,m.jsxs)(`div`,{className:B.shareLegend,children:[(0,m.jsxs)(`span`,{className:B.shareItem,children:[(0,m.jsx)(`span`,{className:B.shareDot,style:{background:`var(--ds-blue)`}}),t(`peak`),(0,m.jsxs)(`span`,{className:B.shareValue,"data-testid":`billing-share-peak`,children:[G(en.peak),` · `,n.toFixed(1),`%`]})]}),(0,m.jsxs)(`span`,{className:B.shareItem,children:[(0,m.jsx)(`span`,{className:B.shareDot,style:{background:`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`}}),t(`offPeak`),(0,m.jsxs)(`span`,{className:B.shareValue,"data-testid":`billing-share-offpeak`,children:[G(en.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),tn>0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,G(tn))})]})})()]}),L===`providers`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[jn.length>0&&(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,m.jsx)(`div`,{className:B.panelHead,children:(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`panelRelayQuota`)})}),(0,m.jsx)(`div`,{className:B.providerGroupList,"data-testid":`billing-relay-quotas`,children:jn.map(e=>(0,m.jsxs)(`div`,{className:B.siteRow,"data-testid":`billing-relay-quota`,children:[(0,m.jsxs)(`span`,{className:B.siteRowName,children:[(0,m.jsx)(`span`,{className:y(B.siteKindTag,yi[e.kind]),children:vi(e.kind,t)}),(0,m.jsx)(`span`,{className:B.siteRowTitle,children:e.origin})]}),(0,m.jsxs)(`span`,{className:B.siteRowMeta,children:[e.balance!==void 0&&(0,m.jsxs)(`span`,{className:B.siteRowCost,children:[t(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let n=e.remainingPercent<20;return(0,m.jsxs)(`span`,{className:y(B.siteRowCalls,n&&B.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,m.jsx)(`span`,{className:B.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-providers`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`providerBilling`)}),v(`billing.dashboard.decor`,{position:`models`}),(0,m.jsx)(`span`,{className:B.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${Si(e.updatedAt)}`})]}),se&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),(0,m.jsxs)(`div`,{className:B.providerCtlRow,"data-testid":`billing-provider-controls`,children:[(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,disabled:Nn.length===0,onClick:In,children:t(Fn?`collapseAll`:`expandAll`)}),(0,m.jsxs)(`span`,{className:B.providerTodayToggle,children:[(0,m.jsx)(`span`,{children:t(`todayOnly`)}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Ct,"data-testid":`billing-provider-today-toggle`,className:y(B.switch,Ct&&B.switchOn),onClick:Tt,children:(0,m.jsx)(`span`,{className:B.switchKnob})})]})]}),Mn.length===0?(0,m.jsxs)(`div`,{className:B.emptyState,"data-testid":`billing-provider-empty`,children:[(0,m.jsxs)(`span`,{className:B.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:B.emptyIllDot})]}),(0,m.jsx)(`span`,{className:B.emptyTitle,children:t(Ct?`todayNoConsumption`:`noData`)}),(0,m.jsx)(`span`,{className:B.emptyDesc,children:t(`emptyHint`)})]}):(0,m.jsx)(`div`,{className:B.providerGroupList,"data-testid":`billing-provider-groups`,children:Mn.map(e=>{let n=e.models.length>0||e.subscriptions.length>0,r=n&&vt.has(e.id);return(0,m.jsxs)(`div`,{className:B.providerGroup,"data-testid":`billing-provider-group`,children:[(0,m.jsxs)(`div`,{className:y(B.providerGroupHead,n&&B.providerGroupCollapsible),"data-testid":`billing-provider-group-head`,"aria-expanded":n?r:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,onClick:n?()=>{bt(e.id)}:void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),bt(e.id))}:void 0,children:[(0,m.jsxs)(`span`,{className:B.providerGroupTitle,children:[(0,m.jsx)(`span`,{className:y(B.healthDot,e.dot),role:`img`,"aria-label":Fi(e.dot,t),title:Fi(e.dot,t)}),(()=>{let n=Ft(e.name),r=e.channelKind===`direct`?ar(n):void 0,i=e.channelKind===`direct`?t(`directTag`):e.channelKind===`site`?t(`relayTag`):e.channelKind===`unknown`?t(`unknownTag`):void 0;return(0,m.jsxs)(m.Fragment,{children:[i!==void 0&&(0,m.jsx)(`span`,{className:y(B.kindBadge,e.channelKind===`site`&&B.kindBadgeRelay,e.channelKind===`unknown`&&B.kindBadgeUnknown),"data-testid":`billing-kind-badge`,children:i}),e.channelKind!==`unknown`&&(0,m.jsx)(`span`,{className:B.providerGroupName,children:r??n})]})})(),e.subscriptions.length>0&&(0,m.jsxs)(`span`,{className:B.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` `,t(`planCountUnit`)]})]}),(0,m.jsxs)(`span`,{className:B.providerGroupMeta,children:[(0,m.jsxs)(`span`,{className:B.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,m.jsx)(`span`,{className:B.providerGroupCostLabel,children:t(`cost`)}),e.channelKind===`unknown`?(0,m.jsx)(`span`,{className:B.na,children:`—`}):(0,m.jsx)(`span`,{className:B.providerGroupCostValue,children:G(bi(e))})]}),!Y(e)&&e.balance!==void 0?(0,m.jsxs)(`span`,{className:B.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,m.jsx)(`span`,{className:B.providerGroupBalanceLabel,children:t(`balance`)}),dn(e.balance)]}):(0,m.jsx)(`span`,{className:B.providerGroupBalance,"aria-hidden":`true`}),Xr(e.name)===void 0?(0,m.jsx)(`span`,{className:B.providerGroupRecharge,"aria-hidden":`true`}):(0,m.jsx)(`a`,{className:B.providerGroupRecharge,"data-testid":`billing-group-recharge`,href:Xr(e.name),target:`_blank`,rel:`noreferrer`,title:t(`rechargeHint`),"aria-label":`${Ft(e.name)} ${t(`recharge`)}`,onClick:e=>{e.stopPropagation()},children:t(`recharge`)})]})]}),e.models.length>0&&(0,m.jsx)(`div`,{className:B.providerStatRow,"data-testid":`billing-provider-stat-row`,children:(()=>{let n=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=n.input>0?e.models.reduce((e,t)=>e+t.cacheHitRate,0)/e.models.length:0;return[{lbl:t(`calls`),val:n.calls.toLocaleString(),sub:``},{lbl:t(`inputTokens`),val:J(n.input),sub:r>0?`${t(`cacheHitRate`)} ${r.toFixed(0)}%`:``},{lbl:t(`outputTokens`),val:J(n.output),sub:``},{lbl:t(`cost`),val:G(bi(e)),sub:e.models.length===1?``:`${e.models.length} ${t(`models`)}`}].map((e,t)=>(0,m.jsxs)(`div`,{className:B.providerStatCell,children:[(0,m.jsx)(`div`,{className:B.providerStatLbl,children:e.lbl}),(0,m.jsx)(`div`,{className:B.providerStatVal,children:e.val}),e.sub!==``&&(0,m.jsx)(`div`,{className:B.providerStatSub,children:e.sub})]},t))})()}),r&&(0,m.jsxs)(m.Fragment,{children:[e.channelKind===`unknown`&&(0,m.jsx)(`p`,{className:B.unknownHint,"data-testid":`billing-unknown-hint`,children:t(`unknownChannelHint`)}),e.models.length>0&&(0,m.jsx)(`div`,{className:B.tableScroll,"data-testid":`billing-table-scroll`,children:(0,m.jsxs)(`table`,{className:B.modelTable,children:[Ln,(0,m.jsx)(`tbody`,{children:e.models.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:Rn(e)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.input)}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.output)}),(0,m.jsx)(`td`,{className:B.numCol,children:$t(e.cacheHitRate)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.plan?(0,m.jsxs)(`span`,{className:B.planTag,children:[e.estimated>0?(0,m.jsxs)(`span`,{children:[`≈`,G(e.estimated)]}):null,(0,m.jsx)(`span`,{className:B.planTagBadge,"data-testid":`billing-plan-badge`,children:t(`subscriptionTag`)})]}):e.actual===void 0?e.estimated>0?(0,m.jsxs)(`span`,{title:t(`cellEstimateHint`),children:[`≈`,G(e.estimated)]}):(0,m.jsx)(`span`,{className:B.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,m.jsxs)(`span`,{className:B.bucketCost,children:[(0,m.jsx)(`span`,{className:B.bucketOfficial,children:G(t)}),(0,m.jsx)(`span`,{className:B.bucketSep,children:`/`}),(0,m.jsx)(`span`,{className:B.bucketThird,children:G(n)})]}):G(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,m.jsx)(`div`,{className:B.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=gi(e.status,t);return(0,m.jsxs)(`div`,{className:y(B.subscriptionCard,B.subscriptionCardUpgraded),"data-testid":`billing-subscription-card`,children:[(0,m.jsxs)(`div`,{className:B.subscriptionHead,children:[(0,m.jsx)(`span`,{className:B.subscriptionName,children:Ft(e.displayName)}),e.planType===`code`&&(()=>{let n=Ge(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,m.jsxs)(`span`,{className:B.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,G(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,m.jsx)(`span`,{className:B.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionPlan,children:e.plan})]}),n!==``&&(0,m.jsx)(`div`,{className:B.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,m.jsx)(`div`,{className:B.subscriptionStatus,children:t(`subscriptionNoApi`)}),e.windows.map(e=>(0,m.jsx)(Ni,{window:e,t},e.kind))]},e.provider)})})]})]},e.id)})})]}),(0,m.jsxs)(`div`,{className:B.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,m.jsx)(`span`,{className:B.exportLabel,children:t(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-day`,onClick:()=>{ln(cn(`usage-daily`,`csv`,Object.keys(F)),rn(F),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{ln(cn(`usage-sessions`,`csv`,Object.keys(F)),sn(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{ln(cn(`usage-sites`,`csv`,Object.keys(F)),an(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-json`,onClick:()=>{ln(cn(`usage-stats`,`json`,Object.keys(F)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`sessions`)}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:e.bySession.length>20?t(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(e.bySession.length)):`${e.bySession.length}`}),e.bySession.length>0&&(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-sessions-view-all`,onClick:()=>{ut(!0)},children:t(`sessionsViewAll`).replace(`{count}`,String(e.bySession.length))})]}),(e.staleLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,m.jsxs)(`div`,{className:B.ubTablewrap,"data-testid":`billing-sessions-table`,children:[he!==void 0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-session-nav-notice`,role:`note`,children:he}),(0,m.jsxs)(`table`,{className:B.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`sessionTitle`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`calls`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`actual`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[pt.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:B.emptyRow,children:t(`noData`)})}),pt.slice(0,20).map(e=>{let n=e.children!==void 0||e.subs!==void 0,r=n&&ot.has(e.id),i=xi(e);return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:n?B.sessionGroupRow:void 0,"aria-expanded":n?r:void 0,tabIndex:n?0:void 0,onClick:n?()=>{ft(e.id)}:void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ft(e.id))}:void 0,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:B.modelName,children:(0,m.jsxs)(`button`,{type:`button`,className:B.sessionLink,"data-testid":`billing-session-open`,title:t(`sessionOpen`),onClick:t=>{t.stopPropagation(),ve(e.id)},children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]})}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)}),(i.calls>0||i.cost>0)&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-session-sub`,children:i.cost>0?t(`sessionSubCost`).replace(`{cost}`,G(i.cost)):t(`sessionSubCalls`).replace(`{calls}`,i.calls.toLocaleString())})]}),mt(e)]}),r&&e.children?.map(e=>(0,m.jsxs)(`tr`,{className:B.sessionChildRow,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`button`,{type:`button`,className:B.sessionLink,"data-testid":`billing-session-open`,title:t(`sessionOpen`),onClick:t=>{t.stopPropagation(),ve(e.id)},children:(0,m.jsx)(`span`,{className:B.modelProvider,children:e.id.slice(0,8)})})}),mt(e)]},e.id)),r&&e.subs?.map(e=>ht(e,0))]},e.id)})]})]})]}),ct&&(0,m.jsxs)(`div`,{className:B.sessionViewer,"data-testid":`billing-session-viewer`,children:[(0,m.jsxs)(`div`,{className:B.sessionViewerHead,children:[(0,m.jsx)(`h3`,{className:B.sessionViewerTitle,children:t(`sessions`)}),(0,m.jsx)(`input`,{className:B.ubSearch,type:`search`,value:U,placeholder:t(`sessionViewerSearch`),"aria-label":t(`sessionViewerSearch`),"data-testid":`billing-session-viewer-search`,onChange:e=>{dt(e.target.value)}}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-session-viewer-close`,onClick:()=>{ut(!1),dt(``)},children:t(`close`)})]}),(0,m.jsx)(`div`,{className:B.sessionViewerList,"data-testid":`billing-session-viewer-list`,children:(0,m.jsxs)(`table`,{className:B.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`sessionTitle`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`calls`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`actual`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[gt.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:B.emptyRow,children:t(`noData`)})}),gt.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsxs)(`td`,{children:[(0,m.jsxs)(`span`,{className:B.modelName,children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.cwd!==void 0&&(0,m.jsx)(`span`,{className:B.modelProvider,children:Vi(e.cwd)}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),children:t(`sessionStaleBadge`)})]}),(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:G(e.cost)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.lastActive>0?`${q(e.lastActive)} ${Si(e.lastActive)}`:`—`})]},e.id))]})]})})]})]})]}),L===`token`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,m.jsx)(hn,{stats:e,trendDays:De,onTrendDays:R,models:Wn,money:G,t}),e.perf!==void 0&&(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-perf`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`perfTitle`)}),(0,m.jsx)(`span`,{className:B.panelHint,children:t(`perfHint`)})]}),(0,m.jsx)(Dn,{perf:e.perf,models:Wn,t})]})]}),L===`pricing`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:B.ubAlert,role:`note`,children:[(0,m.jsxs)(`div`,{className:B.ubAlertLeft,children:[(0,m.jsxs)(`span`,{className:B.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,K(kt.rate)]}),(0,m.jsx)(`span`,{className:y(B.ubTag,kt.live?B.ubTagSuccess:B.ubTagNeutral),children:kt.live?t(`rateLive`):t(`rateBuiltin`)}),Mt>0&&(0,m.jsxs)(`span`,{className:B.ubTag,"data-testid":`billing-pricing-synced`,children:[t(`pricingSyncedAt`),` `,new Date(Mt).toLocaleTimeString(Pt===`zh`?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}),(0,m.jsx)(`button`,{type:`button`,className:B.heatmapRangeButton,"data-testid":`billing-pricing-sync`,disabled:At,onClick:jt,children:t(At?`pricingSyncing`:`pricingSyncNow`)})]}),(0,m.jsx)(`p`,{className:B.ubAlertNote,children:t(`pricingTip`)})]}),(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`pricing`)}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:t(`pricingUnit`)}),(0,m.jsx)(`input`,{className:B.ubSearch,type:`search`,value:It,placeholder:t(`pricingSearch`),"aria-label":t(`pricingSearch`),"data-testid":`billing-pricing-search`,onChange:e=>{Lt(e.target.value)}})]}),(0,m.jsx)(`div`,{className:B.ubTablewrap,children:(0,m.jsxs)(`table`,{className:B.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`thModel`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`thInputMiss`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`thInputHit`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`output`)}),(0,m.jsx)(`th`,{className:B.numCol,colSpan:2,children:t(`band`)})]})}),(0,m.jsx)(`tbody`,{children:Xn(Kt(),It).map(e=>{let n=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:B.ubModel,children:[(()=>{let n=qn(St(Bt,xt(e.key,Ut)),Gt);if(n===null)return null;let r=Rt.includes(e.key),i=`${e.name} · ${t(n===`peak`?`peak`:`offPeak`)} · ${t(`bandPinHint`)}`;return(0,m.jsx)(`button`,{type:`button`,className:y(B.bandDot,B[n],r&&B.bandDotOn),"data-testid":`billing-band-dot`,"aria-pressed":r,"aria-label":i,title:i,onClick:()=>{zt(I(e.key)),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.pinned-pref`))}})})(),(0,m.jsxs)(`span`,{className:B.ubModelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:B.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Wt(e.promo,Date.now())&&(0,m.jsx)(p.Tooltip,{label:[e.promo.note,e.promo.endsAtMs===void 0?t(`promoOpenEnded`):t(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()})].filter(Boolean).join(` · `),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.ubTagPromo,"data-testid":`billing-price-promo`,children:t(`promoBadge`)})})]})]})}),(0,m.jsx)(`td`,{className:B.numCol,children:n?qt(e.price.input,e.price.currency):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsx)(`td`,{className:B.numCol,children:n?qt(e.price.cacheHit,e.price.currency):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsx)(`td`,{className:B.numCol,children:n?qt(e.price.output,e.price.currency):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsxs)(`span`,{className:B.ubChipPeak,children:[(0,m.jsx)(`span`,{className:B.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,m.jsxs)(`span`,{children:[qt(e.price.input,e.price.currency),`/`,qt(e.price.output,e.price.currency)]})]})}),(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsxs)(`span`,{className:B.ubChipOff,children:[(0,m.jsx)(`span`,{className:B.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,m.jsxs)(`span`,{children:[qt(e.price.offPeak.input,e.price.currency),` / `,qt(e.price.offPeak.output,e.price.currency)]})]})})]}):(0,m.jsx)(`td`,{className:B.numCol,colSpan:2,children:n?(0,m.jsx)(`span`,{className:B.flatTag,children:t(`flat`)}):(0,m.jsx)(`span`,{className:B.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,m.jsxs)(`tr`,{className:B.ubExtraRow,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:B.ubExtraName,children:Yn(t.label,Pt)}),t.note!==void 0&&(0,m.jsx)(`span`,{className:B.ubExtraNote,children:Yn(t.note,Pt)})]}),(0,m.jsx)(`td`,{className:B.numCol,children:t.input===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):qt(t.input,e.price.currency)}),(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsx)(`td`,{className:B.numCol,children:t.output===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):qt(t.output,e.price.currency)}),(0,m.jsx)(`td`,{className:B.numCol,colSpan:2,children:(0,m.jsx)(`span`,{className:B.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,m.jsxs)(`section`,{className:B.ubCard,children:[(0,m.jsx)(`div`,{className:B.ubCardHead,children:(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`pricingNotes`)})}),(0,m.jsxs)(`ul`,{className:B.ubNotes,children:[(0,m.jsxs)(`li`,{className:B.ubNotesItem,children:[(0,m.jsx)(`span`,{className:B.ubNotesTerm,children:t(`cacheHit`)}),(0,m.jsx)(`span`,{className:B.ubNotesDesc,children:t(`noteCache`)})]}),(0,m.jsxs)(`li`,{className:B.ubNotesItem,children:[(0,m.jsx)(`span`,{className:B.ubNotesTerm,children:t(`peakBand`)}),(0,m.jsx)(`span`,{className:B.ubNotesDesc,children:t(`noteBand`)})]}),(0,m.jsxs)(`li`,{className:B.ubNotesItem,children:[(0,m.jsx)(`span`,{className:B.ubNotesTerm,children:t(`pricingSource`)}),(0,m.jsx)(`span`,{className:B.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),v(`billing.dashboard.decor`,{position:`footer`})]}),(0,m.jsxs)(`footer`,{className:B.modalFooter,"data-testid":`billing-footer`,children:[(0,m.jsx)(`span`,{children:t(`footer`)}),(0,m.jsx)(`span`,{children:t(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]})})}function Vi(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??`—`}let Hi={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`],displayExtra:[`悬浮`,`订阅`,`计费卡`,`指标`,`环比`,`主数字`,`float`,`subscription`,`card`,`metric`,`delta`],advanced:[`自定义`,`单价`,`价格`,`低谷`,`custom`,`price`],about:[`关于`,`版本`,`作者`,`许可`,`仓库`,`about`,`version`,`author`,`license`,`repo`]};function Ui(e){return Object.values(Hi).every(t=>mi(e,t))}let Wi=[`below`,`above`,`toolbar`];function Gi({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[r,i]=(0,d.useState)(!1),a={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)},o=Wi.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=Wi.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{i(!1)},anchor:(0,m.jsxs)(`button`,{type:`button`,className:B.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(B.rdoChevron,r&&B.rdoChevronOpen),"aria-hidden":!0,children:xr?(0,m.jsx)(xr,{}):null})]})})}function Ki(e){let{t,checkModels:n,publishCosts:r,registerOpen:i,navigateToSession:a,renderSlot:o,useStore:s,actions:c}=e,[l,u]=(0,d.useState)(mr),[f,p]=(0,d.useState)(gr),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(void 0),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)([]),[C,w]=(0,d.useState)(!1),[T,ee]=(0,d.useState)([]),[O,k]=(0,d.useState)(()=>pe()),[j,ne]=(0,d.useState)(()=>Te()),re=(0,d.useCallback)(e=>{ne(e),F(e),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.language-pref`))},[]),M=(0,d.useCallback)(e=>{k(e),me(e),window.dispatchEvent(new CustomEvent(fe))},[]),[ie,se]=(0,d.useState)(()=>E()),ce=(0,d.useCallback)(e=>{se(e),D(e)},[]),[de,he]=(0,d.useState)(()=>ae()),ge=(0,d.useCallback)(e=>{he(e),oe(e)},[]),[_e,ve]=(0,d.useState)(()=>N()),ye=(0,d.useCallback)(e=>{ve(e),ue(e),window.dispatchEvent(new CustomEvent(le))},[]),[be,xe]=(0,d.useState)(()=>te()),Se=(0,d.useCallback)(e=>{xe(e),A(e)},[]),[Ce,we]=(0,d.useState)(()=>{let e=Ee();return $e(e),e}),P=(0,d.useCallback)(e=>{we(e),$e(e),De(e)},[]),I=(0,d.useMemo)(()=>Zr(l),[l,Ce]),L=j,R=(0,d.useCallback)((e,n)=>{let r=(L===`en`?Ve:Be)[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},[L,t]),[Oe,ke]=(0,d.useState)(!1),Ae=(0,d.useCallback)(()=>{ke(!1)},[]),je=(0,d.useRef)(!1),Me=(0,d.useCallback)((e=!1)=>{je.current&&!e||(je.current=!0,Promise.all([Ci().then(e=>{e!==null&&u(e)}),wi().then(({balances:e,reconcile:t,stale:n})=>{e.length>0&&g(e),v(t),b(n===!0)}),Ti().then(({quotas:e,stale:t})=>{e.length>0?(S(e),w(t===!0)):w(!1)}).catch(()=>{w(!0)}),Ei().then(e=>{ee(e)}).catch(()=>{})]).catch(()=>{}).finally(()=>{je.current=!1}))},[]),Ne=(0,d.useCallback)(()=>{Me(!0),ji(),ke(!0)},[Me]);(0,d.useEffect)(()=>{Me(),ji()},[Me]);let[Pe,Fe]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{Fe(!document.hidden),document.hidden||(Me(!0),ji())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[Me]),(0,d.useEffect)(()=>{if(!Pe)return;let e=setInterval(()=>{Me(),ji()},Oe?pr:3e5);return()=>{clearInterval(e)}},[Me,Oe,Pe]),(0,d.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(p(t),ot(t.catalog??[]))}),()=>{e=!1}},[n]);let z=q(),Ie=Object.entries(I.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),Le=I.byDay[z]?.cost??0,Re=new Date;Re.setDate(Re.getDate()-1);let B=`${Re.getFullYear()}-${String(Re.getMonth()+1).padStart(2,`0`)}-${String(Re.getDate()).padStart(2,`0`)}`,ze=I.byDay[B]?.cost??0,He=ze>0?(Le-ze)/ze*100:0,Ue=Or(I.byDay,z),We=(0,d.useMemo)(()=>Dr(I.byDay).map(e=>{let t=I.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:Er(t)}}),[I.byDay]),Ge=Object.entries(I.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+Er(t),0),Ke=(()=>{let e=I.byDay[z];return e===void 0?0:Er(e)})(),qe=Or(I.byDay,z,Er),Je=s(e=>e.enabled),Ye=s(e=>e.amount),Xe=s(e=>e.tierAlertDays),Ze=s(e=>e.lastTierSwitchAt),[V,H]=(0,d.useState)(()=>cr()),[Qe,et]=(0,d.useState)(null),[tt,nt]=(0,d.useState)(null),[rt,it]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{if(!V.enabled)return;let e=setInterval(()=>it(Date.now()),pr);return()=>{clearInterval(e)}},[V.enabled]);let at=(0,d.useCallback)(e=>{H(e),lr(e)},[]),st=x.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),ct=xt(l.byTurn?.[0]?.model,st),ut=(0,d.useCallback)(()=>{nt({entering:dt(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4,channel:ct})},[ct]),U=Ye>0?Ye:l.budget??0,ft=Je&&U>0?Ie/U>=1?`over`:Ie/U>=.8?`warn`:`none`:`none`,pt=(0,d.useCallback)(()=>{let e=!Je;c.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[c,Je]);(0,d.useEffect)(()=>{if(!Je||U<=0)return;let e=Ie/U*100,t=fr.filter(t=>e>=t&&Xe?.[String(t)]!==z);if(t.length===0)return;let n=t[t.length-1]??100;if(c.markTierAlerted(t,z),!ei())return;let r=R(`budgetTierBody`).replace(`{cost}`,K(Ie)).replace(`{budget}`,K(U)).replace(`{pct}`,String(n));ti(`budget:${n}:${z}`,()=>{new Notification(R(`budget`),{body:r})})},[Je,U,Ie,Xe,z,c,R]),(0,d.useEffect)(()=>{let e=ur(rt,V,Ze,ct);if(e===null||(c.markTierSwitchAlerted(e.atMs),et(e),!V.webNotify||!ei()))return;let t=Math.max(1,Math.round((e.atMs-rt)/6e4)),n=R(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=R(e.channel===`zhipu-coding-plan`?e.entering===`peak`?`tierAlertEnterPeakZhipu`:`tierAlertEnterOffZhipu`:e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));ti(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[rt,Ze,V,ct,c,R]);let mt=s(e=>e.lastBalanceAlertDay),ht=s(e=>e.modelBudgets??Wn),gt=s(e=>e.modelTierAlertDays??Gn),_t=(0,d.useMemo)(()=>Ar(I.byDayModels,z.slice(0,7)),[I.byDayModels,z]),vt=I.lowBalanceThreshold??50,yt=(0,d.useMemo)(()=>{if(h.length===0)return;let e=Sr(I.byDay,z),t=lt().rate;for(let n of h){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=vt)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[h,I.lowBalanceThreshold,I.byDay,z]);(0,d.useEffect)(()=>{if(yt===void 0||mt===z||(c.markBalanceAlerted(z),!ei()))return;let e=R(`balanceLowBody`).replace(`{name}`,yt.name).replace(`{balance}`,K(yt.cny)).replace(`{days}`,yt.days===void 0?`—`:String(yt.days));ti(`balance:${z}`,()=>{new Notification(R(`balance`),{body:e})})},[yt,mt,z,c,R]),(0,d.useEffect)(()=>{let e=[],t;for(let[n,r]of Object.entries(ht)){if(!(r>0))continue;let i=_t[n]??0;for(let a of Mr(i,r)){let o=`${n}:${a}`;gt[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||(c.markModelTierAlerted(e,z),!ei()))return;let n=R(`modelBudgetBody`).replace(`{model}`,t.model).replace(`{cost}`,K(t.cost)).replace(`{budget}`,K(t.budget)).replace(`{pct}`,String(t.tier));ti(`model-budget:${t.model}:${t.tier}:${z}`,()=>{new Notification(R(`modelBudgetTitle`),{body:n})})},[ht,_t,gt,z,c,R]);let bt=(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=Ht(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=h.find(t=>$(t.provider)===$(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=h.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`?R(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?R(`balanceUnreachable`):R(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:K(t.totalBalance),r=lt().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<vt}},a=e=>{let t=x.find(t=>t.displayName===e||Rr(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:R(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?R(`subscriptionExhausted`):R(`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,h,x,z,R]),St=(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:Le,monthCost:Ie})},[Le,Ie,r]),(0,d.useEffect)(()=>i(Ne),[i,Ne]);let Ct=(0,d.useMemo)(()=>l.byTurn??[],[l.byTurn]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Ii,{...e,t:R,currency:O,onOpen:Ne,monthCost:Ie,todayCost:Le,weekCost:Ue,days:We,vendorStatus:bt,dash:St,cardPrefs:be,monthTokens:Ge,todayTokens:Ke,weekTokens:qe,floatPrefs:ie,subscriptions:x,budgetPressure:ft,deltaPct:He}),Oe&&(0,m.jsx)(Bi,{stats:I,t:R,onClose:Ae,navigateToSession:a,userPrices:Ce,onUserPrices:P,health:f,balances:h,..._===void 0?{}:{reconcile:_},quotas:x,relayQuotas:T,currency:O,onCurrency:M,language:j,onLanguage:re,turns:Ct,renderSlot:o,budgetEnabled:Je,budgetAmount:U,modelBudgets:ht,monthModelCost:_t,onModelBudget:c.setModelBudget,onToggleBudget:pt,onBudgetAmount:c.setAmount,peakConfig:V,onPeakConfig:at,onPreviewPeak:ut,floatPrefs:ie,onFloatPrefs:ce,cardPrefs:be,onCardPrefs:Se,sitePrefs:de,onSitePrefs:ge,liveCostPrefs:_e,onLiveCostPrefs:ye,quotasStale:C,balanceStale:y}),(Qe!==null||tt!==null)&&(0,m.jsx)(dr,{hit:Qe??tt,config:V,t:R,onDismiss:()=>{et(null),nt(null)}})]})}function qi(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 Ji(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.subCost??0}function Yi(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 Xi(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 Zi(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 Qi(){try{let e=await Qr(`/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 $i(){try{let e=await Qr(`/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 ea(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function ta(e){return!e.running&&!e.promptAttempted&&(e.blank||e.awaitingFirstTurn)}function na({hasBandPlan:e}){let[t,n]=(0,d.useState)(()=>_e()),[r,i]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=()=>{n(_e())};window.addEventListener(ge,e),window.addEventListener(`storage`,e);let t=setInterval(()=>{i(Date.now())},3e4);return()=>{window.removeEventListener(ge,e),window.removeEventListener(`storage`,e),clearInterval(t)}},[]),t.length===0)return null;let a=cr().leadMin*6e4,o=t.map(t=>({key:t,state:qn(St(r,xt(t,e)),a)})).filter(e=>e.state!==null);return o.length===0?null:(0,m.jsx)(`span`,{className:B.bandDots,"data-testid":`billing-pinned-dots`,children:o.map(e=>(0,m.jsx)(`span`,{className:y(B.bandDot,B.bandDotOn,B[e.state]),role:`img`,"aria-label":e.key,title:e.key},e.key))})}function ra(){let[e,t]=(0,d.useState)(()=>pe());return(0,d.useEffect)(()=>{let e=()=>{t(pe())};return window.addEventListener(fe,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(fe,e),window.removeEventListener(`storage`,e)}},[]),e}function ia(){let[e,t]=(0,d.useState)(()=>N().show),[n,r]=(0,d.useState)(()=>N().position);return(0,d.useEffect)(()=>{let e=()=>{t(N().show),r(N().position)};return window.addEventListener(le,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(le,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function aa(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([Qi(),$i()]).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)(()=>qi(n,e),[n,e]),f=(0,d.useMemo)(()=>Ji(n,e),[n,e]),p=(0,d.useMemo)(()=>Yi(n,e),[n,e]),m=(0,d.useMemo)(()=>Xi(i),[i]),h=(0,d.useMemo)(()=>xt(Zi(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)(()=>St(o,h),[o,h]),chips:m,hasBandPlan:i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)}}function oa({sessionId:e,t,seat:n,session:r,useProjection:i}){let{visible:a,position:o}=ia(),s=i?.(`contextPressure`),c=i?.(`contextBreakdown`);(0,d.useEffect)(()=>{li.publish({...s?.projectedTokens===void 0?{}:{projectedTokens:s.projectedTokens},...s?.pressureTokens===void 0?{}:{pressureTokens:s.pressureTokens},...s?.contextWindow===void 0?{}:{contextWindow:s.contextWindow},...c?.systemTokens===void 0?{}:{systemTokens:c.systemTokens},...c?.toolsTokens===void 0?{}:{toolsTokens:c.toolsTokens},...c?.messageTokens===void 0?{}:{messageTokens:c.messageTokens}})},[s,c]);let l=a&&o===n&&!(n===`above`&&r!==void 0&&ta(r)),{sessionCost:u,subCost:f,turnCost:p,tier:h,chips:g,hasBandPlan:_}=aa(e,l),v=ra(),b=e=>K(Xt(e,v),v),x=u>0||p>0,S=h?.tier===`peak`;return l?(0,m.jsxs)(`span`,{className:n===`above`?y(B.feeBar,B.feeBarAbove):B.feeBar,"data-testid":`billing-live-cost-bar`,"data-seat":n,children:[(0,m.jsx)(na,{hasBandPlan:_}),h!==null&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:S?B.feeChipPrimary:B.feeChipOff,"data-testid":`billing-live-tier`,children:t(S?`tierPeak`:`tierOff`)}),(0,m.jsx)(`span`,{className:B.feeCount,children:wt(h.nextSwitchInMs)}),(0,m.jsx)(`span`,{className:B.feeSuffix,children:t(S?`tierToOff`:`tierToPeak`)})]}),x&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:B.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:B.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,m.jsx)(`span`,{className:B.feeNum,"data-tick":`turn`,children:b(p)})]}),(0,m.jsx)(`span`,{className:B.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:B.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,m.jsx)(`span`,{className:B.feeNum,"data-tick":`session`,children:b(u)}),f>0&&(0,m.jsx)(`span`,{className:B.feeSuffix,"data-testid":`billing-live-session-sub`,children:t(`liveSessionSub`).replace(`{cost}`,b(f))})]})]}),g.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:e.pct<=10?B.feeChipError:B.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(ea(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]}):null}function sa({sessionId:e,t}){let n=ra(),r=e=>K(Xt(e,n),n),{visible:i,position:a}=ia(),{sessionCost:o,subCost:s,turnCost:c,tier:l,chips:u,hasBandPlan:d}=aa(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?B.feeInlineError:h<=20?B.feeInlineAlert:void 0,_=y(B.feeInline,g),v=[...l===null?[]:[`${wt(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(ea(e.kind))} ${e.pct}%`)].join(` · `);return(0,m.jsx)(p.Tooltip,{label:v,side:`top`,delayMs:500,children:(0,m.jsxs)(`span`,{className:_,"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":v,children:[(0,m.jsx)(na,{hasBandPlan:d}),l!==null&&(0,m.jsx)(`span`,{className:f?B.feeChipPrimary:B.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),o>0&&(0,m.jsx)(`span`,{className:B.feeInlineNum,children:r(o)})]})})}function ca(){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 la={enabled:!1,timeout:0};function ua(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...la};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...la}}}function da(e){return e.completed===!0||e.running===!1}function fa(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)),da(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=da(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 pa(e){let t=e.get(`uiWorkspace`);if(t!==void 0&&typeof t.openSession==`function`)return t}function ma(e){let t=e.sessions,n=t?.open;return typeof n==`function`?n.bind(t):void 0}function ha(e){return{available:()=>pa(e)!==void 0||ma(e)!==void 0,open:t=>{let n=_(t),r=pa(e);if(r!==void 0)try{return r.openSession(n),`opened`}catch(e){return x(`session-navigation-open-failed`,e),`failed`}let i=ma(e);if(i!==void 0)try{return i(n),`opened`}catch(e){return x(`session-navigation-legacy-open-failed`,e),`failed`}return`unavailable`}}}function ga(e,t){let n=e.get(`commandUi`);if(n===void 0||typeof n.register!=`function`)return!1;let r={name:`usage`,label:t.label,description:t.description,available:()=>!0,ui:{kind:`action`,run:()=>{t.openDashboard()}}};try{n.register(r)}catch(e){return x(`usage-command-register-failed`,e),!1}return!0}let _a=[`slots`,`locale`,`remote`,`sessions`];function va(e){let t=ca();e.provide(`billingMetrics`,t);let n=Kn();e.effect(()=>e.locale.register(ze,{zh:Be,en:Ve}),`ui-usage-billing: dictionaries`);let r=ha(e);ga(e,{openDashboard:()=>{t.openDashboard()},label:()=>Te()===`en`?Ve.commandUsageLabel:Be.commandUsageLabel,description:()=>Te()===`en`?Ve.commandUsageDescription:Be.commandUsageDescription}),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:ze,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}},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),navigateToSession:e=>r.open(e)})},Ki)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:ze,inject:e=>({sessionId:_(e),seat:`below`})},oa)),e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`usage-billing-cost-above`,order:100,locale:ze,inject:e=>({sessionId:_(e),seat:`above`})},oa)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:ze,inject:e=>({sessionId:_(e)})},sa)),e.effect(()=>fa(e.sessions.list,ua),`ui-usage-billing: completion notifier`)}return n.UsageBilling=Ki,n.apply=va,n.inject=_a,t.exports}});
|
|
5
|
+
`)}function _n(){let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}let X={top:18,right:40,bottom:26,left:46};function vn(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function yn(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 bn={key:`__total__`,name:``,color:``};function xn({data:e,models:t=[],currency:n=`cny`,metric:r=`cost`,t:i}){let a=i??(e=>Be[e]),[o,s]=(0,d.useState)(null),c=e=>K(Xt(e,n),n),l=e=>r===`tokens`?un(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-X.left-X.right,a=220-X.top-X.bottom,o=e=>n===1?X.left+i/2:X.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=>X.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>X.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:bn,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:B.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],ee=yn(p,Math.max(1,Math.ceil(p/8)));return(0,m.jsxs)(`div`,{className:B.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:B.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-X.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:X.left,x2:680-X.right,y1:n,y2:n,className:B.chartGrid}),(0,m.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:B.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===``?B.chartBar:B.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:B.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,m.jsx)(`path`,{d:w,fill:`none`,className:B.chartLine}),(()=>{let t=_n(),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:X.top,y2:X.top+g,stroke:`var(--ds-amber)`,strokeWidth:`1`,strokeDasharray:`3 3`,opacity:`0.6`}),(0,m.jsx)(`text`,{x:_(n)+4,y:X.top-6,fill:`var(--ds-amber)`,fontSize:`10`,fontFamily:`var(--font-num)`,children:vn(t)})]}):null})(),C.map((e,t)=>{let n=y(e);return(0,m.jsx)(`text`,{x:680-X.right+8,y:n+3,textAnchor:`start`,className:B.chartAxisLabel,children:un(e)},`calls-${t}`)}),ee.map(t=>{let n=e[t];return n===void 0?null:(0,m.jsx)(`text`,{x:_(t),y:214,textAnchor:`middle`,className:B.chartAxisLabel,children:vn(n.date)},n.date)}),o!==null&&(0,m.jsx)(`line`,{x1:_(o),x2:_(o),y1:X.top,y2:X.top+g,className:B.chartCrosshair})]}),T!==void 0&&o!==null&&(0,m.jsxs)(`div`,{className:B.chartTooltip,style:{left:`${_(o)/680*100}%`,top:`${v(T.cost)/220*100}%`},children:[(0,m.jsx)(`div`,{className:B.chartTooltipDate,children:T.date}),r!==`tokens`&&t.filter(e=>(T.byModel?.[e.key]??0)>0).map(e=>(0,m.jsxs)(`div`,{className:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.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:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.chartLegendBar}),a(`trendTotal`),` `,(0,m.jsx)(`strong`,{children:r===`tokens`?un(T.tokens??0):c(T.cost)})]}),(0,m.jsxs)(`div`,{className:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.chartLegendLine}),a(`calls`),` `,(0,m.jsx)(`strong`,{children:T.calls.toLocaleString()})]})]}),t.length>0&&r!==`tokens`&&(0,m.jsxs)(`div`,{className:B.chartLegend,children:[t.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.chartLegendLine}),a(`calls`)]})]})]})}let Z={top:14,right:42,bottom:22,left:46};function Sn(e){return e.slice(5,13).replace(`T`,` `)}function Cn(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function wn(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Tn(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function En(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function Dn({perf:e,models:t,t:n}){let[r,i]=(0,d.useState)(()=>ke()),[a,o]=(0,d.useState)(null),s=e=>{i(e),Ae(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-Z.left-Z.right,a=180-Z.top-Z.bottom,o=e=>n===1?Z.left+i/2:Z.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=>Z.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:B.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:wn(a),unit:``,pct:a/e*100,color:`var(--ds-green)`},{lbl:n(`perfTps`),val:o.length>0?Tn(s):`—`,unit:``,pct:s/t*100,color:`var(--ds-blue)`},{lbl:n(`perfLatency`),val:wn(c),unit:``,pct:c/r*100,color:`var(--ds-amber)`}];return(0,m.jsx)(`div`,{className:B.perfHero,"data-testid":`billing-perf-hero`,children:u.map((e,t)=>(0,m.jsxs)(`div`,{className:B.perfHeroCell,children:[(0,m.jsx)(`div`,{className:B.perfHeroLbl,children:e.lbl}),(0,m.jsxs)(`div`,{className:B.perfHeroVal,children:[e.val,e.unit!==``&&(0,m.jsx)(`span`,{className:B.perfHeroUnit,children:e.unit})]}),(0,m.jsx)(`div`,{className:B.perfHeroBar,children:(0,m.jsx)(`i`,{style:{width:`${Math.min(100,e.pct)}%`,background:e.color}})})]},t))})})(),(0,m.jsx)(`div`,{className:B.tableScroll,"data-testid":`billing-perf-table`,children:(0,m.jsxs)(`table`,{className:B.modelTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:n(`model`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfSamples`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfTtft`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfP50`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfP90`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfMax`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfTps`)}),(0,m.jsx)(`th`,{className:B.numCol,children:n(`perfLatency`)}),(0,m.jsx)(`th`,{className:B.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:B.modelCell,children:[(0,m.jsx)(`span`,{className:B.modelDot,style:{background:e.color}}),(0,m.jsx)(`span`,{className:B.modelName,children:e.name})]})}),(0,m.jsx)(`td`,{className:B.numCol,children:e.samples.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.ttftAvg)}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.ttftP50)}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.ttftP90)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.ttftMax===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):(0,m.jsxs)(`span`,{children:[wn(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,m.jsx)(`td`,{className:B.numCol,children:e.tpsAvg===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):Tn(e.tpsAvg)}),(0,m.jsx)(`td`,{className:B.numCol,children:wn(e.latencyAvg)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,m.jsx)(`span`,{className:B.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:B.perfCompareList,"data-testid":`billing-perf-compare`,children:l.map(n=>(0,m.jsxs)(`div`,{className:B.perfCompareRow,children:[(0,m.jsxs)(`div`,{className:B.perfCompareName,children:[(0,m.jsx)(`span`,{className:B.perfCompareDot,style:{background:n.color}}),(0,m.jsx)(`span`,{children:n.name})]}),(0,m.jsx)(`div`,{className:B.perfCompareBar,children:(0,m.jsx)(`i`,{style:{width:`${n.ttftP50/e*100}%`,background:t(n.ttftP50)}})}),(0,m.jsx)(`div`,{className:B.perfCompareNum,children:wn(n.ttftP50)}),(0,m.jsx)(`div`,{className:B.perfCompareNum,children:n.tpsAvg===void 0?`—`:Tn(n.tpsAvg)})]},n.key))})})(),f!==null&&(0,m.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,m.jsx)(`div`,{className:B.perfBar,children:(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,r.metric===e&&B.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:B.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,m.jsx)(`button`,{type:`button`,className:B.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(B.perfChip,!t&&B.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:B.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),f.totalPoints>0?(0,m.jsxs)(`div`,{className:B.chartWrap,children:[(0,m.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:B.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-Z.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:Z.left,x2:680-Z.right,y1:n,y2:n,className:B.chartGrid}),(0,m.jsx)(`text`,{x:Z.left-8,y:n+3,textAnchor:`end`,className:B.chartAxisLabel,children:Cn(e)})]},`tick-${t}`)}),f.series.map(e=>e.segments.map((t,n)=>(0,m.jsx)(`path`,{d:t,fill:`none`,className:B.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:B.chartAxisLabel,children:Sn(t)},t)}),a!==null&&(0,m.jsx)(`line`,{x1:f.inner(a),x2:f.inner(a),y1:Z.top,y2:Z.top+f.plotH,className:B.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:B.chartHoverDot},`${e.key}-dot`)})]}),a!==null&&g.length>0&&(0,m.jsxs)(`div`,{className:B.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${f.inner(a)/680*100}%`,top:`${(Z.top+f.plotH/2)/180*100}%`},children:[(0,m.jsx)(`div`,{className:B.chartTooltipDate,children:Sn(f.hourKeys[a]??``)}),g.map(e=>(0,m.jsxs)(`div`,{className:B.chartTooltipRow,children:[(0,m.jsx)(`span`,{className:B.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,m.jsx)(`strong`,{children:En(e.v,r.metric,n)})]},e.key))]})]}):(0,m.jsx)(`div`,{className:B.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),f===null&&(0,m.jsx)(`div`,{className:B.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let On=`@kenz1117/dsh-ui-usage-billing`,kn=`kenz1117`;function An({t:e,version:t}){return(0,m.jsxs)(`section`,{className:B.setCard,"data-testid":`billing-plugin-info`,children:[(0,m.jsxs)(`div`,{className:B.plgHead,children:[(0,m.jsx)(`span`,{className:B.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:B.plgTitle,children:[(0,m.jsxs)(`div`,{className:B.plgNameRow,children:[(0,m.jsx)(`h3`,{className:B.plgName,children:On}),(0,m.jsx)(`span`,{className:B.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,m.jsx)(`p`,{className:B.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,m.jsxs)(`div`,{className:B.plgGrid,children:[(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginAuthor`)}),(0,m.jsxs)(`a`,{className:B.plgLink,href:`https://github.com/${kn}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,kn,`)`]})]}),(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginRepository`)}),(0,m.jsx)(`a`,{className:B.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginNpm`)}),(0,m.jsx)(`a`,{className:B.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:On})]}),(0,m.jsxs)(`div`,{className:B.plgItem,children:[(0,m.jsx)(`span`,{className:B.plgLabel,children:e(`pluginLicense`)}),(0,m.jsx)(`span`,{className:B.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 Mn(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 Nn(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 Pn({rounds:e,flags:t,currency:n,t:r}){let i=(0,d.useMemo)(()=>e.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:B.roundsEmpty,children:[r(`model`),` —`]});let s=e=>K(Xt(e,n),n);return(0,m.jsxs)(`div`,{className:B.rounds,children:[(0,m.jsx)(`div`,{className:B.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=xt(e.model,!1)===`deepseek-metered`&&dt(e.startedAt)===`peak`;return(0,m.jsxs)(`div`,{className:y(B.roundsBarCol,i?B.roundsBarColPeak:B.roundsBarColOff),children:[(0,m.jsx)(`span`,{className:B.roundsBarLabel,style:{bottom:`${n}%`},children:s(e.cost)}),(0,m.jsx)(`div`,{className:B.roundsBarWrap,children:(0,m.jsx)(`div`,{className:t?B.roundsBarFlagged:B.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${r(`model`)} ${e.model} · ${s(e.cost)} · ${Mn(e.startedAt)}${e.endedAt===void 0?``:` → ${jn(e.endedAt)} (${Nn(e.endedAt-e.startedAt)})`}`,children:t&&(0,m.jsx)(`span`,{className:B.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,m.jsxs)(`div`,{className:B.roundsAxis,children:[(0,m.jsxs)(`span`,{children:[r(`costAbbr`),` `,s(o)]}),(0,m.jsxs)(`span`,{children:[i.length,` `,r(`roundsUnit`)]})]})]})}let Fn=[`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)`],In=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Ln=e=>q(e.getTime());function Rn(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:Ln(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:Ln(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=new Date(i,a,u),f=Ln(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 zn(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=Ln(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=Ln(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 Bn({days:e,currency:t,now:n,t:r,range:i=`month`,unit:a=`cost`}){let[o,s]=(0,d.useState)(null),c=e=>K(Xt(e,t),t),l=e=>a===`tokens`?J(e):c(e),u=(0,d.useMemo)(()=>Rn(e,n??new Date),[e,n]),f=Ln(n??new Date);if(i!==`month`){let t=zn(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:In[n-1]??``}),o=n)}),(0,m.jsxs)(`div`,{className:B.heatmapYear+(i===`half`?` `+B.heatmapHalf:``),"data-testid":i===`half`?`heatmap-half`:`heatmap-year`,children:[(0,m.jsxs)(`div`,{className:B.heatmapYearBody,children:[(0,m.jsx)(`div`,{className:B.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,m.jsx)(`span`,{className:B.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,m.jsxs)(`div`,{className:B.heatmapYearScroll,children:[(0,m.jsx)(`div`,{className:B.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:a.map(e=>(0,m.jsx)(`span`,{className:B.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,m.jsx)(`div`,{className:B.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:B.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:Fn[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,tabIndex:-1},e.date))})]})]}),(0,m.jsxs)(`div`,{className:B.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:B.heatmapLegend,children:Fn.map((e,t)=>(0,m.jsx)(`i`,{style:{background:e}},t))}),(0,m.jsx)(`span`,{children:r(`heatmapMore`)})]})]})}return(0,m.jsxs)(`div`,{className:B.heatmap,children:[(0,m.jsx)(`div`,{className:B.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,m.jsx)(`div`,{className:B.heatmapCellEmpty,children:e.dayNum},e.date):(0,m.jsx)(`button`,{type:`button`,className:B.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,"data-today":e.date===f?`true`:void 0,style:{background:Fn[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:B.heatmapFooter,children:[(0,m.jsx)(`span`,{children:r(`heatmapLess`)}),(0,m.jsx)(`span`,{className:B.heatmapLegend,children:Fn.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:B.heatmapHover,"data-testid":`heatmap-hover`,children:[o.date,` · `,l(o.value)]})]})]})}let Vn={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function Hn(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function Q(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function Un(e,t){let n=t?.window??Vn.window,r=t?.threshold??Vn.threshold,i=t?.reasonFactor??Vn.reasonFactor,a=t?.reasonHitDropPp??Vn.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=Q(t),p=Hn(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=Hn(c),r=Hn(l),s=Hn(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 Wn={},Gn={};function Kn(){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 qn(e,t){return e==null?null:Number.isFinite(e.nextSwitchInMs)&&e.nextSwitchInMs<=t?`soon`:e.tier===`peak`?`peak`:`offPeak`}let Jn={显式缓存创建:`Explicit cache write`,显式缓存命中:`Explicit cache hit`,长期半价:`Half price`,与标准价一致:`Same as standard`,"限时 5 折":`Limited-time 50% off`};function Yn(e,t){return e===void 0||t!==`en`?e:Jn[e]??e}function Xn(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 Zn={"智谱 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 Qn(e,t){return t===`en`?Zn[e]??e:e}let $n={workbuddy:`WorkBuddy`,"workbuddy-ai":`WorkBuddy AI`},er={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},tr={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function nr(e){try{return new URL(e).host}catch{return e}}function rr(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=er[n];return r===void 0?nr(n):t===`en`?tr[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=$n[n.trim().toLowerCase()];return r===void 0?`${t===`en`?`Direct`:`直连`} · ${n}`:`${t===`en`?`Direct`:`直连`} · ${r}`}}let ir=[`直连 · `,`Direct · `];function ar(e){for(let t of ir)if(e.startsWith(t))return e.slice(t.length)}let or=`dsh-billing-peak-alert-v1`,sr={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function cr(){try{let e=localStorage.getItem(or);if(e===null)return{...sr};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:sr.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))):sr.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...sr}}}function lr(e){try{localStorage.setItem(or,JSON.stringify(e))}catch{x(`peak-config-storage-unavailable`)}}function ur(e,t,n,r){if(!t.enabled)return null;let i=Ct(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}}function dr({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(B.peakCard,u?B.peakCardPeak:B.peakCardOff,t.position===`center`?B.peakCardCenter:B.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,m.jsxs)(`div`,{className:B.peakHead,children:[(0,m.jsxs)(`span`,{className:y(B.peakTag,u?B.peakTagPrimary:B.peakTagSuccess),children:[(0,m.jsx)(`span`,{className:y(B.peakDot,u?B.peakDotPrimary:B.peakDotSuccess),"aria-hidden":`true`}),c]}),(0,m.jsx)(`button`,{type:`button`,className:B.peakClose,onClick:r,"aria-label":n(`close`),children:`×`})]}),(0,m.jsxs)(`div`,{className:y(B.peakCount,u?B.peakCountPrimary:B.peakCountSuccess),children:[o,`min`]}),(0,m.jsx)(`p`,{className:B.peakDesc,children:l})]})}let fr=[50,80,100],pr=3e4,mr={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}},hr=[`#4f8cff`,`#2dd4bf`,`#a78bfa`,`#f59e0b`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#6366f1`,`#f97316`,`#14b8a6`],gr={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},_r=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`context`,labelKey:`tabContext`},{id:`agents`,labelKey:`tabAgents`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],vr={fill:`none`,"aria-hidden":!0,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`},yr={overview:(0,m.jsx)(`svg`,{viewBox:`0 0 16 16`,...vr,children:(0,m.jsx)(`path`,{d:`M2 13V3M2 13H14M4 10l4-3 2 2 4-5`})}),context:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...vr,children:[(0,m.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.5`}),(0,m.jsx)(`path`,{d:`M8 8V2.5M8 8l3.8 2.3`})]}),agents:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...vr,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`,...vr,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`,...vr,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`,...vr,children:(0,m.jsx)(`path`,{d:`M2 4l4 4 3-3 5 5M11 10h3V7`})}),pricing:(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,...vr,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`,...vr,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,xr=br.IconChevronDownOutlineMedium??br.IconChevronDownOutline14;function Sr(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 Cr(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?Sr(e,n)*s:r+Cr(e,n)*s}function Tr(e){return Object.keys(e).length}function Er(e,t=Date.now()){let n=0,r=new Date(t);for(;q(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function Dr(e){return e.input+e.output}function Or(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=q(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function kr(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[q(i.getTime())];o!==void 0&&(a+=n(o))}return a}function Ar(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=q(a.getTime()),s=new Date(r);s.setDate(s.getDate()-6);let c=q(s.getTime()),l=0,u=0,d=0,f=0,p=0,m=0,h=0,g,_=0;for(let[r,i]of Object.entries(e)){if(!(n===`today`?r===t:n===`7d`?r>=c&&r<=t:n===`week`?r>=o&&r<=t:r.startsWith(t.slice(0,7))))continue;l+=i.cost,u+=i.calls,d+=i.input,f+=i.output,p+=i.cacheHit,m+=i.cacheMiss,h+=i.reasoning??0;let e=Dr(i);e>_&&(_=e,g=r)}return{cost:l,calls:u,input:d,output:f,cacheHit:p,cacheMiss:m,reasoning:h,peakDay:g,peakTokens:_}}function jr(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 Mr=[80,100];function Nr(e,t){if(!(t>0)||!(e>0))return[];let n=e/t*100;return Mr.filter(e=>n>=e)}let Pr={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 $(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function Fr(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 Ir(e,t){let n=$(e),r=$(t);if(Fr(n,r))return!0;let i=Pr[e];return i!==void 0&&i.some(e=>Fr($(e),r))}function Lr(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(Pr))for(let r of n){let n=$(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(Pr))for(let r of t){let t=$(r);if(!(t.length<4)&&n.includes(t))return e}}}let Rr={"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 zr(e){let t=Rr[e];return t===void 0?Lr(e)??e:t}let Br=`https://platform.kimi.com/console/pay`,Vr=`https://open.bigmodel.cn/finance-center/finance/pay`,Hr=`https://bailian.console.aliyun.com/`,Ur=`https://console.volcengine.com/ark`,Wr=`https://console.anthropic.com/settings/billing`,Gr=`https://console.cloud.google.com/billing`,Kr=`https://console.x.ai/`,qr=`https://platform.xiaomimimo.com/console/balance`,Jr=`https://console.cloud.tencent.com/expense/recharge`,Yr={deepseek:`https://platform.deepseek.com/top_up`,minimax:`https://platform.minimax.cn/console/recharge-records`,moonshot:Br,kimi:Br,zhipu:Vr,bigmodel:Vr,qwen:Hr,dashscope:Hr,doubao:Ur,volcengine:Ur,ark:Ur,openai:`https://platform.openai.com/settings/organization/billing`,anthropic:Wr,claude:Wr,google:Gr,gemini:Gr,xai:Kr,grok:Kr,siliconflow:`https://cloud.siliconflow.cn/account/charge`,hunyuan:Jr,tencent:Jr,腾讯云:Jr,xiaomi:qr,mimo:qr,mi:qr,qianfan:`https://console.bce.baidu.com/qianfan/overview`};function Xr(e){let t=Yr[e];if(t!==void 0)return t;let n=Object.keys(Yr).find(t=>e.startsWith(t));return n===void 0?void 0:Yr[n]}function Zr(e){let t=$(e),n=Xr(t);if(n!==void 0)return n;for(let[e,n]of Object.entries(Pr))if(Fr($(e),t))for(let e of n){let t=Xr($(e));if(t!==void 0)return t}}function Qr(e){let t=et();if(t===void 0||e.byDayModels===void 0)return e;let n=lt().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)*U+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=nt(i)??it(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:nt(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=>!nt(e)&&!it(e))}}async function $r(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 ei=new Set;function ti(){return typeof Notification<`u`&&Notification.permission===`granted`}function ni(e,t){ei.has(e)||(ei.add(e),$r(`/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 ri(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 ii(e){let t=new Map(e.map(e=>[e.id,e])),n=ri(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 ai(){let e,t=new Set;return{publish:n=>{let r=oi(n)?void 0:n;if(e!==r&&!(e!==void 0&&r!==void 0&&si(e,r))){e=r;for(let n of t)try{n(e)}catch{}}},subscribe:n=>(n(e),t.add(n),()=>{t.delete(n)}),read:()=>e}}function oi(e){return e.projectedTokens===void 0&&e.pressureTokens===void 0&&e.contextWindow===void 0&&e.systemTokens===void 0&&e.toolsTokens===void 0&&e.messageTokens===void 0}function si(e,t){return e.projectedTokens===t.projectedTokens&&e.pressureTokens===t.pressureTokens&&e.contextWindow===t.contextWindow&&e.systemTokens===t.systemTokens&&e.toolsTokens===t.toolsTokens&&e.messageTokens===t.messageTokens}function ci(e){if(e===void 0)return;let t=e.projectedTokens??e.pressureTokens,n=e.contextWindow;if(!(t===void 0||n===void 0||n<=0))return Math.min(1,t/n)}function li(e){if(e===void 0)return[];let t=[];return e.systemTokens!==void 0&&t.push({key:`system`,tokens:e.systemTokens}),e.toolsTokens!==void 0&&t.push({key:`tools`,tokens:e.toolsTokens}),e.messageTokens!==void 0&&t.push({key:`message`,tokens:e.messageTokens}),t}let ui=ai();function di(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)||fi(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 fi(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 pi(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 mi(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 gi(e,t){return e.checked?e.okProviders.some(e=>Ir(t,e))?B.healthOk:e.badProviders.some(e=>Ir(t,e))?B.healthBad:B.healthIdle:B.healthIdle}function _i(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 vi(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 yi(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let bi={"new-api":B.siteKindSite,sub2api:B.siteKindDirect,unknown:B.siteKindUnknown},xi=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function Si(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 Ci(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}async function wi(){try{let e=await $r(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n||!(`total`in n))return null;let r=n,i=e=>typeof e==`object`&&!!e;return{total:r.total??mr.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}:{},...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}:{}}}catch{return null}}async function Ti(){try{let e=await $r(`/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 Ei(){let e=await $r(`/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 Di(){let e=await $r(`/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 Oi(){try{let e=await $r(`/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 ki(e){try{let t=await $r(`/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 Ai=!1,ji=0;async function Mi(e=0){try{let t=await $r(`/api/billing/pricing`);if(!t.ok){Ai=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){Ai=!1;return}let i=r;Array.isArray(i.catalog)&&i.catalog.length>0&&i.aliases!==null&&typeof i.aliases==`object`&&Dt(i.catalog,i.aliases);let a=r;if(a.source===`builtin`&&e<3){if(e===0){if(Ai)return;Ai=!0}setTimeout(()=>{Mi(e+1)},2e3);return}Ai=!1,ji=a.syncedAt??0,at(a)}catch{Ai=!1}}async function Ni(){try{return(await $r(`/api/billing/pricing/refresh`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`,timeoutMs:3e4})).ok?(await Mi(),!0):!1}catch{return!1}}function Pi({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:B.subscriptionWindow,children:[(0,m.jsx)(`span`,{className:B.subscriptionWindowLabel,children:vi(e.kind,t)}),(0,m.jsx)(`span`,{className:B.subscriptionTrack,"aria-hidden":`true`,children:(0,m.jsx)(`span`,{className:y(B.subscriptionFill,n>=100&&B.subscriptionFillOver,n>=80&&n<100&&B.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,m.jsxs)(`span`,{className:B.subscriptionMeta,children:[(0,m.jsx)(`span`,{className:y(B.subscriptionPct,r&&B.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${q(new Date(e.resetsAt).getTime())} ${Ci(new Date(e.resetsAt).getTime())}`)})]})]})}function Fi({label:e,t}){return(0,m.jsx)(p.Tooltip,{label:e,side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.helpTip,role:`note`,"aria-label":e,children:`?`})})}function Ii(e,t){return e===B.healthOk?t(`healthDotLive`):e===B.healthBad?t(`healthDotFailed`):t(`healthDotUnknown`)}function Li(e){let t=t=>K(Xt(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}=e,C=(0,d.useMemo)(()=>p.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[p.targets,h]),[w,T]=(0,d.useState)(0),ee=C.length===0?0:Math.min(w,C.length-1),E=C[ee],D=(0,d.useRef)(null),[O,k]=(0,d.useState)(!1),[te,A]=(0,d.useState)({left:0,top:0});(0,d.useEffect)(()=>{if(!O||p.mode!==`subscription`||C.length<2)return;let e=setInterval(()=>T(e=>(e+1)%C.length),1500);return()=>clearInterval(e)},[O,p.mode,C.length]);let j=(0,d.useRef)(void 0),ne=(0,d.useCallback)(()=>{window.clearTimeout(j.current),k(!0)},[]),re=(0,d.useCallback)(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>k(!1),120)},[]);(0,d.useEffect)(()=>()=>window.clearTimeout(j.current),[]);let M=(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=()=>M();return window.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},[O,M]);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:B.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:B.triggerGaugeNeedle,style:{transform:`rotate(${oe}deg)`,transformOrigin:`20px 29px`}}),(0,m.jsx)(`circle`,{cx:`20`,cy:`29`,r:`1.5`,fill:`currentColor`,stroke:`none`})]});if(!n)return(0,m.jsx)(`button`,{type:`button`,className:y(B.railButton,x!==`none`&&B.triggerBudgetPulse,x===`over`&&B.triggerBudgetOver),"data-testid":`billing-rail-button`,onClick:i,title:`${r(`title`)} · ${t(g.span===`day`?o:g.span===`week`?s:a)}`,children:se});let ce=g.metric===`tokens`,le=c.map(e=>ce?e.tokens:e.cost),N=Math.max(...le,0),ue=le.map(e=>N>0?4+e/N*12:4);return(0,m.jsxs)(`span`,{ref:D,className:B.triggerWrap,onMouseEnter:()=>{M(),ne()},onMouseLeave:re,onFocusCapture:()=>{M(),ne()},onBlurCapture:()=>k(!1),children:[(0,m.jsxs)(`button`,{type:`button`,className:y(B.trigger,x!==`none`&&B.triggerBudgetPulse,x===`over`&&B.triggerBudgetOver),"data-testid":`billing-trigger`,onClick:i,title:`${r(`title`)} · ${t(g.span===`day`?o:g.span===`week`?s:a)}`,children:[(0,m.jsx)(`span`,{className:y(B.triggerIcon,x!==`none`&&B.triggerBudgetHot),"data-testid":`billing-trigger-icon`,children:se}),(0,m.jsx)(`span`,{className:B.triggerMain,children:(0,m.jsxs)(`span`,{className:B.triggerPrimary,children:[(0,m.jsx)(`span`,{className:B.triggerLabel,children:ce?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`?ce?v:o:g.span===`week`?ce?b:s:ce?_:a,n=g.span===`day`?S:0;return ce?(0,m.jsx)(`span`,{className:B.triggerMetric,"data-testid":`billing-trigger-span-tokens`,children:J(e)}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`span`,{className:B.triggerValueRow,children:[(0,m.jsx)(`span`,{className:B.triggerYen,"aria-hidden":`true`,children:t(e).charAt(0)}),(0,m.jsx)(`span`,{className:B.triggerMetric,"data-testid":`billing-trigger-span-money`,children:t(e).slice(1)})]}),g.showDelta&&n!==0&&(0,m.jsxs)(`span`,{className:y(B.triggerDelta,n>0?B.triggerDeltaUp:B.triggerDeltaDown),"data-testid":`billing-trigger-delta`,children:[n>0?`▲`:`▼`,` `,Math.abs(n).toFixed(1),`%`]}),(0,m.jsx)(`span`,{className:B.triggerGlow,"aria-hidden":`true`})]})})()]})}),(0,m.jsx)(`span`,{className:B.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:ue.map((e,t)=>(0,m.jsx)(`span`,{className:t===ue.length-1?B.triggerSparkHot:B.triggerSparkBar,style:{height:`${e}px`}},c[t]?.date??String(t)))})]}),(0,f.createPortal)((0,m.jsx)(`span`,{className:y(B.triggerPop,O&&B.triggerPopShown),style:{left:`${te.left}px`,top:`${te.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!O,onMouseEnter:ne,onMouseLeave:re,children:p.mode===`subscription`?(0,m.jsx)(m.Fragment,{children:C.length===0?(0,m.jsx)(`span`,{className:B.triggerPopEmpty,children:r(`floatNoTargets`)}):(0,m.jsxs)(m.Fragment,{children:[E!==void 0&&(0,m.jsxs)(`div`,{className:B.floatSub,"data-testid":`billing-float-subscription`,children:[(0,m.jsxs)(`div`,{className:B.floatSubHead,children:[(0,m.jsx)(`span`,{className:B.floatSubName,children:E.displayName}),E.plan!==void 0&&(0,m.jsx)(`span`,{className:B.floatSubPlan,children:E.plan})]}),E.windows.map(e=>(0,m.jsx)(Pi,{window:e,t:r},e.kind))]}),C.length>1&&(0,m.jsx)(`span`,{className:B.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,m.jsxs)(`span`,{className:B.triggerPopSwitchCount,children:[ee+1,`/`,C.length]})})]})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:B.popHead,children:(0,m.jsx)(`span`,{className:B.popTitle,children:r(`popTitle`)})}),(0,m.jsxs)(`span`,{className:B.metricGrid,children:[(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`floatPrimaryToday`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:t(o)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`floatPrimaryWeek`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:t(s)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`floatPrimaryMonth`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:t(a)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`input`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:J(u.input)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`output`)}),(0,m.jsx)(`span`,{className:B.metricValue,children:J(u.output)})]}),(0,m.jsxs)(`span`,{className:B.metricCell,children:[(0,m.jsx)(`span`,{className:B.metricLabel,children:r(`cacheHit`)}),(0,m.jsx)(`span`,{className:y(B.metricValue,B.metricValueSuccess),children:$t(u.cacheRead+u.cacheMiss>0?u.cacheRead/(u.cacheRead+u.cacheMiss)*100:0)})]})]}),(0,m.jsxs)(`span`,{className:B.popModel,children:[(0,m.jsx)(`span`,{className:B.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:B.popModelRow,children:[(0,m.jsx)(`span`,{className:y(B.popDot,B.popDotDirect),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:B.popTagPrimary,children:r(`popDirectLead`)}),(0,m.jsx)(`span`,{className:B.popModelName,children:l.direct.name}),(0,m.jsx)(`span`,{className:y(B.popModelStatus,l.direct.low&&B.popModelStatusLow),children:l.direct.text})]}),l.sub!==void 0&&(0,m.jsxs)(`span`,{className:B.popModelRow,children:[(0,m.jsx)(`span`,{className:y(B.popDot,B.popDotSub),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:B.popTagSub,children:r(`popSubLead`)}),(0,m.jsx)(`span`,{className:B.popModelName,children:l.sub.name}),(0,m.jsx)(`span`,{className:y(B.popModelStatus,l.sub.low&&B.popModelStatusLow),children:l.sub.text})]})]}):(0,m.jsxs)(`span`,{className:B.popModelRow,children:[(0,m.jsx)(`span`,{className:y(B.popDot,B.popDotNeutral),"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:B.popModelStatus,children:r(`popNoConsumption`)})]})]})]})}),document.body)]})}function Ri({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:B.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,onClick:e=>{e.stopPropagation()},children:[(0,m.jsxs)(`span`,{className:B.balanceDetailHead,children:[(0,m.jsx)(`span`,{className:B.balanceDetailTitle,children:e.displayName}),(0,m.jsx)(`button`,{type:`button`,className:B.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,m.jsxs)(`span`,{className:B.balanceDetailGrid,children:[s!==void 0&&(0,m.jsx)(zi,{label:i(`balance`),value:s}),c!==void 0&&(0,m.jsx)(zi,{label:i(`balanceGranted`),value:c}),l!==void 0&&(0,m.jsx)(zi,{label:i(`balanceTopped`),value:l}),(0,m.jsx)(zi,{label:i(`balanceDaily`),value:r(n)}),(0,m.jsx)(zi,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function zi({label:e,value:t}){return(0,m.jsxs)(`span`,{className:B.balanceDetailRow,children:[(0,m.jsx)(`span`,{className:B.balanceDetailLabel,children:e}),(0,m.jsx)(`span`,{className:B.balanceDetailValue,children:t})]})}function Bi({userPrices:e,onUserPrices:t,t:n}){let[r,i]=(0,d.useState)(()=>[...e]),[a,o]=(0,d.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=()=>{i(e=>e.filter((e,t)=>!a.has(t))),o(new Set)},l=(e,t)=>i(n=>n.map((n,r)=>r===e?{...n,...t}:n)),u=()=>i(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),f=e=>{let t=r[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},p=(e,t,n)=>i(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})),h=()=>t(r.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:H(e.origin.trim())}}))),g=Kt().map(e=>e.key),_=(e,t)=>i(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),[v,b]=(0,d.useState)({}),x=(e,t,n)=>`${e}:${t}:${n}`,S=(e,t,n)=>b(r=>{let i=x(e,t,n);if(r[i]===void 0)return r;let a={...r};return delete a[i],a}),C=e=>Number.isFinite(e)&&e!==0?String(e):``,w=(e,t,n)=>{if(b(r=>({...r,[x(e,`main`,t)]:n})),n===``){l(e,{[t]:0});return}let r=Number(n);Number.isFinite(r)&&r>=0&&l(e,{[t]:r})};return(0,m.jsxs)(`section`,{className:B.setCard,"data-testid":`billing-user-prices`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[n(`userPrices`),(0,m.jsx)(Fi,{label:n(`userPricesHint`),t:n})]})})}),(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsx)(`datalist`,{id:`billing-price-model-keys`,children:g.map(e=>(0,m.jsx)(`option`,{value:e},e))}),r.map((e,t)=>(0,m.jsxs)(`div`,{className:B.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,m.jsx)(`input`,{type:`checkbox`,className:B.userPriceCheck,"data-testid":`billing-user-price-select`,checked:a.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>s(t)}),(0,m.jsxs)(`div`,{className:B.userPriceBody,children:[(0,m.jsxs)(`div`,{className:B.userPriceLineMeta,children:[(0,m.jsxs)(`div`,{className:B.userPriceField,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:n(`userPriceModel`)}),(0,m.jsx)(`input`,{className:B.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=>l(t,{key:e.target.value})})]}),(0,m.jsxs)(`div`,{className:B.userPriceField,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:n(`userPriceSource`)}),(0,m.jsx)(`input`,{className:B.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>l(t,{origin:e.target.value.trim()})})]}),(0,m.jsxs)(`div`,{className:B.userPriceField,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:n(`userPriceCurrency`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,e.currency!==`USD`&&B.floatModeBtnOn),onClick:()=>_(t,`CNY`),children:`CNY`}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,e.currency===`USD`&&B.floatModeBtnOn),onClick:()=>_(t,`USD`),children:`USD`})]})]})]}),[{scope:`main`,label:n(`userPriceNormal`),testid:`billing-user-price-normal`,valueOf:n=>v[x(t,`main`,n)]??C(e[n]),onChange:(e,n)=>w(t,e,n)},{scope:`off`,label:n(`userPriceOffPeak`),testid:`billing-user-price-offpeak`,valueOf:e=>v[x(t,`off`,e)]??f(t)[e],onChange:(e,n)=>{b(r=>({...r,[x(t,`off`,e)]:n})),p(t,e,n)}}].map(e=>(0,m.jsxs)(`div`,{className:B.userPricePriceLine,"data-testid":e.testid,children:[(0,m.jsx)(`span`,{className:B.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:B.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:()=>S(t,e.scope,r)},r)})]},e.testid))]})]},t)),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-user-price-add`,onClick:u,children:n(`userPriceAdd`)}),(0,m.jsxs)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:a.size===0,onClick:c,children:[n(`userPriceRemoveSelected`),a.size>0?` (${a.size})`:``]}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-user-price-save`,onClick:h,children:n(`userPriceSave`)})]})]})]})}function Vi({stats:e,t,onClose:n,userPrices:r,onUserPrices:i,health:a,balances:o,reconcile:s,quotas:c,relayQuotas:l,currency:u,onCurrency:f,language:h,onLanguage:g,turns:_,renderSlot:v,budgetEnabled:b,budgetAmount:x,onToggleBudget:S,onBudgetAmount:C,modelBudgets:w,monthModelCost:T,onModelBudget:ee,peakConfig:E,onPeakConfig:D,onPreviewPeak:O,floatPrefs:k,onFloatPrefs:te,cardPrefs:A,onCardPrefs:j,sitePrefs:M,onSitePrefs:ie,liveCostPrefs:ae,onLiveCostPrefs:oe,quotasStale:se,balanceStale:ce,navigateToSession:le}){let N=(0,d.useSyncExternalStore)(ui.subscribe,ui.read),ue=ci(N),de=N?.projectedTokens??N?.pressureTokens,fe=li(N),pe=(0,d.useMemo)(()=>di(e.bySession??[]),[e.bySession]),me=(0,d.useMemo)(()=>pi(pe),[pe]),[he,ge]=(0,d.useState)(void 0),ve=(0,d.useCallback)(e=>{let n=le(e);if(n===`opened`){ge(void 0);return}ge(t(n===`unavailable`?`sessionOpenUnavailable`:`sessionOpenFailed`))},[le,t]),[ye,Se]=(0,d.useState)(`cost`),{total:P,byModel:Te,byDay:F}=e,[L,Ee]=(0,d.useState)(`overview`),[De,R]=(0,d.useState)(7),[Oe,ke]=(0,d.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),Ae=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},je=(0,d.useCallback)(()=>{let e=Ae();ke(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[Fe,Re]=(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}),ze=(0,d.useCallback)(e=>{let t=Ae();Re(t=>new Set(t).add(e));try{window.localStorage.setItem(`dsh-billing:notice-${e}-dismissed`,t)}catch{}},[]),[Be,Ve]=(0,d.useState)(`month`),[He,Ue]=(0,d.useState)(`cost`),[We,Ke]=(0,d.useState)(Ne),[qe,Je]=(0,d.useState)(Ie),[Ye,Xe]=(0,d.useState)(`budget`),[Ze,V]=(0,d.useState)(``),H=e=>hi(Ze,e);(0,d.useEffect)(()=>{if(L!==`settings`||typeof IntersectionObserver>`u`)return;let e=Array.from(document.querySelectorAll(`[id^="settings-"]`)).filter(e=>!e.closest(`[hidden]`));if(e.length===0)return;let t=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&&Xe(t.slice(9))},{rootMargin:`-80px 0px -55% 0px`});for(let n of e)t.observe(n);return()=>{t.disconnect()}},[L]);let Qe=(0,d.useCallback)(e=>{if(Xe(e),typeof document>`u`)return;let t=document.getElementById(`settings-${e}`);if(t===null)return;let n=t.closest(`.${B.dashboardBody}`);if(n===null)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+r,behavior:`smooth`})},[]),$e=(0,d.useCallback)(e=>{Ke(e),Pe(e)},[]),et=(0,d.useCallback)(e=>{Je(e),Le(e)},[]);(0,d.useEffect)(()=>{typeof document>`u`||(document.documentElement.dataset.density=We,document.documentElement.dataset.motion=qe)},[We,qe]),(0,d.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.detail;t?.density!==void 0&&Ke(t.density)},t=e=>{let t=e.detail;t?.motion!==void 0&&Je(t.motion)};return window.addEventListener(Me,e),window.addEventListener(z,t),()=>{window.removeEventListener(Me,e),window.removeEventListener(z,t)}},[]);let[tt,nt]=(0,d.useState)(ne),rt=(0,d.useMemo)(()=>c.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[c]),[it,at]=(0,d.useState)(),[ot,st]=(0,d.useState)(new Set),[ct,ut]=(0,d.useState)(!1),[U,dt]=(0,d.useState)(``),ft=(0,d.useCallback)(e=>{st(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),pt=(0,d.useMemo)(()=>ii(e.bySession??[]),[e.bySession]),mt=e=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:G(e.cost)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.lastActive>0?`${q(e.lastActive)} ${Ci(e.lastActive)}`:`—`})]}),ht=(e,n)=>(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:y(B.sessionChildRow,n>0&&B.sessionSubDeepRow),"data-testid":`billing-session-sub-row`,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),children:t(`sessionSubRow`)}),(e.subCalls??0)>0&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-session-sub-chain`,children:e.subCost!==void 0&&e.subCost>0?t(`sessionSubCost`).replace(`{cost}`,G(e.subCost)):t(`sessionSubCalls`).replace(`{calls}`,(e.subCalls??0).toLocaleString())}),(0,m.jsx)(`span`,{className:B.modelProvider,children:e.title??e.id.slice(0,8)})]}),mt(e)]}),e.subs?.map(e=>ht(e,n+1))]},e.id),gt=(0,d.useMemo)(()=>mi(e.bySession??[],U),[e.bySession,U]),_t=(0,d.useMemo)(()=>[...new Set([...Object.keys(T),...Object.keys(w)])].map(e=>{let t=Ht(e);return{key:e,name:t.key===`other`?void 0:t.name,cost:T[e]??0}}).sort((e,t)=>t.cost-e.cost),[T,w]),[vt,yt]=(0,d.useState)(()=>new Set(be())),bt=(0,d.useCallback)(e=>{yt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),xe([...n]),n})},[]),[Ct,wt]=(0,d.useState)(()=>Ce()),Tt=(0,d.useCallback)(()=>{wt(e=>{let t=!e;return we(t),t})},[]),[Et,Dt]=(0,d.useState)(!1);(0,d.useEffect)(()=>{let e=!0;return Oi().then(t=>{e&&t!==void 0&&Dt(t)}),()=>{e=!1}},[]);let Ot=(0,d.useCallback)(()=>{let e=!Et;Dt(e),ki(e).then(t=>{t||Dt(!e)})},[Et]),kt=lt(),[At,W]=(0,d.useState)(!1),jt=(0,d.useCallback)(()=>{At||(W(!0),Ni().finally(()=>{W(!1)}))},[At]),Mt=ji,G=e=>K(Xt(e,u),u),Nt=u===`usd`?`$`:u===`eur`?`€`:`¥`,Pt=h,Ft=e=>Qn(e,Pt),[It,Lt]=(0,d.useState)(``),[Rt,zt]=(0,d.useState)(()=>_e()),[Bt,Vt]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{let e=setInterval(()=>{Vt(Date.now())},3e4);return()=>{clearInterval(e)}},[]);let Ut=c.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),Gt=E.leadMin*6e4,qt=(e,n)=>e===0?t(`free`):Zt(Qt(e,n,u,kt.rate),u===`usd`?`USD`:u===`eur`?`EUR`:`CNY`),Yt=(0,d.useMemo)(()=>Un([..._].reverse()),[_]),en={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},tn=en.peak/2,nn=Sr(F,q()),on=e=>o.find(t=>$(t.provider)===$(e)),Y=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),dn=e=>{if(e===void 0)return(0,m.jsx)(`span`,{className:B.na,children:`—`});if(e.error===`unconfigured`)return t(`balanceUnconfigured`);if(e.error===`unauthorized`)return t(`balanceUnauthorized`);if(e.error===`unreachable`)return t(`balanceUnreachable`);if(e.totalBalance===void 0)return(0,m.jsx)(`span`,{className:B.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:G(e.totalBalance),r=e.currency===`USD`?e.totalBalance*kt.rate:e.totalBalance,i=nn>0?Math.floor(r/nn):void 0;return(0,m.jsxs)(`span`,{className:B.balanceCell,children:[(0,m.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,m.jsx)(`button`,{type:`button`,className:y(B.balanceDaysBadge,i<=3&&B.balanceDaysBadgeLow),"data-testid":`billing-balance-days-badge`,title:t(`balanceDays`).replace(`{days}`,String(i)),"aria-label":`${e.displayName} ${t(`balanceDays`).replace(`{days}`,String(i))}`,onClick:t=>{t.stopPropagation(),at(it===e.provider?void 0:e.provider)},children:`?`}),it===e.provider&&(0,m.jsx)(Ri,{balance:e,days:i??0,dailyBurn:nn,money:G,t,onClose:()=>{at(void 0)}})]})},fn=Object.keys(F).sort(),pn=q(),mn=F[pn]?.cost??0,gn=pn.slice(0,7),_n=pn.slice(0,4),X=fn.reduce((e,t)=>e+(t.startsWith(gn)?F[t]?.cost??0:0),0),vn=fn.reduce((e,t)=>e+(t.startsWith(_n)?F[t]?.cost??0:0),0),yn=(0,d.useMemo)(()=>wr(F,gn,pn)+c.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[F,gn,pn,c]),bn=(0,d.useMemo)(()=>{if(!(b&&x>0))return null;let e=x-X;return{over:e<=0,remainRatio:Math.max(0,Math.min(1,e/x)),remainCny:Math.max(0,e)}},[b,x,X]),Z=(0,d.useMemo)(()=>{let e=[];for(let t=De-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push(q(n.getTime()))}return e},[De]),Sn=Z.at(-1)??pn,Cn=(0,d.useMemo)(()=>Object.entries(F).map(([e,t])=>({date:e,value:He===`tokens`?Dr(t):t.cost})),[F,He]),wn=(0,d.useMemo)(()=>Cn.reduce((e,t)=>e+t.value,0),[Cn]),Tn=Tr(F),En=Er(F),On=(0,d.useMemo)(()=>Z.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=F[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:Dr(i)}}),[Z,F,e.byDayModels]),kn=(0,d.useMemo)(()=>Object.entries(Te).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=Ht(e),r=n.key===`other`,i=r?Lr(e):void 0,a={input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,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:Jt(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:hr[t%hr.length]??`#8b95a3`})),[Te]),jn=(0,d.useMemo)(()=>M.hideUnidentified?l.filter(e=>e.kind!==`unknown`):l,[l,M.hideUnidentified]),Mn=(0,d.useMemo)(()=>{let n=e.byDayModelsSite;if(Ct){let t=q();n={[t]:e.byDayModelsSite?.[t]??{}}}let r=new Map;for(let t of Object.values(n??{}))for(let[n,i]of Object.entries(t))for(let[t,a]of Object.entries(i)){let i=r.get(t);i===void 0&&(i=new Map,r.set(t,i));let o=i.get(n)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss: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.cost+=a.cost,o.allPlan=o.allPlan&&(a.plan??e.byModel?.[n]?.plan===!0),i.set(n,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=Ht(e),a=i.key===`other`,o=a?Lr(e)??i.provider:i.provider;return{key:e,name:a?e:i.name,provider:o,color:hr[r%hr.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:Jt(i,{input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,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 s=e=>rr(e,Pt)??t(`channelUnknown`),l=new Map,u=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=s(e),r=l.get(n);if(r===void 0)l.set(n,[...t]),u.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=u.get(n)??`unknown`,a=f(e);p[a]>p[i]&&(u.set(n,a),d.set(n,e))}}let m=new Map,h=new Map;for(let e of c){if(e.status===`not-configured`)continue;let t=e.displayName??zr(e.provider),n=s(`direct:${e.provider}`),r=l.has(t)?t:l.has(n)?n:void 0,i=r??`sub:${zr(e.provider)}`;h.set(i,r??zr(e.provider));let a=m.get(i);a===void 0?m.set(i,[e]):a.push(e)}let g=e=>e===s(`direct:deepseek`)||e===s(`site:https://api.deepseek.com`)?on(`deepseek`)??on(e):on(e),_=[];for(let[e,t]of l)_.push({id:`ch:${d.get(e)??e}`,name:e,models:t,subscriptions:m.get(e)??[],balance:g(e),dot:gi(a,t[0]?.provider??``),channelKind:u.get(e)??`unknown`});for(let[e,t]of h)l.has(e)||_.push({id:e,name:t,models:[],subscriptions:m.get(e)??[],balance:on(t),dot:gi(a,t),channelKind:`vendor`});let v=new Set(_.flatMap(e=>[$(e.name),...e.balance===void 0?[]:[$(e.balance.provider)]]));for(let e of o)v.has($(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&_.push({id:`bal:${e.provider}`,name:e.displayName,models:[],subscriptions:[],balance:e,dot:gi(a,e.displayName),channelKind:`vendor`});return _.filter(e=>M.hideUnidentified&&e.channelKind===`unknown`?!1:!Ct||e.models.length>0).sort((e,t)=>{let n=xi(t)-xi(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,c,o,a,Pt,t,Ct,M.hideUnidentified]),Nn=(0,d.useMemo)(()=>Mn.filter(e=>e.models.length>0||e.subscriptions.length>0).map(e=>e.id),[Mn]),Fn=Nn.length>0&&Nn.every(e=>vt.has(e)),In=()=>{let e=new Set(Fn?[]:Nn);yt(e),xe([...e])},Ln=(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`model`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`calls`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`inputTokens`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`outputTokens`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`cacheHitRate`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`actual`)})]})}),Rn=e=>(0,m.jsx)(`span`,{className:B.modelCell,children:(0,m.jsxs)(`span`,{children:[(0,m.jsxs)(`span`,{className:B.modelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:B.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,m.jsx)(`span`,{className:B.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,m.jsx)(`span`,{className:B.modelProvider,children:Ft(e.provider)})]})}),zn=e.bySite?.unknown?.calls??0,Vn=kn.reduce((e,t)=>e+t.estimated,0),Hn=P.cost>0||zn>0?P.cost:Vn,Q=(0,d.useMemo)(()=>{if(tt===`all`){let e,t=0;for(let[n,r]of Object.entries(F)){let i=Dr(r);i>t&&(t=i,e=n)}return{cost:Hn,calls:P.calls,input:P.input,output:P.output,cacheHit:P.cacheHit,cacheMiss:P.cacheMiss,reasoning:P.reasoning??0,peakDay:e,peakTokens:t}}return Ar(F,q(),tt)},[tt,Hn,P,F]),Wn=(0,d.useMemo)(()=>kn.map(e=>({key:e.key,name:e.name,color:e.color})),[kn]),Gn=On.length>=2?On.at(-2)?.cost??0:0,Kn=Gn>0?(mn-Gn)/Gn*100:0;return(0,m.jsx)(p.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:y(B.dashboardModal,`dsh-billing-modal`),children:(0,m.jsxs)(`div`,{className:B.dashboard,"data-testid":`billing-dashboard`,children:[(0,m.jsxs)(`div`,{className:B.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,m.jsxs)(`div`,{children:[v(`billing.dashboard.decor`,{position:`head`}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:B.dashboardTitle,children:t(`title`)}),v(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,m.jsxs)(`p`,{className:B.dashboardSubtitle,children:[t(`lastUpdated`),` `,Sn,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,m.jsxs)(`div`,{className:B.dashboardRight,children:[(0,m.jsx)(`span`,{className:B.currencyToggle,role:`group`,"aria-label":t(`language`),children:[`en`,`zh`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.currencyButton,h===e&&B.currencyButtonActive),"aria-pressed":h===e,"data-testid":`billing-language-${e}`,onClick:()=>{g(e)},children:e===`en`?`EN`:`中`},e))}),(0,m.jsx)(`span`,{className:B.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`,`eur`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.currencyButton,u===e&&B.currencyButtonActive),"aria-pressed":u===e,"data-testid":`billing-currency-${e}`,title:t(e===`cny`?`currencyCny`:e===`usd`?`currencyUsd`:`currencyEur`),onClick:()=>{f(e)},children:e===`cny`?`¥ CNY`:e===`usd`?`$ USD`:`€ EUR`},e))}),a.checked&&(0,m.jsxs)(`span`,{className:y(B.healthBadge,a.available?B.healthBadgeOk:B.healthBadgeBad),children:[(0,m.jsx)(`span`,{className:y(B.healthDot,a.available?B.healthOk:B.healthBad),role:`img`,"aria-label":a.available?t(`healthDotLive`):t(`healthDotFailed`),title:a.available?t(`healthDotLive`):t(`healthDotFailed`)}),a.available?`${t(`healthModelsLive`).replace(`{n}`,String(a.models))}${a.failures>0?` · ${t(`healthVendorsDown`).replace(`{n}`,String(a.failures))}`:``}`:t(`healthVendorsUnavailable`).replace(`{n}`,String(a.failures))]}),(0,m.jsx)(`button`,{type:`button`,className:B.closeButton,"aria-label":t(`close`),"data-testid":`billing-close`,onClick:n,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`})]})})]})]}),e.staleSnapshot===!0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-stale-snapshot`,children:t(`staleSnapshotNotice`)}),(0,m.jsx)(`nav`,{className:B.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:_r.map(e=>(0,m.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":L===e.id,"aria-controls":`billing-tab-panel-${e.id}`,className:y(B.tabButton,L===e.id&&B.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{Ee(e.id)},children:[(0,m.jsx)(`span`,{className:B.tabRailIcon,"aria-hidden":`true`,children:yr[e.id]}),(0,m.jsx)(`span`,{className:B.tabNavLabel,children:t(e.labelKey)})]},e.id))}),(0,m.jsxs)(`div`,{className:B.dashboardBody,children:[L===`overview`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[s?.kind===`drift`&&s.spent!==void 0&&Oe!==Ae()&&(0,m.jsxs)(`div`,{className:B.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,m.jsx)(`span`,{className:B.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:B.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,s.provider??``).replace(`{spent}`,G(s.spent)).replace(`{today}`,G(s.todayOfficialCost??0))}),(0,m.jsx)(`button`,{type:`button`,className:B.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:je,children:t(`reconcileDismiss`)})]}),ce===!0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-balance-stale`,children:t(`balanceStaleNotice`)}),(0,m.jsxs)(`section`,{className:B.hero,"data-testid":`billing-hero`,children:[v(`billing.dashboard.decor`,{position:`hero`}),(0,m.jsxs)(`div`,{className:B.heroTop,children:[(0,m.jsxs)(`div`,{className:B.heroMain,children:[(0,m.jsx)(`span`,{className:B.heroLabel,children:t(`monthCost`)}),(0,m.jsxs)(`div`,{className:B.heroReadout,children:[(0,m.jsx)(`span`,{className:B.heroCurrency,"aria-hidden":`true`,children:Nt}),(0,m.jsx)(`span`,{className:B.heroValue,children:G(X).slice(1)})]}),(0,m.jsxs)(`span`,{className:B.heroMeta,children:[P.calls.toLocaleString(),` `,t(`calls`),yn>0&&(0,m.jsxs)(`span`,{className:B.heroPred,children:[` `,t(`monthProjected`),` `,G(yn)]})]})]}),bn!==null&&(0,m.jsxs)(`div`,{className:B.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,m.jsxs)(`div`,{className:B.heroGaugeDial,children:[(0,m.jsxs)(`svg`,{className:B.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:B.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,m.jsx)(`circle`,{className:y(B.heroGaugeArc,bn.over&&B.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${bn.remainRatio*326.7} 326.7`},stroke:bn.over?void 0:`url(#heroRingGrad)`})]}),(0,m.jsxs)(`span`,{className:B.heroGaugeCenter,children:[(0,m.jsxs)(`span`,{className:y(B.heroGaugeRemain,bn.over&&B.heroGaugeRemainOver),children:[Nt,Xt(bn.remainCny,u).toFixed(2)]}),(0,m.jsx)(`span`,{className:B.heroGaugeLabel,children:t(`budgetRemain`)})]})]}),(0,m.jsxs)(`span`,{className:B.heroGaugeSub,children:[G(X),` / `,G(x)]})]})]}),(0,m.jsxs)(`div`,{className:B.heroSide,children:[(0,m.jsxs)(`div`,{className:B.heroSideItem,children:[(0,m.jsx)(`span`,{className:B.heroSideLabel,children:t(`yearCost`)}),(0,m.jsx)(`span`,{className:B.heroSideValue,children:G(vn)})]}),(0,m.jsxs)(`div`,{className:B.heroSideItem,children:[(0,m.jsx)(`span`,{className:B.heroSideLabel,children:t(`todayCost`)}),(0,m.jsxs)(`span`,{className:B.heroSideValue,children:[G(mn),(0,m.jsxs)(`span`,{className:y(B.delta,Kn>=0?B.deltaUp:B.deltaDown),children:[Kn>=0?`▲`:`▼`,` `,Math.abs(Kn).toFixed(1),`%`]})]})]}),yn>0&&(0,m.jsxs)(`div`,{className:B.heroSideItem,title:t(`monthProjectedHint`),children:[(0,m.jsx)(`span`,{className:B.heroSideLabel,children:t(`monthProjected`)}),(0,m.jsx)(`span`,{className:B.heroSideValue,children:G(yn)})]}),yn<=0&&(0,m.jsx)(`span`,{className:B.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&!Fe.has(`unpriced`)&&(0,m.jsxs)(`div`,{className:B.unpricedHint,"data-testid":`billing-unpriced-hint`,children:[(0,m.jsx)(`span`,{className:B.unpricedHintBody,children:t(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0))}),(0,m.jsx)(`button`,{type:`button`,className:B.noticeDismiss,"data-testid":`billing-unpriced-dismiss`,"aria-label":t(`close`),onClick:()=>{ze(`unpriced`)},children:`×`})]}),(e.total.searchCalls??0)>0&&!Fe.has(`search-estimate`)&&(0,m.jsxs)(`div`,{className:B.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:[(0,m.jsx)(`span`,{className:B.unpricedHintBody,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,G(e.searchCallEstimateCny??0))}),(0,m.jsx)(`button`,{type:`button`,className:B.noticeDismiss,"data-testid":`billing-search-estimate-dismiss`,"aria-label":t(`close`),onClick:()=>{ze(`search-estimate`)},children:`×`})]}),(e.unreadableSessions??0)>0&&!Fe.has(`unreadable`)&&(0,m.jsxs)(`div`,{className:B.staleNotice,"data-testid":`billing-sessions-unreadable`,children:[(0,m.jsxs)(`div`,{className:B.staleNoticeBody,children:[t(`unreadableNotice`).replace(`{count}`,String(e.unreadableSessions)),(e.unreadableNoLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:B.staleNoticeSub,"data-testid":`billing-sessions-no-ledger`,children:t(`unreadableNoLedgerNotice`).replace(`{count}`,String(e.unreadableNoLedgerSessions))}),(e.unreadableFormatSessions??0)>0&&(0,m.jsx)(`div`,{className:B.staleNoticeSub,"data-testid":`billing-sessions-format-unsupported`,children:t(`unreadableFormatNotice`).replace(`{count}`,String(e.unreadableFormatSessions))})]}),(0,m.jsx)(`button`,{type:`button`,className:B.noticeDismiss,"data-testid":`billing-unreadable-dismiss`,"aria-label":t(`close`),onClick:()=>{ze(`unreadable`)},children:`×`})]}),(0,m.jsxs)(`div`,{className:B.kpiZone,children:[(0,m.jsxs)(`div`,{className:B.kpiZoneHead,children:[(0,m.jsx)(`span`,{className:B.kpiZoneLabel,children:t(`kpiRange`)}),(0,m.jsx)(`div`,{className:B.heatmapRangeSwitch,"data-testid":`billing-kpi-range`,role:`group`,"aria-label":t(`kpiRange`),children:[[`today`,`avgRangeToday`],[`7d`,`avgRange7d`],[`week`,`avgRangeWeek`],[`month`,`avgRangeMonth`],[`all`,`avgRangeAll`]].map(([e,n])=>(0,m.jsx)(`button`,{type:`button`,className:y(B.heatmapRangeButton,tt===e&&B.heatmapRangeButtonActive),"data-testid":`billing-kpi-range-${e}`,"aria-pressed":tt===e,onClick:()=>{nt(e),re(e)},children:t(n)},e))})]}),(0,m.jsx)(`section`,{className:B.kpiGrid,"data-testid":`billing-kpi-grid`,children:(()=>{let e=Object.keys(F).sort().slice(-7),n=q(),r=e.indexOf(n),i=(e,t)=>e[t]??0,a=e.map(e=>F[e]?.cost??0),o=e.map(e=>F[e]?.calls??0),s=e.map(e=>{let t=F[e];return t===void 0?0:Dr(t)}),c=e.map(e=>{let t=F[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)=>(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=>(0,m.jsxs)(`span`,{className:y(B.kpiDelta,e>0?B.kpiDeltaUp:e<0?B.kpiDeltaDown:B.kpiDeltaFlat),children:[e>0?`▲`:e<0?`▼`:``,` `,Math.abs(e).toFixed(1),`%`]});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescCacheHit`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`cacheHitRate`)})}),g(f)]}),(0,m.jsx)(`span`,{className:y(B.kpiValue,B.kpiGreen),children:$t(Q.cacheHit+Q.cacheMiss>0?Q.cacheHit/(Q.cacheHit+Q.cacheMiss)*100:0)}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(c,`var(--ds-cyan)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[J(Q.cacheHit),` / `,J(Q.cacheHit+Q.cacheMiss),(P.cacheWrite??0)>0?` · ${t(`tokenCacheWrite`)} ${J(P.cacheWrite??0)}`:``]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescTokens`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokens`)})}),g(d)]}),(0,m.jsx)(`span`,{className:B.kpiValue,children:J(Q.input+Q.output)}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(s,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[t(`inputTokens`),` `,J(Q.input),` · `,t(`outputTokens`),` `,J(Q.output)]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-avg`,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescAvgCost`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`avgCost`)})}),g(l)]}),(0,m.jsx)(`span`,{className:B.kpiValue,children:G(Q.calls>0?Q.cost/Q.calls:0)}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(a,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[t(`calls`),` `,Q.calls.toLocaleString()]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,children:[(0,m.jsxs)(`div`,{className:B.kpiLabelRow,children:[(0,m.jsx)(p.Tooltip,{label:t(`kpiDescCalls`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`calls`)})}),g(u)]}),(0,m.jsx)(`span`,{className:B.kpiValue,children:Q.calls.toLocaleString()}),(0,m.jsx)(`div`,{className:B.kpiSpark,children:h(o,`var(--ds-blue)`)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[kn.length,` `,t(`models`)]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-think`,children:[(0,m.jsx)(`div`,{className:B.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:t(`kpiDescReasoning`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokenReasoningShare`)})})}),(0,m.jsx)(`span`,{className:y(B.kpiValue,B.kpiGreen),children:$t(Q.output>0?Q.reasoning/Q.output*100:0)}),(0,m.jsx)(`span`,{className:B.kpiDetail,children:J(Q.reasoning)})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-io`,children:[(0,m.jsx)(`div`,{className:B.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:t(`kpiDescIo`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokenIo`)})})}),(0,m.jsx)(`span`,{className:B.kpiValue,children:(Q.output>0?Q.input/Q.output:0).toFixed(2)}),(0,m.jsxs)(`span`,{className:B.kpiDetail,children:[J(Q.input),` / `,J(Q.output)]})]}),(0,m.jsxs)(`div`,{className:B.kpiTile,"data-testid":`billing-kpi-peak`,children:[(0,m.jsx)(`div`,{className:B.kpiLabelRow,children:(0,m.jsx)(p.Tooltip,{label:t(`kpiDescPeak`),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.kpiLabel,children:t(`tokenPeak`)})})}),(0,m.jsx)(`span`,{className:B.kpiValue,children:Q.peakTokens>0?un(Q.peakTokens):`—`}),(0,m.jsx)(`span`,{className:B.kpiDetail,children:Q.peakDay??`—`})]})]})})()})]}),(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-heatmap`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`heatmap`)}),(0,m.jsx)(`div`,{className:B.heatmapRangeSwitch,"data-testid":`billing-heatmap-metric`,role:`group`,"aria-label":t(`heatmap`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.heatmapRangeButton,He===e&&B.heatmapRangeButtonActive),"data-testid":`billing-heatmap-metric-${e}`,"aria-pressed":He===e,onClick:()=>{Ue(e)},children:t(e===`cost`?`metricCost`:`metricTokens`)},e))}),(0,m.jsx)(`div`,{className:B.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`half`,`year`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.heatmapRangeButton,Be===e&&B.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":Be===e,onClick:()=>{Ve(e)},children:t(e===`month`?`heatmapMonth`:e===`half`?`heatmapHalf`:`heatmapYear`)},e))}),(0,m.jsxs)(`span`,{className:B.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`heatmapTotal`),` `,He===`tokens`?J(wn):G(wn),` · `,t(`activeDays`),` `,Tn,` · `,t(`streakDays`),` `,En]})]}),(0,m.jsx)(Bn,{days:Cn,currency:u,t,range:Be,unit:He})]})]}),L===`context`&&(0,m.jsx)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-context`,children:N===void 0?(0,m.jsx)(`p`,{className:B.contextEmpty,"data-testid":`billing-context-empty`,children:t(`contextNoData`)}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`section`,{className:B.contextCard,"data-testid":`billing-context-card`,children:[(0,m.jsxs)(`div`,{className:B.contextHead,children:[(0,m.jsx)(`span`,{className:B.contextTitle,children:t(`contextOccupancy`)}),ue!==void 0&&(0,m.jsx)(`span`,{className:B.contextRatio,children:`${String(Math.round(ue*100))}%`})]}),ue!==void 0&&(0,m.jsx)(`div`,{className:B.contextBar,"data-testid":`billing-context-bar`,role:`img`,"aria-label":`${t(`contextOccupancy`)} ${String(Math.round(ue*100))}%`,children:(0,m.jsx)(`span`,{className:B.contextBarFill,style:{width:`${String(Math.round(ue*100))}%`}})}),(0,m.jsxs)(`div`,{className:B.contextBody,children:[de!==void 0&&(0,m.jsx)(`span`,{className:B.contextValue,children:J(de)}),N.contextWindow!==void 0&&(0,m.jsx)(`span`,{className:B.contextHint,children:t(`contextWindow`).replace(`{window}`,J(N.contextWindow))})]}),(0,m.jsxs)(`div`,{className:B.contextStats,children:[N.projectedTokens!==void 0&&(0,m.jsxs)(`div`,{className:B.contextStat,children:[(0,m.jsx)(`span`,{className:B.contextStatLabel,children:t(`contextNextRequest`)}),(0,m.jsx)(`span`,{className:B.contextStatValue,children:J(N.projectedTokens)})]}),N.pressureTokens!==void 0&&(0,m.jsxs)(`div`,{className:B.contextStat,children:[(0,m.jsx)(`span`,{className:B.contextStatLabel,children:t(`contextLastRequest`)}),(0,m.jsx)(`span`,{className:B.contextStatValue,children:J(N.pressureTokens)})]})]})]}),fe.length>0&&(0,m.jsxs)(`section`,{className:B.contextCard,"data-testid":`billing-context-breakdown`,children:[(0,m.jsx)(`div`,{className:B.contextHead,children:(0,m.jsx)(`span`,{className:B.contextTitle,children:t(`contextComposition`)})}),(()=>{let e=Math.max(...fe.map(e=>e.tokens),1);return(0,m.jsx)(`div`,{className:B.contextBreakdown,children:fe.map(n=>(0,m.jsxs)(`div`,{className:B.contextBreakRow,children:[(0,m.jsx)(`span`,{className:B.contextBreakLabel,children:t(n.key===`system`?`contextSystem`:n.key===`tools`?`contextTools`:`contextMessages`)}),(0,m.jsx)(`span`,{className:B.contextBreakTrack,children:(0,m.jsx)(`span`,{className:B.contextBreakFill,style:{width:`${String(Math.round(n.tokens/e*100))}%`}})}),(0,m.jsx)(`span`,{className:B.contextBreakValue,children:J(n.tokens)})]},n.key))})})(),(0,m.jsx)(`p`,{className:B.contextFootnote,children:t(`contextCompositionHint`)})]})]})}),L===`agents`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-agents`,children:[(0,m.jsxs)(`section`,{className:B.agentSummary,"data-testid":`billing-agent-summary`,children:[(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:String(me.agents)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsCount`)})]}),(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:String(me.delegations)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsDelegations`)})]}),(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:String(me.roots)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsRoots`)})]}),me.costliest!==void 0&&me.costliest.chainCost>0&&(0,m.jsxs)(`span`,{className:B.agentSummaryItem,children:[(0,m.jsx)(`span`,{className:B.agentSummaryValue,children:G(me.costliest.chainCost)}),(0,m.jsx)(`span`,{className:B.agentSummaryLabel,children:t(`agentsMostExpensive`)})]})]}),pe.length===0||me.delegations===0?(0,m.jsx)(`p`,{className:B.contextEmpty,"data-testid":`billing-agents-empty`,children:t(`agentsNoData`)}):(0,m.jsx)(`div`,{className:B.agentTree,"data-testid":`billing-agent-tree`,children:(()=>{let e=n=>(0,m.jsxs)(`div`,{className:B.agentNode,children:[(0,m.jsxs)(`div`,{className:B.agentRow,style:{paddingLeft:`${String(n.depth*16)}px`},children:[(0,m.jsx)(`span`,{className:B.agentKind,children:n.depth===0?t(`agentsRoot`):t(`agentsSubagent`)}),(0,m.jsx)(`span`,{className:B.agentTitle,children:n.title??`${t(`sessionUntitled`)} · ${n.id.slice(0,8)}`}),(0,m.jsx)(`span`,{className:B.agentCalls,children:n.calls.toLocaleString()}),(0,m.jsx)(`span`,{className:B.agentCost,children:G(n.cost)}),n.children.length>0&&(0,m.jsxs)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-agent-chain`,children:[t(`agentsChainTotal`),` `,G(n.chainCost)]})]}),n.children.map(e)]},n.id);return pe.map(e)})()})]}),L===`settings`&&(0,m.jsx)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-settings`,children:(0,m.jsxs)(`div`,{className:B.settingsLayout,children:[(0,m.jsx)(`aside`,{className:B.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:t(`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:t(`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:t(`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:t(`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:t(`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:t(`settingsNavAbout`)}].map(e=>(0,m.jsxs)(`button`,{type:`button`,className:y(B.settingsNavItem,Ye===e.id&&B.settingsNavItemActive,e.advanced&&B.settingsNavItemAdvanced),"data-testid":`billing-settings-nav-${e.id}`,onClick:()=>{Qe(e.id)},children:[(0,m.jsx)(`span`,{className:B.settingsNavIcon,"aria-hidden":`true`,children:e.icon}),e.label]},e.id))}),(0,m.jsxs)(`div`,{className:B.settingsPane,children:[(0,m.jsx)(`input`,{className:y(B.ubSearch,B.settingsSearch),type:`search`,value:Ze,placeholder:t(`settingsSearchPlaceholder`),"aria-label":t(`settingsSearchPlaceholder`),"data-testid":`billing-settings-search`,onChange:e=>{V(e.target.value)}}),Ze.trim()!==``&&Wi(Ze)&&(0,m.jsx)(`p`,{className:B.setCardDesc,"data-testid":`billing-settings-search-empty`,children:t(`settingsSearchEmpty`).replace(`{query}`,Ze.trim())}),(0,m.jsxs)(`div`,{hidden:H(Ui.display),className:B.setCard,id:`settings-display-pref`,"data-testid":`billing-density-motion-card`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsx)(`h3`,{className:B.setCardTitle,children:t(`settingsSectionDisplay`)})})}),(0,m.jsxs)(`div`,{className:B.densityRow,children:[(0,m.jsxs)(`div`,{className:B.densityLeft,children:[(0,m.jsx)(`strong`,{children:t(`densityLabel`)}),(0,m.jsx)(`span`,{children:t(`densityHint`)})]}),(0,m.jsx)(`div`,{className:B.densityButtons,"data-testid":`billing-density-buttons`,children:[`compact`,`default`,`comfortable`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.densityButton,We===e&&B.densityButtonActive,e===`comfortable`&&B.densityButtonComfortable),"data-testid":`billing-density-${e}`,onClick:()=>{$e(e)},children:t(e===`compact`?`densityCompact`:e==="default"?`densityDefault`:`densityComfortable`)},e))})]}),(0,m.jsxs)(`div`,{className:B.densityRow,children:[(0,m.jsxs)(`div`,{className:B.densityLeft,children:[(0,m.jsx)(`strong`,{children:t(`motionLabel`)}),(0,m.jsx)(`span`,{children:t(`motionHint`)})]}),(0,m.jsx)(`div`,{className:B.densityButtons,"data-testid":`billing-motion-buttons`,children:[`off`,`subtle`,`rich`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.densityButton,qe===e&&B.densityButtonActive),"data-testid":`billing-motion-${e}`,onClick:()=>{et(e)},children:t(e===`off`?`motionOff`:e===`subtle`?`motionSubtle`:`motionRich`)},e))})]})]}),(0,m.jsxs)(`section`,{hidden:H(Ui.budget),className:B.setCard,"data-testid":`billing-budget`,id:`settings-budget`,children:[(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`budget`),(0,m.jsx)(Fi,{label:t(`budgetHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":b,"aria-label":t(`budget`),"data-testid":`billing-budget-toggle`,className:y(B.switch,b&&B.switchOn),onClick:S,children:(0,m.jsx)(`span`,{className:B.switchKnob})})]}),b&&(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`budgetAmount`)}),(0,m.jsxs)(`span`,{className:B.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,m.jsx)(`span`,{className:B.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:B.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:x===0?``:x,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${u===`usd`?`USD`:u===`eur`?`EUR`:`CNY`})`,title:`${t(`budget`)}(${u===`usd`?`USD`:u===`eur`?`EUR`:`CNY`})`,onChange:e=>{C(e.target.valueAsNumber)}})]})]}),x>0&&(()=>{let e=X/x*100;return(0,m.jsx)(`div`,{className:B.ctlRowStretch,children:(0,m.jsx)(`div`,{className:B.prog,role:`progressbar`,"aria-valuenow":Math.min(e,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),"data-testid":`billing-budget-track`,children:(0,m.jsx)(`div`,{className:y(B.progFill,e>=100&&B.budgetFillOver,e>=80&&e<100&&B.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),x>0&&(0,m.jsx)(`p`,{className:B.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,G(X)).replace(`{total}`,G(x))})]}),(0,m.jsxs)(`div`,{className:B.ctlCol,"data-testid":`billing-model-budgets`,children:[(0,m.jsxs)(`span`,{className:B.modelBudgetTitle,children:[t(`modelBudgetTitle`),(0,m.jsx)(Fi,{label:t(`modelBudgetHint`),t})]}),_t.length===0&&(0,m.jsx)(`p`,{className:B.modelBudgetHint,children:t(`emptyHint`)}),(0,m.jsx)(`div`,{className:B.modelBudgetList,children:_t.map(e=>(0,m.jsxs)(`div`,{className:B.modelBudgetRow,children:[(0,m.jsx)(`span`,{className:B.modelBudgetName,title:e.name??e.key,children:e.name??e.key}),(0,m.jsx)(`span`,{className:B.modelBudgetCost,"data-testid":`billing-model-budget-cost-${e.key}`,children:G(e.cost)}),(0,m.jsxs)(`span`,{className:B.inp,children:[(0,m.jsx)(`span`,{className:B.affix,"aria-hidden":`true`,children:`¥`}),(0,m.jsx)(`input`,{className:B.budgetInput,type:`number`,min:0,step:1,value:w[e.key]??``,placeholder:t(`modelBudgetPlaceholder`),"aria-label":`${t(`modelBudgetTitle`)} · ${e.name??e.key}`,"data-testid":`billing-model-budget-${e.key}`,onChange:t=>{ee(e.key,t.target.valueAsNumber)}})]})]},e.key))})]})]}),(0,m.jsxs)(`section`,{hidden:H(Ui.alert),className:B.setCard,"data-testid":`billing-peak-alert-settings`,id:`settings-alert`,children:[(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`peakAlert`),(0,m.jsx)(Fi,{label:t(`peakAlertHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":E.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:y(B.switch,E.enabled&&B.switchOn),onClick:()=>{D({...E,enabled:!E.enabled})},children:(0,m.jsx)(`span`,{className:B.switchKnob})})]}),E.enabled&&(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`label`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,m.jsx)(`span`,{className:B.inp,children:(0,m.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:E.leadMin,className:B.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);D({...E,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):E.leadMin})}})})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertPos`)}),(0,m.jsx)(`div`,{className:B.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,m.jsxs)(`label`,{className:B.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:E.position===e,onChange:()=>D({...E,position:e})}),(0,m.jsx)(`span`,{className:B.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertMode`)}),(0,m.jsx)(`div`,{className:B.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,m.jsxs)(`label`,{className:B.rdo,children:[(0,m.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:E.mode===e,onChange:()=>D({...E,mode:e})}),(0,m.jsx)(`span`,{className:B.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,m.jsxs)(`label`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,m.jsx)(`input`,{type:`checkbox`,checked:E.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{D({...E,webNotify:e.target.checked})}})]}),(0,m.jsx)(`div`,{className:B.ctlRow,children:(0,m.jsx)(`button`,{type:`button`,className:B.btn,onClick:O,children:t(`peakAlertPreview`)})})]})]}),(0,m.jsx)(`section`,{hidden:H(Ui.toggles),className:B.setCard,"data-testid":`billing-toggle-setting`,id:`settings-display`,children:(0,m.jsxs)(`div`,{className:B.setGrid3,children:[(0,m.jsx)(`div`,{className:B.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`usageStatsTool`),(0,m.jsx)(Fi,{label:t(`usageStatsToolHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Et,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:y(B.switch,Et&&B.switchOn),onClick:Ot,children:(0,m.jsx)(`span`,{className:B.switchKnob})})]})}),(0,m.jsxs)(`div`,{className:B.setCell,"data-testid":`billing-livecost-setting`,children:[(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`liveCostBar`),(0,m.jsx)(Fi,{label:t(`liveCostBarHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":ae.show,"aria-label":t(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:y(B.switch,ae.show&&B.switchOn),onClick:()=>oe({...ae,show:!ae.show}),children:(0,m.jsx)(`span`,{className:B.switchKnob})})]}),ae.show&&(0,m.jsxs)(`div`,{className:B.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,m.jsx)(`span`,{className:B.rdoLabel,children:t(`liveCostBarPosition`)}),(0,m.jsx)(Ki,{liveCostPrefs:ae,onLiveCostPrefs:oe,t})]})]}),(0,m.jsx)(`div`,{className:B.setCell,"data-testid":`billing-site-list-setting`,children:(0,m.jsxs)(`div`,{className:B.setCardHead,children:[(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`siteListDisplay`),(0,m.jsx)(Fi,{label:t(`siteListDisplayHint`),t})]})}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":M.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:y(B.switch,M.hideUnidentified&&B.switchOn),onClick:()=>ie({hideUnidentified:!M.hideUnidentified}),children:(0,m.jsx)(`span`,{className:B.switchKnob})})]})})]})}),(0,m.jsx)(`section`,{hidden:H(Ui.displayExtra),className:B.setCard,"data-testid":`billing-display-setting`,id:`settings-display-extra`,children:(0,m.jsxs)(`div`,{className:B.setGrid2,children:[(0,m.jsxs)(`div`,{className:B.setCell,"data-testid":`billing-float-setting`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`floatWindow`),(0,m.jsx)(Fi,{label:t(`floatWindowHint`),t})]})})}),(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`floatMode`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,k.mode===`combined`&&B.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>te({mode:`combined`,targets:k.targets}),children:t(`floatModeCombined`)}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,k.mode===`subscription`&&B.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>te({mode:`subscription`,targets:k.targets}),children:t(`floatModeSubscription`)})]})]}),k.mode===`subscription`&&(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`floatTargets`)}),(0,m.jsxs)(`span`,{className:B.ctlGroup,"data-testid":`billing-float-targets`,children:[rt.map(e=>{let t=k.targets.includes(e.id);return(0,m.jsxs)(`label`,{className:B.floatTarget,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>te({mode:`subscription`,targets:t?k.targets.filter(t=>t!==e.id):[...k.targets,e.id]})}),(0,m.jsx)(`span`,{className:B.floatTargetLabel,children:e.label})]},e.id)}),rt.length===0&&(0,m.jsx)(`span`,{className:B.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,m.jsxs)(`div`,{className:B.setCell,"data-testid":`billing-card-setting`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsxs)(`h3`,{className:B.setCardTitle,children:[t(`cardDisplay`),(0,m.jsx)(Fi,{label:t(`cardDisplayHint`),t})]})})}),(0,m.jsxs)(`div`,{className:B.ctlCol,children:[(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`cardMetric`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.metric===`money`&&B.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>j({...A,metric:`money`}),children:t(`cardMetricMoney`)}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.metric===`tokens`&&B.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>j({...A,metric:`tokens`}),children:t(`cardMetricTokens`)})]})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`cardSpan`)}),(0,m.jsx)(`div`,{className:B.ctlGroup,"data-testid":`billing-card-span`,children:[[`day`,`cardSpanDay`],[`week`,`cardSpanWeek`],[`month`,`cardSpanMonth`]].map(([e,n])=>(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.span===e&&B.floatModeBtnOn),"data-testid":`billing-card-span-${e}`,"aria-pressed":A.span===e,onClick:()=>j({...A,span:e}),children:t(n)},e))})]}),(0,m.jsxs)(`div`,{className:B.ctlRow,children:[(0,m.jsx)(`span`,{className:B.ctlLabel,children:t(`cardDeltaBadge`)}),(0,m.jsxs)(`div`,{className:B.ctlGroup,"data-testid":`billing-card-delta`,children:[(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,A.showDelta&&B.floatModeBtnOn),"data-testid":`billing-card-delta-show`,"aria-pressed":A.showDelta,onClick:()=>j({...A,showDelta:!0}),children:t(`cardDeltaShow`)}),(0,m.jsx)(`button`,{type:`button`,className:y(B.floatModeBtn,!A.showDelta&&B.floatModeBtnOn),"data-testid":`billing-card-delta-hide`,"aria-pressed":!A.showDelta,onClick:()=>j({...A,showDelta:!1}),children:t(`cardDeltaHide`)})]})]})]})]})]})}),(0,m.jsx)(`div`,{hidden:H(Ui.advanced),id:`settings-advanced`,children:(0,m.jsx)(Bi,{userPrices:r,onUserPrices:i,t})}),(0,m.jsx)(`div`,{hidden:H(Ui.about),id:`settings-about`,children:(0,m.jsx)(An,{t,version:e.pluginVersion})}),(0,m.jsxs)(`section`,{hidden:H(Ui.about),className:B.setCard,"data-testid":`billing-more-works`,children:[(0,m.jsx)(`div`,{className:B.setCardHead,children:(0,m.jsx)(`div`,{className:B.setCardMeta,children:(0,m.jsx)(`h3`,{className:B.setCardTitle,children:t(`moreWorksTitle`)})})}),(0,m.jsxs)(`div`,{className:B.moreWorkList,children:[(0,m.jsxs)(`a`,{className:B.moreWorkRow,href:`https://github.com/kenz1117/dsh-engram`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-engram`,children:[(0,m.jsx)(`span`,{className:B.moreWorkName,children:t(`adEngramName`)}),(0,m.jsx)(`span`,{className:B.moreWorkDesc,children:t(`adEngramDesc`)})]}),(0,m.jsxs)(`a`,{className:B.moreWorkRow,href:`https://github.com/kenz1117/dsh-ui-rainbowspeak`,target:`_blank`,rel:`noreferrer`,"data-testid":`billing-ad-rainbowspeak`,children:[(0,m.jsx)(`span`,{className:B.moreWorkName,children:t(`adRainbowName`)}),(0,m.jsx)(`span`,{className:B.moreWorkDesc,children:t(`adRainbowDesc`)})]})]})]})]})]})}),L===`trends`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-trend`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`trend`)}),v(`billing.dashboard.decor`,{position:`trend`}),(0,m.jsxs)(`span`,{className:B.ubCardControlGroup,children:[(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,De===e&&B.rangeButtonActive),"aria-pressed":De===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{R(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,m.jsx)(`span`,{className:B.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,m.jsx)(`button`,{type:`button`,className:y(B.rangeButton,ye===e&&B.rangeButtonActive),"aria-pressed":ye===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{Se(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:Sn})]}),(0,m.jsx)(xn,{data:On,models:Wn,currency:u,metric:ye,t})]}),_.length>0&&(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`rounds`)}),Yt.length>0&&(0,m.jsxs)(`span`,{className:B.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[Yt.length,` `,t(`anomaly`)]})]}),(0,m.jsx)(`p`,{className:B.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(_.length))}),(0,m.jsx)(Pn,{rounds:_,flags:Yt,currency:u,t})]}),e.byTier!==void 0&&(()=>{let e=en.peak+en.offPeak;if(e<=0)return null;let n=en.peak/e*100;return(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-share`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`peakShare`)}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,m.jsxs)(`div`,{className:B.shareTrack,"data-testid":`billing-share-track`,children:[(0,m.jsx)(`div`,{className:y(B.shareSeg,B.shareSegPeak),style:{width:`${n}%`}}),(0,m.jsx)(`div`,{className:y(B.shareSeg,B.shareSegOff),style:{width:`${100-n}%`}})]}),(0,m.jsxs)(`div`,{className:B.shareLegend,children:[(0,m.jsxs)(`span`,{className:B.shareItem,children:[(0,m.jsx)(`span`,{className:B.shareDot,style:{background:`var(--ds-blue)`}}),t(`peak`),(0,m.jsxs)(`span`,{className:B.shareValue,"data-testid":`billing-share-peak`,children:[G(en.peak),` · `,n.toFixed(1),`%`]})]}),(0,m.jsxs)(`span`,{className:B.shareItem,children:[(0,m.jsx)(`span`,{className:B.shareDot,style:{background:`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`}}),t(`offPeak`),(0,m.jsxs)(`span`,{className:B.shareValue,"data-testid":`billing-share-offpeak`,children:[G(en.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),tn>0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,G(tn))})]})})()]}),L===`providers`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[jn.length>0&&(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,m.jsx)(`div`,{className:B.panelHead,children:(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`panelRelayQuota`)})}),(0,m.jsx)(`div`,{className:B.providerGroupList,"data-testid":`billing-relay-quotas`,children:jn.map(e=>(0,m.jsxs)(`div`,{className:B.siteRow,"data-testid":`billing-relay-quota`,children:[(0,m.jsxs)(`span`,{className:B.siteRowName,children:[(0,m.jsx)(`span`,{className:y(B.siteKindTag,bi[e.kind]),children:yi(e.kind,t)}),(0,m.jsx)(`span`,{className:B.siteRowTitle,children:e.origin})]}),(0,m.jsxs)(`span`,{className:B.siteRowMeta,children:[e.balance!==void 0&&(0,m.jsxs)(`span`,{className:B.siteRowCost,children:[t(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let n=e.remainingPercent<20;return(0,m.jsxs)(`span`,{className:y(B.siteRowCalls,n&&B.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,m.jsx)(`span`,{className:B.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-providers`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`providerBilling`)}),v(`billing.dashboard.decor`,{position:`models`}),(0,m.jsx)(`span`,{className:B.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${Ci(e.updatedAt)}`})]}),se&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),(0,m.jsxs)(`div`,{className:B.providerCtlRow,"data-testid":`billing-provider-controls`,children:[(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,disabled:Nn.length===0,onClick:In,children:t(Fn?`collapseAll`:`expandAll`)}),(0,m.jsxs)(`span`,{className:B.providerTodayToggle,children:[(0,m.jsx)(`span`,{children:t(`todayOnly`)}),(0,m.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Ct,"data-testid":`billing-provider-today-toggle`,className:y(B.switch,Ct&&B.switchOn),onClick:Tt,children:(0,m.jsx)(`span`,{className:B.switchKnob})})]})]}),Mn.length===0?(0,m.jsxs)(`div`,{className:B.emptyState,"data-testid":`billing-provider-empty`,children:[(0,m.jsxs)(`span`,{className:B.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:B.emptyIllDot})]}),(0,m.jsx)(`span`,{className:B.emptyTitle,children:t(Ct?`todayNoConsumption`:`noData`)}),(0,m.jsx)(`span`,{className:B.emptyDesc,children:t(`emptyHint`)})]}):(0,m.jsx)(`div`,{className:B.providerGroupList,"data-testid":`billing-provider-groups`,children:Mn.map(e=>{let n=e.models.length>0||e.subscriptions.length>0,r=n&&vt.has(e.id);return(0,m.jsxs)(`div`,{className:B.providerGroup,"data-testid":`billing-provider-group`,children:[(0,m.jsxs)(`div`,{className:y(B.providerGroupHead,n&&B.providerGroupCollapsible),"data-testid":`billing-provider-group-head`,"aria-expanded":n?r:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,onClick:n?()=>{bt(e.id)}:void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),bt(e.id))}:void 0,children:[(0,m.jsxs)(`span`,{className:B.providerGroupTitle,children:[(0,m.jsx)(`span`,{className:y(B.healthDot,e.dot),role:`img`,"aria-label":Ii(e.dot,t),title:Ii(e.dot,t)}),(()=>{let n=Ft(e.name),r=e.channelKind===`direct`?ar(n):void 0,i=e.channelKind===`direct`?t(`directTag`):e.channelKind===`site`?t(`relayTag`):e.channelKind===`unknown`?t(`unknownTag`):void 0;return(0,m.jsxs)(m.Fragment,{children:[i!==void 0&&(0,m.jsx)(`span`,{className:y(B.kindBadge,e.channelKind===`site`&&B.kindBadgeRelay,e.channelKind===`unknown`&&B.kindBadgeUnknown),"data-testid":`billing-kind-badge`,children:i}),e.channelKind!==`unknown`&&(0,m.jsx)(`span`,{className:B.providerGroupName,children:r??n})]})})(),e.subscriptions.length>0&&(0,m.jsxs)(`span`,{className:B.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` `,t(`planCountUnit`)]})]}),(0,m.jsxs)(`span`,{className:B.providerGroupMeta,children:[(0,m.jsxs)(`span`,{className:B.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,m.jsx)(`span`,{className:B.providerGroupCostLabel,children:t(`cost`)}),e.channelKind===`unknown`?(0,m.jsx)(`span`,{className:B.na,children:`—`}):(0,m.jsx)(`span`,{className:B.providerGroupCostValue,children:G(xi(e))})]}),!Y(e)&&e.balance!==void 0?(0,m.jsxs)(`span`,{className:B.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,m.jsx)(`span`,{className:B.providerGroupBalanceLabel,children:t(`balance`)}),dn(e.balance)]}):(0,m.jsx)(`span`,{className:B.providerGroupBalance,"aria-hidden":`true`}),Zr(e.name)===void 0?(0,m.jsx)(`span`,{className:B.providerGroupRecharge,"aria-hidden":`true`}):(0,m.jsx)(`a`,{className:B.providerGroupRecharge,"data-testid":`billing-group-recharge`,href:Zr(e.name),target:`_blank`,rel:`noreferrer`,title:t(`rechargeHint`),"aria-label":`${Ft(e.name)} ${t(`recharge`)}`,onClick:e=>{e.stopPropagation()},children:t(`recharge`)})]})]}),e.models.length>0&&(0,m.jsx)(`div`,{className:B.providerStatRow,"data-testid":`billing-provider-stat-row`,children:(()=>{let n=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=n.input>0?e.models.reduce((e,t)=>e+t.cacheHitRate,0)/e.models.length:0;return[{lbl:t(`calls`),val:n.calls.toLocaleString(),sub:``},{lbl:t(`inputTokens`),val:J(n.input),sub:r>0?`${t(`cacheHitRate`)} ${r.toFixed(0)}%`:``},{lbl:t(`outputTokens`),val:J(n.output),sub:``},{lbl:t(`cost`),val:G(xi(e)),sub:e.models.length===1?``:`${e.models.length} ${t(`models`)}`}].map((e,t)=>(0,m.jsxs)(`div`,{className:B.providerStatCell,children:[(0,m.jsx)(`div`,{className:B.providerStatLbl,children:e.lbl}),(0,m.jsx)(`div`,{className:B.providerStatVal,children:e.val}),e.sub!==``&&(0,m.jsx)(`div`,{className:B.providerStatSub,children:e.sub})]},t))})()}),r&&(0,m.jsxs)(m.Fragment,{children:[e.channelKind===`unknown`&&(0,m.jsx)(`p`,{className:B.unknownHint,"data-testid":`billing-unknown-hint`,children:t(`unknownChannelHint`)}),e.models.length>0&&(0,m.jsx)(`div`,{className:B.tableScroll,"data-testid":`billing-table-scroll`,children:(0,m.jsxs)(`table`,{className:B.modelTable,children:[Ln,(0,m.jsx)(`tbody`,{children:e.models.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:Rn(e)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.input)}),(0,m.jsx)(`td`,{className:B.numCol,children:J(e.output)}),(0,m.jsx)(`td`,{className:B.numCol,children:$t(e.cacheHitRate)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.plan?(0,m.jsxs)(`span`,{className:B.planTag,children:[e.estimated>0?(0,m.jsxs)(`span`,{children:[`≈`,G(e.estimated)]}):null,(0,m.jsx)(`span`,{className:B.planTagBadge,"data-testid":`billing-plan-badge`,children:t(`subscriptionTag`)})]}):e.actual===void 0?e.estimated>0?(0,m.jsxs)(`span`,{title:t(`cellEstimateHint`),children:[`≈`,G(e.estimated)]}):(0,m.jsx)(`span`,{className:B.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,m.jsxs)(`span`,{className:B.bucketCost,children:[(0,m.jsx)(`span`,{className:B.bucketOfficial,children:G(t)}),(0,m.jsx)(`span`,{className:B.bucketSep,children:`/`}),(0,m.jsx)(`span`,{className:B.bucketThird,children:G(n)})]}):G(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,m.jsx)(`div`,{className:B.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=_i(e.status,t);return(0,m.jsxs)(`div`,{className:y(B.subscriptionCard,B.subscriptionCardUpgraded),"data-testid":`billing-subscription-card`,children:[(0,m.jsxs)(`div`,{className:B.subscriptionHead,children:[(0,m.jsx)(`span`,{className:B.subscriptionName,children:Ft(e.displayName)}),e.planType===`code`&&(()=>{let n=Ge(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,m.jsxs)(`span`,{className:B.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,G(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,m.jsx)(`span`,{className:B.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,m.jsx)(`span`,{className:B.subscriptionPlan,children:e.plan})]}),n!==``&&(0,m.jsx)(`div`,{className:B.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,m.jsx)(`div`,{className:B.subscriptionStatus,children:t(`subscriptionNoApi`)}),e.windows.map(e=>(0,m.jsx)(Pi,{window:e,t},e.kind))]},e.provider)})})]})]},e.id)})})]}),(0,m.jsxs)(`div`,{className:B.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,m.jsx)(`span`,{className:B.exportLabel,children:t(`export`)}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-day`,onClick:()=>{ln(cn(`usage-daily`,`csv`,Object.keys(F)),rn(F),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{ln(cn(`usage-sessions`,`csv`,Object.keys(F)),sn(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{ln(cn(`usage-sites`,`csv`,Object.keys(F)),an(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-export-json`,onClick:()=>{ln(cn(`usage-stats`,`json`,Object.keys(F)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`sessions`)}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:e.bySession.length>20?t(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(e.bySession.length)):`${e.bySession.length}`}),e.bySession.length>0&&(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-sessions-view-all`,onClick:()=>{ut(!0)},children:t(`sessionsViewAll`).replace(`{count}`,String(e.bySession.length))})]}),(e.staleLedgerSessions??0)>0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,m.jsxs)(`div`,{className:B.ubTablewrap,"data-testid":`billing-sessions-table`,children:[he!==void 0&&(0,m.jsx)(`div`,{className:B.staleNotice,"data-testid":`billing-session-nav-notice`,role:`note`,children:he}),(0,m.jsxs)(`table`,{className:B.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`sessionTitle`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`calls`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`actual`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[pt.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:B.emptyRow,children:t(`noData`)})}),pt.slice(0,20).map(e=>{let n=e.children!==void 0||e.subs!==void 0,r=n&&ot.has(e.id),i=Si(e);return(0,m.jsxs)(d.Fragment,{children:[(0,m.jsxs)(`tr`,{className:n?B.sessionGroupRow:void 0,"aria-expanded":n?r:void 0,tabIndex:n?0:void 0,onClick:n?()=>{ft(e.id)}:void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),ft(e.id))}:void 0,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:B.modelName,children:(0,m.jsxs)(`button`,{type:`button`,className:B.sessionLink,"data-testid":`billing-session-open`,title:t(`sessionOpen`),onClick:t=>{t.stopPropagation(),ve(e.id)},children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]})}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)}),(i.calls>0||i.cost>0)&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),"data-testid":`billing-session-sub`,children:i.cost>0?t(`sessionSubCost`).replace(`{cost}`,G(i.cost)):t(`sessionSubCalls`).replace(`{calls}`,i.calls.toLocaleString())})]}),mt(e)]}),r&&e.children?.map(e=>(0,m.jsxs)(`tr`,{className:B.sessionChildRow,children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`button`,{type:`button`,className:B.sessionLink,"data-testid":`billing-session-open`,title:t(`sessionOpen`),onClick:t=>{t.stopPropagation(),ve(e.id)},children:(0,m.jsx)(`span`,{className:B.modelProvider,children:e.id.slice(0,8)})})}),mt(e)]},e.id)),r&&e.subs?.map(e=>ht(e,0))]},e.id)})]})]})]}),ct&&(0,m.jsxs)(`div`,{className:B.sessionViewer,"data-testid":`billing-session-viewer`,children:[(0,m.jsxs)(`div`,{className:B.sessionViewerHead,children:[(0,m.jsx)(`h3`,{className:B.sessionViewerTitle,children:t(`sessions`)}),(0,m.jsx)(`input`,{className:B.ubSearch,type:`search`,value:U,placeholder:t(`sessionViewerSearch`),"aria-label":t(`sessionViewerSearch`),"data-testid":`billing-session-viewer-search`,onChange:e=>{dt(e.target.value)}}),(0,m.jsx)(`button`,{type:`button`,className:B.exportButton,"data-testid":`billing-session-viewer-close`,onClick:()=>{ut(!1),dt(``)},children:t(`close`)})]}),(0,m.jsx)(`div`,{className:B.sessionViewerList,"data-testid":`billing-session-viewer-list`,children:(0,m.jsxs)(`table`,{className:B.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`sessionTitle`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`calls`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`actual`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`lastActive`)})]})}),(0,m.jsxs)(`tbody`,{children:[gt.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:4,className:B.emptyRow,children:t(`noData`)})}),gt.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsxs)(`td`,{children:[(0,m.jsxs)(`span`,{className:B.modelName,children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.cwd!==void 0&&(0,m.jsx)(`span`,{className:B.modelProvider,children:Hi(e.cwd)}),e.stale===!0&&(0,m.jsx)(`span`,{className:y(B.ubTag,B.ubTagNeutral),children:t(`sessionStaleBadge`)})]}),(0,m.jsx)(`td`,{className:B.numCol,children:e.calls.toLocaleString()}),(0,m.jsx)(`td`,{className:B.numCol,children:G(e.cost)}),(0,m.jsx)(`td`,{className:B.numCol,children:e.lastActive>0?`${q(e.lastActive)} ${Ci(e.lastActive)}`:`—`})]},e.id))]})]})})]})]})]}),L===`token`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,m.jsx)(hn,{stats:e,trendDays:De,onTrendDays:R,models:Wn,money:G,t}),e.perf!==void 0&&(0,m.jsxs)(`section`,{className:B.panel,"data-testid":`billing-panel-perf`,children:[(0,m.jsxs)(`div`,{className:B.panelHead,children:[(0,m.jsx)(`h3`,{className:B.panelTitle,children:t(`perfTitle`)}),(0,m.jsx)(`span`,{className:B.panelHint,children:t(`perfHint`)})]}),(0,m.jsx)(Dn,{perf:e.perf,models:Wn,t})]})]}),L===`pricing`&&(0,m.jsxs)(`div`,{className:B.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:B.ubAlert,role:`note`,children:[(0,m.jsxs)(`div`,{className:B.ubAlertLeft,children:[(0,m.jsxs)(`span`,{className:B.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,K(kt.rate)]}),(0,m.jsx)(`span`,{className:y(B.ubTag,kt.live?B.ubTagSuccess:B.ubTagNeutral),children:kt.live?t(`rateLive`):t(`rateBuiltin`)}),Mt>0&&(0,m.jsxs)(`span`,{className:B.ubTag,"data-testid":`billing-pricing-synced`,children:[t(`pricingSyncedAt`),` `,new Date(Mt).toLocaleTimeString(Pt===`zh`?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})]}),(0,m.jsx)(`button`,{type:`button`,className:B.heatmapRangeButton,"data-testid":`billing-pricing-sync`,disabled:At,onClick:jt,children:t(At?`pricingSyncing`:`pricingSyncNow`)})]}),(0,m.jsx)(`p`,{className:B.ubAlertNote,children:t(`pricingTip`)})]}),(0,m.jsxs)(`section`,{className:B.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,m.jsxs)(`div`,{className:B.ubCardHead,children:[(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`pricing`)}),(0,m.jsx)(`span`,{className:B.ubCardSub,children:t(`pricingUnit`)}),(0,m.jsx)(`input`,{className:B.ubSearch,type:`search`,value:It,placeholder:t(`pricingSearch`),"aria-label":t(`pricingSearch`),"data-testid":`billing-pricing-search`,onChange:e=>{Lt(e.target.value)}})]}),(0,m.jsx)(`div`,{className:B.ubTablewrap,children:(0,m.jsxs)(`table`,{className:B.ubTable,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:t(`thModel`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`thInputMiss`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`thInputHit`)}),(0,m.jsx)(`th`,{className:B.numCol,children:t(`output`)}),(0,m.jsx)(`th`,{className:B.numCol,colSpan:2,children:t(`band`)})]})}),(0,m.jsx)(`tbody`,{children:Xn(Kt(),It).map(e=>{let n=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:B.ubModel,children:[(()=>{let n=qn(St(Bt,xt(e.key,Ut)),Gt);if(n===null)return null;let r=Rt.includes(e.key),i=`${e.name} · ${t(n===`peak`?`peak`:`offPeak`)} · ${t(`bandPinHint`)}`;return(0,m.jsx)(`button`,{type:`button`,className:y(B.bandDot,B[n],r&&B.bandDotOn),"data-testid":`billing-band-dot`,"aria-pressed":r,"aria-label":i,title:i,onClick:()=>{zt(I(e.key)),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.pinned-pref`))}})})(),(0,m.jsxs)(`span`,{className:B.ubModelName,children:[e.name,e.uncatalogued&&(0,m.jsx)(`span`,{className:B.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Wt(e.promo,Date.now())&&(0,m.jsx)(p.Tooltip,{label:[e.promo.note,e.promo.endsAtMs===void 0?t(`promoOpenEnded`):t(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()})].filter(Boolean).join(` · `),side:`top`,maxWidth:280,children:(0,m.jsx)(`span`,{className:B.ubTagPromo,"data-testid":`billing-price-promo`,children:t(`promoBadge`)})})]})]})}),(0,m.jsx)(`td`,{className:B.numCol,children:n?qt(e.price.input,e.price.currency):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsx)(`td`,{className:B.numCol,children:n?qt(e.price.cacheHit,e.price.currency):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsx)(`td`,{className:B.numCol,children:n?qt(e.price.output,e.price.currency):(0,m.jsx)(`span`,{className:B.na,children:`—`})}),n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsxs)(`span`,{className:B.ubChipPeak,children:[(0,m.jsx)(`span`,{className:B.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,m.jsxs)(`span`,{children:[qt(e.price.input,e.price.currency),`/`,qt(e.price.output,e.price.currency)]})]})}),(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsxs)(`span`,{className:B.ubChipOff,children:[(0,m.jsx)(`span`,{className:B.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,m.jsxs)(`span`,{children:[qt(e.price.offPeak.input,e.price.currency),` / `,qt(e.price.offPeak.output,e.price.currency)]})]})})]}):(0,m.jsx)(`td`,{className:B.numCol,colSpan:2,children:n?(0,m.jsx)(`span`,{className:B.flatTag,children:t(`flat`)}):(0,m.jsx)(`span`,{className:B.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,m.jsxs)(`tr`,{className:B.ubExtraRow,children:[(0,m.jsxs)(`td`,{children:[(0,m.jsx)(`span`,{className:B.ubExtraName,children:Yn(t.label,Pt)}),t.note!==void 0&&(0,m.jsx)(`span`,{className:B.ubExtraNote,children:Yn(t.note,Pt)})]}),(0,m.jsx)(`td`,{className:B.numCol,children:t.input===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):qt(t.input,e.price.currency)}),(0,m.jsx)(`td`,{className:B.numCol,children:(0,m.jsx)(`span`,{className:B.na,children:`—`})}),(0,m.jsx)(`td`,{className:B.numCol,children:t.output===void 0?(0,m.jsx)(`span`,{className:B.na,children:`—`}):qt(t.output,e.price.currency)}),(0,m.jsx)(`td`,{className:B.numCol,colSpan:2,children:(0,m.jsx)(`span`,{className:B.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,m.jsxs)(`section`,{className:B.ubCard,children:[(0,m.jsx)(`div`,{className:B.ubCardHead,children:(0,m.jsx)(`h3`,{className:B.ubCardTitle,children:t(`pricingNotes`)})}),(0,m.jsxs)(`ul`,{className:B.ubNotes,children:[(0,m.jsxs)(`li`,{className:B.ubNotesItem,children:[(0,m.jsx)(`span`,{className:B.ubNotesTerm,children:t(`cacheHit`)}),(0,m.jsx)(`span`,{className:B.ubNotesDesc,children:t(`noteCache`)})]}),(0,m.jsxs)(`li`,{className:B.ubNotesItem,children:[(0,m.jsx)(`span`,{className:B.ubNotesTerm,children:t(`peakBand`)}),(0,m.jsx)(`span`,{className:B.ubNotesDesc,children:t(`noteBand`)})]}),(0,m.jsxs)(`li`,{className:B.ubNotesItem,children:[(0,m.jsx)(`span`,{className:B.ubNotesTerm,children:t(`pricingSource`)}),(0,m.jsx)(`span`,{className:B.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),v(`billing.dashboard.decor`,{position:`footer`})]}),(0,m.jsxs)(`footer`,{className:B.modalFooter,"data-testid":`billing-footer`,children:[(0,m.jsx)(`span`,{children:t(`footer`)}),(0,m.jsx)(`span`,{children:t(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]})})}function Hi(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??`—`}let Ui={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`],displayExtra:[`悬浮`,`订阅`,`计费卡`,`指标`,`环比`,`主数字`,`float`,`subscription`,`card`,`metric`,`delta`],advanced:[`自定义`,`单价`,`价格`,`低谷`,`custom`,`price`],about:[`关于`,`版本`,`作者`,`许可`,`仓库`,`about`,`version`,`author`,`license`,`repo`]};function Wi(e){return Object.values(Ui).every(t=>hi(e,t))}let Gi=[`below`,`above`,`toolbar`];function Ki({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[r,i]=(0,d.useState)(!1),a={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)},o=Gi.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=Gi.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{i(!1)},anchor:(0,m.jsxs)(`button`,{type:`button`,className:B.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(B.rdoChevron,r&&B.rdoChevronOpen),"aria-hidden":!0,children:xr?(0,m.jsx)(xr,{}):null})]})})}function qi(e){let{t,checkModels:n,publishCosts:r,registerOpen:i,navigateToSession:a,renderSlot:o,useStore:s,actions:c}=e,[l,u]=(0,d.useState)(mr),[f,p]=(0,d.useState)(gr),[h,g]=(0,d.useState)([]),[_,v]=(0,d.useState)(void 0),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)([]),[C,w]=(0,d.useState)(!1),[T,ee]=(0,d.useState)([]),[O,k]=(0,d.useState)(()=>pe()),[j,ne]=(0,d.useState)(()=>Te()),re=(0,d.useCallback)(e=>{ne(e),F(e),window.dispatchEvent(new CustomEvent(`dsh.ui-usage-billing.language-pref`))},[]),M=(0,d.useCallback)(e=>{k(e),me(e),window.dispatchEvent(new CustomEvent(fe))},[]),[ie,se]=(0,d.useState)(()=>E()),ce=(0,d.useCallback)(e=>{se(e),D(e)},[]),[de,he]=(0,d.useState)(()=>ae()),ge=(0,d.useCallback)(e=>{he(e),oe(e)},[]),[_e,ve]=(0,d.useState)(()=>N()),ye=(0,d.useCallback)(e=>{ve(e),ue(e),window.dispatchEvent(new CustomEvent(le))},[]),[be,xe]=(0,d.useState)(()=>te()),Se=(0,d.useCallback)(e=>{xe(e),A(e)},[]),[Ce,we]=(0,d.useState)(()=>{let e=Ee();return $e(e),e}),P=(0,d.useCallback)(e=>{we(e),$e(e),De(e)},[]),I=(0,d.useMemo)(()=>Qr(l),[l,Ce]),L=j,R=(0,d.useCallback)((e,n)=>{let r=(L===`en`?Ve:Be)[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},[L,t]),[Oe,ke]=(0,d.useState)(!1),Ae=(0,d.useCallback)(()=>{ke(!1)},[]),je=(0,d.useRef)(!1),Me=(0,d.useCallback)((e=!1)=>{je.current&&!e||(je.current=!0,Promise.all([wi().then(e=>{e!==null&&u(e)}),Ti().then(({balances:e,reconcile:t,stale:n})=>{e.length>0&&g(e),v(t),b(n===!0)}),Ei().then(({quotas:e,stale:t})=>{e.length>0?(S(e),w(t===!0)):w(!1)}).catch(()=>{w(!0)}),Di().then(e=>{ee(e)}).catch(()=>{})]).catch(()=>{}).finally(()=>{je.current=!1}))},[]),Ne=(0,d.useCallback)(()=>{Me(!0),Mi(),ke(!0)},[Me]);(0,d.useEffect)(()=>{Me(),Mi()},[Me]);let[Pe,Fe]=(0,d.useState)(()=>typeof document>`u`||!document.hidden);(0,d.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{Fe(!document.hidden),document.hidden||(Me(!0),Mi())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[Me]),(0,d.useEffect)(()=>{if(!Pe)return;let e=setInterval(()=>{Me(),Mi()},Oe?pr:3e5);return()=>{clearInterval(e)}},[Me,Oe,Pe]),(0,d.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(p(t),ot(t.catalog??[]))}),()=>{e=!1}},[n]);let z=q(),Ie=Object.entries(I.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),Le=I.byDay[z]?.cost??0,Re=new Date;Re.setDate(Re.getDate()-1);let B=`${Re.getFullYear()}-${String(Re.getMonth()+1).padStart(2,`0`)}-${String(Re.getDate()).padStart(2,`0`)}`,ze=I.byDay[B]?.cost??0,He=ze>0?(Le-ze)/ze*100:0,Ue=kr(I.byDay,z),We=(0,d.useMemo)(()=>Or(I.byDay).map(e=>{let t=I.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:Dr(t)}}),[I.byDay]),Ge=Object.entries(I.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+Dr(t),0),Ke=(()=>{let e=I.byDay[z];return e===void 0?0:Dr(e)})(),qe=kr(I.byDay,z,Dr),Je=s(e=>e.enabled),Ye=s(e=>e.amount),Xe=s(e=>e.tierAlertDays),Ze=s(e=>e.lastTierSwitchAt),[V,H]=(0,d.useState)(()=>cr()),[Qe,et]=(0,d.useState)(null),[tt,nt]=(0,d.useState)(null),[rt,it]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{if(!V.enabled)return;let e=setInterval(()=>it(Date.now()),pr);return()=>{clearInterval(e)}},[V.enabled]);let at=(0,d.useCallback)(e=>{H(e),lr(e)},[]),st=x.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),ct=xt(l.byTurn?.[0]?.model,st),ut=(0,d.useCallback)(()=>{nt({entering:dt(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4,channel:ct})},[ct]),U=Ye>0?Ye:l.budget??0,ft=Je&&U>0?Ie/U>=1?`over`:Ie/U>=.8?`warn`:`none`:`none`,pt=(0,d.useCallback)(()=>{let e=!Je;c.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[c,Je]);(0,d.useEffect)(()=>{if(!Je||U<=0)return;let e=Ie/U*100,t=fr.filter(t=>e>=t&&Xe?.[String(t)]!==z);if(t.length===0)return;let n=t[t.length-1]??100;if(c.markTierAlerted(t,z),!ti())return;let r=R(`budgetTierBody`).replace(`{cost}`,K(Ie)).replace(`{budget}`,K(U)).replace(`{pct}`,String(n));ni(`budget:${n}:${z}`,()=>{new Notification(R(`budget`),{body:r})})},[Je,U,Ie,Xe,z,c,R]),(0,d.useEffect)(()=>{let e=ur(rt,V,Ze,ct);if(e===null||(c.markTierSwitchAlerted(e.atMs),et(e),!V.webNotify||!ti()))return;let t=Math.max(1,Math.round((e.atMs-rt)/6e4)),n=R(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=R(e.channel===`zhipu-coding-plan`?e.entering===`peak`?`tierAlertEnterPeakZhipu`:`tierAlertEnterOffZhipu`:e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));ni(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[rt,Ze,V,ct,c,R]);let mt=s(e=>e.lastBalanceAlertDay),ht=s(e=>e.modelBudgets??Wn),gt=s(e=>e.modelTierAlertDays??Gn),_t=(0,d.useMemo)(()=>jr(I.byDayModels,z.slice(0,7)),[I.byDayModels,z]),vt=I.lowBalanceThreshold??50,yt=(0,d.useMemo)(()=>{if(h.length===0)return;let e=Sr(I.byDay,z),t=lt().rate;for(let n of h){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=vt)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[h,I.lowBalanceThreshold,I.byDay,z]);(0,d.useEffect)(()=>{if(yt===void 0||mt===z||(c.markBalanceAlerted(z),!ti()))return;let e=R(`balanceLowBody`).replace(`{name}`,yt.name).replace(`{balance}`,K(yt.cny)).replace(`{days}`,yt.days===void 0?`—`:String(yt.days));ni(`balance:${z}`,()=>{new Notification(R(`balance`),{body:e})})},[yt,mt,z,c,R]),(0,d.useEffect)(()=>{let e=[],t;for(let[n,r]of Object.entries(ht)){if(!(r>0))continue;let i=_t[n]??0;for(let a of Nr(i,r)){let o=`${n}:${a}`;gt[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||(c.markModelTierAlerted(e,z),!ti()))return;let n=R(`modelBudgetBody`).replace(`{model}`,t.model).replace(`{cost}`,K(t.cost)).replace(`{budget}`,K(t.budget)).replace(`{pct}`,String(t.tier));ni(`model-budget:${t.model}:${t.tier}:${z}`,()=>{new Notification(R(`modelBudgetTitle`),{body:n})})},[ht,_t,gt,z,c,R]);let bt=(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=Ht(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=h.find(t=>$(t.provider)===$(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=h.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`?R(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?R(`balanceUnreachable`):R(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:K(t.totalBalance),r=lt().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<vt}},a=e=>{let t=x.find(t=>t.displayName===e||zr(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:R(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?R(`subscriptionExhausted`):R(`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,h,x,z,R]),St=(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:Le,monthCost:Ie})},[Le,Ie,r]),(0,d.useEffect)(()=>i(Ne),[i,Ne]);let Ct=(0,d.useMemo)(()=>l.byTurn??[],[l.byTurn]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Li,{...e,t:R,currency:O,onOpen:Ne,monthCost:Ie,todayCost:Le,weekCost:Ue,days:We,vendorStatus:bt,dash:St,cardPrefs:be,monthTokens:Ge,todayTokens:Ke,weekTokens:qe,floatPrefs:ie,subscriptions:x,budgetPressure:ft,deltaPct:He}),Oe&&(0,m.jsx)(Vi,{stats:I,t:R,onClose:Ae,navigateToSession:a,userPrices:Ce,onUserPrices:P,health:f,balances:h,..._===void 0?{}:{reconcile:_},quotas:x,relayQuotas:T,currency:O,onCurrency:M,language:j,onLanguage:re,turns:Ct,renderSlot:o,budgetEnabled:Je,budgetAmount:U,modelBudgets:ht,monthModelCost:_t,onModelBudget:c.setModelBudget,onToggleBudget:pt,onBudgetAmount:c.setAmount,peakConfig:V,onPeakConfig:at,onPreviewPeak:ut,floatPrefs:ie,onFloatPrefs:ce,cardPrefs:be,onCardPrefs:Se,sitePrefs:de,onSitePrefs:ge,liveCostPrefs:_e,onLiveCostPrefs:ye,quotasStale:C,balanceStale:y}),(Qe!==null||tt!==null)&&(0,m.jsx)(dr,{hit:Qe??tt,config:V,t:R,onDismiss:()=>{et(null),nt(null)}})]})}function Ji(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 Yi(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.subCost??0}function Xi(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 Zi(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 Qi(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 $i(){try{let e=await $r(`/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 ea(){try{let e=await $r(`/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 ta(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function na(e){return!e.running&&!e.promptAttempted&&(e.blank||e.awaitingFirstTurn)}function ra({hasBandPlan:e}){let[t,n]=(0,d.useState)(()=>_e()),[r,i]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=()=>{n(_e())};window.addEventListener(ge,e),window.addEventListener(`storage`,e);let t=setInterval(()=>{i(Date.now())},3e4);return()=>{window.removeEventListener(ge,e),window.removeEventListener(`storage`,e),clearInterval(t)}},[]),t.length===0)return null;let a=cr().leadMin*6e4,o=t.map(t=>({key:t,state:qn(St(r,xt(t,e)),a)})).filter(e=>e.state!==null);return o.length===0?null:(0,m.jsx)(`span`,{className:B.bandDots,"data-testid":`billing-pinned-dots`,children:o.map(e=>(0,m.jsx)(`span`,{className:y(B.bandDot,B.bandDotOn,B[e.state]),role:`img`,"aria-label":e.key,title:e.key},e.key))})}function ia(){let[e,t]=(0,d.useState)(()=>pe());return(0,d.useEffect)(()=>{let e=()=>{t(pe())};return window.addEventListener(fe,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(fe,e),window.removeEventListener(`storage`,e)}},[]),e}function aa(){let[e,t]=(0,d.useState)(()=>N().show),[n,r]=(0,d.useState)(()=>N().position);return(0,d.useEffect)(()=>{let e=()=>{t(N().show),r(N().position)};return window.addEventListener(le,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(le,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function oa(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([$i(),ea()]).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)(()=>Ji(n,e),[n,e]),f=(0,d.useMemo)(()=>Yi(n,e),[n,e]),p=(0,d.useMemo)(()=>Xi(n,e),[n,e]),m=(0,d.useMemo)(()=>Zi(i),[i]),h=(0,d.useMemo)(()=>xt(Qi(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)(()=>St(o,h),[o,h]),chips:m,hasBandPlan:i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)}}function sa({sessionId:e,t,seat:n,session:r,useProjection:i}){let{visible:a,position:o}=aa(),s=i?.(`contextPressure`),c=i?.(`contextBreakdown`);(0,d.useEffect)(()=>{ui.publish({...s?.projectedTokens===void 0?{}:{projectedTokens:s.projectedTokens},...s?.pressureTokens===void 0?{}:{pressureTokens:s.pressureTokens},...s?.contextWindow===void 0?{}:{contextWindow:s.contextWindow},...c?.systemTokens===void 0?{}:{systemTokens:c.systemTokens},...c?.toolsTokens===void 0?{}:{toolsTokens:c.toolsTokens},...c?.messageTokens===void 0?{}:{messageTokens:c.messageTokens}})},[s,c]);let l=a&&o===n&&!(n===`above`&&r!==void 0&&na(r)),{sessionCost:u,subCost:f,turnCost:p,tier:h,chips:g,hasBandPlan:_}=oa(e,l),v=ia(),b=e=>K(Xt(e,v),v),x=u>0||p>0,S=h?.tier===`peak`;return l?(0,m.jsxs)(`span`,{className:n===`above`?y(B.feeBar,B.feeBarAbove):B.feeBar,"data-testid":`billing-live-cost-bar`,"data-seat":n,children:[(0,m.jsx)(ra,{hasBandPlan:_}),h!==null&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:S?B.feeChipPrimary:B.feeChipOff,"data-testid":`billing-live-tier`,children:t(S?`tierPeak`:`tierOff`)}),(0,m.jsx)(`span`,{className:B.feeCount,children:wt(h.nextSwitchInMs)}),(0,m.jsx)(`span`,{className:B.feeSuffix,children:t(S?`tierToOff`:`tierToPeak`)})]}),x&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:B.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:B.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,m.jsx)(`span`,{className:B.feeNum,"data-tick":`turn`,children:b(p)})]}),(0,m.jsx)(`span`,{className:B.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:B.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,m.jsx)(`span`,{className:B.feeNum,"data-tick":`session`,children:b(u)}),f>0&&(0,m.jsx)(`span`,{className:B.feeSuffix,"data-testid":`billing-live-session-sub`,children:t(`liveSessionSub`).replace(`{cost}`,b(f))})]})]}),g.map(e=>(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`span`,{className:B.feeSep,"aria-hidden":`true`,children:`·`}),(0,m.jsxs)(`span`,{className:e.pct<=10?B.feeChipError:B.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(ta(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]}):null}function ca({sessionId:e,t}){let n=ia(),r=e=>K(Xt(e,n),n),{visible:i,position:a}=aa(),{sessionCost:o,subCost:s,turnCost:c,tier:l,chips:u,hasBandPlan:d}=oa(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?B.feeInlineError:h<=20?B.feeInlineAlert:void 0,_=y(B.feeInline,g),v=[...l===null?[]:[`${wt(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(ta(e.kind))} ${e.pct}%`)].join(` · `);return(0,m.jsx)(p.Tooltip,{label:v,side:`top`,delayMs:500,children:(0,m.jsxs)(`span`,{className:_,"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":v,children:[(0,m.jsx)(ra,{hasBandPlan:d}),l!==null&&(0,m.jsx)(`span`,{className:f?B.feeChipPrimary:B.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),o>0&&(0,m.jsx)(`span`,{className:B.feeInlineNum,children:r(o)})]})})}function la(){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 ua={enabled:!1,timeout:0};function da(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...ua};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...ua}}}function fa(e){return e.completed===!0||e.running===!1}function pa(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)),fa(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=fa(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 ma(e){let t=e.get(`uiWorkspace`);if(t!==void 0&&typeof t.openSession==`function`)return t}function ha(e){let t=e.sessions,n=t?.open;return typeof n==`function`?n.bind(t):void 0}function ga(e){return{available:()=>ma(e)!==void 0||ha(e)!==void 0,open:t=>{let n=_(t),r=ma(e);if(r!==void 0)try{return r.openSession(n),`opened`}catch(e){return x(`session-navigation-open-failed`,e),`failed`}let i=ha(e);if(i!==void 0)try{return i(n),`opened`}catch(e){return x(`session-navigation-legacy-open-failed`,e),`failed`}return`unavailable`}}}function _a(e,t){let n=e.get(`commandUi`);if(n===void 0||typeof n.register!=`function`)return!1;let r={name:`usage`,label:t.label,description:t.description,available:()=>!0,ui:{kind:`action`,run:()=>{t.openDashboard()}}};try{n.register(r)}catch(e){return x(`usage-command-register-failed`,e),!1}return!0}let va=[`slots`,`locale`,`remote`,`sessions`];function ya(e){let t=la();e.provide(`billingMetrics`,t);let n=Kn();e.effect(()=>e.locale.register(ze,{zh:Be,en:Ve}),`ui-usage-billing: dictionaries`);let r=ga(e);_a(e,{openDashboard:()=>{t.openDashboard()},label:()=>Te()===`en`?Ve.commandUsageLabel:Be.commandUsageLabel,description:()=>Te()===`en`?Ve.commandUsageDescription:Be.commandUsageDescription}),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:ze,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}},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),navigateToSession:e=>r.open(e)})},qi)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:ze,inject:e=>({sessionId:_(e),seat:`below`})},sa)),e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`usage-billing-cost-above`,order:100,locale:ze,inject:e=>({sessionId:_(e),seat:`above`})},sa)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:ze,inject:e=>({sessionId:_(e)})},ca)),e.effect(()=>pa(e.sessions.list,da),`ui-usage-billing: completion notifier`)}return n.UsageBilling=qi,n.apply=ya,n.inject=va,t.exports}});
|
|
6
6
|
//# sourceMappingURL=client.js.map
|