@kenz1117/dsh-ui-usage-billing 1.1.15 → 1.1.17
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-runtime/client");function c(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=c(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function l(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=c(e))&&(r&&(r+=` `),r+=t);return r}let u={mode:`combined`,targets:[]},d=`dsh.ui-usage-billing.float`;function f(){try{let e=localStorage.getItem(d);if(e===null)return{...u,targets:[...u.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{...u,targets:[...u.targets]}}}function p(e){try{localStorage.setItem(d,JSON.stringify(e))}catch{}}let m={metric:`money`},h=`dsh.ui-usage-billing.card`;function g(){try{let e=localStorage.getItem(h);return e===null?{...m}:{metric:JSON.parse(e).metric===`tokens`?`tokens`:`money`}}catch{return{...m}}}function _(e){try{localStorage.setItem(h,JSON.stringify(e))}catch{}}let v={hideUnidentified:!0},y=`dsh.ui-usage-billing.sites`;function b(){try{let e=localStorage.getItem(y);return e===null?{...v}:{hideUnidentified:JSON.parse(e).hideUnidentified!==!1}}catch{return{...v}}}function x(e){try{localStorage.setItem(y,JSON.stringify(e))}catch{}}let S=`dsh.ui-usage-billing.prices`;function C(){try{let e=localStorage.getItem(S);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);[i,a,o].every(e=>Number.isFinite(e)&&e>=0)&&n.push({key:e,...typeof r.origin==`string`&&r.origin!==``?{origin:r.origin}:{},input:i,cacheHit:a,output:o,...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 w(e){try{localStorage.setItem(S,JSON.stringify(e))}catch{}}let T=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(T)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=T,e.textContent=`.BAyRca_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}.BAyRca_railButton:hover,.BAyRca_railButton:focus-visible{border-color:var(--dsw-static-blue-500);color:var(--dsw-static-blue-500);outline:none}.BAyRca_railButton svg{stroke-width:2px;width:18px;height:18px}.BAyRca_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}.BAyRca_trigger:hover,.BAyRca_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)}.BAyRca_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}.BAyRca_triggerIcon svg{stroke-width:2px;width:16px;height:16px}.BAyRca_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.BAyRca_triggerPrimary{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.BAyRca_triggerLabel{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.BAyRca_triggerYen{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.BAyRca_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}.BAyRca_triggerSub{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;font-size:10px;line-height:14px;overflow:hidden}.BAyRca_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.BAyRca_triggerSparkBar,.BAyRca_triggerSparkHot{background:var(--dsw-static-blue-500);opacity:.6;border-radius:1px 1px 0 0;width:3px}.BAyRca_triggerSparkHot{opacity:1}.BAyRca_triggerWrap{flex:180px;min-width:96px;max-width:100%;display:block;position:relative;container:BAyRca_billing-trigger/inline-size}@container BAyRca_billing-trigger (width<=200px){.BAyRca_trigger{gap:6px;padding:8px 10px}.BAyRca_triggerSpark{display:none}}@container BAyRca_billing-trigger (width<=170px){.BAyRca_triggerSub,.BAyRca_triggerLabel{display:none}}@container BAyRca_billing-trigger (width<=110px){.BAyRca_triggerIcon,.BAyRca_triggerSpark,.BAyRca_triggerSub,.BAyRca_triggerLabel{display:none}.BAyRca_trigger{justify-content:center;padding:8px 6px}}.BAyRca_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-2) 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%))}.BAyRca_triggerPop,.BAyRca_triggerPop *{box-sizing:border-box}.BAyRca_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 BAyRca_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}.BAyRca_triggerPopShown{opacity:1;visibility:visible;transition:opacity .16s,transform .16s,visibility linear;transform:translateY(-100%)}.BAyRca_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.BAyRca_popTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:700;line-height:18px}.BAyRca_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 8px;display:grid}.BAyRca_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.BAyRca_metricLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.BAyRca_metricValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:12px;font-weight:700;line-height:16px}.BAyRca_metricValuePrimary{color:var(--dsw-static-amber-500)}.BAyRca_metricValueSuccess{color:var(--dsw-static-green-500)}.BAyRca_popModel{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding-top:10px;display:flex}.BAyRca_popModelLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.BAyRca_popModelRow{align-items:center;gap:8px;min-width:0;display:flex}.BAyRca_popDot{border-radius:999px;flex:none;width:6px;height:6px}.BAyRca_popDotDirect{background:var(--dsw-static-green-500)}.BAyRca_popDotSub{background:var(--dsw-static-amber-500)}.BAyRca_popDotNeutral{background:var(--dsw-alias-label-tertiary)}.BAyRca_popTagPrimary,.BAyRca_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}.BAyRca_popTagPrimary{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.BAyRca_popTagSub{background:color-mix(in srgb, var(--dsw-static-amber-500) 18%, transparent);color:var(--dsw-static-amber-500)}.BAyRca_popModelName{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.BAyRca_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}.BAyRca_popModelStatusLow{color:var(--dsw-static-red-500)}.BAyRca_dashboardModal{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:16px;width:min(760px,100vw - 48px);max-height:min(760px,88vh);animation:.18s ease-out BAyRca_dashboardIn;box-shadow:0 12px 32px -12px #0000002e,0 2px 8px #0000000f}@keyframes BAyRca_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)}.BAyRca_dashboard{flex-direction:column;width:100%;max-height:min(760px,88vh);display:flex}.BAyRca_dashboardHead{border-bottom:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.BAyRca_dashboardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.BAyRca_dashboardSubtitle{color:var(--dsw-alias-label-caption);margin:2px 0 0;font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_closeButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.BAyRca_closeButton svg{stroke-width:2px;width:16px;height:16px}.BAyRca_dashboardBody{flex-direction:column;gap:14px;padding:16px 24px 24px;display:flex;overflow-y:auto}.BAyRca_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:12px 24px;font-size:11px;line-height:16px;display:flex}.BAyRca_tabNav{border-bottom:1px solid var(--dsw-alias-border-l1);align-items:center;gap:4px;padding:0 24px;display:flex}.BAyRca_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}.BAyRca_tabButton:hover,.BAyRca_tabButton:focus-visible{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 62%, transparent);outline:none}.BAyRca_tabButtonActive,.BAyRca_tabButtonActive:hover,.BAyRca_tabButtonActive:focus-visible{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font-weight:600}.BAyRca_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out BAyRca_tabPanelIn;display:flex}@keyframes BAyRca_tabPanelIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.BAyRca_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}.BAyRca_reconcileIcon{color:var(--dsw-alias-label-tertiary);flex:none;margin-top:1px;display:inline-flex}.BAyRca_reconcileText{flex:1}.BAyRca_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}.BAyRca_reconcileDismiss:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.BAyRca_hero{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;gap:18px;padding:24px;display:flex;position:relative;overflow:hidden}.BAyRca_heroTop{justify-content:space-between;align-items:center;gap:24px;display:flex}.BAyRca_heroMain{flex-direction:column;gap:2px;min-width:0;display:flex}.BAyRca_heroLabel{color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-size:11px;line-height:16px}.BAyRca_heroReadout{align-items:baseline;gap:4px;display:flex}.BAyRca_heroCurrency{letter-spacing:-.01em;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:22px;font-weight:600;line-height:28px}.BAyRca_heroValue{letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:40px;font-weight:700;line-height:48px}.BAyRca_heroMeta{color:var(--dsw-alias-label-caption);white-space:nowrap;margin-top:2px;font-size:11px;line-height:15px}.BAyRca_heroGauge{flex:none;width:96px;height:96px;position:relative}.BAyRca_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.BAyRca_heroGaugeTrack{fill:none;stroke:var(--dsw-alias-bg-module-platform);stroke-width:7px}.BAyRca_heroGaugeArc{fill:none;stroke:var(--dsw-static-blue-500);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray .26s}.BAyRca_heroGaugeArcOver{stroke:var(--dsw-static-red-500)}.BAyRca_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.BAyRca_heroGaugePct{letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:700;line-height:18px}.BAyRca_heroGaugePctOver{color:var(--dsw-static-red-500)}.BAyRca_heroGaugeLabel{color:var(--dsw-alias-label-tertiary);font-size:9px;line-height:12px}.BAyRca_heroBudget{border-top:1px solid var(--dsw-alias-border-l1);align-items:center;gap:14px;padding-top:14px;display:flex}.BAyRca_heroBudgetLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px;line-height:16px}.BAyRca_heroBudgetTrack{background:var(--dsw-alias-border-l1);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.BAyRca_heroBudgetFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .22s}.BAyRca_heroBudgetFillOver{background:var(--dsw-static-red-500)}.BAyRca_heroBudgetValue{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:11px;line-height:16px}.BAyRca_heroSide{border-top:1px solid var(--dsw-alias-border-l1);align-items:stretch;padding-top:14px;display:flex}.BAyRca_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}.BAyRca_heroSideItem:first-child{border-left:none;padding-left:0}.BAyRca_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}.BAyRca_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}.BAyRca_heroSideSpacer{flex:1;display:block}.BAyRca_delta{align-items:center;gap:2px;margin-left:4px;font-size:11px;font-weight:600;line-height:17px;display:inline-flex}.BAyRca_deltaUp{color:var(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 12%, transparent)}.BAyRca_deltaDown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 12%, transparent)}.BAyRca_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}.BAyRca_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.BAyRca_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}.BAyRca_kpiTile:hover{border-color:var(--dsw-alias-border-l2)}.BAyRca_kpiLabel{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;font-size:10px;font-weight:500;line-height:13px}.BAyRca_kpiValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;letter-spacing:-.01em;font-size:24px;font-weight:600;line-height:32px}.BAyRca_kpiGreen{color:var(--dsw-static-green-500)}.BAyRca_kpiDetail{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;font-size:10.5px;line-height:14px;overflow:hidden}.BAyRca_panel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;gap:10px;padding:16px 18px;transition:border-color .16s;display:flex}.BAyRca_panelHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.BAyRca_panelTitle{letter-spacing:-.005em;color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.BAyRca_panelHint{color:var(--dsw-alias-label-caption);white-space:nowrap;font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_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}.BAyRca_rangeButtonActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font-weight:600}.BAyRca_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.BAyRca_exportLabel{color:var(--dsw-alias-label-caption);font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_exportButton:hover,.BAyRca_exportButton:focus-visible{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);outline:none}.BAyRca_shareTrack{background:var(--dsw-alias-bg-module-platform);border-radius:999px;height:10px;display:flex;overflow:hidden}.BAyRca_shareSeg{height:100%;transition:width .2s}.BAyRca_shareSegPeak{background:var(--dsw-static-blue-500)}.BAyRca_shareSegOff{background:color-mix(in srgb, var(--dsw-static-blue-500) 25%, var(--dsw-alias-bg-module-platform))}.BAyRca_shareSegUser{background:var(--dsw-static-blue-500)}.BAyRca_shareSegAssistant{background:var(--dsw-static-green-500)}.BAyRca_shareSegTool{background:var(--dsw-static-amber-500)}.BAyRca_shareLegend{align-items:center;gap:16px;display:flex}.BAyRca_shareItem{color:var(--dsw-alias-label-secondary);align-items:baseline;gap:6px;font-size:12px;line-height:17px;display:inline-flex}.BAyRca_bucketCost{align-items:baseline;gap:3px;display:inline-flex}.BAyRca_bucketOfficial{color:var(--dsw-static-blue-500);font-weight:600}.BAyRca_bucketSep{color:var(--dsw-alias-label-dimmed)}.BAyRca_bucketThird{color:var(--dsw-alias-label-secondary)}.BAyRca_shareDot{border-radius:50%;flex:none;align-self:center;width:8px;height:8px}.BAyRca_shareValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.BAyRca_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}.BAyRca_budgetInput:focus-visible{outline:none}.BAyRca_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}.BAyRca_switchOn{border-color:var(--dsw-alias-border-l1);background:var(--dsw-alias-label-primary)}.BAyRca_switchKnob{background:var(--dsw-static-neutral-bluish-00);border-radius:50%;width:11px;height:11px;transition:transform .16s;position:absolute;top:2px;left:2px}.BAyRca_switchOn .BAyRca_switchKnob{transform:translate(13px)}.BAyRca_budgetFillWarn{background:var(--dsw-static-amber-500)}.BAyRca_budgetFillOver{background:var(--dsw-static-red-500);animation:1.6s ease-in-out infinite BAyRca_budgetOverPulse}@keyframes BAyRca_budgetOverPulse{50%{opacity:.55}}.BAyRca_chartWrap{width:100%;position:relative}.BAyRca_chartSvg{width:100%;height:auto;display:block}.BAyRca_chartEmpty{height:140px;color:var(--dsw-alias-label-caption);justify-content:center;align-items:center;font-size:13px;display:flex}.BAyRca_emptyRow{text-align:center;color:var(--dsw-alias-label-caption);padding:28px 0;font-size:13px}.BAyRca_chartGrid{stroke:var(--dsw-alias-border-l1);stroke-width:1px}.BAyRca_chartAxisLabel{fill:var(--dsw-alias-label-tertiary);font-size:10px}.BAyRca_chartBar{fill:var(--dsw-static-blue-500);opacity:.7}.BAyRca_chartBar:hover{opacity:1}.BAyRca_chartStack{stroke:var(--dsw-alias-bg-layer-1);stroke-width:.75px}.BAyRca_chartStack:hover{opacity:.9}.BAyRca_chartLine{stroke:var(--dsw-static-blue-500);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.BAyRca_chartCrosshair{stroke:var(--dsw-alias-label-dimmed);stroke-width:1px;stroke-dasharray:3 3}.BAyRca_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))}.BAyRca_chartTooltipDate{color:var(--dsw-alias-label-primary);margin-bottom:3px;font-size:11px;font-weight:600}.BAyRca_chartTooltipRow{color:var(--dsw-alias-label-secondary);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.BAyRca_chartTooltipRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.BAyRca_chartBarPlaceholder{fill:color-mix(in srgb, var(--dsw-alias-label-secondary) 30%, transparent)}.BAyRca_chartLegendLine{background:var(--dsw-static-blue-500);border-radius:2px;width:10px;height:3px;display:inline-block}.BAyRca_chartLegendBar{background:var(--dsw-static-blue-500);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.BAyRca_chartTooltipSwatch{border-radius:3px;flex:none;width:8px;height:8px;display:inline-block}.BAyRca_chartLegend{color:var(--dsw-alias-label-tertiary);justify-content:flex-end;gap:14px;margin-top:2px;font-size:11px;display:flex}.BAyRca_chartLegend span{align-items:center;gap:5px;display:inline-flex}.BAyRca_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}.BAyRca_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}.BAyRca_ubAlertLeft{align-items:center;gap:8px;display:inline-flex}.BAyRca_ubRate{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.BAyRca_ubAlertNote{color:var(--dsw-alias-label-secondary);margin:0}.BAyRca_ubTag,.BAyRca_ubTagSuccess,.BAyRca_ubTagNeutral,.BAyRca_ubTagAlert,.BAyRca_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}.BAyRca_ubTagSuccess{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.BAyRca_ubTagNeutral{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.BAyRca_ubTagAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.BAyRca_ubTagPromo{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500);cursor:help}.BAyRca_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.BAyRca_ubExtraName{color:var(--dsw-alias-label-secondary);margin-left:26px}.BAyRca_ubExtraNote{color:var(--dsw-alias-label-tertiary);margin-left:8px;font-size:10px}.BAyRca_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}.BAyRca_ubCardHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.BAyRca_ubCardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.BAyRca_ubCardSub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_ubTablewrap{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;overflow:auto}.BAyRca_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12.5px}.BAyRca_ubTable th,.BAyRca_ubTable td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;padding:9px 12px}.BAyRca_ubTable tbody tr:last-child td{border-bottom:0}.BAyRca_ubTable thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;font-size:11px;font-weight:600}.BAyRca_ubModel{align-items:center;gap:8px;display:inline-flex}.BAyRca_vendorLogo{object-fit:contain;border-radius:4px;flex:none;width:18px;height:18px}.BAyRca_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}.BAyRca_ubModelName{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-weight:500;display:inline-flex}.BAyRca_ubPricepair{flex-wrap:wrap;gap:6px;display:inline-flex}.BAyRca_ubChipPeak,.BAyRca_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}.BAyRca_ubChipLabel{font-size:10px;font-weight:600}.BAyRca_ubChipPeak{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.BAyRca_ubChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.BAyRca_ubNotes{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.BAyRca_ubNotesItem{align-items:baseline;gap:10px;display:flex}.BAyRca_ubNotesTerm{color:var(--dsw-alias-label-primary);flex:0 0 72px;font-size:12px;font-weight:500}.BAyRca_ubNotesDesc{min-width:0;color:var(--dsw-alias-label-secondary);flex:1;font-size:12px;line-height:17px}.BAyRca_ubCardControlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.BAyRca_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}.BAyRca_modelTable{border-collapse:collapse;table-layout:fixed;width:100%;min-width:640px;font-size:12.5px}.BAyRca_modelTable th:first-child{width:26%}.BAyRca_modelTable th,.BAyRca_modelTable td,.BAyRca_pricingTable th,.BAyRca_pricingTable td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;white-space:nowrap;padding:9px 12px}.BAyRca_modelTable tbody tr:last-child td,.BAyRca_pricingTable tbody tr:last-child td{border-bottom:0}.BAyRca_modelTable thead th,.BAyRca_pricingTable thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;background:0 0;font-size:11px;font-weight:600}.BAyRca_modelTable tbody tr,.BAyRca_pricingTable tbody tr{transition:background-color .12s}.BAyRca_modelTable tbody tr:hover,.BAyRca_pricingTable tbody tr:hover{background:0 0}.BAyRca_sessionGroupRow{cursor:pointer}.BAyRca_sessionGroupRow .BAyRca_modelName:before{content:"›";color:var(--dsw-alias-label-tertiary);margin-right:6px;display:inline-block}.BAyRca_sessionGroupRow[aria-expanded=true] .BAyRca_modelName:before{transform:rotate(90deg)}.BAyRca_sessionChildRow td:first-child{padding-left:30px}.BAyRca_numCol{text-align:right;font-variant-numeric:tabular-nums}.BAyRca_na{color:var(--dsw-alias-label-dimmed)}.BAyRca_modelCell{align-items:center;gap:8px;display:inline-flex}.BAyRca_modelDot{border-radius:50%;flex:none;width:9px;height:9px}.BAyRca_modelName{color:var(--dsw-alias-label-primary);font-weight:500;line-height:16px;display:block}.BAyRca_modelProvider{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px;display:block}.BAyRca_pricingToggle:hover .BAyRca_panelTitle,.BAyRca_pricingToggle:focus-visible .BAyRca_panelTitle{color:var(--dsw-alias-label-primary)}.BAyRca_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}.BAyRca_siteRowName{align-items:center;gap:8px;min-width:0;display:inline-flex}.BAyRca_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}.BAyRca_siteKindSite{color:var(--dsw-static-blue-500);background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent)}.BAyRca_siteKindDirect{color:var(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent)}.BAyRca_siteKindUnknown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent)}.BAyRca_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}.BAyRca_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.BAyRca_siteRowCost{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:700;line-height:18px}.BAyRca_siteRowCalls{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.BAyRca_siteRowCallsLow{color:var(--dsw-static-red-500)}.BAyRca_flatTag{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px}.BAyRca_healthDot{border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.BAyRca_healthOk{background:var(--dsw-static-green-500)}.BAyRca_healthBad{background:var(--dsw-static-red-500)}.BAyRca_healthIdle{background:var(--dsw-static-neutral-bluish-400)}.BAyRca_dashboardRight{align-items:center;gap:8px;min-width:0;display:flex}.BAyRca_healthBadge{white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;line-height:16px;display:inline-flex}.BAyRca_healthBadgeOk{color:var(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2)}.BAyRca_healthBadgeBad{color:var(--dsw-static-red-500);background:var(--dsw-alias-bg-layer-2)}.BAyRca_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}.BAyRca_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}.BAyRca_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}.BAyRca_feeBar{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);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}.BAyRca_feeCount{color:var(--dsw-alias-label-primary);font-weight:600}.BAyRca_feeSuffix{color:var(--dsw-alias-label-tertiary)}.BAyRca_feeItem{color:var(--dsw-alias-label-secondary);white-space:nowrap}.BAyRca_feeNum{color:var(--dsw-alias-label-primary)}.BAyRca_feeSep{color:var(--dsw-alias-label-tertiary)}.BAyRca_feeChipPrimary,.BAyRca_feeChipOff,.BAyRca_feeChipAlert,.BAyRca_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}.BAyRca_feeChipPrimary{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.BAyRca_feeChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.BAyRca_feeChipAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.BAyRca_feeChipError{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500)}.BAyRca_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.BAyRca_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}.BAyRca_balanceDaysBadge:hover{border-color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-caption) 18%, transparent)}.BAyRca_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)}.BAyRca_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}.BAyRca_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.BAyRca_balanceDetailTitle{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600}.BAyRca_balanceDetailClose{cursor:pointer;color:var(--dsw-alias-label-caption);background:0 0;border:none;font-size:14px;line-height:1}.BAyRca_balanceDetailClose:hover{color:var(--dsw-alias-label-primary)}.BAyRca_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.BAyRca_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}.BAyRca_balanceDetailLabel{color:var(--dsw-alias-label-caption)}.BAyRca_balanceDetailValue{color:var(--dsw-alias-label-primary);font-weight:500}.BAyRca_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}.BAyRca_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}.BAyRca_currencyButtonActive{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.BAyRca_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.BAyRca_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}.BAyRca_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 BAyRca_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}@keyframes BAyRca_subscriptionGoldFlow{0%{background-position:200% 0}to{background-position:-200% 0}}.BAyRca_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}.BAyRca_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.BAyRca_subscriptionName{font-size:13px;font-weight:700}.BAyRca_subscriptionPlan{color:var(--dsw-alias-label-secondary);font-size:11px}.BAyRca_subscriptionPlan[data-kind=code],.BAyRca_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}.BAyRca_subscriptionTier{color:var(--dsw-alias-label-secondary);margin-left:6px}.BAyRca_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}.BAyRca_subscriptionStatus{color:var(--dsw-alias-label-secondary);margin-bottom:6px;font-size:11px}.BAyRca_subscriptionWindow{align-items:center;gap:10px;margin-top:8px;font-size:11px;display:flex}.BAyRca_subscriptionWindowLabel{color:var(--dsw-alias-label-secondary);flex:0 0 44px}.BAyRca_subscriptionTrack{background:var(--dsw-alias-bg-layer-3);border-radius:3px;flex:1;height:6px;overflow:hidden}.BAyRca_subscriptionFill{background:var(--dsw-static-blue-500);border-radius:3px;height:100%;transition:width .2s;display:block}.BAyRca_subscriptionFillWarn{background:var(--dsw-static-amber-500)}.BAyRca_subscriptionFillOver{background:var(--dsw-static-red-500)}.BAyRca_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.BAyRca_subscriptionPct{text-align:right;font-variant-numeric:tabular-nums;flex:none;min-width:52px}.BAyRca_subscriptionExhausted{color:var(--dsw-static-red-500);min-width:52px;font-weight:600}.BAyRca_subscriptionReset{color:var(--dsw-alias-label-caption);white-space:nowrap;flex:none;font-size:10px}.BAyRca_providerGroupList{flex-direction:column;gap:10px;display:flex}.BAyRca_providerGroup{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:12px;padding:12px 14px}.BAyRca_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.BAyRca_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.BAyRca_providerGroupName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:18px}.BAyRca_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.BAyRca_providerGroupBadge{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}.BAyRca_providerGroupBalance{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;align-items:baseline;gap:6px;font-size:12px;line-height:17px;display:inline-flex}.BAyRca_providerGroupBalanceLabel{color:var(--dsw-alias-label-caption);font-size:11px;line-height:17px}.BAyRca_rounds{margin-top:10px}.BAyRca_roundsBars{align-items:flex-end;gap:3px;height:124px;padding:16px 2px 0;display:flex;overflow-x:auto}.BAyRca_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}.BAyRca_roundsBarColPeak{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent)}.BAyRca_roundsBarColOff{background:var(--dsw-alias-bg-module-platform)}.BAyRca_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%)}.BAyRca_roundsBarWrap{flex:1;align-items:flex-end;min-height:0;display:flex}.BAyRca_roundsBar{background:var(--dsw-static-blue-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.BAyRca_roundsBarFlagged{background:var(--dsw-static-red-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.BAyRca_roundsFlagMark{background:var(--dsw-static-red-500);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.BAyRca_roundsAxis{color:var(--dsw-alias-label-secondary);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.BAyRca_roundsEmpty{color:var(--dsw-alias-label-secondary);margin-top:10px;font-size:12px}.BAyRca_heatmap{margin-top:10px}.BAyRca_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;display:grid}.BAyRca_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}.BAyRca_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}.BAyRca_heatmapCell[data-level="0"],.BAyRca_heatmapCell[data-level="1"],.BAyRca_heatmapCell[data-level="2"]{color:var(--dsw-alias-label-primary)}.BAyRca_heatmapCell[data-level="3"],.BAyRca_heatmapCell[data-level="4"]{color:var(--dsw-static-neutral-bluish-00)}.BAyRca_heatmapFooter{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-top:10px;font-size:10px;display:flex}.BAyRca_heatmapLegend{gap:3px;display:inline-flex}.BAyRca_heatmapLegend i{border-radius:4px;width:14px;height:14px;display:block}.BAyRca_heatmapHover{font-variant-numeric:tabular-nums;margin-left:auto}.BAyRca_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.BAyRca_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}.BAyRca_heatmapRangeButtonActive{color:var(--dsw-alias-text-primary);border-color:currentColor;font-weight:600}.BAyRca_heatmapYear{flex-direction:column;gap:6px;display:flex}.BAyRca_heatmapYearBody{align-items:flex-start;gap:6px;display:flex}.BAyRca_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}.BAyRca_heatmapYearWeekday{white-space:nowrap;text-align:right;height:11px}.BAyRca_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}.BAyRca_heatmapYearMonth{white-space:nowrap;overflow:visible}.BAyRca_heatmapYearScroll{padding-bottom:2px;overflow-x:auto}.BAyRca_heatmapYearGrid{grid-template-rows:repeat(7,11px);grid-auto-flow:column;gap:3px;min-width:max-content;display:grid}.BAyRca_heatmapYearCell{cursor:pointer;border:0;border-radius:2px;width:11px;height:11px;padding:0}.BAyRca_triggerPopSubscription{width:auto;left:0;right:0}.BAyRca_floatSub{flex-direction:column;gap:6px;min-width:0;display:flex}.BAyRca_floatSubHead{flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;display:flex}.BAyRca_floatSubName{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:700}.BAyRca_floatSubPlan{color:var(--dsw-alias-label-secondary);font-size:10px}.BAyRca_floatSub .BAyRca_subscriptionWindow{flex-wrap:wrap;gap:4px 10px}.BAyRca_floatSub .BAyRca_subscriptionWindowLabel{flex:none}.BAyRca_floatSub .BAyRca_subscriptionMeta{min-width:0;max-width:100%}.BAyRca_floatSub .BAyRca_subscriptionPct{min-width:0}.BAyRca_floatSub .BAyRca_subscriptionReset{white-space:normal;overflow-wrap:anywhere}.BAyRca_triggerPopEmpty{color:var(--dsw-alias-label-tertiary);padding:2px 0;font-size:11px;line-height:1.5}.BAyRca_triggerPopSwitcher{justify-content:flex-end;align-items:center;gap:8px;margin-top:2px;display:flex}.BAyRca_triggerPopSwitchCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:10px}.BAyRca_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}.BAyRca_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)}.BAyRca_floatTarget{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:5px;font-size:12px;display:inline-flex}.BAyRca_floatTargetLabel{color:var(--dsw-alias-label-secondary)}.BAyRca_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}.BAyRca_plgHead{align-items:flex-start;gap:12px;display:flex}.BAyRca_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}.BAyRca_plgTitle{flex-direction:column;gap:4px;min-width:0;display:flex}.BAyRca_plgNameRow{align-items:center;gap:8px;display:flex}.BAyRca_plgName{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.BAyRca_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}.BAyRca_plgDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_plgItem{flex-direction:column;gap:2px;min-width:0;display:flex}.BAyRca_plgLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.BAyRca_plgVal{color:var(--dsw-alias-label-primary);word-break:break-all;font-size:12px;line-height:17px}.BAyRca_plgLink{color:var(--dsw-static-blue-500);word-break:break-all;font-size:12px;line-height:17px;text-decoration:none}.BAyRca_plgLink:hover{text-decoration:underline}.BAyRca_tokenPanel{flex-direction:column;gap:14px;display:flex}.BAyRca_tokenModelBar{background:var(--dsw-alias-bg-layer-2);border-radius:999px;height:8px;overflow:hidden}.BAyRca_tokenModelParts{height:100%;display:flex}.BAyRca_tokenModelPartIn{background:var(--dsw-static-blue-500)}.BAyRca_tokenModelPartOut{background:var(--dsw-static-amber-500)}.BAyRca_tokenModelShareRow{align-items:center;gap:6px;display:inline-flex}@media (width<=640px){.BAyRca_kpiGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.BAyRca_hero{gap:14px}.BAyRca_heroTop{flex-direction:column;align-items:flex-start;gap:12px}.BAyRca_heroGauge{width:72px;height:72px}.BAyRca_heroSide{gap:12px}.BAyRca_heroSideSpacer{display:none}}.BAyRca_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 BAyRca_peakAlertIn;display:flex;position:fixed;box-shadow:0 4px 16px #00000014}.BAyRca_peakCardCorner{bottom:18px;right:18px}.BAyRca_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.BAyRca_peakCardPeak{color:var(--dsw-static-blue-500)}.BAyRca_peakCardOff{color:var(--dsw-static-green-500)}.BAyRca_peakHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.BAyRca_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}.BAyRca_peakTagPrimary{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-static-blue-500)}.BAyRca_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-static-green-500)}.BAyRca_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.BAyRca_peakDotPrimary{background:var(--dsw-static-blue-500)}.BAyRca_peakDotSuccess{background:var(--dsw-static-green-500)}.BAyRca_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}.BAyRca_peakClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2)}.BAyRca_peakCount{font-variant-numeric:tabular-nums;font-size:28px;font-weight:700;line-height:34px}.BAyRca_peakCountPrimary{color:var(--dsw-static-blue-500)}.BAyRca_peakCountSuccess{color:var(--dsw-static-green-500)}.BAyRca_peakDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:18px}@keyframes BAyRca_peakAlertIn{0%{opacity:0}to{opacity:1}}.BAyRca_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}.BAyRca_setCardHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.BAyRca_setCardMeta{flex-direction:column;gap:4px;min-width:0;display:flex}.BAyRca_setCardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.BAyRca_setCardDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.BAyRca_ctlCol{flex-direction:column;gap:10px;padding-top:2px;display:flex}.BAyRca_ctlRow{align-items:center;gap:12px;min-height:28px;display:flex}.BAyRca_ctlRowStretch{display:flex}.BAyRca_ctlLabel{color:var(--dsw-alias-label-secondary);flex:0 0 96px;font-size:11px;line-height:16px}.BAyRca_ctlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.BAyRca_userPriceRow{border-bottom:1px solid var(--dsw-alias-border-l1);grid-template-columns:minmax(96px,1.1fr) minmax(120px,1.5fr) repeat(3,minmax(64px,84px)) auto auto;align-items:end;gap:8px 10px;padding:8px 0;display:grid}@media (width<=720px){.BAyRca_userPriceRow{grid-template-columns:repeat(3,minmax(0,1fr))}}.BAyRca_userPriceRow .BAyRca_userPriceInput,.BAyRca_userPriceRow .BAyRca_userPriceInputNum{box-sizing:border-box;width:100%;min-width:0;max-width:none}.BAyRca_userPriceOffPeak{flex-wrap:wrap;grid-column:1/-1;align-items:center;gap:10px;width:100%;padding:2px 0 6px;display:flex}.BAyRca_userPriceField{flex-direction:column;gap:4px;min-width:0;display:flex}.BAyRca_userPriceField .BAyRca_ctlLabel{flex:none;font-size:11px}.BAyRca_userPriceInput,.BAyRca_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}.BAyRca_userPriceInputNum{min-width:72px;max-width:88px}.BAyRca_userPriceRemove{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-static-red-400);cursor:pointer;background:0 0;border-radius:6px;align-self:center;padding:4px 8px;font-size:11px;line-height:16px}.BAyRca_userPriceRemove:hover{border-color:var(--dsw-static-red-400)}.BAyRca_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}.BAyRca_rdo input{opacity:0;pointer-events:none;position:absolute}.BAyRca_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}.BAyRca_rdo input:checked+.BAyRca_rdoDot{border-color:var(--dsw-static-blue-500)}.BAyRca_rdo input:checked+.BAyRca_rdoDot:after{content:"";background:var(--dsw-static-blue-500);border-radius:50%;position:absolute;inset:3px}.BAyRca_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}.BAyRca_affix{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_prog{background:var(--dsw-alias-bg-module-platform);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.BAyRca_progFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .2s}.BAyRca_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}.BAyRca_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))}`,document.head.appendChild(e)}var E={feeChipAlert:`BAyRca_feeChipAlert`,rdoDot:`BAyRca_rdoDot`,inp:`BAyRca_inp`,tabPanelIn:`BAyRca_tabPanelIn`,panel:`BAyRca_panel`,dashboardTitle:`BAyRca_dashboardTitle`,modelName:`BAyRca_modelName`,balanceDetailValue:`BAyRca_balanceDetailValue`,peakCardCorner:`BAyRca_peakCardCorner`,subscriptionGoldFlow:`BAyRca_subscriptionGoldFlow`,tokenModelParts:`BAyRca_tokenModelParts`,peakDot:`BAyRca_peakDot`,ubTablewrap:`BAyRca_ubTablewrap`,peakDesc:`BAyRca_peakDesc`,triggerWrap:`BAyRca_triggerWrap`,ctlGroup:`BAyRca_ctlGroup`,metricValuePrimary:`BAyRca_metricValuePrimary`,ubTag:`BAyRca_ubTag`,heatmapRangeButton:`BAyRca_heatmapRangeButton`,ubCardControlGroup:`BAyRca_ubCardControlGroup`,peakCardPeak:`BAyRca_peakCardPeak`,triggerSub:`BAyRca_triggerSub`,switchOn:`BAyRca_switchOn`,peakHead:`BAyRca_peakHead`,userPriceInput:`BAyRca_userPriceInput`,rangeButton:`BAyRca_rangeButton`,balanceDetailClose:`BAyRca_balanceDetailClose`,popDotDirect:`BAyRca_popDotDirect`,kpiDetail:`BAyRca_kpiDetail`,ubPricepair:`BAyRca_ubPricepair`,ubNotesDesc:`BAyRca_ubNotesDesc`,feeItem:`BAyRca_feeItem`,userPriceField:`BAyRca_userPriceField`,dashboardSubtitle:`BAyRca_dashboardSubtitle`,siteKindTag:`BAyRca_siteKindTag`,userPriceRemove:`BAyRca_userPriceRemove`,vendorLogo:`BAyRca_vendorLogo`,siteRowCost:`BAyRca_siteRowCost`,popModelRow:`BAyRca_popModelRow`,plgLink:`BAyRca_plgLink`,ubTagAlert:`BAyRca_ubTagAlert`,heroTop:`BAyRca_heroTop`,rangeButtonActive:`BAyRca_rangeButtonActive`,exportBar:`BAyRca_exportBar`,kpiValue:`BAyRca_kpiValue`,popHead:`BAyRca_popHead`,providerGroupTitle:`BAyRca_providerGroupTitle`,heroGaugeTrack:`BAyRca_heroGaugeTrack`,floatModeBtn:`BAyRca_floatModeBtn`,setCardDesc:`BAyRca_setCardDesc`,popModelStatusLow:`BAyRca_popModelStatusLow`,triggerMetric:`BAyRca_triggerMetric`,dashboardHead:`BAyRca_dashboardHead`,heroBudget:`BAyRca_heroBudget`,ctlRow:`BAyRca_ctlRow`,heroCurrency:`BAyRca_heroCurrency`,subscriptionAuto:`BAyRca_subscriptionAuto`,chartLegendLine:`BAyRca_chartLegendLine`,trigger:`BAyRca_trigger`,shareItem:`BAyRca_shareItem`,subscriptionHead:`BAyRca_subscriptionHead`,panelHead:`BAyRca_panelHead`,feeChipError:`BAyRca_feeChipError`,providerGroupName:`BAyRca_providerGroupName`,tokenModelPartIn:`BAyRca_tokenModelPartIn`,metricValue:`BAyRca_metricValue`,progFill:`BAyRca_progFill`,ubTagPromo:`BAyRca_ubTagPromo`,heroBudgetLabel:`BAyRca_heroBudgetLabel`,ubAlertLeft:`BAyRca_ubAlertLeft`,chartTooltipRow:`BAyRca_chartTooltipRow`,siteRowCalls:`BAyRca_siteRowCalls`,heatmapLegend:`BAyRca_heatmapLegend`,heatmapYearMonths:`BAyRca_heatmapYearMonths`,kpiGreen:`BAyRca_kpiGreen`,bucketCost:`BAyRca_bucketCost`,chartLine:`BAyRca_chartLine`,triggerPrimary:`BAyRca_triggerPrimary`,ubTagError:`BAyRca_ubTagError`,floatTarget:`BAyRca_floatTarget`,popDotSub:`BAyRca_popDotSub`,setCardHead:`BAyRca_setCardHead`,balanceDetailHead:`BAyRca_balanceDetailHead`,tabButton:`BAyRca_tabButton`,shareTrack:`BAyRca_shareTrack`,triggerSparkBar:`BAyRca_triggerSparkBar`,heroGaugePct:`BAyRca_heroGaugePct`,feeChipPrimary:`BAyRca_feeChipPrimary`,budgetOverPulse:`BAyRca_budgetOverPulse`,balanceDetailTitle:`BAyRca_balanceDetailTitle`,providerGroupList:`BAyRca_providerGroupList`,budgetFillWarn:`BAyRca_budgetFillWarn`,heatmapYearScroll:`BAyRca_heatmapYearScroll`,triggerPopSwitchCount:`BAyRca_triggerPopSwitchCount`,feeCount:`BAyRca_feeCount`,tokenModelShareRow:`BAyRca_tokenModelShareRow`,currencyButtonActive:`BAyRca_currencyButtonActive`,providerGroupBalance:`BAyRca_providerGroupBalance`,ubExtraRow:`BAyRca_ubExtraRow`,metricLabel:`BAyRca_metricLabel`,ubTagNeutral:`BAyRca_ubTagNeutral`,ubExtraName:`BAyRca_ubExtraName`,ctlCol:`BAyRca_ctlCol`,ctlRowStretch:`BAyRca_ctlRowStretch`,chartLegendBar:`BAyRca_chartLegendBar`,exportLabel:`BAyRca_exportLabel`,roundsBarColOff:`BAyRca_roundsBarColOff`,modelCell:`BAyRca_modelCell`,peakTagPrimary:`BAyRca_peakTagPrimary`,subscriptionName:`BAyRca_subscriptionName`,reconcileNotice:`BAyRca_reconcileNotice`,sessionGroupRow:`BAyRca_sessionGroupRow`,siteRowCallsLow:`BAyRca_siteRowCallsLow`,peakTag:`BAyRca_peakTag`,numCol:`BAyRca_numCol`,pricingTable:`BAyRca_pricingTable`,peakCardOff:`BAyRca_peakCardOff`,heroMain:`BAyRca_heroMain`,popTagPrimary:`BAyRca_popTagPrimary`,budgetInput:`BAyRca_budgetInput`,plgGrid:`BAyRca_plgGrid`,heroBudgetTrack:`BAyRca_heroBudgetTrack`,reconcileDismiss:`BAyRca_reconcileDismiss`,subscriptionWindow:`BAyRca_subscriptionWindow`,roundsEmpty:`BAyRca_roundsEmpty`,triggerMain:`BAyRca_triggerMain`,popModelLabel:`BAyRca_popModelLabel`,tabNav:`BAyRca_tabNav`,popDot:`BAyRca_popDot`,heroGaugeSvg:`BAyRca_heroGaugeSvg`,modalFooter:`BAyRca_modalFooter`,currencyToggle:`BAyRca_currencyToggle`,setCardTitle:`BAyRca_setCardTitle`,providerGroupHead:`BAyRca_providerGroupHead`,ubCardHead:`BAyRca_ubCardHead`,chartLegend:`BAyRca_chartLegend`,chartSvg:`BAyRca_chartSvg`,metricCell:`BAyRca_metricCell`,tokenModelBar:`BAyRca_tokenModelBar`,chartStack:`BAyRca_chartStack`,subscriptionWindowLabel:`BAyRca_subscriptionWindowLabel`,chartAxisLabel:`BAyRca_chartAxisLabel`,roundsBars:`BAyRca_roundsBars`,deltaDown:`BAyRca_deltaDown`,heatmapFooter:`BAyRca_heatmapFooter`,heroBudgetFillOver:`BAyRca_heroBudgetFillOver`,reconcileText:`BAyRca_reconcileText`,providerGroupBadge:`BAyRca_providerGroupBadge`,subscriptionExhausted:`BAyRca_subscriptionExhausted`,shareSegPeak:`BAyRca_shareSegPeak`,subscriptionPlan:`BAyRca_subscriptionPlan`,plgLabel:`BAyRca_plgLabel`,feeNum:`BAyRca_feeNum`,healthBadgeOk:`BAyRca_healthBadgeOk`,subscriptionFillOver:`BAyRca_subscriptionFillOver`,popModel:`BAyRca_popModel`,peakClose:`BAyRca_peakClose`,balanceDetailPop:`BAyRca_balanceDetailPop`,budgetFillOver:`BAyRca_budgetFillOver`,siteRowName:`BAyRca_siteRowName`,planTag:`BAyRca_planTag`,peakCount:`BAyRca_peakCount`,heroGauge:`BAyRca_heroGauge`,subscriptionFill:`BAyRca_subscriptionFill`,setCardMeta:`BAyRca_setCardMeta`,healthDot:`BAyRca_healthDot`,healthBad:`BAyRca_healthBad`,"billing-trigger":`BAyRca_billing-trigger`,peakCardCenter:`BAyRca_peakCardCenter`,triggerLabel:`BAyRca_triggerLabel`,heroLabel:`BAyRca_heroLabel`,heroMeta:`BAyRca_heroMeta`,heroGaugeCenter:`BAyRca_heroGaugeCenter`,triggerPopShown:`BAyRca_triggerPopShown`,peakAlertIn:`BAyRca_peakAlertIn`,uncataloguedTag:`BAyRca_uncataloguedTag`,metricGrid:`BAyRca_metricGrid`,delta:`BAyRca_delta`,panelTitle:`BAyRca_panelTitle`,heroSideItem:`BAyRca_heroSideItem`,shareLegend:`BAyRca_shareLegend`,feeSuffix:`BAyRca_feeSuffix`,feeChipOff:`BAyRca_feeChipOff`,subscriptionGrid:`BAyRca_subscriptionGrid`,heatmapYearWeekday:`BAyRca_heatmapYearWeekday`,closeButton:`BAyRca_closeButton`,currencyButton:`BAyRca_currencyButton`,heatmapGrid:`BAyRca_heatmapGrid`,ubNotes:`BAyRca_ubNotes`,prog:`BAyRca_prog`,ubModelName:`BAyRca_ubModelName`,providerGroupMeta:`BAyRca_providerGroupMeta`,ubRate:`BAyRca_ubRate`,chartCrosshair:`BAyRca_chartCrosshair`,roundsBarWrap:`BAyRca_roundsBarWrap`,heroSideValue:`BAyRca_heroSideValue`,subscriptionTrack:`BAyRca_subscriptionTrack`,plgDesc:`BAyRca_plgDesc`,siteRowTitle:`BAyRca_siteRowTitle`,tokenModelPartOut:`BAyRca_tokenModelPartOut`,subscriptionFillWarn:`BAyRca_subscriptionFillWarn`,plgItem:`BAyRca_plgItem`,ubTagSuccess:`BAyRca_ubTagSuccess`,popDotNeutral:`BAyRca_popDotNeutral`,dashboardIn:`BAyRca_dashboardIn`,tabPanel:`BAyRca_tabPanel`,siteRow:`BAyRca_siteRow`,subscriptionPct:`BAyRca_subscriptionPct`,plgTitle:`BAyRca_plgTitle`,providerGroupBalanceLabel:`BAyRca_providerGroupBalanceLabel`,heatmapYearGrid:`BAyRca_heatmapYearGrid`,panelHint:`BAyRca_panelHint`,heroValue:`BAyRca_heroValue`,siteRowMeta:`BAyRca_siteRowMeta`,popModelName:`BAyRca_popModelName`,switch:`BAyRca_switch`,heatmapYearMonth:`BAyRca_heatmapYearMonth`,plgHead:`BAyRca_plgHead`,tableScroll:`BAyRca_tableScroll`,kpiGrid:`BAyRca_kpiGrid`,balanceDetailLabel:`BAyRca_balanceDetailLabel`,popModelStatus:`BAyRca_popModelStatus`,ubCard:`BAyRca_ubCard`,dashboard:`BAyRca_dashboard`,dashboardBody:`BAyRca_dashboardBody`,tabButtonActive:`BAyRca_tabButtonActive`,heroSideSpacer:`BAyRca_heroSideSpacer`,shareSegAssistant:`BAyRca_shareSegAssistant`,ctlLabel:`BAyRca_ctlLabel`,triggerYen:`BAyRca_triggerYen`,modelProvider:`BAyRca_modelProvider`,providerGroup:`BAyRca_providerGroup`,balanceDetailGrid:`BAyRca_balanceDetailGrid`,siteKindSite:`BAyRca_siteKindSite`,heroGaugePctOver:`BAyRca_heroGaugePctOver`,flatTag:`BAyRca_flatTag`,roundsBarCol:`BAyRca_roundsBarCol`,siteKindDirect:`BAyRca_siteKindDirect`,triggerPopSwitcher:`BAyRca_triggerPopSwitcher`,siteKindUnknown:`BAyRca_siteKindUnknown`,heroGaugeArcOver:`BAyRca_heroGaugeArcOver`,heatmapRangeButtonActive:`BAyRca_heatmapRangeButtonActive`,peakTagSuccess:`BAyRca_peakTagSuccess`,triggerPop:`BAyRca_triggerPop`,popTagSub:`BAyRca_popTagSub`,chartBar:`BAyRca_chartBar`,ubCardTitle:`BAyRca_ubCardTitle`,feeSep:`BAyRca_feeSep`,roundsBarColPeak:`BAyRca_roundsBarColPeak`,subscriptionCard:`BAyRca_subscriptionCard`,healthBadge:`BAyRca_healthBadge`,ubNotesTerm:`BAyRca_ubNotesTerm`,floatSubHead:`BAyRca_floatSubHead`,triggerPopEmpty:`BAyRca_triggerPopEmpty`,heroGaugeLabel:`BAyRca_heroGaugeLabel`,switchKnob:`BAyRca_switchKnob`,modelDot:`BAyRca_modelDot`,healthOk:`BAyRca_healthOk`,tokenPanel:`BAyRca_tokenPanel`,peakCountSuccess:`BAyRca_peakCountSuccess`,deltaUp:`BAyRca_deltaUp`,emptyRow:`BAyRca_emptyRow`,shareSegOff:`BAyRca_shareSegOff`,bucketOfficial:`BAyRca_bucketOfficial`,popTitle:`BAyRca_popTitle`,chartTooltip:`BAyRca_chartTooltip`,vendorLetter:`BAyRca_vendorLetter`,bucketSep:`BAyRca_bucketSep`,subscriptionTier:`BAyRca_subscriptionTier`,floatSub:`BAyRca_floatSub`,staleNotice:`BAyRca_staleNotice`,shareSeg:`BAyRca_shareSeg`,peakDotSuccess:`BAyRca_peakDotSuccess`,heroGaugeArc:`BAyRca_heroGaugeArc`,heatmapCellEmpty:`BAyRca_heatmapCellEmpty`,userPriceInputNum:`BAyRca_userPriceInputNum`,feeBar:`BAyRca_feeBar`,chartTooltipDate:`BAyRca_chartTooltipDate`,rdo:`BAyRca_rdo`,pricingToggle:`BAyRca_pricingToggle`,ubCardSub:`BAyRca_ubCardSub`,ubChipPeak:`BAyRca_ubChipPeak`,heroBudgetValue:`BAyRca_heroBudgetValue`,ubExtraNote:`BAyRca_ubExtraNote`,roundsBarLabel:`BAyRca_roundsBarLabel`,heatmapYearWeekdays:`BAyRca_heatmapYearWeekdays`,balanceCell:`BAyRca_balanceCell`,ubChipLabel:`BAyRca_ubChipLabel`,na:`BAyRca_na`,heatmap:`BAyRca_heatmap`,metricValueSuccess:`BAyRca_metricValueSuccess`,chartWrap:`BAyRca_chartWrap`,reconcileIcon:`BAyRca_reconcileIcon`,ubTable:`BAyRca_ubTable`,shareValue:`BAyRca_shareValue`,ubAlertNote:`BAyRca_ubAlertNote`,subscriptionMeta:`BAyRca_subscriptionMeta`,heroSideLabel:`BAyRca_heroSideLabel`,balanceDaysBadgeLow:`BAyRca_balanceDaysBadgeLow`,heatmapRangeSwitch:`BAyRca_heatmapRangeSwitch`,heatmapYear:`BAyRca_heatmapYear`,triggerPopSubscription:`BAyRca_triggerPopSubscription`,ubModel:`BAyRca_ubModel`,healthIdle:`BAyRca_healthIdle`,plgTag:`BAyRca_plgTag`,floatTargetLabel:`BAyRca_floatTargetLabel`,exportButton:`BAyRca_exportButton`,plgVal:`BAyRca_plgVal`,heatmapHover:`BAyRca_heatmapHover`,shareSegTool:`BAyRca_shareSegTool`,triggerIcon:`BAyRca_triggerIcon`,heroSide:`BAyRca_heroSide`,dashboardRight:`BAyRca_dashboardRight`,balanceDetailRow:`BAyRca_balanceDetailRow`,triggerSpark:`BAyRca_triggerSpark`,heatmapCell:`BAyRca_heatmapCell`,modelTable:`BAyRca_modelTable`,heatmapYearBody:`BAyRca_heatmapYearBody`,chartTooltipSwatch:`BAyRca_chartTooltipSwatch`,ubAlert:`BAyRca_ubAlert`,peakCard:`BAyRca_peakCard`,userPriceOffPeak:`BAyRca_userPriceOffPeak`,shareSegUser:`BAyRca_shareSegUser`,floatModeBtnOn:`BAyRca_floatModeBtnOn`,affix:`BAyRca_affix`,ubNotesItem:`BAyRca_ubNotesItem`,shareDot:`BAyRca_shareDot`,plgNameRow:`BAyRca_plgNameRow`,triggerSparkHot:`BAyRca_triggerSparkHot`,peakDotPrimary:`BAyRca_peakDotPrimary`,setCard:`BAyRca_setCard`,chartBarPlaceholder:`BAyRca_chartBarPlaceholder`,chartGrid:`BAyRca_chartGrid`,subscriptionStatus:`BAyRca_subscriptionStatus`,kpiLabel:`BAyRca_kpiLabel`,estimatedTag:`BAyRca_estimatedTag`,btn:`BAyRca_btn`,hero:`BAyRca_hero`,subscriptionReset:`BAyRca_subscriptionReset`,heroReadout:`BAyRca_heroReadout`,balanceDaysBadge:`BAyRca_balanceDaysBadge`,heroBudgetFill:`BAyRca_heroBudgetFill`,chartEmpty:`BAyRca_chartEmpty`,userPriceRow:`BAyRca_userPriceRow`,heatmapYearCell:`BAyRca_heatmapYearCell`,ubChipOff:`BAyRca_ubChipOff`,roundsFlagMark:`BAyRca_roundsFlagMark`,sessionChildRow:`BAyRca_sessionChildRow`,floatSubName:`BAyRca_floatSubName`,rangeToggle:`BAyRca_rangeToggle`,floatSubPlan:`BAyRca_floatSubPlan`,bucketThird:`BAyRca_bucketThird`,roundsAxis:`BAyRca_roundsAxis`,unpricedHint:`BAyRca_unpricedHint`,dashboardModal:`BAyRca_dashboardModal`,healthBadgeBad:`BAyRca_healthBadgeBad`,rounds:`BAyRca_rounds`,plgIcon:`BAyRca_plgIcon`,roundsBar:`BAyRca_roundsBar`,plgName:`BAyRca_plgName`,railButton:`BAyRca_railButton`,kpiTile:`BAyRca_kpiTile`,peakCountPrimary:`BAyRca_peakCountPrimary`,roundsBarFlagged:`BAyRca_roundsBarFlagged`};let D={"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`}},ee={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 te(e){return e===``?e:ee[e]??e}function ne(e){let t=D[te(e)];return t?.type===`code`?t.tier:void 0}let O=[{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}],k,re,A,ie,j;function ae(e){j=e.length>0?e:void 0}function M(){return j}function N(e){return z(e)}function oe(e,t){if(j===void 0)return;let n=N(e),r=L(n);if(t!==void 0){for(let e of j)if(e.origin!==void 0&&e.origin!==``&&(N(e.key)===n||L(e.key)===r)&&e.origin===t)return{input:e.input,cacheHit:e.cacheHit,output:e.output,...e.currency===void 0?{}:{currency:e.currency}}}for(let e of j)if((e.origin===void 0||e.origin===``)&&(N(e.key)===n||L(e.key)===r))return{input:e.input,cacheHit:e.cacheHit,output:e.output,...e.currency===void 0?{}:{currency:e.currency}}}function P(e){k=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,re=e.prices,A=e.extraModels}function se(e){ie=e}function ce(){return k??6.79}function le(){return{rate:ce(),live:k!==void 0}}function ue(e){return e>=9&&e<12||e>=14&&e<18}function de(e){return e==null||!Number.isFinite(e)?`peak`:fe(e)?`offPeak`:ue((new Date(e).getUTCHours()+8)%24)?`peak`:`offPeak`}function fe(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}let pe=[540,720,840,1080];function me(e){return((e+288e5)%864e5+864e5)%864e5}function he(e){let t=de(e),n=me(e);for(let r=0;r<7;r++){let i=r*864e5-n;for(let n of pe){let r=i+n*6e4;if(!(r<=0)&&de(e+r)!==t)return{tier:t,nextSwitchInMs:r}}}let r=pe[0]??0;return{tier:t,nextSwitchInMs:864e5-n+r*6e4}}function ge(e,t){let{nextSwitchInMs:n}=he(e);if(n>t)return null;let r=e+n;return{entering:de(r),atMs:r}}function F(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 _e=`09:00-12:00 / 14:00-18:00`,ve=`Standard / Flex`,ye=[{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:_e},{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:_e},{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:_e},{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:ve,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:ve,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}}],I={"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`,"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 L(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let R=(()=>{let e=new Map,t=(t,n)=>{let r=L(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of ye)t(e.key,e.key);for(let[e,n]of Object.entries(I))t(e,n);for(let e of O)t(e.key,e.key);return e})();function z(e){let t=I[e]??e;if(t===e){let t=L(e);if(t!==``){let e=R.get(t);if(e!==void 0)return e;let n=(A??[]).find(e=>L(e.key)===t);if(n!==void 0)return n.key}}return t}function be(e){let t=z(e),n=re?.[t];if(n!==void 0)return n;let r=O.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function xe(e){let t=z(e),n=ye.find(e=>e.key===t),r=A?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=ye.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():B(r)),a=oe(t);if(a!==void 0)return{...i,userPriced:!0,price:{currency:a.currency??`CNY`,input:a.input,cacheHit:a.cacheHit,output:a.output}};let o=be(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function B(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 Se(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function V(e,t){let{promo:n}=e;if(n===void 0||!Se(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 Ce(e=Date.now()){let t=[...ye.map(t=>V(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>L(e.key)));for(let e of ie??[]){let i=e.id.toLowerCase();if((()=>{let t=z(e.id);return ye.find(e=>e.key===t)})()!==void 0)continue;let a=L(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(A??[]).find(e=>L(e.key)===a),s;if(o!==void 0)s=B(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=be(i);s=t===void 0?{key:z(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=oe(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 we(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function H(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*ce():a}function Te(e,t,n=.5,r=Date.now()){let i=V(e,r),a=H(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:H(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function Ee(e){let t=ce();return t>0?e/t:e}function U(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 De(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 Oe(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function W(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 G={top:18,right:40,bottom:26,left:46};function K(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function Ae(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function q(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 je={key:`__total__`,name:`总计`,color:``};function Me({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>U(n===`usd`?Ee(e):e,n),l=e=>i===`tokens`?Ae(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-G.left-G.right,a=220-G.top-G.bottom,o=e=>n===1?G.left+r/2:G.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=>G.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>G.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:je,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:E.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:x,linePath:S}=d,C=a===null?void 0:e[a],w=q(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:E.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:E.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-G.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:G.left,x2:680-G.right,y1:n,y2:n,className:E.chartGrid}),(0,o.jsx)(`text`,{x:G.left-8,y:n+3,textAnchor:`end`,className:E.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===``?E.chartBar:E.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:E.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:S,fill:`none`,className:E.chartLine}),x.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-G.right+8,y:n+3,textAnchor:`start`,className:E.chartAxisLabel,children:Ae(e)},`calls-${t}`)}),w.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:E.chartAxisLabel,children:K(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:G.top,y2:G.top+m,className:E.chartCrosshair})]}),C!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:E.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(C.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:E.chartTooltipDate,children:C.date}),i!==`tokens`&&t.filter(e=>(C.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:E.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(C.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:E.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:E.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?Ae(C.tokens??0):c(C.cost)})]}),(0,o.jsxs)(`div`,{className:E.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:E.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:C.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:E.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartLegendLine}),`调用`]})]})]})}let J={top:14,right:42,bottom:22,left:46};function Ne(e){let t=Object.keys(e).sort(),n=[];for(let r of t.slice(-48)){let t=e[r];t!==void 0&&n.push({key:r,ttftMs:t.ttftAvg,...t.tpsAvg===void 0?{}:{tps:t.tpsAvg}})}return n}function Pe(e){return e.slice(5,13).replace(`T`,` `)}function Fe(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Ie(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Le({perf:e,models:t,t:n}){let i=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,a=(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:i(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]),s=(0,r.useMemo)(()=>{let t=e===void 0?[]:Ne(e.byHour);if(t.length===0)return null;let n=t.length,r=680-J.left-J.right,i=180-J.top-J.bottom,a=e=>n===1?J.left+r/2:J.left+r*e/(n-1),o=Math.max(...t.map(e=>e.ttftMs),1),s=Math.max(...t.map(e=>e.tps??0),1),c=e=>J.top+i-e/o*i,l=e=>J.top+i-e/s*i,u=t.map((e,t)=>`${t===0?`M`:`L`}${a(t)} ${c(e.ttftMs)}`).join(` `),d=t.some(e=>e.tps!==void 0)?t.map((e,t)=>`${t===0?`M`:`L`}${a(t)} ${l(e.tps??0)}`).join(` `):``,f=Math.max(1,Math.ceil(n/8)),p=[];for(let e=0;e<n;e+=f)p.push(e);return n>0&&p[p.length-1]!==n-1&&p.push(n-1),{points:t,n,inner:a,yTtft:c,ttftPath:u,tpsPath:d,indices:p,ttftTicks:[0,.5,1].map(e=>o*e).reverse(),maxTps:s}},[e]);return e===void 0||a.length===0?(0,o.jsx)(`div`,{className:E.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)}):(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:E.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:E.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfEstimated`)})]})}),(0,o.jsx)(`tbody`,{children:a.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:E.modelCell,children:[(0,o.jsx)(`span`,{className:E.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:E.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:E.numCol,children:Fe(e.ttftAvg)}),(0,o.jsx)(`td`,{className:E.numCol,children:Fe(e.ttftP50)}),(0,o.jsx)(`td`,{className:E.numCol,children:Fe(e.ttftP90)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):(0,o.jsxs)(`span`,{children:[Fe(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):Ie(e.tpsAvg)}),(0,o.jsx)(`td`,{className:E.numCol,children:Fe(e.latencyAvg)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:E.na,children:`—`})})]},e.key))})]})}),s!==null&&(0,o.jsxs)(`div`,{className:E.chartWrap,"data-testid":`billing-perf-hour`,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:E.chartSvg,role:`img`,"aria-label":`Hourly TTFT and generation speed by model`,children:[s.ttftTicks.map((e,t)=>{let n=s.yTtft(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:J.left,x2:680-J.right,y1:n,y2:n,className:E.chartGrid}),(0,o.jsx)(`text`,{x:J.left-8,y:n+3,textAnchor:`end`,className:E.chartAxisLabel,children:e.toFixed(0)})]},`ttft-${t}`)}),(0,o.jsx)(`path`,{d:s.ttftPath,fill:`none`,className:E.chartLine}),s.tpsPath!==``&&(0,o.jsx)(`path`,{d:s.tpsPath,fill:`none`,className:E.chartLine,style:{stroke:`var(--dsw-static-amber-500)`,strokeDasharray:`4 4`}}),s.indices.map(e=>{let t=s.points[e];return t===void 0?null:(0,o.jsx)(`text`,{x:s.inner(e),y:174,textAnchor:`middle`,className:E.chartAxisLabel,children:Pe(t.key)},t.key)}),(0,o.jsxs)(`text`,{x:680-J.right+8,y:J.top+4,textAnchor:`start`,className:E.chartAxisLabel,children:[n(`perfTpsUnit`),` `,s.maxTps.toFixed(0)]})]}),(0,o.jsxs)(`div`,{className:E.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartLegendLine}),n(`perfTtft`),` (ms)`]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartLegendLine,style:{background:`var(--dsw-static-amber-500)`}}),n(`perfTps`),` (`,n(`perfTpsUnit`),`)`]})]})]})]})}let Re=`@kenz1117/dsh-ui-usage-billing`,Y=`kenz1117`;function ze({t:e,version:t}){return(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:E.plgHead,children:[(0,o.jsx)(`span`,{className:E.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:E.plgTitle,children:[(0,o.jsxs)(`div`,{className:E.plgNameRow,children:[(0,o.jsx)(`h3`,{className:E.plgName,children:Re}),(0,o.jsx)(`span`,{className:E.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:E.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:E.plgGrid,children:[(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:E.plgLink,href:`https://github.com/${Y}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,Y,`)`]})]}),(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:E.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:E.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:Re})]}),(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:E.plgVal,children:`MIT`})]})]})]})}function Be(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 Ve(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let X={top:14,right:18,bottom:22,left:46},Z=`var(--dsw-static-blue-500)`,He=`#14b8a6`,Ue=`var(--dsw-static-amber-500)`;function We(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 Ge(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,s=e.money;e.models;let{byDay:c,byModel:u,total:d}=t,[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(`structure`),[g,_]=(0,r.useState)(null);t.byDayModels;let v=(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:E.shareSegUser},{label:a(`roleAssistant`),value:e.assistant,seg:E.shareSegAssistant},{label:a(`roleTool`),value:e.tool,seg:E.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,a]),y=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=Be(n.getTime()),i=c[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[c,n]),b=(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:xe(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]),x=(0,r.useMemo)(()=>{let e=d.cacheHit??0,t=d.cacheMiss??0,n=d.input??0,r=d.output??0,i=d.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 y){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}},[d,y]),S=(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]),C=(0,r.useMemo)(()=>{let e=y.length;if(e===0)return null;let t=680-X.left-X.right,n=200-X.top-X.bottom,r=Math.max(...y.map(e=>e.miss+e.hit+e.output),1),i=e=>X.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?X.left+t/2:X.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}},[y]);return(0,o.jsxs)(`div`,{className:E.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:E.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:E.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-token-export-csv`,onClick:()=>{let e=new Blob([We(y)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${Be()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-token-export-json`,onClick:()=>{let e=new Blob([JSON.stringify({days:y,models:b,total:d},null,2)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${Be()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},children:a(`exportJson`)})]}),(0,o.jsxs)(`div`,{className:E.kpiGrid,"data-testid":`billing-token-kpis`,children:[(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenCacheHitRate`)}),(0,o.jsxs)(`span`,{className:E.kpiValue,children:[x.cacheHitRate.toFixed(1),`%`]}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[W(x.hit),` / `,W(x.hit+x.miss),(d.cacheWrite??0)>0?` · ${a(`tokenCacheWrite`)} ${W(d.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenReasoningShare`)}),(0,o.jsxs)(`span`,{className:E.kpiValue,children:[x.reasoningPct.toFixed(1),`%`]}),(0,o.jsx)(`span`,{className:E.kpiDetail,children:W(x.reasoning)})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenIo`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:x.io.toFixed(2)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[W(x.input),` / `,W(x.output)]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenPeak`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:x.peak===void 0?`—`:Ve(x.peak.miss+x.peak.hit+x.peak.output)}),(0,o.jsx)(`span`,{className:E.kpiDetail,children:x.peak?.date??`—`})]})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`tokenDaily`)}),(0,o.jsx)(`span`,{className:E.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.rangeButton,n===e&&E.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]}),C===null?(0,o.jsx)(`div`,{className:E.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:E.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:E.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),children:[[0,.5,1].map(e=>{let t=C.max*e,n=C.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:X.left,x2:680-X.right,y1:n,y2:n,className:E.chartGrid}),(0,o.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:E.chartAxisLabel,children:Ve(t)})]},e)}),y.map((e,t)=>{let n=C.inner(t)-C.barW/2,r=C.y(0),i=C.y(e.miss),a=C.y(e.miss+e.hit),s=C.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:C.barW,height:r-i,fill:Z}),(0,o.jsx)(`rect`,{x:n,y:a,width:C.barW,height:i-a,fill:He}),(0,o.jsx)(`rect`,{x:n,y:s,width:C.barW,height:a-s,fill:Ue})]},e.date)}),C.indices.map(e=>{let t=y[e];return t===void 0?null:(0,o.jsx)(`text`,{x:C.inner(e),y:194,textAnchor:`middle`,className:E.chartAxisLabel,children:t.date.slice(5)},t.date)})]}),(0,o.jsxs)(`div`,{className:E.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:Z}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:He}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:Ue}}),a(`tokenOutput`)]})]})]})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`tokenByModel`)})}),b.length===0?(0,o.jsx)(`div`,{className:E.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:E.tableScroll,children:(0,o.jsxs)(`table`,{className:E.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:E.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:b.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:E.numCol,children:W(e.input)}),(0,o.jsx)(`td`,{className:E.numCol,children:W(e.output)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.reasoning>0?W(e.reasoning):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsxs)(`td`,{className:E.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:E.numCol,children:W(e.total)}),(0,o.jsx)(`td`,{className:E.numCol,children:(0,o.jsxs)(`span`,{className:E.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:E.tokenModelBar,children:(0,o.jsxs)(`span`,{className:E.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:E.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:E.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),S.totalCalls>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:E.tableScroll,children:(0,o.jsxs)(`table`,{className:E.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:E.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...S.top,...S.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelName,children:e})}),(0,o.jsx)(`td`,{className:E.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:E.numCol,children:[(t/S.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),v.length>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`roleCost`)}),(0,o.jsx)(`span`,{className:E.panelHint,children:a(`roleHint`)})]}),(0,o.jsx)(`div`,{className:E.shareTrack,"data-testid":`billing-role-track`,children:v.map(e=>(0,o.jsx)(`div`,{className:l(E.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:E.shareLegend,children:v.map(e=>(0,o.jsxs)(`span`,{className:E.shareItem,children:[(0,o.jsx)(`span`,{className:l(E.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:E.shareValue,children:[s(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function Ke(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function qe(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 Je(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 Ye({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:E.roundsEmpty,children:[i(`model`),` —`]});let u=e=>U(n===`usd`?Ee(e):e,n);return(0,o.jsxs)(`div`,{className:E.rounds,children:[(0,o.jsx)(`div`,{className:E.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=de(e.startedAt)===`peak`;return(0,o.jsxs)(`div`,{className:l(E.roundsBarCol,r?E.roundsBarColPeak:E.roundsBarColOff),children:[(0,o.jsx)(`span`,{className:E.roundsBarLabel,style:{bottom:`${n}%`},children:u(e.cost)}),(0,o.jsx)(`div`,{className:E.roundsBarWrap,children:(0,o.jsx)(`div`,{className:t?E.roundsBarFlagged:E.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${i(`model`)} ${e.model} · ${u(e.cost)} · ${qe(e.startedAt)}${e.endedAt===void 0?``:` → ${Ke(e.endedAt)} (${Je(e.endedAt-e.startedAt)})`}`,children:t&&(0,o.jsx)(`span`,{className:E.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,o.jsxs)(`div`,{className:E.roundsAxis,children:[(0,o.jsxs)(`span`,{children:[i(`costAbbr`),` `,u(c)]}),(0,o.jsxs)(`span`,{children:[a.length,` 轮`]})]})]})}let Xe=[`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)`],Ze=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Qe(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function $e(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:Qe(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:Qe(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=Qe(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 et(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=Qe(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=Qe(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 tt({days:e,currency:t,now:n,t:i,range:a=`month`}){let[s,c]=(0,r.useState)(null),l=e=>U(t===`usd`?Ee(e):e,t),u=(0,r.useMemo)(()=>$e(e,n??new Date),[e,n]);if(a===`year`){let t=et(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:Ze[n-1]??``}),a=n)}),(0,o.jsxs)(`div`,{className:E.heatmapYear,"data-testid":`heatmap-year`,children:[(0,o.jsxs)(`div`,{className:E.heatmapYearBody,children:[(0,o.jsx)(`div`,{className:E.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,o.jsx)(`span`,{className:E.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,o.jsxs)(`div`,{className:E.heatmapYearScroll,children:[(0,o.jsx)(`div`,{className:E.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:r.map(e=>(0,o.jsx)(`span`,{className:E.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,o.jsx)(`div`,{className:E.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:E.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,style:{background:Xe[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`},e.date))})]})]}),(0,o.jsxs)(`div`,{className:E.heatmapFooter,children:[(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:E.heatmapLegend,children:Xe.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapMore`)})]})]})}return(0,o.jsxs)(`div`,{className:E.heatmap,children:[(0,o.jsx)(`div`,{className:E.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,o.jsx)(`div`,{className:E.heatmapCellEmpty,children:e.dayNum},e.date):(0,o.jsx)(`button`,{type:`button`,className:E.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,style:{background:Xe[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:E.heatmapFooter,children:[(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:E.heatmapLegend,children:Xe.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapMore`)}),s!==null&&(0,o.jsxs)(`span`,{className:E.heatmapHover,"data-testid":`heatmap-hover`,children:[s.date,` · `,l(s.value)]})]})]})}let nt={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function rt(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function it(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function at(e,t){let n=t?.window??nt.window,r=t?.threshold??nt.threshold,i=t?.reasonFactor??nt.reasonFactor,a=t?.reasonHitDropPp??nt.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=it(t),p=rt(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=rt(c),r=rt(l),s=rt(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 ot(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function st(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function ct(e){return e.toFixed(2)}function lt(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,ct(n.cost)].join(`,`)})].join(`
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function pt(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 mt(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 ht=`usageBilling`,gt={title:`使用统计`,subtitle:`计费仪表盘`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,totalCost:`总费用`,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:`标题`,project:`项目`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`厂商计费与订阅`,estimated:`估算`,actual:`实际`,pricing:`模型单价表`,showPricing:`查看模型单价`,hidePricing:`收起单价表`,pricePerM:`¥ / 1M tokens`,input:`输入`,output:`输出`,cacheHit:`缓存命中`,peak:`高峰`,offPeak:`低谷`,flat:`全天统一`,peakHours:`高峰时段`,band:`时段`,openDashboard:`打开计费仪表盘`,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:`知道了`,subscriptions:`订阅套餐`,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:`暂无可选的订阅通道。`,floatPrev:`上一张订阅`,floatNext:`下一张订阅`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemove:`删除`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,workspaces:`工作区统计`,workspacesHint:`点击行下钻项目成本前 5 会话`,plan:`套餐`,remaining:`剩余`,unknownModel:`未定价`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,currentRound:`当前`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabDetails:`统计`,tabPricing:`费率`,tabSettings:`设置`,settingsHead:`偏好设置`,settingsHint:`管理与计费相关的偏好`,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:`按模型与按小时聚合;估算样本为工具续写步骤`,heatmapYear:`年`,heatmapMonth:`月`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginInfo:`插件信息`,pluginName:`插件名`,pluginDescription:`描述`,pluginVersion:`版本`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenCacheHitRate:`缓存命中率`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,tokenTotal:`总 Token`,tokenShare:`占比`,usageStatsTool:`注入用量查询工具`,usageStatsToolHint:`让模型可在对话中查询用量/费用;会占用模型每次请求的上下文,coding 场景建议关闭(改后需重载应用生效)`,balanceGranted:`赠金余额`,balanceTopped:`充值余额`,balanceDaily:`日均消耗`,balanceDaysLong:`约可撑`,balanceDaysUnit:`天`,popTodayModel:`主力消耗模型余额`,popTitle:`用量速览`,popNoConsumption:`暂无消耗`,popQuotaAlert:`额度提醒`,popRiskNone:`余额与配额正常`,popDirectLead:`直联`,popSubLead:`订阅`,popBalanceNormal:`余额正常`,popBalanceLow:`余额不足`,popQuotaNormal:`配额正常`,popQuotaLow:`配额将尽`,alertBalanceLow:`{name} 余额不足`,alertQuotaLow:`{name} 配额将尽`,unpricedHint:`{count} 个模型未收录计价,费用已按 0 计`,searchEstimateHint:`含 {count} 次联网搜索请求的估算费用(每次约 {each};日志无用量事件,按次估算,可在配置 searchCallEstimateCny 调整或关闭)`,siteListDisplay:`中转站列表`,siteListDisplayHint:`隐藏「未知路由 / 未识别」占位条目,净化中转站分布与额度列表`,exportCsvSite:`按站点 CSV`,panelRelay:`中转站分布`,relaySite:`中转站`,relayDirect:`直连`,relayUnknown:`未知路由`,panelRelayQuota:`中转站额度`,relayBalance:`余额`,relayNoQuota:`未读出额度`,relayWindowUsed:`已用`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`未识别`,relayCalls:`调用`},_t={title:`Usage`,subtitle:`Billing dashboard`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,liveTurn:`Turn`,liveSession:`Session`,totalCost:`Total`,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`,project:`Project`,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`,estimated:`Est.`,actual:`Actual`,pricing:`Model pricing`,showPricing:`View pricing`,hidePricing:`Hide pricing`,pricePerM:`¥ / 1M tokens`,input:`Input`,output:`Output`,cacheHit:`Cache hit`,peak:`Peak`,offPeak:`Off-peak`,flat:`Flat`,peakHours:`Peak hours`,band:`Band`,openDashboard:`Open billing dashboard`,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`,subscriptions:`Subscriptions`,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.`,floatPrev:`Previous subscription`,floatNext:`Next subscription`,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. Leave source empty for the model default, or enter a relay origin to price only that source.`,userPriceSave:`Save`,userPriceModel:`Model`,userPriceSource:`Source (relay origin)`,userPriceSourceHint:`Empty = default; e.g. https://api.relay.com`,userPriceCurrency:`Currency`,userPriceAdd:`Add`,userPriceRemove:`Remove`,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`,workspaces:`Workspaces`,workspacesHint:`Click a row to drill into its top-5 sessions`,plan:`Plan`,remaining:`Left`,unknownModel:`Unpriced`,model:`Model`,thModel:`Model name`,thInputMiss:`Input (cache miss)`,thInputHit:`Input (cache hit)`,currentRound:`current`,costAbbr:`cost`,tabOverview:`Overview`,tabTrends:`Trends`,tabProviders:`Bills`,tabDetails:`Stats`,tabPricing:`Rates`,tabSettings:`Settings`,settingsHead:`Preferences`,settingsHint:`Manage billing-related preferences`,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`,heatmapYear:`Year`,heatmapMonth:`Month`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginInfo:`Plugin info`,pluginName:`Name`,pluginDescription:`Description`,pluginVersion:`Version`,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`,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`,popQuotaAlert:`Quota alerts`,popRiskNone:`Balances & quotas OK`,popDirectLead:`Direct`,popSubLead:`Subscription`,popBalanceNormal:`balance ok`,popBalanceLow:`balance low`,popQuotaNormal:`quota ok`,popQuotaLow:`quota low`,alertBalanceLow:`{name} balance low`,alertQuotaLow:`{name} quota low`,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 "unknown route / unidentified" placeholder rows in relay distribution and quota lists`,exportCsvSite:`By site CSV`,panelRelay:`Relay sites`,relaySite:`Relay`,relayDirect:`Direct`,relayUnknown:`Unknown route`,panelRelayQuota:`Relay quota`,relayBalance:`Balance`,relayNoQuota:`No quota`,relayWindowUsed:`used`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`Unknown`,relayCalls:`calls`},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 yt(e,t){return t===`en`?vt[e]??e:e}let bt={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 xt(e){return bt[e]}let St=`dsh-billing-peak-alert-v1`,Ct={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function wt(){try{let e=localStorage.getItem(St);if(e===null)return{...Ct};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:Ct.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))):Ct.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...Ct}}}function Tt(e){try{localStorage.setItem(St,JSON.stringify(e))}catch{}}function Et(e,t,n){if(!t.enabled)return null;let r=ge(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 Dt({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)),u=e.entering,d=n(u===`peak`?`tierPeak`:`tierOff`),f=n(u===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),p=u===`peak`;return(0,o.jsxs)(`div`,{className:l(E.peakCard,p?E.peakCardPeak:E.peakCardOff,t.position===`center`?E.peakCardCenter:E.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:E.peakHead,children:[(0,o.jsxs)(`span`,{className:l(E.peakTag,p?E.peakTagPrimary:E.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:l(E.peakDot,p?E.peakDotPrimary:E.peakDotSuccess),"aria-hidden":`true`}),d]}),(0,o.jsx)(`button`,{type:`button`,className:E.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:l(E.peakCount,p?E.peakCountPrimary:E.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:E.peakDesc,children:f})]})}let Ot=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}];function kt(e){if(e!==void 0)return e.split(/[\\/]/).filter(Boolean).pop()??e}let At=[50,80,100],jt={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},Mt={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 Nt(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 Pt(e,t){let n=Q(e),r=Q(t);if(Nt(n,r))return!0;let i=Mt[e];return i!==void 0&&i.some(e=>Nt(Q(e),r))}function Ft(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(Mt))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(Mt))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let It={"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 Lt(e){let t=It[e];return t===void 0?Ft(e)??e:t}function Rt(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 zt(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)),[i,a]=t.split(`-`).map(Number),o=new Date(i,a,0).getDate(),s=r.length>0?r.reduce((t,n)=>t+(e[n]?.cost??0),0)/r.length:Rt(e,n);return s<=0?0:s*o}function Bt(e){let t=M();if(t===void 0||e.byDayModels===void 0)return e;let n=le().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||L(t.key)===L(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=(t.cacheMiss*e.input+i*e.cacheHit+t.output*e.output)/1e6;return e.currency===`USD`?a*n:a};for(let[t,n]of Object.entries(e.byDayModels)){let u=0,d={};for(let[i,a]of Object.entries(n)){let n=oe(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:oe(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=>!oe(e))}}function Vt(){return typeof Notification<`u`&&Notification.permission===`granted`}let Ht=new Set;function Ut(e,t){Ht.has(e)||(Ht.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 Wt(e){return Object.keys(e).length}function Gt(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 Kt(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 qt(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 Jt(e,t){return e.checked?e.okProviders.some(e=>Pt(t,e))?E.healthOk:e.badProviders.some(e=>Pt(t,e))?E.healthBad:E.healthIdle:E.healthIdle}function Yt(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 Xt(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 Zt(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 Qt(e,t){return e.startsWith(`site:`)?{name:e.slice(5),kind:`site`}:e.startsWith(`direct:`)?{name:e.slice(7),kind:`direct`}:{name:t(`relayUnknown`),kind:`unknown`}}function $t(e,t){switch(e){case`site`:return t(`relaySite`);case`direct`:return t(`relayDirect`);default:return t(`relayUnknown`)}}function en(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let tn={site:E.siteKindSite,direct:E.siteKindDirect,unknown:E.siteKindUnknown},nn={"new-api":E.siteKindSite,sub2api:E.siteKindDirect,unknown:E.siteKindUnknown},rn=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 an(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let on=[`#3b82f6`,`#06b6d4`,`#8b5cf6`,`#f59e0b`,`#10b981`,`#ef4444`,`#ec4899`,`#6366f1`,`#f97316`,`#14b8a6`],sn={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function cn(){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??sn.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.byHour!==null&&typeof r.perf.byHour==`object`?{perf:r.perf}:{},...typeof r.pluginVersion==`string`?{pluginVersion:r.pluginVersion}:{}}}catch{return null}}let ln=!1;async function un(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){ln=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){ln=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(ln)return;ln=!0}setTimeout(()=>{un(e+1)},2e3);return}ln=!1,P(i)}catch{ln=!1}}async function dn(){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 fn(){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 pn(){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 mn(){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 hn(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}}function gn(e){let{wide:t,t:n,onOpen:a,monthCost:s,todayCost:c,weekCost:u,days:d,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]),[x,S]=(0,r.useState)(0),C=b.length===0?0:Math.min(x,b.length-1),w=b[C];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||b.length<2)return;let e=setInterval(()=>S(e=>(e+1)%b.length),1500);return()=>clearInterval(e)},[m.mode,b.length]);let T=(0,r.useRef)(null),[D,ee]=(0,r.useState)(!1),[te,ne]=(0,r.useState)({left:0,top:0,width:0}),O=(0,r.useRef)(void 0),k=(0,r.useCallback)(()=>{window.clearTimeout(O.current),ee(!0)},[]),re=(0,r.useCallback)(()=>{window.clearTimeout(O.current),O.current=window.setTimeout(()=>ee(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(O.current),[]);let A=(0,r.useCallback)(()=>{let e=T.current?.getBoundingClientRect();e!==void 0&&ne({left:e.left,top:e.top-8,width:e.width})},[]);(0,r.useEffect)(()=>{if(!D)return;let e=()=>A();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[D,A]);let ie=(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:E.railButton,"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${U(s)}`,children:ie});let j=g.metric===`tokens`,ae=d.map(e=>j?e.tokens:e.cost),M=Math.max(...ae,0),N=ae.map(e=>M>0?4+e/M*12:4);return(0,o.jsxs)(`span`,{ref:T,className:E.triggerWrap,onMouseEnter:()=>{A(),k()},onMouseLeave:re,onFocusCapture:()=>{A(),k()},onBlurCapture:()=>ee(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:E.trigger,"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${U(s)}`,children:[(0,o.jsx)(`span`,{className:E.triggerIcon,"data-testid":`billing-trigger-icon`,children:ie}),(0,o.jsxs)(`span`,{className:E.triggerMain,children:[(0,o.jsxs)(`span`,{className:E.triggerPrimary,children:[(0,o.jsx)(`span`,{className:E.triggerLabel,children:n(j?`triggerMonthTokens`:`triggerMonth`)}),j?(0,o.jsx)(`span`,{className:E.triggerMetric,"data-testid":`billing-trigger-month-tokens`,children:W(_)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:E.triggerYen,"aria-hidden":`true`,children:U(s).charAt(0)}),(0,o.jsx)(`span`,{className:E.triggerMetric,children:U(s).slice(1)})]})]}),(0,o.jsx)(`span`,{className:E.triggerSub,"data-testid":`billing-trigger-today`,children:j?`${n(`triggerToday`)} ${W(v)} · ${n(`weekCost`)} ${W(y)}`:`${n(`triggerToday`)} ${U(c)} · ${n(`weekCost`)} ${U(u)}`})]}),(0,o.jsx)(`span`,{className:E.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:N.map((e,t)=>(0,o.jsx)(`span`,{className:t===N.length-1?E.triggerSparkHot:E.triggerSparkBar,style:{height:`${e}px`}},d[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:l(E.triggerPop,D&&E.triggerPopShown,m.mode===`subscription`&&E.triggerPopSubscription),style:{left:`${te.left}px`,top:`${te.top}px`,width:`${te.width}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!D,onMouseEnter:k,onMouseLeave:re,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:b.length===0?(0,o.jsx)(`span`,{className:E.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[w!==void 0&&(0,o.jsxs)(`div`,{className:E.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:E.floatSubHead,children:[(0,o.jsx)(`span`,{className:E.floatSubName,children:w.displayName}),w.plan!==void 0&&(0,o.jsx)(`span`,{className:E.floatSubPlan,children:w.plan})]}),w.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:E.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:E.subscriptionWindowLabel,children:Zt(e.kind,n)}),(0,o.jsx)(`span`,{className:E.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(E.subscriptionFill,t>=100&&E.subscriptionFillOver,t>=80&&t<100&&E.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:E.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(E.subscriptionPct,r&&E.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${an(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),b.length>1&&(0,o.jsx)(`span`,{className:E.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:E.triggerPopSwitchCount,children:[C+1,`/`,b.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:E.popHead,children:(0,o.jsx)(`span`,{className:E.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:E.metricGrid,children:[(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`monthCost`)}),(0,o.jsx)(`span`,{className:l(E.metricValue,E.metricValuePrimary),children:U(s)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`tokenTotal`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:W(p.totalToken)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:W(p.input)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:W(p.output)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:l(E.metricValue,E.metricValueSuccess),children:W(p.cacheRead)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`calls`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:p.calls.toLocaleString()})]})]}),(0,o.jsxs)(`span`,{className:E.popModel,children:[(0,o.jsx)(`span`,{className:E.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:E.popModelRow,children:[(0,o.jsx)(`span`,{className:l(E.popDot,E.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:E.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:l(E.popModelStatus,f.direct.low&&E.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:E.popModelRow,children:[(0,o.jsx)(`span`,{className:l(E.popDot,E.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:E.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:l(E.popModelStatus,f.sub.low&&E.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:E.popModelRow,children:[(0,o.jsx)(`span`,{className:l(E.popDot,E.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function _n({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:E.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:E.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:E.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:E.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:E.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(vn,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(vn,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(vn,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(vn,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(vn,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function vn({label:e,value:t}){return(0,o.jsxs)(`span`,{className:E.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:E.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:E.balanceDetailValue,children:t})]})}function yn({userPrices:e,onUserPrices:t,t:n}){let[i,a]=(0,r.useState)(()=>[...e]),s=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),c=e=>a(t=>t.filter((t,n)=>n!==e)),u=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),d=()=>t(i.filter(e=>e.key.trim()!==``)),f=(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})),p=e=>Number.isFinite(e)&&e!==0?String(e):``,m=(e,t,n)=>{let r=Number(n);s(e,{[t]:Number.isFinite(r)&&r>=0?r:0})};return(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:E.setCardHead,children:(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:E.ctlCol,children:[i.map((e,t)=>(0,o.jsxs)(`div`,{className:E.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:E.userPriceInput,"data-testid":`billing-user-price-model`,type:`text`,value:e.key,placeholder:`flash`,"aria-label":n(`userPriceModel`),onChange:e=>s(t,{key:e.target.value})})]}),(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:E.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>s(t,{origin:e.target.value.trim()})})]}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}),(0,o.jsx)(`input`,{className:E.userPriceInputNum,type:`number`,min:0,step:.01,value:p(e[r]),onChange:e=>m(t,r,e.target.value)})]},r)),(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:E.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,e.currency!==`USD`&&E.floatModeBtnOn),onClick:()=>f(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,e.currency===`USD`&&E.floatModeBtnOn),onClick:()=>f(t,`USD`),children:`USD`})]})]}),(0,o.jsx)(`button`,{type:`button`,className:E.userPriceRemove,"aria-label":n(`userPriceRemove`),onClick:()=>c(t),children:n(`userPriceRemove`)})]},t)),(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-user-price-add`,onClick:u,children:n(`userPriceAdd`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-user-price-save`,onClick:d,children:n(`userPriceSave`)})]})]})]})}function bn({stats:e,t,onClose:n,userPrices:i,onUserPrices:s,health:c,balances:u,reconcile:d,quotas:f,relayQuotas:p,currency:m,onCurrency:h,turns:g,renderSlot:_,budgetEnabled:v,budgetAmount:y,onToggleBudget:b,onBudgetAmount:x,peakConfig:S,onPeakConfig:C,onPreviewPeak:w,floatPrefs:T,onFloatPrefs:D,cardPrefs:ee,onCardPrefs:te,sitePrefs:O,onSitePrefs:k,quotasStale:re}){let[A,ie]=(0,r.useState)(`cost`),{total:j,byModel:ae,byDay:M}=e,[N,oe]=(0,r.useState)(`overview`),[P,se]=(0,r.useState)(7),[ce,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,F]=(0,r.useState)(),[_e,ve]=(0,r.useState)(),[ye,I]=(0,r.useState)(new Set),L=(0,r.useCallback)(e=>{I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[R,z]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return mn().then(t=>{e&&t!==void 0&&z(t)}),()=>{e=!1}},[]);let be=(0,r.useCallback)(()=>{let e=!R;z(e),hn(e).then(t=>{t||z(!e)})},[R]),B=le(),V=e=>U(m===`usd`?Ee(e):e,m),H=m===`usd`?`en`:`zh`,G=e=>yt(e,H),K=(e,n)=>e===0?t(`free`):De(Oe(e,n,m,B.rate),m===`usd`?`USD`:`CNY`),Ae=(0,r.useMemo)(()=>at([...g].reverse()),[g]),q={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},je=q.peak/2,J=Rt(M,$()),Ne=e=>u.find(t=>Q(t.provider)===Q(e)),Pe=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),Fe=e=>{if(e===void 0)return(0,o.jsx)(`span`,{className:E.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:E.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:V(e.totalBalance),r=e.currency===`USD`?e.totalBalance*B.rate:e.totalBalance,i=J>0?Math.floor(r/J):void 0;return(0,o.jsxs)(`span`,{className:E.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:l(E.balanceDaysBadge,i<=3&&E.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:()=>{F(ge===e.provider?void 0:e.provider)},children:`?`}),ge===e.provider&&(0,o.jsx)(_n,{balance:e,days:i??0,dailyBurn:J,money:V,t,onClose:()=>{F(void 0)}})]})},Ie=j.cacheHit+j.cacheMiss>0?j.cacheHit/(j.cacheHit+j.cacheMiss)*100:0,Re=Object.keys(M).sort(),Y=$(),Be=M[Y]?.cost??0,Ve=Y.slice(0,7),X=Y.slice(0,4),Z=Re.reduce((e,t)=>e+(t.startsWith(Ve)?M[t]?.cost??0:0),0),He=Re.reduce((e,t)=>e+(t.startsWith(X)?M[t]?.cost??0:0),0),Ue=(0,r.useMemo)(()=>zt(M,Ve,Y)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[M,Ve,Y,f]),We=(0,r.useMemo)(()=>{let e=v&&y>0?Z/y*100:NaN;return{pct:Number.isFinite(e)?Math.max(0,Math.min(100,e)):He>0?Math.max(0,Math.min(100,Z/He*100)):0,over:Number.isFinite(e)&&e>=100,label:t(Number.isFinite(e)?`budget`:`monthCost`)}},[v,y,Z,He,t]),Ke=v&&y>0?Z/y*100:0,qe=(0,r.useMemo)(()=>{let e=[];for(let t=P-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push($(n.getTime()))}return e},[P]),Je=qe.at(-1)??Y,Xe=(0,r.useMemo)(()=>Object.entries(M).map(([e,t])=>({date:e,value:t.cost})),[M]),Ze=Wt(M),Qe=Gt(M),$e=(0,r.useMemo)(()=>qe.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=M[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}}),[qe,M,e.byDayModels]),et=(0,r.useMemo)(()=>Object.entries(ae).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=xe(e),r=n.key===`other`,i=r?Ft(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:Te(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:on[t%on.length]??`#8b95a3`})),[ae]),nt=(0,r.useMemo)(()=>Object.entries(e.bySite??{}).filter(([e])=>!(O.hideUnidentified&&e===`unknown`)).sort((e,t)=>(t[1].cost??0)-(e[1].cost??0)),[e.bySite,O.hideUnidentified]),rt=(0,r.useMemo)(()=>O.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,O.hideUnidentified]),it=(0,r.useMemo)(()=>{let e=new Map;for(let t of f){if(t.status===`not-configured`)continue;let n=Lt(t.provider),r=e.get(n);r===void 0?e.set(n,[t]):r.push(t)}let t=new Map,n=new Map;for(let t of e.keys())n.set(Q(t),t);for(let e of et){let r=e.provider;if(e.plan===!0){let t=Ft(e.key);t!==void 0&&(r=t)}let i=n.get(Q(r))??r,a=t.get(i);a===void 0?t.set(i,[e]):a.push(e)}let r=[...new Set([...t.keys(),...e.keys()])].map(n=>({name:n,models:t.get(n)??[],subscriptions:e.get(n)??[],balance:Ne(n),dot:Jt(c,n)})),i=new Set(r.map(e=>Q(e.name)));for(let e of u)i.has(Q(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&r.push({name:e.displayName,models:[],subscriptions:[],balance:e,dot:Jt(c,e.displayName)});return r.sort((e,t)=>{let n=e=>e.models.reduce((e,t)=>e+(t.actual??t.estimated),0),r=n(t)-n(e);return r===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`):r})},[et,f,u,c]),ot=et.reduce((e,t)=>e+t.estimated,0),st=j.cost>0?j.cost:ot,ct=j.calls>0?st/j.calls:0,dt=(0,r.useMemo)(()=>et.map(e=>({key:e.key,name:e.name,color:e.color})),[et]),ht=$e.length>=2?$e.at(-2)?.cost??0:0,gt=ht>0?(Be-ht)/ht*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:l(E.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:E.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:E.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:E.headTitleRow,children:[(0,o.jsx)(`h2`,{className:E.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:E.dashboardSubtitle,children:[t(`lastUpdated`),` `,Je,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:E.dashboardRight,children:[(0,o.jsx)(`span`,{className:E.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.currencyButton,m===e&&E.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:l(E.healthBadge,c.available?E.healthBadgeOk:E.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:l(E.healthDot,c.available?E.healthOk:E.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:E.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:E.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:Ot.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":N===e.id,className:l(E.tabButton,N===e.id&&E.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{oe(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:E.dashboardBody,children:[N===`overview`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[d?.kind===`drift`&&d.spent!==void 0&&ce!==de()&&(0,o.jsxs)(`div`,{className:E.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:E.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:E.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,d.provider??``).replace(`{spent}`,V(d.spent)).replace(`{today}`,V(d.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:E.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:fe,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:E.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:E.heroTop,children:[(0,o.jsxs)(`div`,{className:E.heroMain,children:[(0,o.jsx)(`span`,{className:E.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:E.heroReadout,children:[(0,o.jsx)(`span`,{className:E.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:E.heroValue,children:V(Z).slice(1)})]}),(0,o.jsxs)(`span`,{className:E.heroMeta,children:[j.calls.toLocaleString(),` `,t(`calls`)]})]}),(0,o.jsxs)(`div`,{className:E.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`svg`,{className:E.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:E.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:l(E.heroGaugeArc,We.over&&E.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${We.pct/100*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:E.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:l(E.heroGaugePct,We.over&&E.heroGaugePctOver),children:[We.pct.toFixed(0),`%`]}),(0,o.jsx)(`span`,{className:E.heroGaugeLabel,children:We.label})]})]})]}),v&&y>0&&(0,o.jsxs)(`div`,{className:E.heroBudget,"data-testid":`billing-hero-budget`,children:[(0,o.jsx)(`span`,{className:E.heroBudgetLabel,children:t(`budget`)}),(0,o.jsx)(`div`,{className:E.heroBudgetTrack,role:`progressbar`,"aria-valuenow":Math.min(Ke,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),children:(0,o.jsx)(`div`,{className:l(E.heroBudgetFill,Ke>=100&&E.heroBudgetFillOver),style:{width:`${Math.min(Ke,100)}%`}})}),(0,o.jsxs)(`span`,{className:E.heroBudgetValue,children:[V(Z),` / `,V(y),` · `,Ke.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:E.heroSide,children:[(0,o.jsxs)(`div`,{className:E.heroSideItem,children:[(0,o.jsx)(`span`,{className:E.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:E.heroSideValue,children:V(He)})]}),(0,o.jsxs)(`div`,{className:E.heroSideItem,children:[(0,o.jsx)(`span`,{className:E.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:E.heroSideValue,children:[V(Be),(0,o.jsxs)(`span`,{className:l(E.delta,gt>=0?E.deltaUp:E.deltaDown),children:[gt>=0?`▲`:`▼`,` `,Math.abs(gt).toFixed(1),`%`]})]})]}),Ue>0&&(0,o.jsxs)(`div`,{className:E.heroSideItem,children:[(0,o.jsx)(`span`,{className:E.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:E.heroSideValue,children:V(Ue)})]}),Ue<=0&&(0,o.jsx)(`span`,{className:E.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:E.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:E.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,V(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`section`,{className:E.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:E.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:l(E.kpiValue,E.kpiGreen),children:ke(Ie)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[W(j.cacheHit),` / `,W(j.cacheHit+j.cacheMiss)]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:W(j.input+j.output)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[t(`inputTokens`),` `,W(j.input),` · `,t(`outputTokens`),` `,W(j.output)]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:V(ct)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[t(`calls`),` `,j.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:j.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[et.length,` `,t(`models`)]})]})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:E.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`year`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.heatmapRangeButton,pe===e&&E.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:E.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,Ze,` · `,t(`streakDays`),` `,Qe]})]}),(0,o.jsx)(tt,{days:Xe,currency:m,t,range:pe})]})]}),N===`settings`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:E.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:l(E.switch,v&&E.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:E.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:E.ctlCol,children:[(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:E.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:E.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:E.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=>{x(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=Z/y*100;return(0,o.jsx)(`div`,{className:E.ctlRowStretch,children:(0,o.jsx)(`div`,{className:E.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:l(E.progFill,e>=100&&E.budgetFillOver,e>=80&&e<100&&E.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:E.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,V(Z)).replace(`{total}`,V(y))})]})]}),(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":S.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:l(E.switch,S.enabled&&E.switchOn),onClick:()=>{C({...S,enabled:!S.enabled})},children:(0,o.jsx)(`span`,{className:E.switchKnob})})]}),S.enabled&&(0,o.jsxs)(`div`,{className:E.ctlCol,children:[(0,o.jsxs)(`label`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:E.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:S.leadMin,className:E.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);C({...S,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):S.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:E.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:E.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:S.position===e,onChange:()=>C({...S,position:e})}),(0,o.jsx)(`span`,{className:E.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:E.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:E.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:S.mode===e,onChange:()=>C({...S,mode:e})}),(0,o.jsx)(`span`,{className:E.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:S.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{C({...S,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:E.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:E.btn,onClick:w,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:E.setCard,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":R,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:l(E.switch,R&&E.switchOn),onClick:be,children:(0,o.jsx)(`span`,{className:E.switchKnob})})]})}),(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:E.setCardHead,children:(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:E.ctlCol,children:[(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:E.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,T.mode===`combined`&&E.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>D({mode:`combined`,targets:T.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,T.mode===`subscription`&&E.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>D({mode:`subscription`,targets:T.targets}),children:t(`floatModeSubscription`)})]})]}),T.mode===`subscription`&&(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:E.ctlGroup,"data-testid":`billing-float-targets`,children:[he.map(e=>{let t=T.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:E.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>D({mode:`subscription`,targets:t?T.targets.filter(t=>t!==e.id):[...T.targets,e.id]})}),(0,o.jsx)(`span`,{className:E.floatTargetLabel,children:e.label})]},e.id)}),he.length===0&&(0,o.jsx)(`span`,{className:E.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:E.setCardHead,children:(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsx)(`div`,{className:E.ctlCol,children:(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:E.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,ee.metric===`money`&&E.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>te({metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,ee.metric===`tokens`&&E.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>te({metric:`tokens`}),children:t(`cardMetricTokens`)})]})]})})]}),(0,o.jsx)(`section`,{className:E.setCard,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:E.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:l(E.switch,O.hideUnidentified&&E.switchOn),onClick:()=>k({hideUnidentified:!O.hideUnidentified}),children:(0,o.jsx)(`span`,{className:E.switchKnob})})]})}),(0,o.jsx)(yn,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(ze,{t,version:e.pluginVersion})]}),N===`trends`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:l(E.ubCard,E.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:E.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:E.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.rangeButton,P===e&&E.rangeButtonActive),"aria-pressed":P===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{se(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,o.jsx)(`span`,{className:E.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.rangeButton,A===e&&E.rangeButtonActive),"aria-pressed":A===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{ie(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:E.ubCardSub,children:Je})]}),(0,o.jsx)(Me,{data:$e,models:dt,currency:m,metric:A})]}),g.length>0&&(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`rounds`)}),Ae.length>0&&(0,o.jsxs)(`span`,{className:E.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[Ae.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:E.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(Ye,{rounds:g,flags:Ae,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=q.peak+q.offPeak;if(e<=0)return null;let n=q.peak/e*100;return(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:E.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:E.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:l(E.shareSeg,E.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:l(E.shareSeg,E.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:E.shareLegend,children:[(0,o.jsxs)(`span`,{className:E.shareItem,children:[(0,o.jsx)(`span`,{className:E.shareDot,style:{background:`var(--dsw-static-blue-500)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:E.shareValue,"data-testid":`billing-share-peak`,children:[V(q.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:E.shareItem,children:[(0,o.jsx)(`span`,{className:E.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:E.shareValue,"data-testid":`billing-share-offpeak`,children:[V(q.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),je>0&&(0,o.jsx)(`div`,{className:E.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,V(je))})]})})()]}),N===`providers`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[nt.length>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-relay-sites`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`panelRelay`)})}),(0,o.jsx)(`div`,{className:E.providerGroupList,"data-testid":`billing-relay-sites`,children:nt.map(([e,n])=>{let r=Qt(e,t);return(0,o.jsxs)(`div`,{className:E.siteRow,"data-testid":`billing-relay-site`,children:[(0,o.jsxs)(`span`,{className:E.siteRowName,children:[(0,o.jsx)(`span`,{className:l(E.siteKindTag,tn[r.kind]),children:$t(r.kind,t)}),(0,o.jsx)(`span`,{className:E.siteRowTitle,children:r.name})]}),(0,o.jsxs)(`span`,{className:E.siteRowMeta,children:[(0,o.jsx)(`span`,{className:E.siteRowCost,children:V(n.cost)}),(0,o.jsxs)(`span`,{className:E.siteRowCalls,children:[n.calls,` `,t(`relayCalls`)]})]})]},e)})})]}),rt.length>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:E.providerGroupList,"data-testid":`billing-relay-quotas`,children:rt.map(e=>(0,o.jsxs)(`div`,{className:E.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:E.siteRowName,children:[(0,o.jsx)(`span`,{className:l(E.siteKindTag,nn[e.kind]),children:en(e.kind,t)}),(0,o.jsx)(`span`,{className:E.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:E.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:E.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:l(E.siteRowCalls,n&&E.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:E.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:E.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${an(e.updatedAt)}`})]}),re&&(0,o.jsx)(`div`,{className:E.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),it.length===0?(0,o.jsx)(`div`,{className:E.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:E.providerGroupList,"data-testid":`billing-provider-groups`,children:it.map(e=>(0,o.jsxs)(`div`,{className:E.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:E.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:E.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:l(E.healthDot,e.dot),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.providerGroupName,children:G(e.name)})]}),(0,o.jsxs)(`span`,{className:E.providerGroupMeta,children:[e.subscriptions.length>0&&(0,o.jsxs)(`span`,{className:E.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` 套餐`]}),!Pe(e)&&e.balance!==void 0&&(0,o.jsxs)(`span`,{className:E.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:E.providerGroupBalanceLabel,children:t(`balance`)}),Fe(e.balance)]})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:l(E.tableScroll,E.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:E.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`actual`)})]})}),(0,o.jsx)(`tbody`,{children:e.models.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:E.modelCell,children:[(0,o.jsx)(xn,{provider:e.provider,colorVar:e.color}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:E.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:E.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:E.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:E.modelProvider,children:G(e.provider)})]})]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:E.numCol,children:W(e.input)}),(0,o.jsx)(`td`,{className:E.numCol,children:W(e.output)}),(0,o.jsx)(`td`,{className:E.numCol,children:ke(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.plan?(0,o.jsx)(`span`,{className:E.planTag,children:t(`subscriptionIncluded`)}):e.actual===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:E.bucketCost,children:[(0,o.jsx)(`span`,{className:E.bucketOfficial,children:V(t)}),(0,o.jsx)(`span`,{className:E.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:E.bucketThird,children:V(n)})]}):V(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:E.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=Xt(e.status,t);return(0,o.jsxs)(`div`,{className:E.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:E.subscriptionHead,children:[(0,o.jsx)(`span`,{className:E.subscriptionName,children:G(e.displayName)}),e.planType===`code`&&(()=>{let n=ne(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:E.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,V(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:E.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:E.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:E.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:E.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:E.subscriptionWindowLabel,children:Zt(e.kind,t)}),(0,o.jsx)(`span`,{className:E.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(E.subscriptionFill,n>=100&&E.subscriptionFillOver,n>=80&&n<100&&E.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:E.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(E.subscriptionPct,r&&E.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${an(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:E.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:E.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-day`,onClick:()=>{mt(pt(`usage-daily`,`csv`,Object.keys(M)),lt(M),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{mt(pt(`usage-sessions`,`csv`,Object.keys(M)),ft(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{mt(pt(`usage-sites`,`csv`,Object.keys(M)),ut(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-json`,onClick:()=>{mt(pt(`usage-stats`,`json`,Object.keys(M)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:E.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:E.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:E.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:E.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`sessionTitle`)}),(0,o.jsx)(`th`,{children:t(`project`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`lastActive`)})]})}),(0,o.jsxs)(`tbody`,{children:[e.bySession.length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:5,className:E.emptyRow,children:t(`noData`)})}),Yt(e.bySession).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&ye.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelProvider,children:kt(e.cwd)??`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:E.numCol,children:V(e.cost)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${an(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?E.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{L(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:E.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:l(E.ubTag,E.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:E.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),N===`token`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(Ge,{stats:e,trendDays:P,onTrendDays:se,models:dt,money:V,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:E.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(Le,{perf:e.perf,models:dt,t})]})]}),N===`pricing`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:E.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:E.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:E.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,U(B.rate)]}),(0,o.jsx)(`span`,{className:l(E.ubTag,B.live?E.ubTagSuccess:E.ubTagNeutral),children:B.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:E.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:E.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:E.ubTablewrap,children:(0,o.jsxs)(`table`,{className:E.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:Ce().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:E.ubModel,children:[(0,o.jsx)(xn,{provider:e.provider,colorVar:we(e.colorVar)}),(0,o.jsxs)(`span`,{className:E.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:E.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Se(e.promo,Date.now())&&(0,o.jsx)(`span`,{className:E.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:E.numCol,children:n?K(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:n?K(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:n?K(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(`span`,{className:E.ubPricepair,children:[(0,o.jsxs)(`span`,{className:E.ubChipPeak,children:[(0,o.jsx)(`span`,{className:E.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:E.num,children:[K(e.price.input,e.price.currency),` / `,K(e.price.output,e.price.currency)]})]}),(0,o.jsxs)(`span`,{className:E.ubChipOff,children:[(0,o.jsx)(`span`,{className:E.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:E.num,children:[K(e.price.offPeak.input,e.price.currency),` / `,K(e.price.offPeak.output,e.price.currency)]})]})]}):n?(0,o.jsx)(`span`,{className:E.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:E.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:E.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:E.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:E.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:E.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):K(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:E.numCol,children:(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):K(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:E.numCol,children:(0,o.jsx)(`span`,{className:E.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:E.ubCard,children:[(0,o.jsx)(`div`,{className:E.ubCardHead,children:(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:E.ubNotes,children:[(0,o.jsxs)(`li`,{className:E.ubNotesItem,children:[(0,o.jsx)(`span`,{className:E.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:E.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:E.ubNotesItem,children:[(0,o.jsx)(`span`,{className:E.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:E.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:E.ubNotesItem,children:[(0,o.jsx)(`span`,{className:E.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:E.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:E.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 xn({provider:e,colorVar:t}){let n=xt(e);return n===void 0?(0,o.jsx)(`span`,{className:E.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()}):(0,o.jsx)(`img`,{className:E.vendorLogo,src:n,alt:``,"aria-hidden":`true`})}function Sn(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(sn),[m,h]=(0,r.useState)(jt),[v,y]=(0,r.useState)([]),[S,T]=(0,r.useState)(void 0),[E,D]=(0,r.useState)([]),[ee,te]=(0,r.useState)(!1),[ne,O]=(0,r.useState)([]),[k,re]=(0,r.useState)(`cny`),[A,ie]=(0,r.useState)(()=>f()),j=(0,r.useCallback)(e=>{ie(e),p(e)},[]),[M,N]=(0,r.useState)(()=>b()),oe=(0,r.useCallback)(e=>{N(e),x(e)},[]),[P,ce]=(0,r.useState)(()=>g()),ue=(0,r.useCallback)(e=>{ce(e),_(e)},[]),[fe,pe]=(0,r.useState)(()=>{let e=C();return ae(e),e}),me=(0,r.useCallback)(e=>{pe(e),ae(e),w(e)},[]),he=(0,r.useMemo)(()=>Bt(u),[u,fe]),ge=k===`usd`?`en`:`zh`,F=(0,r.useCallback)((e,n)=>{let r=(ge===`en`?_t:gt)[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},[ge,t]),[_e,ve]=(0,r.useState)(!1),ye=(0,r.useCallback)(()=>{ve(!1)},[]),I=(0,r.useCallback)(()=>{cn().then(e=>{e!==null&&d(Bt(e))}),dn().then(({balances:e,reconcile:t})=>{e.length>0&&y(e),T(t)}),fn().then(e=>{e.length>0&&D(e),te(!1)}).catch(()=>{te(!0)}),pn().then(e=>{O(e)}).catch(()=>{})},[]),L=(0,r.useCallback)(()=>{I(),un(),ve(!0)},[I]);(0,r.useEffect)(()=>{I(),un()},[I]),(0,r.useEffect)(()=>{let e=setInterval(()=>{I(),un()},rn);return()=>{clearInterval(e)}},[I]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(h(t),se(t.catalog??[]))}),()=>{e=!1}},[n]);let R=$(),z=Object.entries(u.byDay).filter(([e])=>e.startsWith(R.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),be=u.byDay[R]?.cost??0,B=qt(u.byDay,R),Se=(0,r.useMemo)(()=>Kt(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]),V=Object.entries(u.byDay).filter(([e])=>e.startsWith(R.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Ce=(()=>{let e=u.byDay[R];return e===void 0?0:e.input+e.output})(),we=qt(u.byDay,R,e=>e.input+e.output),H=c(e=>e.enabled),Te=c(e=>e.amount),Ee=c(e=>e.tierAlertDays),De=c(e=>e.lastTierSwitchAt),[Oe,W]=(0,r.useState)(()=>wt()),[ke,G]=(0,r.useState)(null),[K,Ae]=(0,r.useState)(null),[q,je]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>je(Date.now()),rn);return()=>{clearInterval(e)}},[]);let Me=(0,r.useCallback)(e=>{W(e),Tt(e)},[]),J=(0,r.useCallback)(()=>{Ae({entering:de(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4})},[]),Ne=Te>0?Te:u.budget??0,Pe=(0,r.useCallback)(()=>{let e=!H;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,H]);(0,r.useEffect)(()=>{if(!H||Ne<=0)return;let e=z/Ne*100,t=At.filter(t=>e>=t&&Ee?.[String(t)]!==R);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,R),!Vt())return;let r=F(`budgetTierBody`).replace(`{cost}`,U(z)).replace(`{budget}`,U(Ne)).replace(`{pct}`,String(n));Ut(`budget:${n}:${R}`,()=>{new Notification(F(`budget`),{body:r})})},[H,Ne,z,Ee,R,l,F]),(0,r.useEffect)(()=>{let e=Et(q,Oe,De);if(e===null||(l.markTierSwitchAlerted(e.atMs),G(e),!Oe.webNotify||!Vt()))return;let t=Math.max(1,Math.round((e.atMs-q)/6e4)),n=F(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=F(e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));Ut(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[q,De,Oe,l,F]);let Fe=c(e=>e.lastBalanceAlertDay),Ie=u.lowBalanceThreshold??50,Le=(0,r.useMemo)(()=>{if(v.length===0)return;let e=Rt(u.byDay,R),t=le().rate;for(let n of v){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=Ie)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[v,u.lowBalanceThreshold,u.byDay,R]);(0,r.useEffect)(()=>{if(Le===void 0||Fe===R||(l.markBalanceAlerted(R),!Vt()))return;let e=F(`balanceLowBody`).replace(`{name}`,Le.name).replace(`{balance}`,U(Le.cny)).replace(`{days}`,Le.days===void 0?`—`:String(Le.days));Ut(`balance:${R}`,()=>{new Notification(F(`balance`),{body:e})})},[Le,Fe,R,l,F]);let Re=(0,r.useMemo)(()=>{let e=R.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=xe(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=v.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=v.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`?F(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?F(`balanceUnreachable`):F(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:U(t.totalBalance),r=le().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<Ie}},a=e=>{let t=E.find(t=>t.displayName===e||Lt(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:F(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?F(`subscriptionExhausted`):F(`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,v,E,R]),Y=(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:be,monthCost:z})},[be,z,i]),(0,r.useEffect)(()=>a(L),[a,L]);let ze=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(gn,{...e,t:F,onOpen:L,monthCost:z,todayCost:be,weekCost:B,days:Se,vendorStatus:Re,dash:Y,cardPrefs:P,monthTokens:V,todayTokens:Ce,weekTokens:we,floatPrefs:A,subscriptions:E}),_e&&(0,o.jsx)(bn,{stats:he,t:F,onClose:ye,userPrices:fe,onUserPrices:me,health:m,balances:v,...S===void 0?{}:{reconcile:S},quotas:E,relayQuotas:ne,currency:k,onCurrency:re,turns:ze,renderSlot:s,budgetEnabled:H,budgetAmount:Ne,onToggleBudget:Pe,onBudgetAmount:l.setAmount,peakConfig:Oe,onPeakConfig:Me,onPreviewPeak:J,floatPrefs:A,onFloatPrefs:j,cardPrefs:P,onCardPrefs:ue,sitePrefs:M,onSitePrefs:oe,quotasStale:ee}),(ke!==null||K!==null)&&(0,o.jsx)(Dt,{hit:ke??K,config:Oe,t:F,onDismiss:()=>{G(null),Ae(null)}})]})}function Cn(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function wn(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 Tn(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 En(){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 Dn(){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 On(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function kn({useSession:e,t}){let n=e(e=>e.sessionId),[i,a]=(0,r.useState)(null),[s,c]=(0,r.useState)([]),[l,u]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=!1,t=()=>{En().then(t=>{!e&&t!==null&&a(t)}),Dn().then(t=>{e||c(t)}),e||u(Date.now())};t();let n=setInterval(t,3e4);return()=>{e=!0,clearInterval(n)}},[n]);let d=(0,r.useMemo)(()=>Cn(i,n),[i,n]),f=(0,r.useMemo)(()=>wn(i,n),[i,n]),p=he(l),m=(0,r.useMemo)(()=>Tn(s),[s]),h=e=>U(e,`cny`);if(n===void 0)return null;let g=d>0||f>0,_=p.tier===`peak`;return(0,o.jsxs)(`span`,{className:E.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:_?E.feeChipPrimary:E.feeChipOff,"data-testid":`billing-live-tier`,children:t(_?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:E.feeCount,children:F(p.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:E.feeSuffix,children:t(_?`tierToOff`:`tierToPeak`)}),g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:E.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:E.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:E.feeNum,children:h(f)})]}),(0,o.jsx)(`span`,{className:E.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:E.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:E.feeNum,children:h(d)})]})]}),m.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?E.feeChipError:E.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(On(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function An(){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 jn(){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 Mn={enabled:!1,timeout:0};function Nn(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...Mn};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...Mn}}}function Pn(e){return e.completed===!0||e.running===!1}function Fn(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)),Pn(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=Pn(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 In=[`slots`,`locale`,`connection`,`sessions`];function Ln(e){let t=An();e.provide(`billingMetrics`,t);let n=jn(),r=e.get(`connection`);e.effect(()=>e.locale.register(ht,{zh:gt,en:_t}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:ht,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}},store:n,inject:()=>({checkModels:async()=>{try{let{result:e}=await r.api.llm.models({});if(!e.ok)return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]};let t=[];for(let n of e.value.groups)for(let e of n.models)t.push({id:e.id,...typeof e.name==`string`&&e.name!==``?{name:e.name}:{},provider:n.name});return{checked:!0,available:e.value.groups.length>0,models:e.value.groups.reduce((e,t)=>e+t.models.length,0),failures:e.value.failures.length,okProviders:e.value.groups.map(e=>e.name),badProviders:e.value.failures.map(e=>e.name),catalog:t}}catch{return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]}}},publishCosts:e=>{t.publishCosts(e)},registerOpen:e=>t.registerOpen(e)})},Sn)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:ht},kn)),e.effect(()=>Fn(e.sessions.list,Nn),`ui-usage-billing: completion notifier`)}return n.UsageBilling=Sn,n.apply=Ln,n.inject=In,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-runtime/client");function c(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=c(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function l(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=c(e))&&(r&&(r+=` `),r+=t);return r}let u={mode:`combined`,targets:[]},d=`dsh.ui-usage-billing.float`;function f(){try{let e=localStorage.getItem(d);if(e===null)return{...u,targets:[...u.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{...u,targets:[...u.targets]}}}function p(e){try{localStorage.setItem(d,JSON.stringify(e))}catch{}}let m={metric:`money`},h=`dsh.ui-usage-billing.card`;function g(){try{let e=localStorage.getItem(h);return e===null?{...m}:{metric:JSON.parse(e).metric===`tokens`?`tokens`:`money`}}catch{return{...m}}}function _(e){try{localStorage.setItem(h,JSON.stringify(e))}catch{}}let v={hideUnidentified:!0},y=`dsh.ui-usage-billing.sites`;function b(){try{let e=localStorage.getItem(y);return e===null?{...v}:{hideUnidentified:JSON.parse(e).hideUnidentified!==!1}}catch{return{...v}}}function x(e){try{localStorage.setItem(y,JSON.stringify(e))}catch{}}let S=`dsh.ui-usage-billing.prices`;function C(){try{let e=localStorage.getItem(S);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);[i,a,o].every(e=>Number.isFinite(e)&&e>=0)&&n.push({key:e,...typeof r.origin==`string`&&r.origin!==``?{origin:r.origin}:{},input:i,cacheHit:a,output:o,...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 w(e){try{localStorage.setItem(S,JSON.stringify(e))}catch{}}let T=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(T)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=T,e.textContent=`.BAyRca_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}.BAyRca_railButton:hover,.BAyRca_railButton:focus-visible{border-color:var(--dsw-static-blue-500);color:var(--dsw-static-blue-500);outline:none}.BAyRca_railButton svg{stroke-width:2px;width:18px;height:18px}.BAyRca_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}.BAyRca_trigger:hover,.BAyRca_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)}.BAyRca_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}.BAyRca_triggerIcon svg{stroke-width:2px;width:16px;height:16px}.BAyRca_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.BAyRca_triggerPrimary{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.BAyRca_triggerLabel{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.BAyRca_triggerYen{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.BAyRca_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}.BAyRca_triggerSub{color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;font-size:10px;line-height:14px;overflow:hidden}.BAyRca_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.BAyRca_triggerSparkBar,.BAyRca_triggerSparkHot{background:var(--dsw-static-blue-500);opacity:.6;border-radius:1px 1px 0 0;width:3px}.BAyRca_triggerSparkHot{opacity:1}.BAyRca_triggerWrap{flex:180px;min-width:96px;max-width:100%;display:block;position:relative;container:BAyRca_billing-trigger/inline-size}@container BAyRca_billing-trigger (width<=200px){.BAyRca_trigger{gap:6px;padding:8px 10px}.BAyRca_triggerSpark{display:none}}@container BAyRca_billing-trigger (width<=170px){.BAyRca_triggerSub,.BAyRca_triggerLabel{display:none}}@container BAyRca_billing-trigger (width<=110px){.BAyRca_triggerIcon,.BAyRca_triggerSpark,.BAyRca_triggerSub,.BAyRca_triggerLabel{display:none}.BAyRca_trigger{justify-content:center;padding:8px 6px}}.BAyRca_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-2) 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%))}.BAyRca_triggerPop,.BAyRca_triggerPop *{box-sizing:border-box}.BAyRca_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 BAyRca_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}.BAyRca_triggerPopShown{opacity:1;visibility:visible;transition:opacity .16s,transform .16s,visibility linear;transform:translateY(-100%)}.BAyRca_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.BAyRca_popTitle{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:700;line-height:18px}.BAyRca_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 8px;display:grid}.BAyRca_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.BAyRca_metricLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.BAyRca_metricValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:12px;font-weight:700;line-height:16px}.BAyRca_metricValuePrimary{color:var(--dsw-static-amber-500)}.BAyRca_metricValueSuccess{color:var(--dsw-static-green-500)}.BAyRca_popModel{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:6px;padding-top:10px;display:flex}.BAyRca_popModelLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.BAyRca_popModelRow{align-items:center;gap:8px;min-width:0;display:flex}.BAyRca_popDot{border-radius:999px;flex:none;width:6px;height:6px}.BAyRca_popDotDirect{background:var(--dsw-static-green-500)}.BAyRca_popDotSub{background:var(--dsw-static-amber-500)}.BAyRca_popDotNeutral{background:var(--dsw-alias-label-tertiary)}.BAyRca_popTagPrimary,.BAyRca_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}.BAyRca_popTagPrimary{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.BAyRca_popTagSub{background:color-mix(in srgb, var(--dsw-static-amber-500) 18%, transparent);color:var(--dsw-static-amber-500)}.BAyRca_popModelName{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.BAyRca_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}.BAyRca_popModelStatusLow{color:var(--dsw-static-red-500)}.BAyRca_dashboardModal{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:16px;width:min(760px,100vw - 48px);max-height:min(760px,88vh);animation:.18s ease-out BAyRca_dashboardIn;box-shadow:0 12px 32px -12px #0000002e,0 2px 8px #0000000f}@keyframes BAyRca_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)}.BAyRca_dashboard{flex-direction:column;width:100%;max-height:min(760px,88vh);display:flex}.BAyRca_dashboardHead{border-bottom:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.BAyRca_dashboardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.BAyRca_dashboardSubtitle{color:var(--dsw-alias-label-caption);margin:2px 0 0;font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_closeButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.BAyRca_closeButton svg{stroke-width:2px;width:16px;height:16px}.BAyRca_dashboardBody{flex-direction:column;gap:14px;padding:16px 24px 24px;display:flex;overflow-y:auto}.BAyRca_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:12px 24px;font-size:11px;line-height:16px;display:flex}.BAyRca_tabNav{border-bottom:1px solid var(--dsw-alias-border-l1);align-items:center;gap:4px;padding:0 24px;display:flex}.BAyRca_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}.BAyRca_tabButton:hover,.BAyRca_tabButton:focus-visible{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 62%, transparent);outline:none}.BAyRca_tabButtonActive,.BAyRca_tabButtonActive:hover,.BAyRca_tabButtonActive:focus-visible{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font-weight:600}.BAyRca_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out BAyRca_tabPanelIn;display:flex}@keyframes BAyRca_tabPanelIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.BAyRca_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}.BAyRca_reconcileIcon{color:var(--dsw-alias-label-tertiary);flex:none;margin-top:1px;display:inline-flex}.BAyRca_reconcileText{flex:1}.BAyRca_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}.BAyRca_reconcileDismiss:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.BAyRca_hero{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;gap:18px;padding:24px;display:flex;position:relative;overflow:hidden}.BAyRca_heroTop{justify-content:space-between;align-items:center;gap:24px;display:flex}.BAyRca_heroMain{flex-direction:column;gap:2px;min-width:0;display:flex}.BAyRca_heroLabel{color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-size:11px;line-height:16px}.BAyRca_heroReadout{align-items:baseline;gap:4px;display:flex}.BAyRca_heroCurrency{letter-spacing:-.01em;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:22px;font-weight:600;line-height:28px}.BAyRca_heroValue{letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--dsw-alias-label-primary);font-size:40px;font-weight:700;line-height:48px}.BAyRca_heroMeta{color:var(--dsw-alias-label-caption);white-space:nowrap;margin-top:2px;font-size:11px;line-height:15px}.BAyRca_heroGauge{flex:none;width:96px;height:96px;position:relative}.BAyRca_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.BAyRca_heroGaugeTrack{fill:none;stroke:var(--dsw-alias-bg-module-platform);stroke-width:7px}.BAyRca_heroGaugeArc{fill:none;stroke:var(--dsw-static-blue-500);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray .26s}.BAyRca_heroGaugeArcOver{stroke:var(--dsw-static-red-500)}.BAyRca_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.BAyRca_heroGaugePct{letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:700;line-height:18px}.BAyRca_heroGaugePctOver{color:var(--dsw-static-red-500)}.BAyRca_heroGaugeLabel{color:var(--dsw-alias-label-tertiary);font-size:9px;line-height:12px}.BAyRca_heroBudget{border-top:1px solid var(--dsw-alias-border-l1);align-items:center;gap:14px;padding-top:14px;display:flex}.BAyRca_heroBudgetLabel{color:var(--dsw-alias-label-secondary);white-space:nowrap;flex:none;font-size:11px;line-height:16px}.BAyRca_heroBudgetTrack{background:var(--dsw-alias-border-l1);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.BAyRca_heroBudgetFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .22s}.BAyRca_heroBudgetFillOver{background:var(--dsw-static-red-500)}.BAyRca_heroBudgetValue{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;font-size:11px;line-height:16px}.BAyRca_heroSide{border-top:1px solid var(--dsw-alias-border-l1);align-items:stretch;padding-top:14px;display:flex}.BAyRca_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}.BAyRca_heroSideItem:first-child{border-left:none;padding-left:0}.BAyRca_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}.BAyRca_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}.BAyRca_heroSideSpacer{flex:1;display:block}.BAyRca_delta{align-items:center;gap:2px;margin-left:4px;font-size:11px;font-weight:600;line-height:17px;display:inline-flex}.BAyRca_deltaUp{color:var(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 12%, transparent)}.BAyRca_deltaDown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 12%, transparent)}.BAyRca_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}.BAyRca_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.BAyRca_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}.BAyRca_kpiTile:hover{border-color:var(--dsw-alias-border-l2)}.BAyRca_kpiLabel{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.06em;font-size:10px;font-weight:500;line-height:13px}.BAyRca_kpiValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;letter-spacing:-.01em;font-size:24px;font-weight:600;line-height:32px}.BAyRca_kpiGreen{color:var(--dsw-static-green-500)}.BAyRca_kpiDetail{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;font-size:10.5px;line-height:14px;overflow:hidden}.BAyRca_panel{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;gap:10px;padding:16px 18px;transition:border-color .16s;display:flex}.BAyRca_panelHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.BAyRca_panelTitle{letter-spacing:-.005em;color:var(--dsw-alias-label-primary);margin:0;font-size:14px;font-weight:600;line-height:20px}.BAyRca_panelHint{color:var(--dsw-alias-label-caption);white-space:nowrap;font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_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}.BAyRca_rangeButtonActive{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font-weight:600}.BAyRca_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.BAyRca_exportLabel{color:var(--dsw-alias-label-caption);font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_exportButton:hover,.BAyRca_exportButton:focus-visible{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);outline:none}.BAyRca_shareTrack{background:var(--dsw-alias-bg-module-platform);border-radius:999px;height:10px;display:flex;overflow:hidden}.BAyRca_shareSeg{height:100%;transition:width .2s}.BAyRca_shareSegPeak{background:var(--dsw-static-blue-500)}.BAyRca_shareSegOff{background:color-mix(in srgb, var(--dsw-static-blue-500) 25%, var(--dsw-alias-bg-module-platform))}.BAyRca_shareSegUser{background:var(--dsw-static-blue-500)}.BAyRca_shareSegAssistant{background:var(--dsw-static-green-500)}.BAyRca_shareSegTool{background:var(--dsw-static-amber-500)}.BAyRca_shareLegend{align-items:center;gap:16px;display:flex}.BAyRca_shareItem{color:var(--dsw-alias-label-secondary);align-items:baseline;gap:6px;font-size:12px;line-height:17px;display:inline-flex}.BAyRca_bucketCost{align-items:baseline;gap:3px;display:inline-flex}.BAyRca_bucketOfficial{color:var(--dsw-static-blue-500);font-weight:600}.BAyRca_bucketSep{color:var(--dsw-alias-label-dimmed)}.BAyRca_bucketThird{color:var(--dsw-alias-label-secondary)}.BAyRca_shareDot{border-radius:50%;flex:none;align-self:center;width:8px;height:8px}.BAyRca_shareValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.BAyRca_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}.BAyRca_budgetInput:focus-visible{outline:none}.BAyRca_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}.BAyRca_switchOn{border-color:var(--dsw-alias-border-l1);background:var(--dsw-alias-label-primary)}.BAyRca_switchKnob{background:var(--dsw-static-neutral-bluish-00);border-radius:50%;width:11px;height:11px;transition:transform .16s;position:absolute;top:2px;left:2px}.BAyRca_switchOn .BAyRca_switchKnob{transform:translate(13px)}.BAyRca_budgetFillWarn{background:var(--dsw-static-amber-500)}.BAyRca_budgetFillOver{background:var(--dsw-static-red-500);animation:1.6s ease-in-out infinite BAyRca_budgetOverPulse}@keyframes BAyRca_budgetOverPulse{50%{opacity:.55}}.BAyRca_chartWrap{width:100%;position:relative}.BAyRca_chartSvg{width:100%;height:auto;display:block}.BAyRca_chartEmpty{height:140px;color:var(--dsw-alias-label-caption);justify-content:center;align-items:center;font-size:13px;display:flex}.BAyRca_emptyRow{text-align:center;color:var(--dsw-alias-label-caption);padding:28px 0;font-size:13px}.BAyRca_chartGrid{stroke:var(--dsw-alias-border-l1);stroke-width:1px}.BAyRca_chartAxisLabel{fill:var(--dsw-alias-label-tertiary);font-size:10px}.BAyRca_chartBar{fill:var(--dsw-static-blue-500);opacity:.7}.BAyRca_chartBar:hover{opacity:1}.BAyRca_chartStack{stroke:var(--dsw-alias-bg-layer-1);stroke-width:.75px}.BAyRca_chartStack:hover{opacity:.9}.BAyRca_chartLine{stroke:var(--dsw-static-blue-500);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.BAyRca_chartCrosshair{stroke:var(--dsw-alias-label-dimmed);stroke-width:1px;stroke-dasharray:3 3}.BAyRca_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))}.BAyRca_chartTooltipDate{color:var(--dsw-alias-label-primary);margin-bottom:3px;font-size:11px;font-weight:600}.BAyRca_chartTooltipRow{color:var(--dsw-alias-label-secondary);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.BAyRca_chartTooltipRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.BAyRca_chartBarPlaceholder{fill:color-mix(in srgb, var(--dsw-alias-label-secondary) 30%, transparent)}.BAyRca_chartLegendLine{background:var(--dsw-static-blue-500);border-radius:2px;width:10px;height:3px;display:inline-block}.BAyRca_chartLegendBar{background:var(--dsw-static-blue-500);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.BAyRca_chartTooltipSwatch{border-radius:3px;flex:none;width:8px;height:8px;display:inline-block}.BAyRca_chartLegend{color:var(--dsw-alias-label-tertiary);justify-content:flex-end;gap:14px;margin-top:2px;font-size:11px;display:flex}.BAyRca_chartLegend span{align-items:center;gap:5px;display:inline-flex}.BAyRca_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}.BAyRca_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}.BAyRca_ubAlertLeft{align-items:center;gap:8px;display:inline-flex}.BAyRca_ubRate{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:600}.BAyRca_ubAlertNote{color:var(--dsw-alias-label-secondary);margin:0}.BAyRca_ubTag,.BAyRca_ubTagSuccess,.BAyRca_ubTagNeutral,.BAyRca_ubTagAlert,.BAyRca_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}.BAyRca_ubTagSuccess{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.BAyRca_ubTagNeutral{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.BAyRca_ubTagAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.BAyRca_ubTagPromo{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500);cursor:help}.BAyRca_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.BAyRca_ubExtraName{color:var(--dsw-alias-label-secondary);margin-left:26px}.BAyRca_ubExtraNote{color:var(--dsw-alias-label-tertiary);margin-left:8px;font-size:10px}.BAyRca_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}.BAyRca_ubCardHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.BAyRca_ubCardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.BAyRca_ubCardSub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_ubTablewrap{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;overflow:auto}.BAyRca_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12.5px}.BAyRca_ubTable th,.BAyRca_ubTable td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;padding:9px 12px}.BAyRca_ubTable tbody tr:last-child td{border-bottom:0}.BAyRca_ubTable thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;font-size:11px;font-weight:600}.BAyRca_ubModel{align-items:center;gap:8px;display:inline-flex}.BAyRca_vendorLogo{object-fit:contain;border-radius:4px;flex:none;width:18px;height:18px}.BAyRca_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}.BAyRca_ubModelName{color:var(--dsw-alias-label-primary);align-items:center;gap:6px;font-weight:500;display:inline-flex}.BAyRca_ubPricepair{flex-wrap:wrap;gap:6px;display:inline-flex}.BAyRca_ubChipPeak,.BAyRca_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}.BAyRca_ubChipLabel{font-size:10px;font-weight:600}.BAyRca_ubChipPeak{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.BAyRca_ubChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.BAyRca_ubNotes{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.BAyRca_ubNotesItem{align-items:baseline;gap:10px;display:flex}.BAyRca_ubNotesTerm{color:var(--dsw-alias-label-primary);flex:0 0 72px;font-size:12px;font-weight:500}.BAyRca_ubNotesDesc{min-width:0;color:var(--dsw-alias-label-secondary);flex:1;font-size:12px;line-height:17px}.BAyRca_ubCardControlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.BAyRca_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}.BAyRca_modelTable{border-collapse:collapse;table-layout:fixed;width:100%;min-width:640px;font-size:12.5px}.BAyRca_modelTable th:first-child{width:26%}.BAyRca_modelTable th,.BAyRca_modelTable td,.BAyRca_pricingTable th,.BAyRca_pricingTable td{border-bottom:1px solid var(--dsw-alias-border-l1);text-align:left;white-space:nowrap;padding:9px 12px}.BAyRca_modelTable tbody tr:last-child td,.BAyRca_pricingTable tbody tr:last-child td{border-bottom:0}.BAyRca_modelTable thead th,.BAyRca_pricingTable thead th{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;letter-spacing:.05em;background:0 0;font-size:11px;font-weight:600}.BAyRca_modelTable tbody tr,.BAyRca_pricingTable tbody tr{transition:background-color .12s}.BAyRca_modelTable tbody tr:hover,.BAyRca_pricingTable tbody tr:hover{background:0 0}.BAyRca_sessionGroupRow{cursor:pointer}.BAyRca_sessionGroupRow .BAyRca_modelName:before{content:"›";color:var(--dsw-alias-label-tertiary);margin-right:6px;display:inline-block}.BAyRca_sessionGroupRow[aria-expanded=true] .BAyRca_modelName:before{transform:rotate(90deg)}.BAyRca_sessionChildRow td:first-child{padding-left:30px}.BAyRca_numCol{text-align:right;font-variant-numeric:tabular-nums}.BAyRca_na{color:var(--dsw-alias-label-dimmed)}.BAyRca_modelCell{align-items:center;gap:8px;display:inline-flex}.BAyRca_modelDot{border-radius:50%;flex:none;width:9px;height:9px}.BAyRca_modelName{color:var(--dsw-alias-label-primary);font-weight:500;line-height:16px;display:block}.BAyRca_modelProvider{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px;display:block}.BAyRca_pricingToggle:hover .BAyRca_panelTitle,.BAyRca_pricingToggle:focus-visible .BAyRca_panelTitle{color:var(--dsw-alias-label-primary)}.BAyRca_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}.BAyRca_siteRowName{align-items:center;gap:8px;min-width:0;display:inline-flex}.BAyRca_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}.BAyRca_siteKindSite{color:var(--dsw-static-blue-500);background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent)}.BAyRca_siteKindDirect{color:var(--dsw-static-green-500);background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent)}.BAyRca_siteKindUnknown{color:var(--dsw-static-red-500);background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent)}.BAyRca_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}.BAyRca_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.BAyRca_siteRowCost{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:700;line-height:18px}.BAyRca_siteRowCalls{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.BAyRca_siteRowCallsLow{color:var(--dsw-static-red-500)}.BAyRca_flatTag{color:var(--dsw-alias-label-caption);font-size:10.5px;line-height:14px}.BAyRca_healthDot{border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.BAyRca_healthOk{background:var(--dsw-static-green-500)}.BAyRca_healthBad{background:var(--dsw-static-red-500)}.BAyRca_healthIdle{background:var(--dsw-static-neutral-bluish-400)}.BAyRca_dashboardRight{align-items:center;gap:8px;min-width:0;display:flex}.BAyRca_healthBadge{white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;line-height:16px;display:inline-flex}.BAyRca_healthBadgeOk{color:var(--dsw-static-green-500);background:var(--dsw-alias-bg-layer-2)}.BAyRca_healthBadgeBad{color:var(--dsw-static-red-500);background:var(--dsw-alias-bg-layer-2)}.BAyRca_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}.BAyRca_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}.BAyRca_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}.BAyRca_feeBar{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);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}.BAyRca_feeCount{color:var(--dsw-alias-label-primary);font-weight:600}.BAyRca_feeSuffix{color:var(--dsw-alias-label-tertiary)}.BAyRca_feeItem{color:var(--dsw-alias-label-secondary);white-space:nowrap}.BAyRca_feeNum{color:var(--dsw-alias-label-primary)}.BAyRca_feeSep{color:var(--dsw-alias-label-tertiary)}.BAyRca_feeChipPrimary,.BAyRca_feeChipOff,.BAyRca_feeChipAlert,.BAyRca_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}.BAyRca_feeChipPrimary{background:color-mix(in srgb, var(--dsw-static-blue-500) 14%, transparent);color:var(--dsw-static-blue-500)}.BAyRca_feeChipOff{background:color-mix(in srgb, var(--dsw-static-green-500) 14%, transparent);color:var(--dsw-static-green-500)}.BAyRca_feeChipAlert{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent);color:var(--dsw-static-amber-500)}.BAyRca_feeChipError{background:color-mix(in srgb, var(--dsw-static-red-500) 14%, transparent);color:var(--dsw-static-red-500)}.BAyRca_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.BAyRca_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}.BAyRca_balanceDaysBadge:hover{border-color:var(--dsw-alias-label-secondary);background:color-mix(in srgb, var(--dsw-alias-label-caption) 18%, transparent)}.BAyRca_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)}.BAyRca_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}.BAyRca_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.BAyRca_balanceDetailTitle{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600}.BAyRca_balanceDetailClose{cursor:pointer;color:var(--dsw-alias-label-caption);background:0 0;border:none;font-size:14px;line-height:1}.BAyRca_balanceDetailClose:hover{color:var(--dsw-alias-label-primary)}.BAyRca_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.BAyRca_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}.BAyRca_balanceDetailLabel{color:var(--dsw-alias-label-caption)}.BAyRca_balanceDetailValue{color:var(--dsw-alias-label-primary);font-weight:500}.BAyRca_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}.BAyRca_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}.BAyRca_currencyButtonActive{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.BAyRca_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.BAyRca_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}.BAyRca_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 BAyRca_subscriptionGoldFlow;position:absolute;top:0;left:0;right:0}@keyframes BAyRca_subscriptionGoldFlow{0%{background-position:200% 0}to{background-position:-200% 0}}.BAyRca_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}.BAyRca_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.BAyRca_subscriptionName{font-size:13px;font-weight:700}.BAyRca_subscriptionPlan{color:var(--dsw-alias-label-secondary);font-size:11px}.BAyRca_subscriptionPlan[data-kind=code],.BAyRca_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}.BAyRca_subscriptionTier{color:var(--dsw-alias-label-secondary);margin-left:6px}.BAyRca_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}.BAyRca_subscriptionStatus{color:var(--dsw-alias-label-secondary);margin-bottom:6px;font-size:11px}.BAyRca_subscriptionWindow{align-items:center;gap:10px;margin-top:8px;font-size:11px;display:flex}.BAyRca_subscriptionWindowLabel{color:var(--dsw-alias-label-secondary);flex:0 0 44px}.BAyRca_subscriptionTrack{background:var(--dsw-alias-bg-layer-3);border-radius:3px;flex:1;height:6px;overflow:hidden}.BAyRca_subscriptionFill{background:var(--dsw-static-blue-500);border-radius:3px;height:100%;transition:width .2s;display:block}.BAyRca_subscriptionFillWarn{background:var(--dsw-static-amber-500)}.BAyRca_subscriptionFillOver{background:var(--dsw-static-red-500)}.BAyRca_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.BAyRca_subscriptionPct{text-align:right;font-variant-numeric:tabular-nums;flex:none;min-width:52px}.BAyRca_subscriptionExhausted{color:var(--dsw-static-red-500);min-width:52px;font-weight:600}.BAyRca_subscriptionReset{color:var(--dsw-alias-label-caption);white-space:nowrap;flex:none;font-size:10px}.BAyRca_providerGroupList{flex-direction:column;gap:10px;display:flex}.BAyRca_providerGroup{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:12px;padding:12px 14px}.BAyRca_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.BAyRca_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.BAyRca_providerGroupName{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:18px}.BAyRca_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.BAyRca_providerGroupBadge{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}.BAyRca_providerGroupBalance{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;white-space:nowrap;align-items:baseline;gap:6px;font-size:12px;line-height:17px;display:inline-flex}.BAyRca_providerGroupBalanceLabel{color:var(--dsw-alias-label-caption);font-size:11px;line-height:17px}.BAyRca_rounds{margin-top:10px}.BAyRca_roundsBars{align-items:flex-end;gap:3px;height:124px;padding:16px 2px 0;display:flex;overflow-x:auto}.BAyRca_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}.BAyRca_roundsBarColPeak{background:color-mix(in srgb, var(--dsw-static-amber-500) 16%, transparent)}.BAyRca_roundsBarColOff{background:var(--dsw-alias-bg-module-platform)}.BAyRca_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%)}.BAyRca_roundsBarWrap{flex:1;align-items:flex-end;min-height:0;display:flex}.BAyRca_roundsBar{background:var(--dsw-static-blue-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.BAyRca_roundsBarFlagged{background:var(--dsw-static-red-500);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.BAyRca_roundsFlagMark{background:var(--dsw-static-red-500);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.BAyRca_roundsAxis{color:var(--dsw-alias-label-secondary);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.BAyRca_roundsEmpty{color:var(--dsw-alias-label-secondary);margin-top:10px;font-size:12px}.BAyRca_heatmap{margin-top:10px}.BAyRca_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;display:grid}.BAyRca_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}.BAyRca_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}.BAyRca_heatmapCell[data-level="0"],.BAyRca_heatmapCell[data-level="1"],.BAyRca_heatmapCell[data-level="2"]{color:var(--dsw-alias-label-primary)}.BAyRca_heatmapCell[data-level="3"],.BAyRca_heatmapCell[data-level="4"]{color:var(--dsw-static-neutral-bluish-00)}.BAyRca_heatmapFooter{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-top:10px;font-size:10px;display:flex}.BAyRca_heatmapLegend{gap:3px;display:inline-flex}.BAyRca_heatmapLegend i{border-radius:4px;width:14px;height:14px;display:block}.BAyRca_heatmapHover{font-variant-numeric:tabular-nums;margin-left:auto}.BAyRca_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.BAyRca_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}.BAyRca_heatmapRangeButtonActive{color:var(--dsw-alias-text-primary);border-color:currentColor;font-weight:600}.BAyRca_heatmapYear{flex-direction:column;gap:6px;display:flex}.BAyRca_heatmapYearBody{align-items:flex-start;gap:6px;display:flex}.BAyRca_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}.BAyRca_heatmapYearWeekday{white-space:nowrap;text-align:right;height:11px}.BAyRca_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}.BAyRca_heatmapYearMonth{white-space:nowrap;overflow:visible}.BAyRca_heatmapYearScroll{padding-bottom:2px;overflow-x:auto}.BAyRca_heatmapYearGrid{grid-template-rows:repeat(7,11px);grid-auto-flow:column;gap:3px;min-width:max-content;display:grid}.BAyRca_heatmapYearCell{cursor:pointer;border:0;border-radius:2px;width:11px;height:11px;padding:0}.BAyRca_floatSub{flex-direction:column;gap:6px;min-width:0;display:flex}.BAyRca_floatSubHead{flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;display:flex}.BAyRca_floatSubName{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:700}.BAyRca_floatSubPlan{color:var(--dsw-alias-label-secondary);font-size:10px}.BAyRca_floatSub .BAyRca_subscriptionWindow{flex-wrap:wrap;gap:4px 10px}.BAyRca_floatSub .BAyRca_subscriptionWindowLabel{flex:none}.BAyRca_floatSub .BAyRca_subscriptionMeta{min-width:0;max-width:100%}.BAyRca_floatSub .BAyRca_subscriptionPct{min-width:0}.BAyRca_floatSub .BAyRca_subscriptionReset{white-space:normal;overflow-wrap:anywhere}.BAyRca_triggerPopEmpty{color:var(--dsw-alias-label-tertiary);padding:2px 0;font-size:11px;line-height:1.5}.BAyRca_triggerPopSwitcher{justify-content:flex-end;align-items:center;gap:8px;margin-top:2px;display:flex}.BAyRca_triggerPopSwitchCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:10px}.BAyRca_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}.BAyRca_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)}.BAyRca_floatTarget{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:5px;font-size:12px;display:inline-flex}.BAyRca_floatTargetLabel{color:var(--dsw-alias-label-secondary)}.BAyRca_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}.BAyRca_plgHead{align-items:flex-start;gap:12px;display:flex}.BAyRca_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}.BAyRca_plgTitle{flex-direction:column;gap:4px;min-width:0;display:flex}.BAyRca_plgNameRow{align-items:center;gap:8px;display:flex}.BAyRca_plgName{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.BAyRca_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}.BAyRca_plgDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.BAyRca_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}.BAyRca_plgItem{flex-direction:column;gap:2px;min-width:0;display:flex}.BAyRca_plgLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.BAyRca_plgVal{color:var(--dsw-alias-label-primary);word-break:break-all;font-size:12px;line-height:17px}.BAyRca_plgLink{color:var(--dsw-static-blue-500);word-break:break-all;font-size:12px;line-height:17px;text-decoration:none}.BAyRca_plgLink:hover{text-decoration:underline}.BAyRca_tokenPanel{flex-direction:column;gap:14px;display:flex}.BAyRca_tokenModelBar{background:var(--dsw-alias-bg-layer-2);border-radius:999px;height:8px;overflow:hidden}.BAyRca_tokenModelParts{height:100%;display:flex}.BAyRca_tokenModelPartIn{background:var(--dsw-static-blue-500)}.BAyRca_tokenModelPartOut{background:var(--dsw-static-amber-500)}.BAyRca_tokenModelShareRow{align-items:center;gap:6px;display:inline-flex}@media (width<=640px){.BAyRca_kpiGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.BAyRca_hero{gap:14px}.BAyRca_heroTop{flex-direction:column;align-items:flex-start;gap:12px}.BAyRca_heroGauge{width:72px;height:72px}.BAyRca_heroSide{gap:12px}.BAyRca_heroSideSpacer{display:none}}.BAyRca_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 BAyRca_peakAlertIn;display:flex;position:fixed;box-shadow:0 4px 16px #00000014}.BAyRca_peakCardCorner{bottom:18px;right:18px}.BAyRca_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.BAyRca_peakCardPeak{color:var(--dsw-static-blue-500)}.BAyRca_peakCardOff{color:var(--dsw-static-green-500)}.BAyRca_peakHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.BAyRca_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}.BAyRca_peakTagPrimary{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-static-blue-500)}.BAyRca_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-static-green-500)}.BAyRca_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.BAyRca_peakDotPrimary{background:var(--dsw-static-blue-500)}.BAyRca_peakDotSuccess{background:var(--dsw-static-green-500)}.BAyRca_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}.BAyRca_peakClose:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2)}.BAyRca_peakCount{font-variant-numeric:tabular-nums;font-size:28px;font-weight:700;line-height:34px}.BAyRca_peakCountPrimary{color:var(--dsw-static-blue-500)}.BAyRca_peakCountSuccess{color:var(--dsw-static-green-500)}.BAyRca_peakDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:18px}@keyframes BAyRca_peakAlertIn{0%{opacity:0}to{opacity:1}}.BAyRca_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}.BAyRca_setCardHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.BAyRca_setCardMeta{flex-direction:column;gap:4px;min-width:0;display:flex}.BAyRca_setCardTitle{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.BAyRca_setCardDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.BAyRca_ctlCol{flex-direction:column;gap:10px;padding-top:2px;display:flex}.BAyRca_ctlRow{align-items:center;gap:12px;min-height:28px;display:flex}.BAyRca_ctlRowStretch{display:flex}.BAyRca_ctlLabel{color:var(--dsw-alias-label-secondary);flex:0 0 96px;font-size:11px;line-height:16px}.BAyRca_ctlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.BAyRca_userPriceRow{border-bottom:1px solid var(--dsw-alias-border-l1);grid-template-columns:minmax(96px,1.1fr) minmax(120px,1.5fr) repeat(3,minmax(64px,84px)) auto auto;align-items:end;gap:8px 10px;padding:8px 0;display:grid}@media (width<=720px){.BAyRca_userPriceRow{grid-template-columns:repeat(3,minmax(0,1fr))}}.BAyRca_userPriceRow .BAyRca_userPriceInput,.BAyRca_userPriceRow .BAyRca_userPriceInputNum{box-sizing:border-box;width:100%;min-width:0;max-width:none}.BAyRca_userPriceOffPeak{flex-wrap:wrap;grid-column:1/-1;align-items:center;gap:10px;width:100%;padding:2px 0 6px;display:flex}.BAyRca_userPriceField{flex-direction:column;gap:4px;min-width:0;display:flex}.BAyRca_userPriceField .BAyRca_ctlLabel{flex:none;font-size:11px}.BAyRca_userPriceInput,.BAyRca_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}.BAyRca_userPriceInputNum{min-width:72px;max-width:88px}.BAyRca_userPriceRemove{border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-static-red-400);cursor:pointer;background:0 0;border-radius:6px;align-self:center;padding:4px 8px;font-size:11px;line-height:16px}.BAyRca_userPriceRemove:hover{border-color:var(--dsw-static-red-400)}.BAyRca_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}.BAyRca_rdo input{opacity:0;pointer-events:none;position:absolute}.BAyRca_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}.BAyRca_rdo input:checked+.BAyRca_rdoDot{border-color:var(--dsw-static-blue-500)}.BAyRca_rdo input:checked+.BAyRca_rdoDot:after{content:"";background:var(--dsw-static-blue-500);border-radius:50%;position:absolute;inset:3px}.BAyRca_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}.BAyRca_affix{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_prog{background:var(--dsw-alias-bg-module-platform);border-radius:999px;flex:1;min-width:0;height:6px;overflow:hidden}.BAyRca_progFill{background:var(--dsw-static-blue-500);border-radius:999px;height:100%;transition:width .2s}.BAyRca_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}.BAyRca_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))}`,document.head.appendChild(e)}var E={chartWrap:`BAyRca_chartWrap`,ubNotesItem:`BAyRca_ubNotesItem`,peakTag:`BAyRca_peakTag`,tabNav:`BAyRca_tabNav`,ubCardSub:`BAyRca_ubCardSub`,floatTarget:`BAyRca_floatTarget`,providerGroupBalanceLabel:`BAyRca_providerGroupBalanceLabel`,peakDesc:`BAyRca_peakDesc`,kpiTile:`BAyRca_kpiTile`,budgetFillOver:`BAyRca_budgetFillOver`,floatSub:`BAyRca_floatSub`,plgGrid:`BAyRca_plgGrid`,providerGroupName:`BAyRca_providerGroupName`,trigger:`BAyRca_trigger`,flatTag:`BAyRca_flatTag`,userPriceInput:`BAyRca_userPriceInput`,peakCardCorner:`BAyRca_peakCardCorner`,inp:`BAyRca_inp`,heroGaugePctOver:`BAyRca_heroGaugePctOver`,subscriptionGoldFlow:`BAyRca_subscriptionGoldFlow`,panelHint:`BAyRca_panelHint`,plgIcon:`BAyRca_plgIcon`,subscriptionTrack:`BAyRca_subscriptionTrack`,roundsBarCol:`BAyRca_roundsBarCol`,affix:`BAyRca_affix`,budgetFillWarn:`BAyRca_budgetFillWarn`,floatSubHead:`BAyRca_floatSubHead`,plgLink:`BAyRca_plgLink`,healthBadgeBad:`BAyRca_healthBadgeBad`,shareItem:`BAyRca_shareItem`,balanceDaysBadge:`BAyRca_balanceDaysBadge`,shareTrack:`BAyRca_shareTrack`,subscriptionReset:`BAyRca_subscriptionReset`,heatmapRangeSwitch:`BAyRca_heatmapRangeSwitch`,floatModeBtnOn:`BAyRca_floatModeBtnOn`,ubChipPeak:`BAyRca_ubChipPeak`,plgHead:`BAyRca_plgHead`,shareSegPeak:`BAyRca_shareSegPeak`,popHead:`BAyRca_popHead`,popModelRow:`BAyRca_popModelRow`,deltaUp:`BAyRca_deltaUp`,siteRowName:`BAyRca_siteRowName`,feeChipOff:`BAyRca_feeChipOff`,heatmapYear:`BAyRca_heatmapYear`,peakCount:`BAyRca_peakCount`,heroGaugeSvg:`BAyRca_heroGaugeSvg`,siteKindSite:`BAyRca_siteKindSite`,staleNotice:`BAyRca_staleNotice`,heroBudgetValue:`BAyRca_heroBudgetValue`,rdoDot:`BAyRca_rdoDot`,ctlCol:`BAyRca_ctlCol`,sessionGroupRow:`BAyRca_sessionGroupRow`,ubChipLabel:`BAyRca_ubChipLabel`,roundsBarWrap:`BAyRca_roundsBarWrap`,modelName:`BAyRca_modelName`,setCardDesc:`BAyRca_setCardDesc`,triggerIcon:`BAyRca_triggerIcon`,delta:`BAyRca_delta`,feeBar:`BAyRca_feeBar`,subscriptionHead:`BAyRca_subscriptionHead`,rdo:`BAyRca_rdo`,heatmapYearScroll:`BAyRca_heatmapYearScroll`,railButton:`BAyRca_railButton`,popDotNeutral:`BAyRca_popDotNeutral`,popTagSub:`BAyRca_popTagSub`,floatSubName:`BAyRca_floatSubName`,chartCrosshair:`BAyRca_chartCrosshair`,chartTooltip:`BAyRca_chartTooltip`,budgetInput:`BAyRca_budgetInput`,ubNotesDesc:`BAyRca_ubNotesDesc`,ubChipOff:`BAyRca_ubChipOff`,healthIdle:`BAyRca_healthIdle`,tokenPanel:`BAyRca_tokenPanel`,modalFooter:`BAyRca_modalFooter`,metricValueSuccess:`BAyRca_metricValueSuccess`,ubPricepair:`BAyRca_ubPricepair`,balanceDetailRow:`BAyRca_balanceDetailRow`,heatmapHover:`BAyRca_heatmapHover`,plgDesc:`BAyRca_plgDesc`,siteRowMeta:`BAyRca_siteRowMeta`,sessionChildRow:`BAyRca_sessionChildRow`,subscriptionPct:`BAyRca_subscriptionPct`,ctlRow:`BAyRca_ctlRow`,siteRowCost:`BAyRca_siteRowCost`,heroBudgetTrack:`BAyRca_heroBudgetTrack`,bucketCost:`BAyRca_bucketCost`,panelHead:`BAyRca_panelHead`,roundsEmpty:`BAyRca_roundsEmpty`,triggerPopSwitchCount:`BAyRca_triggerPopSwitchCount`,roundsBarColPeak:`BAyRca_roundsBarColPeak`,heroSideSpacer:`BAyRca_heroSideSpacer`,providerGroup:`BAyRca_providerGroup`,heroSideItem:`BAyRca_heroSideItem`,pricingToggle:`BAyRca_pricingToggle`,heroBudgetLabel:`BAyRca_heroBudgetLabel`,siteKindUnknown:`BAyRca_siteKindUnknown`,feeCount:`BAyRca_feeCount`,siteRow:`BAyRca_siteRow`,balanceDetailGrid:`BAyRca_balanceDetailGrid`,peakDotPrimary:`BAyRca_peakDotPrimary`,chartLegend:`BAyRca_chartLegend`,heatmapYearMonth:`BAyRca_heatmapYearMonth`,triggerMain:`BAyRca_triggerMain`,subscriptionExhausted:`BAyRca_subscriptionExhausted`,rounds:`BAyRca_rounds`,ubExtraName:`BAyRca_ubExtraName`,ubCardTitle:`BAyRca_ubCardTitle`,ubTablewrap:`BAyRca_ubTablewrap`,subscriptionFillOver:`BAyRca_subscriptionFillOver`,tokenModelShareRow:`BAyRca_tokenModelShareRow`,userPriceField:`BAyRca_userPriceField`,chartAxisLabel:`BAyRca_chartAxisLabel`,shareSegUser:`BAyRca_shareSegUser`,closeButton:`BAyRca_closeButton`,dashboardBody:`BAyRca_dashboardBody`,heroGaugeLabel:`BAyRca_heroGaugeLabel`,ubTagSuccess:`BAyRca_ubTagSuccess`,heroReadout:`BAyRca_heroReadout`,kpiGreen:`BAyRca_kpiGreen`,heatmapYearWeekday:`BAyRca_heatmapYearWeekday`,peakTagSuccess:`BAyRca_peakTagSuccess`,chartSvg:`BAyRca_chartSvg`,setCard:`BAyRca_setCard`,roundsBarFlagged:`BAyRca_roundsBarFlagged`,plgTitle:`BAyRca_plgTitle`,heroSideValue:`BAyRca_heroSideValue`,subscriptionTier:`BAyRca_subscriptionTier`,heroGaugeCenter:`BAyRca_heroGaugeCenter`,"billing-trigger":`BAyRca_billing-trigger`,hero:`BAyRca_hero`,reconcileIcon:`BAyRca_reconcileIcon`,na:`BAyRca_na`,dashboardSubtitle:`BAyRca_dashboardSubtitle`,providerGroupList:`BAyRca_providerGroupList`,deltaDown:`BAyRca_deltaDown`,balanceDetailPop:`BAyRca_balanceDetailPop`,prog:`BAyRca_prog`,chartTooltipRow:`BAyRca_chartTooltipRow`,triggerPopShown:`BAyRca_triggerPopShown`,balanceDaysBadgeLow:`BAyRca_balanceDaysBadgeLow`,metricValuePrimary:`BAyRca_metricValuePrimary`,exportBar:`BAyRca_exportBar`,heatmapGrid:`BAyRca_heatmapGrid`,ubCard:`BAyRca_ubCard`,plgName:`BAyRca_plgName`,dashboardTitle:`BAyRca_dashboardTitle`,providerGroupHead:`BAyRca_providerGroupHead`,peakCardOff:`BAyRca_peakCardOff`,peakDotSuccess:`BAyRca_peakDotSuccess`,reconcileText:`BAyRca_reconcileText`,btn:`BAyRca_btn`,tokenModelPartOut:`BAyRca_tokenModelPartOut`,subscriptionName:`BAyRca_subscriptionName`,roundsBar:`BAyRca_roundsBar`,roundsBarColOff:`BAyRca_roundsBarColOff`,triggerMetric:`BAyRca_triggerMetric`,subscriptionAuto:`BAyRca_subscriptionAuto`,peakCountPrimary:`BAyRca_peakCountPrimary`,roundsAxis:`BAyRca_roundsAxis`,ubTag:`BAyRca_ubTag`,balanceCell:`BAyRca_balanceCell`,heatmapYearMonths:`BAyRca_heatmapYearMonths`,heroGaugeArcOver:`BAyRca_heroGaugeArcOver`,chartEmpty:`BAyRca_chartEmpty`,modelProvider:`BAyRca_modelProvider`,metricGrid:`BAyRca_metricGrid`,popTitle:`BAyRca_popTitle`,exportLabel:`BAyRca_exportLabel`,floatTargetLabel:`BAyRca_floatTargetLabel`,siteKindTag:`BAyRca_siteKindTag`,floatModeBtn:`BAyRca_floatModeBtn`,heroGaugeArc:`BAyRca_heroGaugeArc`,triggerWrap:`BAyRca_triggerWrap`,tabPanelIn:`BAyRca_tabPanelIn`,ubTagAlert:`BAyRca_ubTagAlert`,shareSegTool:`BAyRca_shareSegTool`,triggerYen:`BAyRca_triggerYen`,triggerSpark:`BAyRca_triggerSpark`,subscriptionGrid:`BAyRca_subscriptionGrid`,feeNum:`BAyRca_feeNum`,providerGroupBadge:`BAyRca_providerGroupBadge`,heroBudget:`BAyRca_heroBudget`,feeSuffix:`BAyRca_feeSuffix`,triggerPrimary:`BAyRca_triggerPrimary`,heroCurrency:`BAyRca_heroCurrency`,switchOn:`BAyRca_switchOn`,reconcileNotice:`BAyRca_reconcileNotice`,emptyRow:`BAyRca_emptyRow`,balanceDetailLabel:`BAyRca_balanceDetailLabel`,popDotSub:`BAyRca_popDotSub`,ubExtraNote:`BAyRca_ubExtraNote`,heatmapFooter:`BAyRca_heatmapFooter`,plgVal:`BAyRca_plgVal`,subscriptionFill:`BAyRca_subscriptionFill`,heroSide:`BAyRca_heroSide`,healthBadgeOk:`BAyRca_healthBadgeOk`,heroBudgetFill:`BAyRca_heroBudgetFill`,rangeButtonActive:`BAyRca_rangeButtonActive`,chartLine:`BAyRca_chartLine`,balanceDetailHead:`BAyRca_balanceDetailHead`,heroLabel:`BAyRca_heroLabel`,siteKindDirect:`BAyRca_siteKindDirect`,healthBad:`BAyRca_healthBad`,currencyButtonActive:`BAyRca_currencyButtonActive`,reconcileDismiss:`BAyRca_reconcileDismiss`,kpiGrid:`BAyRca_kpiGrid`,popModel:`BAyRca_popModel`,healthOk:`BAyRca_healthOk`,feeChipPrimary:`BAyRca_feeChipPrimary`,peakCountSuccess:`BAyRca_peakCountSuccess`,ctlRowStretch:`BAyRca_ctlRowStretch`,shareDot:`BAyRca_shareDot`,tokenModelPartIn:`BAyRca_tokenModelPartIn`,triggerPop:`BAyRca_triggerPop`,triggerSparkBar:`BAyRca_triggerSparkBar`,ubNotesTerm:`BAyRca_ubNotesTerm`,tabButtonActive:`BAyRca_tabButtonActive`,ubAlertNote:`BAyRca_ubAlertNote`,plgTag:`BAyRca_plgTag`,budgetOverPulse:`BAyRca_budgetOverPulse`,siteRowTitle:`BAyRca_siteRowTitle`,healthDot:`BAyRca_healthDot`,modelTable:`BAyRca_modelTable`,currencyToggle:`BAyRca_currencyToggle`,plgItem:`BAyRca_plgItem`,tokenModelParts:`BAyRca_tokenModelParts`,peakClose:`BAyRca_peakClose`,progFill:`BAyRca_progFill`,triggerSub:`BAyRca_triggerSub`,heatmapCell:`BAyRca_heatmapCell`,siteRowCallsLow:`BAyRca_siteRowCallsLow`,plgNameRow:`BAyRca_plgNameRow`,peakHead:`BAyRca_peakHead`,chartStack:`BAyRca_chartStack`,providerGroupTitle:`BAyRca_providerGroupTitle`,chartBar:`BAyRca_chartBar`,shareLegend:`BAyRca_shareLegend`,exportButton:`BAyRca_exportButton`,kpiValue:`BAyRca_kpiValue`,panelTitle:`BAyRca_panelTitle`,feeItem:`BAyRca_feeItem`,dashboardModal:`BAyRca_dashboardModal`,setCardHead:`BAyRca_setCardHead`,pricingTable:`BAyRca_pricingTable`,unpricedHint:`BAyRca_unpricedHint`,dashboard:`BAyRca_dashboard`,roundsBarLabel:`BAyRca_roundsBarLabel`,heatmapCellEmpty:`BAyRca_heatmapCellEmpty`,switchKnob:`BAyRca_switchKnob`,balanceDetailValue:`BAyRca_balanceDetailValue`,popModelLabel:`BAyRca_popModelLabel`,subscriptionFillWarn:`BAyRca_subscriptionFillWarn`,balanceDetailClose:`BAyRca_balanceDetailClose`,heatmapRangeButton:`BAyRca_heatmapRangeButton`,vendorLetter:`BAyRca_vendorLetter`,heroMain:`BAyRca_heroMain`,tabPanel:`BAyRca_tabPanel`,subscriptionMeta:`BAyRca_subscriptionMeta`,userPriceRemove:`BAyRca_userPriceRemove`,roundsFlagMark:`BAyRca_roundsFlagMark`,peakCard:`BAyRca_peakCard`,metricCell:`BAyRca_metricCell`,rangeToggle:`BAyRca_rangeToggle`,shareSegAssistant:`BAyRca_shareSegAssistant`,metricValue:`BAyRca_metricValue`,heatmapRangeButtonActive:`BAyRca_heatmapRangeButtonActive`,roundsBars:`BAyRca_roundsBars`,setCardMeta:`BAyRca_setCardMeta`,popDot:`BAyRca_popDot`,switch:`BAyRca_switch`,chartBarPlaceholder:`BAyRca_chartBarPlaceholder`,peakTagPrimary:`BAyRca_peakTagPrimary`,popModelStatus:`BAyRca_popModelStatus`,ubAlert:`BAyRca_ubAlert`,heatmapYearWeekdays:`BAyRca_heatmapYearWeekdays`,ctlLabel:`BAyRca_ctlLabel`,providerGroupMeta:`BAyRca_providerGroupMeta`,shareValue:`BAyRca_shareValue`,heroGaugeTrack:`BAyRca_heroGaugeTrack`,heatmapLegend:`BAyRca_heatmapLegend`,bucketSep:`BAyRca_bucketSep`,chartGrid:`BAyRca_chartGrid`,ubAlertLeft:`BAyRca_ubAlertLeft`,modelDot:`BAyRca_modelDot`,subscriptionWindowLabel:`BAyRca_subscriptionWindowLabel`,heroMeta:`BAyRca_heroMeta`,feeChipAlert:`BAyRca_feeChipAlert`,modelCell:`BAyRca_modelCell`,tokenModelBar:`BAyRca_tokenModelBar`,ubTagNeutral:`BAyRca_ubTagNeutral`,heroValue:`BAyRca_heroValue`,chartTooltipDate:`BAyRca_chartTooltipDate`,peakAlertIn:`BAyRca_peakAlertIn`,peakCardPeak:`BAyRca_peakCardPeak`,setCardTitle:`BAyRca_setCardTitle`,providerGroupBalance:`BAyRca_providerGroupBalance`,dashboardRight:`BAyRca_dashboardRight`,userPriceRow:`BAyRca_userPriceRow`,userPriceOffPeak:`BAyRca_userPriceOffPeak`,peakDot:`BAyRca_peakDot`,shareSeg:`BAyRca_shareSeg`,ubCardControlGroup:`BAyRca_ubCardControlGroup`,planTag:`BAyRca_planTag`,currencyButton:`BAyRca_currencyButton`,heroBudgetFillOver:`BAyRca_heroBudgetFillOver`,heatmapYearBody:`BAyRca_heatmapYearBody`,triggerPopEmpty:`BAyRca_triggerPopEmpty`,ubCardHead:`BAyRca_ubCardHead`,dashboardHead:`BAyRca_dashboardHead`,siteRowCalls:`BAyRca_siteRowCalls`,vendorLogo:`BAyRca_vendorLogo`,heroTop:`BAyRca_heroTop`,heroGaugePct:`BAyRca_heroGaugePct`,bucketOfficial:`BAyRca_bucketOfficial`,shareSegOff:`BAyRca_shareSegOff`,bucketThird:`BAyRca_bucketThird`,heroGauge:`BAyRca_heroGauge`,tableScroll:`BAyRca_tableScroll`,ubModelName:`BAyRca_ubModelName`,ubTagError:`BAyRca_ubTagError`,triggerSparkHot:`BAyRca_triggerSparkHot`,subscriptionStatus:`BAyRca_subscriptionStatus`,subscriptionWindow:`BAyRca_subscriptionWindow`,userPriceInputNum:`BAyRca_userPriceInputNum`,heatmap:`BAyRca_heatmap`,ubNotes:`BAyRca_ubNotes`,peakCardCenter:`BAyRca_peakCardCenter`,ubModel:`BAyRca_ubModel`,tabButton:`BAyRca_tabButton`,healthBadge:`BAyRca_healthBadge`,heatmapYearGrid:`BAyRca_heatmapYearGrid`,ctlGroup:`BAyRca_ctlGroup`,ubRate:`BAyRca_ubRate`,ubTable:`BAyRca_ubTable`,popModelName:`BAyRca_popModelName`,heatmapYearCell:`BAyRca_heatmapYearCell`,popModelStatusLow:`BAyRca_popModelStatusLow`,chartLegendBar:`BAyRca_chartLegendBar`,floatSubPlan:`BAyRca_floatSubPlan`,heroSideLabel:`BAyRca_heroSideLabel`,popTagPrimary:`BAyRca_popTagPrimary`,feeSep:`BAyRca_feeSep`,subscriptionCard:`BAyRca_subscriptionCard`,estimatedTag:`BAyRca_estimatedTag`,numCol:`BAyRca_numCol`,feeChipError:`BAyRca_feeChipError`,uncataloguedTag:`BAyRca_uncataloguedTag`,dashboardIn:`BAyRca_dashboardIn`,ubTagPromo:`BAyRca_ubTagPromo`,balanceDetailTitle:`BAyRca_balanceDetailTitle`,chartLegendLine:`BAyRca_chartLegendLine`,rangeButton:`BAyRca_rangeButton`,triggerLabel:`BAyRca_triggerLabel`,metricLabel:`BAyRca_metricLabel`,kpiDetail:`BAyRca_kpiDetail`,panel:`BAyRca_panel`,triggerPopSwitcher:`BAyRca_triggerPopSwitcher`,popDotDirect:`BAyRca_popDotDirect`,kpiLabel:`BAyRca_kpiLabel`,chartTooltipSwatch:`BAyRca_chartTooltipSwatch`,subscriptionPlan:`BAyRca_subscriptionPlan`,ubExtraRow:`BAyRca_ubExtraRow`,plgLabel:`BAyRca_plgLabel`};let D={"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`}},ee={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 te(e){return e===``?e:ee[e]??e}function ne(e){let t=D[te(e)];return t?.type===`code`?t.tier:void 0}let O=[{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}],k,re,A,ie,j;function ae(e){j=e.length>0?e:void 0}function M(){return j}function N(e){return z(e)}function oe(e,t){if(j===void 0)return;let n=N(e),r=R(n);if(t!==void 0){for(let e of j)if(e.origin!==void 0&&e.origin!==``&&(N(e.key)===n||R(e.key)===r)&&e.origin===t)return{input:e.input,cacheHit:e.cacheHit,output:e.output,...e.currency===void 0?{}:{currency:e.currency}}}for(let e of j)if((e.origin===void 0||e.origin===``)&&(N(e.key)===n||R(e.key)===r))return{input:e.input,cacheHit:e.cacheHit,output:e.output,...e.currency===void 0?{}:{currency:e.currency}}}function se(e){k=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,re=e.prices,A=e.extraModels}function ce(e){ie=e}function le(){return k??6.79}function ue(){return{rate:le(),live:k!==void 0}}let de=Date.parse(`2026-09-14T04:00:00Z`),fe={input:1.5,cacheHit:.05,output:4.5},pe={flash:fe,"flash-vision-exp":fe,pro:{input:4.5,cacheHit:.15,output:13.5}};function me(e){return e>=9&&e<12||e>=14&&e<18}function he(e){return e==null||!Number.isFinite(e)?`peak`:ge(e)?`offPeak`:me((new Date(e).getUTCHours()+8)%24)?`peak`:`offPeak`}function ge(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}let _e=[540,720,840,1080];function P(e){return((e+288e5)%864e5+864e5)%864e5}function ve(e){let t=he(e),n=P(e);for(let r=0;r<7;r++){let i=r*864e5-n;for(let n of _e){let r=i+n*6e4;if(!(r<=0)&&he(e+r)!==t)return{tier:t,nextSwitchInMs:r}}}let r=_e[0]??0;return{tier:t,nextSwitchInMs:864e5-n+r*6e4}}function ye(e,t){let{nextSwitchInMs:n}=ve(e);if(n>t)return null;let r=e+n;return{entering:he(r),atMs:r}}function be(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 F=`09:00-12:00 / 14:00-18:00`,xe=`Standard / Flex`,I=[{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:F},{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:F},{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:F},{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:xe,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:xe,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}}],L={"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`,"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 R(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let Se=(()=>{let e=new Map,t=(t,n)=>{let r=R(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of I)t(e.key,e.key);for(let[e,n]of Object.entries(L))t(e,n);for(let e of O)t(e.key,e.key);return e})();function z(e){let t=L[e]??e;if(t===e){let t=R(e);if(t!==``){let e=Se.get(t);if(e!==void 0)return e;let n=(A??[]).find(e=>R(e.key)===t);if(n!==void 0)return n.key}}return t}function Ce(e){let t=z(e),n=re?.[t];if(n!==void 0)return n;let r=O.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function we(e){let t=z(e),n=I.find(e=>e.key===t),r=A?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=I.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():Te(r)),a=oe(t);if(a!==void 0)return{...i,userPriced:!0,price:{currency:a.currency??`CNY`,input:a.input,cacheHit:a.cacheHit,output:a.output}};let o=Ce(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function Te(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 Ee(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function B(e,t){let{promo:n}=e;if(n===void 0||!Ee(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 De(e,t){if(e.key!==`pro`||t>=de)return e;let n=pe.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 Oe(e=Date.now()){let t=[...I.filter(e=>e.retired!==!0).map(t=>De(B(t,e),e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>R(e.key)));for(let e of ie??[]){let i=e.id.toLowerCase();if((()=>{let t=z(e.id);return I.find(e=>e.key===t)})()!==void 0)continue;let a=R(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(A??[]).find(e=>R(e.key)===a),s;if(o!==void 0)s=Te(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=Ce(i);s=t===void 0?{key:z(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=oe(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 ke(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function V(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*le():a}function Ae(e,t,n=.5,r=Date.now()){let i=B(e,r),a=V(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:V(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function je(e){let t=le();return t>0?e/t:e}function H(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 Me(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 Ne(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function U(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 Pe(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let W={top:18,right:40,bottom:26,left:46};function Fe(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function Ie(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function Le(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 Re={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=>H(n===`usd`?je(e):e,n),l=e=>i===`tokens`?Ie(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-W.left-W.right,a=220-W.top-W.bottom,o=e=>n===1?W.left+r/2:W.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=>W.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>W.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:Re,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:E.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:x,linePath:S}=d,C=a===null?void 0:e[a],w=Le(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:E.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:E.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-W.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:W.left,x2:680-W.right,y1:n,y2:n,className:E.chartGrid}),(0,o.jsx)(`text`,{x:W.left-8,y:n+3,textAnchor:`end`,className:E.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===``?E.chartBar:E.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:E.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:S,fill:`none`,className:E.chartLine}),x.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-W.right+8,y:n+3,textAnchor:`start`,className:E.chartAxisLabel,children:Ie(e)},`calls-${t}`)}),w.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:E.chartAxisLabel,children:Fe(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:W.top,y2:W.top+m,className:E.chartCrosshair})]}),C!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:E.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(C.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:E.chartTooltipDate,children:C.date}),i!==`tokens`&&t.filter(e=>(C.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:E.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(C.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:E.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:E.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?Ie(C.tokens??0):c(C.cost)})]}),(0,o.jsxs)(`div`,{className:E.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:E.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:C.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:E.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartLegendLine}),`调用`]})]})]})}let G={top:14,right:42,bottom:22,left:46};function K(e){let t=Object.keys(e).sort(),n=[];for(let r of t.slice(-48)){let t=e[r];t!==void 0&&n.push({key:r,ttftMs:t.ttftAvg,...t.tpsAvg===void 0?{}:{tps:t.tpsAvg}})}return n}function q(e){return e.slice(5,13).replace(`T`,` `)}function J(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function Be(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Ve({perf:e,models:t,t:n}){let i=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,a=(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:i(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]),s=(0,r.useMemo)(()=>{let t=e===void 0?[]:K(e.byHour);if(t.length===0)return null;let n=t.length,r=680-G.left-G.right,i=180-G.top-G.bottom,a=e=>n===1?G.left+r/2:G.left+r*e/(n-1),o=Math.max(...t.map(e=>e.ttftMs),1),s=Math.max(...t.map(e=>e.tps??0),1),c=e=>G.top+i-e/o*i,l=e=>G.top+i-e/s*i,u=t.map((e,t)=>`${t===0?`M`:`L`}${a(t)} ${c(e.ttftMs)}`).join(` `),d=t.some(e=>e.tps!==void 0)?t.map((e,t)=>`${t===0?`M`:`L`}${a(t)} ${l(e.tps??0)}`).join(` `):``,f=Math.max(1,Math.ceil(n/8)),p=[];for(let e=0;e<n;e+=f)p.push(e);return n>0&&p[p.length-1]!==n-1&&p.push(n-1),{points:t,n,inner:a,yTtft:c,ttftPath:u,tpsPath:d,indices:p,ttftTicks:[0,.5,1].map(e=>o*e).reverse(),maxTps:s}},[e]);return e===void 0||a.length===0?(0,o.jsx)(`div`,{className:E.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)}):(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:E.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:E.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:E.numCol,children:n(`perfEstimated`)})]})}),(0,o.jsx)(`tbody`,{children:a.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:E.modelCell,children:[(0,o.jsx)(`span`,{className:E.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:E.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:E.numCol,children:J(e.ttftAvg)}),(0,o.jsx)(`td`,{className:E.numCol,children:J(e.ttftP50)}),(0,o.jsx)(`td`,{className:E.numCol,children:J(e.ttftP90)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):(0,o.jsxs)(`span`,{children:[J(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):Be(e.tpsAvg)}),(0,o.jsx)(`td`,{className:E.numCol,children:J(e.latencyAvg)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:E.na,children:`—`})})]},e.key))})]})}),s!==null&&(0,o.jsxs)(`div`,{className:E.chartWrap,"data-testid":`billing-perf-hour`,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:E.chartSvg,role:`img`,"aria-label":`Hourly TTFT and generation speed by model`,children:[s.ttftTicks.map((e,t)=>{let n=s.yTtft(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:G.left,x2:680-G.right,y1:n,y2:n,className:E.chartGrid}),(0,o.jsx)(`text`,{x:G.left-8,y:n+3,textAnchor:`end`,className:E.chartAxisLabel,children:e.toFixed(0)})]},`ttft-${t}`)}),(0,o.jsx)(`path`,{d:s.ttftPath,fill:`none`,className:E.chartLine}),s.tpsPath!==``&&(0,o.jsx)(`path`,{d:s.tpsPath,fill:`none`,className:E.chartLine,style:{stroke:`var(--dsw-static-amber-500)`,strokeDasharray:`4 4`}}),s.indices.map(e=>{let t=s.points[e];return t===void 0?null:(0,o.jsx)(`text`,{x:s.inner(e),y:174,textAnchor:`middle`,className:E.chartAxisLabel,children:q(t.key)},t.key)}),(0,o.jsxs)(`text`,{x:680-G.right+8,y:G.top+4,textAnchor:`start`,className:E.chartAxisLabel,children:[n(`perfTpsUnit`),` `,s.maxTps.toFixed(0)]})]}),(0,o.jsxs)(`div`,{className:E.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartLegendLine}),n(`perfTtft`),` (ms)`]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartLegendLine,style:{background:`var(--dsw-static-amber-500)`}}),n(`perfTps`),` (`,n(`perfTpsUnit`),`)`]})]})]})]})}let He=`@kenz1117/dsh-ui-usage-billing`,Y=`kenz1117`;function Ue({t:e,version:t}){return(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:E.plgHead,children:[(0,o.jsx)(`span`,{className:E.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:E.plgTitle,children:[(0,o.jsxs)(`div`,{className:E.plgNameRow,children:[(0,o.jsx)(`h3`,{className:E.plgName,children:He}),(0,o.jsx)(`span`,{className:E.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:E.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:E.plgGrid,children:[(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:E.plgLink,href:`https://github.com/${Y}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,Y,`)`]})]}),(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:E.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:E.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:He})]}),(0,o.jsxs)(`div`,{className:E.plgItem,children:[(0,o.jsx)(`span`,{className:E.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:E.plgVal,children:`MIT`})]})]})]})}function We(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 Ge(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let X={top:14,right:18,bottom:22,left:46},Ke=`var(--dsw-static-blue-500)`,qe=`#14b8a6`,Je=`var(--dsw-static-amber-500)`;function Ye(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 Xe(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,s=e.money;e.models;let{byDay:c,byModel:u,total:d}=t,[f,p]=(0,r.useState)(null),[m,h]=(0,r.useState)(`structure`),[g,_]=(0,r.useState)(null);t.byDayModels;let v=(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:E.shareSegUser},{label:a(`roleAssistant`),value:e.assistant,seg:E.shareSegAssistant},{label:a(`roleTool`),value:e.tool,seg:E.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,a]),y=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=We(n.getTime()),i=c[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[c,n]),b=(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:we(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]),x=(0,r.useMemo)(()=>{let e=d.cacheHit??0,t=d.cacheMiss??0,n=d.input??0,r=d.output??0,i=d.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 y){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}},[d,y]),S=(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]),C=(0,r.useMemo)(()=>{let e=y.length;if(e===0)return null;let t=680-X.left-X.right,n=200-X.top-X.bottom,r=Math.max(...y.map(e=>e.miss+e.hit+e.output),1),i=e=>X.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?X.left+t/2:X.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}},[y]);return(0,o.jsxs)(`div`,{className:E.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:E.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:E.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-token-export-csv`,onClick:()=>{let e=new Blob([Ye(y)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${We()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-token-export-json`,onClick:()=>{let e=new Blob([JSON.stringify({days:y,models:b,total:d},null,2)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${We()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},children:a(`exportJson`)})]}),(0,o.jsxs)(`div`,{className:E.kpiGrid,"data-testid":`billing-token-kpis`,children:[(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenCacheHitRate`)}),(0,o.jsxs)(`span`,{className:E.kpiValue,children:[x.cacheHitRate.toFixed(1),`%`]}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[U(x.hit),` / `,U(x.hit+x.miss),(d.cacheWrite??0)>0?` · ${a(`tokenCacheWrite`)} ${U(d.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenReasoningShare`)}),(0,o.jsxs)(`span`,{className:E.kpiValue,children:[x.reasoningPct.toFixed(1),`%`]}),(0,o.jsx)(`span`,{className:E.kpiDetail,children:U(x.reasoning)})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenIo`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:x.io.toFixed(2)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[U(x.input),` / `,U(x.output)]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:a(`tokenPeak`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:x.peak===void 0?`—`:Ge(x.peak.miss+x.peak.hit+x.peak.output)}),(0,o.jsx)(`span`,{className:E.kpiDetail,children:x.peak?.date??`—`})]})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`tokenDaily`)}),(0,o.jsx)(`span`,{className:E.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.rangeButton,n===e&&E.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]}),C===null?(0,o.jsx)(`div`,{className:E.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:E.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:E.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),children:[[0,.5,1].map(e=>{let t=C.max*e,n=C.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:X.left,x2:680-X.right,y1:n,y2:n,className:E.chartGrid}),(0,o.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:E.chartAxisLabel,children:Ge(t)})]},e)}),y.map((e,t)=>{let n=C.inner(t)-C.barW/2,r=C.y(0),i=C.y(e.miss),a=C.y(e.miss+e.hit),s=C.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:C.barW,height:r-i,fill:Ke}),(0,o.jsx)(`rect`,{x:n,y:a,width:C.barW,height:i-a,fill:qe}),(0,o.jsx)(`rect`,{x:n,y:s,width:C.barW,height:a-s,fill:Je})]},e.date)}),C.indices.map(e=>{let t=y[e];return t===void 0?null:(0,o.jsx)(`text`,{x:C.inner(e),y:194,textAnchor:`middle`,className:E.chartAxisLabel,children:t.date.slice(5)},t.date)})]}),(0,o.jsxs)(`div`,{className:E.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:Ke}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:qe}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.chartTooltipSwatch,style:{background:Je}}),a(`tokenOutput`)]})]})]})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`tokenByModel`)})}),b.length===0?(0,o.jsx)(`div`,{className:E.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:E.tableScroll,children:(0,o.jsxs)(`table`,{className:E.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:E.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:b.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:E.numCol,children:U(e.input)}),(0,o.jsx)(`td`,{className:E.numCol,children:U(e.output)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.reasoning>0?U(e.reasoning):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsxs)(`td`,{className:E.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:E.numCol,children:U(e.total)}),(0,o.jsx)(`td`,{className:E.numCol,children:(0,o.jsxs)(`span`,{className:E.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:E.tokenModelBar,children:(0,o.jsxs)(`span`,{className:E.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:E.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:E.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),S.totalCalls>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:E.tableScroll,children:(0,o.jsxs)(`table`,{className:E.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:E.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:E.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...S.top,...S.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelName,children:e})}),(0,o.jsx)(`td`,{className:E.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:E.numCol,children:[(t/S.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),v.length>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:a(`roleCost`)}),(0,o.jsx)(`span`,{className:E.panelHint,children:a(`roleHint`)})]}),(0,o.jsx)(`div`,{className:E.shareTrack,"data-testid":`billing-role-track`,children:v.map(e=>(0,o.jsx)(`div`,{className:l(E.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:E.shareLegend,children:v.map(e=>(0,o.jsxs)(`span`,{className:E.shareItem,children:[(0,o.jsx)(`span`,{className:l(E.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:E.shareValue,children:[s(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function Ze(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function Qe(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 $e(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 et({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:E.roundsEmpty,children:[i(`model`),` —`]});let u=e=>H(n===`usd`?je(e):e,n);return(0,o.jsxs)(`div`,{className:E.rounds,children:[(0,o.jsx)(`div`,{className:E.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=he(e.startedAt)===`peak`;return(0,o.jsxs)(`div`,{className:l(E.roundsBarCol,r?E.roundsBarColPeak:E.roundsBarColOff),children:[(0,o.jsx)(`span`,{className:E.roundsBarLabel,style:{bottom:`${n}%`},children:u(e.cost)}),(0,o.jsx)(`div`,{className:E.roundsBarWrap,children:(0,o.jsx)(`div`,{className:t?E.roundsBarFlagged:E.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${i(`model`)} ${e.model} · ${u(e.cost)} · ${Qe(e.startedAt)}${e.endedAt===void 0?``:` → ${Ze(e.endedAt)} (${$e(e.endedAt-e.startedAt)})`}`,children:t&&(0,o.jsx)(`span`,{className:E.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,o.jsxs)(`div`,{className:E.roundsAxis,children:[(0,o.jsxs)(`span`,{children:[i(`costAbbr`),` `,u(c)]}),(0,o.jsxs)(`span`,{children:[a.length,` 轮`]})]})]})}let Z=[`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)`],tt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function nt(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function rt(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:nt(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:nt(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=nt(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 it(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=nt(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=nt(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 at({days:e,currency:t,now:n,t:i,range:a=`month`}){let[s,c]=(0,r.useState)(null),l=e=>H(t===`usd`?je(e):e,t),u=(0,r.useMemo)(()=>rt(e,n??new Date),[e,n]);if(a===`year`){let t=it(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:tt[n-1]??``}),a=n)}),(0,o.jsxs)(`div`,{className:E.heatmapYear,"data-testid":`heatmap-year`,children:[(0,o.jsxs)(`div`,{className:E.heatmapYearBody,children:[(0,o.jsx)(`div`,{className:E.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,o.jsx)(`span`,{className:E.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,o.jsxs)(`div`,{className:E.heatmapYearScroll,children:[(0,o.jsx)(`div`,{className:E.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:r.map(e=>(0,o.jsx)(`span`,{className:E.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,o.jsx)(`div`,{className:E.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:E.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,style:{background:Z[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`},e.date))})]})]}),(0,o.jsxs)(`div`,{className:E.heatmapFooter,children:[(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:E.heatmapLegend,children:Z.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapMore`)})]})]})}return(0,o.jsxs)(`div`,{className:E.heatmap,children:[(0,o.jsx)(`div`,{className:E.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,o.jsx)(`div`,{className:E.heatmapCellEmpty,children:e.dayNum},e.date):(0,o.jsx)(`button`,{type:`button`,className:E.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,style:{background:Z[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:E.heatmapFooter,children:[(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:E.heatmapLegend,children:Z.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:E.heatmapLegendText,children:i(`heatmapMore`)}),s!==null&&(0,o.jsxs)(`span`,{className:E.heatmapHover,"data-testid":`heatmap-hover`,children:[s.date,` · `,l(s.value)]})]})]})}let ot={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function st(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function ct(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function lt(e,t){let n=t?.window??ot.window,r=t?.threshold??ot.threshold,i=t?.reasonFactor??ot.reasonFactor,a=t?.reasonHitDropPp??ot.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=ct(t),p=st(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=st(c),r=st(l),s=st(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 ut(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function dt(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function ft(e){return e.toFixed(2)}function pt(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,ft(n.cost)].join(`,`)})].join(`
|
|
3
|
+
`)}function mt(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[ut(dt(n)),r,t.calls,ft(t.cost)].join(`,`)})].join(`
|
|
4
|
+
`)}function ht(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function gt(e){return[`session_id,title,project,calls,cost_cny,last_active`,...e.map(e=>[ut(dt(e.id)),ut(dt(e.title??``)),ut(dt(ht(e.cwd))),e.calls,ft(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``].join(`,`))].join(`
|
|
5
|
+
`)}function _t(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 vt(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 yt=`usageBilling`,bt={title:`使用统计`,subtitle:`计费仪表盘`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,totalCost:`总费用`,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:`标题`,project:`项目`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`厂商计费与订阅`,estimated:`估算`,actual:`实际`,pricing:`模型单价表`,showPricing:`查看模型单价`,hidePricing:`收起单价表`,pricePerM:`¥ / 1M tokens`,input:`输入`,output:`输出`,cacheHit:`缓存命中`,peak:`高峰`,offPeak:`低谷`,flat:`全天统一`,peakHours:`高峰时段`,band:`时段`,openDashboard:`打开计费仪表盘`,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:`知道了`,subscriptions:`订阅套餐`,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:`暂无可选的订阅通道。`,floatPrev:`上一张订阅`,floatNext:`下一张订阅`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemove:`删除`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,workspaces:`工作区统计`,workspacesHint:`点击行下钻项目成本前 5 会话`,plan:`套餐`,remaining:`剩余`,unknownModel:`未定价`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,currentRound:`当前`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabDetails:`统计`,tabPricing:`费率`,tabSettings:`设置`,settingsHead:`偏好设置`,settingsHint:`管理与计费相关的偏好`,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:`按模型与按小时聚合;估算样本为工具续写步骤`,heatmapYear:`年`,heatmapMonth:`月`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginInfo:`插件信息`,pluginName:`插件名`,pluginDescription:`描述`,pluginVersion:`版本`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenCacheHitRate:`缓存命中率`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,tokenTotal:`总 Token`,tokenShare:`占比`,usageStatsTool:`注入用量查询工具`,usageStatsToolHint:`让模型可在对话中查询用量/费用;会占用模型每次请求的上下文,coding 场景建议关闭(改后需重载应用生效)`,balanceGranted:`赠金余额`,balanceTopped:`充值余额`,balanceDaily:`日均消耗`,balanceDaysLong:`约可撑`,balanceDaysUnit:`天`,popTodayModel:`主力消耗模型余额`,popTitle:`用量速览`,popNoConsumption:`暂无消耗`,popQuotaAlert:`额度提醒`,popRiskNone:`余额与配额正常`,popDirectLead:`直联`,popSubLead:`订阅`,popBalanceNormal:`余额正常`,popBalanceLow:`余额不足`,popQuotaNormal:`配额正常`,popQuotaLow:`配额将尽`,alertBalanceLow:`{name} 余额不足`,alertQuotaLow:`{name} 配额将尽`,unpricedHint:`{count} 个模型未收录计价,费用已按 0 计`,searchEstimateHint:`含 {count} 次联网搜索请求的估算费用(每次约 {each};日志无用量事件,按次估算,可在配置 searchCallEstimateCny 调整或关闭)`,siteListDisplay:`中转站列表`,siteListDisplayHint:`隐藏「未知路由 / 未识别」占位条目,净化中转站分布与额度列表`,exportCsvSite:`按站点 CSV`,panelRelay:`中转站分布`,relaySite:`中转站`,relayDirect:`直连`,relayUnknown:`未知路由`,panelRelayQuota:`中转站额度`,relayBalance:`余额`,relayNoQuota:`未读出额度`,relayWindowUsed:`已用`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`未识别`,relayCalls:`调用`},xt={title:`Usage`,subtitle:`Billing dashboard`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,liveTurn:`Turn`,liveSession:`Session`,totalCost:`Total`,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`,project:`Project`,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`,estimated:`Est.`,actual:`Actual`,pricing:`Model pricing`,showPricing:`View pricing`,hidePricing:`Hide pricing`,pricePerM:`¥ / 1M tokens`,input:`Input`,output:`Output`,cacheHit:`Cache hit`,peak:`Peak`,offPeak:`Off-peak`,flat:`Flat`,peakHours:`Peak hours`,band:`Band`,openDashboard:`Open billing dashboard`,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`,subscriptions:`Subscriptions`,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.`,floatPrev:`Previous subscription`,floatNext:`Next subscription`,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. Leave source empty for the model default, or enter a relay origin to price only that source.`,userPriceSave:`Save`,userPriceModel:`Model`,userPriceSource:`Source (relay origin)`,userPriceSourceHint:`Empty = default; e.g. https://api.relay.com`,userPriceCurrency:`Currency`,userPriceAdd:`Add`,userPriceRemove:`Remove`,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`,workspaces:`Workspaces`,workspacesHint:`Click a row to drill into its top-5 sessions`,plan:`Plan`,remaining:`Left`,unknownModel:`Unpriced`,model:`Model`,thModel:`Model name`,thInputMiss:`Input (cache miss)`,thInputHit:`Input (cache hit)`,currentRound:`current`,costAbbr:`cost`,tabOverview:`Overview`,tabTrends:`Trends`,tabProviders:`Bills`,tabDetails:`Stats`,tabPricing:`Rates`,tabSettings:`Settings`,settingsHead:`Preferences`,settingsHint:`Manage billing-related preferences`,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`,heatmapYear:`Year`,heatmapMonth:`Month`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginInfo:`Plugin info`,pluginName:`Name`,pluginDescription:`Description`,pluginVersion:`Version`,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`,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`,popQuotaAlert:`Quota alerts`,popRiskNone:`Balances & quotas OK`,popDirectLead:`Direct`,popSubLead:`Subscription`,popBalanceNormal:`balance ok`,popBalanceLow:`balance low`,popQuotaNormal:`quota ok`,popQuotaLow:`quota low`,alertBalanceLow:`{name} balance low`,alertQuotaLow:`{name} quota low`,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 "unknown route / unidentified" placeholder rows in relay distribution and quota lists`,exportCsvSite:`By site CSV`,panelRelay:`Relay sites`,relaySite:`Relay`,relayDirect:`Direct`,relayUnknown:`Unknown route`,panelRelayQuota:`Relay quota`,relayBalance:`Balance`,relayNoQuota:`No quota`,relayWindowUsed:`used`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`Unknown`,relayCalls:`calls`},St={"智谱 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 Ct(e,t){return t===`en`?St[e]??e:e}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 Tt(e){return wt[e]}let Et=`dsh-billing-peak-alert-v1`,Dt={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function Ot(){try{let e=localStorage.getItem(Et);if(e===null)return{...Dt};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:Dt.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))):Dt.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...Dt}}}function kt(e){try{localStorage.setItem(Et,JSON.stringify(e))}catch{}}function At(e,t,n){if(!t.enabled)return null;let r=ye(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 jt({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)),u=e.entering,d=n(u===`peak`?`tierPeak`:`tierOff`),f=n(u===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),p=u===`peak`;return(0,o.jsxs)(`div`,{className:l(E.peakCard,p?E.peakCardPeak:E.peakCardOff,t.position===`center`?E.peakCardCenter:E.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:E.peakHead,children:[(0,o.jsxs)(`span`,{className:l(E.peakTag,p?E.peakTagPrimary:E.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:l(E.peakDot,p?E.peakDotPrimary:E.peakDotSuccess),"aria-hidden":`true`}),d]}),(0,o.jsx)(`button`,{type:`button`,className:E.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:l(E.peakCount,p?E.peakCountPrimary:E.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:E.peakDesc,children:f})]})}let Mt=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}];function Nt(e){if(e!==void 0)return e.split(/[\\/]/).filter(Boolean).pop()??e}let Pt=[50,80,100],Ft={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},It={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 Lt(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 Rt(e,t){let n=Q(e),r=Q(t);if(Lt(n,r))return!0;let i=It[e];return i!==void 0&&i.some(e=>Lt(Q(e),r))}function zt(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(It))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(It))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let Bt={"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 Vt(e){let t=Bt[e];return t===void 0?zt(e)??e:t}function Ht(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 Ut(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)),[i,a]=t.split(`-`).map(Number),o=new Date(i,a,0).getDate(),s=r.length>0?r.reduce((t,n)=>t+(e[n]?.cost??0),0)/r.length:Ht(e,n);return s<=0?0:s*o}function Wt(e){let t=M();if(t===void 0||e.byDayModels===void 0)return e;let n=ue().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||R(t.key)===R(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=(t.cacheMiss*e.input+i*e.cacheHit+t.output*e.output)/1e6;return e.currency===`USD`?a*n:a};for(let[t,n]of Object.entries(e.byDayModels)){let u=0,d={};for(let[i,a]of Object.entries(n)){let n=oe(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:oe(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=>!oe(e))}}function Gt(){return typeof Notification<`u`&&Notification.permission===`granted`}let Kt=new Set;function qt(e,t){Kt.has(e)||(Kt.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 Jt(e){return Object.keys(e).length}function Yt(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 Xt(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 Zt(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 Qt(e,t){return e.checked?e.okProviders.some(e=>Rt(t,e))?E.healthOk:e.badProviders.some(e=>Rt(t,e))?E.healthBad:E.healthIdle:E.healthIdle}function $t(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 en(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 tn(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 nn(e,t){return e.startsWith(`site:`)?{name:e.slice(5),kind:`site`}:e.startsWith(`direct:`)?{name:e.slice(7),kind:`direct`}:{name:t(`relayUnknown`),kind:`unknown`}}function rn(e,t){switch(e){case`site`:return t(`relaySite`);case`direct`:return t(`relayDirect`);default:return t(`relayUnknown`)}}function an(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let on={site:E.siteKindSite,direct:E.siteKindDirect,unknown:E.siteKindUnknown},sn={"new-api":E.siteKindSite,sub2api:E.siteKindDirect,unknown:E.siteKindUnknown},cn=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 ln(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let un=[`#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 fn(){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.byHour!==null&&typeof r.perf.byHour==`object`?{perf:r.perf}:{},...typeof r.pluginVersion==`string`?{pluginVersion:r.pluginVersion}:{}}}catch{return null}}let pn=!1;async function mn(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){pn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){pn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(pn)return;pn=!0}setTimeout(()=>{mn(e+1)},2e3);return}pn=!1,se(i)}catch{pn=!1}}async function hn(){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 gn(){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 _n(){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 vn(){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 yn(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}}function bn(e){let{wide:t,t:n,onOpen:a,monthCost:s,todayCost:c,weekCost:u,days:d,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]),[x,S]=(0,r.useState)(0),C=b.length===0?0:Math.min(x,b.length-1),w=b[C];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||b.length<2)return;let e=setInterval(()=>S(e=>(e+1)%b.length),1500);return()=>clearInterval(e)},[m.mode,b.length]);let T=(0,r.useRef)(null),[D,ee]=(0,r.useState)(!1),[te,ne]=(0,r.useState)({left:0,top:0}),O=(0,r.useRef)(void 0),k=(0,r.useCallback)(()=>{window.clearTimeout(O.current),ee(!0)},[]),re=(0,r.useCallback)(()=>{window.clearTimeout(O.current),O.current=window.setTimeout(()=>ee(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(O.current),[]);let A=(0,r.useCallback)(()=>{let e=T.current?.getBoundingClientRect();e!==void 0&&ne({left:e.left,top:e.top-8})},[]);(0,r.useEffect)(()=>{if(!D)return;let e=()=>A();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[D,A]);let ie=(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:E.railButton,"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${H(s)}`,children:ie});let j=g.metric===`tokens`,ae=d.map(e=>j?e.tokens:e.cost),M=Math.max(...ae,0),N=ae.map(e=>M>0?4+e/M*12:4);return(0,o.jsxs)(`span`,{ref:T,className:E.triggerWrap,onMouseEnter:()=>{A(),k()},onMouseLeave:re,onFocusCapture:()=>{A(),k()},onBlurCapture:()=>ee(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:E.trigger,"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${H(s)}`,children:[(0,o.jsx)(`span`,{className:E.triggerIcon,"data-testid":`billing-trigger-icon`,children:ie}),(0,o.jsxs)(`span`,{className:E.triggerMain,children:[(0,o.jsxs)(`span`,{className:E.triggerPrimary,children:[(0,o.jsx)(`span`,{className:E.triggerLabel,children:n(j?`triggerMonthTokens`:`triggerMonth`)}),j?(0,o.jsx)(`span`,{className:E.triggerMetric,"data-testid":`billing-trigger-month-tokens`,children:U(_)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:E.triggerYen,"aria-hidden":`true`,children:H(s).charAt(0)}),(0,o.jsx)(`span`,{className:E.triggerMetric,children:H(s).slice(1)})]})]}),(0,o.jsx)(`span`,{className:E.triggerSub,"data-testid":`billing-trigger-today`,children:j?`${n(`triggerToday`)} ${U(v)} · ${n(`weekCost`)} ${U(y)}`:`${n(`triggerToday`)} ${H(c)} · ${n(`weekCost`)} ${H(u)}`})]}),(0,o.jsx)(`span`,{className:E.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:N.map((e,t)=>(0,o.jsx)(`span`,{className:t===N.length-1?E.triggerSparkHot:E.triggerSparkBar,style:{height:`${e}px`}},d[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:l(E.triggerPop,D&&E.triggerPopShown),style:{left:`${te.left}px`,top:`${te.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!D,onMouseEnter:k,onMouseLeave:re,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:b.length===0?(0,o.jsx)(`span`,{className:E.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[w!==void 0&&(0,o.jsxs)(`div`,{className:E.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:E.floatSubHead,children:[(0,o.jsx)(`span`,{className:E.floatSubName,children:w.displayName}),w.plan!==void 0&&(0,o.jsx)(`span`,{className:E.floatSubPlan,children:w.plan})]}),w.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:E.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:E.subscriptionWindowLabel,children:tn(e.kind,n)}),(0,o.jsx)(`span`,{className:E.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(E.subscriptionFill,t>=100&&E.subscriptionFillOver,t>=80&&t<100&&E.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:E.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(E.subscriptionPct,r&&E.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${ln(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),b.length>1&&(0,o.jsx)(`span`,{className:E.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:E.triggerPopSwitchCount,children:[C+1,`/`,b.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:E.popHead,children:(0,o.jsx)(`span`,{className:E.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:E.metricGrid,children:[(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`monthCost`)}),(0,o.jsx)(`span`,{className:l(E.metricValue,E.metricValuePrimary),children:H(s)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`tokenTotal`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:U(p.totalToken)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:U(p.input)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:U(p.output)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:l(E.metricValue,E.metricValueSuccess),children:U(p.cacheRead)})]}),(0,o.jsxs)(`span`,{className:E.metricCell,children:[(0,o.jsx)(`span`,{className:E.metricLabel,children:n(`calls`)}),(0,o.jsx)(`span`,{className:E.metricValue,children:p.calls.toLocaleString()})]})]}),(0,o.jsxs)(`span`,{className:E.popModel,children:[(0,o.jsx)(`span`,{className:E.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:E.popModelRow,children:[(0,o.jsx)(`span`,{className:l(E.popDot,E.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:E.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:l(E.popModelStatus,f.direct.low&&E.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:E.popModelRow,children:[(0,o.jsx)(`span`,{className:l(E.popDot,E.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:E.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:l(E.popModelStatus,f.sub.low&&E.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:E.popModelRow,children:[(0,o.jsx)(`span`,{className:l(E.popDot,E.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function xn({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:E.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:E.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:E.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:E.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:E.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(Sn,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(Sn,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(Sn,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(Sn,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(Sn,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function Sn({label:e,value:t}){return(0,o.jsxs)(`span`,{className:E.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:E.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:E.balanceDetailValue,children:t})]})}function Cn({userPrices:e,onUserPrices:t,t:n}){let[i,a]=(0,r.useState)(()=>[...e]),s=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),c=e=>a(t=>t.filter((t,n)=>n!==e)),u=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),d=()=>t(i.filter(e=>e.key.trim()!==``)),f=(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})),p=e=>Number.isFinite(e)&&e!==0?String(e):``,m=(e,t,n)=>{let r=Number(n);s(e,{[t]:Number.isFinite(r)&&r>=0?r:0})};return(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:E.setCardHead,children:(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:E.ctlCol,children:[i.map((e,t)=>(0,o.jsxs)(`div`,{className:E.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:E.userPriceInput,"data-testid":`billing-user-price-model`,type:`text`,value:e.key,placeholder:`flash`,"aria-label":n(`userPriceModel`),onChange:e=>s(t,{key:e.target.value})})]}),(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:E.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>s(t,{origin:e.target.value.trim()})})]}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}),(0,o.jsx)(`input`,{className:E.userPriceInputNum,type:`number`,min:0,step:.01,value:p(e[r]),onChange:e=>m(t,r,e.target.value)})]},r)),(0,o.jsxs)(`div`,{className:E.userPriceField,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:E.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,e.currency!==`USD`&&E.floatModeBtnOn),onClick:()=>f(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,e.currency===`USD`&&E.floatModeBtnOn),onClick:()=>f(t,`USD`),children:`USD`})]})]}),(0,o.jsx)(`button`,{type:`button`,className:E.userPriceRemove,"aria-label":n(`userPriceRemove`),onClick:()=>c(t),children:n(`userPriceRemove`)})]},t)),(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-user-price-add`,onClick:u,children:n(`userPriceAdd`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-user-price-save`,onClick:d,children:n(`userPriceSave`)})]})]})]})}function wn({stats:e,t,onClose:n,userPrices:i,onUserPrices:s,health:c,balances:u,reconcile:d,quotas:f,relayQuotas:p,currency:m,onCurrency:h,turns:g,renderSlot:_,budgetEnabled:v,budgetAmount:y,onToggleBudget:b,onBudgetAmount:x,peakConfig:S,onPeakConfig:C,onPreviewPeak:w,floatPrefs:T,onFloatPrefs:D,cardPrefs:ee,onCardPrefs:te,sitePrefs:O,onSitePrefs:k,quotasStale:re}){let[A,ie]=(0,r.useState)(`cost`),{total:j,byModel:ae,byDay:M}=e,[N,oe]=(0,r.useState)(`overview`),[se,ce]=(0,r.useState)(7),[le,de]=(0,r.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),fe=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},pe=(0,r.useCallback)(()=>{let e=fe();de(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[me,he]=(0,r.useState)(`month`),ge=(0,r.useMemo)(()=>f.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[f]),[_e,P]=(0,r.useState)(),[ve,ye]=(0,r.useState)(),[be,F]=(0,r.useState)(new Set),xe=(0,r.useCallback)(e=>{F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[I,L]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return vn().then(t=>{e&&t!==void 0&&L(t)}),()=>{e=!1}},[]);let R=(0,r.useCallback)(()=>{let e=!I;L(e),yn(e).then(t=>{t||L(!e)})},[I]),Se=ue(),z=e=>H(m===`usd`?je(e):e,m),Ce=m===`usd`?`en`:`zh`,Te=e=>Ct(e,Ce),B=(e,n)=>e===0?t(`free`):Me(Ne(e,n,m,Se.rate),m===`usd`?`USD`:`CNY`),De=(0,r.useMemo)(()=>lt([...g].reverse()),[g]),V={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},W=V.peak/2,Fe=Ht(M,$()),Ie=e=>u.find(t=>Q(t.provider)===Q(e)),Le=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),Re=e=>{if(e===void 0)return(0,o.jsx)(`span`,{className:E.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:E.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:z(e.totalBalance),r=e.currency===`USD`?e.totalBalance*Se.rate:e.totalBalance,i=Fe>0?Math.floor(r/Fe):void 0;return(0,o.jsxs)(`span`,{className:E.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:l(E.balanceDaysBadge,i<=3&&E.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:()=>{P(_e===e.provider?void 0:e.provider)},children:`?`}),_e===e.provider&&(0,o.jsx)(xn,{balance:e,days:i??0,dailyBurn:Fe,money:z,t,onClose:()=>{P(void 0)}})]})},G=j.cacheHit+j.cacheMiss>0?j.cacheHit/(j.cacheHit+j.cacheMiss)*100:0,K=Object.keys(M).sort(),q=$(),J=M[q]?.cost??0,Be=q.slice(0,7),He=q.slice(0,4),Y=K.reduce((e,t)=>e+(t.startsWith(Be)?M[t]?.cost??0:0),0),We=K.reduce((e,t)=>e+(t.startsWith(He)?M[t]?.cost??0:0),0),Ge=(0,r.useMemo)(()=>Ut(M,Be,q)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[M,Be,q,f]),X=(0,r.useMemo)(()=>{let e=v&&y>0?Y/y*100:NaN;return{pct:Number.isFinite(e)?Math.max(0,Math.min(100,e)):We>0?Math.max(0,Math.min(100,Y/We*100)):0,over:Number.isFinite(e)&&e>=100,label:t(Number.isFinite(e)?`budget`:`monthCost`)}},[v,y,Y,We,t]),Ke=v&&y>0?Y/y*100:0,qe=(0,r.useMemo)(()=>{let e=[];for(let t=se-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push($(n.getTime()))}return e},[se]),Je=qe.at(-1)??q,Ye=(0,r.useMemo)(()=>Object.entries(M).map(([e,t])=>({date:e,value:t.cost})),[M]),Ze=Jt(M),Qe=Yt(M),$e=(0,r.useMemo)(()=>qe.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=M[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}}),[qe,M,e.byDayModels]),Z=(0,r.useMemo)(()=>Object.entries(ae).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=we(e),r=n.key===`other`,i=r?zt(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:Ae(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:un[t%un.length]??`#8b95a3`})),[ae]),tt=(0,r.useMemo)(()=>Object.entries(e.bySite??{}).filter(([e])=>!(O.hideUnidentified&&e===`unknown`)).sort((e,t)=>(t[1].cost??0)-(e[1].cost??0)),[e.bySite,O.hideUnidentified]),nt=(0,r.useMemo)(()=>O.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,O.hideUnidentified]),rt=(0,r.useMemo)(()=>{let e=new Map;for(let t of f){if(t.status===`not-configured`)continue;let n=Vt(t.provider),r=e.get(n);r===void 0?e.set(n,[t]):r.push(t)}let t=new Map,n=new Map;for(let t of e.keys())n.set(Q(t),t);for(let e of Z){let r=e.provider;if(e.plan===!0){let t=zt(e.key);t!==void 0&&(r=t)}let i=n.get(Q(r))??r,a=t.get(i);a===void 0?t.set(i,[e]):a.push(e)}let r=[...new Set([...t.keys(),...e.keys()])].map(n=>({name:n,models:t.get(n)??[],subscriptions:e.get(n)??[],balance:Ie(n),dot:Qt(c,n)})),i=new Set(r.map(e=>Q(e.name)));for(let e of u)i.has(Q(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&r.push({name:e.displayName,models:[],subscriptions:[],balance:e,dot:Qt(c,e.displayName)});return r.sort((e,t)=>{let n=e=>e.models.reduce((e,t)=>e+(t.actual??t.estimated),0),r=n(t)-n(e);return r===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`):r})},[Z,f,u,c]),it=Z.reduce((e,t)=>e+t.estimated,0),ot=j.cost>0?j.cost:it,st=j.calls>0?ot/j.calls:0,ct=(0,r.useMemo)(()=>Z.map(e=>({key:e.key,name:e.name,color:e.color})),[Z]),ut=$e.length>=2?$e.at(-2)?.cost??0:0,dt=ut>0?(J-ut)/ut*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:l(E.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:E.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:E.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:E.headTitleRow,children:[(0,o.jsx)(`h2`,{className:E.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:E.dashboardSubtitle,children:[t(`lastUpdated`),` `,Je,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:E.dashboardRight,children:[(0,o.jsx)(`span`,{className:E.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.currencyButton,m===e&&E.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:l(E.healthBadge,c.available?E.healthBadgeOk:E.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:l(E.healthDot,c.available?E.healthOk:E.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:E.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:E.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:Mt.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":N===e.id,className:l(E.tabButton,N===e.id&&E.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{oe(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:E.dashboardBody,children:[N===`overview`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[d?.kind===`drift`&&d.spent!==void 0&&le!==fe()&&(0,o.jsxs)(`div`,{className:E.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:E.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:E.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,d.provider??``).replace(`{spent}`,z(d.spent)).replace(`{today}`,z(d.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:E.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:pe,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:E.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:E.heroTop,children:[(0,o.jsxs)(`div`,{className:E.heroMain,children:[(0,o.jsx)(`span`,{className:E.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:E.heroReadout,children:[(0,o.jsx)(`span`,{className:E.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:E.heroValue,children:z(Y).slice(1)})]}),(0,o.jsxs)(`span`,{className:E.heroMeta,children:[j.calls.toLocaleString(),` `,t(`calls`)]})]}),(0,o.jsxs)(`div`,{className:E.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`svg`,{className:E.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:E.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:l(E.heroGaugeArc,X.over&&E.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${X.pct/100*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:E.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:l(E.heroGaugePct,X.over&&E.heroGaugePctOver),children:[X.pct.toFixed(0),`%`]}),(0,o.jsx)(`span`,{className:E.heroGaugeLabel,children:X.label})]})]})]}),v&&y>0&&(0,o.jsxs)(`div`,{className:E.heroBudget,"data-testid":`billing-hero-budget`,children:[(0,o.jsx)(`span`,{className:E.heroBudgetLabel,children:t(`budget`)}),(0,o.jsx)(`div`,{className:E.heroBudgetTrack,role:`progressbar`,"aria-valuenow":Math.min(Ke,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),children:(0,o.jsx)(`div`,{className:l(E.heroBudgetFill,Ke>=100&&E.heroBudgetFillOver),style:{width:`${Math.min(Ke,100)}%`}})}),(0,o.jsxs)(`span`,{className:E.heroBudgetValue,children:[z(Y),` / `,z(y),` · `,Ke.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:E.heroSide,children:[(0,o.jsxs)(`div`,{className:E.heroSideItem,children:[(0,o.jsx)(`span`,{className:E.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:E.heroSideValue,children:z(We)})]}),(0,o.jsxs)(`div`,{className:E.heroSideItem,children:[(0,o.jsx)(`span`,{className:E.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:E.heroSideValue,children:[z(J),(0,o.jsxs)(`span`,{className:l(E.delta,dt>=0?E.deltaUp:E.deltaDown),children:[dt>=0?`▲`:`▼`,` `,Math.abs(dt).toFixed(1),`%`]})]})]}),Ge>0&&(0,o.jsxs)(`div`,{className:E.heroSideItem,children:[(0,o.jsx)(`span`,{className:E.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:E.heroSideValue,children:z(Ge)})]}),Ge<=0&&(0,o.jsx)(`span`,{className:E.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:E.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:E.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,z(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`section`,{className:E.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:E.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:l(E.kpiValue,E.kpiGreen),children:Pe(G)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[U(j.cacheHit),` / `,U(j.cacheHit+j.cacheMiss)]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:U(j.input+j.output)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[t(`inputTokens`),` `,U(j.input),` · `,t(`outputTokens`),` `,U(j.output)]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:z(st)}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[t(`calls`),` `,j.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:E.kpiTile,children:[(0,o.jsx)(`span`,{className:E.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:E.kpiValue,children:j.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:E.kpiDetail,children:[Z.length,` `,t(`models`)]})]})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:E.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`year`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.heatmapRangeButton,me===e&&E.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":me===e,onClick:()=>{he(e)},children:t(e===`month`?`heatmapMonth`:`heatmapYear`)},e))}),(0,o.jsxs)(`span`,{className:E.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,Ze,` · `,t(`streakDays`),` `,Qe]})]}),(0,o.jsx)(at,{days:Ye,currency:m,t,range:me})]})]}),N===`settings`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:E.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:l(E.switch,v&&E.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:E.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:E.ctlCol,children:[(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:E.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:E.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:E.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=>{x(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=Y/y*100;return(0,o.jsx)(`div`,{className:E.ctlRowStretch,children:(0,o.jsx)(`div`,{className:E.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:l(E.progFill,e>=100&&E.budgetFillOver,e>=80&&e<100&&E.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:E.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,z(Y)).replace(`{total}`,z(y))})]})]}),(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":S.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:l(E.switch,S.enabled&&E.switchOn),onClick:()=>{C({...S,enabled:!S.enabled})},children:(0,o.jsx)(`span`,{className:E.switchKnob})})]}),S.enabled&&(0,o.jsxs)(`div`,{className:E.ctlCol,children:[(0,o.jsxs)(`label`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:E.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:S.leadMin,className:E.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);C({...S,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):S.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:E.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:E.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:S.position===e,onChange:()=>C({...S,position:e})}),(0,o.jsx)(`span`,{className:E.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:E.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:E.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:S.mode===e,onChange:()=>C({...S,mode:e})}),(0,o.jsx)(`span`,{className:E.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:S.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{C({...S,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:E.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:E.btn,onClick:w,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:E.setCard,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":I,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:l(E.switch,I&&E.switchOn),onClick:R,children:(0,o.jsx)(`span`,{className:E.switchKnob})})]})}),(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:E.setCardHead,children:(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:E.ctlCol,children:[(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:E.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,T.mode===`combined`&&E.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>D({mode:`combined`,targets:T.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,T.mode===`subscription`&&E.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>D({mode:`subscription`,targets:T.targets}),children:t(`floatModeSubscription`)})]})]}),T.mode===`subscription`&&(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:E.ctlGroup,"data-testid":`billing-float-targets`,children:[ge.map(e=>{let t=T.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:E.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>D({mode:`subscription`,targets:t?T.targets.filter(t=>t!==e.id):[...T.targets,e.id]})}),(0,o.jsx)(`span`,{className:E.floatTargetLabel,children:e.label})]},e.id)}),ge.length===0&&(0,o.jsx)(`span`,{className:E.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`section`,{className:E.setCard,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:E.setCardHead,children:(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:E.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsx)(`div`,{className:E.ctlCol,children:(0,o.jsxs)(`div`,{className:E.ctlRow,children:[(0,o.jsx)(`span`,{className:E.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:E.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,ee.metric===`money`&&E.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>te({metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:l(E.floatModeBtn,ee.metric===`tokens`&&E.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>te({metric:`tokens`}),children:t(`cardMetricTokens`)})]})]})})]}),(0,o.jsx)(`section`,{className:E.setCard,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:E.setCardHead,children:[(0,o.jsxs)(`div`,{className:E.setCardMeta,children:[(0,o.jsx)(`h3`,{className:E.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:E.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:l(E.switch,O.hideUnidentified&&E.switchOn),onClick:()=>k({hideUnidentified:!O.hideUnidentified}),children:(0,o.jsx)(`span`,{className:E.switchKnob})})]})}),(0,o.jsx)(Cn,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(Ue,{t,version:e.pluginVersion})]}),N===`trends`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:l(E.ubCard,E.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:E.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:E.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.rangeButton,se===e&&E.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:E.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(E.rangeButton,A===e&&E.rangeButtonActive),"aria-pressed":A===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{ie(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:E.ubCardSub,children:Je})]}),(0,o.jsx)(ze,{data:$e,models:ct,currency:m,metric:A})]}),g.length>0&&(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`rounds`)}),De.length>0&&(0,o.jsxs)(`span`,{className:E.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[De.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:E.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(et,{rounds:g,flags:De,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=V.peak+V.offPeak;if(e<=0)return null;let n=V.peak/e*100;return(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:E.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:E.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:l(E.shareSeg,E.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:l(E.shareSeg,E.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:E.shareLegend,children:[(0,o.jsxs)(`span`,{className:E.shareItem,children:[(0,o.jsx)(`span`,{className:E.shareDot,style:{background:`var(--dsw-static-blue-500)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:E.shareValue,"data-testid":`billing-share-peak`,children:[z(V.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:E.shareItem,children:[(0,o.jsx)(`span`,{className:E.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:E.shareValue,"data-testid":`billing-share-offpeak`,children:[z(V.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),W>0&&(0,o.jsx)(`div`,{className:E.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,z(W))})]})})()]}),N===`providers`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[tt.length>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-relay-sites`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`panelRelay`)})}),(0,o.jsx)(`div`,{className:E.providerGroupList,"data-testid":`billing-relay-sites`,children:tt.map(([e,n])=>{let r=nn(e,t);return(0,o.jsxs)(`div`,{className:E.siteRow,"data-testid":`billing-relay-site`,children:[(0,o.jsxs)(`span`,{className:E.siteRowName,children:[(0,o.jsx)(`span`,{className:l(E.siteKindTag,on[r.kind]),children:rn(r.kind,t)}),(0,o.jsx)(`span`,{className:E.siteRowTitle,children:r.name})]}),(0,o.jsxs)(`span`,{className:E.siteRowMeta,children:[(0,o.jsx)(`span`,{className:E.siteRowCost,children:z(n.cost)}),(0,o.jsxs)(`span`,{className:E.siteRowCalls,children:[n.calls,` `,t(`relayCalls`)]})]})]},e)})})]}),nt.length>0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:E.panelHead,children:(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:E.providerGroupList,"data-testid":`billing-relay-quotas`,children:nt.map(e=>(0,o.jsxs)(`div`,{className:E.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:E.siteRowName,children:[(0,o.jsx)(`span`,{className:l(E.siteKindTag,sn[e.kind]),children:an(e.kind,t)}),(0,o.jsx)(`span`,{className:E.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:E.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:E.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:l(E.siteRowCalls,n&&E.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:E.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:E.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${ln(e.updatedAt)}`})]}),re&&(0,o.jsx)(`div`,{className:E.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),rt.length===0?(0,o.jsx)(`div`,{className:E.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:E.providerGroupList,"data-testid":`billing-provider-groups`,children:rt.map(e=>(0,o.jsxs)(`div`,{className:E.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:E.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:E.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:l(E.healthDot,e.dot),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:E.providerGroupName,children:Te(e.name)})]}),(0,o.jsxs)(`span`,{className:E.providerGroupMeta,children:[e.subscriptions.length>0&&(0,o.jsxs)(`span`,{className:E.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` 套餐`]}),!Le(e)&&e.balance!==void 0&&(0,o.jsxs)(`span`,{className:E.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:E.providerGroupBalanceLabel,children:t(`balance`)}),Re(e.balance)]})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:l(E.tableScroll,E.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:E.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`actual`)})]})}),(0,o.jsx)(`tbody`,{children:e.models.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:E.modelCell,children:[(0,o.jsx)(Tn,{provider:e.provider,colorVar:e.color}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:E.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:E.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:E.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:E.modelProvider,children:Te(e.provider)})]})]})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:E.numCol,children:U(e.input)}),(0,o.jsx)(`td`,{className:E.numCol,children:U(e.output)}),(0,o.jsx)(`td`,{className:E.numCol,children:Pe(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.plan?(0,o.jsx)(`span`,{className:E.planTag,children:t(`subscriptionIncluded`)}):e.actual===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:E.bucketCost,children:[(0,o.jsx)(`span`,{className:E.bucketOfficial,children:z(t)}),(0,o.jsx)(`span`,{className:E.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:E.bucketThird,children:z(n)})]}):z(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:E.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=en(e.status,t);return(0,o.jsxs)(`div`,{className:E.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:E.subscriptionHead,children:[(0,o.jsx)(`span`,{className:E.subscriptionName,children:Te(e.displayName)}),e.planType===`code`&&(()=>{let n=ne(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:E.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,z(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:E.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:E.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:E.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:E.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:E.subscriptionWindowLabel,children:tn(e.kind,t)}),(0,o.jsx)(`span`,{className:E.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(E.subscriptionFill,n>=100&&E.subscriptionFillOver,n>=80&&n<100&&E.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:E.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(E.subscriptionPct,r&&E.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:E.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${ln(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:E.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:E.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-day`,onClick:()=>{vt(_t(`usage-daily`,`csv`,Object.keys(M)),pt(M),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{vt(_t(`usage-sessions`,`csv`,Object.keys(M)),gt(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{vt(_t(`usage-sites`,`csv`,Object.keys(M)),mt(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:E.exportButton,"data-testid":`billing-export-json`,onClick:()=>{vt(_t(`usage-stats`,`json`,Object.keys(M)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:E.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:E.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:E.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:E.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`sessionTitle`)}),(0,o.jsx)(`th`,{children:t(`project`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`lastActive`)})]})}),(0,o.jsxs)(`tbody`,{children:[e.bySession.length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:5,className:E.emptyRow,children:t(`noData`)})}),$t(e.bySession).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&be.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelProvider,children:Nt(e.cwd)??`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:E.numCol,children:z(e.cost)}),(0,o.jsx)(`td`,{className:E.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${ln(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?E.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{xe(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:E.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:l(E.ubTag,E.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:E.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:E.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),N===`token`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(Xe,{stats:e,trendDays:se,onTrendDays:ce,models:ct,money:z,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:E.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:E.panelHead,children:[(0,o.jsx)(`h3`,{className:E.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:E.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(Ve,{perf:e.perf,models:ct,t})]})]}),N===`pricing`&&(0,o.jsxs)(`div`,{className:E.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:E.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:E.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:E.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,H(Se.rate)]}),(0,o.jsx)(`span`,{className:l(E.ubTag,Se.live?E.ubTagSuccess:E.ubTagNeutral),children:Se.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:E.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:E.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:E.ubCardHead,children:[(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:E.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:E.ubTablewrap,children:(0,o.jsxs)(`table`,{className:E.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:E.numCol,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:Oe().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:E.ubModel,children:[(0,o.jsx)(Tn,{provider:e.provider,colorVar:ke(e.colorVar)}),(0,o.jsxs)(`span`,{className:E.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:E.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Ee(e.promo,Date.now())&&(0,o.jsx)(`span`,{className:E.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:E.numCol,children:n?B(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:n?B(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:n?B(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(`span`,{className:E.ubPricepair,children:[(0,o.jsxs)(`span`,{className:E.ubChipPeak,children:[(0,o.jsx)(`span`,{className:E.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:E.num,children:[B(e.price.input,e.price.currency),` / `,B(e.price.output,e.price.currency)]})]}),(0,o.jsxs)(`span`,{className:E.ubChipOff,children:[(0,o.jsx)(`span`,{className:E.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:E.num,children:[B(e.price.offPeak.input,e.price.currency),` / `,B(e.price.offPeak.output,e.price.currency)]})]})]}):n?(0,o.jsx)(`span`,{className:E.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:E.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:E.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:E.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:E.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:E.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):B(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:E.numCol,children:(0,o.jsx)(`span`,{className:E.na,children:`—`})}),(0,o.jsx)(`td`,{className:E.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:E.na,children:`—`}):B(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:E.numCol,children:(0,o.jsx)(`span`,{className:E.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:E.ubCard,children:[(0,o.jsx)(`div`,{className:E.ubCardHead,children:(0,o.jsx)(`h3`,{className:E.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:E.ubNotes,children:[(0,o.jsxs)(`li`,{className:E.ubNotesItem,children:[(0,o.jsx)(`span`,{className:E.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:E.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:E.ubNotesItem,children:[(0,o.jsx)(`span`,{className:E.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:E.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:E.ubNotesItem,children:[(0,o.jsx)(`span`,{className:E.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:E.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:E.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 Tn({provider:e,colorVar:t}){let n=Tt(e);return n===void 0?(0,o.jsx)(`span`,{className:E.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()}):(0,o.jsx)(`img`,{className:E.vendorLogo,src:n,alt:``,"aria-hidden":`true`})}function En(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(dn),[m,h]=(0,r.useState)(Ft),[v,y]=(0,r.useState)([]),[S,T]=(0,r.useState)(void 0),[E,D]=(0,r.useState)([]),[ee,te]=(0,r.useState)(!1),[ne,O]=(0,r.useState)([]),[k,re]=(0,r.useState)(`cny`),[A,ie]=(0,r.useState)(()=>f()),j=(0,r.useCallback)(e=>{ie(e),p(e)},[]),[M,N]=(0,r.useState)(()=>b()),oe=(0,r.useCallback)(e=>{N(e),x(e)},[]),[se,le]=(0,r.useState)(()=>g()),de=(0,r.useCallback)(e=>{le(e),_(e)},[]),[fe,pe]=(0,r.useState)(()=>{let e=C();return ae(e),e}),me=(0,r.useCallback)(e=>{pe(e),ae(e),w(e)},[]),ge=(0,r.useMemo)(()=>Wt(u),[u,fe]),_e=k===`usd`?`en`:`zh`,P=(0,r.useCallback)((e,n)=>{let r=(_e===`en`?xt:bt)[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},[_e,t]),[ve,ye]=(0,r.useState)(!1),be=(0,r.useCallback)(()=>{ye(!1)},[]),F=(0,r.useCallback)(()=>{fn().then(e=>{e!==null&&d(Wt(e))}),hn().then(({balances:e,reconcile:t})=>{e.length>0&&y(e),T(t)}),gn().then(e=>{e.length>0&&D(e),te(!1)}).catch(()=>{te(!0)}),_n().then(e=>{O(e)}).catch(()=>{})},[]),xe=(0,r.useCallback)(()=>{F(),mn(),ye(!0)},[F]);(0,r.useEffect)(()=>{F(),mn()},[F]),(0,r.useEffect)(()=>{let e=setInterval(()=>{F(),mn()},cn);return()=>{clearInterval(e)}},[F]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(h(t),ce(t.catalog??[]))}),()=>{e=!1}},[n]);let I=$(),L=Object.entries(u.byDay).filter(([e])=>e.startsWith(I.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),R=u.byDay[I]?.cost??0,Se=Zt(u.byDay,I),z=(0,r.useMemo)(()=>Xt(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]),Ce=Object.entries(u.byDay).filter(([e])=>e.startsWith(I.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Te=(()=>{let e=u.byDay[I];return e===void 0?0:e.input+e.output})(),Ee=Zt(u.byDay,I,e=>e.input+e.output),B=c(e=>e.enabled),De=c(e=>e.amount),Oe=c(e=>e.tierAlertDays),ke=c(e=>e.lastTierSwitchAt),[V,Ae]=(0,r.useState)(()=>Ot()),[je,Me]=(0,r.useState)(null),[Ne,U]=(0,r.useState)(null),[Pe,W]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>W(Date.now()),cn);return()=>{clearInterval(e)}},[]);let Fe=(0,r.useCallback)(e=>{Ae(e),kt(e)},[]),Ie=(0,r.useCallback)(()=>{U({entering:he(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4})},[]),Le=De>0?De:u.budget??0,Re=(0,r.useCallback)(()=>{let e=!B;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,B]);(0,r.useEffect)(()=>{if(!B||Le<=0)return;let e=L/Le*100,t=Pt.filter(t=>e>=t&&Oe?.[String(t)]!==I);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,I),!Gt())return;let r=P(`budgetTierBody`).replace(`{cost}`,H(L)).replace(`{budget}`,H(Le)).replace(`{pct}`,String(n));qt(`budget:${n}:${I}`,()=>{new Notification(P(`budget`),{body:r})})},[B,Le,L,Oe,I,l,P]),(0,r.useEffect)(()=>{let e=At(Pe,V,ke);if(e===null||(l.markTierSwitchAlerted(e.atMs),Me(e),!V.webNotify||!Gt()))return;let t=Math.max(1,Math.round((e.atMs-Pe)/6e4)),n=P(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=P(e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));qt(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[Pe,ke,V,l,P]);let ze=c(e=>e.lastBalanceAlertDay),G=u.lowBalanceThreshold??50,K=(0,r.useMemo)(()=>{if(v.length===0)return;let e=Ht(u.byDay,I),t=ue().rate;for(let n of v){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=G)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[v,u.lowBalanceThreshold,u.byDay,I]);(0,r.useEffect)(()=>{if(K===void 0||ze===I||(l.markBalanceAlerted(I),!Gt()))return;let e=P(`balanceLowBody`).replace(`{name}`,K.name).replace(`{balance}`,H(K.cny)).replace(`{days}`,K.days===void 0?`—`:String(K.days));qt(`balance:${I}`,()=>{new Notification(P(`balance`),{body:e})})},[K,ze,I,l,P]);let q=(0,r.useMemo)(()=>{let e=I.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=we(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=v.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=v.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`?P(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?P(`balanceUnreachable`):P(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:H(t.totalBalance),r=ue().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<G}},a=e=>{let t=E.find(t=>t.displayName===e||Vt(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:P(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?P(`subscriptionExhausted`):P(`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,v,E,I]),J=(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:R,monthCost:L})},[R,L,i]),(0,r.useEffect)(()=>a(xe),[a,xe]);let Be=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(bn,{...e,t:P,onOpen:xe,monthCost:L,todayCost:R,weekCost:Se,days:z,vendorStatus:q,dash:J,cardPrefs:se,monthTokens:Ce,todayTokens:Te,weekTokens:Ee,floatPrefs:A,subscriptions:E}),ve&&(0,o.jsx)(wn,{stats:ge,t:P,onClose:be,userPrices:fe,onUserPrices:me,health:m,balances:v,...S===void 0?{}:{reconcile:S},quotas:E,relayQuotas:ne,currency:k,onCurrency:re,turns:Be,renderSlot:s,budgetEnabled:B,budgetAmount:Le,onToggleBudget:Re,onBudgetAmount:l.setAmount,peakConfig:V,onPeakConfig:Fe,onPreviewPeak:Ie,floatPrefs:A,onFloatPrefs:j,cardPrefs:se,onCardPrefs:de,sitePrefs:M,onSitePrefs:oe,quotasStale:ee}),(je!==null||Ne!==null)&&(0,o.jsx)(jt,{hit:je??Ne,config:V,t:P,onDismiss:()=>{Me(null),U(null)}})]})}function Dn(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function On(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 kn(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 An(){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 jn(){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 Mn(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function Nn({useSession:e,t}){let n=e(e=>e.sessionId),[i,a]=(0,r.useState)(null),[s,c]=(0,r.useState)([]),[l,u]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=!1,t=()=>{An().then(t=>{!e&&t!==null&&a(t)}),jn().then(t=>{e||c(t)}),e||u(Date.now())};t();let n=setInterval(t,3e4);return()=>{e=!0,clearInterval(n)}},[n]);let d=(0,r.useMemo)(()=>Dn(i,n),[i,n]),f=(0,r.useMemo)(()=>On(i,n),[i,n]),p=ve(l),m=(0,r.useMemo)(()=>kn(s),[s]),h=e=>H(e,`cny`);if(n===void 0)return null;let g=d>0||f>0,_=p.tier===`peak`;return(0,o.jsxs)(`span`,{className:E.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:_?E.feeChipPrimary:E.feeChipOff,"data-testid":`billing-live-tier`,children:t(_?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:E.feeCount,children:be(p.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:E.feeSuffix,children:t(_?`tierToOff`:`tierToPeak`)}),g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:E.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:E.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:E.feeNum,children:h(f)})]}),(0,o.jsx)(`span`,{className:E.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:E.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:E.feeNum,children:h(d)})]})]}),m.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:E.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?E.feeChipError:E.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(Mn(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function Pn(){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 Fn(){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 In={enabled:!1,timeout:0};function Ln(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...In};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...In}}}function Rn(e){return e.completed===!0||e.running===!1}function zn(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)),Rn(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=Rn(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 Bn=[`slots`,`locale`,`connection`,`sessions`];function Vn(e){let t=Pn();e.provide(`billingMetrics`,t);let n=Fn(),r=e.get(`connection`);e.effect(()=>e.locale.register(yt,{zh:bt,en:xt}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:yt,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}},store:n,inject:()=>({checkModels:async()=>{try{let{result:e}=await r.api.llm.models({});if(!e.ok)return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]};let t=[];for(let n of e.value.groups)for(let e of n.models)t.push({id:e.id,...typeof e.name==`string`&&e.name!==``?{name:e.name}:{},provider:n.name});return{checked:!0,available:e.value.groups.length>0,models:e.value.groups.reduce((e,t)=>e+t.models.length,0),failures:e.value.failures.length,okProviders:e.value.groups.map(e=>e.name),badProviders:e.value.failures.map(e=>e.name),catalog:t}}catch{return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]}}},publishCosts:e=>{t.publishCosts(e)},registerOpen:e=>t.registerOpen(e)})},En)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:yt},Nn)),e.effect(()=>zn(e.sessions.list,Ln),`ui-usage-billing: completion notifier`)}return n.UsageBilling=En,n.apply=Vn,n.inject=Bn,t.exports}});
|
|
6
6
|
//# sourceMappingURL=client.js.map
|
package/lib/index.js
CHANGED
|
@@ -329,7 +329,7 @@ const GEMINI_PEAK_HOURS = "Standard / Flex";
|
|
|
329
329
|
const MODEL_CATALOG = [
|
|
330
330
|
{
|
|
331
331
|
key: "flash",
|
|
332
|
-
name: "DeepSeek V4 Flash",
|
|
332
|
+
name: "DeepSeek V4.1 Flash",
|
|
333
333
|
provider: "DeepSeek",
|
|
334
334
|
colorVar: "dsw-static-blue-500",
|
|
335
335
|
price: {
|
|
@@ -350,6 +350,7 @@ const MODEL_CATALOG = [
|
|
|
350
350
|
name: "DeepSeek V4 Flash Vision (Exp)",
|
|
351
351
|
provider: "DeepSeek",
|
|
352
352
|
colorVar: "dsw-static-blue-500",
|
|
353
|
+
retired: true,
|
|
353
354
|
price: {
|
|
354
355
|
currency: "CNY",
|
|
355
356
|
input: 2,
|
|
@@ -273,6 +273,11 @@ export interface ModelEntry {
|
|
|
273
273
|
uncatalogued?: boolean;
|
|
274
274
|
/** 该条目当前按用户自定义单价计价(设置面板可维护);费率表标注「自定义」。 */
|
|
275
275
|
userPriced?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* 厂商已下线的模型(请求由继任型号服务、按继任单价计):不进费率表面板,
|
|
278
|
+
* 目录条目与历史回算保留——存量用量仍按原键计价与显示,删条目会破坏历史计算。
|
|
279
|
+
*/
|
|
280
|
+
retired?: boolean;
|
|
276
281
|
}
|
|
277
282
|
export declare const MODEL_CATALOG: readonly ModelEntry[];
|
|
278
283
|
/**
|
|
@@ -328,7 +333,9 @@ export declare function applyPromo(entry: ModelEntry, nowMs: number): ModelEntry
|
|
|
328
333
|
* 会把费率表撑爆;它们只作为目录外模型的计价回退源(见 {@link livePriceOf} /
|
|
329
334
|
* {@link modelOf})。探活模型在此逐个对价:内置已有的跳过去重;目录外但
|
|
330
335
|
* models.dev 有价的按归一化 id 复用其 USD 价;两者皆无的标 `uncatalogued`。
|
|
331
|
-
* 内置条目按 nowMs
|
|
336
|
+
* 内置条目按 nowMs 折算限时促销(生效中的条目显示折后单价,过期自动恢复刊例价),
|
|
337
|
+
* 应用路由分界期的现行价覆盖(V4 Pro 见 {@link applyRoutingDisplay}),并滤除
|
|
338
|
+
* 已下线条目(retired:官方下线的型号不进面板,目录与历史回算保留)。
|
|
332
339
|
* @param nowMs - 促销判定时刻;缺省当前时刻。
|
|
333
340
|
*/
|
|
334
341
|
export declare function catalogEntries(nowMs?: number): readonly ModelEntry[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenz1117/dsh-ui-usage-billing",
|
|
3
3
|
"description": "Usage billing dashboard for DeepSeek Harness: sidebar cost metrics plus a full dashboard modal, priced from a current multi-provider catalog with real usage aggregated from session logs.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.17",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|