PageSourceSearch

https://ns.org.nz/assets/ChannelStatusView-BptT-4GO.js

js ns.org.nz collected 2026-09-25 01:14:55 UTC 77,758 bytes, 2 lines download raw bytes

1import{f as et,_ as ce,aQ as St,a as Be,g as Rt,k as Tt,D as ze,u as Lt,aR as Dt,aS as Et,ar as It}from"./index-D4B9XJED.js";import{b as ye}from"./apiError-BcAuv_LF.js";import{_ as tt}from"./AppLayout.vue_vue_type_script_setup_true_lang-964gbyG2.js";import{d as J,r as I,o as Fe,O as Ve,z as i,B as e,E as C,u as r,A as S,G as n,F as H,V as Z,C as o,c as k,D as X,H as Q,k as F,S as de,a0 as Nt,w as ne,K as Me,q as at,P as nt,_ as Pt,U as Xe,n as Ye,X as Bt,Z as zt}from"./vendor-vue-Dzwqm9Y9.js";import{u as re}from"./vendor-i18n-BuoWFzps.js";import{_ as Ae}from"./EmptyState.vue_vue_type_script_setup_true_lang-BZop-dpC.js";import{y as Ft,u as je,z as At,_ as jt,v as Ot,S as Wt,j as Qe,B as qt,E as Ut,F as Ht,G as Gt,H as Zt,I as Kt}from"./channelMonitorV2-mAMxr0Tg.js";import{L as Je}from"./LoadingSpinner-Jr1bbwDT.js";import{S as Xt}from"./Select-BjYX9AhD.js";import{C as Yt,b as Qt,L as Jt,P as ea,c as ta,e as aa,p as na,a as ra,i as la,d as oa}from"./vendor-chart-BNlN3Otn.js";import"./vendor-misc-B-nM3tYW.js";import"./AppHeader.vue_vue_type_style_index_0_scoped_59fb3e77_lang-C9_N2XZy.js";import"./useClipboard-Cj86XNkg.js";import"./LocaleSwitcher-BANwbqFd.js";/* empty css                                                                       */import"./UsageProgressBar.vue_vue_type_script_setup_true_lang-o9MFxojm.js";import"./vendor-ui-KYGBtk6l.js";async function sa(t){const{data:a}=await et.get("/channel-monitors",{signal:t==null?void 0:t.signal});return a}async function rt(t){const{data:a}=await et.get(`/channel-monitors/${t}/status`);return a}const ia=["title"],ca={key:0,class:"absolute right-0 z-20 mt-1 w-44 rounded-lg border border-gray-200 bg-white shadow-lg dark:border-dark-600 dark:bg-dark-800"},ua={class:"p-1.5"},da={key:0,class:"h-4 w-4 text-primary-500",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},ma=["onClick"],ha={key:0,class:"h-4 w-4 text-primary-500",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},pa=J({__name:"AutoRefreshButton",props:{enabled:{type:Boolean},intervalSeconds:{},countdown:{},intervals:{}},emits:["update:enabled","update:interval"],setup(t){const{t:a}=re(),c=I(!1),m=I(null);function d(l){m.value&&!m.value.contains(l.target)&&(c.value=!1)}return Fe(()=>document.addEventListener("click",d)),Ve(()=>document.removeEventListener("click",d)),(l,b)=>(o(),i("div",{class:"relative",ref_key:"dropdownRef",ref:m},[e("button",{onClick:b[0]||(b[0]=x=>c.value=!c.value),class:"inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white px-2.5 py-1.5 text-xs font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50 dark:border-dark-600 dark:bg-dark-800 dark:text-gray-300 dark:hover:bg-dark-700",title:r(a)("common.autoRefresh.title")},[(o(),i("svg",{class:S(["h-3.5 w-3.5",t.enabled?"animate-spin":""]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[...b[2]||(b[2]=[e("path",{"fill-rule":"evenodd",d:"M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.312a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.848a5.5 5.5 0 019.201-2.466l.312.311H11.768a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.537a.75.75 0 00-1.5 0v2.034l-.312-.312A7 7 0 002.628 8.397a.75.75 0 001.449.39z","clip-rule":"evenodd"},null,-1)])],2)),e("span",null,n(t.enabled?r(a)("common.autoRefresh.countdown",{seconds:t.countdown}):r(a)("common.autoRefresh.title")),1)],8,ia),c.value?(o(),i("div",ca,[e("div",ua,[e("button",{onClick:b[1]||(b[1]=x=>l.$emit("update:enabled",!t.enabled)),class:"flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-dark-700"},[e("span",null,n(r(a)("common.autoRefresh.enable")),1),t.enabled?(o(),i("svg",da,[...b[3]||(b[3]=[e("path",{"fill-rule":"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z","clip-rule":"evenodd"},null,-1)])])):C("",!0)]),b[5]||(b[5]=e("div",{class:"my-1 border-t border-gray-100 dark:border-dark-700"},null,-1)),(o(!0),i(H,null,Z(t.intervals,x=>(o(),i("button",{key:x,onClick:_=>l.$emit("update:interval",x),class:"flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-dark-700"},[e("span",null,n(r(a)("common.autoRefresh.seconds",{n:x})),1),t.intervalSeconds===x?(o(),i("svg",ha,[...b[4]||(b[4]=[e("path",{"fill-rule":"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z","clip-rule":"evenodd"},null,-1)])])):C("",!0)],8,ma))),128))])])):C("",!0)],512))}}),fa={class:"py-3 md:py-4"},ga={class:"flex items-center justify-end gap-3 flex-wrap"},va={role:"tablist",class:"inline-flex p-0.5 rounded-xl bg-gray-100 dark:bg-dark-800 border border-gray-200/60 dark:border-dark-700/60 text-xs"},ba=["aria-selected","onClick"],xa=["disabled","title"],ya=J({__name:"MonitorHero",props:{overallStatus:{},intervalSeconds:{},window:{},loading:{type:Boolean},autoRefresh:{}},emits:["update:window","refresh"],setup(t,{emit:a}){const c=t,m=a,{t:d}=re(),l=k(()=>[{value:"7d",label:d("channelStatus.windowTab.7d")},{value:"15d",label:d("channelStatus.windowTab.15d")},{value:"30d",label:d("channelStatus.windowTab.30d")}]),b=k(()=>d(`channelStatus.overall.${c.overallStatus}`)),x=k(()=>{switch(c.overallStatus){case"operational":return"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300";
1case"degraded":default:return"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300"}}),_=k(()=>{switch(c.overallStatus){case"operational":return"bg-emerald-500 animate-pulse";case"degraded":default:return"bg-amber-500 animate-pulse"}});return(p,$)=>(o(),i("section",fa,[e("div",ga,[e("div",va,[(o(!0),i(H,null,Z(l.value,D=>(o(),i("button",{key:D.value,type:"button",role:"tab","aria-selected":t.window===D.value,class:S(["px-3 py-1 rounded-lg transition-colors",t.window===D.value?"bg-white dark:bg-dark-700 shadow-sm text-gray-900 dark:text-white font-semibold":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"]),onClick:N=>m("update:window",D.value)},n(D.label),11,ba))),128))]),e("span",{class:S(["inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold tracking-wider uppercase",x.value])},[e("span",{class:S(["w-1.5 h-1.5 rounded-full mr-1.5",_.value])},null,2),Q(" "+n(b.value),1)],2),e("button",{type:"button",class:"h-8 w-8 rounded-lg flex items-center justify-center text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-dark-700 transition-colors disabled:opacity-50",disabled:t.loading,title:r(d)("common.refresh"),onClick:$[0]||($[0]=D=>m("refresh"))},[F(ce,{name:"refresh",size:"md",class:S(t.loading?"animate-spin":"")},null,8,["class"])],8,xa),t.autoRefresh?(o(),X(pa,{key:0,enabled:t.autoRefresh.enabled.value,"interval-seconds":t.autoRefresh.intervalSeconds.value,countdown:t.autoRefresh.countdown.value,intervals:t.autoRefresh.intervals,"onUpdate:enabled":t.autoRefresh.setEnabled,"onUpdate:interval":t.autoRefresh.setInterval},null,8,["enabled","interval-seconds","countdown","intervals","onUpdate:enabled","onUpdate:interval"])):C("",!0)])]))}}),ka={class:"mt-5 grid grid-cols-2 gap-2"},_a={class:"rounded-xl p-3 bg-gray-50/80 dark:bg-dark-900/40 border border-gray-100 dark:border-dark-700/50"},wa={class:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wider text-gray-400"},Ma={class:"mt-1.5 text-lg font-bold font-mono tabular-nums text-gray-900 dark:text-gray-100"},$a={class:"text-xs font-normal text-gray-400 ml-0.5"},Va={class:"rounded-xl p-3 bg-gray-50/80 dark:bg-dark-900/40 border border-gray-100 dark:border-dark-700/50"},Ca={class:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wider text-gray-400"},Sa={class:"mt-1.5 text-lg font-bold font-mono tabular-nums text-gray-900 dark:text-gray-100"},Ra={class:"text-xs font-normal text-gray-400 ml-0.5"},Ta=J({__name:"MonitorMetricPair",props:{primaryLabel:{},primaryValue:{},primaryUnit:{},primaryIcon:{},secondaryLabel:{},secondaryValue:{},secondaryUnit:{},secondaryIcon:{}},setup(t){return(a,c)=>(o(),i("div",ka,[e("div",_a,[e("div",wa,[F(ce,{name:t.primaryIcon,size:"xs"},null,8,["name"]),e("span",null,n(t.primaryLabel),1)]),e("div",Ma,[Q(n(t.primaryValue),1),e("span",$a,n(t.primaryUnit),1)])]),e("div",Va,[e("div",Ca,[F(ce,{name:t.secondaryIcon,size:"xs"},null,8,["name"]),e("span",null,n(t.secondaryLabel),1)]),e("div",Sa,[Q(n(t.secondaryValue),1),e("span",Ra,n(t.secondaryUnit),1)])])]))}}),La={class:"mt-3 flex items-end justify-between"},Da={class:"text-[11px] uppercase tracking-widest text-gray-400"},Ea={class:"flex items-baseline gap-0.5"},Ia={key:0,class:"mt-1 text-[11px] text-gray-400 text-right"},Na=J({__name:"MonitorAvailabilityRow",props:{windowLabel:{},value:{},samplesLabel:{}},setup(t){const a=t,{t:c}=re(),m=k(()=>a.value===null||Number.isNaN(a.value)?c("monitorCommon.latencyEmpty"):a.value.toFixed(2)),d=k(()=>{const l=Ft(a.value);return l?{color:l}:{color:"rgb(156 163 175)"}});return(l,b)=>(o(),i(H,null,[e("div",La,[e("div",Da,n(t.windowLabel),1),e("div",Ea,[e("span",{class:"text-3xl font-bold tabular-nums leading-none",style:de(d.value)},n(m.value),5),e("span",{class:"text-base font-semibold leading-none",style:de(d.value)},"%",4)])]),t.samplesLabel?(o(),i("div",Ia,n(t.samplesLabel),1)):C("",!0)],64))}}),Pa={class:"mt-4 pt-3 border-t border-gray-100 dark:border-dark-700/60"},Ba={class:"flex justify-between text-[10px] font-semibold uppercase tracking-widest text-gray-400 mb-2"},za={class:"tabular-nums"},Fa={key:0,class:"flex h-5 w-full items-center justify-center rounded border border-dashed border-gray-300 dark:border-dark-600 text-[10px] uppercase tracking-widest text-gray-400"},Aa={key:1,class:"flex items-end gap-[2px] h-5 w-full"},ja=["title"],Oa={class:"mt-1 flex justify-between text-[9px] uppercase tracking-widest text-gray-400"},Wa=J({__name:"MonitorTimeline",props:{buckets:{default:()=>[]},countdownSeconds:{},length:{default:60},maintenance:{type:Boolean,default:!1}},setup(t){const a=t,{t:c}
1=re(),{statusLabel:m,formatLatency:d,formatRelativeTime:l}=je(),b={operational:100,degraded:65,failed:35,error:35,empty:15},x={operational:"bg-emerald-500",degraded:"bg-amber-500",failed:"bg-red-500",error:"bg-red-500",empty:"bg-gray-300 dark:bg-dark-600"},_=k(()=>{const p=[...a.buckets??[]].slice(0,a.length).reverse(),$=Math.max(0,a.length-p.length),D=[];for(let N=0;N<$;N+=1)D.push({colorClass:x.empty,heightPct:b.empty,title:""});for(const N of p){const j=N.status,z=x[j]??x.empty,g=b[j]??b.empty,M=d(N.latency_ms),T=l(N.checked_at),A=m(N.status);D.push({colorClass:z,heightPct:g,title:`${T} · ${A} · ${M}ms`})}return D});return(p,$)=>(o(),i("div",Pa,[e("div",Ba,[e("span",null,n(r(c)("monitorCommon.history60pts",{n:t.length})),1),e("span",za,n(r(c)("monitorCommon.nextUpdateIn",{n:t.countdownSeconds})),1)]),t.maintenance?(o(),i("div",Fa,n(r(c)("monitorCommon.maintenancePaused")),1)):(o(),i("div",Aa,[(o(!0),i(H,null,Z(_.value,(D,N)=>(o(),i("div",{key:N,class:S(["flex-1 min-w-0 rounded-sm",D.colorClass]),style:de({height:D.heightPct+"%"}),title:D.title},null,14,ja))),128))])),e("div",Oa,[e("span",null,n(r(c)("monitorCommon.past")),1),e("span",null,n(r(c)("monitorCommon.now")),1)])]))}}),qa={class:"flex items-start gap-3"},Ua={class:"flex-1 min-w-0"},Ha={class:"text-base font-semibold truncate text-gray-900 dark:text-gray-100"},Ga={class:"mt-0.5 flex items-center gap-1.5 min-w-0"},Za={class:"font-mono text-xs truncate text-gray-500 dark:text-gray-400"},Ka={key:0,class:"inline-flex items-center rounded-md px-1.5 py-0.5 text-[10px] font-medium bg-gray-100 text-gray-600 dark:bg-dark-700 dark:text-gray-300 flex-shrink-0"},Xa=J({__name:"MonitorCard",props:{item:{},window:{},availabilityValue:{},countdownSeconds:{}},emits:["click"],setup(t,{emit:a}){const c={openai:"text-emerald-600 dark:text-emerald-300",anthropic:"text-orange-600 dark:text-orange-300",gemini:"text-sky-600 dark:text-sky-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-purple-600 dark:text-purple-300",kimi:"text-pink-600 dark:text-pink-300",zhipu:"text-indigo-600 dark:text-indigo-300",deepseek:"text-teal-600 dark:text-teal-300",opencode_go:"text-amber-700 dark:text-amber-300"},m=t,d=a,{t:l}=re(),{statusLabel:b,statusBadgeClass:x,providerLabel:_,providerBadgeClass:p,formatLatency:$,formatMonitorModel:D}=je(),N=k(()=>c[m.item.provider]??"text-gray-500 dark:text-gray-300"),j=k(()=>St()&&!!m.item.latest_quota),z=k(()=>{const M=l(`channelStatus.windowTab.${m.window}`);return`${l("monitorCommon.availabilityPrefix")} · ${M}`}),g=k(()=>{var T;const M=((T=m.item.extra_models)==null?void 0:T.length)??0;if(M!==0)return l("monitorCommon.extraModelsCount",{n:M})});return(M,T)=>(o(),i("button",{type:"button",class:"group text-left p-5 rounded-2xl min-h-[280px] w-full bg-white/70 backdrop-blur-xl border border-gray-200/80 shadow-card dark:bg-dark-800/60 dark:border-dark-700/70 hover:-translate-y-1 hover:shadow-card-hover dark:hover:border-primary-500/30 hover:border-gray-300 transition-all duration-300 ease-out flex flex-col",onClick:T[0]||(T[0]=A=>d("click"))},[e("div",qa,[e("span",{class:S(["w-9 h-9 rounded-xl ring-1 ring-black/5 dark:ring-white/10 grid place-items-center flex-shrink-0",[r(At)(t.item.provider),N.value]])},[F(jt,{provider:t.item.provider,size:20},null,8,["provider"])],2),e("div",Ua,[e("div",Ha,n(t.item.name),1),e("div",Ga,[e("span",{class:S(["inline-flex items-center rounded-md px-1.5 py-0.5 text-[10px] font-medium flex-shrink-0",r(p)(t.item.provider)])},n(r(_)(t.item.provider)),3),e("span",Za,n(r(D)(t.item.primary_model)),1),t.item.group_name?(o(),i("span",Ka,n(t.item.group_name),1)):C("",!0)])]),e("span",{class:S(["px-2.5 py-1 rounded-full text-xs font-semibold flex-shrink-0",r(x)(t.item.primary_status)])},n(r(b)(t.item.primary_status)),3)]),F(Ta,{"primary-icon":"bolt","primary-label":r(l)("monitorCommon.dialogLatency"),"primary-value":r($)(t.item.primary_latency_ms),"primary-unit":"ms","secondary-icon":"globe","secondary-label":r(l)("monitorCommon.endpointPing"),"secondary-value":r($)(t.item.primary_ping_latency_ms),"secondary-unit":"ms"},null,8,["primary-label","primary-value","secondary-label","secondary-value"]),j.value?(o(),X(Ot,{key:0,snapshot:t.item.latest_quota,class:"mt-2"},null,8,["snapshot"])):C("",!0),T[1]||(T[1]=e("div",{class:"mt-4 border-t border-gray-100 dark:border-dark-700/60"},null,-1)),F(Na,{"window-label":z.value,value:t.availabilityValue,"
1samples-label":g.value},null,8,["window-label","value","samples-label"]),F(Wa,{buckets:t.item.timeline,"countdown-seconds":t.countdownSeconds},null,8,["buckets","countdown-seconds"])]))}}),Ya={key:0,class:"grid gap-5 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4"},Qa={key:2,class:"grid gap-5 grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4"},Ja=J({__name:"MonitorCardGrid",props:{items:{},window:{},countdownSeconds:{},loading:{type:Boolean},detailCache:{}},emits:["cardClick"],setup(t,{emit:a}){const c=t,m=a,{t:d}=re();function l(b){if(c.window==="7d")return b.availability_7d??null;const x=c.detailCache[b.id];if(!x)return null;const _=x.models.find(p=>p.model===b.primary_model);return _?c.window==="15d"?_.availability_15d??null:_.availability_30d??null:null}return(b,x)=>(o(),i("div",null,[t.loading&&t.items.length===0?(o(),i("div",Ya,[(o(),i(H,null,Z(6,_=>e("div",{key:_,class:"p-5 rounded-2xl min-h-[280px] bg-white/70 dark:bg-dark-800/60 border border-gray-200/80 dark:border-dark-700/70 animate-pulse"},[...x[0]||(x[0]=[Nt('<div class="flex items-start gap-3"><div class="w-9 h-9 rounded-xl bg-gray-200 dark:bg-dark-700"></div><div class="flex-1 space-y-2"><div class="h-4 w-2/3 rounded bg-gray-200 dark:bg-dark-700"></div><div class="h-3 w-1/2 rounded bg-gray-200 dark:bg-dark-700"></div></div><div class="h-6 w-16 rounded-full bg-gray-200 dark:bg-dark-700"></div></div><div class="mt-5 grid grid-cols-2 gap-2"><div class="h-16 rounded-xl bg-gray-100 dark:bg-dark-900/40"></div><div class="h-16 rounded-xl bg-gray-100 dark:bg-dark-900/40"></div></div><div class="mt-6 h-5 w-full rounded bg-gray-100 dark:bg-dark-900/40"></div>',3)])])),64))])):t.items.length===0?(o(),X(Ae,{key:1,title:r(d)("channelStatus.empty.title"),description:r(d)("channelStatus.empty.description")},null,8,["title","description"])):(o(),i("div",Qa,[(o(!0),i(H,null,Z(t.items,_=>(o(),X(Xa,{key:_.id,item:_,window:t.window,"availability-value":l(_),"countdown-seconds":t.countdownSeconds,onClick:p=>m("cardClick",_)},null,8,["item","window","availability-value","countdown-seconds","onClick"]))),128))]))]))}}),en={key:0,class:"py-8 text-center text-sm text-gray-500"},tn={key:1,class:"py-8 text-center text-sm text-gray-500"},an={key:2,class:"overflow-x-auto"},nn={class:"w-full text-left text-sm"},rn={class:"border-b border-gray-200 dark:border-dark-700"},ln={class:"text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400"},on={class:"py-2 pr-3"},sn={class:"py-2 pr-3"},cn={class:"py-2 pr-3"},un={class:"py-2 pr-3"},dn={class:"py-2 pr-3"},mn={class:"py-2 pr-3"},hn={class:"py-2 pr-3"},pn={class:"py-2 pr-3 font-medium text-gray-900 dark:text-gray-100"},fn={class:"py-2 pr-3"},gn={class:"py-2 pr-3 text-gray-700 dark:text-gray-300"},vn={class:"py-2 pr-3 text-gray-700 dark:text-gray-300"},bn={class:"py-2 pr-3 text-gray-700 dark:text-gray-300"},xn={class:"py-2 pr-3 text-gray-700 dark:text-gray-300"},yn={class:"py-2 pr-3 text-gray-700 dark:text-gray-300"},kn={class:"flex justify-end"},_n=J({__name:"MonitorDetailDialog",props:{show:{type:Boolean},monitorId:{},title:{}},emits:["close"],setup(t){const a=t,{t:c}=re(),m=Be(),{statusLabel:d,statusBadgeClass:l,formatLatency:b,formatPercent:x,formatMonitorModel:_}=je(),p=I(null),$=I(!1);async function D(N){p.value=null,$.value=!0;try{p.value=await rt(N)}catch(j){m.showError(ye(j,c("channelStatus.detailLoadError")))}finally{$.value=!1}}return ne(()=>[a.show,a.monitorId],([N,j])=>{if(!N){p.value=null;return}j!=null&&D(j)},{immediate:!0}),(N,j)=>(o(),X(Rt,{show:t.show,title:t.title,width:"wide",onClose:j[1]||(j[1]=z=>N.$emit("close"))},{footer:Me(()=>[e("div",kn,[e("button",{onClick:j[0]||(j[0]=z=>N.$emit("close")),class:"btn btn-secondary"},n(r(c)("channelStatus.closeDetail")),1)])]),default:Me(()=>[$.value?(o(),i("div",en,n(r(c)("common.loading")),1)):p.value?(o(),i("div",an,[e("table",nn,[e("thead",rn,[e("tr",ln,[e("th",on,n(r(c)("channelStatus.detailColumns.model")),1),e("th",sn,n(r(c)("channelStatus.detailColumns.latestStatus")),1),e("th",cn,n(r(c)("channelStatus.detailColumns.latestLatency")),1),e("th",un,n(r(c)("channelStatus.detailColumns.availability7d")),1),e("th",dn,n(r(c)("channelStatus.detailColumns.availability15d")),1),e("th",mn,n(r(c)("channelStatus.detailColumns.availability30d")),1),e("th",hn,n(r(c)("channelStatus.detailColumns.avgLatency7d")),1)])]),e("tbody",null,[(o(!0),i(H,null,Z(p.value.models,z=>(o(),i("tr",{key:z.model,class:"border-b border-gray-100 dark:border-dark-800"},[e("td",pn,n(r(_)(z.model)),1),e("td",fn,[e("span",{class:S(["inline-flex items-center rounded-full px-2 py-0.5 text-[11px]",r(l)(z.latest_status)])},n(r(d)(z.latest_status)),3)]),e("td",gn,n(r(b)(z.latest_latency_ms)),1),e("td",vn,n(r(x)(z.availability_7d)),1),e("td",bn,n(r(x)(z.availability_15d)),1),e("td",xn,n(r
1(x)(z.availability_30d)),1),e("td",yn,n(r(b)(z.avg_latency_7d_ms)),1)]))),128))])])])):(o(),i("div",tn,n(r(c)("channelStatus.detailLoadError")),1))]),_:1},8,["show","title"]))}});function wn(t){const{storageKey:a,intervals:c=[5,10,15,30],defaultInterval:m,onRefresh:d,shouldPause:l}=t,b=I(!1),x=I(m??c[c.length-1]),_=I(0),p=I(!1);let $;function D(){try{const B=localStorage.getItem(a);if(!B)return;const P=JSON.parse(B);b.value=P.enabled===!0;const h=Number(P.interval_seconds);c.includes(h)&&(x.value=h)}catch{}}function N(){try{localStorage.setItem(a,JSON.stringify({enabled:b.value,interval_seconds:x.value}))}catch{}}async function j(){if(b.value&&!(l!=null&&l())&&!p.value){if(_.value<=1){_.value=x.value,p.value=!0;try{await d()}finally{p.value=!1}return}_.value-=1}}function z(){$===void 0&&($=setInterval(j,1e3))}function g(){$!==void 0&&(clearInterval($),$=void 0)}function M(B){b.value=B,N(),B?(_.value=x.value,z()):(g(),_.value=0)}function T(B){x.value=B,N(),b.value&&(_.value=B)}function A(){_.value=x.value}return D(),Ve(g),{enabled:b,intervalSeconds:x,countdown:_,fetching:p,intervals:c,setEnabled:M,setInterval:T,resetCountdown:A,start:z,stop:g}}const Mn=J({__name:"ChannelStatusV1View",setup(t){const{t:a}=re(),c=Be(),m=I([]),d=I(!1),l=I("7d"),b=at({}),x=I(!1),_=I(null);let p=null;const $=wn({storageKey:"channel-status-auto-refresh",intervals:[30,60,120],defaultInterval:Qe,onRefresh:()=>z(!0),shouldPause:()=>document.hidden||d.value}),D=$.countdown,N=k(()=>{if(m.value.length===0)return"operational";for(const h of m.value)if(h.primary_status==="failed"||h.primary_status==="error"||h.primary_status!==Wt)return"degraded";return"operational"}),j=k(()=>{var h;return((h=_.value)==null?void 0:h.name)||a("channelStatus.detailTitle")});async function z(h=!1){p&&p.abort();const W=new AbortController;p=W,h||(d.value=!0);try{const R=await sa({signal:W.signal});if(W.signal.aborted||p!==W)return;m.value=R.items||[]}catch(R){const L=R;if((L==null?void 0:L.name)==="AbortError"||(L==null?void 0:L.code)==="ERR_CANCELED")return;c.showError(ye(R,a("channelStatus.loadError")))}finally{p===W&&(h||(d.value=!1),$.resetCountdown(),p=null)}}async function g(){await z(!1),l.value!=="7d"&&await Promise.all(m.value.map(h=>M(h.id,!0)))}async function M(h,W=!1){if(!(!W&&b[h]))try{b[h]=await rt(h)}catch(R){c.showError(ye(R,a("channelStatus.detailLoadError")))}}async function T(){l.value!=="7d"&&await Promise.all(m.value.map(h=>M(h.id)))}async function A(h){l.value=h,await T()}function B(h){_.value=h,x.value=!0}function P(){x.value=!1,_.value=null}return ne(m,()=>{T()}),ne(()=>{var h;return(h=c.cachedPublicSettings)==null?void 0:h.channel_monitor_enabled},h=>{h===!1?$.stop():$.enabled.value&&$.start()}),Fe(()=>{var h;z(!1),((h=c.cachedPublicSettings)==null?void 0:h.channel_monitor_enabled)!==!1&&$.setEnabled(!0)}),Ve(()=>{p&&p.abort()}),(h,W)=>(o(),X(tt,null,{default:Me(()=>{var R;return[F(ya,{"overall-status":N.value,"interval-seconds":r(Qe),window:l.value,loading:d.value,"auto-refresh":r($),"onUpdate:window":A,onRefresh:g},null,8,["overall-status","interval-seconds","window","loading","auto-refresh"]),F(Ja,{items:m.value,window:l.value,"countdown-seconds":r(D),loading:d.value,"detail-cache":b,onCardClick:B},null,8,["items","window","countdown-seconds","loading","detail-cache"]),F(_n,{show:x.value,"monitor-id":((R=_.value)==null?void 0:R.id)??null,title:j.value,onClose:P},null,8,["show","monitor-id","title"])]}),_:1}))}});function Oe(){var t;if(typeof document<"u"){const a=(t=document.documentElement.getAttribute("lang"))==null?void 0:t.trim();if(a)return a}return typeof navigator<"u"&&navigator.language?navigator.language:"zh-CN"}function We(t){if(t==null||Number.isNaN(Number(t)))return"0";const a=Number(t);return Math.abs(a)<1e3?Intl.NumberFormat(Oe(),{maximumFractionDigits:1}).format(a):Tt(a)}function qe(t){return t==null||Number.isNaN(Number(t))?0:Number(t)/60}function lt(t){return We(qe(t))}function Re(t,a=Oe()){return`${new Intl.NumberFormat(a,{minimumFractionDigits:t<.01?2:1,maximumFractionDigits:t<.01?2:1}).format((t||0)*100)}%`}function ie(t){return t==null?"-":t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function $n(t){return Re(1-(t||0))}function Vn(t){if(t==null||Number.isNaN(t))return"unknown";const a=Math.max(0,Math.min(100,t)),c=Math.round(a/10);return`score${Math.max(0,Math.min(10,c))}`}function ot(t,a){return a==="success"?t.error_rate_score??null:a==="ttft"?t.ttft_score??null:a==="cache"?t.cache_score??null:t.score??null}function st(t,a,c){const m=ot(t,a);if(a==="ttft"&&m==null)return"health-unknown";if(m==null){if(c<=0)return"health-unknown";const d=a==="success"?t.error_rate:a==="cache"?t.cache:t.overall;return Rn(d)}return`health-${Vn(m)}`}function Cn(t){return t==null?!0:t.p50_ms==null}function Sn(t,a){return Cn(a)?"unknown":t}function Rn(t){return`health-${t||"unknown"}`}function it(t,a,c,m){const d=[];return c!=null&&d.push(`AVG ${ie(c)}`),t!=null&&d.push(`P50 ${ie(t)}`),a!=null&&d.push(`P90 ${ie(a)}`),a==null&&m!=null&&d.push(`P95 ${ie(m)}`),d.length?d.join(" · "):"-"}function Tn(t,a,c){const m=[];return t!=null&&Number.isFinite(t)&&m.push(`AVG ${ie(t)}`),a!=null&&Number.isFinite(a)?m.push(`P90 ${ie(a)}`):c!=null&&Number.isFinite(c)&&m.push(`P95 ${ie(c)}`),m.length?m.join(" · "):"-"}const Ln=["aria-expanded","aria-label"],Dn=["aria-selected","onClick"],En={class:"flex min-w-0 flex-1 items-center gap-2"},In={class:"min-w-0 flex-1 truncate"},Nn={key:0,class:"text-xs text-gray-400"},Pn={key:0,class:"px-4 py-3 text-center text-xs text-gray-400"},Bn=J({__name:"FilterMultiSelect",props:{label:{},allLabel:{},modelValue:{},options:{},compact:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:a}){const c=t,m=a,{t:d,locale:l}=re(),b=I(null),x=I(null),_=I(null),p=I(!1),$=`filter-select-${Math.random().toString(36).slice(2,9)}`,D=k(()=>{var R;return c.modelValue.length===0?c.allLabel:c.modelValue.length===1?((R=c.options.find(L=>L.value===c.modelValue[0]))==null?void 0:R.label)||c.modelValue[0]:d("channelMonitorV2.filters.selectedCount",{count:c.modelValue.length})}),N=k(()=>{const R=x.value;if(!R)return{};const L=R.getBoundingClientRect(),O=8,q=Math.max(O,window.innerWidth-O),ae=Math.min(Math.max(O,L.left),q),Y=Math.max(0,q-ae),oe=Math.max(200,L.width),K=Math.min(oe,Y);return{position:"fixed",left:`${ae}px`,top:`${L.bottom+4}px`,minWidth:`${K}px`,maxWidth:`${Y}px`,zIndex:"100000020"}});function j(){m("update:modelValue",[])}function z(R){const L=new Set(c.modelValue);L.has(R)?L.delete(R):L.add(R),m("update:modelValue",[...L])}function g(){p.value?T():M()}function M(){p.value=!0,Ye(()=>A())}function T(){p.value=!1}function A(){const R=x.value,L=_.value;
1if(!R||!L)return;const O=R.getBoundingClientRect(),q=8,ae=Math.max(q,window.innerWidth-q),Y=Math.min(Math.max(q,O.left),ae),oe=Math.max(0,ae-Y),K=Math.max(200,O.width),ee=Math.min(K,oe);L.style.left=`${Y}px`,L.style.top=`${O.bottom+4}px`,L.style.minWidth=`${ee}px`,L.style.maxWidth=`${oe}px`}function B(R){return Intl.NumberFormat(l.value||Oe(),{notation:R>=1e4?"compact":"standard"}).format(R)}function P(R){var O,q;if(!p.value)return;const L=R.target;L&&((O=b.value)!=null&&O.contains(L)||(q=_.value)!=null&&q.contains(L)||T())}function h(R){R.key==="Escape"&&T()}function W(){p.value&&A()}return ne(p,async R=>{R?(await Ye(),A(),document.addEventListener("mousedown",P),document.addEventListener("keydown",h),window.addEventListener("resize",W),window.addEventListener("scroll",W,!0)):(document.removeEventListener("mousedown",P),document.removeEventListener("keydown",h),window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0))}),Ve(()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",h),window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0)}),(R,L)=>(o(),i("div",{ref_key:"containerRef",ref:b,class:S(["filter-menu relative",t.compact?"min-w-[6.5rem] sm:min-w-[7.25rem]":"min-w-[150px] sm:min-w-[160px]"])},[e("button",{ref_key:"triggerRef",ref:x,type:"button",class:S(["select-trigger flex cursor-pointer list-none items-center justify-between gap-1.5 text-left",[p.value?"select-trigger-open":"",t.compact?"h-8 rounded-lg !px-2 !py-1 text-xs":"h-[42px]"]]),"aria-expanded":p.value,"aria-haspopup":"listbox","aria-label":t.label,onClick:g},[e("span",{class:S(["select-value min-w-0 truncate",t.compact?"max-w-[5.5rem] sm:max-w-[6.5rem]":"max-w-[11rem]"])},n(r(d)("channelMonitorV2.filters.labelValue",{label:t.label,value:D.value})),3),e("span",{class:S(["select-icon shrink-0 text-gray-400 transition-transform",p.value?"rotate-180":""])},[F(ce,{name:"chevronDown",size:"sm"})],2)],10,Ln),(o(),X(nt,{to:"body"},[F(Pt,{name:"select-dropdown"},{default:Me(()=>[p.value?(o(),i("div",{key:0,ref_key:"dropdownRef",ref:_,class:S(["select-dropdown-portal dropdown filter-dropdown",[$]]),style:de(N.value),role:"listbox","aria-multiselectable":"true",onClick:L[0]||(L[0]=Xe(()=>{},["stop"])),onMousedown:L[1]||(L[1]=Xe(()=>{},["stop"]))},[e("button",{type:"button",class:"dropdown-item select-option select-option-group flex w-full items-center justify-between border-b border-gray-100 px-4 py-2 text-left text-sm font-semibold text-gray-700 hover:bg-gray-100 dark:border-dark-700 dark:text-gray-300 dark:hover:bg-dark-700",onClick:j},[e("span",null,n(t.allLabel),1),t.modelValue.length===0?(o(),X(ce,{key:0,name:"check",size:"sm",class:"text-primary-500"})):C("",!0)]),(o(!0),i(H,null,Z(t.options,O=>(o(),i("button",{key:O.value,type:"button",role:"option",class:S(["dropdown-item select-option flex w-full items-center justify-between gap-3 px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-dark-700",t.modelValue.includes(O.value)?"select-option-selected":""]),"aria-selected":t.modelValue.includes(O.value),onClick:q=>z(O.value)},[e("span",En,[e("span",{class:S(["checkbox flex h-4 w-4 items-center justify-center rounded border border-gray-300 bg-white text-primary-500 dark:border-dark-600 dark:bg-dark-900",t.modelValue.includes(O.value)?"border-primary-500 bg-primary-50 dark:bg-primary-900/30":""])},[t.modelValue.includes(O.value)?(o(),X(ce,{key:0,name:"check",size:"sm",class:"text-primary-500"})):C("",!0)],2),e("span",In,n(O.label),1)]),O.count!=null?(o(),i("small",Nn,n(B(O.count)),1)):C("",!0)],10,Dn))),128)),t.options.length===0?(o(),i("p",Pn,n(r(d)("channelMonitorV2.filters.empty")),1)):C("",!0)],38)):C("",!0)]),_:1})]))],2))}}),Pe=ze(Bn,[["__scopeId","data-v-34616c70"]]),zn=["title"],Fn={class:"min-w-0 flex-1"},An={class:"stat-label text-[10px] font-bold uppercase tracking-wider text-gray-400"},jn={key:0,class:"mt-1.5 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] leading-snug text-gray-400 dark:text-dark-400"},On={key:1,class:"mt-1.5 block text-[11px] leading-snug text-gray-400 dark:text-dark-400"},we=J({__name:"MetricCell",props:{label:{},value:{},detail:{},state:{},title:{}},setup(t){const a=t,c=k(()=>{const x=(a.detail||"").trim();
1return!x||x==="-"?[]:x.split(/\s*[·|]\s*/).map(_=>_.trim()).filter(Boolean)}),m=k(()=>{const x=(a.value||"").trim();return x===""||x==="-"||x==="—"}),d=k(()=>m.value?void 0:a.state),l=k(()=>d.value?d.value==="healthy"?"text-emerald-600 dark:text-emerald-400":d.value==="warning"?"text-amber-600 dark:text-amber-400":d.value==="critical"?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-dark-400":m.value?"text-gray-500 dark:text-dark-400":"text-gray-900 dark:text-white"),b=k(()=>d.value==="healthy"?"bg-emerald-500":d.value==="warning"?"bg-amber-500":d.value==="critical"?"bg-red-500":"bg-gray-300 dark:bg-dark-600");return(x,_)=>(o(),i("div",{class:"stat-card !min-h-[6.5rem] !rounded-3xl !border-0 !p-4 shadow-sm ring-1 ring-gray-900/5 dark:!bg-dark-800 dark:ring-dark-700",title:t.title||void 0},[d.value?(o(),i("div",{key:0,class:S(["mt-1 h-2 w-2 shrink-0 rounded-full",b.value]),"aria-hidden":"true"},null,2)):C("",!0),e("div",Fn,[e("span",An,n(t.label),1),e("strong",{class:S(["stat-value mt-1 block overflow-visible text-xl tabular-nums leading-tight !text-clip !whitespace-normal",l.value])},n(t.value),3),c.value.length>1?(o(),i("div",jn,[(o(!0),i(H,null,Z(c.value,(p,$)=>(o(),i("span",{key:`${$}:${p}`,class:"whitespace-nowrap tabular-nums"},n(p),1))),128))])):t.detail?(o(),i("small",On,n(t.detail),1)):C("",!0)])],8,zn))}}),Wn=["title"],qn={key:0,class:"rank-trophy shrink-0",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20","aria-hidden":"true"},Un=["fill"],Hn=["fill"],Gn=["fill"],Zn=["fill"],Kn=["fill"],Xn={key:1,class:"sr-only"},Yn=J({__name:"MonitorRankBadge",props:{rank:{}},setup(t){const{t:a}=re(),c={1:{light:"#FFD524",mid:"#F5B200",dark:"#B45309"},2:{light:"#E5E7EB",mid:"#9CA3AF",dark:"#4B5563"},3:{light:"#E8A86A",mid:"#CD7F32",dark:"#8B5A2B"}},m=t,d=k(()=>{const D=Number(m.rank);return Number.isFinite(D)&&D>0?Math.floor(D):null}),l=k(()=>d.value!=null&&d.value>=1&&d.value<=3),b=k(()=>d.value===1||d.value===2||d.value===3?c[d.value]:null),x=k(()=>d.value==null||d.value<=0?"—":`#${d.value}`),_=k(()=>d.value==null||d.value<=0?a("channelMonitorV2.rank.unranked"):d.value===1?a("channelMonitorV2.rank.gold"):d.value===2?a("channelMonitorV2.rank.silver"):d.value===3?a("channelMonitorV2.rank.bronze"):a("channelMonitorV2.rank.place",{n:d.value})),p=k(()=>_.value),$=k(()=>d.value===1?"text-amber-600 dark:text-amber-400":d.value===2?"text-slate-500 dark:text-slate-300":d.value===3?"text-amber-800 dark:text-amber-600":"");return(D,N)=>(o(),i("span",{class:S(["inline-flex items-center gap-1.5 tabular-nums",$.value]),title:p.value},[l.value&&b.value?(o(),i("svg",qn,[e("path",{d:"M506.9 750.3c1.5 0 3-0.1 4.6-0.1 4.1 0 8.2 0.1 12.3 0.2V613.8h-16.9v136.5z",fill:b.value.mid},null,8,Un),e("path",{d:"M585.3 815.7c25.5 17.4 49 44.5 56.8 84.9h98.3c-20.4-36.7-77-71.2-155.1-84.9z",fill:b.value.light},null,8,Hn),e("path",{d:"M922.2 64.2H757.7c-0.2 0-0.4 0.1-0.6 0.1-0.2 0-0.4-0.1-0.6-0.1h-229c-16.3 0-29.6 13.2-29.6 29.6s13.2 29.6 29.6 29.6h199.6l0.9 215.5c0 98.3-66.1 181.4-156.1 207.4-19 5.5-39 8.5-59.8 8.5-119 0-215.9-96.9-215.9-216l-0.9-215.3h48.5c16.3 0 29.6-13.2 29.6-29.6s-13.2-29.6-29.6-29.6H100.9c-16.3 0-29.6 13.2-29.6 29.6V135c0 66.3 33.3 127.3 89.1 163.2 5 3.2 10.5 4.7 16 4.7 9.7 0 19.2-4.8 24.9-13.5 8.8-13.7 4.9-32-8.8-40.9-38.8-25-62-67.4-62-113.5v-11.6H236l0.9 215.5c0 126.7 86.2 233.7 203 265.4v151.3c-11.8 1.7-23.5 3.7-34.9 6.3-15.9 3.6-25.9 19.5-22.3 35.4 3.6 15.9 19.5 25.9 35.4 22.3 29.6-6.7 61-10.1 93.3-10.1 26.3 0 50.9 2.3 73.8 6.4 78.2 13.7 134.8 48.2 155.1 84.9H282.2c10.2-19 29.8-37.1 57.1-52.1 14.3-7.9 19.5-25.9 11.6-40.2-7.9-14.3-25.9-19.5-40.2-11.6-61.7 34-95.7 81.4-95.7 133.5 0 16.3 13.2 29.6 29.6 29.6h533.5c16.3 0 29.6-13.2 29.6-29.6 0-85.9-94.3-155.9-224.9-174.9v-151C700.3 573.1 787 465.9 787 338.7l-0.9-215.3h106.6V135c-0.1-16.3-13.4-29.6-29.7-29.6zM523.8 750.4c-4.1-0.1-8.2-0.2-12.3-0.2-1.5 0-3 0.1-4.6 0.1-2.6 0-5.2 0.1-7.8 0.2V613.8h24.7v136.6z",fill:b.value.dark},null,8,Gn),e("path",{d:"M727.9 338.8l-0.9-215.5h-92.3l0.9 215.5c0 84.1-19.5 168.1-63.9 207.4 90.1-26 156.2-109.1 156.2-207.4z",fill:b.value.light},null,8,Zn),e("path",{d:"M433.2 123.3h1.8c16.3 0 29.6-13.2 29.6-29.6S451.4 64.2 435 64.2h-1.8c-16.3 0-29.6 13.2-29.6 29.6s13.3 29.5 29.6 29.5z",fill:b.value.dark},null,8,Kn)])):C("",!0),l.value?(o(),i("span",Xn,n(_.value),1)):C("",!0),e("span",{class:S(["text-xs font-semibold",l.value?$.value:"text-gray-500 dark:text-dark-300"])},n(x.value),3)],10,Wn))}}),Qn={span:1,offset:0},ct=.12,Jn=.12;function $e(t,a,c){return Math.min(c,Math.max(a,t))}function ke(){return{...Qn}}function ut(t){return t.span<.999||t.offset>.001}function xe(t){const a=$e(t.span,ct,1),c=Math.max(0,1-a);return{span:a,offset:$e(t.offset,0,c)}}function dt(t,a,c){const m=$e(Number.isFinite(c)?c:.5,0,1);
1if(a.shiftKey||Math.abs(a.deltaX)>Math.abs(a.deltaY)){if(t.span>=1)return xe(t);const D=(a.shiftKey?a.deltaY:a.deltaX)/400*t.span;return xe({span:t.span,offset:t.offset+D})}const l=a.deltaY<0?-1:a.deltaY>0?1:0;if(l===0)return xe(t);const b=$e(t.span*(1+l*Jn),ct,1);if(Math.abs(b-t.span)<1e-9)return xe(t);const p=t.offset+m*t.span-m*b;return xe({span:b,offset:p})}function mt(t,a){if(!t.length)return[];const c=xe(a);if(c.span>=.999)return[...t];const m=Math.max(1,Math.ceil(t.length*c.span)),d=Math.max(0,t.length-m),l=Math.min(d,Math.max(0,Math.round(c.offset*t.length)));return t.slice(l,l+m)}function ht(t,a){if(!a)return .5;const c=a.getBoundingClientRect();return c.width<=0?.5:$e((t-c.left)/c.width,0,1)}const er={class:"card flex min-h-[360px] flex-col overflow-hidden !rounded-3xl !border-0 !p-6 shadow-sm ring-1 ring-gray-900/5 dark:!bg-dark-800 dark:ring-dark-700"},tr={class:"card-header mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3 !border-0 !p-0"},ar={class:"min-w-0"},nr={class:"flex items-center gap-2 text-sm font-bold text-gray-900 dark:text-white"},rr={class:"inline-flex h-4 w-4 text-sky-500","aria-hidden":"true"},lr={class:"mt-0.5 text-xs text-gray-500 dark:text-dark-400"},or={class:"flex w-full min-w-0 flex-wrap items-center justify-end gap-2 text-xs text-gray-500 dark:text-gray-400 sm:w-auto"},sr={class:"flex shrink-0 items-center gap-1"},ir={class:"flex shrink-0 items-center gap-1"},cr={class:"flex shrink-0 items-center gap-1"},ur={class:"badge badge-gray shrink-0"},dr=["disabled"],mr={class:"card-body min-h-0 flex-1 !p-0"},hr={key:0,class:"flex h-[280px] items-center justify-center sm:h-[300px]"},pr={class:"animate-pulse text-sm text-gray-400"},fr={key:2,class:"flex h-[280px] items-center justify-center sm:h-[300px]"},gr=J({__name:"MonitorTrendChart",props:{trend:{},coverage:{},loading:{type:Boolean}},setup(t){Yt.register(Qt,Jt,ea,ta,aa,na,ra,la);const{t:a,locale:c}=re(),m=t,d=I(null),l=I(ke()),b=k(()=>ut(l.value)),x=k(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")),_=k(()=>{var A;const M=(((A=m.coverage)==null?void 0:A.bucket_seconds)||60)/60;if(M<60)return a("channelMonitorV2.bucket.minutes",{count:M});const T=M/60;return T<24?a("channelMonitorV2.bucket.hours",{count:T}):a("channelMonitorV2.bucket.days",{count:T/24})}),p=k(()=>{const g=$.value;if(!g.length)return null;const M=g.map(P=>new Intl.DateTimeFormat(c.value||void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(P.bucket_start))),T=j(g.map(P=>(P.metrics.error_rate||0)*100)),A=j(g.map(P=>(P.metrics.cache_rate||0)*100)),B=j(g.map(P=>{var h;return((h=P.metrics.ttft)==null?void 0:h.p50_ms)??null}));return{labels:M,datasets:[{label:a("channelMonitorV2.chart.errorDataset"),data:T,borderColor:"#ef4444",backgroundColor:"rgba(239, 67, 67, 0.10)",yAxisID:"yPct",tension:.4,cubicInterpolationMode:"monotone",fill:"origin",pointRadius:0,pointHoverRadius:4,pointHitRadius:10,borderWidth:2},{label:a("channelMonitorV2.chart.cacheDataset"),data:A,borderColor:"#10b981",backgroundColor:"rgba(16, 185, 129, 0.08)",yAxisID:"yPct",tension:.4,cubicInterpolationMode:"monotone",fill:!1,pointRadius:0,pointHoverRadius:4,pointHitRadius:10,borderWidth:2},{label:a("channelMonitorV2.chart.ttftDataset"),data:B,borderColor:"#0ea5e9",backgroundColor:"rgba(14, 165, 233, 0.08)",yAxisID:"yTtft",tension:.4,cubicInterpolationMode:"monotone",fill:!1,pointRadius:0,pointHoverRadius:4,pointHitRadius:10,borderWidth:2,spanGaps:!0}]}}),$=k(()=>mt(m.trend||[],l.value));function D(g){g.preventDefault();const M=ht(g.clientX,d.value);l.value=dt(l.value,g,M)}function N(){l.value=ke()}ne(()=>m.trend,()=>{l.value=ke()});function j(g){return g.length<=2?g:g.map((M,T)=>{if(M==null)return null;const A=g.slice(Math.max(0,T-1),Math.min(g.length,T+2)).filter(B=>B!=null);return A.length?A.reduce((B,P)=>B+P,0)/A.length:M})}const z=k(()=>{const g=x.value?"#9ca3af":"#6b7280",M=x.value?"#374151":"#f3f4f6",T=x.value?"#1f2937":"#ffffff",A=x.value?"#f3f4f6":"#111827",B=x.value?"#d1d5db":"#4b5563";return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1}
1,plugins:{legend:{display:!1},tooltip:{backgroundColor:T,titleColor:A,bodyColor:B,borderColor:M,borderWidth:1,padding:10,displayColors:!0,callbacks:{label(P){const h=P.dataset.label||"",W=P.parsed.y;return W==null?`${h}: -`:h===a("channelMonitorV2.chart.errorDataset")||h===a("channelMonitorV2.chart.cacheDataset")?`${h}: ${Re(W/100)}`:`${h}: ${ie(W)}`}}}},scales:{x:{ticks:{color:g,maxRotation:0,autoSkip:!0,maxTicksLimit:8,autoSkipPadding:10,font:{size:10}},grid:{display:!1}},yPct:{type:"linear",position:"left",min:0,suggestedMax:100,ticks:{color:g,font:{size:10},callback:P=>`${P}%`},grid:{color:M,borderDash:[4,4]},title:{display:!0,text:a("channelMonitorV2.chart.percentAxis"),color:g,font:{size:11}}},yTtft:{type:"linear",position:"right",min:0,ticks:{color:"#0ea5e9",font:{size:10},callback:P=>ie(Number(P))},grid:{display:!1},title:{display:!0,text:a("channelMonitorV2.metrics.ttftP50"),color:"#0ea5e9",font:{size:11}}}}}});return(g,M)=>(o(),i("section",er,[e("div",tr,[e("div",ar,[e("h2",nr,[e("span",rr,[F(ce,{name:"chart",size:"sm"})]),Q(" "+n(r(a)("channelMonitorV2.chart.title")),1)]),e("p",lr,n(r(a)("channelMonitorV2.chart.description")),1)]),e("div",or,[e("span",sr,[M[0]||(M[0]=e("span",{class:"h-2 w-2 rounded-full bg-red-500"},null,-1)),Q(n(r(a)("channelMonitorV2.chart.errorLegend")),1)]),e("span",ir,[M[1]||(M[1]=e("span",{class:"h-2 w-2 rounded-full bg-emerald-500"},null,-1)),Q(n(r(a)("channelMonitorV2.chart.cacheLegend")),1)]),e("span",cr,[M[2]||(M[2]=e("span",{class:"h-2 w-2 rounded-full bg-sky-500"},null,-1)),Q(n(r(a)("channelMonitorV2.chart.ttftLegend")),1)]),e("span",ur,n(_.value),1),e("button",{type:"button",class:"inline-flex shrink-0 items-center rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] font-semibold text-gray-600 hover:bg-gray-50 disabled:opacity-50 dark:border-dark-700 dark:bg-dark-900 dark:text-gray-300 dark:hover:bg-dark-800",disabled:!b.value,onClick:N},n(r(a)("channelMonitorV2.chart.resetZoom")),9,dr)])]),e("div",mr,[t.loading?(o(),i("div",hr,[e("div",pr,n(r(a)("common.loading")),1)])):p.value?(o(),i("div",{key:1,ref_key:"chartRef",ref:d,class:"h-[280px] sm:h-[300px]",onWheel:D},[F(r(oa),{data:p.value,options:z.value},null,8,["data","options"])],544)):(o(),i("div",fr,[F(Ae,{title:r(a)("channelMonitorV2.chart.emptyTitle"),description:r(a)("channelMonitorV2.empty.description")},null,8,["title","description"])]))])]))}}),vr={class:"card flex min-h-[360px] flex-col overflow-visible !rounded-3xl !border-0 !p-6 shadow-sm ring-1 ring-gray-900/5 dark:!bg-dark-800 dark:ring-dark-700"},br={class:"card-header mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3 !border-0 !p-0"},xr={class:"min-w-0"},yr={class:"flex items-center gap-2 text-sm font-bold text-gray-900 dark:text-white"},kr={class:"inline-flex h-4 w-4 text-emerald-500","aria-hidden":"true"},_r={class:"mt-0.5 text-xs text-gray-500 dark:text-dark-400"},wr={class:"flex w-full min-w-0 flex-wrap items-center justify-end gap-2 text-xs text-gray-500 dark:text-gray-400 sm:w-auto"},Mr={class:"badge badge-gray shrink-0"},$r={class:"hidden text-[11px] text-gray-400 dark:text-dark-400 sm:inline"},Vr=["disabled"],Cr={class:"card-body min-h-0 flex-1 !p-0"},Sr={key:0},Rr={class:"pulse-axis flex justify-between gap-3"},Tr={class:"not-italic"},Lr={class:"not-italic"},Dr=["title"],Er={class:"truncate text-xs font-semibold text-gray-800 dark:text-gray-100"},Ir={class:"summary-value bg-white text-xs font-medium tabular-nums text-gray-600 dark:bg-dark-800 dark:text-gray-300"},Nr=["title"],Pr=["title"],Br={class:"summary-value bg-white text-xs font-medium tabular-nums text-gray-600 dark:bg-dark-800 dark:text-gray-300"},zr=["title","aria-label","onMouseenter","onFocus"],Fr={class:"pulse-tooltip",role:"tooltip"},Ar={class:"pulse-tooltip-line pulse-tooltip-title"},jr={class:"pulse-tooltip-line"},Or={class:"pulse-tooltip-line"},Wr={class:"pulse-tooltip-line"},qr={key:0,class:"pulse-tooltip-line"},Ur={class:"pulse-tooltip-line"},Hr={class:"pulse-tooltip-line"},Gr={key:1,class:"pulse-tooltip-line"},Zr={class:"pulse-tooltip-line"},Kr={class:"pulse-tooltip-line pulse-tooltip-title"},Xr={class:"pulse-tooltip-line"},Yr={key:1,class:"flex min-h-[200px] items-center justify-center py-8"},Qr=["aria-label"],Jr={class:"flex items-center gap-2 text-[11px] text-gray-500 dark:text-gray-400"},el={class:"shrink-0"},tl={class:"shrink-0"},al={class:"flex flex-wrap gap-4 text-[11px] text-gray-500 dark:text-gray-400"},nl={class:"inline-flex items-center gap-1.5"},rl={class:"inline-flex items-center gap-1.5"},ll={class:"inline-flex items-center gap-1.5"},ol={class:"inline-flex items-center gap-1.5"},sl=J({__name:"RelayPulseMatrix",props:{rows:{},coverage:{},healthMode:{},showThroughput:{type:Boolean,default:!0}},setup(t){const{t:a,locale:c}=re(),m=t,d=at({visible:!1,x:0,y:0,lines:[]}),l=I(null),b=I(ke()),x=k(()=>ut(b.value)),_=k(()=>{const u=Math.max(60,m.coverage.bucket_seconds)*1e3,v=new Date(m.coverage.requested_start).getTime(),w=m.coverage.requested_end?new Date(m.coverage.requested_end).getTime():NaN,V=new Date(m.coverage.data_through).getTime(),G=Number.isFinite(w)&&w>v?w:V;if(![v,G].every(Number.isFinite)||v>=G)return[];const fe=[];for(let se=Math.floor(v/u)*u;se<G;se+=u)fe.push(new Date(se).toISOString());return fe}),p=k(()=>mt(_.value,b.value)),$=k(()=>({"--bucket-count":String(Math.max(1,p.value.length)),minWidth:x.value?`calc(260px + ${D.value})`:"0"})),D=k(()=>{const u=Math.max(1,p.value.length);if(!x.value)return"0px";const v=Math.min(12,Math.round((1-b.value.span)/.08)),w=6+v*4,V=v>=4?3:2;return`${u*w+Math.max(0,u-1)*V}px`}),N=k(()=>{const u=Math.max(1,p.value.length),v=x.value?Math.min(12,Math.round((1-b.value.span)/.08)):0,w=x.value?v>=4?3:2:u>24?1:2,V=16,G=x.value?`${6+v*4}px`:"0";return{gridTemplateColumns:`repeat(${u}, minmax(${G}, 1fr))`,gap:`${w}px`,height:`${V}px`,minWidth:D.value}}),j=k(()=>p.value.length?be(p.value[0]):"时间脉冲"),z=k(()=>p.value.length?be(p.value[p.value.length-1]):""),g=k(()=>{const u=m.coverage.bucket_seconds/60;
1if(u<60)return a("channelMonitorV2.bucket.minutes",{count:u});const v=u/60;return v<24?a("channelMonitorV2.bucket.hours",{count:v}):a("channelMonitorV2.bucket.days",{count:v/24})}),M=k(()=>{const u=new Map;return p.value.forEach((v,w)=>u.set(v,w)),u}),T=k(()=>{const u=p.value,v=M.value;return m.rows.map(w=>{const V=u.map(G=>({start:G}));for(const G of w.buckets||[]){const fe=new Date(G.bucket_start).toISOString(),se=v.get(fe);se!=null&&(V[se]={start:u[se],bucket:G})}return{row:w,slots:V}})});function A(u){const v=l.value,w=u.target,V=w==null?void 0:w.closest(".pulse-track"),G=!!(w!=null&&w.closest(".matrix-scroll")),fe=u.shiftKey||Math.abs(u.deltaX)>Math.abs(u.deltaY);if(!G&&!V||!G&&!fe)return;u.preventDefault();const se=V||v,Te=ht(u.clientX,se);b.value=dt(b.value,u,Te)}function B(){b.value=ke()}ne(()=>[m.coverage.requested_start,m.coverage.requested_end,m.coverage.coverage_start,m.coverage.data_through,m.coverage.bucket_seconds],()=>{b.value=ke()});function P(u,v){return st(u,m.healthMode,v)}function h(u){const v=[u.platform];return(u.group_name||u.group_id)&&v.push(u.group_name||`#${u.group_id}`),u.model&&v.push(u.model==="__other__"?a("channelMonitorV2.otherModels"):u.model),v.join(" / ")}function W(u){return[u.platform,u.group_id||0,u.model||""].join(":")}function R(u){const v=u.request_count<=0,w=(u.rpm||0)<=0&&(u.tpm||0)<=0;return v&&w&&m.showThroughput?"-":$n(u.error_rate)}function L(u){const v=ot(u,m.healthMode);return v==null?"—":`${Math.round(v)}`}function O(u){return q(u).join(`
2`)}function q(u){const v=u.metrics,w=[pe(u.bucket_start),a("channelMonitorV2.matrix.scoreLine",{score:L(u.health)}),a("channelMonitorV2.metrics.successRateValue",{value:R(v)}),a("channelMonitorV2.metrics.ttftValue",{value:le(v.ttft)})];return m.showThroughput&&w.push(a("channelMonitorV2.metrics.tpsValue",{value:he(v.tpm)})),w.push(a("channelMonitorV2.metrics.cacheRateValue",{value:me(v.cache_rate)}),a("channelMonitorV2.metrics.errorRateValue",{value:me(v.error_rate)})),m.showThroughput&&w.push(a("channelMonitorV2.metrics.rpmValue",{value:Ce(v.rpm)})),w.push(a("channelMonitorV2.metrics.durationValue",{value:le(v.duration)})),w}function ae(u){return[pe(u),a("channelMonitorV2.matrix.noTraffic")]}function Y(u,v){d.lines=v.bucket?q(v.bucket):ae(v.start),d.visible=!0,ee(u)}function oe(u){d.visible&&ee(u)}function K(){d.visible=!1}function ee(u){if("clientX"in u){d.x=Math.min(window.innerWidth-12,Math.max(12,u.clientX)),d.y=Math.min(window.innerHeight-12,Math.max(12,u.clientY))-12;return}const v=u.target,w=v==null?void 0:v.getBoundingClientRect();w&&(d.x=w.left+w.width/2,d.y=w.top-10)}function le(u){return it(u.p50_ms,u.p90_ms,u.avg_ms,u.p95_ms)}function me(u){return Re(u)}function Ce(u){return We(u)}function he(u){return lt(u)}function ge(u){const v=qe(u);return Intl.NumberFormat(c.value||void 0,{maximumFractionDigits:3}).format(v)}function ve(u){return ie(u)}function be(u){return new Intl.DateTimeFormat(c.value||void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(u))}function pe(u){const v=new Date(u),w=new Date(v.getTime()+m.coverage.bucket_seconds*1e3);return`${be(v.toISOString())} - ${new Intl.DateTimeFormat(c.value||void 0,{hour:"2-digit",minute:"2-digit"}).format(w)}`}return(u,v)=>(o(),i("section",vr,[e("div",br,[e("div",xr,[e("h2",yr,[e("span",kr,[F(ce,{name:"grid",size:"sm"})]),Q(" "+n(r(a)("channelMonitorV2.matrix.title")),1)]),e("p",_r,n(r(a)("channelMonitorV2.matrix.description")),1)]),e("div",wr,[e("span",Mr,n(g.value),1),e("span",$r,n(r(a)("channelMonitorV2.matrix.wheelZoomX")),1),e("button",{type:"button",class:"inline-flex shrink-0 items-center rounded-lg border border-gray-200 bg-white px-2 py-1 text-[11px] font-semibold text-gray-600 hover:bg-gray-50 disabled:opacity-50 dark:border-dark-700 dark:bg-dark-900 dark:text-gray-300 dark:hover:bg-dark-800",disabled:!x.value,onClick:B},n(r(a)("channelMonitorV2.matrix.resetZoom")),9,Vr)])]),e("div",Cr,[t.rows.length?(o(),i("div",{key:0,ref_key:"scrollRef",ref:l,class:"matrix-scroll max-h-[min(42vh,420px)] max-w-full overflow-auto rounded-2xl bg-gray-50/60 p-2 dark:bg-dark-900/30",onWheel:A},[e("div",{class:"matrix-table w-full",style:de($.value)},[e("div",{class:S(["matrix-header matrix-row sticky top-0 z-[3] bg-gray-50 text-[10px] font-semibold uppercase tracking-wide text-gray-500 dark:bg-dark-900 dark:text-gray-400",t.showThroughput?"matrix-row--with-tps":""])},[e("span",null,n(r(a)("channelMonitorV2.matrix.dimension")),1),e("span",null,n(r(a)("channelMonitorV2.metrics.successRate")),1),e("span",null,n(r(a)("channelMonitorV2.metrics.ttft")),1),t.showThroughput?
2(o(),i("span",Sr,n(r(a)("channelMonitorV2.metrics.tps")),1)):C("",!0),e("span",null,n(r(a)("channelMonitorV2.metrics.cacheRate")),1),e("span",Rr,[e("i",Tr,n(j.value),1),e("i",Lr,n(z.value),1)])],2),(o(!0),i(H,null,Z(T.value,w=>(o(),i("div",{key:W(w.row),class:S(["matrix-row border-b border-gray-100/80 dark:border-dark-700/60",t.showThroughput?"matrix-row--with-tps":""])},[e("div",{class:"dimension-cell flex min-w-0 items-center gap-2 bg-white dark:bg-dark-800",title:h(w.row)},[e("span",{class:S(["status-dot",P(w.row.health,w.row.metrics.request_count)])},null,2),e("strong",Er,n(h(w.row)),1)],8,Dr),e("strong",Ir,n(R(w.row.metrics)),1),e("strong",{class:"summary-value bg-white text-xs font-medium tabular-nums text-gray-600 dark:bg-dark-800 dark:text-gray-300",title:le(w.row.metrics.ttft)},n(ve(w.row.metrics.ttft.p50_ms)),9,Nr),t.showThroughput?(o(),i("strong",{key:0,class:"summary-value bg-white text-xs font-medium tabular-nums text-gray-600 dark:bg-dark-800 dark:text-gray-300",title:ge(w.row.metrics.tpm)},n(he(w.row.metrics.tpm)),9,Pr)):C("",!0),e("strong",Br,n(me(w.row.metrics.cache_rate)),1),e("div",{class:"pulse-track grid items-stretch",style:de(N.value)},[(o(!0),i(H,null,Z(w.slots,V=>(o(),i("span",{key:V.start,class:S(["pulse-cell relative rounded-sm border-0 p-0 outline-offset-1",[V.bucket?P(V.bucket.health,V.bucket.metrics.request_count):"health-unknown",V.bucket?"has-data":"is-empty"]]),tabindex:"0",role:"img",title:V.bucket?O(V.bucket):r(a)("channelMonitorV2.matrix.noTrafficAt",{time:pe(V.start)}),"aria-label":V.bucket?O(V.bucket):r(a)("channelMonitorV2.matrix.noTrafficAt",{time:pe(V.start)}),onMouseenter:G=>Y(G,V),onMousemove:v[0]||(v[0]=G=>oe(G)),onMouseleave:K,onFocus:G=>Y(G,V),onBlur:K},[e("span",Fr,[V.bucket?(o(),i(H,{key:0},[e("span",Ar,n(pe(V.start)),1),e("span",jr,n(r(a)("channelMonitorV2.matrix.scoreLine",{score:L(V.bucket.health)})),1),e("span",Or,n(r(a)("channelMonitorV2.metrics.successRateValue",{value:R(V.bucket.metrics)})),1),e("span",Wr,n(r(a)("channelMonitorV2.metrics.ttftValue",{value:le(V.bucket.metrics.ttft)}
2)),1),t.showThroughput?(o(),i("span",qr,n(r(a)("channelMonitorV2.metrics.tpsValue",{value:he(V.bucket.metrics.tpm)})),1)):C("",!0),e("span",Ur,n(r(a)("channelMonitorV2.metrics.cacheRateValue",{value:me(V.bucket.metrics.cache_rate)})),1),e("span",Hr,n(r(a)("channelMonitorV2.metrics.errorRateValue",{value:me(V.bucket.metrics.error_rate)})),1),t.showThroughput?(o(),i("span",Gr,n(r(a)("channelMonitorV2.metrics.rpmValue",{value:Ce(V.bucket.metrics.rpm)})),1)):C("",!0),e("span",Zr,n(r(a)("channelMonitorV2.metrics.durationValue",{value:le(V.bucket.metrics.duration)})),1)],64)):(o(),i(H,{key:1},[e("span",Kr,n(pe(V.start)),1),e("span",Xr,n(r(a)("channelMonitorV2.matrix.noTraffic")),1)],64))])],42,zr))),128))],4)],2))),128))],4)],544)):(o(),i("div",Yr,[F(Ae,{title:r(a)("channelMonitorV2.matrix.emptyTitle"),description:r(a)("channelMonitorV2.empty.description")},null,8,["title","description"])])),e("div",{class:"mt-4 flex flex-col gap-2","aria-label":r(a)("channelMonitorV2.matrix.legendAria")},[e("div",Jr,[e("span",el,n(r(a)("channelMonitorV2.matrix.bad")),1),v[1]||(v[1]=e("div",{class:"score-legend h-2.5 flex-1 overflow-hidden rounded-full"},null,-1)),e("span",tl,n(r(a)("channelMonitorV2.matrix.good")),1)]),e("div",al,[e("span",nl,[v[2]||(v[2]=e("i",{class:"status-dot health-score10"},null,-1)),Q(n(r(a)("channelMonitorV2.matrix.healthyLegend")),1)]),e("span",rl,[v[3]||(v[3]=e("i",{class:"status-dot health-score6"},null,-1)),Q(n(r(a)("channelMonitorV2.matrix.warningLegend")),1)]),e("span",ll,[v[4]||(v[4]=e("i",{class:"status-dot health-score2"},null,-1)),Q(n(r(a)("channelMonitorV2.matrix.criticalLegend")),1)]),e("span",ol,[v[5]||(v[5]=e("i",{class:"status-dot health-unknown"},null,-1)),Q(n(r(a)("channelMonitorV2.matrix.unknownLegend")),1)])])],8,Qr)]),(o(),X(nt,{to:"body"},[d.visible?(o(),i("div",{key:0,class:"matrix-floating-tooltip",style:de({left:`${d.x}px`,top:`${d.y}px`}),role:"tooltip"},[(o(!0),i(H,null,Z(d.lines,(w,V)=>(o(),i("span",{key:`${V}:${w}`,class:S(["matrix-floating-tooltip-line",V===0?"matrix-floating-tooltip-title":""])},n(w),3))),128))],4)):C("",!0)]))]))}}),il=ze(sl,[["__scopeId","data-v-160eba47"]]),cl={class:"space-y-6 pb-12"},ul={class:"card sticky top-0 z-20 !rounded-3xl !border-0 p-0 shadow-sm ring-1 ring-gray-900/5 backdrop-blur-sm dark:!bg-dark-800 dark:ring-dark-700 supports-[backdrop-filter]:bg-white/95 dark:supports-[backdrop-filter]:bg-dark-800/95"},dl={class:"page-header mb-0 flex flex-wrap items-start justify-between gap-4 border-b border-gray-100 px-5 py-4 dark:border-dark-700 sm:px-6"},ml={class:"min-w-0"},hl={class:"page-title flex items-center gap-2 text-xl font-black text-gray-900 dark:text-white"},pl={class:"inline-flex h-8 w-8 items-center justify-center rounded-xl bg-blue-50 text-blue-500 dark:bg-blue-900/30 dark:text-blue-400"},fl={class:"page-description mt-1.5 flex flex-wrap items-center gap-2 text-xs text-gray-500 dark:text-gray-400"},gl={class:"relative flex h-2 w-2 shrink-0"},vl={key:0,class:"inline-flex items-center gap-1 text-primary-600 dark:text-primary-300"},bl={key:1},xl={key:2,class:"text-gray-400"},yl={key:3,class:"badge badge-warning"},kl={key:4,class:"badge badge-primary inline-flex items-center gap-1"},_l=["title","disabled"],wl={key:0,class:"border-b border-blue-100 bg-blue-50/90 px-5 py-3 dark:border-blue-900/40 dark:bg-blue-950/40 sm:px-6",role:"status","aria-live":"polite"},Ml={class:"flex flex-wrap items-start justify-between gap-3"},$l={class:"min-w-0 flex-1"},Vl={class:"text-sm font-semibold text-blue-900 dark:text-blue-100"},Cl={class:"mt-0.5 text-xs text-blue-800/80 dark:text-blue-200/80"},Sl={class:"shrink-0 text-xs font-medium tabular-nums text-blue-700 dark:text-blue-300"},Rl=["aria-valuenow","aria-label"],Tl={class:"monitor-toolbar flex flex-nowrap items-center gap-1.5 overflow-x-auto px-4 py-3 sm:gap-2 sm:px-5"},Ll=["aria-label"],Dl=["onClick"],El=["disabled"],Il=["aria-label"],Nl=["aria-label"],Pl=["onClick"],Bl=["aria-label"],zl={class:"relative min-h-[320px]"},Fl={key:2,class:"card flex min-h-[320px] items-center justify-center !rounded-3xl !border-0 text-sm text-gray-400 shadow-sm ring-1 ring-gray-900/5 dark:ring-dark-700"},Al={class:"animate-pulse"},jl={class:"card flex min-h-0 flex-col overflow-hidden !rounded-3xl !border-0 shadow-sm ring-1 ring-gray-900/5 dark:!bg-dark-800 dark:ring-dark-700"},Ol={class:"border-b border-gray-100 px-5 pt-4 dark:border-dark-700 sm:px-6"},Wl=["aria-label"],ql=["aria-selected","onClick"],Ul={class:"min-h-0 max-h-[min(52vh,520px)] overflow-auto p-4 sm:p-5"},Hl={key:0,class:"table-container border-0"},Gl={class:"table monitor-table min-w-[720px]"},Zl={key:0},Kl={key:1},Xl=["onClick"],Yl={class:"flex items-center gap-2"},Ql={class:"block text-xs text-gray-500 dark:text-dark-400"},Jl={class:"font-semibold text-gray-900 dark:text-white"},eo={class:"block"},to={class:"text-xs text-gray-400"},ao={class:"block"},no={class:"text-xs text-gray-400"},ro=["title"],lo={key:1},oo={key:1,class:"space-y-3"},so=["onClick"],io={class:"flex min-w-0 items-center gap-1.5 truncate text-gray-700 dark:text-gray-200"},co={class:"truncate"},uo={key:0,class:"badge badge-gray shrink-0 !px-1.5 !py-0 text-[10px]"},mo={class:"h-2 overflow-hidden rounded-full bg-gray-100 dark:bg-dark-700"},ho={key:0,class:"mt-3 space-y-2 border-t border-gray-100 pt-3 dark:border-dark-700"},po={class:"mb-1 flex flex-wrap items-center gap-2"},fo={class:"badge badge-gray !px-1.5 !py-0 text-[10px]"},go={class:"truncate font-medium"},vo={key:0,class:"text-gray-400"},bo={key:1,class:"text-gray-400"},xo={class:"ml-auto text-gray-400"},yo={class:"break-words leading-relaxed"},ko={key:1,class:"text-xs text-gray-400"},_o={key:2,class:"table-container border-0"},wo={class:"table monitor-table min-w-[640px]"},Mo={class:"w-16"},$o={key:0},Vo={key:1},Co={key:0,class:"badge badge-primary ml-2 !px-1.5 !py-0 text-[10px]"},So={class:"block"},Ro={class:"text-xs text-gray-400"},To={class:"block"},Lo={class:"text-xs text-gray-400"},Do=["title"],Eo={key:1},Io={key:3,class:"empty-state py-10 text-sm text-gray-400"},No={key:4,class:"empty-state py-10"},Po={class:"empty-state-title text-base"},Bo={class:"empty-state-description"},zo=J({__name:"ChannelStatusV2View",setup(t){const a=Bt(),c=zt(),m=Lt(),d=Be(),{t:l,te:b,locale:x}=re(),_=k(()=>m.isAdmin),p=k(()=>_.value||!Dt()),$=k(()=>_.value||!Et()),D=k(()=>[{value:"90m",label:l("channelMonitorV2.ranges.90m")},{value:"24h",label:l("channelMonitorV2.ranges.24h")},{value:"7d",label:l("channelMonitorV2.ranges.7d")},{value:"30d",label:l("channelMonitorV2.ranges.30d")}]),N=k(()=>{const s=[{value:"models",label:l("channelMonitorV2.tabs.models")},{value:"errors",label:l("channelMonitorV2.tabs.errors")}];return $.value&&s.push({value:"users",label:l("channelMonitorV2.tabs.users")}),s}),j=k(()=>[{value:"platform",label:l("channelMonitorV2.groupBy.platform")},{value:"platform_group",label:l("channelMonitorV2.groupBy.platformGroup")},{value:"platform_model",label:l("channelMonitorV2.groupBy.platformModel")},{value:"platform_group_model",label:l("channelMonitorV2.groupBy.platformGroupModel")}]),z=k(()=>[{value:"overall",label:l("channelMonitorV2.healthMode.overall")},{value:"success",label:l("channelMonitorV2.healthMode.success")},{value:"ttft",label:l("channelMonitorV2.healthMode.ttft")}
2,{value:"cache",label:l("channelMonitorV2.healthMode.cache")}]),g=I({range:G(a.query.range),platforms:V(a.query.platform),groupIds:V(a.query.group).map(Number).filter(Boolean),models:V(a.query.model)}),M=I(se(a.query.tab,$.value)),T=I(fe(a.query.group_by)),A=I(Te(a.query.health_mode)),B=I(pt(a.query.trend_view)),P=I({platforms:[],groups:[],models:[]}),h=I(null),W=I(null),R=I([]),L=I([]),O=I([]),q=I(!1),ae=I(!1),Y=I(!1),oe=I(new Set);let K=null,ee=0,le=null;const me=k(()=>g.value.platforms.length+g.value.groupIds.length+g.value.models.length>0),Ce=k(()=>(P.value.platforms||[]).map(s=>({value:s.value,label:s.label}))),he=k(()=>new Set(g.value.platforms)),ge=k(()=>(P.value.groups||[]).filter(s=>he.value.size===0||!s.platform||he.value.has(s.platform)).map(s=>({value:String(s.id),label:s.platform?`${s.platform} / ${s.name||`#${s.id}`}`:s.name||`#${s.id}`}))),ve=k(()=>(P.value.models||[]).filter(s=>he.value.size===0||!s.platform||he.value.has(s.platform)).map(s=>({value:s.value,label:s.platform&&!s.label.includes(s.platform)?`${s.platform} / ${s.label}`:s.label}))),be=k({get:()=>g.value.groupIds.map(String),set:s=>{g.value.groupIds=s.map(Number).filter(y=>Number.isInteger(y)&&y>0)}});ne([ge,ve],()=>{if(ge.value.length>0){const s=new Set(ge.value.map(E=>E.value)),y=g.value.groupIds.filter(E=>s.has(String(E)));y.length!==g.value.groupIds.length&&(g.value.groupIds=y)}if(ve.value.length>0){const s=new Set(ve.value.map(E=>E.value)),y=g.value.models.filter(E=>s.has(E));y.length!==g.value.models.length&&(g.value.models=y)}},{flush:"post"});const pe=k(()=>M.value==="models"?R.value.length===0:M.value==="errors"?L.value.length===0:O.value.length===0),u=k(()=>{var s,y,E;return!!((E=(y=(s=h.value)==null?void 0:s.coverage)==null?void 0:y.bootstrap)!=null&&E.active)}),v=k(()=>{var y,E,U;const s=(U=(E=(y=h.value)==null?void 0:y.coverage)==null?void 0:E.bootstrap)==null?void 0:U.progress_percent;return typeof s!="number"||Number.isNaN(s)?0:Math.min(100,Math.max(0,Math.round(s)))}),w=k(()=>{var y;const s=((y=W.value)==null?void 0:y.items)||[];return T.value==="platform_group"||T.value==="platform_group_model"?s.filter(E=>E.group_id!=null&&Number(E.group_id)>0):s});function V(s){return typeof s=="string"?s.split(",").filter(Boolean):[]}function G(s){return["90m","24h","7d","30d"].includes(String(s))?s:"90m"}function fe(s){return["platform","platform_group","platform_model","platform_group_model"].includes(s)?s:"platform_group"}function se(s,y){return(y?["models","errors","users"]:["models","errors"]).includes(s)?s:"models"}function Te(s){return["overall","success","ttft","cache"].includes(s)?s:"overall"}function pt(s){return s==="line"?"line":"pulse"}function _e(){c.replace({query:{range:g.value.range,platform:g.value.platforms.join(",")||void 0,group:g.value.groupIds.join(",")||void 0,model:g.value.models.join(",")||void 0,group_by:T.value,health_mode:A.value,trend_view:B.value==="line"?"line":void 0,tab:M.value}})}async function ft(s,y=ee){const E={range:g.value.range,platforms:[],groupIds:[],models:[]},U=await qt(E,_.value,s);y===ee&&(P.value=U)}async function Ue(s,y=ee){const[E,U]=await Promise.all([Ut(g.value,_.value,s),Ht(g.value,T.value,_.value,s)]);y===ee&&(h.value=E,W.value=U,bt(),await Ge(s,y))}async function Se(s=!0){K==null||K.abort();const y=new AbortController;K=y;const E=++ee;Y.value=!0,s||(q.value=!0);try{await Promise.all([ft(y.signal,E),Ue(y.signal,E)])}catch(U){U.name!=="CanceledError"&&d.showError(ye(U,l("channelMonitorV2.loadFailed")))}finally{E===ee&&(q.value=!1,ae.value=!1,Y.value=!1)}}async function He(s=!0){K==null||K.abort();const y=new AbortController;K=y;const E=++ee;Y.value=!0,s||(q.value=!0);try{await Ue(y.signal,E)}catch(U){U.name!=="CanceledError"&&d.showError(ye(U,l("channelMonitorV2.loadFailed")))}finally{E===ee&&(q.value=!1,ae.value=!1,Y.value=!1)}}async function Ge(s,y=ee){ae.value=!0;try{M.value==="models"?R.value=(await Gt(g.value,_.value,s)).items||[]:M.value==="errors"?L.value=(await Zt(g.value,_.value,s)).items||[]:$.value?O.value=(await Kt(g.value,_.value,s)).items||[]:O.value=[]}catch(E){const U=E;if((U==null?void 0:U.name)==="AbortError"||(U==null?void 0:U.name)==="CanceledError"||(U==null?void 0:U.code)==="ERR_CANCELED")return;
2d.showError(ye(E,l("channelMonitorV2.detailLoadFailed")))}finally{y===ee&&(ae.value=!1)}}function gt(s){g.value.range=s}function vt(){g.value={...g.value,platforms:[],groupIds:[],models:[]}}function bt(){var y,E;le&&(window.clearInterval(le),le=null);const s=u.value?10:((E=(y=h.value)==null?void 0:y.config)==null?void 0:E.refresh_interval_seconds)||300;le=window.setInterval(()=>{!q.value&&!Y.value&&Se(!0)},Math.max(u.value?10:60,s)*1e3)}function xt(s){g.value.platforms=[s.platform],g.value.models=[s.model]}function Le(s){return We(s)}function yt(s){return Intl.NumberFormat(x.value||void 0,{maximumFractionDigits:2}).format(s||0)}function De(s){return lt(s)}function Ee(s){return Intl.NumberFormat(x.value||void 0,{maximumFractionDigits:3}).format(qe(s))}function ue(s){return Re(s)}function Ie(s){return ie(s)}function kt(s,y){return Sn(s,y)}function Ne(s){return it(s.p50_ms,s.p90_ms,s.avg_ms,s.p95_ms)}function _t(s){return Tn(s.avg_ms,s.p90_ms,s.p95_ms)}function wt(s){return new Intl.DateTimeFormat(x.value||void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(s))}function Mt(s){return!s||typeof s=="string"?`status-dot health-${s||"unknown"}`:`status-dot ${s.score!=null?st(s,"overall",0):`health-${s.overall||"unknown"}`}`}function $t(s){const y=`channelMonitorV2.errorCategories.${s}`;return b(y)?l(y):s}function Vt(s){const y=new Set(oe.value);y.has(s)?y.delete(s):y.add(s),oe.value=y}let Ze=g.value.range;return ne(g,()=>{_e();const s=g.value.range!==Ze;Ze=g.value.range,s?Se(!0):He(!0)},{deep:!0}),ne(T,()=>{_e(),He(!0)}),ne(A,_e),ne(B,_e),ne(M,()=>{_e(),Ge()}),ne($,s=>{!s&&M.value==="users"&&(M.value="models")}),Fe(()=>void Se(!1)),Ve(()=>{K==null||K.abort(),le&&window.clearInterval(le)}),(s,y)=>(o(),X(tt,null,{default:Me(()=>{var E,U,Ke;return[e("div",cl,[e("section",ul,[e("header",dl,[e("div",ml,[e("h1",hl,[e("span",pl,[F(ce,{name:"chart",size:"sm"})]),Q(" "+n(r(l)("channelMonitorV2.title")),1)]),e("div",fl,[e("span",gl,[e("span",{class:S(["relative inline-flex h-2 w-2 rounded-full",q.value||Y.value?"bg-gray-400":"bg-green-500"])},null,2)]),Y.value?(o(),i("span",vl,[F(Je,{size:"sm"}),Q(" "+n(r(l)("channelMonitorV2.updating")),1)])):(E=h.value)!=null&&E.coverage.data_through?(o(),i("span",bl,n(r(l)("channelMonitorV2.updatedTo",{time:wt(h.value.coverage.data_through)})),1)):(o(),i("span",xl,n(r(l)("common.loading")),1)),h.value&&!h.value.coverage.coverage_complete&&!u.value?(o(),i("span",yl,n(r(l)("channelMonitorV2.partialCoverage")),1)):C("",!0),u.value?(o(),i("span",kl,[F(Je,{size:"sm"}),Q(" "+n(r(l)("channelMonitorV2.bootstrap.progress",{percent:v.value})),1)])):C("",!0)])]),e("button",{class:"btn btn-secondary btn-icon flex h-8 w-8 items-center justify-center rounded-lg bg-gray-100 text-gray-500 hover:bg-gray-200 dark:bg-dark-700 dark:text-gray-400 dark:hover:bg-dark-600",type:"button",title:r(l)("common.refresh"),disabled:q.value,onClick:y[0]||(y[0]=f=>Se(!1))},[F(ce,{name:"refresh",size:"sm",class:S(q.value?"animate-spin":"")},null,8,["class"])],8,_l)]),u.value?(o(),i("div",wl,[e("div",Ml,[e("div",$l,[e("p",Vl,n(r(l)("channelMonitorV2.bootstrap.title")),1),e("p",Cl,n(r(l)("channelMonitorV2.bootstrap.description")),1)]),e("span",Sl,n(r(l)("channelMonitorV2.bootstrap.progress",{percent:v.value})),1)]),e("div",{class:"mt-2.5 h-1.5 overflow-hidden rounded-full bg-blue-200/80 dark:bg-blue-900/60",role:"progressbar","aria-valuenow":v.value,"aria-valuemin":"0","aria-valuemax":"100","aria-label":r(l)("channelMonitorV2.bootstrap.working")},[e("div",{class:"h-full rounded-full bg-blue-500 transition-[width] duration-500 ease-out dark:bg-blue-400",style:de({width:`${v.value}%`})},null,4)],8,Rl)])):C("",!0),e("div",Tl,[e("div",{class:"tabs inline-flex shrink-0",role:"group","aria-label":r(l)("channelMonitorV2.timeRange")},[(o(!0),i(H,null,Z(D.value,f=>(o(),i("button",{key:f.value,type:"button",class:S(["tab !px-2 !py-1 text-xs sm:!px-2.5",g.value.range===f.value?"tab-active":""]),onClick:te=>gt(f.value)},n(f.label),11,Dl))),128))],8,Ll),y[7]||(y[7]=e("span",{class:"mx-0.5 hidden h-5 w-px shrink-0 bg-gray-200 dark:bg-dark-700 sm:block","aria-hidden":"true"},null,-1)),F(Pe,{modelValue:g.value.platforms,"onUpdate:modelValue":y[1]||(y[1]=f=>g.value.platforms=f),compact:"",label:r(l)("channelMonitorV2.filters.platform"),"all-label":r(l)("channelMonitorV2.filters.allPlatforms"),options:Ce.value},null,8,["modelValue","label","all-label","options"]),F(Pe,{modelValue:be.value,"onUpdate:modelValue":y[2]||(y[2]=f=>be.value=f),compact:"",label:r(l)("channelMonitorV2.filters.group"),"all-label":r(l)("channelMonitorV2.filters.allGroups"),options:ge.value},null,8,["modelValue","label","all-label","options"]),F(Pe,{modelValue:g.value.models,"onUpdate:modelValue":y[3]||(y[3]=f=>
2g.value.models=f),compact:"",label:r(l)("channelMonitorV2.filters.model"),"all-label":r(l)("channelMonitorV2.filters.allModels"),options:ve.value},null,8,["modelValue","label","all-label","options"]),e("button",{type:"button",class:S(["btn btn-ghost btn-sm shrink-0 !px-2 !py-1 text-xs",me.value?"":"opacity-40"]),disabled:!me.value,onClick:vt},n(r(l)("channelMonitorV2.clearFilters")),11,El),y[8]||(y[8]=e("span",{class:"mx-0.5 hidden h-5 w-px shrink-0 bg-gray-200 dark:bg-dark-700 md:block","aria-hidden":"true"},null,-1)),F(Xt,{modelValue:T.value,"onUpdate:modelValue":y[4]||(y[4]=f=>T.value=f),options:j.value,placeholder:r(l)("channelMonitorV2.groupBy.label"),class:"monitor-toolbar-select w-[7.5rem] shrink-0 sm:w-[8.5rem]"},null,8,["modelValue","options","placeholder"]),e("div",{class:"tabs inline-flex shrink-0",role:"group","aria-label":r(l)("channelMonitorV2.trendView.label")},[e("button",{type:"button",class:S(["tab !px-2 !py-1 text-xs",B.value==="pulse"?"tab-active":""]),onClick:y[5]||(y[5]=f=>B.value="pulse")},n(r(l)("channelMonitorV2.trendView.pulse")),3),e("button",{type:"button",class:S(["tab !px-2 !py-1 text-xs",B.value==="line"?"tab-active":""]),onClick:y[6]||(y[6]=f=>B.value="line")},n(r(l)("channelMonitorV2.trendView.line")),3)],8,Il),B.value==="pulse"?(o(),i("div",{key:0,class:"tabs inline-flex shrink-0",role:"group","aria-label":r(l)("channelMonitorV2.healthMode.label")},[(o(!0),i(H,null,Z(z.value,f=>(o(),i("button",{key:f.value,type:"button",class:S(["tab !px-2 !py-1 text-xs",A.value===f.value?"tab-active":""]),onClick:te=>A.value=f.value},n(f.label),11,Pl))),128))],8,Nl)):C("",!0)])]),h.value?(o(),i("section",{key:0,class:S(["grid grid-cols-2 gap-3 sm:grid-cols-3",p.value?"xl:grid-cols-5":"xl:grid-cols-4"]),"aria-label":r(l)("channelMonitorV2.summaryAria")},[F(we,{label:r(l)("channelMonitorV2.metrics.successRate"),value:ue(1-h.value.metrics.error_rate),detail:r(l)("channelMonitorV2.metrics.errorRateValue",{value:ue(h.value.metrics.error_rate)}),state:h.value.health.error_rate},null,8,["label","value","detail","state"]),F(we,{label:r(l)("channelMonitorV2.metrics.ttftP50"),value:Ie(h.value.metrics.ttft.p50_ms),detail:_t(h.value.metrics.ttft),title:Ne(h.value.metrics.ttft),state:kt(h.value.health.ttft,h.value.metrics.ttft)},null,8,["label","value","detail","title","state"]),p.value?(o(),X(we,{key:0,label:r(l)("channelMonitorV2.metrics.tps"),value:De(h.value.metrics.tpm),detail:r(l)("channelMonitorV2.metrics.tpsDetail"),title:Ee(h.value.metrics.tpm)},null,8,["label","value","detail","title"])):C("",!0),F(we,{label:r(l)("channelMonitorV2.metrics.cacheRate"),value:ue(h.value.metrics.cache_rate),detail:r(l)("channelMonitorV2.metrics.cacheDetail"),state:h.value.health.cache||h.value.health.overall},null,8,["label","value","detail","state"]),p.value?(o(),X(we,{key:1,label:r(l)("channelMonitorV2.metrics.rpm"),value:Le(h.value.metrics.rpm),detail:r(l)("channelMonitorV2.metrics.rpmDetail"),title:yt(h.value.metrics.rpm)},null,8,["label","value","detail","title"])):C("",!0)],10,Bl)):q.value?(o(),i("section",{key:1,class:S(["grid grid-cols-2 gap-3 sm:grid-cols-3",p.value?"xl:grid-cols-5":"xl:grid-cols-4"]),"aria-hidden":"true"},[(o(!0),i(H,null,Z(p.value?5:4,f=>(o(),i("div",{key:f,class:"h-24 animate-pulse rounded-2xl bg-gray-50 dark:bg-dark-900/30"}))),128))],2)):C("",!0),e("div",zl,[B.value==="line"?(o(),X(gr,{key:0,trend:((U=h.value)==null?void 0:U.trend)||[],coverage:((Ke=h.value)==null?void 0:Ke.coverage)||null,loading:q.value&&!h.value},null,8,["trend","coverage","loading"])):W.value?(o(),X(il,{key:1,rows:w.value,coverage:W.value.coverage,"health-mode":A.value,"show-throughput":p.value},null,8,["rows","coverage","health-mode","show-throughput"])):q.value?(o(),i("div",Fl,[e("span",Al,n(r(l)("common.loading")),1)])):C("",!0)]),e("section",jl,[e("div",Ol,[e("nav",{class:"tabs w-full max-w-md 
2sm:w-auto",role:"tablist","aria-label":r(l)("channelMonitorV2.tabs.aria")},[(o(!0),i(H,null,Z(N.value,f=>(o(),i("button",{key:f.value,type:"button",role:"tab",class:S(["tab flex-1 sm:flex-none",M.value===f.value?"tab-active":""]),"aria-selected":M.value===f.value,onClick:te=>M.value=f.value},n(f.label),11,ql))),128))],8,Wl)]),e("div",Ul,[M.value==="models"?(o(),i("div",Hl,[e("table",Gl,[e("thead",null,[e("tr",null,[e("th",null,n(r(l)("channelMonitorV2.table.platformModel")),1),e("th",null,n(r(l)("channelMonitorV2.metrics.successRate")),1),e("th",null,n(r(l)("channelMonitorV2.metrics.ttftP50")),1),p.value?(o(),i("th",Zl,n(r(l)("channelMonitorV2.metrics.tps")),1)):C("",!0),e("th",null,n(r(l)("channelMonitorV2.metrics.cacheRate")),1),p.value?(o(),i("th",Kl,n(r(l)("channelMonitorV2.metrics.rpm")),1)):C("",!0)])]),e("tbody",null,[(o(!0),i(H,null,Z(R.value,f=>(o(),i("tr",{key:`${f.platform}:${f.model}`,class:"cursor-pointer",onClick:te=>xt(f)},[e("td",null,[e("div",Yl,[e("span",{class:S(Mt(f.health)),"aria-hidden":"true"},null,2),e("div",null,[e("span",Ql,n(f.platform),1),e("strong",Jl,n(f.model==="__other__"?r(l)("channelMonitorV2.otherModels"):f.model),1)])])]),e("td",null,[e("span",eo,n(ue(1-f.metrics.error_rate)),1),e("small",to,n(r(l)("channelMonitorV2.metrics.errorRateValue",{value:ue(f.metrics.error_rate)})),1)]),e("td",null,[e("span",ao,n(Ie(f.metrics.ttft.p50_ms)),1),e("small",no,n(Ne(f.metrics.ttft)),1)]),p.value?(o(),i("td",{key:0,title:Ee(f.metrics.tpm)},n(De(f.metrics.tpm)),9,ro)):C("",!0),e("td",null,n(ue(f.metrics.cache_rate)),1),p.value?(o(),i("td",lo,n(Le(f.metrics.rpm)),1)):C("",!0)],8,Xl))),128))])])])):M.value==="errors"?(o(),i("div",oo,[(o(!0),i(H,null,Z(L.value,f=>(o(),i("div",{key:f.category,class:S(["rounded-2xl bg-gray-50 p-4 text-sm dark:bg-dark-900/30",f.ignored?"opacity-60":""])},[e("button",{type:"button",class:"grid w-full grid-cols-[minmax(100px,200px)_1fr_auto_auto] items-center gap-3 text-left",onClick:te=>Vt(f.category)},[e("span",io,[e("span",co,n($t(f.category)),1),f.ignored?(o(),i("span",uo,n(r(l)("channelMonitorV2.ignored")),1)):C("",!0)]),e("span",mo,[e("i",{class:S(["block h-full rounded-full",f.ignored?"bg-gray-400 dark:bg-gray-500":"bg-gradient-to-r from-red-400 to-red-500"]),style:de({width:`${Math.max(2,f.rate*100)}%`})},null,6)]),e("small",{class:S(["w-14 text-right text-xs tabular-nums",f.ignored?"text-gray-400":"text-gray-500"])},n(ue(f.rate)),3),F(ce,{name:"chevronDown",size:"sm",class:S(["text-gray-400 transition-transform",oe.value.has(f.category)?"rotate-180":""])},null,8,["class"])],8,so),oe.value.has(f.category)?(o(),i("div",ho,[_.value&&(f.details||[]).length?(o(!0),i(H,{key:0},Z(f.details||[],(te,Ct)=>(o(),i("div",{key:`${f.category}:${Ct}:${te.message}`,class:"rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:bg-dark-900/50 dark:text-dark-300"},[e("div",po,[e("span",fo,n(te.platform||"-"),1),e("span",go,n(te.model||"-"),1),te.status_code?(o(),i("span",vo,n(r(l)("channelMonitorV2.errorDetail.http",{code:te.status_code})),1)):C("",!0),te.upstream_status_code?(o(),i("span",bo,n(r(l)("channelMonitorV2.errorDetail.upstream",{code:te.upstream_status_code})),1)):C("",!0),e("span",xo,"×"+n(te.count),1)]),e("p",yo,n(te.message||te.error_type||r(l)("channelMonitorV2.errorDetail.noMessage")),1)]))),128)):(o(),i("p",ko,n(r(l)("channelMonitorV2.errorDetail.empty")),1))])):C("",!0)],2))),128))])):(o(),i("div",_o,[e("table",wo,[e("thead",null,[e("tr",null,[e("th",Mo,n(r(l)("channelMonitorV2.table.rank")),1),e("th",null,n(r(l)("channelMonitorV2.table.user")),1),e("th",null,n(r(l)("channelMonitorV2.metrics.successRate")),1),e("th",null,n(r(l)("channelMonitorV2.metrics.ttftP50")),1),p.value?(o(),i("th",$o,n(r(l)("channelMonitorV2.metrics.tps")),1)):C("",!0),e("th",null,n(r(l)("channelMonitorV2.metrics.cacheRate")),1),p.value?(o(),i("th",Vo,n(r(l)("channelMonitorV2.metrics.rpm")),1)):C("",!0)])]),e("tbody",null,[(o(!0),i(H,null,Z(O.value,f=>(o(),i("tr",{key:f.user_id||f.display_label,class:S(f.is_self?"bg-primary-50 ring-1 ring-inset ring-primary-200/80 dark:bg-primary-900/25 dark:ring-primary-700/50":"")},[e("td",null,[F(Yn,{rank:f.rank},null,8,["rank"])]),e("td",null,[e("strong",{class:S(["font-semibold",f.is_self?"text-primary-700 dark:text-primary-300":"text-gray-900 dark:text-white"])},[Q(n(f.display_label)+" ",1),f.is_self?(o(),i("span",Co,n(r(l)("channelMonitorV2.currentUser")),1)):C("",!0)],2)]),e("td",null,[e("span",So,n(ue(1-f.metrics.error_rate)),1),e("small",Ro,n(r(l)("channelMonitorV2.metrics.errorRateValue",{value:ue(f.metrics.error_rate)})),1)]),e("td",null,[e("span",To,n(Ie(f.metrics.ttft.p50_ms)),1),e("small",Lo,n(Ne(f.metrics.ttft)),1)]),p.value?(o(),i("td",{key:0,title:Ee(f.metrics.tpm)},n(De(f.metrics.tpm)),9,Do)):C("",!0),e("td",null,n(ue(f.metrics.cache_rate)),1),p.value?(o(),i("td",Eo,n(Le(f.metrics.rpm)),1)):C("",!0)],2))),128))])])])),ae.value?(o(),i("div",Io,n(r(l)("common.loading")),1)):pe.value?(o(),i("div",No,[e("p",Po,n(u.value?r(l)("channelMonitorV2.bootstrap.title"):r(l)("channelMonitorV2.empty.title")),1),e("p",Bo,n(u.value?r(l)("channelMonitorV2.bootstrap.description"):r(l)("channelMonitorV2.empty.description")),1)])):C("",!0)])])])]}),_:1}))}}),Fo=ze(zo,[["__scopeId","data-v-3e0168ae"]]),ns=J({__name:"ChannelStatusView",setup(t){const a=k(()=>It());return(c,m)=>a.value?(o(),X(Mn,{key:0})):(o(),X(Fo,{key:1}))}});
2export{ns as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.