dsh-cost-meter 1.9.76 → 1.9.78

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,11 +1,11 @@
1
1
  // Generated from src/client/*.js by node scripts/build.mjs; do not edit.
2
- ;(function(Je){const Pe=window.__ModuleLoader__,fe=Pe[Symbol.for("@dsh-plugin/dsh-loader:load-wrap")];return(Je.id==="dsh-cost-meter"&&Pe.load===fe?.ours&&typeof fe.original=="function"?fe.original:Pe.load).call(Pe,Je)})({id:"dsh-cost-meter",factory:ge=>{var Je={exports:{}},Pe=Je.exports;Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"});const fe=ge("react"),{Tooltip:K}=ge("@deepseek-ai/dsh-client-ui-primitives"),ht=!1,cs="var(--dsw-alias-~.cm-~background:~align-items:center~font-size:~border-radius:~display:flex;~color:~width:~flex-direction:column;~white-space:nowrap~height:~padding:~font-weight:600~overflow:hidden~text-overflow:ellipsis~font-variant-numeric:tabular-nums~justify-content:~box-sizing:border-box~1px solid ~grid-template-columns:~display:~cursor:pointer~gap:~border:~flex-wrap:wrap~margin-top:~flex:none~transform:~padding-bottom:~position:~margin:~overflow-wrap:anywhere~text-align:~var(--dsh-frame-top-clearance,0px)~box-shadow:~overscroll-behavior:contain~border-bottom:~grid-column:~flex:~font:inherit;~font-weight:~overflow:auto;~z-index:~transition:~user-select:none~5px solid ~text-only:~left:~opacity:~outline:~-webkit-app-region:~flex-shrink:0~flex-wrap:nowrap;~border-top:~flex-direction:~outline-offset:~pointer-events:~grid-area:1/1;~var(--cm-opaque-base,#fff)~grid-auto-flow:column;~bottom:~align-self:~var(--cm-dialog-top)~var(--cm-guide-top)~2px solid ~clickable:~right:~--cm-opaque-base:~text-decoration:~--cm-guide-top:~overflow-x:auto~inset:~top:50%;~content:~align-items:~cursor:~3px solid ~6px solid ~animation:~top:0;~action:~order:".split("~"),Qa='|section |tabs>|tab{ƕinline-flex;&;Ƒcenter;ƒ;min-Ƌ32px;ƌ6px 10px;Ɵ0;ƨ?13px;line-Ƌ20px;vertical-align:middle}|peak-alert{ƫ2147483647;max-Ƌcalc(100dvh - 32px);ƪƤ}|peak-alert,|peak-alert *{Ƴno-drag}|peak-alert |peak-alert-actions{ƞrelative;ƛ}|peak-alert |peak-alert-actions button{ƹauto}@property --cm-dialog-top{syntax:"<length>";inherits:true;initial-value:0px}|stat-dialog{--cm-dialog-top:var(--dsh-frame-chrome-top,Ƣ);Ljƿ 0 0 0;Ɵauto;ƈmin(1000px,94vw);max-ƈcalc(100vw - 32px);max-Ƌcalc(100vh - ƿ - 32px);Ǝ;ƒ;ƌ0;ƅ16px;ƘƓ`border-l1);Ƈ`label-primary);$`bg-layer-2,`bg-base,#fff))}|stat-dialog[open]{ƆƷcolumn}|loading{ƌ24px;min-Ƌ160px;ƕgrid;Ɨ18px}|loading i{Ƌ18px;ƅ5px;$`bg-layer-1,#f2f3f5)}|loading i:first-child{ƈ35%}|loading i:last-child{ƈ65%}|stat-dialog-head{Ɔ&;Ƒspace-between;Ɨ16px;ƌ16px 24px;ƥƓ`border-l3);ƛ}|stat-dialog-head strong{?15px;Ʃ500}|stat-dialog-body{ƪmin-Ƌ0;ƌ20px 24px;Ƥ}|stat-dialog::backdrop{Ljvar(--dsh-frame-chrome-top,Ƣ) 0 0;$#0005}|dp{ƒ;min-ƈ0;ƨ?calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-Ƌcalc(20px + var(--dsh-content-font-delta-secondary,0px));ƅvar(--dsw-radius-sm);max-ƈ100%;Ƈ`label-tertiary);Ɛ;Ɗ;$0 0;Ƙnone;&;Ɨ6px;ƌ1px 8px;ƕinline-flex;Ɩ}|dp:hover,|dp[aria-expanded=true]{$`interactive-bg-hover);Ƈ`label-secondary)}|dp-header{max-ƈ180px}|dl{Ə;min-ƈ0;Ǝ}|dp-status{max-ƈ100%;?12px;line-Ƌ20px;Ƈ`label-tertiary);Ɗ;Ǝ;Ə}|foot{Ɔ&;Ɨ6px;Ƌ32px;ƌ0 8px;ƅ8px;?12px;Ƈ`label-secondary);Ɗ;Ǝ}|foot:hover,|foot-rail:hover,|corner-chip:hover,|qchip:hover,|tab:hover,|btn:hover{$`interactive-bg-hover)}|foot-rail{ƈ100%;Ƒcenter;ƌ0;?13px;ƍ;Ƈ`label-primary)}|num{Ɛ}|go-rail{?11px;Ʃ700;Ƈ`label-primary)}|go-list{ƆƉƗ10px}|go-row{Ɔ&;Ɨ8px;?12px}|go-label{ƛ;ƈ88px;Ƈ`label-secondary)}|go-bar{Ƨ1;Ƌ6px;ƅ3px;$`interactive-bg-hover);Ǝ}|go-fill{Ƌ100%;ƅ3px;$`brand-primary)}|go-num{ƛ;min-ƈ44px;ơright;ƍ;Ɛ}|go-reset{ƛ;max-ƈ230px;?11px;Ƈ`label-tertiary);Ɗ;Ǝ;Ə}|go-time{?11px;Ƈ`label-tertiary)}|go-row.main |go-label{ƍ;Ƈ`label-primary)}|corner{ƕinline-flex;Ƨ0 1 auto;ƙ;Ƒcenter;&;Ɨ6px;min-ƈ0;max-ƈ100%}|corner-chip{ƕinline-flex;&;Ƌ20px;ƌ0 8px;ƅ6px;$`bg-layer-2);?11px;line-Ƌ20px;Ƈ`label-secondary);Ɗ;Ɛ}|qstrip{Ɔƙ;Ƒcenter;&;Ɨ6px;ƈ100%;max-ƈvar(--dsh-chat-content-width,720px);Ɵ0 auto;ƒ;ƌ0 calc(var(--dsh-composer-side-clearance,0px) + 16px)}|qchip{ƕinline-flex;&;Ɨ6px;Ƌ22px;ƌ0 8px;ƅ6px;$transparent;?11px;line-Ƌ22px;Ƈ`label-secondary);Ɗ;Ɛ;njdefault}|quota-details{ƞrelative;min-ƈ0}|quota-details>summary{list-style:none;Ɩ}|quota-details>summary::-webkit-details-marker{ƕnone}|quota-detail{white-space:normal;ƒ;ƌ10px;ƘƓ`border-l1);ƅ8px;$`bg-layer-1,#fff);Ƈ`label-primary);?12px;line-Ƌ1.6}|qstrip |quota-detail{ƞabsolute;ƽcalc(100% + 6px);ư0;ƈmin(320px,calc(100vw - 32px));ƫ100}|quota-detail button{ƚ8px}|qchip |qlabel{Ƈ`label-primary);ƍ}|qchip |qbar{ƕblock;ƈ44px;Ƌ4px;ƅ2px;$`border-l1);Ǝ;ƛ}|qchip |qfill{ƕblock;Ƌ100%;ƅ2px;$`state-ok-primary,#3ba272)}|qchip |qseg{ƕinline-flex;&;Ɨ4px}|qchip |qsep{ƈ1px;Ƌ12px;$`border-l1);ƛ}|qchip |qtext{Ƈ`label-secondary)}|qchip.warn |qfill{$`state-warn-primary)}|qchip.over |qfill{$`state-error-primary)}|qchip.action{Ɩ;ƭ;Ʋnone}|qchip.Ǒfocus-visible{ƣ0 0 0 2px `brand-primary)}|qchip.Ǒactive{ƜtranslateY(.5px)}|plan-provider{ƆƉƗ8px}|plan-provider+|plan-provider{ƚ14px}|plan-provider-name{Ɔ&;Ɨ8px;?13px;ƍ}|plan-updated{?11px;Ʃ400;Ƈ`label-tertiary)}|plan-tag{ƛ;margin-ư6px;ƌ0 6px;ƅ999px;ƘƓ`border-l1);?10px;line-Ƌ16px;Ƈ`state-warn-primary)}|plan-reset,|plan-method{?11px;Ƈ`label-tertiary)}|qguide{džvar(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,Ƣ) + 18px));ƞfixed;Ljauto;Ɵ0;top:max(ǀ,env(safe-area-inset-top,0px));ƹauto;Ƴno-drag;ư50%;Ɯtranslate(-50%);ƫ9999;max-ƈ440px;ƈcalc(100% - 32px);ƘƓ`border-l1);ƅ12px;$`bg-layer-2);ƣ0 8px 28px #0000002e;ƌ14px 16px;?13px;Ƈ`label-primary);ƆƉƗ8px}|qguide[data-cm-onboarding]{ƒ;max-Ƌcalc(100dvh - max(ǀ,env(safe-area-inset-top,0px)) - 16px);ƪƤ}|qguide h4{Ɵ0;?13px;ƍ}|qguide p{Ɵ0;?12px;line-Ƌ1.6;Ƈ`label-secondary)}|qguide |buttons{ƆƗ8px;Ƒflex-end}|section{ƆƉƗ20px;ƌ4px 2px 24px;?13px;Ƈ`label-primary)}|cards{ƕgrid;Ɣrepeat(auto-fit,minmax(min(220px,100%),1fr));Ɨ12px}|overview-grid{container:cm-overview / inline-size;min-ƈ0}|overview-grid>|cards{Ɣrepeat(var(--cm-overview-count,3),minmax(0,1fr))}|overview-grid |card{min-ƈ0;ƆƉƗ6px;ƌ12px 14px}|overview-grid :is(|card-title,|card-sub){Ɵ0}|overview-grid |card-value{line-Ƌ1.35;Ɛ;Ơ}|overview-grid |card-sub{line-Ƌ1.5;Ơ}@container cm-overview (max-ƈ460px){|overview-grid>|cards{Ɣ1fr}}|cards-toggle{Ɔ&;Ɨ6px;Ɵ-6px 2px 0 auto;ƈfit-content;?12px;Ƈ`label-tertiary);Ɩ;ƭ}|cards-toggle:hover{Ƈ`label-primary)}|cards-toggle input{Ɵ0;Ɩ}|card,|budget{ƘƓ`border-l1);ƅ12px;ƌ14px 16px;$`bg-layer-1)}|card-title{?12px;Ƈ`label-tertiary);Ɵ0 0 8px}|card-value{?20px;line-Ƌ28px;ƍ}|card-sub{?12px;Ƈ`label-tertiary);ƚ4px}|h{?13px;ƍ;Ɵ0}|collapse-h{Ɔ&;Ɨ8px;$none;Ƙnone;ƌ0;Ɵ0;Ɩ;Ƈinherit;ƨơleft}|collapse-h:hover |h{Ƈ`interactive-text-hover,`label-primary))}|caret{ƛ;ƈ0;Ƌ0;border-ưƮtransparent;border-ǃƮtransparent;ƶǎ`label-secondary);Ɯrotate(-90deg);Ƭtransform .15s ease}|caret.open{Ɯrotate(0)}|collapse-body{ƆƉƗ12px;ƚ12px}|toolbar{ƆƑflex-end;&;Ɨ10px}|toolbar |field{Ʒrow;&;Ɨ8px}|toolbar |field label{Ɵ0;?12px;Ƈ`label-tertiary)}|toolbar |input{min-ƈ150px;ƌ4px 10px}|tabs-row{Ɔ&;Ƒspace-between;Ɨ12px;ƙ;ƥƓvar(--dsh-alias-border-l1);Ɲ10px}|tabs{Ɔ&;Ɨ4px;ƙ}|tab{ƨ?13px;Ƈ`label-secondary);$transparent;Ƙnone;ƅ8px;ƌ6px 14px;Ɩ;Ɗ}|tab.active{$`state-business-primary);Ƈ`label-primary-inverted);ƍ}|tabs-row |msg{ƌ2px 10px}|tabs-row>|hint,|tabs-row>|msg{margin-inline-start:auto}|note{?12px;Ƈ`label-tertiary);Ɵ0}|table{ƈ100%;border-collapse:collapse;?12px}|table th,|table td{ơleft;ƌ7px 10px;ƥƓ`border-l1);Ɗ}|table th{Ƈ`label-tertiary);Ʃ500}|table td.num,|table th.num{ơright;Ɛ}|table tr:last-child td{ƥnone}|table tr|row-click{Ɩ}|table tr|row-click:hover td{$`bg-hover,rgba(127,127,127,.08))}|sess-title{max-ƈ260px;Ǝ;Ə;Ɗ}|sess-id{?11px;font-family:ui-monospace,Consolas,monospace;Ƈ`label-tertiary)}|empty{?12px;Ƈ`label-tertiary);ƌ8px 0}|scroll{max-Ƌ320px;ƪƘƓ`border-l1);ƅ10px}|grid{ƕgrid;Ɣrepeat(auto-fit,minmax(min(220px,100%),1fr));Ɨ12px}|field{ƆƉƗ6px;min-ƈ0}|field label{?12px;Ƈ`label-secondary)}|input,|input option,|input optgroup{Ƈ`label-primary);$`bg-base)}|input{ƨ?13px;ƘƓ`border-l1);ƅ8px;ƌ6px 10px;Ʋnone}|input:is(select){color-scheme:light dark}|input:is(select) :is(option,optgroup){Ƈ`label-primary)!important;$`bg-base)!important;$rgb(from `bg-base) r g b / 1)!important}|input:focus{border-Ƈ`state-business-primary)}|input.narrow{max-ƈ120px}|range-row{Ɔ&;Ɨ10px}|range{Ƨ1;min-ƈ0;accent-Ƈ`state-business-primary)}|range-value{ƛ;min-ƈ44px;?12px;Ƈ`label-tertiary);ơright}|check{Ɔ&;Ɨ8px;?13px;Ƈ`label-primary);Ɩ}|pricing-page,|pricing-content{ƕgrid;Ɨ20px;min-ƈ0}|pricing-heading{Ɔ&;Ƒspace-between;Ɨ12px}|pricing-heading |h{?16px;margin-ƽ6px}|pricing-heading |note{line-Ƌ1.6}|pricing-unit{ƴ;Ƈ`label-tertiary);?11px}|pricing-nav{ƆƗ4px;ƌ4px;ƅ10px;$`bg-layer-1);ƘƓ`border-l1)}|pricing-nav-item{Ƨ1;min-ƈ0;ƨƇ`label-secondary);$transparent;Ƙ0;ƅ7px;ƌ8px 10px;Ɩ}|pricing-nav-item.active{Ƈ`state-business-primary);$`bg-base);ƣ0 1px 3px #0000000d;ƍ}|pricing-nav-item:focus-visible{Ʋǁ`state-business-primary)}|pricing-tools{ƕgrid;Ɨ16px}|pricing-tool{ƆƉƗ12px;ƌ16px;ƘƓ`border-l1);ƅ12px;min-ƈ0}|pricing-tool>|peak-panel{ƌ0;Ƙ0;$none}|pricing-tool p{line-Ƌ1.65}@media(max-ƈ480px){|pricing-heading{Njflex-start;ƉƗ4px}|pricing-nav-item{ƌ8px 4px;?12px}|pricing-tool{ƌ12px}}|price-card{ƘƓ`border-l1);ƅ10px;ƌ12px 14px;ƆƉƗ10px;$`bg-layer-1)}|price-head{Ɔ&;Ɨ8px;ƙ}|price-name{ƍ;?13px;Ơ;min-ƈ0;Ƨ1 1 180px}|price-legacy{?11px;Ƈ`label-tertiary);ƘƓ`border-l1);ƅ999px;ƌ1px 8px}|price-locked{?11px;Ƈ`state-business-primary);ƘƓ`state-business-primary);ƅ999px;ƌ1px 8px;njhelp}|price-row{ƕgrid;Ɣ52px repeat(4,minmax(0,1fr));Ɨ8px;&}|price-row span{?12px;Ƈ`label-tertiary)}|price-row input{ƈ100%;min-ƈ0;ƒ;ƌ6px 5px}|price-multiplier{Ɔ&;Ƒspace-between;Ɨ6px 12px;ƙ;?12px;Ƈ`label-tertiary)}|price-multiplier label{ƕinline-flex;&;Ɨ5px;Ɩ}|price-multiplier input{Ɵ0;accent-Ƈ`brand-primary,#4d6bfe)}|price-row input[aria-invalid=true]{border-Ƈ#d64c4c}|buttons{Ɔƙ;Ɨ10px;&}|btn{ƨ?13px;Ƈ`label-primary);$`button-elevated-fill);ƘƓ`border-l1);ƅ8px;ƌ6px 14px;Ɩ}|btn|stat-entry{?12px;line-Ƌ20px;ƌ0 6px;min-ƈ0;max-ƈ100%;Ɗ;Ǝ;Ə;ƴ}|btn|stat-header{border-Ƈ`border-l3);ƅ7px;padding-inline:8px}@media(max-ƈ640px){|stat-header{ƕnone}}|btn.primary{$`state-business-primary);border-Ƈtransparent;Ƈ`label-primary-inverted)}|btn.primary:hover{Ʊ.88;$`state-business-primary)}|btn.danger,|msg.err,|bal-line.err,|bal-err{Ƈ`state-error-primary)}|btn.small{ƌ3px 10px;?12px}|msg{?12px;line-Ƌ18px;ƌ8px 12px;ƅ8px;ƘƓ`border-l1)}|msg.ok{Ƈ`state-success-primary)}|hint{?12px;Ƈ`label-tertiary)}|budget{ƆƉƗ10px}|peak-alert{ƞfixed;Ljauto;Ɵ0;ƒ;ƹauto;Ƴno-drag;Ƈ`label-primary);ƫ9999;ƈ340px;max-ƈcalc(100vw - 32px);ƌ16px;ƅ14px;$`bg-layer-2);ƘƓ`border-l2);ƣ0 14px 36px #00000038;ƆƉƗ8px;?12px;Ǐcm-peak-alert-in .22s cubic-bezier(.2,.8,.2,1)}|peak-alert|peak-alert-corner{ǃ20px;ƽ20px}|peak-alert|peak-alert-center{ljư50%;Ɯtranslate(-50%,-50%);animation-name:cm-peak-alert-in-center}|peak-alert-peak{ƶǍ`state-warn-primary)}|peak-alert-offpeak{ƶǍ`state-info-primary,#3b82f6)}|peak-alert-badge{ƕinline-flex;&;Ɨ6px;?11px;ƍ;letter-spacing:.4px;text-Ɯuppercase}|peak-alert-badge:before{NJ"";ƈ8px;Ƌ8px;ƅ50%;$currentColor;ƣ0 0 0 4px color-mix(in srgb,currentColor 16%,transparent)}|peak-alert-peak |peak-alert-badge{Ƈ`state-warn-primary)}|peak-alert-offpeak |peak-alert-badge{Ƈ`state-info-primary,#3b82f6)}|peak-alert-title{?14px;ƍ;Ƈ`label-primary)}|peak-alert-body{Ƈ`label-secondary);line-Ƌ1.55}|peak-alert-actions{ƆƑflex-end;Ɨ8px;ƚ2px}|row{ƆƗ8px;&;ƙ}@keyframes cm-peak-alert-in{0%{Ʊ0;ƜtranslateY(10px) scale(.98)}to{Ʊ1;ƜtranslateY(0) scale(1)}}@keyframes cm-peak-alert-in-center{0%{Ʊ0;Ɯtranslate(-50%,calc(-50% + 10px))}to{Ʊ1;Ɯtranslate(-50%,-50%)}}|budget-head{Ɔ&;Ƒspace-between;Ɨ8px}|quota-name{Ƨ1;min-ƈ0}|budget-bar{Ƌ8px;ƅ999px;$`bg-layer-3);Ǝ}|budget-fill{Ƌ100%;ƅ999px;$`state-business-primary);Ƭwidth .3s ease}|ug{ƆƉƗ12px}|ug-total{?13px;Ƈ`label-primary)}|ug-grid{ƕgrid;Ƽgrid-template-rows:repeat(7,auto);Ɨ3px;ƈ100%}|ug-cell{ƈ100%;aspect-ratio:1/1;ƅ3px;ƒ;$color-mix(in srgb,`label-primary) 8%,transparent);ƘƓ`border-l1)}|ug-cell.l1,|ug-cell.l2,|ug-cell.l3,|ug-cell.l4{border-Ƈtransparent}|ug-cell.l1{$color-mix(in srgb,`state-business-primary) 25%,`bg-layer-3))}|ug-cell.l2{$color-mix(in srgb,`state-business-primary) 50%,`bg-layer-3))}|ug-cell.l3{$color-mix(in srgb,`state-business-primary) 75%,`bg-layer-3))}|ug-cell.l4{$`state-business-primary)}|ug-cell.today{ƲƓ`label-secondary);Ƹ1px}|ug-months{ƕgrid;ƼƗ3px;ƈ100%;?10px;Ƈ`label-tertiary);ƚ4px}|ug-monthc{Ɗ}|budget-line{?13px;Ƈ`label-secondary)}|budget-line.over{Ƈ`state-error-primary)}|peak-strip{Ɔ&;Ɨ6px;ƚ4px;min-ƈ0}|peak-track{ƞrelative;ƆƧ1;Ƌ6px;min-ƈ0;ƅ999px;Ǝ;ƘƓ`border-l1);$`bg-layer-3)}|peak-segment{Ƌ100%;Ƨ1}|peak-high{$#ff9800}|peak-low{$`state-business-primary)}|peak-marker{ƞabsolute;ǐư50%;ƈ2px;Ƌ100%;$`bg-base);ƣ0 0 0 1px `label-tertiary);Ɯtranslate(-50%);Ƭleft .4s ease;ƫ2}|peak-chip{?11px;ƍ;line-Ƌ1.2;Ɗ;Ƈ`label-secondary)}|peak-classic{ƞrelative;ƆƉƗ5px;ƚ6px;min-ƈ0}|peak-classic |peak-track{ƛ;Ƌ8px}|peak-classic-marker{ƞabsolute;ǐư50%;ƈ4px;Ƌ12px;$`bg-base);Ƙ1.Ʈ#ff9800;ƣ0 0 0 1px `bg-base),0 0 0 2px `label-tertiary);Ɯtranslate(-50%);Ƭleft .4s ease;ƫ2;ƅ2px}|peak-classic-marker:after{NJ"";ƞabsolute;top:-7px;ư50%;Ɯtranslate(-50%);border-ưƮtransparent;border-ǃƮtransparent;ƶǎ#ff9800}|peak-classic.off |peak-classic-marker{border-Ƈ`state-business-primary)}|peak-classic.off |peak-classic-marker:after{border-top-Ƈ`state-business-primary)}|peak-classic-chip{ƾflex-start;?11px;ƍ;line-Ƌ1.4;$`bg-layer-2);ƘƓ`border-l1);ƅ999px;ƌ2px 8px;Ɗ;Ƈ`label-secondary)}|peak-strip.peak |peak-chip,|peak-classic.peak |peak-classic-chip,|peak-rail.peak |peak-rail-label,|peak-rail-classic.peak |peak-rail-classic-label{Ƈ#ff9800}|peak-strip.off |peak-chip,|peak-classic.off |peak-classic-chip,|peak-rail.off |peak-rail-label,|peak-rail-classic.off |peak-rail-classic-label{Ƈ`state-business-primary)}|peak-strip.weekend |peak-chip,|peak-classic.weekend |peak-classic-chip,|peak-rail.weekend |peak-rail-label,|peak-rail-classic.weekend |peak-rail-classic-label{Ƈ#34a853}|peak-classic.weekend |peak-classic-marker{border-Ƈ#34a853}|peak-classic.weekend |peak-classic-marker:after{border-top-Ƈ#34a853}|peak-rail{ƆƉ&;Ɨ3px;ƈ40px;ƒ}|peak-rail-track{ƞrelative;ƆƉƈ6px;Ƌ56px;ƅ999px;Ǝ;ƘƓ`border-l1);$`bg-layer-3)}|peak-rail-segment{ƈ100%;Ƨ1}|peak-rail-high{$#ff9800}|peak-rail-low{$`state-business-primary)}|peak-rail-marker{ƞabsolute;ư0;ljƈ100%;Ƌ2px;$`bg-base);ƣ0 0 0 1px `label-tertiary);ƜtranslateY(-50%);Ƭtop .4s ease;ƫ2}|peak-rail-label{?10px;ƍ;line-Ƌ1.2;Ɗ;Ƈ`label-secondary)}|peak-rail-classic{ƆƉ&;Ɨ3px;ƈ40px;ƒ}|peak-rail-classic-track{ƞrelative;ƆƉƈ14px;Ƌ56px;ƅ999px;ƘƓ`border-l1);$`bg-layer-3)}|peak-rail-classic-segment{ƞrelative;ƈ100%;Ƨ1;Ǝ}|peak-rail-classic-segment.peak{$#ff9800;ƅ999px 999px 0 0}|peak-rail-classic-segment.off{$`state-business-primary);ƅ0 0 999px 999px}|peak-rail-classic-marker{ƞabsolute;ư50%;ljƈ12px;Ƌ4px;$`bg-base);Ƙ1.Ʈ#ff9800;ƣ0 0 0 1px `bg-base),0 0 0 2px `label-tertiary);Ɯtranslate(-50%,-50%);Ƭtop .4s ease;ƫ2;ƅ2px}|peak-rail-classic.off |peak-rail-classic-marker{border-Ƈ`state-business-primary)}|peak-rail-classic-label{?10px;ƍ;line-Ƌ1.2;Ɗ}|peak-rail-classic.weekend |peak-rail-classic-marker{border-Ƈ#34a853}|grid-group{Ʀ1 / -1;ƚ8px;?12px;ƍ;Ƈ`label-tertiary);ƥƓ`border-l1);Ɲ4px}|grid-group:first-child{ƚ0}|peak-preview{ƚ8px}|toggle-btn{$none;Ƙnone;ƌ0;?12px;ƍ;Ƈ`state-business-primary);Ɩ}|toggle-btn:hover{Džunderline}|collapsed-note{ƚ4px}|catalog-vendor{ƚ10px;?12px;ƍ;Ƈ`label-tertiary);ƥƓ`border-l1);Ɲ2px;Ɔ&;Ƒspace-between;Ɨ8px}|vendor-toggle{Ɩ;ƭ}|vendor-toggle:hover{Ƈ`label-secondary)}|vendor-display{ƕinline-flex;&;Ɨ4px;Ʃ400;?11px;Ƈ`label-tertiary);Ɗ}|mstats-tabs{ƆƗ8px;margin-ƽ8px}|mstats-tab{$none;ƘƓ`border-l1);ƅ999px;ƌ2px 12px;?12px;Ƈ`label-secondary);Ɩ}|model-costs |mstats-tab.active{$color-mix(in srgb,`state-business-primary) 14%,`bg-base));border-Ƈ`state-business-primary);Ƈ`label-primary);ƍ}|mstats-h{Ɵ10px 0 4px;?12px;ƍ;Ƈ`label-secondary)}|mstats-row{ƕgrid;Ɣminmax(90px,170px) 1fr auto;Ɨ8px;&;?11px;line-Ƌ1.7}|mstats-name{Ǝ;Ə;Ɗ;Ƈ`label-secondary)}|mstats-label{Ʀ1/-1;Ɔƙ;&;Ɨ6px;ƚ6px}|mstats-label |mstats-name{Ƨ1;min-ƈ90px}|mstats-label~|mstats-barbg{Ʀ1/3}|mstats-label select{max-ƈ100%;min-ƈ0}|mstats-barbg{ƞrelative;Ƌ10px;ƅ999px;$`bg-layer-3);Ǝ;ƕflex}|mstats-bar{Ƌ100%;min-ƈ0;ƅ999px}|mstats-bar.cost{$#ff9800}|mstats-bar.hit{$#34a853}|mstats-bar.value{$#a142f4}|mstats-seg{Ƌ100%;min-ƈ0}|mstats-seg.in{$`state-business-primary)}|mstats-seg.cache{$#ff9800}|mstats-seg.out{$#34a853}|mstats-val{Ɗ;Ƈ`label-secondary)}|mstats-legend{ƆƗ12px;?10px;Ƈ`label-tertiary);Ɵ2px 0 4px}|mstats-dot{ƕinline-block;ƈ8px;Ƌ8px;ƅ2px;margin-ǃ3px}|mstats-note{ƚ10px;?10px;line-Ƌ1.6;Ƈ`label-tertiary)}|match-row{Ɔ&;Ɨ8px;ƌ3px 0;?12px;ƙ}|match-row |input{Ƨ1;min-ƈ160px}|budget-controls{ƕgrid;Ɣrepeat(auto-fit,minmax(min(180px,100%),1fr));Ɨ12px}|bbox{ƘƓ`border-l1);ƅ12px;ƌ8px 10px;$`bg-layer-1);ƆƉƗ6px;min-ƈ148px;ƒ}|bbox.rail{ƌ6px;min-ƈ0;ƈ40px;&;Ƒcenter;ƅ10px}|bbox.warn{border-Ƈ`state-warn-primary)}|bbox.over{border-Ƈ`state-error-primary)}|bbox-head{Ɔ&;Ƒspace-between;Ɨ8px}|bbox-label,|bbox-pct{?12px;ƍ;Ƈ`label-primary)}|bbox.warn |bbox-pct{Ƈ`state-warn-primary)}|bbox.over |bbox-pct{Ƈ`state-error-primary)}|bbox-bar{Ƌ6px;ƅ999px;$`bg-layer-3);Ǝ}|bbox-bar.segments{ƆƋ8px}|bbox-bar.segments |bbox-fill{ƛ;ƅ0;Ƌ100%}|bbox-bar.segments |bbox-fill:first-child{ƅ999px 0 0 999px}|bbox-bar.segments |bbox-seg-today{ƛ;Ƌ100%;$#ff9800}|bbox-bar.segments |bbox-seg-spent{ƛ;Ƌ100%;$`interactive-bg-hover);ƅ0 999px 999px 0}|bbox-bar.segments.rev |bbox-fill:first-child,|bbox-bar.segments.rev |bbox-seg-today:first-child{ƅ999px 0 0 999px}|bbox-bar.segments.rev |bbox-fill,|bbox-bar.segments.rev |bbox-fill:last-child,|bbox-bar.segments.rev |bbox-seg-today:last-child,|bbox-bar.segments.rev |bbox-seg-spent:last-child{ƅ0 999px 999px 0}|bbox-bar.segments.rev |bbox-seg-spent{ƅ0}|dir-row{Ɔ&;Ɨ8px;ƚ6px}|dir-label{Ƨ1 1 40%;?12px;Ƈ`label-secondary)}|dir-row |input{Ƨ1 1 60%;ƈauto}|bbox-fill{Ƌ100%;ƅ999px;$`state-business-primary)}|balance-name{ƕinline-flex;&;Ɨ4px;min-ƈ0;Ơ}|model-costs{?12px}|model-costs |bal-label{Ɗ}|model-top{Ɨ4px;max-ƈ180px;Ǝ;Ə}|model-costs |collapse-h{min-ƈ0;ƈ100%;Ɗ}|model-costs |bbox-bar{ƚ3px}|bal-label{min-ƈ0;Ǝ;Ə}|bal-amt{margin-ưauto;ơright;ƴ}|bbox-pct|bal-amt{Ƈ`state-business-primary)}|bal-link{ƛ;ƕinline-flex;&;Ƒcenter;ƌ2px;ƅ4px;?12px;line-Ƌ16px;Ƈ`label-tertiary);Džnone;Ʋnone}|bal-link:hover{Ƈ`brand-primary);$`interactive-bg-hover)}|bal-link:focus-visible{ƣ0 0 0 2px `brand-primary)}|bbox.warn |bbox-fill,|bbox |bbox-section.warn |bbox-fill,|bbox |mm-row.warn |bbox-fill,|budget-fill.warn{$`state-warn-primary)}|bbox.over |bbox-fill,|bbox-section.over |bbox-fill,|mm-row.over |bbox-fill,|budget-fill.over{$`state-error-primary)}|bbox-line{?12px;Ƈ`label-tertiary)}|bbox-rail{?11px;ƍ;Ƈ`label-primary)}|bbox.warn |bbox-pct,|bbox.warn |bbox-rail,|bbox |bbox-section.warn |bbox-pct,|bbox |mm-row.warn |bbox-pct,|mm-row.warn |bbox-label,|corner-chip.warn,|qchip.warn,|simple-summary.warn{Ƈ`state-warn-primary)}|bbox.over |bbox-pct,|bbox.over |bbox-rail,|bbox-section.over |bbox-pct,|mm-row.over |bbox-pct,|mm-row.over |bbox-label,|corner-chip.over,|qchip.over,|simple-summary.over{Ƈ`state-error-primary)}|bbox-pair{ƆƉƗ0;ƌ2px 10px}|bbox-pair |bbox-section{ƆƉƗ4px;ƌ4px 0}|bbox-pair |bbox-bar{Ƌ4px}|bbox-divider{Ƌ1px;$`border-l1);Ɵ0}|bbox.clickable,|foot.clickable{Ɩ}|bbox.ǂhover{border-Ƈ`state-business-primary)}|bbox.ǂfocus-visible,|foot.ǂfocus-visible{Ʋǁ`state-business-primary);Ƹ1px}@keyframes cm-click-refresh-pulse{0%,to{Ʊ.55}50%{Ʊ1}}|bbox.clickable.busy,|foot.clickable.busy{Ǐcm-click-refresh-pulse 1.1s ease-in-out 2;njprogress}|mm{ƌ8px 10px;Ɨ4px}|mm-title{?12px;ƍ;Ƈ`label-primary)}|mm-reset{?11px;Ƈ`label-tertiary);Ʀ1/-1}|codex-head>|mm-title{min-ƈ0;Ǝ;Ə;Ɗ}|codex-resets{ƛ;ơright}|codex-resets>span{ƕblock}|footer-stack.compact |bbox[data-cm-display=codex]{grid:auto/1fr}|bbox.rail[data-cm-display=codex] |bbox-rail{max-ƈ100%;Ơ;ơcenter;?10px}|gw-switcher{Ɩ;ƭ;?11px;ƌ1px 6px;ƅ999px;ƘƓ`border-l1);$`bg-layer-2);Ƈ`label-secondary)}|gw-switcher:hover{$`interactive-bg-hover);Ƈ`label-primary)}|gw-sub{?11px;Ƈ`label-tertiary);Ǝ;Ə;Ɗ}|mm-row{Ɔ&;Ɨ8px;ƌ2px 0}|mm-sub{?11px;line-Ƌ16px;Ɲ4px;Ƈ`label-tertiary)}|mm-sub.warn{Ɲ0;Ƈ`state-warn-primary)}|mm-row |bbox-label{ƛ;ƈauto;min-ƈ22px;max-ƈ115px;Ʃ400;Ƈ`label-secondary);Ɛ;Ɗ;Ǝ;Ə;word-break:keep-all}|mm-row |bbox-bar{Ƨ1;min-ƈ40px;Ƌ6px}|mm-row |bbox-pct{ƛ;min-ƈ2.4em;ơright;Ɛ}|mm-row.wide |bbox-label{ƈauto;max-ƈ64px;Ƨ0 1 auto;Ɗ;Ǝ;Ə}|mm-row.wide |mm-text{Ƨ1;min-ƈ0;?12px;Ƈ`label-secondary);ơright;Ɛ;Ɗ;Ǝ;Ə}|bal-line{?13px;Ƈ`label-secondary)}|bal-line.warn{Ƈ`state-warn-primary,#b45309)}:has(>|footer-stack),:has(>[data-slot="sidebar.footer.action"]>|footer-stack){ƙ;Ƨ0 0 auto;Ƌauto;min-Ƌ0;align-NJflex-start}:has(>div>[data-slot="sidebar.footer.action"]>|footer-stack){Ƨ0 0 auto;Ƌauto;min-Ƌ0}:has(>|footer-stack.rail),:has(>[data-slot="sidebar.footer.action"]>|footer-stack.rail){ƉƵ&;Ɨ6px}|footer-stack{Ɔƛ;ǒ-1;ƉƗ6px;ƈ100%;min-ƈ0;max-ƈ100%;Njstretch;ƒ}|footer-stack.rail{&;ǒ1}|footer-stack |bbox{ƈ100%;min-ƈ0}|footer-stack |foot{ƈ100%;ƒ}|footer-stack |foot:not(|foot-rail){Ƒspace-between}|model-costs |collapse-h{ƈ100%}|model-costs |collapse-h>|bal-amt{margin-ưauto}|footer-stack.compact |bbox{ƕgrid;Ɣrepeat(2,minmax(0,1fr));column-Ɨ12px;row-Ɨ2px;&}|footer-stack.compact |bbox>*{Ʀ1/-1}|footer-stack.compact |bbox>|mm-row:not(|mm-title){Ʀauto}|footer-stack.compact |mm-row{min-ƈ0;Ɨ4px;flex-wrap:nowrap}|footer-stack.compact |mm-row |bbox-label{Ƨ0 1 auto;min-ƈ0;max-ƈ45%;ƈauto}|footer-stack.compact |mm-row |bbox-bar{min-ƈ0;Ƨ1 1 0}|footer-stack.simple{Ɨ0;max-Ƌ38vh;max-Ƌmin(38dvh,320px);ƪƤ;scrollbar-ƈthin;ƘƓ`border-l1);ƅ10px;$`bg-layer-1)}|footer-stack.simple>*{ƴ}|footer-stack.simple:focus-visible{Ʋǁ`state-business-primary);Ƹ2px}|footer-stack.simple |bbox{Ƙ0;ƅ0;ƌ4px 8px;Ɨ2px;$transparent;ƣinset 0 -1px `border-l1)}|footer-stack.simple |mm-title{?11px;line-Ƌ16px;Ɵ0}|footer-stack.simple |mm-row{Ɨ6px;min-Ƌ16px;line-Ƌ16px;Ɵ0;ƌ0}|footer-stack.simple |mm-text{?11px}|footer-stack.simple>|peak-strip,|footer-stack.simple>|peak-classic{Ɵ0;ƌ4px 8px}|simple-summary>span{min-ƈ0;Ɗ;Ǝ;Ə}|footer-stack.simple |bbox-pct{?12px;line-Ƌ18px}|footer-stack.simple |bbox-bar{Ƌ4px}|footer-stack.simple |bbox-line{ƕnone}|footer-stack.simple |foot{Ƌ26px;ƌ0 8px}|footer-stack.simple |peak-classic{ƚ2px;Ɨ2px}|footer-stack.simple |peak-classic-chip{ƌ0 4px;Ƙ0;$transparent}|simple-summary{ƞsticky;ǐƫ1;$`bg-layer-1);ƆƑspace-between;&;Ɨ8px;ƌ5px 8px;?12px;ƍ;ƥƓ`border-l1)}|footer-stack.simple.rail{Ƙ0;$transparent}|footer-stack.simple.rail |bbox{ƌ4px 2px}|footer-stack.simple |peak-rail-track,|footer-stack.simple |peak-rail-classic-track{Ƌ28px}|footer-stack.text-only |bbox-bar{ƕnone}|footer-stack.Ưnot(.rail) |bbox{ƌ4px 8px;Ɨ2px}|footer-stack.Ưnot(.rail) |mm{ƆƷrow;ƙ;Ɨ2px 12px;&}|footer-stack.Ưnot(.rail) |mm>|mm-title,|footer-stack.Ưnot(.rail) |codex-head,|footer-stack.Ưnot(.rail) |mm-reset{Ƨ1 0 100%;min-ƈ0}|footer-stack.Ưnot(.rail) |mm-row:not(|mm-title){Ɨ4px;ƌ0;min-ƈ0;max-ƈ100%}|footer-stack.text-only |mm-row |bbox-label{max-ƈ115px;Ƨ0 1 auto}|footer-stack.text-only |mm-row |bbox-pct{min-ƈ0}@media(max-ƈ640px){|cards,|grid,|budget-controls{Ɣ1fr}}@media(max-ƈ1023px){|section{Ɲcalc(16px + env(safe-area-inset-bottom))}|cards,|overview-grid>|cards,|grid,|budget-controls{Ɣ1fr;Ɨ8px}|card{ƌ10px 12px}|card-value{?17px}|card-sub,|bal-line,|bal-amt{Ơ}|buttons,|toolbar,|row,|budget-head{ƙ}|btn,|tab,|foot,|corner-chip{min-Ƌ36px;Ƌauto}|tabs{ƵLJ}|tab{ƛ}|qstrip{ƌ0 8px}|qguide{max-ƈcalc(100vw - 24px);džvar(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,Ƣ) + 10px + env(safe-area-inset-top)))}|peak-alert{max-ƈcalc(100vw - 24px)}|peak-alert|peak-alert-corner{ǃ12px;ư12px;ƽcalc(12px + env(safe-area-inset-bottom));ƈauto}|footer-stack{Ɲenv(safe-area-inset-bottom)}|stat-dialog-body{ƌ14px;Ɲcalc(14px + env(safe-area-inset-bottom))}}body[data-dsh-pocket-layout=mobile] :is(|cards,|overview-grid>|cards,|grid,|budget-controls){Ɣ1fr;Ɨ8px}body[data-dsh-pocket-layout=mobile] |tabs{ƵLJ}body[data-dsh-pocket-layout=mobile] |footer-stack{Ɲenv(safe-area-inset-bottom)}body[data-dsh-pocket-layout=mobile] :is(|peak-alert,|qguide){max-ƈcalc(100vw - 24px)}body{DŽ#fff}body[data-ds-dark-theme],body[data-theme=dark],html[data-theme=dark] body{DŽ#151517}|section,|stat-dialog,|qguide,|peak-alert,|footer-stack.simple{$ƻ;$rgb(from `bg-layer-2,`bg-base,#fff)) r g b / 1)}|today-values{ƕinline-flex;ƙ;Ƒflex-end;Ɨ2px 8px;min-ƈ0;max-ƈ100%}|today-values>span{Ɗ}|today-values[data-both=true]>[data-cm-today=tokens]{?11px;Ƈ`label-secondary)}|simple-summary{$ƻ;$rgb(from `bg-layer-1,`bg-base,#fff)) r g b / 1)}|plan-gauges{Ʀ1/-1;ƕgrid;Ɣrepeat(auto-fit,minmax(52px,1fr));Ɨ6px}|plan-gauges |mm-row{ƕgrid;Ɣ1fr;Ɨ0;justify-items:center;Ɵ0;ƌ0;Ƈ`state-business-primary,#4b7ff5)}|plan-gauges svg{ƺƈ100%;max-ƈ64px}|plan-gauges |bbox-pct{ƺƾcenter;ơcenter;ƜtranslateY(-3px);?12px}|plan-gauges |bbox-label{ƺƾend;Ɲ8%;max-ƈ100%;ơcenter;Ǝ;Ə}|plan-gauges |mm-row:not(:has(svg)){Ʀ1/-1;ƕflex}|plan-gauges .warn{Ƈ`state-warn-primary,#d97706)}|plan-gauges .over{Ƈ`state-error-primary,#dc2626)}'.replace(/[`|$&?ƀ-ǿ]/g,e=>cs[e.charCodeAt(0)>=384?e.charCodeAt(0)-384:"`|$&?".indexOf(e)]),_a="dsh-cost-meter/client.css";if(typeof document<"u"&&document.head!==void 0){const e=document.querySelector("style[data-plugin-css="+JSON.stringify(_a)+"]");if(e?.textContent!==Qa){const t=e??document.createElement("style");t.dataset.plugin="dsh-cost-meter",t.dataset.pluginCss=_a,t.textContent=Qa,e===null&&document.head.appendChild(t)}}const us="Balance|balance|额度|session|Plan|Label|models|quota|credential|显示|amount|余额|custom|Stats|费用|价格|peak|coding|模型|Source|gateway|time|tokens|会话|model|refresh|Quota|自动|price|history|刷新|官方|输入|official|weekends and Chinese public holidays are|Refresh|Alert|DeepSeek|Token|position|缓存|message|remaining|display|the|用量|金额|Title|自定义|budget|period|sidebar|凭据|调用|input|Coding|Failed|Peak|output|source|中国公众假期全天谷价|同步|失败|峰时高价时段显著提示|时段|计费|预算|Credits|Sidebar|Note|OpenCode Go|cache|calls|currency|usage|Budget|今日|峰时|已用|credits|plan|pricing|以同一系统账号运行|Remaining|Settings|历史|图框详细信息|Display|Monthly|details|WorkBuddy2API|分钟|当前|留空|Today|cost|interval|optional|侧边栏|and|DescribeBillingAccount|Enable|account|failed|位置|保存|剩余|小时|币种|数据|日期|本地|记录|读取|谷时|账本|输出|month|total|Cost|API|Cache|Codex|Hint|Official|Placeholder|Strip includes|ledger|启用|History|Preview|browser|current|minutes|右下角|浏览器|设置页|automatically|rates|Credit|OpenDesign|Weekly|Window|YYYY-MM-DD|auth login|expression|used|volcengine|全部|可选|峰谷|提示|时间|更新|本月|查询|添加|订阅|设置|请求|谷价|进入|配置|默认|Currency|Interval|Multiply|Session|Short|default|is an upper bound|never echoed back|workspace ID|法定假日|逗号分隔|AccessKey|Custom|Output|WorkBuddy|corner|主机|人民币|估算|命中|密钥|来源|清除|点击|登录|积分|累计|账号|重置|隐藏|Total|codex|empty|local|not queried|today|comma-separated|data|date|deepseek-v4-pro|only|qwen|导入安装前|开始对话后|汇总在这里|Chinese|Compact|confirm|granted|holiday|unknown|Configured|Credential|Entering|Input|Provider|Remove|Unreported|Volcengine|built-in table|configured|enable|enough samples|external|for this|opendesign|override|request Cookie|this|token|toppedUp|使用|侧栏|名称|周期|周末|填写|开启|提醒|明细|暂无|确认|统计|间隔|Alibaba Cloud|Authorization|subscriptions|take priority|Anthropic|Empty|Key|Model|Reset|Strip|apply|countdown|effective|estimates|including|qianwenai|工作区|框上方|横条含|白名单|Bottom-right|Compensation|Content-Type|Cookie|Default|JSON|Loading|Method|MiniMax|Organization|Rolling|Show|Target|Volcano|billing|console|from|hitRate|method|notification|rate|records|same OS user|subscription|weekend|匹配|单价|后续|图框|安装|导入|展开|恢复|按自然月|排行加载|火山引擎|环境变量|移除|赠送|采样区间|预览|Antigravity|Clear|Click|Composer|Flash|Local|Match|Position|SiliconFlow|This|Unavailable|Unsupported|Usage|application|auto-detect|bailian-cli|composer|environment|estimate|full-window|group|host|matching|max-preview|pre-install|provider|qianwen-cli|settings|unavailable|Add|DSH|are|Auto-match|Claude Pro|Cline Pass|Import|Legacy|Management|Notice|OpenAI|OpenRouter|Rhythm|Used|aggregated|billed|equivalent|historical|hours soon|legacy|multiplier|percentage|status|to restore|window|上限|下方|优先|倍率|全天|关闭|内置|加载|区间|取消|后重|基础|当日|总额|手动|支持|日志|未知|本周|渠道|滚动|生效|端口|等值|美元|覆盖|计价|这里|采样|页面|Account|Allowed|Bailian|Billing|Convert|Factory|Headers|Invalid|Queried|Start|Unknown|Weekend|address|click|factory|headers|hours|include|range|ranking|restore|summary|Auto|Direction|Estimated|Kimi Code|Rank|Sort|Topped-up|Unlimited|all|auto-sync|open|page|precision|reasoning|subagents|sync|unmatched|中复制|占位符|子代理|性价比|抵扣率|控制台|未上报|标题栏|百分比|知道了|起始日|这一项|阿里云|Base URL|Class|Corner|Daily|Detail|DevTools|Disabled|External|Gemini|HTTPS|Ledger|Line|Moonshot|Overview|Qwen|Recent|Saving|Security|Selected|Status|Sync|Toggle|actual|blank to|calendar|card|clear|combined|count|entering|fields|first|follow|import|language|limit|multiply|notice|reads|recorded|remove|required|requires|reset|sample|snapshot|spend|start|store|subtract|table|use|with|不会|不计|保留|修改|充值|写入|分别|切换|删除|到期|勾选|北京|千问|发现|发送|只写|可用|可能|地址|外部|字段|实际|对账|弹窗|影响|快照|折算|推理|文档|方向|时区|格式|每日|汇率|满窗|用于|精度|组织|编辑|账户|路径|选择|All|Off|key|Amounts|Base|Beijing|Both|Bundled|ChatGPT|Confirm|Control|English|Extract|Fetched|General|Granted|HTTP|Include|Kimi|Minimax|Missing|Percent|Pricing|Request|Save|Section|Summary|applies|catalog|changes|channel|dock|earlier|expires|for|loading|minimax|missing|name|percent|plugins|qianwen|reading|replace|when|Badge|Enter|Error|Guide|Limit|Login|Price|Query|ROUTE|Rates|Spent|Style|UTC|alert|entry|query|scnet|until|value|Active|Amount|Body|Date|Header|Hidden|Minute|Not|OPENAI|Origin|Period|Public|Remain|Sample|Secret|Switch|Time|USD|active|aliyun|auto|cancel|change|divide|expiry|flat|full|grants|here|hidden|hide|logs|not|origin|port|reason|remain|select|studio|your|上界|不足|专用|个人|中文|为准|以及|例如|允许|入口|其他|包含|卡片|即可|即将|厂商|原因|发生|可在|同名|后可|后的|回放|回显|域名|填入|处于|套餐|对应|工具|平价|应用|底部|开关|手工|挂载|按量|按钮|换算|授权|放行|早期|智谱|最多|最近|月度|权限|条数|查看|标准|样本|档位|比例|状态|界面|百炼|窗口|类型|缺失|网关|花费|英文|获取|表外|规则|语言|请在|账单|跟随|过期|通知|重试|Hit|box|col|CLI|CNY|Hide|KEY|Last|Lock|Unit|VAR|When|bar|day|docs|left|off|pct|read|saved|stay|that|tier|tok|will|work|yet|Pro|tab|Edit|Open|The|Top|back|each|less|new|old|over|per|save|show|zone|Use|its|low|min".split("|"),Ha=e=>e.replace(/[ƀ-߿]/g,t=>us[t.charCodeAt(0)-384]),ds=Ha("ƃ͈|ƃ͈ɒ|ƃǷɒ|Ƈ̦|ǑCnyǻ|ƁϐƸ|ɖϋ|Ɓ|ơƀ|Ƈʸ|ƇDŽǔ|ƇDŽʸ|Ƈǔʸ|ƇΜʼs|ϘƸ|reconcileƅ|ɔѬpedUp|upɊdAt|ƱOf|ȒOf|ǵɂ|Ʊ|ɇǷƯ|ɇƦsƯ|Ɩѕ|LjƦs|ǵǷ|ǶǷ|ɇ|ƳǞMetric|ƳǞǷ|ƳǞƦs|ƲDay|ƲMonth|ƲΜ|ƲȰRange|noȁ|юϟ|юÇs|юInTok|юǹTok|юOutTok|юǷ|noȧsǞ|юȧ|ɡNj|Ʊϝƅ|ƱϦƅ|ͬϟ|endϟ|̛Text|Ʊ̓Dž|Ʊ͐|Ѳύ|nearύ|˥ɿ|ȩF̧ѭ|ͥ|ѢΠ|ѢΝƹ|Ѣƹ|ƁApiɾ|ƁƓChoice|ƁƓ̟|ƁƓ̉|ƁƓǻ|Ɓ͈|ƁϐƸǻ|Ɓϣ̑|Ǧƀ|ƙing|ƙƀ|ƌƀƯ|ƌƀ˒|ɩ˞ƀ˒|ɩ˞ƀDž|ϯƀ˒|ϯƀDž|ƌƀConfigDž|ƌƀƅZh|ƌƀƅEn|ƌƀUrl|ƌƀUrlǻ|ƌƀHttp|ѥBuddyƀ˒|ѥBuddyƀDž|ƌƀʓ|ƌƀ̏|ƌƀϞ|ƌƀϞDž|ƌƀΨ|ƌƀǗƅ|ƌƀƣȥ|ƌƀѕƅ|ƌƀ̍|ƌƀ̍Dž|ƁBarǓ|ƁBarǞ|ƁBarϓ|ј̠sƯ|ј̠Ǔ|ј̠˟|ƁNjCapƅ|ƁNoCap|̩Aiȋ˒|̩Aiȋϝ|̩Aiȋ̒|̩AiȋExpiry|̩Aiȋ̌|̩AiȋDž|̩Aiȋζ|ƌƀ̐Json|ƌƀ̏VarDž|ƌƀ̊Hosts|ƌƀ̊Hostsǻ|ƌƀɘsƯ|ƌƀɘsǻ|ƌƀNoǽs|ɡ|ƌƀ͈|ƌƀǓ|ƙȰƀ|goƚƯ|goƚRowƅ|goȎʖ|goȎȍ|goȎǘ|goʀAt|ͨRѮed|ͨDays|ͨHours|ͨϢs|ƇʀInHm|ƇʀInM|ƇʀAt|ƇForecastь|Ƈ˟|ƇǓ|goƚα|goƚΩAt|goƚǗƅ|goƚƣȥƅ|goƚɾƅ|goMainƅ|góƅ|ƈɗOf|ƈϣɗ|ƈδ|ƈѩ|ƈʶ|ƈ͍|ƈɚǻ|secretMigrationPending|Ʊ́ƅ|ƙGoƚ|goƚϣ̑|ƑƄɼ|ƑƄZai|zaiƄɾƅ|zaiƄɾΰ|agyLinkƚ˒|ƑƄί|ƑƄίƯ|πϥ|πϥDž|ƑƄϨ5h|ƑƄϨ7d|ƁRechargeLink|ɃƚƯ|Ƀƚǥ|ɃƚFive|ɃƚWeek|Ƀƚʀ|Ƀƚʿ|Ƀƚǥd|ɃƚDŽ|Ƀƚʁ|̚SubagentǷ|Ɣƚɽ|ƑƄǗƅ|ƑƄɾƅ|ƑƄƣȥƅ|ƙƷƄ|loginƷƄ|loggingIn|ƑƄϣ̑|ƔƚƯ|ƔƓ˒|ƔƓƅ|ƔƓΠURL|ƔƓǗ|ƔƓƣȥ|ƔƓΜowlist|ƔƓɘ|ƔƓ͐|ƔƓˀ|ƔƓ̓|ƔƓNỏs|ƔƓΩAt|Ɣϫ̉|ƔOnlyͅ|ƙ|ƇǥFirst|ƇƣReady|Ƈɜ|ƇεDž|goƚ̓Dž|ȳƅ|ȳGoʖ|ȳGoȍ|ȳGoǘ|ȳNj|goȨʖ|goȨȍ|goȨǘ|goȨ̀|ƱȨ|ǿReadƸ|φ͇|ǿʿ|̮Ƹ|Ɲʶed|͗Ƹ|ƐΝ|ƐϣEffective|ƐϜ|Ɛ˛|ќƹϜ|ʤΜΝƹ|ʤChip|ʤȨ|ɕΜΝƹ|ɕChip|ɕȨ|ƐHoliљsƅ|ʤRuleDž|ƐȨ|ќƹȨ|Ɛϔƅ|Ɛϔɒ|Ɛϔ̾ic|ƐƤƅ|ƐƤAheadƅ|ƐƤʘƅ|ƐƤʘƹ|ƐƤʘΝƹ|ƐƤʘ΢|ƐƤƯƹ|ƐƤƯΝƹ|ƐƤϞ|ƐƤPhaseƹ|ƐƤPhaseΝƹ|ƐƤBtn|ƐƤωƹ|ƐƤωΝƹ|ƐƤʼƅ|ƐƤʼ̿|ƐƤʼCenter|ƐƤWebϣifyƅ|ƐƤWebϣifyǻ|ƐƤȂƅ|ƐƤȂƹ|ƐƤȂΝƹ|ƐƤȂTag|ƐPanelƯ|Ɛ˛ϡǻ|ˉΪ|ˉMoney|ˉDŽ|ƳSimple|closeό|̝Ϗʻes|ͥϏʻǻ|ˉ̿|ˉ́|unmountBtn|θUnƜd|Ɯєω|Ɯєǻ|ƜєRelease|ƘƍƯ|ƆƯ|ƆCount|ƆOƬr|Ɔ_ɡd|Ɔ_ȩѪ|Ɔ_remember|Ɔ_Ɩ|Ɔ_sh˔s|Ɔ_λ|Ɔ_Ʋ|Ɔ_̞|Ɔ_Ƨ|Ɔ_topN|Ɔ_ƙSeconds|Ɔɂ|ƆѬ|ƆFirst|ƆAfter|Ɔѓ|ƘƍǞ|Ƙƍȁ|ƘƍǷH|ƘƍƦsH|ƘƍьH|Ƙƍьɝ|ƘƍьɝTip|ƘƍValueH|Ƙƍɚ|Ƙƍǹ|Ƙƍȱ|Ƙƍɽ|ƘƍBlended|ƘƍDž|Ƙƍ˙|ƃ͈Split|ƃ͈Splitɒ|ǐƍƯ|ǐƍɽ|ǐƍȎ|ǐƍα|ǐƍʺ|ǐƍPer1|ǐƍFull|ǐƍʀs|ǐƍʓϩ|ǐƍʓLive|ǐƍʓNone|ǐƍʓϩAt|ǐƍConfidenceLow|ǐƍCurveƯ|ǐƍ̀|ǐƍȍ|ǐƍǘ|ǐƍCurveɽ|ǐƍBarTip|ǐƍDž|ʚ̾ƅ|ʚ̾Ƅ|ʚ̟̾|ʚ̾Api|ƜȦSepaʠ|ƜȦǻ|ƜȦΜ|ƜȦSingle|ƜȦ̐|Ɯʻƅ|Ɯʻ̟|ƜʻExact|ƜʻDž|ɦʘʐ|ɦɜ|̯Ư|̯ǻ|sectionƅ|NJεƅ|ϵɚ|ϵǹd|ϵǹWrite|LJWriteF̧ѭ|ϵȱ|ƑƄή|ƑƄѪrouter|ƑƄSiliconfѹ|ƑƄCommǣcode|ƑƄClinepass|ƑƄScnet|ƑƄɞ|ƑƄ͋|ƑƄMimo|ƑƄBaidu|Ƈ˟ɂ|wbT|wbH|ƑƄ̎|ƑƄѪdesign|ɥWorkspace|ɥDž|ɥώ|̗Pool|̗Pool΢|̗Org|mimoȎƄ|mimoȎʍ|ƑƄȎƀ|ɍƓ|ɍƓʺ|ɍƓCli|ɍƓ̋|ɍCliDž|ɍ̋Dž|ɍƄǃƅ|ɍƄ̒ƅ|ɍϒƅ|ɍϒɿǽ|ɍRateDraftDž|ɍϒ˒|ɍʺDž|ϙƄǃƅ|ϙƄ̒ƅ|ϙʺDž|ȓȯIdƅ|ȓϪȯƅ|ȓȯǽ|ȓϪǽ|ʃHoursOnly|ʃHourϢ|ʃϢ|nextΝƹIn|nextƹIn|Ɛζ|noƹȎs|ɖ|͖Ǟ|͖Month|͖ɂ|͖ɂSub|ɣˁ|͘ˁ|ɣStale|ɣȁ|͖sFootϼe|ƕѶǻ|ɇȧs|ƝExpǣǻ|Ɲȧsʒ|ƝNoȧs|Ɲȧsϋ|ƃ̣Ư|ƃ̣ǻ|ƃ̣ɽ|ƃ̣ʒ|ƃ̣ϋ|ƃ̣ύ|͖s͒Ƅɂ|͖s͒Ƅɂǻ|ϺȧǷϠ|ϺȧǷDock|ϺTurnǷ|ƃ̣̤|ƃ̤ǷDesc|ƃ̤ǷAsc|ƃ̤ϬDesc|ƃ̤ϬAsc|ƃ̤͌|Ɲ|NJƯ|NJɂ|NJDay|NJɽ|Ѩ͊|Ѩƚs|Ѩˁ|Ѩβ|ѨǗ|ƝDataƯ|Ƨƅ|ƧDock|ƧϠ|ќ|ƇʁʗNj|ƇʁʗGo|ƇʁʗƄs|̪LoadϬout|Ɓϡ|Ɓ͒|̖Toƣ|ƁʷόϞ|ƁʷόOk|Ƴƅ|ƳOn|ljƅ|ʠƅ|decimalsƅ|ƁǗƅ|ƁDŽ|Ɓǔ|Ɓ΢|ƙȥƅ|Ɛǥdƅ|Ɛ˛ƅ|ƜTableƯ|ǑȤƅ|ǑȤUsd|ǑȤCny|ǑȤDž|ƜTableDž|ɊdϏDž|ȩɿId|Ѱɿǽ|addɿ|ɉ͑|saving|ϰδƸ|ϰδdAt|ϰδǻ|ɓFetch|ʂ|ϱ|̮FromDocs|̮ScopeDž|ɓʀ|͞˙|ɓ˘˙|˥˘Ƹ|˥˘Dž|ɓʶ|͗Μȁ|last͑|never͑ed|ƻ|ƻǼ|ƻΣ|͟ƅ|Ʌe̟|rpcƸ|rpc͑Ƹ|rpcƀƸ").split("|"),Ie=Object.fromEntries([["zh",'本Ɨ {Ɗ} · ȷ {ʝ} · Ơ {ƶ} · ƨ {LJ} · Ǵ {ƺ}|本Ɨ {Ɗ}|仅ƉƮ|无限制|ǜȵƮ来自̃Ə × Γ {ʠ}。对照Ɵȵч,请Λ ѐ,再ƽƏ;ƽ仅ΊʧƵ。|Ƌțƾ:{Ʃ}|˼错误|Ƌ|ƥ Ƌ|Ơʉ|ɬ和Ȉ|ɬ和Ơʉ|Ȉ和Ơʉ|ȔǨ|țƾ|ƟƋ变动与ǯdz交叉Έ(偏差超阈时ȗ)|ʲ {ɔ} · Ͷ {ɪ}|șȘ {ƕ}|ǂ({Ʋ})|ǎ {Ȓ} / {Ɗ}|Ț {ǵ} · Ⱦ {Ƕ}|ǂ|njƎ(按ǜ价表计算)|nj Ʀ ƭ|Ɩ|Ƶ {Lj} 次 · Ơ {ƶ} · ƨ {LJ} · Ǵ {ƺ}|Ț {Ɗ}|Ⱦ {Ɗ}|nj|ǢnjƉ|Ǝ|Ʀ ƭ|nj|Ț|Ⱦ|ư˳|ɴǕǰ。ɏ,Ǝ将按天ɐ。|Ǯ|Ƶ|Ơ ѣ|ƨ ѣ|Ǵ ѣ|Ǝ|njɴƗǰ。|Ɨ|Ȁǂ|ǂƂ(按ƉǬ)|ǂɮ|开始Ǯ|结束Ǯ(ǝ = nj)|ɶ˳:{̛}|Ȁǂ后ƉƂ、ǎƮ及и(按ƉǬЪ);ȕnj、Ț、Ⱦ或ưɮ。|{Ʋ}ǂ {Ɗ} · ǎ {Ȓ} · {ѝ}%|(已超出)|(接近˫)|旧ƒ|ȣ回退|ʱ|˶|Dz|Ǎ|ƋІ Ǹ ɾ|Ƌȹ|ƛ(ƒ ɾ ˭)|˓ ȼ钱包|手选ȿ或І ɾ ˭。|总Ƌ {Ƕ} · ʲ {ɔ} · Ͷ {ɪ} · ș于 {ƕ}|Ƌțƾ:{Ʃ}|未țƋ|ƟΙƋ|ƞ中…|ƞƋ|ư ɛ Ƌ|ȜȢ|Ȝ Ʀ ˞ Ƌ|Ɖ官网Ι页的ȵ΂Ƌ。ȼ ɩrhythm.Ђ,在ȇ开发者С → 网络̰Ιȟ的 ʏ,或在存储 / У̰ tr_ƃ 值,Нˬƴ并Ȁ。ʏ 仅存 ˓ ƴ库;щ˵新ɰ。|Ȝ; / ̼Ƌ|ț̼中国站΂金。RAM ȯ 需 bss:Ǥ в。前两项必填;STS 才需 ͎ Ʀ。ȸ存ƴ库。|extract ˺点Κ、数值、嵌套 add/ͮ/͡/ϳ/Ѻ/max/sum,Њ ȑ 算式。Ћ ƪ: {"ȑ":"(ɉ.Ƕ - ɉ.Ȓ) / 500000"}。Ά名和Ъи按接口ɰ;已ƭ应填 ͫ。|Јɭ|сɭ|ȟ URL|˺ ͆、本机 ά,Њ /τ/… 相对Κ(ƛш ˓ ́)。|Ќ非回环 ά(ƴ明文传输;须将准确的 ȴ:́ 加入ʋ)|+ ǚ Ƚ|ǚ 预设DZ活跃ȿ池ǪȽ,ɫ管理后台 X-AdѺ-Ʀ(不是ƒ Ǹ ɾ)。请ɰ·΄与́;令牌щ后șƴ。|ȟ方法|ȟ头 (ʑ)|ȟ体 (ʑ)|ǝ不΀;ʑ 原文ǩ并΀。ȣ ʎ 为 ˂/json,Жȟ头̄。|解析ф (ʑ)|ưƋƉǨ|ƞɷ (Ǜ)|Ƌ原Ǭ|按ƉǬΌ(ϭ Ƌ)|ɫƉΓ与Ζ;ƋǬ保持端点原Ǭ。ЎǬ及Ƚ不Ό。|Ƌ {Ɗ}|˷ǎ {Ɗ}|ǎ {Ɗ}|进度条Ώ|ǪΏ(满 → 空)|ǎΏ(空 → 满)|Ƃ˫ (ȕ)|未设ǂ˫,仅ƉƟƋ。|Ȝ ˜ Ǹ ʲƂ|ʲƮ(ϭ)|̀Ǯ(ϕ)|ͻǮ(ϕ)|д ˜ ƟƂ|用ʲƮ减去本ɮ的Η Ǹ ƎȶǪƂ。起止Ǯ从ƟƂ̈ɰ,ͻ˷ 00:00 ϕ 归零。|˸ {Ƕ} · ΗƎ {Ȓ} · 预估Ǫ {ƪ} · ϕ ͻ {ϴ}|ʑ Α无效|{{і_NAME}} 从ƴ库或ʰDZ。<ϑ>_Ǹ_ђ 中 ϑ 为大写 ɛ ID,符号改下划线,如 ̩ai→Ϥ_Ǹ_ђ。З共用ȸ。|ƴʋ (Ȯ)|ȟ头带ȸ时仅Ь列表内ȴ,ǝ则Ь并警告,防ʪ他人Ȣ外带ȸ。|ƴƠ|为上方 {{і}} ̱存入ȸ(write-Ɍ,΁ƴ库,不Л):|ȟ头还没有 {{і}} ̱:Н如 "ɹ": "Be˔r {{MY_Ǹ_ђ}}" 后̆会出现ƴƠ框。|Ȁ|Ǫ {ƪ} · ǎ {ͫ} / Ƃ {maxNj} · ș于 {ƕ}|Ǫ {Ɗ}|ƞưƋ|dž ȝƂ|Go|˿ 5 ǫ|˽|Ț|ɀ:{ƕ}|已到ɀȘ|Ǫ {d}天{h}ǫ|Ǫ {h}ǫ{m}分|Ǫ {m}Ǜ|{h} ǫ {m} Ǜ后ɀ|{m} Ǜ后ɀ|{ƕ} ɀ|按本м平均ƭ,预计 {ƕ} 达到˫|ǎ {ѝ}%|Ǫ {ѝ}%|{σ}%|ș于 {ƕ}|Go ƂƉǨ|Go Ƃƞɷ(Ǜ)|dž Ǹ ɾ(ȕ,ǝƛͿ)|Go Ƃ主з|Go ǖ|已Ȣ(ȹ:{ƻ})|未Ȣ|ǩ|Θƴ|Ⱥ|ǩ中…|ȸ只ͷ ˓ ƴ库,不ǩ在dz里,也ͲЛ。|以下ȸ仍在ǯdz,未迁入ƴ库。请导出Рʰ˵启:|ǂǖ|ƞƂ|未țƂ|ɼ(˖/Max)|Z.ai / Ю GLM Ʒ Ƅ|ЮЇ或团队 Ʒ Ƅ Ǹ ɾ|请Ȣ Ʒ Ƅ Ǹ ɾ|Ȝ ʵ Ƃ|ʔ M Ƅ / Ʀ Ƅ|ʔ Ƅ|țМ(͆)|ǝƛΛƟ站点。ɰ后 ɾ 仅发往该М;ɫ可信΄,不含Κ。|5h|7d|д ƥ Ɵƭ与Ͷ|Τ (Ǻ) Ƃ|Ǻ Ƃ未ɱ · 点此ɱ|5h Ƃ|周Ƃ|{ƕ} ɀ|未取得Ƃ,请ɵ所选ǭ源已ȼ;Ȼы|Ɖ Ǻ Ƃ(需ȼ Ǻ 插件)|在ɬƉ Ǻ Ƃ|在Ơ区Ɖ Ǻ Ƃ|本ƗƎЏ̲|ɴƂǭ|ƉǨ|Ǹ ɾ(ȕ,ǝƛͿ)|ƞɷ(Ǜ)|ƞ|ȼ|ȼ中…|未țƂ|яѧxyǸ пƂ|Ȝȹ|ȹɭ|̽|ƉǨ|ƞɷ(Ǜ)|ƴʋ(ȴ:́,Ȯ)|˚ ɾ(΁)|й|不˺的 ɛ|˼|未Ϳȿ|抓取于 {ƕ}|͹ȿ (ǜ: {Ǧ})|只Ɖ ͅ Ƃ|ƞ|先ͼȀ̻|Ȁ并ǩƉǨИƞ|ͺ|ͼȀ后会排到最上面;点ɭ可ʫ该项自己的Ȣ。ưƋЯ 8 条,пȹЯ 4 条。|ɱ后DZ dž 的˿ 5 ǫ、周、月Ƃ,Ɖ在ɬ、Ȉ及Ȇ;无ȝ时ȗД。|ȆƉ(λ)|˿ 5 ǫƂ|˽Ƃ|ȚƂ|ǂǎ%|5h|周|月|日|ǂ|dzDZƾ:{Ʃ}|正在DZdz…|dz不΂|ƽƾ:{Ʃ}|Ǖǰ已Ⱥ。|Ⱥƾ:{Ʃ}|Ȗ̅已˰,按˶Əǁ|尚未̀(̀Ș:{ƕ}),ǜ按˶Əǁ|ǜО峰ǀ,按Ǎ价ǁ|ǜ为 ƥ Ǎ高价ǀ,按Ǎ价ǁ|ǜО谷ǀ,按Dz价ǁ|ɯǀ——全Ƞ(周六及周日˯按Dz价ǁ)|ɯǀ——全Ƞ|ɯ全谷|ȭ——˯Ƞ|ȭ——全Ƞ|假日|ȭ(ͽǮ,Ȯ)|自 2026-08-23 ͽȘ 00:00 起,ɯ和Ƽ;调休上班的ɯ仍按Ƞ。|Ǎ|Т|Ȗǀ条样式|简洁(单行紧凑)|经典(分段与胶囊芯片)|峰/谷͹前Ήɲ|提前ɲ(Ǜ,1-30)|ɲн|ȡǍ|ȡDz|峰和谷|ВȡǍ|ВȡDz|约 {ƕ} 后ǁз͹为{phase}价,请注意本ǀƵ成本。|Ǎ|Dz|̹|峰价ɲ|Ƞɲ|ΉǨ|Ȇ|屏幕中心|ƽ΀系统ъ|Х后цȇ΄栏Ќъв,才能在̈最小化/切走时收到ɲ。|ʴΉ|ʴ ȡ峰|ʴ ȡ谷|(ʴ)|Ȗ̅与ȗ|ȗ已Ɂ:需ȀȖ̅并ɱ「ƿ」。|常规|Ʈ与Ǭ|ǢƉ|简化ɬƉ|˰ȗ|ʬ已ʱ的ƒ ({͙})|ʱ会Ⱥ˹映射并Ɂ此行,可ʬ;Ͳͺƭǰ,ʧ按ƛʥф̅。|Ȇ角标|ǖ|˴Ч|未核价|已ư|这个Ə是你˹改过的,ƛƽͲ̄它。|ʬƛƽ|按ƒɶ(ɩ 与Ǝ)|ɬƒр|{n} ƒ|其它|ƉƒрА|ȣʫ|记住ʫй|Ɖ Ʀ|ƉƎ占比条|ȆƉ Ѭ-1 ƒ|ȣɮ|收起摘要|АǨ|ƒ行数(1–10)|ƞɷ(10–60 秒)|ɮ˸与ƒ数|Ѭ-1 ƒ与Ʈ|顶部|Ƌ之后|Ф|nj|近 90 天|Ǝ排行|Ʀ 消耗|ƨȷ率|̶?|长Ƶ无ƨȷ:代理΃ʱƨΆ。Ʈ按全未ȷ计,是Є;可直连核对。|̳ · 每̃ ɩ 数|Ơ|ƨ|Ǵ|该ǀɴƭǭ。|综合ʦ {Ɯ}/M|ȷ率=ƨ读÷(ƨ读+普通Ơ);「̶?」表示ƨΆ΃о,Ʈ为Є。ʦ=Ǝ÷ɩ×1M;̳=ɩ÷Ǝ。|未分ƒ(Эǭ · 按当时ǰǁ)|本Ɨ {Ɗ}(Ǹ)· Ƅ ̂ {ǐϝ} · ȷ {ʝ} · Ơ {ƶ} · ƨ {LJ} · Ǵ {ƺ}|本Ɨ {Ɗ}(Ǹ)· Ƅ ̂ {ǐϝ}|Ʀ Ƅ ƭɶ(每 1% 与Δȶ)|尚无 Ʒ Ƅ Ƃǭ;ц「Ƃ」页ɱ并ƞГ。|м|ǎ %|本ɮ·(ǯdz)|每 1% Ƃ ≈|Δ 100% ≈|ɀ {ƕ}|̇差分|ǜƭΌ|жЅ|{ʞ}(基准 {ƕ})|读数Ζ受限|Ƅ ƭ曲线(按ʳ聚合)|Β|每周|每月|̇Ѕ:至少两次成功ƞ,且Ƃ̸Е变化。|{Ɋ}:Δ估计 ≈ {϶}(每 1% ≈ {ѳ1})· · {Ɩ} / {ǟ} · {Ǡs} 个ʳ|Ʈ是目录价̂;ȝ耗Ƃ,ǂ只计 Ǹ。ȶ仅含 dsh Ƶ;服务端̸含全ȿ。短时жΖ有限;5h ˿,周/月按ǯ日历。|ǁ方式|Ƅ ȝ|ƛ|Ǹ Ш|͸Ȟˮ|可Ơ 2 × 0.8|͵ˮ会ƽ到本ƒȔʦ|仅͵̻的ˮ;˴ͼʬ统一ˮ|请Ơ非负ʦ或乘法,Ћ 2 × 0.8|˼ƒ名ƛʥ|ƛ(去后缀 / 前缀 / 家族相似)|仅精确ʥ|˭ɫ˹指定和˾Ə,ƛ识别Зƒ及Ǯ标签。|ƥ ȣ价|ʱ|待ʥ与˹Ȟ|按˾和ƒ͸Ȟ:ΛƏ表条目、ưƏ,或标记为ǯƒ。ưƏ只Εǜ˾。|Ǝ|ƭ|Ơ|ƨDZ|ƨͷ|ǝ时按ƨDZ价ǁ|Ǵ|̢ / ͉|˝|ʽ 硅基流动|CommǣCode|˗|SCNet 超算互联网 Ʀ Ƅ|火山方舟 ʙ Ark Ʒ Ƅ|; ͋ Ʀ Ƅ|小米 MiMo Ʀ Ƅ|百度千帆 Ʀ Ƅ|ǎ / 总Ƃ|Ȳ Ƚ|ƛDZ Ȳ Ƚ。|̎ (Droid)|Ȍ|Ȍ ʈ ID|点ˬЩƛт(设备码Ы,ȇ批准一次Б),也可按 F12 复制 ʏ Цɰ。ʈ ID ǝ时ƛDZ;Φ ɾ 需填ʈ ID,不˺΍ Ǹ ɾ。|一键тƂƴ|Ƃн|Stǣard + Core|Η ID(ȕ)|ПȽ|补偿Ƚ|Ƌ|Ƃȹ|ǯȶ|Ɵ я|л я|я 模式需在 ˓ ȴʩ @ʇ/ˏ,并ǒ υ Ȑ。|л я:在 ˓ ȴʩ ˄。ȼЩ会在该ȴ打开Ыȇ;远程或无кȴ请ǒ bl Ȑ --ʛ。|б ǃ Ƃ(Ї版 Lite 5 万 / е版 50 万,以ȝ页Љ)|ȝ̺(ȕ,Α ȏ;ǝʭ)|ǃ ̴̄(ȕ;每百万 ɩ 抵扣的 ǃ,ǝ用˱表)|ƒ名,如 ɍ3.8-ˌ|待填齐三项正数后ƛǩ;Ȕ清空ʬ˱表。|Ȝ|ǃ ǯȶ,以̵Љ。ɶ归属;П的 Ƅ Ƶ;ͳШ Ǹ。уƒ需设̴。|ǯȶб ǃ Ƃ(˶ 60,000 / е 240,000 / 高级 600,000)|ȝ̺(ȕ,Α ȏ;ǝʭ)|˭用 24 ǫ内的̵΋,否则按ǯdz和Ɵ ǃ 表ȶ。ЎС和уƒͳ入。|ʯ ȯ ID|ʯ Ϫȯ|AK...|SK...|{h}ǫ|{h}ǫ{m}分|{m}Ǜ|{ƕ}后ȡТ|{ƕ}后ȡ高峰|峰ǀ({Ѷ}):{˪s};̀Ș:{ƕ}。{˨}|未ȢȖǀ。{˨}|˼|njƎ|ȚƎ|ȾƎ|自dz建立以来 · Ƶ {Lj} 次|΅ƭ|˓ + ΅合计|΅΋超过 24 ǫ未ș|近期Βǰ|Ʈ取а΋,΃比Ɵч晚几Ǜ。Ɩ 含Ơ、Ǵ、ƨ和΍;΍并入Ǵǁ。以ƮΈ。|nj/Ț按宿主ΐ {ˊ},ȇ为 {ȃ}。ΐ不同会Ί日界和Έ;可将 dsh 改为ǯΐ。|njƗ|ȻǮ行可ʫ˷Ɨɳ|Ɨɳ˲中…|该日无Ɨɳ(Эǭ或Ɨ˻已清理)|Ɨɳ˲ƾ|按Ɨɶ(ȔǕ)|跨天合并,̲按Х归并。仅列选定г,ȾƎЏȔ对话。|ɴƗǭ|Ɨʮ中…|Ɨʮƾ|Ɖг|Ʈ含 Ƅ ˸|ɱ后所有Ʈ按含 Ƅ ȝ̂的总Ǝ展示;˰(ȣ)仅计真金白银 Ǹ ˾|Ɂ̷ƎɳЍ|ɁƠ框ˬƎɳЍ|Ɂ每轮回复Й本轮Ǝ|排序|Ǝ 高→低|Ǝ 低→高|Ș 新→旧|Ș 旧→新|实时顺序|Ǖǰ|Ʀ ƭɶ|Ⱦ {Ɩ} Ɩ · Ơ {ƶ} · ƨ {LJ} · Ǵ {ƺ} · {Lj} 次Ƶ|{Ɋ}:共 {Ɩ} Ɩ(Ơ {ƶ} · ƨ {LJ} · Ǵ {ƺ})· {Lj} 次Ƶ · {ǟ}|ɴǕǭ,ɏΒƭ会ɐ|概览|Ƃ|ƭ|Ə|Ɖ|Ǖǭ|ƗƎƉǨ|Ơ区ˬ|Ɨ̷|˰|ʊǂǎ%|ʊ Go Ƃ|ʊ Ʒ Ƅ Ƃ|̈DZ超时,请Ȼы。|Ƌ已Ɂ|ȻɭɁ或ƉƋ;ȻƮƞ|Ȼ立即ƞ|ȻǢƋ或 Ʒ Ƅ ʨБƞ;ƞ时ʨ闪烁,ƾ时ʹ原值并在悬停ȗ中说明Д。|̹|˷ƎƉ|ǢФ|货币单位|Γ(1 ̃ = ? 目标Ǭ)|小数位数|ƋƉǨ|主̈Ǣ|Ȉ|两者都Ɖ|Ƌƞɷ(Ǜ)|Ȁ ƥ ȖǀƏ|ƿ(Ǣǂ框/njƎ;ȈȖ面板内ʴ)|已Ч的Ə表|ƟƏǬ|̃(сƟ页)|ȵ(ЈƟ页)|决定ƽƏ所用的Ɵ页х;ƽЙƏΕʧƵ。|ѧ 与 ʹ ͸按Ɵʦǁ,旧 ʹ ɭ按 ʹ 价结算。工作日ͽȘ 09–12、14–18 为峰ǀ,ɯ及Ƽ。改价ΕʧƵ,已ǰƮʹ;修正旧Ǝ请ɵ后ɫǕ重算。ƨͷ按ȷ价。|̆Ɖǜ适用Ə。ЦΘ会˴此条ʧ预定调价,已Е的ǕƏ仍ʹ。|ȣƏ|新ƒ ID(如 ɋ)|Ȝƒ|ǭ与ƽ|ǩ中…|ƛǩƾ:{Ʃ}|已ƛǩ {ƕ}|Ȣ͵后ƛǩ|ɵ用ƟΎƏ̄Ə表?|У|˴|从ƟΎƽƏ|Ɵƽ只ș ƥ Ə(含Ȗ);z-ai/ή/͋/ʙ 等第三方Ə随版本ș,ЖƏ表ʫРГΘ,或用ƒ名ʥ调整。|ɵȺȔǕ?|ɎǕ|ɵʪ?将КȔƗ˻,只补dzо的Ǯ与Ɨ,不Ί已有ǰ。|ɎǕƾ:{Ʃ}|首次启动ƛʪ旧ǰ;拷入˻И重跑。按ǜƏ回推;已ͺ˻无法К,跨ʩ时刻的Ɨͳ此前ƭ。|ɵȺ|ȺȔǕ|аƽ:{ƕ}|从未(ɫ˱Ə)|;ȹ:{ƻ}|ƟΎ|˱ȣ|кх|ш ˓(ƛ)|{ʞ} Ƶƾ|ƽƵƾ|ƋƞƵƾ'],["en",`ʾ ƃ {Ɗ} · ь {ʝ} · ɚ {ƶ} · ǹ {LJ} · ȱ {ƺ}|ʾ ƃ {Ɗ}|ʗ Ɗ Ɍ|̦|ѐ Ƕs Ͱ ϭ Ɯs × {ʠ}. To comp˔ ơ ѐ bills, Ё ѐ, Ƭn ̮ Ɯs; ̮ing affects Ɍ Ѱ Lj.|ƀ Ϙ ǧ: {Ʃ}|̓ error|ƀ|ƥ Ɓ|Above Ƭ ƶ э|DŽ ǣ ː|DŽ ǣ ƶ э|ǔ ǣ ƶ э|Μ locations|ϐ ǧ|Cross-check ơ Ɓ ι against Ƭ Ʌ ǿ (warn ψ Ƭy diverge)|Ϋ {ɔ} · ̥ {ɪ}|UpɊd {ƕ}|Nj ({Ʋ})|˟ {Ȓ} / {Ɗ}|ʾ ǵ {ǵ} · Μ ƕ {Ƕ}|Nj|Ǟ's ǟ (calculated using Ȅ Ȋ)|Ǟ's ɩ NJ|Ɩ|Çs {Lj} · ɚ {ƶ} · ǹ {LJ} · ȱ {ƺ}|ʾ ǵ {Ɗ}|Μ ƕ {Ɗ}|Ǟ|DŽ ɇ ƫ|Ƿ|Ʀ NJ|Ǟ|ʾ ǵ|Μ ƕ|Ȱ ̛|No Ɲ Ѧ. Once you ͬ chatting, ǟs ˔ ˠ ϸ ѳ љ.|ϟ|Çs|In ѣ|ǹ ѣ|Out ѣ|Ƿ|No ƃs ͤ ɇ.|ȧ|ǥ Ʊ|Nj Ɗ (in ƫ lj)|Nj Ʋ|̒ Ɋ|End Ɋ (Ʉ = ɇ)|Range: {̛}|ǥ a Ʊ to see Ѹ ͠, Ȓ Ɗ ǣ ˧ in Ƭ ƫ lj. Choose ɇ, ǵ, ̧ ƕ or a ƌ ̛.|{Ʋ} Ʊ {Ɗ} · ˟ {Ȓ} · {ѝ}%| (Ѳ ͠)| (near ͠)|˙|ʐ f̧ѭ|ɜ|Π|Ν-Ɛ|ƹ|ƀ Ǹ Ξ|ƀ ƻ|̟ (Ƙ Ξ ͜)|˓ Ǧ w̧et|͏ Ǧs or dedicated Ξs ɻ.|ɂ {Ƕ} · Ϋ {ɔ} · ̥ {ɪ} · UpɊd {ƕ}|ƀ Ϙ ǧ: {Ʃ}|ƀ Ɇ|̉ Ɓ|ƣing…|ƣ Ɓ|Ȱ ˎ Ɓ|˒ ϗ|˒ Ʀ ˞ Ɓ|ʗs available ѐ Ɓ ʜ Ƭ ơ Ǧ ̪. Sign in at ɩrhythm.Ђ. In ȃ ͂, copy Ƭ Ǧ ɧ ʜ Netѥ, or Ƭ tr_ƃ ϛ ʜ Storage / Application. δ it beѹ ǣ ɡ ɨ ͖. ʏs Ѡ in Ƭ ˓ ƈ ͭ; χ Ƭm ψ expired.|˒ Qianwen / ɸ Ɓ|ʗs ɸ China funds. RAM ȯ needs bss:Ǥ. ѫ ͜ two ͛ ˔ ͦ; ͎ Ʀ is ξ STS. Ϫs Ѡ in Ƭ ƈ ͭ.|ѷ paths, numbers, nested add/ͮ/͡/ϳ/Ѻ/max/sum, or ȑ ξmulas. Example ƪ: {"ȑ":"(ɉ.Ƕ - ɉ.Ȓ) / 500000"}. ʻ ͛ ǣ unѸ to Ѓ endpoint; put Ȓ Ɗs in ͫ.|ɑ ς|Χ ς|γ URL|SupϾs ͆, Ʌ ά ǣ /τ/… paths ѡ ͝ Ƭ Ȅ ˓ Ͼ.|Μow non-loopѭ ά (plaintext ƈs; ͧ Ƭ exact ˊ:Ͼ in ̧owed ˊs)|+ ǚ Ǐ|ѫ ǚ pͨ ͣ ƪ Ǐ across Ϯ Ǧs using an adѺ X-AdѺ-Ʀ, ϼ a Ƙ Ǹ Ξ. Set Ƭ ͓ ̕ ǣ Ͼ; χ Ƭ ƈ ψ it ν.|ά ʞ|̏ (ʑ)|γ body (ʑ)|Blank sends no body; ʑ text is џ ǣ sent as entered. ʎ ȩs to ˂/json; ̘ can ɦ it.|Ψ rules (ʑ)|Ȱ Ɓ ƫ|ƣ Ǡ (ȅ)|Ɠ lj|̍ ϭ Ɓ to ƫ lj|ѷs Ƭ ƫ ʠ ǣ ̫. Keep Ƭ ƻ lj; oƬr currencies ǣ Ǐ Ѡ unϲd.|ƀ {Ɗ}|Ǟ {Ɗ}|ϓ {Ɗ}|ѧgress ј direction|Ǔ (϶ → Ʉ)|˟ (Ʉ → ϶)|Nj cap (ǡ)|Ǽ Ɓ Ɍ Ϛ a Ʊ cap is set.|˒ ˜ Ǹ Ǐ|Grant Ɗ (ϭ)|̒ Ɋ (ϕ)|Expiration Ɋ (ϕ)|View ˜ credit Ϸ|̡ ƪ Ǐ equal Ƭ grant Ɗ ѯ organization Ǹ ǟs. ϊ Ƭ Ɋs ʜ ȋ Ϸ. ѫ ˇ ν at 00:00 ϕ on Ƭ expiration Ɋ.|Grant {Ƕ} · ʕ ǟs {Ȓ} · ̡ ƪ {ƪ} · Expires {ϴ} ϕ|̐ ʑ|{{і_NAME}} ͣ a ƈ or ˆ variable. <ϑ>_Ǹ_ђ Ͱs an upѳcase ɛ ID ͱ underscores, such as ̩ai→Ϥ_Ǹ_ђ. Names can sh˔ a Ξ.|̊ ˊs (Ɉ)|ї ̘ carry ƈs Ɍ listed ˊs ˔ ̧owed; leave Ʉ to ̧ow ͱ a warning. ѧtects Ξs ψ ͞ing someone else's config.|ɘ ƶ|Store Ƭ Ξ ξ Ѯ {{і}} placehѱer above (write-Ɍ: ͭd in Ƭ ˓ ƈ ͭ, ȫ):|No {{і}} placehѱers in Ƭ ̘ Ѧ — add e.g. "ɹ": "Be˔r {{MY_Ǹ_ђ}}" ǣ a ƈ ƶ Ѥ appear ϸ.|ǥ|Ǔ {ƪ} · ϓ {ͫ} / Nj {maxNj} · UpɊd {ƕ}|Ǔ {Ɗ}|ƣ ƌ Ɓ|dž ʣ Ƈ|Go|ʖ 5h|ȍ|ǘ|ʀs: {ƕ}|ʀ ƕ rѮed|{d}d {h}h ћ|{h}h {m}m ћ|{m}m ћ|ʀs in {h}h {m}m|ʀs in {m}m|ʀs {ƕ}|At ɨ ˪’s average pace, ͠ expected {ƕ}|{ѝ}% Ȓ|{ѝ}% ƪ|{σ}%|UpɊd {ƕ}|Go Ƈ ƫ Ƨ|Go Ƈ ƙ Ǡ (ȅ)|dž Ǹ Ξ (ǡ; Ʉ = ˃)|Go Ƈ primary ˪|Go э Ǚ|ɗ (ƻ: {ƻ})|ϣ ɠ|δ|ѩ ƈ|ʶ|͍…|ѫ Ξ is written to Ƭ ˓ ƈ ͭ Ɍ — it is never џ in Ƭ ǿ ǣ ȫ.|ѫse ƈs Ѐ in Ƭ Ʌ ǿ. ExϾ Ƭ ˋ ˆ variables ǣ reͬ:|Nj э Ǚ|ƣ Ƈ|ƚ Ɇ|ɼ (˖/Max)|Z.ai / Zhipu GLM Ʒ Ƅ|Personal or team GLM Ʒ Ƅ Ǹ Ξ|Ʒ Ƅ Ǹ Ξ ͦ|˒ ʵ Ƈ|ʔ M Ƅ / Ʀ Ƅ|ʔ Ƅ|ƚ Ͻ (͆)|ɽ: ơ sites. OƬrwise Ƭ ɾ is sent Ɍ to ɨ Ͻ. ѷ a trusted ̕ ͱout a path.|5h|7d|Ѫ ƥ NJ ǣ top-up|Τ (Ǻ) Ƈ|Ǻ Ƈ is disabled · ̖ to ɡ|5h Ƈ|ȍ Ƈ|ͨs {ƕ}|ƚ ˑ. ǥ ǣ sign in to Ƭ Ёed ƻ; ̖ to retry.|ʗ Ǻ Ƈ (ͧ a signed-in Ǻ plugin)|ʗ Ǻ Ƈ in Ƴ|ʗ Ǻ Ƈ above ˅|έ ̭ in ƃ ǟ|No Ƈ ɉ|Ǘ Ƨ|Ǹ Ξ (ǡ; Ʉ = ˃)|ƣ Ǡ (ȅ)|ƣ|ώ|Signing in…|ƚ Ɇ|яѧxyǸ Ɣ Ƈs|˒ ƻ|Ɠ label|̽|Ǘ|ƣ Ǡ (ȅ)|ɘ ̧owlist (ˊ:Ͼ, Ɉ)|˚ Ξ (write-Ɍ)|͐|ˀ ˎs|̓|No Ǧs|fetched {ƕ}|ϫ Ǧ (Ȅ: {Ǧ})|ͅ Ƈ Ɍ|ƣ|ǥ ɨ item ͜|ǥ ǣ Ѵ a ƫ Ƨ to ƙ|ɜ|ǥd items move to Ƭ top; ̖ a ς to expǣ Ѹ own ː. Up to 8 ƌ Ɓs ǣ 4 Ɣ ƻs.|ǥ dž rolling 5h, weekly ǣ ǵly Ƈs in Ƭ Ƴ, ǔ ǣ bottom-right ȳ. ΰ ɺ ѵ a Ͽ.|ʌ (λ) ƫ|ʖ-5h Ƈ|ȍ Ƈ|ǘ Ƈ|Nj Ȓ %|5h|Wk|Mo|̀|Nj|͇ ў ǧ: {Ʃ}|Reading ǿ…|͇ ˑ|͑ ǧ: {Ʃ}|ȁ cle˔d.|ʶ ǧ: {Ʃ}|ƹ/ќ-Ɛ Ǒ is ќ; base Ɯs ˔ Ȓ|ϣ Ѧ ʄ (ʄ at {ƕ}); base Ɯs ˔ Ȅly Ȓ|ƹ hour now; Ɛ Ɯs ʂ|ƥ Ɛ-hour Ǒ is Ϯ; Ȅ Lj ˔ ˡ at Ɛ Ɯs|Ν-Ɛ now; ќ-Ɛ Ɯs ʂ|̔ — ̧ ќ-Ɛ (Sat & Sun ˡ at ќ-Ɛ Ɯs ̧ љ)|̔ — ̧ ќ-Ɛ|̔|ɑ public ɕ — ќ-Ɛ ̧ љ|ϧ ɕ — ̧ ќ-Ɛ|Holiљ|ϧ ɕs (Ρ Ɋs, comma sepaʠd)|Since Aug 23, 2026 (Ρ ƕ), Ƣ ќ-Ɛ ̧ љ, ʆ ѥ-shift ʤs.|ƹ|Ν-Ɛ|ƹ Ʋ strip style|ɒ (one-line)|̾ic (segments & chip)|Popup ϖ beξe Ɛ/ќ-Ɛ switch|Lead ƕ (ȅ, 1-30)|Ƥ type|ə Ɛ|ə ќ-Ɛ|΢|ə Ɛ ˤ|ə ќ-Ɛ ˤ|̌ switches to {phase} Ǒ in about {ƕ}; Ѻd Ѓ ç ǟs in ɨ ˪.|Ɛ|ќ-Ɛ|Got it|ƹ ϖ|Ν-Ɛ ϖ|Popup Ƨ|ʌ|Screen center|Also send a system ʟ|ї ɡd, ̧ow ʟ ѳmission in Ƭ ȃ ̕ ј so you get ϖed even ψ Ƭ ̪ is Ѻimized or ѭgrounded.|Ȃ Ƭ popup|Ȃ ͚ Ɛ|Ȃ ͚ ќ-Ɛ| (preview)|ƹ/ќ-Ɛ Ǒ & ͢|˛ Ϲ: ɡ Ɛ/ќ-Ɛ Ǒ ǣ Ƭ “proѺent ͢” toggle.|Ϊ|Money & lj|DŽ ƫ|Simplify Ƭ Ƴ|Dismiss guide|Reͭ ͥd Ɔ ({͙})|ɜ ͗s Ƭ ɦ ǣ Ϻs Ƭ row Ϛ ̝d. ˁ ʡ ˔ kept; ϰmatic Ɯ ˋ η.|̿ chips|Box Ǚ|Unmount|UnƜd|Ȱ|You edited ɨ Ɯ manu̧y; ̨ Ѥ ϼ Ѳwrite it.|Resume ̨|Per-Ƙ statistics (Ɩ & ǟ)|DŽ Ƙ ǟs|{n} Ɔ|OƬr|ʗ Ƙ ǟ ͖|Expǣ by ȩ|Remember expansion|ʗ Ɩ|ʗ ǟ sh˔s|Ѭ Ƙ in ȳ λ|ʐ Ʋ|Collapsed ̞|Card Ƨ|ɿ rows (1–10)|ƣ Ǡ (10–60 seconds)|Ϧ Ƕ ǣ Ƙ ͙|Ѭ Ƙ ǣ ǟ|Ѭ|After Ɓs|Bottom|Ǟ|ѓ 90 љs|Ƿ ̜|Ʀ NJ|ǹ hit ʠ|unreϾed?|Zero LJ hѸ on long Lj may mean a relay ͥd LJ ͛. Μ-miss ǟ Ȫ; check ͱ Ƭ direct Ǹ.|Value · Ɩ ѳ ϭ|ɚ|ǹ|ȱ|No NJ ɉ ɤ Ʋ.|blended {Ɯ}/M|ь ʠ = LJ ͣ ÷ (ͣ + unLJd ƶ). “ɝ?” means LJ ɉ may be ρ, so ǟ Ȫ. ѕ Ɯ = ǟ ÷ Ɩ × 1M; ϛ = Ɩ ÷ ǟ.|Unattributed (early ɉ · ˡ as ͤ)|ʾ ƃ {Ɗ} (Ǹ) · Ƅ equiv. {ǐϝ} · ь {ʝ} · ɚ {ƶ} · ǹ {LJ} · ȱ {ƺ}|ʾ ƃ {Ɗ} (Ǹ) · Ƅ equiv. {ǐϝ}|Ʀ Ƅ NJ stats (ѳ-1% & ˈ ʅ)|No Ʒ Ƅ Ƈ ɉ Ѧ. ǥ ǣ ƙ a ˎ under ƚs.|Ȏ|˟ %|ʾ Ʋ ͓ (Ʌ ǿ)|Per 1% Ƈ ≈|Full ˪ (100%) ≈|ͨs {ƕ}|ͩ delta|Ȅ NJ ratio|ϼ ɢ|{ʞ} (as of {ƕ})|ѹ φ ̫|Ƅ NJ curves (ˠ ʜ ͩ Ǡs)|̀|ȍ|ǘ|ϣ ɢ: ƙ success϶y twice ͱ a Ƈ ˧ ϲ.|{Ɋ}: ˈ est. ≈ {϶} (ѳ 1% ≈ {ѳ1}) · ͓ {Ɩ} / {ǟ} · {Ǡs} ͩ Ǡ(s)|Ο ˔ θ-Ɯ ˢs. Ƅs Ͱ Ƈ; Ʊs ͙ Ǹ Ɍ. Estimates cѲ dsh Lj, while server ˧s cѲ Ƭ Ǧ. Ȩ ͩs ˔ ѯ precise. 5h rolls; week/ǵ Ͱ Ʌ Ɋs.|̌ class|Ƅ ʣ|̟|Ǹ NJ|Sepaʠ ˦s|Try 2 × 0.8|Changing Ƭ ˦ η to ̧ Ȋ ɤ Ƙ|Change ɨ ʠ Ɍ; uncheck ˩ Ƭ sh˔d ˦|ϊ a non-negative ʠ or multiplication, e.g. 2 × 0.8|˕ ɖ Ƙ ςs|̟ (strip suffix / prefix / family similarity)|Exact match Ɍ|Manual assignments ǣ ˎ Ɯs ɻ. ˕ recognizes ˢ ςs ǣ Ɋ tags.|ƥ ȩ Ɯ|ɜ|Unmatched ǣ manu̧y ɠ Ɔ|Set Ѯ κ ǣ Ƙ sepaʠly: Ё a θ ϗ, Ͱ a ƌ Ɯ, or mark as Ʌ. Ȱ Ɯs ʂ Ɍ to ѡ κ.|Ƿ|ˁ|ɚ|ǹ ў|ǹ write|Leave ͔ Ͱ Ƭ LJ-ў Ɯ|ȱ|̢ / ͉|˝|ʽ|CommǣCode|˗|SCNet Ʀ Ƅ|ʙ Ark Ʒ Ƅ|͋ Ʀ Ƅ (ʇ.com)|Xiaomi MiMo Ʀ Ƅ|Baidu Qianfan Ʀ Ƅ|˟ / Ƕ|Ȳ|Reads Ȳ Ǐ ȉ.|̎ (Droid)|Ȍ|Ȍ Ȭ|Press Ƭ button beѹ to get Ƭ ƈ ȉ (approve once in Ƭ ȃ), or paste a ɧ copied ʜ ͂. Leave Ƭ Ȭ ͔ ў Ƭ Ȅ one; Φ ɾs need an explicit Ȭ ǣ inference Ǹ Ξs do ϼ ѥ.|Get Ƈ ƈ|ƚ pool|Stǣard + Core|ʕ ID (ǡ)|Ƅ Ǐ|ʍ|ƀ|ƚ ƻ|ʺ ˇ|Ǽ я|̋ я|Insţ @ʇ/ˏ on Ƭ ˓ ˊ ǣ run υ Ȑ as Ƭ ʢ.|Insţ ˄ on Ƭ ˓ ˊ. ώ ̩s ѡ ˊ’s ȃ; ξ a remote or headѯ ˊ, run bl Ȑ --ʛ as Ƭ ʢ.|ǘ Ǐ Ƈ (ѳsonal Lite 50K / Stǣard 500K; see Ѓ ǐ ̪)|Ƅ ͬ Ɋ (ǡ, ȏ; Ʉ = ͕ ǵ)|ǃ ʠ ɦs (ǡ; Ǐ deducted ѳ 1M Ɩ; Ʉ = ɟ)|ɿ ς, e.g. ɍ3.8-ˌ|ϊ ̧ three positive Ȋ to Ѵ ȉ; ͗ ̧ ˩ Ƭ ɟ.|˒|ʺ ǃ ˇ; ʛ is authoritative. Counts Ƅ Lj assigned to ͋. Excludes pay-as-you-go Ǹ. ˒ Ȋ ξ oƬr Ɔ.|ǘ Ǐ Ƈ ξ Ʌ ʅ (Basic 60,000 / Stǣard 240,000 / ѧ 600,000)|Ƅ ͬ Ɋ (ǡ, ȏ; Ʉ = ͕ ǵ)|ѷs ʛ ͪs Ѱer than 24h, Ƭn ʅ ʜ Ʌ ʡ ǣ ơ ǃ Ȋ. OƬr tools ǣ unlisted Ɔ ˔ excluded.|ɞ ȯ ID|ɞ Ϫȯ|AK...|SK...|{h}h|{h}h {m}m|{m}m|Ν-Ɛ in {ƕ}|ƹ in {ƕ}|ƹ ̙ ({Ѷ}): {˪s}; ʄ: {ƕ}. {˨}|No Ɛ ˪s ɠ. {˨}|ɖ|Ǟ|ʾ ǵ|Μ ƕ|Since Ƭ ǿ was created · Çs {Lj}|̈́ NJ|˓ + ɣ Ƕ|̈́ ͪ has ϼ been upɊd ξ 24 ̙|͌ daily ʡ|Ο Ͱ Ƭ latest ͪ ǣ may lag Ƭ ơ bill by ȅ. Ʀs ̚ ƶ, ƺ, LJ ǣ ̬; ̬ is ˡ ͱ ƺ. Reconcile by Ɗ.|Ǟ/ǵ Ͱ ˊ ƕѶ {ˊ}; ɨ ȃ Ͱs {ȃ}. Different љ boundaries affect reconciliation. Set dsh to Ѓ Ʌ ƕѶ to align.|Ǟ's ƃs|ʷ a Ɋ row to expǣ Ѹ ƃ Ǚ|ʒ ƃ Ǚ…|No ƃ Ǚ ɤ љ (early ɉ or ƃ ϻ cleaned)|Ƹ to load ƃ Ǚ|By ƃ (̧ Ɲ)|Days ͘; ̭ ͝ ː. ͏ rows ѵn; cumulative ǟs ̚ every conversation.|No ƃ ɉ Ѧ|ʒ ƃ ̜…|Ƹ to load ƃ ̜|Rows|έ ǐ Ƕs|ї on, every Ɗ ѵs Ƕ ˢ ǟ ʆ ǐ ɺ; ќ (ȩ) ͙s real-money Ǹ κs Ɍ|ё header ǟ Ǚ|ё ˅ ǟ Ǚ|ё turn ǟ summaries|̤|Ƿ high→ѹ|Ƿ ѹ→high|Ϭ Ѱ→ѱ|Ϭ ѱ→Ѱ|͌ order|ȁ|Ʀ NJ stats|Μ-ƕ {Ɩ} Ɩ · ƶ {ƶ} · LJ {LJ} · ƺ {ƺ} · {Lj} Lj|{Ɋ}: {Ɩ} Ɩ (ƶ {ƶ} · LJ {LJ} · ƺ {ƺ}) · {Lj} Lj · {ǟ}|No Ɲ Ѧ — daily NJ Ѥ accumulate ϸ|͊|ƚs|ˁ|β|Ǘ|ȁ ɉ|ȧ ǟ ƫ Ƨ|Beѹ Ƭ ˅|ȧ title ј|Ν|Ǿ Ʊ Ȓ %|Ǿ Ƭ Go Ƈ|Ǿ Ƒ ǐ Ƈs|Page ο ƕd out. Please retry.|ƀ Ϲ|ʷ Ƭ ς to Ϻ/ѵ; ̖ Ƭ Ɗ to ƙ|ʷ to ƙ now|ʷ a Ƴ Ɓ or ǐ э to ƙ. It pulses while ο; on failure it keeps Ƭ ѱ ϛ ǣ ѵs Ƭ Ͽ on hѲ.|Got it|Ǟ ǟ ƫ|DŽ footer|Ȥ|Exϲ ʠ (1 ϭ = ? target lj)|Decimal places|ƀ ƫ Ƨ|Main Ƴ|ǔ ̪|΢|ƀ ƙ Ǡ (ȅ)|ѷ ƥ Ɛ-hour Ɯs|ѧѺent ͢ during Ɛ ̙ (Ƴ Ʊ э, ɇ's ǟ; previewed in Ƭ ǔ Ɛ panel)|Mounted Ɯ ͯs|Ǽ Ɯ lj|ϭ (Χ ơ ̪)|ѐ (ɑ ơ ̪)|Selects Ƭ ơ Ǒ-̪ ͟. ͑ed Ɯs ʂ to subsequent Lj.|ѧ ǣ ʹ Ͱ sepaʠ ơ Ȋ; ˥ ʹ ςs Ͱ ʹ Ȋ. Weekљ Ɛs ˔ 01–04 ǣ 06–10 ϕ; Ƣ ќ-Ɛ. Rate ι ʂ to later Lj. Recorded Ɗs Ѐ Ϛ you ɓ ˣ recalculation. ǹ writes Ͱ hit Ȋ.|Current Ȋ ˔ ѵn ϸ. ѩing ϱs any future scheduled ϲ ɤ ϗ; μ ˣ Ȋ ˔ retained.|ʐ Ɯ|New Ƙ ID (e.g. ɋ)|˒ Ƙ|Data & ̮|͍…|̟-Ѵ ǧ: {Ʃ}|̟-џ {ƕ}|ǔ ˔ ϰ-џ|Overwrite Ƭ Ɯ ͯ ͱ Ɯs ʜ Ƭ ơ њ?|Apply|Cancel|͑ Ɯs ʜ ơ њ|Ǽ ̮ upɊs ƥ Ɯs (ʆ Ɛ Ȋ). Third-party Ɯs (z-ai/ή/͋/ʙ) ͝ releases; expǣ a vendor ˉ in Ƭ Ɯ ͯ or Ͱ Ƙ ˋ.|ʶ ̧ Ɲ?|˘ ˍ Ɲ|Υ ͞? Replays ̧ ƃ ϻ ǣ Ɍ fills Ɋs/ƃs ρ ʜ Ƭ ǿ; existing ʡ ˔ untouched.|Ƹ to ͞ ˍ Ɲ: {Ʃ}|Pre-insţ Ɲ ͞s at ͜ launch; rerun after copying ѱ ϻ. Ƿs Ͱ Ȅ Ɯs. Deleted ϻ canϼ replay; ƃs spanning insţation exclude μ NJ.|Υ ͗|ʶ ̧ Ɲ|ѓ ̮: {ƕ}|Never (bundled Ɯs)|; Ɠ: {ƻ}|Ǽ њ|Σ|Language|Folѹ ˓ (ϰ)|{ʞ} ç ǧ|͑ ç ǧ|ƀ ƙ ç ǧ`]].map(([e,t])=>{const n=Ha(t).split("|");return[e,Object.fromEntries(ds.map((a,o)=>[a,n[o]]).filter(([,a])=>a!=="\0"))]}));function Ua(){return(typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language:"").toLowerCase().startsWith("zh")?"zh":"en"}function Xe(e){const t=typeof e=="string"?e.toLowerCase().split(/[-_]/)[0]:"";return t==="zh"||t==="en"?t:null}function j(e){const t=typeof e=="string"?e:e?.locale;return t==="zh"||t==="en"?t:Xe(e?.activeLocale)||Ua()}function z(e){const t=e==="zh"?Ie.zh:Ie.en;return(n,a)=>{let o=t[n]??Ie.en[n]??n;if(a)for(const r of Object.keys(a))o=o.split("{"+r+"}").join(String(a[r]));return o}}const et={day:"periodDay",month:"periodMonth",all:"periodAll",custom:"periodCustomRange"};function ae(e,t){throw new Error("dsh-cost-meter: 服务端数据非法 ("+e+": "+t+")")}function de(e,t){return(e===null||typeof e!="object"||Array.isArray(e))&&ae(t,"object"),e}function G(e,t){return(typeof e!="number"||!Number.isFinite(e))&&ae(t,"number"),e}function J(e,t){return typeof e!="string"&&ae(t,"string"),e}const je=(e,t,n)=>typeof e=="string"&&t.includes(e)?e:n;function qa(e,t=!1){return e===null||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([n,a])=>t?n.length>0&&["plan","api"].includes(a):["auto","plan","api"].includes(a)))}function xe(e,t){return typeof e!="boolean"&&ae(t,"boolean"),e}const Ue=(e,t,n)=>Object.fromEntries(t.map(a=>[a,n(e[a])]));function Wa(e,t){const n={};if(e!==null&&typeof e=="object"&&!Array.isArray(e))for(const a of Object.keys(e)){const o=e[a];if(o===null||typeof o!="object"||Array.isArray(o))continue;const r=i=>typeof i=="number"&&Number.isFinite(i)&&i>=0?i:0;n[a]={...Ut(o),...Ue(o,["input","output","cacheRead","cacheWrite","reasoning","cost"],r),apiCost:o.apiCost===void 0?r(o.cost):r(o.apiCost)}}return n}const kt=["costCny","apiCostCny","costEur","apiCostEur"],Ut=e=>Object.fromEntries(kt.filter(t=>Number.isFinite(e?.[t])).map(t=>[t,e[t]]));function $a(e,t){de(e,t);const n={...Ut(e),reasoning:e.reasoning===void 0?0:G(e.reasoning,t+".reasoning"),apiCost:e.apiCost===void 0?void 0:G(e.apiCost,t+".apiCost"),byModel:Wa(e.byModel,t+".byModel"),byProviderModel:Wa(e.byProviderModel,t+".byProviderModel")};for(const a of["input","output","cacheRead","cacheWrite","calls","cost"])n[a]=G(e[a],t+"."+a);return n}function ms(e){return e==null?void 0:{source:J(e.source,"source"),requestId:J(e.requestId,"requestId"),attempt:G(e.attempt,"attempt"),complete:xe(e.complete,"complete"),status:J(e.status,"status"),upstream:J(e.upstream,"upstream")}}function Ka(e){return(Array.isArray(e)?e:ae("rows","array")).map(t=>({provider:J(t.provider,"provider"),model:J(t.model,"model"),bucket:J(t.bucket,"bucket"),tokens:G(t.tokens,"tokens"),...t.requests===void 0?{}:{requests:G(t.requests,"requests")},rate:G(t.rate,"rate"),cost:G(t.cost,"cost"),priced:xe(t.priced,"priced"),plan:xe(t.plan,"plan")}))}function qt(e,t){return{...$a(e,t),id:J(e.id,t+".id"),provider:typeof e.provider=="string"?e.provider:"",model:typeof e.model=="string"?e.model:""}}function we(e,t){const n={...$a(e,t),date:J(e.date,t+".date"),sessions:[]};return e.sessions!==void 0&&(Array.isArray(e.sessions)||ae(t+".sessions","array"),n.sessions=e.sessions.map((a,o)=>qt(a,t+".sessions["+o+"]"))),n}function Wt(e,t,n=["cacheWrite","reasoning"]){const a={};for(const o of["cacheHit","cacheMiss","output"])a[o]=G(e[o],t+"."+o);for(const o of n)e[o]!==void 0&&(a[o]=G(e[o],t+"."+o));return a}function $t(e,t){de(e,t);const n={...Wt(e,t),...wt(e)};for(const a of["offPeak","peak","legacyBase","longContext"])e[a]!==void 0&&(n[a]=Wt(e[a],t+"."+a,["cacheWrite","reasoning","aboveInputTokens"]));e.cny!==void 0&&(n.cny=Wt(e.cny,t+".cny")),e.legacy!==void 0&&(n.legacy=xe(e.legacy,t+".legacy")),e.rateHistory!==void 0&&((!Array.isArray(e.rateHistory)||e.rateHistory.length>16)&&ae(t+".rateHistory","price history"),n.rateHistory=e.rateHistory.map((a,o)=>((!a||typeof a.before!="string"||!Number.isFinite(Date.parse(a.before)))&&ae(t+".rateHistory","dated price"),{...$t({...a,rateHistory:void 0},t+".rateHistory."+o),before:a.before}))),Object.assign(n,xt(e));for(const a of["billingMode","sourceUrl","checkedAt","notes"])typeof e[a]=="string"&&(n[a]=e[a]);return n}function ps(e,t){const n=o=>o==null?void 0:{...["aliyun","tokenrhythm","openai-credits"].includes(o.adapter)?{adapter:o.adapter}:{},...o.adapter==="openai-credits"?{grantAmount:me(o.grantAmount),grantStart:o.grantStart??"",grantExpiry:o.grantExpiry??""}:{},enabled:o.enabled===!0,label:typeof o.label=="string"?o.label:"",labelEn:typeof o.labelEn=="string"?o.labelEn:"",dashboardUrl:typeof o.dashboardUrl=="string"?o.dashboardUrl:"",display:je(o.display,["sidebar","settings","off"],"both"),unit:o.adapter==="tokenrhythm"?"CNY":["CNY","EUR","CREDITS"].includes(o.unit)?o.unit:"USD",convertToDisplayCurrency:o.convertToDisplayCurrency===!0,allowInsecureHttp:o.allowInsecureHttp===!0,refreshMinutes:typeof o.refreshMinutes=="number"&&Number.isFinite(o.refreshMinutes)?o.refreshMinutes:15,request:o.request&&typeof o.request=="object"?o.request:{url:""},extract:o.extract&&typeof o.extract=="object"?o.extract:{},allowedHosts:Array.isArray(o?.allowedHosts)?o.allowedHosts.filter(r=>typeof r=="string"):[]};de(e,t);const a={};if(e.prices!==null&&typeof e.prices=="object"&&e.prices.models!==null&&typeof e.prices.models=="object")for(const o of Object.keys(e.prices.models))a[o]=$t(e.prices.models[o],t+".prices.models."+o);return{queryAccounts:e.queryAccounts&&typeof e.queryAccounts=="object"?e.queryAccounts:{},locale:e.locale==="zh"||e.locale==="en"||e.locale==="auto"?e.locale:"auto",position:e.position==="header"||e.position==="off"?e.position:"dock",sidebar:e.sidebar!==!1,showSessionId:e.showSessionId===!0,hideOfficialBalance:e.hideOfficialBalance===!0,hideCustomBalance:e.hideCustomBalance===!0,hideTodayCost:e.hideTodayCost===!0,sessionListCostPeriod:e.sessionListCostPeriod==="today"?"today":"total",modelStatistics:e.modelStatistics??{},...Ue(e,["hideSessionCostHeader","hideSessionCostDock","hideTurnCost","followSkinTransparency","sidebarTodayBalanceInline","sessionListCosts","hideBudget","sessionCostCompact","contextCostsEnabled","contextCostsPromptSeen","showTotalWithPlan","sidebarSimple","codexQuotaEnabled","codexCompatPromptDismissed","includeSubagentCost","peakEnabled","peakAlertWebNotify"],o=>o===!0),sidebarTodayMetric:["tokens","both"].includes(e.sidebarTodayMetric)?e.sidebarTodayMetric:"cost",sidebarTextOnly:e.sidebarTextOnly===!0,localSavings:e.localSavings,...Object.hasOwn(e,"sidebarOrder")?{sidebarOrder:Array.isArray(e.sidebarOrder)?e.sidebarOrder:[]}:{},statisticsBasis:e.statisticsBasis,sidebarModels:Object.fromEntries(Object.entries(qn).map(([o,r])=>[o,e.sidebarModels?.[o]??r])),codexQuotaSidebar:e.codexQuotaSidebar!==!1,codexQuotaStrip:e.codexQuotaStrip!==!1,codexQuotaSource:["connect","subscription","chatgpt","pi-ai","chatgpt-sub"].includes(e.codexQuotaSource)?e.codexQuotaSource:"auto",codexCompatHistoryAppliedAt:me(e.codexCompatHistoryAppliedAt),sidebarStyle:je(e.sidebarStyle,["standard","compact","summary","icons"],"standard"),planQuotaStyle:e.planQuotaStyle==="gauge"?"gauge":"bars",...Ue(e,["sidebarSimplePromptSeen","sidebarSummaryPromptSeen","peakProgressPromptSeen"].filter(o=>Object.hasOwn(e,o)),o=>o===!0),billionContextNoticeEnabled:e.billionContextNoticeEnabled!==!1,billionContextNoticesSeen:Array.isArray(e.billionContextNoticesSeen)?e.billionContextNoticesSeen.filter(o=>typeof o=="string").slice(-32):[],priceMatchDismissed:Array.isArray(e.priceMatchDismissed)?e.priceMatchDismissed.filter(o=>typeof o=="string"):[],pricingCurrency:e.pricingCurrency==="CNY"?"CNY":"USD",currency:typeof e.currency=="string"?e.currency:"CNY",symbol:typeof e.symbol=="string"?e.symbol:"¥",decimals:G(e.decimals,t+".decimals"),exchangeRate:G(e.exchangeRate,t+".exchangeRate"),exchangeRateAuto:e.exchangeRateAuto!==!1,fxRates:e.fxRates,exchangeRateDate:e.exchangeRateDate??"",exchangeRateCheckedAt:e.exchangeRateCheckedAt??0,peakEffectiveAt:typeof e.peakEffectiveAt=="string"?e.peakEffectiveAt:"",peakWindows:Array.isArray(e.peakWindows)?e.peakWindows.map((o,r)=>({start:G(o.start,t+".peakWindows["+r+"].start"),end:G(o.end,t+".peakWindows["+r+"].end")})):[],peakHolidays:Array.isArray(e.peakHolidays)?e.peakHolidays.filter(o=>typeof o=="string"):[],peakNotice:e.peakNotice!==!1,peakAlertEnabled:e.peakAlertEnabled!==!1,peakAlertAhead:Number.isFinite(e.peakAlertAhead)&&e.peakAlertAhead>=1&&e.peakAlertAhead<=30?e.peakAlertAhead:2,peakAlertTarget:e.peakAlertTarget==="peak"||e.peakAlertTarget==="offpeak"?e.peakAlertTarget:"both",peakAlertPosition:e.peakAlertPosition==="center"?"center":"corner",peakStyle:["classic","progress"].includes(e.peakStyle)?e.peakStyle:"compact",peakTimeZone:typeof e.peakTimeZone=="string"?e.peakTimeZone:"auto",peakTimeDisplay:["countdown","switch"].includes(e.peakTimeDisplay)?e.peakTimeDisplay:"both",priceMatch:e.priceMatch==="exact"?"exact":"auto",priceOverrides:(()=>{const o={};if(e.priceOverrides!==null&&typeof e.priceOverrides=="object"&&!Array.isArray(e.priceOverrides))for(const[r,i]of Object.entries(e.priceOverrides))typeof r=="string"&&typeof i=="string"&&(o[r]=i);return o})(),priceTableDisplay:(()=>{const o={};if(e.priceTableDisplay!==null&&typeof e.priceTableDisplay=="object"&&!Array.isArray(e.priceTableDisplay))for(const[r,i]of Object.entries(e.priceTableDisplay))typeof r=="string"&&(o[r]=i===!0);return o})(),codingPlans:(()=>{const o={};if(e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans))for(const r of Object.keys(e.codingPlans)){const i=e.codingPlans[r];i===null||typeof i!="object"||Array.isArray(i)||(o[r]={enabled:i.enabled===!0,display:i.display==="sidebar"||i.display==="both"||i.display==="off"?i.display:"settings",...typeof i.showInComposer=="boolean"?{showInComposer:i.showInComposer}:{},refreshMinutes:typeof i.refreshMinutes=="number"&&Number.isFinite(i.refreshMinutes)?i.refreshMinutes:15,apiKey:typeof i.apiKey=="string"?i.apiKey:"",...r==="minimax"?{baseUrl:typeof i.baseUrl=="string"?i.baseUrl:""}:{},...r==="factory"?{orgId:typeof i.orgId=="string"?i.orgId:"",factoryPool:["core","both"].includes(i.factoryPool)?i.factoryPool:"standard"}:{},...r==="workbuddy"?{accountScope:i.accountScope??"current",accountIds:Array.isArray(i.accountIds)?i.accountIds:[],...typeof i.accountSource=="string"?{accountSource:i.accountSource}:{}}:{},...r==="opendesign"?{workspaceId:typeof i.workspaceId=="string"?i.workspaceId:""}:{},...r==="qwen"?{quotaSource:["cli","bailian"].includes(i.quotaSource)?i.quotaSource:"local"}:{},...typeof i.planCredits=="number"&&Number.isFinite(i.planCredits)&&i.planCredits>0?{planCredits:i.planCredits}:{},...typeof i.planStart=="string"?{planStart:i.planStart}:{},...i.rates!==null&&typeof i.rates=="object"&&!Array.isArray(i.rates)?{rates:i.rates}:{},...typeof i.accessKeyId=="string"?{accessKeyId:i.accessKeyId}:{},...typeof i.secretAccessKey=="string"?{secretAccessKey:i.secretAccessKey}:{}})}return o})(),prices:{models:a,...e.prices?.custom?{custom:e.prices.custom}:{},default:$t(e.prices?.default??{cacheHit:0,cacheMiss:0,output:0},t+".prices.default"),providers:e.prices?.providers&&typeof e.prices.providers=="object"?e.prices.providers:{},currency:typeof e.prices?.currency=="string"&&e.prices.currency.length>0?e.prices.currency:void 0},historyDays:G(e.historyDays,t+".historyDays"),billingStorageRetentionDays:[0,7,30].includes(e.billingStorageRetentionDays)?e.billingStorageRetentionDays:7,fetchedAt:e.fetchedAt===null||e.fetchedAt===void 0?null:J(e.fetchedAt,t+".fetchedAt"),priceSource:typeof e.priceSource=="string"?e.priceSource:"bundled",budget:{enabled:e.budget?.enabled===!0,amount:typeof e.budget?.amount=="number"&&Number.isFinite(e.budget.amount)?e.budget.amount:100,period:e.budget?.period==="day"||e.budget?.period==="all"||e.budget?.period==="custom"?e.budget.period:"month",customStart:typeof e.budget?.customStart=="string"?e.budget.customStart:null,customEnd:typeof e.budget?.customEnd=="string"?e.budget.customEnd:null,detail:e.budget?.detail!==!1},balance:{source:e.balance?.source==="account"?"account":"auto",display:je(e.balance?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.balance?.refreshMinutes=="number"&&Number.isFinite(e.balance.refreshMinutes)?e.balance.refreshMinutes:5,showProgressBar:e.balance?.showProgressBar===!0,showSource:e.balance?.showSource===!0,officialChannelOnly:e.balance?.officialChannelOnly===!0,quickHide:e.balance?.quickHide===!0,budgetCap:typeof e.balance?.budgetCap=="number"&&Number.isFinite(e.balance.budgetCap)&&e.balance.budgetCap>0?e.balance.budgetCap:null,currency:e.balance?.currency??"native",...Object.hasOwn(e.balance??{},"clickHintSeen")?{clickHintSeen:e.balance?.clickHintSeen===!0}:{}},goQuota:{enabled:e.goQuota?.enabled!==!1,...typeof e.goQuota?.showInComposer=="boolean"?{showInComposer:e.goQuota.showInComposer}:{},display:je(e.goQuota?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.goQuota?.refreshMinutes=="number"&&Number.isFinite(e.goQuota.refreshMinutes)?e.goQuota.refreshMinutes:15,apiKey:typeof e.goQuota?.apiKey=="string"?e.goQuota.apiKey:"",main:e.goQuota?.main==="weekly"||e.goQuota?.main==="monthly"?e.goQuota.main:"rolling",detail:e.goQuota?.detail!==!1},customBalance:n(e.customBalance),gatewayQuotas:(()=>{const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:e.gatewayQuotas?.sources;return{sources:Array.isArray(o)?o.slice(0,4).filter(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)).map(i=>({id:typeof i.id=="string"?i.id.slice(0,48):"",type:i.type==="agy-link"?"agy-link":"cliproxyapi",label:typeof i.label=="string"?i.label.slice(0,80):"",baseURL:typeof i.baseURL=="string"?i.baseURL:"",enabled:i.enabled!==!1,display:je(i.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof i.refreshMinutes=="number"&&Number.isFinite(i.refreshMinutes)?Math.min(1440,Math.max(1,Math.floor(i.refreshMinutes))):15,includeProviders:Array.isArray(i.includeProviders)?[...new Set(i.includeProviders.filter(l=>typeof l=="string").map(l=>l.toLowerCase()).filter(l=>Gt.includes(l)))]:Gt,allowedHosts:Array.isArray(i.allowedHosts)?i.allowedHosts.filter(l=>typeof l=="string").slice(0,16):[],allowInsecureHttp:i.allowInsecureHttp===!0,antigravityOnlyGemini:i.antigravityOnlyGemini===!0,keyVar:typeof i.keyVar=="string"?i.keyVar:""})):[]}})(),customBalances:(()=>{if(Array.isArray(e.customBalances))return e.customBalances.filter(r=>r!==null&&typeof r=="object").slice(0,8).map(n).filter(Boolean);const o=n(e.customBalance);return o?[o]:[]})(),corner:{enabled:e.corner?.enabled===!0,goRolling:e.corner?.goRolling!==!1,goWeekly:e.corner?.goWeekly!==!1,goMonthly:e.corner?.goMonthly!==!1,budget:e.corner?.budget!==!1},quotaStrip:{enabled:e.quotaStrip?.enabled===!0,budget:e.quotaStrip?.budget!==!1,go:e.quotaStrip?.go!==!1,plans:e.quotaStrip?.plans!==!1,planAmounts:e.quotaStrip?.planAmounts!==!1,...Object.hasOwn(e.quotaStrip??{},"promptSeen")?{promptSeen:e.quotaStrip?.promptSeen===!0}:{}},usage:{position:e.usage?.position==="general"||e.usage?.position==="section"?e.usage.position:"cost"},barDirections:(()=>{const o=e.barDirections!==null&&typeof e.barDirections=="object"&&!Array.isArray(e.barDirections)?e.barDirections:{},r=(i,l)=>o[i]==="remaining"||o[i]==="used"?o[i]:l;return{balance:r("balance","remaining"),budget:r("budget","used"),go:r("go","used"),plan:r("plan","used")}})(),planBilling:{...Array.isArray(e.planBilling?.autoProviders)?{autoProviders:e.planBilling.autoProviders.filter(o=>Te.includes(o))}:{},providers:qa(e.planBilling?.providers),models:qa(e.planBilling?.models,!0),modelPlans:Object.fromEntries(Object.entries(e.planBilling?.modelPlans??{}).filter(([o,r])=>o.includes(":")&&Te.includes(r)))}}}const tt=e=>typeof e=="number"&&Number.isFinite(e)?e:null,me=e=>tt(e)??0,fs={status:"off",message:"",fetchedAt:0,currency:"",totalBalance:0,grantedBalance:0,toppedUpBalance:0},bs={status:"off",message:"",fetchedAt:0,rolling:null,weekly:null,monthly:null},za=(e=null)=>({status:"off",message:"",fetchedAt:0,label:"",unit:"USD",remaining:0,maxBudget:null,spend:null,index:e});function Kt(e,t){return de(e,t),{status:e.status==="ok"||e.status==="error"?e.status:"off",message:typeof e.message=="string"?e.message:"",fetchedAt:typeof e.fetchedAt=="number"?e.fetchedAt:0}}function Ga(e,t){return{...Kt(e,t),keyConfigured:e.keyConfigured===!0,keySource:typeof e.keySource=="string"?e.keySource:"",currency:typeof e.currency=="string"?e.currency:"",totalBalance:me(e.totalBalance),grantedBalance:me(e.grantedBalance),toppedUpBalance:me(e.toppedUpBalance)}}function zt(e,t){return e==null?null:((typeof e!="object"||Array.isArray(e))&&ae(t,"object"),{percent:me(e.percent),resetsAt:typeof e.resetsAt=="string"?e.resetsAt:""})}function gs(e,t){return{...Kt(e,t),rolling:zt(e.rolling,t+".rolling"),weekly:zt(e.weekly,t+".weekly"),monthly:zt(e.monthly,t+".monthly")}}function Va(e,t){return{...Kt(e,t),label:typeof e.label=="string"?e.label:"",unit:typeof e.unit=="string"?e.unit:"USD",remaining:me(e.remaining),maxBudget:tt(e.maxBudget),spend:tt(e.spend),index:typeof e.index=="number"&&Number.isFinite(e.index)&&e.index>=0?Math.floor(e.index):null}}const ys=new Set(["ok","partial","unknown","error","stale","unsupported","capability_missing"]),hs=new Set(["off","loading","ok","partial","stale","error"]),Gt=["antigravity","claude","codex","kimi","xai","workbuddy"],Ya={antigravity:"Antigravity",claude:"Claude",codex:"Codex",kimi:"Kimi",xai:"xAI",workbuddy:"WorkBuddy"};function ks(e,t){de(e,t);const n=(i,l="")=>typeof i=="string"?i:l,a=i=>tt(i),o=i=>i!==null&&typeof i=="object"&&!Array.isArray(i)?{id:n(i.id),label:n(i.label),...a(i.percent)===null?{}:{percent:a(i.percent)},resetsAt:n(i.resetsAt),periodHours:a(i.periodHours),scope:n(i.scope)}:null,r=i=>i!==null&&typeof i=="object"&&!Array.isArray(i)?{unit:n(i.unit,"credits"),used:a(i.used),remaining:a(i.remaining),limit:a(i.limit),fetchedAt:n(i.fetchedAt),packages:Array.isArray(i.packages)?i.packages.filter(l=>l!==null&&typeof l=="object"&&!Array.isArray(l)).map(l=>({id:n(l.id),label:n(l.label),used:a(l.used),remaining:a(l.remaining),limit:a(l.limit),startsAt:n(l.startsAt),resetsAt:n(l.resetsAt)})):[]}:void 0;return{id:n(e.id),type:e.type==="agy-link"?"agy-link":"cliproxyapi",label:n(e.label),status:hs.has(e.status)?e.status:"error",message:n(e.message),fetchedAt:a(e.fetchedAt)??0,attemptedAt:a(e.attemptedAt)??0,serverVersion:n(e.serverVersion),keyConfigured:e.keyConfigured===!0,keySource:n(e.keySource,"none"),accounts:Array.isArray(e.accounts)?e.accounts.filter(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)).slice(0,16).map(i=>({id:n(i.id),provider:n(i.provider,"unknown"),label:n(i.label,"unknown"),status:ys.has(i.status)?i.status:"unknown",message:n(i.message),plan:n(i.plan),windows:Array.isArray(i.windows)?i.windows.map(o).filter(Boolean):[],credits:r(i.credits)})):[],unsupportedProviders:Array.isArray(e.unsupportedProviders)?e.unsupportedProviders.filter(i=>typeof i=="string").slice(0,32):[]}}function xs(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;const t={};if(e.providers!==null&&typeof e.providers=="object"&&!Array.isArray(e.providers))for(const[n,a]of Object.entries(e.providers)){if(a===null||typeof a!="object"||Array.isArray(a))continue;const o={},r={};if(a.windows!==null&&typeof a.windows=="object"&&!Array.isArray(a.windows))for(const[i,l]of Object.entries(a.windows))l===null||typeof l!="object"||Array.isArray(l)||(o[i]={...Ue(l,["percent","localTokens","localCost","sampleCount"],me),...Ue(l,["sampleAt","per1Tokens","per1Cost","fullTokens","fullCost"],tt),resetsAt:typeof l.resetsAt=="string"?l.resetsAt:"",method:l.method==="sample"||l.method==="live"?l.method:"none",confidence:l.confidence==="high"||l.confidence==="low"?l.confidence:null});if(a.intervals!==null&&typeof a.intervals=="object"&&!Array.isArray(a.intervals))for(const[i,l]of Object.entries(a.intervals))Array.isArray(l)&&(r[i]=l.filter(c=>c!==null&&typeof c=="object"&&!Array.isArray(c)).map(c=>Ue(c,["t0","t1","tokens","cost","pct","per1Tokens","per1Cost"],me)));t[n]={windows:o,intervals:r}}return{generatedAt:me(e.generatedAt),providers:t}}function ws(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.usage&&typeof e.usage=="object"?e.usage:{};return{installed:e.installed===!0,enabled:e.enabled===!0,version:typeof e.version=="string"?e.version:"",detection:je(e.detection,["package","profile","none"],"none"),planClass:je(e.planClass,["auto","plan","api"],"auto"),usage:{calls:me(t.calls),cost:me(t.cost),tokens:me(t.tokens),days:me(t.days),providers:(Array.isArray(t.providers)?t.providers:[]).filter(n=>typeof n=="string")},historyAppliedAt:me(e.historyAppliedAt),promptDismissed:e.promptDismissed===!0,promptDue:e.promptDue===!0}}function Za(e,t){return de(e,t),{today:we(e.today,t+".today"),month:we(e.month,t+".month"),total:we(e.total,t+".total"),budgetUsed:typeof e.budgetUsed=="number"&&Number.isFinite(e.budgetUsed)?e.budgetUsed:void 0,localSavings:e.localSavings,balance:e.balance==null?fs:Ga(e.balance,t+".balance"),balanceAccounts:Array.isArray(e.balanceAccounts)?e.balanceAccounts.slice(0,11).map(n=>({...Ga(n,t+".balanceAccounts"),id:J(n.id,t),label:J(n.label,t)})):[],goQuota:e.goQuota==null?bs:gs(e.goQuota,t+".goQuota"),customBalance:e.customBalance==null?za():Va(e.customBalance,t+".customBalance"),customBalances:Array.isArray(e.customBalances)?e.customBalances.filter(n=>n!==null&&typeof n=="object").map((n,a)=>Va(n,t+".customBalances["+a+"]")):[],gatewayQuotas:Array.isArray(e.gatewayQuotas)?e.gatewayQuotas.filter(n=>n!==null&&typeof n=="object"&&!Array.isArray(n)).map((n,a)=>ks(n,t+".gatewayQuotas["+a+"]")):[],customVarStatus:e.customVarStatus!==null&&typeof e.customVarStatus=="object"&&!Array.isArray(e.customVarStatus)?Object.fromEntries(Object.entries(e.customVarStatus).filter(([,n])=>n!==null&&typeof n=="object").map(([n,a])=>[n,{configured:a.configured===!0,source:typeof a.source=="string"?a.source:""}])):{},codingPlans:e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans)?e.codingPlans:{},planStats:xs(e.planStats),codexCompat:ws(e.codexCompat),ourFreeModel:e.ourFreeModel?.enabled===!0?{enabled:!0,version:typeof e.ourFreeModel.version=="string"?e.ourFreeModel.version:""}:void 0,history:Array.isArray(e.history)?e.history.map((n,a)=>we(n,t+".history["+a+"]")):[],billionContext:e.billionContext?.protocol===1?{protocol:1,connected:e.billionContext.connected===!0,failed:e.billionContext.failed===!0,requests:Number(e.billionContext.requests)||0,unreported:Number(e.billionContext.unreported)||0,partial:Number(e.billionContext.partial)||0,uncovered:Number(e.billionContext.uncovered)||0,unresolved:Number(e.billionContext.unresolved)||0,detected:e.billionContext.detected===!0,version:typeof e.billionContext.version=="string"?e.billionContext.version.slice(0,100):"",compatibility:["needs_update","changed","bridge_missing","ready"].includes(e.billionContext.compatibility)?e.billionContext.compatibility:"unknown",noticeId:typeof e.billionContext.noticeId=="string"?e.billionContext.noticeId.slice(0,240):""}:void 0,externalUsage:e.externalUsage&&Array.isArray(e.externalUsage.sources)?{fetchedAt:Number(e.externalUsage.fetchedAt)||0,stale:e.externalUsage.stale===!0,sources:e.externalUsage.sources.map(n=>({source:String(n.source),today:we(n.today,t+".external.today"),month:we(n.month,t+".external.month"),total:we(n.total,t+".external.total"),history:(n.history??[]).map(a=>we(a,t+".external.history"))})),combined:Object.fromEntries(["today","month","total","history"].map(n=>[n,n==="history"?(e.externalUsage.combined.history??[]).map(a=>we(a,t+".external.history")):we(e.externalUsage.combined[n],t+".external."+n)]))}:null,config:ps(e.config,t+".config"),pricesRev:typeof e.pricesRev=="string"?e.pricesRev:void 0,modelLabels:Object.fromEntries(Object.entries(e.modelLabels??{}).filter(([,n])=>typeof n=="string")),modelDirectory:e.modelDirectory,reconcile:e.reconcile===null||e.reconcile===void 0?void 0:{ok:e.reconcile.ok===!0,message:typeof e.reconcile.message=="string"?e.reconcile.message:""},priceLockIds:Array.isArray(e.priceLockIds)?e.priceLockIds.filter(n=>typeof n=="string"):[],meta:{...Xe(e.meta?.locale)?{locale:Xe(e.meta.locale)}:{},now:typeof e.meta?.now=="number"?e.meta.now:Date.now(),timezoneOffsetMinutes:typeof e.meta?.timezoneOffsetMinutes=="number"?e.meta.timezoneOffsetMinutes:0,timezone:typeof e.meta?.timezone=="string"?e.meta.timezone:"",...typeof e.meta?.defaultProvider=="string"?{defaultProvider:e.meta.defaultProvider}:{},dayKey:typeof e.meta?.dayKey=="string"?e.meta.dayKey:"",monthKey:typeof e.meta?.monthKey=="string"?e.meta.monthKey:""}}}function Ns(e,t){de(e,t);const n={ok:e.ok===!0,message:typeof e.message=="string"?e.message:""};return e.state!==void 0&&e.state!==null&&(n.state=Za(e.state,t+".state")),n}function X(e){return{parse:e}}const at=X(Za),Ss=X(e=>de(e,"patch")),Cs=X(Ns),Vt=X(e=>J(e,"provider")),vs=X(e=>{if(e!=null)return(typeof e!="number"||!Number.isInteger(e)||e<0||e>7)&&ae("index","0-7 integer"),e}),As=X(e=>J(e,"date")),Ms=X(e=>de(e,"day")),Ps=X(e=>(Number.isFinite(Number(e))||ae("limit","number"),Number(e))),Ja=X(e=>J(e,"sort")),Os=X(e=>de(e,"topSessions")),Xa=X(e=>J(e,"target")),Ts=X(e=>J(e,"value")),ye=(e,t)=>({mode:"strict",typeSymbol:"dsh-cost-meter#"+e,schema:t,create:()=>t}),se=(e,t,n,a=!1)=>({name:e,wire:e,source:"json",codec:ye(t,n),...a?{acceptsUndefined:!0}:{}}),en=X(e=>{de(e,"billing storage options"),(Object.keys(e).some(n=>!["retentionDays","apply","streams","groups"].includes(n))||![0,7,30].includes(e.retentionDays))&&ae("billing storage options","retentionDays 0/7/30");const t={retentionDays:e.retentionDays};for(const n of["apply","streams","groups"])e[n]!==void 0&&typeof e[n]!="boolean"&&ae(n,"boolean"),t[n]=e[n]??n!=="apply";return t}),Rs={package:"dsh-cost-meter",descriptors:[{method:"getStateSince",parameters:[se("pricesRev","PricesRev",X(e=>(typeof e!="string"&&ae("pricesRev","price table revision"),e)))],result:ye("CostState",at)},...["getState","getLocalState"].map(e=>({method:e,result:ye("CostState",at)})),{method:"billingStorage",parameters:[se("options","BillingStorageOptions",en)],result:ye("BillingStorage",X(e=>{de(e,"billing storage");const t={};for(const n of["retentionDays","scannedAt","sessions","reclaimableBytes","archivedStreams","removedFiles","releasedBytes","archiveBytes","skipped"])t[n]=G(e[n],n);for(const n of["applied","limited"])typeof e[n]!="boolean"&&ae(n,"boolean"),t[n]=e[n];for(const n of["streams","groups","archives"]){const a=de(e[n],n),o={};for(const r of["files","bytes","eligibleFiles","eligibleBytes"])o[r]=G(a[r],n+"."+r);for(const r of["oldestAt","newestAt"])o[r]=a[r]===null?null:G(a[r],n+"."+r);t[n]=o}return t}))},{method:"updateConfig",parameters:[se("patch","ConfigPatch",Ss)],result:ye("CostState",at)},{method:"fetchPrices"},{method:"releasePriceLock",parameters:[se("id","PriceLockId",X(e=>((typeof e!="string"||e.length===0)&&ae("id","OpenRouter model id"),e)))]},{method:"refreshBalance"},{method:"refreshGoQuota"},...["getPiAiCodexQuota","getChatgptSubQuota"].map(e=>({method:e,result:ye("PiAiCodexQuota",X(t=>{de(t,"pi-ai quota"),["off","ok","error"].includes(t.status)||ae("pi-ai quota status","off/ok/error");const n={},a=de(t.windows,"pi-ai windows");for(const o of["five","weekly"])if(a[o]!==void 0){const r=G(a[o].percent,o);(r<0||r>100)&&ae(o,"0-100 percent"),n[o]={percent:r,resetsAt:J(a[o].resetsAt,"resetsAt")}}return{status:t.status,windows:n,message:J(t.message,"message")}}))})),{method:"refreshCustomBalance",parameters:[se("index","CustomBalanceIndex",vs,!0)]},{method:"refreshCodingPlan",parameters:[se("provider","CodingPlanProvider",Vt)]},{method:"loginCodingPlan",parameters:[se("provider","CodingPlanProvider",Vt)]},{method:"loginOpenDesign"},{method:"refreshGatewayQuota",parameters:[se("sourceId","GatewayQuotaSourceId",X(e=>{if(e!=null)return(typeof e!="string"||e.length>48||!/^[a-z0-9][a-z0-9_-]*$/.test(e))&&ae("sourceId","gateway source id"),e}),!0)]},{method:"resetHistory",result:ye("CostState",at)},{method:"importLegacyHistory"},{method:"getDaySessions",parameters:[se("date","DayKey",As)],result:ye("DayRecord",Ms)},{method:"getSessionCost",parameters:[se("sessionId","SessionId",Vt)],result:ye("SessionCost",X(e=>({own:qt(e.own,"own"),subagents:qt(e.subagents,"subagents"),found:xe(e.found,"found"),subagentCount:G(e.subagentCount,"subagentCount")})))},{id:"dsh-cost-meter#costMeter/getTurnCost",service:"costMeter",namespace:"costMeter",method:"getTurnCost",invocation:{kind:"direct"},parameters:[se("sessionId","SessionId",X(e=>J(e,"sessionId"))),...["startSeq","endSeq"].map(e=>se(e,"TurnSeq",X(t=>((!Number.isSafeInteger(t)||t<0)&&ae(e,"nonnegative integer"),t)))),{...se("displayCurrency","DisplayCurrency",X(e=>(e!==void 0&&!/^[A-Z]{3}$/.test(e)&&ae("displayCurrency","currency"),e))),acceptsUndefined:!0}],result:ye("TurnCost",X(e=>({...Ut(e),found:xe(e.found,"found"),...e.inherited===void 0?{}:{inherited:xe(e.inherited,"inherited")},cost:G(e.cost,"cost"),apiCost:G(e.apiCost,"apiCost"),rows:Ka(e.rows),calls:(Array.isArray(e.calls)?e.calls:ae("calls","array")).map(t=>({kind:J(t.kind,"kind"),provider:J(t.provider,"provider"),model:J(t.model,"model"),atMs:G(t.atMs,"atMs"),cost:G(t.cost,"cost"),apiCost:G(t.apiCost,"apiCost"),plan:xe(t.plan,"plan"),priced:xe(t.priced,"priced"),longContext:xe(t.longContext,"longContext"),rows:Ka(t.rows),...t.metering?{metering:ms(t.metering)}:{}}))})))},{method:"getTopSessions",parameters:[se("limit","SessionLimit",Ps),se("sort","SessionSort",Ja,!0),se("dir","SessionSortDir",Ja,!0)],result:ye("TopSessions",Os)},{method:"setCredential",parameters:[se("target","CredentialTarget",Xa),se("value","CredentialValue",Ts)]},{method:"clearCredential",parameters:[se("target","CredentialTarget",Xa)]},...["applyCodexCompatHistory","dismissCodexCompat"].map(e=>({method:e,result:ye("CostState",at)}))].map(e=>({id:"dsh-cost-meter#costMeter/"+e.method,service:"costMeter",namespace:"costMeter",invocation:{kind:"direct"},parameters:[],result:ye("FetchPricesResult",Cs),...e}))};function Ds(e,t){const n=t?.models??{};return typeof e=="string"&&e.length>0&&n[e]!==void 0?n[e]:t?.default??{cacheHit:0,cacheMiss:0,output:0}}const Bs=["peakWindows","peakHolidays","peakSchedule"];function xt(e){return Object.fromEntries(Bs.filter(t=>e?.[t]!==void 0).map(t=>[t,e[t]]))}function Mr(e){return!(!e||typeof e!="object"||e.peakWindows!==void 0&&(!Array.isArray(e.peakWindows)||e.peakWindows.length>24||e.peakWindows.some(t=>!t||!Number.isFinite(t.start)||!Number.isFinite(t.end)||t.start<0||t.start>=24||t.end<0||t.end>24||t.start===t.end))||e.peakSchedule!==void 0&&!["deepseek","volcengine","ollama","daily","utc-weekdays"].includes(e.peakSchedule)||e.peakHolidays!==void 0&&e.peakHolidays!==null&&(!Array.isArray(e.peakHolidays)||e.peakHolidays.length>366||e.peakHolidays.some(t=>typeof t!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t)||!Number.isFinite(Date.parse(t+"T00:00:00Z"))||new Date(t+"T00:00:00Z").toISOString().slice(0,10)!==t)))}function Ls(e,t,n){if(!e?.entry)return e;const a=n?.providers?.[t]??(["deepseek-official","deepseek-account",""].includes(t)?n?.providers?.deepseek:void 0),o={...xt(a),...e.entry};return{...e,entry:o,billingMode:(o.peak||o.offPeak)&&Object.keys(xt(o)).length&&o.billingMode!=="flat"?"deepseek-peak":e.billingMode}}function qe(e,t,n){if(!(e.peakWindows!==void 0||e.peakHolidays!==void 0||["daily","utc-weekdays","deepseek"].includes(e.peakSchedule)))return null;if(n?.enabled!==!0||!Number.isFinite(t)||Number.isFinite(n.effectiveAtMs)&&t<n.effectiveAtMs)return"base";const o=e.peakSchedule??(e.billingMode==="utc-peak"?"utc-weekdays":"deepseek"),r=e.peakWindows??(o==="ollama"?[{start:12,end:18}]:n.windows??[]),i=e.peakHolidays===null?[]:e.peakHolidays??(["ollama","volcengine","utc-weekdays","daily"].includes(o)?[]:n.holidays??[]),l=new Date(t+8*36e5),c=new Date(t),u=["ollama","utc-weekdays"].includes(o)?c.getUTCDay():l.getUTCDay();if(o!=="daily"&&(u===0||u===6)||i.includes(l.toISOString().slice(0,10)))return"offPeak";const d=c.getUTCHours()+c.getUTCMinutes()/60+c.getUTCSeconds()/3600+c.getUTCMilliseconds()/36e5;return r.some(m=>m.start<m.end?d>=m.start&&d<m.end:d>=m.start||d<m.end)?"peak":"offPeak"}function Es(e,t,n){const a=qe(e,t,n);if(a===null||a==="base")return null;const o=e.peakWindows??(e.peakSchedule==="ollama"?[{start:12,end:18}]:n.windows??[]),r=Math.floor(t/864e5)*864e5,i=new Set,l=Math.max(9,Math.min(380,(e.peakHolidays??n.holidays??[]).length+8));for(let d=-l;d<=l;d++){const m=r+d*864e5;for(const g of[0,16,...o.flatMap(f=>[f.start,f.end])])i.add(m+g*36e5)}let c=null,u=null;for(const d of i)qe(e,d-1,n)!==qe(e,d,n)&&(d<=t&&(c===null||d>c)&&(c=d),d>t&&(u===null||d<u)&&(u=d));return c===null||u===null?null:{inPeak:a==="peak",weekend:!1,prevAtMs:c,nextAtMs:u,nextIntoPeak:qe(e,u,n)==="peak"}}function wt(e){return Object.fromEntries(["multiplier","separateMultipliers","multipliers"].filter(t=>e?.[t]!==void 0).map(t=>[t,e[t]]))}function Nt(e,t){return(e.separateMultipliers?e.multipliers?.[t]:void 0)??e.multiplier??1}function tn(e,t,n="base"){const a={};for(const o of["cacheHit","cacheMiss","cacheWrite","output","reasoning"])e[o]!==void 0&&(a[o]=e[o]*Nt(t,n+"."+o));return e.longContext&&(a.longContext={...tn(e.longContext,t,"longContext"),aboveInputTokens:e.longContext.aboveInputTokens}),a}function Is(e){const t=wt(e);return t.multipliers&&(t.multipliers=Object.fromEntries(Object.entries(t.multipliers).filter(([n])=>n.startsWith("cny.")).map(([n,a])=>[n.replace("cny.","base."),a]))),{...e.cny,...t}}function We(e){if(e===null||typeof e!="object")return;const t=i=>{const l=e[i];return typeof l=="number"&&Number.isFinite(l)&&l>=0?l:void 0},n=t("cacheMiss")??t("input")??0,o={cacheHit:t("cacheHit")??t("cachedInput")??t("cacheRead")??n,cacheMiss:n,output:t("output")??0},r=t("reasoning");return r!==void 0&&(o.reasoning=r),t("cacheWrite")!==void 0&&(o.cacheWrite=t("cacheWrite")),o}function js(e){const t=We(e);if(t===void 0)return null;Object.assign(t,wt(e),xt(e)),e.billingMode==="utc-peak"&&(t.billingMode="utc-peak"),e.peakSchedule==="volcengine"&&(t.peakSchedule="volcengine");for(const n of["offPeak","peak","legacyBase"]){const a=We(e[n]);a!==void 0&&(t[n]=a)}return Number.isFinite(e.longContext?.aboveInputTokens)&&e.longContext.aboveInputTokens>0&&(t.longContext={...We(e.longContext),aboveInputTokens:e.longContext.aboveInputTokens}),Array.isArray(e.rateHistory)&&(t.rateHistory=e.rateHistory.slice(0,16).map(n=>{const a={...We(n),before:n.before};for(const o of["offPeak","peak"]){const r=We(n[o]);r!==void 0&&(a[o]=r)}return a})),t}function nt(e,t=Date.now()){if(!e||!Number.isFinite(t)||!Array.isArray(e.rateHistory))return e;let n=null,a=1/0;for(const i of e.rateHistory){const l=Date.parse(i.before);t<l&&l<a&&(n=i,a=l)}if(!n)return e;const{before:o,...r}=n;return{...e,...r}}const Yt=Date.parse("2026-08-22T16:00:00Z");function an(e){if(!Number.isFinite(e)||e<Yt)return null;const t=Math.floor((e+8*36e5)/864e5),n=(t+4)%7;if(n!==6&&n!==0)return null;const a=n===6?t:t-1;return{start:Math.max(a*864e5-8*36e5,Yt),end:(a+2)*864e5-8*36e5}}function nn(e,t){if(!Number.isFinite(e)||e<Yt||!Array.isArray(t))return null;const n=Math.floor((e+8*36e5)/864e5);return t.includes(new Date(n*864e5).toISOString().slice(0,10))?{start:n*864e5-8*36e5,end:(n+1)*864e5-8*36e5}:null}const Fs=(e,t)=>nn(e,t)??an(e);function St(e,t,n,a){if(!Array.isArray(n)||n.length===0||Fs(e,a)!==null||Number.isFinite(t)&&e<t)return!1;const o=new Date(e).getUTCHours();return n.some(r=>{const i=Number(r.start),l=Number(r.end);return!Number.isFinite(i)||!Number.isFinite(l)?!1:i<l?o>=i&&o<l:o>=i||o<l})}const Qs=Date.parse("2026-08-16T16:00:00Z"),_s=17881344e5;function sn(e,t,n){const a=nt(e,t)??{cacheHit:0,cacheMiss:0,output:0},o=(c,u="base")=>({reasoning:0,...tn(c,a,u)}),r=qe(a,t,n);if(r!==null)return r==="base"||!a[r]?o(a):o(a[r],r);const i=a.peakSchedule==="ollama";if(i||a.billingMode==="utc-peak"){if(n?.enabled!==!0||!Number.isFinite(t)||i&&t<_s)return o(a);const c=new Date(t),u=c.getUTCDay(),d=c.getUTCHours(),m=u>0&&u<6&&(i?d>=12&&d<18:d>=1&&d<4||d>=6&&d<10);return o((m?a.peak:a.offPeak)??a,(m?a.peak:a.offPeak)?m?"peak":"offPeak":"base")}if(Number.isFinite(t)&&t<Qs){const c=a.legacyBase;return c===void 0?o(a):o(c,"legacyBase")}if(n?.enabled!==!0)return o(a);const l=typeof n.effectiveAtMs=="number"&&Number.isFinite(n.effectiveAtMs)?n.effectiveAtMs:void 0;if(St(t,l,n.windows,a.peakSchedule==="volcengine"?[]:n.holidays)){const c=a.peak;return c===void 0?o(a):o(c,"peak")}if(l!==void 0&&t>=l){const c=a.offPeak;return c===void 0?o(a):o(c,"offPeak")}return o(a)}function on(e,t){const n=Math.max(0,Number(e.input)||0),a=Math.max(0,Number(e.output)||0),o=Math.max(0,Number(e.cacheRead)||0),r=Math.max(0,Number(e.cacheWrite)||0),i=Math.max(0,Number(e.reasoning)||0);return t.longContext&&n+o+r>t.longContext.aboveInputTokens&&(t=t.longContext),(n*t.cacheMiss+a*t.output+o*t.cacheHit+r*(t.cacheWrite??t.cacheHit)+i*(t.reasoning??0))/1e6}function rn(e,t,n){const a=Number(e);if(!Number.isFinite(a)||a<0||a===0)return 0;if(t!=="CNY")return a;const o=Number(n);return!Number.isFinite(o)||o<=0?a:a/o}function re(e,t){const n=e?.barDirections,a=t==="balance"?"remaining":"used";if(n===null||typeof n!="object"||Array.isArray(n))return a;const o=n[t];return o==="remaining"||o==="used"?o:a}function he(e,t){if(e==null||!Number.isFinite(Number(e)))return{width:0,label:null};const n=Math.max(0,Math.min(100,Number(e))),a=t==="remaining"?Math.round((100-n)*10)/10:Math.round(n*10)/10;return{width:a,label:a}}const ln=(e,t)=>e.toFixed(t).replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1");function le(e,t){const n=typeof t?.symbol=="string"&&t.symbol.length>0?t.symbol:"$",a=Number(t?.decimals),o=Math.max(0,Math.min(10,Number.isFinite(a)?Math.floor(a):2));let r=o;return e>0&&e<Math.pow(10,-o)&&(r=o+2),n+ln(e,r)}function $(e,t){const n=Number(t?.exchangeRate),a=e*(Number.isFinite(n)&&n>0?n:1);return le(a,t)}function E(e){const t=Math.max(0,Number(e)||0),n=a=>a>=100?String(Math.round(a)):String(Math.round(a*10)/10);return t<1e3?String(Math.round(t)):t>=999500?n(t/1e6)+"M":t<1e6?n(t/1e3)+"K":n(t/1e6)+"M"}function st(e){return String(e??"").normalize("NFKC").toLowerCase().replace(/[((]\s*(?:go|zen)\s*[))]/g," ").trim()}function $e(e){return st(e).replace(/[\s._\-\u2010-\u2015\u2212]+/gu,"")}function Hs(e,t=!0,n=!0){const a=st(e),o=a.match(/[-_./:@](\d{4}-\d{2}-\d{2}|\d{8}|\d{6}|\d{4})$/);if(o){const r=o[1].replaceAll("-","");if(r.length===4&&!t||r.length===6&&(!t||!n))return a;const i=r.length===4?2e3:r.length===6?2e3+Number(r.slice(0,2)):Number(r.slice(0,4)),l=Number(r.slice(-4,-2)),c=Number(r.slice(-2)),u=new Date(Date.UTC(i,l-1,c));return i>=2e3&&u.getUTCFullYear()===i&&u.getUTCMonth()===l-1&&u.getUTCDate()===c?a.slice(0,o.index):a}return a.replace(/[-_./:@]latest$/,"")}function cn(e,t,n=e,a=!0,o=!0){if(typeof e!="string"||e.length===0)return null;const r=Array.isArray(t)?t.filter(u=>typeof u=="string"&&u.length>0):[],i=r.find(u=>u===n);if(i!==void 0)return{id:i,rank:3};let l=e.normalize("NFKC").trim(),c=2;for(;;){const u=$e(l);if(u.length===0)return null;const d=r.filter(g=>$e(g)===u);if(d.length>0)return{id:d.length===1?d[0]:null,rank:c};if(/[:((]\s*(?:free|online)\b/i.test(l))return null;const m=Hs(l,a,o);if(m===l.toLowerCase())return null;l=m,c=1}}function Ct(e,t,n=e,a=!0,o=!0){return cn(e,t,n,a,o)?.id??null}const Zt=["opendesign","open-design","open-design-api","amr-link.open-design.ai"],un=["vercel","copilot","cline","qoder","qoder-cn","qoder-global","trae","trae-cn","trae-global","zcode","mimo-app","commandcode-plan","cursor","windsurf","augment","roo","codebuddy"],Ke=new Set(["openrouter","opencode-zen","opencode-go","opencode-go-plus","zen","opencode",...Zt]),Oe={openai:/^(?:gpt|o\d|codex)/i,anthropic:/^claude/i,google:/^gemini/i,stepfun:/^step-/i,deepseek:/^deepseek/i,moonshot:/^kimi/i,"z-ai":/^glm/i,xai:/^grok/i,alibaba:/^qwen/i,minimax:/^minimax/i,tencent:/^(?:hunyuan|hy\d)/i,xiaomi:/^mimo/i,upstage:/^solar/i,nvidia:/^nemotron/i,mistral:/^mistral/i,meta:/^(?:muse|llama)/i,meituan:/^longcat/i};function Jt(e){return["deepseek-peak","utc-peak"].includes(e?.billingMode)?e.billingMode:"flat"}function ze(e,t,n,a,o){if(typeof e!="string")return null;if(Object.hasOwn(t,e))return{id:e,rank:3};if(a!=="auto")return null;let r=e.normalize("NFKC").trim().replace(/^models\/(?=gemini)/i,"google/");const i=r.search(/[/:]/);if(i>0){const l=r.slice(0,i).trim().toLowerCase(),c=l==="deepseek-ai"?"deepseek":l,u=r.slice(i+1).trim();if(Object.hasOwn(Oe,c)&&(c===n||["opencode-zen","opencode-go","zen","opencode","opencode-go-plus"].includes(n)&&(Oe[c].test(u)||Ct(u,Object.keys(c==="deepseek"?o?.models??{}:o?.providers?.[c]?.models??{}),u,o?.snapshotTags!==!1,o?.shortSnapshotTags!==!1)!==null)))r=u;else if(Object.hasOwn(Oe,c))return null}return cn(r,Object.keys(t),e,o?.snapshotTags!==!1,o?.shortSnapshotTags!==!1)}function Us(e,t,n,a,o){return ze(e,t,n,a,o)?.id??null}const qs=new Set(["local","lmstudio","ollama","jan","gpt4all","koboldcpp","llamacpp","llama-cpp","localai","vllm","sglang","tabbyapi","lmdeploy","oobabooga","text-generation-webui","llama-server"]),Ws=["lmstudio:","lmstudio/","ollama:","ollama/","jan:","jan/","gpt4all:","gpt4all/","koboldcpp:","koboldcpp/","llamacpp:","llamacpp/","llama-cpp:","llama-cpp/","localai:","localai/","vllm:","vllm/","sglang:","sglang/","tabbyapi:","tabbyapi/","lmdeploy:","oobabooga/","text-generation-webui/","llama-server:","gguf:","local:"];function ve(e,t){if(typeof e=="string"&&qs.has(e))return!0;const n=typeof t=="string"?st(t):"";return Ws.some(a=>n.startsWith(a))}function dn(e,t,n,a){if(!["deepseek","deepseek-official","deepseek-account"].includes(e)&&typeof t=="string"&&t.length>0&&t!=="__local__"&&!t.includes(":")){const o=n.models??{},r=Object.hasOwn(o,t)?t:a==="auto"?Ct(t,Object.keys(o),t,n?.snapshotTags!==!1,n?.shortSnapshotTags!==!1):null;if(r!==null&&o[r]?.unpriced!==!0)return{entry:o[r],priced:!0,billingMode:"deepseek-peak",matched:!0}}return null}function Xt(e,t,n){const a=n?.prices??{},o=n?.priceMatch==="exact"?"exact":"auto",r=n?.priceOverrides&&typeof n.priceOverrides=="object"?n.priceOverrides:{};let i=String(e??"").trim().toLowerCase();if(i.startsWith("llm-")&&(i=i.slice(4)),i===""&&(i="deepseek"),["our-free-model","our-free-model-region"].includes(i)&&r[i+":*"]==="__free__")return{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},priced:!0,currency:"USD",billingMode:"flat",matched:!0};let l=i,c=t;const u=r[i+":"+t];if(u==="__custom__"){const m=a.custom?.[i+":"+t];return{entry:m??null,priced:!!m,billingMode:m?.billingMode??"flat",matched:!0,currency:m?.currency??"USD"}}if(u==="__local__")return{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},billingMode:"flat",priced:!0,local:!0,currency:"USD",matched:!0};if(typeof u=="string"&&u.length>0){const m=u.indexOf(":");if(m>0&&u.slice(m+1).length>0?(l=u.slice(0,m).trim().toLowerCase(),c=u.slice(m+1)):c=u,l==="deepseek"&&c==="__default__")return{entry:a.default??{cacheHit:0,cacheMiss:0,output:0},priced:a.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}if(!ve(l,c)&&l!=="openrouter"){const m=a.providers?.[l]?.models??{},g=ze(c,m,l,o,a);if(g){const f=g.id===null?null:m[g.id];return{entry:f,priced:f!=null&&f.unpriced!==!0,billingMode:Jt(f),matched:!0}}}if(/(?:^|[-_])free(?:$|[-_])/.test(l)&&!["our-free-model","our-free-model-region"].includes(l))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(l!=="opencode-go"&&Fe.go.includes(l))return Xt("opencode-go",c,{...n,priceOverrides:{}});if(Zt.includes(l)&&l!=="opendesign")return Xt("opendesign",c,{...n,priceOverrides:{}});if(ve(l,c))return dn(i,u,a,o)??{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},billingMode:"flat",priced:!0,local:!0,currency:"USD",matched:!0};if(l==="openrouter"){const m=a.providers?.openrouter?.models??{},g=Object.hasOwn(m,c)?m[c]:null;return{entry:g,priced:g!==null&&g.unpriced!==!0,billingMode:"flat",matched:g!==null}}if(["deepseek","deepseek-official","deepseek-account"].includes(l)){const m=a.models??{},g=ze(c,m,"deepseek",o,a);if(g)return g.id===null||m[g.id]?.unpriced===!0?{entry:null,priced:!1,billingMode:"flat",matched:!0}:{entry:m[g.id],priced:!0,billingMode:"deepseek-peak",matched:!0};if(o==="auto"){let f=null,p=-1,k=!1,h="flat";for(const[A,x]of Object.entries(a.providers??{})){if(Ke.has(A))continue;const y=x?.models??{},b=ze(c,y,A,o,a);if(!b)continue;const w=b.id===null?null:y[b.id],N=b.rank;N>p?(f=w,p=N,k=b.id===null||w==null,h=Jt(w)):N===p&&(k=!0)}if(k)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(f!==null)return{entry:f,priced:f.unpriced!==!0,billingMode:h,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}if(Ke.has(l))return{entry:null,priced:!1,billingMode:"flat",matched:!1};const d=o==="auto"&&!u&&/^deepseek/i.test(st(c).replace(/^deepseek(?:-ai)?[/:]\s*/,""));if(Object.hasOwn(Oe,l)&&!d)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(o==="auto"){let m=null,g=-1,f=!1,p="flat";for(const[k,h]of[["deepseek",{models:a.models??{}}],...Object.entries(a.providers??{})]){if(k===l||Ke.has(k))continue;const A=h?.models??{},x=ze(c,A,k,o,a);if(!x)continue;const y=x.id,b=y===null?null:A[y];if(k==="mistral"&&y?.startsWith("deepseek-")&&y!==c&&!l.includes("mistral")&&!/^mistral[/:]/i.test(String(c).trim()))continue;const w=x.rank;w>g?(m=b,g=w,f=y===null||b==null,p=k==="deepseek"?"deepseek-peak":Jt(b)):w===g&&(f=!0)}if(f)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(m!==null)return{entry:m,priced:m.unpriced!==!0,billingMode:p,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}function $s(e,t,n,a,o){const r=o?.[(e||"deepseek")+":"+t];if(!e||a==="exact"||typeof t!="string"||ve(e,t)||/(?:^|[-_])free(?:$|[-_])/.test(e)||typeof r=="string"&&r.length>0||ze(t,n?.providers?.[e]?.models??{},e,"auto",n))return null;const i=t.normalize("NFKC").trim(),l=i.indexOf("/");if(l<=0||l===i.length-1)return null;const c=i.slice(0,l).trim().toLowerCase().replace(/^llm-/,""),u=i.slice(l+1).trim(),d={codex:"openai",claude:"anthropic",gemini:"google","deepseek-ai":"deepseek","deepseek-official":"deepseek","ollama-cloud":"ollama-cloud",volcengine:"volcengine",ark:"ark"},m=/^(?:dsh-)?magpie(?:$|-)/.test(e),g=["our-free-model","our-free-model-region"].includes(c),f=Object.hasOwn(d,c)||Ke.has(c)||Object.hasOwn(n?.providers??{},c)||Object.values(Fe).some(k=>k.includes(c))||un.includes(c)||g;if(!m&&(!f||Ke.has(e)||Fe.go.includes(e))||/(?:^|[-_])free(?:$|[-_])/.test(c)&&!g)return null;const p=Object.hasOwn(d,c)?d[c]:Fe.go.includes(c)?"opencode-go":c;return!m&&Object.hasOwn(Oe,e)&&Object.hasOwn(Oe,p)&&p!==e&&(p!=="deepseek"||!/^deepseek/i.test(st(u)))||Object.hasOwn(Oe,p)&&Us(u,p==="deepseek"?n?.models??{}:n?.providers?.[p]?.models??{},p,"auto",n)===null?null:{provider:f||Object.hasOwn(d,c)||Ke.has(p)||Object.hasOwn(Oe,p)||Object.hasOwn(n?.providers??{},p)||ve(p,u)?p:e,model:u}}function mn(e,t,n){let a=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";const o=Object.fromEntries(["our-free-model:*","our-free-model-region:*"].filter(l=>n?.priceOverrides?.[l]==="__free__").map(l=>[l,"__free__"]));for(let l=0;l<8;l++){const c=$s(a,t,n?.prices,n?.priceMatch,n?.priceOverrides);if(!c)break;e=c.provider,a=c.provider,t=c.model,n={...n,priceOverrides:o}}let r=Xt(e,t,n);const i=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";return!r.currency&&!r.priced&&(r=dn(i,n?.priceOverrides?.[i+":"+t],n?.prices??{},n?.priceMatch==="exact"?"exact":"auto")??r),r.currency||(r=r.priced&&n?.prices?.currency==="CNY"&&r.entry?.cny?{...r,entry:Is(r.entry),currency:"CNY"}:{...r,currency:r.priced&&r.billingMode==="deepseek-peak"&&n?.prices?.currency==="CNY"?"CNY":"USD"}),r=Ls(r,i,n?.prices),i==="ollama-cloud"&&n?.prices?.ollamaPeak!==!1&&r.entry&&r.billingMode==="deepseek-peak"&&(n?.prices?.ollamaTaggedPeak===!1?["deepseek-v4.1-flash","deepseek-v4-pro"].includes(String(t).trim().toLowerCase()):Ct(t,["deepseek-v4.1-flash","deepseek-v4-pro"])!==null)&&(r={...r,entry:{...r.entry,peakSchedule:r.entry.peakSchedule??"ollama"}}),["volcengine","ark"].includes(i)&&n?.prices?.volcenginePeak!==!1&&r.entry&&r.billingMode==="deepseek-peak"?{...r,entry:{...r.entry,peakSchedule:r.entry.peakSchedule??"volcengine"}}:r}function Ks(e){const t=Number(e?.calls)||0,n=Number(e?.input)||0,a=Number(e?.cacheRead)||0;return t>=3&&n>=1e5&&a===0}function vt(e,t){return!e||!t?0:typeof e.cost=="number"&&Number.isFinite(e.cost)?e.cost:bn(e,t).total}function ot(e){if(e===null||typeof e!="object")return 0;const t=Number(e.cost)||0,n=e.apiCost===void 0||e.apiCost===null?t:Number(e.apiCost);return Number.isFinite(n)&&n>=0?Math.min(n,t):t}function Q(e,t){const n={CNY:"Cny",EUR:"Eur"}[t?.currency],a=t?.showTotalWithPlan===!0,o=n&&e?.[(a?"cost":"apiCost")+n],r=a?Number(e?.cost)||0:ot(e);return!Number.isFinite(o)||o===0&&r>0?r:o/(t.exchangeRate||1)}const Fe={opendesign:Zt,go:["go","zen","opencode","opencode-go","opencode-go-plus","dsh-opencode-go"],codex:["codex","openai-codex","dsh-openai-codex","codex-chatgpt"],anthropic:["anthropic","claude-subscription"],zai:["zai","glm-coding-plan"],minimax:["minimax","minimax-code","minimax-m-plan","minimax-mplan","minimax-token-plan"],kimi:["kimi","kimi-code","kimi-coding","kimi-coding-plan"],commandcode:["commandcode","command-code"],clinepass:["clinepass","cline-pass"],workbuddy:["workbuddy","workbuddy-subscription","workbuddy-ai","workbuddy-global","xdpool","xdpool-global"],antigravity:["antigravity"],stepfun:["stepfun","step-code"],"volcengine-agent":["volcengine-agent","ark-agent-plan","volcengine-agent-plan"],"tencent-coding":["tencent-coding","tencent-coding-plan","tokenhub-coding-plan"],"tencent-token":["tencent-token","tencent-token-plan","tokenhub-token-plan","tencent-hy-token-plan","tokenhub-hy-token-plan"],"baidu-coding":["baidu-coding-plan","qianfan-coding-plan","baidu-token-plan","qianfan-token-plan","baidu-tokenplan","qianfan-tokenplan"],qwen:["qwen","qwen-tokenplan","qianwen-tokenplan","qwen-token-plan","qianwen-token-plan"],scnet:["scnet","scnet-tokenplan","scnet-token-plan"],mimo:["mimo","xiaomimimo","mimo-token-plan","xiaomi-token-plan","xiaomi-token-plan-cn","xiaomi-token-plan-sgp","xiaomi-token-plan-ams"],factory:["factory","droid","factory-a","factory-g","factory-o"]},Te=["opendesign","anthropic","zai","minimax","kimi","openrouter","siliconflow","commandcode","clinepass","scnet","volcengine","qwen","mimo","factory","go","codex","volcengine-agent","tencent-coding","tencent-token","baidu-coding","workbuddy","antigravity","stepfun"],zs=Object.entries({opendesign:"opendesign|open[._-]?design",codex:"codex|chatgpt","baidu-coding":"baidu|qianfan|百度|千帆","tencent-coding":"tencent|tokenhub|腾讯",anthropic:"anthropic|claude",zai:"z[._-]?ai|zhipu|glm|智谱",minimax:"minimax|海螺",kimi:"kimi|moonshot|moonshotai|月之暗面",openrouter:"openrouter",siliconflow:"siliconflow|硅基",commandcode:"commandcode",clinepass:"cline[._-]?pass|clinepass",scnet:"scnet|sugon|超算",volcengine:"volcengine|volcano|volc|ark|火山|方舟",qwen:"qwen|qianwen|千问|通义",mimo:"mimo|xiaomi|小米",factory:"factory|droid",go:"opencode(?:[-_\\s]?go)?|zen|go"}).map(([e,t])=>[e,new RegExp("(?:^|[^a-z0-9])(?:"+t+")(?=$|[^a-z0-9])")]);function ea(e,t){for(const n of[e,t]){const a=String(n??"").normalize("NFKC").replace(/([a-zA-Z0-9\u3400-\u9fff])(?=(?:MPlan|Coding|Token|Agent|Plan|Subscription))/g,"$1-").replace(/([a-z0-9])((?:coding|token|agent|m)?plan|subscription)$/i,"$1-$2").toLowerCase();if(!/(?:^|[^a-z0-9])(?:(?:coding|token|agent|m)[-_\s]*)?plan(?:$|[^a-z0-9])|(?:^|[^a-z0-9])subscription(?:$|[^a-z0-9])|套餐|订阅/.test(a))continue;const o=zs.filter(([,r])=>r.test(a));if(o.length){if(o.length!==1)return null;const r=o[0][0];if(r==="volcengine"&&/agent[-_\s]*plan|智能体.*套餐/.test(a))return"volcengine-agent";if(r==="tencent-coding"){const i=/token[-_\s]*plan|令牌.*套餐/.test(a),l=/coding[-_\s]*plan|编程.*套餐/.test(a);return i===l?null:i?"tencent-token":r}return r}}return null}function pn(e,t){const n=String(e??"").normalize("NFKC").trim().toLowerCase().replace(/^llm-/,"");if(!n||typeof t!="string"||ve(n,t)||/(?:^|[-_])free(?:$|[-_])/.test(n)||n==="opencode-zen"||Te.includes(n)||Object.values(Fe).some(l=>l.includes(n))||ea(e)!==null)return null;const a=t.normalize("NFKC").trim().split("/").map(l=>l.trim());if(a.some(l=>!l)||a.slice(0,-1).some(l=>/(?:^|[-_])free(?:$|[-_])/.test(l.toLowerCase())||ve(l.toLowerCase().replace(/^llm-/,""),""))||ve("",a.at(-1)))return null;const o=/^(?:dsh-)?magpie(?:$|-)/.test(n),r=["openai","google","deepseek","deepseek-ai","deepseek-official","moonshot","z-ai","xai","alibaba","tencent","xiaomi","upstage","nvidia","mistral","meta","meituan","gemini","claude","ollama-cloud","ark"],i={anthropic:{vendor:"anthropic",model:/^claude/i},minimax:{vendor:"minimax",model:/^minimax/i},stepfun:{vendor:"stepfun",model:/^step-/i},codex:{vendor:"openai",model:/^(?:gpt|o\d|codex)/i}};for(let l=0;l<Math.min(a.length-1,8);l++){const c=a[l].toLowerCase().replace(/^llm-/,"");if(c==="openrouter"||c==="opencode-zen"||r.includes(c)||/(?:^|[-_])free(?:$|[-_])/.test(c)||ve(c,a.slice(l+1).join("/")))return null;const u=Object.hasOwn(i,c)?i[c]:null;if(u){const d=a.slice(l+1);if(d[0].toLowerCase()===u.vendor&&d.shift(),d.length!==1||!u.model.test(d[0]))return null}for(const[d,m]of Object.entries(Fe))if(m.includes(c)||d===c)return{id:d,provider:c};if(Te.includes(c))return{id:c,provider:c};if(!o&&!un.includes(c))return null}return null}function fn(e,t,n){const a=String(e??"").trim().toLowerCase().replace(/^llm-/,""),o=t?.planBilling?.modelPlans?.[e+":"+n]??t?.planBilling?.modelPlans?.[a+":"+n];if(Te.includes(o))return o;if(a.length===0)return null;for(const[i,l]of Object.entries(Fe))if(l.includes(a))return i;if(Te.includes(a))return a;const r=ea(e);return r!==null?r:ve(a,n)||/(?:^|[-_])free(?:$|[-_])/.test(a)||a==="opencode-zen"?null:typeof n=="string"&&n.normalize("NFKC").includes("/")?pn(e,n)?.id??null:ea(e,n)}function Gs(e){if(Array.isArray(e?.planBilling?.autoProviders))return new Set(e.planBilling.autoProviders);const t=new Set,n=e?.codingPlans;if(n!==null&&typeof n=="object")for(const a of Te)a!=="go"&&n[a]?.enabled===!0&&t.add(a);return e?.goQuota?.enabled===!0&&t.add("go"),e?.codexQuotaEnabled===!0&&t.add("codex"),t}const Vs=new Set(["grok-4.5","glm-5.3","glm-5.3-flash","glm-5.2","glm-5.1","gpt-5.6-luna","kimi-k3","kimi-k2.7-code","kimi-k2.6","mimo-v2.6-flash","mimo-v2.6-pro","mimo-v2.5","mimo-v2.5-pro","minimax-m3","minimax-m2.7","qwen3.8-max","qwen3.7-max","qwen3.7-plus","qwen3.6-plus","hy3","longcat-2.0","muse-spark-1.2-contributor"].map($e));function Ys(e,t,n){const a=String(e??"").trim().toLowerCase();if(a.length>0&&a!=="deepseek"&&!a.includes("deepseek"))return!1;const o=$e(t);if(o.length===0||!Vs.has(o))return!1;const r=n?.prices,i=r?.models??{};for(const l of Object.keys(i))if($e(l)===o)return!1;for(const l of Object.keys(r?.providers?.["opencode-go"]?.models??{}))if($e(l)===o)return!0;return!1}function rt(e,t,n){if(e==="deepseek-official"&&/^deepseek-(web-(search|fetch)|(search|fetch)-api|search-server)$/.test(t))return"api";let a=fn(e,n,t);a===null&&Ys(e,t,n)&&(a="go");const o=n?.planBilling?.models;if(o!==null&&typeof o=="object"){const l=o[e+":"+t];if(l==="plan"||l==="api")return l;if(a!==null){const c=o[a+":"+t];if(c==="plan"||c==="api")return c}}for(const l of[e,a]){if(l==null)continue;const c=n?.planBilling?.providers?.[l];if(c==="plan"||c==="api")return c}if(a===null)return"api";const r=pn(e,t),i=r?.id===a?r.provider:e;return a==="go"&&/^(?:llm-)?(?:dsh-opencode-go|opencode-go(?:-plus)?)$/i.test(String(i).trim())||a==="kimi"&&/^(?:llm-)?kimi-coding(?:-plan)?$/i.test(String(i).trim())||a==="minimax"&&/^(?:llm-)?minimax-(?:m-?plan|token-plan)$/i.test(String(i).trim())||Gs(n).has(a)?"plan":"api"}function bn(e,t){if(!e||!t)return{total:0,api:0};const n=Zs(t),a={enabled:t.peakEnabled===!0,effectiveAtMs:Date.parse(t.peakEffectiveAt||""),windows:t.peakWindows,holidays:t.peakHolidays},o=Date.now(),r=e.byProviderModel??e.byModel??{};let i=0,l=0;for(const g of Object.keys(r)){const f=g.indexOf(":"),p=f>0?g.slice(0,f):"deepseek",k=f>0?g.slice(f+1):g,h=mn(p,k,t);if(h.priced){const A=js(h.entry);A&&h.billingMode==="deepseek-peak"&&t.prices?.ollamaPeak!==!1&&p.trim().toLowerCase().replace(/^llm-/,"")==="ollama-cloud"&&(t.prices?.ollamaTaggedPeak===!1?["deepseek-v4.1-flash","deepseek-v4-pro"].includes(k.trim().toLowerCase()):Ct(k,["deepseek-v4.1-flash","deepseek-v4-pro"])!==null)&&(A.peakSchedule??="ollama");const x=on(r[g],sn(A,o,{...a,enabled:["deepseek-peak","utc-peak"].includes(h.billingMode)&&a.enabled})),y=rn(x,h.currency,n);i+=y,rt(p,k,t)==="api"&&(l+=y)}}const c={input:0,output:0,cacheRead:0,cacheWrite:0,reasoning:0};for(const g of Object.keys(r))c.input+=r[g].input??0,c.output+=r[g].output??0,c.cacheRead+=r[g].cacheRead??0,c.cacheWrite+=r[g].cacheWrite??0,c.reasoning+=r[g].reasoning??0;const u={input:Math.max(0,(e.input??0)-c.input),output:Math.max(0,(e.output??0)-c.output),cacheRead:Math.max(0,(e.cacheRead??0)-c.cacheRead),cacheWrite:Math.max(0,(e.cacheWrite??0)-c.cacheWrite),reasoning:Math.max(0,(e.reasoning??0)-c.reasoning)},d=on(u,sn(Ds("default",t.prices),o,a)),m=rn(d,t.prices?.currency==="CNY"?"CNY":"USD",n);return i+=m,l+=m,{total:i,api:l}}function Zs(e){const t=n=>typeof n=="number"&&Number.isFinite(n)&&n>0&&n<1e6;return e.currency==="CNY"&&t(e.exchangeRate)?e.exchangeRate:t(e.fxRates?.CNY)?e.fxRates.CNY:7.2}function gn(e,t){if(!e||!t)return!1;const n=e.byProviderModel??{};for(const a of Object.keys(n)){const o=a.indexOf(":"),r=o>0?a.slice(0,o):"deepseek",i=o>0?a.slice(o+1):a;if(rt(r,i,t)==="plan")return!0}return!1}function yn(e){return(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0)}function hn(e,t){if(e?.apiCost!==void 0)return ot(e);if(!gn(e,t))return vt(e,t);let n=0;for(const[a,o]of Object.entries(e.byProviderModel??{})){if(!Number.isFinite(o.cost))return bn(e,t).api;const r=a.indexOf(":");rt(a.slice(0,r),a.slice(r+1),t)==="plan"&&(n+=o.cost)}return Math.max(0,vt(e,t)-n)}function ta(e){const t=Math.abs(Math.round(Number(e)||0)),n=Math.floor(t/60),a=t%60;return"UTC"+(Number(e)<0?"-":"+")+n+(a>0?":"+String(a).padStart(2,"0"):"")}function Js(e){const t=e?.meta,n=Number(t?.timezoneOffsetMinutes);if(!Number.isFinite(n))return null;const a=-new Date().getTimezoneOffset();if(a===n)return null;const o=typeof t?.timezone=="string"&&t.timezone.length>0?t.timezone:"";return{hostLabel:o?o+" ("+ta(n)+")":ta(n),browserLabel:ta(a)}}function kn(e,t=n=>n){let n=t(e);const a=new Set;return{getSnapshot:()=>n,subscribe:o=>(a.add(o),()=>{a.delete(o)}),set:o=>{if(o=t(o),o!==n){n=o;for(const r of[...a])r()}}}}const{createElement:s,Fragment:R,useState:D,useEffect:ee,useRef:Ne}=fe;function aa({target:e,configured:t,source:n,t:a,api:o,placeholder:r,disabled:i}){const[l,c]=D(""),[u,d]=D(!1),[m,g]=D(!1),[f,p]=D(null),k=Ne(!1),h=i===!0||m,A=async()=>{const w=l.trim();if(!(w.length===0||h||k.current)){k.current=!0,g(!0),p(null);try{const N=await o.setCredential(e,w);c(""),d(!1),p({kind:"ok",text:N?.message??a("credentialSave")})}catch(N){p({kind:"err",text:String(N?.message??N)})}finally{k.current=!1,g(!1)}}},x=async()=>{if(!(h||k.current)){k.current=!0,g(!0),p(null);try{const w=await o.clearCredential(e);c(""),d(!1),p({kind:"ok",text:w?.message??a("credentialClear")})}catch(w){p({kind:"err",text:String(w?.message??w)})}finally{k.current=!1,g(!1)}}},y=()=>{c(""),d(!1)},b=t===!0?s("button",{className:"cm-btn small",type:"button",onClick:x,disabled:h},a("credentialClear")):null;return s("div",{className:"cm-field"},u?s("form",{className:"cm-field",autoComplete:"off",onSubmit:w=>{w.preventDefault(),A()}},s("input",{className:"cm-input",type:"password",name:"cm-credential-"+e,autoFocus:!0,value:l,placeholder:typeof r=="string"?r:"",disabled:h,autoComplete:"new-password","data-lpignore":"true","data-1p-ignore":"true","data-bwignore":"true","aria-label":a("credentialInputHint"),onChange:w=>c(w.target.value)}),s("div",{className:"cm-buttons"},s("button",{className:"cm-btn small",type:"submit",disabled:h||l.trim().length===0},a(m?"credentialSaving":"credentialSave")),s("button",{className:"cm-btn small",type:"button",onClick:y,disabled:m},a("cancel")),b)):s("div",{className:"cm-buttons"},s("button",{className:"cm-btn small",type:"button",onClick:()=>d(!0),disabled:h},a("credentialEdit")),b),s("span",{className:"cm-hint"},t===!0?a("credentialConfiguredOf",{source:typeof n=="string"&&n.length>0?n:"unknown"}):a("credentialNotConfigured")),s("span",{className:"cm-hint"},a("credentialInputHint")),Ra(f))}function Xs({pending:e,t}){return!Array.isArray(e)||e.length===0?null:s("div",{className:"cm-msg err"},s("div",null,t("secretMigrationPending")),s("div",null,e.join("、")))}function At({size:e=16,className:t}){return s("svg",{width:e,height:e,className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("path",{d:"M4 4H12A2 2 0 0 1 14 6V11.5A2 2 0 0 1 12 13.5H4A2 2 0 0 1 2 11.5V6A2 2 0 0 1 4 4ZM4 5.3H12A0.7 0.7 0 0 1 12.7 6V11.5A0.7 0.7 0 0 1 12 12.2H4A0.7 0.7 0 0 1 3.3 11.5V6A0.7 0.7 0 0 1 4 5.3Z",fill:"currentColor",fillRule:"evenodd"}),s("path",{d:"M3.3 5.3H12.7V7.1H3.3Z",fill:"currentColor"}),s("path",{d:"M8 2.8A1.3 1.3 0 1 0 8 5.4A1.3 1.3 0 1 0 8 2.8Z",fill:"currentColor"}))}function na(e){return e?"Conversation cost details":"本会话费用明细"}function xn(e,t){const n=Ne(!1),a=Ne(""),o=t!==null&&typeof t=="object"?[t.input,t.cacheRead,t.cacheWrite,t.output,t.reasoning,t.cost].map(r=>String(r??0)).join("|"):"";ee(()=>{if(!n.current){n.current=!0,a.current=o;return}if(o===""||o===a.current)return;a.current=o;const r=setTimeout(()=>{e.api?.reload?.()},800);return()=>clearTimeout(r)},[o])}function eo(e,t,n,a){const o=t?t.own:e;if(!n||!t?.subagentCount)return o;const r=t.subagents,i={...o};for(const l of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...kt])i[l]=(o?.[l]??0)+(r?.[l]??0);i.apiCost=hn(o,a)+ot(r);for(const l of["byModel","byProviderModel"]){i[l]={...o?.[l]};for(const[c,u]of Object.entries(r?.[l]??{})){const d={...i[l][c]};d.apiCost=ot(d)+ot(u);for(const m of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...kt])d[m]=(d[m]??0)+(u[m]??0);i[l][c]=d}}return i}function to(e){const t=e.useProjection?e.useProjection("costUsage"):void 0,n=e.useCost?.(u=>u)?.state,a=n?.config,[o,r]=D(null);xn(e,t);const i=["input","output","cacheRead","cacheWrite","reasoning","calls","cost","apiCost"].map(u=>t?.[u]??"").join(":");ee(()=>{if(!e.sessionId||!e.api?.getSessionCost)return;let u=!0,d=!1;const m=async()=>{if(!(d||typeof document<"u"&&document.hidden)){d=!0;try{const p=await e.api.getSessionCost(e.sessionId);u&&r({id:e.sessionId,include:a?.includeSubagentCost===!0,value:p})}catch{u&&r(p=>p?.id===e.sessionId&&p.include===(a?.includeSubagentCost===!0)?p:{id:e.sessionId,include:a?.includeSubagentCost===!0,value:null})}finally{d=!1}}};m();const g=a?.includeSubagentCost===!0?setInterval(m,1e4):null,f=()=>{document.hidden||m()};return typeof document<"u"&&document.addEventListener?.("visibilitychange",f),()=>{u=!1,g!==null&&clearInterval(g),typeof document<"u"&&document.removeEventListener?.("visibilitychange",f)}},[e.sessionId,n?.meta?.now,i,a?.includeSubagentCost]);const l=o&&o.id===e.sessionId&&o.include===(a?.includeSubagentCost===!0)?o:null,c=l?.value;return{usage:eo(t,c,a?.includeSubagentCost||c&&c.subagentCount>0,a),config:a,pending:!!e.sessionId&&!!e.api?.getSessionCost&&!l,unrecorded:!!c&&!c.found&&!c.subagentCount}}function ao(e){const t=j(e.config)==="en";return e.pending?t?"Loading session cost…":"正在读取本会话费用…":e.unrecorded?t?"Session cost: no ledger records":"本会话暂无账本记录":e.usage?"":t?"Session cost unavailable":"本会话费用暂不可用"}function no(e,t){if(Number.isFinite(e?.costCny)||Number.isFinite(e?.costEur)){const o=Q(e,{...t,showTotalWithPlan:!0}),r=Q(e,{...t,showTotalWithPlan:!1});return{cost:t.showTotalWithPlan?o:r,planPart:t.showTotalWithPlan?0:Math.max(0,o-r)}}let n=0,a=vt(e,t);if(t.showTotalWithPlan!==!0&&(e.apiCost!==void 0||gn(e,t))){const o={total:vt(e,t),api:hn(e,t)};n=Math.max(0,o.total-o.api),n>0&&(a=o.api)}return{cost:a,planPart:n}}function so(e,t){return Object.entries(e?.byProviderModel??{}).filter(([,n])=>n.input||n.output||n.cacheRead||n.cacheWrite||n.reasoning).map(([n,a])=>bt(n)+" "+$(Q(a,{...t,showTotalWithPlan:!0}),t)).join("; ")}function oo(e){const t=e.useCost?.(h=>h)?.state?.config,[n,a]=D(null),[o,r]=D(""),i=e.turn?.start?.seq,l=e.turn?.end?.seq,c=e.sessionId,u=JSON.stringify([t?.prices,t?.priceOverrides,t?.priceMatch,t?.planBilling,t?.codingPlans,t?.goQuota?.enabled,t?.peakEnabled,t?.peakEffectiveAt,t?.peakWindows,t?.peakHolidays,t?.exchangeRate]);if(ee(()=>{let h=!0;if(a(null),r(""),!(t?.hideTurnCost||!c||i==null||l==null))return e.api.getTurnCost(c,i,l).then(A=>{h&&a(A)},A=>{h&&r(String(A.message??A))}),()=>{h=!1}},[c,i,l,u,t?.hideTurnCost]),!t||t.hideTurnCost||i==null||l==null)return null;const d=j(t)==="en",m=d?{input:"Input",output:"Output",cacheRead:"Cache read",cacheWrite:"Cache write",reasoning:"Reasoning"}:{input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",reasoning:"推理"},g=h=>{const A=Number(t.exchangeRate),x=h*(Number.isFinite(A)&&A>0?A:1),y=t.decimals??2;return $(h,x>0&&x<10**-(y+2)?{...t,decimals:Math.max(8,y)}:t)},f=h=>$(h,{...t,decimals:Math.max(8,t.decimals??2)}),p=d?{model:"Model call",compaction:"Context compaction",search:"Native search",fetch:"Web fetch"}:{model:"模型调用",compaction:"上下文压缩",search:"原生搜索",fetch:"网页抓取"},k=(h,A)=>s("div",{key:A,style:{marginBottom:4,overflowWrap:"anywhere"}},bt(h.provider+":"+h.model)+" · "+(m[h.bucket]||(h.bucket==="fetchRequests"?d?"Fetch requests":"抓取请求":d?"Search requests":"搜索请求"))+(h.plan?" (Plan)":"")+": "+(h.requests?h.requests+(d?" requests":" 次"):h.tokens.toLocaleString())+" × "+(h.priced?f(h.rate):"?")+(h.requests?" ≈ ":" / 1,000,000 ≈ ")+(h.priced?g(h.cost):"?"),h.priced?h.bucket==="reasoning"&&h.rate===0?d?" (no separate charge)":"(不单独收费)":"":d?" (price unavailable)":"(未配置价格)");return s("details",{className:"cm-note",style:{fontSize:12,marginTop:6}},s("summary",{style:{cursor:"pointer"},title:d?"Log estimate at configured prices; session cost uses recorded ledger amounts.":"本轮按日志和配置价格估算,本会话按账本已入账金额汇总。"},d?"Turn cost":"本轮费用",n?.found?" ≈ "+g(Q(n,t))+(n.rows.some(h=>!h.priced)?d?" + unpriced usage":" + 未定价用量":""):n?.inherited?d?" · inherited history":" · 继承历史":o?" ⚠":""),o?s("div",{role:"alert"},o):n?n.found?s(R,null,s("p",null,d?"Estimated from recorded usage and configured prices; rates per 1M tokens.":"按已记录用量和配置价格估算;单价单位为每百万 Token。"),s("p",null,"API ≈ "+g(Q(n,{...t,showTotalWithPlan:!1}))+" · Plan ≈ "+g(Q(n,{...t,showTotalWithPlan:!0})-Q(n,{...t,showTotalWithPlan:!1}))+(d?" (equivalent)":"(等值)")),n.rows.map(k),s("details",null,s("summary",{style:{cursor:"pointer"}},(d?"Individual calls":"逐次调用明细")+" ("+n.calls.length+")"),n.calls.map((h,A)=>s("details",{key:A,style:{margin:"6px 0"}},s("summary",{title:h.provider+":"+h.model,style:{cursor:"pointer",overflowWrap:"anywhere"}},"#"+(A+1)+" "+p[h.kind]+" · "+bt(h.provider+":"+h.model)+" · "+new Date(h.atMs).toLocaleTimeString()+" · "+(h.plan?"Plan ":"API ")+(h.priced?"≈ "+g(h.cost):d?"price unavailable":"未配置价格")+(h.longContext?d?" · long context":" · 长上下文价格":"")),h.metering?s("p",null,"billion-context · "+h.metering.upstream+(h.metering.attempt>1?(d?" · Retry ":" · 重试 ")+h.metering.attempt:"")+(h.metering.complete?"":d?" · partial usage":" · 用量回执不完整")):null,h.rows.map(k))))):n.inherited?d?"Inherited usage is not billed again in this conversation.":"继承的历史用量不在本会话重复计费。":d?"Complete usage records unavailable":"没有完整用量记录":d?"Loading…":"加载中…")}function ro(e){const t=e.useCost?.(C=>C),n=to(e),{usage:a,config:o}=n,[r,i]=D(null),l=e.entryPosition!=="header"&&o?.hideSessionCostDock===!0,c=!l&&!!e.sessionId&&r===e.sessionId;if(ee(()=>{i(null)},[e.sessionId,l]),l||!e.sessionId)return null;const u=j(o)==="en",d=z(j(o)),m=o?ao(n):t?.error||(u?"Loading…":"加载中…"),g=s(zn,{open:c,onClose:()=>i(null),sessionId:e.sessionId,state:t?.state,error:t?.error,api:e.api});if(o&&m)return s(R,null,s("span",{className:"cm-dp-status",role:"status",title:m},m),g);const{cost:f,planPart:p}=a&&o?no(a,o):{cost:0,planPart:0},k={amount:$(f,o),planAmount:$(p,o),hitRate:yn(a)>0?((a?.cacheRead??0)/yn(a)*100).toFixed(1)+"%":"—",input:E(a?.input??0),cache:E((a?.cacheRead??0)+(a?.cacheWrite??0)),output:E(a?.output??0)},h=o?d(p>0?"sessionLineSplit":"sessionLine",k):m,A=o?so(a,o):"",x=na(u),b=e.entryPosition==="header"||o?.sessionCostCompact===!0?p>0?"sessionLineSplitCompact":"sessionLineCompact":p>0?"sessionLineSplit":"sessionLine",w=m||d(b,k),N=()=>Ca(e.api?.loadStatistics,{state:t?.state,sessionId:e.sessionId});return s(R,null,s(K,{portal:!0,label:[h,o?.includeSubagentCost?u?"Includes subagents":"含子代理":u?"Main session only":"仅主会话",A].filter(Boolean).join("; "),side:"top"},s("button",{type:"button",className:"cm-dp"+(e.entryPosition==="header"?" cm-dp-header":""),"aria-label":x,"aria-haspopup":"dialog","aria-expanded":c,onMouseEnter:N,onFocus:N,onClick:()=>i(e.sessionId)},s("span",{className:"cm-dl"},w))),g)}const io={CNY:"¥",USD:"$",EUR:"€",GBP:"£",JPY:"JP¥",KRW:"₩",INR:"₹",HKD:"HK$",SGD:"S$",AUD:"A$",CAD:"C$",CHF:"CHF",NZD:"NZ$",BRL:"R$",MXN:"MX$",ZAR:"R",TRY:"₺",SEK:"kr",NOK:"NKr",DKK:"Dkr",PLN:"zł",THB:"฿",IDR:"Rp",MYR:"RM",PHP:"₱",ILS:"₪"};function wn(e,t){const n=e?.symbol||"$";return!t||t===e?.currency?n:io[t]??t+" "}function Nn(e,t,n){const a=t?.balance?.currency,o=(a==="display"?t?.currency:a)??n,r=t?.fxRates;return o!==n&&r?.[n]>0&&r?.[o]>0?[e/r[n]*r[o],o]:[e,n]}function Re(e,t,n){const a=typeof n=="string"?n.toUpperCase():"",[o,r]=Nn(e,t,a);return le(o,{symbol:wn(t,r),decimals:Math.max(2,Math.min(10,Math.floor(Number(t?.decimals)||2)))})}function sa(e,t){const n=Number(e?.balance?.budgetCap);if(Number.isFinite(n)&&n>0)return n;const a=Number(t?.maxBudget);return Number.isFinite(a)&&a>0?a:null}function lo(e){const t=e.today,n=t?.byProviderModel;if(n===null||typeof n!="object"||Object.keys(n).length===0)return Number(t?.cost)||0;let a=0;for(const[o,r]of Object.entries(n)){const i=o.indexOf(":");let l=i>=0?o.slice(0,i):o;l.startsWith("llm-")&&(l=l.slice(4)),/^deepseek(?:-official|-account)?$/.test(l)&&(a+=Number(r?.cost)||0)}return a}function Sn(e,t,n,a,o=null){const r=n==="official"?lo(e):Number(e.today?.cost)||0,i=n==="custom"?lt(t,a,o):e.balance?.currency;if(i==="USD")return r;if(i==="CREDITS")return 0;const l=Number(t?.fxRates?.[i]??t?.exchangeRate);return r*(Number.isFinite(l)&&l>0?l:1)}function oa({remaining:e,spend:t,todayUsed:n,cap:a}){if(a===null||a<=0)return{remainingPct:0,todayPct:0,spentPct:0,hasCap:!1,pastSpend:0,today:0};const o=Math.max(0,Number(e)||0),r=Math.max(0,Number(t)||0),i=Math.max(0,Math.min(r,Number(n)||0)),l=Math.max(0,r-i),c=Math.max(0,Math.min(100,o/a*100)),u=Math.max(0,Math.min(100-c,i/a*100)),d=Math.max(0,Math.min(100-c-u,l/a*100));return{remainingPct:c,todayPct:u,spentPct:d,hasCap:!0,pastSpend:l,today:i}}function ra(e,t,n=null,a=null){const o=n??e.customBalance;if((a??t?.customBalance)?.adapter==="tokenrhythm")return{cap:null,...oa({remaining:o?.remaining,cap:null})};const r=sa(lt(t,o,a)==="CREDITS"?null:t,o),i=Number(o?.remaining)||0,l=Number(o?.spend)||0,c=Sn(e,t,"custom",o,a);return{cap:r,...oa({remaining:i,spend:l,todayUsed:c,cap:r})}}function co(e,t){const n=e.balance,a=sa(t,null),o=Number(n?.totalBalance)||0,r=Sn(e,t,"official",null),i=a===null?0:Math.max(0,a-o);return{cap:a,...oa({remaining:o,spend:i,todayUsed:r,cap:a})}}function ia(e){const{segments:t,direction:n="remaining"}=e,{remainingPct:a,todayPct:o,spentPct:r,hasCap:i}=t;if(!i)return null;const l=[];a>0&&l.push(s("div",{className:"cm-bbox-fill",style:{width:a+"%"}})),o>0&&l.push(s("div",{className:"cm-bbox-seg-today",style:{width:o+"%"}})),r>0&&l.push(s("div",{className:"cm-bbox-seg-spent",style:{width:r+"%"}}));const c=n==="used"?[...l].reverse():l;return s("div",{className:"cm-bbox-bar segments"+(n==="used"?" rev":"")},...c)}function uo(e,t,n,a,o){const r=[e("balanceBarRemaining",{amount:a})];return n.today>0&&r.push(e("balanceBarToday",{amount:t(n.today)})),n.pastSpend>0&&r.push(e("balanceBarSpent",{amount:t(n.pastSpend)})),o!==null&&o>0&&r.push(e("balanceBudgetCapLabel")+": "+t(o)),r.join(" · ")}function De(e){const[t,n]=D(!1),[a,o]=D(null);return{busy:t,err:a,run:()=>{t||typeof e!="function"||(n(!0),o(null),Promise.resolve().then(e).catch(i=>{o(i?.message??String(i))}).finally(()=>{n(!1)}))}}}const be=(e,t)=>({role:"button",tabIndex:0,"aria-busy":e?"true":"false",onClick:t,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),t())}});function Se(e,t){const n=[e("clickToRefresh")];return t.busy&&n.push(e("refreshing")),t.err&&n.push("⚠ "+e("queryFailed")+": "+t.err),n}const mo="https://platform.deepseek.com/usage";function it(e,t=mo,n=e("balanceRechargeLink")){if(!t)return null;try{const a=new URL(t);if(!["http:","https:"].includes(a.protocol)||a.username||a.password)return null}catch{return null}return s("a",{className:"cm-bal-link",href:t,target:"_blank",rel:"noreferrer noopener",title:n,"aria-label":n,onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation()},s("svg",{width:14,height:14,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},s("path",{d:"M8 4H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4M11 3h6v6M9 11l8-8"})))}const Mt=kn({});function Pt(e,t,n){const a=()=>{const u=Mt.getSnapshot()[t];if(u!==void 0)return u;try{return window.localStorage?.getItem("cm.balance.hidden."+t)==="1"}catch{return!1}},[o,r]=D(a);ee(()=>{const u=()=>r(a()),d=Mt.subscribe(u);return u(),d},[t]);const i=e.balance?.quickHide===!0,l=i&&o,c=u=>{u.stopPropagation();const d=!a();try{window.localStorage?.setItem("cm.balance.hidden."+t,d?"1":"0")}catch{}Mt.set({...Mt.getSnapshot(),[t]:d}),r(d)};return{hidden:l,label:u=>i?s("span",{role:"button",tabIndex:0,"aria-pressed":l,title:n("balanceToggle"),onClick:c,onKeyDown:d=>{d.stopPropagation(),(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c(d))}},u):u,tip:[n("balanceHidden"),n("balanceToggle")].join(" · ")}}function la(e){const{state:t,wide:n,api:a}=e,o=t.balance,r=z(j(t.config)),i=De(a?()=>a.refreshBalance():null),l=Pt(t.config,e.accountId??"official",r),c=e.label??Cn(r,t.config);if(!o||o.status==="off")return null;if(o.status==="error")return s(K,{portal:!0,label:[r("balanceQueryFailed",{message:o.message||r("unknownError")}),...Se(r,i)].join("; "),side:"right",delayMs:300},s("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+" cm-bal-err"+(i.busy?" busy":""),...be(i.busy,i.run)},n?s(R,null,c," ",s("span",{className:"cm-num"},r("queryFailed"))):"⚠"));const u=l.hidden?l.tip:vn(r,o,t.config,t.reconcile,i);return s(K,{portal:!0,label:e.label?s(R,null,s("strong",null,e.label),u):u,side:"right",delayMs:300},s("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+(i.busy?" busy":""),...be(i.busy,i.run)},n?s(R,null,s("span",{className:"cm-balance-name"},l.label(c),it(r)),s("span",{className:"cm-num cm-bal-amt"},l.hidden?"••••":Re(o.totalBalance,t.config,o.currency)),t.reconcile?.ok===!1?" ⚠":""):s(At,{size:16})))}function po(e,t,n){if(n||e.config?.balance?.officialChannelOnly!==!0)return!0;const a=o=>/^(?:llm-)?deepseek(?:-official|-account)?$/.test(String(o).trim().toLowerCase());return typeof t=="string"&&t.trim()?a(t):Object.keys(e.today?.byProviderModel??{}).some(o=>a(o.split(":")[0]))}function Cn(e,t){return e(t?.balance?.showSource===!0?"officialBalance":"balance")}function vn(e,t,n,a,o){const r=[e("officialBalance")+" "+Re(t.totalBalance,n,t.currency),e("grantedToppedUp",{granted:Re(t.grantedBalance,n,t.currency),toppedUp:Re(t.toppedUpBalance,n,t.currency)}),...n.balance?.showProgressBar&&sa(n,null)===null?[e("balanceNoCap")]:[],...a?.ok===!1?["⚠ "+a.message]:[],...Se(e,o)];return s("div",{style:{maxWidth:"min(225px, 68vw)",whiteSpace:"normal",fontSize:11,lineHeight:1.5}},...r.map((i,l)=>s("div",{key:l},i)))}function fo(e){const{state:t,wide:n,api:a}=e,o=t.config,r=t.balance,i=z(j(o)),l=De(a?()=>a.refreshBalance():null),c=Pt(o,"official",i);if(!r||r.status!=="ok")return null;const u=co(t,o),d=c.hidden?"••••":Re(r.totalBalance,o,r.currency),m=c.hidden?c.tip:vn(i,r,o,t.reconcile,l),g=s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-balance-name"},s("span",{className:"cm-bbox-label"},c.label(Cn(i,o))),it(i)),s("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},d)),c.hidden?null:s(ia,{segments:u,direction:re(o,"balance")}));return s(K,{portal:!0,label:m,side:"right",delayMs:300},s("div",{"data-cm-display":"balance",className:"cm-bbox clickable"+(n?"":" rail")+(l.busy?" busy":""),...be(l.busy,l.run)},n?g:s("div",{className:"cm-bbox-rail cm-num"},c.hidden||!u.hasCap?d:Math.round(u.remainingPct)+"%")))}function ca(e,t){const n=typeof e?.label=="string"?e.label:"",a=typeof e?.labelEn=="string"?e.labelEn:"";return t==="en"?a||n||"Custom balance":n||a||"自定义余额"}function lt(e,t,n){if((n??e?.customBalance)?.adapter==="tokenrhythm")return"CNY";if((n??e?.customBalance)?.adapter==="aliyun"&&["CNY","USD","EUR"].includes(t?.unit))return t.unit;const a=n?.unit??e?.customBalance?.unit;return["CNY","EUR","USD","CREDITS"].includes(a)?a:["CNY","EUR","CREDITS"].includes(t?.unit)?t.unit:"USD"}function Qe(e,t,n,a){const o=lt(t,n,a),r=Number(e);if(!Number.isFinite(r))return"—";const i=Math.max(2,Math.min(6,Math.floor(Number(t?.decimals)||4)));if(o==="CREDITS")return ln(r,i)+" Credits";const l=t?.currency==="USD"?1:Number(t?.exchangeRate);if((a??t?.customBalance)?.convertToDisplayCurrency===!0&&o==="USD"&&(t?.balance?.currency??"native")==="native"&&l>0&&Number.isFinite(l)){const m=r*l;return Number.isFinite(m)?le(m,t):"—"}const[u,d]=Nn(r,t,o);return Number.isFinite(u)?le(u,{symbol:wn(t,d),decimals:i}):"—"}function ua(e,t,n,a,o=null){const r=Qe(e.remaining,t,e,o);if((o??t?.customBalance)?.adapter==="aliyun"&&e.message)return n("customBalanceRemaining",{amount:r})+" · "+e.message;if(o?.adapter==="openai-credits"){const g=f=>Qe(f,t,e,o);return n("openAiCreditSummary",{total:g(e.maxBudget),used:g(e.spend),remaining:r,expiry:o.grantExpiry})}if((o??t?.customBalance)?.adapter==="tokenrhythm")return n("customBalanceRemaining",{amount:r});const i=g=>Qe(g,t,e,o);if(a&&t.balance?.showProgressBar===!0){const g=ra(a,t,e,o);return[uo(n,i,g,r,g.cap),n("updatedAt",{time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"})].join(" · ")}const l=e.spend!==null?i(e.spend):"—",c=e.maxBudget!==null?i(e.maxBudget):"—",u=lt(t,e,o)==="CREDITS"?NaN:Number(t?.balance?.budgetCap),d=Number.isFinite(u)&&u>0?n("balanceBudgetCapLabel")+": "+i(u):"",m=e.maxBudget!==null&&e.spend!==null?n("customBalanceLine",{remaining:r,spend:l,maxBudget:c,time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"}):n("customBalanceRemaining",{amount:r});return d?m+" · "+d:m}function bo(e,t,n,a,o,r){const i=ca(o??t.customBalance??{},j(t)),l=r?.hidden?"••••":Qe(a.remaining,t,a,o),c=ra(e,t,a,o);return{level:"ok",rail:r?.hidden||!c.hasCap?l:Math.round(c.remainingPct)+"%",body:s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-balance-name"},s("span",{className:"cm-bbox-label"},r?r.label(i):i),it(n,o?.dashboardUrl||"",i)),s("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},l)),r?.hidden?null:s(ia,{segments:c,direction:re(t,"balance")}))}}function Ot(e,t){if(t?.hideCustomBalance===!0)return[];const n=t?.customBalances??[],a=Array.isArray(e?.customBalances)?e.customBalances:[],o=[];return n.forEach((r,i)=>{if(r?.enabled!==!0||r.display!=="sidebar"&&r.display!=="both")return;const l=a.find(c=>c.index===i)??(a.length===1&&n.length===1?a[0]:null);o.push({index:i,entry:r,snapshot:l})}),o.length===0&&a.length===0&&t?.customBalance?.enabled===!0&&(t.customBalance.display==="sidebar"||t.customBalance.display==="both")&&e?.customBalance?.status&&e.customBalance.status!=="off"&&o.push({index:null,entry:t.customBalance,snapshot:e.customBalance}),o}function go(e){const{state:t,wide:n,api:a}=e,o=t.config,r=z(j(o)),i=Ot(t,o);return i.length===0?null:s(R,null,i.map(({index:l,entry:c,snapshot:u})=>s(["tokenrhythm","openai-credits"].includes(c.adapter)?An:yo,{key:"cb-"+l,state:t,wide:n,api:a,t:r,index:l,entry:c,snapshot:u})))}function yo(e){const{state:t,wide:n,api:a,t:o,index:r,entry:i,snapshot:l}=e,c=t.config,u=Pt(c,"custom-"+r,o),d=De(a?()=>a.refreshCustomBalance(r):null);if(l==null||l.status!=="ok")return null;const m=bo(t,c,o,l,i,u),g=u.hidden?u.tip:[ua(l,c,o,t,i),...Se(o,d)].join(" · ");return s(K,{portal:!0,label:g,side:"right",delayMs:300},s("div",{"data-cm-display":"customBalance",className:"cm-bbox clickable"+(m.level==="ok"?"":" "+m.level)+(n?"":" rail")+(d.busy?" busy":""),...be(d.busy,d.run)},n?m.body:s("div",{className:"cm-bbox-rail cm-num"},m.rail)))}function ho(e){const{state:t,wide:n,api:a}=e,o=t.config,r=z(j(o)),i=Ot(t,o);return i.length===0?null:s(R,null,i.map(({index:l,entry:c,snapshot:u})=>s(An,{key:"cbr-"+l,state:t,wide:n,api:a,t:r,index:l,entry:c,snapshot:u})))}function An(e){const{state:t,wide:n,api:a,t:o,index:r,entry:i,snapshot:l}=e,c=t.config,u=Pt(c,"custom-"+r,o),d=l??za(r),m=De(a?()=>a.refreshCustomBalance(r):null);if(d.status==="off")return null;const g=ca(i??c.customBalance??{},j(c));if(d.status==="error")return s(K,{portal:!0,label:[d.message||o("unknownError"),...Se(o,m)].join("; "),side:"right",delayMs:300},s("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+" cm-bal-err"+(m.busy?" busy":""),...be(m.busy,m.run)},n?s(R,null,s("span",{className:"cm-balance-name"},s("span",{className:"cm-bal-label",title:g},g),it(o,i?.dashboardUrl||"",g)),s("span",{className:"cm-num cm-bal-amt"},o("queryFailed"))):"⚠"));const f=u.hidden?"••••":Qe(d.remaining,c,d,i),p=u.hidden?u.tip:[ua(d,c,o,t,i),...Se(o,m)].join(" · ");return s(K,{portal:!0,label:p,side:"right",delayMs:300},s("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+(m.busy?" busy":""),...be(m.busy,m.run)},n?s(R,null,s("span",{className:"cm-balance-name"},s("span",{className:"cm-bal-label",title:g},u.label(g)),it(o,i?.dashboardUrl||"",g)),s("span",{className:"cm-num cm-bal-amt"},f)):s(At,{size:16})))}function Mn(e){const n=(e.useCost?e.useCost(p=>p):void 0)?.state;if(!n)return null;const a=n.config,o=z(j(a)),r=a.corner??{enabled:!1,goRolling:!0,goWeekly:!0,goMonthly:!0,budget:!0},i=n.goQuota,l=a?.goQuota?.enabled!==!1&&i?.status==="ok",c=p=>p!==null&&typeof p?.percent=="number"?Math.round(Math.max(0,Math.min(100,p.percent))):null,u=[];if(a.sidebarModels?.dock){const p=$n(n,a.sidebarModels.period,o);p.length&&u.push({key:"model-top",text:s(R,null,s("span",{className:"cm-bal-label"},p[0].label),s("span",{className:"cm-bal-amt"},$(p[0].cost,a))),tip:p[0].label+" "+$(p[0].cost,a),level:"ok"})}const d=(p,k,h,A)=>{if(!r.enabled||!p||!l)return;const x=c(k);if(x===null)return;const y=typeof k.resetsAt=="string"&&k.resetsAt.length>0?o("goResetAt",{time:new Date(k.resetsAt).toLocaleString()}):"";u.push({key:h,text:o(h)+" "+x+"%",tip:o(A)+": "+x+"%"+(y?" · "+y:""),level:x>=100?"over":x>=80?"warn":"ok"})},m=a?.goQuota?.main==="weekly"||a?.goQuota?.main==="monthly"?a.goQuota.main:"rolling",g=[m,...["rolling","weekly","monthly"].filter(p=>p!==m)],f=p=>p==="rolling"?["goRolling",i?.rolling,"goShortRolling","cornerGoRolling"]:p==="weekly"?["goWeekly",i?.weekly,"goShortWeekly","cornerGoWeekly"]:["goMonthly",i?.monthly,"goShortMonthly","cornerGoMonthly"];for(const p of g){const[k,h,A,x]=f(p);d(r[k]===!0,h,A,x)}if(r.enabled&&r.budget===!0){const p=a.budget??{enabled:!1,amount:100,period:"month"};if(p.enabled===!0){const k=Number(a.exchangeRate),A=(n.budgetUsed??(p.period==="day"?Q(n.today,a):p.period==="all"?Q(n.total,a):Q(n.month,a)))*(Number.isFinite(k)&&k>0?k:1),x=Math.max(0,Number(p.amount)||0),y=x>0?Math.min(999,A/x*100):null;if(y!==null){const b=y>=100?"over":y>=80?"warn":"ok";u.push({key:"budget",text:o("budgetShort")+" "+y.toFixed(1)+"%",tip:o("budgetOf",{period:o(et[p.period]??"periodMonth")})+" · "+o("usedOf",{used:le(A,a),amount:le(x,a)}),level:b})}}}return u.length===0?null:s("div",{className:"cm-corner"},u.map(p=>s(K,{portal:!0,key:p.key,label:p.tip,side:"top",delayMs:500},s("span",{className:"cm-corner-chip"+(p.key==="model-top"?" cm-model-top":"")+(p.level==="ok"?"":" "+p.level)},p.text))))}function da(e,t,n,a){if(a==="volcengine"&&(n=[]),!Array.isArray(t)||t.length===0||!Number.isFinite(e))return null;const o=(f,p)=>{const k=new Date(e);return k.setUTCDate(k.getUTCDate()+f),k.setUTCHours(p,0,0,0),k.getTime()},r=new Set,i=Math.max(12,Math.min(380,(Array.isArray(n)?n.length:0)+7));for(let f=-i;f<=i;f+=1){r.add(o(f,16));for(const p of t){const k=Number(p?.start),h=Number(p?.end);!Number.isFinite(k)||!Number.isFinite(h)||(r.add(o(f,k)),r.add(o(h<=k?f+1:f,h)))}}const l=[...r].sort((f,p)=>f-p).flatMap(f=>{const p=St(f-1,void 0,t,n),k=St(f,void 0,t,n);return p===k?[]:[{at:f,intoPeak:k}]});let c=null,u=null;for(const f of l)f.at<=e&&(c===null||f.at>c.at)&&(c=f),f.at>e&&(u===null||f.at<u.at)&&(u=f);const d=nn(e,n),m=d??an(e);return m!==null?u===null?null:{inPeak:!1,weekend:d===null,...d?{holiday:!0}:{},prevAtMs:m.start,nextAtMs:u.at,nextIntoPeak:u.intoPeak}:c===null||u===null?null:{inPeak:St(e,void 0,t,n),weekend:!1,prevAtMs:c.at,nextAtMs:u.at,nextIntoPeak:u.intoPeak}}function Be(e,t){if(!e||e.peakNotice===!1||e.peakEnabled!==!0)return null;const n=Date.parse(e.peakEffectiveAt||"");return Number.isFinite(n)&&t<n?null:ma(e,t)}function ma(e,t){const n=String(e?.peakProvider??"").trim().toLowerCase().replace(/^llm-/,""),a=e?.prices?.providers?.[n]??(["deepseek-official","deepseek-account",""].includes(n)?e?.prices?.providers?.deepseek:void 0),o=a&&{peakSchedule:n==="ollama-cloud"&&e.prices.ollamaPeak!==!1?"ollama":["volcengine","ark"].includes(n)&&e.prices.volcenginePeak!==!1?"volcengine":void 0,...a},r={enabled:e?.peakEnabled===!0,effectiveAtMs:Date.parse(e?.peakEffectiveAt),windows:e?.peakWindows,holidays:e?.peakHolidays};return o&&qe(o,t,r)!==null?Es(o,t,r):da(t,e?.peakWindows??[],e?.peakHolidays,["volcengine","ark"].includes(n)?"volcengine":void 0)}function pa(e,t){const n=e?.config,a=t??n?.peakProvider??e?.meta?.defaultProvider;return n&&a?{...n,peakProvider:a}:n}function Pn(e,t,n){let a=t.prevAtMs;for(let o=0;o<16;o++){const r=ma(e,a-1);if(!r||r.inPeak!==t.inPeak||r.prevAtMs>=a)break;a=r.prevAtMs}return{start:a,progress:Math.max(0,Math.min(100,(n-a)/Math.max(1,t.nextAtMs-a)*100))}}function Tt(e,t,n){const{progress:a}=Pn(e,t,n);return(t.weekend||t.holiday?a:(t.inPeak?0:50)+a/2)+"%"}function Ge(e,t){const[n,a]=D(Date.now());return ee(()=>{if(t!==void 0)return;let o;const r=()=>{if(window.clearTimeout(o),document.hidden)return;const i=Date.now(),l=Be(e,i);a(i),o=window.setTimeout(r,Math.max(100,Math.min(3e4,(l?.nextAtMs??i+3e4)-i)))};return r(),document.addEventListener("visibilitychange",r),()=>{window.clearTimeout(o),document.removeEventListener("visibilitychange",r)}},[t,e.peakWindows,e.peakHolidays,e.peakProvider]),t??n}function Ve(e){return e.holiday===!0?{short:"holidayShort",chip:"holidayChip",notice:"holidayAllOffPeak"}:e.weekend===!0?{short:"weekendShort",chip:"weekendChip",notice:"weekendAllOffPeak"}:e.inPeak?{short:"peakShort",chip:"peakShort",notice:"peakNotice"}:{short:"offPeakShort",chip:"offPeakShort",notice:"offPeakActive"}}function Ce(e,t,n){const a=Math.max(0,e.nextAtMs-t),o=Math.max(1,Math.ceil(a/6e4)),r=Math.floor(o/60),i=o%60;return r>0?i>0?n("countdownHourMinute",{h:r,m:i}):n("countdownHoursOnly",{h:r}):n("countdownMinute",{m:o})}function On(e){const t=Ne(null),n=Ne(e.actions);n.current=e.actions,ee(()=>{const c=t.current;if(!c)return;try{typeof c.showPopover=="function"?c.showPopover():c.removeAttribute("popover")}catch{c.removeAttribute("popover")}let u=!1;const d=p=>{c.contains(p.target)&&(u=!0,p.stopPropagation())},m=p=>{u&&(u=!1,p.stopPropagation())},f=[["pointerdown",d],["pointerup",m],["pointercancel",m],["touchstart",d],["click",p=>{if(!c.contains(p.target))return;p.stopPropagation();const k=p.target.closest?.("[data-cm-action]");k&&!k.disabled&&n.current[k.dataset.cmAction]?.()}]];for(const[p,k]of f)window.addEventListener?.(p,k,{capture:!0,passive:!0});return()=>{for(const[p,k]of f)window.removeEventListener?.(p,k,!0);try{c.hidePopover()}catch{}}},[]);const{actions:a,children:o,...r}=e,i=s("div",{...r,ref:t,popover:"manual"},o);let l;try{l=ge("react-dom")?.createPortal}catch{}return typeof l=="function"?l(i,document.body):i}const ko="cm-peak-alert-preview";function xo(e){return e.useCost?.(n=>n)?.state?.config?.peakEnabled===!0?s(ct,{...e,view:"alert"}):null}function wo(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const r=Ve(o),i=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)});return s(K,{portal:!0,label:n(r.notice),side:"right",delayMs:300},s("div",{"data-cm-display":"peak",className:"cm-peak-strip "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off")},s("div",{className:"cm-peak-track"},s("div",{className:"cm-peak-segment cm-peak-high"}),s("div",{className:"cm-peak-segment cm-peak-low"}),s("div",{className:"cm-peak-marker",style:{left:Tt(t,o,a)}})),s("span",{className:"cm-peak-chip"},n(r.chip)+" · "+i)))}function No(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const r=Ve(o),i=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)});return s(K,{portal:!0,label:n(r.notice),side:"right",delayMs:300},s("div",{"data-cm-display":"peak",className:"cm-peak-classic "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off")},s("div",{className:"cm-peak-classic-marker",style:{left:"clamp(6px, "+Tt(t,o,a)+", calc(100% - 6px))"}}),s("div",{className:"cm-peak-track"},s("div",{className:"cm-peak-segment cm-peak-high"}),s("div",{className:"cm-peak-segment cm-peak-low"})),s("span",{className:"cm-peak-classic-chip"},n(r.chip)+" · "+i)))}let Tn;function So(){return Tn??=ge.async("./client.peak.js").then(e=>e.mount({peakView:Be,peakPhaseAt:da,peakPhaseForConfig:ma,peakConfigForState:pa,peakPeriodProgress:Pn,usePeakClock:Ge,phaseLabelKeys:Ve,countdownText:Ce,resolveLocale:j,makeT:z,Tooltip:K,FloatingCard:On})).catch(e=>{throw Tn=null,e})}function ct(e){return s(ne,{...e,load:So,quiet:!0})}function Rn(e,t,n){return t.sidebarTextOnly===!0?s(ct,{config:t,t:n}):s(t?.peakStyle==="progress"?ct:t?.peakStyle==="classic"?No:wo,{config:t,t:n})}function Co(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const r=Ve(o),i=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)}),l=[n(r.notice),i];return s(K,{portal:!0,label:l,side:"right",delayMs:300},s("div",{className:"cm-peak-rail "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off"),"aria-label":l.join("; ")},s("div",{className:"cm-peak-rail-track"},s("div",{className:"cm-peak-rail-segment cm-peak-rail-high"}),s("div",{className:"cm-peak-rail-segment cm-peak-rail-low"}),s("div",{className:"cm-peak-rail-marker",style:{top:Tt(t,o,a)}})),s("span",{className:"cm-peak-rail-label"},n(r.short))))}function vo(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const r=Ve(o),i=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)}),l=[n(r.notice),i];return s(K,{portal:!0,label:l,side:"right",delayMs:300},s("div",{className:"cm-peak-rail-classic "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off"),"aria-label":l.join("; ")},s("div",{className:"cm-peak-rail-classic-track"},s("div",{className:"cm-peak-rail-classic-segment peak"}),s("div",{className:"cm-peak-rail-classic-segment off"}),s("div",{className:"cm-peak-rail-classic-marker",style:{top:Tt(t,o,a)}})),s("span",{className:"cm-peak-rail-classic-label"},n(r.short))))}function Ao(e,t,n){return t.sidebarTextOnly===!0?s(ct,{config:t,t:n,rail:!0}):s(t?.peakStyle==="progress"?ct:t?.peakStyle==="classic"?vo:Co,{config:t,t:n,rail:!0})}function Mo(e,t,n){const a=t.budget??{enabled:!1,amount:100,period:"month"},o=Number(t.exchangeRate),i=(e.budgetUsed??(a.period==="day"?Q(e.today,t):a.period==="all"?Q(e.total,t):Q(e.month,t)))*(Number.isFinite(o)&&o>0?o:1),l=Math.max(0,Number(a.amount)||0),c=l>0?Math.min(999,i/l*100):null,u=he(c===null?null:Math.min(100,c),re(t,"budget")),d=a.detail!==!1;return{level:c===null?"ok":c>=100?"over":c>=80?"warn":"ok",rail:u.label===null?"—":Math.round(u.label)+"%",body:s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-bbox-label"},n("budget")),s("span",{className:"cm-bbox-pct cm-num"},u.label===null?"—":u.label.toFixed(1)+"%")),s("div",{className:"cm-bbox-bar"},s("div",{className:"cm-bbox-fill",style:{width:u.width+"%"}})),d?s(R,null,s("div",{className:"cm-bbox-line cm-num"},n("usedOf",{used:le(i,t),amount:le(l,t)}))):null)}}function Po(e,t,n){const a=e.goQuota,o=t?.goQuota?.main==="weekly"||t?.goQuota?.main==="monthly"?t.goQuota.main:"rolling",r=a[o],i=r!==null&&typeof r?.percent=="number"?Math.max(0,Math.min(100,Number(r.percent)||0)):0,l=f=>f!==null&&typeof f?.percent=="number"?Math.round(he(f.percent,re(t,"go")).label)+"%":"—",c=f=>n(f==="rolling"?"goShortRolling":f==="weekly"?"goShortWeekly":"goShortMonthly"),u=["rolling","weekly","monthly"].filter(f=>f!==o),d=r!==null&&typeof r?.resetsAt=="string"&&r.resetsAt.length>0?n("goResetAt",{time:new Date(r.resetsAt).toLocaleString()}):"",m=t?.goQuota?.detail!==!1,g=he(i,re(t,"go"));return{level:i>=100?"over":i>=80?"warn":"ok",rail:g.label===null?"—":Math.round(g.label)+"%",body:s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-bbox-label"},n("goQuotaRowLabel")+" "+c(o)),s("span",{className:"cm-bbox-pct cm-num"},g.label===null?"—":Math.round(g.label)+"%")),s("div",{className:"cm-bbox-bar"},s("div",{className:"cm-bbox-fill",style:{width:g.width+"%"}})),m?s(R,null,s("div",{className:"cm-bbox-line cm-num"},u.map(f=>c(f)+" "+l(a[f])).join(" · ")),d?s("div",{className:"cm-bbox-line"},d):null):null)}}function Dn(e,t,n){const a=re(t,"go");return["rolling","weekly","monthly"].map((o,r)=>{const i=e?.[o],l=typeof i?.percent=="number"&&Number.isFinite(i.percent)?Math.max(0,Math.min(100,i.percent)):null,c=i?.resetsAt&&Number.isFinite(Date.parse(i.resetsAt))?" · "+n("goResetAt",{time:new Date(i.resetsAt).toLocaleString()}):"";return n(["goWindowRolling","goWindowWeekly","goWindowMonthly"][r])+": "+(l===null?"—":_e(he(l,a).label,a,n))+c}).concat(e?.fetchedAt>0?n("goQuotaFetchedAt",{time:new Date(e.fetchedAt).toLocaleTimeString()}):[]).join(`
3
- `)}function Bn({trigger:e,detail:t,refresh:n,busy:a,t:o,...r}){const i=e.props["data-cm-display"];return s("details",{...r,"data-cm-display":i,className:"cm-quota-details"+(i?" "+e.props.className:""),onKeyDown:l=>{l.key==="Escape"&&(l.currentTarget.open=!1,l.currentTarget.querySelector("summary")?.focus(),l.stopPropagation())}},s("summary",{...e.props,...i?{className:void 0,"data-cm-display":void 0}:{},"aria-label":e.props["aria-label"]||o("goQuotaRowLabel")},e.props.children),s("div",{className:"cm-quota-detail",role:"region","aria-label":o("goQuotaRowLabel")},s("div",{style:{whiteSpace:"pre-line"}},t),n?s("button",{type:"button",className:"cm-btn small",disabled:a,onClick:n},o(a?"refreshing":"refresh")):null))}function Oo(e){const{state:t,wide:n}=e,a=t.goQuota,o=z(j(t.config));if(!a||a.status!=="ok")return null;const r=t.config?.goQuota?.main==="weekly"||t.config?.goQuota?.main==="monthly"?t.config.goQuota.main:"rolling";if(a[r]===null||typeof a[r]?.percent!="number")return null;const i=Po(t,t.config,o),l=Dn(a,t.config,o);return s(K,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},l),side:"right",delayMs:300},s(Bn,{detail:l,t:o,trigger:s("summary",{"data-cm-display":"go",className:"cm-bbox"+(i.level==="ok"?"":" "+i.level)+(n?"":" rail")},n?i.body:s("div",{className:"cm-bbox-rail cm-num"},i.rail))}))}function To(e){return e===null||typeof e!="object"||e.unlimited||typeof e.percent!="number"?null:Math.max(0,Math.min(100,Math.round(Number(e.percent)||0)))}function fa(e){const t=e!==null&&typeof e=="object"?e:{};return{five:t["5h"]??null,seven:t["7d"]??t.week??t.weekly??null}}function Ln(e,t,n=Date.now()){if(typeof e!="string"||!e)return"";const a=Date.parse(e);if(!Number.isFinite(a))return"";const o=a-n;if(o<=0)return t("resetReached");const r=Math.ceil(o/6e4),i=Math.floor(r/1440),l=Math.floor(r%1440/60),c=r%60;return i>0?t("resetDays",{d:i,h:l}):l>0?t("resetHours",{h:l,m:c}):t("resetMinutes",{m:c})}function ut(e,t,n=Date.now()){const a=Ln(e?.resetsAt,t,n);return a?t("goResetAt",{time:new Date(e.resetsAt).toLocaleString()})+" ("+a+")":""}function _e(e,t,n){return e===null?"—":n(t==="remaining"?"quotaRemaining":"quotaUsed",{pct:e})}function Rt(e){const[,t]=D(0),n=()=>t(Date.now());return ee(()=>{if(!e)return;const a=setInterval(n,6e4);return()=>clearInterval(a)},[e]),{onMouseEnter:n,onFocus:n}}function En(e,t){if(!t)return s("div",{className:"cm-bbox-bar"},s("div",{className:"cm-bbox-fill",style:{width:e+"%"}}));const n={d:"M22 78 A40 40 0 1 1 78 78",pathLength:100,fill:"none",strokeWidth:8,strokeLinecap:"round"};return s("svg",{viewBox:"0 0 100 100","aria-hidden":!0},s("path",{...n,stroke:"currentColor",opacity:.18}),s("path",{...n,stroke:"currentColor",strokeDasharray:e+" 100",opacity:e>0?1:0}))}function dt(e,t,n,a,o,r){const i=To(t),l=i===null?"ok":i>=100?"over":i>=80?"warn":"ok",c=he(i,n),u=t?.unlimited?"∞":o?_e(c.label,n,a):c.label===null?"—":c.label+"%";return{level:l,pct:i,text:u,label:c.label,row:s("div",{key:e,className:"cm-mm-row"+(l==="ok"?"":" "+l)},s("span",{className:"cm-bbox-label"},e),En(c.width,r),s("span",{className:"cm-bbox-pct cm-num"},u))}}function ba(e){const{five:t,seven:n,fetchedAt:a,t:o,wide:r,refresh:i,direction:l="used",gauge:c}=e,u=Rt(t?.resetsAt),d=Ln(t?.resetsAt,o),m=dt(o("codingPlanRemain5h"),t,l,o,!1,c),g=dt(o("codingPlanRemain7d"),n,l,o,!1,c),f=m.level==="over"||g.level==="over"?"over":m.level==="warn"||g.level==="warn"?"warn":"ok",p=(x,y,b)=>{const w=y?.unlimited?o("quotaUnlimited"):_e(b.label,l,o),N=ut(y,o);return x+" "+w+(N?" · "+N:"")},k=[o("codingPlanMinimaxTitle"),p(o("codingPlanRemain5h"),t,m),p(o("codingPlanRemain7d"),n,g),a>0?o("goQuotaFetchedAt",{time:new Date(a).toLocaleTimeString()}):null,...i?Se(o,i):[]].filter(Boolean).join(`
4
- `),h=s(R,null,s("div",{className:"cm-mm-title"},o("codingPlanMinimaxTitle")),s(c?"div":R,c?{className:"cm-plan-gauges"}:null,m.row,g.row),d?s("div",{className:"cm-mm-reset"},"5h · "+d):null),A=s(R,null,s("div",{className:"cm-bbox-rail cm-num"},m.text),s("div",{className:"cm-bbox-rail cm-num"},g.text));return s(K,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},k),side:"right",delayMs:300},s("div",{...u,"data-cm-display":"plan","data-cm-plan":"minimax",className:"cm-bbox cm-mm"+(f==="ok"?"":" "+f)+(r===!1?" rail":"")+(i?" clickable"+(i.busy?" busy":""):""),...i?be(i.busy,i.run):{}},r===!1?A:h))}function In(e,t,n,a,o,r){const i=r.busy||n?.status==="loading"?a("refreshing"):r.err||n?.status==="error"?a("queryFailed"):e==="zai"&&n?.status==="off"&&n?.message?a(n.keyConfigured?"queryFailed":"zaiPlanKeyMissing"):n?.status==="ok"?a("gatewayQuotaEmpty"):a("codingPlanNotQueried"),l=[t,i,n?.message===i?"":n?.message,...Se(a,r)].filter(Boolean).join(`
5
- `);return s(K,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},l),side:"right",delayMs:300},s("div",{"data-cm-display":"plan","data-cm-plan":e,"aria-label":l,className:"cm-bbox cm-mm clickable"+(o===!1?" rail":"")+(r.busy?" busy":""),...be(r.busy,r.run)},o===!1?s("div",{className:"cm-bbox-rail"},"—"):s(R,null,s("div",{className:"cm-mm-title"},t),s("span",{className:"cm-hint"},i))))}function Ro(e){const{state:t,wide:n,api:a}=e,o=t.codingPlans?.minimax,r=z(j(t.config)),i=De(a?()=>a.refreshCodingPlan("minimax"):null),{five:l,seven:c}=fa(o?.windows);return o?.status!=="ok"||l==null&&c==null?In("minimax",r("codingPlanMinimaxTitle"),o,r,n,i):s(ba,{five:l,seven:c,fetchedAt:o.fetchedAt,t:r,wide:n,refresh:i,direction:re(t.config,"plan"),gauge:n!==!1&&t.config.planQuotaStyle==="gauge"&&!t.config.sidebarTextOnly})}const Do="/plugins/dsh-openai-codex/auth/status",Bo={18e3:"five",604800:"weekly"};function jn(e){if(!Array.isArray(e))return null;const t=e.find(a=>a!==null&&typeof a=="object"&&a.id==="codex");if(!t||!Array.isArray(t.windows))return null;const n={};for(const a of t.windows){const o=a!==null&&typeof a=="object"?Bo[Number(a.windowSeconds)]:null;if(!o||typeof a.remainingPercent!="number"||!Number.isFinite(Number(a.remainingPercent)))continue;const r=Number(a.resetAt??a.resetsAt);n[o]={percent:Math.max(0,Math.min(100,Math.round((100-Number(a.remainingPercent))*10)/10)),resetsAt:Number.isFinite(r)&&r>0?new Date(r*1e3).toISOString():""}}return n}function Lo(e){return e===null||typeof e!="object"||e.status!=="signed-in"?null:jn(e.usage?.rateLimits)}async function ga(e){const t=AbortSignal.timeout(8e3);let n;const a=new Promise((o,r)=>{n=()=>r(t.reason),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([Promise.resolve().then(()=>e(t)),a])}finally{t.removeEventListener("abort",n)}}async function Eo(e){try{const t=await ga(n=>H.rpc?.call("/api","codex-subscription/usage",{force:e},n));return t?.ok?jn(t.value?.rateLimits):null}catch{return null}}const H={source:"auto",listeners:[]},ya=(e,t=null,n=null)=>Object.assign(H,{rpc:e,readPiAi:t,readChatgptSub:n,request:null,inFlight:null,fetchedAt:0,status:"idle",windows:{},message:""});ya(null);const Dt=()=>{const{rpc:e,readPiAi:t,readChatgptSub:n,request:a,inFlight:o,listeners:r,...i}=H;return i},Io=e=>(H.listeners.push(e),()=>{H.listeners=H.listeners.filter(t=>t!==e)}),Bt=()=>{for(const e of H.listeners)try{e()}catch{}};async function Lt(e=!1,t=!1,n="auto"){if(!t)return;if(H.inFlight!==null&&H.source===n)return H.inFlight;if(!e&&H.source===n&&H.fetchedAt>0&&Date.now()-H.fetchedAt<(H.status==="ok"?5:1)*6e4)return;const a={};H.request=a,H.source!==n&&Object.assign(H,{status:"idle",windows:{},fetchedAt:0,source:n}),Bt();const o=Promise.resolve().then(async()=>{let r={},i="";try{if((n==="auto"||n==="subscription")&&(r=await Eo(e)??{}),Object.keys(r).length===0&&(n==="auto"||n==="pi-ai"))try{const l=await ga(()=>H.readPiAi?.());l?.ok===!0&&l.value?.status==="ok"?r=l.value.windows:l?.ok===!0&&l.value?.status==="error"&&(i=l.value.message)}catch{}if(Object.keys(r).length===0&&(n==="auto"||n==="chatgpt-sub"))try{const l=await ga(()=>ge.async("./client.codex.js").then(c=>c.readChatgptSubQuota(H.readChatgptSub)));l?.status==="ok"?r=l.windows:l?.status==="error"&&(i=l.message)}catch{}if(Object.keys(r).length===0&&(n==="auto"||n==="chatgpt"))try{r=await(await ge.async("./client.codex.js")).readChatgptQuota(e)??{}}catch{}if(Object.keys(r).length===0&&(n==="auto"||n==="connect")){const l=await fetch(Do,{credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});l.ok&&(r=Lo(await l.json().catch(()=>null))??{})}}catch{}finally{if(H.request!==a)return;H.status=Object.keys(r).length>0?"ok":"unavailable",H.windows=r,H.message=Object.keys(r).length?"":i,H.fetchedAt=Date.now(),H.inFlight=null,Bt()}});return H.inFlight=o,o}function Et(e,t="auto"){const[n,a]=D(Dt);return ee(()=>{if(!e)return;let o=!0;const r=()=>{o&&a(Dt())},i=Io(r);r(),Lt(!1,!0,t);const l=setInterval(()=>{Lt(!1,!0,t)},6e4);return()=>{o=!1,clearInterval(l),i()}},[e,t,H.rpc]),n.source===t?n:{status:"idle",windows:{},fetchedAt:0}}function jo(e){const t=Rt(),{state:n,wide:a}=e,o=z(j(n.config)),r=n.config?.codexQuotaEnabled===!0&&n.config?.codexQuotaSidebar!==!1,i=n.config?.codexQuotaSource??"auto",l=Et(r&&!e.preview,i),c=e.preview?n.displayPreviewCodex??(H.source===i?H:{status:"idle"}):l,u=De(e.preview?null:r?()=>Lt(!0,r,i):()=>e.api.updateConfig({codexQuotaEnabled:!0,codexQuotaSidebar:!0}));if(!r&&(n.config?.codexQuotaSidebar===!1||n.codexCompat?.enabled!==!0))return null;if(!r)return s("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(a===!1?" rail":""),...be(u.busy,u.run)},u.err||(a===!1?"Codex":o("codexQuotaEnable")));if(c.status!=="ok")return s("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(a===!1?" rail":""),title:c.message||o("codexQuotaUnavailable"),...be(u.busy,u.run)},s("div",{className:"cm-mm-title"},a===!1?"Codex":o("codexQuotaTitle")),s("span",{className:"cm-hint"},a===!1?"—":c.status==="idle"||u.busy?o("refreshing"):c.message||o("codexQuotaUnavailable")));const d=[["five","codexQuotaFive","5h"],["weekly","codexQuotaWeek","7d"]].flatMap(([k,h,A])=>{const x=c.windows[k];if(!x)return[];const y=dt(A,x,"remaining",o,!0),b=new Date(typeof x.resetsAt=="string"?x.resetsAt:NaN),w=Number.isFinite(b.getTime())?o("codexQuotaReset",{time:b.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}):"";return[{...y,key:k,short:A,name:o(h),reset:w,win:x}]});if(!d.length)return null;const m=d.some(k=>k.pct>=100)?"over":d.some(k=>k.pct>=80)?"warn":"ok",g=[o("codexQuotaTitle"),...d.map(k=>k.name+" · "+k.text+(k.reset?" · "+ut(k.win,o):"")),c.fetchedAt>0?o("goQuotaFetchedAt",{time:new Date(c.fetchedAt).toLocaleTimeString()}):null,...Se(o,u)].filter(Boolean).join(`
6
- `),f=s(R,null,s("div",{className:"cm-bbox-head cm-codex-head"},s("div",{className:"cm-mm-title"},o("codexQuotaTitle")),s("div",{className:"cm-codex-resets"},...d.filter(k=>k.reset).map(k=>s("span",{key:k.key,className:"cm-mm-reset"},(d.length>1?k.short+" · ":"")+k.reset)))),...d.map(k=>k.row)),p=s(R,null,...d.map(k=>s("div",{className:"cm-bbox-rail cm-num"},k.text)));return s(K,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},g),side:"right",delayMs:300},s("div",{...t,"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(m==="ok"?"":" "+m)+(a===!1?" rail":"")+(u.busy?" busy":""),...be(u.busy,u.run)},a===!1?p:f))}function Ye(e,t){return e.startsWith("core_")?"Core · "+Ye(e.slice(5),t):e==="fiveHour"||e==="five_hour"||e==="5h"?"5h":e==="seven_day"?"7d":e==="weekly"||e==="week"||e==="7d"?e==="7d"?"7d":t("goShortWeekly"):e==="monthly"||e==="month"?t("goShortMonthly"):e==="daily"||e==="day"?t("goShortDaily"):e==="plan"?t("mimoWindowPlan"):e==="compensation"?t("mimoWindowCompensation"):e==="usage"?t("quotaUsedTotal"):e==="balance"?t("codingPlanWindowBalance"):String(e).replace(/_/g," ")}function It(e,t){const n=a=>{const o=a.replace(/^core_/,"").toLowerCase().replace(/[^a-z0-9]/g,"");return/^(fivehour|five|5h|rolling|session)$/.test(o)?0:/^(daily|day|1d)$/.test(o)?1:/^(weekly|week|7d|sevenday)$/.test(o)?2:/^(monthly|month|30d)$/.test(o)?3:4};return Object.entries(e??{}).filter(([a])=>t!=="volcengine"||[0,2,3].includes(n(a))).sort((a,o)=>n(a[0])-n(o[0]))}function Fo(e){return/^(five_?hour|5h)$/i.test(e)?5:/^(seven_?day|7d)$/i.test(e)?168:0}function Fn(e,t){return e>=(t==="anthropic"?95:100)?"over":e>=80?"warn":"ok"}function Qo(e,t,n,a,o=Date.now()){const r=Date.parse(t?.resetsAt),i=Fo(e);if(!Number.isFinite(r)||i===0||!Number.isFinite(t.percent))return null;const l=r-o;if(l<=0)return null;const c=new Intl.DateTimeFormat(a==="en"?"en-US":"zh-CN",i===5?{hour:"2-digit",minute:"2-digit",hour12:!1}:{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}),u=Math.ceil(l/6e4),d=i===5?u>=60?n("quotaResetInHm",{h:Math.floor(u/60),m:u%60}):n("quotaResetInM",{m:u}):n("quotaResetAt",{time:c.format(r)}),m=i*36e5,g=o-(r-m),f=t.percent>0&&t.percent<100&&g/m>=.1?r-m+g*100/t.percent:1/0;return{reset:d,forecast:f>o&&f<r?n("quotaForecastHit",{time:c.format(f)}):""}}function _o(e){const t=Rt(),{id:n,state:a,wide:o,api:r}=e,i=a.codingPlans?.[n],l=z(j(a.config)),c=De(r?()=>r.refreshCodingPlan(n):null),u=Le.find(C=>C.id===n);if(!u)return null;const d=i?.windows!==null&&typeof i?.windows=="object"?i.windows:{},m=It(d,n);if(i?.status!=="ok"||m.length===0)return In(n,l(u.labelKey),i,l,o,c);const g=C=>C!==null&&typeof C=="object"&&typeof C.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(C.percent)||0))):null,f=re(a.config,"plan"),p=o!==!1&&a.config.planQuotaStyle==="gauge"&&!a.config.sidebarTextOnly,k=(n==="workbuddy"||n==="opendesign")&&d.balance?.text?l("codingPlanWindowBalance")+": "+d.balance.text:null,h=j(a.config),A=(k?m.filter(([C])=>C!=="balance"):m).map(([C,O])=>{const T=g(O);if(T===null)return s("div",{key:C,className:"cm-mm-row wide"},s("span",{className:"cm-mm-text"},typeof O?.text=="string"?O.text:"—"));const W=Fn(T,n),v=he(T,f),I=s("div",{key:C,className:"cm-mm-row wide"+(W==="ok"?"":" "+W)},s("span",{className:"cm-bbox-label"},Ye(C,l)),En(v.width,p),s("span",{className:"cm-bbox-pct cm-num"},v.label===null?"—":v.label+"%")),F=n==="anthropic"?Qo(C,O,l,h):null;return F===null?I:s(p?"div":R,{key:C},I,s("div",{className:"cm-mm-sub"},F.reset,F.forecast&&s("div",{className:"cm-mm-sub warn"},F.forecast)))}),x=m.map(([C,O])=>{const T=g(O),W=ut(O,l),v=T===null?typeof O?.text=="string"?O.text:"—":_e(he(T,f).label,f,l);return Ye(C,l)+" "+v+(W?" · "+W:"")});i.fetchedAt>0&&x.push(l("goQuotaFetchedAt",{time:new Date(i.fetchedAt).toLocaleTimeString()})),i.message&&x.push(i.message),x.push(...Se(l,c));const y=[l(u.labelKey),...x].join(`
7
- `),b=m.map(([,C])=>g(C)).filter(C=>C!==null),w=Fn(Math.max(0,...b),n),N=b.length>0?b.slice(0,2).map(C=>he(C,f).label+"%").join(" "):typeof m[0][1]?.text=="string"?m[0][1].text:"—";return s(K,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},y),side:"right",delayMs:300},s("div",{...t,"data-cm-display":"plan","data-cm-plan":n,className:"cm-bbox cm-mm clickable"+(w==="ok"?"":" "+w)+(o===!1?" rail":"")+(c.busy?" busy":""),...be(c.busy,c.run)},o===!1?s("div",{className:"cm-bbox-rail cm-num"},N):s(R,null,s("div",{className:k?"cm-mm-title cm-mm-row wide":"cm-mm-title"},l(u.labelKey),k&&s("span",{className:"cm-mm-text"},k)),s(p?"div":R,p?{className:"cm-plan-gauges"}:null,...A))))}const Qn=e=>{try{return window.localStorage?.getItem?.("cm.gw."+e)??""}catch{return""}},Ho=(e,t)=>{try{window.localStorage?.setItem?.("cm.gw."+e,t)}catch{}};function Uo(e){const t=Rt(),{source:n,snapshot:a,state:o,wide:r,api:i}=e,l=z(j(o.config)),[c,u]=D(()=>({source:n.id,id:Qn(n.id)})),d=De(i?()=>i.refreshGatewayQuota(n.id):null),m=n.type==="agy-link",g=m?"remaining":re(o.config,"plan"),f=m?10:4,p=a.accounts.length>1,k=c.source===n.id?c.id:Qn(n.id),h=a.accounts.findIndex(B=>B.id===k),A=h>=0?h:Math.max(0,a.accounts.findIndex(B=>B.windows.length>0||B.credits!=null)),x=a.accounts[A]??a.accounts[0],y=x?.label||x?.id||"",b=B=>p&&!m?(Ya[B.provider]??B.provider)+" · ":"",w=p&&x?[x]:a.accounts,N=[];for(const B of w){if(N.length>=f)break;for(const ie of B.windows){if(N.length>=f)break;const Ee=b(B)+(ie.label||ie.id||l("gatewaySourceUnknown"));N.push({win:ie,name:Ee,view:dt(Ee,ie,g,l)})}B.windows.length===0&&B.credits!=null&&N.push({win:null,name:b(B)+(B.credits.unit||"credits"),text:(B.credits.used??"—")+" / "+(B.credits.limit??"—")})}N.length===0&&N.push({name:l("gatewayQuotaEmpty"),text:"—"});const C=N.some(B=>B.view?.level==="over")?"over":N.some(B=>B.view?.level==="warn")?"warn":"ok",O=N.map(B=>{if(B.text!=null)return B.name+" "+B.text;const ie=ut(B.win,l);return B.name+" "+_e(B.view.label,g,l)+(ie?" · "+ie:"")});a.fetchedAt>0&&O.push(l("goQuotaFetchedAt",{time:new Date(a.fetchedAt).toLocaleTimeString()})),O.push(...Se(l,d));const W=[p&&y?`${n.label||n.id} (${A+1}/${a.accounts.length} · ${y})`:n.label||n.id,...O].join(`
8
- `),v=N.map((B,ie)=>B.text!=null?s("div",{key:ie,className:"cm-mm-row wide"},s("span",{className:"cm-bbox-label"},B.name),s("span",{className:"cm-mm-text cm-num"},B.text)):s(R,{key:ie},B.view.row)),I=B=>{if(!B.key||B.key==="Enter"||B.key===" "){B.stopPropagation(),B.preventDefault?.();const ie=a.accounts[(A+1)%a.accounts.length];Ho(n.id,ie.id),u({source:n.id,id:ie.id})}},F=p?s("span",{className:"cm-gw-switcher","aria-label":l("gatewaySwitchAccount",{account:y||A+1}),onClick:I,onKeyDown:I,role:"button",tabIndex:0},`${A+1}/${a.accounts.length} ⇄`):null,te=p?s("div",{className:"cm-bbox-head"},s("div",{className:"cm-mm-title"},n.label||n.id),F):s("div",{className:"cm-mm-title"},n.label||n.id),V=p&&y?s("div",{className:"cm-gw-sub"},y):null,Y=s(R,null,te,V,...v),M=N.filter(B=>B.view).map(B=>B.view.label).filter(B=>B!==null),U=M.length>0?M.slice(0,2).map(B=>B+"%").join(" "):N[0].text??"—",gt=s("div",{className:"cm-bbox-rail cm-num"},U);return s(K,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},W),side:"right",delayMs:300},s("div",{...t,"data-cm-display":"gateway","data-cm-source":n.id,className:"cm-bbox cm-mm clickable"+(C==="ok"?"":" "+C)+(r===!1?" rail":"")+(d.busy?" busy":""),...be(d.busy,d.run)},r===!1?s(R,null,gt,F):Y))}function qo(e,t,n,a){const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:[],r=[];for(const i of t.gatewayQuotas?.sources??[]){if(i.enabled===!1||i.display!=="sidebar"&&i.display!=="both")continue;const l=o.find(c=>c.id===i.id);!l||l.status!=="ok"&&l.status!=="partial"&&l.status!=="stale"||l.accounts.length===0||r.push(s(Uo,{key:"gateway:"+i.id,source:i,snapshot:l,state:e,wide:n,api:a}))}return r}const Wo={anthropic:"Claude",zai:"Z.ai",minimax:"MM",kimi:"Kimi",openrouter:"OR",siliconflow:"SF",commandcode:"CC",clinepass:"CP",scnet:"SCNet",volcengine:"Ark",qwen:"Qwen",mimo:"MiMo","baidu-coding":"千帆",factory:"Factory",opendesign:"OpenDesign"};function _n(e,t,n){return e?.enabled!==!0?!1:typeof e.showInComposer=="boolean"?e.showInComposer:e.display!=="off"&&t?.enabled===!0&&t[n]!==!1}function ha(e,t,n){const a=e?.display??"settings";return(typeof e?.showInComposer=="boolean"?e.showInComposer:a!=="off"&&t?.enabled===!0&&t[n]!==!1)?{off:"composer",both:"all"}[a]??a+"-composer":a}function ka(e){const t={composer:"off","sidebar-composer":"sidebar","settings-composer":"settings",all:"both"}[e];return{display:t??e,showInComposer:t!==void 0}}function xa(e){return[["sidebar","balanceSidebar"],["settings","balanceSettings"],["both","quotaSidebarSettings"],["composer","quotaComposer"],["sidebar-composer","quotaSidebarComposer"],["settings-composer","quotaSettingsComposer"],["all","quotaAllPositions"],["off","off"]].map(([t,n])=>s("option",{key:t,value:t},e(n)))}function $o(e){const t=e.useCost?e.useCost(x=>x):void 0,n=t?.state?.config;Et(n?.codexQuotaEnabled===!0&&n.codexQuotaStrip!==!1&&n.quotaStrip?.enabled===!0,n?.codexQuotaSource);const[a,o]=D(null),[r,i]=D({}),l=t?.state,c=e.api;if(!l)return null;const u=l.config,d=u.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};if(d.enabled!==!0&&u.goQuota?.showInComposer!==!0&&!Object.values(u.codingPlans??{}).some(x=>x.enabled===!0&&x.showInComposer===!0))return null;const m=z(j(u)),g=[];if(d.enabled===!0&&d.budget!==!1){const x=u.budget??{enabled:!1,amount:100,period:"month"};if(x.enabled===!0){const y=Number(u.exchangeRate),w=(l.budgetUsed??(x.period==="day"?Q(l.today,u):x.period==="all"?Q(l.total,u):Q(l.month,u)))*(Number.isFinite(y)&&y>0?y:1),N=Math.max(0,Number(x.amount)||0);if(N>0){const C=Math.min(999,w/N*100),O=C>=100?"over":C>=80?"warn":"ok";g.push({key:"budget",label:m("budgetShort"),level:O,tip:m("budgetOf",{period:m(et[x.period]??"periodMonth")})+" · "+m("usedOf",{used:le(w,u),amount:le(N,u)})+" · "+C.toFixed(1)+"%",segs:[{name:"main",pct:Math.round(he(Math.min(100,C),re(u,"budget")).width)}]})}}}if(_n(u.goQuota,d,"go")){const x=l.goQuota;if(u?.goQuota?.enabled!==!1&&x?.status==="ok"){const y=u.goQuota.main==="weekly"||u.goQuota.main==="monthly"?u.goQuota.main:"rolling",b=y==="rolling"?x.rolling:y==="weekly"?x.weekly:x.monthly;if(b!==null&&typeof b=="object"&&typeof b.percent=="number"){const w=Math.max(0,Math.min(100,Math.round(Number(b.percent)||0))),N=w>=100?"over":w>=80?"warn":"ok",C=typeof b.resetsAt=="string"&&b.resetsAt.length>0?" · "+m("goResetAt",{time:new Date(b.resetsAt).toLocaleString()}):"";g.push({key:"go",label:"Go "+m(y==="rolling"?"goShortRolling":y==="weekly"?"goShortWeekly":"goShortMonthly"),level:N,tip:Dn(x,u,m),segs:[{name:"main",pct:Math.round(he(w,re(u,"go")).width)}]})}}}for(const x of Le){const y=l.codingPlans?.[x.id];if(!_n(u.codingPlans?.[x.id],d,"plans")||!y||y.status!=="ok")continue;const b=y.windows!==null&&typeof y.windows=="object"?y.windows:{},w=It(b,x.id),N=x.id==="factory"?[w.filter(([C])=>!C.startsWith("core_")),w.filter(([C])=>C.startsWith("core_"))]:[w];for(const[C,O]of N.entries()){if(O.length===0)continue;const T=Wo[x.id]??x.id,W=[],v=[];y.message&&v.push(y.message);let I=0,F=0;for(const[te,V]of O){const Y=Ye(te,m),M=typeof V?.resetsAt=="string"&&V.resetsAt.length>0?" · "+m("goResetAt",{time:new Date(V.resetsAt).toLocaleString()}):"",U=V!==null&&typeof V=="object"&&typeof V.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(V.percent)||0))):null;if(v.push(Y+" "+(U===null?typeof V?.text=="string"?V.text:"—":U+"%")+M),U===null){d.planAmounts!==!1&&W.push({name:te,pct:null,text:typeof V?.text=="string"?V.text:"—"});continue}F>=(x.id==="factory"?3:2)||(F+=1,W.push({name:te,pct:Math.round(he(U,re(u,"plan")).width)}),I=Math.max(I,U>=100?2:U>=80?1:0))}y.fetchedAt>0&&v.push(m("goQuotaFetchedAt",{time:new Date(y.fetchedAt).toLocaleTimeString()})),W.length!==0&&g.push({key:x.id+(C?":core":""),label:T+(x.id==="factory"?C?" Core":" Standard":""),level:["ok","warn","over"][I],tip:v.join("; "),segs:W})}}const f=d.enabled===!0&&u.codexQuotaEnabled===!0&&u.codexQuotaStrip!==!1&&H.source===(u.codexQuotaSource??"auto")&&H.status==="ok"?H.windows:{},p=f.five??null,k=f.weekly??null,h=x=>Math.max(0,Math.min(100,Math.round(Number(x.percent)||0)));if(p!==null||k!==null){const x=p===null?null:h(p),y=k===null?null:h(k),b=Math.max(x??0,y??0);g.push({key:"codex",label:"Codex",level:b>=100?"over":b>=80?"warn":"ok",tip:[m("codexQuotaTitle"),...[["5h",p],[m("codingPlanRemain7d"),k]].filter(([,w])=>w).map(([w,N])=>w+": "+_e(100-h(N),"remaining",m)+(typeof N.resetsAt=="string"&&Number.isFinite(Date.parse(N.resetsAt))?" · "+m("goResetAt",{time:new Date(N.resetsAt).toLocaleString()}):"")),H.fetchedAt>0?m("goQuotaFetchedAt",{time:new Date(H.fetchedAt).toLocaleTimeString()}):null].filter(Boolean).join(`
9
- `),segs:[x===null?null:{name:"5h",pct:100-x},y===null?null:{name:"weekly",pct:100-y}].filter(Boolean)})}if(g.length===0)return null;const A=x=>{a!==null||!c||(o(x),i(y=>({...y,[x]:null})),Promise.resolve().then(()=>x==="budget"?c.reload():x==="go"?c.refreshGoQuota():x==="codex"?Lt(!0,u.codexQuotaEnabled===!0,u.codexQuotaSource):x==="factory:core"?c.refreshCodingPlan("factory"):c.refreshCodingPlan(x)).catch(y=>{i(b=>({...b,[x]:y?.message??String(y)}))}).finally(()=>o(null)))};return s("div",{className:"cm-qstrip"},g.map(x=>{const y=a===x.key,b=r[x.key],w=x.key==="codex"?"remaining":re(u,x.key==="budget"||x.key==="go"?x.key:"plan"),N=[s("span",{className:"cm-qlabel",key:"l"},x.label)];y?N.push(s("span",{className:"cm-qtext",key:"busy"},m("refreshing"))):x.segs.forEach((O,T)=>{T>0&&N.push(s("span",{className:"cm-qsep",key:"sep"+T,"aria-hidden":"true"})),O.pct===null?N.push(s("span",{className:"cm-qtext",key:O.name},O.text)):N.push(s("span",{className:"cm-qseg",key:O.name},s("span",{className:"cm-qbar"},s("span",{className:"cm-qfill",style:{width:O.pct+"%"}})),s("span",null,(x.key==="codex"&&x.segs.length>1?(O.name==="5h"?"5h":m("goShortWeekly"))+" ":"")+_e(O.pct,w,m))))});const C=[x.tip];return!y&&c&&C.push(m("clickToRefresh")),y&&C.push(m("refreshing")),b&&C.push("⚠ "+m("queryFailed")+": "+b),x.key==="go"?s(Bn,{key:x.key,detail:[x.tip,b].filter(Boolean).join(`
10
- `),t:m,busy:y,refresh:c?()=>A(x.key):null,trigger:s("summary",{className:"cm-qchip action"+(x.level==="ok"?"":" "+x.level),"aria-label":x.label},N)}):s(K,{portal:!0,key:x.key,label:x.key==="codex"?s("span",{style:{whiteSpace:"pre-line"}},C.join(`
11
- `)):C.join("; "),side:"bottom",delayMs:400},s("span",{className:"cm-qchip"+(c?" action":"")+(x.level==="ok"?"":" "+x.level),...c?be(y,()=>A(x.key)):{}},N))}))}let Hn;function Ko(e){const[t,n]=D(null);return ee(()=>{let a=!0;return(Hn??=ge.async("./client.notices.js").then(r=>r.mount({FloatingCard:On,makeT:z,resolveLocale:j})).catch(r=>{throw Hn=null,r})).then(r=>{a&&n(()=>r)}).catch(()=>{}),()=>{a=!1}},[]),t?s(t,e):null}function wa(e,t,n){const a=t.sidebarTodayMetric??"cost";return s("span",{className:"cm-today-values","data-both":a==="both"},a!=="tokens"?s("span",{"data-cm-today":"cost"},$(Q(e,t),t)):null,a!=="cost"?s("span",{"data-cm-today":"tokens"},E(["input","output","cacheRead","cacheWrite"].reduce((o,r)=>o+(Number(e?.[r])||0),0))+" "+n("tokensUnit")):null)}function jt(e){const{state:t,wide:n}=e,a=t.today,o=t.config,r=z(j(o)),i=wa(a,o,r),l=o.budget??{enabled:!1,amount:100,period:"month"},c=Number(o.exchangeRate),d=(t.budgetUsed??(l.period==="day"?Q(t.today,o):l.period==="all"?Q(t.total,o):Q(t.month,o)))*(Number.isFinite(c)&&c>0?c:1),m=Math.max(0,Number(l.amount)||0),g=m>0?Math.min(999,d/m*100):null,f=g===null?"ok":g>=100?"over":g>=80?"warn":"ok";if(l.enabled===!0&&o.hideBudget!==!0&&e.todayOnly!==!0){const k=[r("budgetOf",{period:r(et[l.period]??"periodMonth")}),r("usedOf",{used:le(d,o),amount:le(m,o)})+" · "+(g===null?"—":g.toFixed(1)+"%"),r("monthTotal",{month:$(Q(t.month,o),o),total:$(Q(t.total,o),o)})].join("; ");if(e.summary===!0)return s(K,{portal:!0,label:k,side:"right",delayMs:300},s("div",{"data-cm-display":"budget",className:"cm-simple-summary"+(f==="ok"?"":" "+f),tabIndex:0},s("span",null,r("budgetOf",{period:r(et[l.period]??"periodMonth")})),s("span",{className:"cm-num"},le(d,o)+" / "+le(m,o))));const h=Mo(t,o,r);return s(K,{portal:!0,label:k,side:"right",delayMs:300},s("div",{"data-cm-display":"budget",className:"cm-bbox"+(f==="ok"?"":" "+f)+(n?"":" rail")},n?h.body:s("div",{className:"cm-bbox-rail cm-num"},h.rail)))}const p=[o.sidebarTodayMetric==="tokens"?r("todayTokensTitle"):r("todayCostTitle"),r("callsTokens",{calls:a.calls,input:E(a.input),cache:E(a.cacheRead+a.cacheWrite),output:E(a.output)}),r("monthCost",{amount:$(Q(t.month,o),o)}),r("totalCost",{amount:$(Q(t.total,o),o)})].join("; ");return s(K,{portal:!0,label:p,side:"right",delayMs:300},s("div",{"data-cm-display":"today",className:"cm-foot"+(n?"":" cm-foot-rail")},n?s(R,null,s("span",null,r("today")),s("span",{className:"cm-num cm-bal-amt"},i)):s(At,{size:16})))}const zo=()=>ge.async("./client.sidebar-icons.js").then(e=>e.mount({makeT:z,resolveLocale:j,peakView:Be,usePeakClock:Ge,phaseLabelKeys:Ve,countdownText:Ce,codexQuotaSnapshot:Dt,displayCostOf:Q,formatMoneyUsd:$,sidebarTodayValue:wa,CODING_PLAN_ROWS:Le}));function Go(e){const t=e.useCost?e.useCost(r=>r):void 0;Et(t?.state?.config?.codexQuotaEnabled===!0&&t?.state?.config?.codexQuotaSidebar!==!1,t?.state?.config?.codexQuotaSource);let n;if(e.useProjection)try{n=e.useProjection("costUsage")}catch{n=void 0}xn(e,n);const a=t?.state,o=a?{...a,config:pa(a,n?.provider)}:null;return o?Na(o,!!e.wide,e.api,!1,n?.provider):null}function Na(e,t,n,a=!1,o,r=a){const i=pa(e),l=z(j(i)),c=(i.balance?.display==="sidebar"||i.balance?.display==="both")&&i.hideOfficialBalance!==!0&&po(e,o,r),d=Ot(e,i).length>0,m=c&&i.balance?.showProgressBar===!0&&e.balance?.status==="ok",g=d&&i.balance?.showProgressBar===!0,f=i.goQuota?.main==="weekly"||i.goQuota?.main==="monthly"?i.goQuota.main:"rolling",p=i.goQuota?.enabled!==!1&&(i.goQuota?.display==="sidebar"||i.goQuota?.display==="both")&&e.goQuota?.status==="ok"&&e.goQuota?.[f]!==null,k=Le.map(I=>I.id).filter(I=>{const F=i.codingPlans?.[I];return!(F?.enabled!==!0||F.display!=="sidebar"&&F.display!=="both")}),h=k.length>0,A=qo(e,i,t,n),x=i.codexQuotaSidebar!==!1&&(i.codexQuotaEnabled===!0||e.codexCompat?.enabled===!0),y=(i.budget??{}).enabled===!0&&i.hideBudget!==!0,b=i.sidebar!==!1&&i.hideTodayCost!==!0,w=Be(i,Date.now())!==null,N=i.sidebarModels?.enabled===!0;if(!i.localSavings?.enabled&&!N&&!c&&!d&&!p&&!h&&!x&&!y&&!b&&!w&&A.length===0)return null;const C=i.sidebarSimple===!0,O=!C&&t&&i.sidebarStyle==="compact",T=[];C&&t&&b&&!i.sidebarTodayBalanceInline&&T.push(s("div",{key:"today","data-cm-display":"today",className:"cm-simple-summary"},s("span",null,l("today")),s("span",{className:"cm-num"},wa(e.today,i,l)))),c&&e.balanceAccounts?.length>1?T.push(s(R,{key:"balance"},...e.balanceAccounts.map(I=>s(la,{key:I.id,accountId:"official-"+I.id,label:I.label,state:{...e,balance:I,reconcile:void 0},wide:t,api:n})))):c&&e.balance?.status==="off"&&e.balanceAccounts?.length===1?T.push(s(la,{key:"balance",state:{...e,balance:e.balanceAccounts[0],reconcile:void 0},wide:t,api:n})):m?T.push(s(fo,{key:"balance",state:e,wide:t,api:n})):c&&T.push(s(la,{key:"balance",state:e,wide:t,api:n})),g?T.push(s(go,{key:"customBalance",state:e,wide:t,api:n})):d&&T.push(s(ho,{key:"customBalance",state:e,wide:t,api:n}));const W=T.length;h&&T.push(...k.map(I=>I==="minimax"?s(Ro,{key:"plan:"+I,state:e,wide:t,api:n}):s(_o,{key:"plan:"+I,id:I,state:e,wide:t,api:n}))),T.push(...A),x&&T.push(s(jo,{key:"codex",state:e,wide:t,api:n,preview:a})),p&&T.push(s(Oo,{key:"go",state:e,wide:t})),y&&T.push(s(jt,{key:"budget",state:e,wide:t,summary:C&&t})),b&&(!(C&&t)||i.sidebarTodayBalanceInline)&&T.push(s(jt,{key:"today",state:e,wide:t,todayOnly:!0})),w&&T.push(s(R,{key:"peak"},t?Rn(e,i.sidebarStyle==="summary"&&!i.sidebarSimple?{...i,peakProgressVariant:"summary"}:i,l):Ao(e,i,l))),N&&T.splice(i.sidebarModels.position==="first"?0:i.sidebarModels.position==="afterBalance"?W:T.length,0,s(Yo,{key:"models",state:e,wide:t,preview:a})),i.localSavings?.enabled&&T.push(s(ne,{key:"localSavings",state:e,wide:t,load:Vo,quiet:!0}));const v=i.sidebarOrder?.length?i.sidebarOrder:i.sidebarStyle==="summary"&&!C?["today","balance","peak"]:[];if(v.length){const I=F=>{const te=v.indexOf(F.key);return te<0?999:te};T.sort((F,te)=>I(F)-I(te))}return s("div",{...C?{tabIndex:0,role:"region","aria-label":l("sidebarSimple")}:{},className:"cm-footer-stack"+(i.sidebarTodayBalanceInline?" same-line":"")+(t?"":" rail")+(O?" compact":"")+(C?" simple":i.sidebarStyle==="summary"&&t?" summary":"")+(i.sidebarTextOnly?" text-only":"")},...!C&&t&&i.sidebarStyle==="icons"?[s(ne,{load:zo,state:{...e,config:i},preview:a,nodes:T,fallback:T})]:T)}let Un;const Vo=()=>Un??=ge.async("./client.local-savings.js").then(e=>e.mount({formatMoneyUsd:$,formatTokens:E,resolveLocale:j,Tooltip:K})).catch(e=>{throw Un=null,e}),qn={enabled:!1,period:"today",topN:5,summary:"total",position:"last",defaultOpen:!1,remember:!0,tokens:!1,shares:!0,refreshSeconds:60,dock:!1},Wn="dsh-cost-meter:models-open";function $n(e,t,n){return Vn(e,e.config,n,t).map(a=>({...a,label:e.modelLabels?.[a.key]??(a.key==="deepseek:legacy"?a.label:bt(a.key)),cost:Q(a,e.config)})).sort((a,o)=>o.cost-a.cost||o.tokens-a.tokens||a.key.localeCompare(o.key))}function Yo({state:e,wide:t,preview:n=!1}){const a={...qn,...e.config.sidebarModels},o=z(j(e.config)),r=()=>{try{const y=a.remember?window.localStorage.getItem(Wn):null;if(y!==null)return y==="1"}catch{}return a.defaultOpen},[i,l]=D(r),[c,u]=D(a.period);ee(()=>u(a.period),[a.period]);const d=Ne(a.defaultOpen);ee(()=>{l(n&&d.current!==a.defaultOpen?a.defaultOpen:r()),d.current=a.defaultOpen},[a.defaultOpen,a.remember]);const m=$n(e,c,o),g=m.reduce((y,b)=>y+b.cost,0),f=y=>$(y,e.config),p=o(c==="history"?"modelStatsHistory":"modelStatsToday")+" "+f(g)+" · "+o("modelsCount",{n:m.length}),k=a.summary==="top"&&m.length?m[0].label+" "+f(m[0].cost):p,h=s(R,null,s("span",{className:"cm-bal-label"},a.summary==="top"&&m.length?m[0].label:o(c==="history"?"modelStatsHistory":"modelStatsToday")),s("span",{className:"cm-bal-amt cm-num"},a.summary==="top"&&m.length?f(m[0].cost):f(g)+" · "+o("modelsCount",{n:m.length}))),A=()=>{l(!i);try{a.remember&&!n&&window.localStorage.setItem(Wn,i?"0":"1")}catch{}};if(!t||e.config.sidebarSimple)return s("div",{"data-cm-display":"models",className:"cm-foot cm-num"+(t?"":" cm-foot-rail"),title:k+" · "+p},t?h:s(At,{size:16}));const x=m.slice(0,a.topN);return m.length>a.topN&&x.push(m.slice(a.topN).reduce((y,b)=>{for(const w of["cost","input","output","cacheRead","cacheWrite"])y[w]+=b[w];return y},{key:"other",label:o("modelsOther"),cost:0,input:0,output:0,cacheRead:0,cacheWrite:0})),s("div",{"data-cm-display":"models",className:"cm-bbox cm-model-costs"},s("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(i),title:p,onClick:A},s("span",{className:"cm-caret"+(i?" open":"")}),h),i?s(R,null,s("div",{className:"cm-buttons"},["today","history"].map(y=>s("button",{key:y,type:"button",className:"cm-mstats-tab"+(c===y?" active":""),"aria-pressed":c===y,onClick:()=>u(y)},o(y==="today"?"modelStatsToday":"modelStatsHistory")))),x.length?x.map(y=>s("div",{key:y.key},s("div",{className:"cm-bbox-head"},s("span",{className:"cm-bal-label",title:y.label},y.label),s("span",{className:"cm-num cm-bal-amt"},f(y.cost))),a.shares?s("div",{className:"cm-bbox-bar",title:(g>0?y.cost/g*100:0).toFixed(1)+"%"},s("div",{className:"cm-bbox-fill",style:{width:(g>0?y.cost/g*100:0)+"%"}})):null,a.tokens?s("div",{className:"cm-mstats-note"},o("modelStatsInput")+" "+E(y.input)+" · "+o("modelStatsCache")+" "+E(y.cacheRead+y.cacheWrite)+" · "+o("modelStatsOutput")+" "+E(y.output)):null)):s("span",{className:"cm-note"},o("modelStatsEmpty"))):null)}function mt(e){return s("div",{className:"cm-card"},s("p",{className:"cm-card-title"},e.title),s("div",{className:"cm-card-value cm-num"},e.value),s("p",{className:"cm-card-sub"},e.sub))}const Sa=new WeakMap;function Zo(e,t){let n;return Promise.race([Promise.resolve().then(e),new Promise((a,o)=>{n=setTimeout(()=>o(Error(t)),15e3)})]).finally(()=>clearTimeout(n))}const Ca=(e,t)=>e?.().then(n=>(Sa.set(e,n),n.prefetch?.(t))).catch(()=>{});function Kn({state:e}){const t=e?.billionContext;return!t||!(t.unresolved>0||["needs_update","changed","bridge_missing"].includes(t.compatibility))?null:s("p",{className:"cm-note","data-billing-accuracy":"billion-context"},j(e.config)==="en"?"Some billion-context usage records are incomplete; cost totals may differ from the provider bill.":"billion-context 部分用量记录不完整,费用统计可能存在偏差。")}function ne(e){const t=e.load??e.api.loadStatistics,[n,a]=D(()=>Sa.get(t)??null),[o,r]=D(""),[i,l]=D(0);return ee(()=>{let c=!0;if(r(""),typeof t!="function")return;let u;try{u=t()}catch(d){u=Promise.reject(d)}return u.then(d=>{Sa.set(t,d),c&&a(()=>d)},d=>{c&&r(String(d.message??d))}),()=>{c=!1}},[e.api,e.load,i]),n?s(n,{...e,formatMoneyUsd:$,formatTokens:E,resolveLocale:j}):e.fallback?s(R,null,e.fallback,o?s("button",{type:"button",className:"cm-btn small",title:o,onClick:()=>l(c=>c+1)},j(e.state?.config)==="en"?"Retry icon layout":"重试图标布局"):null):e.quiet?null:s("div",{className:o?"":"cm-loading",role:o?"alert":"status","aria-label":j(e.state?.config)==="en"?"Loading":"正在读取"},o||s(R,null,s("i"),s("i"),s("i")),o?s("button",{className:"cm-btn",onClick:()=>l(c=>c+1)},"↻"):null)}const Jo="cm-stat-dialog";function zn(e){const t=fe.useRef(null),n=fe.useRef(!1);if(ee(()=>{e.open&&t.current?.showModal()},[e.open]),!e.open)return null;const a=j(e.state?.config)==="en",o=na(a),r=e.onClose,i=l=>{if(l.target!==l.currentTarget)return!1;const c=l.currentTarget.getBoundingClientRect();return l.clientX<c.left||l.clientX>=c.right||l.clientY<c.top||l.clientY>=c.bottom};return s("dialog",{ref:t,role:"dialog",className:Jo,"aria-label":o,onCancel:r,onPointerDown:l=>{n.current=i(l)},onClick:l=>{n.current&&i(l)&&r(),n.current=!1}},s("header",{className:"cm-stat-dialog-head"},s("strong",null,o),s("button",{type:"button",className:"cm-btn",autoFocus:!0,"aria-label":a?"Close":"关闭",onClick:r},"×")),s("div",{className:"cm-stat-dialog-body"},e.state?s(ne,{key:e.sessionId,state:e.state,api:e.api,sessionId:e.sessionId}):s("p",{role:e.error?"alert":"status"},e.error||(a?"Loading…":"加载中…"),s("button",{type:"button",className:"cm-btn",onClick:()=>e.api.reload()},a?"Retry":"重试"))))}function Xo(e){const t=e.useCost?.(d=>d),n=t?.state,[a,o]=D(null),r=n?.config?.hideSessionCostHeader===!0,i=!r&&!!e.sessionId&&a===e.sessionId;if(ee(()=>{o(null)},[e.sessionId,r]),!e.sessionId||r)return null;const l=j(n?.config)==="en",c=na(l),u=()=>Ca(e.api.loadStatistics,{state:n,sessionId:e.sessionId});return s(R,null,s("button",{type:"button",className:"cm-btn cm-stat-entry cm-stat-header",title:c,"aria-label":c,"aria-haspopup":"dialog","data-cm-display":"session-header",onMouseEnter:u,onFocus:u,onClick:()=>o(e.sessionId)},l?"Cost details":"费用明细"),s(zn,{open:i,onClose:()=>o(null),sessionId:e.sessionId,state:n,error:t?.error,api:e.api}))}const pt=(e,t,n)=>s("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(e),onClick:t},s("span",{className:"cm-caret"+(e?" open":"")}),s("h3",{className:"cm-h"},n));function er(e){const{state:t,api:n}=e,a=z(j(t.config)),[o,r]=D(!1);return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(o,()=>r(!o),a("history"))),o?s("div",{className:"cm-collapse-body"},s(tr,{state:t,api:n})):null)}function tr(e){const{state:t,api:n}=e,a=z(j(t.config)),[o,r]=D(null),[i,l]=D({}),[c,u]=D(()=>new Set),d=t.history??[];if(d.length===0)return s("p",{className:"cm-empty"},a("noHistory"));const m=f=>{if(o===f){r(null);return}r(f),!(i[f]!==void 0||c.has(f))&&(u(p=>{const k=new Set(p);return k.add(f),k}),n.getDaySessions(f).then(p=>l(k=>({...k,[f]:Array.isArray(p?.sessions)?p.sessions:[]}))).catch(()=>l(p=>({...p,[f]:"error"}))).finally(()=>u(p=>{const k=new Set(p);return k.delete(f),k})))},g=f=>f.map(p=>s("tr",{key:p.id},va(p,t.config?.showSessionId===!0,a),s("td",{className:"num"},String(p.calls)),s("td",{className:"num"},E(p.input)),s("td",{className:"num"},E(p.cacheRead+p.cacheWrite)),s("td",{className:"num"},E(p.output)),s("td",{className:"num"},$(Q(p,t.config),t.config))));return s("div",{className:"cm-scroll"},s("p",{className:"cm-hint",style:{padding:"6px 10px 0"}},a("historyExpandHint")),s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("colDate")),s("th",{className:"num"},a("colCalls")),s("th",{className:"num"},a("colInTok")),s("th",{className:"num"},a("colCacheTok")),s("th",{className:"num"},a("colOutTok")),s("th",{className:"num"},a("colCost")))),s("tbody",null,d.flatMap(f=>{const p=s("tr",{key:f.date,className:"cm-row-click",onClick:()=>m(f.date)},s("td",null,(o===f.date?"▾ ":"▸ ")+f.date),s("td",{className:"num"},String(f.calls)),s("td",{className:"num"},E(f.input)),s("td",{className:"num"},E(f.cacheRead+f.cacheWrite)),s("td",{className:"num"},E(f.output)),s("td",{className:"num"},$(Q(f,t.config),t.config)));if(o!==f.date)return[p];const k=i[f.date],h=c.has(f.date)&&k===void 0?s("p",{className:"cm-empty"},a("historySessionsLoading")):k==="error"?s("p",{className:"cm-empty"},a("historySessionsError")):!Array.isArray(k)||k.length===0?s("p",{className:"cm-empty"},a("historyNoSessions")):s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("colSession")),s("th",{className:"num"},a("colCalls")),s("th",{className:"num"},a("colInTok")),s("th",{className:"num"},a("colCacheTok")),s("th",{className:"num"},a("colOutTok")),s("th",{className:"num"},a("colCost")))),s("tbody",null,g(k)));return[p,s("tr",{key:f.date+"-sessions"},s("td",{colSpan:6},h))]}))))}function ar(e){const{state:t,api:n}=e,a=z(j(t.config)),[o,r]=D(!1),[i,l]=D(100),[c,u]=D("cost-desc"),[d,m]=D(null),[g,f]=D(!1),[p,k]=D(!1),h=fe.useRef(0),A=(w,N)=>{const[C,O]=N==="recent"?["recent","desc"]:N.split("-"),T=++h.current;f(!0),k(!1),n.getTopSessions(w,C,O).then(W=>{T===h.current&&m(Array.isArray(W?.sessions)?W.sessions:[])}).catch(()=>{T===h.current&&k(!0)}).finally(()=>{T===h.current&&f(!1)})},x=()=>{r(w=>{const N=!w;return N&&d===null&&!g&&A(i,c),N})},y=w=>{l(w),(o||d!==null)&&A(w,c)},b=w=>{u(w),(o||d!==null)&&A(i,w)};return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(o,x,a("sessionRankTitle"))),o?s("div",{className:"cm-collapse-body"},s("p",{className:"cm-hint"},a("sessionRankHint")),s("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",margin:"6px 0"}},s("div",{className:"cm-field"},s("label",null,a("sessionRankSort")),s("select",{className:"cm-input",value:c,onChange:w=>b(w.target.value)},s("option",{value:"cost-desc"},a("sessionSortCostDesc")),s("option",{value:"cost-asc"},a("sessionSortCostAsc")),s("option",{value:"time-desc"},a("sessionSortTimeDesc")),s("option",{value:"time-asc"},a("sessionSortTimeAsc")),s("option",{value:"recent"},a("sessionSortRecent")))),s("div",{className:"cm-field"},s("label",null,a("sessionRankLimit")),s("select",{className:"cm-input",value:String(i),onChange:w=>y(Number(w.target.value))},s("option",{value:"50"},"50"),s("option",{value:"100"},"100"),s("option",{value:"200"},"200")))),g?s("p",{className:"cm-empty"},a("sessionRankLoading")):p?s("p",{className:"cm-empty"},a("sessionRankError")):d===null||d.length===0?s("p",{className:"cm-empty"},a("sessionRankEmpty")):s("div",{className:"cm-scroll"},s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("colDate")),s("th",null,a("colSession")),s("th",{className:"num"},a("colCalls")),s("th",{className:"num"},a("colInTok")),s("th",{className:"num"},a("colCacheTok")),s("th",{className:"num"},a("colOutTok")),s("th",{className:"num"},a("colCost")))),s("tbody",null,d.map(w=>s("tr",{key:w.date+":"+w.id},s("td",null,w.date),va(w,t.config?.showSessionId===!0,a),s("td",{className:"num"},String(w.calls)),s("td",{className:"num"},E(w.input)),s("td",{className:"num"},E((w.cacheRead??0)+(w.cacheWrite??0))),s("td",{className:"num"},E(w.output)),s("td",{className:"num"},$(Q(w,t.config),t.config)))))))):null)}function Gn(e){const{state:t}=e,n=z(j(t.config)),a=t.today.sessions??[];if(a.length===0)return s("p",{className:"cm-empty"},n("noSessionsToday"));const o=t.config?.showSessionId===!0;return s("div",{className:"cm-scroll"},s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,n("colSession")),s("th",{className:"num"},n("colCalls")),s("th",{className:"num"},n("colInTok")),s("th",{className:"num"},n("colCacheTok")),s("th",{className:"num"},n("colOutTok")),s("th",{className:"num"},n("colCost")))),s("tbody",null,a.map(r=>s("tr",{key:r.id},va(r,o,n),s("td",{className:"num"},String(r.calls)),s("td",{className:"num"},E(r.input)),s("td",{className:"num"},E(r.cacheRead+r.cacheWrite)),s("td",{className:"num"},E(r.output)),s("td",{className:"num"},$(Q(r,t.config),t.config)))))))}function va(e,t,n){const a=typeof e.title=="string"?e.title.trim():"",o=String(e.id).slice(0,14)+"…",r=a.length>0?a:o,i=a.length>0?a+" · "+e.id:e.id;return s("td",{title:i},s("div",{className:"cm-sess-title"+(a.length===0?" cm-sess-id":"")},r),t&&a.length>0?s("div",{className:"cm-sess-id"},o):null)}function nr(e){const{state:t,draft:n,setDraft:a,t:o}=e,r=t.config,i=n?.budget??r.budget,l=Number(r.exchangeRate),u=(t.budgetUsed??(i.period==="day"?Q(t.today,r):i.period==="all"?Q(t.total,r):Q(t.month,r)))*(Number.isFinite(l)&&l>0?l:1),d=Math.max(0,Number(i.amount)||0),m=i.enabled&&d>0?Math.min(999,u/d*100):null,g=m===null?"ok":m>=100?"over":m>=80?"warn":"ok",f=(h,A)=>{n!==null&&a({...n,budget:{...n.budget??r.budget,[h]:A}})},p=i.period==="custom"?i.customStart+" → "+(i.customEnd??o("periodDay")):null,k=i.enabled&&m!==null?o("budgetStatus",{period:o(et[i.period]??"periodMonth"),amount:le(d,r),used:le(u,r),pct:m.toFixed(1)})+(g==="over"?o("overLimit"):g==="warn"?o("nearLimit"):""):null;return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},s("h3",{className:"cm-h"},o("budget")),s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:i.enabled===!0,onChange:h=>f("enabled",h.target.checked)}),s("span",null,o("enableBudget")))),i.enabled?s(R,null,s("div",{className:"cm-budget-bar"},s("div",{className:"cm-budget-fill "+(g==="ok"?"":g),style:{width:(m===null?0:Math.min(100,m))+"%"}})),s("div",{className:"cm-budget-line"+(g==="over"?" over":"")+" cm-num"},k),s("div",{className:"cm-budget-controls"},s("div",{className:"cm-field"},s("label",null,o("budgetAmountLabel")),ft({value:i.amount},h=>f("amount",h))),s("div",{className:"cm-field"},s("label",null,o("budgetPeriodLabel")),s("select",{className:"cm-input",value:i.period,onChange:h=>f("period",h.target.value)},s("option",{value:"day"},o("periodDay")),s("option",{value:"month"},o("periodMonth")),s("option",{value:"all"},o("periodAll")),s("option",{value:"custom"},o("periodCustomRange")))),i.period==="custom"?s(R,null,s("div",{className:"cm-field"},s("label",null,o("startDate")),s("input",{className:"cm-input",type:"date",value:i.customStart??"",onChange:h=>f("customStart",h.target.value===""?null:h.target.value)})),s("div",{className:"cm-field"},s("label",null,o("endDate")),s("input",{className:"cm-input",type:"date",value:i.customEnd??"",onChange:h=>f("customEnd",h.target.value===""?null:h.target.value)}))):null),p!==null?s("p",{className:"cm-hint"},o("rangeText",{range:p})):null):s("p",{className:"cm-note"},o("budgetDisabledNote")))}function sr(e){return s(ne,{...e,load:e.api.loadPricing,mode:"peak-settings",peakHelpers:{peakPhaseAt:da,resolveLocale:j,peakNoticeEl:Rn}})}function ft(e,t){const n=e.value;return s("input",{className:"cm-input narrow",type:"number",step:"any",min:"0",placeholder:e.placeholder,title:e.title,"aria-label":e.label,value:typeof n=="number"?String(n):"",onChange:a=>{const o=a.target.value;if(o===""){if(e.emptyMode==="clear"){t(null);return}if(e.emptyMode==="ignore")return;t(0);return}const r=Number(o);Number.isFinite(r)&&r>=0&&t(r)}})}function Aa({value:e,entry:t,path:n,emptyMode:a,placeholder:o,label:r,title:i,t:l,onCommit:c,plain:u=!1}){const d=Nt(t,n),m=e==null?"":String(e)+(!u&&(t.multiplier!==void 0||t.separateMultipliers)?" × "+d:""),[g,f]=D(m),[p,k]=D(!1),h=Ne(!1);ee(()=>{h.current||f(m)},[m]);const A=()=>{if(!h.current)return;const x=g.trim().split(/\s*[×*xX]\s*/),y=/^[+]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;if(g.trim()===""){h.current=!1,k(!1),a==="clear"?c(null):f(m);return}if(x.length>2||!x.every(b=>y.test(b)&&Number.isFinite(Number(b)))||!Number.isFinite(Number(x[0])*(x.length===2?Number(x[1]):d))){k(!0);return}h.current=!1,k(!1),f(String(Number(x[0]))+(!u&&(t.multiplier!==void 0||t.separateMultipliers||x.length===2)?" × "+(x.length===2?Number(x[1]):d):"")),c(Number(x[0]),x.length===2?Number(x[1]):void 0)};return s("input",{className:"cm-input narrow",type:"text",value:g,placeholder:o,"aria-label":r,"aria-invalid":p,title:p?l("priceMultiplyInvalid"):[i,u?"":l(t.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll"),e==null?"":"= "+Number((e*d).toPrecision(12))].filter(Boolean).join(" · "),onChange:x=>{h.current=!0,f(x.target.value),k(!1)},onBlur:A,onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),A()),x.key==="Escape"&&(x.stopPropagation(),h.current=!1,k(!1),f(m))}})}function Ft(e,t,n){n!==void 0&&(e.separateMultipliers?e.multipliers={...e.multipliers,[t]:n}:e.multiplier=n)}function Ma(e,t,n,a,o,r,i,l=0){const c=a==="cacheWrite",u=t?.[a]??(a==="cacheMiss"?t?.input:a==="cacheHit"?t?.cachedInput:void 0)??null,d=r({cacheHit:"flatCached",cacheMiss:"flatInput",cacheWrite:"flatCacheWrite",output:"flatOutput"}[a]);return s("label",{className:"cm-price-cell"},s("span",{className:"cm-price-cell-label"},d),s(Aa,{entry:e,value:u,path:n+"."+a,t:r,emptyMode:c||!["base","cny"].includes(n)?"clear":"ignore",placeholder:c?String(t?.cacheHit??t?.cachedInput??t?.cacheMiss??t?.input??l):void 0,label:o+" · "+d,title:c?r("cacheWriteFallback"):void 0,onCommit:i}))}function Pa(e,t,n){return s("div",{className:"cm-price-multiplier"},s("label",null,s("input",{type:"checkbox",checked:e.separateMultipliers===!0,onChange:a=>n(a.target.checked)}),t("priceMultiplySeparate")),s("span",{title:t(e.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll")},t("priceMultiplyHint")))}function or(e){const{modelId:t,entry:n,isDefault:a,draft:o,setDraft:r,t:i}=e,l=nt(n),c=f=>{const p={...nt(f)};if(Array.isArray(f.rateHistory)){const k=f.rateHistory.filter(h=>Date.parse(h.before)<=Date.now());k.length>0?p.rateHistory=k:delete p.rateHistory}return p},u=f=>{const p=a?{...o.prices,default:f}:{...o.prices,models:{...o.prices.models,[t]:f}};r({...o,prices:p})},d=(f,p,k,h)=>{const A=a?o.prices.default:o.prices.models[t],x=c(A??{cacheHit:0,cacheMiss:0,output:0}),y=f==="base"?x:{...x[f]??(k===null?{}:We(x))};k===null?delete y[p]:y[p]=Math.max(0,k),f!=="base"&&(Object.keys(y).length?x[f]=y:delete x[f]),Ft(x,f+"."+p,h),u(x)},m=()=>{const f={...o.prices.models};delete f[t],r({...o,prices:{...o.prices,models:f}})},g=(f,p)=>{const k=p==="base"?l:l[p]??null;return s("div",{className:"cm-price-row",key:p},s("span",null,f),...["cacheMiss","cacheHit","cacheWrite","output"].map(h=>s(R,{key:h},Ma(l,k,p,h,f,i,(A,x)=>d(p,h,A,x),l.cacheHit))))};return s("div",{className:"cm-price-card"},s("div",{className:"cm-price-head"},s("span",{className:"cm-price-name"},t),s("span",{className:"cm-price-unit"},o.prices.currency??"USD"),s(R,null,l?.legacy===!0?s("span",{className:"cm-price-legacy"},i("legacyModel")):null,a?s("span",{className:"cm-price-legacy"},i("defaultFallback")):null,a?null:s("button",{className:"cm-btn small danger",onClick:m},i("remove")))),s("div",{className:"cm-price-row cm-price-columns"},s("span",null,""),s("span",null,i("flatInput")),s("span",null,i("flatCached")),s("span",null,i("flatCacheWrite")),s("span",null,i("flatOutput"))),g(i("tierBase"),"base"),g(i("tierOffPeak"),"offPeak"),g(i("tierPeak"),"peak"),Pa(l,i,f=>u({...n,separateMultipliers:f,multipliers:{}})),Array.isArray(n?.rateHistory)&&n.rateHistory.length>0?s("p",{className:"cm-note"},i("datedPriceNote")):null)}const rr={deepseek:"DeepSeek",stepfun:"StepFun",openai:"OpenAI",anthropic:"Anthropic",google:"Google Gemini",moonshot:"Moonshot (Kimi)","z-ai":"Z.ai / 智谱",xai:"xAI",alibaba:"阿里云百炼",minimax:"MiniMax",tencent:"腾讯混元",xiaomi:"小米",upstage:"Upstage",nvidia:"NVIDIA",mistral:"Mistral",meta:"Meta",meituan:"美团 LongCat","opencode-go":"OpenCode Go"},ir=e=>e==="zen"?"go":e,bt=e=>e.replace(/^zen:/i,"go:").replace(/^(deepseek(?:-official|-account)?):deepseek-(?:v4(?:\.1)?-)?flash(?:-vision-exp)?$/i,"$1:DeepSeek V4.1 Flash");function Vn(e,t,n,a){const o=["input","output","cacheRead","cacheWrite","reasoning","cost","calls"],r=u=>Number.isFinite(Number(u))&&Number(u)>0?Number(u):0,i=(u,d,m)=>{if(!m||typeof m!="object")return;const g=u[d]??(u[d]=Object.fromEntries([...o,"apiCost"].map(p=>[p,0])));for(const p of o)g[p]+=r(m[p]);for(const p of kt)Number.isFinite(m[p])&&(g[p]=(g[p]??0)+m[p]);const f=d.indexOf(":");g.apiCost+=r(m.apiCost??(rt(f>0?d.slice(0,f):"deepseek",f>0?d.slice(f+1):d,t)==="plan"?0:m.cost))},l=u=>{if(!u||typeof u!="object")return{};if(u.byProviderModel&&Object.keys(u.byProviderModel).length)return u.byProviderModel;if(u.byModel&&Object.keys(u.byModel).length)return Object.fromEntries(Object.entries(u.byModel).map(([m,g])=>[m.includes(":")?m:"deepseek:"+m,g]));const d={};for(const m of Array.isArray(u.sessions)?u.sessions:[])if(!(!m||typeof m!="object"))if(m.byProviderModel&&Object.keys(m.byProviderModel).length)for(const[g,f]of Object.entries(m.byProviderModel))i(d,g,f);else i(d,(m.provider||"deepseek")+":"+(m.model||"unknown"),m);return Object.keys(d).length?d:o.some(m=>r(u[m])>0)?{"deepseek:legacy":u}:{}};return(u=>{const d={},m=g=>{for(const[f,p]of Object.entries(g??{}))i(d,f,p)};if(u==="today")m(l(e.today));else{const g=Date.parse((e.meta?.dayKey||new Date().toISOString().slice(0,10))+"T00:00:00Z");for(const f of e.history??[]){const p=Date.parse(f.date+"T00:00:00Z");p<=g&&p>=g-76896e5&&m(l(f))}}return Object.entries(d).map(([g,f])=>{const p=g.indexOf(":"),k=(p>0?g.slice(0,p):"deepseek").toLowerCase(),h=p>0?g.slice(p+1):g,A=f.input+f.output+f.cacheRead+f.cacheWrite+f.reasoning,x=f.cacheRead+f.input;return{label:e.modelLabels?.[g]??(g==="deepseek:legacy"?n("modelStatsLegacy"):k==="deepseek"||k===""?h:ir(k)+":"+h),key:g,...f,tokens:A,cls:rt(k,h,t),hitRate:x>0?f.cacheRead/x:null,cacheUnreported:Ks(f),blended:A>0&&f.cost>0?f.cost/A*1e6:null,perUsd:f.cost>0?A/f.cost:null}}).filter(g=>(g.tokens>0||g.cost>0)&&t.modelStatistics?.[g.key]?.[u==="today"?"today":"summary"]!==!1)})(a).sort((u,d)=>d.cost-u.cost||d.tokens-u.tokens)}function lr(e){const{state:t,config:n,t:a,initialTab:o,draft:r,setDraft:i}=e,[l,c]=D(o==="history"?"history":"today"),[u,d]=D(!1),m=Vn(t,n,a,l),g=b=>(Math.max(0,Math.min(1,b))*100).toFixed(1)+"%",f=m.reduce((b,w)=>Math.max(b,w.cost),0),p=m.reduce((b,w)=>Math.max(b,w.tokens),0),k=m.reduce((b,w)=>Math.max(b,w.perUsd??0),0),h=(b,w)=>s("button",{className:"cm-mstats-tab"+(l===b?" active":""),onClick:()=>c(b)},w),A=b=>b.cls==="plan"?s("span",{className:"cm-plan-tag",title:a("billingClassLabel")+" · "+(Oa(fn(b.provider,n,b.model),a)||a("billingClassPlan"))},a("billingClassPlan")):null,x=b=>s("select",{className:"cm-input",title:a("billingClassLabel"),value:n.planBilling?.models?.[b.key]==="plan"&&n.planBilling?.modelPlans?.[b.key]?"plan:"+n.planBilling.modelPlans[b.key]:n.planBilling?.models?.[b.key]??"auto",disabled:r===null,onChange:w=>{const N={...r.planBilling?.models??{}},C={...r.planBilling?.modelPlans??{}},O=w.target.value;delete C[b.key],O.startsWith("plan:")?(N[b.key]="plan",C[b.key]=O.slice(5)):O==="auto"?delete N[b.key]:N[b.key]=O,i({...r,planBilling:{...r.planBilling,models:N,modelPlans:C}})}},s("option",{value:"auto"},a("billingClassAuto")),s("option",{value:"plan"},a("billingClassPlan")),s("option",{value:"api"},a("billingClassApi")),Te.map(w=>s("option",{key:w,value:"plan:"+w},a("billingClassPlan")+" · "+Oa(w,a)))),y=(b,w,N,C,O)=>s("div",{className:"cm-mstats-row"},O?s("div",{className:"cm-mstats-label"},s("span",{className:"cm-mstats-name",title:b},b),O):s("span",{className:"cm-mstats-name",title:b},b),s("div",{className:"cm-mstats-barbg"},s("div",{className:"cm-mstats-bar "+N,style:{width:g(w)}})),s("span",{className:"cm-mstats-val"},C));return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(u,()=>d(!u),a("modelStatsTitle"))),u?s("div",{className:"cm-collapse-body"},s("div",{className:"cm-mstats-tabs"},h("today",a("modelStatsToday")),h("history",a("modelStatsHistory"))),m.length===0?s("p",{className:"cm-note"},a("modelStatsEmpty")):s(R,null,s("div",{className:"cm-mstats-h"},a("modelStatsCostH")),m.map(b=>s(R,{key:"c:"+b.label},y(b.label,f>0?b.cost/f:0,"cost",$(b.cost,n),s(R,null,A(b),x(b),b.cacheUnreported?s("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null)))),s("div",{className:"cm-mstats-h"},a("modelStatsTokensH")),s("div",{className:"cm-mstats-legend"},s("span",null,s("span",{className:"cm-mstats-dot",style:{background:"var(--dsw-alias-state-business-primary)"}}),a("modelStatsInput")),s("span",null,s("span",{className:"cm-mstats-dot",style:{background:"#ff9800"}}),a("modelStatsCache")),s("span",null,s("span",{className:"cm-mstats-dot",style:{background:"#34a853"}}),a("modelStatsOutput"))),[...m].sort((b,w)=>w.tokens-b.tokens).map(b=>s("div",{className:"cm-mstats-row",key:"t:"+b.label},s("span",{className:"cm-mstats-name",title:b.label},b.label),s("div",{className:"cm-mstats-barbg"},s("div",{className:"cm-mstats-seg in",style:{width:g(p>0?b.input/p:0)}}),s("div",{className:"cm-mstats-seg cache",style:{width:g(p>0?(b.cacheRead+b.cacheWrite)/p:0)}}),s("div",{className:"cm-mstats-seg out",style:{width:g(p>0?(b.output+b.reasoning)/p:0)}})),s("span",{className:"cm-mstats-val"},E(b.tokens)))),s("div",{className:"cm-mstats-h"},a("modelStatsHitH")),[...m].sort((b,w)=>(w.hitRate??-1)-(b.hitRate??-1)).map(b=>s(R,{key:"h:"+b.label},y(b.label,b.hitRate??0,"hit",b.cacheUnreported?a("modelStatsHitUnreported"):b.hitRate===null?"—":(b.hitRate*100).toFixed(1)+"%",b.cacheUnreported?s("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null))),s("div",{className:"cm-mstats-h"},a("modelStatsValueH")),[...m].sort((b,w)=>(w.perUsd??-1)-(b.perUsd??-1)).map(b=>s(R,{key:"v:"+b.label},y(b.label,k>0?(b.perUsd??0)/k:0,"value",b.perUsd===null?"—":E(b.perUsd)+" tok/$"+(b.blended!==null?" · "+a("modelStatsBlended",{price:"$"+b.blended.toFixed(2)}):"")))),s("p",{className:"cm-mstats-note"},a("modelStatsNote")))):null)}function cr(e,t){return e==="fiveHour"?t==="en"?"5-hour":"5 小时":e==="weekly"?t==="en"?"This week":"本周":e==="monthly"?t==="en"?"This month":"本月":e==="daily"?t==="en"?"Today":"当日":e}function Oa(e,t){if(e==="go")return"OpenCode Go / Go Plus";const n={codex:"Codex / ChatGPT","volcengine-agent":"Volcengine Agent Plan","tencent-coding":"Tencent Coding Plan","tencent-token":"Tencent Token Plan"};if(n[e])return n[e];const a=Le.find(o=>o.id===e);return a!==void 0?t(a.labelKey):e}const Yn=["fiveHour","weekly","monthly","daily"];function ur(e,t){const n=new Map,a=o=>{const r=new Date(o),i=l=>String(l).padStart(2,"0");if(t==="monthly")return r.getFullYear()+"-"+i(r.getMonth()+1);if(t==="weekly"){const l=new Date(r.getFullYear(),r.getMonth(),r.getDate()-(r.getDay()+6)%7);return l.getFullYear()+"-"+i(l.getMonth()+1)+"-"+i(l.getDate())}return r.getFullYear()+"-"+i(r.getMonth()+1)+"-"+i(r.getDate())};for(const o of Object.values(e??{}))for(const r of o??[]){if(r===null||typeof r!="object"||!(r.tokens>0)&&!(r.cost>0))continue;const i=a(Number(r.t1)||Number(r.t0)),l=n.get(i)??{key:i,tokens:0,cost:0,pct:0,intervals:0};l.tokens+=Number(r.tokens)||0,l.cost+=Number(r.cost)||0,l.pct+=Number(r.pct)||0,l.intervals+=1,n.set(i,l)}return[...n.values()].map(o=>({...o,per1Tokens:o.pct>0?o.tokens/o.pct:null,fullTokens:o.pct>0?o.tokens/o.pct*100:null})).sort((o,r)=>o.key<r.key?-1:o.key>r.key?1:0)}function dr(e){const{state:t,config:n,t:a}=e,[o,r]=D(!1),[i,l]=D("daily"),c=j(n),u=t?.planStats,d=u!=null&&typeof u.providers=="object"?u.providers:{},m=Object.keys(d).sort(),g=N=>$(Number(N)||0,n??t?.config),f=N=>N.method==="none"||N.per1Tokens===null?"—":E(N.per1Tokens)+" tok · "+g(N.per1Cost),p=N=>N.method==="none"||N.fullTokens===null?"—":E(N.fullTokens)+" tok · "+g(N.fullCost),k=N=>N.method==="sample"?a("planStatsMethodSample"):N.method==="live"?a("planStatsMethodLive"):a("planStatsMethodNone"),h=N=>{let C=k(N);return N.method==="sample"&&Number(N.sampleAt)>0&&(C=a("planStatsMethodSampleAt",{method:C,time:new Date(Number(N.sampleAt)).toLocaleString(c==="en"?"en-US":"zh-CN")})),(N.method==="sample"||N.method==="live")&&N.confidence==="low"&&(C+=" · "+a("planStatsConfidenceLow")),C},A=([N,C,O])=>s("tr",{key:C+":"+N},s("td",null,cr(N,c)),s("td",{className:"num"},Math.round(O.percent*10)/10+"%"),s("td",{className:"num"},E(O.localTokens)+" tok · "+g(O.localCost)),s("td",{className:"num"},f(O)),s("td",{className:"num"},p(O)),s("td",{className:"num cm-plan-reset"},O.resetsAt.length>0?a("planStatsResets",{time:new Date(O.resetsAt).toLocaleString(c==="en"?"en-US":"zh-CN")}):"—"),s("td",{className:"cm-plan-method"},h(O))),x=o?m.flatMap(N=>Object.entries(d[N]?.intervals??{})).map(([N,C])=>({winKey:N,list:C})):[],y=ur(Object.fromEntries(x.map(N=>[N.winKey,N.list])),i),b=y.reduce((N,C)=>Math.max(N,C.fullTokens??0),0),w=(N,C)=>s("button",{key:N,className:"cm-mstats-tab"+(i===N?" active":""),onClick:()=>l(N)},C);return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(o,()=>r(!o),a("planStatsTitle"))),o?s("div",{className:"cm-collapse-body"},m.length===0?s("p",{className:"cm-empty"},a("planStatsEmpty")):s(R,null,m.map(N=>{const C=d[N]?.windows??{},O=[...Yn.filter(T=>C[T]!==void 0).map(T=>[T,N,C[T]]),...Object.keys(C).filter(T=>!Yn.includes(T)).map(T=>[T,N,C[T]])];return s("div",{key:N,className:"cm-plan-provider"},s("div",{className:"cm-plan-provider-name"},Oa(N,a),s("span",{className:"cm-plan-updated"},(()=>{const T=Number(d[N]?.generatedAt)||Number(u?.generatedAt)||0;return T>0?new Date(T).toLocaleTimeString(c==="en"?"en-US":"zh-CN"):""})())),s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("planStatsWindow")),s("th",{className:"num"},a("planStatsPercent")),s("th",null,a("planStatsLocal")),s("th",null,a("planStatsPer1")),s("th",null,a("planStatsFull")),s("th",null,""),s("th",null,""))),s("tbody",null,O.map(A))))}),s("div",{className:"cm-mstats-h",style:{marginTop:"10px"}},a("planStatsCurveTitle")),s("div",{className:"cm-mstats-tabs"},w("daily",a("planStatsDaily")),w("weekly",a("planStatsWeekly")),w("monthly",a("planStatsMonthly"))),y.length===0?s("p",{className:"cm-note"},a("planStatsCurveEmpty")):s(R,null,[...y].reverse().map(N=>s("div",{className:"cm-mstats-row",key:N.key},s("span",{className:"cm-mstats-name"},N.key),s("div",{className:"cm-mstats-barbg"},s("div",{className:"cm-mstats-bar value",style:{width:(b>0?(N.fullTokens??0)/b*100:0).toFixed(1)+"%"}})),s(K,{label:a("planStatsBarTip",{date:N.key,full:N.fullTokens===null?"—":E(N.fullTokens),per1:N.per1Tokens===null?"—":E(N.per1Tokens),tokens:E(N.tokens),cost:g(N.cost),intervals:N.intervals}),side:"top",delayMs:200},s("span",{className:"cm-mstats-val"},N.fullTokens===null?"—":E(N.fullTokens)))))),s("p",{className:"cm-note"},a("planStatsNote")))):null)}function mr(e){const{provider:t,modelId:n,entry:a,draft:o,setDraft:r,t:i,api:l,lockedIds:c,releaseDisabled:u}=e,d=Array.isArray(c)&&c.includes(n),[m,g]=D(!1),[f,p]=D(""),k=async()=>{if(!(m||u)){g(!0),p("");try{await l.releasePriceLock(n)}catch(b){p(String(b.message??b))}finally{g(!1)}}},h=b=>{const w={...o.prices.providers??{}},N=w[t]??{};w[t]={...N,models:b},r({...o,prices:{...o.prices,providers:w}})},A=(b,w,N)=>{if(o===null)return;const C={...(o.prices.providers??{})[t]?.models??{}};C[n]={...C[n]??{},[b]:Math.max(0,w)},w===null&&delete C[n][b],b==="input"&&delete C[n].cacheMiss,b==="cachedInput"&&(delete C[n].cacheHit,delete C[n].cacheRead),Ft(C[n],"base."+({input:"cacheMiss",cachedInput:"cacheHit"}[b]??b),N),h(C)},x=(b,w,N)=>{if(o===null)return;const C={...(o.prices.providers??{})[t]?.models??{}},O=C[n]??{};C[n]={...O,cny:{...O.cny,[b]:Math.max(0,w)}},w===null&&delete C[n].cny[b],Ft(C[n],"cny."+b,N),h(C)},y=()=>{if(o===null)return;const b={...(o.prices.providers??{})[t]?.models??{}};delete b[n],h(b)};return s("div",{className:"cm-price-card"},s("div",{className:"cm-price-head"},s("span",{className:"cm-price-name"},n),s("span",{className:"cm-price-unit"},a.cny?"USD / CNY":"USD"),s(R,null,a?.unpriced===!0?s("span",{className:"cm-price-legacy"},i("catalogUnpriced")):null,d?s("span",{className:"cm-price-locked",title:i("priceLockHint")},i("priceLockBadge")):null,d&&typeof l?.releasePriceLock=="function"?s("button",{className:"cm-btn small",disabled:m||u,onClick:k},i("priceLockRelease")):null,s("button",{className:"cm-btn small danger",onClick:y},i("unmountBtn")))),f?s("p",{className:"cm-err",role:"alert"},f):null,a?.unpriced===!0?null:s(R,null,s("div",{className:"cm-price-row cm-price-columns"},s("span",null,""),s("span",null,i("flatInput")),s("span",null,i("flatCached")),s("span",null,i("flatCacheWrite")),s("span",null,i("flatOutput"))),s("div",{className:"cm-price-row"},s("span",null,"USD"),...["cacheMiss","cacheHit","cacheWrite","output"].map(b=>s(R,{key:b},Ma(a,a,"base",b,"USD",i,(w,N)=>A({cacheMiss:"input",cacheHit:"cachedInput"}[b]??b,w,N))))),a?.cny?s("div",{className:"cm-price-row"},s("span",null,"CNY"),...["cacheMiss","cacheHit","cacheWrite","output"].map(b=>s(R,{key:b},Ma(a,a.cny,"cny",b,"CNY",i,(w,N)=>x(b,w,N))))):null,Pa(a,i,b=>h({...o.prices.providers[t].models,[n]:{...a,separateMultipliers:b,multipliers:{}}}))))}const Ta=e=>[s("option",{key:"sidebar",value:"sidebar"},e("balanceSidebar")),s("option",{key:"settings",value:"settings"},e("balanceSettings")),s("option",{key:"both",value:"both"},e("balanceBoth")),s("option",{key:"off",value:"off"},e("off"))],Ra=e=>e!=null?s("div",{className:"cm-msg "+e.kind},e.text):null;function pr(e){const{state:t,api:n,t:a,draft:o,setDraft:r}=e,[i,l,c]=Qt(a,()=>n.refreshBalance()),u=t.balance,d=t.config,m=t.reconcile,g=(o?.balance??d.balance??{}).reconcile!==!1,f=h=>{o===null||typeof r!="function"||r({...o,balance:{...o.balance??d.balance??{},reconcile:h.target.checked}})},p=h=>Re(h,d,u?.currency),k=u.status==="ok"?s("div",{className:"cm-bal-line"},s("span",null,a("balanceLine",{total:p(u.totalBalance),granted:p(u.grantedBalance),toppedUp:p(u.toppedUpBalance),time:u.fetchedAt>0?new Date(u.fetchedAt).toLocaleTimeString():"—"}))):u.status==="error"?s("div",{className:"cm-bal-line err"},a("balanceQueryFailedHint",{message:u.message||a("unknownError")})):s("div",{className:"cm-bal-line"},a("balanceNotQueried"));return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},s("h3",{className:"cm-h"},a("accountBalance")),s("button",{className:"cm-btn small",onClick:c,disabled:i},a(i?"refreshing":"refreshBalance"))),k,s("div",{className:"cm-field"},s("label",null,a("balanceSourceChoice")),s("select",{className:"cm-input","aria-label":a("balanceSourceChoice"),value:(o?.balance??d.balance)?.source??"auto",disabled:!o,onChange:h=>r({...o,balance:{...o.balance,source:h.target.value}})},s("option",{value:"auto"},a("balanceSourceAuto")),s("option",{value:"account"},a("balanceSourceAccount")))),s("p",{className:"cm-hint"},a("balanceSourceHint")),s("label",null,a("balanceApiKey")),s(es,{state:t,draft:o,setDraft:r,target:"balance",configured:u.keyConfigured,source:u.keySource,t:a,api:n,placeholder:"sk-…"}),m!==void 0&&m.ok===!1?s("div",{className:"cm-bal-line warn"},"⚠ "+m.message):null,s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:g,onChange:f}),a("reconcileLabel")),Ra(l))}function Da(e){const t=Ne(null);ee(()=>{e.targeted&&(t.current?.scrollIntoView({block:"start"}),t.current?.focus({preventScroll:!0}))},[e.targeted]);const{name:n,enabled:a,saved:o,busy:r,open:i,statusNode:l,configNode:c,errorMsg:u,onToggle:d,onRefresh:m,onLogin:g,loginRequired:f,onRemove:p,onToggleOpen:k,t:h}=e,A=c!=null,x=f?g:m,y=h(r===!0?f?"loggingIn":"refreshing":f?"loginCodingPlan":"refresh");return s("div",{ref:t,"data-quota-plan":e.planId,tabIndex:e.targeted?-1:void 0,className:"cm-budget cm-quota-card"},s("div",{className:"cm-budget-head"},s("label",{className:"cm-check"},s("input",{type:"checkbox","aria-label":h("enable")+": "+n,checked:a===!0,onChange:b=>d(b.target.checked)})),s("div",{className:"cm-quota-name"},A?pt(i===!0,k,n):s("h3",{className:"cm-h"},n)),p?s("button",{className:"cm-btn small",onClick:p},h("quotaRemove")):null,s("button",{className:"cm-btn small",onClick:x,disabled:r===!0||a!==!0||o?.enabled!==!0||o.display==="off"&&o.showInComposer!==!0,title:a!==!0?h("quotaEnableFirst"):o?.enabled!==!0||o.display==="off"&&o.showInComposer!==!0?h("quotaRefreshReady"):h(f?"loginCodingPlan":"refresh")},y)),l,A&&i===!0?s("div",{className:"cm-collapse-body"},c):null,u!=null?s("div",{className:"cm-msg "+u.kind},u.text):null)}function Qt(e,t){const[n,a]=D(!1),[o,r]=D(null),i=Ne(!1);return[n,o,async()=>{if(!i.current){i.current=!0,a(!0),r(null);try{const c=await t();r({kind:c.ok?"ok":"err",text:c.message})}catch(c){r({kind:"err",text:e("syncFailed",{message:c?.message??String(c)})})}finally{i.current=!1,a(!1)}}}]}const fr=e=>{const t=e.filter(a=>a.enabled===!0),n=e.filter(a=>a.enabled!==!0);return[...t,...n]},Ba=(e,t,n,a,o,r=t)=>{if(typeof n?.percent!="number")return s("div",{key:r,className:"cm-go-row"+(o?" main":"")},s("span",{className:"cm-go-label"},t),s("span",{className:"cm-go-num"},typeof n?.text=="string"?n.text:"—"));const i=Math.max(0,Math.min(100,Number(n.percent)||0)),l=he(i,a),c=typeof n.resetsAt=="string"&&n.resetsAt.length>0?e("goResetAt",{time:new Date(n.resetsAt).toLocaleString()}):"";return s("div",{key:r,className:"cm-go-row"+(o?" main":"")},s("span",{className:"cm-go-label"},t),s("div",{className:"cm-go-bar"},s("div",{className:"cm-go-fill",style:{width:l.width+"%"}})),s("span",{className:"cm-go-num"},l.label===null?"—":e("goQuotaPercent",{percent:String(Math.round(l.label))})),c?s("span",{className:"cm-go-reset"},c):null)};function br(e){return s(ne,{...e,mode:"custom-balance",load:Jn})}function gr({config:e,draft:t,setDraft:n,t:a,api:o}){const r=t?.goQuota??e.goQuota,i=(l,c)=>{t&&n({...t,goQuota:{...r,[l]:c}})};return s(R,null,[["display","goQuotaDisplayLabel"],["main","goMainLabel"]].map(([l,c])=>s("div",{key:l,className:"cm-field"},s("label",null,a(c)),s("select",{className:"cm-input",value:l==="display"?ha(r,(t??e).quotaStrip,"go"):r[l],onChange:u=>l==="display"?t&&n({...t,goQuota:{...r,...ka(u.target.value)}}):i(l,u.target.value)},l==="display"?xa(a):["rolling","weekly","monthly"].map((u,d)=>s("option",{key:u,value:u},a(["goWindowRolling","goWindowWeekly","goWindowMonthly"][d])))))),s("div",{className:"cm-field"},s("label",null,a("goQuotaRefreshIntervalLabel")),ft({value:r.refreshMinutes},l=>i("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(l)))))),s("label",null,a("goQuotaKeyLabel")),s(es,{state:{config:e},draft:t,setDraft:n,target:"goQuota",configured:e.goQuota?.keyConfigured===!0,source:e.goQuota?.keySource,t:a,api:o,placeholder:"sk-…"}))}function yr(e){const{state:t,api:n,t:a,draft:o,setDraft:r}=e,[i,l]=D(!1),c=t.goQuota,u=t.config,d=o?.goQuota?.enabled??u.goQuota?.enabled??!0,m=(b,w)=>{o!==null&&r({...o,goQuota:{...o.goQuota??u.goQuota,[b]:w}})},[g,f,p]=Qt(a,()=>n.refreshGoQuota()),k=u.goQuota?.main==="weekly"||u.goQuota?.main==="monthly"?u.goQuota.main:"rolling",h=[k,...["rolling","weekly","monthly"].filter(b=>b!==k)],A=b=>b==="rolling"?"goWindowRolling":b==="weekly"?"goWindowWeekly":"goWindowMonthly",x=b=>b==="rolling"?c.rolling:b==="weekly"?c.weekly:c.monthly,y=d===!1?s("p",{className:"cm-note"},a("goQuotaDisabledNote")):c.status==="ok"?s("div",{className:"cm-go-list"},h.map(b=>Ba(a,a(A(b)),x(b),re(u,"go"),b===k)),s("div",{className:"cm-go-time"},a("goQuotaFetchedAt",{time:c.fetchedAt>0?new Date(c.fetchedAt).toLocaleTimeString():"—"}))):c.status==="error"?s("div",{className:"cm-bal-line err"},c.message||a("unknownError")):c.status==="off"&&c.message?s("p",{className:"cm-note"},c.message):s("div",{className:"cm-bal-line"},a("goQuotaNotQueried"));return s(Da,{name:a("goQuotaTitle"),enabled:d,saved:u.goQuota,busy:g,open:i,statusNode:y,errorMsg:f,configNode:s(gr,{config:u,draft:o,setDraft:r,t:a,api:n}),onToggleOpen:()=>l(b=>!b),onToggle:b=>m("enabled",b),onRefresh:p,t:a})}const hr=(e,t)=>{if(typeof e?.keyVar=="string"&&e.keyVar.length>0)return e.keyVar;const a="CLIPROXYAPI_MANAGEMENT_KEY_"+(String(e?.id??"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"GATEWAY");return Object.keys(t??{}).find(o=>o===a||o.startsWith(a+"_"))??a};function kr(e){const{state:t,api:n,t:a,draft:o,setDraft:r,index:i}=e,l=t.config,u=(o??l).gatewayQuotas?.sources??[],d=u[i]??{},g=(Array.isArray(t.gatewayQuotas)?t.gatewayQuotas:[]).find(v=>v.id===d.id)??{id:d.id,status:"off",accounts:[],unsupportedProviders:[]},f=d.type==="agy-link",p=f?null:hr(d,t.customVarStatus),[k,h]=D(!1),[A,x,y]=Qt(a,()=>n.refreshGatewayQuota(d.id)),b=v=>{o!==null&&r({...o,gatewayQuotas:{...o.gatewayQuotas??l.gatewayQuotas??{},sources:v}})},w=v=>b(u.map((I,F)=>F===i?{...I,...v}:I)),N=(v,I,F)=>s("div",{className:"cm-field"},s("label",null,v),s("input",{className:"cm-input","aria-label":v,value:I??"",onChange:F})),C=(v,I)=>{const F=dt(v?.label||v?.id||a("gatewaySourceUnknown"),v,f?"remaining":re(l,"plan"),a);return s(R,{key:v?.id||I},F.row,v?.resetsAt?s("div",{className:"cm-note"},ut(v,a)):null)},O=(v,I)=>s("div",{key:v.id||I,className:"cm-mm-row wide"},s("span",{className:"cm-bbox-label"},v.label||"package"),s("span",{className:"cm-bbox-pct cm-num"},(v.used??"—")+" / "+(v.limit??"—")),s("span",{className:"cm-bbox-pct cm-num"},(v.remaining??"—")+" remaining")),T=v=>v==null?null:s(R,null,s("div",{className:"cm-mm-row wide"},s("span",{className:"cm-bbox-label"},v.unit||"credits"),s("span",{className:"cm-bbox-pct cm-num"},(v.used??"—")+" / "+(v.limit??"—")),s("span",{className:"cm-bbox-pct cm-num"},(v.remaining??"—")+" remaining")),(v.packages??[]).map(O)),W=(v,I)=>s("div",{key:v.id||I,className:"cm-budget",style:{marginTop:"8px",padding:"10px 12px"}},s("div",{className:"cm-budget-head"},s("strong",null,(Ya[v.provider]??v.provider??a("gatewaySourceUnknown"))+" · "+(v.label||a("gatewaySourceUnknown"))),s("span",{className:"cm-hint"},v.status)),v.plan?s("div",{className:"cm-note"},v.plan):null,v.windows.length>0?s("div",{className:"cm-go-list"},v.windows.map(C)):null,T(v.credits),v.message?s("div",{className:"cm-note"},v.message):null);return s(Da,{name:d.label||d.id||a("gatewayQuotaTitle"),enabled:d.enabled===!0,saved:l.gatewayQuotas?.sources?.find(v=>v.id===d.id),busy:A,open:k,errorMsg:x,statusNode:s("div",{className:"cm-note"},a("gatewaySourceStatus")+": "+(g.status??a("gatewaySourceUnknown"))+(g.serverVersion?" · "+g.serverVersion:"")+(g.fetchedAt>0?" · "+a("gatewaySourceFetchedAt",{time:new Date(g.fetchedAt).toLocaleTimeString()}):"")+(g.message?" · "+g.message:"")),configNode:s(R,null,s("div",{className:"cm-grid"},N(a("gatewaySourceLabel"),d.label,v=>w({label:v.target.value})),!f&&N(a("gatewaySourceBaseURL"),d.baseURL,v=>w({baseURL:v.target.value})),s("div",{className:"cm-field"},s("label",null,a("gatewaySourceDisplay")),s("select",{className:"cm-input",value:d.display??"both",onChange:v=>w({display:v.target.value})},...Ta(a))),s("div",{className:"cm-field"},s("label",null,a("gatewaySourceRefreshInterval")),ft({value:d.refreshMinutes??15},v=>w({refreshMinutes:Math.min(1440,Math.max(1,Math.floor(v)))}))),!f&&N(a("gatewaySourceAllowlist"),(d.allowedHosts??[]).join(", "),v=>w({allowedHosts:v.target.value.split(/[\s,;]+/).filter(Boolean)})),!f&&s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:d.allowInsecureHttp===!0,onChange:v=>w({allowInsecureHttp:v.target.checked})}),s("span",null,a("customBalanceHttp"))),!f&&s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:d.antigravityOnlyGemini===!0,onChange:v=>w({antigravityOnlyGemini:v.target.checked})}),s("span",null,a("gatewayOnlyGemini")))),p?s("div",{className:"cm-field"},s("label",null,a("gatewaySourceCredential")),s(aa,{target:"customVar:"+p,configured:t.customVarStatus?.[p]?.configured===!0,source:t.customVarStatus?.[p]?.source??"",t:a,api:n,placeholder:p})):null,g.unsupportedProviders.length>0?s("div",{className:"cm-note"},a("gatewaySourceUnsupported")+": "+g.unsupportedProviders.join(", ")):null,g.accounts.length>0?g.accounts.map(W):s("div",{className:"cm-bal-line"},a("gatewaySourceNoAccounts"))),onToggle:v=>w({enabled:v}),onRefresh:y,onRemove:()=>b(u.filter((v,I)=>I!==i)),onToggleOpen:()=>h(v=>!v),t:a})}const Le=[{id:"opendesign",labelKey:"codingPlanOpendesign"},{id:"anthropic",labelKey:"codingPlanAnthropic"},{id:"zai",labelKey:"codingPlanZai"},{id:"minimax",labelKey:"codingPlanMinimax"},{id:"kimi",labelKey:"codingPlanKimi"},{id:"openrouter",labelKey:"codingPlanOpenrouter"},{id:"siliconflow",labelKey:"codingPlanSiliconflow"},{id:"commandcode",labelKey:"codingPlanCommandcode"},{id:"clinepass",labelKey:"codingPlanClinepass"},{id:"scnet",labelKey:"codingPlanScnet"},{id:"volcengine",labelKey:"codingPlanVolcengine"},{id:"qwen",labelKey:"codingPlanQwen"},{id:"mimo",labelKey:"codingPlanMimo"},{id:"baidu-coding",labelKey:"codingPlanBaidu"},{id:"workbuddy",labelKey:"wbT"},{id:"factory",labelKey:"codingPlanFactory"}];let Zn;function Jn(){return Zn??=ge.async("./client.plan-settings.js").then(e=>e.mount({useQuotaRefresh:Qt,miniMaxWindowsOf:fa,MiniMaxPlanCard:ba,barDirectionOf:re,quotaWindowRow:Ba,codingPlanWindowLabel:Ye,codingPlanWindowEntries:It,numInput:ft,CredentialField:aa,QuotaCard:Da,resolveLocale:j,formatMoneyUsd:$,formatBalanceMoney:Re,quotaPlacementValue:ha,quotaPlacementPatch:ka,quotaPlacementOptions:xa,displayOptions:Ta,BalanceBar:ia,segmentsForCustomBalance:ra,customBalanceUnitOf:lt,customBalanceDetailText:ua,formatCustomBalanceMoney:Qe,resolveCustomBalanceLabel:ca})).catch(e=>{throw Zn=null,e})}function Xn(e){return s(ne,{...e,load:Jn})}function es(e){const[t,n]=D(!1);return t||e.state.config.queryAccounts?.[e.target]?.accounts?.length?s(Xn,{...e,mode:"credential"}):s(R,null,s(aa,e),s("button",{type:"button",className:"cm-btn small",onClick:()=>n(!0)},j(e.state.config)==="en"?"Manage accounts":"管理账号"))}function xr(e){const{state:t,api:n,t:a,draft:o,setDraft:r}=e,i=t.config,l=o??i,c=l.codingPlans??{},u=l.gatewayQuotas?.sources??[],d=o?.customBalances??i.customBalances??[],m=y=>{o!==null&&r({...o,customBalances:y,...y.length===0?{customBalance:{...i.customBalance??{},enabled:!1,request:{url:"",headers:{}}}}:{}})},g=Ne({next:0,keys:[]}).current;for(;g.keys.length<d.length;)g.keys.push(g.next++);g.keys.length=d.length;const f=y=>{g.keys.splice(y,1),m(d.filter((b,w)=>w!==y))},p=(y,b)=>m(d.map((w,N)=>N===y?{...w,...b}:w)),k=(y="custom")=>{if(!(d.length>=8)){if(y==="openai-credits"){if(d.some(b=>b.adapter===y))return;m([...d,{adapter:y,enabled:!1,label:"OpenAI API 赠送额度(预估)",labelEn:"OpenAI API credits (estimate)",grantAmount:0,grantStart:"",grantExpiry:"",display:"both",unit:"USD",refreshMinutes:15,dashboardUrl:"https://platform.openai.com/settings/organization/billing/credit-grants",request:{url:"https://api.openai.com/v1/organization/costs",method:"GET",headers:{}},extract:{}}]);return}if(y==="workbuddy2api"){m([...d,{enabled:!1,label:"WorkBuddy2API 积分",labelEn:"WorkBuddy2API credits",display:"both",unit:"CREDITS",refreshMinutes:15,request:{url:"http://127.0.0.1:8790/api/credits/expiry?package_limit=1",method:"GET",headers:{"X-Admin-Token":"{{WORKBUDDY2API_ADMIN_TOKEN}}"}},extract:{remaining:"summary.available_remaining"},allowedHosts:["127.0.0.1:8790"],allowInsecureHttp:!1}]);return}m([...d,{...y!=="custom"?{adapter:y}:{},enabled:!1,label:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"千问 / 阿里云":"",labelEn:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"Qianwen / Alibaba Cloud":"",display:"both",unit:y!=="custom"?"CNY":"USD",refreshMinutes:15,request:{url:y==="tokenrhythm"?"https://tokenrhythm.studio/api/wallet/summary":y==="aliyun"?"https://business.aliyuncs.com/":"",method:y==="aliyun"?"POST":"GET",headers:{}},extract:{},allowedHosts:[]}])}},h=(y="cliproxyapi")=>{if(u.length>=4||o===null)return;const b=y==="agy-link";r({...o,gatewayQuotas:{...o.gatewayQuotas??i.gatewayQuotas??{},sources:[...u,{id:b?"agy-link":"gateway-"+Date.now().toString(36),type:y,label:b?"Antigravity":"CLIProxyAPI",baseURL:b?"":"http://127.0.0.1:8317",enabled:b,display:"both",refreshMinutes:15,includeProviders:b?["antigravity"]:Gt,allowedHosts:[],allowInsecureHttp:!1}]}})},A=[...u.map((y,b)=>({kind:"gateway",key:"gw-"+(y.id??b),index:b,enabled:y.enabled===!0})),{kind:"go",key:"go",enabled:l.goQuota?.enabled!==!1},...Le.map(y=>({kind:"plan",key:"plan-"+y.id,planId:y.id,labelKey:y.labelKey,enabled:c[y.id]?.enabled===!0})),...d.map((y,b)=>({kind:"custom",key:"cb-"+g.keys[b],index:b,enabled:y.enabled===!0}))],x=y=>y.kind==="plan"?s(Xn,{key:y.key,planId:y.planId,labelKey:y.labelKey,targeted:y.planId===e.targetPlan,state:t,api:n,t:a,draft:o,setDraft:r}):y.kind==="go"?s(yr,{key:y.key,state:t,api:n,t:a,draft:o,setDraft:r}):y.kind==="gateway"?s(kr,{key:y.key,index:y.index,state:t,api:n,t:a,draft:o,setDraft:r}):s(br,{key:y.key,state:t,api:n,t:a,entry:d[y.index],index:y.index,canRemove:!0,onPatch:b=>p(y.index,b),onRemove:()=>f(y.index)});return s("div",null,s("p",{className:"cm-note"},a("quotaSectionNote")),s("div",{className:"cm-quota-list"},fr(A).map(x)),s("div",{className:"cm-buttons"},s("button",{className:"cm-btn small",onClick:()=>h(),disabled:u.length>=4},a("gatewaySourceAdd")),s("button",{className:"cm-btn small",onClick:()=>h("agy-link"),disabled:u.length>=4||u.some(y=>y.type==="agy-link")},a("agyLinkQuotaAdd")),s("button",{className:"cm-btn small",onClick:()=>k(),disabled:d.length>=8},a("customBalanceAdd")),s("button",{className:"cm-btn small",onClick:()=>k("aliyun"),disabled:d.length>=8},a("aliyunBalanceAdd")),s("button",{className:"cm-btn small",onClick:()=>k("tokenrhythm"),disabled:d.length>=8},a("tokenRhythmBalanceAdd")),s("button",{className:"cm-btn small",onClick:()=>k("openai-credits"),disabled:d.length>=8||d.some(y=>y.adapter==="openai-credits")},a("openAiCreditAdd")),s("button",{className:"cm-btn small",onClick:()=>k("workbuddy2api"),disabled:d.length>=8},a("workBuddyBalanceAdd")),s("p",{className:"cm-note"},a("workBuddyBalanceNote"))))}const wr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ts=e=>(e.input??0)+(e.output??0)+(e.cacheRead??0)+(e.cacheWrite??0);function _t(e){const t=e.useCost?e.useCost(b=>b):void 0,n=e.state??t?.state;if(!n)return null;const a=n.config,o=j(a),r=e.t??z(o),i=Array.isArray(n.history)?n.history:[];if(i.length===0)return s("div",null,s("h3",{className:"cm-h"},r("usageTitle")),s("p",{className:"cm-empty"},r("usageEmpty")));const l=n.meta?.dayKey??"",c=new Map(i.map(b=>[b.date,b])),u=b=>{const w=N=>String(N).padStart(2,"0");return b.getFullYear()+"-"+w(b.getMonth()+1)+"-"+w(b.getDate())},d=new Date;d.setHours(0,0,0,0);const m=new Date(d);m.setDate(m.getDate()+(6-(d.getDay()+6)%7));const g=26,f=[],p=[];let k=-1;for(let b=g-1;b>=0;b-=1){for(let N=0;N<7;N+=1){const C=new Date(m);C.setDate(C.getDate()-(b*7+(6-N)));const O=c.get(u(C));f.push(O!==void 0?{day:O,tokens:ts(O)}:{day:{date:u(C)},tokens:0})}const w=new Date(m);w.setDate(w.getDate()-(b*7+6)),p.push(w.getMonth()!==k?o==="en"?wr[w.getMonth()]:String(w.getMonth()+1)+"月":""),k=w.getMonth()}const h=Math.max(...f.map(b=>b.tokens),1),A=b=>{const w=b/h;return w<.25?1:w<.5?2:w<.75?3:4},x=b=>{const{day:w,tokens:N}=b,C="cm-ug-cell"+(N>0?" l"+A(N):"")+(w.date===l?" today":""),O=r("usageDay",{date:w.date,tokens:E(N),input:E(w.input??0),cache:E((w.cacheRead??0)+(w.cacheWrite??0)),output:E(w.output??0),calls:w.calls??0,cost:$(Q(w,a),a)});return s(K,{key:w.date,label:O,side:"top",delayMs:200},s("div",{className:C}))},y=n.total;return s("div",{className:"cm-ug"},s("h3",{className:"cm-h"},r("usageTitle")),s("div",{className:"cm-ug-total"},r("usageTotal",{tokens:E(ts(y)),input:E(y.input??0),cache:E((y.cacheRead??0)+(y.cacheWrite??0)),output:E(y.output??0),calls:y.calls??0})),s("div",{className:"cm-ug-grid",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},f.map(x)),s("div",{className:"cm-ug-months",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},p.map((b,w)=>s("span",{key:"m"+String(w),className:"cm-ug-monthc"},b))))}function as(e){return e.ready?s(ne,{...e,load:e.api.loadCodex,quiet:e.view==="prompt"}):null}function Nr(e){const t=e.useCost?.(a=>a),n=t?.state;return s(as,{...e,state:n,view:"prompt",ready:n?.codexCompat?.enabled===!0&&n?.codexCompat?.promptDue,locale:t?.locale})}const Sr=!1;function Cr(e){const t=e.useCost?.(n=>n);return s(ne,{state:t?.state,snapshot:t,api:e.api,load:e.api.loadSettingsOverview,helpers:{makeT:z,Card:mt,BillingAccuracyNote:Kn,displayCostOf:Q,quotaWindowRow:Ba,codingPlanWindowLabel:Ye,formatBalanceMoney:Re,formatCustomBalanceMoney:Qe,CODING_PLAN_ROWS:Le,UsagePanel:_t,TodaySessions:Gn,BudgetBoxContent:jt,useCodexQuota:Et,codingPlanWindowEntries:It}})}function ns(e){const t=e.useCost?e.useCost(P=>P):void 0,n=e.api,a=t?.state??null,[o,r]=D(null),[i,l]=D(null),[c,u]=D(!1),[d,m]=D(!1),[g,f]=D(!1),[p,k]=D(!1),[h,A]=D("models"),[x,y]=D("overview"),b=a?.codexCompat?.installed===!0&&a?.codexCompat?.enabled===!0,w=x==="export"?"statistics":x==="codex"&&!b?"overview":x;ee(()=>{b||y(P=>P==="codex"?"overview":P)},[b]);const[N,C]=D(null),[O,T]=D({status:"idle",at:0,error:null}),W=fe.useRef(null),v=fe.useRef(null),I=fe.useRef(null),F=fe.useRef(Promise.resolve()),te=fe.useRef(0),V=fe.useRef(null);ee(()=>()=>{V.current?.()},[]),ee(()=>{if(a!==null){const P=JSON.stringify(a.config);r(q=>{const ce=q!==null&&JSON.stringify(q)!==W.current;return ce||(v.current=a.config,I.current=a.config),ce?{...q,activeLocale:a.config.activeLocale}:JSON.parse(P)}),W.current=P}},[a]),ee(()=>{o!==null&&I.current===null&&v.current!==null&&(I.current=v.current)},[o]),ee(()=>{const P=++te.current;if(o===null||n===void 0)return;const q=JSON.stringify(o);if(q===W.current){V.current=null;return}T(ue=>ue.status==="saving"?ue:{...ue,status:"saving"});const ce=()=>{F.current=F.current.catch(()=>{}).then(async()=>{if(P!==te.current)return;const ue={},pe=I.current??v.current;if(pe!==null&&typeof pe=="object")for(const oe of Object.keys(o))oe==="activeLocale"||o[oe]===pe[oe]||JSON.stringify(o[oe])!==JSON.stringify(pe[oe])&&(ue[oe]=o[oe]);if(Object.keys(ue).length===0){W.current=q,T({status:"saved",at:Date.now(),error:null});return}try{await n.updateConfig(ue),W.current=q,pe!==null&&typeof pe=="object"&&(I.current={...pe,...ue}),P===te.current&&T({status:"saved",at:Date.now(),error:null})}catch(oe){P===te.current&&T({status:"error",at:0,error:oe?.message??String(oe)})}})};V.current=ce;const ke=setTimeout(ce,120);return()=>{clearTimeout(ke)}},[o,n]),ee(()=>{a!==null&&t?.status==="error"&&t.error&&l({kind:"err",text:M("ledgerReadFailed",{message:t.error})})},[t?.status,t?.error]);const Y=j({...o??a?.config,activeLocale:t?.locale}),M=z(Y);if(t===void 0||a===null)return s("div",{className:"cm-section"},s("p",{className:"cm-empty"},t?.status==="loading"?M("readingLedger"):M("ledgerUnavailable")),t?.error&&s("p",{className:"cm-err",role:"alert"},M("ledgerReadFailed",{message:t.error})),s("button",{className:"cm-btn",disabled:t?.status==="loading"||!n?.reload,onClick:n?.reload},M("refresh")));const U=a.config,gt=async()=>{if(!p){k(!0),l(null);try{const P=await n.fetchPrices();if(l({kind:P.ok?"ok":"err",text:P.message}),P.ok&&P.state&&typeof P.state.config=="object"){const q=JSON.stringify(P.state.config);r(JSON.parse(q)),W.current=q}}catch(P){l({kind:"err",text:M("syncFailed",{message:P?.message??String(P)})})}finally{k(!1),u(!1)}}},B=async()=>{if(!p){k(!0);try{await n.resetHistory(),l({kind:"ok",text:M("historyCleared")})}catch(P){l({kind:"err",text:M("clearFailed",{message:P?.message??String(P)})})}finally{k(!1),m(!1)}}},ie=async()=>{if(!p){k(!0),l(null);try{const P=await n.importLegacyHistory();l({kind:"ok",text:P.message})}catch(P){l({kind:"err",text:M("legacyImportFailed",{message:P?.message??String(P)})})}finally{k(!1),f(!1)}}},Ee=(P,q)=>{o!==null&&r({...o,[P]:q})},La=[["overview",M("tabOverview")],["statistics",Y==="en"?"Cost statistics":"计费统计"],["quotas",M("tabQuotas")],["usage",M("tabUsage")],["pricing",M("tabPricing")],...b?[["codex","Codex"]]:[],["display",M("tabDisplay")]],Ht=P=>Ca({statistics:n.loadStatistics,pricing:n.loadOpenRouter,codex:n.loadCodex}[P],{state:a}),Ea=O.status==="saving"?s("span",{className:"cm-hint"},M("saving")):O.status==="error"?s("span",{className:"cm-msg err"},M("autoSaveFailed",{message:O.error??""})):s("span",{className:"cm-hint"},O.status==="saved"?M("autoSavedAt",{time:new Date(O.at).toLocaleTimeString()}):M("autoSaveHint"));return s("div",{className:"cm-section"},s("div",{className:"cm-tabs-row"},s("div",{className:"cm-tabs",role:"tablist"},La.map(([P,q])=>s("button",{key:P,type:"button",role:"tab","aria-selected":String(w===P),className:"cm-tab"+(w===P?" active":""),onMouseEnter:()=>Ht(P),onFocus:()=>Ht(P),onClick:()=>y(P)},q))),Ea),s(ne,{state:a,api:n,load:n.loadCommunity,locale:Y,quiet:!0}),Ra(i),w==="statistics"?s(ne,{state:a,api:n,autoExport:x==="export"}):null,w==="overview"?s(R,{key:"overview"},s("div",{className:"cm-overview-grid"},s("div",{className:"cm-cards",style:{"--cm-overview-count":U.hideTodayCost===!0?2:3}},U.hideTodayCost===!0?null:s(mt,{title:M("cardToday"),value:$(Q(a.today,U),U),sub:M("callsTokens",{calls:a.today.calls,input:E(a.today.input),cache:E(a.today.cacheRead+a.today.cacheWrite),output:E(a.today.output)})}),s(mt,{title:M("cardMonth"),value:$(Q(a.month,U),U),sub:M("callsTokens",{calls:a.month.calls,input:E(a.month.input),cache:E(a.month.cacheRead+a.month.cacheWrite),output:E(a.month.output)})}),s(mt,{title:M("cardTotal"),value:$(Q(a.total,U),U),sub:M("cardTotalSub",{calls:a.total.calls})}))),s(ne,{state:a,t:M,api:n,load:n.loadPricing,mode:"external",quiet:!0,helpers:{Card:mt,displayCostOf:Q}}),s("p",{className:"cm-note",key:"cards-footnote"},M("cardsFootnote")),s(Kn,{state:a}),s(ne,{state:a,api:n,load:n.loadPricing,mode:"check",quiet:!0,onPrices:()=>{y("pricing"),A("tools")}}),(()=>{const P=Js(a);return P!==null?s("p",{className:"cm-note",key:"tz-hint"},M("timezoneHint",{host:P.hostLabel,browser:P.browserLabel})):null})(),s("label",{className:"cm-cards-toggle",title:M("cardsTogglePlanTotalHint")},s("input",{type:"checkbox",checked:(o??U).showTotalWithPlan===!0,onChange:P=>{const q=o??U;q!=null&&r({...q,showTotalWithPlan:P.target.checked})}}),s("span",null,M("cardsTogglePlanTotal"))),s(ne,{state:a,api:n,load:n.loadPricing,mode:"billing",draft:o,setDraft:r,locale:Y}),s("div",null,s("button",{className:"cm-btn",onClick:()=>y("export")},Y==="en"?"Export cost records":"导出费用记录"),s("h3",{className:"cm-h"},M("todaySessions")),s(Gn,{state:a,t:M})),s(nr,{state:a,draft:o,setDraft:r,t:M}),(U.balance?.display==="settings"||U.balance?.display==="both")&&U.hideOfficialBalance!==!0?s(pr,{state:a,api:n,t:M,draft:o,setDraft:r}):null):null,w==="quotas"?s(xr,{key:"quotas",state:a,api:n,t:M,draft:o,setDraft:r,targetPlan:N}):null,w==="usage"?s(R,{key:"usage"},!ht||(U.usage?.position??"cost")==="cost"?s(_t,{state:a,t:M,locale:Y}):null,s(lr,{state:a,config:o??U,t:M,draft:o,setDraft:r}),s(dr,{state:a,config:o??U,t:M}),s(er,{state:a,api:n}),s(ar,{state:a,api:n}),s(ne,{state:a,api:n,load:n.loadBillingStorage,draft:o,setDraft:r,locale:Y,disabled:O.status==="saving"||(o??U).billingStorageRetentionDays!==U.billingStorageRetentionDays}),s("div",null,s("h3",{className:"cm-h"},M("historyDataTitle")),s("div",{className:"cm-buttons"},g?s(R,null,s("span",{className:"cm-hint"},M("confirmImportLegacy")),s("button",{className:"cm-btn",onClick:ie,disabled:p},M("apply")),s("button",{className:"cm-btn",onClick:()=>f(!1)},M("cancel"))):s("button",{className:"cm-btn",onClick:()=>f(!0),disabled:p},M("importLegacy")),d?s(R,null,s("span",{className:"cm-hint"},M("confirmReset")),s("button",{className:"cm-btn danger",onClick:B,disabled:p},M("confirmClear")),s("button",{className:"cm-btn",onClick:()=>m(!1)},M("cancel"))):s("button",{className:"cm-btn danger",onClick:()=>m(!0),disabled:p},M("clearAllHistory"))),s("p",{className:"cm-note"},M("legacyImportNote")))):null,w==="codex"?s(as,{key:"codex",state:a,api:n,t:M,locale:Y,view:"panel",ready:b}):null,w==="display"?s(R,{key:"display"},a?.secretMigration?.pending?.length>0?s(Xs,{pending:a.secretMigration.pending,t:M}):null,s(ne,{state:{...a,displayPreviewCodex:H.source===(a.config.codexQuotaSource??"auto")?Dt():{status:"idle",windows:{}}},api:n,load:n.loadDisplay,draft:o,setDraft:r,t:M,locale:Y,numInput:ft,displayOptions:Ta,quotaPlacementValue:ha,quotaPlacementPatch:ka,quotaPlacementOptions:xa,USAGE_POSITION_SWITCHABLE:ht,formatMoneyUsd:$,planOptions:Le.map(P=>[P.id,M(P.labelKey)]),onNavigate:(P,q)=>{C(q),y(P)},renderSidebar:(P,q=a,ce=!0)=>Na({...q,config:P},!0,void 0,!0,void 0,ce),renderCorner:P=>s(Mn,{useCost:()=>({state:P})}),renderStyleSample:(P,q=a,ce=!0)=>{if(!ce||P.sidebarStyle==="icons")return Na({...q,config:P},!0,void 0,!0);const ke=P.sidebarSimple===!0,ue={...P,peakNotice:!1,hideBudget:!1,hideTodayCost:!1,budget:{...P.budget,enabled:!0,amount:Number(P.budget?.amount)>0?P.budget.amount:100}},pe={...q,config:ue},oe=fa(q.codingPlans?.minimax?.windows??{});return s("div",{className:"cm-footer-stack"+(ke?" simple":P.sidebarStyle==="compact"?" compact":"")},s(jt,{state:pe,wide:!0,summary:ke}),s(ba,{five:oe.five??{percent:24},seven:oe.seven??{percent:18},fetchedAt:0,t:M,wide:!0,direction:re(P,"plan")}))}})):null,w==="pricing"?s("div",{key:"pricing",className:"cm-pricing-page"},s("div",{className:"cm-pricing-heading"},s("div",null,s("h3",{className:"cm-h"},Y==="en"?"Pricing":"价格设置"),s("p",{className:"cm-note"},Y==="en"?"New prices apply to future calls. Historical costs keep their original rates.":"价格修改用于后续调用,历史费用沿用原价格。")),s("span",{className:"cm-pricing-unit"},Y==="en"?"Per 1M tokens":"每百万 Token")),s("div",{className:"cm-pricing-nav",role:"tablist","aria-label":Y==="en"?"Pricing sections":"价格分区"},[["models","模型定价","Model pricing"],["catalog","参考价格表","Price tables"],["tools","同步与规则","Sync & rules"]].map(([P,q,ce])=>s("button",{key:P,id:"cm-pricing-"+P,type:"button",role:"tab","aria-selected":h===P,"aria-controls":"cm-pricing-panel",tabIndex:h===P?0:-1,className:"cm-pricing-nav-item"+(h===P?" active":""),onClick:()=>A(P),onKeyDown:ke=>{const ue=["models","catalog","tools"],pe=ke.key==="ArrowRight"?1:ke.key==="ArrowLeft"?-1:0;if(pe){ke.preventDefault();const oe=ue[(ue.indexOf(P)+pe+3)%3];A(oe),ke.currentTarget.parentElement.querySelector("#cm-pricing-"+oe)?.focus()}}},Y==="en"?ce:q))),s("div",{id:"cm-pricing-panel",className:"cm-pricing-content",role:"tabpanel","aria-labelledby":"cm-pricing-"+h},h==="models"?s(ne,{state:a,api:n,load:n.loadPricing,mode:"matching",draft:o,setDraft:r,t:M,locale:Y,resolveClientPrice:mn,prettyProviderKey:bt,setField:Ee,priceEditor:{PriceInput:Aa,priceFactor:Nt,setPriceFactor:Ft,multiplierOptions:Pa,priceMultiplierSettings:wt,priceAt:nt}}):null,h==="catalog"?s("div",{className:"cm-pricing-catalog"},s("h3",{className:"cm-h"},M("priceTableTitle")),s(ne,{state:a,api:n,load:n.loadPricing,mode:"catalog",draft:o,setDraft:r,t:M,locale:Y,vendorLabels:rr,priceEditor:{PriceInput:Aa,priceAt:nt,priceFactor:Nt},renderEditor:(P,q,ce)=>P==="deepseek"?s(or,{modelId:q==="__default__"?M("defaultModelId"):q,entry:ce,isDefault:q==="__default__",draft:o,setDraft:r,t:M}):s(mr,{provider:P,modelId:q,entry:ce,draft:o,setDraft:r,t:M,api:n,lockedIds:P==="openrouter"?a.priceLockIds??[]:[],releaseDisabled:JSON.stringify(o)!==W.current})})):null,h==="tools"?s("div",{className:"cm-pricing-tools"},s("section",{className:"cm-pricing-tool"},s(sr,{state:a,draft:o,setDraft:r,t:M,api:n}),s(ne,{state:a,api:n,load:n.loadPricing,mode:"schedule",draft:o,setDraft:r,locale:Y})),s("section",{className:"cm-pricing-tool"},s(ne,{state:a,api:n,load:n.loadPricing,mode:"history",locale:Y,disabled:p||JSON.stringify(o)!==W.current})),s("section",{className:"cm-pricing-tool"},s("h3",{className:"cm-h"},M("dataSync")),(o??U).currency==="CNY"&&(o??U).prices?.currency!=="CNY"?s("div",{className:"cm-note",role:"status"},M("pricingCnyHint",{rate:(o??U).exchangeRate}),(o??U).pricingCurrency!=="CNY"?s("button",{className:"cm-btn small",disabled:p,onClick:()=>Ee("pricingCurrency","CNY")},M("pricingCurrencyCny")):null):null,s("div",{className:"cm-field"},s("label",null,M("pricingCurrencyLabel")),s("select",{className:"cm-input",value:o?.pricingCurrency==="CNY"?"CNY":"USD",onChange:P=>Ee("pricingCurrency",P.target.value)},s("option",{value:"USD"},M("pricingCurrencyUsd")),s("option",{value:"CNY"},M("pricingCurrencyCny"))),s("p",{className:"cm-note"},M("pricingCurrencyNote"))),s("div",{className:"cm-buttons"},c?s(R,null,s("span",{className:"cm-hint"},M("confirmFetch")),s("button",{className:"cm-btn",onClick:gt,disabled:p},M("apply")),s("button",{className:"cm-btn",onClick:()=>u(!1)},M("cancel"))):s("button",{className:"cm-btn",onClick:()=>u(!0),disabled:p},M("syncFromDocs"))),s("p",{className:"cm-note"},M("lastSync",{time:U.fetchedAt!==null?new Date(U.fetchedAt).toLocaleString():M("neverSynced")})+M("source",{source:U.priceSource==="official"?M("sourceOfficial"):M("sourceBundled")})),s("p",{className:"cm-note"},M("syncScopeNote"))),s("section",{className:"cm-pricing-tool"},s(ne,{state:a,api:n,load:n.loadOpenRouter}))):null)):null,s(ne,{state:a,api:n,load:n.loadCommunity,locale:Y,quiet:!0,footer:!0}))}const vr=["remote"];async function Ar(e){const t=e.remote;if(t===void 0||typeof t.$mount!="function")return;const n=await t.$mount(Rs);e.effect(()=>()=>{n()},"cost-meter: remote contribution");const a=e.get("remote.costMeter");if(a===void 0)return;e.inject(["connection"],S=>S.effect(()=>{const L=S.get("connection")?.rpc;return ya(L,()=>a.getPiAiCodexQuota(),()=>a.getChatgptSubQuota()),Bt(),()=>{H.rpc===L&&(ya(null),Bt())}},"cost-meter: Codex quota transport"));const o=()=>{try{return Xe(e.get("locale")?.getSnapshot?.().active)}catch{return null}},r=kn({status:"loading",error:null,state:null},S=>{const L=o()||Xe(S.state?.meta?.locale)||Ua();return{...S,locale:L,...S.state?{state:{...S.state,config:{...S.state.config,activeLocale:L}}}:{}}}),i=()=>z(j(r.getSnapshot().state?.config||{activeLocale:r.getSnapshot().locale})),l=async(S,L)=>{const _=await a[S](...L??[]);if(_===null||typeof _!="object"||_.ok!==!0)throw new Error(_?.error?.message??i()("rpcFailed",{method:S}));return _.value},c=S=>(r.set({status:"ready",error:null,state:S}),S);let u=Date.now(),d=!1,m=!0,g=1,f=0,p=0,k=Promise.resolve();const h=(S,L)=>{if(typeof S?.pricesRev!="string"||S.pricesRev!==L?.pricesRev)return S;const _=L?.config?.prices;return _===void 0?S:{...S,config:{...S.config,prices:_}}},A=async()=>{if(!m||d||p)return;const S=f,L=()=>m&&S===f&&p===0;d=!0,u=Date.now();const _=r.getSnapshot();_.state===null&&r.set({..._,status:"loading"});try{const Z=_.state?.pricesRev,Ae=await l(_.state===null?"getLocalState":typeof Z=="string"?"getStateSince":"getState",typeof Z=="string"?[Z]:[]);if(!L())return;if(g=1,r.set({status:"ready",error:null,state:h(Ae,_.state)}),_.state===null){const He=await l("getState");L()&&r.set({status:"ready",error:null,state:h(He,Ae)})}}catch(Z){if(!L())return;_.state===null&&(u=Date.now()),g=Math.min(g*2,60),r.set({status:"error",error:Z?.message??String(Z),state:r.getSnapshot().state??_.state})}finally{d=!1}};e.effect(()=>e.on("connection/reset",()=>{A()}),"cost-meter: reconnect reload");const x=setInterval(()=>{const S=r.getSnapshot().state,L=S?.config.sidebarModels,_=S?L?.enabled||L?.dock?L.refreshSeconds:60:g;!document.hidden&&Date.now()-u>=(_||60)*1e3&&A()},1e3);e.effect(()=>()=>{m=!1,clearInterval(x)},"cost-meter: poll timer");const y=()=>{m&&e.fiber?.uid!==null&&r.set(r.getSnapshot())},b=S=>S.effect(()=>{y();const L=S.get("locale")?.subscribe?.(y);return()=>{L?.(),y()}},"cost-meter: DSH locale");typeof e.inject=="function"?e.inject(["locale"],b):o()&&b(e),e.effect(()=>e.on("locale/change",y),"cost-meter: locale change"),window.addEventListener?.("languagechange",y),e.effect(()=>()=>window.removeEventListener?.("languagechange",y),"cost-meter: browser locale");const w=()=>{document.visibilityState==="visible"&&A()};document.addEventListener("visibilitychange",w),e.effect(()=>()=>{document.removeEventListener("visibilitychange",w)},"cost-meter: visibility reload");const N=async(S,L="rpcSyncFailed",_=!1)=>{const Z=await S;if(Z===null||typeof Z!="object"||Z.ok!==!0)throw new Error(Z?.error?.message??(_?Z?.value?.message:void 0)??i()(L));return Z.value.state!==void 0&&r.set({status:"ready",error:null,state:Z.value.state}),Z.value},C={},O=S=>{if(!C[S]){const L=Zo(()=>ge.async("./client."+S+".js"),i()("pageLoadTimeout")).then(_=>_.mount(e,r,j,{formatMoneyUsd:$,displayCostOf:Q,formatTokens:E,updateConfig:Z=>T.updateConfig(Z)})).catch(_=>{throw C[S]===L&&delete C[S],_});C[S]=L}return C[S]},T={loadBillingStorage:()=>O("billing-storage"),billingStorage:async S=>l("billingStorage",[en.parse(S)]),loadSettingsOverview:()=>O("settings-overview"),loadStatistics:()=>O("statistics"),loadOpenRouter:()=>O("openrouter"),loadCommunity:()=>O("community"),loadPricing:()=>O("pricing"),loadDisplay:()=>Promise.all([O("display"),O("sidebar-order")]).then(([S])=>S),loadCodex:()=>O("codex"),reload:A,updateConfig:async S=>{const{activeLocale:L,..._}=S;f++,p++;const Z=k.catch(()=>{}).then(async()=>{const Ae=await l("updateConfig",[_]);return r.set({status:"ready",error:null,state:Ae}),S.planBilling&&setTimeout(()=>{A()},1500),Ae});k=Z;try{return await Z}finally{p--,f++}},fetchPrices:async()=>N(a.fetchPrices()),releasePriceLock:async S=>{const L=await N(a.releasePriceLock(S),"rpcSyncFailed",!0);if(!L.ok)throw new Error(L.message);return L},resetHistory:async()=>{const S=await l("resetHistory");return r.set({status:"ready",error:null,state:S}),S},applyCodexCompatHistory:async()=>c(await l("applyCodexCompatHistory")),dismissCodexCompat:async()=>c(await l("dismissCodexCompat")),importLegacyHistory:async()=>{const S=await a.importLegacyHistory();if(S===null||typeof S!="object"||S.ok!==!0)throw new Error(S?.error?.message??S?.value?.message??i()("legacyImportFailed",{message:"RPC failed"}));return S.value.state!==void 0&&r.set({status:"ready",error:null,state:S.value.state}),S.value},getDaySessions:async S=>l("getDaySessions",[S]),getSessionCost:async S=>l("getSessionCost",[S]),getTurnCost:async(S,L,_)=>l("getTurnCost",[S,L,_,r.getSnapshot().state?.config?.currency]),getTopSessions:async(S,L,_)=>l("getTopSessions",[S,L,_]),refreshBalance:async()=>N(a.refreshBalance(),"rpcBalanceFailed"),refreshGoQuota:async()=>N(a.refreshGoQuota()),refreshGatewayQuota:async(S=null)=>N(S==null?a.refreshGatewayQuota():a.refreshGatewayQuota(S)),refreshCustomBalance:async(S=null)=>N(S==null?a.refreshCustomBalance():a.refreshCustomBalance(S)),refreshCodingPlan:async S=>N(a.refreshCodingPlan(S)),loginCodingPlan:async S=>N(a.loginCodingPlan(S)),loginOpenDesign:async()=>N(a.loginOpenDesign()),setCredential:async(S,L)=>N(a.setCredential(S,L),"rpcSyncFailed",!0),clearCredential:async S=>N(a.clearCredential(S),"rpcSyncFailed",!0)},W=S=>{S.target?.closest?.('[data-slot="conversation.input.model"]')&&T.loadOpenRouter().catch(()=>{})};for(const S of["pointerover","focusin"])e.effect(()=>(document.addEventListener(S,W),()=>document.removeEventListener(S,W)));A();const v=e.get("slots");if(v===void 0)return;const I=S=>{typeof v.entries=="function"&&v.entries(S).some(L=>L.locale==="dsh-context")&&T.loadStatistics().catch(()=>{})};e.on("slots/changed",I),["conversation.view","sidebar.right.pane.tab","conversation.input.overlay"].forEach(I);const F=()=>({hooks:{cost:r},api:T});v.inject("plugins.bundle.config",()=>v.register({name:"plugins.bundle.config",key:"dsh-cost-meter",inject:F},ns)),v.inject("conversation.session.header.actions",()=>v.register({name:"conversation.session.header.actions",id:"cost-meter-statistics",order:1,inject:F},Xo)),v.inject("conversation.chat.turnTail",()=>v.register({name:"conversation.chat.turnTail",id:"cost-meter-turn",order:10,select:S=>S,inject:F},oo));const te=()=>({gen:0,dispose:null}),V=(S,L,_,Z,Ae=!0)=>{S.dispose!==null&&(S.dispose(),S.dispose=null),S.gen+=1;const He=S.gen;Ae&&v.inject(L,()=>{if(S.gen!==He)return;const Me=typeof _=="function"?_():v.register(_,Z);if(S.gen!==He){Me();return}return S.dispose=Me,()=>{S.dispose===Me&&(S.dispose=null),Me()}})},Y=te(),M=S=>{const L=S==="header"?"conversation.session.header.actions":"conversation.composer.dock";V(Y,L,{name:L,id:"cost-meter",order:S==="header"?-5:5,inject:()=>({...F(),entryPosition:S})},ro,S!=="off")},U=te(),gt=S=>{V(U,"sidebar.footer.action",{name:"sidebar.footer.action",id:"cost-meter",order:0,inject:F},Go,S)},B=te(),ie=S=>{V(B,"conversation.composer.dock",{name:"conversation.composer.dock",id:"cost-meter-corner",order:9,inject:F},Mn,S)};v.inject("conversation.input.dock",()=>v.register({name:"conversation.input.dock",id:"cost-meter-qstrip",order:100,inject:F},$o)),v.inject("sidebar.footer.action",()=>v.register({name:"sidebar.footer.action",id:"cost-meter-display-onboarding",order:1,inject:F},Ko)),v.inject("sidebar.footer.action",()=>v.register({name:"sidebar.footer.action",id:"cost-meter-codex-compat",order:1,inject:F},Nr));const Ee=te(),La=S=>{V(Ee,"sidebar.footer.action",()=>v.register({name:"sidebar.footer.action",id:"cost-meter-peak-alert",order:0,inject:F},xo),null,S)};window.cmPeakAlertPreview=S=>{if(window.__cmPeakAlertLive!==!0){console.warn("[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。");return}window.dispatchEvent(new CustomEvent(ko,{detail:{kind:S==="offpeak"?"offpeak":"peak"}}))};const Ht=te(),Ea=S=>{V(Ht,"settings.section",{name:"settings.section",id:"cost-meter",order:30,label:S==="en"?Ie.en.sectionLabel:Ie.zh.sectionLabel,inject:F},Sr?Cr:ns,!0)},P=te(),q=S=>{V(P,"settings.general.item",{name:"settings.general.item",id:"cost-meter-usage",order:30,inject:F},_t,S)},ce=te(),ke=(S,L)=>{V(ce,"settings.section",{name:"settings.section",id:"cost-meter-usage",order:31,label:L==="en"?Ie.en.usageSectionLabel:Ie.zh.usageSectionLabel,inject:F},_t,S)};let ue=null,pe=null,oe=null,Ia=null,ss=null,os=null;const rs=()=>{const S=r.getSnapshot().state;S?.config?.sessionListCosts&&O("session-list").catch(()=>{});const L=S?.config?.position??"dock",_=S?.config?.sidebar!==!1&&S?.config?.hideTodayCost!==!0,Z=S?.config?.balance?.display??"both",Ae=(Z==="sidebar"||Z==="both")&&S?.config?.hideOfficialBalance!==!0,He=ls=>ls?.enabled===!0&&["sidebar","both"].includes(ls.display),Me=_||Ae||S?.config?.localSavings?.enabled===!0||S?.config?.codexQuotaEnabled===!0||S?.config?.sidebarModels?.enabled===!0||S?.config?.budget?.enabled===!0&&S?.config?.hideBudget!==!0||S?.config?.goQuota?.enabled===!0&&["sidebar","both"].includes(S.config.goQuota.display)||S?.config?.peakEnabled===!0&&S.config.peakNotice!==!1||Object.values(S?.config?.codingPlans??{}).some(He)||(S?.config?.gatewayQuotas?.sources??[]).some(He)||Ot(S,S?.config).length>0;S?.config?.followSkinTransparency&&O("display").catch(()=>{}),Me&&ge.async&&O("sidebar-order").catch(()=>{});const ja=S?.config?.corner?.enabled===!0||S?.config?.sidebarModels?.dock===!0,Ze=j(S?.config||{activeLocale:r.getSnapshot().locale}),yt=S?.config?.usage?.position??"cost";L!==ue&&(M(L),ue=L),Me!==pe&&(gt(Me),pe=Me),ja!==oe&&(ie(ja),oe=ja);const Fa=S?.config?.peakEnabled===!0;Fa!==os&&(La(Fa),os=Fa),Ze!==Ia&&(Ea(Ze),Ia=Ze),yt!==ss?(ht&&(q(yt==="general"),ke(yt==="section",Ze)),ss=yt):ht&&yt==="section"&&Ze!==Ia&&ke(!0,Ze)};rs();const is=r.subscribe(rs);return e.effect(()=>()=>{is()},"cost-meter: slot sync"),is}return Pe.apply=Ar,Pe.inject=vr,Je.exports}});
2
+ ;(function(Je){const Pe=window.__ModuleLoader__,fe=Pe[Symbol.for("@dsh-plugin/dsh-loader:load-wrap")];return(Je.id==="dsh-cost-meter"&&Pe.load===fe?.ours&&typeof fe.original=="function"?fe.original:Pe.load).call(Pe,Je)})({id:"dsh-cost-meter",factory:le=>{var Je={exports:{}},Pe=Je.exports;Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"});const fe=le("react"),{Tooltip:V}=le("@deepseek-ai/dsh-client-ui-primitives"),ht=!1,ps="var(--dsw-alias-~.cm-~background:~align-items:center~font-size:~border-radius:~display:flex;~color:~width:~flex-direction:column;~white-space:nowrap~height:~padding:~font-weight:600~overflow:hidden~text-overflow:ellipsis~font-variant-numeric:tabular-nums~justify-content:~box-sizing:border-box~1px solid ~grid-template-columns:~display:~cursor:pointer~gap:~border:~flex-wrap:wrap~margin-top:~flex:none~transform:~padding-bottom:~position:~margin:~overflow-wrap:anywhere~text-align:~var(--dsh-frame-top-clearance,0px)~box-shadow:~overscroll-behavior:contain~border-bottom:~grid-column:~flex:~font:inherit;~font-weight:~overflow:auto;~z-index:~transition:~user-select:none~5px solid ~text-only:~left:~opacity:~outline:~-webkit-app-region:~flex-shrink:0~flex-wrap:nowrap;~border-top:~flex-direction:~outline-offset:~pointer-events:~grid-area:1/1;~var(--cm-opaque-base,#fff)~grid-auto-flow:column;~bottom:~align-self:~var(--cm-dialog-top)~var(--cm-guide-top)~2px solid ~clickable:~right:~--cm-opaque-base:~text-decoration:~--cm-guide-top:~overflow-x:auto~inset:~top:50%;~content:~align-items:~cursor:~3px solid ~6px solid ~animation:~top:0;~action:~order:".split("~"),qa='|section |tabs>|tab{ƕinline-flex;&;Ƒcenter;ƒ;min-Ƌ32px;ƌ6px 10px;Ɵ0;ƨ?13px;line-Ƌ20px;vertical-align:middle}|peak-alert{ƫ2147483647;max-Ƌcalc(100dvh - 32px);ƪƤ}|peak-alert,|peak-alert *{Ƴno-drag}|peak-alert |peak-alert-actions{ƞrelative;ƛ}|peak-alert |peak-alert-actions button{ƹauto}@property --cm-dialog-top{syntax:"<length>";inherits:true;initial-value:0px}|stat-dialog{--cm-dialog-top:var(--dsh-frame-chrome-top,Ƣ);Ljƿ 0 0 0;Ɵauto;ƈmin(1000px,94vw);max-ƈcalc(100vw - 32px);max-Ƌcalc(100vh - ƿ - 32px);Ǝ;ƒ;ƌ0;ƅ16px;ƘƓ`border-l1);Ƈ`label-primary);$`bg-layer-2,`bg-base,#fff))}|stat-dialog[open]{ƆƷcolumn}|loading{ƌ24px;min-Ƌ160px;ƕgrid;Ɨ18px}|loading i{Ƌ18px;ƅ5px;$`bg-layer-1,#f2f3f5)}|loading i:first-child{ƈ35%}|loading i:last-child{ƈ65%}|stat-dialog-head{Ɔ&;Ƒspace-between;Ɨ16px;ƌ16px 24px;ƥƓ`border-l3);ƛ}|stat-dialog-head strong{?15px;Ʃ500}|stat-dialog-body{ƪmin-Ƌ0;ƌ20px 24px;Ƥ}|stat-dialog::backdrop{Ljvar(--dsh-frame-chrome-top,Ƣ) 0 0;$#0005}|dp{ƒ;min-ƈ0;ƨ?calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-Ƌcalc(20px + var(--dsh-content-font-delta-secondary,0px));ƅvar(--dsw-radius-sm);max-ƈ100%;Ƈ`label-tertiary);Ɛ;Ɗ;$0 0;Ƙnone;&;Ɨ6px;ƌ1px 8px;ƕinline-flex;Ɩ}|dp:hover,|dp[aria-expanded=true]{$`interactive-bg-hover);Ƈ`label-secondary)}|dp-header{max-ƈ180px}|dl{Ə;min-ƈ0;Ǝ}|dp-status{max-ƈ100%;?12px;line-Ƌ20px;Ƈ`label-tertiary);Ɗ;Ǝ;Ə}|foot{Ɔ&;Ɨ6px;Ƌ32px;ƌ0 8px;ƅ8px;?12px;Ƈ`label-secondary);Ɗ;Ǝ}|foot:hover,|foot-rail:hover,|corner-chip:hover,|qchip:hover,|tab:hover,|btn:hover{$`interactive-bg-hover)}|foot-rail{ƈ100%;Ƒcenter;ƌ0;?13px;ƍ;Ƈ`label-primary)}|num{Ɛ}|go-rail{?11px;Ʃ700;Ƈ`label-primary)}|go-list{ƆƉƗ10px}|go-row{Ɔ&;Ɨ8px;?12px}|go-label{ƛ;ƈ88px;Ƈ`label-secondary)}|go-bar{Ƨ1;Ƌ6px;ƅ3px;$`interactive-bg-hover);Ǝ}|go-fill{Ƌ100%;ƅ3px;$`brand-primary)}|go-num{ƛ;min-ƈ44px;ơright;ƍ;Ɛ}|go-reset{ƛ;max-ƈ230px;?11px;Ƈ`label-tertiary);Ɗ;Ǝ;Ə}|go-time{?11px;Ƈ`label-tertiary)}|go-row.main |go-label{ƍ;Ƈ`label-primary)}|corner{ƕinline-flex;Ƨ0 1 auto;ƙ;Ƒcenter;&;Ɨ6px;min-ƈ0;max-ƈ100%}|corner-chip{ƕinline-flex;&;Ƌ20px;ƌ0 8px;ƅ6px;$`bg-layer-2);?11px;line-Ƌ20px;Ƈ`label-secondary);Ɗ;Ɛ}|qstrip{Ɔƙ;Ƒcenter;&;Ɨ6px;ƈ100%;max-ƈvar(--dsh-chat-content-width,720px);Ɵ0 auto;ƒ;ƌ0 calc(var(--dsh-composer-side-clearance,0px) + 16px)}|qchip{ƕinline-flex;&;Ɨ6px;Ƌ22px;ƌ0 8px;ƅ6px;$transparent;?11px;line-Ƌ22px;Ƈ`label-secondary);Ɗ;Ɛ;njdefault}|quota-details{ƞrelative;min-ƈ0}|quota-details>summary{list-style:none;Ɩ}|quota-details>summary::-webkit-details-marker{ƕnone}|quota-detail{white-space:normal;ƒ;ƌ10px;ƘƓ`border-l1);ƅ8px;$`bg-layer-1,#fff);Ƈ`label-primary);?12px;line-Ƌ1.6}|qstrip |quota-detail{ƞabsolute;ƽcalc(100% + 6px);ư0;ƈmin(320px,calc(100vw - 32px));ƫ100}|quota-detail button{ƚ8px}|qchip |qlabel{Ƈ`label-primary);ƍ}|qchip |qbar{ƕblock;ƈ44px;Ƌ4px;ƅ2px;$`border-l1);Ǝ;ƛ}|qchip |qfill{ƕblock;Ƌ100%;ƅ2px;$`state-ok-primary,#3ba272)}|qchip |qseg{ƕinline-flex;&;Ɨ4px}|qchip |qsep{ƈ1px;Ƌ12px;$`border-l1);ƛ}|qchip |qtext{Ƈ`label-secondary)}|qchip.warn |qfill{$`state-warn-primary)}|qchip.over |qfill{$`state-error-primary)}|qchip.action{Ɩ;ƭ;Ʋnone}|qchip.Ǒfocus-visible{ƣ0 0 0 2px `brand-primary)}|qchip.Ǒactive{ƜtranslateY(.5px)}|plan-provider{ƆƉƗ8px}|plan-provider+|plan-provider{ƚ14px}|plan-provider-name{Ɔ&;Ɨ8px;?13px;ƍ}|plan-updated{?11px;Ʃ400;Ƈ`label-tertiary)}|plan-tag{ƛ;margin-ư6px;ƌ0 6px;ƅ999px;ƘƓ`border-l1);?10px;line-Ƌ16px;Ƈ`state-warn-primary)}|plan-reset,|plan-method{?11px;Ƈ`label-tertiary)}|qguide{džvar(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,Ƣ) + 18px));ƞfixed;Ljauto;Ɵ0;top:max(ǀ,env(safe-area-inset-top,0px));ƹauto;Ƴno-drag;ư50%;Ɯtranslate(-50%);ƫ9999;max-ƈ440px;ƈcalc(100% - 32px);ƘƓ`border-l1);ƅ12px;$`bg-layer-2);ƣ0 8px 28px #0000002e;ƌ14px 16px;?13px;Ƈ`label-primary);ƆƉƗ8px}|qguide[data-cm-onboarding]{ƒ;max-Ƌcalc(100dvh - max(ǀ,env(safe-area-inset-top,0px)) - 16px);ƪƤ}|qguide h4{Ɵ0;?13px;ƍ}|qguide p{Ɵ0;?12px;line-Ƌ1.6;Ƈ`label-secondary)}|qguide |buttons{ƆƗ8px;Ƒflex-end}|section{ƆƉƗ20px;ƌ4px 2px 24px;?13px;Ƈ`label-primary)}|cards{ƕgrid;Ɣrepeat(auto-fit,minmax(min(220px,100%),1fr));Ɨ12px}|overview-grid{container:cm-overview / inline-size;min-ƈ0}|overview-grid>|cards{Ɣrepeat(var(--cm-overview-count,3),minmax(0,1fr))}|overview-grid |card{min-ƈ0;ƆƉƗ6px;ƌ12px 14px}|overview-grid :is(|card-title,|card-sub){Ɵ0}|overview-grid |card-value{line-Ƌ1.35;Ɛ;Ơ}|overview-grid |card-sub{line-Ƌ1.5;Ơ}@container cm-overview (max-ƈ460px){|overview-grid>|cards{Ɣ1fr}}|cards-toggle{Ɔ&;Ɨ6px;Ɵ-6px 2px 0 auto;ƈfit-content;?12px;Ƈ`label-tertiary);Ɩ;ƭ}|cards-toggle:hover{Ƈ`label-primary)}|cards-toggle input{Ɵ0;Ɩ}|card,|budget{ƘƓ`border-l1);ƅ12px;ƌ14px 16px;$`bg-layer-1)}|card-title{?12px;Ƈ`label-tertiary);Ɵ0 0 8px}|card-value{?20px;line-Ƌ28px;ƍ}|card-sub{?12px;Ƈ`label-tertiary);ƚ4px}|h{?13px;ƍ;Ɵ0}|collapse-h{Ɔ&;Ɨ8px;$none;Ƙnone;ƌ0;Ɵ0;Ɩ;Ƈinherit;ƨơleft}|collapse-h:hover |h{Ƈ`interactive-text-hover,`label-primary))}|caret{ƛ;ƈ0;Ƌ0;border-ưƮtransparent;border-ǃƮtransparent;ƶǎ`label-secondary);Ɯrotate(-90deg);Ƭtransform .15s ease}|caret.open{Ɯrotate(0)}|collapse-body{ƆƉƗ12px;ƚ12px}|toolbar{ƆƑflex-end;&;Ɨ10px}|toolbar |field{Ʒrow;&;Ɨ8px}|toolbar |field label{Ɵ0;?12px;Ƈ`label-tertiary)}|toolbar |input{min-ƈ150px;ƌ4px 10px}|tabs-row{Ɔ&;Ƒspace-between;Ɨ12px;ƙ;ƥƓvar(--dsh-alias-border-l1);Ɲ10px}|tabs{Ɔ&;Ɨ4px;ƙ}|tab{ƨ?13px;Ƈ`label-secondary);$transparent;Ƙnone;ƅ8px;ƌ6px 14px;Ɩ;Ɗ}|tab.active{$`state-business-primary);Ƈ`label-primary-inverted);ƍ}|tabs-row |msg{ƌ2px 10px}|tabs-row>|hint,|tabs-row>|msg{margin-inline-start:auto}|note{?12px;Ƈ`label-tertiary);Ɵ0}|table{ƈ100%;border-collapse:collapse;?12px}|table th,|table td{ơleft;ƌ7px 10px;ƥƓ`border-l1);Ɗ}|table th{Ƈ`label-tertiary);Ʃ500}|table td.num,|table th.num{ơright;Ɛ}|table tr:last-child td{ƥnone}|table tr|row-click{Ɩ}|table tr|row-click:hover td{$`bg-hover,rgba(127,127,127,.08))}|sess-title{max-ƈ260px;Ǝ;Ə;Ɗ}|sess-id{?11px;font-family:ui-monospace,Consolas,monospace;Ƈ`label-tertiary)}|empty{?12px;Ƈ`label-tertiary);ƌ8px 0}|scroll{max-Ƌ320px;ƪƘƓ`border-l1);ƅ10px}|grid{ƕgrid;Ɣrepeat(auto-fit,minmax(min(220px,100%),1fr));Ɨ12px}|field{ƆƉƗ6px;min-ƈ0}|field label{?12px;Ƈ`label-secondary)}|input,|input option,|input optgroup{Ƈ`label-primary);$`bg-base)}|input{ƨ?13px;ƘƓ`border-l1);ƅ8px;ƌ6px 10px;Ʋnone}|input:is(select){color-scheme:light dark}|input:is(select) :is(option,optgroup){Ƈ`label-primary)!important;$`bg-base)!important;$rgb(from `bg-base) r g b / 1)!important}|input:focus{border-Ƈ`state-business-primary)}|input.narrow{max-ƈ120px}|range-row{Ɔ&;Ɨ10px}|range{Ƨ1;min-ƈ0;accent-Ƈ`state-business-primary)}|range-value{ƛ;min-ƈ44px;?12px;Ƈ`label-tertiary);ơright}|check{Ɔ&;Ɨ8px;?13px;Ƈ`label-primary);Ɩ}|pricing-page,|pricing-content{ƕgrid;Ɨ20px;min-ƈ0}|pricing-heading{Ɔ&;Ƒspace-between;Ɨ12px}|pricing-heading |h{?16px;margin-ƽ6px}|pricing-heading |note{line-Ƌ1.6}|pricing-unit{ƴ;Ƈ`label-tertiary);?11px}|pricing-nav{ƆƗ4px;ƌ4px;ƅ10px;$`bg-layer-1);ƘƓ`border-l1)}|pricing-nav-item{Ƨ1;min-ƈ0;ƨƇ`label-secondary);$transparent;Ƙ0;ƅ7px;ƌ8px 10px;Ɩ}|pricing-nav-item.active{Ƈ`state-business-primary);$`bg-base);ƣ0 1px 3px #0000000d;ƍ}|pricing-nav-item:focus-visible{Ʋǁ`state-business-primary)}|pricing-tools{ƕgrid;Ɨ16px}|pricing-tool{ƆƉƗ12px;ƌ16px;ƘƓ`border-l1);ƅ12px;min-ƈ0}|pricing-tool>|peak-panel{ƌ0;Ƙ0;$none}|pricing-tool p{line-Ƌ1.65}@media(max-ƈ480px){|pricing-heading{Njflex-start;ƉƗ4px}|pricing-nav-item{ƌ8px 4px;?12px}|pricing-tool{ƌ12px}}|price-card{ƘƓ`border-l1);ƅ10px;ƌ12px 14px;ƆƉƗ10px;$`bg-layer-1)}|price-head{Ɔ&;Ɨ8px;ƙ}|price-name{ƍ;?13px;Ơ;min-ƈ0;Ƨ1 1 180px}|price-legacy{?11px;Ƈ`label-tertiary);ƘƓ`border-l1);ƅ999px;ƌ1px 8px}|price-locked{?11px;Ƈ`state-business-primary);ƘƓ`state-business-primary);ƅ999px;ƌ1px 8px;njhelp}|price-row{ƕgrid;Ɣ52px repeat(4,minmax(0,1fr));Ɨ8px;&}|price-row span{?12px;Ƈ`label-tertiary)}|price-row input{ƈ100%;min-ƈ0;ƒ;ƌ6px 5px}|price-multiplier{Ɔ&;Ƒspace-between;Ɨ6px 12px;ƙ;?12px;Ƈ`label-tertiary)}|price-multiplier label{ƕinline-flex;&;Ɨ5px;Ɩ}|price-multiplier input{Ɵ0;accent-Ƈ`brand-primary,#4d6bfe)}|price-row input[aria-invalid=true]{border-Ƈ#d64c4c}|buttons{Ɔƙ;Ɨ10px;&}|btn{ƨ?13px;Ƈ`label-primary);$`button-elevated-fill);ƘƓ`border-l1);ƅ8px;ƌ6px 14px;Ɩ}|btn|stat-entry{?12px;line-Ƌ20px;ƌ0 6px;min-ƈ0;max-ƈ100%;Ɗ;Ǝ;Ə;ƴ}|btn|stat-header{border-Ƈ`border-l3);ƅ7px;padding-inline:8px}@media(max-ƈ640px){|stat-header{ƕnone}}|btn.primary{$`state-business-primary);border-Ƈtransparent;Ƈ`label-primary-inverted)}|btn.primary:hover{Ʊ.88;$`state-business-primary)}|btn.danger,|msg.err,|bal-line.err,|bal-err{Ƈ`state-error-primary)}|btn.small{ƌ3px 10px;?12px}|msg{?12px;line-Ƌ18px;ƌ8px 12px;ƅ8px;ƘƓ`border-l1)}|msg.ok{Ƈ`state-success-primary)}|hint{?12px;Ƈ`label-tertiary)}|budget{ƆƉƗ10px}|peak-alert{ƞfixed;Ljauto;Ɵ0;ƒ;ƹauto;Ƴno-drag;Ƈ`label-primary);ƫ9999;ƈ340px;max-ƈcalc(100vw - 32px);ƌ16px;ƅ14px;$`bg-layer-2);ƘƓ`border-l2);ƣ0 14px 36px #00000038;ƆƉƗ8px;?12px;Ǐcm-peak-alert-in .22s cubic-bezier(.2,.8,.2,1)}|peak-alert|peak-alert-corner{ǃ20px;ƽ20px}|peak-alert|peak-alert-center{ljư50%;Ɯtranslate(-50%,-50%);animation-name:cm-peak-alert-in-center}|peak-alert-peak{ƶǍ`state-warn-primary)}|peak-alert-offpeak{ƶǍ`state-info-primary,#3b82f6)}|peak-alert-badge{ƕinline-flex;&;Ɨ6px;?11px;ƍ;letter-spacing:.4px;text-Ɯuppercase}|peak-alert-badge:before{NJ"";ƈ8px;Ƌ8px;ƅ50%;$currentColor;ƣ0 0 0 4px color-mix(in srgb,currentColor 16%,transparent)}|peak-alert-peak |peak-alert-badge{Ƈ`state-warn-primary)}|peak-alert-offpeak |peak-alert-badge{Ƈ`state-info-primary,#3b82f6)}|peak-alert-title{?14px;ƍ;Ƈ`label-primary)}|peak-alert-body{Ƈ`label-secondary);line-Ƌ1.55}|peak-alert-actions{ƆƑflex-end;Ɨ8px;ƚ2px}|row{ƆƗ8px;&;ƙ}@keyframes cm-peak-alert-in{0%{Ʊ0;ƜtranslateY(10px) scale(.98)}to{Ʊ1;ƜtranslateY(0) scale(1)}}@keyframes cm-peak-alert-in-center{0%{Ʊ0;Ɯtranslate(-50%,calc(-50% + 10px))}to{Ʊ1;Ɯtranslate(-50%,-50%)}}|budget-head{Ɔ&;Ƒspace-between;Ɨ8px}|quota-name{Ƨ1;min-ƈ0}|budget-bar{Ƌ8px;ƅ999px;$`bg-layer-3);Ǝ}|budget-fill{Ƌ100%;ƅ999px;$`state-business-primary);Ƭwidth .3s ease}|ug{ƆƉƗ12px}|ug-total{?13px;Ƈ`label-primary)}|ug-grid{ƕgrid;Ƽgrid-template-rows:repeat(7,auto);Ɨ3px;ƈ100%}|ug-cell{ƈ100%;aspect-ratio:1/1;ƅ3px;ƒ;$color-mix(in srgb,`label-primary) 8%,transparent);ƘƓ`border-l1)}|ug-cell.l1,|ug-cell.l2,|ug-cell.l3,|ug-cell.l4{border-Ƈtransparent}|ug-cell.l1{$color-mix(in srgb,`state-business-primary) 25%,`bg-layer-3))}|ug-cell.l2{$color-mix(in srgb,`state-business-primary) 50%,`bg-layer-3))}|ug-cell.l3{$color-mix(in srgb,`state-business-primary) 75%,`bg-layer-3))}|ug-cell.l4{$`state-business-primary)}|ug-cell.today{ƲƓ`label-secondary);Ƹ1px}|ug-months{ƕgrid;ƼƗ3px;ƈ100%;?10px;Ƈ`label-tertiary);ƚ4px}|ug-monthc{Ɗ}|budget-line{?13px;Ƈ`label-secondary)}|budget-line.over{Ƈ`state-error-primary)}|peak-strip{Ɔ&;Ɨ6px;ƚ4px;min-ƈ0}|peak-track{ƞrelative;ƆƧ1;Ƌ6px;min-ƈ0;ƅ999px;Ǝ;ƘƓ`border-l1);$`bg-layer-3)}|peak-segment{Ƌ100%;Ƨ1}|peak-high{$#ff9800}|peak-low{$`state-business-primary)}|peak-marker{ƞabsolute;ǐư50%;ƈ2px;Ƌ100%;$`bg-base);ƣ0 0 0 1px `label-tertiary);Ɯtranslate(-50%);Ƭleft .4s ease;ƫ2}|peak-chip{?11px;ƍ;line-Ƌ1.2;Ɗ;Ƈ`label-secondary)}|peak-classic{ƞrelative;ƆƉƗ5px;ƚ6px;min-ƈ0}|peak-classic |peak-track{ƛ;Ƌ8px}|peak-classic-marker{ƞabsolute;ǐư50%;ƈ4px;Ƌ12px;$`bg-base);Ƙ1.Ʈ#ff9800;ƣ0 0 0 1px `bg-base),0 0 0 2px `label-tertiary);Ɯtranslate(-50%);Ƭleft .4s ease;ƫ2;ƅ2px}|peak-classic-marker:after{NJ"";ƞabsolute;top:-7px;ư50%;Ɯtranslate(-50%);border-ưƮtransparent;border-ǃƮtransparent;ƶǎ#ff9800}|peak-classic.off |peak-classic-marker{border-Ƈ`state-business-primary)}|peak-classic.off |peak-classic-marker:after{border-top-Ƈ`state-business-primary)}|peak-classic-chip{ƾflex-start;?11px;ƍ;line-Ƌ1.4;$`bg-layer-2);ƘƓ`border-l1);ƅ999px;ƌ2px 8px;Ɗ;Ƈ`label-secondary)}|peak-strip.peak |peak-chip,|peak-classic.peak |peak-classic-chip,|peak-rail.peak |peak-rail-label,|peak-rail-classic.peak |peak-rail-classic-label{Ƈ#ff9800}|peak-strip.off |peak-chip,|peak-classic.off |peak-classic-chip,|peak-rail.off |peak-rail-label,|peak-rail-classic.off |peak-rail-classic-label{Ƈ`state-business-primary)}|peak-strip.weekend |peak-chip,|peak-classic.weekend |peak-classic-chip,|peak-rail.weekend |peak-rail-label,|peak-rail-classic.weekend |peak-rail-classic-label{Ƈ#34a853}|peak-classic.weekend |peak-classic-marker{border-Ƈ#34a853}|peak-classic.weekend |peak-classic-marker:after{border-top-Ƈ#34a853}|peak-rail{ƆƉ&;Ɨ3px;ƈ40px;ƒ}|peak-rail-track{ƞrelative;ƆƉƈ6px;Ƌ56px;ƅ999px;Ǝ;ƘƓ`border-l1);$`bg-layer-3)}|peak-rail-segment{ƈ100%;Ƨ1}|peak-rail-high{$#ff9800}|peak-rail-low{$`state-business-primary)}|peak-rail-marker{ƞabsolute;ư0;ljƈ100%;Ƌ2px;$`bg-base);ƣ0 0 0 1px `label-tertiary);ƜtranslateY(-50%);Ƭtop .4s ease;ƫ2}|peak-rail-label{?10px;ƍ;line-Ƌ1.2;Ɗ;Ƈ`label-secondary)}|peak-rail-classic{ƆƉ&;Ɨ3px;ƈ40px;ƒ}|peak-rail-classic-track{ƞrelative;ƆƉƈ14px;Ƌ56px;ƅ999px;ƘƓ`border-l1);$`bg-layer-3)}|peak-rail-classic-segment{ƞrelative;ƈ100%;Ƨ1;Ǝ}|peak-rail-classic-segment.peak{$#ff9800;ƅ999px 999px 0 0}|peak-rail-classic-segment.off{$`state-business-primary);ƅ0 0 999px 999px}|peak-rail-classic-marker{ƞabsolute;ư50%;ljƈ12px;Ƌ4px;$`bg-base);Ƙ1.Ʈ#ff9800;ƣ0 0 0 1px `bg-base),0 0 0 2px `label-tertiary);Ɯtranslate(-50%,-50%);Ƭtop .4s ease;ƫ2;ƅ2px}|peak-rail-classic.off |peak-rail-classic-marker{border-Ƈ`state-business-primary)}|peak-rail-classic-label{?10px;ƍ;line-Ƌ1.2;Ɗ}|peak-rail-classic.weekend |peak-rail-classic-marker{border-Ƈ#34a853}|grid-group{Ʀ1 / -1;ƚ8px;?12px;ƍ;Ƈ`label-tertiary);ƥƓ`border-l1);Ɲ4px}|grid-group:first-child{ƚ0}|peak-preview{ƚ8px}|toggle-btn{$none;Ƙnone;ƌ0;?12px;ƍ;Ƈ`state-business-primary);Ɩ}|toggle-btn:hover{Džunderline}|collapsed-note{ƚ4px}|catalog-vendor{ƚ10px;?12px;ƍ;Ƈ`label-tertiary);ƥƓ`border-l1);Ɲ2px;Ɔ&;Ƒspace-between;Ɨ8px}|vendor-toggle{Ɩ;ƭ}|vendor-toggle:hover{Ƈ`label-secondary)}|vendor-display{ƕinline-flex;&;Ɨ4px;Ʃ400;?11px;Ƈ`label-tertiary);Ɗ}|mstats-tabs{ƆƗ8px;margin-ƽ8px}|mstats-tab{$none;ƘƓ`border-l1);ƅ999px;ƌ2px 12px;?12px;Ƈ`label-secondary);Ɩ}|model-costs |mstats-tab.active{$color-mix(in srgb,`state-business-primary) 14%,`bg-base));border-Ƈ`state-business-primary);Ƈ`label-primary);ƍ}|mstats-h{Ɵ10px 0 4px;?12px;ƍ;Ƈ`label-secondary)}|mstats-row{ƕgrid;Ɣminmax(90px,170px) 1fr auto;Ɨ8px;&;?11px;line-Ƌ1.7}|mstats-name{Ǝ;Ə;Ɗ;Ƈ`label-secondary)}|mstats-label{Ʀ1/-1;Ɔƙ;&;Ɨ6px;ƚ6px}|mstats-label |mstats-name{Ƨ1;min-ƈ90px}|mstats-label~|mstats-barbg{Ʀ1/3}|mstats-label select{max-ƈ100%;min-ƈ0}|mstats-barbg{ƞrelative;Ƌ10px;ƅ999px;$`bg-layer-3);Ǝ;ƕflex}|mstats-bar{Ƌ100%;min-ƈ0;ƅ999px}|mstats-bar.cost{$#ff9800}|mstats-bar.hit{$#34a853}|mstats-bar.value{$#a142f4}|mstats-seg{Ƌ100%;min-ƈ0}|mstats-seg.in{$`state-business-primary)}|mstats-seg.cache{$#ff9800}|mstats-seg.out{$#34a853}|mstats-val{Ɗ;Ƈ`label-secondary)}|mstats-legend{ƆƗ12px;?10px;Ƈ`label-tertiary);Ɵ2px 0 4px}|mstats-dot{ƕinline-block;ƈ8px;Ƌ8px;ƅ2px;margin-ǃ3px}|mstats-note{ƚ10px;?10px;line-Ƌ1.6;Ƈ`label-tertiary)}|match-row{Ɔ&;Ɨ8px;ƌ3px 0;?12px;ƙ}|match-row |input{Ƨ1;min-ƈ160px}|budget-controls{ƕgrid;Ɣrepeat(auto-fit,minmax(min(180px,100%),1fr));Ɨ12px}|bbox{ƘƓ`border-l1);ƅ12px;ƌ8px 10px;$`bg-layer-1);ƆƉƗ6px;min-ƈ148px;ƒ}|bbox.rail{ƌ6px;min-ƈ0;ƈ40px;&;Ƒcenter;ƅ10px}|bbox.warn{border-Ƈ`state-warn-primary)}|bbox.over{border-Ƈ`state-error-primary)}|bbox-head{Ɔ&;Ƒspace-between;Ɨ8px}|bbox-label,|bbox-pct{?12px;ƍ;Ƈ`label-primary)}|bbox.warn |bbox-pct{Ƈ`state-warn-primary)}|bbox.over |bbox-pct{Ƈ`state-error-primary)}|bbox-bar{Ƌ6px;ƅ999px;$`bg-layer-3);Ǝ}|bbox-bar.segments{ƆƋ8px}|bbox-bar.segments |bbox-fill{ƛ;ƅ0;Ƌ100%}|bbox-bar.segments |bbox-fill:first-child{ƅ999px 0 0 999px}|bbox-bar.segments |bbox-seg-today{ƛ;Ƌ100%;$#ff9800}|bbox-bar.segments |bbox-seg-spent{ƛ;Ƌ100%;$`interactive-bg-hover);ƅ0 999px 999px 0}|bbox-bar.segments.rev |bbox-fill:first-child,|bbox-bar.segments.rev |bbox-seg-today:first-child{ƅ999px 0 0 999px}|bbox-bar.segments.rev |bbox-fill,|bbox-bar.segments.rev |bbox-fill:last-child,|bbox-bar.segments.rev |bbox-seg-today:last-child,|bbox-bar.segments.rev |bbox-seg-spent:last-child{ƅ0 999px 999px 0}|bbox-bar.segments.rev |bbox-seg-spent{ƅ0}|dir-row{Ɔ&;Ɨ8px;ƚ6px}|dir-label{Ƨ1 1 40%;?12px;Ƈ`label-secondary)}|dir-row |input{Ƨ1 1 60%;ƈauto}|bbox-fill{Ƌ100%;ƅ999px;$`state-business-primary)}|balance-name{ƕinline-flex;&;Ɨ4px;min-ƈ0;Ơ}|model-costs{?12px}|model-costs |bal-label{Ɗ}|model-top{Ɨ4px;max-ƈ180px;Ǝ;Ə}|model-costs |collapse-h{min-ƈ0;ƈ100%;Ɗ}|model-costs |bbox-bar{ƚ3px}|bal-label{min-ƈ0;Ǝ;Ə}|bal-amt{margin-ưauto;ơright;ƴ}|bbox-pct|bal-amt{Ƈ`state-business-primary)}|bal-link{ƛ;ƕinline-flex;&;Ƒcenter;ƌ2px;ƅ4px;?12px;line-Ƌ16px;Ƈ`label-tertiary);Džnone;Ʋnone}|bal-link:hover{Ƈ`brand-primary);$`interactive-bg-hover)}|bal-link:focus-visible{ƣ0 0 0 2px `brand-primary)}|bbox.warn |bbox-fill,|bbox |bbox-section.warn |bbox-fill,|bbox |mm-row.warn |bbox-fill,|budget-fill.warn{$`state-warn-primary)}|bbox.over |bbox-fill,|bbox-section.over |bbox-fill,|mm-row.over |bbox-fill,|budget-fill.over{$`state-error-primary)}|bbox-line{?12px;Ƈ`label-tertiary)}|bbox-rail{?11px;ƍ;Ƈ`label-primary)}|bbox.warn |bbox-pct,|bbox.warn |bbox-rail,|bbox |bbox-section.warn |bbox-pct,|bbox |mm-row.warn |bbox-pct,|mm-row.warn |bbox-label,|corner-chip.warn,|qchip.warn,|simple-summary.warn{Ƈ`state-warn-primary)}|bbox.over |bbox-pct,|bbox.over |bbox-rail,|bbox-section.over |bbox-pct,|mm-row.over |bbox-pct,|mm-row.over |bbox-label,|corner-chip.over,|qchip.over,|simple-summary.over{Ƈ`state-error-primary)}|bbox-pair{ƆƉƗ0;ƌ2px 10px}|bbox-pair |bbox-section{ƆƉƗ4px;ƌ4px 0}|bbox-pair |bbox-bar{Ƌ4px}|bbox-divider{Ƌ1px;$`border-l1);Ɵ0}|bbox.clickable,|foot.clickable{Ɩ}|bbox.ǂhover{border-Ƈ`state-business-primary)}|bbox.ǂfocus-visible,|foot.ǂfocus-visible{Ʋǁ`state-business-primary);Ƹ1px}@keyframes cm-click-refresh-pulse{0%,to{Ʊ.55}50%{Ʊ1}}|bbox.clickable.busy,|foot.clickable.busy{Ǐcm-click-refresh-pulse 1.1s ease-in-out 2;njprogress}|mm{ƌ8px 10px;Ɨ4px}|mm-title{?12px;ƍ;Ƈ`label-primary)}|mm-reset{?11px;Ƈ`label-tertiary);Ʀ1/-1}|codex-head>|mm-title{min-ƈ0;Ǝ;Ə;Ɗ}|codex-resets{ƛ;ơright}|codex-resets>span{ƕblock}|footer-stack.compact |bbox[data-cm-display=codex]{grid:auto/1fr}|bbox.rail[data-cm-display=codex] |bbox-rail{max-ƈ100%;Ơ;ơcenter;?10px}|gw-switcher{Ɩ;ƭ;?11px;ƌ1px 6px;ƅ999px;ƘƓ`border-l1);$`bg-layer-2);Ƈ`label-secondary)}|gw-switcher:hover{$`interactive-bg-hover);Ƈ`label-primary)}|gw-sub{?11px;Ƈ`label-tertiary);Ǝ;Ə;Ɗ}|mm-row{Ɔ&;Ɨ8px;ƌ2px 0}|mm-sub{?11px;line-Ƌ16px;Ɲ4px;Ƈ`label-tertiary)}|mm-sub.warn{Ɲ0;Ƈ`state-warn-primary)}|mm-row |bbox-label{ƛ;ƈauto;min-ƈ22px;max-ƈ115px;Ʃ400;Ƈ`label-secondary);Ɛ;Ɗ;Ǝ;Ə;word-break:keep-all}|mm-row |bbox-bar{Ƨ1;min-ƈ40px;Ƌ6px}|mm-row |bbox-pct{ƛ;min-ƈ2.4em;ơright;Ɛ}|mm-row.wide |bbox-label{ƈauto;max-ƈ64px;Ƨ0 1 auto;Ɗ;Ǝ;Ə}|mm-row.wide |mm-text{Ƨ1;min-ƈ0;?12px;Ƈ`label-secondary);ơright;Ɛ;Ɗ;Ǝ;Ə}|bal-line{?13px;Ƈ`label-secondary)}|bal-line.warn{Ƈ`state-warn-primary,#b45309)}:has(>|footer-stack),:has(>[data-slot="sidebar.footer.action"]>|footer-stack){ƙ;Ƨ0 0 auto;Ƌauto;min-Ƌ0;align-NJflex-start}:has(>div>[data-slot="sidebar.footer.action"]>|footer-stack){Ƨ0 0 auto;Ƌauto;min-Ƌ0}:has(>|footer-stack.rail),:has(>[data-slot="sidebar.footer.action"]>|footer-stack.rail){ƉƵ&;Ɨ6px}|footer-stack{Ɔƛ;ǒ-1;ƉƗ6px;ƈ100%;min-ƈ0;max-ƈ100%;Njstretch;ƒ}|footer-stack.rail{&;ǒ1}|footer-stack |bbox{ƈ100%;min-ƈ0}|footer-stack |foot{ƈ100%;ƒ}|footer-stack |foot:not(|foot-rail){Ƒspace-between}|model-costs |collapse-h{ƈ100%}|model-costs |collapse-h>|bal-amt{margin-ưauto}|footer-stack.compact |bbox{ƕgrid;Ɣrepeat(2,minmax(0,1fr));column-Ɨ12px;row-Ɨ2px;&}|footer-stack.compact |bbox>*{Ʀ1/-1}|footer-stack.compact |bbox>|mm-row:not(|mm-title){Ʀauto}|footer-stack.compact |mm-row{min-ƈ0;Ɨ4px;flex-wrap:nowrap}|footer-stack.compact |mm-row |bbox-label{Ƨ0 1 auto;min-ƈ0;max-ƈ45%;ƈauto}|footer-stack.compact |mm-row |bbox-bar{min-ƈ0;Ƨ1 1 0}|footer-stack.simple{Ɨ0;max-Ƌ38vh;max-Ƌmin(38dvh,320px);ƪƤ;scrollbar-ƈthin;ƘƓ`border-l1);ƅ10px;$`bg-layer-1)}|footer-stack.simple>*{ƴ}|footer-stack.simple:focus-visible{Ʋǁ`state-business-primary);Ƹ2px}|footer-stack.simple |bbox{Ƙ0;ƅ0;ƌ4px 8px;Ɨ2px;$transparent;ƣinset 0 -1px `border-l1)}|footer-stack.simple |mm-title{?11px;line-Ƌ16px;Ɵ0}|footer-stack.simple |mm-row{Ɨ6px;min-Ƌ16px;line-Ƌ16px;Ɵ0;ƌ0}|footer-stack.simple |mm-text{?11px}|footer-stack.simple>|peak-strip,|footer-stack.simple>|peak-classic{Ɵ0;ƌ4px 8px}|simple-summary>span{min-ƈ0;Ɗ;Ǝ;Ə}|footer-stack.simple |bbox-pct{?12px;line-Ƌ18px}|footer-stack.simple |bbox-bar{Ƌ4px}|footer-stack.simple |bbox-line{ƕnone}|footer-stack.simple |foot{Ƌ26px;ƌ0 8px}|footer-stack.simple |peak-classic{ƚ2px;Ɨ2px}|footer-stack.simple |peak-classic-chip{ƌ0 4px;Ƙ0;$transparent}|simple-summary{ƞsticky;ǐƫ1;$`bg-layer-1);ƆƑspace-between;&;Ɨ8px;ƌ5px 8px;?12px;ƍ;ƥƓ`border-l1)}|footer-stack.simple.rail{Ƙ0;$transparent}|footer-stack.simple.rail |bbox{ƌ4px 2px}|footer-stack.simple |peak-rail-track,|footer-stack.simple |peak-rail-classic-track{Ƌ28px}|footer-stack.text-only |bbox-bar{ƕnone}|footer-stack.Ưnot(.rail) |bbox{ƌ4px 8px;Ɨ2px}|footer-stack.Ưnot(.rail) |mm{ƆƷrow;ƙ;Ɨ2px 12px;&}|footer-stack.Ưnot(.rail) |mm>|mm-title,|footer-stack.Ưnot(.rail) |codex-head,|footer-stack.Ưnot(.rail) |mm-reset{Ƨ1 0 100%;min-ƈ0}|footer-stack.Ưnot(.rail) |mm-row:not(|mm-title){Ɨ4px;ƌ0;min-ƈ0;max-ƈ100%}|footer-stack.text-only |mm-row |bbox-label{max-ƈ115px;Ƨ0 1 auto}|footer-stack.text-only |mm-row |bbox-pct{min-ƈ0}@media(max-ƈ640px){|cards,|grid,|budget-controls{Ɣ1fr}}@media(max-ƈ1023px){|section{Ɲcalc(16px + env(safe-area-inset-bottom))}|cards,|overview-grid>|cards,|grid,|budget-controls{Ɣ1fr;Ɨ8px}|card{ƌ10px 12px}|card-value{?17px}|card-sub,|bal-line,|bal-amt{Ơ}|buttons,|toolbar,|row,|budget-head{ƙ}|btn,|tab,|foot,|corner-chip{min-Ƌ36px;Ƌauto}|tabs{ƵLJ}|tab{ƛ}|qstrip{ƌ0 8px}|qguide{max-ƈcalc(100vw - 24px);džvar(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,Ƣ) + 10px + env(safe-area-inset-top)))}|peak-alert{max-ƈcalc(100vw - 24px)}|peak-alert|peak-alert-corner{ǃ12px;ư12px;ƽcalc(12px + env(safe-area-inset-bottom));ƈauto}|footer-stack{Ɲenv(safe-area-inset-bottom)}|stat-dialog-body{ƌ14px;Ɲcalc(14px + env(safe-area-inset-bottom))}}body[data-dsh-pocket-layout=mobile] :is(|cards,|overview-grid>|cards,|grid,|budget-controls){Ɣ1fr;Ɨ8px}body[data-dsh-pocket-layout=mobile] |tabs{ƵLJ}body[data-dsh-pocket-layout=mobile] |footer-stack{Ɲenv(safe-area-inset-bottom)}body[data-dsh-pocket-layout=mobile] :is(|peak-alert,|qguide){max-ƈcalc(100vw - 24px)}body{DŽ#fff}body[data-ds-dark-theme],body[data-theme=dark],html[data-theme=dark] body{DŽ#151517}|section,|stat-dialog,|qguide,|peak-alert,|footer-stack.simple{$ƻ;$rgb(from `bg-layer-2,`bg-base,#fff)) r g b / 1)}|today-values{ƕinline-flex;ƙ;Ƒflex-end;Ɨ2px 8px;min-ƈ0;max-ƈ100%}|today-values>span{Ɗ}|today-values[data-both=true]>[data-cm-today=tokens]{?11px;Ƈ`label-secondary)}|simple-summary{$ƻ;$rgb(from `bg-layer-1,`bg-base,#fff)) r g b / 1)}|plan-gauges{Ʀ1/-1;ƕgrid;Ɣrepeat(auto-fit,minmax(52px,1fr));Ɨ6px}|plan-gauges |mm-row{ƕgrid;Ɣ1fr;Ɨ0;justify-items:center;Ɵ0;ƌ0;Ƈ`state-business-primary,#4b7ff5)}|plan-gauges svg{ƺƈ100%;max-ƈ64px}|plan-gauges |bbox-pct{ƺƾcenter;ơcenter;ƜtranslateY(-3px);?12px}|plan-gauges |bbox-label{ƺƾend;Ɲ8%;max-ƈ100%;ơcenter;Ǝ;Ə}|plan-gauges |mm-row:not(:has(svg)){Ʀ1/-1;ƕflex}|plan-gauges .warn{Ƈ`state-warn-primary,#d97706)}|plan-gauges .over{Ƈ`state-error-primary,#dc2626)}'.replace(/[`|$&?ƀ-ǿ]/g,e=>ps[e.charCodeAt(0)>=384?e.charCodeAt(0)-384:"`|$&?".indexOf(e)]),Ua="dsh-cost-meter/client.css";if(typeof document<"u"&&document.head!==void 0){const e=document.querySelector("style[data-plugin-css="+JSON.stringify(Ua)+"]");if(e?.textContent!==qa){const t=e??document.createElement("style");t.dataset.plugin="dsh-cost-meter",t.dataset.pluginCss=Ua,t.textContent=qa,e===null&&document.head.appendChild(t)}}const fs="Balance|balance|额度|session|Plan|Label|quota|models|显示|credential|amount|余额|custom|Stats|费用|价格|peak|coding|模型|Source|gateway|time|tokens|会话|model|refresh|Quota|自动|price|history|刷新|官方|输入|official|weekends and Chinese public holidays are|Refresh|Alert|DeepSeek|Token|position|缓存|message|remaining|Sidebar|display|the|用量|金额|Title|自定义|budget|period|sidebar|凭据|调用|input|Coding|Failed|Peak|output|source|中国公众假期全天谷价|同步|失败|峰时高价时段显著提示|时段|计费|预算|Credits|Display|Note|OpenCode Go|cache|calls|currency|usage|Budget|今日|峰时|已用|credits|plan|pricing|以同一系统账号运行|Remaining|Settings|历史|图框详细信息|Monthly|details|WorkBuddy2API|分钟|当前|留空|Today|cost|interval|optional|侧边栏|and|DescribeBillingAccount|Enable|account|failed|位置|保存|剩余|小时|币种|数据|日期|本地|记录|读取|谷时|账本|输出|month|total|Cost|API|Cache|Codex|Hint|Official|Placeholder|Strip includes|ledger|启用|设置|History|Preview|browser|current|minutes|右下角|浏览器|automatically|rates|Credit|OpenDesign|Weekly|Window|YYYY-MM-DD|auth login|expression|used|volcengine|全部|可选|峰谷|提示|时间|更新|本月|查询|添加|订阅|请求|谷价|进入|配置|默认|Currency|Interval|Multiply|Session|Short|default|is an upper bound|never echoed back|workspace ID|法定假日|逗号分隔|AccessKey|Custom|Output|WorkBuddy|corner|主机|人民币|估算|侧栏|命中|密钥|来源|清除|点击|登录|积分|累计|账号|重置|隐藏|Total|codex|empty|local|not queried|today|comma-separated|data|date|deepseek-v4-pro|only|qwen|导入安装前|开始对话后|汇总在这里|Chinese|Compact|confirm|granted|holiday|unknown|Configured|Credential|Entering|Input|Provider|Remove|Unreported|Volcengine|built-in table|configured|enable|enough samples|external|for this|opendesign|override|request Cookie|settings|this|token|toppedUp|使用|名称|周期|周末|填写|开启|提醒|明细|暂无|确认|统计|间隔|Alibaba Cloud|Authorization|subscriptions|take priority|Anthropic|Empty|Key|Model|Reset|Strip|apply|countdown|effective|estimates|including|qianwenai|工作区|框上方|横条含|白名单|Bottom-right|Compensation|Content-Type|Cookie|Default|JSON|Loading|Method|MiniMax|Organization|Rolling|Show|Target|Volcano|billing|console|from|hitRate|method|notification|rate|records|same OS user|subscription|weekend|匹配|单价|后续|图框|安装|导入|展开|恢复|按自然月|排行加载|火山引擎|环境变量|移除|赠送|采样区间|预览|Antigravity|Clear|Click|Composer|Flash|Local|Match|Position|SiliconFlow|This|Unavailable|Unsupported|Usage|application|auto-detect|bailian-cli|composer|environment|estimate|full-window|group|host|matching|max-preview|pre-install|provider|qianwen-cli|unavailable|Add|DSH|are|Auto-match|Claude Pro|Cline Pass|Import|Legacy|Management|Notice|OpenAI|OpenRouter|Rhythm|Used|aggregated|billed|equivalent|historical|hours soon|legacy|multiplier|percentage|status|to restore|window|上限|下方|优先|倍率|全天|关闭|内置|加载|区间|取消|后重|基础|当日|总额|手动|支持|日志|未知|本周|渠道|滚动|生效|端口|等值|美元|覆盖|计价|这里|采样|页面|Account|Allowed|Bailian|Billing|Convert|Factory|Headers|Invalid|Queried|Start|Unknown|Weekend|address|click|factory|headers|hours|include|range|ranking|restore|summary|Auto|Direction|Estimated|Kimi Code|Rank|Sort|Topped-up|Unlimited|all|auto-sync|open|page|precision|reasoning|subagents|sync|unmatched|中复制|占位符|子代理|性价比|抵扣率|控制台|未上报|标题栏|百分比|知道了|起始日|这一项|阿里云|Base URL|Class|Corner|Daily|Detail|DevTools|Disabled|External|Gemini|HTTPS|Ledger|Line|Moonshot|Overview|Qwen|Recent|Saving|Security|Selected|Status|Sync|Toggle|actual|blank to|calendar|card|clear|combined|count|entering|fields|first|follow|import|language|limit|multiply|notice|reads|recorded|remove|required|requires|reset|sample|snapshot|spend|start|store|subtract|table|use|with|不会|不计|保留|修改|充值|写入|分别|切换|删除|到期|勾选|北京|千问|发现|发送|只写|可用|可能|地址|外部|字段|实际|对账|弹窗|影响|快照|折算|推理|文档|方向|时区|格式|每日|汇率|满窗|用于|精度|组织|编辑|账户|路径|选择|All|Off|key|Amounts|Base|Beijing|Both|Bundled|ChatGPT|Confirm|Control|English|Extract|Fetched|General|Granted|HTTP|Include|Kimi|Minimax|Missing|Percent|Pricing|Request|Save|Section|Summary|applies|catalog|changes|channel|dock|earlier|expires|for|loading|minimax|missing|name|percent|plugins|qianwen|reading|replace|when|Badge|Enter|Error|Guide|Limit|Login|Price|Query|ROUTE|Rates|Spent|Style|UTC|alert|entry|query|scnet|until|value|Active|Amount|Body|Date|Header|Hidden|Minute|Not|OPENAI|Origin|Period|Public|Remain|Sample|Secret|Switch|Time|USD|active|aliyun|auto|cancel|change|divide|expiry|flat|full|grants|here|hidden|hide|logs|not|origin|port|reason|remain|select|studio|your|上界|不足|专用|个人|中文|为准|以及|例如|允许|入口|其他|包含|卡片|即可|即将|厂商|原因|发生|可在|同名|后可|后的|回放|回显|域名|填入|处于|套餐|对应|工具|平价|应用|底部|开关|手工|挂载|按量|按钮|换算|授权|放行|早期|智谱|最多|最近|月度|权限|条数|查看|标准|样本|档位|比例|状态|界面|百炼|窗口|类型|缺失|网关|花费|英文|获取|表外|规则|语言|请在|账单|跟随|过期|通知|重试|Hit|box|col|CLI|CNY|Hide|KEY|Last|Lock|Open|Unit|VAR|When|bar|day|docs|left|off|pct|read|saved|stay|that|tier|tok|will|work|yet|Pro|tab|Edit|The|Top|back|each|less|new|old|over|per|save|show|zone|Use|its|low|min".split("|"),Ha=e=>e.replace(/[ƀ-߿]/g,t=>fs[t.charCodeAt(0)-384]),bs=Ha("ƃ͇|ƃ͇ɒ|ƃǷɒ|Ɔ̥|ǒCnyǻ|ƁϏƹ|ɖϊ|Ɓ|ơƀ|Ɔʸ|ƆƫǕ|Ɔƫʸ|ƆǕʸ|ƆΛʼs|ϗƹ|reconcileƅ|ɔѫpedUp|upɊdAt|ƲOf|ȒOf|ǵɂ|Ʋ|ɇǷư|ɇƦsư|Ɩѕ|ljƦs|ǵǷ|ǶǷ|ɇ|ƴǞMetric|ƴǞǷ|ƴǞƦs|ƳDay|ƳMonth|ƳΛ|ƳȯRange|noȂ|эϞ|эC̦s|эInTok|эǹTok|эOutTok|эǷ|noȦsǞ|эȦ|ɡnj|ƲϜƅ|Ʋϥƅ|ͫϞ|endϞ|̚Text|Ʋ͂dž|Ʋ͏|ѱό|nearό|ˤɿ|ȨF̦Ѭ|ͤ|ѢΟ|ѢΜƺ|Ѣƺ|ƁApiɾ|ƁƓChoice|ƁƓ̞|ƁƓ̈|ƁƓǻ|Ɓ͇|ƁϏƹǻ|ƁϢ̐|Ǧƀ|ƙing|ƙƀ|ƌƀư|ƌƀˑ|ɪ˝ƀˑ|ɪ˝ƀdž|Ϯƀˑ|Ϯƀdž|ƌƀConfigdž|ƌƀƅZh|ƌƀƅEn|ƌƀUrl|ƌƀUrlǻ|ƌƀHttp|ѥBuddyƀˑ|ѥBuddyƀdž|ƌƀʓ|ƌƀ̎|ƌƀϝ|ƌƀϝdž|ƌƀΧ|ƌƀDžƅ|ƌƀƣȤ|ƌƀѕƅ|ƌƀ̌|ƌƀ̌dž|ƁBarǔ|ƁBarǞ|ƁBarϒ|ј̟sư|ј̟ǔ|ј̟˞|ƁnjCapƅ|ƁNoCap|̨Aiȋˑ|̨AiȋϜ|̨Aiȋ̑|̨AiȋExpiry|̨Aiȋ̋|̨Aiȋdž|̨Aiȋε|ƌƀ̏Json|ƌƀ̎Vardž|ƌƀ̉Hosts|ƌƀ̉Hostsǻ|ƌƀɘsư|ƌƀɘsǻ|ƌƀNoǽs|ɡ|ƌƀ͇|ƌƀǔ|ƙȯƀ|goƚư|goƚRowƅ|goȎʖ|goȎȍ|goȎǘ|goʀAt|ͧRѭed|ͧDays|ͧHours|ͧϡs|ƆʀInHm|ƆʀInM|ƆʀAt|ƆForecastы|Ɔ˞|Ɔǔ|goƚΰ|goƚΨAt|goƚDžƅ|goƚƣȤƅ|goƚɾƅ|goMainƅ|gòƅ|ƉɗOf|ƉϢɗ|Ɖγ|Ɖѩ|Ɖʶ|Ɖ͌|Ɖɚǻ|secretMigrationPending|Ʋ̀ƅ|ƙGoƚ|goƚϢ̐|ƑƄɼ|ƑƄZai|zaiƄɾƅ|zaiƄɾί|agyLinkƚˑ|ƑƄή|ƑƄήư|οϤ|οϤdž|ƑƄϧ5h|ƑƄϧ7d|ƁRechargeLink|Ƀƚư|Ƀƚǥ|ɃƚFive|ɃƚWeek|Ƀƚʀ|Ƀƚʿ|Ƀƚǥd|Ƀƚƫ|Ƀƚʁ|̙SubagentǷ|Ɣƚɽ|ƑƄDžƅ|ƑƄɾƅ|ƑƄƣȤƅ|ƙƸƄ|loginƸƄ|loggingIn|ƑƄϢ̐|Ɣƚư|ƔƓˑ|ƔƓƅ|ƔƓΟURL|ƔƓDž|ƔƓƣȤ|ƔƓΛowlist|ƔƓɘ|ƔƓ͏|ƔƓˀ|ƔƓ̒|ƔƓNös|ƔƓΨAt|ƔϪ̈|ƔOnlÿ́|ƙ|ƆǥFirst|ƆƣReady|Ɔɜ|Ɔδdž|goƚ͂dž|Ȳƅ|ȲGoʖ|ȲGoȍ|ȲGoǘ|Ȳnj|goȧʖ|goȧȍ|goȧǘ|goȧ̿|Ʋȧ|ǿReadƹ|υ͆|ǿʿ|̭ƹ|Ɲʶed|͖ƹ|ƐΜ|ƐϢEffective|Ɛϛ|Ɛ˚|ќƺϛ|ʤΛΜƺ|ʤChip|ʤȧ|ɕΛΜƺ|ɕChip|ɕȧ|ƐHoliљsƅ|ʤRuledž|Ɛȧ|ќƺȧ|Ɛϓƅ|Ɛϓɒ|Ɛϓ̽ic|ƐƤƅ|ƐƤAheadƅ|ƐƤʘƅ|ƐƤʘƺ|ƐƤʘΜƺ|ƐƤʘΡ|ƐƤưƺ|ƐƤưΜƺ|ƐƤϝ|ƐƤPhaseƺ|ƐƤPhaseΜƺ|ƐƤBtn|ƐƤψƺ|ƐƤψΜƺ|ƐƤʼƅ|ƐƤʼ̾|ƐƤʼCenter|ƐƤWebϢifyƅ|ƐƤWebϢifyǻ|ƐƤȃƅ|ƐƤȃƺ|ƐƤȃΜƺ|ƐƤȃTag|ƐPanelư|Ɛ˚Ϡǻ|ˉΩ|ˉMoney|ˉƫ|ƴSimple|closeϋ|̜ώʻes|ͤώʻǻ|ˉ̾|ˉ̀|unmountBtn|ηUnƜd|Ɯѓψ|Ɯѓǻ|ƜѓRelease|Ƙƍư|Ƈư|ƇCount|ƇOƭr|Ƈ_ɡd|Ƈ_Ȩє|Ƈ_remember|Ƈ_Ɩ|Ƈ_sh˓s|Ƈ_κ|Ƈ_Ƴ|Ƈ_̝|Ƈ_Ƨ|Ƈ_topN|Ƈ_ƙSeconds|Ƈɂ|Ƈѫ|ƇFirst|ƇAfter|Ƈђ|ƘƍǞ|ƘƍȂ|ƘƍǷH|ƘƍƦsH|ƘƍыH|Ƙƍыɝ|ƘƍыɝTip|ƘƍValueH|Ƙƍɚ|Ƙƍǹ|ƘƍȰ|Ƙƍɽ|ƘƍBlended|Ƙƍdž|Ƙƍ˘|ƃ͇Split|ƃ͇Splitɒ|Ǒƍư|Ǒƍɽ|ǑƍȎ|Ǒƍΰ|Ǒƍʺ|ǑƍPer1|ǑƍFull|Ǒƍʀs|ǑƍʓϨ|ǑƍʓLive|ǑƍʓNone|ǑƍʓϨAt|ǑƍConfidenceLow|ǑƍCurveư|Ǒƍ̿|Ǒƍȍ|Ǒƍǘ|ǑƍCurveɽ|ǑƍBarTip|Ǒƍdž|ʚ̽ƅ|ʚ̽Ƅ|ʚ̞̽|ʚ̽Api|ƜȥSepaʠ|Ɯȥǻ|ƜȥΛ|ƜȥSingle|Ɯȥ̏|Ɯʻƅ|Ɯʻ̞|ƜʻExact|Ɯʻdž|ɦʘʐ|ɦɜ|̮ư|̮ǻ|sectionƅ|Njδƅ|ϴɚ|ϴǹd|ϴǹWrite|LjWriteF̦Ѭ|ϴȰ|ƑƄέ|ƑƄєrouter|ƑƄSiliconfѸ|ƑƄCommǣcode|ƑƄClinepass|ƑƄScnet|ƑƄɞ|ƑƄ͊|ƑƄMimo|ƑƄBaidu|Ɔ˞ɂ|wbT|wbH|ƑƄ̍|ƑƄєdesign|ɥWorkspace|ɥdž|ɥύ|̖Pool|̖PoolΡ|̖Org|mimoȎƄ|mimoȎʍ|ƑƄȎƀ|ɍƓ|ɍƓʺ|ɍƓCli|ɍƓ̊|ɍClidž|ɍ̊dž|ɍƄDŽƅ|ɍƄ̑ƅ|ɍϑƅ|ɍϑɿǽ|ɍRateDraftdž|ɍϑˑ|ɍʺdž|ϘƄDŽƅ|ϘƄ̑ƅ|Ϙʺdž|ȓȮIdƅ|ȓϩȮƅ|ȓȮǽ|ȓϩǽ|ʃHoursOnly|ʃHourϡ|ʃϡ|nextΜƺIn|nextƺIn|Ɛε|noƺȎs|ɖ|͕Ǟ|͕Month|͕ɂ|͕ɂSub|ɣˁ|͗ˁ|ɣStale|ɣȂ|͕sFootϻe|ƕѵǻ|ɇȦs|ƝExpǣǻ|ƝȦsʒ|ƝNoȦs|ƝȦsϊ|ƃ̢ư|ƃ̢ǻ|ƃ̢ɽ|ƃ̢ʒ|ƃ̢ϊ|ƃ̢ό|͕s͑Ƅɂ|͕s͑Ƅɂǻ|ϹȦǷϟ|ϹȦǷDock|ϹTurnǷ|ƃ̢̣|ƃ̣ǷDesc|ƃ̣ǷAsc|ƃ̣ϫDesc|ƃ̣ϫAsc|ƃ̣͋|Ɲ|Njư|Njɂ|NjDay|Njɽ|Ѩ͉|Ѩƚs|Ѩˁ|Ѩα|Ɔƫ|ƆєDž|ѨDž|ƝDataư|Ƨƅ|ƧDock|Ƨϟ|ќ|Ɔʁʗnj|ƆʁʗGo|ƆʁʗƄs|̩Loadϫout|ƁϠ|Ɓ͑|̕Toƣ|Ɓʷϋϝ|ƁʷϋOk|ƴƅ|ƴOn|NJƅ|ʠƅ|decimalsƅ|ƁDžƅ|Ɓƫ|ƁǕ|ƁΡ|ƙȤƅ|Ɛǥdƅ|Ɛ˚ƅ|ƜTableư|ǒȣƅ|ǒȣUsd|ǒȣCny|ǒȣdž|ƜTabledž|Ɋdώdž|ȨɿId|ѯɿǽ|addɿ|ɉ͐|saving|ϯγƹ|ϯγdAt|ϯγǻ|ɓFetch|ʂ|ϰ|̭FromDocs|̭Scopedž|ɓʀ|͝˘|ɓ˗˘|ˤ˗ƹ|ˤ˗dž|ɓʶ|͖ΛȂ|last͐|never͐ed|Ƽ|ƼǼ|Ƽ΢|͞ƅ|Ʌe̞|rpcƹ|rpc͐ƹ|rpcƀƹ").split("|"),Ie=Object.fromEntries([["zh",'本Ɨ {Ɗ} · ȷ {ʝ} · Ơ {Ʒ} · ƨ {Lj} · Ǵ {ƻ}|本Ɨ {Ɗ}|仅ƈƯ|无限制|ǜȴƯ来自̂Ə × Β {ʠ}。对照Ɵȴц,请Κ я,再ƾƏ;ƾ仅Ήʧƶ。|Ƌțƿ:{Ʃ}|˻错误|Ƌ|ƥ Ƌ|Ơʉ|ȶ和ȁ页|ȶ和Ơʉ|ȁ页和Ơʉ|ȔǨ|țƿ|ƟƋ变动与ǯdz交叉·(偏差超阈时ȗ)|ʲ {ɔ} · ͵ {ɫ}|șȘ {ƕ}|ǃ({Ƴ})|Ǐ {Ȓ} / {Ɗ}|Ț {ǵ} · Ⱦ {Ƕ}|ǃ|ǍƎ(按ǜ价表计算)|Ǎ Ʀ Ʈ|Ɩ|ƶ {lj} 次 · Ơ {Ʒ} · ƨ {Lj} · Ǵ {ƻ}|Ț {Ɗ}|Ⱦ {Ɗ}|Ǎ|ǢǍƈ|Ǝ|Ʀ Ʈ|Ǎ|Ț|Ⱦ|Ʊ˲|ɴǖǰ。ɏ,Ǝ将按天ɐ。|Ǯ|ƶ|Ơ ѣ|ƨ ѣ|Ǵ ѣ|Ǝ|ǍɴƗǰ。|Ɨ|Ȁǃ|ǃƂ(按ƈǬ)|ǃɮ|开始Ǯ|结束Ǯ(ǝ = Ǎ)|ɶ˲:{̚}|Ȁǃ后ƈƂ、ǏƯ及з(按ƈǬЩ);ȕǍ、Ț、Ⱦ或Ʊɮ。|{Ƴ}ǃ {Ɗ} · Ǐ {Ȓ} · {ѝ}%|(已超出)|(接近˪)|旧ƒ|Ȣ回退|ʱ|˵|Dz|ǎ|ƋЅ Ǹ ɾ|Ƌȹ|ƛ(ƒ ɾ ˬ)|˒ ȼ钱包|手选ȿ或Ѕ ɾ ˬ。|总Ƌ {Ƕ} · ʲ {ɔ} · ͵ {ɫ} · ș于 {ƕ}|Ƌțƿ:{Ʃ}|未țƋ|ƟΘƋ|ƞ中…|ƞƋ|Ʊ ɛ Ƌ|Ȝȡ|Ȝ Ʀ ˝ Ƌ|ƈ官网Θ页的ȴ΁Ƌ。ȼ ɪrhythm.Ё,在Ȉ开发者Р → 网络̯ΘȞ的 ʏ,或在存储 / Т̯ tr_ƃ 值,М˫Ƶ并Ȁ。ʏ 仅存 ˒ Ƶ库;ш˴新ɰ。|Ȝͽ / ̻Ƌ|ț̻中国站΁金。RAM Ȯ 需 bss:Ǥ б。前两项必填;STS 才需 ͍ Ʀ。ȸ存Ƶ库。|extract ˹点Ι、数值、嵌套 add/ͭ/͠/ϲ/ѹ/max/sum,Љ ȑ 算式。Њ ƪ: {"ȑ":"(ɉ.Ƕ - ɉ.Ȓ) / 500000"}。΅名和Щз按接口ɰ;已Ʈ应填 ͪ。|Їɭ|рɭ|Ȟ URL|˹ ͅ、本机 Ϋ,Љ /σ/… 相对Ι(ƛч ˒ ̀)。|Ћ非回环 Ϋ(Ƶ明文传输;须将准确的 ȳ:̀ 加入ʋ)|+ ǚ Ƚ|ǚ 预设DZ活跃ȿ池ǪȽ,ɬ管理后台 X-Adѹ-Ʀ(不是ƒ Ǹ ɾ)。请ɰΆ΃与̀;令牌ш后șƵ。|Ȟ方法|Ȟ头 (ʑ)|Ȟ体 (ʑ)|ǝ不Ϳ;ʑ 原文ǩ并Ϳ。Ȣ ʎ 为 ˂/json,ЕȞ头̃。|解析у (ʑ)|ƱƋƈǨ|ƞɷ (Ǜ)|Ƌ原Ǭ|按ƈǬ΋(Ϭ Ƌ)|ɬƈΒ与Ε;ƋǬ保持端点原Ǭ。ЍǬ及Ƚ不΋。|Ƌ {Ɗ}|˶Ǐ {Ɗ}|Ǐ {Ɗ}|进度条Ύ|ǪΎ(满 → 空)|ǏΎ(空 → 满)|Ƃ˪ (ȕ)|未设ǃ˪,仅ƈƟƋ。|Ȝ ˛ Ǹ ʲƂ|ʲƯ(Ϭ)|˿Ǯ(ϔ)|ͺǮ(ϔ)|г ˛ ƟƂ|用ʲƯ减去本ɮ的Ζ Ǹ ƎȵǪƂ。起止Ǯ从ƟƂ̇ɰ,ͺ˶ 00:00 ϔ 归零。|˷ {Ƕ} · ΖƎ {Ȓ} · 预估Ǫ {ƪ} · ϔ ͺ {ϳ}|ʑ ΐ无效|{{і_NAME}} 从Ƶ库或ʰDZ。<ϐ>_Ǹ_ё 中 ϐ 为大写 ɛ ID,符号改下划线,如 ̨ai→ϣ_Ǹ_ё。Ж共用ȸ。|Ƶʋ (ȭ)|Ȟ头带ȸ时仅Ы列表内ȳ,ǝ则Ы并警告,防ʪ他人ȡ外带ȸ。|ƵƠ|为上方 {{і}} ̰存入ȸ(write-Ɍ,΀Ƶ库,不К):|Ȟ头还没有 {{і}} ̰:М如 "ɹ": "Be˓r {{MY_Ǹ_ё}}" 后̅会出现ƵƠ框。|Ȁ|Ǫ {ƪ} · Ǐ {ͪ} / Ƃ {maxnj} · ș于 {ƕ}|Ǫ {Ɗ}|ƞƱƋ|LJ ȝƂ|Go|˾ 5 ǫ|˼|Ț|ɀ:{ƕ}|已到ɀȘ|Ǫ {d}天{h}ǫ|Ǫ {h}ǫ{m}分|Ǫ {m}Ǜ|{h} ǫ {m} Ǜ后ɀ|{m} Ǜ后ɀ|{ƕ} ɀ|按本л平均Ʈ,预计 {ƕ} 达到˪|Ǐ {ѝ}%|Ǫ {ѝ}%|{ς}%|ș于 {ƕ}|Go ƂƈǨ|Go Ƃƞɷ(Ǜ)|LJ Ǹ ɾ(ȕ,ǝƛ;)|Go Ƃ主ж|Go Ǘ|已ȡ(ȹ:{Ƽ})|未ȡ|ǩ|ΗƵ|Ⱥ|ǩ中…|ȸ只Ͷ ˒ Ƶ库,不ǩ在dz里,也ͱК。|以下ȸ仍在ǯdz,未迁入Ƶ库。请导出Пʰ˴启:|ǃǗ|ƞƂ|未țƂ|ɼ(˕/Max)|Z.ai / Э GLM Ƹ Ƅ|ЭІ或团队 Ƹ Ƅ Ǹ ɾ|请ȡ Ƹ Ƅ Ǹ ɾ|Ȝ ʵ Ƃ|ʔ M Ƅ / Ʀ Ƅ|ʔ Ƅ|țЛ(ͅ)|ǝƛΚƟ站点。ɰ后 ɾ 仅发往该Л;ɬ可信΃,不含Ι。|5h|7d|г ƥ ƟƮ与͵|Σ (Ǻ) Ƃ|Ǻ Ƃ未ɱ · 点此ɱ|5h Ƃ|周Ƃ|{ƕ} ɀ|未取得Ƃ,请ɵ所选ǭ源已ȼ;Ȼъ|ƈ Ǻ Ƃ(需ȼ Ǻ 插件)|在ȶƈ Ǻ Ƃ|在Ơ区ƈ Ǻ Ƃ|本ƗƎЎ̱|ɴƂǭ|ƈǨ|Ǹ ɾ(ȕ,ǝƛ;)|ƞɷ(Ǜ)|ƞ|ȼ|ȼ中…|未țƂ|юѧxyǸ оƂ|Ȝȹ|ȹɭ|̼|ƈǨ|ƞɷ(Ǜ)|Ƶʋ(ȳ:̀,ȭ)|˙ ɾ(΀)|и|不˹的 ɛ|˻|未;ȿ|抓取于 {ƕ}|͸ȿ (ǜ: {Ǧ})|只ƈ ̈́ Ƃ|ƞ|先ͻȀ̺|Ȁ并ǩƈǨЗƞ|͹|ͻȀ后会排到最上面;点ɭ可ʫ该项自己的ȡ。ƱƋЮ 8 条,оȹЮ 4 条。|ɱ后DZ LJ 的˾ 5 ǫ、周、月Ƃ,ƈ在ȶ、ȁ页及ȇ;无ȝ时ȗГ。|ȇƈ(κ)|˾ 5 ǫƂ|˼Ƃ|ȚƂ|ǃǏ%|5h|周|月|日|ǃ|dzDZƿ:{Ʃ}|正在DZdz…|dz不΁|ƾƿ:{Ʃ}|ǖǰ已Ⱥ。|Ⱥƿ:{Ʃ}|Ȗ̄已˯,按˵Əǂ|尚未˿(˿Ș:{ƕ}),ǜ按˵Əǂ|ǜН峰ǁ,按ǎ价ǂ|ǜ为 ƥ ǎ高价ǁ,按ǎ价ǂ|ǜН谷ǁ,按Dz价ǂ|ɯǁ——全ȟ(周六及周日ˮ按Dz价ǂ)|ɯǁ——全ȟ|ɯ全谷|Ȭ——ˮȟ|Ȭ——全ȟ|假日|Ȭ(ͼǮ,ȭ)|自 2026-08-23 ͼȘ 00:00 起,ɯ和ƽ;调休上班的ɯ仍按ȟ。|ǎ|С|Ȗǁ条样式|简洁(单行紧凑)|经典(分段与胶囊芯片)|峰/谷͸前Έɲ|提前ɲ(Ǜ,1-30)|ɲм|Ƞǎ|ȠDz|峰和谷|БȠǎ|БȠDz|约 {ƕ} 后ǂж͸为{phase}价,请注意本ǁƶ成本。|ǎ|Dz|̸|峰价ɲ|ȟɲ|ΈǨ|ȇ|屏幕中心|ƾͿ系统щ|Ф后хȈ΃栏Ћщб,才能在̇最小化/切走时收到ɲ。|ʴΈ|ʴ Ƞ峰|ʴ Ƞ谷|(ʴ)|Ȗ̄与ȗ|ȗ已Ɂ:需ȀȖ̄并ɱ「ǀ」。|常规|Ư与Ǭ|Ǣƈ|简化ȶƈ|˯ȗ|ʬ已ʱ的ƒ ({͘})|ʱ会Ⱥ˸映射并Ɂ此行,可ʬ;ͱ͹Ʈǰ,ʧ按ƛʥӯ。|ȇ角标|Ǘ|˳Ц|未核价|已Ʊ|这个Ə是你˸改过的,ƛƾͱ̃它。|ʬƛƾ|按ƒɶ(ɪ 与Ǝ)|ȶƒп|{n} ƒ|其它|ƈƒпЏ|Ȣʫ|记住ʫи|ƈ Ʀ|ƈƎ占比条|ȇƈ ѫ-1 ƒ|Ȣɮ|收起摘要|ЏǨ|ƒ行数(1–10)|ƞɷ(10–60 秒)|ɮ˷与ƒ数|ѫ-1 ƒ与Ư|顶部|Ƌ之后|У|Ǎ|近 90 天|Ǝ排行|Ʀ 消耗|ƨȷ率|̵?|长ƶ无ƨȷ:代理΂ʱƨ΅。Ư按全未ȷ计,是Ѓ;可直连核对。|̲ · 每̂ ɪ 数|Ơ|ƨ|Ǵ|该ǁɴƮǭ。|综合ʦ {Ɯ}/M|ȷ率=ƨ读÷(ƨ读+普通Ơ);「̵?」表示ƨ΅΂н,Ư为Ѓ。ʦ=Ǝ÷ɪ×1M;̲=ɪ÷Ǝ。|未分ƒ(Ьǭ · 按当时ǰǂ)|本Ɨ {Ɗ}(Ǹ)· Ƅ ́ {ǑϜ} · ȷ {ʝ} · Ơ {Ʒ} · ƨ {Lj} · Ǵ {ƻ}|本Ɨ {Ɗ}(Ǹ)· Ƅ ́ {ǑϜ}|Ʀ Ƅ Ʈɶ(每 1% 与Γȵ)|尚无 Ƹ Ƅ Ƃǭ;х「Ƃ」页ɱ并ƞВ。|л|Ǐ %|本ɮΆ(ǯdz)|每 1% Ƃ ≈|Γ 100% ≈|ɀ {ƕ}|̆差分|ǜƮ΋|еЄ|{ʞ}(基准 {ƕ})|读数Ε受限|Ƅ Ʈ曲线(按ʳ聚合)|Α|每周|每月|̆Є:至少两次成功ƞ,且Ƃ̷Д变化。|{Ɋ}:Γ估计 ≈ {ϵ}(每 1% ≈ {Ѳ1})· Ά {Ɩ} / {ǟ} · {Ǡs} 个ʳ|Ư是目录价́;ȝ耗Ƃ,ǃ只计 Ǹ。ȵ仅含 dsh ƶ;服务端̷含全ȿ。短时еΕ有限;5h ˾,周/月按ǯ日历。|ǂ方式|Ƅ ȝ|ƛ|Ǹ Ч|ͷȁ˭|可Ơ 2 × 0.8|ʹ˭会ƾ到本ƒȔʦ|仅ʹ̺的˭;˳ͻʬ统一˭|请Ơ非负ʦ或乘法,Њ 2 × 0.8|˻ƒ名ƛʥ|ƛ(去后缀 / 前缀 / 家族相似)|仅精确ʥ|ˬɬ˸指定和˽Ə,ƛ识别Жƒ及Ǯ标签。|ƥ Ȣ价|ʱ|待ʥ与˸ȁ|按˽和ƒͷȁ:ΚƏ表条目、ƱƏ,或标记为ǯƒ。ƱƏ只Δǜ˽。|Ǝ|Ʈ|Ơ|ƨDZ|ƨͶ|ǝ时按ƨDZ价ǂ|Ǵ|̡ / ͈|˜|ʽ 硅基流动|CommǣCode|˖|SCNet 超算互联网 Ʀ Ƅ|火山方舟 ʙ Ark Ƹ Ƅ|ͽ ͊ Ʀ Ƅ|小米 MiMo Ʀ Ƅ|百度千帆 Ʀ Ƅ|Ǐ / 总Ƃ|ȱ Ƚ|ƛDZ ȱ Ƚ。|̍ (Droid)|Ȍ|Ȍ ʈ ID|点˫Шƛс(设备码Ъ,Ȉ批准一次А),也可按 F12 复制 ʏ Хɰ。ʈ ID ǝ时ƛDZ;Υ ɾ 需填ʈ ID,不˹Ό Ǹ ɾ。|一键сƂƵ|Ƃм|Stǣard + Core|Ζ ID(ȕ)|ОȽ|补偿Ƚ|Ƌ|Ƃȹ|ǯȵ|Ɵ ю|к ю|ю 模式需在 ˒ ȳʩ @ʇ/ˏ,并Ǔ τ Ȑ。|к ю:在 ˒ ȳʩ ˄。ȼШ会在该ȳ打开ЪȈ;远程或无йȳ请Ǔ bl Ȑ --ʛ。|а DŽ Ƃ(І版 Lite 5 万 / д版 50 万,以ȝ页Ј)|ȝ̹(ȕ,ΐ ȏ;ǝʭ)|DŽ ̳̃(ȕ;每百万 ɪ 抵扣的 DŽ,ǝ用˰表)|ƒ名,如 ɍ3.8-ˌ|待填齐三项正数后ƛǩ;Ȕ清空ʬ˰表。|Ȝ|DŽ ǯȵ,以̴Ј。ɶ归属ͽО的 Ƅ ƶ;ͲЧ Ǹ。тƒ需设̳。|ǯȵа DŽ Ƃ(˵ 60,000 / д 240,000 / 高级 600,000)|ȝ̹(ȕ,ΐ ȏ;ǝʭ)|ˬ用 24 ǫ内的̴Ί,否则按ǯdz和Ɵ DŽ 表ȵ。ЍР和тƒͲ入。|ʯ Ȯ ID|ʯ ϩȮ|AK...|SK...|{h}ǫ|{h}ǫ{m}分|{m}Ǜ|{ƕ}后ȠС|{ƕ}后Ƞ高峰|峰ǁ({ѵ}):{˩s};˿Ș:{ƕ}。{˧}|未ȡȖǁ。{˧}|˻|ǍƎ|ȚƎ|ȾƎ|自dz建立以来 · ƶ {lj} 次|΄Ʈ|˒ + ΄合计|΄Ί超过 24 ǫ未ș|近期Αǰ|Ư取ЯΊ,΂比Ɵц晚几Ǜ。Ɩ 含Ơ、Ǵ、ƨ和Ό;Ό并入Ǵǂ。以Ư·。|Ǎ/Ț按宿主Ώ {ˊ},Ȉ为 {Ȅ}。Ώ不同会Ή日界和·;可将 dsh 改为ǯΏ。|ǍƗ|ȻǮ行可ʫ˶Ɨɳ|Ɨɳ˱中…|该日无Ɨɳ(Ьǭ或Ɨ˺已清理)|Ɨɳ˱ƿ|按Ɨɶ(Ȕǖ)|跨天合并,̱按Ф归并。仅列选定в,ȾƎЎȔ对话。|ɴƗǭ|Ɨʮ中…|Ɨʮƿ|ƈв|Ư含 Ƅ ˷|ɱ后所有Ư按含 Ƅ ȝ́的总Ǝ展示;˯(Ȣ)仅计真金白银 Ǹ ˽|Ɂ̶ƎɳЌ|ɁƠ框˫ƎɳЌ|Ɂ每轮回复И本轮Ǝ|排序|Ǝ 高→低|Ǝ 低→高|Ș 新→旧|Ș 旧→新|实时顺序|ǖǰ|Ʀ Ʈɶ|Ⱦ {Ɩ} Ɩ · Ơ {Ʒ} · ƨ {Lj} · Ǵ {ƻ} · {lj} 次ƶ|{Ɋ}:共 {Ɩ} Ɩ(Ơ {Ʒ} · ƨ {Lj} · Ǵ {ƻ})· {lj} 次ƶ · {ǟ}|ɴǖǭ,ɏΑƮ会ɐ|概览|Ƃ|Ʈ|Ə|ȶ|ƈȁ →|ƈ|ǖǭ|ƗƎƈǨ|Ơ区˫|Ɨ̶|˯|ʊǃǏ%|ʊ Go Ƃ|ʊ Ƹ Ƅ Ƃ|̇DZ超时,请Ȼъ。|Ƌ已Ɂ|ȻɭɁ或ƈƋ;ȻƯƞ|Ȼ立即ƞ|ȻǢƋ或 Ƹ Ƅ ʨАƞ;ƞ时ʨ闪烁,ƿ时ͳ原值并在悬停ȗ中说明Г。|̸|˶Ǝƈ|ǢУ|货币单位|Β(1 ̂ = ? 目标Ǭ)|小数位数|ƋƈǨ|主̇Ǣ|ȁ页|两者都ƈ|Ƌƞɷ(Ǜ)|Ȁ ƥ ȖǁƏ|ǀ(Ǣǃ框/ǍƎ;ȁ页Ȗ面板内ʴ)|已Ц的Ə表|ƟƏǬ|̂(рƟ页)|ȴ(ЇƟ页)|决定ƾƏ所用的Ɵ页ф;ƾИƏΔʧƶ。|ѧ 与 ʹ ͷ按Ɵʦǂ,旧 ʹ ɭ按 ʹ 价结算。工作日ͼȘ 09–12、14–18 为峰ǁ,ɯ及ƽ。改价Δʧƶ,已ǰƯͳ;修正旧Ǝ请ɵ后ɬǖ重算。ƨͶ按ȷ价。|̅ƈǜ适用Ə。ХΗ会˳此条ʧ预定调价,已Д的ǖƏ仍ͳ。|ȢƏ|新ƒ ID(如 ɋ)|Ȝƒ|ǭ与ƾ|ǩ中…|ƛǩƿ:{Ʃ}|已ƛǩ {ƕ}|ȡʹ后ƛǩ|ɵ用Ɵ΍Ə̃Ə表?|Т|˳|从Ɵ΍ƾƏ|Ɵƾ只ș ƥ Ə(含Ȗ);z-ai/έ/͊/ʙ 等第三方Ə随版本ș,ЕƏ表ʫПВΗ,或用ƒ名ʥ调整。|ɵȺȔǖ?|Ɏǖ|ɵʪ?将ЙȔƗ˺,只补dzн的Ǯ与Ɨ,不Ή已有ǰ。|Ɏǖƿ:{Ʃ}|首次启动ƛʪ旧ǰ;拷入˺З重跑。按ǜƏ回推;已͹˺无法Й,跨ʩ时刻的ƗͲ此前Ʈ。|ɵȺ|ȺȔǖ|Яƾ:{ƕ}|从未(ɬ˰Ə)|;ȹ:{Ƽ}|Ɵ΍|˰Ȣ|йф|ч ˒(ƛ)|{ʞ} ƶƿ|ƾƶƿ|Ƌƞƶƿ'],["en",`ʾ ƃ {Ɗ} · ы {ʝ} · ɚ {Ʒ} · ǹ {Lj} · Ȱ {ƻ}|ʾ ƃ {Ɗ}|ʗ Ɗ Ɍ|̥|я Ƕs ͯ Ϭ Ɯs × {ʠ}. To comp˓ ơ я bills, Ѐ я, ƭn ̭ Ɯs; ̭ing affects Ɍ ѯ lj.|ƀ ϗ ǧ: {Ʃ}|̒ error|ƀ|ƥ Ɓ|Above ƭ Ʒ ь|ƫ ǣ ɨ|ƫ ǣ Ʒ ь|Ǖ ǣ Ʒ ь|Λ locations|Ϗ ǧ|Cross-check ơ Ɓ θ against ƭ Ʌ ǿ (warn χ ƭy diverge)|Ϊ {ɔ} · ̤ {ɫ}|UpɊd {ƕ}|nj ({Ƴ})|˞ {Ȓ} / {Ɗ}|ʾ ǵ {ǵ} · Λ ƕ {Ƕ}|nj|Ǟ's ǟ (calculated using ȅ Ȋ)|Ǟ's ɪ Nj|Ɩ|C̦s {lj} · ɚ {Ʒ} · ǹ {Lj} · Ȱ {ƻ}|ʾ ǵ {Ɗ}|Λ ƕ {Ɗ}|Ǟ|ƫ ɇ Ƭ|Ƿ|Ʀ Nj|Ǟ|ʾ ǵ|Λ ƕ|ȯ ̚|No Ɲ Ѧ. Once you ͫ chatting, ǟs ˓ ˟ Ϸ Ѳ љ.|Ϟ|C̦s|In ѣ|ǹ ѣ|Out ѣ|Ƿ|No ƃs ͣ ɇ.|Ȧ|ǥ Ʋ|nj Ɗ (in Ƭ NJ)|nj Ƴ|̑ Ɋ|End Ɋ (Ʉ = ɇ)|Range: {̚}|ǥ a Ʋ to see ѷ ͟, Ȓ Ɗ ǣ ˦ in ƭ Ƭ NJ. Choose ɇ, ǵ, ̦ ƕ or a ƌ ̚.|{Ƴ} Ʋ {Ɗ} · ˞ {Ȓ} · {ѝ}%| (ѱ ͟)| (near ͟)|˘|ʐ f̦Ѭ|ɜ|Ο|Μ-Ɛ|ƺ|ƀ Ǹ Ν|ƀ Ƽ|̞ (Ƙ Ν ͛)|˒ Ǧ w̦et|͎ Ǧs or dedicated Νs ɻ.|ɂ {Ƕ} · Ϊ {ɔ} · ̤ {ɫ} · UpɊd {ƕ}|ƀ ϗ ǧ: {Ʃ}|ƀ Ɇ|̈ Ɓ|ƣing…|ƣ Ɓ|ȯ ˎ Ɓ|ˑ ϖ|ˑ Ʀ ˝ Ɓ|ʗs available я Ɓ ʜ ƭ ơ Ǧ ̩. Sign in at ɪrhythm.Ё. In Ȅ ́, copy ƭ Ǧ ɧ ʜ Netѥ, or ƭ tr_ƃ Ϛ ʜ Storage / Application. γ it beѸ ǣ ɡ ɩ ͕. ʏs Ѡ in ƭ ˒ Ɖ ͬ; φ ƭm χ expired.|ˑ Qianwen / ɸ Ɓ|ʗs ɸ China funds. RAM Ȯ needs bss:Ǥ. Ѫ ͛ two ͚ ˓ ͥ; ͍ Ʀ is ν STS. ϩs Ѡ in ƭ Ɖ ͬ.|Ѷ paths, numbers, nested add/ͭ/͠/ϲ/ѹ/max/sum, or ȑ νmulas. Example ƪ: {"ȑ":"(ɉ.Ƕ - ɉ.Ȓ) / 500000"}. ʻ ͚ ǣ unѷ to Ђ endpoint; put Ȓ Ɗs in ͪ.|ɑ ρ|Φ ρ|β URL|SupϽs ͅ, Ʌ Ϋ ǣ /σ/… paths ѡ ͜ ƭ ȅ ˒ Ͻ.|Λow non-loopѬ Ϋ (plaintext Ɖs; ͦ ƭ exact ˊ:Ͻ in ̦owed ˊs)|+ ǚ ǐ|Ѫ ǚ pͧ ͢ ƪ ǐ across ϭ Ǧs using an adѹ X-Adѹ-Ʀ, ϻ a Ƙ Ǹ Ν. Set ƭ ͒ ̔ ǣ Ͻ; φ ƭ Ɖ χ it μ.|Ϋ ʞ|̎ (ʑ)|β body (ʑ)|Blank sends no body; ʑ text is џ ǣ sent as entered. ʎ Ȩs to ˂/json; ̗ can ɦ it.|Χ rules (ʑ)|ȯ Ɓ Ƭ|ƣ Ǡ (Ȇ)|Ɠ NJ|̌ Ϭ Ɓ to Ƭ NJ|Ѷs ƭ Ƭ ʠ ǣ ̪. Keep ƭ Ƽ NJ; oƭr currencies ǣ ǐ Ѡ unϱd.|ƀ {Ɗ}|Ǟ {Ɗ}|ϒ {Ɗ}|ѧgress ј direction|ǔ (ϵ → Ʉ)|˞ (Ʉ → ϵ)|nj cap (ǡ)|Ǽ Ɓ Ɍ ϙ a Ʋ cap is set.|ˑ ˛ Ǹ ǐ|Grant Ɗ (Ϭ)|̑ Ɋ (ϔ)|Expiration Ɋ (ϔ)|View ˛ credit ϶|̠ ƪ ǐ equal ƭ grant Ɗ Ѯ organization Ǹ ǟs. ω ƭ Ɋs ʜ ȋ ϶. Ѫ ˇ μ at 00:00 ϔ on ƭ expiration Ɋ.|Grant {Ƕ} · ʕ ǟs {Ȓ} · ̠ ƪ {ƪ} · Expires {ϳ} ϔ|̏ ʑ|{{і_NAME}} ͢ a Ɖ or ˆ variable. <ϐ>_Ǹ_ё ͯs an upѲcase ɛ ID Ͱ underscores, such as ̨ai→ϣ_Ǹ_ё. Names can sh˓ a Ν.|̉ ˊs (Ɉ)|ї ̗ carry Ɖs Ɍ listed ˊs ˓ ̦owed; leave Ʉ to ̦ow Ͱ a warning. ѧtects Νs χ ͝ing someone else's config.|ɘ Ʒ|Store ƭ Ν ν ѭ {{і}} placehѰer above (write-Ɍ: ͬd in ƭ ˒ Ɖ ͬ, Ȫ):|No {{і}} placehѰers in ƭ ̗ Ѧ — add e.g. "ɹ": "Be˓r {{MY_Ǹ_ё}}" ǣ a Ɖ Ʒ Ѥ appear Ϸ.|ǥ|ǔ {ƪ} · ϒ {ͪ} / nj {maxnj} · UpɊd {ƕ}|ǔ {Ɗ}|ƣ ƌ Ɓ|LJ ʣ Ɔ|Go|ʖ 5h|ȍ|ǘ|ʀs: {ƕ}|ʀ ƕ rѭed|{d}d {h}h ћ|{h}h {m}m ћ|{m}m ћ|ʀs in {h}h {m}m|ʀs in {m}m|ʀs {ƕ}|At ɩ ˩’s average pace, ͟ expected {ƕ}|{ѝ}% Ȓ|{ѝ}% ƪ|{ς}%|UpɊd {ƕ}|Go Ɔ Ƭ Ƨ|Go Ɔ ƙ Ǡ (Ȇ)|LJ Ǹ Ν (ǡ; Ʉ = ˃)|Go Ɔ primary ˩|Go ь Ǚ|ɗ (Ƽ: {Ƽ})|Ϣ ɠ|γ|ѩ Ɖ|ʶ|͌…|Ѫ Ν is written to ƭ ˒ Ɖ ͬ Ɍ — it is never џ in ƭ ǿ ǣ Ȫ.|Ѫse Ɖs Ͽ in ƭ Ʌ ǿ. ExϽ ƭ ˋ ˆ variables ǣ reͫ:|nj ь Ǚ|ƣ Ɔ|ƚ Ɇ|ɼ (˕/Max)|Z.ai / Zhipu GLM Ƹ Ƅ|Personal or team GLM Ƹ Ƅ Ǹ Ν|Ƹ Ƅ Ǹ Ν ͥ|ˑ ʵ Ɔ|ʔ M Ƅ / Ʀ Ƅ|ʔ Ƅ|ƚ ϼ (ͅ)|ɽ: ơ sites. Oƭrwise ƭ ɾ is sent Ɍ to ɩ ϼ. Ѷ a trusted ̔ Ͱout a path.|5h|7d|є ƥ Nj ǣ top-up|Σ (Ǻ) Ɔ|Ǻ Ɔ is disabled · ̕ to ɡ|5h Ɔ|ȍ Ɔ|ͧs {ƕ}|ƚ ː. ǥ ǣ sign in to ƭ Ѐed Ƽ; ̕ to retry.|ʗ Ǻ Ɔ (ͦ a signed-in Ǻ plugin)|ʗ Ǻ Ɔ in ƴ|ʗ Ǻ Ɔ above ˅|ά ̬ in ƃ ǟ|No Ɔ ɉ|Dž Ƨ|Ǹ Ν (ǡ; Ʉ = ˃)|ƣ Ǡ (Ȇ)|ƣ|ύ|Signing in…|ƚ Ɇ|юѧxyǸ Ɣ Ɔs|ˑ Ƽ|Ɠ label|̼|Dž|ƣ Ǡ (Ȇ)|ɘ ̦owlist (ˊ:Ͻ, Ɉ)|˙ Ν (write-Ɍ)|͏|ˀ ˎs|̒|No Ǧs|fetched {ƕ}|Ϫ Ǧ (ȅ: {Ǧ})|̈́ Ɔ Ɍ|ƣ|ǥ ɩ item ͛|ǥ ǣ ѳ a Ƭ Ƨ to ƙ|ɜ|ǥd items move to ƭ top; ̕ a ρ to expǣ ѷ own ɨ. Up to 8 ƌ Ɓs ǣ 4 Ɣ Ƽs.|ǥ LJ rolling 5h, weekly ǣ ǵly Ɔs in ƭ ƴ, Ǖ ǣ bottom-right Ȳ. ί ɺ Ѵ a Ͼ.|ʌ (κ) Ƭ|ʖ-5h Ɔ|ȍ Ɔ|ǘ Ɔ|nj Ȓ %|5h|Wk|Mo|̿|nj|͆ ў ǧ: {Ʃ}|Reading ǿ…|͆ ː|͐ ǧ: {Ʃ}|Ȃ cle˓d.|ʶ ǧ: {Ʃ}|ƺ/ќ-Ɛ ǒ is ќ; base Ɯs ˓ Ȓ|Ϣ Ѧ ʄ (ʄ at {ƕ}); base Ɯs ˓ ȅly Ȓ|ƺ hour now; Ɛ Ɯs ʂ|ƥ Ɛ-hour ǒ is ϭ; ȅ lj ˓ ˠ at Ɛ Ɯs|Μ-Ɛ now; ќ-Ɛ Ɯs ʂ|̓ — ̦ ќ-Ɛ (Sat & Sun ˠ at ќ-Ɛ Ɯs ̦ љ)|̓ — ̦ ќ-Ɛ|̓|ɑ public ɕ — ќ-Ɛ ̦ љ|Ϧ ɕ — ̦ ќ-Ɛ|Holiљ|Ϧ ɕs (Π Ɋs, comma sepaʠd)|Since Aug 23, 2026 (Π ƕ), Ƣ ќ-Ɛ ̦ љ, ʆ ѥ-shift ʤs.|ƺ|Μ-Ɛ|ƺ Ƴ strip style|ɒ (one-line)|̽ic (segments & chip)|Popup ϕ beνe Ɛ/ќ-Ɛ switch|Lead ƕ (Ȇ, 1-30)|Ƥ type|ə Ɛ|ə ќ-Ɛ|Ρ|ə Ɛ ˣ|ə ќ-Ɛ ˣ|̋ switches to {phase} ǒ in about {ƕ}; ѹd Ђ c̦ ǟs in ɩ ˩.|Ɛ|ќ-Ɛ|Got it|ƺ ϕ|Μ-Ɛ ϕ|Popup Ƨ|ʌ|Screen center|Also send a system ʟ|ї ɡd, ̦ow ʟ Ѳmission in ƭ Ȅ ̔ ј so you get ϕed even χ ƭ ̩ is ѹimized or Ѭgrounded.|ȃ ƭ popup|ȃ ͙ Ɛ|ȃ ͙ ќ-Ɛ| (preview)|ƺ/ќ-Ɛ ǒ & ͡|˚ ϸ: ɡ Ɛ/ќ-Ɛ ǒ ǣ ƭ “proѹent ͡” toggle.|Ω|Money & NJ|ƫ Ƭ|Simplify ƭ ƴ|Dismiss guide|Reͬ ͤd Ƈ ({͘})|ɜ ͖s ƭ ɦ ǣ Ϲs ƭ row ϙ ̜d. ˁ ʡ ˓ kept; ϯmatic Ɯ ˋ ζ.|̾ chips|Box Ǚ|Unmount|UnƜd|ȯ|You edited ɩ Ɯ manu̦y; ̧ Ѥ ϻ ѱwrite it.|Resume ̧|Per-Ƙ statistics (Ɩ & ǟ)|ƫ Ƙ ǟs|{n} Ƈ|Oƭr|ʗ Ƙ ǟ ͕|Expǣ by Ȩ|Remember expansion|ʗ Ɩ|ʗ ǟ sh˓s|ѫ Ƙ in Ȳ κ|ʐ Ƴ|Collapsed ̝|Card Ƨ|ɿ rows (1–10)|ƣ Ǡ (10–60 seconds)|ϥ Ƕ ǣ Ƙ ͘|ѫ Ƙ ǣ ǟ|ѫ|After Ɓs|Bottom|Ǟ|ђ 90 љs|Ƿ ̛|Ʀ Nj|ǹ hit ʠ|unreϽed?|Zero Lj hѷ on long lj may mean a relay ͤd Lj ͚. Λ-miss ǟ ȩ; check Ͱ ƭ direct Ǹ.|Value · Ɩ Ѳ Ϭ|ɚ|ǹ|Ȱ|No Nj ɉ ɤ Ƴ.|blended {Ɯ}/M|ы ʠ = Lj ͢ ÷ (͢ + unLjd Ʒ). “ɝ?” means Lj ɉ may be π, so ǟ ȩ. ѕ Ɯ = ǟ ÷ Ɩ × 1M; Ϛ = Ɩ ÷ ǟ.|Unattributed (early ɉ · ˠ as ͣ)|ʾ ƃ {Ɗ} (Ǹ) · Ƅ equiv. {ǑϜ} · ы {ʝ} · ɚ {Ʒ} · ǹ {Lj} · Ȱ {ƻ}|ʾ ƃ {Ɗ} (Ǹ) · Ƅ equiv. {ǑϜ}|Ʀ Ƅ Nj stats (Ѳ-1% & ˈ ʅ)|No Ƹ Ƅ Ɔ ɉ Ѧ. ǥ ǣ ƙ a ˎ under ƚs.|Ȏ|˞ %|ʾ Ƴ ͒ (Ʌ ǿ)|Per 1% Ɔ ≈|Full ˩ (100%) ≈|ͧs {ƕ}|ͨ delta|ȅ Nj ratio|ϻ ɢ|{ʞ} (as of {ƕ})|Ѹ υ ̪|Ƅ Nj curves (˟ ʜ ͨ Ǡs)|̿|ȍ|ǘ|Ϣ ɢ: ƙ successϵy twice Ͱ a Ɔ ˦ ϱ.|{Ɋ}: ˈ est. ≈ {ϵ} (Ѳ 1% ≈ {Ѳ1}) · ͒ {Ɩ} / {ǟ} · {Ǡs} ͨ Ǡ(s)|Ξ ˓ η-Ɯ ˡs. Ƅs ͯ Ɔ; Ʋs ͘ Ǹ Ɍ. Estimates cѱ dsh lj, while server ˦s cѱ ƭ Ǧ. ȧ ͨs ˓ Ѯ precise. 5h rolls; week/ǵ ͯ Ʌ Ɋs.|̋ class|Ƅ ʣ|̞|Ǹ Nj|Sepaʠ ˥s|Try 2 × 0.8|Changing ƭ ˥ ζ to ̦ Ȋ ɤ Ƙ|Change ɩ ʠ Ɍ; uncheck ˨ ƭ sh˓d ˥|ω a non-negative ʠ or multiplication, e.g. 2 × 0.8|˔ ɖ Ƙ ρs|̞ (strip suffix / prefix / family similarity)|Exact match Ɍ|Manual assignments ǣ ˎ Ɯs ɻ. ˔ recognizes ˡ ρs ǣ Ɋ tags.|ƥ Ȩ Ɯ|ɜ|Unmatched ǣ manu̦y ɠ Ƈ|Set ѭ ι ǣ Ƙ sepaʠly: Ѐ a η ϖ, ͯ a ƌ Ɯ, or mark as Ʌ. ȯ Ɯs ʂ Ɍ to ѡ ι.|Ƿ|ˁ|ɚ|ǹ ў|ǹ write|Leave ͓ ͯ ƭ Lj-ў Ɯ|Ȱ|̡ / ͈|˜|ʽ|CommǣCode|˖|SCNet Ʀ Ƅ|ʙ Ark Ƹ Ƅ|͊ Ʀ Ƅ (ʇ.com)|Xiaomi MiMo Ʀ Ƅ|Baidu Qianfan Ʀ Ƅ|˞ / Ƕ|ȱ|Reads ȱ ǐ ȉ.|̍ (Droid)|Ȍ|Ȍ ȫ|Press ƭ button beѸ to get ƭ Ɖ ȉ (approve once in ƭ Ȅ), or paste a ɧ copied ʜ ́. Leave ƭ ȫ ͓ ў ƭ ȅ one; Υ ɾs need an explicit ȫ ǣ inference Ǹ Νs do ϻ ѥ.|Get Ɔ Ɖ|ƚ pool|Stǣard + Core|ʕ ID (ǡ)|Ƅ ǐ|ʍ|ƀ|ƚ Ƽ|ʺ ˇ|Ǽ ю|̊ ю|Insț @ʇ/ˏ on ƭ ˒ ˊ ǣ run τ Ȑ as ƭ ʢ.|Insț ˄ on ƭ ˒ ˊ. ύ ̨s ѡ ˊ’s Ȅ; ν a remote or headѮ ˊ, run bl Ȑ --ʛ as ƭ ʢ.|ǘ ǐ Ɔ (Ѳsonal Lite 50K / Stǣard 500K; see Ђ Ǒ ̩)|Ƅ ͫ Ɋ (ǡ, ȏ; Ʉ = ͔ ǵ)|DŽ ʠ ɦs (ǡ; ǐ deducted Ѳ 1M Ɩ; Ʉ = ɟ)|ɿ ρ, e.g. ɍ3.8-ˌ|ω ̦ three positive Ȋ to ѳ ȉ; ͖ ̦ ˨ ƭ ɟ.|ˑ|ʺ DŽ ˇ; ʛ is authoritative. Counts Ƅ lj assigned to ͊. Excludes pay-as-you-go Ǹ. ˑ Ȋ ν oƭr Ƈ.|ǘ ǐ Ɔ ν Ʌ ʅ (Basic 60,000 / Stǣard 240,000 / ѧ 600,000)|Ƅ ͫ Ɋ (ǡ, ȏ; Ʉ = ͔ ǵ)|Ѷs ʛ ͩs ѯer than 24h, ƭn ʅ ʜ Ʌ ʡ ǣ ơ DŽ Ȋ. Oƭr tools ǣ unlisted Ƈ ˓ excluded.|ɞ Ȯ ID|ɞ ϩȮ|AK...|SK...|{h}h|{h}h {m}m|{m}m|Μ-Ɛ in {ƕ}|ƺ in {ƕ}|ƺ ̘ ({ѵ}): {˩s}; ʄ: {ƕ}. {˧}|No Ɛ ˩s ɠ. {˧}|ɖ|Ǟ|ʾ ǵ|Λ ƕ|Since ƭ ǿ was created · C̦s {lj}|̓ Nj|˒ + ɣ Ƕ|̓ ͩ has ϻ been upɊd ν 24 ̘|͋ daily ʡ|Ξ ͯ ƭ latest ͩ ǣ may lag ƭ ơ bill by Ȇ. Ʀs ̙ Ʒ, ƻ, Lj ǣ ̫; ̫ is ˠ Ͱ ƻ. Reconcile by Ɗ.|Ǟ/ǵ ͯ ˊ ƕѵ {ˊ}; ɩ Ȅ ͯs {Ȅ}. Different љ boundaries affect reconciliation. Set dsh to Ђ Ʌ ƕѵ to align.|Ǟ's ƃs|ʷ a Ɋ row to expǣ ѷ ƃ Ǚ|ʒ ƃ Ǚ…|No ƃ Ǚ ɤ љ (early ɉ or ƃ Ϻ cleaned)|ƹ to load ƃ Ǚ|By ƃ (̦ Ɲ)|Days ͗; ̬ ͜ ɨ. ͎ rows Ѵn; cumulative ǟs ̙ every conversation.|No ƃ ɉ Ѧ|ʒ ƃ ̛…|ƹ to load ƃ ̛|Rows|ά Ǒ Ƕs|ї on, every Ɗ Ѵs Ƕ ˡ ǟ ʆ Ǒ ɺ; ќ (Ȩ) ͘s real-money Ǹ ιs Ɍ|ѐ header ǟ Ǚ|ѐ ˅ ǟ Ǚ|ѐ turn ǟ summaries|̣|Ƿ high→Ѹ|Ƿ Ѹ→high|ϫ ѯ→Ѱ|ϫ Ѱ→ѯ|͋ order|Ȃ|Ʀ Nj stats|Λ-ƕ {Ɩ} Ɩ · Ʒ {Ʒ} · Lj {Lj} · ƻ {ƻ} · {lj} lj|{Ɋ}: {Ɩ} Ɩ (Ʒ {Ʒ} · Lj {Lj} · ƻ {ƻ}) · {lj} lj · {ǟ}|No Ɲ Ѧ — daily Nj Ѥ accumulate Ϸ|͉|ƚs|ˁ|α|ƫ|Dž ɨ →|Dž|Ȃ ɉ|Ȧ ǟ Ƭ Ƨ|BeѸ ƭ ˅|Ȧ title ј|Μ|Ǿ Ʋ Ȓ %|Ǿ ƭ Go Ɔ|Ǿ Ƒ Ǒ Ɔs|Page ξ ƕd out. Please retry.|ƀ ϸ|ʷ ƭ ρ to Ϲ/Ѵ; ̕ ƭ Ɗ to ƙ|ʷ to ƙ now|ʷ a ƴ Ɓ or Ǒ ь to ƙ. It pulses while ξ; on failure it keeps ƭ Ѱ Ϛ ǣ Ѵs ƭ Ͼ on hѱ.|Got it|Ǟ ǟ Ƭ|ƫ footer|ȣ|Exϱ ʠ (1 Ϭ = ? target NJ)|Decimal places|ƀ Ƭ Ƨ|Main ƴ|Ǖ ̩|Ρ|ƀ ƙ Ǡ (Ȇ)|Ѷ ƥ Ɛ-hour Ɯs|ѧѹent ͡ during Ɛ ̘ (ƴ Ʋ ь, ɇ's ǟ; previewed in ƭ Ǖ Ɛ panel)|Mounted Ɯ ͮs|Ǽ Ɯ NJ|Ϭ (Φ ơ ̩)|я (ɑ ơ ̩)|Selects ƭ ơ ǒ-̩ ͞. ͐ed Ɯs ʂ to subsequent lj.|ѧ ǣ ʹ ͯ sepaʠ ơ Ȋ; ˤ ʹ ρs ͯ ʹ Ȋ. Weekљ Ɛs ˓ 01–04 ǣ 06–10 ϔ; Ƣ ќ-Ɛ. Rate θ ʂ to later lj. Recorded Ɗs Ͽ ϙ you ɓ ˢ recalculation. ǹ writes ͯ hit Ȋ.|Current Ȋ ˓ Ѵn Ϸ. ѩing ϰs any future scheduled ϱ ɤ ϖ; λ ˢ Ȋ ˓ retained.|ʐ Ɯ|New Ƙ ID (e.g. ɋ)|ˑ Ƙ|Data & ̭|͌…|̞-ѳ ǧ: {Ʃ}|̞-џ {ƕ}|Ǖ ˓ ϯ-џ|Overwrite ƭ Ɯ ͮ Ͱ Ɯs ʜ ƭ ơ њ?|Apply|Cancel|͐ Ɯs ʜ ơ њ|Ǽ ̭ upɊs ƥ Ɯs (ʆ Ɛ Ȋ). Third-party Ɯs (z-ai/έ/͊/ʙ) ͜ releases; expǣ a vendor ˉ in ƭ Ɯ ͮ or ͯ Ƙ ˋ.|ʶ ̦ Ɲ?|˗ ˍ Ɲ|Τ ͝? Replays ̦ ƃ Ϻ ǣ Ɍ fills Ɋs/ƃs π ʜ ƭ ǿ; existing ʡ ˓ untouched.|ƹ to ͝ ˍ Ɲ: {Ʃ}|Pre-insț Ɲ ͝s at ͛ launch; rerun after copying Ѱ Ϻ. Ƿs ͯ ȅ Ɯs. Deleted Ϻ canϻ replay; ƃs spanning insțation exclude λ Nj.|Τ ͖|ʶ ̦ Ɲ|ђ ̭: {ƕ}|Never (bundled Ɯs)|; Ɠ: {Ƽ}|Ǽ њ|΢|Language|FolѸ ˒ (ϯ)|{ʞ} c̦ ǧ|͐ c̦ ǧ|ƀ ƙ c̦ ǧ`]].map(([e,t])=>{const n=Ha(t).split("|");return[e,Object.fromEntries(bs.map((a,o)=>[a,n[o]]).filter(([,a])=>a!=="\0"))]}));function Wa(){return(typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language:"").toLowerCase().startsWith("zh")?"zh":"en"}function Xe(e){const t=typeof e=="string"?e.toLowerCase().split(/[-_]/)[0]:"";return t==="zh"||t==="en"?t:null}function F(e){const t=typeof e=="string"?e:e?.locale;return t==="zh"||t==="en"?t:Xe(e?.activeLocale)||Wa()}function Y(e){const t=e==="zh"?Ie.zh:Ie.en;return(n,a)=>{let o=t[n]??Ie.en[n]??n;if(a)for(const i of Object.keys(a))o=o.split("{"+i+"}").join(String(a[i]));return o}}const et={day:"periodDay",month:"periodMonth",all:"periodAll",custom:"periodCustomRange"};function te(e,t){throw new Error("dsh-cost-meter: 服务端数据非法 ("+e+": "+t+")")}function de(e,t){return(e===null||typeof e!="object"||Array.isArray(e))&&te(t,"object"),e}function Z(e,t){return(typeof e!="number"||!Number.isFinite(e))&&te(t,"number"),e}function X(e,t){return typeof e!="string"&&te(t,"string"),e}const je=(e,t,n)=>typeof e=="string"&&t.includes(e)?e:n;function $a(e,t=!1){return e===null||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([n,a])=>t?n.length>0&&["plan","api"].includes(a):["auto","plan","api"].includes(a)))}function xe(e,t){return typeof e!="boolean"&&te(t,"boolean"),e}const Ue=(e,t,n)=>Object.fromEntries(t.map(a=>[a,n(e[a])]));function Ka(e,t){const n={};if(e!==null&&typeof e=="object"&&!Array.isArray(e))for(const a of Object.keys(e)){const o=e[a];if(o===null||typeof o!="object"||Array.isArray(o))continue;const i=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:0;n[a]={...Ht(o),...Ue(o,["input","output","cacheRead","cacheWrite","reasoning","cost"],i),apiCost:o.apiCost===void 0?i(o.cost):i(o.apiCost)}}return n}const kt=["costCny","apiCostCny","costEur","apiCostEur"],Ht=e=>Object.fromEntries(kt.filter(t=>Number.isFinite(e?.[t])).map(t=>[t,e[t]]));function za(e,t){de(e,t);const n={...Ht(e),reasoning:e.reasoning===void 0?0:Z(e.reasoning,t+".reasoning"),apiCost:e.apiCost===void 0?void 0:Z(e.apiCost,t+".apiCost"),byModel:Ka(e.byModel,t+".byModel"),byProviderModel:Ka(e.byProviderModel,t+".byProviderModel")};for(const a of["input","output","cacheRead","cacheWrite","calls","cost"])n[a]=Z(e[a],t+"."+a);return n}function gs(e){return e==null?void 0:{source:X(e.source,"source"),requestId:X(e.requestId,"requestId"),attempt:Z(e.attempt,"attempt"),complete:xe(e.complete,"complete"),status:X(e.status,"status"),upstream:X(e.upstream,"upstream")}}function Ga(e){return(Array.isArray(e)?e:te("rows","array")).map(t=>({provider:X(t.provider,"provider"),model:X(t.model,"model"),bucket:X(t.bucket,"bucket"),tokens:Z(t.tokens,"tokens"),...t.requests===void 0?{}:{requests:Z(t.requests,"requests")},rate:Z(t.rate,"rate"),cost:Z(t.cost,"cost"),priced:xe(t.priced,"priced"),plan:xe(t.plan,"plan")}))}function Wt(e,t){return{...za(e,t),id:X(e.id,t+".id"),provider:typeof e.provider=="string"?e.provider:"",model:typeof e.model=="string"?e.model:""}}function we(e,t){const n={...za(e,t),date:X(e.date,t+".date"),sessions:[]};return e.sessions!==void 0&&(Array.isArray(e.sessions)||te(t+".sessions","array"),n.sessions=e.sessions.map((a,o)=>Wt(a,t+".sessions["+o+"]"))),n}function $t(e,t,n=["cacheWrite","reasoning"]){const a={};for(const o of["cacheHit","cacheMiss","output"])a[o]=Z(e[o],t+"."+o);for(const o of n)e[o]!==void 0&&(a[o]=Z(e[o],t+"."+o));return a}function Kt(e,t){de(e,t);const n={...$t(e,t),...wt(e)};for(const a of["offPeak","peak","legacyBase","longContext"])e[a]!==void 0&&(n[a]=$t(e[a],t+"."+a,["cacheWrite","reasoning","aboveInputTokens"]));e.cny!==void 0&&(n.cny=$t(e.cny,t+".cny")),e.legacy!==void 0&&(n.legacy=xe(e.legacy,t+".legacy")),e.rateHistory!==void 0&&((!Array.isArray(e.rateHistory)||e.rateHistory.length>16)&&te(t+".rateHistory","price history"),n.rateHistory=e.rateHistory.map((a,o)=>((!a||typeof a.before!="string"||!Number.isFinite(Date.parse(a.before)))&&te(t+".rateHistory","dated price"),{...Kt({...a,rateHistory:void 0},t+".rateHistory."+o),before:a.before}))),Object.assign(n,xt(e));for(const a of["billingMode","sourceUrl","checkedAt","notes"])typeof e[a]=="string"&&(n[a]=e[a]);return n}function ys(e,t){const n=o=>o==null?void 0:{...["aliyun","tokenrhythm","openai-credits","fireworks"].includes(o.adapter)?{adapter:o.adapter}:{},...o.adapter==="openai-credits"?{grantAmount:me(o.grantAmount),grantStart:o.grantStart??"",grantExpiry:o.grantExpiry??""}:{},enabled:o.enabled===!0,label:typeof o.label=="string"?o.label:"",labelEn:typeof o.labelEn=="string"?o.labelEn:"",dashboardUrl:typeof o.dashboardUrl=="string"?o.dashboardUrl:"",display:je(o.display,["sidebar","settings","off"],"both"),unit:o.adapter==="tokenrhythm"?"CNY":["CNY","EUR","CREDITS"].includes(o.unit)?o.unit:"USD",convertToDisplayCurrency:o.convertToDisplayCurrency===!0,allowInsecureHttp:o.allowInsecureHttp===!0,refreshMinutes:typeof o.refreshMinutes=="number"&&Number.isFinite(o.refreshMinutes)?o.refreshMinutes:15,request:o.request&&typeof o.request=="object"?o.request:{url:""},extract:o.extract&&typeof o.extract=="object"?o.extract:{},...Array.isArray(o?.channels)?{channels:o.channels.filter(i=>typeof i=="string")}:{},allowedHosts:Array.isArray(o?.allowedHosts)?o.allowedHosts.filter(i=>typeof i=="string"):[]};de(e,t);const a={};if(e.prices!==null&&typeof e.prices=="object"&&e.prices.models!==null&&typeof e.prices.models=="object")for(const o of Object.keys(e.prices.models))a[o]=Kt(e.prices.models[o],t+".prices.models."+o);return{queryAccounts:e.queryAccounts&&typeof e.queryAccounts=="object"?e.queryAccounts:{},locale:e.locale==="zh"||e.locale==="en"||e.locale==="auto"?e.locale:"auto",position:e.position==="header"||e.position==="off"?e.position:"dock",sidebar:e.sidebar!==!1,showSessionId:e.showSessionId===!0,hideOfficialBalance:e.hideOfficialBalance===!0,hideCustomBalance:e.hideCustomBalance===!0,hideTodayCost:e.hideTodayCost===!0,sessionListCostPeriod:e.sessionListCostPeriod==="today"?"today":"total",modelStatistics:e.modelStatistics??{},...Ue(e,["hideSessionCostHeader","hideSessionCostDock","hideTurnCost","followSkinTransparency","sidebarTodayBalanceInline","sessionListCosts","hideBudget","sessionCostCompact","contextCostsEnabled","contextCostsPromptSeen","showTotalWithPlan","sidebarSimple","codexQuotaEnabled","codexCompatPromptDismissed","includeSubagentCost","peakEnabled","peakAlertWebNotify"],o=>o===!0),sidebarTodayMetric:["tokens","both"].includes(e.sidebarTodayMetric)?e.sidebarTodayMetric:"cost",sidebarTextOnly:e.sidebarTextOnly===!0,localSavings:e.localSavings,...Object.hasOwn(e,"sidebarOrder")?{sidebarOrder:Array.isArray(e.sidebarOrder)?e.sidebarOrder:[]}:{},statisticsBasis:e.statisticsBasis,sidebarModels:Object.fromEntries(Object.entries($n).map(([o,i])=>[o,e.sidebarModels?.[o]??i])),codexQuotaSidebar:e.codexQuotaSidebar!==!1,codexQuotaStrip:e.codexQuotaStrip!==!1,codexQuotaSource:["connect","subscription","chatgpt","pi-ai","chatgpt-sub"].includes(e.codexQuotaSource)?e.codexQuotaSource:"auto",codexCompatHistoryAppliedAt:me(e.codexCompatHistoryAppliedAt),sidebarStyle:je(e.sidebarStyle,["standard","compact","summary","icons"],"standard"),planQuotaStyle:e.planQuotaStyle==="gauge"?"gauge":"bars",...Ue(e,["sidebarSimplePromptSeen","sidebarSummaryPromptSeen","peakProgressPromptSeen"].filter(o=>Object.hasOwn(e,o)),o=>o===!0),billionContextNoticeEnabled:e.billionContextNoticeEnabled!==!1,billionContextNoticesSeen:Array.isArray(e.billionContextNoticesSeen)?e.billionContextNoticesSeen.filter(o=>typeof o=="string").slice(-32):[],priceMatchDismissed:Array.isArray(e.priceMatchDismissed)?e.priceMatchDismissed.filter(o=>typeof o=="string"):[],pricingCurrency:e.pricingCurrency==="CNY"?"CNY":"USD",currency:typeof e.currency=="string"?e.currency:"CNY",symbol:typeof e.symbol=="string"?e.symbol:"¥",decimals:Z(e.decimals,t+".decimals"),exchangeRate:Z(e.exchangeRate,t+".exchangeRate"),exchangeRateAuto:e.exchangeRateAuto!==!1,fxRates:e.fxRates,exchangeRateDate:e.exchangeRateDate??"",exchangeRateCheckedAt:e.exchangeRateCheckedAt??0,peakEffectiveAt:typeof e.peakEffectiveAt=="string"?e.peakEffectiveAt:"",peakWindows:Array.isArray(e.peakWindows)?e.peakWindows.map((o,i)=>({start:Z(o.start,t+".peakWindows["+i+"].start"),end:Z(o.end,t+".peakWindows["+i+"].end")})):[],peakHolidays:Array.isArray(e.peakHolidays)?e.peakHolidays.filter(o=>typeof o=="string"):[],peakNotice:e.peakNotice!==!1,peakAlertEnabled:e.peakAlertEnabled!==!1,peakAlertAhead:Number.isFinite(e.peakAlertAhead)&&e.peakAlertAhead>=1&&e.peakAlertAhead<=30?e.peakAlertAhead:2,peakAlertTarget:e.peakAlertTarget==="peak"||e.peakAlertTarget==="offpeak"?e.peakAlertTarget:"both",peakAlertPosition:e.peakAlertPosition==="center"?"center":"corner",peakStyle:["classic","progress"].includes(e.peakStyle)?e.peakStyle:"compact",peakTimeZone:typeof e.peakTimeZone=="string"?e.peakTimeZone:"auto",peakTimeDisplay:["countdown","switch"].includes(e.peakTimeDisplay)?e.peakTimeDisplay:"both",priceMatch:e.priceMatch==="exact"?"exact":"auto",priceOverrides:(()=>{const o={};if(e.priceOverrides!==null&&typeof e.priceOverrides=="object"&&!Array.isArray(e.priceOverrides))for(const[i,r]of Object.entries(e.priceOverrides))typeof i=="string"&&typeof r=="string"&&(o[i]=r);return o})(),priceTableDisplay:(()=>{const o={};if(e.priceTableDisplay!==null&&typeof e.priceTableDisplay=="object"&&!Array.isArray(e.priceTableDisplay))for(const[i,r]of Object.entries(e.priceTableDisplay))typeof i=="string"&&(o[i]=r===!0);return o})(),codingPlans:(()=>{const o={};if(e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans))for(const i of Object.keys(e.codingPlans)){const r=e.codingPlans[i];r===null||typeof r!="object"||Array.isArray(r)||(o[i]={enabled:r.enabled===!0,display:r.display==="sidebar"||r.display==="both"||r.display==="off"?r.display:"settings",...typeof r.sidebarAfterSuccess=="boolean"?{sidebarAfterSuccess:r.sidebarAfterSuccess}:{},...typeof r.showInComposer=="boolean"?{showInComposer:r.showInComposer}:{},refreshMinutes:typeof r.refreshMinutes=="number"&&Number.isFinite(r.refreshMinutes)?r.refreshMinutes:15,apiKey:typeof r.apiKey=="string"?r.apiKey:"",...i==="minimax"?{baseUrl:typeof r.baseUrl=="string"?r.baseUrl:""}:{},...i==="factory"?{orgId:typeof r.orgId=="string"?r.orgId:"",factoryPool:["core","both"].includes(r.factoryPool)?r.factoryPool:"standard"}:{},...i==="workbuddy"?{accountScope:r.accountScope??"current",accountIds:Array.isArray(r.accountIds)?r.accountIds:[],...typeof r.accountSource=="string"?{accountSource:r.accountSource}:{}}:{},...i==="opendesign"?{workspaceId:typeof r.workspaceId=="string"?r.workspaceId:""}:{},...i==="qwen"?{quotaSource:["cli","bailian"].includes(r.quotaSource)?r.quotaSource:"local"}:{},...typeof r.planCredits=="number"&&Number.isFinite(r.planCredits)&&r.planCredits>0?{planCredits:r.planCredits}:{},...typeof r.planStart=="string"?{planStart:r.planStart}:{},...r.rates!==null&&typeof r.rates=="object"&&!Array.isArray(r.rates)?{rates:r.rates}:{},...typeof r.accessKeyId=="string"?{accessKeyId:r.accessKeyId}:{},...typeof r.secretAccessKey=="string"?{secretAccessKey:r.secretAccessKey}:{}})}return o})(),prices:{models:a,...e.prices?.custom?{custom:e.prices.custom}:{},default:Kt(e.prices?.default??{cacheHit:0,cacheMiss:0,output:0},t+".prices.default"),providers:e.prices?.providers&&typeof e.prices.providers=="object"?e.prices.providers:{},currency:typeof e.prices?.currency=="string"&&e.prices.currency.length>0?e.prices.currency:void 0},historyDays:Z(e.historyDays,t+".historyDays"),billingStorageRetentionDays:[0,7,30].includes(e.billingStorageRetentionDays)?e.billingStorageRetentionDays:7,fetchedAt:e.fetchedAt===null||e.fetchedAt===void 0?null:X(e.fetchedAt,t+".fetchedAt"),priceSource:typeof e.priceSource=="string"?e.priceSource:"bundled",budget:{enabled:e.budget?.enabled===!0,amount:typeof e.budget?.amount=="number"&&Number.isFinite(e.budget.amount)?e.budget.amount:100,period:e.budget?.period==="day"||e.budget?.period==="all"||e.budget?.period==="custom"?e.budget.period:"month",customStart:typeof e.budget?.customStart=="string"?e.budget.customStart:null,customEnd:typeof e.budget?.customEnd=="string"?e.budget.customEnd:null,detail:e.budget?.detail!==!1},balance:{source:e.balance?.source==="account"?"account":"auto",display:je(e.balance?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.balance?.refreshMinutes=="number"&&Number.isFinite(e.balance.refreshMinutes)?e.balance.refreshMinutes:5,showProgressBar:e.balance?.showProgressBar===!0,showSource:e.balance?.showSource===!0,officialChannelOnly:e.balance?.officialChannelOnly===!0,quickHide:e.balance?.quickHide===!0,budgetCap:typeof e.balance?.budgetCap=="number"&&Number.isFinite(e.balance.budgetCap)&&e.balance.budgetCap>0?e.balance.budgetCap:null,currency:e.balance?.currency??"native",...Object.hasOwn(e.balance??{},"clickHintSeen")?{clickHintSeen:e.balance?.clickHintSeen===!0}:{}},goQuota:{enabled:e.goQuota?.enabled!==!1,...typeof e.goQuota?.showInComposer=="boolean"?{showInComposer:e.goQuota.showInComposer}:{},display:je(e.goQuota?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.goQuota?.refreshMinutes=="number"&&Number.isFinite(e.goQuota.refreshMinutes)?e.goQuota.refreshMinutes:15,apiKey:typeof e.goQuota?.apiKey=="string"?e.goQuota.apiKey:"",main:e.goQuota?.main==="weekly"||e.goQuota?.main==="monthly"?e.goQuota.main:"rolling",detail:e.goQuota?.detail!==!1},customBalance:n(e.customBalance),gatewayQuotas:(()=>{const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:e.gatewayQuotas?.sources;return{sources:Array.isArray(o)?o.slice(0,4).filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).map(r=>({id:typeof r.id=="string"?r.id.slice(0,48):"",type:r.type==="agy-link"?"agy-link":"cliproxyapi",label:typeof r.label=="string"?r.label.slice(0,80):"",baseURL:typeof r.baseURL=="string"?r.baseURL:"",enabled:r.enabled!==!1,display:je(r.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof r.refreshMinutes=="number"&&Number.isFinite(r.refreshMinutes)?Math.min(1440,Math.max(1,Math.floor(r.refreshMinutes))):15,includeProviders:Array.isArray(r.includeProviders)?[...new Set(r.includeProviders.filter(l=>typeof l=="string").map(l=>l.toLowerCase()).filter(l=>Vt.includes(l)))]:Vt,allowedHosts:Array.isArray(r.allowedHosts)?r.allowedHosts.filter(l=>typeof l=="string").slice(0,16):[],allowInsecureHttp:r.allowInsecureHttp===!0,antigravityOnlyGemini:r.antigravityOnlyGemini===!0,keyVar:typeof r.keyVar=="string"?r.keyVar:""})):[]}})(),customBalances:(()=>{if(Array.isArray(e.customBalances))return e.customBalances.filter(i=>i!==null&&typeof i=="object").slice(0,8).map(n).filter(Boolean);const o=n(e.customBalance);return o?[o]:[]})(),corner:{enabled:e.corner?.enabled===!0,goRolling:e.corner?.goRolling!==!1,goWeekly:e.corner?.goWeekly!==!1,goMonthly:e.corner?.goMonthly!==!1,budget:e.corner?.budget!==!1},quotaStrip:{enabled:e.quotaStrip?.enabled===!0,budget:e.quotaStrip?.budget!==!1,go:e.quotaStrip?.go!==!1,plans:e.quotaStrip?.plans!==!1,planAmounts:e.quotaStrip?.planAmounts!==!1,...Object.hasOwn(e.quotaStrip??{},"promptSeen")?{promptSeen:e.quotaStrip?.promptSeen===!0}:{}},usage:{position:e.usage?.position==="general"||e.usage?.position==="section"?e.usage.position:"cost"},barDirections:(()=>{const o=e.barDirections!==null&&typeof e.barDirections=="object"&&!Array.isArray(e.barDirections)?e.barDirections:{},i=(r,l)=>o[r]==="remaining"||o[r]==="used"?o[r]:l;return{balance:i("balance","remaining"),budget:i("budget","used"),go:i("go","used"),plan:i("plan","used")}})(),planBilling:{...Array.isArray(e.planBilling?.autoProviders)?{autoProviders:e.planBilling.autoProviders.filter(o=>Te.includes(o))}:{},providers:$a(e.planBilling?.providers),models:$a(e.planBilling?.models,!0),modelPlans:Object.fromEntries(Object.entries(e.planBilling?.modelPlans??{}).filter(([o,i])=>o.includes(":")&&Te.includes(i)))}}}const tt=e=>typeof e=="number"&&Number.isFinite(e)?e:null,me=e=>tt(e)??0,hs={status:"off",message:"",fetchedAt:0,currency:"",totalBalance:0,grantedBalance:0,toppedUpBalance:0},ks={status:"off",message:"",fetchedAt:0,rolling:null,weekly:null,monthly:null},Va=(e=null)=>({status:"off",message:"",fetchedAt:0,label:"",unit:"USD",remaining:0,maxBudget:null,spend:null,index:e});function zt(e,t){return de(e,t),{status:e.status==="ok"||e.status==="error"?e.status:"off",message:typeof e.message=="string"?e.message:"",fetchedAt:typeof e.fetchedAt=="number"?e.fetchedAt:0}}function Ya(e,t){return{...zt(e,t),keyConfigured:e.keyConfigured===!0,keySource:typeof e.keySource=="string"?e.keySource:"",currency:typeof e.currency=="string"?e.currency:"",totalBalance:me(e.totalBalance),grantedBalance:me(e.grantedBalance),toppedUpBalance:me(e.toppedUpBalance)}}function Gt(e,t){return e==null?null:((typeof e!="object"||Array.isArray(e))&&te(t,"object"),{percent:me(e.percent),resetsAt:typeof e.resetsAt=="string"?e.resetsAt:""})}function xs(e,t){return{...zt(e,t),rolling:Gt(e.rolling,t+".rolling"),weekly:Gt(e.weekly,t+".weekly"),monthly:Gt(e.monthly,t+".monthly")}}function Za(e,t){return{...zt(e,t),label:typeof e.label=="string"?e.label:"",unit:typeof e.unit=="string"?e.unit:"USD",remaining:me(e.remaining),maxBudget:tt(e.maxBudget),spend:tt(e.spend),index:typeof e.index=="number"&&Number.isFinite(e.index)&&e.index>=0?Math.floor(e.index):null}}const ws=new Set(["ok","partial","unknown","error","stale","unsupported","capability_missing"]),Ns=new Set(["off","loading","ok","partial","stale","error"]),Vt=["antigravity","claude","codex","kimi","xai","workbuddy"],Ja={antigravity:"Antigravity",claude:"Claude",codex:"Codex",kimi:"Kimi",xai:"xAI",workbuddy:"WorkBuddy"};function Ss(e,t){de(e,t);const n=(r,l="")=>typeof r=="string"?r:l,a=r=>tt(r),o=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?{id:n(r.id),label:n(r.label),...a(r.percent)===null?{}:{percent:a(r.percent)},resetsAt:n(r.resetsAt),periodHours:a(r.periodHours),scope:n(r.scope)}:null,i=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?{unit:n(r.unit,"credits"),used:a(r.used),remaining:a(r.remaining),limit:a(r.limit),fetchedAt:n(r.fetchedAt),packages:Array.isArray(r.packages)?r.packages.filter(l=>l!==null&&typeof l=="object"&&!Array.isArray(l)).map(l=>({id:n(l.id),label:n(l.label),used:a(l.used),remaining:a(l.remaining),limit:a(l.limit),startsAt:n(l.startsAt),resetsAt:n(l.resetsAt)})):[]}:void 0;return{browserAccessDenied:e.browserAccessDenied===!0,id:n(e.id),type:e.type==="agy-link"?"agy-link":"cliproxyapi",label:n(e.label),status:Ns.has(e.status)?e.status:"error",message:n(e.message),fetchedAt:a(e.fetchedAt)??0,attemptedAt:a(e.attemptedAt)??0,serverVersion:n(e.serverVersion),keyConfigured:e.keyConfigured===!0,keySource:n(e.keySource,"none"),accounts:Array.isArray(e.accounts)?e.accounts.filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).slice(0,16).map(r=>({id:n(r.id),provider:n(r.provider,"unknown"),label:n(r.label,"unknown"),status:ws.has(r.status)?r.status:"unknown",message:n(r.message),plan:n(r.plan),windows:Array.isArray(r.windows)?r.windows.map(o).filter(Boolean):[],credits:i(r.credits)})):[],unsupportedProviders:Array.isArray(e.unsupportedProviders)?e.unsupportedProviders.filter(r=>typeof r=="string").slice(0,32):[]}}function Cs(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;const t={};if(e.providers!==null&&typeof e.providers=="object"&&!Array.isArray(e.providers))for(const[n,a]of Object.entries(e.providers)){if(a===null||typeof a!="object"||Array.isArray(a))continue;const o={},i={};if(a.windows!==null&&typeof a.windows=="object"&&!Array.isArray(a.windows))for(const[r,l]of Object.entries(a.windows))l===null||typeof l!="object"||Array.isArray(l)||(o[r]={...Ue(l,["percent","localTokens","localCost","sampleCount"],me),...Ue(l,["sampleAt","per1Tokens","per1Cost","fullTokens","fullCost"],tt),resetsAt:typeof l.resetsAt=="string"?l.resetsAt:"",method:l.method==="sample"||l.method==="live"?l.method:"none",confidence:l.confidence==="high"||l.confidence==="low"?l.confidence:null});if(a.intervals!==null&&typeof a.intervals=="object"&&!Array.isArray(a.intervals))for(const[r,l]of Object.entries(a.intervals))Array.isArray(l)&&(i[r]=l.filter(c=>c!==null&&typeof c=="object"&&!Array.isArray(c)).map(c=>Ue(c,["t0","t1","tokens","cost","pct","per1Tokens","per1Cost"],me)));t[n]={windows:o,intervals:i}}return{generatedAt:me(e.generatedAt),providers:t}}function vs(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.usage&&typeof e.usage=="object"?e.usage:{};return{installed:e.installed===!0,enabled:e.enabled===!0,version:typeof e.version=="string"?e.version:"",detection:je(e.detection,["package","profile","none"],"none"),planClass:je(e.planClass,["auto","plan","api"],"auto"),usage:{calls:me(t.calls),cost:me(t.cost),tokens:me(t.tokens),days:me(t.days),providers:(Array.isArray(t.providers)?t.providers:[]).filter(n=>typeof n=="string")},historyAppliedAt:me(e.historyAppliedAt),promptDismissed:e.promptDismissed===!0,promptDue:e.promptDue===!0}}function Xa(e,t){return de(e,t),{today:we(e.today,t+".today"),month:we(e.month,t+".month"),total:we(e.total,t+".total"),budgetUsed:typeof e.budgetUsed=="number"&&Number.isFinite(e.budgetUsed)?e.budgetUsed:void 0,localSavings:e.localSavings,balance:e.balance==null?hs:Ya(e.balance,t+".balance"),balanceAccounts:Array.isArray(e.balanceAccounts)?e.balanceAccounts.slice(0,11).map(n=>({...Ya(n,t+".balanceAccounts"),id:X(n.id,t),label:X(n.label,t)})):[],goQuota:e.goQuota==null?ks:xs(e.goQuota,t+".goQuota"),customBalance:e.customBalance==null?Va():Za(e.customBalance,t+".customBalance"),customBalances:Array.isArray(e.customBalances)?e.customBalances.filter(n=>n!==null&&typeof n=="object").map((n,a)=>Za(n,t+".customBalances["+a+"]")):[],gatewayQuotas:Array.isArray(e.gatewayQuotas)?e.gatewayQuotas.filter(n=>n!==null&&typeof n=="object"&&!Array.isArray(n)).map((n,a)=>Ss(n,t+".gatewayQuotas["+a+"]")):[],customVarStatus:e.customVarStatus!==null&&typeof e.customVarStatus=="object"&&!Array.isArray(e.customVarStatus)?Object.fromEntries(Object.entries(e.customVarStatus).filter(([,n])=>n!==null&&typeof n=="object").map(([n,a])=>[n,{configured:a.configured===!0,source:typeof a.source=="string"?a.source:""}])):{},codingPlans:e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans)?e.codingPlans:{},planStats:Cs(e.planStats),codexCompat:vs(e.codexCompat),ourFreeModel:e.ourFreeModel?.enabled===!0?{enabled:!0,version:typeof e.ourFreeModel.version=="string"?e.ourFreeModel.version:""}:void 0,history:Array.isArray(e.history)?e.history.map((n,a)=>we(n,t+".history["+a+"]")):[],billionContext:e.billionContext?.protocol===1?{protocol:1,connected:e.billionContext.connected===!0,failed:e.billionContext.failed===!0,requests:Number(e.billionContext.requests)||0,unreported:Number(e.billionContext.unreported)||0,partial:Number(e.billionContext.partial)||0,uncovered:Number(e.billionContext.uncovered)||0,unresolved:Number(e.billionContext.unresolved)||0,detected:e.billionContext.detected===!0,version:typeof e.billionContext.version=="string"?e.billionContext.version.slice(0,100):"",compatibility:["needs_update","changed","bridge_missing","ready"].includes(e.billionContext.compatibility)?e.billionContext.compatibility:"unknown",noticeId:typeof e.billionContext.noticeId=="string"?e.billionContext.noticeId.slice(0,240):""}:void 0,externalUsage:e.externalUsage&&Array.isArray(e.externalUsage.sources)?{fetchedAt:Number(e.externalUsage.fetchedAt)||0,stale:e.externalUsage.stale===!0,sources:e.externalUsage.sources.map(n=>({source:String(n.source),today:we(n.today,t+".external.today"),month:we(n.month,t+".external.month"),total:we(n.total,t+".external.total"),history:(n.history??[]).map(a=>we(a,t+".external.history"))})),combined:Object.fromEntries(["today","month","total","history"].map(n=>[n,n==="history"?(e.externalUsage.combined.history??[]).map(a=>we(a,t+".external.history")):we(e.externalUsage.combined[n],t+".external."+n)]))}:null,config:ys(e.config,t+".config"),pricesRev:typeof e.pricesRev=="string"?e.pricesRev:void 0,modelLabels:Object.fromEntries(Object.entries(e.modelLabels??{}).filter(([,n])=>typeof n=="string")),modelDirectory:e.modelDirectory,reconcile:e.reconcile===null||e.reconcile===void 0?void 0:{ok:e.reconcile.ok===!0,message:typeof e.reconcile.message=="string"?e.reconcile.message:""},priceLockIds:Array.isArray(e.priceLockIds)?e.priceLockIds.filter(n=>typeof n=="string"):[],meta:{...Xe(e.meta?.locale)?{locale:Xe(e.meta.locale)}:{},now:typeof e.meta?.now=="number"?e.meta.now:Date.now(),timezoneOffsetMinutes:typeof e.meta?.timezoneOffsetMinutes=="number"?e.meta.timezoneOffsetMinutes:0,timezone:typeof e.meta?.timezone=="string"?e.meta.timezone:"",...typeof e.meta?.defaultProvider=="string"?{defaultProvider:e.meta.defaultProvider}:{},dayKey:typeof e.meta?.dayKey=="string"?e.meta.dayKey:"",monthKey:typeof e.meta?.monthKey=="string"?e.meta.monthKey:""}}}function As(e,t){de(e,t);const n={ok:e.ok===!0,message:typeof e.message=="string"?e.message:""};return e.state!==void 0&&e.state!==null&&(n.state=Xa(e.state,t+".state")),n}function ee(e){return{parse:e}}const at=ee(Xa),Ms=ee(e=>de(e,"patch")),Ps=ee(As),Yt=ee(e=>X(e,"provider")),Os=ee(e=>{if(e!=null)return(typeof e!="number"||!Number.isInteger(e)||e<0||e>7)&&te("index","0-7 integer"),e}),Ts=ee(e=>X(e,"date")),Rs=ee(e=>de(e,"day")),Ds=ee(e=>(Number.isFinite(Number(e))||te("limit","number"),Number(e))),en=ee(e=>X(e,"sort")),Bs=ee(e=>de(e,"topSessions")),tn=ee(e=>X(e,"target")),Ls=ee(e=>X(e,"value")),ye=(e,t)=>({mode:"strict",typeSymbol:"dsh-cost-meter#"+e,schema:t,create:()=>t}),ne=(e,t,n,a=!1)=>({name:e,wire:e,source:"json",codec:ye(t,n),...a?{acceptsUndefined:!0}:{}}),an=ee(e=>{de(e,"billing storage options"),(Object.keys(e).some(n=>!["retentionDays","apply","streams","groups"].includes(n))||![0,7,30].includes(e.retentionDays))&&te("billing storage options","retentionDays 0/7/30");const t={retentionDays:e.retentionDays};for(const n of["apply","streams","groups"])e[n]!==void 0&&typeof e[n]!="boolean"&&te(n,"boolean"),t[n]=e[n]??n!=="apply";return t}),Es={package:"dsh-cost-meter",descriptors:[{method:"getStateSince",parameters:[ne("pricesRev","PricesRev",ee(e=>(typeof e!="string"&&te("pricesRev","price table revision"),e)))],result:ye("CostState",at)},...["getState","getLocalState"].map(e=>({method:e,result:ye("CostState",at)})),{method:"billingStorage",parameters:[ne("options","BillingStorageOptions",an)],result:ye("BillingStorage",ee(e=>{de(e,"billing storage");const t={};for(const n of["retentionDays","scannedAt","sessions","reclaimableBytes","archivedStreams","removedFiles","releasedBytes","archiveBytes","skipped"])t[n]=Z(e[n],n);for(const n of["applied","limited"])typeof e[n]!="boolean"&&te(n,"boolean"),t[n]=e[n];for(const n of["streams","groups","archives"]){const a=de(e[n],n),o={};for(const i of["files","bytes","eligibleFiles","eligibleBytes"])o[i]=Z(a[i],n+"."+i);for(const i of["oldestAt","newestAt"])o[i]=a[i]===null?null:Z(a[i],n+"."+i);t[n]=o}return t}))},{method:"updateConfig",parameters:[ne("patch","ConfigPatch",Ms)],result:ye("CostState",at)},{method:"fetchPrices"},{method:"releasePriceLock",parameters:[ne("id","PriceLockId",ee(e=>((typeof e!="string"||e.length===0)&&te("id","OpenRouter model id"),e)))]},{method:"refreshBalance"},{method:"refreshGoQuota"},...["getPiAiCodexQuota","getChatgptSubQuota"].map(e=>({method:e,result:ye("PiAiCodexQuota",ee(t=>{de(t,"pi-ai quota"),["off","ok","error"].includes(t.status)||te("pi-ai quota status","off/ok/error");const n={},a=de(t.windows,"pi-ai windows");for(const o of["five","weekly"])if(a[o]!==void 0){const i=Z(a[o].percent,o);(i<0||i>100)&&te(o,"0-100 percent"),n[o]={percent:i,resetsAt:X(a[o].resetsAt,"resetsAt")}}return{status:t.status,windows:n,message:X(t.message,"message")}}))})),{method:"refreshCustomBalance",parameters:[ne("index","CustomBalanceIndex",Os,!0)]},{method:"refreshCodingPlan",parameters:[ne("provider","CodingPlanProvider",Yt)]},{method:"loginCodingPlan",parameters:[ne("provider","CodingPlanProvider",Yt)]},{method:"loginOpenDesign"},{method:"refreshGatewayQuota",parameters:[ne("sourceId","GatewayQuotaSourceId",ee(e=>{if(e!=null)return(typeof e!="string"||e.length>48||!/^[a-z0-9][a-z0-9_-]*$/.test(e))&&te("sourceId","gateway source id"),e}),!0)]},{method:"resetHistory",result:ye("CostState",at)},{method:"importLegacyHistory"},{method:"getDaySessions",parameters:[ne("date","DayKey",Ts)],result:ye("DayRecord",Rs)},{method:"getSessionCost",parameters:[ne("sessionId","SessionId",Yt)],result:ye("SessionCost",ee(e=>({own:Wt(e.own,"own"),subagents:Wt(e.subagents,"subagents"),found:xe(e.found,"found"),subagentCount:Z(e.subagentCount,"subagentCount")})))},{id:"dsh-cost-meter#costMeter/getTurnCost",service:"costMeter",namespace:"costMeter",method:"getTurnCost",invocation:{kind:"direct"},parameters:[ne("sessionId","SessionId",ee(e=>X(e,"sessionId"))),...["startSeq","endSeq"].map(e=>ne(e,"TurnSeq",ee(t=>((!Number.isSafeInteger(t)||t<0)&&te(e,"nonnegative integer"),t)))),{...ne("displayCurrency","DisplayCurrency",ee(e=>(e!==void 0&&!/^[A-Z]{3}$/.test(e)&&te("displayCurrency","currency"),e))),acceptsUndefined:!0}],result:ye("TurnCost",ee(e=>({...Ht(e),found:xe(e.found,"found"),...e.inherited===void 0?{}:{inherited:xe(e.inherited,"inherited")},cost:Z(e.cost,"cost"),apiCost:Z(e.apiCost,"apiCost"),rows:Ga(e.rows),calls:(Array.isArray(e.calls)?e.calls:te("calls","array")).map(t=>({kind:X(t.kind,"kind"),provider:X(t.provider,"provider"),model:X(t.model,"model"),atMs:Z(t.atMs,"atMs"),cost:Z(t.cost,"cost"),apiCost:Z(t.apiCost,"apiCost"),plan:xe(t.plan,"plan"),priced:xe(t.priced,"priced"),longContext:xe(t.longContext,"longContext"),rows:Ga(t.rows),...t.metering?{metering:gs(t.metering)}:{}}))})))},{method:"getTopSessions",parameters:[ne("limit","SessionLimit",Ds),ne("sort","SessionSort",en,!0),ne("dir","SessionSortDir",en,!0)],result:ye("TopSessions",Bs)},{method:"setCredential",parameters:[ne("target","CredentialTarget",tn),ne("value","CredentialValue",Ls)]},{method:"clearCredential",parameters:[ne("target","CredentialTarget",tn)]},...["applyCodexCompatHistory","dismissCodexCompat"].map(e=>({method:e,result:ye("CostState",at)}))].map(e=>({id:"dsh-cost-meter#costMeter/"+e.method,service:"costMeter",namespace:"costMeter",invocation:{kind:"direct"},parameters:[],result:ye("FetchPricesResult",Ps),...e}))};function Is(e,t){const n=t?.models??{};return typeof e=="string"&&e.length>0&&n[e]!==void 0?n[e]:t?.default??{cacheHit:0,cacheMiss:0,output:0}}const js=["peakWindows","peakHolidays","peakSchedule"];function xt(e){return Object.fromEntries(js.filter(t=>e?.[t]!==void 0).map(t=>[t,e[t]]))}function Dr(e){return!(!e||typeof e!="object"||e.peakWindows!==void 0&&(!Array.isArray(e.peakWindows)||e.peakWindows.length>24||e.peakWindows.some(t=>!t||!Number.isFinite(t.start)||!Number.isFinite(t.end)||t.start<0||t.start>=24||t.end<0||t.end>24||t.start===t.end))||e.peakSchedule!==void 0&&!["deepseek","volcengine","ollama","daily","utc-weekdays"].includes(e.peakSchedule)||e.peakHolidays!==void 0&&e.peakHolidays!==null&&(!Array.isArray(e.peakHolidays)||e.peakHolidays.length>366||e.peakHolidays.some(t=>typeof t!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t)||!Number.isFinite(Date.parse(t+"T00:00:00Z"))||new Date(t+"T00:00:00Z").toISOString().slice(0,10)!==t)))}function Fs(e,t,n){if(!e?.entry)return e;const a=n?.providers?.[t]??(["deepseek-official","deepseek-account",""].includes(t)?n?.providers?.deepseek:void 0),o={...xt(a),...e.entry};return{...e,entry:o,billingMode:(o.peak||o.offPeak)&&Object.keys(xt(o)).length&&o.billingMode!=="flat"?"deepseek-peak":e.billingMode}}function He(e,t,n){if(!(e.peakWindows!==void 0||e.peakHolidays!==void 0||["daily","utc-weekdays","deepseek"].includes(e.peakSchedule)))return null;if(n?.enabled!==!0||!Number.isFinite(t)||Number.isFinite(n.effectiveAtMs)&&t<n.effectiveAtMs)return"base";const o=e.peakSchedule??(e.billingMode==="utc-peak"?"utc-weekdays":"deepseek"),i=e.peakWindows??(o==="ollama"?[{start:12,end:18}]:n.windows??[]),r=e.peakHolidays===null?[]:e.peakHolidays??(["ollama","volcengine","utc-weekdays","daily"].includes(o)?[]:n.holidays??[]),l=new Date(t+8*36e5),c=new Date(t),u=["ollama","utc-weekdays"].includes(o)?c.getUTCDay():l.getUTCDay();if(o!=="daily"&&(u===0||u===6)||r.includes(l.toISOString().slice(0,10)))return"offPeak";const d=c.getUTCHours()+c.getUTCMinutes()/60+c.getUTCSeconds()/3600+c.getUTCMilliseconds()/36e5;return i.some(m=>m.start<m.end?d>=m.start&&d<m.end:d>=m.start||d<m.end)?"peak":"offPeak"}function Qs(e,t,n){const a=He(e,t,n);if(a===null||a==="base")return null;const o=e.peakWindows??(e.peakSchedule==="ollama"?[{start:12,end:18}]:n.windows??[]),i=Math.floor(t/864e5)*864e5,r=new Set,l=Math.max(9,Math.min(380,(e.peakHolidays??n.holidays??[]).length+8));for(let d=-l;d<=l;d++){const m=i+d*864e5;for(const g of[0,16,...o.flatMap(b=>[b.start,b.end])])r.add(m+g*36e5)}let c=null,u=null;for(const d of r)He(e,d-1,n)!==He(e,d,n)&&(d<=t&&(c===null||d>c)&&(c=d),d>t&&(u===null||d<u)&&(u=d));return c===null||u===null?null:{inPeak:a==="peak",weekend:!1,prevAtMs:c,nextAtMs:u,nextIntoPeak:He(e,u,n)==="peak"}}function wt(e){return Object.fromEntries(["multiplier","separateMultipliers","multipliers"].filter(t=>e?.[t]!==void 0).map(t=>[t,e[t]]))}function Nt(e,t){return(e.separateMultipliers?e.multipliers?.[t]:void 0)??e.multiplier??1}function nn(e,t,n="base"){const a={};for(const o of["cacheHit","cacheMiss","cacheWrite","output","reasoning"])e[o]!==void 0&&(a[o]=e[o]*Nt(t,n+"."+o));return e.longContext&&(a.longContext={...nn(e.longContext,t,"longContext"),aboveInputTokens:e.longContext.aboveInputTokens}),a}function _s(e){const t=wt(e);return t.multipliers&&(t.multipliers=Object.fromEntries(Object.entries(t.multipliers).filter(([n])=>n.startsWith("cny.")).map(([n,a])=>[n.replace("cny.","base."),a]))),{...e.cny,...t}}function We(e){if(e===null||typeof e!="object")return;const t=r=>{const l=e[r];return typeof l=="number"&&Number.isFinite(l)&&l>=0?l:void 0},n=t("cacheMiss")??t("input")??0,o={cacheHit:t("cacheHit")??t("cachedInput")??t("cacheRead")??n,cacheMiss:n,output:t("output")??0},i=t("reasoning");return i!==void 0&&(o.reasoning=i),t("cacheWrite")!==void 0&&(o.cacheWrite=t("cacheWrite")),o}function qs(e){const t=We(e);if(t===void 0)return null;Object.assign(t,wt(e),xt(e)),e.billingMode==="utc-peak"&&(t.billingMode="utc-peak"),e.peakSchedule==="volcengine"&&(t.peakSchedule="volcengine");for(const n of["offPeak","peak","legacyBase"]){const a=We(e[n]);a!==void 0&&(t[n]=a)}return Number.isFinite(e.longContext?.aboveInputTokens)&&e.longContext.aboveInputTokens>0&&(t.longContext={...We(e.longContext),aboveInputTokens:e.longContext.aboveInputTokens}),Array.isArray(e.rateHistory)&&(t.rateHistory=e.rateHistory.slice(0,16).map(n=>{const a={...We(n),before:n.before};for(const o of["offPeak","peak"]){const i=We(n[o]);i!==void 0&&(a[o]=i)}return a})),t}function nt(e,t=Date.now()){if(!e||!Number.isFinite(t)||!Array.isArray(e.rateHistory))return e;let n=null,a=1/0;for(const r of e.rateHistory){const l=Date.parse(r.before);t<l&&l<a&&(n=r,a=l)}if(!n)return e;const{before:o,...i}=n;return{...e,...i}}const Zt=Date.parse("2026-08-22T16:00:00Z");function sn(e){if(!Number.isFinite(e)||e<Zt)return null;const t=Math.floor((e+8*36e5)/864e5),n=(t+4)%7;if(n!==6&&n!==0)return null;const a=n===6?t:t-1;return{start:Math.max(a*864e5-8*36e5,Zt),end:(a+2)*864e5-8*36e5}}function on(e,t){if(!Number.isFinite(e)||e<Zt||!Array.isArray(t))return null;const n=Math.floor((e+8*36e5)/864e5);return t.includes(new Date(n*864e5).toISOString().slice(0,10))?{start:n*864e5-8*36e5,end:(n+1)*864e5-8*36e5}:null}const Us=(e,t)=>on(e,t)??sn(e);function St(e,t,n,a){if(!Array.isArray(n)||n.length===0||Us(e,a)!==null||Number.isFinite(t)&&e<t)return!1;const o=new Date(e).getUTCHours();return n.some(i=>{const r=Number(i.start),l=Number(i.end);return!Number.isFinite(r)||!Number.isFinite(l)?!1:r<l?o>=r&&o<l:o>=r||o<l})}const Hs=Date.parse("2026-08-16T16:00:00Z"),Ws=17881344e5;function rn(e,t,n){const a=nt(e,t)??{cacheHit:0,cacheMiss:0,output:0},o=(c,u="base")=>({reasoning:0,...nn(c,a,u)}),i=He(a,t,n);if(i!==null)return i==="base"||!a[i]?o(a):o(a[i],i);const r=a.peakSchedule==="ollama";if(r||a.billingMode==="utc-peak"){if(n?.enabled!==!0||!Number.isFinite(t)||r&&t<Ws)return o(a);const c=new Date(t),u=c.getUTCDay(),d=c.getUTCHours(),m=u>0&&u<6&&(r?d>=12&&d<18:d>=1&&d<4||d>=6&&d<10);return o((m?a.peak:a.offPeak)??a,(m?a.peak:a.offPeak)?m?"peak":"offPeak":"base")}if(Number.isFinite(t)&&t<Hs){const c=a.legacyBase;return c===void 0?o(a):o(c,"legacyBase")}if(n?.enabled!==!0)return o(a);const l=typeof n.effectiveAtMs=="number"&&Number.isFinite(n.effectiveAtMs)?n.effectiveAtMs:void 0;if(St(t,l,n.windows,a.peakSchedule==="volcengine"?[]:n.holidays)){const c=a.peak;return c===void 0?o(a):o(c,"peak")}if(l!==void 0&&t>=l){const c=a.offPeak;return c===void 0?o(a):o(c,"offPeak")}return o(a)}function ln(e,t){const n=Math.max(0,Number(e.input)||0),a=Math.max(0,Number(e.output)||0),o=Math.max(0,Number(e.cacheRead)||0),i=Math.max(0,Number(e.cacheWrite)||0),r=Math.max(0,Number(e.reasoning)||0);return t.longContext&&n+o+i>t.longContext.aboveInputTokens&&(t=t.longContext),(n*t.cacheMiss+a*t.output+o*t.cacheHit+i*(t.cacheWrite??t.cacheHit)+r*(t.reasoning??0))/1e6}function cn(e,t,n){const a=Number(e);if(!Number.isFinite(a)||a<0||a===0)return 0;if(t!=="CNY")return a;const o=Number(n);return!Number.isFinite(o)||o<=0?a:a/o}function re(e,t){const n=e?.barDirections,a=t==="balance"?"remaining":"used";if(n===null||typeof n!="object"||Array.isArray(n))return a;const o=n[t];return o==="remaining"||o==="used"?o:a}function he(e,t){if(e==null||!Number.isFinite(Number(e)))return{width:0,label:null};const n=Math.max(0,Math.min(100,Number(e))),a=t==="remaining"?Math.round((100-n)*10)/10:Math.round(n*10)/10;return{width:a,label:a}}const un=(e,t)=>e.toFixed(t).replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1");function ce(e,t){const n=typeof t?.symbol=="string"&&t.symbol.length>0?t.symbol:"$",a=Number(t?.decimals),o=Math.max(0,Math.min(10,Number.isFinite(a)?Math.floor(a):2));let i=o;return e>0&&e<Math.pow(10,-o)&&(i=o+2),n+un(e,i)}function z(e,t){const n=Number(t?.exchangeRate),a=e*(Number.isFinite(n)&&n>0?n:1);return ce(a,t)}function I(e){const t=Math.max(0,Number(e)||0),n=a=>a>=100?String(Math.round(a)):String(Math.round(a*10)/10);return t<1e3?String(Math.round(t)):t>=999500?n(t/1e6)+"M":t<1e6?n(t/1e3)+"K":n(t/1e6)+"M"}function st(e){return String(e??"").normalize("NFKC").toLowerCase().replace(/[((]\s*(?:go|zen)\s*[))]/g," ").trim()}function $e(e){return st(e).replace(/[\s._\-\u2010-\u2015\u2212]+/gu,"")}function $s(e,t=!0,n=!0){const a=st(e),o=a.match(/[-_./:@](\d{4}-\d{2}-\d{2}|\d{8}|\d{6}|\d{4})$/);if(o){const i=o[1].replaceAll("-","");if(i.length===4&&!t||i.length===6&&(!t||!n))return a;const r=i.length===4?2e3:i.length===6?2e3+Number(i.slice(0,2)):Number(i.slice(0,4)),l=Number(i.slice(-4,-2)),c=Number(i.slice(-2)),u=new Date(Date.UTC(r,l-1,c));return r>=2e3&&u.getUTCFullYear()===r&&u.getUTCMonth()===l-1&&u.getUTCDate()===c?a.slice(0,o.index):a}return a.replace(/[-_./:@]latest$/,"")}function dn(e,t,n=e,a=!0,o=!0){if(typeof e!="string"||e.length===0)return null;const i=Array.isArray(t)?t.filter(u=>typeof u=="string"&&u.length>0):[],r=i.find(u=>u===n);if(r!==void 0)return{id:r,rank:3};let l=e.normalize("NFKC").trim(),c=2;for(;;){const u=$e(l);if(u.length===0)return null;const d=i.filter(g=>$e(g)===u);if(d.length>0)return{id:d.length===1?d[0]:null,rank:c};if(/[:((]\s*(?:free|online)\b/i.test(l))return null;const m=$s(l,a,o);if(m===l.toLowerCase())return null;l=m,c=1}}function Ct(e,t,n=e,a=!0,o=!0){return dn(e,t,n,a,o)?.id??null}const Jt=["opendesign","open-design","open-design-api","amr-link.open-design.ai"],mn=["vercel","copilot","cline","qoder","qoder-cn","qoder-global","trae","trae-cn","trae-global","zcode","mimo-app","commandcode-plan","cursor","windsurf","augment","roo","codebuddy"],Ke=new Set(["openrouter","opencode-zen","opencode-go","opencode-go-plus","zen","opencode",...Jt]),Oe={openai:/^(?:gpt|o\d|codex)/i,anthropic:/^claude/i,google:/^gemini/i,stepfun:/^step-/i,deepseek:/^deepseek/i,moonshot:/^kimi/i,"z-ai":/^glm/i,xai:/^grok/i,alibaba:/^qwen/i,minimax:/^minimax/i,tencent:/^(?:hunyuan|hy\d)/i,xiaomi:/^mimo/i,upstage:/^solar/i,nvidia:/^nemotron/i,mistral:/^mistral/i,meta:/^(?:muse|llama)/i,meituan:/^longcat/i};function Xt(e){return["deepseek-peak","utc-peak"].includes(e?.billingMode)?e.billingMode:"flat"}function ze(e,t,n,a,o){if(typeof e!="string")return null;if(Object.hasOwn(t,e))return{id:e,rank:3};if(a!=="auto")return null;let i=e.normalize("NFKC").trim().replace(/^models\/(?=gemini)/i,"google/");const r=i.search(/[/:]/);if(r>0){const l=i.slice(0,r).trim().toLowerCase(),c=l==="deepseek-ai"?"deepseek":l,u=i.slice(r+1).trim();if(Object.hasOwn(Oe,c)&&(c===n||["opencode-zen","opencode-go","zen","opencode","opencode-go-plus"].includes(n)&&(Oe[c].test(u)||Ct(u,Object.keys(c==="deepseek"?o?.models??{}:o?.providers?.[c]?.models??{}),u,o?.snapshotTags!==!1,o?.shortSnapshotTags!==!1)!==null)))i=u;else if(Object.hasOwn(Oe,c))return null}return dn(i,Object.keys(t),e,o?.snapshotTags!==!1,o?.shortSnapshotTags!==!1)}function Ks(e,t,n,a,o){return ze(e,t,n,a,o)?.id??null}const zs=new Set(["local","lmstudio","ollama","jan","gpt4all","koboldcpp","llamacpp","llama-cpp","localai","vllm","sglang","tabbyapi","lmdeploy","oobabooga","text-generation-webui","llama-server"]),Gs=["lmstudio:","lmstudio/","ollama:","ollama/","jan:","jan/","gpt4all:","gpt4all/","koboldcpp:","koboldcpp/","llamacpp:","llamacpp/","llama-cpp:","llama-cpp/","localai:","localai/","vllm:","vllm/","sglang:","sglang/","tabbyapi:","tabbyapi/","lmdeploy:","oobabooga/","text-generation-webui/","llama-server:","gguf:","local:"];function ve(e,t){if(typeof e=="string"&&zs.has(e))return!0;const n=typeof t=="string"?st(t):"";return Gs.some(a=>n.startsWith(a))}function pn(e,t,n,a){if(!["deepseek","deepseek-official","deepseek-account"].includes(e)&&typeof t=="string"&&t.length>0&&t!=="__local__"&&!t.includes(":")){const o=n.models??{},i=Object.hasOwn(o,t)?t:a==="auto"?Ct(t,Object.keys(o),t,n?.snapshotTags!==!1,n?.shortSnapshotTags!==!1):null;if(i!==null&&o[i]?.unpriced!==!0)return{entry:o[i],priced:!0,billingMode:"deepseek-peak",matched:!0}}return null}function ea(e,t,n){const a=n?.prices??{},o=n?.priceMatch==="exact"?"exact":"auto",i=n?.priceOverrides&&typeof n.priceOverrides=="object"?n.priceOverrides:{};let r=String(e??"").trim().toLowerCase();if(r.startsWith("llm-")&&(r=r.slice(4)),r===""&&(r="deepseek"),["our-free-model","our-free-model-region"].includes(r)&&i[r+":*"]==="__free__")return{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},priced:!0,currency:"USD",billingMode:"flat",matched:!0};let l=r,c=t;const u=i[r+":"+t];if(u==="__custom__"){const m=a.custom?.[r+":"+t];return{entry:m??null,priced:!!m,billingMode:m?.billingMode??"flat",matched:!0,currency:m?.currency??"USD"}}if(u==="__local__")return{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},billingMode:"flat",priced:!0,local:!0,currency:"USD",matched:!0};if(typeof u=="string"&&u.length>0){const m=u.indexOf(":");if(m>0&&u.slice(m+1).length>0?(l=u.slice(0,m).trim().toLowerCase(),c=u.slice(m+1)):c=u,l==="deepseek"&&c==="__default__")return{entry:a.default??{cacheHit:0,cacheMiss:0,output:0},priced:a.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}if(!ve(l,c)&&l!=="openrouter"){const m=a.providers?.[l]?.models??{},g=ze(c,m,l,o,a);if(g){const b=g.id===null?null:m[g.id];return{entry:b,priced:b!=null&&b.unpriced!==!0,billingMode:Xt(b),matched:!0}}}if(/(?:^|[-_])free(?:$|[-_])/.test(l)&&!["our-free-model","our-free-model-region"].includes(l))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(l!=="opencode-go"&&Fe.go.includes(l))return ea("opencode-go",c,{...n,priceOverrides:{}});if(Jt.includes(l)&&l!=="opendesign")return ea("opendesign",c,{...n,priceOverrides:{}});if(ve(l,c))return pn(r,u,a,o)??{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},billingMode:"flat",priced:!0,local:!0,currency:"USD",matched:!0};if(l==="openrouter"){const m=a.providers?.openrouter?.models??{},g=Object.hasOwn(m,c)?m[c]:null;return{entry:g,priced:g!==null&&g.unpriced!==!0,billingMode:"flat",matched:g!==null}}if(["deepseek","deepseek-official","deepseek-account"].includes(l)){const m=a.models??{},g=ze(c,m,"deepseek",o,a);if(g)return g.id===null||m[g.id]?.unpriced===!0?{entry:null,priced:!1,billingMode:"flat",matched:!0}:{entry:m[g.id],priced:!0,billingMode:"deepseek-peak",matched:!0};if(o==="auto"){let b=null,p=-1,k=!1,h="flat";for(const[v,x]of Object.entries(a.providers??{})){if(Ke.has(v))continue;const y=x?.models??{},f=ze(c,y,v,o,a);if(!f)continue;const w=f.id===null?null:y[f.id],N=f.rank;N>p?(b=w,p=N,k=f.id===null||w==null,h=Xt(w)):N===p&&(k=!0)}if(k)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(b!==null)return{entry:b,priced:b.unpriced!==!0,billingMode:h,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}if(Ke.has(l))return{entry:null,priced:!1,billingMode:"flat",matched:!1};const d=o==="auto"&&!u&&/^deepseek/i.test(st(c).replace(/^deepseek(?:-ai)?[/:]\s*/,""));if(Object.hasOwn(Oe,l)&&!d)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(o==="auto"){let m=null,g=-1,b=!1,p="flat";for(const[k,h]of[["deepseek",{models:a.models??{}}],...Object.entries(a.providers??{})]){if(k===l||Ke.has(k))continue;const v=h?.models??{},x=ze(c,v,k,o,a);if(!x)continue;const y=x.id,f=y===null?null:v[y];if(k==="mistral"&&y?.startsWith("deepseek-")&&y!==c&&!l.includes("mistral")&&!/^mistral[/:]/i.test(String(c).trim()))continue;const w=x.rank;w>g?(m=f,g=w,b=y===null||f==null,p=k==="deepseek"?"deepseek-peak":Xt(f)):w===g&&(b=!0)}if(b)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(m!==null)return{entry:m,priced:m.unpriced!==!0,billingMode:p,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}function Vs(e,t,n,a,o){const i=o?.[(e||"deepseek")+":"+t];if(!e||a==="exact"||typeof t!="string"||ve(e,t)||/(?:^|[-_])free(?:$|[-_])/.test(e)||typeof i=="string"&&i.length>0||ze(t,n?.providers?.[e]?.models??{},e,"auto",n))return null;const r=t.normalize("NFKC").trim(),l=r.indexOf("/");if(l<=0||l===r.length-1)return null;const c=r.slice(0,l).trim().toLowerCase().replace(/^llm-/,""),u=r.slice(l+1).trim(),d={codex:"openai",claude:"anthropic",gemini:"google","deepseek-ai":"deepseek","deepseek-official":"deepseek","ollama-cloud":"ollama-cloud",volcengine:"volcengine",ark:"ark"},m=/^(?:dsh-)?magpie(?:$|-)/.test(e),g=["our-free-model","our-free-model-region"].includes(c),b=Object.hasOwn(d,c)||Ke.has(c)||Object.hasOwn(n?.providers??{},c)||Object.values(Fe).some(k=>k.includes(c))||mn.includes(c)||g;if(!m&&(!b||Ke.has(e)||Fe.go.includes(e))||/(?:^|[-_])free(?:$|[-_])/.test(c)&&!g)return null;const p=Object.hasOwn(d,c)?d[c]:Fe.go.includes(c)?"opencode-go":c;return!m&&Object.hasOwn(Oe,e)&&Object.hasOwn(Oe,p)&&p!==e&&(p!=="deepseek"||!/^deepseek/i.test(st(u)))||Object.hasOwn(Oe,p)&&Ks(u,p==="deepseek"?n?.models??{}:n?.providers?.[p]?.models??{},p,"auto",n)===null?null:{provider:b||Object.hasOwn(d,c)||Ke.has(p)||Object.hasOwn(Oe,p)||Object.hasOwn(n?.providers??{},p)||ve(p,u)?p:e,model:u}}function fn(e,t,n){let a=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";const o=Object.fromEntries(["our-free-model:*","our-free-model-region:*"].filter(l=>n?.priceOverrides?.[l]==="__free__").map(l=>[l,"__free__"]));for(let l=0;l<8;l++){const c=Vs(a,t,n?.prices,n?.priceMatch,n?.priceOverrides);if(!c)break;e=c.provider,a=c.provider,t=c.model,n={...n,priceOverrides:o}}let i=ea(e,t,n);const r=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";return!i.currency&&!i.priced&&(i=pn(r,n?.priceOverrides?.[r+":"+t],n?.prices??{},n?.priceMatch==="exact"?"exact":"auto")??i),i.currency||(i=i.priced&&n?.prices?.currency==="CNY"&&i.entry?.cny?{...i,entry:_s(i.entry),currency:"CNY"}:{...i,currency:i.priced&&i.billingMode==="deepseek-peak"&&n?.prices?.currency==="CNY"?"CNY":"USD"}),i=Fs(i,r,n?.prices),r==="ollama-cloud"&&n?.prices?.ollamaPeak!==!1&&i.entry&&i.billingMode==="deepseek-peak"&&(n?.prices?.ollamaTaggedPeak===!1?["deepseek-v4.1-flash","deepseek-v4-pro"].includes(String(t).trim().toLowerCase()):Ct(t,["deepseek-v4.1-flash","deepseek-v4-pro"])!==null)&&(i={...i,entry:{...i.entry,peakSchedule:i.entry.peakSchedule??"ollama"}}),["volcengine","ark"].includes(r)&&n?.prices?.volcenginePeak!==!1&&i.entry&&i.billingMode==="deepseek-peak"?{...i,entry:{...i.entry,peakSchedule:i.entry.peakSchedule??"volcengine"}}:i}function Ys(e){const t=Number(e?.calls)||0,n=Number(e?.input)||0,a=Number(e?.cacheRead)||0;return t>=3&&n>=1e5&&a===0}function vt(e,t){return!e||!t?0:typeof e.cost=="number"&&Number.isFinite(e.cost)?e.cost:yn(e,t).total}function ot(e){if(e===null||typeof e!="object")return 0;const t=Number(e.cost)||0,n=e.apiCost===void 0||e.apiCost===null?t:Number(e.apiCost);return Number.isFinite(n)&&n>=0?Math.min(n,t):t}function _(e,t){const n={CNY:"Cny",EUR:"Eur"}[t?.currency],a=t?.showTotalWithPlan===!0,o=n&&e?.[(a?"cost":"apiCost")+n],i=a?Number(e?.cost)||0:ot(e);return!Number.isFinite(o)||o===0&&i>0?i:o/(t.exchangeRate||1)}const Fe={opendesign:Jt,go:["go","zen","opencode","opencode-go","opencode-go-plus","dsh-opencode-go"],codex:["codex","openai-codex","dsh-openai-codex","codex-chatgpt"],anthropic:["anthropic","claude-subscription"],zai:["zai","glm-coding-plan"],minimax:["minimax","minimax-code","minimax-m-plan","minimax-mplan","minimax-token-plan"],kimi:["kimi","kimi-code","kimi-coding","kimi-coding-plan"],commandcode:["commandcode","command-code"],clinepass:["clinepass","cline-pass"],workbuddy:["workbuddy","workbuddy-subscription","workbuddy-ai","workbuddy-global","xdpool","xdpool-global"],antigravity:["antigravity"],stepfun:["stepfun","step-code"],"volcengine-agent":["volcengine-agent","ark-agent-plan","volcengine-agent-plan"],"tencent-coding":["tencent-coding","tencent-coding-plan","tokenhub-coding-plan"],"tencent-token":["tencent-token","tencent-token-plan","tokenhub-token-plan","tencent-hy-token-plan","tokenhub-hy-token-plan"],"baidu-coding":["baidu-coding-plan","qianfan-coding-plan","baidu-token-plan","qianfan-token-plan","baidu-tokenplan","qianfan-tokenplan"],qwen:["qwen","qwen-tokenplan","qianwen-tokenplan","qwen-token-plan","qianwen-token-plan"],scnet:["scnet","scnet-tokenplan","scnet-token-plan"],mimo:["mimo","xiaomimimo","mimo-token-plan","xiaomi-token-plan","xiaomi-token-plan-cn","xiaomi-token-plan-sgp","xiaomi-token-plan-ams"],factory:["factory","droid","factory-a","factory-g","factory-o"]},Te=["opendesign","anthropic","zai","minimax","kimi","openrouter","siliconflow","commandcode","clinepass","scnet","volcengine","qwen","mimo","factory","go","codex","volcengine-agent","tencent-coding","tencent-token","baidu-coding","workbuddy","antigravity","stepfun"],Zs=Object.entries({opendesign:"opendesign|open[._-]?design",codex:"codex|chatgpt","baidu-coding":"baidu|qianfan|百度|千帆","tencent-coding":"tencent|tokenhub|腾讯",anthropic:"anthropic|claude",zai:"z[._-]?ai|zhipu|glm|智谱",minimax:"minimax|海螺",kimi:"kimi|moonshot|moonshotai|月之暗面",openrouter:"openrouter",siliconflow:"siliconflow|硅基",commandcode:"commandcode",clinepass:"cline[._-]?pass|clinepass",scnet:"scnet|sugon|超算",volcengine:"volcengine|volcano|volc|ark|火山|方舟",qwen:"qwen|qianwen|千问|通义",mimo:"mimo|xiaomi|小米",factory:"factory|droid",go:"opencode(?:[-_\\s]?go)?|zen|go"}).map(([e,t])=>[e,new RegExp("(?:^|[^a-z0-9])(?:"+t+")(?=$|[^a-z0-9])")]);function ta(e,t){for(const n of[e,t]){const a=String(n??"").normalize("NFKC").replace(/([a-zA-Z0-9\u3400-\u9fff])(?=(?:MPlan|Coding|Token|Agent|Plan|Subscription))/g,"$1-").replace(/([a-z0-9])((?:coding|token|agent|m)?plan|subscription)$/i,"$1-$2").toLowerCase();if(!/(?:^|[^a-z0-9])(?:(?:coding|token|agent|m)[-_\s]*)?plan(?:$|[^a-z0-9])|(?:^|[^a-z0-9])subscription(?:$|[^a-z0-9])|套餐|订阅/.test(a))continue;const o=Zs.filter(([,i])=>i.test(a));if(o.length){if(o.length!==1)return null;const i=o[0][0];if(i==="volcengine"&&/agent[-_\s]*plan|智能体.*套餐/.test(a))return"volcengine-agent";if(i==="tencent-coding"){const r=/token[-_\s]*plan|令牌.*套餐/.test(a),l=/coding[-_\s]*plan|编程.*套餐/.test(a);return r===l?null:r?"tencent-token":i}return i}}return null}function bn(e,t){const n=String(e??"").normalize("NFKC").trim().toLowerCase().replace(/^llm-/,"");if(!n||typeof t!="string"||ve(n,t)||/(?:^|[-_])free(?:$|[-_])/.test(n)||n==="opencode-zen"||Te.includes(n)||Object.values(Fe).some(l=>l.includes(n))||ta(e)!==null)return null;const a=t.normalize("NFKC").trim().split("/").map(l=>l.trim());if(a.some(l=>!l)||a.slice(0,-1).some(l=>/(?:^|[-_])free(?:$|[-_])/.test(l.toLowerCase())||ve(l.toLowerCase().replace(/^llm-/,""),""))||ve("",a.at(-1)))return null;const o=/^(?:dsh-)?magpie(?:$|-)/.test(n),i=["openai","google","deepseek","deepseek-ai","deepseek-official","moonshot","z-ai","xai","alibaba","tencent","xiaomi","upstage","nvidia","mistral","meta","meituan","gemini","claude","ollama-cloud","ark"],r={anthropic:{vendor:"anthropic",model:/^claude/i},minimax:{vendor:"minimax",model:/^minimax/i},stepfun:{vendor:"stepfun",model:/^step-/i},codex:{vendor:"openai",model:/^(?:gpt|o\d|codex)/i}};for(let l=0;l<Math.min(a.length-1,8);l++){const c=a[l].toLowerCase().replace(/^llm-/,"");if(c==="openrouter"||c==="opencode-zen"||i.includes(c)||/(?:^|[-_])free(?:$|[-_])/.test(c)||ve(c,a.slice(l+1).join("/")))return null;const u=Object.hasOwn(r,c)?r[c]:null;if(u){const d=a.slice(l+1);if(d[0].toLowerCase()===u.vendor&&d.shift(),d.length!==1||!u.model.test(d[0]))return null}for(const[d,m]of Object.entries(Fe))if(m.includes(c)||d===c)return{id:d,provider:c};if(Te.includes(c))return{id:c,provider:c};if(!o&&!mn.includes(c))return null}return null}function gn(e,t,n){const a=String(e??"").trim().toLowerCase().replace(/^llm-/,""),o=t?.planBilling?.modelPlans?.[e+":"+n]??t?.planBilling?.modelPlans?.[a+":"+n];if(Te.includes(o))return o;if(a.length===0)return null;for(const[r,l]of Object.entries(Fe))if(l.includes(a))return r;if(Te.includes(a))return a;const i=ta(e);return i!==null?i:ve(a,n)||/(?:^|[-_])free(?:$|[-_])/.test(a)||a==="opencode-zen"?null:typeof n=="string"&&n.normalize("NFKC").includes("/")?bn(e,n)?.id??null:ta(e,n)}function Js(e){if(Array.isArray(e?.planBilling?.autoProviders))return new Set(e.planBilling.autoProviders);const t=new Set,n=e?.codingPlans;if(n!==null&&typeof n=="object")for(const a of Te)a!=="go"&&n[a]?.enabled===!0&&t.add(a);return e?.goQuota?.enabled===!0&&t.add("go"),e?.codexQuotaEnabled===!0&&t.add("codex"),t}const Xs=new Set(["grok-4.5","glm-5.3","glm-5.3-flash","glm-5.2","glm-5.1","gpt-5.6-luna","kimi-k3","kimi-k2.7-code","kimi-k2.6","mimo-v2.6-flash","mimo-v2.6-pro","mimo-v2.5","mimo-v2.5-pro","minimax-m3","minimax-m2.7","qwen3.8-max","qwen3.7-max","qwen3.7-plus","qwen3.6-plus","hy3","longcat-2.0","muse-spark-1.2-contributor"].map($e));function eo(e,t,n){const a=String(e??"").trim().toLowerCase();if(a.length>0&&a!=="deepseek"&&!a.includes("deepseek"))return!1;const o=$e(t);if(o.length===0||!Xs.has(o))return!1;const i=n?.prices,r=i?.models??{};for(const l of Object.keys(r))if($e(l)===o)return!1;for(const l of Object.keys(i?.providers?.["opencode-go"]?.models??{}))if($e(l)===o)return!0;return!1}function rt(e,t,n){if(e==="deepseek-official"&&/^deepseek-(web-(search|fetch)|(search|fetch)-api|search-server)$/.test(t))return"api";let a=gn(e,n,t);a===null&&eo(e,t,n)&&(a="go");const o=n?.planBilling?.models;if(o!==null&&typeof o=="object"){const l=o[e+":"+t];if(l==="plan"||l==="api")return l;if(a!==null){const c=o[a+":"+t];if(c==="plan"||c==="api")return c}}for(const l of[e,a]){if(l==null)continue;const c=n?.planBilling?.providers?.[l];if(c==="plan"||c==="api")return c}if(a===null)return"api";const i=bn(e,t),r=i?.id===a?i.provider:e;return a==="go"&&/^(?:llm-)?(?:dsh-opencode-go|opencode-go(?:-plus)?)$/i.test(String(r).trim())||a==="kimi"&&/^(?:llm-)?kimi-coding(?:-plan)?$/i.test(String(r).trim())||a==="minimax"&&/^(?:llm-)?minimax-(?:m-?plan|token-plan)$/i.test(String(r).trim())||Js(n).has(a)?"plan":"api"}function yn(e,t){if(!e||!t)return{total:0,api:0};const n=to(t),a={enabled:t.peakEnabled===!0,effectiveAtMs:Date.parse(t.peakEffectiveAt||""),windows:t.peakWindows,holidays:t.peakHolidays},o=Date.now(),i=e.byProviderModel??e.byModel??{};let r=0,l=0;for(const g of Object.keys(i)){const b=g.indexOf(":"),p=b>0?g.slice(0,b):"deepseek",k=b>0?g.slice(b+1):g,h=fn(p,k,t);if(h.priced){const v=qs(h.entry);v&&h.billingMode==="deepseek-peak"&&t.prices?.ollamaPeak!==!1&&p.trim().toLowerCase().replace(/^llm-/,"")==="ollama-cloud"&&(t.prices?.ollamaTaggedPeak===!1?["deepseek-v4.1-flash","deepseek-v4-pro"].includes(k.trim().toLowerCase()):Ct(k,["deepseek-v4.1-flash","deepseek-v4-pro"])!==null)&&(v.peakSchedule??="ollama");const x=ln(i[g],rn(v,o,{...a,enabled:["deepseek-peak","utc-peak"].includes(h.billingMode)&&a.enabled})),y=cn(x,h.currency,n);r+=y,rt(p,k,t)==="api"&&(l+=y)}}const c={input:0,output:0,cacheRead:0,cacheWrite:0,reasoning:0};for(const g of Object.keys(i))c.input+=i[g].input??0,c.output+=i[g].output??0,c.cacheRead+=i[g].cacheRead??0,c.cacheWrite+=i[g].cacheWrite??0,c.reasoning+=i[g].reasoning??0;const u={input:Math.max(0,(e.input??0)-c.input),output:Math.max(0,(e.output??0)-c.output),cacheRead:Math.max(0,(e.cacheRead??0)-c.cacheRead),cacheWrite:Math.max(0,(e.cacheWrite??0)-c.cacheWrite),reasoning:Math.max(0,(e.reasoning??0)-c.reasoning)},d=ln(u,rn(Is("default",t.prices),o,a)),m=cn(d,t.prices?.currency==="CNY"?"CNY":"USD",n);return r+=m,l+=m,{total:r,api:l}}function to(e){const t=n=>typeof n=="number"&&Number.isFinite(n)&&n>0&&n<1e6;return e.currency==="CNY"&&t(e.exchangeRate)?e.exchangeRate:t(e.fxRates?.CNY)?e.fxRates.CNY:7.2}function hn(e,t){if(!e||!t)return!1;const n=e.byProviderModel??{};for(const a of Object.keys(n)){const o=a.indexOf(":"),i=o>0?a.slice(0,o):"deepseek",r=o>0?a.slice(o+1):a;if(rt(i,r,t)==="plan")return!0}return!1}function kn(e){return(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0)}function xn(e,t){if(e?.apiCost!==void 0)return ot(e);if(!hn(e,t))return vt(e,t);let n=0;for(const[a,o]of Object.entries(e.byProviderModel??{})){if(!Number.isFinite(o.cost))return yn(e,t).api;const i=a.indexOf(":");rt(a.slice(0,i),a.slice(i+1),t)==="plan"&&(n+=o.cost)}return Math.max(0,vt(e,t)-n)}function aa(e){const t=Math.abs(Math.round(Number(e)||0)),n=Math.floor(t/60),a=t%60;return"UTC"+(Number(e)<0?"-":"+")+n+(a>0?":"+String(a).padStart(2,"0"):"")}function ao(e){const t=e?.meta,n=Number(t?.timezoneOffsetMinutes);if(!Number.isFinite(n))return null;const a=-new Date().getTimezoneOffset();if(a===n)return null;const o=typeof t?.timezone=="string"&&t.timezone.length>0?t.timezone:"";return{hostLabel:o?o+" ("+aa(n)+")":aa(n),browserLabel:aa(a)}}function wn(e,t=n=>n){let n=t(e);const a=new Set;return{getSnapshot:()=>n,subscribe:o=>(a.add(o),()=>{a.delete(o)}),set:o=>{if(o=t(o),o!==n){n=o;for(const i of[...a])i()}}}}const{createElement:s,Fragment:R,useState:D,useEffect:J,useRef:Ne}=fe;function na({target:e,configured:t,source:n,t:a,api:o,placeholder:i,disabled:r}){const[l,c]=D(""),[u,d]=D(!1),[m,g]=D(!1),[b,p]=D(null),k=Ne(!1),h=r===!0||m,v=async()=>{const w=l.trim();if(!(w.length===0||h||k.current)){k.current=!0,g(!0),p(null);try{const N=await o.setCredential(e,w);c(""),d(!1),p({kind:"ok",text:N?.message??a("credentialSave")})}catch(N){p({kind:"err",text:String(N?.message??N)})}finally{k.current=!1,g(!1)}}},x=async()=>{if(!(h||k.current)){k.current=!0,g(!0),p(null);try{const w=await o.clearCredential(e);c(""),d(!1),p({kind:"ok",text:w?.message??a("credentialClear")})}catch(w){p({kind:"err",text:String(w?.message??w)})}finally{k.current=!1,g(!1)}}},y=()=>{c(""),d(!1)},f=t===!0?s("button",{className:"cm-btn small",type:"button",onClick:x,disabled:h},a("credentialClear")):null;return s("div",{className:"cm-field"},u?s("form",{className:"cm-field",autoComplete:"off",onSubmit:w=>{w.preventDefault(),v()}},s("input",{className:"cm-input",type:"password",name:"cm-credential-"+e,autoFocus:!0,value:l,placeholder:typeof i=="string"?i:"",disabled:h,autoComplete:"new-password","data-lpignore":"true","data-1p-ignore":"true","data-bwignore":"true","aria-label":a("credentialInputHint"),onChange:w=>c(w.target.value)}),s("div",{className:"cm-buttons"},s("button",{className:"cm-btn small",type:"submit",disabled:h||l.trim().length===0},a(m?"credentialSaving":"credentialSave")),s("button",{className:"cm-btn small",type:"button",onClick:y,disabled:m},a("cancel")),f)):s("div",{className:"cm-buttons"},s("button",{className:"cm-btn small",type:"button",onClick:()=>d(!0),disabled:h},a("credentialEdit")),f),s("span",{className:"cm-hint"},t===!0?a("credentialConfiguredOf",{source:typeof n=="string"&&n.length>0?n:"unknown"}):a("credentialNotConfigured")),s("span",{className:"cm-hint"},a("credentialInputHint")),Da(b))}function no({pending:e,t}){return!Array.isArray(e)||e.length===0?null:s("div",{className:"cm-msg err"},s("div",null,t("secretMigrationPending")),s("div",null,e.join("、")))}function At({size:e=16,className:t}){return s("svg",{width:e,height:e,className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("path",{d:"M4 4H12A2 2 0 0 1 14 6V11.5A2 2 0 0 1 12 13.5H4A2 2 0 0 1 2 11.5V6A2 2 0 0 1 4 4ZM4 5.3H12A0.7 0.7 0 0 1 12.7 6V11.5A0.7 0.7 0 0 1 12 12.2H4A0.7 0.7 0 0 1 3.3 11.5V6A0.7 0.7 0 0 1 4 5.3Z",fill:"currentColor",fillRule:"evenodd"}),s("path",{d:"M3.3 5.3H12.7V7.1H3.3Z",fill:"currentColor"}),s("path",{d:"M8 2.8A1.3 1.3 0 1 0 8 5.4A1.3 1.3 0 1 0 8 2.8Z",fill:"currentColor"}))}function sa(e){return e?"Conversation cost details":"本会话费用明细"}function Nn(e,t){const n=Ne(!1),a=Ne(""),o=t!==null&&typeof t=="object"?[t.input,t.cacheRead,t.cacheWrite,t.output,t.reasoning,t.cost].map(i=>String(i??0)).join("|"):"";J(()=>{if(!n.current){n.current=!0,a.current=o;return}if(o===""||o===a.current)return;a.current=o;const i=setTimeout(()=>{e.api?.reload?.()},800);return()=>clearTimeout(i)},[o])}function so(e,t,n,a){const o=t?t.own:e;if(!n||!t?.subagentCount)return o;const i=t.subagents,r={...o};for(const l of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...kt])r[l]=(o?.[l]??0)+(i?.[l]??0);r.apiCost=xn(o,a)+ot(i);for(const l of["byModel","byProviderModel"]){r[l]={...o?.[l]};for(const[c,u]of Object.entries(i?.[l]??{})){const d={...r[l][c]};d.apiCost=ot(d)+ot(u);for(const m of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...kt])d[m]=(d[m]??0)+(u[m]??0);r[l][c]=d}}return r}function oo(e){const t=e.useProjection?e.useProjection("costUsage"):void 0,n=e.useCost?.(u=>u)?.state,a=n?.config,[o,i]=D(null);Nn(e,t);const r=["input","output","cacheRead","cacheWrite","reasoning","calls","cost","apiCost"].map(u=>t?.[u]??"").join(":");J(()=>{if(!e.sessionId||!e.api?.getSessionCost)return;let u=!0,d=!1;const m=async()=>{if(!(d||typeof document<"u"&&document.hidden)){d=!0;try{const p=await e.api.getSessionCost(e.sessionId);u&&i({id:e.sessionId,include:a?.includeSubagentCost===!0,value:p})}catch{u&&i(p=>p?.id===e.sessionId&&p.include===(a?.includeSubagentCost===!0)?p:{id:e.sessionId,include:a?.includeSubagentCost===!0,value:null})}finally{d=!1}}};m();const g=a?.includeSubagentCost===!0?setInterval(m,1e4):null,b=()=>{document.hidden||m()};return typeof document<"u"&&document.addEventListener?.("visibilitychange",b),()=>{u=!1,g!==null&&clearInterval(g),typeof document<"u"&&document.removeEventListener?.("visibilitychange",b)}},[e.sessionId,n?.meta?.now,r,a?.includeSubagentCost]);const l=o&&o.id===e.sessionId&&o.include===(a?.includeSubagentCost===!0)?o:null,c=l?.value;return{usage:so(t,c,a?.includeSubagentCost||c&&c.subagentCount>0,a),config:a,pending:!!e.sessionId&&!!e.api?.getSessionCost&&!l,unrecorded:!!c&&!c.found&&!c.subagentCount}}function ro(e){const t=F(e.config)==="en";return e.pending?t?"Loading session cost…":"正在读取本会话费用…":e.unrecorded?t?"Session cost: no ledger records":"本会话暂无账本记录":e.usage?"":t?"Session cost unavailable":"本会话费用暂不可用"}function io(e,t){if(Number.isFinite(e?.costCny)||Number.isFinite(e?.costEur)){const o=_(e,{...t,showTotalWithPlan:!0}),i=_(e,{...t,showTotalWithPlan:!1});return{cost:t.showTotalWithPlan?o:i,planPart:t.showTotalWithPlan?0:Math.max(0,o-i)}}let n=0,a=vt(e,t);if(t.showTotalWithPlan!==!0&&(e.apiCost!==void 0||hn(e,t))){const o={total:vt(e,t),api:xn(e,t)};n=Math.max(0,o.total-o.api),n>0&&(a=o.api)}return{cost:a,planPart:n}}function lo(e,t){return Object.entries(e?.byProviderModel??{}).filter(([,n])=>n.input||n.output||n.cacheRead||n.cacheWrite||n.reasoning).map(([n,a])=>bt(n)+" "+z(_(a,{...t,showTotalWithPlan:!0}),t)).join("; ")}function co(e){const t=e.useCost?.(h=>h)?.state?.config,[n,a]=D(null),[o,i]=D(""),r=e.turn?.start?.seq,l=e.turn?.end?.seq,c=e.sessionId,u=JSON.stringify([t?.prices,t?.priceOverrides,t?.priceMatch,t?.planBilling,t?.codingPlans,t?.goQuota?.enabled,t?.peakEnabled,t?.peakEffectiveAt,t?.peakWindows,t?.peakHolidays,t?.exchangeRate]);if(J(()=>{let h=!0;if(a(null),i(""),!(t?.hideTurnCost||!c||r==null||l==null))return e.api.getTurnCost(c,r,l).then(v=>{h&&a(v)},v=>{h&&i(String(v.message??v))}),()=>{h=!1}},[c,r,l,u,t?.hideTurnCost]),!t||t.hideTurnCost||r==null||l==null)return null;const d=F(t)==="en",m=d?{input:"Input",output:"Output",cacheRead:"Cache read",cacheWrite:"Cache write",reasoning:"Reasoning"}:{input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",reasoning:"推理"},g=h=>{const v=Number(t.exchangeRate),x=h*(Number.isFinite(v)&&v>0?v:1),y=t.decimals??2;return z(h,x>0&&x<10**-(y+2)?{...t,decimals:Math.max(8,y)}:t)},b=h=>z(h,{...t,decimals:Math.max(8,t.decimals??2)}),p=d?{model:"Model call",compaction:"Context compaction",search:"Native search",fetch:"Web fetch"}:{model:"模型调用",compaction:"上下文压缩",search:"原生搜索",fetch:"网页抓取"},k=(h,v)=>s("div",{key:v,style:{marginBottom:4,overflowWrap:"anywhere"}},bt(h.provider+":"+h.model)+" · "+(m[h.bucket]||(h.bucket==="fetchRequests"?d?"Fetch requests":"抓取请求":d?"Search requests":"搜索请求"))+(h.plan?" (Plan)":"")+": "+(h.requests?h.requests+(d?" requests":" 次"):h.tokens.toLocaleString())+" × "+(h.priced?b(h.rate):"?")+(h.requests?" ≈ ":" / 1,000,000 ≈ ")+(h.priced?g(h.cost):"?"),h.priced?h.bucket==="reasoning"&&h.rate===0?d?" (no separate charge)":"(不单独收费)":"":d?" (price unavailable)":"(未配置价格)");return s("details",{className:"cm-note",style:{fontSize:12,marginTop:6}},s("summary",{style:{cursor:"pointer"},title:d?"Log estimate at configured prices; session cost uses recorded ledger amounts.":"本轮按日志和配置价格估算,本会话按账本已入账金额汇总。"},d?"Turn cost":"本轮费用",n?.found?" ≈ "+g(_(n,t))+(n.rows.some(h=>!h.priced)?d?" + unpriced usage":" + 未定价用量":""):n?.inherited?d?" · inherited history":" · 继承历史":o?" ⚠":""),o?s("div",{role:"alert"},o):n?n.found?s(R,null,s("p",null,d?"Estimated from recorded usage and configured prices; rates per 1M tokens.":"按已记录用量和配置价格估算;单价单位为每百万 Token。"),s("p",null,"API ≈ "+g(_(n,{...t,showTotalWithPlan:!1}))+" · Plan ≈ "+g(_(n,{...t,showTotalWithPlan:!0})-_(n,{...t,showTotalWithPlan:!1}))+(d?" (equivalent)":"(等值)")),n.rows.map(k),s("details",null,s("summary",{style:{cursor:"pointer"}},(d?"Individual calls":"逐次调用明细")+" ("+n.calls.length+")"),n.calls.map((h,v)=>s("details",{key:v,style:{margin:"6px 0"}},s("summary",{title:h.provider+":"+h.model,style:{cursor:"pointer",overflowWrap:"anywhere"}},"#"+(v+1)+" "+p[h.kind]+" · "+bt(h.provider+":"+h.model)+" · "+new Date(h.atMs).toLocaleTimeString()+" · "+(h.plan?"Plan ":"API ")+(h.priced?"≈ "+g(h.cost):d?"price unavailable":"未配置价格")+(h.longContext?d?" · long context":" · 长上下文价格":"")),h.metering?s("p",null,"billion-context · "+h.metering.upstream+(h.metering.attempt>1?(d?" · Retry ":" · 重试 ")+h.metering.attempt:"")+(h.metering.complete?"":d?" · partial usage":" · 用量回执不完整")):null,h.rows.map(k))))):n.inherited?d?"Inherited usage is not billed again in this conversation.":"继承的历史用量不在本会话重复计费。":d?"Complete usage records unavailable":"没有完整用量记录":d?"Loading…":"加载中…")}function uo(e){const t=e.useCost?.(C=>C),n=oo(e),{usage:a,config:o}=n,[i,r]=D(null),l=e.entryPosition!=="header"&&o?.hideSessionCostDock===!0,c=!l&&!!e.sessionId&&i===e.sessionId;if(J(()=>{r(null)},[e.sessionId,l]),l||!e.sessionId)return null;const u=F(o)==="en",d=Y(F(o)),m=o?ro(n):t?.error||(u?"Loading…":"加载中…"),g=s(Vn,{open:c,onClose:()=>r(null),sessionId:e.sessionId,state:t?.state,error:t?.error,api:e.api});if(o&&m)return s(R,null,s("span",{className:"cm-dp-status",role:"status",title:m},m),g);const{cost:b,planPart:p}=a&&o?io(a,o):{cost:0,planPart:0},k={amount:z(b,o),planAmount:z(p,o),hitRate:kn(a)>0?((a?.cacheRead??0)/kn(a)*100).toFixed(1)+"%":"—",input:I(a?.input??0),cache:I((a?.cacheRead??0)+(a?.cacheWrite??0)),output:I(a?.output??0)},h=o?d(p>0?"sessionLineSplit":"sessionLine",k):m,v=o?lo(a,o):"",x=sa(u),f=e.entryPosition==="header"||o?.sessionCostCompact===!0?p>0?"sessionLineSplitCompact":"sessionLineCompact":p>0?"sessionLineSplit":"sessionLine",w=m||d(f,k),N=()=>va(e.api?.loadStatistics,{state:t?.state,sessionId:e.sessionId});return s(R,null,s(V,{portal:!0,label:[h,o?.includeSubagentCost?u?"Includes subagents":"含子代理":u?"Main session only":"仅主会话",v].filter(Boolean).join("; "),side:"top"},s("button",{type:"button",className:"cm-dp"+(e.entryPosition==="header"?" cm-dp-header":""),"aria-label":x,"aria-haspopup":"dialog","aria-expanded":c,onMouseEnter:N,onFocus:N,onClick:()=>r(e.sessionId)},s("span",{className:"cm-dl"},w))),g)}const mo={CNY:"¥",USD:"$",EUR:"€",GBP:"£",JPY:"JP¥",KRW:"₩",INR:"₹",HKD:"HK$",SGD:"S$",AUD:"A$",CAD:"C$",CHF:"CHF",NZD:"NZ$",BRL:"R$",MXN:"MX$",ZAR:"R",TRY:"₺",SEK:"kr",NOK:"NKr",DKK:"Dkr",PLN:"zł",THB:"฿",IDR:"Rp",MYR:"RM",PHP:"₱",ILS:"₪"};function Sn(e,t){const n=e?.symbol||"$";return!t||t===e?.currency?n:mo[t]??t+" "}function Cn(e,t,n){const a=t?.balance?.currency,o=(a==="display"?t?.currency:a)??n,i=t?.fxRates;return o!==n&&i?.[n]>0&&i?.[o]>0?[e/i[n]*i[o],o]:[e,n]}function Re(e,t,n){const a=typeof n=="string"?n.toUpperCase():"",[o,i]=Cn(e,t,a);return ce(o,{symbol:Sn(t,i),decimals:Math.max(2,Math.min(10,Math.floor(Number(t?.decimals)||2)))})}function oa(e,t){const n=Number(e?.balance?.budgetCap);if(Number.isFinite(n)&&n>0)return n;const a=Number(t?.maxBudget);return Number.isFinite(a)&&a>0?a:null}function po(e){const t=e.today,n=t?.byProviderModel;if(n===null||typeof n!="object"||Object.keys(n).length===0)return Number(t?.cost)||0;let a=0;for(const[o,i]of Object.entries(n)){const r=o.indexOf(":");let l=r>=0?o.slice(0,r):o;l.startsWith("llm-")&&(l=l.slice(4)),/^deepseek(?:-official|-account)?$/.test(l)&&(a+=Number(i?.cost)||0)}return a}function vn(e,t,n,a,o=null){const i=(o??t?.customBalance)?.channels??[];if(n==="custom"){const u=lt(t,a,o);if(!i.length||u==="CREDITS")return 0;const d=new Set(i.map(k=>k.replace(/^llm-/,""))),m=Number(t?.fxRates?.[u]??t?.exchangeRate),g=u==="USD"||!(Number.isFinite(m)&&m>0)?1:m,b={CNY:"costCny",EUR:"costEur"}[u];let p=0;for(const[k,h]of Object.entries(e.today?.byProviderModel??{}))d.has(k.split(":",1)[0].replace(/^llm-/,""))&&(p+=b&&Number.isFinite(h?.[b])?h[b]:(Number(h?.cost)||0)*g);return p}const r=po(e),l=e.balance?.currency;if(l==="USD")return r;if(l==="CREDITS")return 0;const c=Number(t?.fxRates?.[l]??t?.exchangeRate);return r*(Number.isFinite(c)&&c>0?c:1)}function ra({remaining:e,spend:t,todayUsed:n,cap:a}){if(a===null||a<=0)return{remainingPct:0,todayPct:0,spentPct:0,hasCap:!1,pastSpend:0,today:0};const o=Math.max(0,Number(e)||0),i=Math.max(0,Number(t)||0),r=Math.max(0,Math.min(i,Number(n)||0)),l=Math.max(0,i-r),c=Math.max(0,Math.min(100,o/a*100)),u=Math.max(0,Math.min(100-c,r/a*100)),d=Math.max(0,Math.min(100-c-u,l/a*100));return{remainingPct:c,todayPct:u,spentPct:d,hasCap:!0,pastSpend:l,today:r}}function ia(e,t,n=null,a=null){const o=n??e.customBalance;if((a??t?.customBalance)?.adapter==="tokenrhythm")return{cap:null,...ra({remaining:o?.remaining,cap:null})};const i=oa(lt(t,o,a)==="CREDITS"?null:t,o),r=Number(o?.remaining)||0,l=o?.spend==null&&i!==null?Math.max(0,i-r):Number(o?.spend)||0,c=vn(e,t,"custom",o,a);return{cap:i,...ra({remaining:r,spend:l,todayUsed:c,cap:i})}}function fo(e,t){const n=e.balance,a=oa(t,null),o=Number(n?.totalBalance)||0,i=vn(e,t,"official",null),r=a===null?0:Math.max(0,a-o);return{cap:a,...ra({remaining:o,spend:r,todayUsed:i,cap:a})}}function la(e){const{segments:t,direction:n="remaining"}=e,{remainingPct:a,todayPct:o,spentPct:i,hasCap:r}=t;if(!r)return null;const l=[];a>0&&l.push(s("div",{className:"cm-bbox-fill",style:{width:a+"%"}})),o>0&&l.push(s("div",{className:"cm-bbox-seg-today",style:{width:o+"%"}})),i>0&&l.push(s("div",{className:"cm-bbox-seg-spent",style:{width:i+"%"}}));const c=n==="used"?[...l].reverse():l;return s("div",{className:"cm-bbox-bar segments"+(n==="used"?" rev":"")},...c)}function bo(e,t,n,a,o){const i=[e("balanceBarRemaining",{amount:a})];return n.today>0&&i.push(e("balanceBarToday",{amount:t(n.today)})),n.pastSpend>0&&i.push(e("balanceBarSpent",{amount:t(n.pastSpend)})),o!==null&&o>0&&i.push(e("balanceBudgetCapLabel")+": "+t(o)),i.join(" · ")}function De(e){const[t,n]=D(!1),[a,o]=D(null);return{busy:t,err:a,run:()=>{t||typeof e!="function"||(n(!0),o(null),Promise.resolve().then(e).catch(r=>{o(r?.message??String(r))}).finally(()=>{n(!1)}))}}}const be=(e,t)=>({role:"button",tabIndex:0,"aria-busy":e?"true":"false",onClick:t,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),t())}});function Se(e,t){const n=[e("clickToRefresh")];return t.busy&&n.push(e("refreshing")),t.err&&n.push("⚠ "+e("queryFailed")+": "+t.err),n}const go="https://platform.deepseek.com/usage";function it(e,t=go,n=e("balanceRechargeLink")){if(!t)return null;try{const a=new URL(t);if(!["http:","https:"].includes(a.protocol)||a.username||a.password)return null}catch{return null}return s("a",{className:"cm-bal-link",href:t,target:"_blank",rel:"noreferrer noopener",title:n,"aria-label":n,onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation()},s("svg",{width:14,height:14,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},s("path",{d:"M8 4H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4M11 3h6v6M9 11l8-8"})))}const Mt=wn({});function Pt(e,t,n){const a=()=>{const u=Mt.getSnapshot()[t];if(u!==void 0)return u;try{return window.localStorage?.getItem("cm.balance.hidden."+t)==="1"}catch{return!1}},[o,i]=D(a);J(()=>{const u=()=>i(a()),d=Mt.subscribe(u);return u(),d},[t]);const r=e.balance?.quickHide===!0,l=r&&o,c=u=>{u.stopPropagation();const d=!a();try{window.localStorage?.setItem("cm.balance.hidden."+t,d?"1":"0")}catch{}Mt.set({...Mt.getSnapshot(),[t]:d}),i(d)};return{hidden:l,label:u=>r?s("span",{role:"button",tabIndex:0,"aria-pressed":l,title:n("balanceToggle"),onClick:c,onKeyDown:d=>{d.stopPropagation(),(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c(d))}},u):u,tip:[n("balanceHidden"),n("balanceToggle")].join(" · ")}}function ca(e){const{state:t,wide:n,api:a}=e,o=t.balance,i=Y(F(t.config)),r=De(a?()=>a.refreshBalance():null),l=Pt(t.config,e.accountId??"official",i),c=e.label??An(i,t.config);if(!o||o.status==="off")return null;if(o.status==="error")return s(V,{portal:!0,label:[i("balanceQueryFailed",{message:o.message||i("unknownError")}),...Se(i,r)].join("; "),side:"right",delayMs:300},s("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+" cm-bal-err"+(r.busy?" busy":""),...be(r.busy,r.run)},n?s(R,null,c," ",s("span",{className:"cm-num"},i("queryFailed"))):"⚠"));const u=l.hidden?l.tip:Mn(i,o,t.config,t.reconcile,r);return s(V,{portal:!0,label:e.label?s(R,null,s("strong",null,e.label),u):u,side:"right",delayMs:300},s("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+(r.busy?" busy":""),...be(r.busy,r.run)},n?s(R,null,s("span",{className:"cm-balance-name"},l.label(c),it(i)),s("span",{className:"cm-num cm-bal-amt"},l.hidden?"••••":Re(o.totalBalance,t.config,o.currency)),t.reconcile?.ok===!1?" ⚠":""):s(At,{size:16})))}function yo(e,t,n){if(n||e.config?.balance?.officialChannelOnly!==!0)return!0;const a=o=>/^(?:llm-)?deepseek(?:-official|-account)?$/.test(String(o).trim().toLowerCase());return typeof t=="string"&&t.trim()?a(t):Object.keys(e.today?.byProviderModel??{}).some(o=>a(o.split(":")[0]))}function An(e,t){return e(t?.balance?.showSource===!0?"officialBalance":"balance")}function Mn(e,t,n,a,o){const i=[e("officialBalance")+" "+Re(t.totalBalance,n,t.currency),e("grantedToppedUp",{granted:Re(t.grantedBalance,n,t.currency),toppedUp:Re(t.toppedUpBalance,n,t.currency)}),...n.balance?.showProgressBar&&oa(n,null)===null?[e("balanceNoCap")]:[],...a?.ok===!1?["⚠ "+a.message]:[],...Se(e,o)];return s("div",{style:{maxWidth:"min(225px, 68vw)",whiteSpace:"normal",fontSize:11,lineHeight:1.5}},...i.map((r,l)=>s("div",{key:l},r)))}function ho(e){const{state:t,wide:n,api:a}=e,o=t.config,i=t.balance,r=Y(F(o)),l=De(a?()=>a.refreshBalance():null),c=Pt(o,"official",r);if(!i||i.status!=="ok")return null;const u=fo(t,o),d=c.hidden?"••••":Re(i.totalBalance,o,i.currency),m=c.hidden?c.tip:Mn(r,i,o,t.reconcile,l),g=s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-balance-name"},s("span",{className:"cm-bbox-label"},c.label(An(r,o))),it(r)),s("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},d)),c.hidden?null:s(la,{segments:u,direction:re(o,"balance")}));return s(V,{portal:!0,label:m,side:"right",delayMs:300},s("div",{"data-cm-display":"balance",className:"cm-bbox clickable"+(n?"":" rail")+(l.busy?" busy":""),...be(l.busy,l.run)},n?g:s("div",{className:"cm-bbox-rail cm-num"},c.hidden||!u.hasCap?d:Math.round(u.remainingPct)+"%")))}function ua(e,t){const n=typeof e?.label=="string"?e.label:"",a=typeof e?.labelEn=="string"?e.labelEn:"";return t==="en"?a||n||"Custom balance":n||a||"自定义余额"}function lt(e,t,n){if((n??e?.customBalance)?.adapter==="tokenrhythm")return"CNY";if((n??e?.customBalance)?.adapter==="aliyun"&&["CNY","USD","EUR"].includes(t?.unit))return t.unit;const a=n?.unit??e?.customBalance?.unit;return["CNY","EUR","USD","CREDITS"].includes(a)?a:["CNY","EUR","CREDITS"].includes(t?.unit)?t.unit:"USD"}function Qe(e,t,n,a){const o=lt(t,n,a),i=Number(e);if(!Number.isFinite(i))return"—";const r=Math.max(2,Math.min(6,Math.floor(Number(t?.decimals)||4)));if(o==="CREDITS")return un(i,r)+" Credits";const l=t?.currency==="USD"?1:Number(t?.exchangeRate);if((a??t?.customBalance)?.convertToDisplayCurrency===!0&&o==="USD"&&(t?.balance?.currency??"native")==="native"&&l>0&&Number.isFinite(l)){const m=i*l;return Number.isFinite(m)?ce(m,t):"—"}const[u,d]=Cn(i,t,o);return Number.isFinite(u)?ce(u,{symbol:Sn(t,d),decimals:r}):"—"}function da(e,t,n,a,o=null){const i=Qe(e.remaining,t,e,o);if((o??t?.customBalance)?.adapter==="aliyun"&&e.message)return n("customBalanceRemaining",{amount:i})+" · "+e.message;if(o?.adapter==="openai-credits"){const g=b=>Qe(b,t,e,o);return n("openAiCreditSummary",{total:g(e.maxBudget),used:g(e.spend),remaining:i,expiry:o.grantExpiry})}if((o??t?.customBalance)?.adapter==="tokenrhythm")return n("customBalanceRemaining",{amount:i});const r=g=>Qe(g,t,e,o);if(a&&t.balance?.showProgressBar===!0){const g=ia(a,t,e,o);return[bo(n,r,g,i,g.cap),n("updatedAt",{time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"})].join(" · ")}const l=e.spend!==null?r(e.spend):"—",c=e.maxBudget!==null?r(e.maxBudget):"—",u=lt(t,e,o)==="CREDITS"?NaN:Number(t?.balance?.budgetCap),d=Number.isFinite(u)&&u>0?n("balanceBudgetCapLabel")+": "+r(u):"",m=e.maxBudget!==null&&e.spend!==null?n("customBalanceLine",{remaining:i,spend:l,maxBudget:c,time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"}):n("customBalanceRemaining",{amount:i});return d?m+" · "+d:m}function ko(e,t,n,a,o,i){const r=ua(o??t.customBalance??{},F(t)),l=i?.hidden?"••••":Qe(a.remaining,t,a,o),c=ia(e,t,a,o);return{level:"ok",rail:i?.hidden||!c.hasCap?l:Math.round(c.remainingPct)+"%",body:s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-balance-name"},s("span",{className:"cm-bbox-label"},i?i.label(r):r),it(n,o?.dashboardUrl||"",r)),s("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},l)),i?.hidden?null:s(la,{segments:c,direction:re(t,"balance")}))}}function Ot(e,t){if(t?.hideCustomBalance===!0)return[];const n=t?.customBalances??[],a=Array.isArray(e?.customBalances)?e.customBalances:[],o=[];return n.forEach((i,r)=>{if(i?.enabled!==!0||i.display!=="sidebar"&&i.display!=="both")return;const l=a.find(c=>c.index===r)??(a.length===1&&n.length===1?a[0]:null);o.push({index:r,entry:i,snapshot:l})}),o.length===0&&a.length===0&&t?.customBalance?.enabled===!0&&(t.customBalance.display==="sidebar"||t.customBalance.display==="both")&&e?.customBalance?.status&&e.customBalance.status!=="off"&&o.push({index:null,entry:t.customBalance,snapshot:e.customBalance}),o}function xo(e){const{state:t,wide:n,api:a}=e,o=t.config,i=Y(F(o)),r=Ot(t,o);return r.length===0?null:s(R,null,r.map(({index:l,entry:c,snapshot:u})=>s(["tokenrhythm","openai-credits"].includes(c.adapter)?Pn:wo,{key:"cb-"+l,state:t,wide:n,api:a,t:i,index:l,entry:c,snapshot:u})))}function wo(e){const{state:t,wide:n,api:a,t:o,index:i,entry:r,snapshot:l}=e,c=t.config,u=Pt(c,"custom-"+i,o),d=De(a?()=>a.refreshCustomBalance(i):null);if(l==null||l.status!=="ok")return null;const m=ko(t,c,o,l,r,u),g=u.hidden?u.tip:[da(l,c,o,t,r),...Se(o,d)].join(" · ");return s(V,{portal:!0,label:g,side:"right",delayMs:300},s("div",{"data-cm-display":"customBalance",className:"cm-bbox clickable"+(m.level==="ok"?"":" "+m.level)+(n?"":" rail")+(d.busy?" busy":""),...be(d.busy,d.run)},n?m.body:s("div",{className:"cm-bbox-rail cm-num"},m.rail)))}function No(e){const{state:t,wide:n,api:a}=e,o=t.config,i=Y(F(o)),r=Ot(t,o);return r.length===0?null:s(R,null,r.map(({index:l,entry:c,snapshot:u})=>s(Pn,{key:"cbr-"+l,state:t,wide:n,api:a,t:i,index:l,entry:c,snapshot:u})))}function Pn(e){const{state:t,wide:n,api:a,t:o,index:i,entry:r,snapshot:l}=e,c=t.config,u=Pt(c,"custom-"+i,o),d=l??Va(i),m=De(a?()=>a.refreshCustomBalance(i):null);if(d.status==="off")return null;const g=ua(r??c.customBalance??{},F(c));if(d.status==="error")return s(V,{portal:!0,label:[d.message||o("unknownError"),...Se(o,m)].join("; "),side:"right",delayMs:300},s("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+" cm-bal-err"+(m.busy?" busy":""),...be(m.busy,m.run)},n?s(R,null,s("span",{className:"cm-balance-name"},s("span",{className:"cm-bal-label",title:g},g),it(o,r?.dashboardUrl||"",g)),s("span",{className:"cm-num cm-bal-amt"},o("queryFailed"))):"⚠"));const b=u.hidden?"••••":Qe(d.remaining,c,d,r),p=u.hidden?u.tip:[da(d,c,o,t,r),...Se(o,m)].join(" · ");return s(V,{portal:!0,label:p,side:"right",delayMs:300},s("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(n?"":" cm-foot-rail")+(m.busy?" busy":""),...be(m.busy,m.run)},n?s(R,null,s("span",{className:"cm-balance-name"},s("span",{className:"cm-bal-label",title:g},u.label(g)),it(o,r?.dashboardUrl||"",g)),s("span",{className:"cm-num cm-bal-amt"},b)):s(At,{size:16})))}function On(e){const n=(e.useCost?e.useCost(p=>p):void 0)?.state;if(!n)return null;const a=n.config,o=Y(F(a)),i=a.corner??{enabled:!1,goRolling:!0,goWeekly:!0,goMonthly:!0,budget:!0},r=n.goQuota,l=a?.goQuota?.enabled!==!1&&r?.status==="ok",c=p=>p!==null&&typeof p?.percent=="number"?Math.round(Math.max(0,Math.min(100,p.percent))):null,u=[];if(a.sidebarModels?.dock){const p=zn(n,a.sidebarModels.period,o);p.length&&u.push({key:"model-top",text:s(R,null,s("span",{className:"cm-bal-label"},p[0].label),s("span",{className:"cm-bal-amt"},z(p[0].cost,a))),tip:p[0].label+" "+z(p[0].cost,a),level:"ok"})}const d=(p,k,h,v)=>{if(!i.enabled||!p||!l)return;const x=c(k);if(x===null)return;const y=typeof k.resetsAt=="string"&&k.resetsAt.length>0?o("goResetAt",{time:new Date(k.resetsAt).toLocaleString()}):"";u.push({key:h,text:o(h)+" "+x+"%",tip:o(v)+": "+x+"%"+(y?" · "+y:""),level:x>=100?"over":x>=80?"warn":"ok"})},m=a?.goQuota?.main==="weekly"||a?.goQuota?.main==="monthly"?a.goQuota.main:"rolling",g=[m,...["rolling","weekly","monthly"].filter(p=>p!==m)],b=p=>p==="rolling"?["goRolling",r?.rolling,"goShortRolling","cornerGoRolling"]:p==="weekly"?["goWeekly",r?.weekly,"goShortWeekly","cornerGoWeekly"]:["goMonthly",r?.monthly,"goShortMonthly","cornerGoMonthly"];for(const p of g){const[k,h,v,x]=b(p);d(i[k]===!0,h,v,x)}if(i.enabled&&i.budget===!0){const p=a.budget??{enabled:!1,amount:100,period:"month"};if(p.enabled===!0){const k=Number(a.exchangeRate),v=(n.budgetUsed??(p.period==="day"?_(n.today,a):p.period==="all"?_(n.total,a):_(n.month,a)))*(Number.isFinite(k)&&k>0?k:1),x=Math.max(0,Number(p.amount)||0),y=x>0?Math.min(999,v/x*100):null;if(y!==null){const f=y>=100?"over":y>=80?"warn":"ok";u.push({key:"budget",text:o("budgetShort")+" "+y.toFixed(1)+"%",tip:o("budgetOf",{period:o(et[p.period]??"periodMonth")})+" · "+o("usedOf",{used:ce(v,a),amount:ce(x,a)}),level:f})}}}return u.length===0?null:s("div",{className:"cm-corner"},u.map(p=>s(V,{portal:!0,key:p.key,label:p.tip,side:"top",delayMs:500},s("span",{className:"cm-corner-chip"+(p.key==="model-top"?" cm-model-top":"")+(p.level==="ok"?"":" "+p.level)},p.text))))}function ma(e,t,n,a){if(a==="volcengine"&&(n=[]),!Array.isArray(t)||t.length===0||!Number.isFinite(e))return null;const o=(b,p)=>{const k=new Date(e);return k.setUTCDate(k.getUTCDate()+b),k.setUTCHours(p,0,0,0),k.getTime()},i=new Set,r=Math.max(12,Math.min(380,(Array.isArray(n)?n.length:0)+7));for(let b=-r;b<=r;b+=1){i.add(o(b,16));for(const p of t){const k=Number(p?.start),h=Number(p?.end);!Number.isFinite(k)||!Number.isFinite(h)||(i.add(o(b,k)),i.add(o(h<=k?b+1:b,h)))}}const l=[...i].sort((b,p)=>b-p).flatMap(b=>{const p=St(b-1,void 0,t,n),k=St(b,void 0,t,n);return p===k?[]:[{at:b,intoPeak:k}]});let c=null,u=null;for(const b of l)b.at<=e&&(c===null||b.at>c.at)&&(c=b),b.at>e&&(u===null||b.at<u.at)&&(u=b);const d=on(e,n),m=d??sn(e);return m!==null?u===null?null:{inPeak:!1,weekend:d===null,...d?{holiday:!0}:{},prevAtMs:m.start,nextAtMs:u.at,nextIntoPeak:u.intoPeak}:c===null||u===null?null:{inPeak:St(e,void 0,t,n),weekend:!1,prevAtMs:c.at,nextAtMs:u.at,nextIntoPeak:u.intoPeak}}function Be(e,t){if(!e||e.peakNotice===!1||e.peakEnabled!==!0)return null;const n=Date.parse(e.peakEffectiveAt||"");return Number.isFinite(n)&&t<n?null:pa(e,t)}function pa(e,t){const n=String(e?.peakProvider??"").trim().toLowerCase().replace(/^llm-/,""),a=e?.prices?.providers?.[n]??(["deepseek-official","deepseek-account",""].includes(n)?e?.prices?.providers?.deepseek:void 0),o=a&&{peakSchedule:n==="ollama-cloud"&&e.prices.ollamaPeak!==!1?"ollama":["volcengine","ark"].includes(n)&&e.prices.volcenginePeak!==!1?"volcengine":void 0,...a},i={enabled:e?.peakEnabled===!0,effectiveAtMs:Date.parse(e?.peakEffectiveAt),windows:e?.peakWindows,holidays:e?.peakHolidays};return o&&He(o,t,i)!==null?Qs(o,t,i):ma(t,e?.peakWindows??[],e?.peakHolidays,["volcengine","ark"].includes(n)?"volcengine":void 0)}function fa(e,t){const n=e?.config,a=t??n?.peakProvider??e?.meta?.defaultProvider;return n&&a?{...n,peakProvider:a}:n}function Tn(e,t,n){let a=t.prevAtMs;for(let o=0;o<16;o++){const i=pa(e,a-1);if(!i||i.inPeak!==t.inPeak||i.prevAtMs>=a)break;a=i.prevAtMs}return{start:a,progress:Math.max(0,Math.min(100,(n-a)/Math.max(1,t.nextAtMs-a)*100))}}function Tt(e,t,n){const{progress:a}=Tn(e,t,n);return(t.weekend||t.holiday?a:(t.inPeak?0:50)+a/2)+"%"}function Ge(e,t){const[n,a]=D(Date.now());return J(()=>{if(t!==void 0)return;let o;const i=()=>{if(window.clearTimeout(o),document.hidden)return;const r=Date.now(),l=Be(e,r);a(r),o=window.setTimeout(i,Math.max(100,Math.min(3e4,(l?.nextAtMs??r+3e4)-r)))};return i(),document.addEventListener("visibilitychange",i),()=>{window.clearTimeout(o),document.removeEventListener("visibilitychange",i)}},[t,e.peakWindows,e.peakHolidays,e.peakProvider]),t??n}function Ve(e){return e.holiday===!0?{short:"holidayShort",chip:"holidayChip",notice:"holidayAllOffPeak"}:e.weekend===!0?{short:"weekendShort",chip:"weekendChip",notice:"weekendAllOffPeak"}:e.inPeak?{short:"peakShort",chip:"peakShort",notice:"peakNotice"}:{short:"offPeakShort",chip:"offPeakShort",notice:"offPeakActive"}}function Ce(e,t,n){const a=Math.max(0,e.nextAtMs-t),o=Math.max(1,Math.ceil(a/6e4)),i=Math.floor(o/60),r=o%60;return i>0?r>0?n("countdownHourMinute",{h:i,m:r}):n("countdownHoursOnly",{h:i}):n("countdownMinute",{m:o})}function Rn(e){const t=Ne(null),n=Ne(e.actions);n.current=e.actions,J(()=>{const c=t.current;if(!c)return;try{typeof c.showPopover=="function"?c.showPopover():c.removeAttribute("popover")}catch{c.removeAttribute("popover")}let u=!1;const d=p=>{c.contains(p.target)&&(u=!0,p.stopPropagation())},m=p=>{u&&(u=!1,p.stopPropagation())},b=[["pointerdown",d],["pointerup",m],["pointercancel",m],["touchstart",d],["click",p=>{if(!c.contains(p.target))return;p.stopPropagation();const k=p.target.closest?.("[data-cm-action]");k&&!k.disabled&&n.current[k.dataset.cmAction]?.()}]];for(const[p,k]of b)window.addEventListener?.(p,k,{capture:!0,passive:!0});return()=>{for(const[p,k]of b)window.removeEventListener?.(p,k,!0);try{c.hidePopover()}catch{}}},[]);const{actions:a,children:o,...i}=e,r=s("div",{...i,ref:t,popover:"manual"},o);let l;try{l=le("react-dom")?.createPortal}catch{}return typeof l=="function"?l(r,document.body):r}const So="cm-peak-alert-preview";function Co(e){return e.useCost?.(n=>n)?.state?.config?.peakEnabled===!0?s(ct,{...e,view:"alert"}):null}function vo(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const i=Ve(o),r=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)});return s(V,{portal:!0,label:n(i.notice),side:"right",delayMs:300},s("div",{"data-cm-display":"peak",className:"cm-peak-strip "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off")},s("div",{className:"cm-peak-track"},s("div",{className:"cm-peak-segment cm-peak-high"}),s("div",{className:"cm-peak-segment cm-peak-low"}),s("div",{className:"cm-peak-marker",style:{left:Tt(t,o,a)}})),s("span",{className:"cm-peak-chip"},n(i.chip)+" · "+r)))}function Ao(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const i=Ve(o),r=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)});return s(V,{portal:!0,label:n(i.notice),side:"right",delayMs:300},s("div",{"data-cm-display":"peak",className:"cm-peak-classic "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off")},s("div",{className:"cm-peak-classic-marker",style:{left:"clamp(6px, "+Tt(t,o,a)+", calc(100% - 6px))"}}),s("div",{className:"cm-peak-track"},s("div",{className:"cm-peak-segment cm-peak-high"}),s("div",{className:"cm-peak-segment cm-peak-low"})),s("span",{className:"cm-peak-classic-chip"},n(i.chip)+" · "+r)))}let Dn;function Mo(){return Dn??=le.async("./client.peak.js").then(e=>e.mount({peakView:Be,peakPhaseAt:ma,peakPhaseForConfig:pa,peakConfigForState:fa,peakPeriodProgress:Tn,usePeakClock:Ge,phaseLabelKeys:Ve,countdownText:Ce,resolveLocale:F,makeT:Y,Tooltip:V,FloatingCard:Rn})).catch(e=>{throw Dn=null,e})}function ct(e){return s(ae,{...e,load:Mo,quiet:!0})}function Bn(e,t,n){return t.sidebarTextOnly===!0?s(ct,{config:t,t:n}):s(t?.peakStyle==="progress"?ct:t?.peakStyle==="classic"?Ao:vo,{config:t,t:n})}function Po(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const i=Ve(o),r=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)}),l=[n(i.notice),r];return s(V,{portal:!0,label:l,side:"right",delayMs:300},s("div",{className:"cm-peak-rail "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off"),"aria-label":l.join("; ")},s("div",{className:"cm-peak-rail-track"},s("div",{className:"cm-peak-rail-segment cm-peak-rail-high"}),s("div",{className:"cm-peak-rail-segment cm-peak-rail-low"}),s("div",{className:"cm-peak-rail-marker",style:{top:Tt(t,o,a)}})),s("span",{className:"cm-peak-rail-label"},n(i.short))))}function Oo(e){const{config:t,t:n}=e,a=Ge(t,e.now),o=Be(t,a);if(o===null)return null;const i=Ve(o),r=o.nextIntoPeak?n("nextPeakIn",{time:Ce(o,a,n)}):n("nextOffPeakIn",{time:Ce(o,a,n)}),l=[n(i.notice),r];return s(V,{portal:!0,label:l,side:"right",delayMs:300},s("div",{className:"cm-peak-rail-classic "+(o.weekend||o.holiday?"weekend":o.inPeak?"peak":"off"),"aria-label":l.join("; ")},s("div",{className:"cm-peak-rail-classic-track"},s("div",{className:"cm-peak-rail-classic-segment peak"}),s("div",{className:"cm-peak-rail-classic-segment off"}),s("div",{className:"cm-peak-rail-classic-marker",style:{top:Tt(t,o,a)}})),s("span",{className:"cm-peak-rail-classic-label"},n(i.short))))}function To(e,t,n){return t.sidebarTextOnly===!0?s(ct,{config:t,t:n,rail:!0}):s(t?.peakStyle==="progress"?ct:t?.peakStyle==="classic"?Oo:Po,{config:t,t:n,rail:!0})}function Ro(e,t,n){const a=t.budget??{enabled:!1,amount:100,period:"month"},o=Number(t.exchangeRate),r=(e.budgetUsed??(a.period==="day"?_(e.today,t):a.period==="all"?_(e.total,t):_(e.month,t)))*(Number.isFinite(o)&&o>0?o:1),l=Math.max(0,Number(a.amount)||0),c=l>0?Math.min(999,r/l*100):null,u=he(c===null?null:Math.min(100,c),re(t,"budget")),d=a.detail!==!1;return{level:c===null?"ok":c>=100?"over":c>=80?"warn":"ok",rail:u.label===null?"—":Math.round(u.label)+"%",body:s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-bbox-label"},n("budget")),s("span",{className:"cm-bbox-pct cm-num"},u.label===null?"—":u.label.toFixed(1)+"%")),s("div",{className:"cm-bbox-bar"},s("div",{className:"cm-bbox-fill",style:{width:u.width+"%"}})),d?s(R,null,s("div",{className:"cm-bbox-line cm-num"},n("usedOf",{used:ce(r,t),amount:ce(l,t)}))):null)}}function Do(e,t,n){const a=e.goQuota,o=t?.goQuota?.main==="weekly"||t?.goQuota?.main==="monthly"?t.goQuota.main:"rolling",i=a[o],r=i!==null&&typeof i?.percent=="number"?Math.max(0,Math.min(100,Number(i.percent)||0)):0,l=b=>b!==null&&typeof b?.percent=="number"?Math.round(he(b.percent,re(t,"go")).label)+"%":"—",c=b=>n(b==="rolling"?"goShortRolling":b==="weekly"?"goShortWeekly":"goShortMonthly"),u=["rolling","weekly","monthly"].filter(b=>b!==o),d=i!==null&&typeof i?.resetsAt=="string"&&i.resetsAt.length>0?n("goResetAt",{time:new Date(i.resetsAt).toLocaleString()}):"",m=t?.goQuota?.detail!==!1,g=he(r,re(t,"go"));return{level:r>=100?"over":r>=80?"warn":"ok",rail:g.label===null?"—":Math.round(g.label)+"%",body:s(R,null,s("div",{className:"cm-bbox-head"},s("span",{className:"cm-bbox-label"},n("goQuotaRowLabel")+" "+c(o)),s("span",{className:"cm-bbox-pct cm-num"},g.label===null?"—":Math.round(g.label)+"%")),s("div",{className:"cm-bbox-bar"},s("div",{className:"cm-bbox-fill",style:{width:g.width+"%"}})),m?s(R,null,s("div",{className:"cm-bbox-line cm-num"},u.map(b=>c(b)+" "+l(a[b])).join(" · ")),d?s("div",{className:"cm-bbox-line"},d):null):null)}}function Ln(e,t,n){const a=re(t,"go");return["rolling","weekly","monthly"].map((o,i)=>{const r=e?.[o],l=typeof r?.percent=="number"&&Number.isFinite(r.percent)?Math.max(0,Math.min(100,r.percent)):null,c=r?.resetsAt&&Number.isFinite(Date.parse(r.resetsAt))?" · "+n("goResetAt",{time:new Date(r.resetsAt).toLocaleString()}):"";return n(["goWindowRolling","goWindowWeekly","goWindowMonthly"][i])+": "+(l===null?"—":_e(he(l,a).label,a,n))+c}).concat(e?.fetchedAt>0?n("goQuotaFetchedAt",{time:new Date(e.fetchedAt).toLocaleTimeString()}):[]).join(`
3
+ `)}function En({trigger:e,detail:t,refresh:n,busy:a,t:o,...i}){const r=e.props["data-cm-display"];return s("details",{...i,"data-cm-display":r,className:"cm-quota-details"+(r?" "+e.props.className:""),onKeyDown:l=>{l.key==="Escape"&&(l.currentTarget.open=!1,l.currentTarget.querySelector("summary")?.focus(),l.stopPropagation())}},s("summary",{...e.props,...r?{className:void 0,"data-cm-display":void 0}:{},"aria-label":e.props["aria-label"]||o("goQuotaRowLabel")},e.props.children),s("div",{className:"cm-quota-detail",role:"region","aria-label":o("goQuotaRowLabel")},s("div",{style:{whiteSpace:"pre-line"}},t),n?s("button",{type:"button",className:"cm-btn small",disabled:a,onClick:n},o(a?"refreshing":"refresh")):null))}function Bo(e){const{state:t,wide:n}=e,a=t.goQuota,o=Y(F(t.config));if(!a||a.status!=="ok")return null;const i=t.config?.goQuota?.main==="weekly"||t.config?.goQuota?.main==="monthly"?t.config.goQuota.main:"rolling";if(a[i]===null||typeof a[i]?.percent!="number")return null;const r=Do(t,t.config,o),l=Ln(a,t.config,o);return s(V,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},l),side:"right",delayMs:300},s(En,{detail:l,t:o,trigger:s("summary",{"data-cm-display":"go",className:"cm-bbox"+(r.level==="ok"?"":" "+r.level)+(n?"":" rail")},n?r.body:s("div",{className:"cm-bbox-rail cm-num"},r.rail))}))}function Lo(e){return e===null||typeof e!="object"||e.unlimited||typeof e.percent!="number"?null:Math.max(0,Math.min(100,Math.round(Number(e.percent)||0)))}function ba(e){const t=e!==null&&typeof e=="object"?e:{};return{five:t["5h"]??null,seven:t["7d"]??t.week??t.weekly??null}}function In(e,t,n=Date.now()){if(typeof e!="string"||!e)return"";const a=Date.parse(e);if(!Number.isFinite(a))return"";const o=a-n;if(o<=0)return t("resetReached");const i=Math.ceil(o/6e4),r=Math.floor(i/1440),l=Math.floor(i%1440/60),c=i%60;return r>0?t("resetDays",{d:r,h:l}):l>0?t("resetHours",{h:l,m:c}):t("resetMinutes",{m:c})}function ut(e,t,n=Date.now()){const a=In(e?.resetsAt,t,n);return a?t("goResetAt",{time:new Date(e.resetsAt).toLocaleString()})+" ("+a+")":""}function _e(e,t,n){return e===null?"—":n(t==="remaining"?"quotaRemaining":"quotaUsed",{pct:e})}function Rt(e){const[,t]=D(0),n=()=>t(Date.now());return J(()=>{if(!e)return;const a=setInterval(n,6e4);return()=>clearInterval(a)},[e]),{onMouseEnter:n,onFocus:n}}function jn(e,t){if(!t)return s("div",{className:"cm-bbox-bar"},s("div",{className:"cm-bbox-fill",style:{width:e+"%"}}));const n={d:"M22 78 A40 40 0 1 1 78 78",pathLength:100,fill:"none",strokeWidth:8,strokeLinecap:"round"};return s("svg",{viewBox:"0 0 100 100","aria-hidden":!0},s("path",{...n,stroke:"currentColor",opacity:.18}),s("path",{...n,stroke:"currentColor",strokeDasharray:e+" 100",opacity:e>0?1:0}))}function dt(e,t,n,a,o,i){const r=Lo(t),l=r===null?"ok":r>=100?"over":r>=80?"warn":"ok",c=he(r,n),u=t?.unlimited?"∞":o?_e(c.label,n,a):c.label===null?"—":c.label+"%";return{level:l,pct:r,text:u,label:c.label,row:s("div",{key:e,className:"cm-mm-row"+(l==="ok"?"":" "+l)},s("span",{className:"cm-bbox-label"},e),jn(c.width,i),s("span",{className:"cm-bbox-pct cm-num"},u))}}function ga(e){const{five:t,seven:n,fetchedAt:a,t:o,wide:i,refresh:r,direction:l="used",gauge:c}=e,u=Rt(t?.resetsAt),d=In(t?.resetsAt,o),m=dt(o("codingPlanRemain5h"),t,l,o,!1,c),g=dt(o("codingPlanRemain7d"),n,l,o,!1,c),b=m.level==="over"||g.level==="over"?"over":m.level==="warn"||g.level==="warn"?"warn":"ok",p=(x,y,f)=>{const w=y?.unlimited?o("quotaUnlimited"):_e(f.label,l,o),N=ut(y,o);return x+" "+w+(N?" · "+N:"")},k=[o("codingPlanMinimaxTitle"),p(o("codingPlanRemain5h"),t,m),p(o("codingPlanRemain7d"),n,g),a>0?o("goQuotaFetchedAt",{time:new Date(a).toLocaleTimeString()}):null,...r?Se(o,r):[]].filter(Boolean).join(`
4
+ `),h=s(R,null,s("div",{className:"cm-mm-title"},o("codingPlanMinimaxTitle")),s(c?"div":R,c?{className:"cm-plan-gauges"}:null,m.row,g.row),d?s("div",{className:"cm-mm-reset"},"5h · "+d):null),v=s(R,null,s("div",{className:"cm-bbox-rail cm-num"},m.text),s("div",{className:"cm-bbox-rail cm-num"},g.text));return s(V,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},k),side:"right",delayMs:300},s("div",{...u,"data-cm-display":"plan","data-cm-plan":"minimax",className:"cm-bbox cm-mm"+(b==="ok"?"":" "+b)+(i===!1?" rail":"")+(r?" clickable"+(r.busy?" busy":""):""),...r?be(r.busy,r.run):{}},i===!1?v:h))}function Fn(e,t,n,a,o,i){const r=i.busy||n?.status==="loading"?a("refreshing"):i.err||n?.status==="error"?a("queryFailed"):e==="zai"&&n?.status==="off"&&n?.message?a(n.keyConfigured?"queryFailed":"zaiPlanKeyMissing"):n?.status==="ok"?a("gatewayQuotaEmpty"):a("codingPlanNotQueried"),l=[t,r,n?.message===r?"":n?.message,...Se(a,i)].filter(Boolean).join(`
5
+ `);return s(V,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},l),side:"right",delayMs:300},s("div",{"data-cm-display":"plan","data-cm-plan":e,"aria-label":l,className:"cm-bbox cm-mm clickable"+(o===!1?" rail":"")+(i.busy?" busy":""),...be(i.busy,i.run)},o===!1?s("div",{className:"cm-bbox-rail"},"—"):s(R,null,s("div",{className:"cm-mm-title"},t),s("span",{className:"cm-hint"},r))))}function Eo(e){const{state:t,wide:n,api:a}=e,o=t.codingPlans?.minimax,i=Y(F(t.config)),r=De(a?()=>a.refreshCodingPlan("minimax"):null),{five:l,seven:c}=ba(o?.windows);return o?.status!=="ok"||l==null&&c==null?Fn("minimax",i("codingPlanMinimaxTitle"),o,i,n,r):s(ga,{five:l,seven:c,fetchedAt:o.fetchedAt,t:i,wide:n,refresh:r,direction:re(t.config,"plan"),gauge:n!==!1&&t.config.planQuotaStyle==="gauge"&&!t.config.sidebarTextOnly})}const Io="/plugins/dsh-openai-codex/auth/status",jo={18e3:"five",604800:"weekly"};function Qn(e){if(!Array.isArray(e))return null;const t=e.find(a=>a!==null&&typeof a=="object"&&a.id==="codex");if(!t||!Array.isArray(t.windows))return null;const n={};for(const a of t.windows){const o=a!==null&&typeof a=="object"?jo[Number(a.windowSeconds)]:null;if(!o||typeof a.remainingPercent!="number"||!Number.isFinite(Number(a.remainingPercent)))continue;const i=Number(a.resetAt??a.resetsAt);n[o]={percent:Math.max(0,Math.min(100,Math.round((100-Number(a.remainingPercent))*10)/10)),resetsAt:Number.isFinite(i)&&i>0?new Date(i*1e3).toISOString():""}}return n}function Fo(e){return e===null||typeof e!="object"||e.status!=="signed-in"?null:Qn(e.usage?.rateLimits)}async function ya(e){const t=AbortSignal.timeout(8e3);let n;const a=new Promise((o,i)=>{n=()=>i(t.reason),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([Promise.resolve().then(()=>e(t)),a])}finally{t.removeEventListener("abort",n)}}async function Qo(e){try{const t=await ya(n=>U.rpc?.call("/api","codex-subscription/usage",{force:e},n));return t?.ok?Qn(t.value?.rateLimits):null}catch{return null}}const U={source:"auto",listeners:[]},ha=(e,t=null,n=null)=>Object.assign(U,{rpc:e,readPiAi:t,readChatgptSub:n,request:null,inFlight:null,fetchedAt:0,status:"idle",windows:{},message:""});ha(null);const Dt=()=>{const{rpc:e,readPiAi:t,readChatgptSub:n,request:a,inFlight:o,listeners:i,...r}=U;return r},_o=e=>(U.listeners.push(e),()=>{U.listeners=U.listeners.filter(t=>t!==e)}),Bt=()=>{for(const e of U.listeners)try{e()}catch{}};async function Lt(e=!1,t=!1,n="auto"){if(!t)return;if(U.inFlight!==null&&U.source===n)return U.inFlight;if(!e&&U.source===n&&U.fetchedAt>0&&Date.now()-U.fetchedAt<(U.status==="ok"?5:1)*6e4)return;const a={};U.request=a,U.source!==n&&Object.assign(U,{status:"idle",windows:{},fetchedAt:0,source:n}),Bt();const o=Promise.resolve().then(async()=>{let i={},r="";try{if((n==="auto"||n==="subscription")&&(i=await Qo(e)??{}),Object.keys(i).length===0&&(n==="auto"||n==="pi-ai"))try{const l=await ya(()=>U.readPiAi?.());l?.ok===!0&&l.value?.status==="ok"?i=l.value.windows:l?.ok===!0&&l.value?.status==="error"&&(r=l.value.message)}catch{}if(Object.keys(i).length===0&&(n==="auto"||n==="chatgpt-sub"))try{const l=await ya(()=>le.async("./client.codex.js").then(c=>c.readChatgptSubQuota(U.readChatgptSub)));l?.status==="ok"?i=l.windows:l?.status==="error"&&(r=l.message)}catch{}if(Object.keys(i).length===0&&(n==="auto"||n==="chatgpt"))try{i=await(await le.async("./client.codex.js")).readChatgptQuota(e)??{}}catch{}if(Object.keys(i).length===0&&(n==="auto"||n==="connect")){const l=await fetch(Io,{credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});l.ok&&(i=Fo(await l.json().catch(()=>null))??{})}}catch{}finally{if(U.request!==a)return;U.status=Object.keys(i).length>0?"ok":"unavailable",U.windows=i,U.message=Object.keys(i).length?"":r,U.fetchedAt=Date.now(),U.inFlight=null,Bt()}});return U.inFlight=o,o}function Et(e,t="auto"){const[n,a]=D(Dt);return J(()=>{if(!e)return;let o=!0;const i=()=>{o&&a(Dt())},r=_o(i);i(),Lt(!1,!0,t);const l=setInterval(()=>{Lt(!1,!0,t)},6e4);return()=>{o=!1,clearInterval(l),r()}},[e,t,U.rpc]),n.source===t?n:{status:"idle",windows:{},fetchedAt:0}}function qo(e){const t=Rt(),{state:n,wide:a}=e,o=Y(F(n.config)),i=n.config?.codexQuotaEnabled===!0&&n.config?.codexQuotaSidebar!==!1,r=n.config?.codexQuotaSource??"auto",l=Et(i&&!e.preview,r),c=e.preview?n.displayPreviewCodex??(U.source===r?U:{status:"idle"}):l,u=De(e.preview?null:i?()=>Lt(!0,i,r):()=>e.api.updateConfig({codexQuotaEnabled:!0,codexQuotaSidebar:!0}));if(!i&&(n.config?.codexQuotaSidebar===!1||n.codexCompat?.enabled!==!0))return null;if(!i)return s("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(a===!1?" rail":""),...be(u.busy,u.run)},u.err||(a===!1?"Codex":o("codexQuotaEnable")));if(c.status!=="ok")return s("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(a===!1?" rail":""),title:c.message||o("codexQuotaUnavailable"),...be(u.busy,u.run)},s("div",{className:"cm-mm-title"},a===!1?"Codex":o("codexQuotaTitle")),s("span",{className:"cm-hint"},a===!1?"—":c.status==="idle"||u.busy?o("refreshing"):c.message||o("codexQuotaUnavailable")));const d=[["five","codexQuotaFive","5h"],["weekly","codexQuotaWeek","7d"]].flatMap(([k,h,v])=>{const x=c.windows[k];if(!x)return[];const y=dt(v,x,"remaining",o,!0),f=new Date(typeof x.resetsAt=="string"?x.resetsAt:NaN),w=Number.isFinite(f.getTime())?o("codexQuotaReset",{time:f.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}):"";return[{...y,key:k,short:v,name:o(h),reset:w,win:x}]});if(!d.length)return null;const m=d.some(k=>k.pct>=100)?"over":d.some(k=>k.pct>=80)?"warn":"ok",g=[o("codexQuotaTitle"),...d.map(k=>k.name+" · "+k.text+(k.reset?" · "+ut(k.win,o):"")),c.fetchedAt>0?o("goQuotaFetchedAt",{time:new Date(c.fetchedAt).toLocaleTimeString()}):null,...Se(o,u)].filter(Boolean).join(`
6
+ `),b=s(R,null,s("div",{className:"cm-bbox-head cm-codex-head"},s("div",{className:"cm-mm-title"},o("codexQuotaTitle")),s("div",{className:"cm-codex-resets"},...d.filter(k=>k.reset).map(k=>s("span",{key:k.key,className:"cm-mm-reset"},(d.length>1?k.short+" · ":"")+k.reset)))),...d.map(k=>k.row)),p=s(R,null,...d.map(k=>s("div",{className:"cm-bbox-rail cm-num"},k.text)));return s(V,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},g),side:"right",delayMs:300},s("div",{...t,"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(m==="ok"?"":" "+m)+(a===!1?" rail":"")+(u.busy?" busy":""),...be(u.busy,u.run)},a===!1?p:b))}function Ye(e,t){return e.startsWith("core_")?"Core · "+Ye(e.slice(5),t):e==="fiveHour"||e==="five_hour"||e==="5h"?"5h":e==="seven_day"?"7d":e==="weekly"||e==="week"||e==="7d"?e==="7d"?"7d":t("goShortWeekly"):e==="monthly"||e==="month"?t("goShortMonthly"):e==="daily"||e==="day"?t("goShortDaily"):e==="plan"?t("mimoWindowPlan"):e==="compensation"?t("mimoWindowCompensation"):e==="usage"?t("quotaUsedTotal"):e==="balance"?t("codingPlanWindowBalance"):String(e).replace(/_/g," ")}function ka(e,t,n,a){return typeof n?.text!="string"?"—":e==="kimi"&&t==="balance"?a("codingPlanWindowBalance")+" "+n.text:n.text}function It(e,t){const n=a=>{const o=a.replace(/^core_/,"").toLowerCase().replace(/[^a-z0-9]/g,"");return/^(fivehour|five|5h|rolling|session)$/.test(o)?0:/^(daily|day|1d)$/.test(o)?1:/^(weekly|week|7d|sevenday)$/.test(o)?2:/^(monthly|month|30d)$/.test(o)?3:4};return Object.entries(e??{}).filter(([a])=>t!=="volcengine"||[0,2,3].includes(n(a))).sort((a,o)=>n(a[0])-n(o[0]))}function Uo(e){return/^(five_?hour|5h)$/i.test(e)?5:/^(seven_?day|7d)$/i.test(e)?168:0}function _n(e,t){return e>=(t==="anthropic"?95:100)?"over":e>=80?"warn":"ok"}function Ho(e,t,n,a,o=Date.now()){const i=Date.parse(t?.resetsAt),r=Uo(e);if(!Number.isFinite(i)||r===0||!Number.isFinite(t.percent))return null;const l=i-o;if(l<=0)return null;const c=new Intl.DateTimeFormat(a==="en"?"en-US":"zh-CN",r===5?{hour:"2-digit",minute:"2-digit",hour12:!1}:{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}),u=Math.ceil(l/6e4),d=r===5?u>=60?n("quotaResetInHm",{h:Math.floor(u/60),m:u%60}):n("quotaResetInM",{m:u}):n("quotaResetAt",{time:c.format(i)}),m=r*36e5,g=o-(i-m),b=t.percent>0&&t.percent<100&&g/m>=.1?i-m+g*100/t.percent:1/0;return{reset:d,forecast:b>o&&b<i?n("quotaForecastHit",{time:c.format(b)}):""}}function Wo(e){const t=Rt(),{id:n,state:a,wide:o,api:i}=e,r=a.codingPlans?.[n],l=Y(F(a.config)),c=De(i?()=>i.refreshCodingPlan(n):null),u=Le.find(C=>C.id===n);if(!u)return null;const d=r?.windows!==null&&typeof r?.windows=="object"?r.windows:{},m=It(d,n);if(r?.status!=="ok"||m.length===0)return Fn(n,l(u.labelKey),r,l,o,c);const g=C=>C!==null&&typeof C=="object"&&typeof C.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(C.percent)||0))):null,b=re(a.config,"plan"),p=o!==!1&&a.config.planQuotaStyle==="gauge"&&!a.config.sidebarTextOnly,k=(n==="workbuddy"||n==="opendesign")&&d.balance?.text?l("codingPlanWindowBalance")+": "+d.balance.text:null,h=F(a.config),v=(k?m.filter(([C])=>C!=="balance"):m).map(([C,T])=>{const O=g(T);if(O===null)return s("div",{key:C,className:"cm-mm-row wide"},s("span",{className:"cm-mm-text"},ka(n,C,T,l)));const W=_n(O,n),A=he(O,b),L=s("div",{key:C,className:"cm-mm-row wide"+(W==="ok"?"":" "+W)},s("span",{className:"cm-bbox-label"},Ye(C,l)),jn(A.width,p),s("span",{className:"cm-bbox-pct cm-num"},A.label===null?"—":A.label+"%")),K=n==="anthropic"?Ho(C,T,l,h):null;return K===null?L:s(p?"div":R,{key:C},L,s("div",{className:"cm-mm-sub"},K.reset,K.forecast&&s("div",{className:"cm-mm-sub warn"},K.forecast)))}),x=m.map(([C,T])=>{const O=g(T),W=ut(T,l),A=O===null?typeof T?.text=="string"?T.text:"—":_e(he(O,b).label,b,l);return Ye(C,l)+" "+A+(W?" · "+W:"")});r.fetchedAt>0&&x.push(l("goQuotaFetchedAt",{time:new Date(r.fetchedAt).toLocaleTimeString()})),r.message&&x.push(r.message),x.push(...Se(l,c));const y=[l(u.labelKey),...x].join(`
7
+ `),f=m.map(([,C])=>g(C)).filter(C=>C!==null),w=_n(Math.max(0,...f),n),N=f.length>0?f.slice(0,2).map(C=>he(C,b).label+"%").join(" "):ka(n,m[0][0],m[0][1],l);return s(V,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},y),side:"right",delayMs:300},s("div",{...t,"data-cm-display":"plan","data-cm-plan":n,className:"cm-bbox cm-mm clickable"+(w==="ok"?"":" "+w)+(o===!1?" rail":"")+(c.busy?" busy":""),...be(c.busy,c.run)},o===!1?s("div",{className:"cm-bbox-rail cm-num"},N):s(R,null,s("div",{className:k?"cm-mm-title cm-mm-row wide":"cm-mm-title"},l(u.labelKey),k&&s("span",{className:"cm-mm-text"},k)),s(p?"div":R,p?{className:"cm-plan-gauges"}:null,...v))))}const qn=e=>{try{return window.localStorage?.getItem?.("cm.gw."+e)??""}catch{return""}},$o=(e,t)=>{try{window.localStorage?.setItem?.("cm.gw."+e,t)}catch{}};function Ko(e){const t=Rt(),{source:n,snapshot:a,state:o,wide:i,api:r}=e,l=Y(F(o.config)),[c,u]=D(()=>({source:n.id,id:qn(n.id)})),d=De(r?()=>r.refreshGatewayQuota(n.id):null),m=n.type==="agy-link",g=m?"remaining":re(o.config,"plan"),b=m?10:4,p=a.accounts.length>1,k=c.source===n.id?c.id:qn(n.id),h=a.accounts.findIndex(E=>E.id===k),v=h>=0?h:Math.max(0,a.accounts.findIndex(E=>E.windows.length>0||E.credits!=null)),x=a.accounts[v]??a.accounts[0],y=x?.label||x?.id||"",f=E=>p&&!m?(Ja[E.provider]??E.provider)+" · ":"",w=p&&x?[x]:a.accounts,N=[];for(const E of w){if(N.length>=b)break;for(const ie of E.windows){if(N.length>=b)break;const Ee=f(E)+(ie.label||ie.id||l("gatewaySourceUnknown"));N.push({win:ie,name:Ee,view:dt(Ee,ie,g,l)})}E.windows.length===0&&E.credits!=null&&N.push({win:null,name:f(E)+(E.credits.unit||"credits"),text:(E.credits.used??"—")+" / "+(E.credits.limit??"—")})}N.length===0&&N.push({name:l("gatewayQuotaEmpty"),text:"—"});const C=N.some(E=>E.view?.level==="over")?"over":N.some(E=>E.view?.level==="warn")?"warn":"ok",T=N.map(E=>{if(E.text!=null)return E.name+" "+E.text;const ie=ut(E.win,l);return E.name+" "+_e(E.view.label,g,l)+(ie?" · "+ie:"")});a.fetchedAt>0&&T.push(l("goQuotaFetchedAt",{time:new Date(a.fetchedAt).toLocaleTimeString()})),T.push(...Se(l,d));const W=[p&&y?`${n.label||n.id} (${v+1}/${a.accounts.length} · ${y})`:n.label||n.id,...T].join(`
8
+ `),A=N.map((E,ie)=>E.text!=null?s("div",{key:ie,className:"cm-mm-row wide"},s("span",{className:"cm-bbox-label"},E.name),s("span",{className:"cm-mm-text cm-num"},E.text)):s(R,{key:ie},E.view.row)),L=E=>{if(!E.key||E.key==="Enter"||E.key===" "){E.stopPropagation(),E.preventDefault?.();const ie=a.accounts[(v+1)%a.accounts.length];$o(n.id,ie.id),u({source:n.id,id:ie.id})}},K=p?s("span",{className:"cm-gw-switcher","aria-label":l("gatewaySwitchAccount",{account:y||v+1}),onClick:L,onKeyDown:L,role:"button",tabIndex:0},`${v+1}/${a.accounts.length} ⇄`):null,H=p?s("div",{className:"cm-bbox-head"},s("div",{className:"cm-mm-title"},n.label||n.id),K):s("div",{className:"cm-mm-title"},n.label||n.id),se=p&&y?s("div",{className:"cm-gw-sub"},y):null,q=s(R,null,H,se,...A),M=N.filter(E=>E.view).map(E=>E.view.label).filter(E=>E!==null),Q=M.length>0?M.slice(0,2).map(E=>E+"%").join(" "):N[0].text??"—",gt=s("div",{className:"cm-bbox-rail cm-num"},Q);return s(V,{portal:!0,label:s("span",{style:{whiteSpace:"pre-line"}},W),side:"right",delayMs:300},s("div",{...t,"data-cm-display":"gateway","data-cm-source":n.id,className:"cm-bbox cm-mm clickable"+(C==="ok"?"":" "+C)+(i===!1?" rail":"")+(d.busy?" busy":""),...be(d.busy,d.run)},i===!1?s(R,null,gt,K):q))}function zo(e,t,n,a){const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:[],i=[];for(const r of t.gatewayQuotas?.sources??[]){if(r.enabled===!1||r.display!=="sidebar"&&r.display!=="both")continue;const l=o.find(c=>c.id===r.id);!l||l.status!=="ok"&&l.status!=="partial"&&l.status!=="stale"||l.accounts.length===0||i.push(s(Ko,{key:"gateway:"+r.id,source:r,snapshot:l,state:e,wide:n,api:a}))}return i}const Go={anthropic:"Claude",zai:"Z.ai",minimax:"MM",kimi:"Kimi",openrouter:"OR",siliconflow:"SF",commandcode:"CC",clinepass:"CP",scnet:"SCNet",volcengine:"Ark",qwen:"Qwen",mimo:"MiMo","baidu-coding":"千帆",factory:"Factory",opendesign:"OpenDesign"};function Un(e,t,n){return e?.enabled!==!0?!1:typeof e.showInComposer=="boolean"?e.showInComposer:e.display!=="off"&&t?.enabled===!0&&t[n]!==!1}function xa(e,t,n){const a=e?.display??"settings";return(typeof e?.showInComposer=="boolean"?e.showInComposer:a!=="off"&&t?.enabled===!0&&t[n]!==!1)?{off:"composer",both:"all"}[a]??a+"-composer":a}function wa(e){const t={composer:"off","sidebar-composer":"sidebar","settings-composer":"settings",all:"both"}[e];return{display:t??e,showInComposer:t!==void 0}}function Na(e){return[["sidebar","balanceSidebar"],["settings","balanceSettings"],["both","quotaSidebarSettings"],["composer","quotaComposer"],["sidebar-composer","quotaSidebarComposer"],["settings-composer","quotaSettingsComposer"],["all","quotaAllPositions"],["off","off"]].map(([t,n])=>s("option",{key:t,value:t},e(n)))}function Vo(e){const t=e.useCost?e.useCost(x=>x):void 0,n=t?.state?.config;Et(n?.codexQuotaEnabled===!0&&n.codexQuotaStrip!==!1&&n.quotaStrip?.enabled===!0,n?.codexQuotaSource);const[a,o]=D(null),[i,r]=D({}),l=t?.state,c=e.api;if(!l)return null;const u=l.config,d=u.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};if(d.enabled!==!0&&u.goQuota?.showInComposer!==!0&&!Object.values(u.codingPlans??{}).some(x=>x.enabled===!0&&x.showInComposer===!0))return null;const m=Y(F(u)),g=[];if(d.enabled===!0&&d.budget!==!1){const x=u.budget??{enabled:!1,amount:100,period:"month"};if(x.enabled===!0){const y=Number(u.exchangeRate),w=(l.budgetUsed??(x.period==="day"?_(l.today,u):x.period==="all"?_(l.total,u):_(l.month,u)))*(Number.isFinite(y)&&y>0?y:1),N=Math.max(0,Number(x.amount)||0);if(N>0){const C=Math.min(999,w/N*100),T=C>=100?"over":C>=80?"warn":"ok";g.push({key:"budget",label:m("budgetShort"),level:T,tip:m("budgetOf",{period:m(et[x.period]??"periodMonth")})+" · "+m("usedOf",{used:ce(w,u),amount:ce(N,u)})+" · "+C.toFixed(1)+"%",segs:[{name:"main",pct:Math.round(he(Math.min(100,C),re(u,"budget")).width)}]})}}}if(Un(u.goQuota,d,"go")){const x=l.goQuota;if(u?.goQuota?.enabled!==!1&&x?.status==="ok"){const y=u.goQuota.main==="weekly"||u.goQuota.main==="monthly"?u.goQuota.main:"rolling",f=y==="rolling"?x.rolling:y==="weekly"?x.weekly:x.monthly;if(f!==null&&typeof f=="object"&&typeof f.percent=="number"){const w=Math.max(0,Math.min(100,Math.round(Number(f.percent)||0))),N=w>=100?"over":w>=80?"warn":"ok",C=typeof f.resetsAt=="string"&&f.resetsAt.length>0?" · "+m("goResetAt",{time:new Date(f.resetsAt).toLocaleString()}):"";g.push({key:"go",label:"Go "+m(y==="rolling"?"goShortRolling":y==="weekly"?"goShortWeekly":"goShortMonthly"),level:N,tip:Ln(x,u,m),segs:[{name:"main",pct:Math.round(he(w,re(u,"go")).width)}]})}}}for(const x of Le){const y=l.codingPlans?.[x.id];if(!Un(u.codingPlans?.[x.id],d,"plans")||!y||y.status!=="ok")continue;const f=y.windows!==null&&typeof y.windows=="object"?y.windows:{},w=It(f,x.id),N=x.id==="factory"?[w.filter(([C])=>!C.startsWith("core_")),w.filter(([C])=>C.startsWith("core_"))]:[w];for(const[C,T]of N.entries()){if(T.length===0)continue;const O=Go[x.id]??x.id,W=[],A=[];y.message&&A.push(y.message);let L=0,K=0;for(const[H,se]of T){const q=Ye(H,m),M=typeof se?.resetsAt=="string"&&se.resetsAt.length>0?" · "+m("goResetAt",{time:new Date(se.resetsAt).toLocaleString()}):"",Q=se!==null&&typeof se=="object"&&typeof se.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(se.percent)||0))):null;if(A.push(q+" "+(Q===null?typeof se?.text=="string"?se.text:"—":Q+"%")+M),Q===null){d.planAmounts!==!1&&W.push({name:H,pct:null,text:ka(x.id,H,se,m)});continue}K>=(x.id==="factory"?3:2)||(K+=1,W.push({name:H,pct:Math.round(he(Q,re(u,"plan")).width)}),L=Math.max(L,Q>=100?2:Q>=80?1:0))}y.fetchedAt>0&&A.push(m("goQuotaFetchedAt",{time:new Date(y.fetchedAt).toLocaleTimeString()})),W.length!==0&&g.push({key:x.id+(C?":core":""),label:O+(x.id==="factory"?C?" Core":" Standard":""),level:["ok","warn","over"][L],tip:A.join("; "),segs:W})}}const b=d.enabled===!0&&u.codexQuotaEnabled===!0&&u.codexQuotaStrip!==!1&&U.source===(u.codexQuotaSource??"auto")&&U.status==="ok"?U.windows:{},p=b.five??null,k=b.weekly??null,h=x=>Math.max(0,Math.min(100,Math.round(Number(x.percent)||0)));if(p!==null||k!==null){const x=p===null?null:h(p),y=k===null?null:h(k),f=Math.max(x??0,y??0);g.push({key:"codex",label:"Codex",level:f>=100?"over":f>=80?"warn":"ok",tip:[m("codexQuotaTitle"),...[["5h",p],[m("codingPlanRemain7d"),k]].filter(([,w])=>w).map(([w,N])=>w+": "+_e(100-h(N),"remaining",m)+(typeof N.resetsAt=="string"&&Number.isFinite(Date.parse(N.resetsAt))?" · "+m("goResetAt",{time:new Date(N.resetsAt).toLocaleString()}):"")),U.fetchedAt>0?m("goQuotaFetchedAt",{time:new Date(U.fetchedAt).toLocaleTimeString()}):null].filter(Boolean).join(`
9
+ `),segs:[x===null?null:{name:"5h",pct:100-x},y===null?null:{name:"weekly",pct:100-y}].filter(Boolean)})}if(g.length===0)return null;const v=x=>{a!==null||!c||(o(x),r(y=>({...y,[x]:null})),Promise.resolve().then(()=>x==="budget"?c.reload():x==="go"?c.refreshGoQuota():x==="codex"?Lt(!0,u.codexQuotaEnabled===!0,u.codexQuotaSource):x==="factory:core"?c.refreshCodingPlan("factory"):c.refreshCodingPlan(x)).catch(y=>{r(f=>({...f,[x]:y?.message??String(y)}))}).finally(()=>o(null)))};return s("div",{className:"cm-qstrip"},g.map(x=>{const y=a===x.key,f=i[x.key],w=x.key==="codex"?"remaining":re(u,x.key==="budget"||x.key==="go"?x.key:"plan"),N=[s("span",{className:"cm-qlabel",key:"l"},x.label)];y?N.push(s("span",{className:"cm-qtext",key:"busy"},m("refreshing"))):x.segs.forEach((T,O)=>{O>0&&N.push(s("span",{className:"cm-qsep",key:"sep"+O,"aria-hidden":"true"})),T.pct===null?N.push(s("span",{className:"cm-qtext",key:T.name},T.text)):N.push(s("span",{className:"cm-qseg",key:T.name},s("span",{className:"cm-qbar"},s("span",{className:"cm-qfill",style:{width:T.pct+"%"}})),s("span",null,(x.key==="codex"&&x.segs.length>1?(T.name==="5h"?"5h":m("goShortWeekly"))+" ":"")+_e(T.pct,w,m))))});const C=[x.tip];return!y&&c&&C.push(m("clickToRefresh")),y&&C.push(m("refreshing")),f&&C.push("⚠ "+m("queryFailed")+": "+f),x.key==="go"?s(En,{key:x.key,detail:[x.tip,f].filter(Boolean).join(`
10
+ `),t:m,busy:y,refresh:c?()=>v(x.key):null,trigger:s("summary",{className:"cm-qchip action"+(x.level==="ok"?"":" "+x.level),"aria-label":x.label},N)}):s(V,{portal:!0,key:x.key,label:x.key==="codex"?s("span",{style:{whiteSpace:"pre-line"}},C.join(`
11
+ `)):C.join("; "),side:"bottom",delayMs:400},s("span",{className:"cm-qchip"+(c?" action":"")+(x.level==="ok"?"":" "+x.level),...c?be(y,()=>v(x.key)):{}},N))}))}let Hn;function Yo(e){const[t,n]=D(null);return J(()=>{let a=!0;return(Hn??=le.async("./client.notices.js").then(i=>i.mount({FloatingCard:Rn,makeT:Y,resolveLocale:F})).catch(i=>{throw Hn=null,i})).then(i=>{a&&n(()=>i)}).catch(()=>{}),()=>{a=!1}},[]),t?s(t,e):null}function Sa(e,t,n){const a=t.sidebarTodayMetric??"cost";return s("span",{className:"cm-today-values","data-both":a==="both"},a!=="tokens"?s("span",{"data-cm-today":"cost"},z(_(e,t),t)):null,a!=="cost"?s("span",{"data-cm-today":"tokens"},I(["input","output","cacheRead","cacheWrite"].reduce((o,i)=>o+(Number(e?.[i])||0),0))+" "+n("tokensUnit")):null)}function jt(e){const{state:t,wide:n}=e,a=t.today,o=t.config,i=Y(F(o)),r=Sa(a,o,i),l=o.budget??{enabled:!1,amount:100,period:"month"},c=Number(o.exchangeRate),d=(t.budgetUsed??(l.period==="day"?_(t.today,o):l.period==="all"?_(t.total,o):_(t.month,o)))*(Number.isFinite(c)&&c>0?c:1),m=Math.max(0,Number(l.amount)||0),g=m>0?Math.min(999,d/m*100):null,b=g===null?"ok":g>=100?"over":g>=80?"warn":"ok";if(l.enabled===!0&&o.hideBudget!==!0&&e.todayOnly!==!0){const k=[i("budgetOf",{period:i(et[l.period]??"periodMonth")}),i("usedOf",{used:ce(d,o),amount:ce(m,o)})+" · "+(g===null?"—":g.toFixed(1)+"%"),i("monthTotal",{month:z(_(t.month,o),o),total:z(_(t.total,o),o)})].join("; ");if(e.summary===!0)return s(V,{portal:!0,label:k,side:"right",delayMs:300},s("div",{"data-cm-display":"budget",className:"cm-simple-summary"+(b==="ok"?"":" "+b),tabIndex:0},s("span",null,i("budgetOf",{period:i(et[l.period]??"periodMonth")})),s("span",{className:"cm-num"},ce(d,o)+" / "+ce(m,o))));const h=Ro(t,o,i);return s(V,{portal:!0,label:k,side:"right",delayMs:300},s("div",{"data-cm-display":"budget",className:"cm-bbox"+(b==="ok"?"":" "+b)+(n?"":" rail")},n?h.body:s("div",{className:"cm-bbox-rail cm-num"},h.rail)))}const p=[o.sidebarTodayMetric==="tokens"?i("todayTokensTitle"):i("todayCostTitle"),i("callsTokens",{calls:a.calls,input:I(a.input),cache:I(a.cacheRead+a.cacheWrite),output:I(a.output)}),i("monthCost",{amount:z(_(t.month,o),o)}),i("totalCost",{amount:z(_(t.total,o),o)})].join("; ");return s(V,{portal:!0,label:p,side:"right",delayMs:300},s("div",{"data-cm-display":"today",className:"cm-foot"+(n?"":" cm-foot-rail")},n?s(R,null,s("span",null,i("today")),s("span",{className:"cm-num cm-bal-amt"},r)):s(At,{size:16})))}const Zo=()=>le.async("./client.sidebar-icons.js").then(e=>e.mount({makeT:Y,resolveLocale:F,peakView:Be,usePeakClock:Ge,phaseLabelKeys:Ve,countdownText:Ce,codexQuotaSnapshot:Dt,displayCostOf:_,formatMoneyUsd:z,sidebarTodayValue:Sa,CODING_PLAN_ROWS:Le}));function Jo(){const[e,t]=D(null);return J(()=>{if(typeof document>"u"||typeof MutationObserver>"u")return;let n;const a=".bt-leftcol .bt-leftcol-foot",o=()=>{const r=document.querySelector(a);r&&n?.nextSibling===r||(n&&n.remove(),n=null,r&&!r.previousElementSibling?.classList.contains("cm-bot-cost-mount")&&(n=document.createElement("div"),n.className="cm-bot-cost-mount",r.before(n)),t(n))};o();const i=new MutationObserver(r=>{(n&&!n.isConnected||r.some(l=>[...l.addedNodes,...l.removedNodes].some(c=>c.nodeType===1&&(c.matches(".bt-leftcol, .bt-leftcol-foot, .cm-bot-cost-mount")||c.querySelector(".bt-leftcol, .bt-leftcol-foot")))))&&o()});return i.observe(document.body,{childList:!0,subtree:!0}),()=>{i.disconnect(),n?.remove()}},[]),e}function Xo(e){const t=Jo(),n=e.useCost?e.useCost(r=>r):void 0;Et(n?.state?.config?.codexQuotaEnabled===!0&&n?.state?.config?.codexQuotaSidebar!==!1,n?.state?.config?.codexQuotaSource);let a;if(e.useProjection)try{a=e.useProjection("costUsage")}catch{a=void 0}Nn(e,a);const o=n?.state,i=o?{...o,config:fa(o,a?.provider)}:null;if(!i)return null;if(t){let r;try{r=le("react-dom")?.createPortal}catch{}if(r)return r(Ft(i,!0,e.api,!1,a?.provider),t)}return Ft(i,!!e.wide,e.api,!1,a?.provider)}function Ft(e,t,n,a=!1,o,i=a){const r=fa(e),l=Y(F(r)),c=(r.balance?.display==="sidebar"||r.balance?.display==="both")&&r.hideOfficialBalance!==!0&&yo(e,o,i),d=Ot(e,r).length>0,m=c&&r.balance?.showProgressBar===!0&&e.balance?.status==="ok",g=d&&r.balance?.showProgressBar===!0,b=r.goQuota?.main==="weekly"||r.goQuota?.main==="monthly"?r.goQuota.main:"rolling",p=r.goQuota?.enabled!==!1&&(r.goQuota?.display==="sidebar"||r.goQuota?.display==="both")&&e.goQuota?.status==="ok"&&e.goQuota?.[b]!==null,k=Le.map(L=>L.id).filter(L=>{const K=r.codingPlans?.[L];return K?.enabled!==!0||K.display!=="sidebar"&&K.display!=="both"?!1:K.sidebarAfterSuccess!==!0||e.codingPlans?.[L]?.status==="ok"}),h=k.length>0,v=zo(e,r,t,n),x=r.codexQuotaSidebar!==!1&&(r.codexQuotaEnabled===!0||e.codexCompat?.enabled===!0),y=(r.budget??{}).enabled===!0&&r.hideBudget!==!0,f=r.sidebar!==!1&&r.hideTodayCost!==!0,w=Be(r,Date.now())!==null,N=r.sidebarModels?.enabled===!0;if(!r.localSavings?.enabled&&!N&&!c&&!d&&!p&&!h&&!x&&!y&&!f&&!w&&v.length===0)return null;const C=r.sidebarSimple===!0,T=!C&&t&&r.sidebarStyle==="compact",O=[];C&&t&&f&&!r.sidebarTodayBalanceInline&&O.push(s("div",{key:"today","data-cm-display":"today",className:"cm-simple-summary"},s("span",null,l("today")),s("span",{className:"cm-num"},Sa(e.today,r,l)))),c&&e.balanceAccounts?.length>1?O.push(s(R,{key:"balance"},...e.balanceAccounts.map(L=>s(ca,{key:L.id,accountId:"official-"+L.id,label:L.label,state:{...e,balance:L,reconcile:void 0},wide:t,api:n})))):c&&e.balance?.status==="off"&&e.balanceAccounts?.length===1?O.push(s(ca,{key:"balance",state:{...e,balance:e.balanceAccounts[0],reconcile:void 0},wide:t,api:n})):m?O.push(s(ho,{key:"balance",state:e,wide:t,api:n})):c&&O.push(s(ca,{key:"balance",state:e,wide:t,api:n})),g?O.push(s(xo,{key:"customBalance",state:e,wide:t,api:n})):d&&O.push(s(No,{key:"customBalance",state:e,wide:t,api:n}));const W=O.length;h&&O.push(...k.map(L=>L==="minimax"?s(Eo,{key:"plan:"+L,state:e,wide:t,api:n}):s(Wo,{key:"plan:"+L,id:L,state:e,wide:t,api:n}))),O.push(...v),x&&O.push(s(qo,{key:"codex",state:e,wide:t,api:n,preview:a})),p&&O.push(s(Bo,{key:"go",state:e,wide:t})),y&&O.push(s(jt,{key:"budget",state:e,wide:t,summary:C&&t})),f&&(!(C&&t)||r.sidebarTodayBalanceInline)&&O.push(s(jt,{key:"today",state:e,wide:t,todayOnly:!0})),w&&O.push(s(R,{key:"peak"},t?Bn(e,r.sidebarStyle==="summary"&&!r.sidebarSimple?{...r,peakProgressVariant:"summary"}:r,l):To(e,r,l))),N&&O.splice(r.sidebarModels.position==="first"?0:r.sidebarModels.position==="afterBalance"?W:O.length,0,s(tr,{key:"models",state:e,wide:t,preview:a})),r.localSavings?.enabled&&O.push(s(ae,{key:"localSavings",state:e,wide:t,load:er,quiet:!0}));const A=r.sidebarOrder?.length?r.sidebarOrder:r.sidebarStyle==="summary"&&!C?["today","balance","peak"]:[];if(A.length){const L=K=>{const H=A.indexOf(K.key);return H<0?999:H};O.sort((K,H)=>L(K)-L(H))}return s("div",{...C?{tabIndex:0,role:"region","aria-label":l("sidebarSimple")}:{},className:"cm-footer-stack"+(r.sidebarTodayBalanceInline?" same-line":"")+(t?"":" rail")+(T?" compact":"")+(C?" simple":r.sidebarStyle==="summary"&&t?" summary":"")+(r.sidebarTextOnly?" text-only":"")},...!C&&t&&r.sidebarStyle==="icons"?[s(ae,{load:Zo,state:{...e,config:r},preview:a,nodes:O,fallback:O})]:O)}let Wn;const er=()=>Wn??=le.async("./client.local-savings.js").then(e=>e.mount({formatMoneyUsd:z,formatTokens:I,resolveLocale:F,Tooltip:V})).catch(e=>{throw Wn=null,e}),$n={enabled:!1,period:"today",topN:5,summary:"total",position:"last",defaultOpen:!1,remember:!0,tokens:!1,shares:!0,refreshSeconds:60,dock:!1},Kn="dsh-cost-meter:models-open";function zn(e,t,n){return Zn(e,e.config,n,t).map(a=>({...a,label:e.modelLabels?.[a.key]??(a.key==="deepseek:legacy"?a.label:bt(a.key)),cost:_(a,e.config)})).sort((a,o)=>o.cost-a.cost||o.tokens-a.tokens||a.key.localeCompare(o.key))}function tr({state:e,wide:t,preview:n=!1}){const a={...$n,...e.config.sidebarModels},o=Y(F(e.config)),i=()=>{try{const y=a.remember?window.localStorage.getItem(Kn):null;if(y!==null)return y==="1"}catch{}return a.defaultOpen},[r,l]=D(i),[c,u]=D(a.period);J(()=>u(a.period),[a.period]);const d=Ne(a.defaultOpen);J(()=>{l(n&&d.current!==a.defaultOpen?a.defaultOpen:i()),d.current=a.defaultOpen},[a.defaultOpen,a.remember]);const m=zn(e,c,o),g=m.reduce((y,f)=>y+f.cost,0),b=y=>z(y,e.config),p=o(c==="history"?"modelStatsHistory":"modelStatsToday")+" "+b(g)+" · "+o("modelsCount",{n:m.length}),k=a.summary==="top"&&m.length?m[0].label+" "+b(m[0].cost):p,h=s(R,null,s("span",{className:"cm-bal-label"},a.summary==="top"&&m.length?m[0].label:o(c==="history"?"modelStatsHistory":"modelStatsToday")),s("span",{className:"cm-bal-amt cm-num"},a.summary==="top"&&m.length?b(m[0].cost):b(g)+" · "+o("modelsCount",{n:m.length}))),v=()=>{l(!r);try{a.remember&&!n&&window.localStorage.setItem(Kn,r?"0":"1")}catch{}};if(!t||e.config.sidebarSimple)return s("div",{"data-cm-display":"models",className:"cm-foot cm-num"+(t?"":" cm-foot-rail"),title:k+" · "+p},t?h:s(At,{size:16}));const x=m.slice(0,a.topN);return m.length>a.topN&&x.push(m.slice(a.topN).reduce((y,f)=>{for(const w of["cost","input","output","cacheRead","cacheWrite"])y[w]+=f[w];return y},{key:"other",label:o("modelsOther"),cost:0,input:0,output:0,cacheRead:0,cacheWrite:0})),s("div",{"data-cm-display":"models",className:"cm-bbox cm-model-costs"},s("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(r),title:p,onClick:v},s("span",{className:"cm-caret"+(r?" open":"")}),h),r?s(R,null,s("div",{className:"cm-buttons"},["today","history"].map(y=>s("button",{key:y,type:"button",className:"cm-mstats-tab"+(c===y?" active":""),"aria-pressed":c===y,onClick:()=>u(y)},o(y==="today"?"modelStatsToday":"modelStatsHistory")))),x.length?x.map(y=>s("div",{key:y.key},s("div",{className:"cm-bbox-head"},s("span",{className:"cm-bal-label",title:y.label},y.label),s("span",{className:"cm-num cm-bal-amt"},b(y.cost))),a.shares?s("div",{className:"cm-bbox-bar",title:(g>0?y.cost/g*100:0).toFixed(1)+"%"},s("div",{className:"cm-bbox-fill",style:{width:(g>0?y.cost/g*100:0)+"%"}})):null,a.tokens?s("div",{className:"cm-mstats-note"},o("modelStatsInput")+" "+I(y.input)+" · "+o("modelStatsCache")+" "+I(y.cacheRead+y.cacheWrite)+" · "+o("modelStatsOutput")+" "+I(y.output)):null)):s("span",{className:"cm-note"},o("modelStatsEmpty"))):null)}function mt(e){return s("div",{className:"cm-card"},s("p",{className:"cm-card-title"},e.title),s("div",{className:"cm-card-value cm-num"},e.value),s("p",{className:"cm-card-sub"},e.sub))}const Ca=new WeakMap;function ar(e,t){let n;return Promise.race([Promise.resolve().then(e),new Promise((a,o)=>{n=setTimeout(()=>o(Error(t)),15e3)})]).finally(()=>clearTimeout(n))}const va=(e,t)=>e?.().then(n=>(Ca.set(e,n),n.prefetch?.(t))).catch(()=>{});function Gn({state:e}){const t=e?.billionContext;return!t||!(t.unresolved>0||["needs_update","changed","bridge_missing"].includes(t.compatibility))?null:s("p",{className:"cm-note","data-billing-accuracy":"billion-context"},F(e.config)==="en"?"Some billion-context usage records are incomplete; cost totals may differ from the provider bill.":"billion-context 部分用量记录不完整,费用统计可能存在偏差。")}function ae(e){const t=e.load??e.api.loadStatistics,[n,a]=D(()=>Ca.get(t)??null),[o,i]=D(""),[r,l]=D(0);return J(()=>{let c=!0;if(i(""),typeof t!="function")return;let u;try{u=t()}catch(d){u=Promise.reject(d)}return u.then(d=>{Ca.set(t,d),c&&a(()=>d)},d=>{c&&i(String(d.message??d))}),()=>{c=!1}},[e.api,e.load,r]),n?s(n,{...e,formatMoneyUsd:z,formatTokens:I,resolveLocale:F}):e.fallback?s(R,null,e.fallback,o?s("button",{type:"button",className:"cm-btn small",title:o,onClick:()=>l(c=>c+1)},F(e.state?.config)==="en"?"Retry icon layout":"重试图标布局"):null):e.quiet?null:s("div",{className:o?"":"cm-loading",role:o?"alert":"status","aria-label":F(e.state?.config)==="en"?"Loading":"正在读取"},o||s(R,null,s("i"),s("i"),s("i")),o?s("button",{className:"cm-btn",onClick:()=>l(c=>c+1)},"↻"):null)}const nr="cm-stat-dialog";function Vn(e){const t=fe.useRef(null),n=fe.useRef(!1);if(J(()=>{e.open&&t.current?.showModal()},[e.open]),!e.open)return null;const a=F(e.state?.config)==="en",o=sa(a),i=e.onClose,r=l=>{if(l.target!==l.currentTarget)return!1;const c=l.currentTarget.getBoundingClientRect();return l.clientX<c.left||l.clientX>=c.right||l.clientY<c.top||l.clientY>=c.bottom};return s("dialog",{ref:t,role:"dialog",className:nr,"aria-label":o,onCancel:i,onPointerDown:l=>{n.current=r(l)},onClick:l=>{n.current&&r(l)&&i(),n.current=!1}},s("header",{className:"cm-stat-dialog-head"},s("strong",null,o),s("button",{type:"button",className:"cm-btn",autoFocus:!0,"aria-label":a?"Close":"关闭",onClick:i},"×")),s("div",{className:"cm-stat-dialog-body"},e.state?s(ae,{key:e.sessionId,state:e.state,api:e.api,sessionId:e.sessionId}):s("p",{role:e.error?"alert":"status"},e.error||(a?"Loading…":"加载中…"),s("button",{type:"button",className:"cm-btn",onClick:()=>e.api.reload()},a?"Retry":"重试"))))}function sr(e){const t=e.useCost?.(d=>d),n=t?.state,[a,o]=D(null),i=n?.config?.hideSessionCostHeader===!0,r=!i&&!!e.sessionId&&a===e.sessionId;if(J(()=>{o(null)},[e.sessionId,i]),!e.sessionId||i)return null;const l=F(n?.config)==="en",c=sa(l),u=()=>va(e.api.loadStatistics,{state:n,sessionId:e.sessionId});return s(R,null,s("button",{type:"button",className:"cm-btn cm-stat-entry cm-stat-header",title:c,"aria-label":c,"aria-haspopup":"dialog","data-cm-display":"session-header",onMouseEnter:u,onFocus:u,onClick:()=>o(e.sessionId)},l?"Cost details":"费用明细"),s(Vn,{open:r,onClose:()=>o(null),sessionId:e.sessionId,state:n,error:t?.error,api:e.api}))}const pt=(e,t,n)=>s("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(e),onClick:t},s("span",{className:"cm-caret"+(e?" open":"")}),s("h3",{className:"cm-h"},n));function or(e){const{state:t,api:n}=e,a=Y(F(t.config)),[o,i]=D(!1);return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(o,()=>i(!o),a("history"))),o?s("div",{className:"cm-collapse-body"},s(rr,{state:t,api:n})):null)}function rr(e){const{state:t,api:n}=e,a=Y(F(t.config)),[o,i]=D(null),[r,l]=D({}),[c,u]=D(()=>new Set),d=t.history??[];if(d.length===0)return s("p",{className:"cm-empty"},a("noHistory"));const m=b=>{if(o===b){i(null);return}i(b),!(r[b]!==void 0||c.has(b))&&(u(p=>{const k=new Set(p);return k.add(b),k}),n.getDaySessions(b).then(p=>l(k=>({...k,[b]:Array.isArray(p?.sessions)?p.sessions:[]}))).catch(()=>l(p=>({...p,[b]:"error"}))).finally(()=>u(p=>{const k=new Set(p);return k.delete(b),k})))},g=b=>b.map(p=>s("tr",{key:p.id},Aa(p,t.config?.showSessionId===!0,a),s("td",{className:"num"},String(p.calls)),s("td",{className:"num"},I(p.input)),s("td",{className:"num"},I(p.cacheRead+p.cacheWrite)),s("td",{className:"num"},I(p.output)),s("td",{className:"num"},z(_(p,t.config),t.config))));return s("div",{className:"cm-scroll"},s("p",{className:"cm-hint",style:{padding:"6px 10px 0"}},a("historyExpandHint")),s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("colDate")),s("th",{className:"num"},a("colCalls")),s("th",{className:"num"},a("colInTok")),s("th",{className:"num"},a("colCacheTok")),s("th",{className:"num"},a("colOutTok")),s("th",{className:"num"},a("colCost")))),s("tbody",null,d.flatMap(b=>{const p=s("tr",{key:b.date,className:"cm-row-click",onClick:()=>m(b.date)},s("td",null,(o===b.date?"▾ ":"▸ ")+b.date),s("td",{className:"num"},String(b.calls)),s("td",{className:"num"},I(b.input)),s("td",{className:"num"},I(b.cacheRead+b.cacheWrite)),s("td",{className:"num"},I(b.output)),s("td",{className:"num"},z(_(b,t.config),t.config)));if(o!==b.date)return[p];const k=r[b.date],h=c.has(b.date)&&k===void 0?s("p",{className:"cm-empty"},a("historySessionsLoading")):k==="error"?s("p",{className:"cm-empty"},a("historySessionsError")):!Array.isArray(k)||k.length===0?s("p",{className:"cm-empty"},a("historyNoSessions")):s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("colSession")),s("th",{className:"num"},a("colCalls")),s("th",{className:"num"},a("colInTok")),s("th",{className:"num"},a("colCacheTok")),s("th",{className:"num"},a("colOutTok")),s("th",{className:"num"},a("colCost")))),s("tbody",null,g(k)));return[p,s("tr",{key:b.date+"-sessions"},s("td",{colSpan:6},h))]}))))}function ir(e){const{state:t,api:n}=e,a=Y(F(t.config)),[o,i]=D(!1),[r,l]=D(100),[c,u]=D("cost-desc"),[d,m]=D(null),[g,b]=D(!1),[p,k]=D(!1),h=fe.useRef(0),v=(w,N)=>{const[C,T]=N==="recent"?["recent","desc"]:N.split("-"),O=++h.current;b(!0),k(!1),n.getTopSessions(w,C,T).then(W=>{O===h.current&&m(Array.isArray(W?.sessions)?W.sessions:[])}).catch(()=>{O===h.current&&k(!0)}).finally(()=>{O===h.current&&b(!1)})},x=()=>{i(w=>{const N=!w;return N&&d===null&&!g&&v(r,c),N})},y=w=>{l(w),(o||d!==null)&&v(w,c)},f=w=>{u(w),(o||d!==null)&&v(r,w)};return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(o,x,a("sessionRankTitle"))),o?s("div",{className:"cm-collapse-body"},s("p",{className:"cm-hint"},a("sessionRankHint")),s("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",margin:"6px 0"}},s("div",{className:"cm-field"},s("label",null,a("sessionRankSort")),s("select",{className:"cm-input",value:c,onChange:w=>f(w.target.value)},s("option",{value:"cost-desc"},a("sessionSortCostDesc")),s("option",{value:"cost-asc"},a("sessionSortCostAsc")),s("option",{value:"time-desc"},a("sessionSortTimeDesc")),s("option",{value:"time-asc"},a("sessionSortTimeAsc")),s("option",{value:"recent"},a("sessionSortRecent")))),s("div",{className:"cm-field"},s("label",null,a("sessionRankLimit")),s("select",{className:"cm-input",value:String(r),onChange:w=>y(Number(w.target.value))},s("option",{value:"50"},"50"),s("option",{value:"100"},"100"),s("option",{value:"200"},"200")))),g?s("p",{className:"cm-empty"},a("sessionRankLoading")):p?s("p",{className:"cm-empty"},a("sessionRankError")):d===null||d.length===0?s("p",{className:"cm-empty"},a("sessionRankEmpty")):s("div",{className:"cm-scroll"},s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("colDate")),s("th",null,a("colSession")),s("th",{className:"num"},a("colCalls")),s("th",{className:"num"},a("colInTok")),s("th",{className:"num"},a("colCacheTok")),s("th",{className:"num"},a("colOutTok")),s("th",{className:"num"},a("colCost")))),s("tbody",null,d.map(w=>s("tr",{key:w.date+":"+w.id},s("td",null,w.date),Aa(w,t.config?.showSessionId===!0,a),s("td",{className:"num"},String(w.calls)),s("td",{className:"num"},I(w.input)),s("td",{className:"num"},I((w.cacheRead??0)+(w.cacheWrite??0))),s("td",{className:"num"},I(w.output)),s("td",{className:"num"},z(_(w,t.config),t.config)))))))):null)}function Yn(e){const{state:t}=e,n=Y(F(t.config)),a=t.today.sessions??[];if(a.length===0)return s("p",{className:"cm-empty"},n("noSessionsToday"));const o=t.config?.showSessionId===!0;return s("div",{className:"cm-scroll"},s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,n("colSession")),s("th",{className:"num"},n("colCalls")),s("th",{className:"num"},n("colInTok")),s("th",{className:"num"},n("colCacheTok")),s("th",{className:"num"},n("colOutTok")),s("th",{className:"num"},n("colCost")))),s("tbody",null,a.map(i=>s("tr",{key:i.id},Aa(i,o,n),s("td",{className:"num"},String(i.calls)),s("td",{className:"num"},I(i.input)),s("td",{className:"num"},I(i.cacheRead+i.cacheWrite)),s("td",{className:"num"},I(i.output)),s("td",{className:"num"},z(_(i,t.config),t.config)))))))}function Aa(e,t,n){const a=typeof e.title=="string"?e.title.trim():"",o=String(e.id).slice(0,14)+"…",i=a.length>0?a:o,r=a.length>0?a+" · "+e.id:e.id;return s("td",{title:r},s("div",{className:"cm-sess-title"+(a.length===0?" cm-sess-id":"")},i),t&&a.length>0?s("div",{className:"cm-sess-id"},o):null)}function lr(e){const{state:t,draft:n,setDraft:a,t:o}=e,i=t.config,r=n?.budget??i.budget,l=Number(i.exchangeRate),u=(t.budgetUsed??(r.period==="day"?_(t.today,i):r.period==="all"?_(t.total,i):_(t.month,i)))*(Number.isFinite(l)&&l>0?l:1),d=Math.max(0,Number(r.amount)||0),m=r.enabled&&d>0?Math.min(999,u/d*100):null,g=m===null?"ok":m>=100?"over":m>=80?"warn":"ok",b=(h,v)=>{n!==null&&a({...n,budget:{...n.budget??i.budget,[h]:v}})},p=r.period==="custom"?r.customStart+" → "+(r.customEnd??o("periodDay")):null,k=r.enabled&&m!==null?o("budgetStatus",{period:o(et[r.period]??"periodMonth"),amount:ce(d,i),used:ce(u,i),pct:m.toFixed(1)})+(g==="over"?o("overLimit"):g==="warn"?o("nearLimit"):""):null;return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},s("h3",{className:"cm-h"},o("budget")),s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:r.enabled===!0,onChange:h=>b("enabled",h.target.checked)}),s("span",null,o("enableBudget")))),r.enabled?s(R,null,s("div",{className:"cm-budget-bar"},s("div",{className:"cm-budget-fill "+(g==="ok"?"":g),style:{width:(m===null?0:Math.min(100,m))+"%"}})),s("div",{className:"cm-budget-line"+(g==="over"?" over":"")+" cm-num"},k),s("div",{className:"cm-budget-controls"},s("div",{className:"cm-field"},s("label",null,o("budgetAmountLabel")),ft({value:r.amount},h=>b("amount",h))),s("div",{className:"cm-field"},s("label",null,o("budgetPeriodLabel")),s("select",{className:"cm-input",value:r.period,onChange:h=>b("period",h.target.value)},s("option",{value:"day"},o("periodDay")),s("option",{value:"month"},o("periodMonth")),s("option",{value:"all"},o("periodAll")),s("option",{value:"custom"},o("periodCustomRange")))),r.period==="custom"?s(R,null,s("div",{className:"cm-field"},s("label",null,o("startDate")),s("input",{className:"cm-input",type:"date",value:r.customStart??"",onChange:h=>b("customStart",h.target.value===""?null:h.target.value)})),s("div",{className:"cm-field"},s("label",null,o("endDate")),s("input",{className:"cm-input",type:"date",value:r.customEnd??"",onChange:h=>b("customEnd",h.target.value===""?null:h.target.value)}))):null),p!==null?s("p",{className:"cm-hint"},o("rangeText",{range:p})):null):s("p",{className:"cm-note"},o("budgetDisabledNote")))}function cr(e){return s(ae,{...e,load:e.api.loadPricing,mode:"peak-settings",peakHelpers:{peakPhaseAt:ma,resolveLocale:F,peakNoticeEl:Bn}})}function ft(e,t){const n=e.value;return s("input",{className:"cm-input narrow",type:"number",step:"any",min:"0",placeholder:e.placeholder,title:e.title,"aria-label":e.label,value:typeof n=="number"?String(n):"",onChange:a=>{const o=a.target.value;if(o===""){if(e.emptyMode==="clear"){t(null);return}if(e.emptyMode==="ignore")return;t(0);return}const i=Number(o);Number.isFinite(i)&&i>=0&&t(i)}})}function Ma({value:e,entry:t,path:n,emptyMode:a,placeholder:o,label:i,title:r,t:l,onCommit:c,plain:u=!1}){const d=Nt(t,n),m=e==null?"":String(e)+(!u&&(t.multiplier!==void 0||t.separateMultipliers)?" × "+d:""),[g,b]=D(m),[p,k]=D(!1),h=Ne(!1);J(()=>{h.current||b(m)},[m]);const v=()=>{if(!h.current)return;const x=g.trim().split(/\s*[×*xX]\s*/),y=/^[+]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;if(g.trim()===""){h.current=!1,k(!1),a==="clear"?c(null):b(m);return}if(x.length>2||!x.every(f=>y.test(f)&&Number.isFinite(Number(f)))||!Number.isFinite(Number(x[0])*(x.length===2?Number(x[1]):d))){k(!0);return}h.current=!1,k(!1),b(String(Number(x[0]))+(!u&&(t.multiplier!==void 0||t.separateMultipliers||x.length===2)?" × "+(x.length===2?Number(x[1]):d):"")),c(Number(x[0]),x.length===2?Number(x[1]):void 0)};return s("input",{className:"cm-input narrow",type:"text",value:g,placeholder:o,"aria-label":i,"aria-invalid":p,title:p?l("priceMultiplyInvalid"):[r,u?"":l(t.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll"),e==null?"":"= "+Number((e*d).toPrecision(12))].filter(Boolean).join(" · "),onChange:x=>{h.current=!0,b(x.target.value),k(!1)},onBlur:v,onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),v()),x.key==="Escape"&&(x.stopPropagation(),h.current=!1,k(!1),b(m))}})}function Qt(e,t,n){n!==void 0&&(e.separateMultipliers?e.multipliers={...e.multipliers,[t]:n}:e.multiplier=n)}function Pa(e,t,n,a,o,i,r,l=0){const c=a==="cacheWrite",u=t?.[a]??(a==="cacheMiss"?t?.input:a==="cacheHit"?t?.cachedInput:void 0)??null,d=i({cacheHit:"flatCached",cacheMiss:"flatInput",cacheWrite:"flatCacheWrite",output:"flatOutput"}[a]);return s("label",{className:"cm-price-cell"},s("span",{className:"cm-price-cell-label"},d),s(Ma,{entry:e,value:u,path:n+"."+a,t:i,emptyMode:c||!["base","cny"].includes(n)?"clear":"ignore",placeholder:c?String(t?.cacheHit??t?.cachedInput??t?.cacheMiss??t?.input??l):void 0,label:o+" · "+d,title:c?i("cacheWriteFallback"):void 0,onCommit:r}))}function Oa(e,t,n){return s("div",{className:"cm-price-multiplier"},s("label",null,s("input",{type:"checkbox",checked:e.separateMultipliers===!0,onChange:a=>n(a.target.checked)}),t("priceMultiplySeparate")),s("span",{title:t(e.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll")},t("priceMultiplyHint")))}function ur(e){const{modelId:t,entry:n,isDefault:a,draft:o,setDraft:i,t:r}=e,l=nt(n),c=b=>{const p={...nt(b)};if(Array.isArray(b.rateHistory)){const k=b.rateHistory.filter(h=>Date.parse(h.before)<=Date.now());k.length>0?p.rateHistory=k:delete p.rateHistory}return p},u=b=>{const p=a?{...o.prices,default:b}:{...o.prices,models:{...o.prices.models,[t]:b}};i({...o,prices:p})},d=(b,p,k,h)=>{const v=a?o.prices.default:o.prices.models[t],x=c(v??{cacheHit:0,cacheMiss:0,output:0}),y=b==="base"?x:{...x[b]??(k===null?{}:We(x))};k===null?delete y[p]:y[p]=Math.max(0,k),b!=="base"&&(Object.keys(y).length?x[b]=y:delete x[b]),Qt(x,b+"."+p,h),u(x)},m=()=>{const b={...o.prices.models};delete b[t],i({...o,prices:{...o.prices,models:b}})},g=(b,p)=>{const k=p==="base"?l:l[p]??null;return s("div",{className:"cm-price-row",key:p},s("span",null,b),...["cacheMiss","cacheHit","cacheWrite","output"].map(h=>s(R,{key:h},Pa(l,k,p,h,b,r,(v,x)=>d(p,h,v,x),l.cacheHit))))};return s("div",{className:"cm-price-card"},s("div",{className:"cm-price-head"},s("span",{className:"cm-price-name"},t),s("span",{className:"cm-price-unit"},o.prices.currency??"USD"),s(R,null,l?.legacy===!0?s("span",{className:"cm-price-legacy"},r("legacyModel")):null,a?s("span",{className:"cm-price-legacy"},r("defaultFallback")):null,a?null:s("button",{className:"cm-btn small danger",onClick:m},r("remove")))),s("div",{className:"cm-price-row cm-price-columns"},s("span",null,""),s("span",null,r("flatInput")),s("span",null,r("flatCached")),s("span",null,r("flatCacheWrite")),s("span",null,r("flatOutput"))),g(r("tierBase"),"base"),g(r("tierOffPeak"),"offPeak"),g(r("tierPeak"),"peak"),Oa(l,r,b=>u({...n,separateMultipliers:b,multipliers:{}})),Array.isArray(n?.rateHistory)&&n.rateHistory.length>0?s("p",{className:"cm-note"},r("datedPriceNote")):null)}const dr={deepseek:"DeepSeek",stepfun:"StepFun",openai:"OpenAI",anthropic:"Anthropic",google:"Google Gemini",moonshot:"Moonshot (Kimi)","z-ai":"Z.ai / 智谱",xai:"xAI",alibaba:"阿里云百炼",minimax:"MiniMax",tencent:"腾讯混元",xiaomi:"小米",upstage:"Upstage",nvidia:"NVIDIA",mistral:"Mistral",meta:"Meta",meituan:"美团 LongCat","opencode-go":"OpenCode Go"},mr=e=>e==="zen"?"go":e,bt=e=>e.replace(/^zen:/i,"go:").replace(/^(deepseek(?:-official|-account)?):deepseek-(?:v4(?:\.1)?-)?flash(?:-vision-exp)?$/i,"$1:DeepSeek V4.1 Flash");function Zn(e,t,n,a){const o=["input","output","cacheRead","cacheWrite","reasoning","cost","calls"],i=u=>Number.isFinite(Number(u))&&Number(u)>0?Number(u):0,r=(u,d,m)=>{if(!m||typeof m!="object")return;const g=u[d]??(u[d]=Object.fromEntries([...o,"apiCost"].map(p=>[p,0])));for(const p of o)g[p]+=i(m[p]);for(const p of kt)Number.isFinite(m[p])&&(g[p]=(g[p]??0)+m[p]);const b=d.indexOf(":");g.apiCost+=i(m.apiCost??(rt(b>0?d.slice(0,b):"deepseek",b>0?d.slice(b+1):d,t)==="plan"?0:m.cost))},l=u=>{if(!u||typeof u!="object")return{};if(u.byProviderModel&&Object.keys(u.byProviderModel).length)return u.byProviderModel;if(u.byModel&&Object.keys(u.byModel).length)return Object.fromEntries(Object.entries(u.byModel).map(([m,g])=>[m.includes(":")?m:"deepseek:"+m,g]));const d={};for(const m of Array.isArray(u.sessions)?u.sessions:[])if(!(!m||typeof m!="object"))if(m.byProviderModel&&Object.keys(m.byProviderModel).length)for(const[g,b]of Object.entries(m.byProviderModel))r(d,g,b);else r(d,(m.provider||"deepseek")+":"+(m.model||"unknown"),m);return Object.keys(d).length?d:o.some(m=>i(u[m])>0)?{"deepseek:legacy":u}:{}};return(u=>{const d={},m=g=>{for(const[b,p]of Object.entries(g??{}))r(d,b,p)};if(u==="today")m(l(e.today));else{const g=Date.parse((e.meta?.dayKey||new Date().toISOString().slice(0,10))+"T00:00:00Z");for(const b of e.history??[]){const p=Date.parse(b.date+"T00:00:00Z");p<=g&&p>=g-76896e5&&m(l(b))}}return Object.entries(d).map(([g,b])=>{const p=g.indexOf(":"),k=(p>0?g.slice(0,p):"deepseek").toLowerCase(),h=p>0?g.slice(p+1):g,v=b.input+b.output+b.cacheRead+b.cacheWrite+b.reasoning,x=b.cacheRead+b.input;return{label:e.modelLabels?.[g]??(g==="deepseek:legacy"?n("modelStatsLegacy"):k==="deepseek"||k===""?h:mr(k)+":"+h),key:g,...b,tokens:v,cls:rt(k,h,t),hitRate:x>0?b.cacheRead/x:null,cacheUnreported:Ys(b),blended:v>0&&b.cost>0?b.cost/v*1e6:null,perUsd:b.cost>0?v/b.cost:null}}).filter(g=>(g.tokens>0||g.cost>0)&&t.modelStatistics?.[g.key]?.[u==="today"?"today":"summary"]!==!1)})(a).sort((u,d)=>d.cost-u.cost||d.tokens-u.tokens)}function pr(e){const{state:t,config:n,t:a,initialTab:o,draft:i,setDraft:r}=e,[l,c]=D(o==="history"?"history":"today"),[u,d]=D(!1),m=Zn(t,n,a,l),g=f=>(Math.max(0,Math.min(1,f))*100).toFixed(1)+"%",b=m.reduce((f,w)=>Math.max(f,w.cost),0),p=m.reduce((f,w)=>Math.max(f,w.tokens),0),k=m.reduce((f,w)=>Math.max(f,w.perUsd??0),0),h=(f,w)=>s("button",{className:"cm-mstats-tab"+(l===f?" active":""),onClick:()=>c(f)},w),v=f=>f.cls==="plan"?s("span",{className:"cm-plan-tag",title:a("billingClassLabel")+" · "+(Ta(gn(f.provider,n,f.model),a)||a("billingClassPlan"))},a("billingClassPlan")):null,x=f=>s("select",{className:"cm-input",title:a("billingClassLabel"),value:n.planBilling?.models?.[f.key]==="plan"&&n.planBilling?.modelPlans?.[f.key]?"plan:"+n.planBilling.modelPlans[f.key]:n.planBilling?.models?.[f.key]??"auto",disabled:i===null,onChange:w=>{const N={...i.planBilling?.models??{}},C={...i.planBilling?.modelPlans??{}},T=w.target.value;delete C[f.key],T.startsWith("plan:")?(N[f.key]="plan",C[f.key]=T.slice(5)):T==="auto"?delete N[f.key]:N[f.key]=T,r({...i,planBilling:{...i.planBilling,models:N,modelPlans:C}})}},s("option",{value:"auto"},a("billingClassAuto")),s("option",{value:"plan"},a("billingClassPlan")),s("option",{value:"api"},a("billingClassApi")),Te.map(w=>s("option",{key:w,value:"plan:"+w},a("billingClassPlan")+" · "+Ta(w,a)))),y=(f,w,N,C,T)=>s("div",{className:"cm-mstats-row"},T?s("div",{className:"cm-mstats-label"},s("span",{className:"cm-mstats-name",title:f},f),T):s("span",{className:"cm-mstats-name",title:f},f),s("div",{className:"cm-mstats-barbg"},s("div",{className:"cm-mstats-bar "+N,style:{width:g(w)}})),s("span",{className:"cm-mstats-val"},C));return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(u,()=>d(!u),a("modelStatsTitle"))),u?s("div",{className:"cm-collapse-body"},s("div",{className:"cm-mstats-tabs"},h("today",a("modelStatsToday")),h("history",a("modelStatsHistory"))),m.length===0?s("p",{className:"cm-note"},a("modelStatsEmpty")):s(R,null,s("div",{className:"cm-mstats-h"},a("modelStatsCostH")),m.map(f=>s(R,{key:"c:"+f.label},y(f.label,b>0?f.cost/b:0,"cost",z(f.cost,n),s(R,null,v(f),x(f),f.cacheUnreported?s("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null)))),s("div",{className:"cm-mstats-h"},a("modelStatsTokensH")),s("div",{className:"cm-mstats-legend"},s("span",null,s("span",{className:"cm-mstats-dot",style:{background:"var(--dsw-alias-state-business-primary)"}}),a("modelStatsInput")),s("span",null,s("span",{className:"cm-mstats-dot",style:{background:"#ff9800"}}),a("modelStatsCache")),s("span",null,s("span",{className:"cm-mstats-dot",style:{background:"#34a853"}}),a("modelStatsOutput"))),[...m].sort((f,w)=>w.tokens-f.tokens).map(f=>s("div",{className:"cm-mstats-row",key:"t:"+f.label},s("span",{className:"cm-mstats-name",title:f.label},f.label),s("div",{className:"cm-mstats-barbg"},s("div",{className:"cm-mstats-seg in",style:{width:g(p>0?f.input/p:0)}}),s("div",{className:"cm-mstats-seg cache",style:{width:g(p>0?(f.cacheRead+f.cacheWrite)/p:0)}}),s("div",{className:"cm-mstats-seg out",style:{width:g(p>0?(f.output+f.reasoning)/p:0)}})),s("span",{className:"cm-mstats-val"},I(f.tokens)))),s("div",{className:"cm-mstats-h"},a("modelStatsHitH")),[...m].sort((f,w)=>(w.hitRate??-1)-(f.hitRate??-1)).map(f=>s(R,{key:"h:"+f.label},y(f.label,f.hitRate??0,"hit",f.cacheUnreported?a("modelStatsHitUnreported"):f.hitRate===null?"—":(f.hitRate*100).toFixed(1)+"%",f.cacheUnreported?s("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null))),s("div",{className:"cm-mstats-h"},a("modelStatsValueH")),[...m].sort((f,w)=>(w.perUsd??-1)-(f.perUsd??-1)).map(f=>s(R,{key:"v:"+f.label},y(f.label,k>0?(f.perUsd??0)/k:0,"value",f.perUsd===null?"—":I(f.perUsd)+" tok/$"+(f.blended!==null?" · "+a("modelStatsBlended",{price:"$"+f.blended.toFixed(2)}):"")))),s("p",{className:"cm-mstats-note"},a("modelStatsNote")))):null)}function fr(e,t){return e==="fiveHour"?t==="en"?"5-hour":"5 小时":e==="weekly"?t==="en"?"This week":"本周":e==="monthly"?t==="en"?"This month":"本月":e==="daily"?t==="en"?"Today":"当日":e}function Ta(e,t){if(e==="go")return"OpenCode Go / Go Plus";const n={codex:"Codex / ChatGPT","volcengine-agent":"Volcengine Agent Plan","tencent-coding":"Tencent Coding Plan","tencent-token":"Tencent Token Plan"};if(n[e])return n[e];const a=Le.find(o=>o.id===e);return a!==void 0?t(a.labelKey):e}const Jn=["fiveHour","weekly","monthly","daily"];function br(e,t){const n=new Map,a=o=>{const i=new Date(o),r=l=>String(l).padStart(2,"0");if(t==="monthly")return i.getFullYear()+"-"+r(i.getMonth()+1);if(t==="weekly"){const l=new Date(i.getFullYear(),i.getMonth(),i.getDate()-(i.getDay()+6)%7);return l.getFullYear()+"-"+r(l.getMonth()+1)+"-"+r(l.getDate())}return i.getFullYear()+"-"+r(i.getMonth()+1)+"-"+r(i.getDate())};for(const o of Object.values(e??{}))for(const i of o??[]){if(i===null||typeof i!="object"||!(i.tokens>0)&&!(i.cost>0))continue;const r=a(Number(i.t1)||Number(i.t0)),l=n.get(r)??{key:r,tokens:0,cost:0,pct:0,intervals:0};l.tokens+=Number(i.tokens)||0,l.cost+=Number(i.cost)||0,l.pct+=Number(i.pct)||0,l.intervals+=1,n.set(r,l)}return[...n.values()].map(o=>({...o,per1Tokens:o.pct>0?o.tokens/o.pct:null,fullTokens:o.pct>0?o.tokens/o.pct*100:null})).sort((o,i)=>o.key<i.key?-1:o.key>i.key?1:0)}function gr(e){const{state:t,config:n,t:a}=e,[o,i]=D(!1),[r,l]=D("daily"),c=F(n),u=t?.planStats,d=u!=null&&typeof u.providers=="object"?u.providers:{},m=Object.keys(d).sort(),g=N=>z(Number(N)||0,n??t?.config),b=N=>N.method==="none"||N.per1Tokens===null?"—":I(N.per1Tokens)+" tok · "+g(N.per1Cost),p=N=>N.method==="none"||N.fullTokens===null?"—":I(N.fullTokens)+" tok · "+g(N.fullCost),k=N=>N.method==="sample"?a("planStatsMethodSample"):N.method==="live"?a("planStatsMethodLive"):a("planStatsMethodNone"),h=N=>{let C=k(N);return N.method==="sample"&&Number(N.sampleAt)>0&&(C=a("planStatsMethodSampleAt",{method:C,time:new Date(Number(N.sampleAt)).toLocaleString(c==="en"?"en-US":"zh-CN")})),(N.method==="sample"||N.method==="live")&&N.confidence==="low"&&(C+=" · "+a("planStatsConfidenceLow")),C},v=([N,C,T])=>s("tr",{key:C+":"+N},s("td",null,fr(N,c)),s("td",{className:"num"},Math.round(T.percent*10)/10+"%"),s("td",{className:"num"},I(T.localTokens)+" tok · "+g(T.localCost)),s("td",{className:"num"},b(T)),s("td",{className:"num"},p(T)),s("td",{className:"num cm-plan-reset"},T.resetsAt.length>0?a("planStatsResets",{time:new Date(T.resetsAt).toLocaleString(c==="en"?"en-US":"zh-CN")}):"—"),s("td",{className:"cm-plan-method"},h(T))),x=o?m.flatMap(N=>Object.entries(d[N]?.intervals??{})).map(([N,C])=>({winKey:N,list:C})):[],y=br(Object.fromEntries(x.map(N=>[N.winKey,N.list])),r),f=y.reduce((N,C)=>Math.max(N,C.fullTokens??0),0),w=(N,C)=>s("button",{key:N,className:"cm-mstats-tab"+(r===N?" active":""),onClick:()=>l(N)},C);return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},pt(o,()=>i(!o),a("planStatsTitle"))),o?s("div",{className:"cm-collapse-body"},m.length===0?s("p",{className:"cm-empty"},a("planStatsEmpty")):s(R,null,m.map(N=>{const C=d[N]?.windows??{},T=[...Jn.filter(O=>C[O]!==void 0).map(O=>[O,N,C[O]]),...Object.keys(C).filter(O=>!Jn.includes(O)).map(O=>[O,N,C[O]])];return s("div",{key:N,className:"cm-plan-provider"},s("div",{className:"cm-plan-provider-name"},Ta(N,a),s("span",{className:"cm-plan-updated"},(()=>{const O=Number(d[N]?.generatedAt)||Number(u?.generatedAt)||0;return O>0?new Date(O).toLocaleTimeString(c==="en"?"en-US":"zh-CN"):""})())),s("table",{className:"cm-table"},s("thead",null,s("tr",null,s("th",null,a("planStatsWindow")),s("th",{className:"num"},a("planStatsPercent")),s("th",null,a("planStatsLocal")),s("th",null,a("planStatsPer1")),s("th",null,a("planStatsFull")),s("th",null,""),s("th",null,""))),s("tbody",null,T.map(v))))}),s("div",{className:"cm-mstats-h",style:{marginTop:"10px"}},a("planStatsCurveTitle")),s("div",{className:"cm-mstats-tabs"},w("daily",a("planStatsDaily")),w("weekly",a("planStatsWeekly")),w("monthly",a("planStatsMonthly"))),y.length===0?s("p",{className:"cm-note"},a("planStatsCurveEmpty")):s(R,null,[...y].reverse().map(N=>s("div",{className:"cm-mstats-row",key:N.key},s("span",{className:"cm-mstats-name"},N.key),s("div",{className:"cm-mstats-barbg"},s("div",{className:"cm-mstats-bar value",style:{width:(f>0?(N.fullTokens??0)/f*100:0).toFixed(1)+"%"}})),s(V,{label:a("planStatsBarTip",{date:N.key,full:N.fullTokens===null?"—":I(N.fullTokens),per1:N.per1Tokens===null?"—":I(N.per1Tokens),tokens:I(N.tokens),cost:g(N.cost),intervals:N.intervals}),side:"top",delayMs:200},s("span",{className:"cm-mstats-val"},N.fullTokens===null?"—":I(N.fullTokens)))))),s("p",{className:"cm-note"},a("planStatsNote")))):null)}function yr(e){const{provider:t,modelId:n,entry:a,draft:o,setDraft:i,t:r,api:l,lockedIds:c,releaseDisabled:u}=e,d=Array.isArray(c)&&c.includes(n),[m,g]=D(!1),[b,p]=D(""),k=async()=>{if(!(m||u)){g(!0),p("");try{await l.releasePriceLock(n)}catch(f){p(String(f.message??f))}finally{g(!1)}}},h=f=>{const w={...o.prices.providers??{}},N=w[t]??{};w[t]={...N,models:f},i({...o,prices:{...o.prices,providers:w}})},v=(f,w,N)=>{if(o===null)return;const C={...(o.prices.providers??{})[t]?.models??{}};C[n]={...C[n]??{},[f]:Math.max(0,w)},w===null&&delete C[n][f],f==="input"&&delete C[n].cacheMiss,f==="cachedInput"&&(delete C[n].cacheHit,delete C[n].cacheRead),Qt(C[n],"base."+({input:"cacheMiss",cachedInput:"cacheHit"}[f]??f),N),h(C)},x=(f,w,N)=>{if(o===null)return;const C={...(o.prices.providers??{})[t]?.models??{}},T=C[n]??{};C[n]={...T,cny:{...T.cny,[f]:Math.max(0,w)}},w===null&&delete C[n].cny[f],Qt(C[n],"cny."+f,N),h(C)},y=()=>{if(o===null)return;const f={...(o.prices.providers??{})[t]?.models??{}};delete f[n],h(f)};return s("div",{className:"cm-price-card"},s("div",{className:"cm-price-head"},s("span",{className:"cm-price-name"},n),s("span",{className:"cm-price-unit"},a.cny?"USD / CNY":"USD"),s(R,null,a?.unpriced===!0?s("span",{className:"cm-price-legacy"},r("catalogUnpriced")):null,d?s("span",{className:"cm-price-locked",title:r("priceLockHint")},r("priceLockBadge")):null,d&&typeof l?.releasePriceLock=="function"?s("button",{className:"cm-btn small",disabled:m||u,onClick:k},r("priceLockRelease")):null,s("button",{className:"cm-btn small danger",onClick:y},r("unmountBtn")))),b?s("p",{className:"cm-err",role:"alert"},b):null,a?.unpriced===!0?null:s(R,null,s("div",{className:"cm-price-row cm-price-columns"},s("span",null,""),s("span",null,r("flatInput")),s("span",null,r("flatCached")),s("span",null,r("flatCacheWrite")),s("span",null,r("flatOutput"))),s("div",{className:"cm-price-row"},s("span",null,"USD"),...["cacheMiss","cacheHit","cacheWrite","output"].map(f=>s(R,{key:f},Pa(a,a,"base",f,"USD",r,(w,N)=>v({cacheMiss:"input",cacheHit:"cachedInput"}[f]??f,w,N))))),a?.cny?s("div",{className:"cm-price-row"},s("span",null,"CNY"),...["cacheMiss","cacheHit","cacheWrite","output"].map(f=>s(R,{key:f},Pa(a,a.cny,"cny",f,"CNY",r,(w,N)=>x(f,w,N))))):null,Oa(a,r,f=>h({...o.prices.providers[t].models,[n]:{...a,separateMultipliers:f,multipliers:{}}}))))}const Ra=e=>[s("option",{key:"sidebar",value:"sidebar"},e("balanceSidebar")),s("option",{key:"settings",value:"settings"},e("balanceSettings")),s("option",{key:"both",value:"both"},e("balanceBoth")),s("option",{key:"off",value:"off"},e("off"))],Da=e=>e!=null?s("div",{className:"cm-msg "+e.kind},e.text):null;function hr(e){const{state:t,api:n,t:a,draft:o,setDraft:i}=e,[r,l,c]=_t(a,()=>n.refreshBalance()),u=t.balance,d=t.config,m=t.reconcile,g=(o?.balance??d.balance??{}).reconcile!==!1,b=h=>{o===null||typeof i!="function"||i({...o,balance:{...o.balance??d.balance??{},reconcile:h.target.checked}})},p=h=>Re(h,d,u?.currency),k=u.status==="ok"?s("div",{className:"cm-bal-line"},s("span",null,a("balanceLine",{total:p(u.totalBalance),granted:p(u.grantedBalance),toppedUp:p(u.toppedUpBalance),time:u.fetchedAt>0?new Date(u.fetchedAt).toLocaleTimeString():"—"}))):u.status==="error"?s("div",{className:"cm-bal-line err"},a("balanceQueryFailedHint",{message:u.message||a("unknownError")})):s("div",{className:"cm-bal-line"},a("balanceNotQueried"));return s("div",{className:"cm-budget"},s("div",{className:"cm-budget-head"},s("h3",{className:"cm-h"},a("accountBalance")),s("button",{className:"cm-btn small",onClick:c,disabled:r},a(r?"refreshing":"refreshBalance"))),k,s("div",{className:"cm-field"},s("label",null,a("balanceSourceChoice")),s("select",{className:"cm-input","aria-label":a("balanceSourceChoice"),value:(o?.balance??d.balance)?.source??"auto",disabled:!o,onChange:h=>i({...o,balance:{...o.balance,source:h.target.value}})},s("option",{value:"auto"},a("balanceSourceAuto")),s("option",{value:"account"},a("balanceSourceAccount")))),s("p",{className:"cm-hint"},a("balanceSourceHint")),s("label",null,a("balanceApiKey")),s(ts,{state:t,draft:o,setDraft:i,target:"balance",configured:u.keyConfigured,source:u.keySource,t:a,api:n,placeholder:"sk-…"}),m!==void 0&&m.ok===!1?s("div",{className:"cm-bal-line warn"},"⚠ "+m.message):null,s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:g,onChange:b}),a("reconcileLabel")),Da(l))}function Ba(e){const t=Ne(null);J(()=>{e.targeted&&(t.current?.scrollIntoView({block:"start"}),t.current?.focus({preventScroll:!0}))},[e.targeted]);const{name:n,enabled:a,saved:o,busy:i,open:r,statusNode:l,configNode:c,errorMsg:u,onToggle:d,onRefresh:m,onLogin:g,loginRequired:b,onRemove:p,onToggleOpen:k,t:h}=e,v=c!=null,x=b?g:m,y=h(i===!0?b?"loggingIn":"refreshing":b?"loginCodingPlan":"refresh");return s("div",{ref:t,"data-quota-plan":e.planId,tabIndex:e.targeted?-1:void 0,className:"cm-budget cm-quota-card"},s("div",{className:"cm-budget-head"},s("label",{className:"cm-check"},s("input",{type:"checkbox","aria-label":h("enable")+": "+n,checked:a===!0,onChange:f=>d(f.target.checked)})),s("div",{className:"cm-quota-name"},v?pt(r===!0,k,n):s("h3",{className:"cm-h"},n)),a&&e.onSidebar?s("label",{className:"cm-check cm-quota-sidebar"},s("input",{type:"checkbox",checked:["both","sidebar"].includes(e.display),"aria-label":n+" · "+h("quotaSidebar"),onChange:f=>e.onSidebar(f.target.checked?"both":"settings")}),h("quotaSidebar")):null,p?s("button",{className:"cm-btn small",onClick:p},h("quotaRemove")):null,s("button",{className:"cm-btn small",onClick:x,disabled:i===!0||a!==!0||o?.enabled!==!0||o.display==="off"&&o.showInComposer!==!0,title:a!==!0?h("quotaEnableFirst"):o?.enabled!==!0||o.display==="off"&&o.showInComposer!==!0?h("quotaRefreshReady"):h(b?"loginCodingPlan":"refresh")},y)),l,v&&r===!0?s("div",{className:"cm-collapse-body"},c):null,u!=null?s("div",{className:"cm-msg "+u.kind},u.text):null)}function _t(e,t){const[n,a]=D(!1),[o,i]=D(null),r=Ne(!1);return[n,o,async()=>{if(!r.current){r.current=!0,a(!0),i(null);try{const c=await t();i({kind:c.ok?"ok":"err",text:c.message})}catch(c){i({kind:"err",text:e("syncFailed",{message:c?.message??String(c)})})}finally{r.current=!1,a(!1)}}}]}const kr=e=>{const t=e.filter(a=>a.enabled===!0),n=e.filter(a=>a.enabled!==!0);return[...t,...n]},La=(e,t,n,a,o,i=t)=>{if(typeof n?.percent!="number")return s("div",{key:i,className:"cm-go-row"+(o?" main":"")},s("span",{className:"cm-go-label"},t),s("span",{className:"cm-go-num"},typeof n?.text=="string"?n.text:"—"));const r=Math.max(0,Math.min(100,Number(n.percent)||0)),l=he(r,a),c=typeof n.resetsAt=="string"&&n.resetsAt.length>0?e("goResetAt",{time:new Date(n.resetsAt).toLocaleString()}):"";return s("div",{key:i,className:"cm-go-row"+(o?" main":"")},s("span",{className:"cm-go-label"},t),s("div",{className:"cm-go-bar"},s("div",{className:"cm-go-fill",style:{width:l.width+"%"}})),s("span",{className:"cm-go-num"},l.label===null?"—":e("goQuotaPercent",{percent:String(Math.round(l.label))})),c?s("span",{className:"cm-go-reset"},c):null)};function xr(e){return s(ae,{...e,mode:"custom-balance",load:es})}function wr({config:e,draft:t,setDraft:n,t:a,api:o}){const i=t?.goQuota??e.goQuota,r=(l,c)=>{t&&n({...t,goQuota:{...i,[l]:c}})};return s(R,null,[["display","goQuotaDisplayLabel"],["main","goMainLabel"]].map(([l,c])=>s("div",{key:l,className:"cm-field"},s("label",null,a(c)),s("select",{className:"cm-input",value:l==="display"?xa(i,(t??e).quotaStrip,"go"):i[l],onChange:u=>l==="display"?t&&n({...t,goQuota:{...i,...wa(u.target.value)}}):r(l,u.target.value)},l==="display"?Na(a):["rolling","weekly","monthly"].map((u,d)=>s("option",{key:u,value:u},a(["goWindowRolling","goWindowWeekly","goWindowMonthly"][d])))))),s("div",{className:"cm-field"},s("label",null,a("goQuotaRefreshIntervalLabel")),ft({value:i.refreshMinutes},l=>r("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(l)))))),s("label",null,a("goQuotaKeyLabel")),s(ts,{state:{config:e},draft:t,setDraft:n,target:"goQuota",configured:e.goQuota?.keyConfigured===!0,source:e.goQuota?.keySource,t:a,api:o,placeholder:"sk-…"}))}function Nr(e){const{state:t,api:n,t:a,draft:o,setDraft:i}=e,[r,l]=D(!1),c=t.goQuota,u=t.config,d=o?.goQuota?.enabled??u.goQuota?.enabled??!0,m=(f,w)=>{o!==null&&i({...o,goQuota:{...o.goQuota??u.goQuota,[f]:w}})},[g,b,p]=_t(a,()=>n.refreshGoQuota()),k=u.goQuota?.main==="weekly"||u.goQuota?.main==="monthly"?u.goQuota.main:"rolling",h=[k,...["rolling","weekly","monthly"].filter(f=>f!==k)],v=f=>f==="rolling"?"goWindowRolling":f==="weekly"?"goWindowWeekly":"goWindowMonthly",x=f=>f==="rolling"?c.rolling:f==="weekly"?c.weekly:c.monthly,y=d===!1?s("p",{className:"cm-note"},a("goQuotaDisabledNote")):c.status==="ok"?s("div",{className:"cm-go-list"},h.map(f=>La(a,a(v(f)),x(f),re(u,"go"),f===k)),s("div",{className:"cm-go-time"},a("goQuotaFetchedAt",{time:c.fetchedAt>0?new Date(c.fetchedAt).toLocaleTimeString():"—"}))):c.status==="error"?s("div",{className:"cm-bal-line err"},c.message||a("unknownError")):c.status==="off"&&c.message?s("p",{className:"cm-note"},c.message):s("div",{className:"cm-bal-line"},a("goQuotaNotQueried"));return s(Ba,{display:(o??u).goQuota?.display,onSidebar:f=>m("display",f),name:a("goQuotaTitle"),enabled:d,saved:u.goQuota,busy:g,open:r,statusNode:y,errorMsg:b,configNode:s(wr,{config:u,draft:o,setDraft:i,t:a,api:n}),onToggleOpen:()=>l(f=>!f),onToggle:f=>m("enabled",f),onRefresh:p,t:a})}const Sr=(e,t)=>{if(typeof e?.keyVar=="string"&&e.keyVar.length>0)return e.keyVar;const a="CLIPROXYAPI_MANAGEMENT_KEY_"+(String(e?.id??"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"GATEWAY");return Object.keys(t??{}).find(o=>o===a||o.startsWith(a+"_"))??a};function Cr(e){const{state:t,api:n,t:a,draft:o,setDraft:i,index:r}=e,l=t.config,u=(o??l).gatewayQuotas?.sources??[],d=u[r]??{},g=(Array.isArray(t.gatewayQuotas)?t.gatewayQuotas:[]).find(A=>A.id===d.id)??{id:d.id,status:"off",accounts:[],unsupportedProviders:[]},b=d.type==="agy-link",p=b?null:Sr(d,t.customVarStatus),[k,h]=D(!1),[v,x,y]=_t(a,()=>n.refreshGatewayQuota(d.id)),f=A=>{o!==null&&i({...o,gatewayQuotas:{...o.gatewayQuotas??l.gatewayQuotas??{},sources:A}})},w=A=>f(u.map((L,K)=>K===r?{...L,...A}:L)),N=(A,L,K)=>s("div",{className:"cm-field"},s("label",null,A),s("input",{className:"cm-input","aria-label":A,value:L??"",onChange:K})),C=(A,L)=>{const K=dt(A?.label||A?.id||a("gatewaySourceUnknown"),A,b?"remaining":re(l,"plan"),a);return s(R,{key:A?.id||L},K.row,A?.resetsAt?s("div",{className:"cm-note"},ut(A,a)):null)},T=(A,L)=>s("div",{key:A.id||L,className:"cm-mm-row wide"},s("span",{className:"cm-bbox-label"},A.label||"package"),s("span",{className:"cm-bbox-pct cm-num"},(A.used??"—")+" / "+(A.limit??"—")),s("span",{className:"cm-bbox-pct cm-num"},(A.remaining??"—")+" remaining")),O=A=>A==null?null:s(R,null,s("div",{className:"cm-mm-row wide"},s("span",{className:"cm-bbox-label"},A.unit||"credits"),s("span",{className:"cm-bbox-pct cm-num"},(A.used??"—")+" / "+(A.limit??"—")),s("span",{className:"cm-bbox-pct cm-num"},(A.remaining??"—")+" remaining")),(A.packages??[]).map(T)),W=(A,L)=>s("div",{key:A.id||L,className:"cm-budget",style:{marginTop:"8px",padding:"10px 12px"}},s("div",{className:"cm-budget-head"},s("strong",null,(Ja[A.provider]??A.provider??a("gatewaySourceUnknown"))+" · "+(A.label||a("gatewaySourceUnknown"))),s("span",{className:"cm-hint"},A.status)),A.plan?s("div",{className:"cm-note"},A.plan):null,A.windows.length>0?s("div",{className:"cm-go-list"},A.windows.map(C)):null,O(A.credits),A.message?s("div",{className:"cm-note"},A.message):null);return s(Ba,{display:d.display,onSidebar:A=>w({display:A}),name:d.label||d.id||a("gatewayQuotaTitle"),enabled:d.enabled===!0,saved:l.gatewayQuotas?.sources?.find(A=>A.id===d.id),busy:v,open:k,errorMsg:x,statusNode:s("div",{className:"cm-note"},a("gatewaySourceStatus")+": "+(g.status??a("gatewaySourceUnknown"))+(g.serverVersion?" · "+g.serverVersion:"")+(g.fetchedAt>0?" · "+a("gatewaySourceFetchedAt",{time:new Date(g.fetchedAt).toLocaleTimeString()}):"")+(g.message?" · "+g.message:"")),configNode:s(R,null,s("div",{className:"cm-grid"},N(a("gatewaySourceLabel"),d.label,A=>w({label:A.target.value})),!b&&N(a("gatewaySourceBaseURL"),d.baseURL,A=>w({baseURL:A.target.value})),s("div",{className:"cm-field"},s("label",null,a("gatewaySourceDisplay")),s("select",{className:"cm-input",value:d.display??"both",onChange:A=>w({display:A.target.value})},...Ra(a))),s("div",{className:"cm-field"},s("label",null,a("gatewaySourceRefreshInterval")),ft({value:d.refreshMinutes??15},A=>w({refreshMinutes:Math.min(1440,Math.max(1,Math.floor(A)))}))),!b&&N(a("gatewaySourceAllowlist"),(d.allowedHosts??[]).join(", "),A=>w({allowedHosts:A.target.value.split(/[\s,;]+/).filter(Boolean)})),!b&&s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:d.allowInsecureHttp===!0,onChange:A=>w({allowInsecureHttp:A.target.checked})}),s("span",null,a("customBalanceHttp"))),!b&&s("label",{className:"cm-check"},s("input",{type:"checkbox",checked:d.antigravityOnlyGemini===!0,onChange:A=>w({antigravityOnlyGemini:A.target.checked})}),s("span",null,a("gatewayOnlyGemini")))),p?s("div",{className:"cm-field"},s("label",null,a("gatewaySourceCredential")),s(na,{target:"customVar:"+p,configured:t.customVarStatus?.[p]?.configured===!0,source:t.customVarStatus?.[p]?.source??"",t:a,api:n,placeholder:p})):null,g.unsupportedProviders.length>0?s("div",{className:"cm-note"},a("gatewaySourceUnsupported")+": "+g.unsupportedProviders.join(", ")):null,g.accounts.length>0?g.accounts.map(W):["ok","partial"].includes(g.status)?s("div",{className:"cm-bal-line"},a("gatewaySourceNoAccounts")):null),onToggle:A=>w({enabled:A}),onRefresh:y,onRemove:()=>f(u.filter((A,L)=>L!==r)),onToggleOpen:()=>h(A=>!A),t:a})}const Le=[{id:"opendesign",labelKey:"codingPlanOpendesign"},{id:"anthropic",labelKey:"codingPlanAnthropic"},{id:"zai",labelKey:"codingPlanZai"},{id:"minimax",labelKey:"codingPlanMinimax"},{id:"kimi",labelKey:"codingPlanKimi"},{id:"openrouter",labelKey:"codingPlanOpenrouter"},{id:"siliconflow",labelKey:"codingPlanSiliconflow"},{id:"commandcode",labelKey:"codingPlanCommandcode"},{id:"clinepass",labelKey:"codingPlanClinepass"},{id:"scnet",labelKey:"codingPlanScnet"},{id:"volcengine",labelKey:"codingPlanVolcengine"},{id:"qwen",labelKey:"codingPlanQwen"},{id:"mimo",labelKey:"codingPlanMimo"},{id:"baidu-coding",labelKey:"codingPlanBaidu"},{id:"workbuddy",labelKey:"wbT"},{id:"factory",labelKey:"codingPlanFactory"}];let Xn;function es(){return Xn??=le.async("./client.plan-settings.js").then(e=>e.mount({useQuotaRefresh:_t,miniMaxWindowsOf:ba,MiniMaxPlanCard:ga,barDirectionOf:re,quotaWindowRow:La,codingPlanWindowLabel:Ye,codingPlanWindowEntries:It,numInput:ft,CredentialField:na,QuotaCard:Ba,resolveLocale:F,formatMoneyUsd:z,formatBalanceMoney:Re,quotaPlacementValue:xa,quotaPlacementPatch:wa,quotaPlacementOptions:Na,displayOptions:Ra,BalanceBar:la,segmentsForCustomBalance:ia,customBalanceUnitOf:lt,customBalanceDetailText:da,formatCustomBalanceMoney:Qe,resolveCustomBalanceLabel:ua})).catch(e=>{throw Xn=null,e})}function Ea(e){return s(ae,{...e,load:es})}function ts(e){const[t,n]=D(!1);return t||e.state.config.queryAccounts?.[e.target]?.accounts?.length?s(Ea,{...e,mode:"credential"}):s(R,null,s(na,e),s("button",{type:"button",className:"cm-btn small",onClick:()=>n(!0)},F(e.state.config)==="en"?"Manage accounts":"管理账号"))}function vr(e){const{state:t,api:n,t:a,draft:o,setDraft:i}=e,r=t.config,l=o??r,c=l.codingPlans??{},u=l.gatewayQuotas?.sources??[],d=o?.customBalances??r.customBalances??[],m=(y,f=!1)=>{o!==null&&i({...o,...f?{hideCustomBalance:!1}:{},customBalances:y,...y.length===0?{customBalance:{...r.customBalance??{},enabled:!1,request:{url:"",headers:{}}}}:{}})},g=Ne({next:0,keys:[]}).current;for(;g.keys.length<d.length;)g.keys.push(g.next++);g.keys.length=d.length;const b=y=>{g.keys.splice(y,1),m(d.filter((f,w)=>w!==y))},p=(y,f,w)=>m(d.map((N,C)=>C===y?{...N,...f}:N),w),k=(y="custom")=>{if(!(d.length>=8)){if(y==="openai-credits"){if(d.some(f=>f.adapter===y))return;m([...d,{adapter:y,enabled:!1,label:"OpenAI API 赠送额度(预估)",labelEn:"OpenAI API credits (estimate)",grantAmount:0,grantStart:"",grantExpiry:"",display:"both",unit:"USD",refreshMinutes:15,dashboardUrl:"https://platform.openai.com/settings/organization/billing/credit-grants",request:{url:"https://api.openai.com/v1/organization/costs",method:"GET",headers:{}},extract:{}}]);return}if(y==="workbuddy2api"){m([...d,{enabled:!1,label:"WorkBuddy2API 积分",labelEn:"WorkBuddy2API credits",display:"both",unit:"CREDITS",refreshMinutes:15,request:{url:"http://127.0.0.1:8790/api/credits/expiry?package_limit=1",method:"GET",headers:{"X-Admin-Token":"{{WORKBUDDY2API_ADMIN_TOKEN}}"}},extract:{remaining:"summary.available_remaining"},allowedHosts:["127.0.0.1:8790"],allowInsecureHttp:!1}]);return}m([...d,{...y!=="custom"?{adapter:y}:{},enabled:!1,label:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"千问 / 阿里云":"",labelEn:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"Qianwen / Alibaba Cloud":"",display:"both",unit:y!=="custom"?"CNY":"USD",refreshMinutes:15,request:{url:y==="tokenrhythm"?"https://tokenrhythm.studio/api/wallet/summary":y==="aliyun"?"https://business.aliyuncs.com/":"",method:y==="aliyun"?"POST":"GET",headers:{}},extract:{},allowedHosts:[]}])}},h=(y="cliproxyapi")=>{if(u.length>=4||o===null)return;const f=y==="agy-link";i({...o,gatewayQuotas:{...o.gatewayQuotas??r.gatewayQuotas??{},sources:[...u,{id:f?"agy-link":"gateway-"+Date.now().toString(36),type:y,label:f?"Antigravity":"CLIProxyAPI",baseURL:f?"":"http://127.0.0.1:8317",enabled:f,display:"both",refreshMinutes:15,includeProviders:f?["antigravity"]:Vt,allowedHosts:[],allowInsecureHttp:!1}]}})},v=[...u.map((y,f)=>({kind:"gateway",key:"gw-"+(y.id??f),index:f,enabled:y.enabled===!0})),{kind:"go",key:"go",enabled:l.goQuota?.enabled!==!1},...Le.map(y=>({kind:"plan",key:"plan-"+y.id,planId:y.id,labelKey:y.labelKey,enabled:c[y.id]?.enabled===!0})),...d.map((y,f)=>({kind:"custom",key:"cb-"+g.keys[f],index:f,enabled:y.enabled===!0}))],x=y=>y.kind==="plan"?s(Ea,{key:y.key,planId:y.planId,labelKey:y.labelKey,targeted:y.planId===e.targetPlan,state:t,api:n,t:a,draft:o,setDraft:i}):y.kind==="go"?s(Nr,{key:y.key,state:t,api:n,t:a,draft:o,setDraft:i}):y.kind==="gateway"?s(Cr,{key:y.key,index:y.index,state:t,api:n,t:a,draft:o,setDraft:i}):s(xr,{key:y.key,state:t,api:n,t:a,entry:d[y.index],index:y.index,canRemove:!0,sidebarHidden:l.hideCustomBalance,onPatch:(f,w)=>p(y.index,f,w),onRemove:()=>b(y.index)});return s("div",null,s("div",{className:"cm-budget-head"},s("p",{className:"cm-note"},a("quotaSectionNote")),s("button",{type:"button",className:"cm-btn small",onClick:e.openDisplay},a("quotaOpenDisplay"))),s("div",{className:"cm-quota-list"},kr(v).map(x)),s("div",{className:"cm-buttons"},s("button",{className:"cm-btn small",onClick:()=>h(),disabled:u.length>=4},a("gatewaySourceAdd")),s("button",{className:"cm-btn small",onClick:()=>h("agy-link"),disabled:u.length>=4||u.some(y=>y.type==="agy-link")},a("agyLinkQuotaAdd")),s("button",{className:"cm-btn small",onClick:()=>k(),disabled:d.length>=8},a("customBalanceAdd")),s("button",{className:"cm-btn small",onClick:()=>k("aliyun"),disabled:d.length>=8},a("aliyunBalanceAdd")),s("button",{className:"cm-btn small",onClick:()=>k("tokenrhythm"),disabled:d.length>=8},a("tokenRhythmBalanceAdd")),s("button",{className:"cm-btn small",onClick:()=>k("openai-credits"),disabled:d.length>=8||d.some(y=>y.adapter==="openai-credits")},a("openAiCreditAdd")),s(Ea,{mode:"add-fireworks",disabled:d.length>=8,onAdd:y=>m([...d,y])}),s("button",{className:"cm-btn small",onClick:()=>k("workbuddy2api"),disabled:d.length>=8},a("workBuddyBalanceAdd")),s("p",{className:"cm-note"},a("workBuddyBalanceNote"))))}const Ar=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],as=e=>(e.input??0)+(e.output??0)+(e.cacheRead??0)+(e.cacheWrite??0);function qt(e){const t=e.useCost?e.useCost(f=>f):void 0,n=e.state??t?.state;if(!n)return null;const a=n.config,o=F(a),i=e.t??Y(o),r=Array.isArray(n.history)?n.history:[];if(r.length===0)return s("div",null,s("h3",{className:"cm-h"},i("usageTitle")),s("p",{className:"cm-empty"},i("usageEmpty")));const l=n.meta?.dayKey??"",c=new Map(r.map(f=>[f.date,f])),u=f=>{const w=N=>String(N).padStart(2,"0");return f.getFullYear()+"-"+w(f.getMonth()+1)+"-"+w(f.getDate())},d=new Date;d.setHours(0,0,0,0);const m=new Date(d);m.setDate(m.getDate()+(6-(d.getDay()+6)%7));const g=26,b=[],p=[];let k=-1;for(let f=g-1;f>=0;f-=1){for(let N=0;N<7;N+=1){const C=new Date(m);C.setDate(C.getDate()-(f*7+(6-N)));const T=c.get(u(C));b.push(T!==void 0?{day:T,tokens:as(T)}:{day:{date:u(C)},tokens:0})}const w=new Date(m);w.setDate(w.getDate()-(f*7+6)),p.push(w.getMonth()!==k?o==="en"?Ar[w.getMonth()]:String(w.getMonth()+1)+"月":""),k=w.getMonth()}const h=Math.max(...b.map(f=>f.tokens),1),v=f=>{const w=f/h;return w<.25?1:w<.5?2:w<.75?3:4},x=f=>{const{day:w,tokens:N}=f,C="cm-ug-cell"+(N>0?" l"+v(N):"")+(w.date===l?" today":""),T=i("usageDay",{date:w.date,tokens:I(N),input:I(w.input??0),cache:I((w.cacheRead??0)+(w.cacheWrite??0)),output:I(w.output??0),calls:w.calls??0,cost:z(_(w,a),a)});return s(V,{key:w.date,label:T,side:"top",delayMs:200},s("div",{className:C}))},y=n.total;return s("div",{className:"cm-ug"},s("h3",{className:"cm-h"},i("usageTitle")),s("div",{className:"cm-ug-total"},i("usageTotal",{tokens:I(as(y)),input:I(y.input??0),cache:I((y.cacheRead??0)+(y.cacheWrite??0)),output:I(y.output??0),calls:y.calls??0})),s("div",{className:"cm-ug-grid",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},b.map(x)),s("div",{className:"cm-ug-months",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},p.map((f,w)=>s("span",{key:"m"+String(w),className:"cm-ug-monthc"},f))))}function ns(e){return e.ready?s(ae,{...e,load:e.api.loadCodex,quiet:e.view==="prompt"}):null}function Mr(e){const t=e.useCost?.(a=>a),n=t?.state;return s(ns,{...e,state:n,view:"prompt",ready:n?.codexCompat?.enabled===!0&&n?.codexCompat?.promptDue,locale:t?.locale})}const Pr=!1;function Or(e){const t=e.useCost?.(n=>n);return s(ae,{state:t?.state,snapshot:t,api:e.api,load:e.api.loadSettingsOverview,helpers:{makeT:Y,Card:mt,BillingAccuracyNote:Gn,displayCostOf:_,quotaWindowRow:La,codingPlanWindowLabel:Ye,formatBalanceMoney:Re,formatCustomBalanceMoney:Qe,CODING_PLAN_ROWS:Le,UsagePanel:qt,TodaySessions:Yn,BudgetBoxContent:jt,useCodexQuota:Et,codingPlanWindowEntries:It}})}function ss(e){const t=e.useCost?e.useCost(P=>P):void 0,n=e.api,a=t?.state??null,[o,i]=D(null),[r,l]=D(null),[c,u]=D(!1),[d,m]=D(!1),[g,b]=D(!1),[p,k]=D(!1),[h,v]=D("models"),[x,y]=D("overview"),f=a?.codexCompat?.installed===!0&&a?.codexCompat?.enabled===!0,w=x==="export"?"statistics":x==="codex"&&!f?"overview":x;J(()=>{f||y(P=>P==="codex"?"overview":P)},[f]);const[N,C]=D(null),[T,O]=D({status:"idle",at:0,error:null}),W=fe.useRef(null),A=fe.useRef(null),L=fe.useRef(null),K=fe.useRef(Promise.resolve()),H=fe.useRef(0),se=fe.useRef(null);J(()=>()=>{se.current?.()},[]),J(()=>{if(a!==null){const P=JSON.stringify(a.config);i($=>{const ue=$!==null&&JSON.stringify($)!==W.current;return ue||(A.current=a.config,L.current=a.config),ue?{...$,activeLocale:a.config.activeLocale}:JSON.parse(P)}),W.current=P}},[a]),J(()=>{o!==null&&L.current===null&&A.current!==null&&(L.current=A.current)},[o]),J(()=>{const P=++H.current;if(o===null||n===void 0)return;const $=JSON.stringify(o);if($===W.current){se.current=null;return}O(pe=>pe.status==="saving"?pe:{...pe,status:"saving"});const ue=()=>{K.current=K.current.catch(()=>{}).then(async()=>{if(P!==H.current)return;const pe={},ge=L.current??A.current;if(ge!==null&&typeof ge=="object")for(const oe of Object.keys(o))oe==="activeLocale"||o[oe]===ge[oe]||JSON.stringify(o[oe])!==JSON.stringify(ge[oe])&&(pe[oe]=o[oe]);if(Object.keys(pe).length===0){W.current=$,O({status:"saved",at:Date.now(),error:null});return}try{await n.updateConfig(pe),W.current=$,ge!==null&&typeof ge=="object"&&(L.current={...ge,...pe}),P===H.current&&O({status:"saved",at:Date.now(),error:null})}catch(oe){P===H.current&&O({status:"error",at:0,error:oe?.message??String(oe)})}})};se.current=ue;const ke=setTimeout(ue,120);return()=>{clearTimeout(ke)}},[o,n]),J(()=>{a!==null&&t?.status==="error"&&t.error&&l({kind:"err",text:M("ledgerReadFailed",{message:t.error})})},[t?.status,t?.error]);const q=F({...o??a?.config,activeLocale:t?.locale}),M=Y(q);if(t===void 0||a===null)return s("div",{className:"cm-section"},s("p",{className:"cm-empty"},t?.status==="loading"?M("readingLedger"):M("ledgerUnavailable")),t?.error&&s("p",{className:"cm-err",role:"alert"},M("ledgerReadFailed",{message:t.error})),s("button",{className:"cm-btn",disabled:t?.status==="loading"||!n?.reload,onClick:n?.reload},M("refresh")));const Q=a.config,gt=async()=>{if(!p){k(!0),l(null);try{const P=await n.fetchPrices();if(l({kind:P.ok?"ok":"err",text:P.message}),P.ok&&P.state&&typeof P.state.config=="object"){const $=JSON.stringify(P.state.config);i(JSON.parse($)),W.current=$}}catch(P){l({kind:"err",text:M("syncFailed",{message:P?.message??String(P)})})}finally{k(!1),u(!1)}}},E=async()=>{if(!p){k(!0);try{await n.resetHistory(),l({kind:"ok",text:M("historyCleared")})}catch(P){l({kind:"err",text:M("clearFailed",{message:P?.message??String(P)})})}finally{k(!1),m(!1)}}},ie=async()=>{if(!p){k(!0),l(null);try{const P=await n.importLegacyHistory();l({kind:"ok",text:P.message})}catch(P){l({kind:"err",text:M("legacyImportFailed",{message:P?.message??String(P)})})}finally{k(!1),b(!1)}}},Ee=(P,$)=>{o!==null&&i({...o,[P]:$})},Ia=[["overview",M("tabOverview")],["statistics",q==="en"?"Cost statistics":"计费统计"],["quotas",M("tabQuotas")],["usage",M("tabUsage")],["pricing",M("tabPricing")],...f?[["codex","Codex"]]:[],["display",M("tabDisplay")]],Ut=P=>va({statistics:n.loadStatistics,pricing:n.loadOpenRouter,codex:n.loadCodex}[P],{state:a}),ja=T.status==="saving"?s("span",{className:"cm-hint"},M("saving")):T.status==="error"?s("span",{className:"cm-msg err"},M("autoSaveFailed",{message:T.error??""})):s("span",{className:"cm-hint"},T.status==="saved"?M("autoSavedAt",{time:new Date(T.at).toLocaleTimeString()}):M("autoSaveHint"));return s("div",{className:"cm-section"},s("div",{className:"cm-tabs-row"},s("div",{className:"cm-tabs",role:"tablist"},Ia.map(([P,$])=>s("button",{key:P,type:"button",role:"tab","aria-selected":String(w===P),className:"cm-tab"+(w===P?" active":""),onMouseEnter:()=>Ut(P),onFocus:()=>Ut(P),onClick:()=>y(P)},$))),ja),s(ae,{state:a,api:n,load:n.loadCommunity,locale:q,quiet:!0}),Da(r),w==="statistics"?s(ae,{state:a,api:n,autoExport:x==="export"}):null,w==="overview"?s(R,{key:"overview"},s("div",{className:"cm-overview-grid"},s("div",{className:"cm-cards",style:{"--cm-overview-count":Q.hideTodayCost===!0?2:3}},Q.hideTodayCost===!0?null:s(mt,{title:M("cardToday"),value:z(_(a.today,Q),Q),sub:M("callsTokens",{calls:a.today.calls,input:I(a.today.input),cache:I(a.today.cacheRead+a.today.cacheWrite),output:I(a.today.output)})}),s(mt,{title:M("cardMonth"),value:z(_(a.month,Q),Q),sub:M("callsTokens",{calls:a.month.calls,input:I(a.month.input),cache:I(a.month.cacheRead+a.month.cacheWrite),output:I(a.month.output)})}),s(mt,{title:M("cardTotal"),value:z(_(a.total,Q),Q),sub:M("cardTotalSub",{calls:a.total.calls})}))),s(ae,{state:a,t:M,api:n,load:n.loadPricing,mode:"external",quiet:!0,helpers:{Card:mt,displayCostOf:_}}),s("p",{className:"cm-note",key:"cards-footnote"},M("cardsFootnote")),s(Gn,{state:a}),s(ae,{state:a,api:n,load:n.loadPricing,mode:"check",quiet:!0,onPrices:()=>{y("pricing"),v("tools")}}),(()=>{const P=ao(a);return P!==null?s("p",{className:"cm-note",key:"tz-hint"},M("timezoneHint",{host:P.hostLabel,browser:P.browserLabel})):null})(),s("label",{className:"cm-cards-toggle",title:M("cardsTogglePlanTotalHint")},s("input",{type:"checkbox",checked:(o??Q).showTotalWithPlan===!0,onChange:P=>{const $=o??Q;$!=null&&i({...$,showTotalWithPlan:P.target.checked})}}),s("span",null,M("cardsTogglePlanTotal"))),s(ae,{state:a,api:n,load:n.loadPricing,mode:"billing",draft:o,setDraft:i,locale:q}),s("div",null,s("button",{className:"cm-btn",onClick:()=>y("export")},q==="en"?"Export cost records":"导出费用记录"),s("h3",{className:"cm-h"},M("todaySessions")),s(Yn,{state:a,t:M})),s(lr,{state:a,draft:o,setDraft:i,t:M}),(Q.balance?.display==="settings"||Q.balance?.display==="both")&&Q.hideOfficialBalance!==!0?s(hr,{state:a,api:n,t:M,draft:o,setDraft:i}):null):null,w==="quotas"?s(vr,{key:"quotas",state:a,api:n,t:M,draft:o,setDraft:i,openDisplay:()=>y("display"),targetPlan:N}):null,w==="usage"?s(R,{key:"usage"},!ht||(Q.usage?.position??"cost")==="cost"?s(qt,{state:a,t:M,locale:q}):null,s(pr,{state:a,config:o??Q,t:M,draft:o,setDraft:i}),s(gr,{state:a,config:o??Q,t:M}),s(or,{state:a,api:n}),s(ir,{state:a,api:n}),s(ae,{state:a,api:n,load:n.loadBillingStorage,draft:o,setDraft:i,locale:q,disabled:T.status==="saving"||(o??Q).billingStorageRetentionDays!==Q.billingStorageRetentionDays}),s("div",null,s("h3",{className:"cm-h"},M("historyDataTitle")),s("div",{className:"cm-buttons"},g?s(R,null,s("span",{className:"cm-hint"},M("confirmImportLegacy")),s("button",{className:"cm-btn",onClick:ie,disabled:p},M("apply")),s("button",{className:"cm-btn",onClick:()=>b(!1)},M("cancel"))):s("button",{className:"cm-btn",onClick:()=>b(!0),disabled:p},M("importLegacy")),d?s(R,null,s("span",{className:"cm-hint"},M("confirmReset")),s("button",{className:"cm-btn danger",onClick:E,disabled:p},M("confirmClear")),s("button",{className:"cm-btn",onClick:()=>m(!1)},M("cancel"))):s("button",{className:"cm-btn danger",onClick:()=>m(!0),disabled:p},M("clearAllHistory"))),s("p",{className:"cm-note"},M("legacyImportNote")))):null,w==="codex"?s(ns,{key:"codex",state:a,api:n,t:M,locale:q,view:"panel",ready:f}):null,w==="display"?s(R,{key:"display"},a?.secretMigration?.pending?.length>0?s(no,{pending:a.secretMigration.pending,t:M}):null,s(ae,{state:{...a,displayPreviewCodex:U.source===(a.config.codexQuotaSource??"auto")?Dt():{status:"idle",windows:{}}},api:n,load:n.loadDisplay,draft:o,setDraft:i,t:M,locale:q,numInput:ft,displayOptions:Ra,quotaPlacementValue:xa,quotaPlacementPatch:wa,quotaPlacementOptions:Na,USAGE_POSITION_SWITCHABLE:ht,formatMoneyUsd:z,planOptions:Le.map(P=>[P.id,M(P.labelKey)]),onNavigate:(P,$)=>{C($),y(P)},renderSidebar:(P,$=a,ue=!0)=>Ft({...$,config:P},!0,void 0,!0,void 0,ue),renderCorner:P=>s(On,{useCost:()=>({state:P})}),renderStyleSample:(P,$=a,ue=!0)=>{if(!ue||P.sidebarStyle==="icons")return Ft({...$,config:P},!0,void 0,!0);const ke=P.sidebarSimple===!0,pe={...P,peakNotice:!1,hideBudget:!1,hideTodayCost:!1,budget:{...P.budget,enabled:!0,amount:Number(P.budget?.amount)>0?P.budget.amount:100}},ge={...$,config:pe},oe=ba($.codingPlans?.minimax?.windows??{});return s("div",{className:"cm-footer-stack"+(ke?" simple":P.sidebarStyle==="compact"?" compact":"")},s(jt,{state:ge,wide:!0,summary:ke}),s(ga,{five:oe.five??{percent:24},seven:oe.seven??{percent:18},fetchedAt:0,t:M,wide:!0,direction:re(P,"plan")}))}})):null,w==="pricing"?s("div",{key:"pricing",className:"cm-pricing-page"},s("div",{className:"cm-pricing-heading"},s("div",null,s("h3",{className:"cm-h"},q==="en"?"Pricing":"价格设置"),s("p",{className:"cm-note"},q==="en"?"New prices apply to future calls. Historical costs keep their original rates.":"价格修改用于后续调用,历史费用沿用原价格。")),s("span",{className:"cm-pricing-unit"},q==="en"?"Per 1M tokens":"每百万 Token")),s("div",{className:"cm-pricing-nav",role:"tablist","aria-label":q==="en"?"Pricing sections":"价格分区"},[["models","模型定价","Model pricing"],["catalog","参考价格表","Price tables"],["tools","同步与规则","Sync & rules"]].map(([P,$,ue])=>s("button",{key:P,id:"cm-pricing-"+P,type:"button",role:"tab","aria-selected":h===P,"aria-controls":"cm-pricing-panel",tabIndex:h===P?0:-1,className:"cm-pricing-nav-item"+(h===P?" active":""),onClick:()=>v(P),onKeyDown:ke=>{const pe=["models","catalog","tools"],ge=ke.key==="ArrowRight"?1:ke.key==="ArrowLeft"?-1:0;if(ge){ke.preventDefault();const oe=pe[(pe.indexOf(P)+ge+3)%3];v(oe),ke.currentTarget.parentElement.querySelector("#cm-pricing-"+oe)?.focus()}}},q==="en"?ue:$))),s("div",{id:"cm-pricing-panel",className:"cm-pricing-content",role:"tabpanel","aria-labelledby":"cm-pricing-"+h},h==="models"?s(ae,{state:a,api:n,load:n.loadPricing,mode:"matching",draft:o,setDraft:i,t:M,locale:q,resolveClientPrice:fn,prettyProviderKey:bt,setField:Ee,priceEditor:{PriceInput:Ma,priceFactor:Nt,setPriceFactor:Qt,multiplierOptions:Oa,priceMultiplierSettings:wt,priceAt:nt}}):null,h==="catalog"?s("div",{className:"cm-pricing-catalog"},s("h3",{className:"cm-h"},M("priceTableTitle")),s(ae,{state:a,api:n,load:n.loadPricing,mode:"catalog",draft:o,setDraft:i,t:M,locale:q,vendorLabels:dr,priceEditor:{PriceInput:Ma,priceAt:nt,priceFactor:Nt},renderEditor:(P,$,ue)=>P==="deepseek"?s(ur,{modelId:$==="__default__"?M("defaultModelId"):$,entry:ue,isDefault:$==="__default__",draft:o,setDraft:i,t:M}):s(yr,{provider:P,modelId:$,entry:ue,draft:o,setDraft:i,t:M,api:n,lockedIds:P==="openrouter"?a.priceLockIds??[]:[],releaseDisabled:JSON.stringify(o)!==W.current})})):null,h==="tools"?s("div",{className:"cm-pricing-tools"},s("section",{className:"cm-pricing-tool"},s(cr,{state:a,draft:o,setDraft:i,t:M,api:n}),s(ae,{state:a,api:n,load:n.loadPricing,mode:"schedule",draft:o,setDraft:i,locale:q})),s("section",{className:"cm-pricing-tool"},s(ae,{state:a,api:n,load:n.loadPricing,mode:"history",locale:q,disabled:p||JSON.stringify(o)!==W.current})),s("section",{className:"cm-pricing-tool"},s("h3",{className:"cm-h"},M("dataSync")),(o??Q).currency==="CNY"&&(o??Q).prices?.currency!=="CNY"?s("div",{className:"cm-note",role:"status"},M("pricingCnyHint",{rate:(o??Q).exchangeRate}),(o??Q).pricingCurrency!=="CNY"?s("button",{className:"cm-btn small",disabled:p,onClick:()=>Ee("pricingCurrency","CNY")},M("pricingCurrencyCny")):null):null,s("div",{className:"cm-field"},s("label",null,M("pricingCurrencyLabel")),s("select",{className:"cm-input",value:o?.pricingCurrency==="CNY"?"CNY":"USD",onChange:P=>Ee("pricingCurrency",P.target.value)},s("option",{value:"USD"},M("pricingCurrencyUsd")),s("option",{value:"CNY"},M("pricingCurrencyCny"))),s("p",{className:"cm-note"},M("pricingCurrencyNote"))),s("div",{className:"cm-buttons"},c?s(R,null,s("span",{className:"cm-hint"},M("confirmFetch")),s("button",{className:"cm-btn",onClick:gt,disabled:p},M("apply")),s("button",{className:"cm-btn",onClick:()=>u(!1)},M("cancel"))):s("button",{className:"cm-btn",onClick:()=>u(!0),disabled:p},M("syncFromDocs"))),s("p",{className:"cm-note"},M("lastSync",{time:Q.fetchedAt!==null?new Date(Q.fetchedAt).toLocaleString():M("neverSynced")})+M("source",{source:Q.priceSource==="official"?M("sourceOfficial"):M("sourceBundled")})),s("p",{className:"cm-note"},M("syncScopeNote"))),s("section",{className:"cm-pricing-tool"},s(ae,{state:a,api:n,load:n.loadOpenRouter}))):null)):null,s(ae,{state:a,api:n,load:n.loadCommunity,locale:q,quiet:!0,footer:!0}))}const Tr=["remote"];async function Rr(e){const t=e.remote;if(t===void 0||typeof t.$mount!="function")return;const n=await t.$mount(Es);e.effect(()=>()=>{n()},"cost-meter: remote contribution");const a=e.get("remote.costMeter");if(a===void 0)return;e.inject(["connection"],S=>S.effect(()=>{const B=S.get("connection")?.rpc;return ha(B,()=>a.getPiAiCodexQuota(),()=>a.getChatgptSubQuota()),Bt(),()=>{U.rpc===B&&(ha(null),Bt())}},"cost-meter: Codex quota transport"));const o=()=>{try{return Xe(e.get("locale")?.getSnapshot?.().active)}catch{return null}};let i,r,l=!1;e.effect(()=>()=>{l=!0,i?.dispose()},"cost-meter: Desktop quota transport");const c=wn({status:"loading",error:null,state:null},S=>{const B=o()||Xe(S.state?.meta?.locale)||Wa();return!i&&!r&&S.state?.gatewayQuotas?.some(j=>j.browserAccessDenied)&&le.async&&(r=le.async("./client.agy-quota.js").then(j=>{if(l)return;const G=()=>c.set(c.getSnapshot());i=j.mount(G),G()}).catch(()=>{}).finally(()=>{r=null})),i&&S.state&&(S={...S,state:i.decorate(S.state,B)}),{...S,locale:B,...S.state?{state:{...S.state,config:{...S.state.config,activeLocale:B}}}:{}}}),u=()=>Y(F(c.getSnapshot().state?.config||{activeLocale:c.getSnapshot().locale})),d=async(S,B)=>{const j=await a[S](...B??[]);if(j===null||typeof j!="object"||j.ok!==!0)throw new Error(j?.error?.message??u()("rpcFailed",{method:S}));return j.value},m=S=>(c.set({status:"ready",error:null,state:S}),S);let g=Date.now(),b=!1,p=!0,k=1,h=0,v=0,x=Promise.resolve();const y=(S,B)=>{if(typeof S?.pricesRev!="string"||S.pricesRev!==B?.pricesRev)return S;const j=B?.config?.prices;return j===void 0?S:{...S,config:{...S.config,prices:j}}},f=async()=>{if(!p||b||v)return;const S=h,B=()=>p&&S===h&&v===0;b=!0,g=Date.now();const j=c.getSnapshot();j.state===null&&c.set({...j,status:"loading"});try{const G=j.state?.pricesRev,Ae=await d(j.state===null?"getLocalState":typeof G=="string"?"getStateSince":"getState",typeof G=="string"?[G]:[]);if(!B())return;if(k=1,c.set({status:"ready",error:null,state:y(Ae,j.state)}),j.state===null){const qe=await d("getState");B()&&c.set({status:"ready",error:null,state:y(qe,Ae)})}}catch(G){if(!B())return;j.state===null&&(g=Date.now()),k=Math.min(k*2,60),c.set({status:"error",error:G?.message??String(G),state:c.getSnapshot().state??j.state})}finally{b=!1}};e.effect(()=>e.on("connection/reset",()=>{f()}),"cost-meter: reconnect reload");const w=setInterval(()=>{const S=c.getSnapshot().state,B=S?.config.sidebarModels,j=S?B?.enabled||B?.dock?B.refreshSeconds:60:k;!document.hidden&&Date.now()-g>=(j||60)*1e3&&f()},1e3);e.effect(()=>()=>{p=!1,clearInterval(w)},"cost-meter: poll timer");const N=()=>{p&&e.fiber?.uid!==null&&c.set(c.getSnapshot())},C=S=>S.effect(()=>{N();const B=S.get("locale")?.subscribe?.(N);return()=>{B?.(),N()}},"cost-meter: DSH locale");typeof e.inject=="function"?e.inject(["locale"],C):o()&&C(e),e.effect(()=>e.on("locale/change",N),"cost-meter: locale change"),window.addEventListener?.("languagechange",N),e.effect(()=>()=>window.removeEventListener?.("languagechange",N),"cost-meter: browser locale");const T=()=>{document.visibilityState==="visible"&&f()};document.addEventListener("visibilitychange",T),e.effect(()=>()=>{document.removeEventListener("visibilitychange",T)},"cost-meter: visibility reload");const O=async(S,B="rpcSyncFailed",j=!1)=>{const G=await S;if(G===null||typeof G!="object"||G.ok!==!0)throw new Error(G?.error?.message??(j?G?.value?.message:void 0)??u()(B));return G.value.state!==void 0&&c.set({status:"ready",error:null,state:G.value.state}),G.value},W={},A=S=>{if(!W[S]){const B=ar(()=>le.async("./client."+S+".js"),u()("pageLoadTimeout")).then(j=>j.mount(e,c,F,{formatMoneyUsd:z,displayCostOf:_,formatTokens:I,updateConfig:G=>L.updateConfig(G)})).catch(j=>{throw W[S]===B&&delete W[S],j});W[S]=B}return W[S]},L={loadBillingStorage:()=>A("billing-storage"),billingStorage:async S=>d("billingStorage",[an.parse(S)]),loadSettingsOverview:()=>A("settings-overview"),loadStatistics:()=>A("statistics"),loadOpenRouter:()=>A("openrouter"),loadCommunity:()=>A("community"),loadPricing:()=>A("pricing"),loadDisplay:()=>Promise.all([A("display"),A("sidebar-order")]).then(([S])=>S),loadCodex:()=>A("codex"),reload:f,updateConfig:async S=>{const{activeLocale:B,...j}=S;h++,v++;const G=x.catch(()=>{}).then(async()=>{const Ae=await d("updateConfig",[j]);return c.set({status:"ready",error:null,state:Ae}),S.planBilling&&setTimeout(()=>{f()},1500),Ae});x=G;try{return await G}finally{v--,h++}},fetchPrices:async()=>O(a.fetchPrices()),releasePriceLock:async S=>{const B=await O(a.releasePriceLock(S),"rpcSyncFailed",!0);if(!B.ok)throw new Error(B.message);return B},resetHistory:async()=>{const S=await d("resetHistory");return c.set({status:"ready",error:null,state:S}),S},applyCodexCompatHistory:async()=>m(await d("applyCodexCompatHistory")),dismissCodexCompat:async()=>m(await d("dismissCodexCompat")),importLegacyHistory:async()=>{const S=await a.importLegacyHistory();if(S===null||typeof S!="object"||S.ok!==!0)throw new Error(S?.error?.message??S?.value?.message??u()("legacyImportFailed",{message:"RPC failed"}));return S.value.state!==void 0&&c.set({status:"ready",error:null,state:S.value.state}),S.value},getDaySessions:async S=>d("getDaySessions",[S]),getSessionCost:async S=>d("getSessionCost",[S]),getTurnCost:async(S,B,j)=>d("getTurnCost",[S,B,j,c.getSnapshot().state?.config?.currency]),getTopSessions:async(S,B,j)=>d("getTopSessions",[S,B,j]),refreshBalance:async()=>O(a.refreshBalance(),"rpcBalanceFailed"),refreshGoQuota:async()=>O(a.refreshGoQuota()),refreshGatewayQuota:async(S=null)=>{r&&await r;const B=i?.refresh(S);if(B)return B;const j=await O(S==null?a.refreshGatewayQuota():a.refreshGatewayQuota(S));return!j.ok&&S?(r&&await r,i?.refresh(S)??j):j},refreshCustomBalance:async(S=null)=>O(S==null?a.refreshCustomBalance():a.refreshCustomBalance(S)),refreshCodingPlan:async S=>O(a.refreshCodingPlan(S)),loginCodingPlan:async S=>O(a.loginCodingPlan(S)),loginOpenDesign:async()=>O(a.loginOpenDesign()),setCredential:async(S,B)=>O(a.setCredential(S,B),"rpcSyncFailed",!0),clearCredential:async S=>O(a.clearCredential(S),"rpcSyncFailed",!0)},K=S=>{S.target?.closest?.('[data-slot="conversation.input.model"]')&&L.loadOpenRouter().catch(()=>{})};for(const S of["pointerover","focusin"])e.effect(()=>(document.addEventListener(S,K),()=>document.removeEventListener(S,K)));f();const H=e.get("slots");if(H===void 0)return;const se=S=>{typeof H.entries=="function"&&H.entries(S).some(B=>B.locale==="dsh-context")&&L.loadStatistics().catch(()=>{})};e.on("slots/changed",se),["conversation.view","sidebar.right.pane.tab","conversation.input.overlay"].forEach(se);const q=()=>({hooks:{cost:c},api:L});H.inject("plugins.bundle.config",()=>H.register({name:"plugins.bundle.config",key:"dsh-cost-meter",inject:q},ss)),H.inject("conversation.session.header.actions",()=>H.register({name:"conversation.session.header.actions",id:"cost-meter-statistics",order:1,inject:q},sr)),H.inject("conversation.chat.turnTail",()=>H.register({name:"conversation.chat.turnTail",id:"cost-meter-turn",order:10,select:S=>S,inject:q},co));const M=()=>({gen:0,dispose:null}),Q=(S,B,j,G,Ae=!0)=>{S.dispose!==null&&(S.dispose(),S.dispose=null),S.gen+=1;const qe=S.gen;Ae&&H.inject(B,()=>{if(S.gen!==qe)return;const Me=typeof j=="function"?j():H.register(j,G);if(S.gen!==qe){Me();return}return S.dispose=Me,()=>{S.dispose===Me&&(S.dispose=null),Me()}})},gt=M(),E=S=>{const B=S==="header"?"conversation.session.header.actions":"conversation.composer.dock";Q(gt,B,{name:B,id:"cost-meter",order:S==="header"?-5:5,inject:()=>({...q(),entryPosition:S})},uo,S!=="off")},ie=M(),Ee=S=>{Q(ie,"sidebar.footer.action",{name:"sidebar.footer.action",id:"cost-meter",order:0,inject:q},Xo,S)},Ia=M(),Ut=S=>{Q(Ia,"conversation.composer.dock",{name:"conversation.composer.dock",id:"cost-meter-corner",order:9,inject:q},On,S)};H.inject("conversation.input.dock",()=>H.register({name:"conversation.input.dock",id:"cost-meter-qstrip",order:100,inject:q},Vo)),H.inject("sidebar.footer.action",()=>H.register({name:"sidebar.footer.action",id:"cost-meter-display-onboarding",order:1,inject:q},Yo)),H.inject("sidebar.footer.action",()=>H.register({name:"sidebar.footer.action",id:"cost-meter-codex-compat",order:1,inject:q},Mr));const ja=M(),P=S=>{Q(ja,"sidebar.footer.action",()=>H.register({name:"sidebar.footer.action",id:"cost-meter-peak-alert",order:0,inject:q},Co),null,S)};window.cmPeakAlertPreview=S=>{if(window.__cmPeakAlertLive!==!0){console.warn("[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。");return}window.dispatchEvent(new CustomEvent(So,{detail:{kind:S==="offpeak"?"offpeak":"peak"}}))};const $=M(),ue=S=>{Q($,"settings.section",{name:"settings.section",id:"cost-meter",order:30,label:S==="en"?Ie.en.sectionLabel:Ie.zh.sectionLabel,inject:q},Pr?Or:ss,!0)},ke=M(),pe=S=>{Q(ke,"settings.general.item",{name:"settings.general.item",id:"cost-meter-usage",order:30,inject:q},qt,S)},ge=M(),oe=(S,B)=>{Q(ge,"settings.section",{name:"settings.section",id:"cost-meter-usage",order:31,label:B==="en"?Ie.en.usageSectionLabel:Ie.zh.usageSectionLabel,inject:q},qt,S)};let os=null,rs=null,is=null,Fa=null,ls=null,cs=null;const us=()=>{const S=c.getSnapshot().state;S?.config?.sessionListCosts&&A("session-list").catch(()=>{});const B=S?.config?.position??"dock",j=S?.config?.sidebar!==!1&&S?.config?.hideTodayCost!==!0,G=S?.config?.balance?.display??"both",Ae=(G==="sidebar"||G==="both")&&S?.config?.hideOfficialBalance!==!0,qe=ms=>ms?.enabled===!0&&["sidebar","both"].includes(ms.display),Me=j||Ae||S?.config?.localSavings?.enabled===!0||S?.config?.codexQuotaEnabled===!0||S?.config?.sidebarModels?.enabled===!0||S?.config?.budget?.enabled===!0&&S?.config?.hideBudget!==!0||S?.config?.goQuota?.enabled===!0&&["sidebar","both"].includes(S.config.goQuota.display)||S?.config?.peakEnabled===!0&&S.config.peakNotice!==!1||Object.values(S?.config?.codingPlans??{}).some(qe)||(S?.config?.gatewayQuotas?.sources??[]).some(qe)||Ot(S,S?.config).length>0;S?.config?.followSkinTransparency&&A("display").catch(()=>{}),Me&&le.async&&A("sidebar-order").catch(()=>{});const Qa=S?.config?.corner?.enabled===!0||S?.config?.sidebarModels?.dock===!0,Ze=F(S?.config||{activeLocale:c.getSnapshot().locale}),yt=S?.config?.usage?.position??"cost";B!==os&&(E(B),os=B),Me!==rs&&(Ee(Me),rs=Me),Qa!==is&&(Ut(Qa),is=Qa);const _a=S?.config?.peakEnabled===!0;_a!==cs&&(P(_a),cs=_a),Ze!==Fa&&(ue(Ze),Fa=Ze),yt!==ls?(ht&&(pe(yt==="general"),oe(yt==="section",Ze)),ls=yt):ht&&yt==="section"&&Ze!==Fa&&oe(!0,Ze)};us();const ds=c.subscribe(us);return e.effect(()=>()=>{ds()},"cost-meter: slot sync"),ds}return Pe.apply=Rr,Pe.inject=Tr,Je.exports}});