@kenz1117/dsh-ui-usage-billing 1.1.12 → 1.1.13

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 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 ee(e){try{localStorage.setItem(y,JSON.stringify(e))}catch{}}let x=`dsh.ui-usage-billing.prices`;function S(){try{let e=localStorage.getItem(x);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 C(e){try{localStorage.setItem(x,JSON.stringify(e))}catch{}}let w=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(w)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=w,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_ubStatGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;display:grid}.BAyRca_ubStatCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;gap:4px;padding:14px 16px;display:flex}.BAyRca_ubStatLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_ubStatValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;letter-spacing:-.01em;font-size:22px;font-weight:700;line-height:28px}.BAyRca_ubStatDetail{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.BAyRca_rowlist{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.BAyRca_rowline{width:100%;min-width:0;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:10px;justify-content:space-between;align-items:center;gap:12px;padding:9px 12px;transition:background-color .14s,border-color .14s;display:flex}.BAyRca_rowline:hover{background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 60%, transparent);border-color:var(--dsw-alias-border-l1)}.BAyRca_rowlineName{min-width:0;color:var(--dsw-alias-label-primary);white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:12.5px;font-weight:500;overflow:hidden}.BAyRca_rowlineRight{font-variant-numeric:tabular-nums;flex:none;align-items:baseline;gap:8px;display:inline-flex}.BAyRca_rowlineMuted{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_rowlineChev{color:var(--dsw-alias-label-tertiary);font-size:14px}.BAyRca_rowlineDrillWrap{padding-left:12px}.BAyRca_rowlineDrill{border-left:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:12px;padding:6px 12px;font-size:12px;display:flex}.BAyRca_modelTable,.BAyRca_pricingTable{border-collapse:collapse;width:100%;font-size:12.5px}.BAyRca_modelTable{table-layout:fixed;min-width:640px}.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;transition:transform .12s;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}body[data-zine-mode] .BAyRca_trigger,body[data-zine-mode] .BAyRca_triggerPop,body[data-zine-mode] .BAyRca_railButton{display:none}body[data-zine-mode] .BAyRca_dashboardHead{background:#000;border-bottom:2px solid #e8ff00}body[data-zine-mode] .BAyRca_headTitleRow{align-items:center;gap:8px;margin-top:4px;display:flex}body[data-zine-mode] .BAyRca_dashboardTitle{color:#e8ff00;letter-spacing:.04em;text-transform:uppercase;text-shadow:0 0 8px #e8ff0066;font-weight:900}body[data-zine-mode] .BAyRca_dashboardSubtitle{color:#c9d98a;letter-spacing:.08em;text-transform:uppercase;font-size:10px}body[data-zine-mode] .BAyRca_closeButton{color:#0a0a05;background:#ff2d95;border:1.5px solid #ff2d95;border-radius:0;box-shadow:0 0 10px #ff2d9573}body[data-zine-mode] .BAyRca_hero{background:#000;border:2.5px solid #e8ff00;border-radius:0;position:relative;box-shadow:0 0 0 1px #0009,0 0 24px #e8ff002e}body[data-zine-mode] .BAyRca_heroLabel{color:#c9d98a;letter-spacing:.12em;text-transform:uppercase;font-size:10px;font-weight:900}body[data-zine-mode] .BAyRca_heroValue{color:#e8ff00;letter-spacing:-.02em;text-shadow:0 0 12px #e8ff0073;-webkit-text-fill-color:#e8ff00;background:0 0;font-size:38px;font-weight:900}body[data-zine-mode] .BAyRca_heroMeta{color:#c9d98a;letter-spacing:.06em;text-transform:uppercase;font-size:10.5px}body[data-zine-mode] .BAyRca_heroSideLabel{color:#c9d98a;letter-spacing:.1em;text-transform:uppercase;font-size:10px;font-weight:900}body[data-zine-mode] .BAyRca_heroSideValue{color:#e8ff00;text-shadow:0 0 6px #e8ff0059}body[data-zine-mode] .BAyRca_delta{font-weight:900}body[data-zine-mode] .BAyRca_deltaUp{color:#ff2d95}body[data-zine-mode] .BAyRca_deltaDown{color:#c9d98a}body[data-zine-mode] .BAyRca_tabNav{background:#000;border-bottom:2px solid #e8ff00}body[data-zine-mode] .BAyRca_tabButton{color:#c9d98a;letter-spacing:.08em;text-transform:uppercase;border-radius:0;font-size:10.5px;font-weight:900}body[data-zine-mode] .BAyRca_tabButton:hover,body[data-zine-mode] .BAyRca_tabButton:focus-visible{color:#e8ff00;background:#e8ff001f}body[data-zine-mode] .BAyRca_tabButtonActive,body[data-zine-mode] .BAyRca_tabButtonActive:hover,body[data-zine-mode] .BAyRca_tabButtonActive:focus-visible{color:#0a0a05;background:#e8ff00;box-shadow:0 0 10px #e8ff0073}body[data-zine-mode] .BAyRca_panel{background:#000;border:2px solid #e8ff00;border-radius:0}body[data-zine-mode] .BAyRca_trendPanel{position:relative}body[data-zine-mode] .BAyRca_panelTitle{color:#e8ff00;letter-spacing:.06em;text-transform:uppercase;text-shadow:0 0 6px #e8ff0066;font-weight:900}body[data-zine-mode] .BAyRca_panelHint{color:#c9d98a;letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:900}body[data-zine-mode] .BAyRca_modelTableScroll{background:#000;border:1.5px solid #e8ff0080;border-radius:0}.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 T={dashboardIn:`BAyRca_dashboardIn`,heroBudgetLabel:`BAyRca_heroBudgetLabel`,heroBudgetFillOver:`BAyRca_heroBudgetFillOver`,feeChipAlert:`BAyRca_feeChipAlert`,chartLegend:`BAyRca_chartLegend`,balanceDetailPop:`BAyRca_balanceDetailPop`,rounds:`BAyRca_rounds`,rowlineRight:`BAyRca_rowlineRight`,heroValue:`BAyRca_heroValue`,healthBadge:`BAyRca_healthBadge`,balanceDetailTitle:`BAyRca_balanceDetailTitle`,popDotDirect:`BAyRca_popDotDirect`,popDotSub:`BAyRca_popDotSub`,plgIcon:`BAyRca_plgIcon`,floatSubHead:`BAyRca_floatSubHead`,rdoDot:`BAyRca_rdoDot`,railButton:`BAyRca_railButton`,ubRate:`BAyRca_ubRate`,ubAlertNote:`BAyRca_ubAlertNote`,heatmapRangeButton:`BAyRca_heatmapRangeButton`,dashboardHead:`BAyRca_dashboardHead`,chartBarPlaceholder:`BAyRca_chartBarPlaceholder`,popDot:`BAyRca_popDot`,shareItem:`BAyRca_shareItem`,ubTagNeutral:`BAyRca_ubTagNeutral`,ubCard:`BAyRca_ubCard`,heroSide:`BAyRca_heroSide`,pricingTable:`BAyRca_pricingTable`,roundsAxis:`BAyRca_roundsAxis`,floatTargetLabel:`BAyRca_floatTargetLabel`,tokenModelBar:`BAyRca_tokenModelBar`,setCardMeta:`BAyRca_setCardMeta`,heroGaugeArc:`BAyRca_heroGaugeArc`,peakCardCenter:`BAyRca_peakCardCenter`,heroMeta:`BAyRca_heroMeta`,shareSeg:`BAyRca_shareSeg`,reconcileDismiss:`BAyRca_reconcileDismiss`,popTitle:`BAyRca_popTitle`,heroMain:`BAyRca_heroMain`,ubNotesTerm:`BAyRca_ubNotesTerm`,chartSvg:`BAyRca_chartSvg`,siteRowName:`BAyRca_siteRowName`,peakCountPrimary:`BAyRca_peakCountPrimary`,shareTrack:`BAyRca_shareTrack`,ubStatValue:`BAyRca_ubStatValue`,btn:`BAyRca_btn`,budgetInput:`BAyRca_budgetInput`,ubTagPromo:`BAyRca_ubTagPromo`,tabPanelIn:`BAyRca_tabPanelIn`,budgetFillWarn:`BAyRca_budgetFillWarn`,ubCardControlGroup:`BAyRca_ubCardControlGroup`,subscriptionAuto:`BAyRca_subscriptionAuto`,plgNameRow:`BAyRca_plgNameRow`,progFill:`BAyRca_progFill`,ubCardSub:`BAyRca_ubCardSub`,heroBudgetTrack:`BAyRca_heroBudgetTrack`,ctlRowStretch:`BAyRca_ctlRowStretch`,siteKindDirect:`BAyRca_siteKindDirect`,heroSideLabel:`BAyRca_heroSideLabel`,modelCell:`BAyRca_modelCell`,siteKindSite:`BAyRca_siteKindSite`,exportLabel:`BAyRca_exportLabel`,providerGroupBalance:`BAyRca_providerGroupBalance`,shareSegUser:`BAyRca_shareSegUser`,vendorLogo:`BAyRca_vendorLogo`,chartEmpty:`BAyRca_chartEmpty`,tableScroll:`BAyRca_tableScroll`,dashboardBody:`BAyRca_dashboardBody`,modelProvider:`BAyRca_modelProvider`,providerGroupBadge:`BAyRca_providerGroupBadge`,roundsBarColPeak:`BAyRca_roundsBarColPeak`,subscriptionGoldFlow:`BAyRca_subscriptionGoldFlow`,chartTooltip:`BAyRca_chartTooltip`,ubTag:`BAyRca_ubTag`,heroGaugeSvg:`BAyRca_heroGaugeSvg`,metricGrid:`BAyRca_metricGrid`,rowlineName:`BAyRca_rowlineName`,metricCell:`BAyRca_metricCell`,heatmapYearGrid:`BAyRca_heatmapYearGrid`,peakTagPrimary:`BAyRca_peakTagPrimary`,reconcileIcon:`BAyRca_reconcileIcon`,subscriptionPlan:`BAyRca_subscriptionPlan`,heroBudgetValue:`BAyRca_heroBudgetValue`,peakDot:`BAyRca_peakDot`,inp:`BAyRca_inp`,roundsBar:`BAyRca_roundsBar`,na:`BAyRca_na`,triggerPopSubscription:`BAyRca_triggerPopSubscription`,heatmapYearMonths:`BAyRca_heatmapYearMonths`,heatmapGrid:`BAyRca_heatmapGrid`,rowlineDrill:`BAyRca_rowlineDrill`,ctlLabel:`BAyRca_ctlLabel`,deltaUp:`BAyRca_deltaUp`,ubStatLabel:`BAyRca_ubStatLabel`,triggerPop:`BAyRca_triggerPop`,heroGaugeTrack:`BAyRca_heroGaugeTrack`,ubExtraRow:`BAyRca_ubExtraRow`,modelDot:`BAyRca_modelDot`,dashboardTitle:`BAyRca_dashboardTitle`,peakClose:`BAyRca_peakClose`,peakAlertIn:`BAyRca_peakAlertIn`,triggerIcon:`BAyRca_triggerIcon`,triggerMetric:`BAyRca_triggerMetric`,switch:`BAyRca_switch`,subscriptionExhausted:`BAyRca_subscriptionExhausted`,triggerSparkHot:`BAyRca_triggerSparkHot`,heatmapFooter:`BAyRca_heatmapFooter`,ubNotes:`BAyRca_ubNotes`,chartWrap:`BAyRca_chartWrap`,triggerLabel:`BAyRca_triggerLabel`,ubCardHead:`BAyRca_ubCardHead`,subscriptionStatus:`BAyRca_subscriptionStatus`,reconcileNotice:`BAyRca_reconcileNotice`,setCard:`BAyRca_setCard`,roundsEmpty:`BAyRca_roundsEmpty`,uncataloguedTag:`BAyRca_uncataloguedTag`,budgetOverPulse:`BAyRca_budgetOverPulse`,balanceCell:`BAyRca_balanceCell`,roundsBarFlagged:`BAyRca_roundsBarFlagged`,triggerPrimary:`BAyRca_triggerPrimary`,rowlineMuted:`BAyRca_rowlineMuted`,plgGrid:`BAyRca_plgGrid`,rowlist:`BAyRca_rowlist`,shareLegend:`BAyRca_shareLegend`,peakHead:`BAyRca_peakHead`,peakDotSuccess:`BAyRca_peakDotSuccess`,tabNav:`BAyRca_tabNav`,trigger:`BAyRca_trigger`,popHead:`BAyRca_popHead`,floatSubPlan:`BAyRca_floatSubPlan`,peakDesc:`BAyRca_peakDesc`,peakCountSuccess:`BAyRca_peakCountSuccess`,peakCard:`BAyRca_peakCard`,feeSuffix:`BAyRca_feeSuffix`,dashboardRight:`BAyRca_dashboardRight`,peakCardCorner:`BAyRca_peakCardCorner`,dashboard:`BAyRca_dashboard`,floatTarget:`BAyRca_floatTarget`,heroGaugeArcOver:`BAyRca_heroGaugeArcOver`,exportButton:`BAyRca_exportButton`,ubTablewrap:`BAyRca_ubTablewrap`,heroGauge:`BAyRca_heroGauge`,providerGroupTitle:`BAyRca_providerGroupTitle`,ubNotesItem:`BAyRca_ubNotesItem`,dashboardModal:`BAyRca_dashboardModal`,planTag:`BAyRca_planTag`,roundsBars:`BAyRca_roundsBars`,kpiDetail:`BAyRca_kpiDetail`,ubStatGrid:`BAyRca_ubStatGrid`,rdo:`BAyRca_rdo`,healthBadgeBad:`BAyRca_healthBadgeBad`,peakCardPeak:`BAyRca_peakCardPeak`,flatTag:`BAyRca_flatTag`,userPriceOffPeak:`BAyRca_userPriceOffPeak`,chartTooltipDate:`BAyRca_chartTooltipDate`,feeChipPrimary:`BAyRca_feeChipPrimary`,heatmapYear:`BAyRca_heatmapYear`,roundsBarLabel:`BAyRca_roundsBarLabel`,chartCrosshair:`BAyRca_chartCrosshair`,chartStack:`BAyRca_chartStack`,heroSideSpacer:`BAyRca_heroSideSpacer`,heroGaugeCenter:`BAyRca_heroGaugeCenter`,panelHead:`BAyRca_panelHead`,feeChipOff:`BAyRca_feeChipOff`,trendPanel:`BAyRca_trendPanel`,popModelName:`BAyRca_popModelName`,ubAlert:`BAyRca_ubAlert`,roundsBarCol:`BAyRca_roundsBarCol`,heatmapYearWeekday:`BAyRca_heatmapYearWeekday`,heatmapYearCell:`BAyRca_heatmapYearCell`,sessionGroupRow:`BAyRca_sessionGroupRow`,triggerSub:`BAyRca_triggerSub`,rowlineDrillWrap:`BAyRca_rowlineDrillWrap`,providerGroupMeta:`BAyRca_providerGroupMeta`,modelName:`BAyRca_modelName`,budgetFillOver:`BAyRca_budgetFillOver`,plgHead:`BAyRca_plgHead`,rowline:`BAyRca_rowline`,currencyButton:`BAyRca_currencyButton`,heatmapYearScroll:`BAyRca_heatmapYearScroll`,peakTagSuccess:`BAyRca_peakTagSuccess`,rangeToggle:`BAyRca_rangeToggle`,heroReadout:`BAyRca_heroReadout`,triggerWrap:`BAyRca_triggerWrap`,healthBad:`BAyRca_healthBad`,rangeButton:`BAyRca_rangeButton`,triggerPopShown:`BAyRca_triggerPopShown`,heatmapRangeButtonActive:`BAyRca_heatmapRangeButtonActive`,floatModeBtn:`BAyRca_floatModeBtn`,plgItem:`BAyRca_plgItem`,ubTable:`BAyRca_ubTable`,subscriptionFillOver:`BAyRca_subscriptionFillOver`,affix:`BAyRca_affix`,shareSegOff:`BAyRca_shareSegOff`,popModelStatus:`BAyRca_popModelStatus`,shareValue:`BAyRca_shareValue`,hero:`BAyRca_hero`,feeNum:`BAyRca_feeNum`,chartGrid:`BAyRca_chartGrid`,popModelLabel:`BAyRca_popModelLabel`,rangeButtonActive:`BAyRca_rangeButtonActive`,ubExtraName:`BAyRca_ubExtraName`,subscriptionHead:`BAyRca_subscriptionHead`,plgLink:`BAyRca_plgLink`,setCardTitle:`BAyRca_setCardTitle`,providerGroupHead:`BAyRca_providerGroupHead`,tabButtonActive:`BAyRca_tabButtonActive`,ctlCol:`BAyRca_ctlCol`,ubModelName:`BAyRca_ubModelName`,healthDot:`BAyRca_healthDot`,siteKindUnknown:`BAyRca_siteKindUnknown`,plgVal:`BAyRca_plgVal`,peakTag:`BAyRca_peakTag`,subscriptionTrack:`BAyRca_subscriptionTrack`,modelTable:`BAyRca_modelTable`,popDotNeutral:`BAyRca_popDotNeutral`,tokenModelParts:`BAyRca_tokenModelParts`,siteRowCallsLow:`BAyRca_siteRowCallsLow`,feeBar:`BAyRca_feeBar`,metricValue:`BAyRca_metricValue`,tabButton:`BAyRca_tabButton`,ubStatCard:`BAyRca_ubStatCard`,ubPricepair:`BAyRca_ubPricepair`,healthBadgeOk:`BAyRca_healthBadgeOk`,roundsBarWrap:`BAyRca_roundsBarWrap`,currencyButtonActive:`BAyRca_currencyButtonActive`,heatmapYearMonth:`BAyRca_heatmapYearMonth`,balanceDetailHead:`BAyRca_balanceDetailHead`,switchKnob:`BAyRca_switchKnob`,providerGroup:`BAyRca_providerGroup`,roundsFlagMark:`BAyRca_roundsFlagMark`,heatmapHover:`BAyRca_heatmapHover`,setCardHead:`BAyRca_setCardHead`,ctlGroup:`BAyRca_ctlGroup`,estimatedTag:`BAyRca_estimatedTag`,peakCardOff:`BAyRca_peakCardOff`,tabPanel:`BAyRca_tabPanel`,providerGroupList:`BAyRca_providerGroupList`,subscriptionFill:`BAyRca_subscriptionFill`,tokenPanel:`BAyRca_tokenPanel`,heroBudget:`BAyRca_heroBudget`,subscriptionCard:`BAyRca_subscriptionCard`,kpiValue:`BAyRca_kpiValue`,metricValueSuccess:`BAyRca_metricValueSuccess`,ubChipOff:`BAyRca_ubChipOff`,ubExtraNote:`BAyRca_ubExtraNote`,tokenModelPartOut:`BAyRca_tokenModelPartOut`,balanceDetailGrid:`BAyRca_balanceDetailGrid`,popTagPrimary:`BAyRca_popTagPrimary`,subscriptionWindowLabel:`BAyRca_subscriptionWindowLabel`,plgLabel:`BAyRca_plgLabel`,ubChipLabel:`BAyRca_ubChipLabel`,providerGroupName:`BAyRca_providerGroupName`,ubAlertLeft:`BAyRca_ubAlertLeft`,triggerSparkBar:`BAyRca_triggerSparkBar`,ubChipPeak:`BAyRca_ubChipPeak`,triggerSpark:`BAyRca_triggerSpark`,balanceDetailLabel:`BAyRca_balanceDetailLabel`,roundsBarColOff:`BAyRca_roundsBarColOff`,switchOn:`BAyRca_switchOn`,chartLegendBar:`BAyRca_chartLegendBar`,sessionChildRow:`BAyRca_sessionChildRow`,triggerPopSwitcher:`BAyRca_triggerPopSwitcher`,heroBudgetFill:`BAyRca_heroBudgetFill`,ubTagSuccess:`BAyRca_ubTagSuccess`,feeSep:`BAyRca_feeSep`,panelHint:`BAyRca_panelHint`,subscriptionName:`BAyRca_subscriptionName`,floatSubName:`BAyRca_floatSubName`,floatModeBtnOn:`BAyRca_floatModeBtnOn`,tokenModelShareRow:`BAyRca_tokenModelShareRow`,kpiGrid:`BAyRca_kpiGrid`,metricLabel:`BAyRca_metricLabel`,emptyRow:`BAyRca_emptyRow`,popModelRow:`BAyRca_popModelRow`,triggerMain:`BAyRca_triggerMain`,siteRowCost:`BAyRca_siteRowCost`,balanceDaysBadgeLow:`BAyRca_balanceDaysBadgeLow`,heroSideValue:`BAyRca_heroSideValue`,heroGaugePct:`BAyRca_heroGaugePct`,heroTop:`BAyRca_heroTop`,shareSegPeak:`BAyRca_shareSegPeak`,heatmapYearBody:`BAyRca_heatmapYearBody`,heatmapYearWeekdays:`BAyRca_heatmapYearWeekdays`,plgName:`BAyRca_plgName`,rowlineChev:`BAyRca_rowlineChev`,metricValuePrimary:`BAyRca_metricValuePrimary`,peakCount:`BAyRca_peakCount`,heatmapLegend:`BAyRca_heatmapLegend`,floatSub:`BAyRca_floatSub`,delta:`BAyRca_delta`,chartLine:`BAyRca_chartLine`,heatmapCellEmpty:`BAyRca_heatmapCellEmpty`,ubNotesDesc:`BAyRca_ubNotesDesc`,userPriceInput:`BAyRca_userPriceInput`,userPriceInputNum:`BAyRca_userPriceInputNum`,plgDesc:`BAyRca_plgDesc`,setCardDesc:`BAyRca_setCardDesc`,unpricedHint:`BAyRca_unpricedHint`,panelTitle:`BAyRca_panelTitle`,ubStatDetail:`BAyRca_ubStatDetail`,subscriptionFillWarn:`BAyRca_subscriptionFillWarn`,ctlRow:`BAyRca_ctlRow`,userPriceRemove:`BAyRca_userPriceRemove`,subscriptionPct:`BAyRca_subscriptionPct`,prog:`BAyRca_prog`,closeButton:`BAyRca_closeButton`,heatmap:`BAyRca_heatmap`,kpiGreen:`BAyRca_kpiGreen`,exportBar:`BAyRca_exportBar`,feeItem:`BAyRca_feeItem`,ubCardTitle:`BAyRca_ubCardTitle`,kpiLabel:`BAyRca_kpiLabel`,chartAxisLabel:`BAyRca_chartAxisLabel`,heatmapRangeSwitch:`BAyRca_heatmapRangeSwitch`,bucketOfficial:`BAyRca_bucketOfficial`,triggerPopSwitchCount:`BAyRca_triggerPopSwitchCount`,shareSegTool:`BAyRca_shareSegTool`,chartTooltipSwatch:`BAyRca_chartTooltipSwatch`,balanceDetailValue:`BAyRca_balanceDetailValue`,chartLegendLine:`BAyRca_chartLegendLine`,shareSegAssistant:`BAyRca_shareSegAssistant`,bucketCost:`BAyRca_bucketCost`,deltaDown:`BAyRca_deltaDown`,ubTagError:`BAyRca_ubTagError`,subscriptionReset:`BAyRca_subscriptionReset`,dashboardSubtitle:`BAyRca_dashboardSubtitle`,numCol:`BAyRca_numCol`,pricingToggle:`BAyRca_pricingToggle`,siteRowCalls:`BAyRca_siteRowCalls`,subscriptionGrid:`BAyRca_subscriptionGrid`,kpiTile:`BAyRca_kpiTile`,popModelStatusLow:`BAyRca_popModelStatusLow`,chartTooltipRow:`BAyRca_chartTooltipRow`,ubModel:`BAyRca_ubModel`,healthIdle:`BAyRca_healthIdle`,balanceDetailClose:`BAyRca_balanceDetailClose`,siteKindTag:`BAyRca_siteKindTag`,heroGaugePctOver:`BAyRca_heroGaugePctOver`,triggerYen:`BAyRca_triggerYen`,modalFooter:`BAyRca_modalFooter`,tokenModelPartIn:`BAyRca_tokenModelPartIn`,panel:`BAyRca_panel`,heroGaugeLabel:`BAyRca_heroGaugeLabel`,feeChipError:`BAyRca_feeChipError`,shareDot:`BAyRca_shareDot`,subscriptionMeta:`BAyRca_subscriptionMeta`,chartBar:`BAyRca_chartBar`,ubTagAlert:`BAyRca_ubTagAlert`,userPriceField:`BAyRca_userPriceField`,reconcileText:`BAyRca_reconcileText`,currencyToggle:`BAyRca_currencyToggle`,balanceDetailRow:`BAyRca_balanceDetailRow`,plgTitle:`BAyRca_plgTitle`,bucketThird:`BAyRca_bucketThird`,siteRow:`BAyRca_siteRow`,subscriptionTier:`BAyRca_subscriptionTier`,modelTableScroll:`BAyRca_modelTableScroll`,popModel:`BAyRca_popModel`,triggerPopEmpty:`BAyRca_triggerPopEmpty`,feeCount:`BAyRca_feeCount`,subscriptionWindow:`BAyRca_subscriptionWindow`,popTagSub:`BAyRca_popTagSub`,heroCurrency:`BAyRca_heroCurrency`,bucketSep:`BAyRca_bucketSep`,siteRowTitle:`BAyRca_siteRowTitle`,heroSideItem:`BAyRca_heroSideItem`,headTitleRow:`BAyRca_headTitleRow`,"billing-trigger":`BAyRca_billing-trigger`,vendorLetter:`BAyRca_vendorLetter`,heroLabel:`BAyRca_heroLabel`,siteRowMeta:`BAyRca_siteRowMeta`,heatmapCell:`BAyRca_heatmapCell`,staleNotice:`BAyRca_staleNotice`,plgTag:`BAyRca_plgTag`,peakDotPrimary:`BAyRca_peakDotPrimary`,providerGroupBalanceLabel:`BAyRca_providerGroupBalanceLabel`,healthOk:`BAyRca_healthOk`,userPriceRow:`BAyRca_userPriceRow`,balanceDaysBadge:`BAyRca_balanceDaysBadge`};let E={"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`}},te={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 ne(e){return e===``?e:te[e]??e}function re(e){let t=E[ne(e)];return t?.type===`code`?t.tier:void 0}let D=[{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}],O,ie,k,ae,A;function oe(e){A=e.length>0?e:void 0}function j(){return A}function M(e){return I(e)}function se(e,t){if(A===void 0)return;let n=M(e),r=P(n);if(t!==void 0){for(let e of A)if(e.origin!==void 0&&e.origin!==``&&(M(e.key)===n||P(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 A)if((e.origin===void 0||e.origin===``)&&(M(e.key)===n||P(e.key)===r))return{input:e.input,cacheHit:e.cacheHit,output:e.output,...e.currency===void 0?{}:{currency:e.currency}}}function ce(e){O=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,ie=e.prices,k=e.extraModels}function le(e){ae=e}function ue(){return O??6.79}function de(){return{rate:ue(),live:O!==void 0}}function fe(e){return e>=9&&e<12||e>=14&&e<18}function pe(e){return e==null||!Number.isFinite(e)?`peak`:me(e)?`offPeak`:fe((new Date(e).getUTCHours()+8)%24)?`peak`:`offPeak`}function me(e){let t=new Date(e+288e5).getUTCDay();return t===0||t===6}let he=[540,720,840,1080];function ge(e){return((e+288e5)%864e5+864e5)%864e5}function _e(e){let t=pe(e),n=ge(e);for(let r=0;r<7;r++){let i=r*864e5-n;for(let n of he){let r=i+n*6e4;if(!(r<=0)&&pe(e+r)!==t)return{tier:t,nextSwitchInMs:r}}}let r=he[0]??0;return{tier:t,nextSwitchInMs:864e5-n+r*6e4}}function ve(e,t){let{nextSwitchInMs:n}=_e(e);if(n>t)return null;let r=e+n;return{entering:pe(r),atMs:r}}function N(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 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:`09:00-12:00 / 14:00-18:00`},{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:`09:00-12:00 / 14:00-18:00`},{key:`pro`,name:`DeepSeek V4 Pro`,provider:`DeepSeek`,colorVar:`dsw-static-deepseek-500`,price:{currency:`CNY`,input:9,cacheHit:.3,output:27,offPeak:{input:4.5,cacheHit:.15,output:13.5}},peakHours:`09:00-12:00 / 14:00-18:00`},{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:`Standard / Flex`,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:`Standard / Flex`,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}}],be={"deepseek-v4-flash":`flash`,"deepseek-v4-flash-vision-exp":`flash-vision-exp`,"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 P(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let F=(()=>{let e=new Map,t=(t,n)=>{let r=P(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(be))t(e,n);for(let e of D)t(e.key,e.key);return e})();function I(e){let t=be[e]??e;if(t===e){let t=P(e);if(t!==``){let e=F.get(t);if(e!==void 0)return e;let n=(k??[]).find(e=>P(e.key)===t);if(n!==void 0)return n.key}}return t}function L(e){let t=I(e),n=ie?.[t];if(n!==void 0)return n;let r=D.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=I(e),n=ye.find(e=>e.key===t),r=k?.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`)})():R(r)),a=se(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=L(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function R(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 Ce(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 we(e=Date.now()){let t=[...ye.map(t=>Ce(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>P(e.key)));for(let e of ae??[]){let i=e.id.toLowerCase();if((()=>{let t=I(e.id);return ye.find(e=>e.key===t)})()!==void 0)continue;let a=P(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(k??[]).find(e=>P(e.key)===a),s;if(o!==void 0)s=R(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=L(i);s=t===void 0?{key:I(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=se(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 Te(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function Ee(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*ue():a}function De(e,t,n=.5,r=Date.now()){let i=Ce(e,r),a=Ee(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:Ee(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function z(e){let t=ue();return t>0?e/t:e}function B(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 Oe(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 ke(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function V(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 Ae(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let H={top:18,right:40,bottom:26,left:46};function je(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function U(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function W(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 Me={key:`__total__`,name:`总计`,color:``};function Ne({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>B(n===`usd`?z(e):e,n),l=e=>i===`tokens`?U(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-H.left-H.right,a=220-H.top-H.bottom,o=e=>n===1?H.left+r/2:H.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=>H.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>H.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:Me,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:T.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:ee,linePath:x}=d,S=a===null?void 0:e[a],C=W(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:T.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:T.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-H.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:H.left,x2:680-H.right,y1:n,y2:n,className:T.chartGrid}),(0,o.jsx)(`text`,{x:H.left-8,y:n+3,textAnchor:`end`,className:T.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===``?T.chartBar:T.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:T.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:x,fill:`none`,className:T.chartLine}),ee.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-H.right+8,y:n+3,textAnchor:`start`,className:T.chartAxisLabel,children:U(e)},`calls-${t}`)}),C.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:T.chartAxisLabel,children:je(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:H.top,y2:H.top+m,className:T.chartCrosshair})]}),S!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:T.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(S.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:T.chartTooltipDate,children:S.date}),i!==`tokens`&&t.filter(e=>(S.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:T.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(S.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:T.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:T.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?U(S.tokens??0):c(S.cost)})]}),(0,o.jsxs)(`div`,{className:T.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:T.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:S.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:T.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartLegendLine}),`调用`]})]})]})}let G={top:14,right:42,bottom:22,left:46};function Pe(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 Fe(e){return e.slice(5,13).replace(`T`,` `)}function K(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?[]:Pe(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:T.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)}):(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:T.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:T.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:T.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:T.modelCell,children:[(0,o.jsx)(`span`,{className:T.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:T.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:T.numCol,children:K(e.ttftAvg)}),(0,o.jsx)(`td`,{className:T.numCol,children:K(e.ttftP50)}),(0,o.jsx)(`td`,{className:T.numCol,children:K(e.ttftP90)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):(0,o.jsxs)(`span`,{children:[K(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):Ie(e.tpsAvg)}),(0,o.jsx)(`td`,{className:T.numCol,children:K(e.latencyAvg)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:T.na,children:`—`})})]},e.key))})]})}),s!==null&&(0,o.jsxs)(`div`,{className:T.chartWrap,"data-testid":`billing-perf-hour`,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:T.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:T.chartGrid}),(0,o.jsx)(`text`,{x:G.left-8,y:n+3,textAnchor:`end`,className:T.chartAxisLabel,children:e.toFixed(0)})]},`ttft-${t}`)}),(0,o.jsx)(`path`,{d:s.ttftPath,fill:`none`,className:T.chartLine}),s.tpsPath!==``&&(0,o.jsx)(`path`,{d:s.tpsPath,fill:`none`,className:T.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:T.chartAxisLabel,children:Fe(t.key)},t.key)}),(0,o.jsxs)(`text`,{x:680-G.right+8,y:G.top+4,textAnchor:`start`,className:T.chartAxisLabel,children:[n(`perfTpsUnit`),` `,s.maxTps.toFixed(0)]})]}),(0,o.jsxs)(`div`,{className:T.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartLegendLine}),n(`perfTtft`),` (ms)`]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartLegendLine,style:{background:`var(--dsw-static-amber-500)`}}),n(`perfTps`),` (`,n(`perfTpsUnit`),`)`]})]})]})]})}let q=`@kenz1117/dsh-ui-usage-billing`,Re=`kenz1117`;function ze({t:e,version:t}){return(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:T.plgHead,children:[(0,o.jsx)(`span`,{className:T.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:T.plgTitle,children:[(0,o.jsxs)(`div`,{className:T.plgNameRow,children:[(0,o.jsx)(`h3`,{className:T.plgName,children:q}),(0,o.jsx)(`span`,{className:T.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:T.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:T.plgGrid,children:[(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:T.plgLink,href:`https://github.com/${Re}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,Re,`)`]})]}),(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:T.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:T.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:q})]}),(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:T.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 J={top:14,right:18,bottom:22,left:46},He=`var(--dsw-static-blue-500)`,Ue=`#14b8a6`,We=`var(--dsw-static-amber-500)`;function Y(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,{byDay:s,byModel:c,total:u}=t,d=(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=s[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[s,n]),f=(0,r.useMemo)(()=>{let e=0;return Object.entries(c).filter(([,e])=>e.calls>0).map(([t,n])=>{let r=n.input+n.output;e+=r;let i=n.cacheHit+n.cacheMiss;return{key:t,name: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}))},[c]),p=(0,r.useMemo)(()=>{let e=u.cacheHit??0,t=u.cacheMiss??0,n=u.input??0,r=u.output??0,i=u.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 d){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}},[u,d]),m=(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]),h=(0,r.useMemo)(()=>{let e=d.length;if(e===0)return null;let t=680-J.left-J.right,n=200-J.top-J.bottom,r=Math.max(...d.map(e=>e.miss+e.hit+e.output),1),i=e=>J.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?J.left+t/2:J.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l}},[d]);return(0,o.jsxs)(`div`,{className:T.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:T.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:T.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-token-export-csv`,onClick:()=>{let e=new Blob([Y(d)],{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:T.exportButton,"data-testid":`billing-token-export-json`,onClick:()=>{let e=new Blob([JSON.stringify({days:d,models:f,total:u},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:T.kpiGrid,"data-testid":`billing-token-kpis`,children:[(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenCacheHitRate`)}),(0,o.jsxs)(`span`,{className:T.kpiValue,children:[p.cacheHitRate.toFixed(1),`%`]}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[V(p.hit),` / `,V(p.hit+p.miss),(u.cacheWrite??0)>0?` · ${a(`tokenCacheWrite`)} ${V(u.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenReasoningShare`)}),(0,o.jsxs)(`span`,{className:T.kpiValue,children:[p.reasoningPct.toFixed(1),`%`]}),(0,o.jsx)(`span`,{className:T.kpiDetail,children:V(p.reasoning)})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenIo`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:p.io.toFixed(2)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[V(p.input),` / `,V(p.output)]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenPeak`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:p.peak===void 0?`—`:Ve(p.peak.miss+p.peak.hit+p.peak.output)}),(0,o.jsx)(`span`,{className:T.kpiDetail,children:p.peak?.date??`—`})]})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:a(`tokenDaily`)}),(0,o.jsx)(`span`,{className:T.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.rangeButton,n===e&&T.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]}),h===null?(0,o.jsx)(`div`,{className:T.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:T.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:T.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),children:[[0,.5,1].map(e=>{let t=h.max*e,n=h.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:J.left,x2:680-J.right,y1:n,y2:n,className:T.chartGrid}),(0,o.jsx)(`text`,{x:J.left-8,y:n+3,textAnchor:`end`,className:T.chartAxisLabel,children:Ve(t)})]},e)}),d.map((e,t)=>{let n=h.inner(t)-h.barW/2,r=h.y(0),i=h.y(e.miss),a=h.y(e.miss+e.hit),s=h.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:h.barW,height:r-i,fill:He}),(0,o.jsx)(`rect`,{x:n,y:a,width:h.barW,height:i-a,fill:Ue}),(0,o.jsx)(`rect`,{x:n,y:s,width:h.barW,height:a-s,fill:We})]},e.date)}),h.indices.map(e=>{let t=d[e];return t===void 0?null:(0,o.jsx)(`text`,{x:h.inner(e),y:194,textAnchor:`middle`,className:T.chartAxisLabel,children:t.date.slice(5)},t.date)})]}),(0,o.jsxs)(`div`,{className:T.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:He}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:Ue}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:We}}),a(`tokenOutput`)]})]})]})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:a(`tokenByModel`)})}),f.length===0?(0,o.jsx)(`div`,{className:T.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:T.tableScroll,children:(0,o.jsxs)(`table`,{className:T.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:T.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:f.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:T.numCol,children:V(e.input)}),(0,o.jsx)(`td`,{className:T.numCol,children:V(e.output)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.reasoning>0?V(e.reasoning):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsxs)(`td`,{className:T.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:T.numCol,children:V(e.total)}),(0,o.jsx)(`td`,{className:T.numCol,children:(0,o.jsxs)(`span`,{className:T.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:T.tokenModelBar,children:(0,o.jsxs)(`span`,{className:T.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:T.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:T.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),m.totalCalls>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:T.tableScroll,children:(0,o.jsxs)(`table`,{className:T.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:T.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...m.top,...m.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelName,children:e})}),(0,o.jsx)(`td`,{className:T.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:T.numCol,children:[(t/m.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]})]})}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:T.roundsEmpty,children:[i(`model`),` —`]});let u=e=>B(n===`usd`?z(e):e,n);return(0,o.jsxs)(`div`,{className:T.rounds,children:[(0,o.jsx)(`div`,{className:T.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=pe(e.startedAt)===`peak`;return(0,o.jsxs)(`div`,{className:l(T.roundsBarCol,r?T.roundsBarColPeak:T.roundsBarColOff),children:[(0,o.jsx)(`span`,{className:T.roundsBarLabel,style:{bottom:`${n}%`},children:u(e.cost)}),(0,o.jsx)(`div`,{className:T.roundsBarWrap,children:(0,o.jsx)(`div`,{className:t?T.roundsBarFlagged:T.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:T.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,o.jsxs)(`div`,{className:T.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=>B(t===`usd`?z(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:T.heatmapYear,"data-testid":`heatmap-year`,children:[(0,o.jsxs)(`div`,{className:T.heatmapYearBody,children:[(0,o.jsx)(`div`,{className:T.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,o.jsx)(`span`,{className:T.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,o.jsxs)(`div`,{className:T.heatmapYearScroll,children:[(0,o.jsx)(`div`,{className:T.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:r.map(e=>(0,o.jsx)(`span`,{className:T.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,o.jsx)(`div`,{className:T.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:T.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:T.heatmapFooter,children:[(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:T.heatmapLegend,children:Xe.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapMore`)})]})]})}return(0,o.jsxs)(`div`,{className:T.heatmap,children:[(0,o.jsx)(`div`,{className:T.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,o.jsx)(`div`,{className:T.heatmapCellEmpty,children:e.dayNum},e.date):(0,o.jsx)(`button`,{type:`button`,className:T.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:T.heatmapFooter,children:[(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:T.heatmapLegend,children:Xe.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapMore`)}),s!==null&&(0,o.jsxs)(`span`,{className:T.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 X(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function it(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=X(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 Z(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function at(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function ot(e){return e.toFixed(2)}function st(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,ot(n.cost)].join(`,`)})].join(`
3
- `)}function ct(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[Z(at(n)),r,t.calls,ot(t.cost)].join(`,`)})].join(`
4
- `)}function lt(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function ut(e){return[`session_id,title,project,calls,cost_cny,last_active`,...e.map(e=>[Z(at(e.id)),Z(at(e.title??``)),Z(at(lt(e.cwd))),e.calls,ot(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``].join(`,`))].join(`
5
- `)}function dt(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 ft(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 pt=`usageBilling`,mt={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 flash 系自 2026-09-10 12:00(北京)起谷档调价:未命中 ¥1 / 输出 ¥4 / 缓存命中 ¥0.02(峰 = 谷 × 2,原 1.5 / 4.5 / 0.05);峰谷分时自 2026-08-23(周日)00:00 起:工作日高峰 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:`免费`,official:`官方`,thirdParty:`三方`,officialCost:`官方费用`,thirdPartyCost:`三方费用`,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:`调用`},ht={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 flash repricing from 2026-09-10 12:00 Beijing: off-peak is now ¥1 miss / ¥4 output / ¥0.02 cache-hit (peak = 2× off-peak; was 1.5 / 4.5 / 0.05); time-of-day billing since 2026-08-23 (Sun) 00:00: weekdays peak 9-12 / 14-18 (×2), weekends (Sat/Sun) all-day off-peak. Cells show peak/off-peak price, 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`,official:`Official`,thirdParty:`Third-party`,officialCost:`Official cost`,thirdPartyCost:`Third-party cost`,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`},gt={"智谱 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 _t(e,t){return t===`en`?gt[e]??e:e}let vt={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 yt(e){return vt[e]}let bt=`dsh-billing-peak-alert-v1`,xt={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function St(){try{let e=localStorage.getItem(bt);if(e===null)return{...xt};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:xt.mode,r=t.position===`center`?`center`:`bottom-right`;return{enabled:t.enabled===!0,leadMin:typeof t.leadMin==`number`&&Number.isFinite(t.leadMin)?Math.min(30,Math.max(1,Math.round(t.leadMin))):xt.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...xt}}}function Ct(e){try{localStorage.setItem(bt,JSON.stringify(e))}catch{}}function wt(e,t,n){if(!t.enabled)return null;let r=ve(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 Tt({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(T.peakCard,p?T.peakCardPeak:T.peakCardOff,t.position===`center`?T.peakCardCenter:T.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:T.peakHead,children:[(0,o.jsxs)(`span`,{className:l(T.peakTag,p?T.peakTagPrimary:T.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:l(T.peakDot,p?T.peakDotPrimary:T.peakDotSuccess),"aria-hidden":`true`}),d]}),(0,o.jsx)(`button`,{type:`button`,className:T.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:l(T.peakCount,p?T.peakCountPrimary:T.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:T.peakDesc,children:f})]})}let Et=[{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 Dt(e){if(e!==void 0)return e.split(/[\\/]/).filter(Boolean).pop()??e}let Ot=[50,80,100],kt={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},At={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 jt(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 Mt(e,t){let n=Q(e),r=Q(t);if(jt(n,r))return!0;let i=At[e];return i!==void 0&&i.some(e=>jt(Q(e),r))}function Nt(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(At))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(At))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let Pt={"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 Ft(e){let t=Pt[e];return t===void 0?Nt(e)??e:t}function It(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 Lt(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:It(e,n);return s<=0?0:s*o}function Rt(e){let t=j();if(t===void 0||e.byDayModels===void 0)return e;let n=de().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||P(t.key)===P(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=se(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:se(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}]}))}}function zt(e){return Object.keys(e).length}function Bt(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 Vt(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 Ht(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 Ut(e,t){return e.checked?e.okProviders.some(e=>Mt(t,e))?T.healthOk:e.badProviders.some(e=>Mt(t,e))?T.healthBad:T.healthIdle:T.healthIdle}function Wt(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 Gt(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 Kt(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 Jt(e,t){switch(e){case`site`:return t(`relaySite`);case`direct`:return t(`relayDirect`);default:return t(`relayUnknown`)}}function Yt(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let Xt={site:T.siteKindSite,direct:T.siteKindDirect,unknown:T.siteKindUnknown},Zt={"new-api":T.siteKindSite,sub2api:T.siteKindDirect,unknown:T.siteKindUnknown},Qt=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 $t(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let en=[`#3b82f6`,`#06b6d4`,`#8b5cf6`,`#f59e0b`,`#10b981`,`#ef4444`,`#ec4899`,`#6366f1`,`#f97316`,`#14b8a6`],tn={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function nn(){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??tn.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 rn=!1;async function an(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){rn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){rn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(rn)return;rn=!0}setTimeout(()=>{an(e+1)},2e3);return}rn=!1,ce(i)}catch{rn=!1}}async function on(){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 sn(){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 cn(){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 ln(){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 un(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 dn(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]),[ee,x]=(0,r.useState)(0),S=b.length===0?0:Math.min(ee,b.length-1),C=b[S];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||b.length<2)return;let e=setInterval(()=>x(e=>(e+1)%b.length),1500);return()=>clearInterval(e)},[m.mode,b.length]);let w=(0,r.useRef)(null),[E,te]=(0,r.useState)(!1),[ne,re]=(0,r.useState)({left:0,top:0,width:0}),D=(0,r.useRef)(void 0),O=(0,r.useCallback)(()=>{window.clearTimeout(D.current),te(!0)},[]),ie=(0,r.useCallback)(()=>{window.clearTimeout(D.current),D.current=window.setTimeout(()=>te(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let k=(0,r.useCallback)(()=>{let e=w.current?.getBoundingClientRect();e!==void 0&&re({left:e.left,top:e.top-8,width:e.width})},[]);(0,r.useEffect)(()=>{if(!E)return;let e=()=>k();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[E,k]);let ae=(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:T.railButton,"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${B(s)}`,children:ae});let A=g.metric===`tokens`,oe=d.map(e=>A?e.tokens:e.cost),j=Math.max(...oe,0),M=oe.map(e=>j>0?4+e/j*12:4);return(0,o.jsxs)(`span`,{ref:w,className:T.triggerWrap,onMouseEnter:()=>{k(),O()},onMouseLeave:ie,onFocusCapture:()=>{k(),O()},onBlurCapture:()=>te(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:T.trigger,"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${B(s)}`,children:[(0,o.jsx)(`span`,{className:T.triggerIcon,"data-testid":`billing-trigger-icon`,children:ae}),(0,o.jsxs)(`span`,{className:T.triggerMain,children:[(0,o.jsxs)(`span`,{className:T.triggerPrimary,children:[(0,o.jsx)(`span`,{className:T.triggerLabel,children:n(A?`triggerMonthTokens`:`triggerMonth`)}),A?(0,o.jsx)(`span`,{className:T.triggerMetric,"data-testid":`billing-trigger-month-tokens`,children:V(_)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:T.triggerYen,"aria-hidden":`true`,children:B(s).charAt(0)}),(0,o.jsx)(`span`,{className:T.triggerMetric,children:B(s).slice(1)})]})]}),(0,o.jsx)(`span`,{className:T.triggerSub,"data-testid":`billing-trigger-today`,children:A?`${n(`triggerToday`)} ${V(v)} · ${n(`weekCost`)} ${V(y)}`:`${n(`triggerToday`)} ${B(c)} · ${n(`weekCost`)} ${B(u)}`})]}),(0,o.jsx)(`span`,{className:T.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:M.map((e,t)=>(0,o.jsx)(`span`,{className:t===M.length-1?T.triggerSparkHot:T.triggerSparkBar,style:{height:`${e}px`}},d[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:l(T.triggerPop,E&&T.triggerPopShown,m.mode===`subscription`&&T.triggerPopSubscription),style:{left:`${ne.left}px`,top:`${ne.top}px`,width:`${ne.width}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!E,onMouseEnter:O,onMouseLeave:ie,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:b.length===0?(0,o.jsx)(`span`,{className:T.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[C!==void 0&&(0,o.jsxs)(`div`,{className:T.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:T.floatSubHead,children:[(0,o.jsx)(`span`,{className:T.floatSubName,children:C.displayName}),C.plan!==void 0&&(0,o.jsx)(`span`,{className:T.floatSubPlan,children:C.plan})]}),C.windows.map(e=>(()=>{let t=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:T.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:T.subscriptionWindowLabel,children:Kt(e.kind,n)}),(0,o.jsx)(`span`,{className:T.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(T.subscriptionFill,t>=100&&T.subscriptionFillOver,t>=80&&t<100&&T.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:T.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(T.subscriptionPct,r&&T.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${$t(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),b.length>1&&(0,o.jsx)(`span`,{className:T.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:T.triggerPopSwitchCount,children:[S+1,`/`,b.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:T.popHead,children:(0,o.jsx)(`span`,{className:T.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:T.metricGrid,children:[(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`monthCost`)}),(0,o.jsx)(`span`,{className:l(T.metricValue,T.metricValuePrimary),children:B(s)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`tokenTotal`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:V(p.totalToken)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:V(p.input)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:V(p.output)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:l(T.metricValue,T.metricValueSuccess),children:V(p.cacheRead)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`calls`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:p.calls.toLocaleString()})]})]}),(0,o.jsxs)(`span`,{className:T.popModel,children:[(0,o.jsx)(`span`,{className:T.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:T.popModelRow,children:[(0,o.jsx)(`span`,{className:l(T.popDot,T.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:T.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:l(T.popModelStatus,f.direct.low&&T.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:T.popModelRow,children:[(0,o.jsx)(`span`,{className:l(T.popDot,T.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:T.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:l(T.popModelStatus,f.sub.low&&T.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:T.popModelRow,children:[(0,o.jsx)(`span`,{className:l(T.popDot,T.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function fn({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:T.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:T.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:T.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:T.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:T.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(pn,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(pn,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(pn,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(pn,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(pn,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function pn({label:e,value:t}){return(0,o.jsxs)(`span`,{className:T.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:T.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:T.balanceDetailValue,children:t})]})}function mn({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:T.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:T.setCardHead,children:(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:T.ctlCol,children:[i.map((e,t)=>(0,o.jsxs)(`div`,{className:T.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsxs)(`div`,{className:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:T.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:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:T.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:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}),(0,o.jsx)(`input`,{className:T.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:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:T.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,e.currency!==`USD`&&T.floatModeBtnOn),onClick:()=>f(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,e.currency===`USD`&&T.floatModeBtnOn),onClick:()=>f(t,`USD`),children:`USD`})]})]}),(0,o.jsx)(`button`,{type:`button`,className:T.userPriceRemove,"aria-label":n(`userPriceRemove`),onClick:()=>c(t),children:n(`userPriceRemove`)})]},t)),(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-user-price-add`,onClick:u,children:n(`userPriceAdd`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-user-price-save`,onClick:d,children:n(`userPriceSave`)})]})]})]})}function hn({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:ee,peakConfig:x,onPeakConfig:S,onPreviewPeak:C,floatPrefs:w,onFloatPrefs:E,cardPrefs:te,onCardPrefs:ne,sitePrefs:D,onSitePrefs:O,quotasStale:ie}){let[k,ae]=(0,r.useState)(`cost`),{total:A,byModel:oe,byDay:j}=e,[M,se]=(0,r.useState)(`overview`),[ce,le]=(0,r.useState)(7),[ue,fe]=(0,r.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),pe=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},me=(0,r.useCallback)(()=>{let e=pe();fe(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[he,ge]=(0,r.useState)(`month`),_e=(0,r.useMemo)(()=>f.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[f]),[ve,N]=(0,r.useState)(),[ye,be]=(0,r.useState)(),[P,F]=(0,r.useState)(new Set),I=(0,r.useCallback)(e=>{F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[L,R]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return ln().then(t=>{e&&t!==void 0&&R(t)}),()=>{e=!1}},[]);let Ce=(0,r.useCallback)(()=>{let e=!L;R(e),un(e).then(t=>{t||R(!e)})},[L]),Ee=de(),H=e=>B(m===`usd`?z(e):e,m),je=m===`usd`?`en`:`zh`,U=e=>_t(e,je),W=(e,n)=>e===0?t(`free`):Oe(ke(e,n,m,Ee.rate),m===`usd`?`USD`:`CNY`),Me=(0,r.useMemo)(()=>it([...g].reverse()),[g]),G={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},Pe=G.peak/2,Fe=(0,r.useMemo)(()=>{let n=e.byRole;if(n===void 0)return[];let r=n.user+n.assistant+n.tool;return r<=0?[]:[{label:t(`roleUser`),value:n.user,seg:T.shareSegUser},{label:t(`roleAssistant`),value:n.assistant,seg:T.shareSegAssistant},{label:t(`roleTool`),value:n.tool,seg:T.shareSegTool}].map(e=>({...e,pct:e.value/r*100}))},[e.byRole,t]),K=It(j,$()),Ie=e=>u.find(t=>Q(t.provider)===Q(e)),q=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:T.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:T.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:H(e.totalBalance),r=e.currency===`USD`?e.totalBalance*Ee.rate:e.totalBalance,i=K>0?Math.floor(r/K):void 0;return(0,o.jsxs)(`span`,{className:T.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:l(T.balanceDaysBadge,i<=3&&T.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:()=>{N(ve===e.provider?void 0:e.provider)},children:`?`}),ve===e.provider&&(0,o.jsx)(fn,{balance:e,days:i??0,dailyBurn:K,money:H,t,onClose:()=>{N(void 0)}})]})},Be=A.cacheHit+A.cacheMiss>0?A.cacheHit/(A.cacheHit+A.cacheMiss)*100:0,Ve=Object.keys(j).sort(),J=$(),He=j[J]?.cost??0,Ue=J.slice(0,7),We=J.slice(0,4),Y=Ve.reduce((e,t)=>e+(t.startsWith(Ue)?j[t]?.cost??0:0),0),Ke=Ve.reduce((e,t)=>e+(t.startsWith(We)?j[t]?.cost??0:0),0),qe=(0,r.useMemo)(()=>Lt(j,Ue,J)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[j,Ue,J,f]),Je=(0,r.useMemo)(()=>{let e=v&&y>0?Y/y*100:NaN;return{pct:Number.isFinite(e)?Math.max(0,Math.min(100,e)):Ke>0?Math.max(0,Math.min(100,Y/Ke*100)):0,over:Number.isFinite(e)&&e>=100,label:t(Number.isFinite(e)?`budget`:`monthCost`)}},[v,y,Y,Ke,t]),Xe=v&&y>0?Y/y*100:0,Ze=(0,r.useMemo)(()=>{let e=[];for(let t=ce-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push($(n.getTime()))}return e},[ce]),Qe=Ze.at(-1)??J,$e=(0,r.useMemo)(()=>Object.entries(j).map(([e,t])=>({date:e,value:t.cost})),[j]),et=zt(j),nt=Bt(j),rt=(0,r.useMemo)(()=>Ze.map(t=>{let n={},r=e.byDayModels?.[t];if(r!==void 0)for(let[e,t]of Object.entries(r))t.cost>0&&(n[e]=t.cost);let i=j[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:i.input+i.output+i.cacheHit+i.cacheMiss}}),[Ze,j,e.byDayModels]),X=(0,r.useMemo)(()=>Object.entries(oe).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=xe(e),r=n.key===`other`,i=r?Nt(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:De(n,a),plan:t.plan===!0,...t.cost>0?{actual:t.cost}:{},uncatalogued:r,estimatedPricing:n.estimated===!0,officialCalls:t.officialCalls??0,officialCost:t.officialCost??0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)).map((e,t)=>({...e,color:en[t%en.length]??`#8b95a3`})),[oe]),Z=(0,r.useMemo)(()=>{let e=0,t=0,n=0;for(let r of X){let i=r.officialCost;i>0&&(e+=i),t+=r.officialCalls,n+=Math.max(0,r.calls-r.officialCalls)}let r=Math.max(0,X.reduce((e,t)=>e+(t.actual??0),0)-e);if(!(e<=0&&r<=0&&t<=0&&n<=0))return{officialCost:e,officialCalls:t,thirdCost:r,thirdCalls:n}},[X]),at=(0,r.useMemo)(()=>Object.entries(e.bySite??{}).filter(([e])=>!(D.hideUnidentified&&e===`unknown`)).sort((e,t)=>(t[1].cost??0)-(e[1].cost??0)),[e.bySite,D.hideUnidentified]),ot=(0,r.useMemo)(()=>D.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,D.hideUnidentified]),lt=(0,r.useMemo)(()=>{let e=new Map;for(let t of f){if(t.status===`not-configured`)continue;let n=Ft(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 X){let r=e.provider;if(e.plan===!0){let t=Nt(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:Ut(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:Ut(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})},[X,f,u,c]),pt=X.reduce((e,t)=>e+t.estimated,0),mt=A.cost>0?A.cost:pt,ht=A.calls>0?mt/A.calls:0,gt=(0,r.useMemo)(()=>X.map(e=>({key:e.key,name:e.name,color:e.color})),[X]),vt=rt.length>=2?rt.at(-2)?.cost??0:0,yt=vt>0?(He-vt)/vt*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:l(T.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:T.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:T.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:T.headTitleRow,children:[(0,o.jsx)(`h2`,{className:T.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:T.dashboardSubtitle,children:[t(`lastUpdated`),` `,Qe,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:T.dashboardRight,children:[(0,o.jsx)(`span`,{className:T.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.currencyButton,m===e&&T.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(T.healthBadge,c.available?T.healthBadgeOk:T.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:l(T.healthDot,c.available?T.healthOk:T.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:T.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:T.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:Et.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":M===e.id,className:l(T.tabButton,M===e.id&&T.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{se(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:T.dashboardBody,children:[M===`overview`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[d?.kind===`drift`&&d.spent!==void 0&&ue!==pe()&&(0,o.jsxs)(`div`,{className:T.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:T.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:T.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,d.provider??``).replace(`{spent}`,H(d.spent)).replace(`{today}`,H(d.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:T.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:me,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:T.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:T.heroTop,children:[(0,o.jsxs)(`div`,{className:T.heroMain,children:[(0,o.jsx)(`span`,{className:T.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:T.heroReadout,children:[(0,o.jsx)(`span`,{className:T.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:T.heroValue,children:H(Y).slice(1)})]}),(0,o.jsxs)(`span`,{className:T.heroMeta,children:[A.calls.toLocaleString(),` `,t(`calls`)]})]}),(0,o.jsxs)(`div`,{className:T.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`svg`,{className:T.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:T.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:l(T.heroGaugeArc,Je.over&&T.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${Je.pct/100*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:T.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:l(T.heroGaugePct,Je.over&&T.heroGaugePctOver),children:[Je.pct.toFixed(0),`%`]}),(0,o.jsx)(`span`,{className:T.heroGaugeLabel,children:Je.label})]})]})]}),v&&y>0&&(0,o.jsxs)(`div`,{className:T.heroBudget,"data-testid":`billing-hero-budget`,children:[(0,o.jsx)(`span`,{className:T.heroBudgetLabel,children:t(`budget`)}),(0,o.jsx)(`div`,{className:T.heroBudgetTrack,role:`progressbar`,"aria-valuenow":Math.min(Xe,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),children:(0,o.jsx)(`div`,{className:l(T.heroBudgetFill,Xe>=100&&T.heroBudgetFillOver),style:{width:`${Math.min(Xe,100)}%`}})}),(0,o.jsxs)(`span`,{className:T.heroBudgetValue,children:[H(Y),` / `,H(y),` · `,Xe.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:T.heroSide,children:[(0,o.jsxs)(`div`,{className:T.heroSideItem,children:[(0,o.jsx)(`span`,{className:T.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:T.heroSideValue,children:H(Ke)})]}),(0,o.jsxs)(`div`,{className:T.heroSideItem,children:[(0,o.jsx)(`span`,{className:T.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:T.heroSideValue,children:[H(He),(0,o.jsxs)(`span`,{className:l(T.delta,yt>=0?T.deltaUp:T.deltaDown),children:[yt>=0?`▲`:`▼`,` `,Math.abs(yt).toFixed(1),`%`]})]})]}),qe>0&&(0,o.jsxs)(`div`,{className:T.heroSideItem,children:[(0,o.jsx)(`span`,{className:T.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:T.heroSideValue,children:H(qe)})]}),qe<=0&&(0,o.jsx)(`span`,{className:T.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:T.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:T.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,H(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`section`,{className:T.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:T.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:l(T.kpiValue,T.kpiGreen),children:Ae(Be)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[V(A.cacheHit),` / `,V(A.cacheHit+A.cacheMiss)]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:V(A.input+A.output)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[t(`inputTokens`),` `,V(A.input),` · `,t(`outputTokens`),` `,V(A.output)]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:H(ht)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[t(`calls`),` `,A.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:A.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[X.length,` `,t(`models`)]})]})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:T.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(T.heatmapRangeButton,he===e&&T.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":he===e,onClick:()=>{ge(e)},children:t(e===`month`?`heatmapMonth`:`heatmapYear`)},e))}),(0,o.jsxs)(`span`,{className:T.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,et,` · `,t(`streakDays`),` `,nt]})]}),(0,o.jsx)(tt,{days:$e,currency:m,t,range:he})]})]}),M===`settings`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:T.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(T.switch,v&&T.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:T.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:T.ctlCol,children:[(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:T.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:T.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:T.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:y===0?``:y,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,title:`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,onChange:e=>{ee(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=Y/y*100;return(0,o.jsx)(`div`,{className:T.ctlRowStretch,children:(0,o.jsx)(`div`,{className:T.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(T.progFill,e>=100&&T.budgetFillOver,e>=80&&e<100&&T.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:T.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,H(Y)).replace(`{total}`,H(y))})]})]}),(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":x.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:l(T.switch,x.enabled&&T.switchOn),onClick:()=>{S({...x,enabled:!x.enabled})},children:(0,o.jsx)(`span`,{className:T.switchKnob})})]}),x.enabled&&(0,o.jsxs)(`div`,{className:T.ctlCol,children:[(0,o.jsxs)(`label`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:T.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:x.leadMin,className:T.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);S({...x,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):x.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:T.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:T.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:x.position===e,onChange:()=>S({...x,position:e})}),(0,o.jsx)(`span`,{className:T.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:T.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:T.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:x.mode===e,onChange:()=>S({...x,mode:e})}),(0,o.jsx)(`span`,{className:T.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:x.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{S({...x,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:T.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:T.btn,onClick:C,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:T.setCard,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":L,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:l(T.switch,L&&T.switchOn),onClick:Ce,children:(0,o.jsx)(`span`,{className:T.switchKnob})})]})}),(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:T.setCardHead,children:(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:T.ctlCol,children:[(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:T.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,w.mode===`combined`&&T.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>E({mode:`combined`,targets:w.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,w.mode===`subscription`&&T.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>E({mode:`subscription`,targets:w.targets}),children:t(`floatModeSubscription`)})]})]}),w.mode===`subscription`&&(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:T.ctlGroup,"data-testid":`billing-float-targets`,children:[_e.map(e=>{let t=w.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:T.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>E({mode:`subscription`,targets:t?w.targets.filter(t=>t!==e.id):[...w.targets,e.id]})}),(0,o.jsx)(`span`,{className:T.floatTargetLabel,children:e.label})]},e.id)}),_e.length===0&&(0,o.jsx)(`span`,{className:T.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:T.setCardHead,children:(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsx)(`div`,{className:T.ctlCol,children:(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:T.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,te.metric===`money`&&T.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>ne({metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,te.metric===`tokens`&&T.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>ne({metric:`tokens`}),children:t(`cardMetricTokens`)})]})]})})]}),(0,o.jsx)(`section`,{className:T.setCard,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`siteListDisplayHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":D.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:l(T.switch,D.hideUnidentified&&T.switchOn),onClick:()=>O({hideUnidentified:!D.hideUnidentified}),children:(0,o.jsx)(`span`,{className:T.switchKnob})})]})}),(0,o.jsx)(mn,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(ze,{t,version:e.pluginVersion})]}),M===`trends`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:l(T.ubCard,T.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:T.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:T.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.rangeButton,ce===e&&T.rangeButtonActive),"aria-pressed":ce===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{le(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,o.jsx)(`span`,{className:T.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.rangeButton,k===e&&T.rangeButtonActive),"aria-pressed":k===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{ae(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:Qe})]}),(0,o.jsx)(Ne,{data:rt,models:gt,currency:m,metric:k})]}),g.length>0&&(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`rounds`)}),Me.length>0&&(0,o.jsxs)(`span`,{className:T.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[Me.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:T.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(Ye,{rounds:g,flags:Me,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=G.peak+G.offPeak;if(e<=0)return null;let n=G.peak/e*100;return(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:T.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:l(T.shareSeg,T.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:l(T.shareSeg,T.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:T.shareLegend,children:[(0,o.jsxs)(`span`,{className:T.shareItem,children:[(0,o.jsx)(`span`,{className:T.shareDot,style:{background:`var(--dsw-static-blue-500)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:T.shareValue,"data-testid":`billing-share-peak`,children:[H(G.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:T.shareItem,children:[(0,o.jsx)(`span`,{className:T.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:T.shareValue,"data-testid":`billing-share-offpeak`,children:[H(G.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),Pe>0&&(0,o.jsx)(`div`,{className:T.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,H(Pe))})]})})()]}),M===`providers`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[at.length>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-relay-sites`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`panelRelay`)})}),(0,o.jsx)(`div`,{className:T.providerGroupList,"data-testid":`billing-relay-sites`,children:at.map(([e,n])=>{let r=qt(e,t);return(0,o.jsxs)(`div`,{className:T.siteRow,"data-testid":`billing-relay-site`,children:[(0,o.jsxs)(`span`,{className:T.siteRowName,children:[(0,o.jsx)(`span`,{className:l(T.siteKindTag,Xt[r.kind]),children:Jt(r.kind,t)}),(0,o.jsx)(`span`,{className:T.siteRowTitle,children:r.name})]}),(0,o.jsxs)(`span`,{className:T.siteRowMeta,children:[(0,o.jsx)(`span`,{className:T.siteRowCost,children:H(n.cost)}),(0,o.jsxs)(`span`,{className:T.siteRowCalls,children:[n.calls,` `,t(`relayCalls`)]})]})]},e)})})]}),ot.length>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:T.providerGroupList,"data-testid":`billing-relay-quotas`,children:ot.map(e=>(0,o.jsxs)(`div`,{className:T.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:T.siteRowName,children:[(0,o.jsx)(`span`,{className:l(T.siteKindTag,Zt[e.kind]),children:Yt(e.kind,t)}),(0,o.jsx)(`span`,{className:T.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:T.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:T.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(T.siteRowCalls,n&&T.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:T.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:T.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${$t(e.updatedAt)}`})]}),ie&&(0,o.jsx)(`div`,{className:T.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),lt.length===0?(0,o.jsx)(`div`,{className:T.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:T.providerGroupList,"data-testid":`billing-provider-groups`,children:lt.map(e=>(0,o.jsxs)(`div`,{className:T.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:T.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:T.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:l(T.healthDot,e.dot),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.providerGroupName,children:U(e.name)})]}),(0,o.jsxs)(`span`,{className:T.providerGroupMeta,children:[e.subscriptions.length>0&&(0,o.jsxs)(`span`,{className:T.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` 套餐`]}),!q(e)&&e.balance!==void 0&&(0,o.jsxs)(`span`,{className:T.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:T.providerGroupBalanceLabel,children:t(`balance`)}),Re(e.balance)]})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:l(T.tableScroll,T.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:T.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:T.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:T.modelCell,children:[(0,o.jsx)(gn,{provider:e.provider,colorVar:e.color}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:T.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:T.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:T.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:T.modelProvider,children:U(e.provider)})]})]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:T.numCol,children:V(e.input)}),(0,o.jsx)(`td`,{className:T.numCol,children:V(e.output)}),(0,o.jsx)(`td`,{className:T.numCol,children:Ae(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.plan?(0,o.jsx)(`span`,{className:T.planTag,children:t(`subscriptionIncluded`)}):e.actual===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:T.bucketCost,children:[(0,o.jsx)(`span`,{className:T.bucketOfficial,children:H(t)}),(0,o.jsx)(`span`,{className:T.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:T.bucketThird,children:H(n)})]}):H(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:T.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=Gt(e.status,t);return(0,o.jsxs)(`div`,{className:T.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:T.subscriptionHead,children:[(0,o.jsx)(`span`,{className:T.subscriptionName,children:U(e.displayName)}),e.planType===`code`&&(()=>{let n=re(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,o.jsxs)(`span`,{className:T.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,H(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:T.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:T.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:T.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:T.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:T.subscriptionWindowLabel,children:Kt(e.kind,t)}),(0,o.jsx)(`span`,{className:T.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(T.subscriptionFill,n>=100&&T.subscriptionFillOver,n>=80&&n<100&&T.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:T.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(T.subscriptionPct,r&&T.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${$t(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:T.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:T.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-day`,onClick:()=>{ft(dt(`usage-daily`,`csv`,Object.keys(j)),st(j),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{ft(dt(`usage-sessions`,`csv`,Object.keys(j)),ut(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{ft(dt(`usage-sites`,`csv`,Object.keys(j)),ct(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-json`,onClick:()=>{ft(dt(`usage-stats`,`json`,Object.keys(j)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),Fe.length>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`roleCost`)}),(0,o.jsx)(`span`,{className:T.panelHint,children:t(`roleHint`)})]}),(0,o.jsx)(`div`,{className:T.shareTrack,"data-testid":`billing-role-track`,children:Fe.map(e=>(0,o.jsx)(`div`,{className:l(T.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:T.shareLegend,children:Fe.map(e=>(0,o.jsxs)(`span`,{className:T.shareItem,children:[(0,o.jsx)(`span`,{className:l(T.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:T.shareValue,children:[H(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]}),Z!==void 0&&(()=>{let e=Z.officialCost+Z.thirdCost,n=e>0?Z.officialCost/e*100:0;return(0,o.jsxs)(`div`,{className:T.ubStatGrid,"data-testid":`billing-panel-buckets`,children:[(0,o.jsxs)(`div`,{className:T.ubStatCard,children:[(0,o.jsxs)(`span`,{className:T.ubStatLabel,children:[t(`official`),`(=DeepSeek 直连)`]}),(0,o.jsx)(`span`,{className:T.ubStatValue,children:H(Z.officialCost)}),(0,o.jsxs)(`span`,{className:T.ubStatDetail,children:[Z.officialCalls,` `,t(`calls`),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:T.ubStatCard,children:[(0,o.jsxs)(`span`,{className:T.ubStatLabel,children:[t(`thirdParty`),`(中转)`]}),(0,o.jsx)(`span`,{className:T.ubStatValue,children:H(Z.thirdCost)}),(0,o.jsxs)(`span`,{className:T.ubStatDetail,children:[Z.thirdCalls,` `,t(`calls`),` · `,(100-n).toFixed(1),`%`]})]})]})})(),e.byWorkspace!==void 0&&e.byWorkspace.length>0&&(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-workspaces`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`workspaces`)}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:t(`workspacesHint`)})]}),(0,o.jsx)(`ul`,{className:T.rowlist,children:e.byWorkspace.map(n=>(0,o.jsxs)(r.Fragment,{children:[(0,o.jsx)(`li`,{children:(0,o.jsxs)(`button`,{type:`button`,className:T.rowline,"data-testid":`billing-workspace-${n.name}`,onClick:()=>{be(ye===n.name?void 0:n.name)},children:[(0,o.jsx)(`span`,{className:T.rowlineName,children:n.name}),(0,o.jsxs)(`span`,{className:T.rowlineRight,children:[(0,o.jsx)(`span`,{className:T.num,children:H(n.cost)}),(0,o.jsxs)(`span`,{className:T.rowlineMuted,children:[n.calls,` `,t(`calls`)]}),(0,o.jsx)(`span`,{className:T.rowlineChev,"aria-hidden":`true`,children:`›`})]})]})}),ye===n.name&&(0,o.jsx)(`li`,{className:T.rowlineDrillWrap,children:e.bySession?.filter(e=>Dt(e.cwd)===n.name).slice(0,5).map(e=>(0,o.jsxs)(`div`,{className:T.rowlineDrill,children:[(0,o.jsx)(`span`,{className:T.rowlineName,children:e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`}),(0,o.jsxs)(`span`,{className:T.rowlineRight,children:[(0,o.jsx)(`span`,{className:T.num,children:H(e.cost)}),(0,o.jsxs)(`span`,{className:T.rowlineMuted,children:[e.calls,` `,t(`calls`)]})]})]},e.id))})]},n.name))})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:T.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:T.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:T.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:T.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:T.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:T.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:T.emptyRow,children:t(`noData`)})}),Wt(e.bySession).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&P.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelProvider,children:Dt(e.cwd)??`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:T.numCol,children:H(e.cost)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${$t(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?T.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{I(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:T.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(T.ubTag,T.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:T.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),M===`token`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(Ge,{stats:e,trendDays:ce,onTrendDays:le,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:T.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(Le,{perf:e.perf,models:gt,t})]})]}),M===`pricing`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:T.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:T.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:T.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,B(Ee.rate)]}),(0,o.jsx)(`span`,{className:l(T.ubTag,Ee.live?T.ubTagSuccess:T.ubTagNeutral),children:Ee.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:T.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:T.ubTablewrap,children:(0,o.jsxs)(`table`,{className:T.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:we().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:T.ubModel,children:[(0,o.jsx)(gn,{provider:e.provider,colorVar:Te(e.colorVar)}),(0,o.jsxs)(`span`,{className:T.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:T.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Se(e.promo,Date.now())&&(0,o.jsx)(`span`,{className:T.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:T.numCol,children:n?W(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:n?W(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:n?W(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(`span`,{className:T.ubPricepair,children:[(0,o.jsxs)(`span`,{className:T.ubChipPeak,children:[(0,o.jsx)(`span`,{className:T.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:T.num,children:[W(e.price.input,e.price.currency),` / `,W(e.price.output,e.price.currency)]})]}),(0,o.jsxs)(`span`,{className:T.ubChipOff,children:[(0,o.jsx)(`span`,{className:T.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:T.num,children:[W(e.price.offPeak.input,e.price.currency),` / `,W(e.price.offPeak.output,e.price.currency)]})]})]}):n?(0,o.jsx)(`span`,{className:T.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:T.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:T.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:T.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:T.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:T.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):W(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:T.numCol,children:(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):W(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:T.numCol,children:(0,o.jsx)(`span`,{className:T.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:T.ubCard,children:[(0,o.jsx)(`div`,{className:T.ubCardHead,children:(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:T.ubNotes,children:[(0,o.jsxs)(`li`,{className:T.ubNotesItem,children:[(0,o.jsx)(`span`,{className:T.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:T.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:T.ubNotesItem,children:[(0,o.jsx)(`span`,{className:T.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:T.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:T.ubNotesItem,children:[(0,o.jsx)(`span`,{className:T.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:T.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:T.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 gn({provider:e,colorVar:t}){let n=yt(e);return n===void 0?(0,o.jsx)(`span`,{className:T.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()}):(0,o.jsx)(`img`,{className:T.vendorLogo,src:n,alt:``,"aria-hidden":`true`})}function _n(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(tn),[m,h]=(0,r.useState)(kt),[v,y]=(0,r.useState)([]),[x,w]=(0,r.useState)(void 0),[T,E]=(0,r.useState)([]),[te,ne]=(0,r.useState)(!1),[re,D]=(0,r.useState)([]),[O,ie]=(0,r.useState)(`cny`),[k,ae]=(0,r.useState)(()=>f()),A=(0,r.useCallback)(e=>{ae(e),p(e)},[]),[j,M]=(0,r.useState)(()=>b()),se=(0,r.useCallback)(e=>{M(e),ee(e)},[]),[ce,ue]=(0,r.useState)(()=>g()),fe=(0,r.useCallback)(e=>{ue(e),_(e)},[]),[me,he]=(0,r.useState)(()=>{let e=S();return oe(e),e}),ge=(0,r.useCallback)(e=>{he(e),oe(e),C(e)},[]),_e=(0,r.useMemo)(()=>Rt(u),[u,me]),ve=O===`usd`?`en`:`zh`,N=(0,r.useCallback)((e,n)=>{let r=(ve===`en`?ht:mt)[e]??t(e);if(n===void 0)return r;let i=r;for(let[e,t]of Object.entries(n))i=i.replaceAll(`{${e}}`,String(t));return i},[ve,t]),[ye,be]=(0,r.useState)(!1),P=(0,r.useCallback)(()=>{be(!1)},[]),F=(0,r.useCallback)(()=>{nn().then(e=>{e!==null&&d(Rt(e))}),on().then(({balances:e,reconcile:t})=>{e.length>0&&y(e),w(t)}),sn().then(e=>{e.length>0&&E(e),ne(!1)}).catch(()=>{ne(!0)}),cn().then(e=>{D(e)}).catch(()=>{})},[]),I=(0,r.useCallback)(()=>{F(),an(),be(!0)},[F]);(0,r.useEffect)(()=>{F(),an()},[F]),(0,r.useEffect)(()=>{let e=setInterval(()=>{F(),an()},Qt);return()=>{clearInterval(e)}},[F]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(h(t),le(t.catalog??[]))}),()=>{e=!1}},[n]);let L=$(),R=Object.entries(u.byDay).filter(([e])=>e.startsWith(L.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),Se=u.byDay[L]?.cost??0,Ce=Ht(u.byDay,L),we=(0,r.useMemo)(()=>Vt(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]),Te=Object.entries(u.byDay).filter(([e])=>e.startsWith(L.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Ee=(()=>{let e=u.byDay[L];return e===void 0?0:e.input+e.output})(),De=Ht(u.byDay,L,e=>e.input+e.output),z=c(e=>e.enabled),Oe=c(e=>e.amount),ke=c(e=>e.tierAlertDays),V=c(e=>e.lastTierSwitchAt),[Ae,H]=(0,r.useState)(()=>St()),[je,U]=(0,r.useState)(null),[W,Me]=(0,r.useState)(null),[Ne,G]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>G(Date.now()),Qt);return()=>{clearInterval(e)}},[]);let Pe=(0,r.useCallback)(e=>{H(e),Ct(e)},[]),Fe=(0,r.useCallback)(()=>{Me({entering:pe(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4})},[]),K=Oe>0?Oe:u.budget??0,Ie=(0,r.useCallback)(()=>{let e=!z;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,z]);(0,r.useEffect)(()=>{if(!z||K<=0)return;let e=R/K*100,t=$(),n=Ot.filter(n=>e>=n&&ke?.[String(n)]!==t);if(n.length===0)return;let r=n[n.length-1]??100;if(l.markTierAlerted(n,t),typeof Notification>`u`||Notification.permission!==`granted`)return;let i=N(`budgetTierBody`).replace(`{cost}`,B(R)).replace(`{budget}`,B(K)).replace(`{pct}`,String(r));try{new Notification(N(`budget`),{body:i})}catch{}},[z,K,R,ke,l,N]),(0,r.useEffect)(()=>{let e=wt(Ne,Ae,V);if(e===null||(l.markTierSwitchAlerted(e.atMs),U(e),!Ae.webNotify)||typeof Notification>`u`||Notification.permission!==`granted`)return;let t=Math.max(1,Math.round((e.atMs-Ne)/6e4)),n=e.entering===`peak`?N(`peakAlertTitlePeak`):N(`peakAlertTitleOff`),r=e.entering===`peak`?N(`tierAlertEnterPeak`).replace(`{minutes}`,String(t)):N(`tierAlertEnterOff`).replace(`{minutes}`,String(t));try{new Notification(n,{body:r})}catch{}},[Ne,V,Ae,l,N]);let Le=c(e=>e.lastBalanceAlertDay),q=(0,r.useMemo)(()=>{if(v.length===0)return;let e=u.lowBalanceThreshold??50,t=It(u.byDay,L),n=de().rate;for(let r of v){if(r.totalBalance===void 0||r.error!==void 0)continue;let i=r.currency===`USD`?r.totalBalance*n:r.totalBalance;if(i>=e)continue;let a=t>0?Math.floor(i/t):void 0;return{name:r.displayName,cny:i,days:a}}},[v,u.lowBalanceThreshold,u.byDay,L]);(0,r.useEffect)(()=>{if(q===void 0)return;let e=$();if(Le===e||(l.markBalanceAlerted(e),typeof Notification>`u`||Notification.permission!==`granted`))return;let t=N(`balanceLowBody`).replace(`{name}`,q.name).replace(`{balance}`,B(q.cny)).replace(`{days}`,q.days===void 0?`—`:String(q.days));try{new Notification(N(`balance`),{body:t})}catch{}},[q,Le,l,N]);let Re=(0,r.useMemo)(()=>{let e=L.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=[...t.entries()].filter(([,e])=>!e.plan).sort((e,t)=>t[1].cost-e[1].cost)[0],r=[...t.entries()].filter(([,e])=>e.plan).sort((e,t)=>t[1].cost-e[1].cost)[0],i=e=>{let t=v.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0)return{text:t?.error===`unauthorized`?N(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?N(`balanceUnreachable`):N(`balanceUnconfigured`),low:!1};let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:B(t.totalBalance),r=de().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<(u.lowBalanceThreshold??50)}},a=e=>{let t=T.find(t=>t.displayName===e||Ft(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:N(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?N(`subscriptionExhausted`):N(`subscriptionRemaining`).replace(`{pct}`,String(n)),low:n<20}};return{direct:n===void 0?void 0:{name:n[0],...i(n[0])},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[u.byDayModels,u.byModel,u.lowBalanceThreshold,v,T,L]),ze=(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:Se,monthCost:R})},[Se,R,i]),(0,r.useEffect)(()=>a(I),[a,I]);let Be=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dn,{...e,t:N,onOpen:I,monthCost:R,todayCost:Se,weekCost:Ce,days:we,vendorStatus:Re,dash:ze,cardPrefs:ce,monthTokens:Te,todayTokens:Ee,weekTokens:De,floatPrefs:k,subscriptions:T}),ye&&(0,o.jsx)(hn,{stats:_e,t:N,onClose:P,userPrices:me,onUserPrices:ge,health:m,balances:v,...x===void 0?{}:{reconcile:x},quotas:T,relayQuotas:re,currency:O,onCurrency:ie,turns:Be,renderSlot:s,budgetEnabled:z,budgetAmount:K,onToggleBudget:Ie,onBudgetAmount:l.setAmount,peakConfig:Ae,onPeakConfig:Pe,onPreviewPeak:Fe,floatPrefs:k,onFloatPrefs:A,cardPrefs:ce,onCardPrefs:fe,sitePrefs:j,onSitePrefs:se,quotasStale:te}),(je!==null||W!==null)&&(0,o.jsx)(Tt,{hit:je??W,config:Ae,t:N,onDismiss:()=>{U(null),Me(null)}})]})}function vn(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function yn(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 bn(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 xn(){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 Sn(){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 Cn(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function wn({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=()=>{xn().then(t=>{!e&&t!==null&&a(t)}),Sn().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)(()=>vn(i,n),[i,n]),f=(0,r.useMemo)(()=>yn(i,n),[i,n]),p=_e(l),m=(0,r.useMemo)(()=>bn(s),[s]),h=e=>B(e,`cny`);if(n===void 0)return null;let g=d>0||f>0,_=p.tier===`peak`;return(0,o.jsxs)(`span`,{className:T.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:_?T.feeChipPrimary:T.feeChipOff,"data-testid":`billing-live-tier`,children:t(_?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:T.feeCount,children:N(p.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:T.feeSuffix,children:t(_?`tierToOff`:`tierToPeak`)}),g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:T.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:T.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:T.feeNum,children:h(f)})]}),(0,o.jsx)(`span`,{className:T.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:T.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:T.feeNum,children:h(d)})]})]}),m.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?T.feeChipError:T.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(Cn(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function Tn(){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 En(){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 Dn={enabled:!1,timeout:0};function On(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...Dn};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...Dn}}}function kn(e){return e.completed===!0||e.running===!1}function An(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)),kn(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=kn(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 jn=[`slots`,`locale`,`connection`,`sessions`];function Mn(e){let t=Tn();e.provide(`billingMetrics`,t);let n=En(),r=e.get(`connection`);e.effect(()=>e.locale.register(pt,{zh:mt,en:ht}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:pt,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)})},_n)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:pt},wn)),e.effect(()=>An(e.sessions.list,On),`ui-usage-billing: completion notifier`)}return n.UsageBilling=_n,n.apply=Mn,n.inject=jn,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 ee(e){try{localStorage.setItem(y,JSON.stringify(e))}catch{}}let x=`dsh.ui-usage-billing.prices`;function S(){try{let e=localStorage.getItem(x);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 C(e){try{localStorage.setItem(x,JSON.stringify(e))}catch{}}let w=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(w)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=w,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_ubStatGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;display:grid}.BAyRca_ubStatCard{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;gap:4px;padding:14px 16px;display:flex}.BAyRca_ubStatLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_ubStatValue{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;letter-spacing:-.01em;font-size:22px;font-weight:700;line-height:28px}.BAyRca_ubStatDetail{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.BAyRca_rowlist{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.BAyRca_rowline{width:100%;min-width:0;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:10px;justify-content:space-between;align-items:center;gap:12px;padding:9px 12px;transition:background-color .14s,border-color .14s;display:flex}.BAyRca_rowline:hover{background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 60%, transparent);border-color:var(--dsw-alias-border-l1)}.BAyRca_rowlineName{min-width:0;color:var(--dsw-alias-label-primary);white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:12.5px;font-weight:500;overflow:hidden}.BAyRca_rowlineRight{font-variant-numeric:tabular-nums;flex:none;align-items:baseline;gap:8px;display:inline-flex}.BAyRca_rowlineMuted{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px}.BAyRca_rowlineChev{color:var(--dsw-alias-label-tertiary);font-size:14px}.BAyRca_rowlineDrillWrap{padding-left:12px}.BAyRca_rowlineDrill{border-left:1px solid var(--dsw-alias-border-l1);justify-content:space-between;align-items:center;gap:12px;padding:6px 12px;font-size:12px;display:flex}.BAyRca_modelTable,.BAyRca_pricingTable{border-collapse:collapse;width:100%;font-size:12.5px}.BAyRca_modelTable{table-layout:fixed;min-width:640px}.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}body[data-zine-mode] .BAyRca_trigger,body[data-zine-mode] .BAyRca_triggerPop,body[data-zine-mode] .BAyRca_railButton{display:none}body[data-zine-mode] .BAyRca_dashboardHead{background:#000;border-bottom:2px solid #e8ff00}body[data-zine-mode] .BAyRca_headTitleRow{align-items:center;gap:8px;margin-top:4px;display:flex}body[data-zine-mode] .BAyRca_dashboardTitle{color:#e8ff00;letter-spacing:.04em;text-transform:uppercase;text-shadow:0 0 8px #e8ff0066;font-weight:900}body[data-zine-mode] .BAyRca_dashboardSubtitle{color:#c9d98a;letter-spacing:.08em;text-transform:uppercase;font-size:10px}body[data-zine-mode] .BAyRca_closeButton{color:#0a0a05;background:#ff2d95;border:1.5px solid #ff2d95;border-radius:0;box-shadow:0 0 10px #ff2d9573}body[data-zine-mode] .BAyRca_hero{background:#000;border:2.5px solid #e8ff00;border-radius:0;position:relative;box-shadow:0 0 0 1px #0009,0 0 24px #e8ff002e}body[data-zine-mode] .BAyRca_heroLabel{color:#c9d98a;letter-spacing:.12em;text-transform:uppercase;font-size:10px;font-weight:900}body[data-zine-mode] .BAyRca_heroValue{color:#e8ff00;letter-spacing:-.02em;text-shadow:0 0 12px #e8ff0073;-webkit-text-fill-color:#e8ff00;background:0 0;font-size:38px;font-weight:900}body[data-zine-mode] .BAyRca_heroMeta{color:#c9d98a;letter-spacing:.06em;text-transform:uppercase;font-size:10.5px}body[data-zine-mode] .BAyRca_heroSideLabel{color:#c9d98a;letter-spacing:.1em;text-transform:uppercase;font-size:10px;font-weight:900}body[data-zine-mode] .BAyRca_heroSideValue{color:#e8ff00;text-shadow:0 0 6px #e8ff0059}body[data-zine-mode] .BAyRca_delta{font-weight:900}body[data-zine-mode] .BAyRca_deltaUp{color:#ff2d95}body[data-zine-mode] .BAyRca_deltaDown{color:#c9d98a}body[data-zine-mode] .BAyRca_tabNav{background:#000;border-bottom:2px solid #e8ff00}body[data-zine-mode] .BAyRca_tabButton{color:#c9d98a;letter-spacing:.08em;text-transform:uppercase;border-radius:0;font-size:10.5px;font-weight:900}body[data-zine-mode] .BAyRca_tabButton:hover,body[data-zine-mode] .BAyRca_tabButton:focus-visible{color:#e8ff00;background:#e8ff001f}body[data-zine-mode] .BAyRca_tabButtonActive,body[data-zine-mode] .BAyRca_tabButtonActive:hover,body[data-zine-mode] .BAyRca_tabButtonActive:focus-visible{color:#0a0a05;background:#e8ff00;box-shadow:0 0 10px #e8ff0073}body[data-zine-mode] .BAyRca_panel{background:#000;border:2px solid #e8ff00;border-radius:0}body[data-zine-mode] .BAyRca_trendPanel{position:relative}body[data-zine-mode] .BAyRca_panelTitle{color:#e8ff00;letter-spacing:.06em;text-transform:uppercase;text-shadow:0 0 6px #e8ff0066;font-weight:900}body[data-zine-mode] .BAyRca_panelHint{color:#c9d98a;letter-spacing:.08em;text-transform:uppercase;font-size:10px;font-weight:900}body[data-zine-mode] .BAyRca_modelTableScroll{background:#000;border:1.5px solid #e8ff0080;border-radius:0}.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 T={popDotDirect:`BAyRca_popDotDirect`,heroReadout:`BAyRca_heroReadout`,shareDot:`BAyRca_shareDot`,siteKindDirect:`BAyRca_siteKindDirect`,userPriceOffPeak:`BAyRca_userPriceOffPeak`,plgTag:`BAyRca_plgTag`,chartWrap:`BAyRca_chartWrap`,subscriptionTrack:`BAyRca_subscriptionTrack`,tabPanelIn:`BAyRca_tabPanelIn`,btn:`BAyRca_btn`,tabButtonActive:`BAyRca_tabButtonActive`,siteRowCost:`BAyRca_siteRowCost`,providerGroupList:`BAyRca_providerGroupList`,providerGroupBalance:`BAyRca_providerGroupBalance`,peakDotPrimary:`BAyRca_peakDotPrimary`,panel:`BAyRca_panel`,popModelLabel:`BAyRca_popModelLabel`,planTag:`BAyRca_planTag`,balanceCell:`BAyRca_balanceCell`,balanceDetailClose:`BAyRca_balanceDetailClose`,triggerPopEmpty:`BAyRca_triggerPopEmpty`,plgVal:`BAyRca_plgVal`,heroBudgetTrack:`BAyRca_heroBudgetTrack`,affix:`BAyRca_affix`,budgetFillOver:`BAyRca_budgetFillOver`,rowlist:`BAyRca_rowlist`,subscriptionGrid:`BAyRca_subscriptionGrid`,heatmapRangeSwitch:`BAyRca_heatmapRangeSwitch`,popModelRow:`BAyRca_popModelRow`,triggerLabel:`BAyRca_triggerLabel`,heroMeta:`BAyRca_heroMeta`,siteRowCalls:`BAyRca_siteRowCalls`,heatmapYear:`BAyRca_heatmapYear`,plgLabel:`BAyRca_plgLabel`,rowlineMuted:`BAyRca_rowlineMuted`,heroGauge:`BAyRca_heroGauge`,staleNotice:`BAyRca_staleNotice`,floatModeBtn:`BAyRca_floatModeBtn`,reconcileNotice:`BAyRca_reconcileNotice`,rowlineDrill:`BAyRca_rowlineDrill`,ctlGroup:`BAyRca_ctlGroup`,chartTooltipRow:`BAyRca_chartTooltipRow`,tokenModelPartIn:`BAyRca_tokenModelPartIn`,exportBar:`BAyRca_exportBar`,subscriptionExhausted:`BAyRca_subscriptionExhausted`,shareSegAssistant:`BAyRca_shareSegAssistant`,panelTitle:`BAyRca_panelTitle`,triggerSparkHot:`BAyRca_triggerSparkHot`,roundsBarWrap:`BAyRca_roundsBarWrap`,tokenModelParts:`BAyRca_tokenModelParts`,peakCard:`BAyRca_peakCard`,roundsFlagMark:`BAyRca_roundsFlagMark`,ubExtraRow:`BAyRca_ubExtraRow`,dashboardHead:`BAyRca_dashboardHead`,popModelStatusLow:`BAyRca_popModelStatusLow`,reconcileIcon:`BAyRca_reconcileIcon`,panelHead:`BAyRca_panelHead`,chartGrid:`BAyRca_chartGrid`,ctlRowStretch:`BAyRca_ctlRowStretch`,heroBudgetFillOver:`BAyRca_heroBudgetFillOver`,balanceDetailHead:`BAyRca_balanceDetailHead`,metricValuePrimary:`BAyRca_metricValuePrimary`,exportButton:`BAyRca_exportButton`,bucketCost:`BAyRca_bucketCost`,dashboardRight:`BAyRca_dashboardRight`,rowlineChev:`BAyRca_rowlineChev`,popModelStatus:`BAyRca_popModelStatus`,trigger:`BAyRca_trigger`,triggerPopSwitchCount:`BAyRca_triggerPopSwitchCount`,metricValueSuccess:`BAyRca_metricValueSuccess`,subscriptionReset:`BAyRca_subscriptionReset`,providerGroupTitle:`BAyRca_providerGroupTitle`,bucketSep:`BAyRca_bucketSep`,ubRate:`BAyRca_ubRate`,peakDot:`BAyRca_peakDot`,peakDotSuccess:`BAyRca_peakDotSuccess`,tableScroll:`BAyRca_tableScroll`,userPriceInputNum:`BAyRca_userPriceInputNum`,heroLabel:`BAyRca_heroLabel`,ubExtraNote:`BAyRca_ubExtraNote`,switchKnob:`BAyRca_switchKnob`,siteRowTitle:`BAyRca_siteRowTitle`,balanceDaysBadgeLow:`BAyRca_balanceDaysBadgeLow`,subscriptionPct:`BAyRca_subscriptionPct`,dashboard:`BAyRca_dashboard`,currencyButton:`BAyRca_currencyButton`,subscriptionName:`BAyRca_subscriptionName`,bucketThird:`BAyRca_bucketThird`,ubNotesTerm:`BAyRca_ubNotesTerm`,feeChipAlert:`BAyRca_feeChipAlert`,heroCurrency:`BAyRca_heroCurrency`,roundsBars:`BAyRca_roundsBars`,plgIcon:`BAyRca_plgIcon`,plgTitle:`BAyRca_plgTitle`,peakCardOff:`BAyRca_peakCardOff`,peakHead:`BAyRca_peakHead`,userPriceRemove:`BAyRca_userPriceRemove`,subscriptionGoldFlow:`BAyRca_subscriptionGoldFlow`,feeChipError:`BAyRca_feeChipError`,ubNotesDesc:`BAyRca_ubNotesDesc`,pricingToggle:`BAyRca_pricingToggle`,dashboardSubtitle:`BAyRca_dashboardSubtitle`,ubStatValue:`BAyRca_ubStatValue`,heatmapYearGrid:`BAyRca_heatmapYearGrid`,ubChipPeak:`BAyRca_ubChipPeak`,dashboardTitle:`BAyRca_dashboardTitle`,chartSvg:`BAyRca_chartSvg`,rangeToggle:`BAyRca_rangeToggle`,popModel:`BAyRca_popModel`,currencyButtonActive:`BAyRca_currencyButtonActive`,triggerPopShown:`BAyRca_triggerPopShown`,ubTable:`BAyRca_ubTable`,heatmapRangeButtonActive:`BAyRca_heatmapRangeButtonActive`,setCardHead:`BAyRca_setCardHead`,setCardMeta:`BAyRca_setCardMeta`,headTitleRow:`BAyRca_headTitleRow`,subscriptionPlan:`BAyRca_subscriptionPlan`,ubTagError:`BAyRca_ubTagError`,dashboardModal:`BAyRca_dashboardModal`,triggerSub:`BAyRca_triggerSub`,subscriptionFillWarn:`BAyRca_subscriptionFillWarn`,railButton:`BAyRca_railButton`,triggerPopSwitcher:`BAyRca_triggerPopSwitcher`,modelTableScroll:`BAyRca_modelTableScroll`,shareValue:`BAyRca_shareValue`,ubTag:`BAyRca_ubTag`,peakCountSuccess:`BAyRca_peakCountSuccess`,rdoDot:`BAyRca_rdoDot`,heroTop:`BAyRca_heroTop`,heroGaugeTrack:`BAyRca_heroGaugeTrack`,tokenModelShareRow:`BAyRca_tokenModelShareRow`,heatmapGrid:`BAyRca_heatmapGrid`,ubModelName:`BAyRca_ubModelName`,heatmapYearMonth:`BAyRca_heatmapYearMonth`,inp:`BAyRca_inp`,peakCardCenter:`BAyRca_peakCardCenter`,switchOn:`BAyRca_switchOn`,dashboardBody:`BAyRca_dashboardBody`,heatmapRangeButton:`BAyRca_heatmapRangeButton`,peakClose:`BAyRca_peakClose`,heroGaugePctOver:`BAyRca_heroGaugePctOver`,healthOk:`BAyRca_healthOk`,roundsEmpty:`BAyRca_roundsEmpty`,floatModeBtnOn:`BAyRca_floatModeBtnOn`,peakDesc:`BAyRca_peakDesc`,setCardDesc:`BAyRca_setCardDesc`,siteRowName:`BAyRca_siteRowName`,roundsBarCol:`BAyRca_roundsBarCol`,heatmapYearBody:`BAyRca_heatmapYearBody`,metricValue:`BAyRca_metricValue`,siteRow:`BAyRca_siteRow`,balanceDetailTitle:`BAyRca_balanceDetailTitle`,ubAlertNote:`BAyRca_ubAlertNote`,ubStatGrid:`BAyRca_ubStatGrid`,plgLink:`BAyRca_plgLink`,triggerIcon:`BAyRca_triggerIcon`,tabPanel:`BAyRca_tabPanel`,kpiTile:`BAyRca_kpiTile`,chartCrosshair:`BAyRca_chartCrosshair`,heroSideLabel:`BAyRca_heroSideLabel`,healthDot:`BAyRca_healthDot`,ubNotesItem:`BAyRca_ubNotesItem`,feeNum:`BAyRca_feeNum`,providerGroupBalanceLabel:`BAyRca_providerGroupBalanceLabel`,peakTagSuccess:`BAyRca_peakTagSuccess`,providerGroupHead:`BAyRca_providerGroupHead`,heatmap:`BAyRca_heatmap`,exportLabel:`BAyRca_exportLabel`,metricLabel:`BAyRca_metricLabel`,heroMain:`BAyRca_heroMain`,deltaUp:`BAyRca_deltaUp`,deltaDown:`BAyRca_deltaDown`,budgetInput:`BAyRca_budgetInput`,chartLegend:`BAyRca_chartLegend`,ubPricepair:`BAyRca_ubPricepair`,feeSuffix:`BAyRca_feeSuffix`,heatmapFooter:`BAyRca_heatmapFooter`,triggerPrimary:`BAyRca_triggerPrimary`,heatmapYearCell:`BAyRca_heatmapYearCell`,chartBar:`BAyRca_chartBar`,providerGroup:`BAyRca_providerGroup`,roundsBarColOff:`BAyRca_roundsBarColOff`,plgDesc:`BAyRca_plgDesc`,heroGaugeArc:`BAyRca_heroGaugeArc`,unpricedHint:`BAyRca_unpricedHint`,ubAlertLeft:`BAyRca_ubAlertLeft`,ubTagPromo:`BAyRca_ubTagPromo`,roundsBarFlagged:`BAyRca_roundsBarFlagged`,balanceDetailLabel:`BAyRca_balanceDetailLabel`,rdo:`BAyRca_rdo`,kpiValue:`BAyRca_kpiValue`,feeBar:`BAyRca_feeBar`,reconcileDismiss:`BAyRca_reconcileDismiss`,metricCell:`BAyRca_metricCell`,ubTablewrap:`BAyRca_ubTablewrap`,rounds:`BAyRca_rounds`,subscriptionWindow:`BAyRca_subscriptionWindow`,heatmapYearMonths:`BAyRca_heatmapYearMonths`,floatSubName:`BAyRca_floatSubName`,floatSubPlan:`BAyRca_floatSubPlan`,metricGrid:`BAyRca_metricGrid`,heroSide:`BAyRca_heroSide`,peakAlertIn:`BAyRca_peakAlertIn`,switch:`BAyRca_switch`,heatmapYearWeekdays:`BAyRca_heatmapYearWeekdays`,ubCardTitle:`BAyRca_ubCardTitle`,ubStatLabel:`BAyRca_ubStatLabel`,rowline:`BAyRca_rowline`,triggerSpark:`BAyRca_triggerSpark`,rowlineRight:`BAyRca_rowlineRight`,heatmapLegend:`BAyRca_heatmapLegend`,kpiDetail:`BAyRca_kpiDetail`,setCard:`BAyRca_setCard`,shareSegUser:`BAyRca_shareSegUser`,modelTable:`BAyRca_modelTable`,heatmapCellEmpty:`BAyRca_heatmapCellEmpty`,heatmapYearWeekday:`BAyRca_heatmapYearWeekday`,ubTagAlert:`BAyRca_ubTagAlert`,modelProvider:`BAyRca_modelProvider`,heroBudgetFill:`BAyRca_heroBudgetFill`,heroSideSpacer:`BAyRca_heroSideSpacer`,plgGrid:`BAyRca_plgGrid`,heroGaugeLabel:`BAyRca_heroGaugeLabel`,shareItem:`BAyRca_shareItem`,ctlLabel:`BAyRca_ctlLabel`,modalFooter:`BAyRca_modalFooter`,emptyRow:`BAyRca_emptyRow`,plgItem:`BAyRca_plgItem`,heatmapYearScroll:`BAyRca_heatmapYearScroll`,feeItem:`BAyRca_feeItem`,feeChipPrimary:`BAyRca_feeChipPrimary`,ubChipOff:`BAyRca_ubChipOff`,estimatedTag:`BAyRca_estimatedTag`,userPriceInput:`BAyRca_userPriceInput`,na:`BAyRca_na`,subscriptionAuto:`BAyRca_subscriptionAuto`,closeButton:`BAyRca_closeButton`,heroSideValue:`BAyRca_heroSideValue`,hero:`BAyRca_hero`,ubNotes:`BAyRca_ubNotes`,ubStatDetail:`BAyRca_ubStatDetail`,panelHint:`BAyRca_panelHint`,reconcileText:`BAyRca_reconcileText`,shareLegend:`BAyRca_shareLegend`,vendorLetter:`BAyRca_vendorLetter`,uncataloguedTag:`BAyRca_uncataloguedTag`,ubTagSuccess:`BAyRca_ubTagSuccess`,floatSub:`BAyRca_floatSub`,progFill:`BAyRca_progFill`,chartLegendBar:`BAyRca_chartLegendBar`,modelName:`BAyRca_modelName`,shareSegOff:`BAyRca_shareSegOff`,ubExtraName:`BAyRca_ubExtraName`,ubCardSub:`BAyRca_ubCardSub`,popDotNeutral:`BAyRca_popDotNeutral`,rowlineDrillWrap:`BAyRca_rowlineDrillWrap`,modelDot:`BAyRca_modelDot`,budgetOverPulse:`BAyRca_budgetOverPulse`,ctlCol:`BAyRca_ctlCol`,balanceDaysBadge:`BAyRca_balanceDaysBadge`,pricingTable:`BAyRca_pricingTable`,ubCardControlGroup:`BAyRca_ubCardControlGroup`,feeChipOff:`BAyRca_feeChipOff`,ubCard:`BAyRca_ubCard`,shareTrack:`BAyRca_shareTrack`,heroSideItem:`BAyRca_heroSideItem`,healthBadgeBad:`BAyRca_healthBadgeBad`,feeCount:`BAyRca_feeCount`,heroGaugeArcOver:`BAyRca_heroGaugeArcOver`,shareSegTool:`BAyRca_shareSegTool`,heatmapHover:`BAyRca_heatmapHover`,plgName:`BAyRca_plgName`,tokenPanel:`BAyRca_tokenPanel`,kpiLabel:`BAyRca_kpiLabel`,rangeButtonActive:`BAyRca_rangeButtonActive`,rangeButton:`BAyRca_rangeButton`,subscriptionStatus:`BAyRca_subscriptionStatus`,ubChipLabel:`BAyRca_ubChipLabel`,floatTarget:`BAyRca_floatTarget`,heroGaugePct:`BAyRca_heroGaugePct`,subscriptionCard:`BAyRca_subscriptionCard`,flatTag:`BAyRca_flatTag`,budgetFillWarn:`BAyRca_budgetFillWarn`,balanceDetailPop:`BAyRca_balanceDetailPop`,providerGroupMeta:`BAyRca_providerGroupMeta`,balanceDetailGrid:`BAyRca_balanceDetailGrid`,peakCardPeak:`BAyRca_peakCardPeak`,ubCardHead:`BAyRca_ubCardHead`,providerGroupName:`BAyRca_providerGroupName`,ctlRow:`BAyRca_ctlRow`,delta:`BAyRca_delta`,popModelName:`BAyRca_popModelName`,chartStack:`BAyRca_chartStack`,numCol:`BAyRca_numCol`,popTitle:`BAyRca_popTitle`,trendPanel:`BAyRca_trendPanel`,bucketOfficial:`BAyRca_bucketOfficial`,triggerSparkBar:`BAyRca_triggerSparkBar`,dashboardIn:`BAyRca_dashboardIn`,healthBadge:`BAyRca_healthBadge`,tabNav:`BAyRca_tabNav`,heatmapCell:`BAyRca_heatmapCell`,heroValue:`BAyRca_heroValue`,plgHead:`BAyRca_plgHead`,chartTooltipSwatch:`BAyRca_chartTooltipSwatch`,subscriptionHead:`BAyRca_subscriptionHead`,subscriptionFill:`BAyRca_subscriptionFill`,healthBad:`BAyRca_healthBad`,popHead:`BAyRca_popHead`,prog:`BAyRca_prog`,siteRowCallsLow:`BAyRca_siteRowCallsLow`,heroBudget:`BAyRca_heroBudget`,chartLegendLine:`BAyRca_chartLegendLine`,siteKindTag:`BAyRca_siteKindTag`,siteRowMeta:`BAyRca_siteRowMeta`,currencyToggle:`BAyRca_currencyToggle`,subscriptionFillOver:`BAyRca_subscriptionFillOver`,floatSubHead:`BAyRca_floatSubHead`,peakCardCorner:`BAyRca_peakCardCorner`,chartBarPlaceholder:`BAyRca_chartBarPlaceholder`,ubStatCard:`BAyRca_ubStatCard`,sessionGroupRow:`BAyRca_sessionGroupRow`,roundsBarLabel:`BAyRca_roundsBarLabel`,setCardTitle:`BAyRca_setCardTitle`,"billing-trigger":`BAyRca_billing-trigger`,heroGaugeSvg:`BAyRca_heroGaugeSvg`,siteKindSite:`BAyRca_siteKindSite`,ubModel:`BAyRca_ubModel`,tabButton:`BAyRca_tabButton`,kpiGrid:`BAyRca_kpiGrid`,modelCell:`BAyRca_modelCell`,subscriptionTier:`BAyRca_subscriptionTier`,kpiGreen:`BAyRca_kpiGreen`,chartLine:`BAyRca_chartLine`,triggerPop:`BAyRca_triggerPop`,heroBudgetLabel:`BAyRca_heroBudgetLabel`,healthIdle:`BAyRca_healthIdle`,popTagPrimary:`BAyRca_popTagPrimary`,floatTargetLabel:`BAyRca_floatTargetLabel`,balanceDetailValue:`BAyRca_balanceDetailValue`,popTagSub:`BAyRca_popTagSub`,feeSep:`BAyRca_feeSep`,subscriptionWindowLabel:`BAyRca_subscriptionWindowLabel`,triggerYen:`BAyRca_triggerYen`,healthBadgeOk:`BAyRca_healthBadgeOk`,providerGroupBadge:`BAyRca_providerGroupBadge`,roundsBar:`BAyRca_roundsBar`,plgNameRow:`BAyRca_plgNameRow`,vendorLogo:`BAyRca_vendorLogo`,peakCountPrimary:`BAyRca_peakCountPrimary`,peakTag:`BAyRca_peakTag`,chartTooltipDate:`BAyRca_chartTooltipDate`,tokenModelPartOut:`BAyRca_tokenModelPartOut`,heroGaugeCenter:`BAyRca_heroGaugeCenter`,userPriceRow:`BAyRca_userPriceRow`,popDot:`BAyRca_popDot`,ubTagNeutral:`BAyRca_ubTagNeutral`,chartAxisLabel:`BAyRca_chartAxisLabel`,tokenModelBar:`BAyRca_tokenModelBar`,userPriceField:`BAyRca_userPriceField`,sessionChildRow:`BAyRca_sessionChildRow`,balanceDetailRow:`BAyRca_balanceDetailRow`,rowlineName:`BAyRca_rowlineName`,ubAlert:`BAyRca_ubAlert`,chartEmpty:`BAyRca_chartEmpty`,triggerMain:`BAyRca_triggerMain`,shareSegPeak:`BAyRca_shareSegPeak`,triggerPopSubscription:`BAyRca_triggerPopSubscription`,roundsAxis:`BAyRca_roundsAxis`,shareSeg:`BAyRca_shareSeg`,triggerWrap:`BAyRca_triggerWrap`,triggerMetric:`BAyRca_triggerMetric`,subscriptionMeta:`BAyRca_subscriptionMeta`,popDotSub:`BAyRca_popDotSub`,siteKindUnknown:`BAyRca_siteKindUnknown`,chartTooltip:`BAyRca_chartTooltip`,heroBudgetValue:`BAyRca_heroBudgetValue`,peakTagPrimary:`BAyRca_peakTagPrimary`,roundsBarColPeak:`BAyRca_roundsBarColPeak`,peakCount:`BAyRca_peakCount`};let E={"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`}},te={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 D(e){return e===``?e:te[e]??e}function ne(e){let t=E[D(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 L(e)}function oe(e,t){if(j===void 0)return;let n=N(e),r=I(n);if(t!==void 0){for(let e of j)if(e.origin!==void 0&&e.origin!==``&&(N(e.key)===n||I(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||I(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=[{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:`Standard / Flex`,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:`Standard / Flex`,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}}],ye={"deepseek-v4-flash":`flash`,"deepseek-v4-flash-vision-exp":`flash-vision-exp`,"deepseek-v4.1-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 I(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let be=(()=>{let e=new Map,t=(t,n)=>{let r=I(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of ve)t(e.key,e.key);for(let[e,n]of Object.entries(ye))t(e,n);for(let e of O)t(e.key,e.key);return e})();function L(e){let t=ye[e]??e;if(t===e){let t=I(e);if(t!==``){let e=be.get(t);if(e!==void 0)return e;let n=(A??[]).find(e=>I(e.key)===t);if(n!==void 0)return n.key}}return t}function R(e){let t=L(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=L(e),n=ve.find(e=>e.key===t),r=A?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=ve.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():Se(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=R(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function Se(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 Ce(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function z(e,t){let{promo:n}=e;if(n===void 0||!Ce(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 we(e=Date.now()){let t=[...ve.map(t=>z(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>I(e.key)));for(let e of ie??[]){let i=e.id.toLowerCase();if((()=>{let t=L(e.id);return ve.find(e=>e.key===t)})()!==void 0)continue;let a=I(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(A??[]).find(e=>I(e.key)===a),s;if(o!==void 0)s=Se(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=R(i);s=t===void 0?{key:L(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 Te(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function B(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 Ee(e,t,n=.5,r=Date.now()){let i=z(e,r),a=B(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:B(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function De(e){let t=ce();return t>0?e/t:e}function V(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 Oe(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 ke(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function H(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 Ae(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let U={top:18,right:40,bottom:26,left:46};function je(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function W(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function Me(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 G={key:`__total__`,name:`总计`,color:``};function Ne({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>V(n===`usd`?De(e):e,n),l=e=>i===`tokens`?W(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-U.left-U.right,a=220-U.top-U.bottom,o=e=>n===1?U.left+r/2:U.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=>U.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>U.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:G,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:T.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:ee,linePath:x}=d,S=a===null?void 0:e[a],C=Me(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:T.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:T.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-U.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:U.left,x2:680-U.right,y1:n,y2:n,className:T.chartGrid}),(0,o.jsx)(`text`,{x:U.left-8,y:n+3,textAnchor:`end`,className:T.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===``?T.chartBar:T.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:T.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:x,fill:`none`,className:T.chartLine}),ee.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-U.right+8,y:n+3,textAnchor:`start`,className:T.chartAxisLabel,children:W(e)},`calls-${t}`)}),C.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:T.chartAxisLabel,children:je(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:U.top,y2:U.top+m,className:T.chartCrosshair})]}),S!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:T.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(S.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:T.chartTooltipDate,children:S.date}),i!==`tokens`&&t.filter(e=>(S.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:T.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(S.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:T.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:T.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?W(S.tokens??0):c(S.cost)})]}),(0,o.jsxs)(`div`,{className:T.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:T.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:S.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:T.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartLegendLine}),`调用`]})]})]})}let K={top:14,right:42,bottom:22,left:46};function Pe(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 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?[]:Pe(e.byHour);if(t.length===0)return null;let n=t.length,r=680-K.left-K.right,i=180-K.top-K.bottom,a=e=>n===1?K.left+r/2:K.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=>K.top+i-e/o*i,l=e=>K.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:T.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)}):(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:T.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:T.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:T.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:T.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:T.modelCell,children:[(0,o.jsx)(`span`,{className:T.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:T.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:T.numCol,children:Fe(e.ttftAvg)}),(0,o.jsx)(`td`,{className:T.numCol,children:Fe(e.ttftP50)}),(0,o.jsx)(`td`,{className:T.numCol,children:Fe(e.ttftP90)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):(0,o.jsxs)(`span`,{children:[Fe(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):Ie(e.tpsAvg)}),(0,o.jsx)(`td`,{className:T.numCol,children:Fe(e.latencyAvg)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:T.na,children:`—`})})]},e.key))})]})}),s!==null&&(0,o.jsxs)(`div`,{className:T.chartWrap,"data-testid":`billing-perf-hour`,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:T.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:K.left,x2:680-K.right,y1:n,y2:n,className:T.chartGrid}),(0,o.jsx)(`text`,{x:K.left-8,y:n+3,textAnchor:`end`,className:T.chartAxisLabel,children:e.toFixed(0)})]},`ttft-${t}`)}),(0,o.jsx)(`path`,{d:s.ttftPath,fill:`none`,className:T.chartLine}),s.tpsPath!==``&&(0,o.jsx)(`path`,{d:s.tpsPath,fill:`none`,className:T.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:T.chartAxisLabel,children:q(t.key)},t.key)}),(0,o.jsxs)(`text`,{x:680-K.right+8,y:K.top+4,textAnchor:`start`,className:T.chartAxisLabel,children:[n(`perfTpsUnit`),` `,s.maxTps.toFixed(0)]})]}),(0,o.jsxs)(`div`,{className:T.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartLegendLine}),n(`perfTtft`),` (ms)`]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartLegendLine,style:{background:`var(--dsw-static-amber-500)`}}),n(`perfTps`),` (`,n(`perfTpsUnit`),`)`]})]})]})]})}let Re=`@kenz1117/dsh-ui-usage-billing`,ze=`kenz1117`;function Be({t:e,version:t}){return(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:T.plgHead,children:[(0,o.jsx)(`span`,{className:T.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:T.plgTitle,children:[(0,o.jsxs)(`div`,{className:T.plgNameRow,children:[(0,o.jsx)(`h3`,{className:T.plgName,children:Re}),(0,o.jsx)(`span`,{className:T.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:T.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:T.plgGrid,children:[(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:T.plgLink,href:`https://github.com/${ze}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,ze,`)`]})]}),(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:T.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:T.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:Re})]}),(0,o.jsxs)(`div`,{className:T.plgItem,children:[(0,o.jsx)(`span`,{className:T.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:T.plgVal,children:`MIT`})]})]})]})}function Ve(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 He(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let J={top:14,right:18,bottom:22,left:46},Ue=`var(--dsw-static-blue-500)`,We=`#14b8a6`,Y=`var(--dsw-static-amber-500)`;function Ge(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 Ke(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,{byDay:s,byModel:c,total:u}=t,d=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=Ve(n.getTime()),i=s[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[s,n]),f=(0,r.useMemo)(()=>{let e=0;return Object.entries(c).filter(([,e])=>e.calls>0).map(([t,n])=>{let r=n.input+n.output;e+=r;let i=n.cacheHit+n.cacheMiss;return{key:t,name: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}))},[c]),p=(0,r.useMemo)(()=>{let e=u.cacheHit??0,t=u.cacheMiss??0,n=u.input??0,r=u.output??0,i=u.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 d){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}},[u,d]),m=(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]),h=(0,r.useMemo)(()=>{let e=d.length;if(e===0)return null;let t=680-J.left-J.right,n=200-J.top-J.bottom,r=Math.max(...d.map(e=>e.miss+e.hit+e.output),1),i=e=>J.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?J.left+t/2:J.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l}},[d]);return(0,o.jsxs)(`div`,{className:T.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:T.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:T.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-token-export-csv`,onClick:()=>{let e=new Blob([Ge(d)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${Ve()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-token-export-json`,onClick:()=>{let e=new Blob([JSON.stringify({days:d,models:f,total:u},null,2)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${Ve()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},children:a(`exportJson`)})]}),(0,o.jsxs)(`div`,{className:T.kpiGrid,"data-testid":`billing-token-kpis`,children:[(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenCacheHitRate`)}),(0,o.jsxs)(`span`,{className:T.kpiValue,children:[p.cacheHitRate.toFixed(1),`%`]}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[H(p.hit),` / `,H(p.hit+p.miss),(u.cacheWrite??0)>0?` · ${a(`tokenCacheWrite`)} ${H(u.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenReasoningShare`)}),(0,o.jsxs)(`span`,{className:T.kpiValue,children:[p.reasoningPct.toFixed(1),`%`]}),(0,o.jsx)(`span`,{className:T.kpiDetail,children:H(p.reasoning)})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenIo`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:p.io.toFixed(2)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[H(p.input),` / `,H(p.output)]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:a(`tokenPeak`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:p.peak===void 0?`—`:He(p.peak.miss+p.peak.hit+p.peak.output)}),(0,o.jsx)(`span`,{className:T.kpiDetail,children:p.peak?.date??`—`})]})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:a(`tokenDaily`)}),(0,o.jsx)(`span`,{className:T.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.rangeButton,n===e&&T.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]}),h===null?(0,o.jsx)(`div`,{className:T.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:T.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:T.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),children:[[0,.5,1].map(e=>{let t=h.max*e,n=h.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:J.left,x2:680-J.right,y1:n,y2:n,className:T.chartGrid}),(0,o.jsx)(`text`,{x:J.left-8,y:n+3,textAnchor:`end`,className:T.chartAxisLabel,children:He(t)})]},e)}),d.map((e,t)=>{let n=h.inner(t)-h.barW/2,r=h.y(0),i=h.y(e.miss),a=h.y(e.miss+e.hit),s=h.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:h.barW,height:r-i,fill:Ue}),(0,o.jsx)(`rect`,{x:n,y:a,width:h.barW,height:i-a,fill:We}),(0,o.jsx)(`rect`,{x:n,y:s,width:h.barW,height:a-s,fill:Y})]},e.date)}),h.indices.map(e=>{let t=d[e];return t===void 0?null:(0,o.jsx)(`text`,{x:h.inner(e),y:194,textAnchor:`middle`,className:T.chartAxisLabel,children:t.date.slice(5)},t.date)})]}),(0,o.jsxs)(`div`,{className:T.chartLegend,children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:Ue}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:We}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.chartTooltipSwatch,style:{background:Y}}),a(`tokenOutput`)]})]})]})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:a(`tokenByModel`)})}),f.length===0?(0,o.jsx)(`div`,{className:T.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:T.tableScroll,children:(0,o.jsxs)(`table`,{className:T.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:T.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:f.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:T.numCol,children:H(e.input)}),(0,o.jsx)(`td`,{className:T.numCol,children:H(e.output)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.reasoning>0?H(e.reasoning):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsxs)(`td`,{className:T.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:T.numCol,children:H(e.total)}),(0,o.jsx)(`td`,{className:T.numCol,children:(0,o.jsxs)(`span`,{className:T.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:T.tokenModelBar,children:(0,o.jsxs)(`span`,{className:T.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:T.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:T.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),m.totalCalls>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:T.tableScroll,children:(0,o.jsxs)(`table`,{className:T.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:T.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:T.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...m.top,...m.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelName,children:e})}),(0,o.jsx)(`td`,{className:T.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:T.numCol,children:[(t/m.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]})]})}function qe(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function Je(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 Ye(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 Xe({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:T.roundsEmpty,children:[i(`model`),` —`]});let u=e=>V(n===`usd`?De(e):e,n);return(0,o.jsxs)(`div`,{className:T.rounds,children:[(0,o.jsx)(`div`,{className:T.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(T.roundsBarCol,r?T.roundsBarColPeak:T.roundsBarColOff),children:[(0,o.jsx)(`span`,{className:T.roundsBarLabel,style:{bottom:`${n}%`},children:u(e.cost)}),(0,o.jsx)(`div`,{className:T.roundsBarWrap,children:(0,o.jsx)(`div`,{className:t?T.roundsBarFlagged:T.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${i(`model`)} ${e.model} · ${u(e.cost)} · ${Je(e.startedAt)}${e.endedAt===void 0?``:` → ${qe(e.endedAt)} (${Ye(e.endedAt-e.startedAt)})`}`,children:t&&(0,o.jsx)(`span`,{className:T.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,o.jsxs)(`div`,{className:T.roundsAxis,children:[(0,o.jsxs)(`span`,{children:[i(`costAbbr`),` `,u(c)]}),(0,o.jsxs)(`span`,{children:[a.length,` 轮`]})]})]})}let Ze=[`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)`],Qe=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function $e(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}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=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:$e(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:$e(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=$e(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 tt(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=$e(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=$e(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 nt({days:e,currency:t,now:n,t:i,range:a=`month`}){let[s,c]=(0,r.useState)(null),l=e=>V(t===`usd`?De(e):e,t),u=(0,r.useMemo)(()=>et(e,n??new Date),[e,n]);if(a===`year`){let t=tt(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:Qe[n-1]??``}),a=n)}),(0,o.jsxs)(`div`,{className:T.heatmapYear,"data-testid":`heatmap-year`,children:[(0,o.jsxs)(`div`,{className:T.heatmapYearBody,children:[(0,o.jsx)(`div`,{className:T.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,o.jsx)(`span`,{className:T.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,o.jsxs)(`div`,{className:T.heatmapYearScroll,children:[(0,o.jsx)(`div`,{className:T.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:r.map(e=>(0,o.jsx)(`span`,{className:T.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,o.jsx)(`div`,{className:T.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:T.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,style:{background:Ze[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`},e.date))})]})]}),(0,o.jsxs)(`div`,{className:T.heatmapFooter,children:[(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:T.heatmapLegend,children:Ze.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapMore`)})]})]})}return(0,o.jsxs)(`div`,{className:T.heatmap,children:[(0,o.jsx)(`div`,{className:T.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,o.jsx)(`div`,{className:T.heatmapCellEmpty,children:e.dayNum},e.date):(0,o.jsx)(`button`,{type:`button`,className:T.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,style:{background:Ze[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:T.heatmapFooter,children:[(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:T.heatmapLegend,children:Ze.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:T.heatmapLegendText,children:i(`heatmapMore`)}),s!==null&&(0,o.jsxs)(`span`,{className:T.heatmapHover,"data-testid":`heatmap-hover`,children:[s.date,` · `,l(s.value)]})]})]})}let rt={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function X(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function Z(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function it(e,t){let n=t?.window??rt.window,r=t?.threshold??rt.threshold,i=t?.reasonFactor??rt.reasonFactor,a=t?.reasonHitDropPp??rt.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=Z(t),p=X(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=X(c),r=X(l),s=X(u);n!==null&&n>0&&e>n*i&&m.push(`output-growth`),r!==null&&r>0&&d>r*i&&m.push(`context-bloat`),s!==null&&f!==null&&f<s-a&&m.push(`cache-hit-drop`),o.push({sessionId:t.sessionId,turn:t.turn,cost:t.cost,reasons:m})}for(s.push(t.cost),c.push(e),l.push(d),f!==null&&u.push(f);s.length>n;)s.shift();for(;c.length>n;)c.shift();for(;l.length>n;)l.shift();for(;u.length>n;)u.shift()}return o}function at(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function ot(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function st(e){return e.toFixed(2)}function ct(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,st(n.cost)].join(`,`)})].join(`
3
+ `)}function lt(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[at(ot(n)),r,t.calls,st(t.cost)].join(`,`)})].join(`
4
+ `)}function ut(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function dt(e){return[`session_id,title,project,calls,cost_cny,last_active`,...e.map(e=>[at(ot(e.id)),at(ot(e.title??``)),at(ot(ut(e.cwd))),e.calls,st(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``].join(`,`))].join(`
5
+ `)}function ft(e,t,n){let r=[...n].sort(),i=r[0],a=r.at(-1);return`${e}${i!==void 0&&a!==void 0?`-${i}_${a}`:``}.${t}`}function pt(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(r),0)}let mt=`usageBilling`,ht={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,原 1.5 / 4.5 / 0.05);V4 Pro 的请求同期起路由至 V4.1 Flash 并按 Flash 单价计费(V4.1 Pro 上线前)。峰谷分时自 2026-08-23(周日)00:00:工作日高峰 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:`免费`,official:`官方`,thirdParty:`三方`,officialCost:`官方费用`,thirdPartyCost:`三方费用`,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:`调用`},gt={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×; was 1.5 / 4.5 / 0.05); 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`,official:`Official`,thirdParty:`Third-party`,officialCost:`Official cost`,thirdPartyCost:`Third-party cost`,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`},_t={"智谱 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 vt(e,t){return t===`en`?_t[e]??e:e}let yt={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 bt(e){return yt[e]}let xt=`dsh-billing-peak-alert-v1`,St={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function Ct(){try{let e=localStorage.getItem(xt);if(e===null)return{...St};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:St.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))):St.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...St}}}function wt(e){try{localStorage.setItem(xt,JSON.stringify(e))}catch{}}function Tt(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 Et({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(T.peakCard,p?T.peakCardPeak:T.peakCardOff,t.position===`center`?T.peakCardCenter:T.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:T.peakHead,children:[(0,o.jsxs)(`span`,{className:l(T.peakTag,p?T.peakTagPrimary:T.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:l(T.peakDot,p?T.peakDotPrimary:T.peakDotSuccess),"aria-hidden":`true`}),d]}),(0,o.jsx)(`button`,{type:`button`,className:T.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:l(T.peakCount,p?T.peakCountPrimary:T.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:T.peakDesc,children:f})]})}let Dt=[{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 Ot(e){if(e!==void 0)return e.split(/[\\/]/).filter(Boolean).pop()??e}let kt=[50,80,100],At={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},jt={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 Mt(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 Nt(e,t){let n=Q(e),r=Q(t);if(Mt(n,r))return!0;let i=jt[e];return i!==void 0&&i.some(e=>Mt(Q(e),r))}function Pt(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(jt))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(jt))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let Ft={"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 It(e){let t=Ft[e];return t===void 0?Pt(e)??e:t}function Lt(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 Rt(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:Lt(e,n);return s<=0?0:s*o}function zt(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||I(t.key)===I(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 Bt(){return typeof Notification<`u`&&Notification.permission===`granted`}let Vt=new Set;function Ht(e,t){Vt.has(e)||(Vt.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 Ut(e){return Object.keys(e).length}function Wt(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 Gt(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 Kt(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=>Nt(t,e))?T.healthOk:e.badProviders.some(e=>Nt(t,e))?T.healthBad:T.healthIdle:T.healthIdle}function Jt(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 Yt(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 Xt(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 Zt(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 Qt(e,t){switch(e){case`site`:return t(`relaySite`);case`direct`:return t(`relayDirect`);default:return t(`relayUnknown`)}}function $t(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let en={site:T.siteKindSite,direct:T.siteKindDirect,unknown:T.siteKindUnknown},tn={"new-api":T.siteKindSite,sub2api:T.siteKindDirect,unknown:T.siteKindUnknown},nn=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 rn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let an=[`#3b82f6`,`#06b6d4`,`#8b5cf6`,`#f59e0b`,`#10b981`,`#ef4444`,`#ec4899`,`#6366f1`,`#f97316`,`#14b8a6`],on={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function sn(){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??on.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 cn=!1;async function ln(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){cn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){cn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(cn)return;cn=!0}setTimeout(()=>{ln(e+1)},2e3);return}cn=!1,P(i)}catch{cn=!1}}async function un(){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 dn(){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 fn(){let e=await fetch(`/api/billing/relay-quotas`);if(!e.ok)throw Error(`relay-quotas HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`relay-quotas: invalid response`)}async function pn(){try{let e=await fetch(`/api/billing/usage-tool`);if(!e.ok)return;let t=JSON.parse(await e.text());return typeof t.enabled==`boolean`?t.enabled:void 0}catch{return}}async function mn(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 hn(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]),[ee,x]=(0,r.useState)(0),S=b.length===0?0:Math.min(ee,b.length-1),C=b[S];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||b.length<2)return;let e=setInterval(()=>x(e=>(e+1)%b.length),1500);return()=>clearInterval(e)},[m.mode,b.length]);let w=(0,r.useRef)(null),[E,te]=(0,r.useState)(!1),[D,ne]=(0,r.useState)({left:0,top:0,width:0}),O=(0,r.useRef)(void 0),k=(0,r.useCallback)(()=>{window.clearTimeout(O.current),te(!0)},[]),re=(0,r.useCallback)(()=>{window.clearTimeout(O.current),O.current=window.setTimeout(()=>te(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(O.current),[]);let A=(0,r.useCallback)(()=>{let e=w.current?.getBoundingClientRect();e!==void 0&&ne({left:e.left,top:e.top-8,width:e.width})},[]);(0,r.useEffect)(()=>{if(!E)return;let e=()=>A();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[E,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:T.railButton,"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${V(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:w,className:T.triggerWrap,onMouseEnter:()=>{A(),k()},onMouseLeave:re,onFocusCapture:()=>{A(),k()},onBlurCapture:()=>te(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:T.trigger,"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${V(s)}`,children:[(0,o.jsx)(`span`,{className:T.triggerIcon,"data-testid":`billing-trigger-icon`,children:ie}),(0,o.jsxs)(`span`,{className:T.triggerMain,children:[(0,o.jsxs)(`span`,{className:T.triggerPrimary,children:[(0,o.jsx)(`span`,{className:T.triggerLabel,children:n(j?`triggerMonthTokens`:`triggerMonth`)}),j?(0,o.jsx)(`span`,{className:T.triggerMetric,"data-testid":`billing-trigger-month-tokens`,children:H(_)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:T.triggerYen,"aria-hidden":`true`,children:V(s).charAt(0)}),(0,o.jsx)(`span`,{className:T.triggerMetric,children:V(s).slice(1)})]})]}),(0,o.jsx)(`span`,{className:T.triggerSub,"data-testid":`billing-trigger-today`,children:j?`${n(`triggerToday`)} ${H(v)} · ${n(`weekCost`)} ${H(y)}`:`${n(`triggerToday`)} ${V(c)} · ${n(`weekCost`)} ${V(u)}`})]}),(0,o.jsx)(`span`,{className:T.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:N.map((e,t)=>(0,o.jsx)(`span`,{className:t===N.length-1?T.triggerSparkHot:T.triggerSparkBar,style:{height:`${e}px`}},d[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:l(T.triggerPop,E&&T.triggerPopShown,m.mode===`subscription`&&T.triggerPopSubscription),style:{left:`${D.left}px`,top:`${D.top}px`,width:`${D.width}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!E,onMouseEnter:k,onMouseLeave:re,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:b.length===0?(0,o.jsx)(`span`,{className:T.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[C!==void 0&&(0,o.jsxs)(`div`,{className:T.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:T.floatSubHead,children:[(0,o.jsx)(`span`,{className:T.floatSubName,children:C.displayName}),C.plan!==void 0&&(0,o.jsx)(`span`,{className:T.floatSubPlan,children:C.plan})]}),C.windows.map(e=>(()=>{let t=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:T.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:T.subscriptionWindowLabel,children:Xt(e.kind,n)}),(0,o.jsx)(`span`,{className:T.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(T.subscriptionFill,t>=100&&T.subscriptionFillOver,t>=80&&t<100&&T.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:T.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(T.subscriptionPct,r&&T.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${rn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),b.length>1&&(0,o.jsx)(`span`,{className:T.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:T.triggerPopSwitchCount,children:[S+1,`/`,b.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:T.popHead,children:(0,o.jsx)(`span`,{className:T.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:T.metricGrid,children:[(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`monthCost`)}),(0,o.jsx)(`span`,{className:l(T.metricValue,T.metricValuePrimary),children:V(s)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`tokenTotal`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:H(p.totalToken)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:H(p.input)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:H(p.output)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:l(T.metricValue,T.metricValueSuccess),children:H(p.cacheRead)})]}),(0,o.jsxs)(`span`,{className:T.metricCell,children:[(0,o.jsx)(`span`,{className:T.metricLabel,children:n(`calls`)}),(0,o.jsx)(`span`,{className:T.metricValue,children:p.calls.toLocaleString()})]})]}),(0,o.jsxs)(`span`,{className:T.popModel,children:[(0,o.jsx)(`span`,{className:T.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:T.popModelRow,children:[(0,o.jsx)(`span`,{className:l(T.popDot,T.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:T.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:l(T.popModelStatus,f.direct.low&&T.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:T.popModelRow,children:[(0,o.jsx)(`span`,{className:l(T.popDot,T.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:T.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:l(T.popModelStatus,f.sub.low&&T.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:T.popModelRow,children:[(0,o.jsx)(`span`,{className:l(T.popDot,T.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function gn({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:T.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:T.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:T.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:T.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:T.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(_n,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(_n,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(_n,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(_n,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(_n,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function _n({label:e,value:t}){return(0,o.jsxs)(`span`,{className:T.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:T.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:T.balanceDetailValue,children:t})]})}function vn({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:T.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:T.setCardHead,children:(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:T.ctlCol,children:[i.map((e,t)=>(0,o.jsxs)(`div`,{className:T.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsxs)(`div`,{className:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:T.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:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:T.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:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}),(0,o.jsx)(`input`,{className:T.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:T.userPriceField,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:T.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,e.currency!==`USD`&&T.floatModeBtnOn),onClick:()=>f(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,e.currency===`USD`&&T.floatModeBtnOn),onClick:()=>f(t,`USD`),children:`USD`})]})]}),(0,o.jsx)(`button`,{type:`button`,className:T.userPriceRemove,"aria-label":n(`userPriceRemove`),onClick:()=>c(t),children:n(`userPriceRemove`)})]},t)),(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-user-price-add`,onClick:u,children:n(`userPriceAdd`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-user-price-save`,onClick:d,children:n(`userPriceSave`)})]})]})]})}function yn({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:ee,peakConfig:x,onPeakConfig:S,onPreviewPeak:C,floatPrefs:w,onFloatPrefs:E,cardPrefs:te,onCardPrefs:D,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),be=(0,r.useCallback)(e=>{I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[L,R]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return pn().then(t=>{e&&t!==void 0&&R(t)}),()=>{e=!1}},[]);let Se=(0,r.useCallback)(()=>{let e=!L;R(e),mn(e).then(t=>{t||R(!e)})},[L]),z=le(),B=e=>V(m===`usd`?De(e):e,m),U=m===`usd`?`en`:`zh`,je=e=>vt(e,U),W=(e,n)=>e===0?t(`free`):Oe(ke(e,n,m,z.rate),m===`usd`?`USD`:`CNY`),Me=(0,r.useMemo)(()=>it([...g].reverse()),[g]),G={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},K=G.peak/2,Pe=(0,r.useMemo)(()=>{let n=e.byRole;if(n===void 0)return[];let r=n.user+n.assistant+n.tool;return r<=0?[]:[{label:t(`roleUser`),value:n.user,seg:T.shareSegUser},{label:t(`roleAssistant`),value:n.assistant,seg:T.shareSegAssistant},{label:t(`roleTool`),value:n.tool,seg:T.shareSegTool}].map(e=>({...e,pct:e.value/r*100}))},[e.byRole,t]),q=Lt(M,$()),Fe=e=>u.find(t=>Q(t.provider)===Q(e)),Ie=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:T.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:T.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:B(e.totalBalance),r=e.currency===`USD`?e.totalBalance*z.rate:e.totalBalance,i=q>0?Math.floor(r/q):void 0;return(0,o.jsxs)(`span`,{className:T.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:l(T.balanceDaysBadge,i<=3&&T.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)(gn,{balance:e,days:i??0,dailyBurn:q,money:B,t,onClose:()=>{F(void 0)}})]})},ze=j.cacheHit+j.cacheMiss>0?j.cacheHit/(j.cacheHit+j.cacheMiss)*100:0,Ve=Object.keys(M).sort(),He=$(),J=M[He]?.cost??0,Ue=He.slice(0,7),We=He.slice(0,4),Y=Ve.reduce((e,t)=>e+(t.startsWith(Ue)?M[t]?.cost??0:0),0),Ge=Ve.reduce((e,t)=>e+(t.startsWith(We)?M[t]?.cost??0:0),0),qe=(0,r.useMemo)(()=>Rt(M,Ue,He)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[M,Ue,He,f]),Je=(0,r.useMemo)(()=>{let e=v&&y>0?Y/y*100:NaN;return{pct:Number.isFinite(e)?Math.max(0,Math.min(100,e)):Ge>0?Math.max(0,Math.min(100,Y/Ge*100)):0,over:Number.isFinite(e)&&e>=100,label:t(Number.isFinite(e)?`budget`:`monthCost`)}},[v,y,Y,Ge,t]),Ye=v&&y>0?Y/y*100:0,Ze=(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]),Qe=Ze.at(-1)??He,$e=(0,r.useMemo)(()=>Object.entries(M).map(([e,t])=>({date:e,value:t.cost})),[M]),et=Ut(M),tt=Wt(M),rt=(0,r.useMemo)(()=>Ze.map(t=>{let n={},r=e.byDayModels?.[t];if(r!==void 0)for(let[e,t]of Object.entries(r))t.cost>0&&(n[e]=t.cost);let i=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}}),[Ze,M,e.byDayModels]),X=(0,r.useMemo)(()=>Object.entries(ae).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=xe(e),r=n.key===`other`,i=r?Pt(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:Ee(n,a),plan:t.plan===!0,...t.cost>0?{actual:t.cost}:{},uncatalogued:r,estimatedPricing:n.estimated===!0,officialCalls:t.officialCalls??0,officialCost:t.officialCost??0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)).map((e,t)=>({...e,color:an[t%an.length]??`#8b95a3`})),[ae]),Z=(0,r.useMemo)(()=>{let e=0,t=0,n=0;for(let r of X){let i=r.officialCost;i>0&&(e+=i),t+=r.officialCalls,n+=Math.max(0,r.calls-r.officialCalls)}let r=Math.max(0,X.reduce((e,t)=>e+(t.actual??0),0)-e);if(!(e<=0&&r<=0&&t<=0&&n<=0))return{officialCost:e,officialCalls:t,thirdCost:r,thirdCalls:n}},[X]),at=(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]),ot=(0,r.useMemo)(()=>O.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,O.hideUnidentified]),st=(0,r.useMemo)(()=>{let e=new Map;for(let t of f){if(t.status===`not-configured`)continue;let n=It(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 X){let r=e.provider;if(e.plan===!0){let t=Pt(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:Fe(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})},[X,f,u,c]),ut=X.reduce((e,t)=>e+t.estimated,0),mt=j.cost>0?j.cost:ut,ht=j.calls>0?mt/j.calls:0,gt=(0,r.useMemo)(()=>X.map(e=>({key:e.key,name:e.name,color:e.color})),[X]),_t=rt.length>=2?rt.at(-2)?.cost??0:0,yt=_t>0?(J-_t)/_t*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:l(T.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:T.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:T.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:T.headTitleRow,children:[(0,o.jsx)(`h2`,{className:T.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:T.dashboardSubtitle,children:[t(`lastUpdated`),` `,Qe,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:T.dashboardRight,children:[(0,o.jsx)(`span`,{className:T.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.currencyButton,m===e&&T.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(T.healthBadge,c.available?T.healthBadgeOk:T.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:l(T.healthDot,c.available?T.healthOk:T.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:T.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:T.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:Dt.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":N===e.id,className:l(T.tabButton,N===e.id&&T.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{oe(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:T.dashboardBody,children:[N===`overview`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[d?.kind===`drift`&&d.spent!==void 0&&ce!==de()&&(0,o.jsxs)(`div`,{className:T.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:T.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:T.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,d.provider??``).replace(`{spent}`,B(d.spent)).replace(`{today}`,B(d.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:T.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:fe,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:T.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:T.heroTop,children:[(0,o.jsxs)(`div`,{className:T.heroMain,children:[(0,o.jsx)(`span`,{className:T.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:T.heroReadout,children:[(0,o.jsx)(`span`,{className:T.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:T.heroValue,children:B(Y).slice(1)})]}),(0,o.jsxs)(`span`,{className:T.heroMeta,children:[j.calls.toLocaleString(),` `,t(`calls`)]})]}),(0,o.jsxs)(`div`,{className:T.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`svg`,{className:T.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:T.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:l(T.heroGaugeArc,Je.over&&T.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${Je.pct/100*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:T.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:l(T.heroGaugePct,Je.over&&T.heroGaugePctOver),children:[Je.pct.toFixed(0),`%`]}),(0,o.jsx)(`span`,{className:T.heroGaugeLabel,children:Je.label})]})]})]}),v&&y>0&&(0,o.jsxs)(`div`,{className:T.heroBudget,"data-testid":`billing-hero-budget`,children:[(0,o.jsx)(`span`,{className:T.heroBudgetLabel,children:t(`budget`)}),(0,o.jsx)(`div`,{className:T.heroBudgetTrack,role:`progressbar`,"aria-valuenow":Math.min(Ye,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),children:(0,o.jsx)(`div`,{className:l(T.heroBudgetFill,Ye>=100&&T.heroBudgetFillOver),style:{width:`${Math.min(Ye,100)}%`}})}),(0,o.jsxs)(`span`,{className:T.heroBudgetValue,children:[B(Y),` / `,B(y),` · `,Ye.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:T.heroSide,children:[(0,o.jsxs)(`div`,{className:T.heroSideItem,children:[(0,o.jsx)(`span`,{className:T.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:T.heroSideValue,children:B(Ge)})]}),(0,o.jsxs)(`div`,{className:T.heroSideItem,children:[(0,o.jsx)(`span`,{className:T.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:T.heroSideValue,children:[B(J),(0,o.jsxs)(`span`,{className:l(T.delta,yt>=0?T.deltaUp:T.deltaDown),children:[yt>=0?`▲`:`▼`,` `,Math.abs(yt).toFixed(1),`%`]})]})]}),qe>0&&(0,o.jsxs)(`div`,{className:T.heroSideItem,children:[(0,o.jsx)(`span`,{className:T.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:T.heroSideValue,children:B(qe)})]}),qe<=0&&(0,o.jsx)(`span`,{className:T.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:T.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:T.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,B(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`section`,{className:T.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:T.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:l(T.kpiValue,T.kpiGreen),children:Ae(ze)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[H(j.cacheHit),` / `,H(j.cacheHit+j.cacheMiss)]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:H(j.input+j.output)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[t(`inputTokens`),` `,H(j.input),` · `,t(`outputTokens`),` `,H(j.output)]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:B(ht)}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[t(`calls`),` `,j.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:T.kpiTile,children:[(0,o.jsx)(`span`,{className:T.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:T.kpiValue,children:j.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:T.kpiDetail,children:[X.length,` `,t(`models`)]})]})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:T.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(T.heatmapRangeButton,pe===e&&T.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:T.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,et,` · `,t(`streakDays`),` `,tt]})]}),(0,o.jsx)(nt,{days:$e,currency:m,t,range:pe})]})]}),N===`settings`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:T.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(T.switch,v&&T.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:T.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:T.ctlCol,children:[(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:T.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:T.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:T.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:y===0?``:y,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,title:`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,onChange:e=>{ee(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=Y/y*100;return(0,o.jsx)(`div`,{className:T.ctlRowStretch,children:(0,o.jsx)(`div`,{className:T.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(T.progFill,e>=100&&T.budgetFillOver,e>=80&&e<100&&T.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:T.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,B(Y)).replace(`{total}`,B(y))})]})]}),(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":x.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:l(T.switch,x.enabled&&T.switchOn),onClick:()=>{S({...x,enabled:!x.enabled})},children:(0,o.jsx)(`span`,{className:T.switchKnob})})]}),x.enabled&&(0,o.jsxs)(`div`,{className:T.ctlCol,children:[(0,o.jsxs)(`label`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:T.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:x.leadMin,className:T.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);S({...x,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):x.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:T.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:T.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:x.position===e,onChange:()=>S({...x,position:e})}),(0,o.jsx)(`span`,{className:T.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:T.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:T.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:x.mode===e,onChange:()=>S({...x,mode:e})}),(0,o.jsx)(`span`,{className:T.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:x.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{S({...x,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:T.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:T.btn,onClick:C,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:T.setCard,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":L,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:l(T.switch,L&&T.switchOn),onClick:Se,children:(0,o.jsx)(`span`,{className:T.switchKnob})})]})}),(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:T.setCardHead,children:(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:T.ctlCol,children:[(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:T.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,w.mode===`combined`&&T.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>E({mode:`combined`,targets:w.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,w.mode===`subscription`&&T.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>E({mode:`subscription`,targets:w.targets}),children:t(`floatModeSubscription`)})]})]}),w.mode===`subscription`&&(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:T.ctlGroup,"data-testid":`billing-float-targets`,children:[he.map(e=>{let t=w.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:T.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>E({mode:`subscription`,targets:t?w.targets.filter(t=>t!==e.id):[...w.targets,e.id]})}),(0,o.jsx)(`span`,{className:T.floatTargetLabel,children:e.label})]},e.id)}),he.length===0&&(0,o.jsx)(`span`,{className:T.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`section`,{className:T.setCard,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:T.setCardHead,children:(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:T.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsx)(`div`,{className:T.ctlCol,children:(0,o.jsxs)(`div`,{className:T.ctlRow,children:[(0,o.jsx)(`span`,{className:T.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:T.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,te.metric===`money`&&T.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>D({metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:l(T.floatModeBtn,te.metric===`tokens`&&T.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>D({metric:`tokens`}),children:t(`cardMetricTokens`)})]})]})})]}),(0,o.jsx)(`section`,{className:T.setCard,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:T.setCardHead,children:[(0,o.jsxs)(`div`,{className:T.setCardMeta,children:[(0,o.jsx)(`h3`,{className:T.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:T.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(T.switch,O.hideUnidentified&&T.switchOn),onClick:()=>k({hideUnidentified:!O.hideUnidentified}),children:(0,o.jsx)(`span`,{className:T.switchKnob})})]})}),(0,o.jsx)(vn,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(Be,{t,version:e.pluginVersion})]}),N===`trends`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:l(T.ubCard,T.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:T.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:T.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.rangeButton,P===e&&T.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:T.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:l(T.rangeButton,A===e&&T.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:T.ubCardSub,children:Qe})]}),(0,o.jsx)(Ne,{data:rt,models:gt,currency:m,metric:A})]}),g.length>0&&(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`rounds`)}),Me.length>0&&(0,o.jsxs)(`span`,{className:T.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[Me.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:T.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(Xe,{rounds:g,flags:Me,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=G.peak+G.offPeak;if(e<=0)return null;let n=G.peak/e*100;return(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:T.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:l(T.shareSeg,T.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:l(T.shareSeg,T.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:T.shareLegend,children:[(0,o.jsxs)(`span`,{className:T.shareItem,children:[(0,o.jsx)(`span`,{className:T.shareDot,style:{background:`var(--dsw-static-blue-500)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:T.shareValue,"data-testid":`billing-share-peak`,children:[B(G.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:T.shareItem,children:[(0,o.jsx)(`span`,{className:T.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:T.shareValue,"data-testid":`billing-share-offpeak`,children:[B(G.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),K>0&&(0,o.jsx)(`div`,{className:T.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,B(K))})]})})()]}),N===`providers`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[at.length>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-relay-sites`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`panelRelay`)})}),(0,o.jsx)(`div`,{className:T.providerGroupList,"data-testid":`billing-relay-sites`,children:at.map(([e,n])=>{let r=Zt(e,t);return(0,o.jsxs)(`div`,{className:T.siteRow,"data-testid":`billing-relay-site`,children:[(0,o.jsxs)(`span`,{className:T.siteRowName,children:[(0,o.jsx)(`span`,{className:l(T.siteKindTag,en[r.kind]),children:Qt(r.kind,t)}),(0,o.jsx)(`span`,{className:T.siteRowTitle,children:r.name})]}),(0,o.jsxs)(`span`,{className:T.siteRowMeta,children:[(0,o.jsx)(`span`,{className:T.siteRowCost,children:B(n.cost)}),(0,o.jsxs)(`span`,{className:T.siteRowCalls,children:[n.calls,` `,t(`relayCalls`)]})]})]},e)})})]}),ot.length>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:T.panelHead,children:(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:T.providerGroupList,"data-testid":`billing-relay-quotas`,children:ot.map(e=>(0,o.jsxs)(`div`,{className:T.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:T.siteRowName,children:[(0,o.jsx)(`span`,{className:l(T.siteKindTag,tn[e.kind]),children:$t(e.kind,t)}),(0,o.jsx)(`span`,{className:T.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:T.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:T.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(T.siteRowCalls,n&&T.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:T.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:T.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${rn(e.updatedAt)}`})]}),re&&(0,o.jsx)(`div`,{className:T.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),st.length===0?(0,o.jsx)(`div`,{className:T.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:T.providerGroupList,"data-testid":`billing-provider-groups`,children:st.map(e=>(0,o.jsxs)(`div`,{className:T.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:T.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:T.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:l(T.healthDot,e.dot),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:T.providerGroupName,children:je(e.name)})]}),(0,o.jsxs)(`span`,{className:T.providerGroupMeta,children:[e.subscriptions.length>0&&(0,o.jsxs)(`span`,{className:T.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` 套餐`]}),!Ie(e)&&e.balance!==void 0&&(0,o.jsxs)(`span`,{className:T.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:T.providerGroupBalanceLabel,children:t(`balance`)}),Re(e.balance)]})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:l(T.tableScroll,T.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:T.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:T.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:T.modelCell,children:[(0,o.jsx)(bn,{provider:e.provider,colorVar:e.color}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:T.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:T.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:T.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:T.modelProvider,children:je(e.provider)})]})]})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:T.numCol,children:H(e.input)}),(0,o.jsx)(`td`,{className:T.numCol,children:H(e.output)}),(0,o.jsx)(`td`,{className:T.numCol,children:Ae(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.plan?(0,o.jsx)(`span`,{className:T.planTag,children:t(`subscriptionIncluded`)}):e.actual===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:T.bucketCost,children:[(0,o.jsx)(`span`,{className:T.bucketOfficial,children:B(t)}),(0,o.jsx)(`span`,{className:T.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:T.bucketThird,children:B(n)})]}):B(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:T.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=Yt(e.status,t);return(0,o.jsxs)(`div`,{className:T.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:T.subscriptionHead,children:[(0,o.jsx)(`span`,{className:T.subscriptionName,children:je(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:T.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,B(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:T.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:T.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:T.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:T.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:T.subscriptionWindowLabel,children:Xt(e.kind,t)}),(0,o.jsx)(`span`,{className:T.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:l(T.subscriptionFill,n>=100&&T.subscriptionFillOver,n>=80&&n<100&&T.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:T.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:l(T.subscriptionPct,r&&T.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:T.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${rn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:T.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:T.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-day`,onClick:()=>{pt(ft(`usage-daily`,`csv`,Object.keys(M)),ct(M),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{pt(ft(`usage-sessions`,`csv`,Object.keys(M)),dt(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{pt(ft(`usage-sites`,`csv`,Object.keys(M)),lt(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:T.exportButton,"data-testid":`billing-export-json`,onClick:()=>{pt(ft(`usage-stats`,`json`,Object.keys(M)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),Pe.length>0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`roleCost`)}),(0,o.jsx)(`span`,{className:T.panelHint,children:t(`roleHint`)})]}),(0,o.jsx)(`div`,{className:T.shareTrack,"data-testid":`billing-role-track`,children:Pe.map(e=>(0,o.jsx)(`div`,{className:l(T.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:T.shareLegend,children:Pe.map(e=>(0,o.jsxs)(`span`,{className:T.shareItem,children:[(0,o.jsx)(`span`,{className:l(T.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:T.shareValue,children:[B(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]}),Z!==void 0&&(()=>{let e=Z.officialCost+Z.thirdCost,n=e>0?Z.officialCost/e*100:0;return(0,o.jsxs)(`div`,{className:T.ubStatGrid,"data-testid":`billing-panel-buckets`,children:[(0,o.jsxs)(`div`,{className:T.ubStatCard,children:[(0,o.jsxs)(`span`,{className:T.ubStatLabel,children:[t(`official`),`(=DeepSeek 直连)`]}),(0,o.jsx)(`span`,{className:T.ubStatValue,children:B(Z.officialCost)}),(0,o.jsxs)(`span`,{className:T.ubStatDetail,children:[Z.officialCalls,` `,t(`calls`),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`div`,{className:T.ubStatCard,children:[(0,o.jsxs)(`span`,{className:T.ubStatLabel,children:[t(`thirdParty`),`(中转)`]}),(0,o.jsx)(`span`,{className:T.ubStatValue,children:B(Z.thirdCost)}),(0,o.jsxs)(`span`,{className:T.ubStatDetail,children:[Z.thirdCalls,` `,t(`calls`),` · `,(100-n).toFixed(1),`%`]})]})]})})(),e.byWorkspace!==void 0&&e.byWorkspace.length>0&&(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-workspaces`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`workspaces`)}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:t(`workspacesHint`)})]}),(0,o.jsx)(`ul`,{className:T.rowlist,children:e.byWorkspace.map(n=>(0,o.jsxs)(r.Fragment,{children:[(0,o.jsx)(`li`,{children:(0,o.jsxs)(`button`,{type:`button`,className:T.rowline,"data-testid":`billing-workspace-${n.name}`,onClick:()=>{ve(_e===n.name?void 0:n.name)},children:[(0,o.jsx)(`span`,{className:T.rowlineName,children:n.name}),(0,o.jsxs)(`span`,{className:T.rowlineRight,children:[(0,o.jsx)(`span`,{className:T.num,children:B(n.cost)}),(0,o.jsxs)(`span`,{className:T.rowlineMuted,children:[n.calls,` `,t(`calls`)]}),(0,o.jsx)(`span`,{className:T.rowlineChev,"aria-hidden":`true`,children:`›`})]})]})}),_e===n.name&&(0,o.jsx)(`li`,{className:T.rowlineDrillWrap,children:e.bySession?.filter(e=>Ot(e.cwd)===n.name).slice(0,5).map(e=>(0,o.jsxs)(`div`,{className:T.rowlineDrill,children:[(0,o.jsx)(`span`,{className:T.rowlineName,children:e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`}),(0,o.jsxs)(`span`,{className:T.rowlineRight,children:[(0,o.jsx)(`span`,{className:T.num,children:B(e.cost)}),(0,o.jsxs)(`span`,{className:T.rowlineMuted,children:[e.calls,` `,t(`calls`)]})]})]},e.id))})]},n.name))})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:T.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:T.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:T.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:T.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:T.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:T.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:T.emptyRow,children:t(`noData`)})}),Jt(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:T.modelProvider,children:Ot(e.cwd)??`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:T.numCol,children:B(e.cost)}),(0,o.jsx)(`td`,{className:T.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${rn(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?T.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{be(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:T.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(T.ubTag,T.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:T.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:T.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),N===`token`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(Ke,{stats:e,trendDays:P,onTrendDays:se,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:T.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:T.panelHead,children:[(0,o.jsx)(`h3`,{className:T.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:T.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(Le,{perf:e.perf,models:gt,t})]})]}),N===`pricing`&&(0,o.jsxs)(`div`,{className:T.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:T.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:T.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:T.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,V(z.rate)]}),(0,o.jsx)(`span`,{className:l(T.ubTag,z.live?T.ubTagSuccess:T.ubTagNeutral),children:z.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:T.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:T.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:T.ubCardHead,children:[(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:T.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:T.ubTablewrap,children:(0,o.jsxs)(`table`,{className:T.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:T.numCol,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:we().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:T.ubModel,children:[(0,o.jsx)(bn,{provider:e.provider,colorVar:Te(e.colorVar)}),(0,o.jsxs)(`span`,{className:T.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:T.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Ce(e.promo,Date.now())&&(0,o.jsx)(`span`,{className:T.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:T.numCol,children:n?W(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:n?W(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:n?W(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(`span`,{className:T.ubPricepair,children:[(0,o.jsxs)(`span`,{className:T.ubChipPeak,children:[(0,o.jsx)(`span`,{className:T.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:T.num,children:[W(e.price.input,e.price.currency),` / `,W(e.price.output,e.price.currency)]})]}),(0,o.jsxs)(`span`,{className:T.ubChipOff,children:[(0,o.jsx)(`span`,{className:T.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:T.num,children:[W(e.price.offPeak.input,e.price.currency),` / `,W(e.price.offPeak.output,e.price.currency)]})]})]}):n?(0,o.jsx)(`span`,{className:T.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:T.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:T.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:T.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:T.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:T.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):W(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:T.numCol,children:(0,o.jsx)(`span`,{className:T.na,children:`—`})}),(0,o.jsx)(`td`,{className:T.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:T.na,children:`—`}):W(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:T.numCol,children:(0,o.jsx)(`span`,{className:T.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:T.ubCard,children:[(0,o.jsx)(`div`,{className:T.ubCardHead,children:(0,o.jsx)(`h3`,{className:T.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:T.ubNotes,children:[(0,o.jsxs)(`li`,{className:T.ubNotesItem,children:[(0,o.jsx)(`span`,{className:T.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:T.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:T.ubNotesItem,children:[(0,o.jsx)(`span`,{className:T.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:T.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:T.ubNotesItem,children:[(0,o.jsx)(`span`,{className:T.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:T.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:T.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 bn({provider:e,colorVar:t}){let n=bt(e);return n===void 0?(0,o.jsx)(`span`,{className:T.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()}):(0,o.jsx)(`img`,{className:T.vendorLogo,src:n,alt:``,"aria-hidden":`true`})}function xn(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(on),[m,h]=(0,r.useState)(At),[v,y]=(0,r.useState)([]),[x,w]=(0,r.useState)(void 0),[T,E]=(0,r.useState)([]),[te,D]=(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),ee(e)},[]),[P,ce]=(0,r.useState)(()=>g()),ue=(0,r.useCallback)(e=>{ce(e),_(e)},[]),[fe,pe]=(0,r.useState)(()=>{let e=S();return ae(e),e}),me=(0,r.useCallback)(e=>{pe(e),ae(e),C(e)},[]),he=(0,r.useMemo)(()=>zt(u),[u,fe]),ge=k===`usd`?`en`:`zh`,F=(0,r.useCallback)((e,n)=>{let r=(ge===`en`?gt:ht)[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)(()=>{sn().then(e=>{e!==null&&d(zt(e))}),un().then(({balances:e,reconcile:t})=>{e.length>0&&y(e),w(t)}),dn().then(e=>{e.length>0&&E(e),D(!1)}).catch(()=>{D(!0)}),fn().then(e=>{O(e)}).catch(()=>{})},[]),be=(0,r.useCallback)(()=>{I(),ln(),ve(!0)},[I]);(0,r.useEffect)(()=>{I(),ln()},[I]),(0,r.useEffect)(()=>{let e=setInterval(()=>{I(),ln()},nn);return()=>{clearInterval(e)}},[I]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(h(t),se(t.catalog??[]))}),()=>{e=!1}},[n]);let L=$(),R=Object.entries(u.byDay).filter(([e])=>e.startsWith(L.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),Se=u.byDay[L]?.cost??0,Ce=Kt(u.byDay,L),z=(0,r.useMemo)(()=>Gt(u.byDay).map(e=>{let t=u.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:t.input+t.output}}),[u.byDay]),we=Object.entries(u.byDay).filter(([e])=>e.startsWith(L.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Te=(()=>{let e=u.byDay[L];return e===void 0?0:e.input+e.output})(),B=Kt(u.byDay,L,e=>e.input+e.output),Ee=c(e=>e.enabled),De=c(e=>e.amount),Oe=c(e=>e.tierAlertDays),ke=c(e=>e.lastTierSwitchAt),[H,Ae]=(0,r.useState)(()=>Ct()),[U,je]=(0,r.useState)(null),[W,Me]=(0,r.useState)(null),[G,Ne]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>Ne(Date.now()),nn);return()=>{clearInterval(e)}},[]);let K=(0,r.useCallback)(e=>{Ae(e),wt(e)},[]),Pe=(0,r.useCallback)(()=>{Me({entering:de(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+18e4})},[]),q=De>0?De:u.budget??0,Fe=(0,r.useCallback)(()=>{let e=!Ee;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,Ee]);(0,r.useEffect)(()=>{if(!Ee||q<=0)return;let e=R/q*100,t=kt.filter(t=>e>=t&&Oe?.[String(t)]!==L);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,L),!Bt())return;let r=F(`budgetTierBody`).replace(`{cost}`,V(R)).replace(`{budget}`,V(q)).replace(`{pct}`,String(n));Ht(`budget:${n}:${L}`,()=>{new Notification(F(`budget`),{body:r})})},[Ee,q,R,Oe,L,l,F]),(0,r.useEffect)(()=>{let e=Tt(G,H,ke);if(e===null||(l.markTierSwitchAlerted(e.atMs),je(e),!H.webNotify||!Bt()))return;let t=Math.max(1,Math.round((e.atMs-G)/6e4)),n=F(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=F(e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));Ht(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[G,ke,H,l,F]);let Ie=c(e=>e.lastBalanceAlertDay),Le=(0,r.useMemo)(()=>{if(v.length===0)return;let e=u.lowBalanceThreshold??50,t=Lt(u.byDay,L),n=le().rate;for(let r of v){if(r.totalBalance===void 0||r.error!==void 0)continue;let i=r.currency===`USD`?r.totalBalance*n:r.totalBalance;if(i>=e)continue;let a=t>0?Math.floor(i/t):void 0;return{name:r.displayName,cny:i,days:a}}},[v,u.lowBalanceThreshold,u.byDay,L]);(0,r.useEffect)(()=>{if(Le===void 0||Ie===L||(l.markBalanceAlerted(L),!Bt()))return;let e=F(`balanceLowBody`).replace(`{name}`,Le.name).replace(`{balance}`,V(Le.cny)).replace(`{days}`,Le.days===void 0?`—`:String(Le.days));Ht(`balance:${L}`,()=>{new Notification(F(`balance`),{body:e})})},[Le,Ie,L,l,F]);let Re=(0,r.useMemo)(()=>{let e=L.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=[...t.entries()].filter(([,e])=>!e.plan).sort((e,t)=>t[1].cost-e[1].cost)[0],r=[...t.entries()].filter(([,e])=>e.plan).sort((e,t)=>t[1].cost-e[1].cost)[0],i=e=>{let t=v.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===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)}`:V(t.totalBalance),r=le().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<(u.lowBalanceThreshold??50)}},a=e=>{let t=T.find(t=>t.displayName===e||It(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}};return{direct:n===void 0?void 0:{name:n[0],...i(n[0])},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[u.byDayModels,u.byModel,u.lowBalanceThreshold,v,T,L]),ze=(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:Se,monthCost:R})},[Se,R,i]),(0,r.useEffect)(()=>a(be),[a,be]);let Be=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(hn,{...e,t:F,onOpen:be,monthCost:R,todayCost:Se,weekCost:Ce,days:z,vendorStatus:Re,dash:ze,cardPrefs:P,monthTokens:we,todayTokens:Te,weekTokens:B,floatPrefs:A,subscriptions:T}),_e&&(0,o.jsx)(yn,{stats:he,t:F,onClose:ye,userPrices:fe,onUserPrices:me,health:m,balances:v,...x===void 0?{}:{reconcile:x},quotas:T,relayQuotas:ne,currency:k,onCurrency:re,turns:Be,renderSlot:s,budgetEnabled:Ee,budgetAmount:q,onToggleBudget:Fe,onBudgetAmount:l.setAmount,peakConfig:H,onPeakConfig:K,onPreviewPeak:Pe,floatPrefs:A,onFloatPrefs:j,cardPrefs:P,onCardPrefs:ue,sitePrefs:M,onSitePrefs:oe,quotasStale:te}),(U!==null||W!==null)&&(0,o.jsx)(Et,{hit:U??W,config:H,t:F,onDismiss:()=>{je(null),Me(null)}})]})}function Sn(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function Cn(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 wn(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 Tn(){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 En(){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 Dn(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function On({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=()=>{Tn().then(t=>{!e&&t!==null&&a(t)}),En().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)(()=>Sn(i,n),[i,n]),f=(0,r.useMemo)(()=>Cn(i,n),[i,n]),p=he(l),m=(0,r.useMemo)(()=>wn(s),[s]),h=e=>V(e,`cny`);if(n===void 0)return null;let g=d>0||f>0,_=p.tier===`peak`;return(0,o.jsxs)(`span`,{className:T.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:_?T.feeChipPrimary:T.feeChipOff,"data-testid":`billing-live-tier`,children:t(_?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:T.feeCount,children:F(p.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:T.feeSuffix,children:t(_?`tierToOff`:`tierToPeak`)}),g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:T.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:T.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:T.feeNum,children:h(f)})]}),(0,o.jsx)(`span`,{className:T.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:T.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:T.feeNum,children:h(d)})]})]}),m.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:T.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?T.feeChipError:T.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(Dn(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function kn(){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 An(){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 jn={enabled:!1,timeout:0};function Mn(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...jn};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...jn}}}function Nn(e){return e.completed===!0||e.running===!1}function Pn(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)),Nn(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=Nn(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 Fn=[`slots`,`locale`,`connection`,`sessions`];function In(e){let t=kn();e.provide(`billingMetrics`,t);let n=An(),r=e.get(`connection`);e.effect(()=>e.locale.register(mt,{zh:ht,en:gt}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:mt,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)})},xn)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:mt},On)),e.effect(()=>Pn(e.sessions.list,Mn),`ui-usage-billing: completion notifier`)}return n.UsageBilling=xn,n.apply=In,n.inject=Fn,t.exports}});
6
6
  //# sourceMappingURL=client.js.map