@kenz1117/dsh-ui-usage-billing 1.2.2 → 1.2.4
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/lib/client.js +5 -5
- package/lib/index.js +2 -1
- package/lib/types/client/pricing.d.ts +8 -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`});let r=e("react"),i=e("react-dom"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react/jsx-runtime"),s=e("@deepseek-ai/dsh-client-store");function c(e){return e}function l(e){return c(e)}function u(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=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}let f={mode:`combined`,targets:[]},p=`dsh.ui-usage-billing.float`;function m(){try{let e=localStorage.getItem(p);if(e===null)return{...f,targets:[...f.targets]};let t=JSON.parse(e);return{mode:t.mode===`subscription`?`subscription`:`combined`,targets:Array.isArray(t.targets)?t.targets.filter(e=>typeof e==`string`):[]}}catch{return{...f,targets:[...f.targets]}}}function h(e){try{localStorage.setItem(p,JSON.stringify(e))}catch{}}let g={metric:`money`},_=`dsh.ui-usage-billing.card`;function v(){try{let e=localStorage.getItem(_);return e===null?{...g}:{metric:JSON.parse(e).metric===`tokens`?`tokens`:`money`}}catch{return{...g}}}function y(e){try{localStorage.setItem(_,JSON.stringify(e))}catch{}}let b={hideUnidentified:!0},ee=`dsh.ui-usage-billing.sites`;function x(){try{let e=localStorage.getItem(ee);return e===null?{...b}:{hideUnidentified:JSON.parse(e).hideUnidentified!==!1}}catch{return{...b}}}function S(e){try{localStorage.setItem(ee,JSON.stringify(e))}catch{}}let C={show:!0,position:`below`},w=`dsh.ui-usage-billing.livecost`,T=`dsh.ui-usage-billing.livecost-pref`;function E(){try{let e=localStorage.getItem(w);if(e===null)return{...C};let t=JSON.parse(e);return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`?t.position:`below`}}catch{return{...C}}}function D(e){try{localStorage.setItem(w,JSON.stringify(e))}catch{}}let O=`dsh.ui-usage-billing.prices`;function k(){try{let e=localStorage.getItem(O);if(e===null)return[];let t=JSON.parse(e);if(t===null)return[];let n=[],r=(e,t)=>{if(typeof t!=`object`||!t)return;let r=t,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})}n.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(t))for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.key==`string`&&t.key!==``&&r(t.key,e)}else if(typeof t==`object`)for(let[e,n]of Object.entries(t))r(e,n);return n}catch{return[]}}function A(e){try{localStorage.setItem(O,JSON.stringify(e))}catch{}}let j={metric:`ttft`},M=`dsh.ui-usage-billing.perf`;function N(){try{let e=localStorage.getItem(M);if(e===null)return{...j};let t=JSON.parse(e);return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}catch{return{...j}}}function te(e){try{localStorage.setItem(M,JSON.stringify(e))}catch{}}let P=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(P)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=P,e.textContent=`.KFXqYa_railButton{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);width:36px;height:36px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;transition:border-color .16s,color .16s;display:flex}.KFXqYa_railButton:hover,.KFXqYa_railButton:focus-visible{border-color:var(--dsw-static-blue-500);color:var(--dsw-static-blue-500);outline:none}.KFXqYa_railButton svg{stroke-width:2px;width:18px;height:18px}.KFXqYa_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);width:100%;min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;border-radius:14px;align-items:center;gap:10px;padding:9px 12px;transition:border-color .16s,transform .16s,box-shadow .16s;display:flex;position:relative;overflow:hidden;box-shadow:0 1px 2px #0000000a}.KFXqYa_trigger:hover,.KFXqYa_trigger:focus-visible{border-color:var(--dsw-static-blue-500);box-shadow:0 6px 18px -8px color-mix(in srgb, var(--dsw-static-blue-500) 45%, transparent);outline:none;transform:translateY(-1px)}.KFXqYa_triggerIcon{border:1px solid var(--dsw-alias-border-l1);width:32px;height:32px;color:var(--dsw-alias-label-secondary);opacity:.8;border-radius:8px;flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_triggerIcon svg{stroke-width:2px;width:16px;height:16px}.KFXqYa_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.KFXqYa_triggerPrimary{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.KFXqYa_triggerLabel{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.KFXqYa_triggerYen{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.KFXqYa_triggerMetric{color:var(--dsw-alias-label-primary);letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:20px;font-weight:700;line-height:24px;overflow:hidden}.KFXqYa_triggerSub{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;font-size:10px;line-height:14px;overflow:hidden}.KFXqYa_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.KFXqYa_triggerSparkBar,.KFXqYa_triggerSparkHot{background:var(--dsw-static-blue-500);opacity:.6;border-radius:1px 1px 0 0;width:3px}.KFXqYa_triggerSparkHot{opacity:1}.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<=200px){.KFXqYa_trigger{gap:6px;padding:8px 10px}.KFXqYa_triggerSpark{display:none}}@container KFXqYa_billing-trigger (width<=170px){.KFXqYa_triggerSub,.KFXqYa_triggerLabel{display:none}}@container KFXqYa_billing-trigger (width<=110px){.KFXqYa_triggerIcon,.KFXqYa_triggerSpark,.KFXqYa_triggerSub,.KFXqYa_triggerLabel{display:none}.KFXqYa_trigger{justify-content:center;padding:8px 6px}}.KFXqYa_triggerPop{box-sizing:border-box;border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 80%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 72%, transparent);-webkit-backdrop-filter:blur(14px)saturate(1.3);box-shadow:0 12px 32px #00000029, inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);opacity:0;visibility:hidden;pointer-events:none;z-index:2000;border-radius:14px;flex-direction:column;gap:5px;padding:10px 12px;transition:opacity .16s,transform .16s,visibility 0s linear .16s;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 0%, var(--dsw-static-amber-500) 30%, var(--dsw-alias-label-primary) 50%, var(--dsw-static-amber-500) 70%, transparent 100%);opacity:.9;pointer-events:none;background-size:200% 100%;height:1.5px;animation:4s ease-in-out infinite KFXqYa_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}.KFXqYa_triggerPopShown{opacity:1;visibility:visible;transition:opacity .16s,transform .16s,visibility linear;transform:translateY(-100%)}.KFXqYa_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.KFXqYa_popTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:700;line-height:18px}.KFXqYa_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 8px;display:grid}.KFXqYa_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_metricLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.KFXqYa_metricValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:12px;font-weight:700;line-height:16px}.KFXqYa_metricValuePrimary{color:var(--dsw-static-amber-500)}.KFXqYa_metricValueSuccess{color:var(--dsw-static-green-500)}.KFXqYa_popModel{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding-top:10px;display:flex}.KFXqYa_popModelLabel{color:var(--dsw-alias-label-tertiary);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(--dsw-static-green-500)}.KFXqYa_popDotSub{background:var(--dsw-static-amber-500)}.KFXqYa_popDotNeutral{background:var(--dsw-alias-label-tertiary)}.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(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.KFXqYa_popTagSub{background:color-mix(in srgb, var(--dsw-static-amber-500) 18%, transparent);color:var(--dsw-static-amber-500)}.KFXqYa_popModelName{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.KFXqYa_popModelStatus{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;margin-left:auto;font-size:11px;font-weight:600;line-height:16px}.KFXqYa_popModelStatusLow{color:var(--dsw-static-red-500)}.KFXqYa_dashboardModal{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:14px;width:min(760px,100vw - 48px);max-height:min(760px,88vh);animation:.18s ease-out KFXqYa_dashboardIn;box-shadow:0 12px 32px -12px #0000002e,0 2px 8px #0000000f}@keyframes KFXqYa_dashboardIn{0%{opacity:0;transform:translateY(8px)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%;max-height:min(760px,88vh);display:flex}.KFXqYa_dashboardHead{border-bottom:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.KFXqYa_dashboardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.KFXqYa_dashboardSubtitle{color:var(--dsw-alias-label-caption);margin:2px 0 0;font-size:11px;line-height:16px}.KFXqYa_closeButton{border:1px solid var(--dsw-alias-border-l1);width:32px;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:8px;flex:none;justify-content:center;align-items:center;transition:background-color .14s,color .14s;display:inline-flex}.KFXqYa_closeButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.KFXqYa_closeButton svg{stroke-width:2px;width:16px;height:16px}.KFXqYa_dashboardBody{flex-direction:column;gap:14px;padding:16px 24px 24px;display:flex;overflow-y:auto}.KFXqYa_modalFooter{border-top:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 18px;font-size:11px;line-height:16px;display:flex}.KFXqYa_tabNav{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;align-items:center;gap:4px;margin:14px 24px 0;padding:4px;display:flex}.KFXqYa_tabButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:7px;padding:6px 14px;font-size:13px;font-weight:500;line-height:20px;transition:background-color .16s,color .16s}.KFXqYa_tabButton:hover,.KFXqYa_tabButton:focus-visible{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 62%, transparent);outline:none}.KFXqYa_tabButtonActive,.KFXqYa_tabButtonActive:hover,.KFXqYa_tabButtonActive:focus-visible{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font-weight:600;box-shadow:0 1px 3px #0000001f}.KFXqYa_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out KFXqYa_tabPanelIn;display:flex}@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(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;flex-direction:column;gap:12px;padding:14px 16px;display:flex;position:relative;overflow:hidden}.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(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:14px}.KFXqYa_heroReadout{align-items:baseline;gap:4px;display:flex}.KFXqYa_heroCurrency{letter-spacing:-.01em;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:15px;font-weight:600;line-height:20px}.KFXqYa_heroValue{letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:28px;font-weight:650;line-height:34px}.KFXqYa_heroMeta{color:var(--dsw-alias-label-caption);white-space:nowrap;margin-top:2px;font-size:11px;line-height:15px}.KFXqYa_heroGauge{flex:none;width:72px;height:72px;position:relative}.KFXqYa_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.KFXqYa_heroGaugeTrack{fill:none;stroke:var(--dsw-alias-bg-module-platform);stroke-width:7px}.KFXqYa_heroGaugeArc{fill:none;stroke:var(--dsw-static-blue-500);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray .26s}.KFXqYa_heroGaugeArcOver{stroke:var(--dsw-static-red-500)}.KFXqYa_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.KFXqYa_heroGaugePct{letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:700;line-height:18px}.KFXqYa_heroGaugePctOver{color:var(--dsw-static-red-500)}.KFXqYa_heroGaugeLabel{color:var(--dsw-alias-label-tertiary);font-size:9px;line-height:12px}.KFXqYa_heroBudget{border-top:1px solid var(--dsw-alias-border-l1);align-items:center;gap:14px;padding-top:14px;display:flex}.KFXqYa_heroBudgetLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px;line-height:16px}.KFXqYa_heroBudgetTrack{background:var(--dsw-alias-border-l1);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.KFXqYa_heroBudgetFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .22s}.KFXqYa_heroBudgetFillOver{background:var(--dsw-static-red-500)}.KFXqYa_heroBudgetValue{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:11px;line-height:16px}.KFXqYa_heroSide{border-top:1px solid var(--dsw-alias-border-l1);align-items:stretch;padding-top:12px;display:flex}.KFXqYa_heroSideItem{border-left:1px solid var(--dsw-alias-border-l1);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(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:13px}.KFXqYa_heroSideValue{color:var(--dsw-alias-label-primary);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(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 12%, transparent)}.KFXqYa_deltaDown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 12%, transparent)}.KFXqYa_unpricedHint{border:1px solid color-mix(in srgb, var(--dsw-static-amber-500) 30%, transparent);background:color-mix(in srgb, var(--dsw-static-amber-500) 8%, transparent);color:var(--dsw-static-amber-500);border-radius:8px;align-items:center;padding:8px 12px;font-size:11.5px;font-weight:500;line-height:17px;display:flex}.KFXqYa_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;display:grid}.KFXqYa_kpiTile{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;flex-direction:column;gap:2px;padding:10px 12px;transition:border-color .16s;display:flex;position:relative;overflow:hidden}.KFXqYa_kpiTile:hover{border-color:var(--dsw-alias-border-l2)}.KFXqYa_kpiLabel{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;font-size:10px;font-weight:500;line-height:13px}.KFXqYa_kpiValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;letter-spacing:-.01em;font-size:16px;font-weight:650;line-height:22px}.KFXqYa_kpiGreen{color:var(--dsw-static-green-500)}.KFXqYa_kpiDetail{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;font-size:10.5px;line-height:14px;overflow:hidden}.KFXqYa_panel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;flex-direction:column;gap:8px;padding:12px 14px;transition:border-color .16s;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(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.KFXqYa_panelHint{color:var(--dsw-alias-label-caption);white-space:nowrap;font-size:11px;line-height:16px}.KFXqYa_rangeToggle{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:8px;gap:2px;padding:2px;display:inline-flex}.KFXqYa_rangeButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:11px;line-height:16px;transition:background-color .14s,color .14s}.KFXqYa_rangeButtonActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font-weight:600}.KFXqYa_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_exportLabel{color:var(--dsw-alias-label-caption);font-size:11px;line-height:16px}.KFXqYa_exportButton{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:999px;padding:4px 12px;font-size:11.5px;line-height:16px;transition:border-color .16s,color .16s,background-color .16s}.KFXqYa_exportButton:hover,.KFXqYa_exportButton:focus-visible{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);outline:none}.KFXqYa_shareTrack{background:var(--dsw-alias-bg-module-platform);border-radius:999px;height:10px;display:flex;overflow:hidden}.KFXqYa_shareSeg{height:100%;transition:width .2s}.KFXqYa_shareSegPeak{background:var(--dsw-static-blue-500)}.KFXqYa_shareSegOff{background:color-mix(in srgb, var(--dsw-static-blue-500) 25%, var(--dsw-alias-bg-module-platform))}.KFXqYa_shareSegUser{background:var(--dsw-static-blue-500)}.KFXqYa_shareSegAssistant{background:var(--dsw-static-green-500)}.KFXqYa_shareSegTool{background:var(--dsw-static-amber-500)}.KFXqYa_shareLegend{align-items:center;gap:16px;display:flex}.KFXqYa_shareItem{color:var(--dsw-alias-label-secondary);align-items:baseline;gap:6px;font-size:12px;line-height:17px;display:inline-flex}.KFXqYa_bucketCost{align-items:baseline;gap:3px;display:inline-flex}.KFXqYa_bucketOfficial{color:var(--dsw-static-blue-500);font-weight:600}.KFXqYa_bucketSep{color:var(--dsw-alias-label-dimmed)}.KFXqYa_bucketThird{color:var(--dsw-alias-label-secondary)}.KFXqYa_shareDot{border-radius:50%;flex:none;align-self:center;width:8px;height:8px}.KFXqYa_shareValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_budgetInput{width:64px;color:var(--dsw-alias-label-primary);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(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);cursor:pointer;border-radius:999px;flex:none;width:30px;height:17px;padding:0;transition:background-color .16s,border-color .16s;position:relative}.KFXqYa_switchOn{border-color:var(--dsw-alias-border-l1);background:var(--dsw-alias-label-primary)}.KFXqYa_switchKnob{background:var(--dsw-static-neutral-bluish-00);border-radius:50%;width:11px;height:11px;transition:transform .16s;position:absolute;top:2px;left:2px}.KFXqYa_switchOn .KFXqYa_switchKnob{transform:translate(13px)}.KFXqYa_budgetFillWarn{background:var(--dsw-static-amber-500)}.KFXqYa_budgetFillOver{background:var(--dsw-static-red-500);animation:1.6s ease-in-out infinite KFXqYa_budgetOverPulse}@keyframes KFXqYa_budgetOverPulse{50%{opacity:.55}}.KFXqYa_chartWrap{width:100%;position:relative}.KFXqYa_chartSvg{width:100%;height:auto;display:block}.KFXqYa_chartEmpty{height:140px;color:var(--dsw-alias-label-caption);justify-content:center;align-items:center;font-size:13px;display:flex}.KFXqYa_emptyRow{text-align:center;color:var(--dsw-alias-label-caption);padding:28px 0;font-size:13px}.KFXqYa_chartGrid{stroke:var(--dsw-alias-border-l1);stroke-width:1px}.KFXqYa_chartAxisLabel{fill:var(--dsw-alias-label-tertiary);font-size:10px}.KFXqYa_chartBar{fill:var(--dsw-static-blue-500);opacity:.7}.KFXqYa_chartBar:hover{opacity:1}.KFXqYa_chartStack{stroke:var(--dsw-alias-bg-layer-1);stroke-width:.75px}.KFXqYa_chartStack:hover{opacity:.9}.KFXqYa_chartLine{stroke:var(--dsw-static-blue-500);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.KFXqYa_chartCrosshair{stroke:var(--dsw-alias-label-dimmed);stroke-width:1px;stroke-dasharray:3 3}.KFXqYa_chartTooltip{pointer-events:none;z-index:2;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);box-shadow:none;white-space:nowrap;border-radius:8px;padding:8px 10px;position:absolute;transform:translate(-50%,calc(-100% - 10px))}.KFXqYa_chartTooltipDate{color:var(--dsw-alias-label-primary);margin-bottom:3px;font-size:11px;font-weight:600}.KFXqYa_chartTooltipRow{color:var(--dsw-alias-label-secondary);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.KFXqYa_chartTooltipRow strong{color:var(--dsw-alias-label-primary);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(--dsw-alias-label-primary);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(--dsw-alias-label-caption);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(--dsw-alias-label-secondary) 30%, transparent)}.KFXqYa_chartLegendLine{background:var(--dsw-static-blue-500);border-radius:2px;width:10px;height:3px;display:inline-block}.KFXqYa_chartLegendBar{background:var(--dsw-static-blue-500);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.KFXqYa_chartTooltipSwatch{border-radius:3px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartLegend{color:var(--dsw-alias-label-tertiary);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(--dsw-alias-label-secondary)}.KFXqYa_chartLegendItemActive{color:var(--dsw-alias-label-primary);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(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:999px;align-items:center;gap:5px;padding:2px 9px;font-size:11px;line-height:16px;transition:border-color .12s,color .12s,opacity .12s;display:inline-flex}.KFXqYa_perfChip:hover{color:var(--dsw-alias-label-primary)}.KFXqYa_perfChipOff{opacity:.45}.KFXqYa_perfChipDot{border-radius:3px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartHoverDot{stroke:var(--dsw-alias-bg-layer-2);stroke-width:1.5px}.KFXqYa_tableScroll{border:1px solid var(--dsw-alias-border-l1);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px;overflow:auto}.KFXqYa_ubAlert{border:1px solid color-mix(in srgb, var(--dsw-static-blue-500) 30%, transparent);background:color-mix(in srgb, var(--dsw-static-blue-500) 8%, transparent);border-radius:10px;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(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_ubAlertNote{color:var(--dsw-alias-label-secondary);margin:0}.KFXqYa_ubTag,.KFXqYa_ubTagSuccess,.KFXqYa_ubTagNeutral,.KFXqYa_ubTagAlert,.KFXqYa_ubTagPromo{white-space:nowrap;border-radius:999px;align-items:center;height:18px;padding:0 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_ubTagSuccess{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.KFXqYa_ubTagNeutral{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.KFXqYa_ubTagAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.KFXqYa_ubTagPromo{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500);cursor:help}.KFXqYa_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.KFXqYa_ubExtraName{color:var(--dsw-alias-label-secondary);margin-left:26px}.KFXqYa_ubExtraNote{color:var(--dsw-alias-label-tertiary);margin-left:8px;font-size:10px}.KFXqYa_ubCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;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(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_ubCardSub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.KFXqYa_ubTablewrap{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;overflow:auto}.KFXqYa_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12.5px}.KFXqYa_ubTable th,.KFXqYa_ubTable td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;padding:9px 12px}.KFXqYa_ubTable tbody tr:last-child td{border-bottom:0}.KFXqYa_ubTable thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;font-size:11px;font-weight:600}.KFXqYa_ubModel{align-items:center;gap:8px;display:inline-flex}.KFXqYa_vendorLogo{object-fit:contain;border-radius:4px;flex:none;width:18px;height:18px}.KFXqYa_vendorLetter{color:#fff;border-radius:4px;flex:none;justify-content:center;align-items:center;width:18px;height:18px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.KFXqYa_ubModelName{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-weight:500;display:inline-flex}.KFXqYa_ubPricepair{flex-wrap:wrap;gap:6px;display:inline-flex}.KFXqYa_ubChipPeak,.KFXqYa_ubChipOff{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:5px;height:20px;padding:0 8px;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(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.KFXqYa_ubChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.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(--dsw-alias-label-primary);flex:0 0 72px;font-size:12px;font-weight:500}.KFXqYa_ubNotesDesc{min-width:0;color:var(--dsw-alias-label-secondary);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(--dsw-static-red-500) 14%, transparent);height:18px;color:var(--dsw-static-red-500);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:12.5px}.KFXqYa_modelTable th:first-child{width:26%}.KFXqYa_modelTable th,.KFXqYa_modelTable td th td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;white-space:nowrap;padding:7px 10px}.KFXqYa_modelTable tbody tr:last-child td tbody tr:last-child td{border-bottom:0}.KFXqYa_sessionGroupRow{cursor:pointer}.KFXqYa_sessionGroupRow .KFXqYa_modelName:before{content:"›";color:var(--dsw-alias-label-tertiary);margin-right:6px;display:inline-block}.KFXqYa_sessionGroupRow[aria-expanded=true] .KFXqYa_modelName:before{transform:rotate(90deg)}.KFXqYa_sessionChildRow td:first-child{padding-left:30px}.KFXqYa_modelTable thead th thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;background:0 0;font-size:11px;font-weight:600}.KFXqYa_modelTable tbody tr tbody tr{transition:background-color .12s}.KFXqYa_modelTable tbody tr:hover 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:var(--dsw-alias-interactive-bg-hover)}.KFXqYa_numCol{text-align:right;font-variant-numeric:tabular-nums}.KFXqYa_na{color:var(--dsw-alias-label-dimmed)}.KFXqYa_modelCell{align-items:center;gap:8px;display:inline-flex}.KFXqYa_modelDot{border-radius:50%;flex:none;width:9px;height:9px}.KFXqYa_modelName{color:var(--dsw-alias-label-primary);font-weight:500;line-height:16px;display:block}.KFXqYa_modelProvider{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px;display:block}.KFXqYa_siteRow{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;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-radius:999px;flex:none;align-items:center;padding:1px 7px;font-size:10.5px;font-weight:600;line-height:16px;display:inline-flex}.KFXqYa_siteKindSite{color:var(--dsw-static-blue-500);background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent)}.KFXqYa_siteKindDirect{color:var(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent)}.KFXqYa_siteKindUnknown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent)}.KFXqYa_siteRowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:600;line-height:18px;overflow:hidden}.KFXqYa_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_siteRowCost{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:700;line-height:18px}.KFXqYa_siteRowCalls{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.KFXqYa_siteRowCallsLow{color:var(--dsw-static-red-500)}.KFXqYa_flatTag{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px}.KFXqYa_healthDot{border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_healthOk{background:var(--dsw-static-green-500)}.KFXqYa_healthBad{background:var(--dsw-static-red-500)}.KFXqYa_healthIdle{background:var(--dsw-static-neutral-bluish-400)}.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(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_healthBadgeBad{color:var(--dsw-static-red-500);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_planTag{color:var(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2);border-radius:999px;align-items:center;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px;display:inline-flex}.KFXqYa_uncataloguedTag{vertical-align:1px;color:var(--dsw-static-amber-500);background:var(--dsw-alias-bg-layer-2);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.KFXqYa_estimatedTag{vertical-align:1px;color:var(--dsw-static-blue-500);background:var(--dsw-alias-bg-layer-2);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(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;border-radius:999px;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_feeBarAbove{order:-1;align-self:center;margin-bottom:8px}.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(--dsw-alias-label-primary);padding-right:6px;font-weight:600}.KFXqYa_feeInlineAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 12%, transparent)}.KFXqYa_feeInlineAlert .KFXqYa_feeInlineNum{color:var(--dsw-static-amber-500)}.KFXqYa_feeInlineError{background:color-mix(in srgb, var(--dsw-static-red-500) 12%, transparent)}.KFXqYa_feeInlineError .KFXqYa_feeInlineNum{color:var(--dsw-static-red-500)}.KFXqYa_feeBar .KFXqYa_feeSep{color:var(--dsw-alias-label-dimmed)}.KFXqYa_feeCount{color:var(--dsw-alias-label-primary);font-weight:600}.KFXqYa_feeSuffix{color:var(--dsw-alias-label-tertiary)}.KFXqYa_feeItem{color:var(--dsw-alias-label-secondary);white-space:nowrap}.KFXqYa_feeNum{color:var(--dsw-alias-label-primary);font-weight:600}.KFXqYa_feeSep{color:var(--dsw-alias-label-tertiary)}.KFXqYa_feeChipPrimary,.KFXqYa_feeChipOff,.KFXqYa_feeChipAlert,.KFXqYa_feeChipError{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{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.KFXqYa_feeChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.KFXqYa_feeChipAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.KFXqYa_feeChipError{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500)}.KFXqYa_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.KFXqYa_balanceDaysBadge{border:1px solid var(--dsw-alias-label-caption);background:color-mix(in srgb, var(--dsw-alias-label-caption) 10%, transparent);min-width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:12px;justify-content:center;align-items:center;padding:0 6px;font-size:10.5px;font-weight:600;line-height:1;display:inline-flex}.KFXqYa_balanceDaysBadge:hover{border-color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-caption) 18%, transparent)}.KFXqYa_balanceDaysBadgeLow{color:var(--dsw-static-red-500);border-color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 10%, transparent)}.KFXqYa_balanceDetailPop{z-index:20;background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-label-caption);white-space:nowrap;border-radius:8px;flex-direction:column;gap:6px;min-width:180px;padding:8px 10px;display:inline-flex;position:absolute;top:calc(100% + 6px);right:0;box-shadow:0 6px 20px #0000002e}.KFXqYa_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.KFXqYa_balanceDetailTitle{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600}.KFXqYa_balanceDetailClose{cursor:pointer;color:var(--dsw-alias-label-caption);background:0 0;border:none;font-size:14px;line-height:1}.KFXqYa_balanceDetailClose:hover{color:var(--dsw-alias-label-primary)}.KFXqYa_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.KFXqYa_balanceDetailRow{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;justify-content:space-between;gap:16px;font-size:11px;line-height:15px;display:flex}.KFXqYa_balanceDetailLabel{color:var(--dsw-alias-label-caption)}.KFXqYa_balanceDetailValue{color:var(--dsw-alias-label-primary);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(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.KFXqYa_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.KFXqYa_subscriptionCard{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) 62%, transparent);-webkit-backdrop-filter:blur(12px)saturate(1.3);border-radius:12px;padding:12px 14px;transition:border-color .2s,box-shadow .2s;position:relative;overflow:hidden;box-shadow:0 8px 24px #0000001a}.KFXqYa_subscriptionCard:before{content:"";background:linear-gradient(90deg, transparent 0%, var(--dsw-static-amber-500) 30%, var(--dsw-alias-label-primary) 50%, var(--dsw-static-amber-500) 70%, transparent 100%);opacity:.9;pointer-events:none;background-size:200% 100%;height:1.5px;animation:3.6s ease-in-out infinite KFXqYa_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}@keyframes KFXqYa_subscriptionGoldFlow{0%{background-position:200% 0}to{background-position:-200% 0}}.KFXqYa_subscriptionCard:hover{border-color:color-mix(in srgb, var(--dsw-static-amber-500) 55%, var(--dsw-alias-border-l1));box-shadow:0 10px 30px #00000029}.KFXqYa_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.KFXqYa_subscriptionName{font-size:13px;font-weight:700}.KFXqYa_subscriptionPlan{color:var(--dsw-alias-label-secondary);font-size:11px}.KFXqYa_subscriptionPlan[data-kind=code],.KFXqYa_subscriptionPlan[data-kind=token]{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);border-radius:999px;padding:1px 8px;font-weight:500}.KFXqYa_subscriptionTier{color:var(--dsw-alias-label-secondary);margin-left:6px}.KFXqYa_subscriptionAuto{color:var(--dsw-static-blue-500);background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, var(--dsw-alias-bg-layer-2));border-radius:999px;margin-left:6px;padding:1px 6px;font-size:10px}.KFXqYa_subscriptionStatus{color:var(--dsw-alias-label-secondary);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(--dsw-alias-label-secondary);flex:0 0 44px}.KFXqYa_subscriptionTrack{background:var(--dsw-alias-bg-layer-3);border-radius:3px;flex:1;height:6px;overflow:hidden}.KFXqYa_subscriptionFill{background:var(--dsw-static-blue-500);border-radius:3px;height:100%;transition:width .2s;display:block}.KFXqYa_subscriptionFillWarn{background:var(--dsw-static-amber-500)}.KFXqYa_subscriptionFillOver{background:var(--dsw-static-red-500)}.KFXqYa_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.KFXqYa_subscriptionPct{text-align:right;font-variant-numeric:tabular-nums;flex:none;min-width:52px}.KFXqYa_subscriptionExhausted{color:var(--dsw-static-red-500);min-width:52px;font-weight:600}.KFXqYa_subscriptionReset{color:var(--dsw-alias-label-caption);white-space:nowrap;flex:none;font-size:10px}.KFXqYa_providerGroupList{flex-direction:column;gap:10px;display:flex}.KFXqYa_providerGroup{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:12px;padding:12px 14px}.KFXqYa_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.KFXqYa_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.KFXqYa_providerGroupName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:18px}.KFXqYa_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_providerGroupBadge{color:var(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2);border-radius:999px;justify-content:center;align-items:center;min-width:64px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px;display:inline-flex}.KFXqYa_providerGroupBalance,.KFXqYa_providerGroupCost{color:var(--dsw-alias-label-secondary);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(--dsw-alias-label-primary);text-align:right;min-width:56px;font-weight:600}.KFXqYa_providerGroupBalanceLabel{color:var(--dsw-alias-label-caption);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(--dsw-static-amber-500) 16%, transparent)}.KFXqYa_roundsBarColOff{background:var(--dsw-alias-bg-module-platform)}.KFXqYa_roundsBarLabel{text-align:center;color:var(--dsw-alias-label-secondary);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(--dsw-static-blue-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsBarFlagged{background:var(--dsw-static-red-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsFlagMark{background:var(--dsw-static-red-500);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.KFXqYa_roundsAxis{color:var(--dsw-alias-label-secondary);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.KFXqYa_roundsEmpty{color:var(--dsw-alias-label-secondary);margin-top:10px;font-size:12px}.KFXqYa_heatmap{margin-top:10px}.KFXqYa_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;display:grid}.KFXqYa_heatmapCellEmpty{background:var(--dsw-alias-bg-layer-1);height:30px;color:var(--dsw-alias-label-dimmed);font-variant-numeric:tabular-nums;border-radius:8px;justify-content:center;align-items:center;font-size:11px;display:flex}.KFXqYa_heatmapCell{font-variant-numeric:tabular-nums;cursor:pointer;border:0;border-radius:8px;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_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:4px;width:14px;height:14px;display:block}.KFXqYa_heatmapHover{font-variant-numeric:tabular-nums;margin-left:auto}.KFXqYa_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.KFXqYa_heatmapRangeButton{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-text-secondary);cursor:pointer;background:0 0;border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4}.KFXqYa_heatmapRangeButtonActive{color:var(--dsw-alias-text-primary);border-color:currentColor;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(--dsw-alias-text-tertiary);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(--dsw-alias-text-tertiary);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_triggerPopSubscription{width:auto;left:0;right:0}.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(--dsw-static-blue-500);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-static-blue-500) 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(--dsw-static-blue-500);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(--dsw-static-amber-500);background:color-mix(in srgb, var(--dsw-static-amber-500) 12%, transparent);border:1px solid color-mix(in srgb, var(--dsw-static-amber-500) 30%, transparent);border-radius:10px;align-items:center;gap:6px;margin:0 0 10px;padding:8px 10px;font-size:11px;display:flex}.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(--dsw-static-blue-500);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(--dsw-static-blue-500)}.KFXqYa_tokenModelPartOut{background:var(--dsw-static-amber-500)}.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:1px solid var(--dsw-alias-border-l1);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 82%, transparent);-webkit-backdrop-filter:blur(12px)saturate(1.2);border-radius:12px;flex-direction:column;gap:8px;min-width:280px;max-width:380px;padding:16px;animation:.2s KFXqYa_peakAlertIn;display:flex;position:fixed;box-shadow:0 4px 16px #00000014}.KFXqYa_peakCardCorner{bottom:18px;right:18px}.KFXqYa_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.KFXqYa_peakCardPeak{color:var(--dsw-static-blue-500)}.KFXqYa_peakCardOff{color:var(--dsw-static-green-500)}.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(--dsw-static-blue-500)}.KFXqYa_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-static-green-500)}.KFXqYa_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.KFXqYa_peakDotPrimary{background:var(--dsw-static-blue-500)}.KFXqYa_peakDotSuccess{background:var(--dsw-static-green-500)}.KFXqYa_peakClose{width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;font-size:15px;line-height:1;transition:background-color .14s,color .14s;display:inline-flex}.KFXqYa_peakClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_peakCount{font-variant-numeric:tabular-nums;font-size:28px;font-weight:700;line-height:34px}.KFXqYa_peakCountPrimary{color:var(--dsw-static-blue-500)}.KFXqYa_peakCountSuccess{color:var(--dsw-static-green-500)}.KFXqYa_peakDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:18px}@keyframes KFXqYa_peakAlertIn{0%{opacity:0}to{opacity:1}}.KFXqYa_setCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;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(--dsw-alias-border-l1);border-radius:10px;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(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_setCardDesc{color:var(--dsw-alias-label-secondary);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(--dsw-alias-label-secondary);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(--dsw-alias-border-l1);align-items:center;gap:10px;padding:8px 0;display:flex}.KFXqYa_userPriceCheck{width:14px;height:14px;accent-color:var(--dsw-static-blue-500);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(--dsw-alias-border-l1);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(--dsw-alias-label-secondary);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(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:96px;max-width:160px;color:var(--dsw-alias-label-primary);border-radius:6px;padding:4px 8px;font-size:12px;line-height:16px}.KFXqYa_userPriceInputNum{min-width:72px;max-width:88px}.KFXqYa_rdo{color:var(--dsw-alias-label-secondary);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(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:50%;flex:none;width:14px;height:14px;position:relative}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot{border-color:var(--dsw-static-blue-500)}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot:after{content:"";background:var(--dsw-static-blue-500);border-radius:50%;position:absolute;inset:3px}.KFXqYa_inp{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:6px;align-items:center;gap:4px;padding:2px 6px;display:inline-flex}.KFXqYa_affix{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.KFXqYa_prog{background:var(--dsw-alias-bg-module-platform);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.KFXqYa_progFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .2s}.KFXqYa_btn{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;line-height:16px;transition:border-color .16s,color .16s,background-color .16s;display:inline-flex}.KFXqYa_btn:hover{border-color:var(--dsw-static-blue-500);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-static-blue-500) 12%, var(--dsw-alias-bg-layer-1))}.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(--dsw-alias-label-primary)}`,document.head.appendChild(e)}var F={rounds:`KFXqYa_rounds`,heatmapCellEmpty:`KFXqYa_heatmapCellEmpty`,railButton:`KFXqYa_railButton`,ctlLabel:`KFXqYa_ctlLabel`,roundsFlagMark:`KFXqYa_roundsFlagMark`,ubChipPeak:`KFXqYa_ubChipPeak`,shareSegAssistant:`KFXqYa_shareSegAssistant`,heatmapYearCell:`KFXqYa_heatmapYearCell`,plgHead:`KFXqYa_plgHead`,heroReadout:`KFXqYa_heroReadout`,popTagPrimary:`KFXqYa_popTagPrimary`,heroTop:`KFXqYa_heroTop`,heroSideLabel:`KFXqYa_heroSideLabel`,balanceCell:`KFXqYa_balanceCell`,popHead:`KFXqYa_popHead`,setGrid3:`KFXqYa_setGrid3`,plgGrid:`KFXqYa_plgGrid`,chartCrosshair:`KFXqYa_chartCrosshair`,flatTag:`KFXqYa_flatTag`,chartLegendBar:`KFXqYa_chartLegendBar`,healthBadgeOk:`KFXqYa_healthBadgeOk`,floatSubHead:`KFXqYa_floatSubHead`,providerGroupCostLabel:`KFXqYa_providerGroupCostLabel`,setCell:`KFXqYa_setCell`,popModelLabel:`KFXqYa_popModelLabel`,modelProvider:`KFXqYa_modelProvider`,balanceDetailRow:`KFXqYa_balanceDetailRow`,chartGrid:`KFXqYa_chartGrid`,peakDotPrimary:`KFXqYa_peakDotPrimary`,peakDotSuccess:`KFXqYa_peakDotSuccess`,rdoDot:`KFXqYa_rdoDot`,heroGaugeArc:`KFXqYa_heroGaugeArc`,progFill:`KFXqYa_progFill`,popModelRow:`KFXqYa_popModelRow`,reconcileNotice:`KFXqYa_reconcileNotice`,plgTitle:`KFXqYa_plgTitle`,subscriptionReset:`KFXqYa_subscriptionReset`,userPriceInput:`KFXqYa_userPriceInput`,siteRowCallsLow:`KFXqYa_siteRowCallsLow`,triggerPop:`KFXqYa_triggerPop`,metricGrid:`KFXqYa_metricGrid`,hero:`KFXqYa_hero`,bucketThird:`KFXqYa_bucketThird`,budgetInput:`KFXqYa_budgetInput`,ubTagNeutral:`KFXqYa_ubTagNeutral`,ubNotesTerm:`KFXqYa_ubNotesTerm`,providerGroupCostValue:`KFXqYa_providerGroupCostValue`,chartTooltipModelDetail:`KFXqYa_chartTooltipModelDetail`,deltaDown:`KFXqYa_deltaDown`,balanceDetailGrid:`KFXqYa_balanceDetailGrid`,heatmapHover:`KFXqYa_heatmapHover`,chartLegendItem:`KFXqYa_chartLegendItem`,heatmapYear:`KFXqYa_heatmapYear`,tokenModelPartOut:`KFXqYa_tokenModelPartOut`,rdo:`KFXqYa_rdo`,panel:`KFXqYa_panel`,currencyToggle:`KFXqYa_currencyToggle`,chartEmpty:`KFXqYa_chartEmpty`,switch:`KFXqYa_switch`,ubExtraNote:`KFXqYa_ubExtraNote`,triggerPopSwitchCount:`KFXqYa_triggerPopSwitchCount`,peakDot:`KFXqYa_peakDot`,floatSubName:`KFXqYa_floatSubName`,roundsBarFlagged:`KFXqYa_roundsBarFlagged`,subscriptionFill:`KFXqYa_subscriptionFill`,heroBudgetFillOver:`KFXqYa_heroBudgetFillOver`,plgLink:`KFXqYa_plgLink`,triggerWrap:`KFXqYa_triggerWrap`,setGrid2:`KFXqYa_setGrid2`,plgDesc:`KFXqYa_plgDesc`,ubNotes:`KFXqYa_ubNotes`,chartTooltipSwatch:`KFXqYa_chartTooltipSwatch`,subscriptionStatus:`KFXqYa_subscriptionStatus`,tabPanel:`KFXqYa_tabPanel`,popTitle:`KFXqYa_popTitle`,trigger:`KFXqYa_trigger`,roundsBarWrap:`KFXqYa_roundsBarWrap`,shareSegUser:`KFXqYa_shareSegUser`,switchKnob:`KFXqYa_switchKnob`,"billing-trigger":`KFXqYa_billing-trigger`,heroBudgetValue:`KFXqYa_heroBudgetValue`,chartLegendItemActive:`KFXqYa_chartLegendItemActive`,feeInlineError:`KFXqYa_feeInlineError`,userPriceInputNum:`KFXqYa_userPriceInputNum`,floatTarget:`KFXqYa_floatTarget`,popModelStatusLow:`KFXqYa_popModelStatusLow`,feeChipAlert:`KFXqYa_feeChipAlert`,peakAlertIn:`KFXqYa_peakAlertIn`,heroBudget:`KFXqYa_heroBudget`,subscriptionGrid:`KFXqYa_subscriptionGrid`,userPriceLineMeta:`KFXqYa_userPriceLineMeta`,ubModelName:`KFXqYa_ubModelName`,tokenPanel:`KFXqYa_tokenPanel`,vendorLogo:`KFXqYa_vendorLogo`,plgItem:`KFXqYa_plgItem`,shareSeg:`KFXqYa_shareSeg`,siteKindDirect:`KFXqYa_siteKindDirect`,numCol:`KFXqYa_numCol`,ubNotesItem:`KFXqYa_ubNotesItem`,peakDesc:`KFXqYa_peakDesc`,deltaUp:`KFXqYa_deltaUp`,setCardTitle:`KFXqYa_setCardTitle`,staleNotice:`KFXqYa_staleNotice`,heroMeta:`KFXqYa_heroMeta`,ubCardSub:`KFXqYa_ubCardSub`,roundsEmpty:`KFXqYa_roundsEmpty`,tabButtonActive:`KFXqYa_tabButtonActive`,heroGaugeTrack:`KFXqYa_heroGaugeTrack`,chartLegend:`KFXqYa_chartLegend`,modelTable:`KFXqYa_modelTable`,shareValue:`KFXqYa_shareValue`,peakCardCenter:`KFXqYa_peakCardCenter`,heroGaugePct:`KFXqYa_heroGaugePct`,ubRate:`KFXqYa_ubRate`,heroGaugeLabel:`KFXqYa_heroGaugeLabel`,heroSideSpacer:`KFXqYa_heroSideSpacer`,feeChipPrimary:`KFXqYa_feeChipPrimary`,subscriptionTier:`KFXqYa_subscriptionTier`,providerGroupCost:`KFXqYa_providerGroupCost`,ubExtraRow:`KFXqYa_ubExtraRow`,heatmap:`KFXqYa_heatmap`,plgLabel:`KFXqYa_plgLabel`,ubExtraName:`KFXqYa_ubExtraName`,userPricePriceLine:`KFXqYa_userPricePriceLine`,shareLegend:`KFXqYa_shareLegend`,ubCardHead:`KFXqYa_ubCardHead`,tabNav:`KFXqYa_tabNav`,subscriptionHead:`KFXqYa_subscriptionHead`,userPriceRow:`KFXqYa_userPriceRow`,chartLegendLine:`KFXqYa_chartLegendLine`,peakCountPrimary:`KFXqYa_peakCountPrimary`,siteRowName:`KFXqYa_siteRowName`,feeSep:`KFXqYa_feeSep`,rdoSelect:`KFXqYa_rdoSelect`,bucketCost:`KFXqYa_bucketCost`,feeNum:`KFXqYa_feeNum`,triggerPopSubscription:`KFXqYa_triggerPopSubscription`,ctlRow:`KFXqYa_ctlRow`,roundsBarCol:`KFXqYa_roundsBarCol`,kpiGrid:`KFXqYa_kpiGrid`,feeInline:`KFXqYa_feeInline`,closeButton:`KFXqYa_closeButton`,bucketSep:`KFXqYa_bucketSep`,tabButton:`KFXqYa_tabButton`,healthBadge:`KFXqYa_healthBadge`,tabPanelIn:`KFXqYa_tabPanelIn`,heatmapRangeButtonActive:`KFXqYa_heatmapRangeButtonActive`,ctlCol:`KFXqYa_ctlCol`,rangeToggle:`KFXqYa_rangeToggle`,chartBar:`KFXqYa_chartBar`,floatSub:`KFXqYa_floatSub`,heatmapYearMonth:`KFXqYa_heatmapYearMonth`,setCard:`KFXqYa_setCard`,tokenModelShareRow:`KFXqYa_tokenModelShareRow`,chartAxisLabel:`KFXqYa_chartAxisLabel`,triggerSparkHot:`KFXqYa_triggerSparkHot`,heroCurrency:`KFXqYa_heroCurrency`,tokenModelPartIn:`KFXqYa_tokenModelPartIn`,budgetFillWarn:`KFXqYa_budgetFillWarn`,exportBar:`KFXqYa_exportBar`,ubCardTitle:`KFXqYa_ubCardTitle`,uncataloguedTag:`KFXqYa_uncataloguedTag`,rdoChevronOpen:`KFXqYa_rdoChevronOpen`,healthIdle:`KFXqYa_healthIdle`,feeSuffix:`KFXqYa_feeSuffix`,peakTag:`KFXqYa_peakTag`,heroGaugeSvg:`KFXqYa_heroGaugeSvg`,feeChipError:`KFXqYa_feeChipError`,modelRowFocusable:`KFXqYa_modelRowFocusable`,estimatedTag:`KFXqYa_estimatedTag`,ubNotesDesc:`KFXqYa_ubNotesDesc`,perfChipOff:`KFXqYa_perfChipOff`,popDotDirect:`KFXqYa_popDotDirect`,heroBudgetTrack:`KFXqYa_heroBudgetTrack`,feeBarAbove:`KFXqYa_feeBarAbove`,subscriptionFillWarn:`KFXqYa_subscriptionFillWarn`,shareSegOff:`KFXqYa_shareSegOff`,subscriptionTrack:`KFXqYa_subscriptionTrack`,delta:`KFXqYa_delta`,heatmapLegend:`KFXqYa_heatmapLegend`,triggerPopSwitcher:`KFXqYa_triggerPopSwitcher`,chartTooltipDate:`KFXqYa_chartTooltipDate`,ubTagPromo:`KFXqYa_ubTagPromo`,bucketOfficial:`KFXqYa_bucketOfficial`,dashboard:`KFXqYa_dashboard`,vendorLetter:`KFXqYa_vendorLetter`,perfBar:`KFXqYa_perfBar`,exportLabel:`KFXqYa_exportLabel`,subscriptionExhausted:`KFXqYa_subscriptionExhausted`,providerGroupMeta:`KFXqYa_providerGroupMeta`,affix:`KFXqYa_affix`,providerGroupTitle:`KFXqYa_providerGroupTitle`,triggerPopShown:`KFXqYa_triggerPopShown`,dashboardRight:`KFXqYa_dashboardRight`,rdoLabel:`KFXqYa_rdoLabel`,dashboardModal:`KFXqYa_dashboardModal`,peakCardOff:`KFXqYa_peakCardOff`,heatmapYearWeekday:`KFXqYa_heatmapYearWeekday`,ubAlertLeft:`KFXqYa_ubAlertLeft`,siteRowCalls:`KFXqYa_siteRowCalls`,peakHead:`KFXqYa_peakHead`,sessionGroupRow:`KFXqYa_sessionGroupRow`,dashboardTitle:`KFXqYa_dashboardTitle`,heatmapRangeButton:`KFXqYa_heatmapRangeButton`,dashboardHead:`KFXqYa_dashboardHead`,popModelName:`KFXqYa_popModelName`,chartBarPlaceholder:`KFXqYa_chartBarPlaceholder`,currencyButtonActive:`KFXqYa_currencyButtonActive`,reconcileDismiss:`KFXqYa_reconcileDismiss`,heroBudgetFill:`KFXqYa_heroBudgetFill`,kpiValue:`KFXqYa_kpiValue`,subscriptionPct:`KFXqYa_subscriptionPct`,reconcileIcon:`KFXqYa_reconcileIcon`,roundsBarColPeak:`KFXqYa_roundsBarColPeak`,roundsBarColOff:`KFXqYa_roundsBarColOff`,ubModel:`KFXqYa_ubModel`,modelDot:`KFXqYa_modelDot`,ubTagAlert:`KFXqYa_ubTagAlert`,feeChipOff:`KFXqYa_feeChipOff`,triggerMetric:`KFXqYa_triggerMetric`,popTagSub:`KFXqYa_popTagSub`,ubTag:`KFXqYa_ubTag`,plgIcon:`KFXqYa_plgIcon`,providerGroupHead:`KFXqYa_providerGroupHead`,emptyRow:`KFXqYa_emptyRow`,heatmapCell:`KFXqYa_heatmapCell`,rdoRow:`KFXqYa_rdoRow`,peakCardPeak:`KFXqYa_peakCardPeak`,peakTagSuccess:`KFXqYa_peakTagSuccess`,prog:`KFXqYa_prog`,metricValueSuccess:`KFXqYa_metricValueSuccess`,ubAlertNote:`KFXqYa_ubAlertNote`,subscriptionMeta:`KFXqYa_subscriptionMeta`,subscriptionGoldFlow:`KFXqYa_subscriptionGoldFlow`,heroValue:`KFXqYa_heroValue`,heroSideItem:`KFXqYa_heroSideItem`,switchOn:`KFXqYa_switchOn`,siteRowMeta:`KFXqYa_siteRowMeta`,triggerMain:`KFXqYa_triggerMain`,popDot:`KFXqYa_popDot`,shareTrack:`KFXqYa_shareTrack`,modelRowActive:`KFXqYa_modelRowActive`,subscriptionCard:`KFXqYa_subscriptionCard`,providerGroupBalanceLabel:`KFXqYa_providerGroupBalanceLabel`,planTag:`KFXqYa_planTag`,shareItem:`KFXqYa_shareItem`,tokenModelParts:`KFXqYa_tokenModelParts`,setCardHead:`KFXqYa_setCardHead`,shareSegTool:`KFXqYa_shareSegTool`,ubChipOff:`KFXqYa_ubChipOff`,siteRowCost:`KFXqYa_siteRowCost`,balanceDetailClose:`KFXqYa_balanceDetailClose`,ctlGroup:`KFXqYa_ctlGroup`,siteKindUnknown:`KFXqYa_siteKindUnknown`,dashboardSubtitle:`KFXqYa_dashboardSubtitle`,modelCell:`KFXqYa_modelCell`,providerGroupBalance:`KFXqYa_providerGroupBalance`,dashboardBody:`KFXqYa_dashboardBody`,tableScroll:`KFXqYa_tableScroll`,popModelStatus:`KFXqYa_popModelStatus`,heroGaugeCenter:`KFXqYa_heroGaugeCenter`,popModel:`KFXqYa_popModel`,heroGaugePctOver:`KFXqYa_heroGaugePctOver`,unpricedHint:`KFXqYa_unpricedHint`,siteRow:`KFXqYa_siteRow`,healthBad:`KFXqYa_healthBad`,healthBadgeBad:`KFXqYa_healthBadgeBad`,currencyButton:`KFXqYa_currencyButton`,heatmapYearWeekdays:`KFXqYa_heatmapYearWeekdays`,floatModeBtnOn:`KFXqYa_floatModeBtnOn`,peakCard:`KFXqYa_peakCard`,healthDot:`KFXqYa_healthDot`,budgetOverPulse:`KFXqYa_budgetOverPulse`,heatmapYearScroll:`KFXqYa_heatmapYearScroll`,plgVal:`KFXqYa_plgVal`,heatmapFooter:`KFXqYa_heatmapFooter`,ubCardControlGroup:`KFXqYa_ubCardControlGroup`,subscriptionPlan:`KFXqYa_subscriptionPlan`,triggerIcon:`KFXqYa_triggerIcon`,triggerYen:`KFXqYa_triggerYen`,peakCardCorner:`KFXqYa_peakCardCorner`,panelHint:`KFXqYa_panelHint`,na:`KFXqYa_na`,panelTitle:`KFXqYa_panelTitle`,chartWrap:`KFXqYa_chartWrap`,heatmapYearGrid:`KFXqYa_heatmapYearGrid`,kpiGreen:`KFXqYa_kpiGreen`,ubTable:`KFXqYa_ubTable`,subscriptionName:`KFXqYa_subscriptionName`,triggerSub:`KFXqYa_triggerSub`,subscriptionWindow:`KFXqYa_subscriptionWindow`,heroSide:`KFXqYa_heroSide`,ctlRowStretch:`KFXqYa_ctlRowStretch`,chartTooltipLabel:`KFXqYa_chartTooltipLabel`,ubPricepair:`KFXqYa_ubPricepair`,siteKindSite:`KFXqYa_siteKindSite`,triggerLabel:`KFXqYa_triggerLabel`,shareDot:`KFXqYa_shareDot`,siteRowTitle:`KFXqYa_siteRowTitle`,ubTagSuccess:`KFXqYa_ubTagSuccess`,exportButton:`KFXqYa_exportButton`,chartTooltipHead:`KFXqYa_chartTooltipHead`,subscriptionAuto:`KFXqYa_subscriptionAuto`,providerGroupName:`KFXqYa_providerGroupName`,heatmapYearMonths:`KFXqYa_heatmapYearMonths`,floatModeBtn:`KFXqYa_floatModeBtn`,siteKindTag:`KFXqYa_siteKindTag`,inp:`KFXqYa_inp`,ubTablewrap:`KFXqYa_ubTablewrap`,chartHoverDot:`KFXqYa_chartHoverDot`,metricValue:`KFXqYa_metricValue`,chartTooltip:`KFXqYa_chartTooltip`,balanceDetailTitle:`KFXqYa_balanceDetailTitle`,heroSideValue:`KFXqYa_heroSideValue`,perfChipDot:`KFXqYa_perfChipDot`,reconcileText:`KFXqYa_reconcileText`,heatmapRangeSwitch:`KFXqYa_heatmapRangeSwitch`,plgNameRow:`KFXqYa_plgNameRow`,perfChip:`KFXqYa_perfChip`,peakClose:`KFXqYa_peakClose`,chartTooltipSplit:`KFXqYa_chartTooltipSplit`,floatTargetLabel:`KFXqYa_floatTargetLabel`,userPriceBody:`KFXqYa_userPriceBody`,plgTag:`KFXqYa_plgTag`,panelHeadControls:`KFXqYa_panelHeadControls`,rdoChevron:`KFXqYa_rdoChevron`,sessionChildRow:`KFXqYa_sessionChildRow`,setCardMeta:`KFXqYa_setCardMeta`,balanceDaysBadge:`KFXqYa_balanceDaysBadge`,perfChips:`KFXqYa_perfChips`,ubTagError:`KFXqYa_ubTagError`,balanceDetailValue:`KFXqYa_balanceDetailValue`,chartTooltipRow:`KFXqYa_chartTooltipRow`,balanceDetailPop:`KFXqYa_balanceDetailPop`,heroGauge:`KFXqYa_heroGauge`,roundsBar:`KFXqYa_roundsBar`,budgetFillOver:`KFXqYa_budgetFillOver`,balanceDaysBadgeLow:`KFXqYa_balanceDaysBadgeLow`,metricLabel:`KFXqYa_metricLabel`,tokenModelBar:`KFXqYa_tokenModelBar`,peakTagPrimary:`KFXqYa_peakTagPrimary`,subscriptionWindowLabel:`KFXqYa_subscriptionWindowLabel`,heatmapYearBody:`KFXqYa_heatmapYearBody`,chartLine:`KFXqYa_chartLine`,userPriceField:`KFXqYa_userPriceField`,kpiLabel:`KFXqYa_kpiLabel`,feeBar:`KFXqYa_feeBar`,setCardDesc:`KFXqYa_setCardDesc`,userPriceCheck:`KFXqYa_userPriceCheck`,metricCell:`KFXqYa_metricCell`,rangeButtonActive:`KFXqYa_rangeButtonActive`,shareSegPeak:`KFXqYa_shareSegPeak`,plgName:`KFXqYa_plgName`,feeInlineNum:`KFXqYa_feeInlineNum`,popDotNeutral:`KFXqYa_popDotNeutral`,triggerSpark:`KFXqYa_triggerSpark`,ubCard:`KFXqYa_ubCard`,metricValuePrimary:`KFXqYa_metricValuePrimary`,kpiTile:`KFXqYa_kpiTile`,peakCount:`KFXqYa_peakCount`,btn:`KFXqYa_btn`,triggerSparkBar:`KFXqYa_triggerSparkBar`,roundsAxis:`KFXqYa_roundsAxis`,ubAlert:`KFXqYa_ubAlert`,feeItem:`KFXqYa_feeItem`,roundsBarLabel:`KFXqYa_roundsBarLabel`,floatSubPlan:`KFXqYa_floatSubPlan`,feeCount:`KFXqYa_feeCount`,peakCountSuccess:`KFXqYa_peakCountSuccess`,balanceDetailHead:`KFXqYa_balanceDetailHead`,rangeButton:`KFXqYa_rangeButton`,feeInlineAlert:`KFXqYa_feeInlineAlert`,heroBudgetLabel:`KFXqYa_heroBudgetLabel`,chartSvg:`KFXqYa_chartSvg`,chartStack:`KFXqYa_chartStack`,dashboardIn:`KFXqYa_dashboardIn`,providerGroupList:`KFXqYa_providerGroupList`,kpiDetail:`KFXqYa_kpiDetail`,healthOk:`KFXqYa_healthOk`,triggerPrimary:`KFXqYa_triggerPrimary`,panelHead:`KFXqYa_panelHead`,heroMain:`KFXqYa_heroMain`,subscriptionFillOver:`KFXqYa_subscriptionFillOver`,providerGroup:`KFXqYa_providerGroup`,ubChipLabel:`KFXqYa_ubChipLabel`,providerGroupBadge:`KFXqYa_providerGroupBadge`,balanceDetailLabel:`KFXqYa_balanceDetailLabel`,heatmapGrid:`KFXqYa_heatmapGrid`,triggerPopEmpty:`KFXqYa_triggerPopEmpty`,popDotSub:`KFXqYa_popDotSub`,heroGaugeArcOver:`KFXqYa_heroGaugeArcOver`,heroLabel:`KFXqYa_heroLabel`,modelName:`KFXqYa_modelName`,modalFooter:`KFXqYa_modalFooter`,roundsBars:`KFXqYa_roundsBars`};let ne={"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`},"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`}},I={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 L(e){return e===``?e:I[e]??e}function re(e){let t=ne[L(e)];return t?.type===`code`?t.tier:void 0}let ie=[{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}],R,ae,oe,se,z;function ce(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function le(e,t){return ce(e)===ce(t)}function ue(e){z=e.length>0?e:void 0}function de(){return z}function fe(e){return je(e)}function pe(e,t){let n=me(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 me(e,t){if(z===void 0)return;let n=fe(e),r=G(n),i=e=>fe(e.key)===n||G(e.key)===r;if(t!==void 0){for(let e of z)if(e.origin!==void 0&&e.origin!==``&&i(e)&&le(e.origin,t))return e}for(let e of z)if((e.origin===void 0||e.origin===``)&&i(e))return e}function B(e){if(z===void 0)return;let t=fe(e),n=G(t);return z.find(e=>e.origin!==void 0&&e.origin!==``&&(fe(e.key)===t||G(e.key)===n))}function he(e){R=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,ae=e.prices,oe=e.extraModels}function ge(e){se=e}function _e(){return R??6.79}function ve(){return{rate:_e(),live:R!==void 0}}let ye=.5;function V(e){return e>=9&&e<12||e>=14&&e<18}function H(e){return e==null||!Number.isFinite(e)?`peak`:be(e)?`offPeak`:V((new Date(e).getUTCHours()+8)%24)?`peak`:`offPeak`}function be(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}let U=[540,720,840,1080];function W(e){return((e+288e5)%864e5+864e5)%864e5}function xe(e){let t=H(e),n=W(e);for(let r=0;r<7;r++){let i=r*864e5-n;for(let n of U){let r=i+n*6e4;if(!(r<=0)&&H(e+r)!==t)return{tier:t,nextSwitchInMs:r}}}let r=U[0]??0;return{tier:t,nextSwitchInMs:864e5-n+r*6e4}}function Se(e,t){let{nextSwitchInMs:n}=xe(e);if(n>t)return null;let r=e+n;return{entering:H(r),atMs:r}}function Ce(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 we=`09:00-12:00 / 14:00-18:00`,Te=`Standard / Flex`,Ee=[{key:`flash`,name:`DeepSeek V4 Flash`,provider:`DeepSeek`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:we},{key:`flash-vision-exp`,name:`DeepSeek V4 Flash Vision (Exp)`,provider:`DeepSeek`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:we},{key:`pro`,name:`DeepSeek V4 Pro`,provider:`DeepSeek`,colorVar:`dsw-static-deepseek-500`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:we},{key:`glm`,name:`GLM-5.2`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3`,name:`GLM-5.3`,provider:`智谱 AI`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3-flash`,name:`GLM-5.3-Flash`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.23,output:2.8},promo:{factor:.5,endsAtMs:Date.UTC(2026,8,8,16,0,0),note:`限时 5 折`}},{key:`glm-4.6`,name:`GLM-4.6`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16}},{key:`glm-4.5-air`,name:`GLM-4.5-Air`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.16,output:2}},{key:`glm-4.7`,name:`GLM-4.7`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5-turbo`,name:`GLM-5-Turbo`,provider:`智谱 AI`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`glm-5.1`,name:`GLM-5.1`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24}},{key:`glm-5v-turbo`,name:`GLM-5V-Turbo`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`qwen-3.8-max`,name:`Qwen3.8 Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:12,cacheHit:1.5,output:36},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-3.8-flash`,name:`Qwen3.8 Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:1,cacheHit:.1,output:3},extraRows:[{label:`显式缓存创建`,input:1.25},{label:`显式缓存命中`,input:.1},{label:`Batch File`,input:.5,output:1.5,note:`长期半价`},{label:`Batch Chat`,input:1,output:3,note:`与标准价一致`}]},{key:`qwen-max`,name:`Qwen3.7-Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:12,cacheHit:1.2,output:36},promo:{factor:.5,note:`限时 5 折`},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1.2},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-plus`,name:`Qwen3.5-Plus`,provider:`阿里通义`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:.8,cacheHit:.08,output:4.8},extraRows:[{label:`显式缓存创建`,input:1},{label:`显式缓存命中`,input:.08},{label:`Batch File`,input:.4,output:2.4,note:`长期半价`},{label:`Batch Chat`,input:.8,output:4.8,note:`与标准价一致`}]},{key:`qwen-flash`,name:`Qwen3.5-Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2},extraRows:[{label:`显式缓存创建`,input:.25},{label:`显式缓存命中`,input:.02}]},{key:`doubao`,name:`Doubao Seed-2.0 Pro`,provider:`字节豆包`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-mini`,name:`Doubao Seed-2.0 Mini`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2}},{key:`doubao-1.6`,name:`Doubao Seed-1.6`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:.8,cacheHit:0,output:8}},{key:`doubao-seed-evolving`,name:`Doubao-Seed-Evolving`,provider:`字节豆包`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-pro`,name:`Doubao Seed-2.1 Pro`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-turbo`,name:`Doubao Seed-2.1 Turbo`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:3,cacheHit:.6,output:15}},{key:`kimi`,name:`Kimi K2.7 Code`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27}},{key:`kimi-k2.7-hs`,name:`Kimi K2.7 Code HighSpeed`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-600`,price:{currency:`CNY`,input:13,cacheHit:2.6,output:54}},{key:`kimi-k2.6`,name:`Kimi K2.6`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27}},{key:`kimi-k3`,name:`Kimi K3`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:20,cacheHit:2,output:100}},{key:`mimo-v2.5`,name:`MiMo V2.5`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:1,cacheHit:.02,output:2}},{key:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:3,cacheHit:.025,output:6}},{key:`minimax`,name:`MiniMax-M3`,provider:`MiniMax`,colorVar:`dsw-static-amber-500`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7`,name:`MiniMax-M2.7`,provider:`MiniMax`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7-highspeed`,name:`MiniMax-M2.7-highspeed`,provider:`MiniMax`,colorVar:`dsw-static-amber-500`,price:{currency:`CNY`,input:4.2,cacheHit:.42,output:16.8}},{key:`ernie`,name:`ERNIE-5.1`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:4,cacheHit:.4,output:18}},{key:`hunyuan`,name:`混元 Hy3`,provider:`腾讯混元`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:1,cacheHit:.25,output:4}},{key:`hunyuan-t1`,name:`混元 T1`,provider:`腾讯混元`,colorVar:`dsw-static-amber-300`,price:{currency:`CNY`,input:1,cacheHit:.1,output:4}},{key:`yi`,name:`Yi-Lightning`,provider:`零一万物`,colorVar:`dsw-static-green-500`,price:{currency:`CNY`,input:.99,cacheHit:.1,output:.99}},{key:`step`,name:`Step 3.7 Flash`,provider:`阶跃星辰`,colorVar:`dsw-static-neutral-bluish-400`,price:{currency:`CNY`,input:1.35,cacheHit:.27,output:8.1}},{key:`spark`,name:`Spark 4.0 Ultra`,provider:`科大讯飞`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:5,cacheHit:.5,output:10},estimated:!0},{key:`sensenova`,name:`SenseNova 6.5`,provider:`商汤`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:4.5,cacheHit:.45,output:9},estimated:!0},{key:`baichuan`,name:`Baichuan M3-Plus`,provider:`百川智能`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:5,cacheHit:.5,output:9}},{key:`gpt-5.6-sol`,name:`GPT-5.6 Sol`,provider:`OpenAI`,colorVar:`dsw-static-green-500`,price:{currency:`USD`,input:5,cacheHit:.5,output:30}},{key:`gpt-5.6-terra`,name:`GPT-5.6 Terra`,provider:`OpenAI`,colorVar:`dsw-static-green-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:12}},{key:`gpt-5.6-luna`,name:`GPT-5.6 Luna`,provider:`OpenAI`,colorVar:`dsw-static-green-500`,price:{currency:`USD`,input:.2,cacheHit:.02,output:1.2}},{key:`gemini-pro`,name:`Gemini 3.1 Pro`,provider:`Google`,colorVar:`dsw-static-blue-600`,price:{currency:`USD`,input:2,cacheHit:.2,output:12,offPeak:{input:1,cacheHit:.1,output:6}},peakHours:Te,tierSemantics:`latency`},{key:`gemini-flash`,name:`Gemini 3.6 Flash`,provider:`Google`,colorVar:`dsw-static-blue-400`,price:{currency:`USD`,input:1.5,cacheHit:.15,output:7.5,offPeak:{input:.75,cacheHit:.075,output:3.75}},peakHours:Te,tierSemantics:`latency`},{key:`grok`,name:`Grok 4.6`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`USD`,input:2,cacheHit:.5,output:6}},{key:`grok-4.3`,name:`Grok 4.3`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`USD`,input:1.25,cacheHit:.2,output:2.5}},{key:`llama`,name:`Llama 4 Maverick`,provider:`Meta`,colorVar:`dsw-static-red-500`,price:{currency:`USD`,input:.2,cacheHit:.05,output:.6}},{key:`llama-scout`,name:`Llama 4 Scout`,provider:`Meta`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:.1,cacheHit:.025,output:.3}},{key:`claude-opus-4-6`,name:`Claude Opus 4.6`,provider:`Anthropic`,colorVar:`dsw-static-red-500`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:3,cacheHit:.3,output:15}},{key:`claude-haiku-4-5`,name:`Claude Haiku 4.5`,provider:`Anthropic`,colorVar:`dsw-static-red-300`,price:{currency:`USD`,input:1,cacheHit:.1,output:5}},{key:`claude-opus-5`,name:`Claude Opus 5`,provider:`Anthropic`,colorVar:`dsw-static-red-500`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-5`,name:`Claude Sonnet 5`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:10}},{key:`mistral-large-2512`,name:`Mistral Large 3`,provider:`Mistral AI`,colorVar:`dsw-static-violet-500`,price:{currency:`USD`,input:.5,cacheHit:.05,output:1.5}},{key:`mistral-small-2603`,name:`Mistral Small 4`,provider:`Mistral AI`,colorVar:`dsw-static-violet-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`ministral-8b-latest`,name:`Ministral 8B`,provider:`Mistral AI`,colorVar:`dsw-static-violet-300`,price:{currency:`USD`,input:.1,cacheHit:.01,output:.1}},{key:`command-a-03-2025`,name:`Command A`,provider:`Cohere`,colorVar:`dsw-static-cyan-500`,price:{currency:`USD`,input:2.5,cacheHit:.25,output:10}},{key:`command-r-08-2024`,name:`Command R`,provider:`Cohere`,colorVar:`dsw-static-cyan-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`longcat-2.0`,name:`LongCat 2.0`,provider:`美团`,colorVar:`dsw-static-amber-500`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`minicpm-v-4.5`,name:`MiniCPM-V 4.5`,provider:`面壁智能`,colorVar:`dsw-static-green-500`,price:{currency:`CNY`,input:1,cacheHit:.2,output:4},estimated:!0},{key:`ernie-4.5`,name:`ERNIE-4.5 300B`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`dots-3-note-preview`,name:`Dots3-Note Preview`,provider:`小红书`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`qwen3.6-max`,name:`Qwen3.6 Max`,provider:`阿里通义`,colorVar:`dsw-static-orange-500`,price:{currency:`CNY`,input:9,cacheHit:.9,output:54},extraRows:[{label:`显式缓存创建`,input:11.25},{label:`显式缓存命中`,input:.9}]},{key:`qwen3-coder-plus`,name:`Qwen3-Coder Plus`,provider:`阿里通义`,colorVar:`dsw-static-orange-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},extraRows:[{label:`显式缓存创建`,input:5},{label:`显式缓存命中`,input:.4}]},{key:`qwen3-coder`,name:`Qwen3-Coder 480B`,provider:`阿里通义`,colorVar:`dsw-static-orange-300`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`glm-4.5-x`,name:`GLM-4.5-X`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5.2-fast`,name:`GLM-5.2 Fast`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24},estimated:!0},{key:`kimi-k3-fast`,name:`Kimi K3 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:20,cacheHit:2,output:100},estimated:!0},{key:`kimi-k2.7-code-fast`,name:`Kimi K2.7 Code Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27},estimated:!0},{key:`kimi-k2.6-fast`,name:`Kimi K2.6 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2.6-turbo`,name:`Kimi K2.6 Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2-thinking-turbo`,name:`Kimi K2 Thinking Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:8,cacheHit:1,output:58}},{key:`doubao-seed-2.0-code`,name:`Doubao Seed-2.0 Code`,provider:`字节豆包`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-seed-2.0-lite`,name:`Doubao Seed-2.0 Lite`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.6,cacheHit:.12,output:3.6}},{key:`other`,name:`其他模型`,provider:`Custom`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:0,cacheHit:0,cacheMiss:0,output:0}}],De={"deepseek-v4-flash":`flash`,"deepseek-v4-flash-vision-exp":`flash-vision-exp`,"deepseek-v4.1-flash":`flash`,"deepseek-v4.1-flash-expires-on-0910":`flash`,"deepseek-flash":`flash`,"deepseek-v4-pro":`pro`,"glm-5.2":`glm`,"glm-4.5-air":`glm-4.5-air`,"glm-4.5air":`glm-4.5-air`,"glm-4.7":`glm-4.7`,"glm-5-turbo":`glm-5-turbo`,"glm-5.1":`glm-5.1`,"glm-5.3-flash":`glm-5.3-flash`,"glm-5v-turbo":`glm-5v-turbo`,"glm-5v.1":`glm-5v-turbo`,"claude-opus-4-6":`claude-opus-4-6`,"claude-opus-4.6":`claude-opus-4-6`,"claude-sonnet-4-6":`claude-sonnet-4-6`,"claude-sonnet-4.6":`claude-sonnet-4-6`,"claude-haiku-4-5":`claude-haiku-4-5`,"claude-haiku-4.5":`claude-haiku-4-5`,"claude-opus-5":`claude-opus-5`,"claude-sonnet-5":`claude-sonnet-5`,"mistral-large-2512":`mistral-large-2512`,"mistral-large-3":`mistral-large-2512`,"mistral-small-2603":`mistral-small-2603`,"mistral-small-4":`mistral-small-2603`,"ministral-8b-latest":`ministral-8b-latest`,"ministral-8b":`ministral-8b-latest`,"command-a-03-2025":`command-a-03-2025`,"command-a":`command-a-03-2025`,"command-r-08-2024":`command-r-08-2024`,"command-r":`command-r-08-2024`,hy3:`hunyuan`,"longcat-2.0":`longcat-2.0`,"longcat-2":`longcat-2.0`,"minicpm-v-4.5":`minicpm-v-4.5`,"minicpm-v-4.5-thinking":`minicpm-v-4.5`,"ernie-4.5":`ernie-4.5`,"ernie-4.5-300b":`ernie-4.5`,"dots-3-note-preview":`dots-3-note-preview`,"dots-3-note":`dots-3-note-preview`,"dots3-note-preview":`dots-3-note-preview`,"rednote-dots3":`dots-3-note-preview`,"doubao-seed-evolving":`doubao-seed-evolving`,"doubao-seed-evolve":`doubao-seed-evolving`,"doubao-seed-2.1-pro":`doubao-seed-2.1-pro`,"doubao-seed-2.1-pro-290000":`doubao-seed-2.1-pro`,"doubao-seed-2.1-turbo":`doubao-seed-2.1-turbo`,"doubao-seed-2-1-turbo":`doubao-seed-2.1-turbo`,"qwen3.8-max":`qwen-3.8-max`,"qwen3.8-flash":`qwen-3.8-flash`,"qwen3.7-max":`qwen-max`,"qwen3.6-max":`qwen3.6-max`,"qwen3.6-max-preview":`qwen3.6-max`,"qwen3-coder-plus":`qwen3-coder-plus`,"qwen3-coder":`qwen3-coder`,"qwen3-coder-480b":`qwen3-coder`,"glm-4.5-x":`glm-4.5-x`,"glm-4.5x":`glm-4.5-x`,"glm-5.2-fast":`glm-5.2-fast`,"glm-5.2f":`glm-5.2-fast`,"kimi-k3-fast":`kimi-k3-fast`,"kimi-k3f":`kimi-k3-fast`,"kimi-k2.7-code-fast":`kimi-k2.7-code-fast`,"kimi-k2.7-code-f":`kimi-k2.7-code-fast`,"kimi-k2.6-fast":`kimi-k2.6-fast`,"kimi-k2.6-turbo":`kimi-k2.6-turbo`,"kimi-k2-thinking-turbo":`kimi-k2-thinking-turbo`,"doubao-seed-2.0-code":`doubao-seed-2.0-code`,"doubao-seed-2-0-code":`doubao-seed-2.0-code`,"doubao-seed-2.0-lite":`doubao-seed-2.0-lite`,"doubao-seed-2-0-lite":`doubao-seed-2.0-lite`,"qwen-max":`qwen-max`,"hunyuan-t1":`hunyuan-t1`,"step-3.7-flash":`step`,"seed-2.0-mini":`doubao-mini`,k3:`kimi-k3`,"kimi-k3":`kimi-k3`,"minimax-m1":`minimax`,"minimax-m2":`minimax`,"minimax-m3":`minimax`,"minimax-m2.7":`minimax-m2.7`,"minimax-m2.7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2.7-high-speed":`minimax-m2.7-highspeed`,"minimax-m2-7":`minimax-m2.7`,"minimax-m2-7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2-7-high-speed":`minimax-m2.7-highspeed`};function G(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let Oe=(()=>{let e=new Map,t=(t,n)=>{let r=G(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of Ee)t(e.key,e.key);for(let[e,n]of Object.entries(De))t(e,n);for(let e of ie)t(e.key,e.key);return e})();function ke(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 Ae(e){let t=De[e];if(t!==void 0)return t;let n=G(e);if(n===``)return;let r=Oe.get(n);return r===void 0?(oe??[]).find(e=>G(e.key)===n)?.key:r}function je(e){let t=De[e]??e;if(t===e){let t=G(e);if(t!==``){let e=Oe.get(t);if(e!==void 0)return e;let n=(oe??[]).find(e=>G(e.key)===t);if(n!==void 0)return n.key}for(let t of ke(e)){let e=Ae(t);if(e!==void 0)return e}}return t}function Me(e){let t=je(e),n=ae?.[t];if(n!==void 0)return n;let r=ie.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function Ne(e){let t=je(e),n=Ee.find(e=>e.key===t),r=oe?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=Ee.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():K(r)),a=pe(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=Me(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function K(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 Pe(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function Fe(e,t){let{promo:n}=e;if(n===void 0||!Pe(n,t))return e;let r=e=>({input:e.input*n.factor,cacheHit:e.cacheHit*n.factor,...e.cacheMiss===void 0?{}:{cacheMiss:e.cacheMiss*n.factor},output:e.output*n.factor});return{...e,price:{...r(e.price),currency:e.price.currency,...e.price.offPeak===void 0?{}:{offPeak:r(e.price.offPeak)}}}}function Ie(e=Date.now()){let t=[...Ee.map(t=>Fe(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>G(e.key)));for(let e of se??[]){let i=e.id.toLowerCase();if((()=>{let t=je(e.id);return Ee.find(e=>e.key===t)})()!==void 0)continue;let a=G(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(oe??[]).find(e=>G(e.key)===a),s;if(o!==void 0)s=K(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=Me(i);s=t===void 0?{key:je(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=pe(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 Le(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function Re(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*_e():a}function ze(e,t,n=ye,r=Date.now()){let i=Fe(e,r),a=Re(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:Re(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function Be(e){let t=_e();return t>0?e/t:e}function q(e,t=`cny`){let n=Number(e);if(!Number.isFinite(n))return t===`cny`?`¥0`:`$0`;let r=t===`cny`?`¥`:`$`;return 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 Ve(e,t=`CNY`){return e===0?`免费`:t===`USD`?e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`:e>=10?`¥${e.toFixed(1)}`:`¥${e.toFixed(2)}`}function He(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}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 Ue(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let Y={top:18,right:40,bottom:26,left:46};function We(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function Ge(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function Ke(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 qe={key:`__total__`,name:`总计`,color:``};function Je({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>q(n===`usd`?Be(e):e,n),l=e=>i===`tokens`?Ge(e):c(e),u=e=>i===`tokens`?e.tokens??0:e.cost,d=(0,r.useMemo)(()=>{let n=e.length;if(n===0)return null;let r=680-Y.left-Y.right,a=220-Y.top-Y.bottom,o=e=>n===1?Y.left+r/2:Y.left+r*e/(n-1),s=Math.max(...i===`tokens`?e.map(e=>e.tokens??0):e.map(e=>Math.max(e.cost,Object.values(e.byModel??{}).reduce((e,t)=>e+t,0))),1e-4),c=e=>Y.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>Y.top+a-e/l*a,f=r/n,p=Math.min(18,f*.6);return{n,plotW:r,plotH:a,inner:o,yCost:c,yCalls:d,barW:p,bars:e.flatMap((e,n)=>{let r=o(n)-p/2;if(t.length===0||i===`tokens`)return[{date:e.date,model:qe,x:r,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,i={date:e.date,model:t,x:r,base:s,value:n,topRounded:t.key===a};return s+=n,i})}),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,i]);if(d===null)return(0,o.jsx)(`div`,{className:F.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:ee,linePath:x}=d,S=a===null?void 0:e[a],C=Ke(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:F.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:F.chartSvg,role:`img`,"aria-label":`Daily cost by model and total calls`,onMouseLeave:()=>{s(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Y.left)/p,r=Math.round(n*(f-1));s(Math.min(Math.max(r,0),f-1))},children:[b.map((e,t)=>{let n=g(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Y.left,x2:680-Y.right,y1:n,y2:n,className:F.chartGrid}),(0,o.jsx)(`text`,{x:Y.left-8,y:n+3,textAnchor:`end`,className:F.chartAxisLabel,children:l(e)})]},`cost-${t}`)}),y.map(t=>{if(t.value>0)return(0,o.jsx)(`rect`,{x:t.x,y:g(t.base+t.value),width:v,height:g(t.base)-g(t.base+t.value),rx:t.topRounded?2:0,className:t.model.color===``?F.chartBar:F.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,o.jsx)(`rect`,{x:t.x,y:g(0)-1,width:v,height:1,rx:0,className:F.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:x,fill:`none`,className:F.chartLine}),ee.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-Y.right+8,y:n+3,textAnchor:`start`,className:F.chartAxisLabel,children:Ge(e)},`calls-${t}`)}),C.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:F.chartAxisLabel,children:We(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:Y.top,y2:Y.top+m,className:F.chartCrosshair})]}),S!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:F.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(S.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:F.chartTooltipDate,children:S.date}),i!==`tokens`&&t.filter(e=>(S.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:F.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(S.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:F.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:F.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?Ge(S.tokens??0):c(S.cost)})]}),(0,o.jsxs)(`div`,{className:F.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:F.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:S.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:F.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:F.chartLegendLine}),`调用`]})]})]})}let X={top:14,right:42,bottom:22,left:46};function Ye(e){return e.slice(5,13).replace(`T`,` `)}function Xe(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function Ze(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Qe(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function $e(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function et({perf:e,models:t,t:n}){let[i,a]=(0,r.useState)(()=>N()),[s,c]=(0,r.useState)(null),l=e=>{a(e),te(e)},u=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,f=(0,r.useMemo)(()=>e===void 0?[]:Object.entries(e.byModel).map(([e,n])=>({key:e,name:t.find(t=>t.key===e)?.name??e,color:u(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]),p=(0,r.useMemo)(()=>{if(e===void 0)return[];if(i.models!==void 0){let t=new Set(Object.keys(e.byModel));return i.models.filter(e=>t.has(e))}return f.slice(0,5).map(e=>e.key)},[e,f,i.models]),m=(0,r.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,r=680-X.left-X.right,a=180-X.top-X.bottom,o=e=>n===1?X.left+r/2:X.left+r*e/(n-1),s=new Set(p),c=e=>i.metric===`ttft`?e?.ttftAvg:e?.tpsAvg,l=[],u=0;for(let r of f){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>u&&(u=s))}l.push({key:r.key,name:r.name,color:r.color,segments:[],points:i})}let d=l.reduce((e,t)=>e+t.points.length,0);u=Math.max(u,1);let m=e=>X.top+a-e/u*a;for(let e of l){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:r,plotH:a,inner:o,yOf:m,series:l,ticks:[0,.5,1].map(e=>u*e).reverse(),xTicks:g,totalPoints:d}},[e,f,p,i.metric]);if(e===void 0||f.length===0)return(0,o.jsx)(`div`,{className:F.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)});let h=e=>{let t=p.includes(e)?p.filter(t=>t!==e):[...p,e];l({metric:i.metric,models:t})},g=e=>{l({metric:e,...i.models===void 0?{}:{models:i.models}})},_=s===null||m===null?[]:m.series.flatMap(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?[]:[{key:e.key,name:e.name,color:e.color,v:t.v}]});return(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:F.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:F.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:F.numCol,children:n(`perfEstimated`)})]})}),(0,o.jsx)(`tbody`,{children:f.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:F.modelCell,children:[(0,o.jsx)(`span`,{className:F.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:F.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:F.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:F.numCol,children:Ze(e.ttftAvg)}),(0,o.jsx)(`td`,{className:F.numCol,children:Ze(e.ttftP50)}),(0,o.jsx)(`td`,{className:F.numCol,children:Ze(e.ttftP90)}),(0,o.jsx)(`td`,{className:F.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:F.na,children:`—`}):(0,o.jsxs)(`span`,{children:[Ze(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:F.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:F.na,children:`—`}):Qe(e.tpsAvg)}),(0,o.jsx)(`td`,{className:F.numCol,children:Ze(e.latencyAvg)}),(0,o.jsx)(`td`,{className:F.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:F.na,children:`—`})})]},e.key))})]})}),m!==null&&(0,o.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,o.jsx)(`div`,{className:F.perfBar,children:(0,o.jsx)(`span`,{className:F.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.rangeButton,i.metric===e&&F.rangeButtonActive),"aria-pressed":i.metric===e,"data-testid":`billing-perf-tab-${e}`,onClick:()=>{g(e)},children:e===`ttft`?`${n(`perfTtft`)} (ms)`:`${n(`perfTps`)} (${n(`perfTpsUnit`)})`},e))})}),(0,o.jsxs)(`div`,{className:F.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,o.jsx)(`button`,{type:`button`,className:F.perfChip,"data-testid":`billing-perf-chip-all`,onClick:()=>{l({metric:i.metric,models:f.map(e=>e.key)})},children:n(`perfAll`)}),f.map(e=>{let t=p.includes(e.key);return(0,o.jsxs)(`button`,{type:`button`,className:d(F.perfChip,!t&&F.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:()=>{h(e.key)},children:[(0,o.jsx)(`span`,{className:F.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),m.totalPoints>0?(0,o.jsxs)(`div`,{className:F.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:F.chartSvg,role:`img`,"aria-label":`Hourly perf comparison by model`,onMouseLeave:()=>{c(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-X.left)/m.plotW,r=Math.round(n*(m.n-1));c(Math.min(Math.max(r,0),m.n-1))},children:[m.ticks.map((e,t)=>{let n=m.yOf(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:X.left,x2:680-X.right,y1:n,y2:n,className:F.chartGrid}),(0,o.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:F.chartAxisLabel,children:Xe(e)})]},`tick-${t}`)}),m.series.map(e=>e.segments.map((t,n)=>(0,o.jsx)(`path`,{d:t,fill:`none`,className:F.chartLine,style:{stroke:e.color}},`${e.key}-${n}`))),m.xTicks.map(e=>{let t=m.hourKeys[e];return t===void 0?null:(0,o.jsx)(`text`,{x:m.inner(e),y:174,textAnchor:`middle`,className:F.chartAxisLabel,children:Ye(t)},t)}),s!==null&&(0,o.jsx)(`line`,{x1:m.inner(s),x2:m.inner(s),y1:X.top,y2:X.top+m.plotH,className:F.chartCrosshair}),s!==null&&m.series.map(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?null:(0,o.jsx)(`circle`,{cx:t.x,cy:t.y,r:3.5,fill:e.color,className:F.chartHoverDot},`${e.key}-dot`)})]}),s!==null&&_.length>0&&(0,o.jsxs)(`div`,{className:F.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${m.inner(s)/680*100}%`,top:`${(X.top+m.plotH/2)/180*100}%`},children:[(0,o.jsx)(`div`,{className:F.chartTooltipDate,children:Ye(m.hourKeys[s]??``)}),_.map(e=>(0,o.jsxs)(`div`,{className:F.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:$e(e.v,i.metric,n)})]},e.key))]})]}):(0,o.jsx)(`div`,{className:F.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),m===null&&(0,o.jsx)(`div`,{className:F.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let tt=`@kenz1117/dsh-ui-usage-billing`,nt=`kenz1117`;function rt({t:e,version:t}){return(0,o.jsxs)(`section`,{className:F.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:F.plgHead,children:[(0,o.jsx)(`span`,{className:F.plgIcon,"aria-hidden":`true`,children:(0,o.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,o.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,o.jsxs)(`div`,{className:F.plgTitle,children:[(0,o.jsxs)(`div`,{className:F.plgNameRow,children:[(0,o.jsx)(`h3`,{className:F.plgName,children:tt}),(0,o.jsx)(`span`,{className:F.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:F.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:F.plgGrid,children:[(0,o.jsxs)(`div`,{className:F.plgItem,children:[(0,o.jsx)(`span`,{className:F.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:F.plgLink,href:`https://github.com/${nt}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,nt,`)`]})]}),(0,o.jsxs)(`div`,{className:F.plgItem,children:[(0,o.jsx)(`span`,{className:F.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:F.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:F.plgItem,children:[(0,o.jsx)(`span`,{className:F.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:F.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:tt})]}),(0,o.jsxs)(`div`,{className:F.plgItem,children:[(0,o.jsx)(`span`,{className:F.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:F.plgVal,children:`MIT`})]})]})]})}function it(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 at(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let Z={top:14,right:18,bottom:22,left:46},ot=`var(--dsw-static-blue-500)`,st=`#14b8a6`,ct=`var(--dsw-static-amber-500)`;function lt(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function ut(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,s=e.money,c=e.models??[],{byDay:l,byModel:u,total:f}=t,[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(`structure`),[_,v]=(0,r.useState)(null),y=t.byDayModels!==void 0,b=e=>{g(e),v(null)},ee=(0,r.useMemo)(()=>{let e=t.byRole;if(e===void 0)return[];let n=e.user+e.assistant+e.tool;return n<=0?[]:[{label:a(`roleUser`),value:e.user,seg:F.shareSegUser},{label:a(`roleAssistant`),value:e.assistant,seg:F.shareSegAssistant},{label:a(`roleTool`),value:e.tool,seg:F.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,a]),x=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=it(n.getTime()),i=l[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[l,n]),S=(0,r.useMemo)(()=>{let e=[];for(let r=n-1;r>=0;--r){let n=new Date;n.setDate(n.getDate()-r);let i=it(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]),C=(0,r.useMemo)(()=>{let e=new Map;for(let t of S)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:c.find(t=>t.key===e)?.name??Ne(e).name,color:c.find(t=>t.key===e)?.color??`#8b95a3`}))},[S,c]),w=_!==null&&C.some(e=>e.key===_)?_:null,T=e=>{if(y){if(h!==`model`){g(`model`),v(e);return}v(t=>t===e?null:e)}},E=(0,r.useMemo)(()=>{let e=0;return Object.entries(u).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:Ne(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}))},[u]),D=(0,r.useMemo)(()=>{let e=f.cacheHit??0,t=f.cacheMiss??0,n=f.input??0,r=f.output??0,i=f.reasoning??0,a=e+t,o=a>0?e/a*100:0,s=r>0?i/r*100:0,c=r>0?n/r:0,l;for(let e of x){let t=e.miss+e.hit+e.output;(l===void 0||t>l.miss+l.hit+l.output)&&(l=e)}return{cacheHitRate:o,reasoningPct:s,io:c,peak:l,hit:e,miss:t,input:n,output:r,reasoning:i}},[f,x]),O=(0,r.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]),k=(0,r.useMemo)(()=>{let e=x.length;if(e===0)return null;let t=680-Z.left-Z.right,n=200-Z.top-Z.bottom,r=Math.max(...h===`model`?S.map(e=>e.total):x.map(e=>e.miss+e.hit+e.output),1),i=e=>Z.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?Z.left+t/2:Z.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}},[x,S,h]),A=()=>{let e=new Blob([dt(x)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${it()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},j=()=>{let e=new Blob([lt(x,E,S,f)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${it()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},M=p===null?void 0:x[p],N=p===null?void 0:S[p];return(0,o.jsxs)(`div`,{className:F.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:F.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:F.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-token-export-csv`,onClick:A,children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-token-export-json`,onClick:j,children:a(`exportJson`)})]}),(0,o.jsxs)(`div`,{className:F.kpiGrid,"data-testid":`billing-token-kpis`,children:[(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:a(`tokenCacheHitRate`)}),(0,o.jsxs)(`span`,{className:F.kpiValue,children:[D.cacheHitRate.toFixed(1),`%`]}),(0,o.jsxs)(`span`,{className:F.kpiDetail,children:[J(D.hit),` / `,J(D.hit+D.miss),(f.cacheWrite??0)>0?` · ${a(`tokenCacheWrite`)} ${J(f.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:a(`tokenReasoningShare`)}),(0,o.jsxs)(`span`,{className:F.kpiValue,children:[D.reasoningPct.toFixed(1),`%`]}),(0,o.jsx)(`span`,{className:F.kpiDetail,children:J(D.reasoning)})]}),(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:a(`tokenIo`)}),(0,o.jsx)(`span`,{className:F.kpiValue,children:D.io.toFixed(2)}),(0,o.jsxs)(`span`,{className:F.kpiDetail,children:[J(D.input),` / `,J(D.output)]})]}),(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:a(`tokenPeak`)}),(0,o.jsx)(`span`,{className:F.kpiValue,children:D.peak===void 0?`—`:at(D.peak.miss+D.peak.hit+D.peak.output)}),(0,o.jsx)(`span`,{className:F.kpiDetail,children:D.peak?.date??`—`})]})]}),(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:F.panelHead,children:[(0,o.jsx)(`h3`,{className:F.panelTitle,children:a(`tokenDaily`)}),(0,o.jsxs)(`span`,{className:F.panelHeadControls,children:[y&&(0,o.jsx)(`span`,{className:F.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.rangeButton,h===e&&F.rangeButtonActive),"aria-pressed":h===e,onClick:()=>{b(e)},"data-testid":`billing-token-view-${e}`,children:a(e===`structure`?`tokenViewStructure`:`tokenViewModel`)},e))}),(0,o.jsx)(`span`,{className:F.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.rangeButton,n===e&&F.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]})]}),k===null||h===`model`&&C.length===0?(0,o.jsx)(`div`,{className:F.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:F.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:F.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),onMouseLeave:()=>{m(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Z.left)/k.plotW,r=Math.round(n*(k.n-1));m(Math.min(Math.max(r,0),k.n-1))},children:[[0,.5,1].map(e=>{let t=k.max*e,n=k.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Z.left,x2:680-Z.right,y1:n,y2:n,className:F.chartGrid}),(0,o.jsx)(`text`,{x:Z.left-8,y:n+3,textAnchor:`end`,className:F.chartAxisLabel,children:at(t)})]},e)}),h===`structure`?x.map((e,t)=>{let n=k.inner(t)-k.barW/2,r=k.y(0),i=k.y(e.miss),a=k.y(e.miss+e.hit),s=k.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:k.barW,height:r-i,fill:ot}),(0,o.jsx)(`rect`,{x:n,y:a,width:k.barW,height:i-a,fill:st}),(0,o.jsx)(`rect`,{x:n,y:s,width:k.barW,height:a-s,fill:ct})]},e.date)}):S.map((e,t)=>{let n=k.inner(t)-k.barW/2,r=0;return(0,o.jsx)(`g`,{children:C.map(t=>{let i=e.models[t.key];if(i===void 0)return null;let a=k.y(r);r+=i.total;let s=k.y(r),c=w!==null&&t.key!==w;return(0,o.jsx)(`rect`,{x:n,y:s,width:k.barW,height:a-s,fill:t.color,opacity:c?.15:1},t.key)})},e.date)}),k.indices.map(e=>{let t=x[e];return t===void 0?null:(0,o.jsx)(`text`,{x:k.inner(e),y:194,textAnchor:`middle`,className:F.chartAxisLabel,children:t.date.slice(5)},t.date)}),p!==null&&(0,o.jsx)(`line`,{x1:k.inner(p),x2:k.inner(p),y1:Z.top,y2:Z.top+k.plotH,className:F.chartCrosshair})]}),p!==null&&h===`structure`&&M!==void 0&&(0,o.jsxs)(`div`,{className:F.chartTooltip,"data-testid":`billing-token-tooltip`,style:{left:`${k.inner(p)/680*100}%`,top:`${k.y(M.miss+M.hit+M.output)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:F.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:F.chartTooltipDate,children:M.date}),(0,o.jsx)(`strong`,{children:(M.miss+M.hit+M.output).toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(F.chartTooltipRow,F.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:F.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:st}}),a(`tokenHit`)]}),(0,o.jsx)(`strong`,{children:M.hit.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(F.chartTooltipRow,F.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:F.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:ot}}),a(`tokenMiss`)]}),(0,o.jsx)(`strong`,{children:M.miss.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(F.chartTooltipRow,F.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:F.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:ct}}),a(`tokenOutput`)]}),(0,o.jsx)(`strong`,{children:M.output.toLocaleString()})]})]}),p!==null&&h===`model`&&N!==void 0&&(0,o.jsxs)(`div`,{className:F.chartTooltip,"data-testid":`billing-token-tooltip`,style:{left:`${k.inner(p)/680*100}%`,top:`${k.y(N.total)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:F.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:F.chartTooltipDate,children:N.date}),(0,o.jsx)(`strong`,{children:N.total.toLocaleString()})]}),C.map(e=>{let t=N.models[e.key];return t===void 0?null:(0,o.jsxs)(`div`,{className:F.chartTooltipModel,children:[(0,o.jsxs)(`div`,{className:d(F.chartTooltipRow,F.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:F.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,o.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:F.chartTooltipModelDetail,children:[a(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,a(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,a(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,o.jsx)(`div`,{className:F.chartLegend,children:h===`structure`?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:ot}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:st}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:ct}}),a(`tokenOutput`)]})]}):C.map(e=>(0,o.jsxs)(`button`,{type:`button`,className:d(F.chartLegendItem,w===e.key&&F.chartLegendItemActive),"aria-pressed":w===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{T(e.key)},children:[(0,o.jsx)(`span`,{className:F.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:F.panelHead,children:(0,o.jsx)(`h3`,{className:F.panelTitle,children:a(`tokenByModel`)})}),E.length===0?(0,o.jsx)(`div`,{className:F.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:F.tableScroll,children:(0,o.jsxs)(`table`,{className:F.modelTable,"data-testid":`billing-token-model-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`model`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:E.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:d(y&&F.modelRowFocusable,w===e.key&&F.modelRowActive),"aria-selected":y?w===e.key:void 0,onClick:y?()=>{T(e.key)}:void 0,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:F.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:F.numCol,children:J(e.input)}),(0,o.jsx)(`td`,{className:F.numCol,children:J(e.output)}),(0,o.jsx)(`td`,{className:F.numCol,children:e.reasoning>0?J(e.reasoning):(0,o.jsx)(`span`,{className:F.na,children:`—`})}),(0,o.jsxs)(`td`,{className:F.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:F.numCol,children:J(e.total)}),(0,o.jsx)(`td`,{className:F.numCol,children:(0,o.jsxs)(`span`,{className:F.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:F.tokenModelBar,children:(0,o.jsxs)(`span`,{className:F.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:F.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:F.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:F.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),O.totalCalls>0&&(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:F.panelHead,children:(0,o.jsx)(`h3`,{className:F.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:F.tableScroll,children:(0,o.jsxs)(`table`,{className:F.modelTable,"data-testid":`billing-tool-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`toolName`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:F.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...O.top,...O.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:F.modelName,children:e})}),(0,o.jsx)(`td`,{className:F.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:F.numCol,children:[(t/O.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),ee.length>0&&(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:F.panelHead,children:[(0,o.jsx)(`h3`,{className:F.panelTitle,children:a(`roleCost`)}),(0,o.jsx)(`span`,{className:F.panelHint,children:a(`roleHint`)})]}),(0,o.jsx)(`div`,{className:F.shareTrack,"data-testid":`billing-role-track`,children:ee.map(e=>(0,o.jsx)(`div`,{className:d(F.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:F.shareLegend,children:ee.map(e=>(0,o.jsxs)(`span`,{className:F.shareItem,children:[(0,o.jsx)(`span`,{className:d(F.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:F.shareValue,children:[s(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function dt(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(`
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function Nt(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 Pt(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)}let Ft=`usageBilling`,It={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,trend:`每日费用与调用趋势`,trend7d:`7 天`,trend30d:`30 天`,trendMetric:`趋势指标`,trendMetricCost:`费用`,trendMetricTokens:`Token`,trendEmpty:`暂无趋势数据`,budget:`本月预算`,budgetAmount:`预算金额`,budgetSummary:`本月已用 {used} / {total};达到 80% 时提醒,达到 100% 时红色脉冲警示`,sessions:`会话明细`,sessionTitle:`标题`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`提供商计费与订阅`,channelUnknown:`未知路由`,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:`内置`,promoBadge:`限时折扣`,promoUntil:`促销价至 {date},之后自动恢复刊例价`,promoOpenEnded:`厂商未公布截止时间,当前按折扣计价;公告截止后自动恢复刊例价`,pricingTip:`DeepSeek 自 2026-09-10 12:00(北京)起:flash 系谷档调价为未命中 ¥1 / 输出 ¥4 / 缓存命中 ¥0.02(峰 = 谷 × 2);V4 Pro 的请求同期起路由至 V4.1 Flash 并按 Flash 单价计费(V4.1 Pro 上线前)。峰谷分时自 2026-08-23 起:工作日高峰 9-12 / 14-18(×2),周末全天低谷价。双价单元格按峰 / 谷展示,费用按调用时刻计。`,pricingUnit:`单位:人民币 / 每百万 Token`,pricingNotes:`计价说明`,ubPeak:`峰`,ubOff:`谷`,ubStd:`标准`,peakBand:`峰谷分带`,pricingSource:`数据来源`,noteCache:`命中部分按缓存价计费,显著降低成本。`,noteBand:`高峰与空闲时段单价不同,空闲约半价。`,noteSource:`价格来自实时汇率 + 模型定价目录,未收录模型按 0 计并提示。`,balance:`余额`,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:`悬浮在左下角计费卡上的用量速览;综合=当前样式,订阅卡=每次展示一张订阅额度卡(可切换)。`,cardDisplay:`计费卡显示`,cardDisplayHint:`切换左下角计费卡的主指标:花费金额或 Token 消耗(副行与迷你柱同步切换,悬浮窗不受影响)。`,cardMetric:`主指标`,cardMetricMoney:`花费金额`,cardMetricTokens:`Token 消耗`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;模型可用下拉候选(目录键或模型 id);来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价(协议可省);低谷价三栏填后按峰/谷混合估算,留空=平档`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceOffPeak:`低谷价`,userPriceNormal:`标准价`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemoveSelected:`删除所选`,userPriceSelect:`选择此行`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabPricing:`费率`,tabSettings:`设置`,budgetHint:`设置月度上限,用于本月预计与超支分段提醒`,peakAlertHint:`在切档前弹窗提醒,可选同步系统通知`,peakAlertDescPeak:`即将进入高峰时段,价格将上调,请提前安排长任务`,peakAlertDescOff:`即将进入平价时段,价格减半,适合运行大批量任务`,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} 分钟后进入平价(价格减半)`,peakAlertTitlePeak:`即将进入高峰价`,peakAlertTitleOff:`即将进入平价`,peakAlert:`峰谷切换提醒`,peakAlertLeadMin:`提前量(分钟)`,peakAlertPos:`位置`,peakAlertMode:`提醒模式`,peakAlertPosCorner:`右下角`,peakAlertPosCenter:`屏幕居中`,peakAlertModePeak:`仅进入峰时`,peakAlertModeOff:`仅进入平价`,peakAlertModeBoth:`峰与谷都提醒`,peakAlertWebNotify:`同时发系统通知`,peakAlertPreview:`预览提醒`,planTypeCode:`订阅制`,planTypeToken:`按量`,subscriptionFeePerMonth:`{amount}/月`,triggerToday:`今日`,triggerMonth:`当月`,triggerMonthTokens:`当月 Token`,subscriptionIncluded:`订阅包含`,free:`免费`,perfSamples:`样本`,perfTtft:`首字延时`,perfP50:`P50`,perfP90:`P90`,perfTps:`生成速度`,perfLatency:`总延迟`,perfEstimated:`估算样本`,perfEmpty:`暂无性能数据`,perfTpsUnit:`tok/s`,perfTitle:`性能`,perfHint:`按模型与按小时聚合;估算样本为工具续写步骤`,perfAll:`全选`,perfChartEmpty:`未选择模型或该指标暂无数据`,heatmapYear:`年`,heatmapMonth:`月`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenCacheHitRate:`缓存命中率`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,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:`未识别`},Lt={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,liveTurn:`Turn`,liveSession:`Session`,calls:`Calls`,cacheHitRate:`Cache Hit`,tokens:`Tokens`,inputTokens:`Input`,outputTokens:`Output`,avgCost:`Avg cost`,trend:`Daily cost & calls`,trend7d:`7D`,trend30d:`30D`,trendMetric:`Trend metric`,trendMetricCost:`Cost`,trendMetricTokens:`Tokens`,trendEmpty:`No trend data yet`,budget:`Monthly budget`,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`,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`,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 from 2026-09-10 12:00 Beijing: flash off-peak now ¥1 miss / ¥4 output / ¥0.02 cache-hit (peak = 2×); V4 Pro requests route to V4.1 Flash at Flash rates until V4.1 Pro ships. Weekday peak 9-12 / 14-18 (×2), weekends all-day 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`,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).`,cardDisplay:`Billing card display`,cardDisplayHint:`Switch the main metric on the bottom-left billing card between cost and token usage (sub row and sparkline follow; the popover is unaffected).`,cardMetric:`Main metric`,cardMetricMoney:`Cost`,cardMetricTokens:`Token usage`,floatNoTargets:`No subscription selected — pick some in Settings.`,floatNoTargetsHint:`No subscription channel available.`,subscriptionsStale:`Subscription refresh failed — showing cached data`,staleLedgerNotice:`{count} sessions use legacy-algorithm archives (logs deleted); attribution may be off`,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`,heatmapLess:`Less`,heatmapMore:`More`,currency:`Currency`,currencyCny:`CNY`,currencyUsd:`USD`,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`,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`,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`,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`,triggerMonth:`This month`,triggerMonthTokens:`Monthly tokens`,subscriptionIncluded:`Included`,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`,heatmapMonth:`Month`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginAuthor:`Author`,pluginRepository:`Repository`,pluginNpm:`npm`,pluginLicense:`License`,tabToken:`Usage`,tokenExport:`Export tokens`,tokenExportCsv:`Daily token CSV`,tokenCacheHitRate:`Cache hit rate`,tokenReasoningShare:`Reasoning share`,tokenReasoningShort:`reasoning`,tokenIo:`In/out ratio`,tokenPeak:`Peak day`,tokenDaily:`Daily tokens`,tokenByModel:`Tokens by model`,tokenMiss:`Input (cache miss)`,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 after a reload)`,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`},Rt={"智谱 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 zt(e,t){return t===`en`?Rt[e]??e:e}let Bt={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},Vt={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function Ht(e){try{return new URL(e).host}catch{return e}}function Ut(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=Bt[n];return r===void 0?Ht(n):t===`en`?Vt[r]??r:r}if(e.startsWith(`direct:`)){let n=e.slice(7);return/^deepseek(?:-[a-z0-9-]+)?$/i.test(n)?t===`en`?`DeepSeek Official`:`DeepSeek 官方`:`${t===`en`?`Direct`:`直连`} · ${n}`}}let Wt={DeepSeek:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M35.7 9.9C35.3 9.8 35.2 10.1 35 10.2C34.9 10.3 34.9 10.4 34.8 10.4C34.3 10.9 33.7 11.3 33 11.2C31.9 11.2 30.9 11.5 30.1 12.4C29.9 11.3 29.3 10.7 28.4 10.3C28 10.1 27.5 9.9 27.1 9.4C26.9 9.1 26.9 8.8 26.7 8.4C26.7 8.2 26.6 8 26.4 7.9C26.1 7.9 26 8.1 25.9 8.3C25.5 9.1 25.3 9.9 25.3 10.8C25.3 12.7 26.2 14.2 27.8 15.3C27.9 15.4 28 15.5 27.9 15.7C27.8 16.1 27.7 16.5 27.6 16.8C27.5 17.1 27.4 17.1 27.1 17C26.3 16.7 25.5 16.1 24.8 15.4C23.7 14.3 22.7 13.1 21.4 12.2C21.1 12 20.8 11.7 20.4 11.5C19.1 10.3 20.6 9.2 21 9.1C21.3 9 21.1 8.5 19.9 8.5C18.8 8.5 17.7 8.9 16.3 9.4C16.1 9.5 15.9 9.6 15.7 9.6C14.5 9.4 13.2 9.3 11.9 9.5C9.4 9.8 7.4 11 5.9 13C4.1 15.4 3.7 18.2 4.2 21.1C4.7 24.1 6.3 26.6 8.7 28.6C11.2 30.7 14 31.7 17.3 31.5C19.2 31.4 21.4 31.1 23.9 29C24.6 29.3 25.2 29.4 26.3 29.5C27.1 29.6 27.9 29.5 28.6 29.3C29.6 29.1 29.5 28.2 29.1 28.1C26.3 26.7 26.9 27.3 26.3 26.8C27.8 25.1 30 23.3 30.8 17.5C30.9 17 30.8 16.7 30.8 16.4C30.8 16.1 30.9 16.1 31.1 16C31.9 15.9 32.6 15.7 33.2 15.4C35.1 14.4 35.8 12.7 36 10.7C36 10.4 36 10.1 35.7 9.9ZM19.4 27.9C16.7 25.8 15.3 25 14.7 25.1C14.2 25.1 14.3 25.7 14.4 26.1C14.6 26.5 14.7 26.7 14.9 27.1C15.1 27.3 15.2 27.6 14.8 27.9C13.9 28.4 12.3 27.7 12.2 27.6C10.4 26.6 8.9 25.2 7.8 23.2C6.8 21.4 6.2 19.4 6.1 17.3C6.1 16.7 6.2 16.6 6.8 16.5C7.4 16.3 8.1 16.3 8.8 16.4C11.6 16.8 14.1 18.1 16.1 20.1C17.2 21.3 18.1 22.6 19 24C20 25.4 21 26.8 22.3 27.9C22.8 28.2 23.2 28.5 23.5 28.8C22.4 28.9 20.7 28.9 19.4 27.9ZM20.8 19.4C20.8 19.3 20.8 19.2 20.8 19.2C20.9 19.1 20.9 19.1 21 19C21 19 21.1 19 21.1 19C21.2 18.9 21.3 19 21.3 19C21.4 19 21.5 19.1 21.5 19.1C21.6 19.2 21.6 19.3 21.6 19.4C21.6 19.4 21.6 19.5 21.6 19.5C21.5 19.6 21.5 19.6 21.5 19.6C21.4 19.7 21.4 19.7 21.3 19.7C21.3 19.8 21.2 19.8 21.2 19.8C21.1 19.8 21.1 19.8 21 19.7C21 19.7 20.9 19.7 20.9 19.6C20.9 19.6 20.8 19.6 20.8 19.5C20.8 19.5 20.8 19.4 20.8 19.4ZM24.9 21.5C24.7 21.6 24.4 21.7 24.1 21.7C23.8 21.7 23.4 21.6 23.1 21.4C22.7 21.1 22.4 20.9 22.3 20.3C22.3 20.1 22.3 19.8 22.4 19.6C22.4 19.1 22.3 18.8 22 18.6C21.8 18.4 21.5 18.3 21.1 18.3C21 18.3 20.9 18.3 20.8 18.2C20.6 18.2 20.5 18 20.6 17.7C20.7 17.7 20.8 17.5 20.9 17.5C21.4 17.2 21.9 17.3 22.4 17.5C22.9 17.7 23.2 18 23.7 18.5C24.3 19.1 24.4 19.3 24.7 19.8C24.9 20.1 25.1 20.5 25.3 20.9C25.3 21.1 25.2 21.4 24.9 21.5Z' fill='currentColor'/%3E%3C/svg%3E`,OpenAI:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M32.8 17.3C33.2 16.3 33.3 15.2 33.2 14.2C33.1 13.2 32.7 12.1 32.3 11.2C31.4 9.8 30.2 8.7 28.8 8C27.3 7.3 25.7 7.2 24.1 7.5C23.4 6.8 22.5 6.1 21.6 5.7C20.7 5.2 19.5 5 18.5 5C16.9 5 15.3 5.5 14 6.4C12.7 7.3 11.7 8.7 11.3 10.2C10.2 10.4 9.2 10.9 8.3 11.5C7.4 12.1 6.8 13 6.2 13.8C5.4 15.2 5.1 16.8 5.3 18.4C5.5 20 6.1 21.5 7.2 22.7C6.8 23.7 6.7 24.8 6.8 25.8C6.9 26.8 7.2 27.9 7.7 28.8C8.6 30.2 9.8 31.3 11.2 32C12.7 32.7 14.3 32.8 15.9 32.5C16.6 33.2 17.5 33.9 18.4 34.3C19.3 34.8 20.5 35 21.5 35C23.1 35 24.7 34.5 26 33.6C27.3 32.7 28.2 31.3 28.7 29.8C29.8 29.6 30.8 29.2 31.6 28.5C32.5 27.9 33.2 27.1 33.7 26.2C34.5 24.8 34.8 23.2 34.6 21.6C34.4 20 33.9 18.5 32.8 17.3ZM21.6 33C20.1 33 19 32.6 17.9 31.7C17.9 31.7 18 31.6 18.1 31.6L24.1 28.2C24.3 28.1 24.4 27.9 24.5 27.8C24.6 27.6 24.6 27.5 24.6 27.3V18.9L27.1 20.4V27.3C27.1 28.1 27 28.8 26.8 29.5C26.5 30.2 26.1 30.8 25.6 31.3C25.1 31.9 24.4 32.3 23.7 32.6C23.1 32.9 22.3 33 21.6 33ZM9.5 27.9C8.8 26.7 8.6 25.4 8.8 24.1C8.8 24.1 8.9 24.2 9 24.2L15 27.7C15.2 27.8 15.3 27.8 15.5 27.8C15.7 27.8 15.9 27.8 16 27.7L23.3 23.5V26.4L17.2 29.9C16.6 30.3 15.9 30.5 15.1 30.6C14.4 30.7 13.7 30.7 13 30.5C11.5 30.1 10.2 29.2 9.5 27.9ZM7.9 14.8C8.6 13.7 9.6 12.9 10.8 12.4V19.5C10.8 19.7 10.8 19.9 10.9 20C11 20.2 11.1 20.3 11.3 20.4L18.6 24.6L16.1 26.1L10.1 22.6C9.4 22.3 8.9 21.8 8.4 21.2C8 20.6 7.6 20 7.4 19.3C7.1 17.8 7.2 16.2 7.9 14.8ZM28.6 19.6L21.3 15.4L23.8 13.9L29.8 17.4C30.8 17.9 31.5 18.7 32 19.6C32.5 20.6 32.7 21.6 32.7 22.7C32.6 23.8 32.2 24.8 31.5 25.6C30.9 26.5 30 27.1 29 27.5V20.4C29 20.2 29 20 28.9 19.9C28.9 19.9 28.8 19.7 28.6 19.6ZM31.2 15.9C31.2 15.9 31.1 15.8 31 15.8L25 12.3C24.8 12.2 24.7 12.2 24.5 12.2C24.3 12.2 24.1 12.2 24 12.3L16.7 16.5V13.6L22.8 10.1C23.7 9.5 24.8 9.3 25.9 9.3C26.9 9.3 28 9.7 28.9 10.3C29.7 11 30.5 11.8 30.9 12.8C31.2 13.7 31.3 14.8 31.2 15.9ZM15.4 21.1L12.9 19.6V12.6C12.9 11.6 13.2 10.4 13.7 9.6C14.3 8.7 15.1 8 16.1 7.5C17 7.1 18.1 6.9 19.2 7.1C20.2 7.2 21.2 7.6 22.1 8.3C22.1 8.3 22 8.4 21.9 8.4L15.9 11.8C15.7 11.9 15.6 12.1 15.5 12.2C15.4 12.4 15.4 12.5 15.4 12.7V21.1ZM16.7 18.1L20 16.3L23.3 18.1V21.9L20 23.8L16.7 21.9V18.1Z' fill='currentColor'/%3E%3C/svg%3E`,Google:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M37 20C27.9 20.6 20.6 27.9 20 37H20C19.4 27.9 12.1 20.6 3 20V20C12.1 19.4 19.4 12.1 20 3H20C20.6 12.1 27.9 19.4 37 20V20Z' fill='currentColor'/%3E%3C/svg%3E`,"智谱 AI":`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.1 7.5L17.4 11.2H5.8L8.5 7.5H20.1H20.1ZM34.1 28.8L31.3 32.5H19.8L22.5 28.8H34.1ZM35 7.5L16.6 32.5H5L23.4 7.5H35Z' fill='currentColor'/%3E%3C/svg%3E`,腾讯混元:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.1 25.2C19.6 26.8 21.1 28.1 22.7 29.2L21.5 30.8C19.9 29.7 18.3 28.3 16.7 26.6C17.1 26.1 17.6 25.7 18.1 25.2ZM10 2.7C11.8 1.7 13.8 2.2 15.6 3.3C17.5 4.4 19.5 6.2 21.3 8.3L19.7 9.6C18 7.6 16.2 6 14.6 5.1C13 4.1 11.8 4 11 4.5C10 5 9.4 6.5 9.8 9.2C9.9 9.8 10 10.4 10.2 11.1C11.6 10.9 13.1 10.9 14.6 10.9C17.7 10.9 20.5 11.2 22.8 11.7L22.8 11.7C23.2 11.8 23.6 11.9 24 12C24 12 24 12 24 12C24.7 12.2 25.3 12.4 25.9 12.6C28.6 13.7 30.6 15.5 30.6 17.9C30.6 19.9 29.1 21.4 27.3 22.5C25.4 23.6 22.9 24.3 20.1 24.8L19.8 22.9C22.4 22.4 24.7 21.7 26.3 20.8C27.9 19.8 28.6 18.8 28.6 17.9C28.6 16.8 27.7 15.5 25.1 14.5C24.6 14.3 23.9 14 23.2 13.8C22.7 15.1 22 16.4 21.3 17.7C18.9 21.7 16.4 24.8 14.1 26.6C11.8 28.4 9.2 29.3 7.2 28.1C5.4 27 4.8 25 4.8 22.9C4.9 20.7 5.5 18.1 6.4 15.5L8.3 16.2C7.4 18.7 6.9 21 6.8 22.9C6.8 24.8 7.4 25.8 8.2 26.3C9.1 26.9 10.7 26.7 12.8 25C13.3 24.7 13.8 24.2 14.3 23.7C13.4 22.6 12.6 21.4 11.9 20.1C9.6 16.1 8.2 12.4 7.8 9.4C7.4 6.5 7.9 3.9 10 2.7ZM14.6 12.9C13.3 12.9 12 12.9 10.8 13.1C11.4 14.9 12.4 16.9 13.6 19.1C14.3 20.2 15 21.3 15.7 22.3C17 20.8 18.3 18.9 19.5 16.7C20.2 15.6 20.7 14.5 21.2 13.4C19.3 13.1 17.1 12.9 14.6 12.9ZM6.2 11.8C6.4 12.5 6.6 13.1 6.8 13.8C4.9 14.2 3.1 14.8 1.5 15.5L0.7 13.7C2.3 13 4.2 12.3 6.2 11.8ZM24.9 3.6L25.9 3.7C25.7 5.7 25.3 7.8 24.6 10.1C24.2 9.9 23.7 9.8 23.2 9.7C23 9.7 22.8 9.7 22.7 9.6C23.3 7.5 23.7 5.4 23.9 3.5L24.9 3.6Z' fill='currentColor'/%3E%3C/svg%3E`,MiniMax:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.9 9.2C17.9 8.6 17.4 8.1 16.8 8.1C16.2 8.1 15.7 8.6 15.7 9.2V27.6C15.7 29.1 14.5 30.2 13.1 30.2C11.7 30.2 10.5 29.1 10.5 27.6V15.8C10.5 15.2 10 14.7 9.4 14.7C8.8 14.7 8.3 15.2 8.3 15.8V20.8C8.3 22.3 7.1 23.4 5.7 23.4C4.3 23.4 3.1 22.3 3.1 20.8V19C3.1 18.6 3.4 18.3 3.8 18.3C4.3 18.3 4.6 18.6 4.6 19V20.8C4.6 21.4 5.1 21.9 5.7 21.9C6.3 21.9 6.8 21.4 6.8 20.8V15.8C6.8 14.4 8 13.2 9.4 13.2C10.8 13.2 12 14.4 12 15.8V27.6C12 28.3 12.5 28.8 13.1 28.8C13.7 28.8 14.2 28.3 14.2 27.6V20.4V9.2C14.2 7.8 15.3 6.6 16.8 6.6C18.2 6.6 19.3 7.8 19.3 9.2V24.5C19.3 24.9 19 25.2 18.6 25.2C18.2 25.2 17.9 24.9 17.9 24.5V9.2ZM31.5 13.2C30.1 13.2 28.9 14.4 28.9 15.8V25.7C28.9 26.3 28.5 26.8 27.8 26.8C27.2 26.8 26.7 26.3 26.7 25.7V9.2C26.7 7.8 25.6 6.6 24.1 6.6C22.7 6.6 21.6 7.8 21.6 9.2V30.1C21.6 30.8 21.1 31.3 20.5 31.3C19.8 31.3 19.3 30.8 19.3 30.1V27.5C19.3 27.1 19 26.8 18.6 26.8C18.2 26.8 17.9 27.1 17.9 27.5V30.1C17.9 31.6 19 32.7 20.5 32.7C21.9 32.7 23 31.6 23 30.1V9.2C23 8.6 23.5 8.1 24.1 8.1C24.8 8.1 25.3 8.6 25.3 9.2V25.7C25.3 27.1 26.4 28.3 27.8 28.3C29.3 28.3 30.4 27.1 30.4 25.7V15.8C30.4 15.2 30.9 14.7 31.5 14.7C32.1 14.7 32.6 15.2 32.6 15.8V24.5C32.6 24.9 33 25.2 33.4 25.2C33.8 25.2 34.1 24.9 34.1 24.5V15.8C34.1 14.4 33 13.2 31.5 13.2Z' fill='currentColor'/%3E%3C/svg%3E`,阿里通义:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M38 23C33.8 25.3 29.6 27.4 24.9 28.3C23.8 28.5 22.6 28.5 21.6 28.4C20.6 28.2 20.1 27.3 20.4 26.4C20.8 25.5 21.2 24.6 21.8 23.9C23.1 22.3 24.5 20.8 25.8 19.3C26.6 18.3 27.3 17.3 28 16.2C28.4 15.4 28.2 14.5 27.4 14.1C26.1 13.5 24.6 13 23.2 12.5C23 12.4 22.8 12.6 22.5 12.7C22.9 13.1 23.2 13.4 23.6 13.7C19.3 14.4 15.3 15.5 11.4 16.9C11.4 17 11.4 17 11.4 17C12 17.9 11.7 18.6 10.9 19.1C10.6 19.4 10.3 19.6 10 19.9C12.6 20.7 14.9 20.2 17.1 18.8C16.9 18.6 16.8 18.5 16.7 18.3C17.5 18.4 18 18.9 18 19.6C18.1 19.7 18 19.9 17.9 20C17.8 19.9 17.6 19.8 17.5 19.6C17.5 19.5 17.5 19.4 17.4 19.3C14.8 21 12 21.4 9 20.5C9 21.1 8.9 21.6 9 22.1C9 22.6 8.8 22.8 8.4 23C7.6 23.5 6.6 24.1 5.9 24.8C5 25.7 5.3 26.8 6.5 27.2C7.9 27.7 9.3 27.7 10.8 27.6C12.4 27.3 14.1 27.1 15.9 26.8C13.8 27.8 11.7 28.5 9.4 28.8C7.9 29 6.3 29.1 4.8 28.7C2.6 28.1 1.6 26.4 2.2 24.3C2.7 22.2 4 20.6 5.4 19.1C10.1 14.1 16.1 11.5 23 11C24.6 10.9 26.2 11.1 27.7 11.8C29.8 12.8 30.7 14.8 29.7 16.8C29 18.2 28.1 19.4 27.1 20.7C26.2 21.9 25.2 23 24.2 24.2C23.9 24.5 23.7 24.9 23.5 25.3C23.1 26 23.3 26.5 24.2 26.4C26 26.3 27.9 26.1 29.6 25.7C32.2 25 34.7 24.1 37.3 23.3C37.5 23.2 37.8 23.1 38 23V23Z' fill='currentColor'/%3E%3C/svg%3E`,小米:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.4 5C13.6 5.2 11.4 5.8 9.5 7.1C8.1 8 7.1 9.1 6.4 10.7C5.6 12.4 5.2 14.3 5.1 17.7C4.9 21.6 5.2 25.5 5.8 27.5C6.3 29.4 7.1 30.8 8.4 32C10 33.5 11.7 34.3 14.5 34.7C17 35 22.8 35.1 25.3 34.7C28.4 34.3 30.4 33.4 32 31.7C32.8 30.9 33.2 30.4 33.7 29.3C34.5 27.6 34.8 25.8 35 22.2C35.1 19.7 35 16.1 34.7 14.4C34.1 10.5 32.5 7.9 29.5 6.4C28 5.6 25.7 5.2 22.5 5C20.1 4.9 19.8 4.9 17.4 5ZM21.1 14.4C22.4 14.7 23 15.1 23.4 16C23.9 17 24 17.7 24 21.9V25.8L22.5 25.8L21.1 25.7L21 21.9C21 17.8 21 17.6 20.4 17.2C19.9 16.8 19.4 16.7 16.6 16.7H13.9L13.8 21.2L13.8 25.7H11L10.9 20C10.9 15.5 10.9 14.3 11 14.2C11.1 14.2 13.2 14.2 15.8 14.2C19.5 14.2 20.5 14.3 21.1 14.4ZM28.9 14.3C29 14.5 29 25.4 29 25.7C29 25.8 28.3 25.8 27.5 25.8L26.1 25.7L26.1 20.1C26.1 16 26.1 14.4 26.2 14.3C26.3 14.2 26.6 14.2 27.6 14.2C28.7 14.2 28.9 14.2 28.9 14.3ZM18.9 22.2V25.8L17.5 25.8L16 25.7L15.9 22.3C15.9 20.5 15.9 18.9 16 18.8C16 18.7 16.4 18.7 17.5 18.7H18.9V22.2Z' fill='currentColor'/%3E%3C/svg%3E`,字节豆包:`data:image/svg+xml,%3Csvg fill='currentColor' fill-rule='evenodd' height='1em' style='flex:none;line-height:1' viewBox='0 0 24 24' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.3 5.4L3.1 21.7a.215.2 0 0.2.261h8.3a.214.2 0 0.2-.261L7.7 5.4a.214.2 0 00-.41 0z' fill-opacity='.5'%3E%3C/path%3E%3Cpath clip-rule='evenodd' d='M4.6 16.2l-1.4 5.6a.214.2 0 0.2.261h2.4-4.6a.214.2 0 01-.214-.26l2.3-9a.214.2 0 1.4 0l.864 3.4z'%3E%3C/path%3E%3Cpath d='M14.4.15a.214.2 0 00-.41 0L8.4 21.7a.214.2 0 0.2.261H19.9a.214.2 0 0.2-.261L14.4.151z' fill-opacity='.5'%3E%3C/path%3E%3Cpath clip-rule='evenodd' d='M16.7 22h3.2a.215.2 0 0.2-.262l-1.8-7 1.2-4.6a.214.2 0 1.4 0l3 11.6a.214.2 0 01-.214.3h-5.9z'%3E%3C/path%3E%3Cpath d='M10.3 7.7L6.7 21.7a.214.2 0 0.2.264h7.2a.216.2 0 0.2-.166.2.216 0 000-.098L10.7 7.7a.214.2 0 00-.409 0z'%3E%3C/path%3E%3C/svg%3E`,月之暗面:`data:image/svg+xml,%3Csvg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M26 4a16 16 0 1 0 10 28A18 18 0 0 1 26 4z' fill='currentColor'/%3E%3C/svg%3E`};function Gt(e){return Wt[e]}let Kt=`dsh-billing-peak-alert-v1`,qt={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function Jt(){try{let e=localStorage.getItem(Kt);if(e===null)return{...qt};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:qt.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))):qt.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...qt}}}function Yt(e){try{localStorage.setItem(Kt,JSON.stringify(e))}catch{}}function Xt(e,t,n){if(!t.enabled)return null;let r=Se(e,t.leadMin*6e4);return r===null||t.mode===`peak`&&r.entering!==`peak`||t.mode===`offPeak`&&r.entering!==`offPeak`||r.atMs===n?null:r}function Zt({hit:e,config:t,t:n,onDismiss:i}){let[a,s]=(0,r.useState)(()=>Date.now());if((0,r.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,r.useEffect)(()=>{a>=e.atMs&&i()},[a,e.atMs,i]),a>=e.atMs)return null;let c=Math.max(1,Math.round((e.atMs-a)/6e4)),l=e.entering,u=n(l===`peak`?`tierPeak`:`tierOff`),f=n(l===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),p=l===`peak`;return(0,o.jsxs)(`div`,{className:d(F.peakCard,p?F.peakCardPeak:F.peakCardOff,t.position===`center`?F.peakCardCenter:F.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:F.peakHead,children:[(0,o.jsxs)(`span`,{className:d(F.peakTag,p?F.peakTagPrimary:F.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:d(F.peakDot,p?F.peakDotPrimary:F.peakDotSuccess),"aria-hidden":`true`}),u]}),(0,o.jsx)(`button`,{type:`button`,className:F.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:d(F.peakCount,p?F.peakCountPrimary:F.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:F.peakDesc,children:f})]})}let Qt=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],$t=[50,80,100],en={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},tn={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`]};function Q(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function nn(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 rn(e,t){let n=Q(e),r=Q(t);if(nn(n,r))return!0;let i=tn[e];return i!==void 0&&i.some(e=>nn(Q(e),r))}function an(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(tn))for(let r of n){let n=Q(r);if(n.length!==0&&(t===n||t.startsWith(`${n}-`)||t.startsWith(`${n}/`)||t.startsWith(`${n}_`)||t.includes(`${n}-`)||t.includes(`${n}/`)||t.includes(`${n}_`)))return e}for(let[e,t]of Object.entries(tn))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let on={"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 sn(e){let t=on[e];return t===void 0?an(e)??e:t}function cn(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 ln(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:cn(e,n);return o<=0?0:o*a}function un(e){let t=de();if(t===void 0||e.byDayModels===void 0)return e;let n=ve().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||G(t.key)===G(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)*ye+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=pe(i)??B(i),s=r&&c(i),f;if((n!==void 0||s)&&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:pe(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=>!pe(e)&&!B(e))}}function dn(){return typeof Notification<`u`&&Notification.permission===`granted`}let fn=new Set;function pn(e,t){fn.has(e)||(fn.add(e),fetch(`/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 mn(e){return Object.keys(e).length}function hn(e,t=Date.now()){let n=0,r=new Date(t);for(;$(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function gn(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=$(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function _n(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[$(i.getTime())];o!==void 0&&(a+=n(o))}return a}function vn(e,t){return e.checked?e.okProviders.some(e=>rn(t,e))?F.healthOk:e.badProviders.some(e=>rn(t,e))?F.healthBad:F.healthIdle:F.healthIdle}function yn(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 bn(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 xn(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 Sn(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let Cn={"new-api":F.siteKindSite,sub2api:F.siteKindDirect,unknown:F.siteKindUnknown},wn=3e4;function $(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 Tn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let En=[`#3b82f6`,`#06b6d4`,`#8b5cf6`,`#f59e0b`,`#10b981`,`#ef4444`,`#ec4899`,`#6366f1`,`#f97316`,`#14b8a6`],Dn={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function On(){try{let e=await fetch(`/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??Dn.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},...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.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}}let kn=!1;async function An(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){kn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){kn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(kn)return;kn=!0}setTimeout(()=>{An(e+1)},2e3);return}kn=!1,he(i)}catch{kn=!1}}async function jn(){try{let e=await fetch(`/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}}}catch{return{balances:[]}}}async function Mn(){let e=await fetch(`/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)return n.quotas;throw Error(`subscriptions: invalid response`)}async function Nn(){let e=await fetch(`/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 Pn(){try{let e=await fetch(`/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 Fn(e){try{let t=await fetch(`/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 In=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function Ln(e){let{wide:t,t:n,onOpen:a,monthCost:s,todayCost:c,weekCost:l,days:u,vendorStatus:f,dash:p,floatPrefs:m,subscriptions:h,cardPrefs:g,monthTokens:_,todayTokens:v,weekTokens:y}=e,b=(0,r.useMemo)(()=>m.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[m.targets,h]),[ee,x]=(0,r.useState)(0),S=b.length===0?0:Math.min(ee,b.length-1),C=b[S];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||b.length<2)return;let e=setInterval(()=>x(e=>(e+1)%b.length),1500);return()=>clearInterval(e)},[m.mode,b.length]);let w=(0,r.useRef)(null),[T,E]=(0,r.useState)(!1),[D,O]=(0,r.useState)({left:0,top:0,width:0}),k=(0,r.useRef)(void 0),A=(0,r.useCallback)(()=>{window.clearTimeout(k.current),E(!0)},[]),j=(0,r.useCallback)(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>E(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(k.current),[]);let M=(0,r.useCallback)(()=>{let e=w.current?.getBoundingClientRect();e!==void 0&&O({left:e.left,top:e.top-8,width:e.width})},[]);(0,r.useEffect)(()=>{if(!T)return;let e=()=>M();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[T,M]);let N=(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M4 7h16v11H4z`}),(0,o.jsx)(`path`,{d:`M4 10h16`}),(0,o.jsx)(`path`,{d:`M8 14h3`})]});if(!t)return(0,o.jsx)(`button`,{type:`button`,className:F.railButton,"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${q(s)}`,children:N});let te=g.metric===`tokens`,P=u.map(e=>te?e.tokens:e.cost),ne=Math.max(...P,0),I=P.map(e=>ne>0?4+e/ne*12:4);return(0,o.jsxs)(`span`,{ref:w,className:F.triggerWrap,onMouseEnter:()=>{M(),A()},onMouseLeave:j,onFocusCapture:()=>{M(),A()},onBlurCapture:()=>E(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:F.trigger,"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${q(s)}`,children:[(0,o.jsx)(`span`,{className:F.triggerIcon,"data-testid":`billing-trigger-icon`,children:N}),(0,o.jsxs)(`span`,{className:F.triggerMain,children:[(0,o.jsxs)(`span`,{className:F.triggerPrimary,children:[(0,o.jsx)(`span`,{className:F.triggerLabel,children:n(te?`triggerMonthTokens`:`triggerMonth`)}),te?(0,o.jsx)(`span`,{className:F.triggerMetric,"data-testid":`billing-trigger-month-tokens`,children:J(_)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:F.triggerYen,"aria-hidden":`true`,children:q(s).charAt(0)}),(0,o.jsx)(`span`,{className:F.triggerMetric,children:q(s).slice(1)})]})]}),(0,o.jsx)(`span`,{className:F.triggerSub,"data-testid":`billing-trigger-today`,children:te?`${n(`triggerToday`)} ${J(v)} · ${n(`weekCost`)} ${J(y)}`:`${n(`triggerToday`)} ${q(c)} · ${n(`weekCost`)} ${q(l)}`})]}),(0,o.jsx)(`span`,{className:F.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:I.map((e,t)=>(0,o.jsx)(`span`,{className:t===I.length-1?F.triggerSparkHot:F.triggerSparkBar,style:{height:`${e}px`}},u[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:d(F.triggerPop,T&&F.triggerPopShown,m.mode===`subscription`&&F.triggerPopSubscription),style:{left:`${D.left}px`,top:`${D.top}px`,width:`${D.width}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!T,onMouseEnter:A,onMouseLeave:j,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:b.length===0?(0,o.jsx)(`span`,{className:F.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[C!==void 0&&(0,o.jsxs)(`div`,{className:F.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:F.floatSubHead,children:[(0,o.jsx)(`span`,{className:F.floatSubName,children:C.displayName}),C.plan!==void 0&&(0,o.jsx)(`span`,{className:F.floatSubPlan,children:C.plan})]}),C.windows.map(e=>(()=>{let t=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:F.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:F.subscriptionWindowLabel,children:xn(e.kind,n)}),(0,o.jsx)(`span`,{className:F.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(F.subscriptionFill,t>=100&&F.subscriptionFillOver,t>=80&&t<100&&F.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:F.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(F.subscriptionPct,r&&F.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:F.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${Tn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),b.length>1&&(0,o.jsx)(`span`,{className:F.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:F.triggerPopSwitchCount,children:[S+1,`/`,b.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:F.popHead,children:(0,o.jsx)(`span`,{className:F.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:F.metricGrid,children:[(0,o.jsxs)(`span`,{className:F.metricCell,children:[(0,o.jsx)(`span`,{className:F.metricLabel,children:n(`monthCost`)}),(0,o.jsx)(`span`,{className:d(F.metricValue,F.metricValuePrimary),children:q(s)})]}),(0,o.jsxs)(`span`,{className:F.metricCell,children:[(0,o.jsx)(`span`,{className:F.metricLabel,children:n(`tokenTotal`)}),(0,o.jsx)(`span`,{className:F.metricValue,children:J(p.totalToken)})]}),(0,o.jsxs)(`span`,{className:F.metricCell,children:[(0,o.jsx)(`span`,{className:F.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:F.metricValue,children:J(p.input)})]}),(0,o.jsxs)(`span`,{className:F.metricCell,children:[(0,o.jsx)(`span`,{className:F.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:F.metricValue,children:J(p.output)})]}),(0,o.jsxs)(`span`,{className:F.metricCell,children:[(0,o.jsx)(`span`,{className:F.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:d(F.metricValue,F.metricValueSuccess),children:J(p.cacheRead)})]}),(0,o.jsxs)(`span`,{className:F.metricCell,children:[(0,o.jsx)(`span`,{className:F.metricLabel,children:n(`calls`)}),(0,o.jsx)(`span`,{className:F.metricValue,children:p.calls.toLocaleString()})]})]}),(0,o.jsxs)(`span`,{className:F.popModel,children:[(0,o.jsx)(`span`,{className:F.popModelLabel,children:n(`popTodayModel`)}),f.direct!==void 0||f.sub!==void 0?(0,o.jsxs)(o.Fragment,{children:[f.direct!==void 0&&(0,o.jsxs)(`span`,{className:F.popModelRow,children:[(0,o.jsx)(`span`,{className:d(F.popDot,F.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:F.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:F.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:d(F.popModelStatus,f.direct.low&&F.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:F.popModelRow,children:[(0,o.jsx)(`span`,{className:d(F.popDot,F.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:F.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:F.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:d(F.popModelStatus,f.sub.low&&F.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:F.popModelRow,children:[(0,o.jsx)(`span`,{className:d(F.popDot,F.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:F.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function Rn({balance:e,days:t,dailyBurn:n,money:r,t:i,onClose:a}){let s=t=>t===void 0?void 0:e.currency===`USD`?`$${t.toFixed(2)}`:r(t),c=s(e.totalBalance),l=s(e.grantedBalance),u=s(e.toppedUpBalance);return(0,o.jsxs)(`span`,{className:F.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:F.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:F.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:F.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:F.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(zn,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(zn,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(zn,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(zn,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(zn,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function zn({label:e,value:t}){return(0,o.jsxs)(`span`,{className:F.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:F.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:F.balanceDetailValue,children:t})]})}function Bn({userPrices:e,onUserPrices:t,t:n}){let[i,a]=(0,r.useState)(()=>[...e]),[s,c]=(0,r.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),u=()=>{a(e=>e.filter((e,t)=>!s.has(t))),c(new Set)},f=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),p=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),m=e=>{let t=i[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},h=(e,t,n)=>a(r=>r.map((r,i)=>{if(i!==e)return r;let a={...m(e),[t]:n},o=[a.input,a.cacheHit,a.output].some(e=>e.trim()!==``),s=[a.input,a.cacheHit,a.output].map(e=>Number(e)),c=o&&s.every(e=>Number.isFinite(e)&&e>=0)&&s.some(e=>e>0),{offPeak:l,...u}=r;return c?{...u,offPeak:{input:s[0]??0,cacheHit:s[1]??0,output:s[2]??0}}:u})),g=()=>t(i.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:ce(e.origin.trim())}}))),_=Ie().map(e=>e.key),v=(e,t)=>a(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),y=e=>Number.isFinite(e)&&e!==0?String(e):``,b=(e,t,n)=>{let r=Number(n);f(e,{[t]:Number.isFinite(r)&&r>=0?r:0})};return(0,o.jsxs)(`section`,{className:F.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:F.setCardHead,children:(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:F.ctlCol,children:[(0,o.jsx)(`datalist`,{id:`billing-price-model-keys`,children:_.map(e=>(0,o.jsx)(`option`,{value:e},e))}),i.map((e,t)=>(0,o.jsxs)(`div`,{className:F.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsx)(`input`,{type:`checkbox`,className:F.userPriceCheck,"data-testid":`billing-user-price-select`,checked:s.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>l(t)}),(0,o.jsxs)(`div`,{className:F.userPriceBody,children:[(0,o.jsxs)(`div`,{className:F.userPriceLineMeta,children:[(0,o.jsxs)(`div`,{className:F.userPriceField,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:F.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=>f(t,{key:e.target.value})})]}),(0,o.jsxs)(`div`,{className:F.userPriceField,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:F.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>f(t,{origin:e.target.value.trim()})})]}),(0,o.jsxs)(`div`,{className:F.userPriceField,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:F.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:d(F.floatModeBtn,e.currency!==`USD`&&F.floatModeBtnOn),onClick:()=>v(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:d(F.floatModeBtn,e.currency===`USD`&&F.floatModeBtnOn),onClick:()=>v(t,`USD`),children:`USD`})]})]})]}),(0,o.jsxs)(`div`,{className:F.userPricePriceLine,"data-testid":`billing-user-price-normal`,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:n(`userPriceNormal`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:F.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceNormal`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:y(e[r]),onChange:e=>b(t,r,e.target.value)},r))]}),(()=>{let e=m(t);return(0,o.jsxs)(`div`,{className:F.userPricePriceLine,"data-testid":`billing-user-price-offpeak`,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:n(`userPriceOffPeak`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:F.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceOffPeak`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:e[r],onChange:e=>h(t,r,e.target.value)},r))]})})()]})]},t)),(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-user-price-add`,onClick:p,children:n(`userPriceAdd`)}),(0,o.jsxs)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:s.size===0,onClick:u,children:[n(`userPriceRemoveSelected`),s.size>0?` (${s.size})`:``]}),(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-user-price-save`,onClick:g,children:n(`userPriceSave`)})]})]})]})}function Vn({stats:e,t,onClose:n,userPrices:i,onUserPrices:s,health:c,balances:l,reconcile:u,quotas:f,relayQuotas:p,currency:m,onCurrency:h,turns:g,renderSlot:_,budgetEnabled:v,budgetAmount:y,onToggleBudget:b,onBudgetAmount:ee,peakConfig:x,onPeakConfig:S,onPreviewPeak:C,floatPrefs:w,onFloatPrefs:T,cardPrefs:E,onCardPrefs:D,sitePrefs:O,onSitePrefs:k,liveCostPrefs:A,onLiveCostPrefs:j,quotasStale:M}){let[N,te]=(0,r.useState)(`cost`),{total:P,byModel:ne,byDay:I}=e,[L,ie]=(0,r.useState)(`overview`),[R,ae]=(0,r.useState)(7),[oe,se]=(0,r.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),z=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},ce=(0,r.useCallback)(()=>{let e=z();se(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[le,ue]=(0,r.useState)(`month`),de=(0,r.useMemo)(()=>f.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[f]),[fe,pe]=(0,r.useState)(),[me,B]=(0,r.useState)(new Set),he=(0,r.useCallback)(e=>{B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[ge,_e]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return Pn().then(t=>{e&&t!==void 0&&_e(t)}),()=>{e=!1}},[]);let ye=(0,r.useCallback)(()=>{let e=!ge;_e(e),Fn(e).then(t=>{t||_e(!e)})},[ge]),V=ve(),H=e=>q(m===`usd`?Be(e):e,m),be=m===`usd`?`en`:`zh`,U=e=>zt(e,be),W=(e,n)=>e===0?t(`free`):Ve(He(e,n,m,V.rate),m===`usd`?`USD`:`CNY`),xe=(0,r.useMemo)(()=>Tt([...g].reverse()),[g]),Se={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},Ce=Se.peak/2,we=cn(I,$()),Te=e=>l.find(t=>Q(t.provider)===Q(e)),Ee=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),De=e=>{if(e===void 0)return(0,o.jsx)(`span`,{className:F.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,o.jsx)(`span`,{className:F.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:H(e.totalBalance),r=e.currency===`USD`?e.totalBalance*V.rate:e.totalBalance,i=we>0?Math.floor(r/we):void 0;return(0,o.jsxs)(`span`,{className:F.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:d(F.balanceDaysBadge,i<=3&&F.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:()=>{pe(fe===e.provider?void 0:e.provider)},children:`?`}),fe===e.provider&&(0,o.jsx)(Rn,{balance:e,days:i??0,dailyBurn:we,money:H,t,onClose:()=>{pe(void 0)}})]})},G=P.cacheHit+P.cacheMiss>0?P.cacheHit/(P.cacheHit+P.cacheMiss)*100:0,Oe=Object.keys(I).sort(),ke=$(),Ae=I[ke]?.cost??0,je=ke.slice(0,7),Me=ke.slice(0,4),K=Oe.reduce((e,t)=>e+(t.startsWith(je)?I[t]?.cost??0:0),0),Fe=Oe.reduce((e,t)=>e+(t.startsWith(Me)?I[t]?.cost??0:0),0),Re=(0,r.useMemo)(()=>ln(I,je,ke)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[I,je,ke,f]),Y=(0,r.useMemo)(()=>{let e=v&&y>0?K/y*100:NaN;return{pct:Number.isFinite(e)?Math.max(0,Math.min(100,e)):Fe>0?Math.max(0,Math.min(100,K/Fe*100)):0,over:Number.isFinite(e)&&e>=100,label:t(Number.isFinite(e)?`budget`:`monthCost`)}},[v,y,K,Fe,t]),We=v&&y>0?K/y*100:0,Ge=(0,r.useMemo)(()=>{let e=[];for(let t=R-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push($(n.getTime()))}return e},[R]),Ke=Ge.at(-1)??ke,qe=(0,r.useMemo)(()=>Object.entries(I).map(([e,t])=>({date:e,value:t.cost})),[I]),X=mn(I),Ye=hn(I),Xe=(0,r.useMemo)(()=>Ge.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=I[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:i.input+i.output+i.cacheHit+i.cacheMiss}}),[Ge,I,e.byDayModels]),Ze=(0,r.useMemo)(()=>Object.entries(ne).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=Ne(e),r=n.key===`other`,i=r?an(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:ze(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:En[t%En.length]??`#8b95a3`})),[ne]),Qe=(0,r.useMemo)(()=>O.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,O.hideUnidentified]),$e=(0,r.useMemo)(()=>{let n=new Map;for(let t of Object.values(e.byDayModelsSite??{}))for(let[e,r]of Object.entries(t))for(let[t,i]of Object.entries(r)){let r=n.get(t);r===void 0&&(r=new Map,n.set(t,r));let a=r.get(e)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0};a.calls+=i.calls,a.input+=i.input,a.output+=i.output,a.cacheHit+=i.cacheHit,a.cacheMiss+=i.cacheMiss,a.cost+=i.cost,r.set(e,a)}let r=new Map;for(let[t,i]of n){let n=[...i.entries()].filter(([,e])=>e.calls>0).map(([t,n],r)=>{let i=Ne(t),a=i.key===`other`,o=a?an(t)??i.provider:i.provider;return{key:t,name:a?t:i.name,provider:o,color:En[r%En.length]??`#8b95a3`,calls:n.calls,input:n.input,output:n.output,cacheHitRate:n.cacheHit+n.cacheMiss>0?n.cacheHit/(n.cacheHit+n.cacheMiss)*100:0,estimated:ze(i,{input:n.input,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,output:n.output}),plan:e.byModel?.[t]?.plan===!0,...n.cost>0?{actual:n.cost}:{},uncatalogued:a,estimatedPricing:i.estimated===!0,officialCalls:0,officialCost:0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));n.length>0&&r.set(t,n)}let i=e=>Ut(e,be)??t(`channelUnknown`),a=new Map;for(let[e,t]of r){let n=i(e),r=a.get(n);r===void 0?a.set(n,[...t]):(r.push(...t),r.sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)))}let o=new Map,s=new Map;for(let e of f){if(e.status===`not-configured`)continue;let t=e.displayName??sn(e.provider),n=i(`direct:${e.provider}`),r=a.has(t)?t:a.has(n)?n:void 0,c=r??`sub:${sn(e.provider)}`;s.set(c,r??sn(e.provider));let l=o.get(c);l===void 0?o.set(c,[e]):l.push(e)}let u=e=>e===i(`direct:deepseek`)||e===i(`site:https://api.deepseek.com`)?Te(`deepseek`)??Te(e):Te(e),d=[];for(let[e,t]of a)d.push({name:e,models:t,subscriptions:o.get(e)??[],balance:u(e),dot:vn(c,t[0]?.provider??``)});for(let[e,t]of s)a.has(e)||d.push({name:t,models:[],subscriptions:o.get(e)??[],balance:Te(t),dot:vn(c,t)});let p=new Set(d.flatMap(e=>[Q(e.name),...e.balance===void 0?[]:[Q(e.balance.provider)]]));for(let e of l)p.has(Q(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&d.push({name:e.displayName,models:[],subscriptions:[],balance:e,dot:vn(c,e.displayName)});return d.sort((e,t)=>{let n=In(t)-In(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,f,l,c,be,t]),tt=(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`actual`)})]})}),nt=e=>{let n=e.color??(e.colorVar===void 0?void 0:Le(e.colorVar));return(0,o.jsxs)(`span`,{className:F.modelCell,children:[(0,o.jsx)(Hn,{provider:e.provider,...n===void 0?{}:{colorVar:n}}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:F.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:F.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:F.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:F.modelProvider,children:U(e.provider)})]})]})},it=Ze.reduce((e,t)=>e+t.estimated,0),at=P.cost>0?P.cost:it,Z=P.calls>0?at/P.calls:0,ot=(0,r.useMemo)(()=>Ze.map(e=>({key:e.key,name:e.name,color:e.color})),[Ze]),st=Xe.length>=2?Xe.at(-2)?.cost??0:0,ct=st>0?(Ae-st)/st*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:d(F.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:F.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:F.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:F.headTitleRow,children:[(0,o.jsx)(`h2`,{className:F.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:F.dashboardSubtitle,children:[t(`lastUpdated`),` `,Ke,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:F.dashboardRight,children:[(0,o.jsx)(`span`,{className:F.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.currencyButton,m===e&&F.currencyButtonActive),"aria-pressed":m===e,"data-testid":`billing-currency-${e}`,title:t(e===`cny`?`currencyCny`:`currencyUsd`),onClick:()=>{h(e)},children:e===`cny`?`¥ CNY`:`$ USD`},e))}),c.checked&&(0,o.jsxs)(`span`,{className:d(F.healthBadge,c.available?F.healthBadgeOk:F.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:d(F.healthDot,c.available?F.healthOk:F.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:F.closeButton,"aria-label":t(`close`),"data-testid":`billing-close`,onClick:n,children:(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M18 6 6 18`}),(0,o.jsx)(`path`,{d:`m6 6 12 12`})]})})]})]}),(0,o.jsx)(`nav`,{className:F.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:Qt.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":L===e.id,className:d(F.tabButton,L===e.id&&F.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{ie(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:F.dashboardBody,children:[L===`overview`&&(0,o.jsxs)(`div`,{className:F.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[u?.kind===`drift`&&u.spent!==void 0&&oe!==z()&&(0,o.jsxs)(`div`,{className:F.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:F.reconcileIcon,"aria-hidden":`true`,children:(0,o.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,o.jsx)(`line`,{x1:`12`,y1:`10`,x2:`12`,y2:`16`}),(0,o.jsx)(`line`,{x1:`12`,y1:`7.5`,x2:`12.01`,y2:`7.5`})]})}),(0,o.jsx)(`span`,{className:F.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,u.provider??``).replace(`{spent}`,H(u.spent)).replace(`{today}`,H(u.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:F.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:ce,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:F.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:F.heroTop,children:[(0,o.jsxs)(`div`,{className:F.heroMain,children:[(0,o.jsx)(`span`,{className:F.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:F.heroReadout,children:[(0,o.jsx)(`span`,{className:F.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:F.heroValue,children:H(K).slice(1)})]}),(0,o.jsxs)(`span`,{className:F.heroMeta,children:[P.calls.toLocaleString(),` `,t(`calls`)]})]}),(0,o.jsxs)(`div`,{className:F.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`svg`,{className:F.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:F.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:d(F.heroGaugeArc,Y.over&&F.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${Y.pct/100*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:F.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:d(F.heroGaugePct,Y.over&&F.heroGaugePctOver),children:[Y.pct.toFixed(0),`%`]}),(0,o.jsx)(`span`,{className:F.heroGaugeLabel,children:Y.label})]})]})]}),v&&y>0&&(0,o.jsxs)(`div`,{className:F.heroBudget,"data-testid":`billing-hero-budget`,children:[(0,o.jsx)(`span`,{className:F.heroBudgetLabel,children:t(`budget`)}),(0,o.jsx)(`div`,{className:F.heroBudgetTrack,role:`progressbar`,"aria-valuenow":Math.min(We,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),children:(0,o.jsx)(`div`,{className:d(F.heroBudgetFill,We>=100&&F.heroBudgetFillOver),style:{width:`${Math.min(We,100)}%`}})}),(0,o.jsxs)(`span`,{className:F.heroBudgetValue,children:[H(K),` / `,H(y),` · `,We.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:F.heroSide,children:[(0,o.jsxs)(`div`,{className:F.heroSideItem,children:[(0,o.jsx)(`span`,{className:F.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:F.heroSideValue,children:H(Fe)})]}),(0,o.jsxs)(`div`,{className:F.heroSideItem,children:[(0,o.jsx)(`span`,{className:F.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:F.heroSideValue,children:[H(Ae),(0,o.jsxs)(`span`,{className:d(F.delta,ct>=0?F.deltaUp:F.deltaDown),children:[ct>=0?`▲`:`▼`,` `,Math.abs(ct).toFixed(1),`%`]})]})]}),Re>0&&(0,o.jsxs)(`div`,{className:F.heroSideItem,children:[(0,o.jsx)(`span`,{className:F.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:F.heroSideValue,children:H(Re)})]}),Re<=0&&(0,o.jsx)(`span`,{className:F.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:F.unpricedHint,"data-testid":`billing-unpriced-hint`,children:t(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0))}),(e.total.searchCalls??0)>0&&(0,o.jsx)(`div`,{className:F.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,H(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`section`,{className:F.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:F.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:d(F.kpiValue,F.kpiGreen),children:Ue(G)}),(0,o.jsxs)(`span`,{className:F.kpiDetail,children:[J(P.cacheHit),` / `,J(P.cacheHit+P.cacheMiss)]})]}),(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:F.kpiValue,children:J(P.input+P.output)}),(0,o.jsxs)(`span`,{className:F.kpiDetail,children:[t(`inputTokens`),` `,J(P.input),` · `,t(`outputTokens`),` `,J(P.output)]})]}),(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:F.kpiValue,children:H(Z)}),(0,o.jsxs)(`span`,{className:F.kpiDetail,children:[t(`calls`),` `,P.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:F.kpiTile,children:[(0,o.jsx)(`span`,{className:F.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:F.kpiValue,children:P.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:F.kpiDetail,children:[Ze.length,` `,t(`models`)]})]})]}),(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:F.panelHead,children:[(0,o.jsx)(`h3`,{className:F.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:F.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`year`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.heatmapRangeButton,le===e&&F.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":le===e,onClick:()=>{ue(e)},children:t(e===`month`?`heatmapMonth`:`heatmapYear`)},e))}),(0,o.jsxs)(`span`,{className:F.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,X,` · `,t(`streakDays`),` `,Ye]})]}),(0,o.jsx)(xt,{days:qe,currency:m,t,range:le})]})]}),L===`settings`&&(0,o.jsxs)(`div`,{className:F.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:F.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:F.setCardHead,children:[(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`budgetHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,"aria-label":t(`budget`),"data-testid":`billing-budget-toggle`,className:d(F.switch,v&&F.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:F.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:F.ctlCol,children:[(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:F.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:F.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:F.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:y===0?``:y,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,title:`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,onChange:e=>{ee(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=K/y*100;return(0,o.jsx)(`div`,{className:F.ctlRowStretch,children:(0,o.jsx)(`div`,{className:F.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,o.jsx)(`div`,{className:d(F.progFill,e>=100&&F.budgetFillOver,e>=80&&e<100&&F.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:F.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,H(K)).replace(`{total}`,H(y))})]})]}),(0,o.jsxs)(`section`,{className:F.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:F.setCardHead,children:[(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":x.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:d(F.switch,x.enabled&&F.switchOn),onClick:()=>{S({...x,enabled:!x.enabled})},children:(0,o.jsx)(`span`,{className:F.switchKnob})})]}),x.enabled&&(0,o.jsxs)(`div`,{className:F.ctlCol,children:[(0,o.jsxs)(`label`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:F.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:x.leadMin,className:F.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);S({...x,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):x.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:F.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:F.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:x.position===e,onChange:()=>S({...x,position:e})}),(0,o.jsx)(`span`,{className:F.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:F.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:F.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:x.mode===e,onChange:()=>S({...x,mode:e})}),(0,o.jsx)(`span`,{className:F.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:x.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{S({...x,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:F.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:F.btn,onClick:C,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:F.setCard,"data-testid":`billing-toggle-setting`,children:(0,o.jsxs)(`div`,{className:F.setGrid3,children:[(0,o.jsx)(`div`,{className:F.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:F.setCardHead,children:[(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":ge,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:d(F.switch,ge&&F.switchOn),onClick:ye,children:(0,o.jsx)(`span`,{className:F.switchKnob})})]})}),(0,o.jsxs)(`div`,{className:F.setCell,"data-testid":`billing-livecost-setting`,children:[(0,o.jsxs)(`div`,{className:F.setCardHead,children:[(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`liveCostBar`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`liveCostBarHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":A.show,"aria-label":t(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:d(F.switch,A.show&&F.switchOn),onClick:()=>j({...A,show:!A.show}),children:(0,o.jsx)(`span`,{className:F.switchKnob})})]}),A.show&&(0,o.jsxs)(`div`,{className:F.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,o.jsx)(`span`,{className:F.rdoLabel,children:t(`liveCostBarPosition`)}),(0,o.jsx)(Wn,{liveCostPrefs:A,onLiveCostPrefs:j,t})]})]}),(0,o.jsx)(`div`,{className:F.setCell,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:F.setCardHead,children:[(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`siteListDisplayHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":O.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:d(F.switch,O.hideUnidentified&&F.switchOn),onClick:()=>k({hideUnidentified:!O.hideUnidentified}),children:(0,o.jsx)(`span`,{className:F.switchKnob})})]})})]})}),(0,o.jsx)(`section`,{className:F.setCard,"data-testid":`billing-display-setting`,children:(0,o.jsxs)(`div`,{className:F.setGrid2,children:[(0,o.jsxs)(`div`,{className:F.setCell,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:F.setCardHead,children:(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:F.ctlCol,children:[(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:F.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(F.floatModeBtn,w.mode===`combined`&&F.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>T({mode:`combined`,targets:w.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:d(F.floatModeBtn,w.mode===`subscription`&&F.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>T({mode:`subscription`,targets:w.targets}),children:t(`floatModeSubscription`)})]})]}),w.mode===`subscription`&&(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:F.ctlGroup,"data-testid":`billing-float-targets`,children:[de.map(e=>{let t=w.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:F.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>T({mode:`subscription`,targets:t?w.targets.filter(t=>t!==e.id):[...w.targets,e.id]})}),(0,o.jsx)(`span`,{className:F.floatTargetLabel,children:e.label})]},e.id)}),de.length===0&&(0,o.jsx)(`span`,{className:F.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`div`,{className:F.setCell,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:F.setCardHead,children:(0,o.jsxs)(`div`,{className:F.setCardMeta,children:[(0,o.jsx)(`h3`,{className:F.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:F.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsx)(`div`,{className:F.ctlCol,children:(0,o.jsxs)(`div`,{className:F.ctlRow,children:[(0,o.jsx)(`span`,{className:F.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:F.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(F.floatModeBtn,E.metric===`money`&&F.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>D({metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:d(F.floatModeBtn,E.metric===`tokens`&&F.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>D({metric:`tokens`}),children:t(`cardMetricTokens`)})]})]})})]})]})}),(0,o.jsx)(Bn,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(rt,{t,version:e.pluginVersion})]}),L===`trends`&&(0,o.jsxs)(`div`,{className:F.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:d(F.ubCard,F.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:F.ubCardHead,children:[(0,o.jsx)(`h3`,{className:F.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:F.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:F.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.rangeButton,R===e&&F.rangeButtonActive),"aria-pressed":R===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{ae(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,o.jsx)(`span`,{className:F.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(F.rangeButton,N===e&&F.rangeButtonActive),"aria-pressed":N===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{te(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:F.ubCardSub,children:Ke})]}),(0,o.jsx)(Je,{data:Xe,models:ot,currency:m,metric:N})]}),g.length>0&&(0,o.jsxs)(`section`,{className:F.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:F.ubCardHead,children:[(0,o.jsx)(`h3`,{className:F.ubCardTitle,children:t(`rounds`)}),xe.length>0&&(0,o.jsxs)(`span`,{className:F.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[xe.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:F.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(ht,{rounds:g,flags:xe,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=Se.peak+Se.offPeak;if(e<=0)return null;let n=Se.peak/e*100;return(0,o.jsxs)(`section`,{className:F.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:F.ubCardHead,children:[(0,o.jsx)(`h3`,{className:F.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:F.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:F.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:d(F.shareSeg,F.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:d(F.shareSeg,F.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:F.shareLegend,children:[(0,o.jsxs)(`span`,{className:F.shareItem,children:[(0,o.jsx)(`span`,{className:F.shareDot,style:{background:`var(--dsw-static-blue-500)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:F.shareValue,"data-testid":`billing-share-peak`,children:[H(Se.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:F.shareItem,children:[(0,o.jsx)(`span`,{className:F.shareDot,style:{background:`color-mix(in srgb, var(--dsw-static-blue-500) 30%, var(--dsw-alias-bg-module-platform))`}}),t(`offPeak`),(0,o.jsxs)(`span`,{className:F.shareValue,"data-testid":`billing-share-offpeak`,children:[H(Se.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),Ce>0&&(0,o.jsx)(`div`,{className:F.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,H(Ce))})]})})()]}),L===`providers`&&(0,o.jsxs)(`div`,{className:F.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[Qe.length>0&&(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:F.panelHead,children:(0,o.jsx)(`h3`,{className:F.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:F.providerGroupList,"data-testid":`billing-relay-quotas`,children:Qe.map(e=>(0,o.jsxs)(`div`,{className:F.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:F.siteRowName,children:[(0,o.jsx)(`span`,{className:d(F.siteKindTag,Cn[e.kind]),children:Sn(e.kind,t)}),(0,o.jsx)(`span`,{className:F.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:F.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:F.siteRowCost,children:[t(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let n=e.remainingPercent<20;return(0,o.jsxs)(`span`,{className:d(F.siteRowCalls,n&&F.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:F.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:F.panelHead,children:[(0,o.jsx)(`h3`,{className:F.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:F.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${Tn(e.updatedAt)}`})]}),M&&(0,o.jsx)(`div`,{className:F.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),$e.length===0?(0,o.jsx)(`div`,{className:F.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:F.providerGroupList,"data-testid":`billing-provider-groups`,children:$e.map(e=>(0,o.jsxs)(`div`,{className:F.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:F.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:F.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:d(F.healthDot,e.dot),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:F.providerGroupName,children:U(e.name)})]}),(0,o.jsxs)(`span`,{className:F.providerGroupMeta,children:[(0,o.jsxs)(`span`,{className:F.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,o.jsx)(`span`,{className:F.providerGroupCostLabel,children:t(`cost`)}),(0,o.jsx)(`span`,{className:F.providerGroupCostValue,children:H(In(e))})]}),e.subscriptions.length>0?(0,o.jsxs)(`span`,{className:F.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` 套餐`]}):(0,o.jsx)(`span`,{className:F.providerGroupBadge,"aria-hidden":`true`}),!Ee(e)&&e.balance!==void 0?(0,o.jsxs)(`span`,{className:F.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:F.providerGroupBalanceLabel,children:t(`balance`)}),De(e.balance)]}):(0,o.jsx)(`span`,{className:F.providerGroupBalance,"aria-hidden":`true`})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:d(F.tableScroll,F.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:F.modelTable,children:[tt,(0,o.jsx)(`tbody`,{children:e.models.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:nt(e)}),(0,o.jsx)(`td`,{className:F.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:F.numCol,children:J(e.input)}),(0,o.jsx)(`td`,{className:F.numCol,children:J(e.output)}),(0,o.jsx)(`td`,{className:F.numCol,children:Ue(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:F.numCol,children:e.plan?(0,o.jsxs)(`span`,{className:F.planTag,children:[t(`subscriptionIncluded`),e.estimated>0?` ≈${H(e.estimated)}`:``]}):e.actual===void 0?(0,o.jsx)(`span`,{className:F.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:F.bucketCost,children:[(0,o.jsx)(`span`,{className:F.bucketOfficial,children:H(t)}),(0,o.jsx)(`span`,{className:F.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:F.bucketThird,children:H(n)})]}):H(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:F.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=bn(e.status,t);return(0,o.jsxs)(`div`,{className:F.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:F.subscriptionHead,children:[(0,o.jsx)(`span`,{className:F.subscriptionName,children:U(e.displayName)}),e.planType===`code`&&(()=>{let n=re(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,o.jsxs)(`span`,{className:F.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,H(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:F.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:F.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:F.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:F.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:F.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:F.subscriptionStatus,children:t(`subscriptionNoApi`)}),e.windows.map(e=>(()=>{let n=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:F.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:F.subscriptionWindowLabel,children:xn(e.kind,t)}),(0,o.jsx)(`span`,{className:F.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(F.subscriptionFill,n>=100&&F.subscriptionFillOver,n>=80&&n<100&&F.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:F.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(F.subscriptionPct,r&&F.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:F.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${Tn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:F.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:F.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-export-day`,onClick:()=>{Pt(Nt(`usage-daily`,`csv`,Object.keys(I)),kt(I),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{Pt(Nt(`usage-sessions`,`csv`,Object.keys(I)),Mt(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{Pt(Nt(`usage-sites`,`csv`,Object.keys(I)),At(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:F.exportButton,"data-testid":`billing-export-json`,onClick:()=>{Pt(Nt(`usage-stats`,`json`,Object.keys(I)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:F.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:F.ubCardHead,children:[(0,o.jsx)(`h3`,{className:F.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:F.ubCardSub,children:e.bySession.length>20?t(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(e.bySession.length)):`${e.bySession.length}`})]}),(e.staleLedgerSessions??0)>0&&(0,o.jsx)(`div`,{className:F.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:F.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:F.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`sessionTitle`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`lastActive`)})]})}),(0,o.jsxs)(`tbody`,{children:[yn(e.bySession??[]).length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:4,className:F.emptyRow,children:t(`noData`)})}),yn(e.bySession??[]).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&me.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{className:F.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:F.numCol,children:H(e.cost)}),(0,o.jsx)(`td`,{className:F.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${Tn(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?F.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{he(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:F.modelName,children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.stale===!0&&(0,o.jsx)(`span`,{className:d(F.ubTag,F.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:F.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:F.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),L===`token`&&(0,o.jsxs)(`div`,{className:F.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(ut,{stats:e,trendDays:R,onTrendDays:ae,models:ot,money:H,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:F.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:F.panelHead,children:[(0,o.jsx)(`h3`,{className:F.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:F.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(et,{perf:e.perf,models:ot,t})]})]}),L===`pricing`&&(0,o.jsxs)(`div`,{className:F.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:F.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:F.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:F.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,q(V.rate)]}),(0,o.jsx)(`span`,{className:d(F.ubTag,V.live?F.ubTagSuccess:F.ubTagNeutral),children:V.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:F.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:F.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:F.ubCardHead,children:[(0,o.jsx)(`h3`,{className:F.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:F.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:F.ubTablewrap,children:(0,o.jsxs)(`table`,{className:F.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:F.numCol,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:Ie().map(e=>{let n=e.price.input>0||e.price.output>0;return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:F.ubModel,children:[(0,o.jsx)(Hn,{provider:e.provider,colorVar:Le(e.colorVar)}),(0,o.jsxs)(`span`,{className:F.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:F.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Pe(e.promo,Date.now())&&(0,o.jsx)(`span`,{className:F.ubTagPromo,"data-testid":`billing-price-promo`,title:e.promo.endsAtMs===void 0?t(`promoOpenEnded`):t(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()}),children:e.promo.note??t(`promoBadge`)})]})]})}),(0,o.jsx)(`td`,{className:F.numCol,children:n?W(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:F.na,children:`—`})}),(0,o.jsx)(`td`,{className:F.numCol,children:n?W(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:F.na,children:`—`})}),(0,o.jsx)(`td`,{className:F.numCol,children:n?W(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:F.na,children:`—`})}),(0,o.jsx)(`td`,{className:F.numCol,children:n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(`span`,{className:F.ubPricepair,children:[(0,o.jsxs)(`span`,{className:F.ubChipPeak,children:[(0,o.jsx)(`span`,{className:F.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:F.num,children:[W(e.price.input,e.price.currency),` / `,W(e.price.output,e.price.currency)]})]}),(0,o.jsxs)(`span`,{className:F.ubChipOff,children:[(0,o.jsx)(`span`,{className:F.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:F.num,children:[W(e.price.offPeak.input,e.price.currency),` / `,W(e.price.offPeak.output,e.price.currency)]})]})]}):n?(0,o.jsx)(`span`,{className:F.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:F.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:F.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:F.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:F.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:F.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:F.na,children:`—`}):W(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:F.numCol,children:(0,o.jsx)(`span`,{className:F.na,children:`—`})}),(0,o.jsx)(`td`,{className:F.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:F.na,children:`—`}):W(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:F.numCol,children:(0,o.jsx)(`span`,{className:F.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:F.ubCard,children:[(0,o.jsx)(`div`,{className:F.ubCardHead,children:(0,o.jsx)(`h3`,{className:F.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:F.ubNotes,children:[(0,o.jsxs)(`li`,{className:F.ubNotesItem,children:[(0,o.jsx)(`span`,{className:F.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:F.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:F.ubNotesItem,children:[(0,o.jsx)(`span`,{className:F.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:F.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:F.ubNotesItem,children:[(0,o.jsx)(`span`,{className:F.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:F.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:F.modalFooter,"data-testid":`billing-footer`,children:[(0,o.jsx)(`span`,{children:t(`footer`)}),(0,o.jsx)(`span`,{children:t(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]})})}function Hn({provider:e,colorVar:t}){let n=Gt(e);return n===void 0?(0,o.jsx)(`span`,{className:F.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()}):(0,o.jsx)(`img`,{className:F.vendorLogo,src:n,alt:``,"aria-hidden":`true`})}let Un=[`below`,`above`,`toolbar`];function Wn({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[i,s]=(0,r.useState)(!1),c={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)},l=Un.map(e=>({id:e,label:c[e]}));return(0,o.jsx)(a.Menu,{open:i,align:`end`,portal:!0,compact:!0,items:l,selectedId:e.position,onSelect:n=>{s(!1);let r=Un.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{s(!1)},anchor:(0,o.jsxs)(`button`,{type:`button`,className:F.rdoSelect,"data-testid":`billing-livecost-position-select`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{s(!i)},children:[(0,o.jsx)(`span`,{children:c[e.position]}),(0,o.jsx)(`span`,{className:d(F.rdoChevron,i&&F.rdoChevronOpen),"aria-hidden":!0,children:(0,o.jsx)(a.IconChevronDownOutline14,{})})]})})}function Gn(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(Dn),[f,p]=(0,r.useState)(en),[g,_]=(0,r.useState)([]),[b,ee]=(0,r.useState)(void 0),[C,w]=(0,r.useState)([]),[O,j]=(0,r.useState)(!1),[M,N]=(0,r.useState)([]),[te,P]=(0,r.useState)(`cny`),[F,ne]=(0,r.useState)(()=>m()),I=(0,r.useCallback)(e=>{ne(e),h(e)},[]),[L,re]=(0,r.useState)(()=>x()),ie=(0,r.useCallback)(e=>{re(e),S(e)},[]),[R,ae]=(0,r.useState)(()=>E()),oe=(0,r.useCallback)(e=>{ae(e),D(e),window.dispatchEvent(new CustomEvent(T))},[]),[se,z]=(0,r.useState)(()=>v()),ce=(0,r.useCallback)(e=>{z(e),y(e)},[]),[le,de]=(0,r.useState)(()=>{let e=k();return ue(e),e}),fe=(0,r.useCallback)(e=>{de(e),ue(e),A(e)},[]),pe=(0,r.useMemo)(()=>un(u),[u,le]),me=te===`usd`?`en`:`zh`,B=(0,r.useCallback)((e,n)=>{let r=(me===`en`?Lt:It)[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},[me,t]),[he,_e]=(0,r.useState)(!1),ye=(0,r.useCallback)(()=>{_e(!1)},[]),V=(0,r.useCallback)(()=>{On().then(e=>{e!==null&&d(un(e))}),jn().then(({balances:e,reconcile:t})=>{e.length>0&&_(e),ee(t)}),Mn().then(e=>{e.length>0&&w(e),j(!1)}).catch(()=>{j(!0)}),Nn().then(e=>{N(e)}).catch(()=>{})},[]),be=(0,r.useCallback)(()=>{V(),An(),_e(!0)},[V]);(0,r.useEffect)(()=>{V(),An()},[V]),(0,r.useEffect)(()=>{let e=setInterval(()=>{V(),An()},wn);return()=>{clearInterval(e)}},[V]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(p(t),ge(t.catalog??[]))}),()=>{e=!1}},[n]);let U=$(),W=Object.entries(u.byDay).filter(([e])=>e.startsWith(U.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),xe=u.byDay[U]?.cost??0,Se=_n(u.byDay,U),Ce=(0,r.useMemo)(()=>gn(u.byDay).map(e=>{let t=u.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:t.input+t.output}}),[u.byDay]),we=Object.entries(u.byDay).filter(([e])=>e.startsWith(U.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Te=(()=>{let e=u.byDay[U];return e===void 0?0:e.input+e.output})(),Ee=_n(u.byDay,U,e=>e.input+e.output),De=c(e=>e.enabled),G=c(e=>e.amount),Oe=c(e=>e.tierAlertDays),ke=c(e=>e.lastTierSwitchAt),[Ae,je]=(0,r.useState)(()=>Jt()),[Me,K]=(0,r.useState)(null),[Pe,Fe]=(0,r.useState)(null),[Ie,Le]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>Le(Date.now()),wn);return()=>{clearInterval(e)}},[]);let Re=(0,r.useCallback)(e=>{je(e),Yt(e)},[]),ze=(0,r.useCallback)(()=>{Fe({entering:H(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4})},[]),Be=G>0?G:u.budget??0,Ve=(0,r.useCallback)(()=>{let e=!De;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,De]);(0,r.useEffect)(()=>{if(!De||Be<=0)return;let e=W/Be*100,t=$t.filter(t=>e>=t&&Oe?.[String(t)]!==U);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,U),!dn())return;let r=B(`budgetTierBody`).replace(`{cost}`,q(W)).replace(`{budget}`,q(Be)).replace(`{pct}`,String(n));pn(`budget:${n}:${U}`,()=>{new Notification(B(`budget`),{body:r})})},[De,Be,W,Oe,U,l,B]),(0,r.useEffect)(()=>{let e=Xt(Ie,Ae,ke);if(e===null||(l.markTierSwitchAlerted(e.atMs),K(e),!Ae.webNotify||!dn()))return;let t=Math.max(1,Math.round((e.atMs-Ie)/6e4)),n=B(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=B(e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));pn(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[Ie,ke,Ae,l,B]);let He=c(e=>e.lastBalanceAlertDay),J=u.lowBalanceThreshold??50,Ue=(0,r.useMemo)(()=>{if(g.length===0)return;let e=cn(u.byDay,U),t=ve().rate;for(let n of g){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=J)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[g,u.lowBalanceThreshold,u.byDay,U]);(0,r.useEffect)(()=>{if(Ue===void 0||He===U||(l.markBalanceAlerted(U),!dn()))return;let e=B(`balanceLowBody`).replace(`{name}`,Ue.name).replace(`{balance}`,q(Ue.cny)).replace(`{days}`,Ue.days===void 0?`—`:String(Ue.days));pn(`balance:${U}`,()=>{new Notification(B(`balance`),{body:e})})},[Ue,He,U,l,B]);let Y=(0,r.useMemo)(()=>{let e=U.slice(0,7),t=new Map;for(let[n,r]of Object.entries(u.byDayModels??{}))if(n.startsWith(e))for(let[e,n]of Object.entries(r)){if(n.cost<=0)continue;let r=Ne(e).provider,i=u.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=g.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=g.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`?B(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?B(`balanceUnreachable`):B(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:q(t.totalBalance),r=ve().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<J}},a=e=>{let t=C.find(t=>t.displayName===e||sn(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:B(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?B(`subscriptionExhausted`):B(`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])}}},[u.byDayModels,u.byModel,u.lowBalanceThreshold,g,C,U]),We=(0,r.useMemo)(()=>{let e=u.total;return{totalToken:e.input+e.output,input:e.input,output:e.output,cacheRead:e.cacheHit,calls:e.calls}},[u]);(0,r.useEffect)(()=>{i({todayCost:xe,monthCost:W})},[xe,W,i]),(0,r.useEffect)(()=>a(be),[a,be]);let Ge=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ln,{...e,t:B,onOpen:be,monthCost:W,todayCost:xe,weekCost:Se,days:Ce,vendorStatus:Y,dash:We,cardPrefs:se,monthTokens:we,todayTokens:Te,weekTokens:Ee,floatPrefs:F,subscriptions:C}),he&&(0,o.jsx)(Vn,{stats:pe,t:B,onClose:ye,userPrices:le,onUserPrices:fe,health:f,balances:g,...b===void 0?{}:{reconcile:b},quotas:C,relayQuotas:M,currency:te,onCurrency:P,turns:Ge,renderSlot:s,budgetEnabled:De,budgetAmount:Be,onToggleBudget:Ve,onBudgetAmount:l.setAmount,peakConfig:Ae,onPeakConfig:Re,onPreviewPeak:ze,floatPrefs:F,onFloatPrefs:I,cardPrefs:se,onCardPrefs:ce,sitePrefs:L,onSitePrefs:ie,liveCostPrefs:R,onLiveCostPrefs:oe,quotasStale:O}),(Me!==null||Pe!==null)&&(0,o.jsx)(Zt,{hit:Me??Pe,config:Ae,t:B,onDismiss:()=>{K(null),Fe(null)}})]})}function Kn(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function qn(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 Jn(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)}async function Yn(){try{let e=await fetch(`/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 Xn(){try{let e=await fetch(`/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 Zn(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function Qn(){let[e,t]=(0,r.useState)(()=>E().show),[n,i]=(0,r.useState)(()=>E().position);return(0,r.useEffect)(()=>{let e=()=>{t(E().show),i(E().position)};return window.addEventListener(T,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(T,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function $n(e){let[t,n]=(0,r.useState)(null),[i,a]=(0,r.useState)([]),[o,s]=(0,r.useState)(()=>Date.now());return(0,r.useEffect)(()=>{let e=!1,t=()=>{Yn().then(t=>{!e&&t!==null&&n(t)}),Xn().then(t=>{e||a(t)}),e||s(Date.now())};t();let r=setInterval(t,3e4);return()=>{e=!0,clearInterval(r)}},[e]),{sessionCost:(0,r.useMemo)(()=>Kn(t,e),[t,e]),turnCost:(0,r.useMemo)(()=>qn(t,e),[t,e]),tier:xe(o),chips:(0,r.useMemo)(()=>Jn(i),[i])}}function er({sessionId:e,t}){let{visible:n,position:r}=Qn(),{sessionCost:i,turnCost:a,tier:s,chips:c}=$n(e),l=e=>q(e,`cny`),u=i>0||a>0,f=s.tier===`peak`;return!n||r===`toolbar`?null:(0,o.jsxs)(`span`,{className:r===`above`?d(F.feeBar,F.feeBarAbove):F.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:f?F.feeChipPrimary:F.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:F.feeCount,children:Ce(s.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:F.feeSuffix,children:t(f?`tierToOff`:`tierToPeak`)}),u&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:F.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:F.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:F.feeNum,children:l(a)})]}),(0,o.jsx)(`span`,{className:F.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:F.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:F.feeNum,children:l(i)})]})]}),c.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:F.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?F.feeChipError:F.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(Zn(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function tr({sessionId:e,t}){let{visible:n,position:r}=Qn(),{sessionCost:i,turnCost:s,tier:c,chips:l}=$n(e);if(!n||r!==`toolbar`)return null;let u=c.tier===`peak`,d=l.reduce((e,t)=>Math.min(e,t.pct),100),f=d<=10?F.feeInlineError:d<=20?F.feeInlineAlert:F.feeInline,p=[`${Ce(c.nextSwitchInMs)} ${t(u?`tierToOff`:`tierToPeak`)}`,`${t(`liveTurn`)} ${q(s,`cny`)}`,`${t(`liveSession`)} ${q(i,`cny`)}`,...l.map(e=>`${e.name} ${t(Zn(e.kind))} ${e.pct}%`)].join(` · `);return(0,o.jsx)(a.Tooltip,{label:p,side:`top`,delayMs:500,children:(0,o.jsxs)(`span`,{className:f,"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":p,children:[(0,o.jsx)(`span`,{className:u?F.feeChipPrimary:F.feeChipOff,"data-testid":`billing-live-tier`,children:t(u?`tierPeak`:`tierOff`)}),i>0&&(0,o.jsx)(`span`,{className:F.feeInlineNum,children:q(i,`cny`)})]})})}function nr(){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{}},registerOpen:e=>(t=e,()=>{t===e&&(t=void 0)})}}function rr(){return(0,s.defineStore)({init:()=>({enabled:!1,amount:0,tierAlertDays:{},lastBalanceAlertDay:``,lastTierSwitchAt:0}),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}}})}let ir={enabled:!1,timeout:0};function ar(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...ir};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...ir}}}function or(e){return e.completed===!0||e.running===!1}function sr(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)),or(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{}},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=or(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)}}let cr=[`slots`,`locale`,`remote`,`sessions`];function lr(e){let t=nr();e.provide(`billingMetrics`,t);let n=rr();e.effect(()=>e.locale.register(Ft,{zh:It,en:Lt}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:Ft,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)})},Gn)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:Ft,inject:e=>({sessionId:l(e)})},er)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:Ft,inject:e=>({sessionId:l(e)})},tr)),e.effect(()=>sr(e.sessions.list,ar),`ui-usage-billing: completion notifier`)}return n.UsageBilling=Gn,n.apply=lr,n.inject=cr,t.exports}});
|
|
1
|
+
window.__ModuleLoader__.load({id:`@kenz1117/dsh-ui-usage-billing`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("react"),i=e("react-dom"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react/jsx-runtime"),s=e("@deepseek-ai/dsh-client-store");function c(e){return e}function l(e){return c(e)}function u(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=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}let f={mode:`combined`,targets:[]},p=`dsh.ui-usage-billing.float`;function m(){try{let e=localStorage.getItem(p);if(e===null)return{...f,targets:[...f.targets]};let t=JSON.parse(e);return{mode:t.mode===`subscription`?`subscription`:`combined`,targets:Array.isArray(t.targets)?t.targets.filter(e=>typeof e==`string`):[]}}catch{return{...f,targets:[...f.targets]}}}function h(e){try{localStorage.setItem(p,JSON.stringify(e))}catch{}}let g={metric:`money`},_=`dsh.ui-usage-billing.card`;function v(){try{let e=localStorage.getItem(_);return e===null?{...g}:{metric:JSON.parse(e).metric===`tokens`?`tokens`:`money`}}catch{return{...g}}}function y(e){try{localStorage.setItem(_,JSON.stringify(e))}catch{}}let b={hideUnidentified:!0},ee=`dsh.ui-usage-billing.sites`;function x(){try{let e=localStorage.getItem(ee);return e===null?{...b}:{hideUnidentified:JSON.parse(e).hideUnidentified!==!1}}catch{return{...b}}}function S(e){try{localStorage.setItem(ee,JSON.stringify(e))}catch{}}let C={show:!0,position:`below`},w=`dsh.ui-usage-billing.livecost`,T=`dsh.ui-usage-billing.livecost-pref`;function E(){try{let e=localStorage.getItem(w);if(e===null)return{...C};let t=JSON.parse(e);return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`?t.position:`below`}}catch{return{...C}}}function D(e){try{localStorage.setItem(w,JSON.stringify(e))}catch{}}let O=`dsh.ui-usage-billing.prices`;function k(){try{let e=localStorage.getItem(O);if(e===null)return[];let t=JSON.parse(e);if(t===null)return[];let n=[],r=(e,t)=>{if(typeof t!=`object`||!t)return;let r=t,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})}n.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(t))for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.key==`string`&&t.key!==``&&r(t.key,e)}else if(typeof t==`object`)for(let[e,n]of Object.entries(t))r(e,n);return n}catch{return[]}}function A(e){try{localStorage.setItem(O,JSON.stringify(e))}catch{}}let te={metric:`ttft`},j=`dsh.ui-usage-billing.perf`;function M(){try{let e=localStorage.getItem(j);if(e===null)return{...te};let t=JSON.parse(e);return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}catch{return{...te}}}function ne(e){try{localStorage.setItem(j,JSON.stringify(e))}catch{}}let N=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(N)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=N,e.textContent=`.KFXqYa_railButton{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);width:36px;height:36px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;transition:border-color .16s,color .16s;display:flex}.KFXqYa_railButton:hover,.KFXqYa_railButton:focus-visible{border-color:var(--dsw-static-blue-500);color:var(--dsw-static-blue-500);outline:none}.KFXqYa_railButton svg{stroke-width:2px;width:18px;height:18px}.KFXqYa_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);width:100%;min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;border-radius:14px;align-items:center;gap:10px;padding:9px 12px;transition:border-color .16s,transform .16s,box-shadow .16s;display:flex;position:relative;overflow:hidden;box-shadow:0 1px 2px #0000000a}.KFXqYa_trigger:hover,.KFXqYa_trigger:focus-visible{border-color:var(--dsw-static-blue-500);box-shadow:0 6px 18px -8px color-mix(in srgb, var(--dsw-static-blue-500) 45%, transparent);outline:none;transform:translateY(-1px)}.KFXqYa_triggerIcon{border:1px solid var(--dsw-alias-border-l1);width:32px;height:32px;color:var(--dsw-alias-label-secondary);opacity:.8;border-radius:8px;flex:none;justify-content:center;align-items:center;display:inline-flex}.KFXqYa_triggerIcon svg{stroke-width:2px;width:16px;height:16px}.KFXqYa_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.KFXqYa_triggerPrimary{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.KFXqYa_triggerLabel{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.KFXqYa_triggerYen{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.KFXqYa_triggerMetric{color:var(--dsw-alias-label-primary);letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:20px;font-weight:700;line-height:24px;overflow:hidden}.KFXqYa_triggerSub{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;font-size:10px;line-height:14px;overflow:hidden}.KFXqYa_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.KFXqYa_triggerSparkBar,.KFXqYa_triggerSparkHot{background:var(--dsw-static-blue-500);opacity:.6;border-radius:1px 1px 0 0;width:3px}.KFXqYa_triggerSparkHot{opacity:1}.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<=200px){.KFXqYa_trigger{gap:6px;padding:8px 10px}.KFXqYa_triggerSpark{display:none}}@container KFXqYa_billing-trigger (width<=170px){.KFXqYa_triggerSub,.KFXqYa_triggerLabel{display:none}}@container KFXqYa_billing-trigger (width<=110px){.KFXqYa_triggerIcon,.KFXqYa_triggerSpark,.KFXqYa_triggerSub,.KFXqYa_triggerLabel{display:none}.KFXqYa_trigger{justify-content:center;padding:8px 6px}}.KFXqYa_triggerPop{box-sizing:border-box;border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 80%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 72%, transparent);-webkit-backdrop-filter:blur(14px)saturate(1.3);width:256px;box-shadow:0 12px 32px #00000029, inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent);opacity:0;visibility:hidden;pointer-events:none;z-index:2000;border-radius:14px;flex-direction:column;gap:5px;padding:10px 12px;transition:opacity .16s,transform .16s,visibility 0s linear .16s;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 0%, var(--dsw-static-amber-500) 30%, var(--dsw-alias-label-primary) 50%, var(--dsw-static-amber-500) 70%, transparent 100%);opacity:.9;pointer-events:none;background-size:200% 100%;height:1.5px;animation:4s ease-in-out infinite KFXqYa_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}.KFXqYa_triggerPopShown{opacity:1;visibility:visible;transition:opacity .16s,transform .16s,visibility linear;transform:translateY(-100%)}.KFXqYa_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.KFXqYa_popTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:700;line-height:18px}.KFXqYa_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 8px;display:grid}.KFXqYa_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.KFXqYa_metricLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.KFXqYa_metricValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:12px;font-weight:700;line-height:16px}.KFXqYa_metricValuePrimary{color:var(--dsw-static-amber-500)}.KFXqYa_metricValueSuccess{color:var(--dsw-static-green-500)}.KFXqYa_popModel{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding-top:10px;display:flex}.KFXqYa_popModelLabel{color:var(--dsw-alias-label-tertiary);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(--dsw-static-green-500)}.KFXqYa_popDotSub{background:var(--dsw-static-amber-500)}.KFXqYa_popDotNeutral{background:var(--dsw-alias-label-tertiary)}.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(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.KFXqYa_popTagSub{background:color-mix(in srgb, var(--dsw-static-amber-500) 18%, transparent);color:var(--dsw-static-amber-500)}.KFXqYa_popModelName{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.KFXqYa_popModelStatus{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;margin-left:auto;font-size:11px;font-weight:600;line-height:16px}.KFXqYa_popModelStatusLow{color:var(--dsw-static-red-500)}.KFXqYa_dashboardModal{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:14px;width:min(760px,100vw - 48px);max-height:min(760px,88vh);animation:.18s ease-out KFXqYa_dashboardIn;box-shadow:0 12px 32px -12px #0000002e,0 2px 8px #0000000f}@keyframes KFXqYa_dashboardIn{0%{opacity:0;transform:translateY(8px)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%;max-height:min(760px,88vh);display:flex}.KFXqYa_dashboardHead{border-bottom:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.KFXqYa_dashboardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.KFXqYa_dashboardSubtitle{color:var(--dsw-alias-label-caption);margin:2px 0 0;font-size:11px;line-height:16px}.KFXqYa_closeButton{border:1px solid var(--dsw-alias-border-l1);width:32px;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border-radius:8px;flex:none;justify-content:center;align-items:center;transition:background-color .14s,color .14s;display:inline-flex}.KFXqYa_closeButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.KFXqYa_closeButton svg{stroke-width:2px;width:16px;height:16px}.KFXqYa_dashboardBody{flex-direction:column;gap:14px;padding:16px 24px 24px;display:flex;overflow-y:auto}.KFXqYa_modalFooter{border-top:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 18px;font-size:11px;line-height:16px;display:flex}.KFXqYa_tabNav{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;align-items:center;gap:4px;margin:14px 24px 0;padding:4px;display:flex}.KFXqYa_tabButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:7px;padding:6px 14px;font-size:13px;font-weight:500;line-height:20px;transition:background-color .16s,color .16s}.KFXqYa_tabButton:hover,.KFXqYa_tabButton:focus-visible{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 62%, transparent);outline:none}.KFXqYa_tabButtonActive,.KFXqYa_tabButtonActive:hover,.KFXqYa_tabButtonActive:focus-visible{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font-weight:600;box-shadow:0 1px 3px #0000001f}.KFXqYa_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out KFXqYa_tabPanelIn;display:flex}@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(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;flex-direction:column;gap:12px;padding:14px 16px;display:flex;position:relative;overflow:hidden}.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(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:14px}.KFXqYa_heroReadout{align-items:baseline;gap:4px;display:flex}.KFXqYa_heroCurrency{letter-spacing:-.01em;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:15px;font-weight:600;line-height:20px}.KFXqYa_heroValue{letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:28px;font-weight:650;line-height:34px}.KFXqYa_heroMeta{color:var(--dsw-alias-label-caption);white-space:nowrap;margin-top:2px;font-size:11px;line-height:15px}.KFXqYa_heroGauge{flex:none;width:72px;height:72px;position:relative}.KFXqYa_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.KFXqYa_heroGaugeTrack{fill:none;stroke:var(--dsw-alias-bg-module-platform);stroke-width:7px}.KFXqYa_heroGaugeArc{fill:none;stroke:var(--dsw-static-blue-500);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray .26s}.KFXqYa_heroGaugeArcOver{stroke:var(--dsw-static-red-500)}.KFXqYa_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.KFXqYa_heroGaugePct{letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:700;line-height:18px}.KFXqYa_heroGaugePctOver{color:var(--dsw-static-red-500)}.KFXqYa_heroGaugeLabel{color:var(--dsw-alias-label-tertiary);font-size:9px;line-height:12px}.KFXqYa_heroBudget{border-top:1px solid var(--dsw-alias-border-l1);align-items:center;gap:14px;padding-top:14px;display:flex}.KFXqYa_heroBudgetLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px;line-height:16px}.KFXqYa_heroBudgetTrack{background:var(--dsw-alias-border-l1);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.KFXqYa_heroBudgetFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .22s}.KFXqYa_heroBudgetFillOver{background:var(--dsw-static-red-500)}.KFXqYa_heroBudgetValue{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:11px;line-height:16px}.KFXqYa_heroSide{border-top:1px solid var(--dsw-alias-border-l1);align-items:stretch;padding-top:12px;display:flex}.KFXqYa_heroSideItem{border-left:1px solid var(--dsw-alias-border-l1);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(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:13px}.KFXqYa_heroSideValue{color:var(--dsw-alias-label-primary);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(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 12%, transparent)}.KFXqYa_deltaDown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 12%, transparent)}.KFXqYa_unpricedHint{border:1px solid color-mix(in srgb, var(--dsw-static-amber-500) 30%, transparent);background:color-mix(in srgb, var(--dsw-static-amber-500) 8%, transparent);color:var(--dsw-static-amber-500);border-radius:8px;align-items:center;padding:8px 12px;font-size:11.5px;font-weight:500;line-height:17px;display:flex}.KFXqYa_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;display:grid}.KFXqYa_kpiTile{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;flex-direction:column;gap:2px;padding:10px 12px;transition:border-color .16s;display:flex;position:relative;overflow:hidden}.KFXqYa_kpiTile:hover{border-color:var(--dsw-alias-border-l2)}.KFXqYa_kpiLabel{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;font-size:10px;font-weight:500;line-height:13px}.KFXqYa_kpiValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;letter-spacing:-.01em;font-size:16px;font-weight:650;line-height:22px}.KFXqYa_kpiGreen{color:var(--dsw-static-green-500)}.KFXqYa_kpiDetail{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;font-size:10.5px;line-height:14px;overflow:hidden}.KFXqYa_panel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:10px;flex-direction:column;gap:8px;padding:12px 14px;transition:border-color .16s;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(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.KFXqYa_panelHint{color:var(--dsw-alias-label-caption);white-space:nowrap;font-size:11px;line-height:16px}.KFXqYa_rangeToggle{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:8px;gap:2px;padding:2px;display:inline-flex}.KFXqYa_rangeButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:11px;line-height:16px;transition:background-color .14s,color .14s}.KFXqYa_rangeButtonActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font-weight:600}.KFXqYa_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.KFXqYa_exportLabel{color:var(--dsw-alias-label-caption);font-size:11px;line-height:16px}.KFXqYa_exportButton{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:999px;padding:4px 12px;font-size:11.5px;line-height:16px;transition:border-color .16s,color .16s,background-color .16s}.KFXqYa_exportButton:hover,.KFXqYa_exportButton:focus-visible{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);outline:none}.KFXqYa_shareTrack{background:var(--dsw-alias-bg-module-platform);border-radius:999px;height:10px;display:flex;overflow:hidden}.KFXqYa_shareSeg{height:100%;transition:width .2s}.KFXqYa_shareSegPeak{background:var(--dsw-static-blue-500)}.KFXqYa_shareSegOff{background:color-mix(in srgb, var(--dsw-static-blue-500) 25%, var(--dsw-alias-bg-module-platform))}.KFXqYa_shareSegUser{background:var(--dsw-static-blue-500)}.KFXqYa_shareSegAssistant{background:var(--dsw-static-green-500)}.KFXqYa_shareSegTool{background:var(--dsw-static-amber-500)}.KFXqYa_shareLegend{align-items:center;gap:16px;display:flex}.KFXqYa_shareItem{color:var(--dsw-alias-label-secondary);align-items:baseline;gap:6px;font-size:12px;line-height:17px;display:inline-flex}.KFXqYa_bucketCost{align-items:baseline;gap:3px;display:inline-flex}.KFXqYa_bucketOfficial{color:var(--dsw-static-blue-500);font-weight:600}.KFXqYa_bucketSep{color:var(--dsw-alias-label-dimmed)}.KFXqYa_bucketThird{color:var(--dsw-alias-label-secondary)}.KFXqYa_shareDot{border-radius:50%;flex:none;align-self:center;width:8px;height:8px}.KFXqYa_shareValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_budgetInput{width:64px;color:var(--dsw-alias-label-primary);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(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);cursor:pointer;border-radius:999px;flex:none;width:30px;height:17px;padding:0;transition:background-color .16s,border-color .16s;position:relative}.KFXqYa_switchOn{border-color:var(--dsw-alias-border-l1);background:var(--dsw-alias-label-primary)}.KFXqYa_switchKnob{background:var(--dsw-static-neutral-bluish-00);border-radius:50%;width:11px;height:11px;transition:transform .16s;position:absolute;top:2px;left:2px}.KFXqYa_switchOn .KFXqYa_switchKnob{transform:translate(13px)}.KFXqYa_budgetFillWarn{background:var(--dsw-static-amber-500)}.KFXqYa_budgetFillOver{background:var(--dsw-static-red-500);animation:1.6s ease-in-out infinite KFXqYa_budgetOverPulse}@keyframes KFXqYa_budgetOverPulse{50%{opacity:.55}}.KFXqYa_chartWrap{width:100%;position:relative}.KFXqYa_chartSvg{width:100%;height:auto;display:block}.KFXqYa_chartEmpty{height:140px;color:var(--dsw-alias-label-caption);justify-content:center;align-items:center;font-size:13px;display:flex}.KFXqYa_emptyRow{text-align:center;color:var(--dsw-alias-label-caption);padding:28px 0;font-size:13px}.KFXqYa_chartGrid{stroke:var(--dsw-alias-border-l1);stroke-width:1px}.KFXqYa_chartAxisLabel{fill:var(--dsw-alias-label-tertiary);font-size:10px}.KFXqYa_chartBar{fill:var(--dsw-static-blue-500);opacity:.7}.KFXqYa_chartBar:hover{opacity:1}.KFXqYa_chartStack{stroke:var(--dsw-alias-bg-layer-1);stroke-width:.75px}.KFXqYa_chartStack:hover{opacity:.9}.KFXqYa_chartLine{stroke:var(--dsw-static-blue-500);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.KFXqYa_chartCrosshair{stroke:var(--dsw-alias-label-dimmed);stroke-width:1px;stroke-dasharray:3 3}.KFXqYa_chartTooltip{pointer-events:none;z-index:2;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);box-shadow:none;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(--dsw-alias-label-primary);margin-bottom:3px;font-size:11px;font-weight:600}.KFXqYa_chartTooltipRow{color:var(--dsw-alias-label-secondary);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.KFXqYa_chartTooltipRow strong{color:var(--dsw-alias-label-primary);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(--dsw-alias-label-primary);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(--dsw-alias-label-caption);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(--dsw-alias-label-secondary) 30%, transparent)}.KFXqYa_chartLegendLine{background:var(--dsw-static-blue-500);border-radius:2px;width:10px;height:3px;display:inline-block}.KFXqYa_chartLegendBar{background:var(--dsw-static-blue-500);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.KFXqYa_chartTooltipSwatch{border-radius:3px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartLegend{color:var(--dsw-alias-label-tertiary);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(--dsw-alias-label-secondary)}.KFXqYa_chartLegendItemActive{color:var(--dsw-alias-label-primary);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(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:999px;align-items:center;gap:5px;padding:2px 9px;font-size:11px;line-height:16px;transition:border-color .12s,color .12s,opacity .12s;display:inline-flex}.KFXqYa_perfChip:hover{color:var(--dsw-alias-label-primary)}.KFXqYa_perfChipOff{opacity:.45}.KFXqYa_perfChipDot{border-radius:3px;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_chartHoverDot{stroke:var(--dsw-alias-bg-layer-2);stroke-width:1.5px}.KFXqYa_tableScroll{border:1px solid var(--dsw-alias-border-l1);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px;overflow:auto}.KFXqYa_ubAlert{border:1px solid color-mix(in srgb, var(--dsw-static-blue-500) 30%, transparent);background:color-mix(in srgb, var(--dsw-static-blue-500) 8%, transparent);border-radius:10px;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(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.KFXqYa_ubAlertNote{color:var(--dsw-alias-label-secondary);margin:0}.KFXqYa_ubTag,.KFXqYa_ubTagSuccess,.KFXqYa_ubTagNeutral,.KFXqYa_ubTagAlert,.KFXqYa_ubTagPromo{white-space:nowrap;border-radius:999px;align-items:center;height:18px;padding:0 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.KFXqYa_ubTagSuccess{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.KFXqYa_ubTagNeutral{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.KFXqYa_ubTagAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.KFXqYa_ubTagPromo{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500);cursor:help}.KFXqYa_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.KFXqYa_ubExtraName{color:var(--dsw-alias-label-secondary);margin-left:26px}.KFXqYa_ubExtraNote{color:var(--dsw-alias-label-tertiary);margin-left:8px;font-size:10px}.KFXqYa_ubCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;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(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_ubCardSub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.KFXqYa_ubTablewrap{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;overflow:auto}.KFXqYa_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12.5px}.KFXqYa_ubTable th,.KFXqYa_ubTable td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;padding:9px 12px}.KFXqYa_ubTable tbody tr:last-child td{border-bottom:0}.KFXqYa_ubTable thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;font-size:11px;font-weight:600}.KFXqYa_ubModel{align-items:center;gap:8px;display:inline-flex}.KFXqYa_vendorLogo{object-fit:contain;border-radius:4px;flex:none;width:18px;height:18px}.KFXqYa_vendorLetter{color:#fff;border-radius:4px;flex:none;justify-content:center;align-items:center;width:18px;height:18px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.KFXqYa_ubModelName{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-weight:500;display:inline-flex}.KFXqYa_ubPricepair{flex-wrap:wrap;gap:6px;display:inline-flex}.KFXqYa_ubChipPeak,.KFXqYa_ubChipOff{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:5px;height:20px;padding:0 8px;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(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.KFXqYa_ubChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.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(--dsw-alias-label-primary);flex:0 0 72px;font-size:12px;font-weight:500}.KFXqYa_ubNotesDesc{min-width:0;color:var(--dsw-alias-label-secondary);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(--dsw-static-red-500) 14%, transparent);height:18px;color:var(--dsw-static-red-500);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:12.5px}.KFXqYa_modelTable th:first-child{width:26%}.KFXqYa_modelTable th,.KFXqYa_modelTable td th td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;white-space:nowrap;padding:7px 10px}.KFXqYa_modelTable tbody tr:last-child td tbody tr:last-child td{border-bottom:0}.KFXqYa_sessionGroupRow{cursor:pointer}.KFXqYa_sessionGroupRow .KFXqYa_modelName:before{content:"›";color:var(--dsw-alias-label-tertiary);margin-right:6px;display:inline-block}.KFXqYa_sessionGroupRow[aria-expanded=true] .KFXqYa_modelName:before{transform:rotate(90deg)}.KFXqYa_sessionChildRow td:first-child{padding-left:30px}.KFXqYa_modelTable thead th thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;background:0 0;font-size:11px;font-weight:600}.KFXqYa_modelTable tbody tr tbody tr{transition:background-color .12s}.KFXqYa_modelTable tbody tr:hover 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:var(--dsw-alias-interactive-bg-hover)}.KFXqYa_numCol{text-align:right;font-variant-numeric:tabular-nums}.KFXqYa_na{color:var(--dsw-alias-label-dimmed)}.KFXqYa_modelCell{align-items:center;gap:8px;display:inline-flex}.KFXqYa_modelDot{border-radius:50%;flex:none;width:9px;height:9px}.KFXqYa_modelName{color:var(--dsw-alias-label-primary);font-weight:500;line-height:16px;display:block}.KFXqYa_modelProvider{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px;display:block}.KFXqYa_siteRow{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:10px;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-radius:999px;flex:none;align-items:center;padding:1px 7px;font-size:10.5px;font-weight:600;line-height:16px;display:inline-flex}.KFXqYa_siteKindSite{color:var(--dsw-static-blue-500);background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent)}.KFXqYa_siteKindDirect{color:var(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent)}.KFXqYa_siteKindUnknown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent)}.KFXqYa_siteRowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-weight:600;line-height:18px;overflow:hidden}.KFXqYa_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_siteRowCost{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:700;line-height:18px}.KFXqYa_siteRowCalls{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.KFXqYa_siteRowCallsLow{color:var(--dsw-static-red-500)}.KFXqYa_flatTag{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px}.KFXqYa_healthDot{border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.KFXqYa_healthOk{background:var(--dsw-static-green-500)}.KFXqYa_healthBad{background:var(--dsw-static-red-500)}.KFXqYa_healthIdle{background:var(--dsw-static-neutral-bluish-400)}.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(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_healthBadgeBad{color:var(--dsw-static-red-500);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_planTag{color:var(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2);border-radius:999px;align-items:center;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px;display:inline-flex}.KFXqYa_uncataloguedTag{vertical-align:1px;color:var(--dsw-static-amber-500);background:var(--dsw-alias-bg-layer-2);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.KFXqYa_estimatedTag{vertical-align:1px;color:var(--dsw-static-blue-500);background:var(--dsw-alias-bg-layer-2);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(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;border-radius:999px;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;font-size:11px;line-height:16px;display:inline-flex}.KFXqYa_feeBarAbove{order:-1;align-self:center;margin-bottom:8px}.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(--dsw-alias-label-primary);padding-right:6px;font-weight:600}.KFXqYa_feeInlineAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 12%, transparent)}.KFXqYa_feeInlineAlert .KFXqYa_feeInlineNum{color:var(--dsw-static-amber-500)}.KFXqYa_feeInlineError{background:color-mix(in srgb, var(--dsw-static-red-500) 12%, transparent)}.KFXqYa_feeInlineError .KFXqYa_feeInlineNum{color:var(--dsw-static-red-500)}.KFXqYa_feeBar .KFXqYa_feeSep{color:var(--dsw-alias-label-dimmed)}.KFXqYa_feeCount{color:var(--dsw-alias-label-primary);font-weight:600}.KFXqYa_feeSuffix{color:var(--dsw-alias-label-tertiary)}.KFXqYa_feeItem{color:var(--dsw-alias-label-secondary);white-space:nowrap}.KFXqYa_feeNum{color:var(--dsw-alias-label-primary);font-weight:600}.KFXqYa_feeSep{color:var(--dsw-alias-label-tertiary)}.KFXqYa_feeChipPrimary,.KFXqYa_feeChipOff,.KFXqYa_feeChipAlert,.KFXqYa_feeChipError{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{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.KFXqYa_feeChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.KFXqYa_feeChipAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.KFXqYa_feeChipError{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500)}.KFXqYa_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.KFXqYa_balanceDaysBadge{border:1px solid var(--dsw-alias-label-caption);background:color-mix(in srgb, var(--dsw-alias-label-caption) 10%, transparent);min-width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:12px;justify-content:center;align-items:center;padding:0 6px;font-size:10.5px;font-weight:600;line-height:1;display:inline-flex}.KFXqYa_balanceDaysBadge:hover{border-color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-caption) 18%, transparent)}.KFXqYa_balanceDaysBadgeLow{color:var(--dsw-static-red-500);border-color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 10%, transparent)}.KFXqYa_balanceDetailPop{z-index:20;background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-label-caption);white-space:nowrap;border-radius:8px;flex-direction:column;gap:6px;min-width:180px;padding:8px 10px;display:inline-flex;position:absolute;top:calc(100% + 6px);right:0;box-shadow:0 6px 20px #0000002e}.KFXqYa_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.KFXqYa_balanceDetailTitle{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600}.KFXqYa_balanceDetailClose{cursor:pointer;color:var(--dsw-alias-label-caption);background:0 0;border:none;font-size:14px;line-height:1}.KFXqYa_balanceDetailClose:hover{color:var(--dsw-alias-label-primary)}.KFXqYa_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.KFXqYa_balanceDetailRow{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;justify-content:space-between;gap:16px;font-size:11px;line-height:15px;display:flex}.KFXqYa_balanceDetailLabel{color:var(--dsw-alias-label-caption)}.KFXqYa_balanceDetailValue{color:var(--dsw-alias-label-primary);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(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.KFXqYa_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.KFXqYa_subscriptionCard{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) 62%, transparent);-webkit-backdrop-filter:blur(12px)saturate(1.3);border-radius:12px;padding:12px 14px;transition:border-color .2s,box-shadow .2s;position:relative;overflow:hidden;box-shadow:0 8px 24px #0000001a}.KFXqYa_subscriptionCard:before{content:"";background:linear-gradient(90deg, transparent 0%, var(--dsw-static-amber-500) 30%, var(--dsw-alias-label-primary) 50%, var(--dsw-static-amber-500) 70%, transparent 100%);opacity:.9;pointer-events:none;background-size:200% 100%;height:1.5px;animation:3.6s ease-in-out infinite KFXqYa_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}@keyframes KFXqYa_subscriptionGoldFlow{0%{background-position:200% 0}to{background-position:-200% 0}}.KFXqYa_subscriptionCard:hover{border-color:color-mix(in srgb, var(--dsw-static-amber-500) 55%, var(--dsw-alias-border-l1));box-shadow:0 10px 30px #00000029}.KFXqYa_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.KFXqYa_subscriptionName{font-size:13px;font-weight:700}.KFXqYa_subscriptionPlan{color:var(--dsw-alias-label-secondary);font-size:11px}.KFXqYa_subscriptionPlan[data-kind=code],.KFXqYa_subscriptionPlan[data-kind=token]{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);border-radius:999px;padding:1px 8px;font-weight:500}.KFXqYa_subscriptionTier{color:var(--dsw-alias-label-secondary);margin-left:6px}.KFXqYa_subscriptionAuto{color:var(--dsw-static-blue-500);background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, var(--dsw-alias-bg-layer-2));border-radius:999px;margin-left:6px;padding:1px 6px;font-size:10px}.KFXqYa_subscriptionStatus{color:var(--dsw-alias-label-secondary);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(--dsw-alias-label-secondary);flex:0 0 44px}.KFXqYa_subscriptionTrack{background:var(--dsw-alias-bg-layer-3);border-radius:3px;flex:1;height:6px;overflow:hidden}.KFXqYa_subscriptionFill{background:var(--dsw-static-blue-500);border-radius:3px;height:100%;transition:width .2s;display:block}.KFXqYa_subscriptionFillWarn{background:var(--dsw-static-amber-500)}.KFXqYa_subscriptionFillOver{background:var(--dsw-static-red-500)}.KFXqYa_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.KFXqYa_subscriptionPct{text-align:right;font-variant-numeric:tabular-nums;flex:none;min-width:52px}.KFXqYa_subscriptionExhausted{color:var(--dsw-static-red-500);min-width:52px;font-weight:600}.KFXqYa_subscriptionReset{color:var(--dsw-alias-label-caption);white-space:nowrap;flex:none;font-size:10px}.KFXqYa_providerGroupList{flex-direction:column;gap:10px;display:flex}.KFXqYa_providerGroup{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:12px;padding:12px 14px}.KFXqYa_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.KFXqYa_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.KFXqYa_providerGroupName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:18px}.KFXqYa_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.KFXqYa_providerGroupBadge{color:var(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2);border-radius:999px;justify-content:center;align-items:center;min-width:64px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px;display:inline-flex}.KFXqYa_providerGroupBalance,.KFXqYa_providerGroupCost{color:var(--dsw-alias-label-secondary);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(--dsw-alias-label-primary);text-align:right;min-width:56px;font-weight:600}.KFXqYa_providerGroupBalanceLabel{color:var(--dsw-alias-label-caption);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(--dsw-static-amber-500) 16%, transparent)}.KFXqYa_roundsBarColOff{background:var(--dsw-alias-bg-module-platform)}.KFXqYa_roundsBarLabel{text-align:center;color:var(--dsw-alias-label-secondary);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(--dsw-static-blue-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsBarFlagged{background:var(--dsw-static-red-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.KFXqYa_roundsFlagMark{background:var(--dsw-static-red-500);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.KFXqYa_roundsAxis{color:var(--dsw-alias-label-secondary);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.KFXqYa_roundsEmpty{color:var(--dsw-alias-label-secondary);margin-top:10px;font-size:12px}.KFXqYa_heatmap{margin-top:10px}.KFXqYa_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;display:grid}.KFXqYa_heatmapCellEmpty{background:var(--dsw-alias-bg-layer-1);height:30px;color:var(--dsw-alias-label-dimmed);font-variant-numeric:tabular-nums;border-radius:8px;justify-content:center;align-items:center;font-size:11px;display:flex}.KFXqYa_heatmapCell{font-variant-numeric:tabular-nums;cursor:pointer;border:0;border-radius:8px;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_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:4px;width:14px;height:14px;display:block}.KFXqYa_heatmapHover{font-variant-numeric:tabular-nums;margin-left:auto}.KFXqYa_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.KFXqYa_heatmapRangeButton{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-text-secondary);cursor:pointer;background:0 0;border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4}.KFXqYa_heatmapRangeButtonActive{color:var(--dsw-alias-text-primary);border-color:currentColor;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(--dsw-alias-text-tertiary);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(--dsw-alias-text-tertiary);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_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(--dsw-static-blue-500);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-static-blue-500) 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(--dsw-static-blue-500);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(--dsw-static-amber-500);background:color-mix(in srgb, var(--dsw-static-amber-500) 12%, transparent);border:1px solid color-mix(in srgb, var(--dsw-static-amber-500) 30%, transparent);border-radius:10px;align-items:center;gap:6px;margin:0 0 10px;padding:8px 10px;font-size:11px;display:flex}.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(--dsw-static-blue-500);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(--dsw-static-blue-500)}.KFXqYa_tokenModelPartOut{background:var(--dsw-static-amber-500)}.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:1px solid var(--dsw-alias-border-l1);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 82%, transparent);-webkit-backdrop-filter:blur(12px)saturate(1.2);border-radius:12px;flex-direction:column;gap:8px;min-width:280px;max-width:380px;padding:16px;animation:.2s KFXqYa_peakAlertIn;display:flex;position:fixed;box-shadow:0 4px 16px #00000014}.KFXqYa_peakCardCorner{bottom:18px;right:18px}.KFXqYa_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.KFXqYa_peakCardPeak{color:var(--dsw-static-blue-500)}.KFXqYa_peakCardOff{color:var(--dsw-static-green-500)}.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(--dsw-static-blue-500)}.KFXqYa_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-static-green-500)}.KFXqYa_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.KFXqYa_peakDotPrimary{background:var(--dsw-static-blue-500)}.KFXqYa_peakDotSuccess{background:var(--dsw-static-green-500)}.KFXqYa_peakClose{width:24px;height:24px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;font-size:15px;line-height:1;transition:background-color .14s,color .14s;display:inline-flex}.KFXqYa_peakClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2)}.KFXqYa_peakCount{font-variant-numeric:tabular-nums;font-size:28px;font-weight:700;line-height:34px}.KFXqYa_peakCountPrimary{color:var(--dsw-static-blue-500)}.KFXqYa_peakCountSuccess{color:var(--dsw-static-green-500)}.KFXqYa_peakDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:18px}@keyframes KFXqYa_peakAlertIn{0%{opacity:0}to{opacity:1}}.KFXqYa_setCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;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(--dsw-alias-border-l1);border-radius:10px;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(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.KFXqYa_setCardDesc{color:var(--dsw-alias-label-secondary);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(--dsw-alias-label-secondary);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(--dsw-alias-border-l1);align-items:center;gap:10px;padding:8px 0;display:flex}.KFXqYa_userPriceCheck{width:14px;height:14px;accent-color:var(--dsw-static-blue-500);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(--dsw-alias-border-l1);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(--dsw-alias-label-secondary);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(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:96px;max-width:160px;color:var(--dsw-alias-label-primary);border-radius:6px;padding:4px 8px;font-size:12px;line-height:16px}.KFXqYa_userPriceInputNum{min-width:72px;max-width:88px}.KFXqYa_rdo{color:var(--dsw-alias-label-secondary);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(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:50%;flex:none;width:14px;height:14px;position:relative}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot{border-color:var(--dsw-static-blue-500)}.KFXqYa_rdo input:checked+.KFXqYa_rdoDot:after{content:"";background:var(--dsw-static-blue-500);border-radius:50%;position:absolute;inset:3px}.KFXqYa_inp{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:6px;align-items:center;gap:4px;padding:2px 6px;display:inline-flex}.KFXqYa_affix{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.KFXqYa_prog{background:var(--dsw-alias-bg-module-platform);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.KFXqYa_progFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .2s}.KFXqYa_btn{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;line-height:16px;transition:border-color .16s,color .16s,background-color .16s;display:inline-flex}.KFXqYa_btn:hover{border-color:var(--dsw-static-blue-500);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-static-blue-500) 12%, var(--dsw-alias-bg-layer-1))}.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(--dsw-alias-label-primary)}`,document.head.appendChild(e)}var P={triggerPopShown:`KFXqYa_triggerPopShown`,panelTitle:`KFXqYa_panelTitle`,heroBudgetTrack:`KFXqYa_heroBudgetTrack`,modelTable:`KFXqYa_modelTable`,providerGroupCost:`KFXqYa_providerGroupCost`,plgName:`KFXqYa_plgName`,healthDot:`KFXqYa_healthDot`,tokenModelShareRow:`KFXqYa_tokenModelShareRow`,peakCardPeak:`KFXqYa_peakCardPeak`,feeCount:`KFXqYa_feeCount`,heatmapRangeSwitch:`KFXqYa_heatmapRangeSwitch`,panelHeadControls:`KFXqYa_panelHeadControls`,rdoChevron:`KFXqYa_rdoChevron`,inp:`KFXqYa_inp`,triggerSub:`KFXqYa_triggerSub`,chartBarPlaceholder:`KFXqYa_chartBarPlaceholder`,modalFooter:`KFXqYa_modalFooter`,ubNotesDesc:`KFXqYa_ubNotesDesc`,modelName:`KFXqYa_modelName`,plgIcon:`KFXqYa_plgIcon`,peakCardOff:`KFXqYa_peakCardOff`,tabPanelIn:`KFXqYa_tabPanelIn`,heroMain:`KFXqYa_heroMain`,heroReadout:`KFXqYa_heroReadout`,feeInlineError:`KFXqYa_feeInlineError`,setCard:`KFXqYa_setCard`,dashboardSubtitle:`KFXqYa_dashboardSubtitle`,switchOn:`KFXqYa_switchOn`,chartLegendBar:`KFXqYa_chartLegendBar`,feeSep:`KFXqYa_feeSep`,triggerLabel:`KFXqYa_triggerLabel`,subscriptionCard:`KFXqYa_subscriptionCard`,popModelStatus:`KFXqYa_popModelStatus`,heroCurrency:`KFXqYa_heroCurrency`,subscriptionFillWarn:`KFXqYa_subscriptionFillWarn`,providerGroupCostValue:`KFXqYa_providerGroupCostValue`,deltaUp:`KFXqYa_deltaUp`,deltaDown:`KFXqYa_deltaDown`,siteRowCalls:`KFXqYa_siteRowCalls`,numCol:`KFXqYa_numCol`,ubCardSub:`KFXqYa_ubCardSub`,balanceDetailTitle:`KFXqYa_balanceDetailTitle`,modelRowFocusable:`KFXqYa_modelRowFocusable`,chartLegend:`KFXqYa_chartLegend`,tabButtonActive:`KFXqYa_tabButtonActive`,setGrid3:`KFXqYa_setGrid3`,currencyButton:`KFXqYa_currencyButton`,flatTag:`KFXqYa_flatTag`,triggerMetric:`KFXqYa_triggerMetric`,unpricedHint:`KFXqYa_unpricedHint`,subscriptionTier:`KFXqYa_subscriptionTier`,staleNotice:`KFXqYa_staleNotice`,kpiDetail:`KFXqYa_kpiDetail`,userPriceField:`KFXqYa_userPriceField`,dashboardIn:`KFXqYa_dashboardIn`,hero:`KFXqYa_hero`,tableScroll:`KFXqYa_tableScroll`,heatmapYearCell:`KFXqYa_heatmapYearCell`,userPriceRow:`KFXqYa_userPriceRow`,panelHint:`KFXqYa_panelHint`,popTagSub:`KFXqYa_popTagSub`,subscriptionHead:`KFXqYa_subscriptionHead`,heatmapYearGrid:`KFXqYa_heatmapYearGrid`,ubAlert:`KFXqYa_ubAlert`,balanceDetailClose:`KFXqYa_balanceDetailClose`,metricLabel:`KFXqYa_metricLabel`,peakCardCenter:`KFXqYa_peakCardCenter`,ubChipPeak:`KFXqYa_ubChipPeak`,rangeButton:`KFXqYa_rangeButton`,chartTooltipRow:`KFXqYa_chartTooltipRow`,triggerSparkBar:`KFXqYa_triggerSparkBar`,budgetInput:`KFXqYa_budgetInput`,feeBarAbove:`KFXqYa_feeBarAbove`,ubExtraRow:`KFXqYa_ubExtraRow`,balanceDetailRow:`KFXqYa_balanceDetailRow`,roundsBarColOff:`KFXqYa_roundsBarColOff`,tabPanel:`KFXqYa_tabPanel`,triggerWrap:`KFXqYa_triggerWrap`,rdoRow:`KFXqYa_rdoRow`,roundsBar:`KFXqYa_roundsBar`,plgLink:`KFXqYa_plgLink`,peakCount:`KFXqYa_peakCount`,popDotNeutral:`KFXqYa_popDotNeutral`,shareSegUser:`KFXqYa_shareSegUser`,heroBudgetValue:`KFXqYa_heroBudgetValue`,peakCountSuccess:`KFXqYa_peakCountSuccess`,heatmapYearBody:`KFXqYa_heatmapYearBody`,popModelName:`KFXqYa_popModelName`,reconcileIcon:`KFXqYa_reconcileIcon`,currencyToggle:`KFXqYa_currencyToggle`,subscriptionPct:`KFXqYa_subscriptionPct`,providerGroupList:`KFXqYa_providerGroupList`,dashboard:`KFXqYa_dashboard`,chartTooltipLabel:`KFXqYa_chartTooltipLabel`,floatSubHead:`KFXqYa_floatSubHead`,userPriceCheck:`KFXqYa_userPriceCheck`,shareSeg:`KFXqYa_shareSeg`,ubAlertLeft:`KFXqYa_ubAlertLeft`,balanceDetailGrid:`KFXqYa_balanceDetailGrid`,feeNum:`KFXqYa_feeNum`,ctlCol:`KFXqYa_ctlCol`,ubTablewrap:`KFXqYa_ubTablewrap`,shareSegOff:`KFXqYa_shareSegOff`,chartTooltipModelDetail:`KFXqYa_chartTooltipModelDetail`,modelDot:`KFXqYa_modelDot`,popModelStatusLow:`KFXqYa_popModelStatusLow`,na:`KFXqYa_na`,ubTagNeutral:`KFXqYa_ubTagNeutral`,perfChip:`KFXqYa_perfChip`,subscriptionWindowLabel:`KFXqYa_subscriptionWindowLabel`,heatmap:`KFXqYa_heatmap`,chartLegendItemActive:`KFXqYa_chartLegendItemActive`,heatmapCellEmpty:`KFXqYa_heatmapCellEmpty`,triggerPopSwitchCount:`KFXqYa_triggerPopSwitchCount`,heroGaugeCenter:`KFXqYa_heroGaugeCenter`,shareValue:`KFXqYa_shareValue`,kpiValue:`KFXqYa_kpiValue`,modelRowActive:`KFXqYa_modelRowActive`,setGrid2:`KFXqYa_setGrid2`,chartAxisLabel:`KFXqYa_chartAxisLabel`,popModelLabel:`KFXqYa_popModelLabel`,siteKindSite:`KFXqYa_siteKindSite`,budgetFillWarn:`KFXqYa_budgetFillWarn`,subscriptionName:`KFXqYa_subscriptionName`,"billing-trigger":`KFXqYa_billing-trigger`,heatmapFooter:`KFXqYa_heatmapFooter`,healthBadgeOk:`KFXqYa_healthBadgeOk`,delta:`KFXqYa_delta`,ctlGroup:`KFXqYa_ctlGroup`,plgVal:`KFXqYa_plgVal`,setCardDesc:`KFXqYa_setCardDesc`,ubTagPromo:`KFXqYa_ubTagPromo`,panel:`KFXqYa_panel`,ubModel:`KFXqYa_ubModel`,healthBad:`KFXqYa_healthBad`,feeInline:`KFXqYa_feeInline`,balanceDaysBadge:`KFXqYa_balanceDaysBadge`,railButton:`KFXqYa_railButton`,heroGaugeTrack:`KFXqYa_heroGaugeTrack`,dashboardModal:`KFXqYa_dashboardModal`,heroGaugePct:`KFXqYa_heroGaugePct`,roundsFlagMark:`KFXqYa_roundsFlagMark`,plgDesc:`KFXqYa_plgDesc`,plgLabel:`KFXqYa_plgLabel`,tokenModelPartIn:`KFXqYa_tokenModelPartIn`,peakDotSuccess:`KFXqYa_peakDotSuccess`,chartTooltipSplit:`KFXqYa_chartTooltipSplit`,reconcileNotice:`KFXqYa_reconcileNotice`,peakCountPrimary:`KFXqYa_peakCountPrimary`,heroGauge:`KFXqYa_heroGauge`,heroBudget:`KFXqYa_heroBudget`,heatmapLegend:`KFXqYa_heatmapLegend`,providerGroupMeta:`KFXqYa_providerGroupMeta`,heatmapYearMonth:`KFXqYa_heatmapYearMonth`,heroSideItem:`KFXqYa_heroSideItem`,ubChipLabel:`KFXqYa_ubChipLabel`,affix:`KFXqYa_affix`,ubExtraNote:`KFXqYa_ubExtraNote`,tokenPanel:`KFXqYa_tokenPanel`,vendorLetter:`KFXqYa_vendorLetter`,estimatedTag:`KFXqYa_estimatedTag`,ubNotes:`KFXqYa_ubNotes`,sessionChildRow:`KFXqYa_sessionChildRow`,roundsBarLabel:`KFXqYa_roundsBarLabel`,switch:`KFXqYa_switch`,metricValue:`KFXqYa_metricValue`,kpiLabel:`KFXqYa_kpiLabel`,healthOk:`KFXqYa_healthOk`,chartLine:`KFXqYa_chartLine`,providerGroupBalanceLabel:`KFXqYa_providerGroupBalanceLabel`,plgTag:`KFXqYa_plgTag`,dashboardHead:`KFXqYa_dashboardHead`,heroBudgetLabel:`KFXqYa_heroBudgetLabel`,chartWrap:`KFXqYa_chartWrap`,subscriptionPlan:`KFXqYa_subscriptionPlan`,metricCell:`KFXqYa_metricCell`,userPriceBody:`KFXqYa_userPriceBody`,shareSegPeak:`KFXqYa_shareSegPeak`,peakTag:`KFXqYa_peakTag`,rdoDot:`KFXqYa_rdoDot`,balanceDaysBadgeLow:`KFXqYa_balanceDaysBadgeLow`,triggerYen:`KFXqYa_triggerYen`,metricGrid:`KFXqYa_metricGrid`,subscriptionMeta:`KFXqYa_subscriptionMeta`,popHead:`KFXqYa_popHead`,ubNotesTerm:`KFXqYa_ubNotesTerm`,heroSideSpacer:`KFXqYa_heroSideSpacer`,ubPricepair:`KFXqYa_ubPricepair`,trigger:`KFXqYa_trigger`,feeChipAlert:`KFXqYa_feeChipAlert`,balanceDetailLabel:`KFXqYa_balanceDetailLabel`,perfChips:`KFXqYa_perfChips`,providerGroupBadge:`KFXqYa_providerGroupBadge`,popTitle:`KFXqYa_popTitle`,rangeToggle:`KFXqYa_rangeToggle`,rdoChevronOpen:`KFXqYa_rdoChevronOpen`,floatSub:`KFXqYa_floatSub`,heroGaugePctOver:`KFXqYa_heroGaugePctOver`,roundsEmpty:`KFXqYa_roundsEmpty`,triggerPopEmpty:`KFXqYa_triggerPopEmpty`,floatSubName:`KFXqYa_floatSubName`,roundsBars:`KFXqYa_roundsBars`,chartEmpty:`KFXqYa_chartEmpty`,triggerSpark:`KFXqYa_triggerSpark`,chartGrid:`KFXqYa_chartGrid`,metricValueSuccess:`KFXqYa_metricValueSuccess`,dashboardBody:`KFXqYa_dashboardBody`,feeInlineAlert:`KFXqYa_feeInlineAlert`,ubTag:`KFXqYa_ubTag`,kpiGreen:`KFXqYa_kpiGreen`,siteRowName:`KFXqYa_siteRowName`,shareLegend:`KFXqYa_shareLegend`,popDotSub:`KFXqYa_popDotSub`,ubExtraName:`KFXqYa_ubExtraName`,chartBar:`KFXqYa_chartBar`,ubCard:`KFXqYa_ubCard`,feeChipError:`KFXqYa_feeChipError`,providerGroupTitle:`KFXqYa_providerGroupTitle`,rounds:`KFXqYa_rounds`,ubTagSuccess:`KFXqYa_ubTagSuccess`,heatmapCell:`KFXqYa_heatmapCell`,triggerSparkHot:`KFXqYa_triggerSparkHot`,userPriceInput:`KFXqYa_userPriceInput`,shareDot:`KFXqYa_shareDot`,popTagPrimary:`KFXqYa_popTagPrimary`,closeButton:`KFXqYa_closeButton`,dashboardTitle:`KFXqYa_dashboardTitle`,kpiGrid:`KFXqYa_kpiGrid`,rangeButtonActive:`KFXqYa_rangeButtonActive`,exportButton:`KFXqYa_exportButton`,siteRowTitle:`KFXqYa_siteRowTitle`,subscriptionFillOver:`KFXqYa_subscriptionFillOver`,heatmapYearWeekday:`KFXqYa_heatmapYearWeekday`,plgTitle:`KFXqYa_plgTitle`,plgNameRow:`KFXqYa_plgNameRow`,bucketThird:`KFXqYa_bucketThird`,metricValuePrimary:`KFXqYa_metricValuePrimary`,heroGaugeLabel:`KFXqYa_heroGaugeLabel`,plgGrid:`KFXqYa_plgGrid`,triggerMain:`KFXqYa_triggerMain`,plgHead:`KFXqYa_plgHead`,plgItem:`KFXqYa_plgItem`,setCardTitle:`KFXqYa_setCardTitle`,heroSideLabel:`KFXqYa_heroSideLabel`,feeBar:`KFXqYa_feeBar`,userPricePriceLine:`KFXqYa_userPricePriceLine`,budgetOverPulse:`KFXqYa_budgetOverPulse`,shareTrack:`KFXqYa_shareTrack`,siteKindTag:`KFXqYa_siteKindTag`,chartLegendLine:`KFXqYa_chartLegendLine`,tokenModelBar:`KFXqYa_tokenModelBar`,ubModelName:`KFXqYa_ubModelName`,balanceDetailHead:`KFXqYa_balanceDetailHead`,roundsAxis:`KFXqYa_roundsAxis`,bucketSep:`KFXqYa_bucketSep`,chartTooltipAlignLeft:`KFXqYa_chartTooltipAlignLeft`,emptyRow:`KFXqYa_emptyRow`,rdoLabel:`KFXqYa_rdoLabel`,siteRowMeta:`KFXqYa_siteRowMeta`,heatmapHover:`KFXqYa_heatmapHover`,heatmapRangeButtonActive:`KFXqYa_heatmapRangeButtonActive`,reconcileDismiss:`KFXqYa_reconcileDismiss`,heroValue:`KFXqYa_heroValue`,peakDesc:`KFXqYa_peakDesc`,chartHoverDot:`KFXqYa_chartHoverDot`,bucketOfficial:`KFXqYa_bucketOfficial`,chartTooltipDate:`KFXqYa_chartTooltipDate`,chartTooltipSwatch:`KFXqYa_chartTooltipSwatch`,triggerIcon:`KFXqYa_triggerIcon`,ubTagError:`KFXqYa_ubTagError`,perfChipOff:`KFXqYa_perfChipOff`,currencyButtonActive:`KFXqYa_currencyButtonActive`,siteRowCost:`KFXqYa_siteRowCost`,floatTargetLabel:`KFXqYa_floatTargetLabel`,tokenModelPartOut:`KFXqYa_tokenModelPartOut`,triggerPop:`KFXqYa_triggerPop`,subscriptionExhausted:`KFXqYa_subscriptionExhausted`,chartStack:`KFXqYa_chartStack`,peakCard:`KFXqYa_peakCard`,peakHead:`KFXqYa_peakHead`,setCardMeta:`KFXqYa_setCardMeta`,popModelRow:`KFXqYa_popModelRow`,userPriceInputNum:`KFXqYa_userPriceInputNum`,tokenModelParts:`KFXqYa_tokenModelParts`,heroGaugeArc:`KFXqYa_heroGaugeArc`,ubCardTitle:`KFXqYa_ubCardTitle`,chartTooltip:`KFXqYa_chartTooltip`,rdoSelect:`KFXqYa_rdoSelect`,feeItem:`KFXqYa_feeItem`,heatmapYearMonths:`KFXqYa_heatmapYearMonths`,ctlRow:`KFXqYa_ctlRow`,feeInlineNum:`KFXqYa_feeInlineNum`,providerGroupName:`KFXqYa_providerGroupName`,rdo:`KFXqYa_rdo`,ubCardHead:`KFXqYa_ubCardHead`,shareItem:`KFXqYa_shareItem`,roundsBarCol:`KFXqYa_roundsBarCol`,popDot:`KFXqYa_popDot`,heatmapRangeButton:`KFXqYa_heatmapRangeButton`,floatModeBtnOn:`KFXqYa_floatModeBtnOn`,sessionGroupRow:`KFXqYa_sessionGroupRow`,heatmapYearWeekdays:`KFXqYa_heatmapYearWeekdays`,siteKindUnknown:`KFXqYa_siteKindUnknown`,peakCardCorner:`KFXqYa_peakCardCorner`,exportBar:`KFXqYa_exportBar`,peakDotPrimary:`KFXqYa_peakDotPrimary`,floatSubPlan:`KFXqYa_floatSubPlan`,heatmapYearScroll:`KFXqYa_heatmapYearScroll`,subscriptionFill:`KFXqYa_subscriptionFill`,tabButton:`KFXqYa_tabButton`,peakClose:`KFXqYa_peakClose`,ctlRowStretch:`KFXqYa_ctlRowStretch`,chartTooltipAlignRight:`KFXqYa_chartTooltipAlignRight`,heroSide:`KFXqYa_heroSide`,kpiTile:`KFXqYa_kpiTile`,heroBudgetFillOver:`KFXqYa_heroBudgetFillOver`,siteRowCallsLow:`KFXqYa_siteRowCallsLow`,tabNav:`KFXqYa_tabNav`,chartLegendItem:`KFXqYa_chartLegendItem`,subscriptionStatus:`KFXqYa_subscriptionStatus`,ctlLabel:`KFXqYa_ctlLabel`,subscriptionAuto:`KFXqYa_subscriptionAuto`,modelProvider:`KFXqYa_modelProvider`,uncataloguedTag:`KFXqYa_uncataloguedTag`,heroSideValue:`KFXqYa_heroSideValue`,panelHead:`KFXqYa_panelHead`,subscriptionWindow:`KFXqYa_subscriptionWindow`,ubCardControlGroup:`KFXqYa_ubCardControlGroup`,heroGaugeArcOver:`KFXqYa_heroGaugeArcOver`,balanceDetailValue:`KFXqYa_balanceDetailValue`,setCell:`KFXqYa_setCell`,modelCell:`KFXqYa_modelCell`,shareSegAssistant:`KFXqYa_shareSegAssistant`,chartSvg:`KFXqYa_chartSvg`,btn:`KFXqYa_btn`,dashboardRight:`KFXqYa_dashboardRight`,setCardHead:`KFXqYa_setCardHead`,heatmapGrid:`KFXqYa_heatmapGrid`,peakDot:`KFXqYa_peakDot`,roundsBarWrap:`KFXqYa_roundsBarWrap`,peakAlertIn:`KFXqYa_peakAlertIn`,exportLabel:`KFXqYa_exportLabel`,bucketCost:`KFXqYa_bucketCost`,ubNotesItem:`KFXqYa_ubNotesItem`,triggerPopSwitcher:`KFXqYa_triggerPopSwitcher`,siteRow:`KFXqYa_siteRow`,chartCrosshair:`KFXqYa_chartCrosshair`,feeChipOff:`KFXqYa_feeChipOff`,balanceCell:`KFXqYa_balanceCell`,feeSuffix:`KFXqYa_feeSuffix`,providerGroup:`KFXqYa_providerGroup`,heroGaugeSvg:`KFXqYa_heroGaugeSvg`,chartTooltipHead:`KFXqYa_chartTooltipHead`,ubTagAlert:`KFXqYa_ubTagAlert`,planTag:`KFXqYa_planTag`,ubRate:`KFXqYa_ubRate`,floatModeBtn:`KFXqYa_floatModeBtn`,healthBadge:`KFXqYa_healthBadge`,peakTagPrimary:`KFXqYa_peakTagPrimary`,heroBudgetFill:`KFXqYa_heroBudgetFill`,budgetFillOver:`KFXqYa_budgetFillOver`,prog:`KFXqYa_prog`,progFill:`KFXqYa_progFill`,perfChipDot:`KFXqYa_perfChipDot`,ubTable:`KFXqYa_ubTable`,popDotDirect:`KFXqYa_popDotDirect`,subscriptionGrid:`KFXqYa_subscriptionGrid`,shareSegTool:`KFXqYa_shareSegTool`,siteKindDirect:`KFXqYa_siteKindDirect`,heroTop:`KFXqYa_heroTop`,ubChipOff:`KFXqYa_ubChipOff`,ubAlertNote:`KFXqYa_ubAlertNote`,triggerPrimary:`KFXqYa_triggerPrimary`,switchKnob:`KFXqYa_switchKnob`,balanceDetailPop:`KFXqYa_balanceDetailPop`,providerGroupHead:`KFXqYa_providerGroupHead`,providerGroupBalance:`KFXqYa_providerGroupBalance`,healthIdle:`KFXqYa_healthIdle`,roundsBarColPeak:`KFXqYa_roundsBarColPeak`,heatmapYear:`KFXqYa_heatmapYear`,peakTagSuccess:`KFXqYa_peakTagSuccess`,subscriptionReset:`KFXqYa_subscriptionReset`,subscriptionGoldFlow:`KFXqYa_subscriptionGoldFlow`,vendorLogo:`KFXqYa_vendorLogo`,floatTarget:`KFXqYa_floatTarget`,userPriceLineMeta:`KFXqYa_userPriceLineMeta`,reconcileText:`KFXqYa_reconcileText`,healthBadgeBad:`KFXqYa_healthBadgeBad`,feeChipPrimary:`KFXqYa_feeChipPrimary`,perfBar:`KFXqYa_perfBar`,heroLabel:`KFXqYa_heroLabel`,roundsBarFlagged:`KFXqYa_roundsBarFlagged`,heroMeta:`KFXqYa_heroMeta`,providerGroupCostLabel:`KFXqYa_providerGroupCostLabel`,subscriptionTrack:`KFXqYa_subscriptionTrack`,popModel:`KFXqYa_popModel`};let re={"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`},"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`}},F={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 ie(e){return e===``?e:F[e]??e}function ae(e){let t=re[ie(e)];return t?.type===`code`?t.tier:void 0}let oe=[{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}],se,ce,le,ue,de;function fe(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function pe(e,t){return fe(e)===fe(t)}function me(e){de=e.length>0?e:void 0}function he(){return de}function ge(e){return G(e)}function _e(e,t){let n=ve(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 ve(e,t){if(de===void 0)return;let n=ge(e),r=U(n),i=e=>ge(e.key)===n||U(e.key)===r;if(t!==void 0){for(let e of de)if(e.origin!==void 0&&e.origin!==``&&i(e)&&pe(e.origin,t))return e}for(let e of de)if((e.origin===void 0||e.origin===``)&&i(e))return e}function I(e){if(de===void 0)return;let t=ge(e),n=U(t);return de.find(e=>e.origin!==void 0&&e.origin!==``&&(ge(e.key)===t||U(e.key)===n))}function ye(e){se=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,ce=e.prices,le=e.extraModels}function be(e){ue=e}function xe(){return se??6.79}function Se(){return{rate:xe(),live:se!==void 0}}let Ce=.5,L=Date.parse(`2026-09-14T04:00:00Z`),R={input:1.5,cacheHit:.05,output:4.5},z={flash:R,"flash-vision-exp":R,pro:{input:4.5,cacheHit:.15,output:13.5}};function B(e){return e>=9&&e<12||e>=14&&e<18}function V(e){return e==null||!Number.isFinite(e)?`peak`:we(e)?`offPeak`:B((new Date(e).getUTCHours()+8)%24)?`peak`:`offPeak`}function we(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}let Te=[540,720,840,1080];function Ee(e){return((e+288e5)%864e5+864e5)%864e5}function De(e){let t=V(e),n=Ee(e);for(let r=0;r<7;r++){let i=r*864e5-n;for(let n of Te){let r=i+n*6e4;if(!(r<=0)&&V(e+r)!==t)return{tier:t,nextSwitchInMs:r}}}let r=Te[0]??0;return{tier:t,nextSwitchInMs:864e5-n+r*6e4}}function Oe(e,t){let{nextSwitchInMs:n}=De(e);if(n>t)return null;let r=e+n;return{entering:V(r),atMs:r}}function ke(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 Ae=`09:00-12:00 / 14:00-18:00`,je=`Standard / Flex`,Me=[{key:`flash`,name:`DeepSeek V4.1 Flash`,provider:`DeepSeek`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Ae},{key:`flash-vision-exp`,name:`DeepSeek V4 Flash Vision (Exp)`,provider:`DeepSeek`,colorVar:`dsw-static-blue-500`,retired:!0,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Ae},{key:`pro`,name:`DeepSeek V4 Pro`,provider:`DeepSeek`,colorVar:`dsw-static-deepseek-500`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Ae},{key:`glm`,name:`GLM-5.2`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3`,name:`GLM-5.3`,provider:`智谱 AI`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3-flash`,name:`GLM-5.3-Flash`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.23,output:2.8},promo:{factor:.5,endsAtMs:Date.UTC(2026,8,8,16,0,0),note:`限时 5 折`}},{key:`glm-4.6`,name:`GLM-4.6`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16}},{key:`glm-4.5-air`,name:`GLM-4.5-Air`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.16,output:2}},{key:`glm-4.7`,name:`GLM-4.7`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5-turbo`,name:`GLM-5-Turbo`,provider:`智谱 AI`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`glm-5.1`,name:`GLM-5.1`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24}},{key:`glm-5v-turbo`,name:`GLM-5V-Turbo`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`qwen-3.8-max`,name:`Qwen3.8 Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:12,cacheHit:1.5,output:36},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-3.8-flash`,name:`Qwen3.8 Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:1,cacheHit:.1,output:3},extraRows:[{label:`显式缓存创建`,input:1.25},{label:`显式缓存命中`,input:.1},{label:`Batch File`,input:.5,output:1.5,note:`长期半价`},{label:`Batch Chat`,input:1,output:3,note:`与标准价一致`}]},{key:`qwen-max`,name:`Qwen3.7-Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:12,cacheHit:1.2,output:36},promo:{factor:.5,note:`限时 5 折`},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1.2},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-plus`,name:`Qwen3.5-Plus`,provider:`阿里通义`,colorVar:`dsw-static-blue-500`,price:{currency:`CNY`,input:.8,cacheHit:.08,output:4.8},extraRows:[{label:`显式缓存创建`,input:1},{label:`显式缓存命中`,input:.08},{label:`Batch File`,input:.4,output:2.4,note:`长期半价`},{label:`Batch Chat`,input:.8,output:4.8,note:`与标准价一致`}]},{key:`qwen-flash`,name:`Qwen3.5-Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2},extraRows:[{label:`显式缓存创建`,input:.25},{label:`显式缓存命中`,input:.02}]},{key:`doubao`,name:`Doubao Seed-2.0 Pro`,provider:`字节豆包`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-mini`,name:`Doubao Seed-2.0 Mini`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2}},{key:`doubao-1.6`,name:`Doubao Seed-1.6`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:.8,cacheHit:0,output:8}},{key:`doubao-seed-evolving`,name:`Doubao-Seed-Evolving`,provider:`字节豆包`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-pro`,name:`Doubao Seed-2.1 Pro`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-turbo`,name:`Doubao Seed-2.1 Turbo`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:3,cacheHit:.6,output:15}},{key:`kimi`,name:`Kimi K2.7 Code`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27}},{key:`kimi-k2.7-hs`,name:`Kimi K2.7 Code HighSpeed`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-600`,price:{currency:`CNY`,input:13,cacheHit:2.6,output:54}},{key:`kimi-k2.6`,name:`Kimi K2.6`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27}},{key:`kimi-k3`,name:`Kimi K3`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:20,cacheHit:2,output:100}},{key:`mimo-v2.5`,name:`MiMo V2.5`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:1,cacheHit:.02,output:2}},{key:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:3,cacheHit:.025,output:6}},{key:`minimax`,name:`MiniMax-M3`,provider:`MiniMax`,colorVar:`dsw-static-amber-500`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7`,name:`MiniMax-M2.7`,provider:`MiniMax`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7-highspeed`,name:`MiniMax-M2.7-highspeed`,provider:`MiniMax`,colorVar:`dsw-static-amber-500`,price:{currency:`CNY`,input:4.2,cacheHit:.42,output:16.8}},{key:`ernie`,name:`ERNIE-5.1`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:4,cacheHit:.4,output:18}},{key:`hunyuan`,name:`混元 Hy3`,provider:`腾讯混元`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:1,cacheHit:.25,output:4}},{key:`hunyuan-t1`,name:`混元 T1`,provider:`腾讯混元`,colorVar:`dsw-static-amber-300`,price:{currency:`CNY`,input:1,cacheHit:.1,output:4}},{key:`yi`,name:`Yi-Lightning`,provider:`零一万物`,colorVar:`dsw-static-green-500`,price:{currency:`CNY`,input:.99,cacheHit:.1,output:.99}},{key:`step`,name:`Step 3.7 Flash`,provider:`阶跃星辰`,colorVar:`dsw-static-neutral-bluish-400`,price:{currency:`CNY`,input:1.35,cacheHit:.27,output:8.1}},{key:`spark`,name:`Spark 4.0 Ultra`,provider:`科大讯飞`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:5,cacheHit:.5,output:10},estimated:!0},{key:`sensenova`,name:`SenseNova 6.5`,provider:`商汤`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:4.5,cacheHit:.45,output:9},estimated:!0},{key:`baichuan`,name:`Baichuan M3-Plus`,provider:`百川智能`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:5,cacheHit:.5,output:9}},{key:`gpt-5.6-sol`,name:`GPT-5.6 Sol`,provider:`OpenAI`,colorVar:`dsw-static-green-500`,price:{currency:`USD`,input:5,cacheHit:.5,output:30}},{key:`gpt-5.6-terra`,name:`GPT-5.6 Terra`,provider:`OpenAI`,colorVar:`dsw-static-green-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:12}},{key:`gpt-5.6-luna`,name:`GPT-5.6 Luna`,provider:`OpenAI`,colorVar:`dsw-static-green-500`,price:{currency:`USD`,input:.2,cacheHit:.02,output:1.2}},{key:`gemini-pro`,name:`Gemini 3.1 Pro`,provider:`Google`,colorVar:`dsw-static-blue-600`,price:{currency:`USD`,input:2,cacheHit:.2,output:12,offPeak:{input:1,cacheHit:.1,output:6}},peakHours:je,tierSemantics:`latency`},{key:`gemini-flash`,name:`Gemini 3.6 Flash`,provider:`Google`,colorVar:`dsw-static-blue-400`,price:{currency:`USD`,input:1.5,cacheHit:.15,output:7.5,offPeak:{input:.75,cacheHit:.075,output:3.75}},peakHours:je,tierSemantics:`latency`},{key:`grok`,name:`Grok 4.6`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`USD`,input:2,cacheHit:.5,output:6}},{key:`grok-4.3`,name:`Grok 4.3`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`USD`,input:1.25,cacheHit:.2,output:2.5}},{key:`llama`,name:`Llama 4 Maverick`,provider:`Meta`,colorVar:`dsw-static-red-500`,price:{currency:`USD`,input:.2,cacheHit:.05,output:.6}},{key:`llama-scout`,name:`Llama 4 Scout`,provider:`Meta`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:.1,cacheHit:.025,output:.3}},{key:`claude-opus-4-6`,name:`Claude Opus 4.6`,provider:`Anthropic`,colorVar:`dsw-static-red-500`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:3,cacheHit:.3,output:15}},{key:`claude-haiku-4-5`,name:`Claude Haiku 4.5`,provider:`Anthropic`,colorVar:`dsw-static-red-300`,price:{currency:`USD`,input:1,cacheHit:.1,output:5}},{key:`claude-opus-5`,name:`Claude Opus 5`,provider:`Anthropic`,colorVar:`dsw-static-red-500`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-5`,name:`Claude Sonnet 5`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:10}},{key:`mistral-large-2512`,name:`Mistral Large 3`,provider:`Mistral AI`,colorVar:`dsw-static-violet-500`,price:{currency:`USD`,input:.5,cacheHit:.05,output:1.5}},{key:`mistral-small-2603`,name:`Mistral Small 4`,provider:`Mistral AI`,colorVar:`dsw-static-violet-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`ministral-8b-latest`,name:`Ministral 8B`,provider:`Mistral AI`,colorVar:`dsw-static-violet-300`,price:{currency:`USD`,input:.1,cacheHit:.01,output:.1}},{key:`command-a-03-2025`,name:`Command A`,provider:`Cohere`,colorVar:`dsw-static-cyan-500`,price:{currency:`USD`,input:2.5,cacheHit:.25,output:10}},{key:`command-r-08-2024`,name:`Command R`,provider:`Cohere`,colorVar:`dsw-static-cyan-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`longcat-2.0`,name:`LongCat 2.0`,provider:`美团`,colorVar:`dsw-static-amber-500`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`minicpm-v-4.5`,name:`MiniCPM-V 4.5`,provider:`面壁智能`,colorVar:`dsw-static-green-500`,price:{currency:`CNY`,input:1,cacheHit:.2,output:4},estimated:!0},{key:`ernie-4.5`,name:`ERNIE-4.5 300B`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`dots-3-note-preview`,name:`Dots3-Note Preview`,provider:`小红书`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`qwen3.6-max`,name:`Qwen3.6 Max`,provider:`阿里通义`,colorVar:`dsw-static-orange-500`,price:{currency:`CNY`,input:9,cacheHit:.9,output:54},extraRows:[{label:`显式缓存创建`,input:11.25},{label:`显式缓存命中`,input:.9}]},{key:`qwen3-coder-plus`,name:`Qwen3-Coder Plus`,provider:`阿里通义`,colorVar:`dsw-static-orange-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},extraRows:[{label:`显式缓存创建`,input:5},{label:`显式缓存命中`,input:.4}]},{key:`qwen3-coder`,name:`Qwen3-Coder 480B`,provider:`阿里通义`,colorVar:`dsw-static-orange-300`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`glm-4.5-x`,name:`GLM-4.5-X`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5.2-fast`,name:`GLM-5.2 Fast`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24},estimated:!0},{key:`kimi-k3-fast`,name:`Kimi K3 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:20,cacheHit:2,output:100},estimated:!0},{key:`kimi-k2.7-code-fast`,name:`Kimi K2.7 Code Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27},estimated:!0},{key:`kimi-k2.6-fast`,name:`Kimi K2.6 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2.6-turbo`,name:`Kimi K2.6 Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2-thinking-turbo`,name:`Kimi K2 Thinking Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:8,cacheHit:1,output:58}},{key:`doubao-seed-2.0-code`,name:`Doubao Seed-2.0 Code`,provider:`字节豆包`,colorVar:`dsw-static-red-500`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-seed-2.0-lite`,name:`Doubao Seed-2.0 Lite`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.6,cacheHit:.12,output:3.6}},{key:`other`,name:`其他模型`,provider:`Custom`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:0,cacheHit:0,cacheMiss:0,output:0}}],H={"deepseek-v4-flash":`flash`,"deepseek-v4-flash-vision-exp":`flash-vision-exp`,"deepseek-v4.1-flash":`flash`,"deepseek-v4.1-flash-expires-on-0910":`flash`,"deepseek-flash":`flash`,"deepseek-v4-pro":`pro`,"glm-5.2":`glm`,"glm-4.5-air":`glm-4.5-air`,"glm-4.5air":`glm-4.5-air`,"glm-4.7":`glm-4.7`,"glm-5-turbo":`glm-5-turbo`,"glm-5.1":`glm-5.1`,"glm-5.3-flash":`glm-5.3-flash`,"glm-5v-turbo":`glm-5v-turbo`,"glm-5v.1":`glm-5v-turbo`,"claude-opus-4-6":`claude-opus-4-6`,"claude-opus-4.6":`claude-opus-4-6`,"claude-sonnet-4-6":`claude-sonnet-4-6`,"claude-sonnet-4.6":`claude-sonnet-4-6`,"claude-haiku-4-5":`claude-haiku-4-5`,"claude-haiku-4.5":`claude-haiku-4-5`,"claude-opus-5":`claude-opus-5`,"claude-sonnet-5":`claude-sonnet-5`,"mistral-large-2512":`mistral-large-2512`,"mistral-large-3":`mistral-large-2512`,"mistral-small-2603":`mistral-small-2603`,"mistral-small-4":`mistral-small-2603`,"ministral-8b-latest":`ministral-8b-latest`,"ministral-8b":`ministral-8b-latest`,"command-a-03-2025":`command-a-03-2025`,"command-a":`command-a-03-2025`,"command-r-08-2024":`command-r-08-2024`,"command-r":`command-r-08-2024`,hy3:`hunyuan`,"longcat-2.0":`longcat-2.0`,"longcat-2":`longcat-2.0`,"minicpm-v-4.5":`minicpm-v-4.5`,"minicpm-v-4.5-thinking":`minicpm-v-4.5`,"ernie-4.5":`ernie-4.5`,"ernie-4.5-300b":`ernie-4.5`,"dots-3-note-preview":`dots-3-note-preview`,"dots-3-note":`dots-3-note-preview`,"dots3-note-preview":`dots-3-note-preview`,"rednote-dots3":`dots-3-note-preview`,"doubao-seed-evolving":`doubao-seed-evolving`,"doubao-seed-evolve":`doubao-seed-evolving`,"doubao-seed-2.1-pro":`doubao-seed-2.1-pro`,"doubao-seed-2.1-pro-290000":`doubao-seed-2.1-pro`,"doubao-seed-2.1-turbo":`doubao-seed-2.1-turbo`,"doubao-seed-2-1-turbo":`doubao-seed-2.1-turbo`,"qwen3.8-max":`qwen-3.8-max`,"qwen3.8-flash":`qwen-3.8-flash`,"qwen3.7-max":`qwen-max`,"qwen3.6-max":`qwen3.6-max`,"qwen3.6-max-preview":`qwen3.6-max`,"qwen3-coder-plus":`qwen3-coder-plus`,"qwen3-coder":`qwen3-coder`,"qwen3-coder-480b":`qwen3-coder`,"glm-4.5-x":`glm-4.5-x`,"glm-4.5x":`glm-4.5-x`,"glm-5.2-fast":`glm-5.2-fast`,"glm-5.2f":`glm-5.2-fast`,"kimi-k3-fast":`kimi-k3-fast`,"kimi-k3f":`kimi-k3-fast`,"kimi-k2.7-code-fast":`kimi-k2.7-code-fast`,"kimi-k2.7-code-f":`kimi-k2.7-code-fast`,"kimi-k2.6-fast":`kimi-k2.6-fast`,"kimi-k2.6-turbo":`kimi-k2.6-turbo`,"kimi-k2-thinking-turbo":`kimi-k2-thinking-turbo`,"doubao-seed-2.0-code":`doubao-seed-2.0-code`,"doubao-seed-2-0-code":`doubao-seed-2.0-code`,"doubao-seed-2.0-lite":`doubao-seed-2.0-lite`,"doubao-seed-2-0-lite":`doubao-seed-2.0-lite`,"qwen-max":`qwen-max`,"hunyuan-t1":`hunyuan-t1`,"step-3.7-flash":`step`,"seed-2.0-mini":`doubao-mini`,k3:`kimi-k3`,"kimi-k3":`kimi-k3`,"minimax-m1":`minimax`,"minimax-m2":`minimax`,"minimax-m3":`minimax`,"minimax-m2.7":`minimax-m2.7`,"minimax-m2.7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2.7-high-speed":`minimax-m2.7-highspeed`,"minimax-m2-7":`minimax-m2.7`,"minimax-m2-7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2-7-high-speed":`minimax-m2.7-highspeed`};function U(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let Ne=(()=>{let e=new Map,t=(t,n)=>{let r=U(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of Me)t(e.key,e.key);for(let[e,n]of Object.entries(H))t(e,n);for(let e of oe)t(e.key,e.key);return e})();function Pe(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 W(e){let t=H[e];if(t!==void 0)return t;let n=U(e);if(n===``)return;let r=Ne.get(n);return r===void 0?(le??[]).find(e=>U(e.key)===n)?.key:r}function G(e){let t=H[e]??e;if(t===e){let t=U(e);if(t!==``){let e=Ne.get(t);if(e!==void 0)return e;let n=(le??[]).find(e=>U(e.key)===t);if(n!==void 0)return n.key}for(let t of Pe(e)){let e=W(t);if(e!==void 0)return e}}return t}function Fe(e){let t=G(e),n=ce?.[t];if(n!==void 0)return n;let r=oe.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function Ie(e){let t=G(e),n=Me.find(e=>e.key===t),r=le?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=Me.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():K(r)),a=_e(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=Fe(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function K(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 Le(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function Re(e,t){let{promo:n}=e;if(n===void 0||!Le(n,t))return e;let r=e=>({input:e.input*n.factor,cacheHit:e.cacheHit*n.factor,...e.cacheMiss===void 0?{}:{cacheMiss:e.cacheMiss*n.factor},output:e.output*n.factor});return{...e,price:{...r(e.price),currency:e.price.currency,...e.price.offPeak===void 0?{}:{offPeak:r(e.price.offPeak)}}}}function ze(e,t){if(e.key!==`pro`||t>=L)return e;let n=z.pro;return n===void 0?e:{...e,price:{currency:`CNY`,input:n.input*2,cacheHit:n.cacheHit*2,output:n.output*2,offPeak:{...n}}}}function Be(e=Date.now()){let t=[...Me.filter(e=>e.retired!==!0).map(t=>ze(Re(t,e),e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>U(e.key)));for(let e of ue??[]){let i=e.id.toLowerCase();if((()=>{let t=G(e.id);return Me.find(e=>e.key===t)})()!==void 0)continue;let a=U(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(le??[]).find(e=>U(e.key)===a),s;if(o!==void 0)s=K(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=Fe(i);s=t===void 0?{key:G(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=_e(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 Ve(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function He(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*xe():a}function Ue(e,t,n=Ce,r=Date.now()){let i=Re(e,r),a=He(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:He(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function q(e){let t=xe();return t>0?e/t:e}function J(e,t=`cny`){let n=Number(e);if(!Number.isFinite(n))return t===`cny`?`¥0`:`$0`;let r=t===`cny`?`¥`:`$`;return 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 We(e,t=`CNY`){return e===0?`免费`:t===`USD`?e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`:e>=10?`¥${e.toFixed(1)}`:`¥${e.toFixed(2)}`}function Ge(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function Y(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 Ke(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let X={top:18,right:40,bottom:26,left:46};function qe(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function Je(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function Ye(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 Xe={key:`__total__`,name:`总计`,color:``};function Ze({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>J(n===`usd`?q(e):e,n),l=e=>i===`tokens`?Je(e):c(e),u=e=>i===`tokens`?e.tokens??0:e.cost,d=(0,r.useMemo)(()=>{let n=e.length;if(n===0)return null;let r=680-X.left-X.right,a=220-X.top-X.bottom,o=e=>n===1?X.left+r/2:X.left+r*e/(n-1),s=Math.max(...i===`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=r/n,p=Math.min(18,f*.6);return{n,plotW:r,plotH:a,inner:o,yCost:c,yCalls:d,barW:p,bars:e.flatMap((e,n)=>{let r=o(n)-p/2;if(t.length===0||i===`tokens`)return[{date:e.date,model:Xe,x:r,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,i={date:e.date,model:t,x:r,base:s,value:n,topRounded:t.key===a};return s+=n,i})}),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,i]);if(d===null)return(0,o.jsx)(`div`,{className:P.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:ee,linePath:x}=d,S=a===null?void 0:e[a],C=Ye(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:P.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)/p,r=Math.round(n*(f-1));s(Math.min(Math.max(r,0),f-1))},children:[b.map((e,t)=>{let n=g(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:X.left,x2:680-X.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:l(e)})]},`cost-${t}`)}),y.map(t=>{if(t.value>0)return(0,o.jsx)(`rect`,{x:t.x,y:g(t.base+t.value),width:v,height:g(t.base)-g(t.base+t.value),rx:t.topRounded?2:0,className:t.model.color===``?P.chartBar:P.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,o.jsx)(`rect`,{x:t.x,y:g(0)-1,width:v,height:1,rx:0,className:P.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:x,fill:`none`,className:P.chartLine}),ee.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-X.right+8,y:n+3,textAnchor:`start`,className:P.chartAxisLabel,children:Je(e)},`calls-${t}`)}),C.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:P.chartAxisLabel,children:qe(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:X.top,y2:X.top+m,className:P.chartCrosshair})]}),S!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:P.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(S.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:P.chartTooltipDate,children:S.date}),i!==`tokens`&&t.filter(e=>(S.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(S.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?Je(S.tokens??0):c(S.cost)})]}),(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:S.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:P.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartLegendLine}),`调用`]})]})]})}let Z={top:14,right:42,bottom:22,left:46};function Qe(e){return e.slice(5,13).replace(`T`,` `)}function $e(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function et(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function tt(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function nt(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function rt({perf:e,models:t,t:n}){let[i,a]=(0,r.useState)(()=>M()),[s,c]=(0,r.useState)(null),l=e=>{a(e),ne(e)},u=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,f=(0,r.useMemo)(()=>e===void 0?[]:Object.entries(e.byModel).map(([e,n])=>({key:e,name:t.find(t=>t.key===e)?.name??e,color:u(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]),p=(0,r.useMemo)(()=>{if(e===void 0)return[];if(i.models!==void 0){let t=new Set(Object.keys(e.byModel));return i.models.filter(e=>t.has(e))}return f.slice(0,5).map(e=>e.key)},[e,f,i.models]),m=(0,r.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,r=680-Z.left-Z.right,a=180-Z.top-Z.bottom,o=e=>n===1?Z.left+r/2:Z.left+r*e/(n-1),s=new Set(p),c=e=>i.metric===`ttft`?e?.ttftAvg:e?.tpsAvg,l=[],u=0;for(let r of f){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>u&&(u=s))}l.push({key:r.key,name:r.name,color:r.color,segments:[],points:i})}let d=l.reduce((e,t)=>e+t.points.length,0);u=Math.max(u,1);let m=e=>Z.top+a-e/u*a;for(let e of l){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:r,plotH:a,inner:o,yOf:m,series:l,ticks:[0,.5,1].map(e=>u*e).reverse(),xTicks:g,totalPoints:d}},[e,f,p,i.metric]);if(e===void 0||f.length===0)return(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)});let h=e=>{let t=p.includes(e)?p.filter(t=>t!==e):[...p,e];l({metric:i.metric,models:t})},g=e=>{l({metric:e,...i.models===void 0?{}:{models:i.models}})},_=s===null||m===null?[]:m.series.flatMap(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?[]:[{key:e.key,name:e.name,color:e.color,v:t.v}]});return(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:P.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:P.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfEstimated`)})]})}),(0,o.jsx)(`tbody`,{children:f.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:P.modelCell,children:[(0,o.jsx)(`span`,{className:P.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:P.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.ttftAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.ttftP50)}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.ttftP90)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):(0,o.jsxs)(`span`,{children:[et(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):tt(e.tpsAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.latencyAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:P.na,children:`—`})})]},e.key))})]})}),m!==null&&(0,o.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,o.jsx)(`div`,{className:P.perfBar,children:(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,i.metric===e&&P.rangeButtonActive),"aria-pressed":i.metric===e,"data-testid":`billing-perf-tab-${e}`,onClick:()=>{g(e)},children:e===`ttft`?`${n(`perfTtft`)} (ms)`:`${n(`perfTps`)} (${n(`perfTpsUnit`)})`},e))})}),(0,o.jsxs)(`div`,{className:P.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,o.jsx)(`button`,{type:`button`,className:P.perfChip,"data-testid":`billing-perf-chip-all`,onClick:()=>{l({metric:i.metric,models:f.map(e=>e.key)})},children:n(`perfAll`)}),f.map(e=>{let t=p.includes(e.key);return(0,o.jsxs)(`button`,{type:`button`,className:d(P.perfChip,!t&&P.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:()=>{h(e.key)},children:[(0,o.jsx)(`span`,{className:P.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),m.totalPoints>0?(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:P.chartSvg,role:`img`,"aria-label":`Hourly perf comparison by model`,onMouseLeave:()=>{c(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Z.left)/m.plotW,r=Math.round(n*(m.n-1));c(Math.min(Math.max(r,0),m.n-1))},children:[m.ticks.map((e,t)=>{let n=m.yOf(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Z.left,x2:680-Z.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:Z.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:$e(e)})]},`tick-${t}`)}),m.series.map(e=>e.segments.map((t,n)=>(0,o.jsx)(`path`,{d:t,fill:`none`,className:P.chartLine,style:{stroke:e.color}},`${e.key}-${n}`))),m.xTicks.map(e=>{let t=m.hourKeys[e];return t===void 0?null:(0,o.jsx)(`text`,{x:m.inner(e),y:174,textAnchor:`middle`,className:P.chartAxisLabel,children:Qe(t)},t)}),s!==null&&(0,o.jsx)(`line`,{x1:m.inner(s),x2:m.inner(s),y1:Z.top,y2:Z.top+m.plotH,className:P.chartCrosshair}),s!==null&&m.series.map(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?null:(0,o.jsx)(`circle`,{cx:t.x,cy:t.y,r:3.5,fill:e.color,className:P.chartHoverDot},`${e.key}-dot`)})]}),s!==null&&_.length>0&&(0,o.jsxs)(`div`,{className:P.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${m.inner(s)/680*100}%`,top:`${(Z.top+m.plotH/2)/180*100}%`},children:[(0,o.jsx)(`div`,{className:P.chartTooltipDate,children:Qe(m.hourKeys[s]??``)}),_.map(e=>(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:nt(e.v,i.metric,n)})]},e.key))]})]}):(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),m===null&&(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let it=`@kenz1117/dsh-ui-usage-billing`,at=`kenz1117`;function ot({t:e,version:t}){return(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:P.plgHead,children:[(0,o.jsx)(`span`,{className:P.plgIcon,"aria-hidden":`true`,children:(0,o.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,o.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,o.jsxs)(`div`,{className:P.plgTitle,children:[(0,o.jsxs)(`div`,{className:P.plgNameRow,children:[(0,o.jsx)(`h3`,{className:P.plgName,children:it}),(0,o.jsx)(`span`,{className:P.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:P.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:P.plgGrid,children:[(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:P.plgLink,href:`https://github.com/${at}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,at,`)`]})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:P.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:P.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:it})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:P.plgVal,children:`MIT`})]})]})]})}function st(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 ct(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let Q={top:14,right:18,bottom:22,left:46},lt=`var(--dsw-static-blue-500)`,ut=`#14b8a6`,dt=`var(--dsw-static-amber-500)`;function ft(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function pt(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,s=e.money,c=e.models??[],{byDay:l,byModel:u,total:f}=t,[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(`structure`),[_,v]=(0,r.useState)(null),y=t.byDayModels!==void 0,b=e=>{g(e),v(null)},ee=(0,r.useMemo)(()=>{let e=t.byRole;if(e===void 0)return[];let n=e.user+e.assistant+e.tool;return n<=0?[]:[{label:a(`roleUser`),value:e.user,seg:P.shareSegUser},{label:a(`roleAssistant`),value:e.assistant,seg:P.shareSegAssistant},{label:a(`roleTool`),value:e.tool,seg:P.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,a]),x=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=st(n.getTime()),i=l[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[l,n]),S=(0,r.useMemo)(()=>{let e=[];for(let r=n-1;r>=0;--r){let n=new Date;n.setDate(n.getDate()-r);let i=st(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]),C=(0,r.useMemo)(()=>{let e=new Map;for(let t of S)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:c.find(t=>t.key===e)?.name??Ie(e).name,color:c.find(t=>t.key===e)?.color??`#8b95a3`}))},[S,c]),w=_!==null&&C.some(e=>e.key===_)?_:null,T=e=>{if(y){if(h!==`model`){g(`model`),v(e);return}v(t=>t===e?null:e)}},E=(0,r.useMemo)(()=>{let e=0;return Object.entries(u).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:Ie(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}))},[u]),D=(0,r.useMemo)(()=>{let e=f.cacheHit??0,t=f.cacheMiss??0,n=f.input??0,r=f.output??0,i=f.reasoning??0,a=e+t,o=a>0?e/a*100:0,s=r>0?i/r*100:0,c=r>0?n/r:0,l;for(let e of x){let t=e.miss+e.hit+e.output;(l===void 0||t>l.miss+l.hit+l.output)&&(l=e)}return{cacheHitRate:o,reasoningPct:s,io:c,peak:l,hit:e,miss:t,input:n,output:r,reasoning:i}},[f,x]),O=(0,r.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]),k=(0,r.useMemo)(()=>{let e=x.length;if(e===0)return null;let t=680-Q.left-Q.right,n=200-Q.top-Q.bottom,r=Math.max(...h===`model`?S.map(e=>e.total):x.map(e=>e.miss+e.hit+e.output),1),i=e=>Q.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?Q.left+t/2:Q.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l,groupW:a}},[x,S,h]),A=()=>{let e=new Blob([mt(x)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${st()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},te=()=>{let e=new Blob([ft(x,E,S,f)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${st()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},j=p===null?void 0:x[p],M=p===null?void 0:S[p],ne=k===null?0:Math.ceil(80/Math.max(k.groupW,1)),N=p===null||k===null?void 0:p>=k.n-ne?P.chartTooltipAlignRight:p<ne?P.chartTooltipAlignLeft:void 0;return(0,o.jsxs)(`div`,{className:P.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:P.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:P.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-token-export-csv`,onClick:A,children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-token-export-json`,onClick:te,children:a(`exportJson`)})]}),(0,o.jsxs)(`div`,{className:P.kpiGrid,"data-testid":`billing-token-kpis`,children:[(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:a(`tokenCacheHitRate`)}),(0,o.jsxs)(`span`,{className:P.kpiValue,children:[D.cacheHitRate.toFixed(1),`%`]}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[Y(D.hit),` / `,Y(D.hit+D.miss),(f.cacheWrite??0)>0?` · ${a(`tokenCacheWrite`)} ${Y(f.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:a(`tokenReasoningShare`)}),(0,o.jsxs)(`span`,{className:P.kpiValue,children:[D.reasoningPct.toFixed(1),`%`]}),(0,o.jsx)(`span`,{className:P.kpiDetail,children:Y(D.reasoning)})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:a(`tokenIo`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:D.io.toFixed(2)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[Y(D.input),` / `,Y(D.output)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:a(`tokenPeak`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:D.peak===void 0?`—`:ct(D.peak.miss+D.peak.hit+D.peak.output)}),(0,o.jsx)(`span`,{className:P.kpiDetail,children:D.peak?.date??`—`})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`tokenDaily`)}),(0,o.jsxs)(`span`,{className:P.panelHeadControls,children:[y&&(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,h===e&&P.rangeButtonActive),"aria-pressed":h===e,onClick:()=>{b(e)},"data-testid":`billing-token-view-${e}`,children:a(e===`structure`?`tokenViewStructure`:`tokenViewModel`)},e))}),(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,n===e&&P.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]})]}),k===null||h===`model`&&C.length===0?(0,o.jsx)(`div`,{className:P.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:P.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),onMouseLeave:()=>{m(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Q.left)/k.plotW,r=Math.round(n*(k.n-1));m(Math.min(Math.max(r,0),k.n-1))},children:[[0,.5,1].map(e=>{let t=k.max*e,n=k.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Q.left,x2:680-Q.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:Q.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:ct(t)})]},e)}),h===`structure`?x.map((e,t)=>{let n=k.inner(t)-k.barW/2,r=k.y(0),i=k.y(e.miss),a=k.y(e.miss+e.hit),s=k.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:k.barW,height:r-i,fill:lt}),(0,o.jsx)(`rect`,{x:n,y:a,width:k.barW,height:i-a,fill:ut}),(0,o.jsx)(`rect`,{x:n,y:s,width:k.barW,height:a-s,fill:dt})]},e.date)}):S.map((e,t)=>{let n=k.inner(t)-k.barW/2,r=0;return(0,o.jsx)(`g`,{children:C.map(t=>{let i=e.models[t.key];if(i===void 0)return null;let a=k.y(r);r+=i.total;let s=k.y(r),c=w!==null&&t.key!==w;return(0,o.jsx)(`rect`,{x:n,y:s,width:k.barW,height:a-s,fill:t.color,opacity:c?.15:1},t.key)})},e.date)}),k.indices.map(e=>{let t=x[e];return t===void 0?null:(0,o.jsx)(`text`,{x:k.inner(e),y:194,textAnchor:`middle`,className:P.chartAxisLabel,children:t.date.slice(5)},t.date)}),p!==null&&(0,o.jsx)(`line`,{x1:k.inner(p),x2:k.inner(p),y1:Q.top,y2:Q.top+k.plotH,className:P.chartCrosshair})]}),p!==null&&h===`structure`&&j!==void 0&&(0,o.jsxs)(`div`,{className:d(P.chartTooltip,N),"data-testid":`billing-token-tooltip`,style:{left:`${k.inner(p)/680*100}%`,top:`${k.y(j.miss+j.hit+j.output)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:P.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:P.chartTooltipDate,children:j.date}),(0,o.jsx)(`strong`,{children:(j.miss+j.hit+j.output).toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:ut}}),a(`tokenHit`)]}),(0,o.jsx)(`strong`,{children:j.hit.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:lt}}),a(`tokenMiss`)]}),(0,o.jsx)(`strong`,{children:j.miss.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:dt}}),a(`tokenOutput`)]}),(0,o.jsx)(`strong`,{children:j.output.toLocaleString()})]})]}),p!==null&&h===`model`&&M!==void 0&&(0,o.jsxs)(`div`,{className:d(P.chartTooltip,N),"data-testid":`billing-token-tooltip`,style:{left:`${k.inner(p)/680*100}%`,top:`${k.y(M.total)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:P.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:P.chartTooltipDate,children:M.date}),(0,o.jsx)(`strong`,{children:M.total.toLocaleString()})]}),C.map(e=>{let t=M.models[e.key];return t===void 0?null:(0,o.jsxs)(`div`,{className:P.chartTooltipModel,children:[(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,o.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:P.chartTooltipModelDetail,children:[a(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,a(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,a(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,o.jsx)(`div`,{className:P.chartLegend,children:h===`structure`?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:lt}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:ut}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:dt}}),a(`tokenOutput`)]})]}):C.map(e=>(0,o.jsxs)(`button`,{type:`button`,className:d(P.chartLegendItem,w===e.key&&P.chartLegendItemActive),"aria-pressed":w===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{T(e.key)},children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`tokenByModel`)})}),E.length===0?(0,o.jsx)(`div`,{className:P.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:P.tableScroll,children:(0,o.jsxs)(`table`,{className:P.modelTable,"data-testid":`billing-token-model-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:E.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:d(y&&P.modelRowFocusable,w===e.key&&P.modelRowActive),"aria-selected":y?w===e.key:void 0,onClick:y?()=>{T(e.key)}:void 0,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:P.numCol,children:Y(e.input)}),(0,o.jsx)(`td`,{className:P.numCol,children:Y(e.output)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.reasoning>0?Y(e.reasoning):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsxs)(`td`,{className:P.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:P.numCol,children:Y(e.total)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:P.tokenModelBar,children:(0,o.jsxs)(`span`,{className:P.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:P.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:P.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),O.totalCalls>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:P.tableScroll,children:(0,o.jsxs)(`table`,{className:P.modelTable,"data-testid":`billing-tool-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`toolName`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...O.top,...O.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelName,children:e})}),(0,o.jsx)(`td`,{className:P.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:P.numCol,children:[(t/O.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),ee.length>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`roleCost`)}),(0,o.jsx)(`span`,{className:P.panelHint,children:a(`roleHint`)})]}),(0,o.jsx)(`div`,{className:P.shareTrack,"data-testid":`billing-role-track`,children:ee.map(e=>(0,o.jsx)(`div`,{className:d(P.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:P.shareLegend,children:ee.map(e=>(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:d(P.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:P.shareValue,children:[s(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function mt(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(`
|
|
2
|
+
`)}function ht(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function gt(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 _t(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 vt({rounds:e,flags:t,currency:n,t:i}){let a=(0,r.useMemo)(()=>e.slice(-40),[e]),s=(0,r.useMemo)(()=>new Set(t.map(e=>`${e.sessionId}:${e.turn}`)),[t]),c=(0,r.useMemo)(()=>Math.max(1e-4,...a.map(e=>e.cost)),[a]);if(a.length===0)return(0,o.jsxs)(`div`,{className:P.roundsEmpty,children:[i(`model`),` —`]});let l=e=>J(n===`usd`?q(e):e,n);return(0,o.jsxs)(`div`,{className:P.rounds,children:[(0,o.jsx)(`div`,{className:P.roundsBars,role:`img`,"aria-label":`cost per turn`,children:a.map(e=>{let t=s.has(`${e.sessionId}:${e.turn}`),n=Math.max(1,e.cost/c*100),r=V(e.startedAt)===`peak`;return(0,o.jsxs)(`div`,{className:d(P.roundsBarCol,r?P.roundsBarColPeak:P.roundsBarColOff),children:[(0,o.jsx)(`span`,{className:P.roundsBarLabel,style:{bottom:`${n}%`},children:l(e.cost)}),(0,o.jsx)(`div`,{className:P.roundsBarWrap,children:(0,o.jsx)(`div`,{className:t?P.roundsBarFlagged:P.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${i(`model`)} ${e.model} · ${l(e.cost)} · ${gt(e.startedAt)}${e.endedAt===void 0?``:` → ${ht(e.endedAt)} (${_t(e.endedAt-e.startedAt)})`}`,children:t&&(0,o.jsx)(`span`,{className:P.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,o.jsxs)(`div`,{className:P.roundsAxis,children:[(0,o.jsxs)(`span`,{children:[i(`costAbbr`),` `,l(c)]}),(0,o.jsxs)(`span`,{children:[a.length,` 轮`]})]})]})}let yt=[`var(--dsw-alias-bg-layer-2)`,`color-mix(in srgb, var(--dsw-static-green-500) 22%, var(--dsw-alias-bg-layer-2))`,`color-mix(in srgb, var(--dsw-static-green-500) 45%, var(--dsw-alias-bg-layer-2))`,`color-mix(in srgb, var(--dsw-static-green-500) 70%, var(--dsw-alias-bg-layer-2))`,`var(--dsw-static-green-500)`],bt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function xt(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function St(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:xt(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:xt(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=xt(new Date(i,a,u)),f=n.get(d)??0,p=0;if(f>0&&r>0){let e=Math.ceil(f/r*4);p=Math.min(4,Math.max(1,e))}let m=u>o;t.push({date:d,dayNum:u,value:m?0:f,level:m?0:p,placeholder:m})}d.push(t)}return d}function Ct(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=xt(t),a=new Date(t);a.setHours(0,0,0,0),a.setDate(a.getDate()-a.getDay());let o=new Date(a);o.setDate(a.getDate()-357);let s=[];for(let e=0;e<52;e+=1){let t=[];for(let a=0;a<7;a+=1){let s=new Date(o);s.setDate(o.getDate()+e*7+a);let c=xt(s),l=c>i,u=l?0:n.get(c)??0,d=0;if(!l&&u>0&&r>0){let e=Math.ceil(u/r*4);d=Math.min(4,Math.max(1,e))}t.push({date:c,dayNum:s.getDate(),value:u,level:d,placeholder:l})}s.push(t)}return s}function wt({days:e,currency:t,now:n,t:i,range:a=`month`}){let[s,c]=(0,r.useState)(null),l=e=>J(t===`usd`?q(e):e,t),u=(0,r.useMemo)(()=>St(e,n??new Date),[e,n]);if(a===`year`){let t=Ct(e,n??new Date),r=[],a=-1;return t.forEach((e,t)=>{let n=Number(e[0]?.date.slice(5,7)??0);n!==a&&(r.push({index:t,label:bt[n-1]??``}),a=n)}),(0,o.jsxs)(`div`,{className:P.heatmapYear,"data-testid":`heatmap-year`,children:[(0,o.jsxs)(`div`,{className:P.heatmapYearBody,children:[(0,o.jsx)(`div`,{className:P.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,o.jsx)(`span`,{className:P.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,o.jsxs)(`div`,{className:P.heatmapYearScroll,children:[(0,o.jsx)(`div`,{className:P.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:r.map(e=>(0,o.jsx)(`span`,{className:P.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,o.jsx)(`div`,{className:P.heatmapYearGrid,role:`img`,"aria-label":`yearly cost heatmap`,"data-testid":`heatmap-year-grid`,children:t.flat().map(e=>(0,o.jsx)(`button`,{type:`button`,className:P.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,style:{background:yt[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`},e.date))})]})]}),(0,o.jsxs)(`div`,{className:P.heatmapFooter,children:[(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:P.heatmapLegend,children:yt.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapMore`)})]})]})}return(0,o.jsxs)(`div`,{className:P.heatmap,children:[(0,o.jsx)(`div`,{className:P.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,o.jsx)(`div`,{className:P.heatmapCellEmpty,children:e.dayNum},e.date):(0,o.jsx)(`button`,{type:`button`,className:P.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,style:{background:yt[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,onMouseEnter:()=>{c(e)},onMouseLeave:()=>{c(null)},onFocus:()=>{c(e)},onBlur:()=>{c(null)},children:e.dayNum},e.date)))}),(0,o.jsxs)(`div`,{className:P.heatmapFooter,children:[(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:P.heatmapLegend,children:yt.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapMore`)}),s!==null&&(0,o.jsxs)(`span`,{className:P.heatmapHover,"data-testid":`heatmap-hover`,children:[s.date,` · `,l(s.value)]})]})]})}let Tt={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function Et(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function Dt(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function Ot(e,t){let n=t?.window??Tt.window,r=t?.threshold??Tt.threshold,i=t?.reasonFactor??Tt.reasonFactor,a=t?.reasonHitDropPp??Tt.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=Dt(t),p=Et(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=Et(c),r=Et(l),s=Et(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}function kt(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function At(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function jt(e){return e.toFixed(2)}function Mt(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,jt(n.cost)].join(`,`)})].join(`
|
|
3
|
+
`)}function Nt(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[kt(At(n)),r,t.calls,jt(t.cost)].join(`,`)})].join(`
|
|
4
|
+
`)}function Pt(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function Ft(e){return[`session_id,title,project,calls,cost_cny,last_active`,...e.map(e=>[kt(At(e.id)),kt(At(e.title??``)),kt(At(Pt(e.cwd))),e.calls,jt(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``].join(`,`))].join(`
|
|
5
|
+
`)}function It(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 Lt(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)}let Rt=`usageBilling`,zt={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,trend:`每日费用与调用趋势`,trend7d:`7 天`,trend30d:`30 天`,trendMetric:`趋势指标`,trendMetricCost:`费用`,trendMetricTokens:`Token`,trendEmpty:`暂无趋势数据`,budget:`本月预算`,budgetAmount:`预算金额`,budgetSummary:`本月已用 {used} / {total};达到 80% 时提醒,达到 100% 时红色脉冲警示`,sessions:`会话明细`,sessionTitle:`标题`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`提供商计费与订阅`,channelUnknown:`未知路由`,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:`内置`,promoBadge:`限时折扣`,promoUntil:`促销价至 {date},之后自动恢复刊例价`,promoOpenEnded:`厂商未公布截止时间,当前按折扣计价;公告截止后自动恢复刊例价`,pricingTip:`DeepSeek 现行(2026-09-10 12:00 北京起):flash 系谷档 未命中 ¥1 / 输出 ¥4 / 缓存命中 ¥0.02(峰 = 谷 × 2),现行型号为 V4.1 Flash(旧 V4 Flash / Vision (Exp) 已下线并入,价格与时间线不变);V4 Pro 的请求自 2026-09-14 12:00 起(原定 09-10,官方推迟)路由至 V4.1 Flash 并按 Flash 单价计费(V4.1 Pro 上线前),此前仍按 V4 Pro 刊例计费。峰谷分时自 2026-08-23 起:工作日高峰 9-12 / 14-18(×2),周末全天低谷价。双价单元格按峰 / 谷展示,费用按调用时刻计。`,pricingUnit:`单位:人民币 / 每百万 Token`,pricingNotes:`计价说明`,ubPeak:`峰`,ubOff:`谷`,ubStd:`标准`,peakBand:`峰谷分带`,pricingSource:`数据来源`,noteCache:`命中部分按缓存价计费,显著降低成本。`,noteBand:`高峰与空闲时段单价不同,空闲约半价。`,noteSource:`价格来自实时汇率 + 模型定价目录,未收录模型按 0 计并提示。`,balance:`余额`,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:`悬浮在左下角计费卡上的用量速览;综合=当前样式,订阅卡=每次展示一张订阅额度卡(可切换)。`,cardDisplay:`计费卡显示`,cardDisplayHint:`切换左下角计费卡的主指标:花费金额或 Token 消耗(副行与迷你柱同步切换,悬浮窗不受影响)。`,cardMetric:`主指标`,cardMetricMoney:`花费金额`,cardMetricTokens:`Token 消耗`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;模型可用下拉候选(目录键或模型 id);来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价(协议可省);低谷价三栏填后按峰/谷混合估算,留空=平档`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceOffPeak:`低谷价`,userPriceNormal:`标准价`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemoveSelected:`删除所选`,userPriceSelect:`选择此行`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabPricing:`费率`,tabSettings:`设置`,budgetHint:`设置月度上限,用于本月预计与超支分段提醒`,peakAlertHint:`在切档前弹窗提醒,可选同步系统通知`,peakAlertDescPeak:`即将进入高峰时段,价格将上调,请提前安排长任务`,peakAlertDescOff:`即将进入平价时段,价格减半,适合运行大批量任务`,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} 分钟后进入平价(价格减半)`,peakAlertTitlePeak:`即将进入高峰价`,peakAlertTitleOff:`即将进入平价`,peakAlert:`峰谷切换提醒`,peakAlertLeadMin:`提前量(分钟)`,peakAlertPos:`位置`,peakAlertMode:`提醒模式`,peakAlertPosCorner:`右下角`,peakAlertPosCenter:`屏幕居中`,peakAlertModePeak:`仅进入峰时`,peakAlertModeOff:`仅进入平价`,peakAlertModeBoth:`峰与谷都提醒`,peakAlertWebNotify:`同时发系统通知`,peakAlertPreview:`预览提醒`,planTypeCode:`订阅制`,planTypeToken:`按量`,subscriptionFeePerMonth:`{amount}/月`,triggerToday:`今日`,triggerMonth:`当月`,triggerMonthTokens:`当月 Token`,subscriptionIncluded:`订阅包含`,free:`免费`,perfSamples:`样本`,perfTtft:`首字延时`,perfP50:`P50`,perfP90:`P90`,perfTps:`生成速度`,perfLatency:`总延迟`,perfEstimated:`估算样本`,perfEmpty:`暂无性能数据`,perfTpsUnit:`tok/s`,perfTitle:`性能`,perfHint:`按模型与按小时聚合;估算样本为工具续写步骤`,perfAll:`全选`,perfChartEmpty:`未选择模型或该指标暂无数据`,heatmapYear:`年`,heatmapMonth:`月`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenCacheHitRate:`缓存命中率`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,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:`未识别`},Bt={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,liveTurn:`Turn`,liveSession:`Session`,calls:`Calls`,cacheHitRate:`Cache Hit`,tokens:`Tokens`,inputTokens:`Input`,outputTokens:`Output`,avgCost:`Avg cost`,trend:`Daily cost & calls`,trend7d:`7D`,trend30d:`30D`,trendMetric:`Trend metric`,trendMetricCost:`Cost`,trendMetricTokens:`Tokens`,trendEmpty:`No trend data yet`,budget:`Monthly budget`,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`,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`,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 current rates (from 2026-09-10 12:00 Beijing): flash family off-peak ¥1 miss / ¥4 output / ¥0.02 cache-hit (peak = 2×); the current model is V4.1 Flash (legacy V4 Flash / Vision (Exp) are retired and merged in, same prices and timeline). V4 Pro requests route to V4.1 Flash at Flash rates from 2026-09-14 12:00 (deferred from 09-10; until V4.1 Pro ships) — before that they still bill at the V4 Pro list rates. Weekday peak 9-12 / 14-18 (×2), weekends all-day 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`,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).`,cardDisplay:`Billing card display`,cardDisplayHint:`Switch the main metric on the bottom-left billing card between cost and token usage (sub row and sparkline follow; the popover is unaffected).`,cardMetric:`Main metric`,cardMetricMoney:`Cost`,cardMetricTokens:`Token usage`,floatNoTargets:`No subscription selected — pick some in Settings.`,floatNoTargetsHint:`No subscription channel available.`,subscriptionsStale:`Subscription refresh failed — showing cached data`,staleLedgerNotice:`{count} sessions use legacy-algorithm archives (logs deleted); attribution may be off`,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`,heatmapLess:`Less`,heatmapMore:`More`,currency:`Currency`,currencyCny:`CNY`,currencyUsd:`USD`,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`,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`,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`,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`,triggerMonth:`This month`,triggerMonthTokens:`Monthly tokens`,subscriptionIncluded:`Included`,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`,heatmapMonth:`Month`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginAuthor:`Author`,pluginRepository:`Repository`,pluginNpm:`npm`,pluginLicense:`License`,tabToken:`Usage`,tokenExport:`Export tokens`,tokenExportCsv:`Daily token CSV`,tokenCacheHitRate:`Cache hit rate`,tokenReasoningShare:`Reasoning share`,tokenReasoningShort:`reasoning`,tokenIo:`In/out ratio`,tokenPeak:`Peak day`,tokenDaily:`Daily tokens`,tokenByModel:`Tokens by model`,tokenMiss:`Input (cache miss)`,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 after a reload)`,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`},Vt={"智谱 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 Ht(e,t){return t===`en`?Vt[e]??e:e}let Ut={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},Wt={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function Gt(e){try{return new URL(e).host}catch{return e}}function Kt(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=Ut[n];return r===void 0?Gt(n):t===`en`?Wt[r]??r:r}if(e.startsWith(`direct:`)){let n=e.slice(7);return/^deepseek(?:-[a-z0-9-]+)?$/i.test(n)?t===`en`?`DeepSeek Official`:`DeepSeek 官方`:`${t===`en`?`Direct`:`直连`} · ${n}`}}let qt={DeepSeek:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M35.7 9.9C35.3 9.8 35.2 10.1 35 10.2C34.9 10.3 34.9 10.4 34.8 10.4C34.3 10.9 33.7 11.3 33 11.2C31.9 11.2 30.9 11.5 30.1 12.4C29.9 11.3 29.3 10.7 28.4 10.3C28 10.1 27.5 9.9 27.1 9.4C26.9 9.1 26.9 8.8 26.7 8.4C26.7 8.2 26.6 8 26.4 7.9C26.1 7.9 26 8.1 25.9 8.3C25.5 9.1 25.3 9.9 25.3 10.8C25.3 12.7 26.2 14.2 27.8 15.3C27.9 15.4 28 15.5 27.9 15.7C27.8 16.1 27.7 16.5 27.6 16.8C27.5 17.1 27.4 17.1 27.1 17C26.3 16.7 25.5 16.1 24.8 15.4C23.7 14.3 22.7 13.1 21.4 12.2C21.1 12 20.8 11.7 20.4 11.5C19.1 10.3 20.6 9.2 21 9.1C21.3 9 21.1 8.5 19.9 8.5C18.8 8.5 17.7 8.9 16.3 9.4C16.1 9.5 15.9 9.6 15.7 9.6C14.5 9.4 13.2 9.3 11.9 9.5C9.4 9.8 7.4 11 5.9 13C4.1 15.4 3.7 18.2 4.2 21.1C4.7 24.1 6.3 26.6 8.7 28.6C11.2 30.7 14 31.7 17.3 31.5C19.2 31.4 21.4 31.1 23.9 29C24.6 29.3 25.2 29.4 26.3 29.5C27.1 29.6 27.9 29.5 28.6 29.3C29.6 29.1 29.5 28.2 29.1 28.1C26.3 26.7 26.9 27.3 26.3 26.8C27.8 25.1 30 23.3 30.8 17.5C30.9 17 30.8 16.7 30.8 16.4C30.8 16.1 30.9 16.1 31.1 16C31.9 15.9 32.6 15.7 33.2 15.4C35.1 14.4 35.8 12.7 36 10.7C36 10.4 36 10.1 35.7 9.9ZM19.4 27.9C16.7 25.8 15.3 25 14.7 25.1C14.2 25.1 14.3 25.7 14.4 26.1C14.6 26.5 14.7 26.7 14.9 27.1C15.1 27.3 15.2 27.6 14.8 27.9C13.9 28.4 12.3 27.7 12.2 27.6C10.4 26.6 8.9 25.2 7.8 23.2C6.8 21.4 6.2 19.4 6.1 17.3C6.1 16.7 6.2 16.6 6.8 16.5C7.4 16.3 8.1 16.3 8.8 16.4C11.6 16.8 14.1 18.1 16.1 20.1C17.2 21.3 18.1 22.6 19 24C20 25.4 21 26.8 22.3 27.9C22.8 28.2 23.2 28.5 23.5 28.8C22.4 28.9 20.7 28.9 19.4 27.9ZM20.8 19.4C20.8 19.3 20.8 19.2 20.8 19.2C20.9 19.1 20.9 19.1 21 19C21 19 21.1 19 21.1 19C21.2 18.9 21.3 19 21.3 19C21.4 19 21.5 19.1 21.5 19.1C21.6 19.2 21.6 19.3 21.6 19.4C21.6 19.4 21.6 19.5 21.6 19.5C21.5 19.6 21.5 19.6 21.5 19.6C21.4 19.7 21.4 19.7 21.3 19.7C21.3 19.8 21.2 19.8 21.2 19.8C21.1 19.8 21.1 19.8 21 19.7C21 19.7 20.9 19.7 20.9 19.6C20.9 19.6 20.8 19.6 20.8 19.5C20.8 19.5 20.8 19.4 20.8 19.4ZM24.9 21.5C24.7 21.6 24.4 21.7 24.1 21.7C23.8 21.7 23.4 21.6 23.1 21.4C22.7 21.1 22.4 20.9 22.3 20.3C22.3 20.1 22.3 19.8 22.4 19.6C22.4 19.1 22.3 18.8 22 18.6C21.8 18.4 21.5 18.3 21.1 18.3C21 18.3 20.9 18.3 20.8 18.2C20.6 18.2 20.5 18 20.6 17.7C20.7 17.7 20.8 17.5 20.9 17.5C21.4 17.2 21.9 17.3 22.4 17.5C22.9 17.7 23.2 18 23.7 18.5C24.3 19.1 24.4 19.3 24.7 19.8C24.9 20.1 25.1 20.5 25.3 20.9C25.3 21.1 25.2 21.4 24.9 21.5Z' fill='currentColor'/%3E%3C/svg%3E`,OpenAI:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M32.8 17.3C33.2 16.3 33.3 15.2 33.2 14.2C33.1 13.2 32.7 12.1 32.3 11.2C31.4 9.8 30.2 8.7 28.8 8C27.3 7.3 25.7 7.2 24.1 7.5C23.4 6.8 22.5 6.1 21.6 5.7C20.7 5.2 19.5 5 18.5 5C16.9 5 15.3 5.5 14 6.4C12.7 7.3 11.7 8.7 11.3 10.2C10.2 10.4 9.2 10.9 8.3 11.5C7.4 12.1 6.8 13 6.2 13.8C5.4 15.2 5.1 16.8 5.3 18.4C5.5 20 6.1 21.5 7.2 22.7C6.8 23.7 6.7 24.8 6.8 25.8C6.9 26.8 7.2 27.9 7.7 28.8C8.6 30.2 9.8 31.3 11.2 32C12.7 32.7 14.3 32.8 15.9 32.5C16.6 33.2 17.5 33.9 18.4 34.3C19.3 34.8 20.5 35 21.5 35C23.1 35 24.7 34.5 26 33.6C27.3 32.7 28.2 31.3 28.7 29.8C29.8 29.6 30.8 29.2 31.6 28.5C32.5 27.9 33.2 27.1 33.7 26.2C34.5 24.8 34.8 23.2 34.6 21.6C34.4 20 33.9 18.5 32.8 17.3ZM21.6 33C20.1 33 19 32.6 17.9 31.7C17.9 31.7 18 31.6 18.1 31.6L24.1 28.2C24.3 28.1 24.4 27.9 24.5 27.8C24.6 27.6 24.6 27.5 24.6 27.3V18.9L27.1 20.4V27.3C27.1 28.1 27 28.8 26.8 29.5C26.5 30.2 26.1 30.8 25.6 31.3C25.1 31.9 24.4 32.3 23.7 32.6C23.1 32.9 22.3 33 21.6 33ZM9.5 27.9C8.8 26.7 8.6 25.4 8.8 24.1C8.8 24.1 8.9 24.2 9 24.2L15 27.7C15.2 27.8 15.3 27.8 15.5 27.8C15.7 27.8 15.9 27.8 16 27.7L23.3 23.5V26.4L17.2 29.9C16.6 30.3 15.9 30.5 15.1 30.6C14.4 30.7 13.7 30.7 13 30.5C11.5 30.1 10.2 29.2 9.5 27.9ZM7.9 14.8C8.6 13.7 9.6 12.9 10.8 12.4V19.5C10.8 19.7 10.8 19.9 10.9 20C11 20.2 11.1 20.3 11.3 20.4L18.6 24.6L16.1 26.1L10.1 22.6C9.4 22.3 8.9 21.8 8.4 21.2C8 20.6 7.6 20 7.4 19.3C7.1 17.8 7.2 16.2 7.9 14.8ZM28.6 19.6L21.3 15.4L23.8 13.9L29.8 17.4C30.8 17.9 31.5 18.7 32 19.6C32.5 20.6 32.7 21.6 32.7 22.7C32.6 23.8 32.2 24.8 31.5 25.6C30.9 26.5 30 27.1 29 27.5V20.4C29 20.2 29 20 28.9 19.9C28.9 19.9 28.8 19.7 28.6 19.6ZM31.2 15.9C31.2 15.9 31.1 15.8 31 15.8L25 12.3C24.8 12.2 24.7 12.2 24.5 12.2C24.3 12.2 24.1 12.2 24 12.3L16.7 16.5V13.6L22.8 10.1C23.7 9.5 24.8 9.3 25.9 9.3C26.9 9.3 28 9.7 28.9 10.3C29.7 11 30.5 11.8 30.9 12.8C31.2 13.7 31.3 14.8 31.2 15.9ZM15.4 21.1L12.9 19.6V12.6C12.9 11.6 13.2 10.4 13.7 9.6C14.3 8.7 15.1 8 16.1 7.5C17 7.1 18.1 6.9 19.2 7.1C20.2 7.2 21.2 7.6 22.1 8.3C22.1 8.3 22 8.4 21.9 8.4L15.9 11.8C15.7 11.9 15.6 12.1 15.5 12.2C15.4 12.4 15.4 12.5 15.4 12.7V21.1ZM16.7 18.1L20 16.3L23.3 18.1V21.9L20 23.8L16.7 21.9V18.1Z' fill='currentColor'/%3E%3C/svg%3E`,Google:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M37 20C27.9 20.6 20.6 27.9 20 37H20C19.4 27.9 12.1 20.6 3 20V20C12.1 19.4 19.4 12.1 20 3H20C20.6 12.1 27.9 19.4 37 20V20Z' fill='currentColor'/%3E%3C/svg%3E`,"智谱 AI":`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.1 7.5L17.4 11.2H5.8L8.5 7.5H20.1H20.1ZM34.1 28.8L31.3 32.5H19.8L22.5 28.8H34.1ZM35 7.5L16.6 32.5H5L23.4 7.5H35Z' fill='currentColor'/%3E%3C/svg%3E`,腾讯混元:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M18.1 25.2C19.6 26.8 21.1 28.1 22.7 29.2L21.5 30.8C19.9 29.7 18.3 28.3 16.7 26.6C17.1 26.1 17.6 25.7 18.1 25.2ZM10 2.7C11.8 1.7 13.8 2.2 15.6 3.3C17.5 4.4 19.5 6.2 21.3 8.3L19.7 9.6C18 7.6 16.2 6 14.6 5.1C13 4.1 11.8 4 11 4.5C10 5 9.4 6.5 9.8 9.2C9.9 9.8 10 10.4 10.2 11.1C11.6 10.9 13.1 10.9 14.6 10.9C17.7 10.9 20.5 11.2 22.8 11.7L22.8 11.7C23.2 11.8 23.6 11.9 24 12C24 12 24 12 24 12C24.7 12.2 25.3 12.4 25.9 12.6C28.6 13.7 30.6 15.5 30.6 17.9C30.6 19.9 29.1 21.4 27.3 22.5C25.4 23.6 22.9 24.3 20.1 24.8L19.8 22.9C22.4 22.4 24.7 21.7 26.3 20.8C27.9 19.8 28.6 18.8 28.6 17.9C28.6 16.8 27.7 15.5 25.1 14.5C24.6 14.3 23.9 14 23.2 13.8C22.7 15.1 22 16.4 21.3 17.7C18.9 21.7 16.4 24.8 14.1 26.6C11.8 28.4 9.2 29.3 7.2 28.1C5.4 27 4.8 25 4.8 22.9C4.9 20.7 5.5 18.1 6.4 15.5L8.3 16.2C7.4 18.7 6.9 21 6.8 22.9C6.8 24.8 7.4 25.8 8.2 26.3C9.1 26.9 10.7 26.7 12.8 25C13.3 24.7 13.8 24.2 14.3 23.7C13.4 22.6 12.6 21.4 11.9 20.1C9.6 16.1 8.2 12.4 7.8 9.4C7.4 6.5 7.9 3.9 10 2.7ZM14.6 12.9C13.3 12.9 12 12.9 10.8 13.1C11.4 14.9 12.4 16.9 13.6 19.1C14.3 20.2 15 21.3 15.7 22.3C17 20.8 18.3 18.9 19.5 16.7C20.2 15.6 20.7 14.5 21.2 13.4C19.3 13.1 17.1 12.9 14.6 12.9ZM6.2 11.8C6.4 12.5 6.6 13.1 6.8 13.8C4.9 14.2 3.1 14.8 1.5 15.5L0.7 13.7C2.3 13 4.2 12.3 6.2 11.8ZM24.9 3.6L25.9 3.7C25.7 5.7 25.3 7.8 24.6 10.1C24.2 9.9 23.7 9.8 23.2 9.7C23 9.7 22.8 9.7 22.7 9.6C23.3 7.5 23.7 5.4 23.9 3.5L24.9 3.6Z' fill='currentColor'/%3E%3C/svg%3E`,MiniMax:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.9 9.2C17.9 8.6 17.4 8.1 16.8 8.1C16.2 8.1 15.7 8.6 15.7 9.2V27.6C15.7 29.1 14.5 30.2 13.1 30.2C11.7 30.2 10.5 29.1 10.5 27.6V15.8C10.5 15.2 10 14.7 9.4 14.7C8.8 14.7 8.3 15.2 8.3 15.8V20.8C8.3 22.3 7.1 23.4 5.7 23.4C4.3 23.4 3.1 22.3 3.1 20.8V19C3.1 18.6 3.4 18.3 3.8 18.3C4.3 18.3 4.6 18.6 4.6 19V20.8C4.6 21.4 5.1 21.9 5.7 21.9C6.3 21.9 6.8 21.4 6.8 20.8V15.8C6.8 14.4 8 13.2 9.4 13.2C10.8 13.2 12 14.4 12 15.8V27.6C12 28.3 12.5 28.8 13.1 28.8C13.7 28.8 14.2 28.3 14.2 27.6V20.4V9.2C14.2 7.8 15.3 6.6 16.8 6.6C18.2 6.6 19.3 7.8 19.3 9.2V24.5C19.3 24.9 19 25.2 18.6 25.2C18.2 25.2 17.9 24.9 17.9 24.5V9.2ZM31.5 13.2C30.1 13.2 28.9 14.4 28.9 15.8V25.7C28.9 26.3 28.5 26.8 27.8 26.8C27.2 26.8 26.7 26.3 26.7 25.7V9.2C26.7 7.8 25.6 6.6 24.1 6.6C22.7 6.6 21.6 7.8 21.6 9.2V30.1C21.6 30.8 21.1 31.3 20.5 31.3C19.8 31.3 19.3 30.8 19.3 30.1V27.5C19.3 27.1 19 26.8 18.6 26.8C18.2 26.8 17.9 27.1 17.9 27.5V30.1C17.9 31.6 19 32.7 20.5 32.7C21.9 32.7 23 31.6 23 30.1V9.2C23 8.6 23.5 8.1 24.1 8.1C24.8 8.1 25.3 8.6 25.3 9.2V25.7C25.3 27.1 26.4 28.3 27.8 28.3C29.3 28.3 30.4 27.1 30.4 25.7V15.8C30.4 15.2 30.9 14.7 31.5 14.7C32.1 14.7 32.6 15.2 32.6 15.8V24.5C32.6 24.9 33 25.2 33.4 25.2C33.8 25.2 34.1 24.9 34.1 24.5V15.8C34.1 14.4 33 13.2 31.5 13.2Z' fill='currentColor'/%3E%3C/svg%3E`,阿里通义:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M38 23C33.8 25.3 29.6 27.4 24.9 28.3C23.8 28.5 22.6 28.5 21.6 28.4C20.6 28.2 20.1 27.3 20.4 26.4C20.8 25.5 21.2 24.6 21.8 23.9C23.1 22.3 24.5 20.8 25.8 19.3C26.6 18.3 27.3 17.3 28 16.2C28.4 15.4 28.2 14.5 27.4 14.1C26.1 13.5 24.6 13 23.2 12.5C23 12.4 22.8 12.6 22.5 12.7C22.9 13.1 23.2 13.4 23.6 13.7C19.3 14.4 15.3 15.5 11.4 16.9C11.4 17 11.4 17 11.4 17C12 17.9 11.7 18.6 10.9 19.1C10.6 19.4 10.3 19.6 10 19.9C12.6 20.7 14.9 20.2 17.1 18.8C16.9 18.6 16.8 18.5 16.7 18.3C17.5 18.4 18 18.9 18 19.6C18.1 19.7 18 19.9 17.9 20C17.8 19.9 17.6 19.8 17.5 19.6C17.5 19.5 17.5 19.4 17.4 19.3C14.8 21 12 21.4 9 20.5C9 21.1 8.9 21.6 9 22.1C9 22.6 8.8 22.8 8.4 23C7.6 23.5 6.6 24.1 5.9 24.8C5 25.7 5.3 26.8 6.5 27.2C7.9 27.7 9.3 27.7 10.8 27.6C12.4 27.3 14.1 27.1 15.9 26.8C13.8 27.8 11.7 28.5 9.4 28.8C7.9 29 6.3 29.1 4.8 28.7C2.6 28.1 1.6 26.4 2.2 24.3C2.7 22.2 4 20.6 5.4 19.1C10.1 14.1 16.1 11.5 23 11C24.6 10.9 26.2 11.1 27.7 11.8C29.8 12.8 30.7 14.8 29.7 16.8C29 18.2 28.1 19.4 27.1 20.7C26.2 21.9 25.2 23 24.2 24.2C23.9 24.5 23.7 24.9 23.5 25.3C23.1 26 23.3 26.5 24.2 26.4C26 26.3 27.9 26.1 29.6 25.7C32.2 25 34.7 24.1 37.3 23.3C37.5 23.2 37.8 23.1 38 23V23Z' fill='currentColor'/%3E%3C/svg%3E`,小米:`data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.4 5C13.6 5.2 11.4 5.8 9.5 7.1C8.1 8 7.1 9.1 6.4 10.7C5.6 12.4 5.2 14.3 5.1 17.7C4.9 21.6 5.2 25.5 5.8 27.5C6.3 29.4 7.1 30.8 8.4 32C10 33.5 11.7 34.3 14.5 34.7C17 35 22.8 35.1 25.3 34.7C28.4 34.3 30.4 33.4 32 31.7C32.8 30.9 33.2 30.4 33.7 29.3C34.5 27.6 34.8 25.8 35 22.2C35.1 19.7 35 16.1 34.7 14.4C34.1 10.5 32.5 7.9 29.5 6.4C28 5.6 25.7 5.2 22.5 5C20.1 4.9 19.8 4.9 17.4 5ZM21.1 14.4C22.4 14.7 23 15.1 23.4 16C23.9 17 24 17.7 24 21.9V25.8L22.5 25.8L21.1 25.7L21 21.9C21 17.8 21 17.6 20.4 17.2C19.9 16.8 19.4 16.7 16.6 16.7H13.9L13.8 21.2L13.8 25.7H11L10.9 20C10.9 15.5 10.9 14.3 11 14.2C11.1 14.2 13.2 14.2 15.8 14.2C19.5 14.2 20.5 14.3 21.1 14.4ZM28.9 14.3C29 14.5 29 25.4 29 25.7C29 25.8 28.3 25.8 27.5 25.8L26.1 25.7L26.1 20.1C26.1 16 26.1 14.4 26.2 14.3C26.3 14.2 26.6 14.2 27.6 14.2C28.7 14.2 28.9 14.2 28.9 14.3ZM18.9 22.2V25.8L17.5 25.8L16 25.7L15.9 22.3C15.9 20.5 15.9 18.9 16 18.8C16 18.7 16.4 18.7 17.5 18.7H18.9V22.2Z' fill='currentColor'/%3E%3C/svg%3E`,字节豆包:`data:image/svg+xml,%3Csvg fill='currentColor' fill-rule='evenodd' height='1em' style='flex:none;line-height:1' viewBox='0 0 24 24' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.3 5.4L3.1 21.7a.215.2 0 0.2.261h8.3a.214.2 0 0.2-.261L7.7 5.4a.214.2 0 00-.41 0z' fill-opacity='.5'%3E%3C/path%3E%3Cpath clip-rule='evenodd' d='M4.6 16.2l-1.4 5.6a.214.2 0 0.2.261h2.4-4.6a.214.2 0 01-.214-.26l2.3-9a.214.2 0 1.4 0l.864 3.4z'%3E%3C/path%3E%3Cpath d='M14.4.15a.214.2 0 00-.41 0L8.4 21.7a.214.2 0 0.2.261H19.9a.214.2 0 0.2-.261L14.4.151z' fill-opacity='.5'%3E%3C/path%3E%3Cpath clip-rule='evenodd' d='M16.7 22h3.2a.215.2 0 0.2-.262l-1.8-7 1.2-4.6a.214.2 0 1.4 0l3 11.6a.214.2 0 01-.214.3h-5.9z'%3E%3C/path%3E%3Cpath d='M10.3 7.7L6.7 21.7a.214.2 0 0.2.264h7.2a.216.2 0 0.2-.166.2.216 0 000-.098L10.7 7.7a.214.2 0 00-.409 0z'%3E%3C/path%3E%3C/svg%3E`,月之暗面:`data:image/svg+xml,%3Csvg viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M26 4a16 16 0 1 0 10 28A18 18 0 0 1 26 4z' fill='currentColor'/%3E%3C/svg%3E`};function Jt(e){return qt[e]}let Yt=`dsh-billing-peak-alert-v1`,Xt={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function Zt(){try{let e=localStorage.getItem(Yt);if(e===null)return{...Xt};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:Xt.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))):Xt.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...Xt}}}function Qt(e){try{localStorage.setItem(Yt,JSON.stringify(e))}catch{}}function $t(e,t,n){if(!t.enabled)return null;let r=Oe(e,t.leadMin*6e4);return r===null||t.mode===`peak`&&r.entering!==`peak`||t.mode===`offPeak`&&r.entering!==`offPeak`||r.atMs===n?null:r}function en({hit:e,config:t,t:n,onDismiss:i}){let[a,s]=(0,r.useState)(()=>Date.now());if((0,r.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,r.useEffect)(()=>{a>=e.atMs&&i()},[a,e.atMs,i]),a>=e.atMs)return null;let c=Math.max(1,Math.round((e.atMs-a)/6e4)),l=e.entering,u=n(l===`peak`?`tierPeak`:`tierOff`),f=n(l===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),p=l===`peak`;return(0,o.jsxs)(`div`,{className:d(P.peakCard,p?P.peakCardPeak:P.peakCardOff,t.position===`center`?P.peakCardCenter:P.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:P.peakHead,children:[(0,o.jsxs)(`span`,{className:d(P.peakTag,p?P.peakTagPrimary:P.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:d(P.peakDot,p?P.peakDotPrimary:P.peakDotSuccess),"aria-hidden":`true`}),u]}),(0,o.jsx)(`button`,{type:`button`,className:P.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:d(P.peakCount,p?P.peakCountPrimary:P.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:P.peakDesc,children:f})]})}let tn=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],nn=[50,80,100],rn={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},an={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`]};function $(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function on(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 sn(e,t){let n=$(e),r=$(t);if(on(n,r))return!0;let i=an[e];return i!==void 0&&i.some(e=>on($(e),r))}function cn(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(an))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(an))for(let r of t){let t=$(r);if(!(t.length<4)&&n.includes(t))return e}}}let ln={"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 un(e){let t=ln[e];return t===void 0?cn(e)??e:t}function dn(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 fn(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:dn(e,n);return o<=0?0:o*a}function pn(e){let t=he();if(t===void 0||e.byDayModels===void 0)return e;let n=Se().rate,r=e.byDayModelsSite!==void 0,i={},a={},o=new Map,s=0,c=e=>t.some(t=>t.origin!==void 0&&t.origin!==``&&(t.key===e||U(t.key)===U(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=r=>{let a=(t.cacheMiss*r.input+i*r.cacheHit+t.output*r.output)/1e6;return e.currency===`USD`?a*n:a};return e.offPeak===void 0?a(e):a(e)*Ce+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=_e(i)??I(i),s=r&&c(i),f;if((n!==void 0||s)&&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:_e(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=>!_e(e)&&!I(e))}}function mn(){return typeof Notification<`u`&&Notification.permission===`granted`}let hn=new Set;function gn(e,t){hn.has(e)||(hn.add(e),fetch(`/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 _n(e){return Object.keys(e).length}function vn(e,t=Date.now()){let n=0,r=new Date(t);for(;On(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function yn(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=On(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function bn(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[On(i.getTime())];o!==void 0&&(a+=n(o))}return a}function xn(e,t){return e.checked?e.okProviders.some(e=>sn(t,e))?P.healthOk:e.badProviders.some(e=>sn(t,e))?P.healthBad:P.healthIdle:P.healthIdle}function Sn(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 Cn(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 wn(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 Tn(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let En={"new-api":P.siteKindSite,sub2api:P.siteKindDirect,unknown:P.siteKindUnknown},Dn=3e4;function On(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 kn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let An=[`#3b82f6`,`#06b6d4`,`#8b5cf6`,`#f59e0b`,`#10b981`,`#ef4444`,`#ec4899`,`#6366f1`,`#f97316`,`#14b8a6`],jn={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function Mn(){try{let e=await fetch(`/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??jn.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},...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.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}}let Nn=!1;async function Pn(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){Nn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){Nn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(Nn)return;Nn=!0}setTimeout(()=>{Pn(e+1)},2e3);return}Nn=!1,ye(i)}catch{Nn=!1}}async function Fn(){try{let e=await fetch(`/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}}}catch{return{balances:[]}}}async function In(){let e=await fetch(`/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)return n.quotas;throw Error(`subscriptions: invalid response`)}async function Ln(){let e=await fetch(`/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 Rn(){try{let e=await fetch(`/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 zn(e){try{let t=await fetch(`/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 Bn=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function Vn(e){let{wide:t,t:n,onOpen:a,monthCost:s,todayCost:c,weekCost:l,days:u,vendorStatus:f,dash:p,floatPrefs:m,subscriptions:h,cardPrefs:g,monthTokens:_,todayTokens:v,weekTokens:y}=e,b=(0,r.useMemo)(()=>m.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[m.targets,h]),[ee,x]=(0,r.useState)(0),S=b.length===0?0:Math.min(ee,b.length-1),C=b[S];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||b.length<2)return;let e=setInterval(()=>x(e=>(e+1)%b.length),1500);return()=>clearInterval(e)},[m.mode,b.length]);let w=(0,r.useRef)(null),[T,E]=(0,r.useState)(!1),[D,O]=(0,r.useState)({left:0,top:0}),k=(0,r.useRef)(void 0),A=(0,r.useCallback)(()=>{window.clearTimeout(k.current),E(!0)},[]),te=(0,r.useCallback)(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>E(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(k.current),[]);let j=(0,r.useCallback)(()=>{let e=w.current?.getBoundingClientRect();e!==void 0&&O({left:e.left,top:e.top-8})},[]);(0,r.useEffect)(()=>{if(!T)return;let e=()=>j();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[T,j]);let M=(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M4 7h16v11H4z`}),(0,o.jsx)(`path`,{d:`M4 10h16`}),(0,o.jsx)(`path`,{d:`M8 14h3`})]});if(!t)return(0,o.jsx)(`button`,{type:`button`,className:P.railButton,"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${J(s)}`,children:M});let ne=g.metric===`tokens`,N=u.map(e=>ne?e.tokens:e.cost),re=Math.max(...N,0),F=N.map(e=>re>0?4+e/re*12:4);return(0,o.jsxs)(`span`,{ref:w,className:P.triggerWrap,onMouseEnter:()=>{j(),A()},onMouseLeave:te,onFocusCapture:()=>{j(),A()},onBlurCapture:()=>E(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:P.trigger,"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${J(s)}`,children:[(0,o.jsx)(`span`,{className:P.triggerIcon,"data-testid":`billing-trigger-icon`,children:M}),(0,o.jsxs)(`span`,{className:P.triggerMain,children:[(0,o.jsxs)(`span`,{className:P.triggerPrimary,children:[(0,o.jsx)(`span`,{className:P.triggerLabel,children:n(ne?`triggerMonthTokens`:`triggerMonth`)}),ne?(0,o.jsx)(`span`,{className:P.triggerMetric,"data-testid":`billing-trigger-month-tokens`,children:Y(_)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.triggerYen,"aria-hidden":`true`,children:J(s).charAt(0)}),(0,o.jsx)(`span`,{className:P.triggerMetric,children:J(s).slice(1)})]})]}),(0,o.jsx)(`span`,{className:P.triggerSub,"data-testid":`billing-trigger-today`,children:ne?`${n(`triggerToday`)} ${Y(v)} · ${n(`weekCost`)} ${Y(y)}`:`${n(`triggerToday`)} ${J(c)} · ${n(`weekCost`)} ${J(l)}`})]}),(0,o.jsx)(`span`,{className:P.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:F.map((e,t)=>(0,o.jsx)(`span`,{className:t===F.length-1?P.triggerSparkHot:P.triggerSparkBar,style:{height:`${e}px`}},u[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:d(P.triggerPop,T&&P.triggerPopShown),style:{left:`${D.left}px`,top:`${D.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!T,onMouseEnter:A,onMouseLeave:te,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:b.length===0?(0,o.jsx)(`span`,{className:P.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[C!==void 0&&(0,o.jsxs)(`div`,{className:P.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:P.floatSubHead,children:[(0,o.jsx)(`span`,{className:P.floatSubName,children:C.displayName}),C.plan!==void 0&&(0,o.jsx)(`span`,{className:P.floatSubPlan,children:C.plan})]}),C.windows.map(e=>(()=>{let t=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:P.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:P.subscriptionWindowLabel,children:wn(e.kind,n)}),(0,o.jsx)(`span`,{className:P.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(P.subscriptionFill,t>=100&&P.subscriptionFillOver,t>=80&&t<100&&P.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:P.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(P.subscriptionPct,r&&P.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${On(new Date(e.resetsAt).getTime())} ${kn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),b.length>1&&(0,o.jsx)(`span`,{className:P.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:P.triggerPopSwitchCount,children:[S+1,`/`,b.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.popHead,children:(0,o.jsx)(`span`,{className:P.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:P.metricGrid,children:[(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`monthCost`)}),(0,o.jsx)(`span`,{className:d(P.metricValue,P.metricValuePrimary),children:J(s)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`tokenTotal`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:Y(p.totalToken)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:Y(p.input)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:Y(p.output)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:d(P.metricValue,P.metricValueSuccess),children:Y(p.cacheRead)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`calls`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:p.calls.toLocaleString()})]})]}),(0,o.jsxs)(`span`,{className:P.popModel,children:[(0,o.jsx)(`span`,{className:P.popModelLabel,children:n(`popTodayModel`)}),f.direct!==void 0||f.sub!==void 0?(0,o.jsxs)(o.Fragment,{children:[f.direct!==void 0&&(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:P.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:d(P.popModelStatus,f.direct.low&&P.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:P.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:d(P.popModelStatus,f.sub.low&&P.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function Hn({balance:e,days:t,dailyBurn:n,money:r,t:i,onClose:a}){let s=t=>t===void 0?void 0:e.currency===`USD`?`$${t.toFixed(2)}`:r(t),c=s(e.totalBalance),l=s(e.grantedBalance),u=s(e.toppedUpBalance);return(0,o.jsxs)(`span`,{className:P.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:P.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:P.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:P.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:P.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(Un,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(Un,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(Un,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(Un,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(Un,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function Un({label:e,value:t}){return(0,o.jsxs)(`span`,{className:P.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:P.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:P.balanceDetailValue,children:t})]})}function Wn({userPrices:e,onUserPrices:t,t:n}){let[i,a]=(0,r.useState)(()=>[...e]),[s,c]=(0,r.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),u=()=>{a(e=>e.filter((e,t)=>!s.has(t))),c(new Set)},f=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),p=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),m=e=>{let t=i[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},h=(e,t,n)=>a(r=>r.map((r,i)=>{if(i!==e)return r;let a={...m(e),[t]:n},o=[a.input,a.cacheHit,a.output].some(e=>e.trim()!==``),s=[a.input,a.cacheHit,a.output].map(e=>Number(e)),c=o&&s.every(e=>Number.isFinite(e)&&e>=0)&&s.some(e=>e>0),{offPeak:l,...u}=r;return c?{...u,offPeak:{input:s[0]??0,cacheHit:s[1]??0,output:s[2]??0}}:u})),g=()=>t(i.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:fe(e.origin.trim())}}))),_=Be().map(e=>e.key),v=(e,t)=>a(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),y=e=>Number.isFinite(e)&&e!==0?String(e):``,b=(e,t,n)=>{let r=Number(n);f(e,{[t]:Number.isFinite(r)&&r>=0?r:0})};return(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsx)(`datalist`,{id:`billing-price-model-keys`,children:_.map(e=>(0,o.jsx)(`option`,{value:e},e))}),i.map((e,t)=>(0,o.jsxs)(`div`,{className:P.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsx)(`input`,{type:`checkbox`,className:P.userPriceCheck,"data-testid":`billing-user-price-select`,checked:s.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>l(t)}),(0,o.jsxs)(`div`,{className:P.userPriceBody,children:[(0,o.jsxs)(`div`,{className:P.userPriceLineMeta,children:[(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:P.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=>f(t,{key:e.target.value})})]}),(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:P.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>f(t,{origin:e.target.value.trim()})})]}),(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,e.currency!==`USD`&&P.floatModeBtnOn),onClick:()=>v(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,e.currency===`USD`&&P.floatModeBtnOn),onClick:()=>v(t,`USD`),children:`USD`})]})]})]}),(0,o.jsxs)(`div`,{className:P.userPricePriceLine,"data-testid":`billing-user-price-normal`,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceNormal`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:P.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceNormal`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:y(e[r]),onChange:e=>b(t,r,e.target.value)},r))]}),(()=>{let e=m(t);return(0,o.jsxs)(`div`,{className:P.userPricePriceLine,"data-testid":`billing-user-price-offpeak`,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceOffPeak`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:P.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceOffPeak`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:e[r],onChange:e=>h(t,r,e.target.value)},r))]})})()]})]},t)),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-add`,onClick:p,children:n(`userPriceAdd`)}),(0,o.jsxs)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:s.size===0,onClick:u,children:[n(`userPriceRemoveSelected`),s.size>0?` (${s.size})`:``]}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-save`,onClick:g,children:n(`userPriceSave`)})]})]})]})}function Gn({stats:e,t,onClose:n,userPrices:i,onUserPrices:s,health:c,balances:l,reconcile:u,quotas:f,relayQuotas:p,currency:m,onCurrency:h,turns:g,renderSlot:_,budgetEnabled:v,budgetAmount:y,onToggleBudget:b,onBudgetAmount:ee,peakConfig:x,onPeakConfig:S,onPreviewPeak:C,floatPrefs:w,onFloatPrefs:T,cardPrefs:E,onCardPrefs:D,sitePrefs:O,onSitePrefs:k,liveCostPrefs:A,onLiveCostPrefs:te,quotasStale:j}){let[M,ne]=(0,r.useState)(`cost`),{total:N,byModel:re,byDay:F}=e,[ie,oe]=(0,r.useState)(`overview`),[se,ce]=(0,r.useState)(7),[le,ue]=(0,r.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),de=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},fe=(0,r.useCallback)(()=>{let e=de();ue(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[pe,me]=(0,r.useState)(`month`),he=(0,r.useMemo)(()=>f.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[f]),[ge,_e]=(0,r.useState)(),[ve,I]=(0,r.useState)(new Set),ye=(0,r.useCallback)(e=>{I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[be,xe]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return Rn().then(t=>{e&&t!==void 0&&xe(t)}),()=>{e=!1}},[]);let Ce=(0,r.useCallback)(()=>{let e=!be;xe(e),zn(e).then(t=>{t||xe(!e)})},[be]),L=Se(),R=e=>J(m===`usd`?q(e):e,m),z=m===`usd`?`en`:`zh`,B=e=>Ht(e,z),V=(e,n)=>e===0?t(`free`):We(Ge(e,n,m,L.rate),m===`usd`?`USD`:`CNY`),we=(0,r.useMemo)(()=>Ot([...g].reverse()),[g]),Te={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},Ee=Te.peak/2,De=dn(F,On()),Oe=e=>l.find(t=>$(t.provider)===$(e)),ke=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),Ae=e=>{if(e===void 0)return(0,o.jsx)(`span`,{className:P.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,o.jsx)(`span`,{className:P.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:R(e.totalBalance),r=e.currency===`USD`?e.totalBalance*L.rate:e.totalBalance,i=De>0?Math.floor(r/De):void 0;return(0,o.jsxs)(`span`,{className:P.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:d(P.balanceDaysBadge,i<=3&&P.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:()=>{_e(ge===e.provider?void 0:e.provider)},children:`?`}),ge===e.provider&&(0,o.jsx)(Hn,{balance:e,days:i??0,dailyBurn:De,money:R,t,onClose:()=>{_e(void 0)}})]})},je=N.cacheHit+N.cacheMiss>0?N.cacheHit/(N.cacheHit+N.cacheMiss)*100:0,Me=Object.keys(F).sort(),H=On(),U=F[H]?.cost??0,Ne=H.slice(0,7),Pe=H.slice(0,4),W=Me.reduce((e,t)=>e+(t.startsWith(Ne)?F[t]?.cost??0:0),0),G=Me.reduce((e,t)=>e+(t.startsWith(Pe)?F[t]?.cost??0:0),0),Fe=(0,r.useMemo)(()=>fn(F,Ne,H)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[F,Ne,H,f]),K=(0,r.useMemo)(()=>{let e=v&&y>0?W/y*100:NaN;return{pct:Number.isFinite(e)?Math.max(0,Math.min(100,e)):G>0?Math.max(0,Math.min(100,W/G*100)):0,over:Number.isFinite(e)&&e>=100,label:t(Number.isFinite(e)?`budget`:`monthCost`)}},[v,y,W,G,t]),Re=v&&y>0?W/y*100:0,ze=(0,r.useMemo)(()=>{let e=[];for(let t=se-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push(On(n.getTime()))}return e},[se]),He=ze.at(-1)??H,X=(0,r.useMemo)(()=>Object.entries(F).map(([e,t])=>({date:e,value:t.cost})),[F]),qe=_n(F),Je=vn(F),Ye=(0,r.useMemo)(()=>ze.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:i.input+i.output+i.cacheHit+i.cacheMiss}}),[ze,F,e.byDayModels]),Xe=(0,r.useMemo)(()=>Object.entries(re).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=Ie(e),r=n.key===`other`,i=r?cn(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:Ue(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:An[t%An.length]??`#8b95a3`})),[re]),Z=(0,r.useMemo)(()=>O.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,O.hideUnidentified]),Qe=(0,r.useMemo)(()=>{let n=new Map;for(let t of Object.values(e.byDayModelsSite??{}))for(let[e,r]of Object.entries(t))for(let[t,i]of Object.entries(r)){let r=n.get(t);r===void 0&&(r=new Map,n.set(t,r));let a=r.get(e)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0};a.calls+=i.calls,a.input+=i.input,a.output+=i.output,a.cacheHit+=i.cacheHit,a.cacheMiss+=i.cacheMiss,a.cost+=i.cost,r.set(e,a)}let r=new Map;for(let[t,i]of n){let n=[...i.entries()].filter(([,e])=>e.calls>0).map(([t,n],r)=>{let i=Ie(t),a=i.key===`other`,o=a?cn(t)??i.provider:i.provider;return{key:t,name:a?t:i.name,provider:o,color:An[r%An.length]??`#8b95a3`,calls:n.calls,input:n.input,output:n.output,cacheHitRate:n.cacheHit+n.cacheMiss>0?n.cacheHit/(n.cacheHit+n.cacheMiss)*100:0,estimated:Ue(i,{input:n.input,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,output:n.output}),plan:e.byModel?.[t]?.plan===!0,...n.cost>0?{actual:n.cost}:{},uncatalogued:a,estimatedPricing:i.estimated===!0,officialCalls:0,officialCost:0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));n.length>0&&r.set(t,n)}let i=e=>Kt(e,z)??t(`channelUnknown`),a=new Map;for(let[e,t]of r){let n=i(e),r=a.get(n);r===void 0?a.set(n,[...t]):(r.push(...t),r.sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)))}let o=new Map,s=new Map;for(let e of f){if(e.status===`not-configured`)continue;let t=e.displayName??un(e.provider),n=i(`direct:${e.provider}`),r=a.has(t)?t:a.has(n)?n:void 0,c=r??`sub:${un(e.provider)}`;s.set(c,r??un(e.provider));let l=o.get(c);l===void 0?o.set(c,[e]):l.push(e)}let u=e=>e===i(`direct:deepseek`)||e===i(`site:https://api.deepseek.com`)?Oe(`deepseek`)??Oe(e):Oe(e),d=[];for(let[e,t]of a)d.push({name:e,models:t,subscriptions:o.get(e)??[],balance:u(e),dot:xn(c,t[0]?.provider??``)});for(let[e,t]of s)a.has(e)||d.push({name:t,models:[],subscriptions:o.get(e)??[],balance:Oe(t),dot:xn(c,t)});let p=new Set(d.flatMap(e=>[$(e.name),...e.balance===void 0?[]:[$(e.balance.provider)]]));for(let e of l)p.has($(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&d.push({name:e.displayName,models:[],subscriptions:[],balance:e,dot:xn(c,e.displayName)});return d.sort((e,t)=>{let n=Bn(t)-Bn(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,f,l,c,z,t]),$e=(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`actual`)})]})}),et=e=>{let n=e.color??(e.colorVar===void 0?void 0:Ve(e.colorVar));return(0,o.jsxs)(`span`,{className:P.modelCell,children:[(0,o.jsx)(Kn,{provider:e.provider,...n===void 0?{}:{colorVar:n}}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:P.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:P.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:P.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:P.modelProvider,children:B(e.provider)})]})]})},tt=Xe.reduce((e,t)=>e+t.estimated,0),nt=N.cost>0?N.cost:tt,it=N.calls>0?nt/N.calls:0,at=(0,r.useMemo)(()=>Xe.map(e=>({key:e.key,name:e.name,color:e.color})),[Xe]),st=Ye.length>=2?Ye.at(-2)?.cost??0:0,ct=st>0?(U-st)/st*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:d(P.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:P.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:P.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:P.headTitleRow,children:[(0,o.jsx)(`h2`,{className:P.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:P.dashboardSubtitle,children:[t(`lastUpdated`),` `,He,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:P.dashboardRight,children:[(0,o.jsx)(`span`,{className:P.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.currencyButton,m===e&&P.currencyButtonActive),"aria-pressed":m===e,"data-testid":`billing-currency-${e}`,title:t(e===`cny`?`currencyCny`:`currencyUsd`),onClick:()=>{h(e)},children:e===`cny`?`¥ CNY`:`$ USD`},e))}),c.checked&&(0,o.jsxs)(`span`,{className:d(P.healthBadge,c.available?P.healthBadgeOk:P.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:d(P.healthDot,c.available?P.healthOk:P.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:P.closeButton,"aria-label":t(`close`),"data-testid":`billing-close`,onClick:n,children:(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M18 6 6 18`}),(0,o.jsx)(`path`,{d:`m6 6 12 12`})]})})]})]}),(0,o.jsx)(`nav`,{className:P.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:tn.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":ie===e.id,className:d(P.tabButton,ie===e.id&&P.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{oe(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:P.dashboardBody,children:[ie===`overview`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[u?.kind===`drift`&&u.spent!==void 0&&le!==de()&&(0,o.jsxs)(`div`,{className:P.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:P.reconcileIcon,"aria-hidden":`true`,children:(0,o.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,o.jsx)(`line`,{x1:`12`,y1:`10`,x2:`12`,y2:`16`}),(0,o.jsx)(`line`,{x1:`12`,y1:`7.5`,x2:`12.01`,y2:`7.5`})]})}),(0,o.jsx)(`span`,{className:P.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,u.provider??``).replace(`{spent}`,R(u.spent)).replace(`{today}`,R(u.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:P.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:fe,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:P.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:P.heroTop,children:[(0,o.jsxs)(`div`,{className:P.heroMain,children:[(0,o.jsx)(`span`,{className:P.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:P.heroReadout,children:[(0,o.jsx)(`span`,{className:P.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:P.heroValue,children:R(W).slice(1)})]}),(0,o.jsxs)(`span`,{className:P.heroMeta,children:[N.calls.toLocaleString(),` `,t(`calls`)]})]}),(0,o.jsxs)(`div`,{className:P.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`svg`,{className:P.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:P.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:d(P.heroGaugeArc,K.over&&P.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${K.pct/100*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:P.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:d(P.heroGaugePct,K.over&&P.heroGaugePctOver),children:[K.pct.toFixed(0),`%`]}),(0,o.jsx)(`span`,{className:P.heroGaugeLabel,children:K.label})]})]})]}),v&&y>0&&(0,o.jsxs)(`div`,{className:P.heroBudget,"data-testid":`billing-hero-budget`,children:[(0,o.jsx)(`span`,{className:P.heroBudgetLabel,children:t(`budget`)}),(0,o.jsx)(`div`,{className:P.heroBudgetTrack,role:`progressbar`,"aria-valuenow":Math.min(Re,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),children:(0,o.jsx)(`div`,{className:d(P.heroBudgetFill,Re>=100&&P.heroBudgetFillOver),style:{width:`${Math.min(Re,100)}%`}})}),(0,o.jsxs)(`span`,{className:P.heroBudgetValue,children:[R(W),` / `,R(y),` · `,Re.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:P.heroSide,children:[(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:P.heroSideValue,children:R(G)})]}),(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:P.heroSideValue,children:[R(U),(0,o.jsxs)(`span`,{className:d(P.delta,ct>=0?P.deltaUp:P.deltaDown),children:[ct>=0?`▲`:`▼`,` `,Math.abs(ct).toFixed(1),`%`]})]})]}),Fe>0&&(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:P.heroSideValue,children:R(Fe)})]}),Fe<=0&&(0,o.jsx)(`span`,{className:P.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:P.unpricedHint,"data-testid":`billing-unpriced-hint`,children:t(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0))}),(e.total.searchCalls??0)>0&&(0,o.jsx)(`div`,{className:P.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,R(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`section`,{className:P.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:d(P.kpiValue,P.kpiGreen),children:Ke(je)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[Y(N.cacheHit),` / `,Y(N.cacheHit+N.cacheMiss)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:Y(N.input+N.output)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[t(`inputTokens`),` `,Y(N.input),` · `,t(`outputTokens`),` `,Y(N.output)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:R(it)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[t(`calls`),` `,N.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:N.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[Xe.length,` `,t(`models`)]})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:P.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`year`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.heatmapRangeButton,pe===e&&P.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":pe===e,onClick:()=>{me(e)},children:t(e===`month`?`heatmapMonth`:`heatmapYear`)},e))}),(0,o.jsxs)(`span`,{className:P.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,qe,` · `,t(`streakDays`),` `,Je]})]}),(0,o.jsx)(wt,{days:X,currency:m,t,range:pe})]})]}),ie===`settings`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`budgetHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,"aria-label":t(`budget`),"data-testid":`billing-budget-toggle`,className:d(P.switch,v&&P.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:P.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:P.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:P.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:y===0?``:y,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,title:`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,onChange:e=>{ee(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=W/y*100;return(0,o.jsx)(`div`,{className:P.ctlRowStretch,children:(0,o.jsx)(`div`,{className:P.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,o.jsx)(`div`,{className:d(P.progFill,e>=100&&P.budgetFillOver,e>=80&&e<100&&P.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:P.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,R(W)).replace(`{total}`,R(y))})]})]}),(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":x.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:d(P.switch,x.enabled&&P.switchOn),onClick:()=>{S({...x,enabled:!x.enabled})},children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),x.enabled&&(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`label`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:P.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:x.leadMin,className:P.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);S({...x,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):x.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:P.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:x.position===e,onChange:()=>S({...x,position:e})}),(0,o.jsx)(`span`,{className:P.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:P.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:x.mode===e,onChange:()=>S({...x,mode:e})}),(0,o.jsx)(`span`,{className:P.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:x.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{S({...x,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:P.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:P.btn,onClick:C,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:P.setCard,"data-testid":`billing-toggle-setting`,children:(0,o.jsxs)(`div`,{className:P.setGrid3,children:[(0,o.jsx)(`div`,{className:P.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":be,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:d(P.switch,be&&P.switchOn),onClick:Ce,children:(0,o.jsx)(`span`,{className:P.switchKnob})})]})}),(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-livecost-setting`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`liveCostBar`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`liveCostBarHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":A.show,"aria-label":t(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:d(P.switch,A.show&&P.switchOn),onClick:()=>te({...A,show:!A.show}),children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),A.show&&(0,o.jsxs)(`div`,{className:P.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,o.jsx)(`span`,{className:P.rdoLabel,children:t(`liveCostBarPosition`)}),(0,o.jsx)(Jn,{liveCostPrefs:A,onLiveCostPrefs:te,t})]})]}),(0,o.jsx)(`div`,{className:P.setCell,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`siteListDisplayHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":O.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:d(P.switch,O.hideUnidentified&&P.switchOn),onClick:()=>k({hideUnidentified:!O.hideUnidentified}),children:(0,o.jsx)(`span`,{className:P.switchKnob})})]})})]})}),(0,o.jsx)(`section`,{className:P.setCard,"data-testid":`billing-display-setting`,children:(0,o.jsxs)(`div`,{className:P.setGrid2,children:[(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,w.mode===`combined`&&P.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>T({mode:`combined`,targets:w.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,w.mode===`subscription`&&P.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>T({mode:`subscription`,targets:w.targets}),children:t(`floatModeSubscription`)})]})]}),w.mode===`subscription`&&(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:P.ctlGroup,"data-testid":`billing-float-targets`,children:[he.map(e=>{let t=w.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:P.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>T({mode:`subscription`,targets:t?w.targets.filter(t=>t!==e.id):[...w.targets,e.id]})}),(0,o.jsx)(`span`,{className:P.floatTargetLabel,children:e.label})]},e.id)}),he.length===0&&(0,o.jsx)(`span`,{className:P.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsx)(`div`,{className:P.ctlCol,children:(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,E.metric===`money`&&P.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>D({metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,E.metric===`tokens`&&P.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>D({metric:`tokens`}),children:t(`cardMetricTokens`)})]})]})})]})]})}),(0,o.jsx)(Wn,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(ot,{t,version:e.pluginVersion})]}),ie===`trends`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:d(P.ubCard,P.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:P.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,se===e&&P.rangeButtonActive),"aria-pressed":se===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{ce(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,M===e&&P.rangeButtonActive),"aria-pressed":M===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{ne(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:He})]}),(0,o.jsx)(Ze,{data:Ye,models:at,currency:m,metric:M})]}),g.length>0&&(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`rounds`)}),we.length>0&&(0,o.jsxs)(`span`,{className:P.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[we.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:P.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(vt,{rounds:g,flags:we,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=Te.peak+Te.offPeak;if(e<=0)return null;let n=Te.peak/e*100;return(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:P.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:d(P.shareSeg,P.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:d(P.shareSeg,P.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:P.shareLegend,children:[(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:P.shareDot,style:{background:`var(--dsw-static-blue-500)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:P.shareValue,"data-testid":`billing-share-peak`,children:[R(Te.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:P.shareDot,style:{background:`color-mix(in srgb, var(--dsw-static-blue-500) 30%, var(--dsw-alias-bg-module-platform))`}}),t(`offPeak`),(0,o.jsxs)(`span`,{className:P.shareValue,"data-testid":`billing-share-offpeak`,children:[R(Te.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),Ee>0&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,R(Ee))})]})})()]}),ie===`providers`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[Z.length>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:P.providerGroupList,"data-testid":`billing-relay-quotas`,children:Z.map(e=>(0,o.jsxs)(`div`,{className:P.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:P.siteRowName,children:[(0,o.jsx)(`span`,{className:d(P.siteKindTag,En[e.kind]),children:Tn(e.kind,t)}),(0,o.jsx)(`span`,{className:P.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:P.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:P.siteRowCost,children:[t(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let n=e.remainingPercent<20;return(0,o.jsxs)(`span`,{className:d(P.siteRowCalls,n&&P.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:P.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:P.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${kn(e.updatedAt)}`})]}),j&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),Qe.length===0?(0,o.jsx)(`div`,{className:P.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:P.providerGroupList,"data-testid":`billing-provider-groups`,children:Qe.map(e=>(0,o.jsxs)(`div`,{className:P.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:P.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:P.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:d(P.healthDot,e.dot),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.providerGroupName,children:B(e.name)})]}),(0,o.jsxs)(`span`,{className:P.providerGroupMeta,children:[(0,o.jsxs)(`span`,{className:P.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,o.jsx)(`span`,{className:P.providerGroupCostLabel,children:t(`cost`)}),(0,o.jsx)(`span`,{className:P.providerGroupCostValue,children:R(Bn(e))})]}),e.subscriptions.length>0?(0,o.jsxs)(`span`,{className:P.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` 套餐`]}):(0,o.jsx)(`span`,{className:P.providerGroupBadge,"aria-hidden":`true`}),!ke(e)&&e.balance!==void 0?(0,o.jsxs)(`span`,{className:P.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:P.providerGroupBalanceLabel,children:t(`balance`)}),Ae(e.balance)]}):(0,o.jsx)(`span`,{className:P.providerGroupBalance,"aria-hidden":`true`})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:d(P.tableScroll,P.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:P.modelTable,children:[$e,(0,o.jsx)(`tbody`,{children:e.models.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:et(e)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:Y(e.input)}),(0,o.jsx)(`td`,{className:P.numCol,children:Y(e.output)}),(0,o.jsx)(`td`,{className:P.numCol,children:Ke(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.plan?(0,o.jsxs)(`span`,{className:P.planTag,children:[t(`subscriptionIncluded`),e.estimated>0?` ≈${R(e.estimated)}`:``]}):e.actual===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:P.bucketCost,children:[(0,o.jsx)(`span`,{className:P.bucketOfficial,children:R(t)}),(0,o.jsx)(`span`,{className:P.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:P.bucketThird,children:R(n)})]}):R(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:P.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=Cn(e.status,t);return(0,o.jsxs)(`div`,{className:P.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:P.subscriptionHead,children:[(0,o.jsx)(`span`,{className:P.subscriptionName,children:B(e.displayName)}),e.planType===`code`&&(()=>{let n=ae(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,o.jsxs)(`span`,{className:P.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,R(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:P.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:P.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:P.subscriptionStatus,children:t(`subscriptionNoApi`)}),e.windows.map(e=>(()=>{let n=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:P.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:P.subscriptionWindowLabel,children:wn(e.kind,t)}),(0,o.jsx)(`span`,{className:P.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(P.subscriptionFill,n>=100&&P.subscriptionFillOver,n>=80&&n<100&&P.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:P.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(P.subscriptionPct,r&&P.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${On(new Date(e.resetsAt).getTime())} ${kn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:P.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:P.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-day`,onClick:()=>{Lt(It(`usage-daily`,`csv`,Object.keys(F)),Mt(F),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{Lt(It(`usage-sessions`,`csv`,Object.keys(F)),Ft(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{Lt(It(`usage-sites`,`csv`,Object.keys(F)),Nt(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-json`,onClick:()=>{Lt(It(`usage-stats`,`json`,Object.keys(F)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:e.bySession.length>20?t(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(e.bySession.length)):`${e.bySession.length}`})]}),(e.staleLedgerSessions??0)>0&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:P.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:P.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`sessionTitle`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`lastActive`)})]})}),(0,o.jsxs)(`tbody`,{children:[Sn(e.bySession??[]).length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:4,className:P.emptyRow,children:t(`noData`)})}),Sn(e.bySession??[]).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&ve.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:R(e.cost)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.lastActive>0?`${On(e.lastActive)} ${kn(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?P.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{ye(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:P.modelName,children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.stale===!0&&(0,o.jsx)(`span`,{className:d(P.ubTag,P.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:P.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),ie===`token`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(pt,{stats:e,trendDays:se,onTrendDays:ce,models:at,money:R,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:P.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(rt,{perf:e.perf,models:at,t})]})]}),ie===`pricing`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:P.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:P.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:P.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,J(L.rate)]}),(0,o.jsx)(`span`,{className:d(P.ubTag,L.live?P.ubTagSuccess:P.ubTagNeutral),children:L.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:P.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:P.ubTablewrap,children:(0,o.jsxs)(`table`,{className:P.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:Be().map(e=>{let n=e.price.input>0||e.price.output>0;return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:P.ubModel,children:[(0,o.jsx)(Kn,{provider:e.provider,colorVar:Ve(e.colorVar)}),(0,o.jsxs)(`span`,{className:P.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:P.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Le(e.promo,Date.now())&&(0,o.jsx)(`span`,{className:P.ubTagPromo,"data-testid":`billing-price-promo`,title:e.promo.endsAtMs===void 0?t(`promoOpenEnded`):t(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()}),children:e.promo.note??t(`promoBadge`)})]})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?V(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?V(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?V(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(`span`,{className:P.ubPricepair,children:[(0,o.jsxs)(`span`,{className:P.ubChipPeak,children:[(0,o.jsx)(`span`,{className:P.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:P.num,children:[V(e.price.input,e.price.currency),` / `,V(e.price.output,e.price.currency)]})]}),(0,o.jsxs)(`span`,{className:P.ubChipOff,children:[(0,o.jsx)(`span`,{className:P.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:P.num,children:[V(e.price.offPeak.input,e.price.currency),` / `,V(e.price.offPeak.output,e.price.currency)]})]})]}):n?(0,o.jsx)(`span`,{className:P.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:P.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:P.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:P.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:P.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:P.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):V(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):V(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsx)(`span`,{className:P.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:P.ubCard,children:[(0,o.jsx)(`div`,{className:P.ubCardHead,children:(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:P.ubNotes,children:[(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:P.modalFooter,"data-testid":`billing-footer`,children:[(0,o.jsx)(`span`,{children:t(`footer`)}),(0,o.jsx)(`span`,{children:t(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]})})}function Kn({provider:e,colorVar:t}){let n=Jt(e);return n===void 0?(0,o.jsx)(`span`,{className:P.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()}):(0,o.jsx)(`img`,{className:P.vendorLogo,src:n,alt:``,"aria-hidden":`true`})}let qn=[`below`,`above`,`toolbar`];function Jn({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[i,s]=(0,r.useState)(!1),c={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)},l=qn.map(e=>({id:e,label:c[e]}));return(0,o.jsx)(a.Menu,{open:i,align:`end`,portal:!0,compact:!0,items:l,selectedId:e.position,onSelect:n=>{s(!1);let r=qn.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{s(!1)},anchor:(0,o.jsxs)(`button`,{type:`button`,className:P.rdoSelect,"data-testid":`billing-livecost-position-select`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{s(!i)},children:[(0,o.jsx)(`span`,{children:c[e.position]}),(0,o.jsx)(`span`,{className:d(P.rdoChevron,i&&P.rdoChevronOpen),"aria-hidden":!0,children:(0,o.jsx)(a.IconChevronDownOutline14,{})})]})})}function Yn(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(jn),[f,p]=(0,r.useState)(rn),[g,_]=(0,r.useState)([]),[b,ee]=(0,r.useState)(void 0),[C,w]=(0,r.useState)([]),[O,te]=(0,r.useState)(!1),[j,M]=(0,r.useState)([]),[ne,N]=(0,r.useState)(`cny`),[P,re]=(0,r.useState)(()=>m()),F=(0,r.useCallback)(e=>{re(e),h(e)},[]),[ie,ae]=(0,r.useState)(()=>x()),oe=(0,r.useCallback)(e=>{ae(e),S(e)},[]),[se,ce]=(0,r.useState)(()=>E()),le=(0,r.useCallback)(e=>{ce(e),D(e),window.dispatchEvent(new CustomEvent(T))},[]),[ue,de]=(0,r.useState)(()=>v()),fe=(0,r.useCallback)(e=>{de(e),y(e)},[]),[pe,he]=(0,r.useState)(()=>{let e=k();return me(e),e}),ge=(0,r.useCallback)(e=>{he(e),me(e),A(e)},[]),_e=(0,r.useMemo)(()=>pn(u),[u,pe]),ve=ne===`usd`?`en`:`zh`,I=(0,r.useCallback)((e,n)=>{let r=(ve===`en`?Bt:zt)[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},[ve,t]),[ye,xe]=(0,r.useState)(!1),Ce=(0,r.useCallback)(()=>{xe(!1)},[]),L=(0,r.useCallback)(()=>{Mn().then(e=>{e!==null&&d(pn(e))}),Fn().then(({balances:e,reconcile:t})=>{e.length>0&&_(e),ee(t)}),In().then(e=>{e.length>0&&w(e),te(!1)}).catch(()=>{te(!0)}),Ln().then(e=>{M(e)}).catch(()=>{})},[]),R=(0,r.useCallback)(()=>{L(),Pn(),xe(!0)},[L]);(0,r.useEffect)(()=>{L(),Pn()},[L]),(0,r.useEffect)(()=>{let e=setInterval(()=>{L(),Pn()},Dn);return()=>{clearInterval(e)}},[L]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(p(t),be(t.catalog??[]))}),()=>{e=!1}},[n]);let z=On(),B=Object.entries(u.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),we=u.byDay[z]?.cost??0,Te=bn(u.byDay,z),Ee=(0,r.useMemo)(()=>yn(u.byDay).map(e=>{let t=u.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:t.input+t.output}}),[u.byDay]),De=Object.entries(u.byDay).filter(([e])=>e.startsWith(z.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Oe=(()=>{let e=u.byDay[z];return e===void 0?0:e.input+e.output})(),ke=bn(u.byDay,z,e=>e.input+e.output),Ae=c(e=>e.enabled),je=c(e=>e.amount),Me=c(e=>e.tierAlertDays),H=c(e=>e.lastTierSwitchAt),[U,Ne]=(0,r.useState)(()=>Zt()),[Pe,W]=(0,r.useState)(null),[G,Fe]=(0,r.useState)(null),[K,Le]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>Le(Date.now()),Dn);return()=>{clearInterval(e)}},[]);let Re=(0,r.useCallback)(e=>{Ne(e),Qt(e)},[]),ze=(0,r.useCallback)(()=>{Fe({entering:V(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4})},[]),Be=je>0?je:u.budget??0,Ve=(0,r.useCallback)(()=>{let e=!Ae;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,Ae]);(0,r.useEffect)(()=>{if(!Ae||Be<=0)return;let e=B/Be*100,t=nn.filter(t=>e>=t&&Me?.[String(t)]!==z);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,z),!mn())return;let r=I(`budgetTierBody`).replace(`{cost}`,J(B)).replace(`{budget}`,J(Be)).replace(`{pct}`,String(n));gn(`budget:${n}:${z}`,()=>{new Notification(I(`budget`),{body:r})})},[Ae,Be,B,Me,z,l,I]),(0,r.useEffect)(()=>{let e=$t(K,U,H);if(e===null||(l.markTierSwitchAlerted(e.atMs),W(e),!U.webNotify||!mn()))return;let t=Math.max(1,Math.round((e.atMs-K)/6e4)),n=I(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=I(e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));gn(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[K,H,U,l,I]);let He=c(e=>e.lastBalanceAlertDay),Ue=u.lowBalanceThreshold??50,q=(0,r.useMemo)(()=>{if(g.length===0)return;let e=dn(u.byDay,z),t=Se().rate;for(let n of g){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=Ue)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[g,u.lowBalanceThreshold,u.byDay,z]);(0,r.useEffect)(()=>{if(q===void 0||He===z||(l.markBalanceAlerted(z),!mn()))return;let e=I(`balanceLowBody`).replace(`{name}`,q.name).replace(`{balance}`,J(q.cny)).replace(`{days}`,q.days===void 0?`—`:String(q.days));gn(`balance:${z}`,()=>{new Notification(I(`balance`),{body:e})})},[q,He,z,l,I]);let We=(0,r.useMemo)(()=>{let e=z.slice(0,7),t=new Map;for(let[n,r]of Object.entries(u.byDayModels??{}))if(n.startsWith(e))for(let[e,n]of Object.entries(r)){if(n.cost<=0)continue;let r=Ie(e).provider,i=u.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=g.find(t=>$(t.provider)===$(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=g.filter(e=>e.totalBalance!==void 0&&e.error===void 0),t=e[0];return t!==void 0&&e.length===1?i(t.provider):void 0}return{text:t?.error===`unauthorized`?I(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?I(`balanceUnreachable`):I(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:J(t.totalBalance),r=Se().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<Ue}},a=e=>{let t=C.find(t=>t.displayName===e||un(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:I(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?I(`subscriptionExhausted`):I(`subscriptionRemaining`).replace(`{pct}`,String(n)),low:n<20}},o=n===void 0?void 0:i(n[0]);return{direct:n===void 0||o===void 0?void 0:{name:n[0],...o},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[u.byDayModels,u.byModel,u.lowBalanceThreshold,g,C,z]),Ge=(0,r.useMemo)(()=>{let e=u.total;return{totalToken:e.input+e.output,input:e.input,output:e.output,cacheRead:e.cacheHit,calls:e.calls}},[u]);(0,r.useEffect)(()=>{i({todayCost:we,monthCost:B})},[we,B,i]),(0,r.useEffect)(()=>a(R),[a,R]);let Y=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Vn,{...e,t:I,onOpen:R,monthCost:B,todayCost:we,weekCost:Te,days:Ee,vendorStatus:We,dash:Ge,cardPrefs:ue,monthTokens:De,todayTokens:Oe,weekTokens:ke,floatPrefs:P,subscriptions:C}),ye&&(0,o.jsx)(Gn,{stats:_e,t:I,onClose:Ce,userPrices:pe,onUserPrices:ge,health:f,balances:g,...b===void 0?{}:{reconcile:b},quotas:C,relayQuotas:j,currency:ne,onCurrency:N,turns:Y,renderSlot:s,budgetEnabled:Ae,budgetAmount:Be,onToggleBudget:Ve,onBudgetAmount:l.setAmount,peakConfig:U,onPeakConfig:Re,onPreviewPeak:ze,floatPrefs:P,onFloatPrefs:F,cardPrefs:ue,onCardPrefs:fe,sitePrefs:ie,onSitePrefs:oe,liveCostPrefs:se,onLiveCostPrefs:le,quotasStale:O}),(Pe!==null||G!==null)&&(0,o.jsx)(en,{hit:Pe??G,config:U,t:I,onDismiss:()=>{W(null),Fe(null)}})]})}function Xn(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function Zn(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 Qn(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)}async function $n(){try{let e=await fetch(`/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 er(){try{let e=await fetch(`/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 tr(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function nr(){let[e,t]=(0,r.useState)(()=>E().show),[n,i]=(0,r.useState)(()=>E().position);return(0,r.useEffect)(()=>{let e=()=>{t(E().show),i(E().position)};return window.addEventListener(T,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(T,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function rr(e){let[t,n]=(0,r.useState)(null),[i,a]=(0,r.useState)([]),[o,s]=(0,r.useState)(()=>Date.now());return(0,r.useEffect)(()=>{let e=!1,t=()=>{$n().then(t=>{!e&&t!==null&&n(t)}),er().then(t=>{e||a(t)}),e||s(Date.now())};t();let r=setInterval(t,3e4);return()=>{e=!0,clearInterval(r)}},[e]),{sessionCost:(0,r.useMemo)(()=>Xn(t,e),[t,e]),turnCost:(0,r.useMemo)(()=>Zn(t,e),[t,e]),tier:De(o),chips:(0,r.useMemo)(()=>Qn(i),[i])}}function ir({sessionId:e,t}){let{visible:n,position:r}=nr(),{sessionCost:i,turnCost:a,tier:s,chips:c}=rr(e),l=e=>J(e,`cny`),u=i>0||a>0,f=s.tier===`peak`;return!n||r===`toolbar`?null:(0,o.jsxs)(`span`,{className:r===`above`?d(P.feeBar,P.feeBarAbove):P.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:f?P.feeChipPrimary:P.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:P.feeCount,children:ke(s.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:P.feeSuffix,children:t(f?`tierToOff`:`tierToPeak`)}),u&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:P.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:P.feeNum,children:l(a)})]}),(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:P.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:P.feeNum,children:l(i)})]})]}),c.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?P.feeChipError:P.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(tr(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function ar({sessionId:e,t}){let{visible:n,position:r}=nr(),{sessionCost:i,turnCost:s,tier:c,chips:l}=rr(e);if(!n||r!==`toolbar`)return null;let u=c.tier===`peak`,d=l.reduce((e,t)=>Math.min(e,t.pct),100),f=d<=10?P.feeInlineError:d<=20?P.feeInlineAlert:P.feeInline,p=[`${ke(c.nextSwitchInMs)} ${t(u?`tierToOff`:`tierToPeak`)}`,`${t(`liveTurn`)} ${J(s,`cny`)}`,`${t(`liveSession`)} ${J(i,`cny`)}`,...l.map(e=>`${e.name} ${t(tr(e.kind))} ${e.pct}%`)].join(` · `);return(0,o.jsx)(a.Tooltip,{label:p,side:`top`,delayMs:500,children:(0,o.jsxs)(`span`,{className:f,"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":p,children:[(0,o.jsx)(`span`,{className:u?P.feeChipPrimary:P.feeChipOff,"data-testid":`billing-live-tier`,children:t(u?`tierPeak`:`tierOff`)}),i>0&&(0,o.jsx)(`span`,{className:P.feeInlineNum,children:J(i,`cny`)})]})})}function or(){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{}},registerOpen:e=>(t=e,()=>{t===e&&(t=void 0)})}}function sr(){return(0,s.defineStore)({init:()=>({enabled:!1,amount:0,tierAlertDays:{},lastBalanceAlertDay:``,lastTierSwitchAt:0}),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}}})}let cr={enabled:!1,timeout:0};function lr(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...cr};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...cr}}}function ur(e){return e.completed===!0||e.running===!1}function dr(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)),ur(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{}},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=ur(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)}}let fr=[`slots`,`locale`,`remote`,`sessions`];function pr(e){let t=or();e.provide(`billingMetrics`,t);let n=sr();e.effect(()=>e.locale.register(Rt,{zh:zt,en:Bt}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:Rt,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)})},Yn)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:Rt,inject:e=>({sessionId:l(e)})},ir)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:Rt,inject:e=>({sessionId:l(e)})},ar)),e.effect(()=>dr(e.sessions.list,lr),`ui-usage-billing: completion notifier`)}return n.UsageBilling=Yn,n.apply=pr,n.inject=fr,t.exports}});
|
|
6
6
|
//# sourceMappingURL=client.js.map
|