diff --git a/README.md b/README.md index 2fc4648c..f97d177b 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ This branch contains the pre-built frontend assets for Claude Relay Service. These files are automatically generated by the CI/CD pipeline. -Version: 1.1.242 -Build Date: 2025-12-26 06:00:32 UTC +Version: 1.1.243 +Build Date: 2025-12-26 06:36:34 UTC diff --git a/assets/AccountUsageRecordsView-DgdPiUJQ.js b/assets/AccountUsageRecordsView-CUkKidfm.js similarity index 50% rename from assets/AccountUsageRecordsView-DgdPiUJQ.js rename to assets/AccountUsageRecordsView-CUkKidfm.js index affcd3b2..745a4178 100644 --- a/assets/AccountUsageRecordsView-DgdPiUJQ.js +++ b/assets/AccountUsageRecordsView-CUkKidfm.js @@ -1,2 +1,2 @@ -import{E as de,a as ie,b as ce,c as pe,d as ue}from"./element-plus-BUfCkBQO.js";import{b as M}from"./vendor-Dr8jvgFu.js";import{c as K,aW as ge,r as b,_ as O,o as J,q as xe,x as c,z as e,R as u,P as r,u as g,J as w,O as P,Q as $,ac as Y,aU as ye,y as i,I as Q}from"./vue-vendor-R8HMg95E.js";import{c as W,s as j}from"./index-Cr7hSgrN.js";import{f as x,R as me}from"./RecordDetailModal-lW2AGtWL.js";const ke={class:"space-y-4 p-4 lg:p-6"},fe={class:"flex flex-wrap items-center justify-between gap-3"},_e={class:"flex items-center gap-3"},ve={class:"text-xl font-bold text-gray-900 dark:text-gray-100"},he={class:"text-xs text-gray-500 dark:text-gray-400"},be={class:"text-xs text-gray-500 dark:text-gray-400"},we={class:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400"},Re={key:0},Ce={key:1},Ie={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Te={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},De={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},Ke={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Pe={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},Se={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ve={class:"mt-1 text-2xl font-bold text-yellow-600 dark:text-yellow-400"},ze={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Oe={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},$e={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ye={class:"flex flex-wrap items-center gap-3"},je={class:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ee={key:0,class:"flex items-center justify-center p-10 text-gray-500 dark:text-gray-400"},Fe={key:1},Ue={key:0,class:"flex flex-col items-center gap-2 p-10 text-gray-500 dark:text-gray-400"},Me={key:1,class:"space-y-4"},Ne={class:"hidden overflow-x-auto md:block"},Ae={class:"min-w-full divide-y divide-gray-200 dark:divide-gray-800"},Be={class:"divide-y divide-gray-200 bg-white dark:divide-gray-800 dark:bg-gray-900"},He={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},qe={class:"px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},Le={class:"flex flex-col"},Ge={class:"font-semibold"},Je={class:"text-xs text-gray-500 dark:text-gray-400"},Qe={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},We={class:"whitespace-nowrap px-4 py-3 text-sm text-blue-600 dark:text-blue-400"},Ze={class:"whitespace-nowrap px-4 py-3 text-sm text-green-600 dark:text-green-400"},Xe={class:"whitespace-nowrap px-4 py-3 text-sm text-purple-600 dark:text-purple-400"},et={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},tt={class:"whitespace-nowrap px-4 py-3 text-sm text-yellow-600 dark:text-yellow-400"},at={class:"whitespace-nowrap px-4 py-3 text-right text-sm"},st={class:"space-y-3 md:hidden"},ot={class:"flex items-center justify-between"},rt={class:"text-sm font-semibold text-gray-900 dark:text-gray-100"},lt={class:"text-xs text-gray-500 dark:text-gray-400"},nt={class:"text-xs text-gray-500 dark:text-gray-400"},dt={class:"mt-3 grid grid-cols-2 gap-2 text-sm text-gray-700 dark:text-gray-300"},it={class:"text-yellow-600 dark:text-yellow-400"},ct={class:"flex items-center justify-between px-4 pb-4"},pt={class:"text-sm text-gray-500 dark:text-gray-400"},ft={__name:"AccountUsageRecordsView",setup(ut){const N=ge(),Z=ye(),f=K(()=>N.params.accountId),I=K(()=>N.query.platform),E=b(!1),S=b(!1),V=b([]),A=b([]),B=b([]),n=O({currentPage:1,pageSize:50,totalRecords:0}),s=O({dateRange:null,model:"",apiKeyId:"",sortOrder:"desc"}),y=O({totalRequests:0,totalTokens:0,totalCost:0,avgCost:0}),R=O({id:f.value,name:"",platform:I.value||""}),F=b(!1),U=b(null),X=K(()=>R.name||R.id||f.value),H=K(()=>{const o={claude:"Claude官方","claude-console":"Claude Console",ccr:"Claude Console Relay",openai:"OpenAI","openai-responses":"OpenAI Responses",gemini:"Gemini","gemini-api":"Gemini API",droid:"Droid",unknown:"未知渠道"},t=R.platform||I.value||"unknown";return o[t]||"未知渠道"}),q=K(()=>!s.dateRange||s.dateRange.length!==2?"":`${T(s.dateRange[0])} ~ ${T(s.dateRange[1])}`),T=o=>o?M(o).format("YYYY-MM-DD HH:mm:ss"):"--",D=o=>{const t=typeof o=="number"?o:0;return t>=1?`$${t.toFixed(2)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`},L=o=>{const t={page:o,pageSize:n.pageSize,sortOrder:s.sortOrder};return s.model&&(t.model=s.model),s.apiKeyId&&(t.apiKeyId=s.apiKeyId),s.dateRange&&s.dateRange.length===2&&(t.startDate=M(s.dateRange[0]).toISOString(),t.endDate=M(s.dateRange[1]).toISOString()),I.value&&(t.platform=I.value),t},ee=o=>{var m,k,_,a,v;V.value=o.records||[];const t=o.pagination||{};n.currentPage=t.currentPage||1,n.pageSize=t.pageSize||n.pageSize,n.totalRecords=t.totalRecords||0;const l=o.filters||{};if(l.model!==void 0&&(s.model=l.model||""),l.apiKeyId!==void 0&&(s.apiKeyId=l.apiKeyId||""),l.sortOrder&&(s.sortOrder=l.sortOrder),l.startDate&&l.endDate){const h=[l.startDate,l.endDate],d=s.dateRange||[];(d[0]!==h[0]||d[1]!==h[1])&&(s.dateRange=h)}const p=o.summary||{};y.totalRequests=p.totalRequests||0,y.totalTokens=p.totalTokens||0,y.totalCost=p.totalCost||0,y.avgCost=p.avgCost||0,R.id=((m=o.accountInfo)==null?void 0:m.id)||f.value,R.name=((k=o.accountInfo)==null?void 0:k.name)||"",R.platform=((_=o.accountInfo)==null?void 0:_.platform)||I.value||"",A.value=((a=o.availableFilters)==null?void 0:a.models)||[],B.value=((v=o.availableFilters)==null?void 0:v.apiKeys)||[]},C=async(o=n.currentPage)=>{E.value=!0;try{const t=await W.get(`/admin/accounts/${f.value}/usage-records`,{params:L(o)});ee(t.data||{})}catch(t){j(`加载请求记录失败:${t.message||"未知错误"}`,"error")}finally{E.value=!1}},te=o=>{n.currentPage=o,C(o)},ae=o=>{n.pageSize=o,n.currentPage=1,C(1)},se=()=>{s.model="",s.apiKeyId="",s.dateRange=null,s.sortOrder="desc",n.currentPage=1,C(1)},G=o=>{U.value=o,F.value=!0},oe=()=>{F.value=!1,U.value=null},re=()=>{Z.push("/accounts")},le=async()=>{var o;if(!S.value){S.value=!0;try{const t=[];let l=1,p=1;const m=50;for(;l<=p&&l<=m;){const z=(await W.get(`/admin/accounts/${f.value}/usage-records`,{params:{...L(l),pageSize:200}})).data||{};t.push(...z.records||[]),p=((o=z.pagination)==null?void 0:o.totalPages)||1,l+=1}if(t.length===0){j("没有可导出的记录","info");return}const _=[["时间","API Key","模型","输入Token","输出Token","缓存创建Token","缓存读取Token","总Token","费用"].join(",")];t.forEach(d=>{const z=[T(d.timestamp),d.apiKeyName||d.apiKeyId||"",d.model||"",d.inputTokens||0,d.outputTokens||0,d.cacheCreateTokens||0,d.cacheReadTokens||0,d.totalTokens||0,d.costFormatted||D(d.cost)];_.push(z.map(ne=>`"${String(ne).replace(/"/g,'""')}"`).join(","))});const a=new Blob([_.join(` -`)],{type:"text/csv;charset=utf-8;"}),v=URL.createObjectURL(a),h=document.createElement("a");h.href=v,h.download=`account-${f.value}-usage-records.csv`,h.click(),URL.revokeObjectURL(v),j("导出 CSV 成功","success")}catch(t){j(`导出失败:${t.message||"未知错误"}`,"error")}finally{S.value=!1}}};return J(()=>[s.model,s.apiKeyId,s.sortOrder],()=>{n.currentPage=1,C(1)}),J(()=>s.dateRange,()=>{n.currentPage=1,C(1)},{deep:!0}),xe(()=>{C()}),(o,t)=>{const l=de,p=ue,m=ie,k=ce,_=pe;return i(),c("div",ke,[e("div",fe,[e("div",_e,[e("button",{class:"rounded-full border border-gray-200 px-3 py-2 text-sm text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",onClick:re}," ← 返回 "),e("div",null,[t[4]||(t[4]=e("p",{class:"text-xs font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-400"}," 账户请求详情时间线 ",-1)),e("h2",ve,r(X.value),1),e("p",he,"ID: "+r(f.value),1),e("p",be,"渠道:"+r(H.value),1)])]),e("div",we,[t[5]||(t[5]=e("i",{class:"fas fa-clock text-blue-500"},null,-1)),q.value?(i(),c("span",Re,r(q.value),1)):(i(),c("span",Ce,"显示近 5000 条记录"))])]),e("div",Ie,[e("div",Te,[t[6]||(t[6]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总请求",-1)),e("p",De,r(g(x)(y.totalRequests)),1)]),e("div",Ke,[t[7]||(t[7]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总 Token",-1)),e("p",Pe,r(g(x)(y.totalTokens)),1)]),e("div",Se,[t[8]||(t[8]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总费用",-1)),e("p",Ve,r(D(y.totalCost)),1)]),e("div",ze,[t[9]||(t[9]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"平均费用/次",-1)),e("p",Oe,r(D(y.avgCost)),1)])]),e("div",$e,[e("div",Ye,[u(l,{modelValue:s.dateRange,"onUpdate:modelValue":t[0]||(t[0]=a=>s.dateRange=a),class:"max-w-[320px]",clearable:"","end-placeholder":"结束时间",format:"YYYY-MM-DD HH:mm:ss","start-placeholder":"开始时间",type:"datetimerange","unlink-panels":"","value-format":"YYYY-MM-DDTHH:mm:ss[Z]"},null,8,["modelValue"]),u(m,{modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=a=>s.model=a),class:"w-[180px]",clearable:"",filterable:"",placeholder:"所有模型"},{default:w(()=>[(i(!0),c($,null,Y(A.value,a=>(i(),Q(p,{key:a,label:a,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(m,{modelValue:s.apiKeyId,"onUpdate:modelValue":t[2]||(t[2]=a=>s.apiKeyId=a),class:"w-[220px]",clearable:"",filterable:"",placeholder:"所有 API Key"},{default:w(()=>[(i(!0),c($,null,Y(B.value,a=>(i(),Q(p,{key:a.id,label:a.name||a.id,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(m,{modelValue:s.sortOrder,"onUpdate:modelValue":t[3]||(t[3]=a=>s.sortOrder=a),class:"w-[140px]",placeholder:"排序"},{default:w(()=>[u(p,{label:"时间降序",value:"desc"}),u(p,{label:"时间升序",value:"asc"})]),_:1},8,["modelValue"]),u(k,{onClick:se},{default:w(()=>t[10]||(t[10]=[e("i",{class:"fas fa-undo mr-2"},null,-1),P(" 重置 ",-1)])),_:1,__:[10]}),u(k,{loading:S.value,type:"primary",onClick:le},{default:w(()=>t[11]||(t[11]=[e("i",{class:"fas fa-file-export mr-2"},null,-1),P(" 导出 CSV ",-1)])),_:1,__:[11]},8,["loading"])])]),e("div",je,[E.value?(i(),c("div",Ee,t[12]||(t[12]=[e("i",{class:"fas fa-spinner fa-spin mr-2"},null,-1),P(" 加载中... ",-1)]))):(i(),c("div",Fe,[V.value.length===0?(i(),c("div",Ue,t[13]||(t[13]=[e("i",{class:"fas fa-inbox text-2xl"},null,-1),e("p",null,"暂无记录",-1)]))):(i(),c("div",Me,[e("div",Ne,[e("table",Ae,[t[15]||(t[15]=e("thead",{class:"bg-gray-50 dark:bg-gray-800"},[e("tr",null,[e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 时间 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," API Key "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 模型 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 输入 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 输出 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 缓存(创/读) "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 总 Token "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 费用 "),e("th",{class:"px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 操作 ")])],-1)),e("tbody",Be,[(i(!0),c($,null,Y(V.value,a=>(i(),c("tr",{key:a.timestamp+a.model},[e("td",He,r(T(a.timestamp)),1),e("td",qe,[e("div",Le,[e("span",Ge,r(a.apiKeyName||a.apiKeyId||"未知 Key"),1),e("span",Je," ID: "+r(a.apiKeyId),1)])]),e("td",Qe,r(a.model),1),e("td",We,r(g(x)(a.inputTokens)),1),e("td",Ze,r(g(x)(a.outputTokens)),1),e("td",Xe,r(g(x)(a.cacheCreateTokens))+" / "+r(g(x)(a.cacheReadTokens)),1),e("td",et,r(g(x)(a.totalTokens)),1),e("td",tt,r(a.costFormatted||D(a.cost)),1),e("td",at,[u(k,{size:"small",onClick:v=>G(a)},{default:w(()=>t[14]||(t[14]=[P("详情",-1)])),_:2,__:[14]},1032,["onClick"])])]))),128))])])]),e("div",st,[(i(!0),c($,null,Y(V.value,a=>(i(),c("div",{key:a.timestamp+a.model,class:"rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},[e("div",ot,[e("div",null,[e("p",rt,r(a.apiKeyName||a.apiKeyId||"未知 Key"),1),e("p",lt," ID: "+r(a.apiKeyId)+" · "+r(T(a.timestamp)),1),e("p",nt," 渠道:"+r(H.value),1)]),u(k,{size:"small",onClick:v=>G(a)},{default:w(()=>t[16]||(t[16]=[P("详情",-1)])),_:2,__:[16]},1032,["onClick"])]),e("div",dt,[e("div",null,"模型:"+r(a.model),1),e("div",null,"总 Token:"+r(g(x)(a.totalTokens)),1),e("div",null,"输入:"+r(g(x)(a.inputTokens)),1),e("div",null,"输出:"+r(g(x)(a.outputTokens)),1),e("div",null," 缓存创/读:"+r(g(x)(a.cacheCreateTokens))+" / "+r(g(x)(a.cacheReadTokens)),1),e("div",it," 费用:"+r(a.costFormatted||D(a.cost)),1)])]))),128))]),e("div",ct,[e("div",pt," 共 "+r(n.totalRecords)+" 条记录 ",1),u(_,{background:"","current-page":n.currentPage,layout:"prev, pager, next, sizes","page-size":n.pageSize,"page-sizes":[20,50,100,200],total:n.totalRecords,onCurrentChange:te,onSizeChange:ae},null,8,["current-page","page-size","total"])])]))]))]),u(me,{record:U.value,show:F.value,onClose:oe},null,8,["record","show"])])}}};export{ft as default}; +import{E as de,a as ie,b as ce,c as pe,d as ue}from"./element-plus-CKhypU-Q.js";import{b as M}from"./vendor-Dr8jvgFu.js";import{c as K,aW as ge,r as b,_ as O,o as J,q as xe,x as c,z as e,R as u,P as r,u as g,J as w,O as P,Q as $,ac as Y,aU as ye,y as i,I as Q}from"./vue-vendor-BVUySZOn.js";import{c as W,s as j}from"./index-BAse2XU9.js";import{f as x,R as me}from"./RecordDetailModal-CVWv3dXE.js";import"./chart-ChB167Jv.js";const ke={class:"space-y-4 p-4 lg:p-6"},fe={class:"flex flex-wrap items-center justify-between gap-3"},_e={class:"flex items-center gap-3"},ve={class:"text-xl font-bold text-gray-900 dark:text-gray-100"},he={class:"text-xs text-gray-500 dark:text-gray-400"},be={class:"text-xs text-gray-500 dark:text-gray-400"},we={class:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400"},Re={key:0},Ce={key:1},Ie={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Te={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},De={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},Ke={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Pe={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},Se={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ve={class:"mt-1 text-2xl font-bold text-yellow-600 dark:text-yellow-400"},ze={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Oe={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},$e={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ye={class:"flex flex-wrap items-center gap-3"},je={class:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ee={key:0,class:"flex items-center justify-center p-10 text-gray-500 dark:text-gray-400"},Fe={key:1},Ue={key:0,class:"flex flex-col items-center gap-2 p-10 text-gray-500 dark:text-gray-400"},Me={key:1,class:"space-y-4"},Ne={class:"hidden overflow-x-auto md:block"},Ae={class:"min-w-full divide-y divide-gray-200 dark:divide-gray-800"},Be={class:"divide-y divide-gray-200 bg-white dark:divide-gray-800 dark:bg-gray-900"},He={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},qe={class:"px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},Le={class:"flex flex-col"},Ge={class:"font-semibold"},Je={class:"text-xs text-gray-500 dark:text-gray-400"},Qe={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},We={class:"whitespace-nowrap px-4 py-3 text-sm text-blue-600 dark:text-blue-400"},Ze={class:"whitespace-nowrap px-4 py-3 text-sm text-green-600 dark:text-green-400"},Xe={class:"whitespace-nowrap px-4 py-3 text-sm text-purple-600 dark:text-purple-400"},et={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},tt={class:"whitespace-nowrap px-4 py-3 text-sm text-yellow-600 dark:text-yellow-400"},at={class:"whitespace-nowrap px-4 py-3 text-right text-sm"},st={class:"space-y-3 md:hidden"},ot={class:"flex items-center justify-between"},rt={class:"text-sm font-semibold text-gray-900 dark:text-gray-100"},lt={class:"text-xs text-gray-500 dark:text-gray-400"},nt={class:"text-xs text-gray-500 dark:text-gray-400"},dt={class:"mt-3 grid grid-cols-2 gap-2 text-sm text-gray-700 dark:text-gray-300"},it={class:"text-yellow-600 dark:text-yellow-400"},ct={class:"flex items-center justify-between px-4 pb-4"},pt={class:"text-sm text-gray-500 dark:text-gray-400"},_t={__name:"AccountUsageRecordsView",setup(ut){const N=ge(),Z=ye(),f=K(()=>N.params.accountId),I=K(()=>N.query.platform),E=b(!1),S=b(!1),V=b([]),A=b([]),B=b([]),n=O({currentPage:1,pageSize:50,totalRecords:0}),s=O({dateRange:null,model:"",apiKeyId:"",sortOrder:"desc"}),y=O({totalRequests:0,totalTokens:0,totalCost:0,avgCost:0}),R=O({id:f.value,name:"",platform:I.value||""}),F=b(!1),U=b(null),X=K(()=>R.name||R.id||f.value),H=K(()=>{const o={claude:"Claude官方","claude-console":"Claude Console",ccr:"Claude Console Relay",openai:"OpenAI","openai-responses":"OpenAI Responses",gemini:"Gemini","gemini-api":"Gemini API",droid:"Droid",unknown:"未知渠道"},t=R.platform||I.value||"unknown";return o[t]||"未知渠道"}),q=K(()=>!s.dateRange||s.dateRange.length!==2?"":`${T(s.dateRange[0])} ~ ${T(s.dateRange[1])}`),T=o=>o?M(o).format("YYYY-MM-DD HH:mm:ss"):"--",D=o=>{const t=typeof o=="number"?o:0;return t>=1?`$${t.toFixed(2)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`},L=o=>{const t={page:o,pageSize:n.pageSize,sortOrder:s.sortOrder};return s.model&&(t.model=s.model),s.apiKeyId&&(t.apiKeyId=s.apiKeyId),s.dateRange&&s.dateRange.length===2&&(t.startDate=M(s.dateRange[0]).toISOString(),t.endDate=M(s.dateRange[1]).toISOString()),I.value&&(t.platform=I.value),t},ee=o=>{var m,k,_,a,v;V.value=o.records||[];const t=o.pagination||{};n.currentPage=t.currentPage||1,n.pageSize=t.pageSize||n.pageSize,n.totalRecords=t.totalRecords||0;const l=o.filters||{};if(l.model!==void 0&&(s.model=l.model||""),l.apiKeyId!==void 0&&(s.apiKeyId=l.apiKeyId||""),l.sortOrder&&(s.sortOrder=l.sortOrder),l.startDate&&l.endDate){const h=[l.startDate,l.endDate],d=s.dateRange||[];(d[0]!==h[0]||d[1]!==h[1])&&(s.dateRange=h)}const p=o.summary||{};y.totalRequests=p.totalRequests||0,y.totalTokens=p.totalTokens||0,y.totalCost=p.totalCost||0,y.avgCost=p.avgCost||0,R.id=((m=o.accountInfo)==null?void 0:m.id)||f.value,R.name=((k=o.accountInfo)==null?void 0:k.name)||"",R.platform=((_=o.accountInfo)==null?void 0:_.platform)||I.value||"",A.value=((a=o.availableFilters)==null?void 0:a.models)||[],B.value=((v=o.availableFilters)==null?void 0:v.apiKeys)||[]},C=async(o=n.currentPage)=>{E.value=!0;try{const t=await W.get(`/admin/accounts/${f.value}/usage-records`,{params:L(o)});ee(t.data||{})}catch(t){j(`加载请求记录失败:${t.message||"未知错误"}`,"error")}finally{E.value=!1}},te=o=>{n.currentPage=o,C(o)},ae=o=>{n.pageSize=o,n.currentPage=1,C(1)},se=()=>{s.model="",s.apiKeyId="",s.dateRange=null,s.sortOrder="desc",n.currentPage=1,C(1)},G=o=>{U.value=o,F.value=!0},oe=()=>{F.value=!1,U.value=null},re=()=>{Z.push("/accounts")},le=async()=>{var o;if(!S.value){S.value=!0;try{const t=[];let l=1,p=1;const m=50;for(;l<=p&&l<=m;){const z=(await W.get(`/admin/accounts/${f.value}/usage-records`,{params:{...L(l),pageSize:200}})).data||{};t.push(...z.records||[]),p=((o=z.pagination)==null?void 0:o.totalPages)||1,l+=1}if(t.length===0){j("没有可导出的记录","info");return}const _=[["时间","API Key","模型","输入Token","输出Token","缓存创建Token","缓存读取Token","总Token","费用"].join(",")];t.forEach(d=>{const z=[T(d.timestamp),d.apiKeyName||d.apiKeyId||"",d.model||"",d.inputTokens||0,d.outputTokens||0,d.cacheCreateTokens||0,d.cacheReadTokens||0,d.totalTokens||0,d.costFormatted||D(d.cost)];_.push(z.map(ne=>`"${String(ne).replace(/"/g,'""')}"`).join(","))});const a=new Blob([_.join(` +`)],{type:"text/csv;charset=utf-8;"}),v=URL.createObjectURL(a),h=document.createElement("a");h.href=v,h.download=`account-${f.value}-usage-records.csv`,h.click(),URL.revokeObjectURL(v),j("导出 CSV 成功","success")}catch(t){j(`导出失败:${t.message||"未知错误"}`,"error")}finally{S.value=!1}}};return J(()=>[s.model,s.apiKeyId,s.sortOrder],()=>{n.currentPage=1,C(1)}),J(()=>s.dateRange,()=>{n.currentPage=1,C(1)},{deep:!0}),xe(()=>{C()}),(o,t)=>{const l=de,p=ue,m=ie,k=ce,_=pe;return i(),c("div",ke,[e("div",fe,[e("div",_e,[e("button",{class:"rounded-full border border-gray-200 px-3 py-2 text-sm text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",onClick:re}," ← 返回 "),e("div",null,[t[4]||(t[4]=e("p",{class:"text-xs font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-400"}," 账户请求详情时间线 ",-1)),e("h2",ve,r(X.value),1),e("p",he,"ID: "+r(f.value),1),e("p",be,"渠道:"+r(H.value),1)])]),e("div",we,[t[5]||(t[5]=e("i",{class:"fas fa-clock text-blue-500"},null,-1)),q.value?(i(),c("span",Re,r(q.value),1)):(i(),c("span",Ce,"显示近 5000 条记录"))])]),e("div",Ie,[e("div",Te,[t[6]||(t[6]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总请求",-1)),e("p",De,r(g(x)(y.totalRequests)),1)]),e("div",Ke,[t[7]||(t[7]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总 Token",-1)),e("p",Pe,r(g(x)(y.totalTokens)),1)]),e("div",Se,[t[8]||(t[8]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总费用",-1)),e("p",Ve,r(D(y.totalCost)),1)]),e("div",ze,[t[9]||(t[9]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"平均费用/次",-1)),e("p",Oe,r(D(y.avgCost)),1)])]),e("div",$e,[e("div",Ye,[u(l,{modelValue:s.dateRange,"onUpdate:modelValue":t[0]||(t[0]=a=>s.dateRange=a),class:"max-w-[320px]",clearable:"","end-placeholder":"结束时间",format:"YYYY-MM-DD HH:mm:ss","start-placeholder":"开始时间",type:"datetimerange","unlink-panels":"","value-format":"YYYY-MM-DDTHH:mm:ss[Z]"},null,8,["modelValue"]),u(m,{modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=a=>s.model=a),class:"w-[180px]",clearable:"",filterable:"",placeholder:"所有模型"},{default:w(()=>[(i(!0),c($,null,Y(A.value,a=>(i(),Q(p,{key:a,label:a,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(m,{modelValue:s.apiKeyId,"onUpdate:modelValue":t[2]||(t[2]=a=>s.apiKeyId=a),class:"w-[220px]",clearable:"",filterable:"",placeholder:"所有 API Key"},{default:w(()=>[(i(!0),c($,null,Y(B.value,a=>(i(),Q(p,{key:a.id,label:a.name||a.id,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),u(m,{modelValue:s.sortOrder,"onUpdate:modelValue":t[3]||(t[3]=a=>s.sortOrder=a),class:"w-[140px]",placeholder:"排序"},{default:w(()=>[u(p,{label:"时间降序",value:"desc"}),u(p,{label:"时间升序",value:"asc"})]),_:1},8,["modelValue"]),u(k,{onClick:se},{default:w(()=>t[10]||(t[10]=[e("i",{class:"fas fa-undo mr-2"},null,-1),P(" 重置 ",-1)])),_:1,__:[10]}),u(k,{loading:S.value,type:"primary",onClick:le},{default:w(()=>t[11]||(t[11]=[e("i",{class:"fas fa-file-export mr-2"},null,-1),P(" 导出 CSV ",-1)])),_:1,__:[11]},8,["loading"])])]),e("div",je,[E.value?(i(),c("div",Ee,t[12]||(t[12]=[e("i",{class:"fas fa-spinner fa-spin mr-2"},null,-1),P(" 加载中... ",-1)]))):(i(),c("div",Fe,[V.value.length===0?(i(),c("div",Ue,t[13]||(t[13]=[e("i",{class:"fas fa-inbox text-2xl"},null,-1),e("p",null,"暂无记录",-1)]))):(i(),c("div",Me,[e("div",Ne,[e("table",Ae,[t[15]||(t[15]=e("thead",{class:"bg-gray-50 dark:bg-gray-800"},[e("tr",null,[e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 时间 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," API Key "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 模型 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 输入 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 输出 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 缓存(创/读) "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 总 Token "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 费用 "),e("th",{class:"px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 操作 ")])],-1)),e("tbody",Be,[(i(!0),c($,null,Y(V.value,a=>(i(),c("tr",{key:a.timestamp+a.model},[e("td",He,r(T(a.timestamp)),1),e("td",qe,[e("div",Le,[e("span",Ge,r(a.apiKeyName||a.apiKeyId||"未知 Key"),1),e("span",Je," ID: "+r(a.apiKeyId),1)])]),e("td",Qe,r(a.model),1),e("td",We,r(g(x)(a.inputTokens)),1),e("td",Ze,r(g(x)(a.outputTokens)),1),e("td",Xe,r(g(x)(a.cacheCreateTokens))+" / "+r(g(x)(a.cacheReadTokens)),1),e("td",et,r(g(x)(a.totalTokens)),1),e("td",tt,r(a.costFormatted||D(a.cost)),1),e("td",at,[u(k,{size:"small",onClick:v=>G(a)},{default:w(()=>t[14]||(t[14]=[P("详情",-1)])),_:2,__:[14]},1032,["onClick"])])]))),128))])])]),e("div",st,[(i(!0),c($,null,Y(V.value,a=>(i(),c("div",{key:a.timestamp+a.model,class:"rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},[e("div",ot,[e("div",null,[e("p",rt,r(a.apiKeyName||a.apiKeyId||"未知 Key"),1),e("p",lt," ID: "+r(a.apiKeyId)+" · "+r(T(a.timestamp)),1),e("p",nt," 渠道:"+r(H.value),1)]),u(k,{size:"small",onClick:v=>G(a)},{default:w(()=>t[16]||(t[16]=[P("详情",-1)])),_:2,__:[16]},1032,["onClick"])]),e("div",dt,[e("div",null,"模型:"+r(a.model),1),e("div",null,"总 Token:"+r(g(x)(a.totalTokens)),1),e("div",null,"输入:"+r(g(x)(a.inputTokens)),1),e("div",null,"输出:"+r(g(x)(a.outputTokens)),1),e("div",null," 缓存创/读:"+r(g(x)(a.cacheCreateTokens))+" / "+r(g(x)(a.cacheReadTokens)),1),e("div",it," 费用:"+r(a.costFormatted||D(a.cost)),1)])]))),128))]),e("div",ct,[e("div",pt," 共 "+r(n.totalRecords)+" 条记录 ",1),u(_,{background:"","current-page":n.currentPage,layout:"prev, pager, next, sizes","page-size":n.pageSize,"page-sizes":[20,50,100,200],total:n.totalRecords,onCurrentChange:te,onSizeChange:ae},null,8,["current-page","page-size","total"])])]))]))]),u(me,{record:U.value,show:F.value,onClose:oe},null,8,["record","show"])])}}};export{_t as default}; diff --git a/assets/AccountsView-2rnZ6KJ6.js b/assets/AccountsView-DXROeeN3.js similarity index 99% rename from assets/AccountsView-2rnZ6KJ6.js rename to assets/AccountsView-DXROeeN3.js index e88a8de2..7702b7bc 100644 --- a/assets/AccountsView-2rnZ6KJ6.js +++ b/assets/AccountsView-DXROeeN3.js @@ -1,4 +1,4 @@ -import{b as Kr,e as br,f as Sr}from"./element-plus-BUfCkBQO.js";import{r as w,aP as Mr,o as we,V as Ya,x as n,y as o,z as e,L as y,K as b,al as ze,aT as Nt,O as f,aq as L,aa as Dr,P as u,aV as Ha,aY as ba,C as K,c as se,Z as jr,an as Ke,Q as Ae,q as ta,I as Je,ac as We,a5 as Mt,R as Oe,B as He,u as st,aX as Pr,aU as Lr,D as ar,_ as vr,J as nt,Y as St}from"./vue-vendor-R8HMg95E.js";import{c as B,s as j,_ as aa,a as zr,A as Ja}from"./index-Cr7hSgrN.js";import{C as kr}from"./ConfirmModal-CZV4xGP-.js";import{C as Rr}from"./chart-yFHxLHpB.js";import{C as Ba,_ as Vr}from"./ActionDropdown-C3hc7yXw.js";import"./vendor-Dr8jvgFu.js";const Qa=w(!1),gr=w({title:"",message:"",confirmText:"继续",cancelText:"取消"}),Et=w(null);function hr(){return{showConfirmModal:Qa,confirmOptions:gr,showConfirm:(N,T,z="继续",C="取消")=>new Promise(A=>{gr.value={title:N,message:T,confirmText:z,cancelText:C},Et.value=A,Qa.value=!0}),handleConfirm:()=>{Qa.value=!1,Et.value&&(Et.value(!0),Et.value=null)},handleCancel:()=>{Qa.value=!1,Et.value&&(Et.value(!1),Et.value=null)}}}const wr=Mr("accounts",()=>{const H=w([]),De=w([]),g=w([]),N=w([]),T=w([]),z=w([]),C=w([]),A=w([]),v=w(!1),k=w(null),F=w(""),ie=w("asc"),Z=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/claude-accounts");if(h.success)H.value=h.data||[];else throw new Error(h.message||"获取Claude账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},de=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/claude-console-accounts");if(h.success)De.value=h.data||[];else throw new Error(h.message||"获取Claude Console账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},Q=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/bedrock-accounts");if(h.success)g.value=h.data||[];else throw new Error(h.message||"获取Bedrock账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},q=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/gemini-accounts");if(h.success)N.value=h.data||[];else throw new Error(h.message||"获取Gemini账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},R=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/openai-accounts");if(h.success)T.value=h.data||[];else throw new Error(h.message||"获取OpenAI账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},c=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/azure-openai-accounts");if(h.success)z.value=h.data||[];else throw new Error(h.message||"获取Azure OpenAI账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},p=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/openai-responses-accounts");if(h.success)C.value=h.data||[];else throw new Error(h.message||"获取OpenAI-Responses账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}},D=async()=>{v.value=!0,k.value=null;try{const h=await B.get("/admin/droid-accounts");if(h.success)A.value=h.data||[];else throw new Error(h.message||"获取Droid账户失败")}catch(h){throw k.value=h.message,h}finally{v.value=!1}};return{claudeAccounts:H,claudeConsoleAccounts:De,bedrockAccounts:g,geminiAccounts:N,openaiAccounts:T,azureOpenaiAccounts:z,openaiResponsesAccounts:C,droidAccounts:A,loading:v,error:k,sortBy:F,sortOrder:ie,fetchClaudeAccounts:Z,fetchClaudeConsoleAccounts:de,fetchBedrockAccounts:Q,fetchGeminiAccounts:q,fetchOpenAIAccounts:R,fetchAzureOpenAIAccounts:c,fetchOpenAIResponsesAccounts:p,fetchDroidAccounts:D,fetchAllAccounts:async()=>{v.value=!0,k.value=null;try{await Promise.all([Z(),de(),Q(),q(),R(),c(),p(),D()])}catch(h){throw k.value=h.message,h}finally{v.value=!1}},createClaudeAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/claude-accounts",h);if(m.success)return await Z(),m.data;throw new Error(m.message||"创建Claude账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createClaudeConsoleAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/claude-console-accounts",h);if(m.success)return await de(),m.data;throw new Error(m.message||"创建Claude Console账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createBedrockAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/bedrock-accounts",h);if(m.success)return await Q(),m.data;throw new Error(m.message||"创建Bedrock账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createGeminiAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/gemini-accounts",h);if(m.success)return await q(),m.data;throw new Error(m.message||"创建Gemini账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createOpenAIAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/openai-accounts",h);if(m.success)return await R(),m.data;throw new Error(m.message||"创建OpenAI账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createDroidAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/droid-accounts",h);if(m.success)return await D(),m.data;throw new Error(m.message||"创建Droid账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},updateDroidAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/droid-accounts/${h}`,m);if(O.success)return await D(),O.data;throw new Error(O.message||"更新Droid账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},createAzureOpenAIAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/azure-openai-accounts",h);if(m.success)return await c(),m.data;throw new Error(m.message||"创建Azure OpenAI账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createOpenAIResponsesAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/openai-responses-accounts",h);if(m.success)return await p(),m.data;throw new Error(m.message||"创建OpenAI-Responses账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},createGeminiApiAccount:async h=>{v.value=!0,k.value=null;try{const m=await B.post("/admin/gemini-api-accounts",h);if(m.success)return await q(),m.data;throw new Error(m.message||"创建Gemini API账户失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},updateClaudeAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/claude-accounts/${h}`,m);if(O.success)return await Z(),O;throw new Error(O.message||"更新Claude账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateClaudeConsoleAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/claude-console-accounts/${h}`,m);if(O.success)return await de(),O;throw new Error(O.message||"更新Claude Console账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateBedrockAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/bedrock-accounts/${h}`,m);if(O.success)return await Q(),O;throw new Error(O.message||"更新Bedrock账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateGeminiAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/gemini-accounts/${h}`,m);if(O.success)return await q(),O;throw new Error(O.message||"更新Gemini账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateOpenAIAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/openai-accounts/${h}`,m);if(O.success)return await R(),O;throw new Error(O.message||"更新OpenAI账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateAzureOpenAIAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/azure-openai-accounts/${h}`,m);if(O.success)return await c(),O;throw new Error(O.message||"更新Azure OpenAI账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateOpenAIResponsesAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/openai-responses-accounts/${h}`,m);if(O.success)return await p(),O;throw new Error(O.message||"更新OpenAI-Responses账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},updateGeminiApiAccount:async(h,m)=>{v.value=!0,k.value=null;try{const O=await B.put(`/admin/gemini-api-accounts/${h}`,m);if(O.success)return await q(),O;throw new Error(O.message||"更新Gemini API账户失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},toggleAccount:async(h,m)=>{v.value=!0,k.value=null;try{let O;h==="claude"?O=`/admin/claude-accounts/${m}/toggle`:h==="claude-console"?O=`/admin/claude-console-accounts/${m}/toggle`:h==="bedrock"?O=`/admin/bedrock-accounts/${m}/toggle`:h==="gemini"?O=`/admin/gemini-accounts/${m}/toggle`:h==="openai"?O=`/admin/openai-accounts/${m}/toggle`:h==="azure_openai"?O=`/admin/azure-openai-accounts/${m}/toggle`:h==="openai-responses"?O=`/admin/openai-responses-accounts/${m}/toggle`:O=`/admin/openai-accounts/${m}/toggle`;const Qe=await B.put(O);if(Qe.success)return h==="claude"?await Z():h==="claude-console"?await de():h==="bedrock"?await Q():h==="gemini"?await q():h==="openai"?await R():h==="azure_openai"?await c():h==="openai-responses"?await p():await R(),Qe;throw new Error(Qe.message||"切换状态失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},deleteAccount:async(h,m)=>{v.value=!0,k.value=null;try{let O;h==="claude"?O=`/admin/claude-accounts/${m}`:h==="claude-console"?O=`/admin/claude-console-accounts/${m}`:h==="bedrock"?O=`/admin/bedrock-accounts/${m}`:h==="gemini"?O=`/admin/gemini-accounts/${m}`:h==="openai"?O=`/admin/openai-accounts/${m}`:h==="azure_openai"?O=`/admin/azure-openai-accounts/${m}`:h==="openai-responses"?O=`/admin/openai-responses-accounts/${m}`:O=`/admin/openai-accounts/${m}`;const Qe=await B.delete(O);if(Qe.success)return h==="claude"?await Z():h==="claude-console"?await de():h==="bedrock"?await Q():h==="gemini"?await q():h==="openai"?await R():h==="azure_openai"?await c():h==="openai-responses"?await p():await R(),Qe;throw new Error(Qe.message||"删除失败")}catch(O){throw k.value=O.message,O}finally{v.value=!1}},refreshClaudeToken:async h=>{v.value=!0,k.value=null;try{const m=await B.post(`/admin/claude-accounts/${h}/refresh`);if(m.success)return await Z(),m;throw new Error(m.message||"Token刷新失败")}catch(m){throw k.value=m.message,m}finally{v.value=!1}},generateClaudeAuthUrl:async h=>{try{const m=await B.post("/admin/claude-accounts/generate-auth-url",h);if(m.success)return m.data;throw new Error(m.message||"生成授权URL失败")}catch(m){throw k.value=m.message,m}},exchangeClaudeCode:async h=>{try{const m=await B.post("/admin/claude-accounts/exchange-code",h);if(m.success)return m.data;throw new Error(m.message||"交换授权码失败")}catch(m){throw k.value=m.message,m}},generateClaudeSetupTokenUrl:async h=>{try{const m=await B.post("/admin/claude-accounts/generate-setup-token-url",h);if(m.success)return m.data;throw new Error(m.message||"生成Setup Token URL失败")}catch(m){throw k.value=m.message,m}},exchangeClaudeSetupTokenCode:async h=>{try{const m=await B.post("/admin/claude-accounts/exchange-setup-token-code",h);if(m.success)return m.data;throw new Error(m.message||"交换Setup Token授权码失败")}catch(m){throw k.value=m.message,m}},oauthWithCookie:async h=>{try{const m=await B.post("/admin/claude-accounts/oauth-with-cookie",h);if(m.success)return m.data;throw new Error(m.message||"Cookie授权失败")}catch(m){throw k.value=m.message,m}},oauthSetupTokenWithCookie:async h=>{try{const m=await B.post("/admin/claude-accounts/setup-token-with-cookie",h);if(m.success)return m.data;throw new Error(m.message||"Cookie授权失败")}catch(m){throw k.value=m.message,m}},generateGeminiAuthUrl:async h=>{try{const m=await B.post("/admin/gemini-accounts/generate-auth-url",h);if(m.success)return m.data;throw new Error(m.message||"生成授权URL失败")}catch(m){throw k.value=m.message,m}},exchangeGeminiCode:async h=>{try{const m=await B.post("/admin/gemini-accounts/exchange-code",h);if(m.success)return m.data;throw new Error(m.message||"交换授权码失败")}catch(m){throw k.value=m.message,m}},generateOpenAIAuthUrl:async h=>{try{const m=await B.post("/admin/openai-accounts/generate-auth-url",h);if(m.success)return m.data;throw new Error(m.message||"生成授权URL失败")}catch(m){throw k.value=m.message,m}},exchangeOpenAICode:async h=>{try{const m=await B.post("/admin/openai-accounts/exchange-code",h);if(m.success)return m.data;throw new Error(m.message||"交换授权码失败")}catch(m){throw k.value=m.message,m}},generateDroidAuthUrl:async h=>{k.value=null;try{const m=await B.post("/admin/droid-accounts/generate-auth-url",h);if(m.success)return m.data;throw new Error(m.message||"生成授权URL失败")}catch(m){throw k.value=m.message,m}},exchangeDroidCode:async h=>{k.value=null;try{return await B.post("/admin/droid-accounts/exchange-code",h)}catch(m){throw k.value=m.message,m}},sortAccounts:h=>{F.value===h?ie.value=ie.value==="asc"?"desc":"asc":(F.value=h,ie.value="asc")},reset:()=>{H.value=[],De.value=[],g.value=[],N.value=[],T.value=[],z.value=[],C.value=[],A.value=[],v.value=!1,k.value=null,F.value="",ie.value="asc"}}}),Or={class:"space-y-4"},Er={class:"flex items-center justify-between"},Nr={class:"flex cursor-pointer items-center"},qr={key:0,class:"space-y-4 rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-800"},Fr={class:"relative"},Wr={key:0,class:"mt-1 text-xs text-red-500"},Gr={key:1,class:"mt-1 text-xs text-green-500"},Br={class:"grid grid-cols-2 gap-4"},Qr={class:"space-y-4"},Hr={class:"flex items-center"},Jr={key:0,class:"grid grid-cols-2 gap-4"},Yr={class:"relative"},Zr=["type"],rr={__name:"ProxyConfig",props:{modelValue:{type:Object,default:()=>({enabled:!1,type:"socks5",host:"",port:"",username:"",password:""})}},emits:["update:modelValue"],setup(H,{emit:De}){const g=H,N=De,T=w({...g.modelValue}),z=w(!!(T.value.username||T.value.password)),C=w(!1),A=w(""),v=w(""),k=w(!1);we(()=>g.modelValue,R=>{JSON.stringify(R)!==JSON.stringify(T.value)&&(T.value={...R},z.value=!!(R.username||R.password))},{deep:!0}),we(()=>T.value.enabled,()=>{ie()}),we(()=>T.value.type,()=>{ie()}),we(()=>T.value.host,()=>{ie()}),we(()=>T.value.port,()=>{ie()}),we(()=>T.value.username,()=>{ie()}),we(()=>T.value.password,()=>{ie()}),we(z,R=>{R||(T.value.username="",T.value.password="",ie())});let F=null;function ie(){F&&clearTimeout(F),F=setTimeout(()=>{const R={...T.value};z.value||(R.username="",R.password=""),N("update:modelValue",R)},100)}function Z(){if(v.value="",k.value=!1,!!A.value)try{const R=A.value.split("#")[0].trim();if(!R)return;const c=/^(socks5|https?):\/\/(?:([^:@]+):([^@]+)@)?([^:]+):(\d+)$/i,p=R.match(c);if(!p){const Y=/^([^:]+):(\d+)$/,re=R.match(Y);if(re){T.value.type="socks5",T.value.host=re[1],T.value.port=re[2],T.value.username="",T.value.password="",z.value=!1,k.value=!0,ie(),setTimeout(()=>{k.value=!1},3e3);return}v.value="无效的代理URL格式,请检查输入";return}const[,D,ge,G,I,U]=p;T.value.type=D.toLowerCase(),T.value.host=I,T.value.port=U,ge&&G?(T.value.username=decodeURIComponent(ge),T.value.password=decodeURIComponent(G),z.value=!0):(T.value.username="",T.value.password="",z.value=!1),k.value=!0,ie(),setTimeout(()=>{k.value=!1},3e3)}catch{v.value="解析失败,请检查URL格式"}}function de(){A.value="",v.value="",k.value=!1}function Q(){setTimeout(()=>{Z()},0)}function q(){const R=A.value.trim();R.includes("://")?(/^(socks5|https?):\/\/[^:]+:\d+/i.test(R)||/^(socks5|https?):\/\/[^:@]+:[^@]+@[^:]+:\d+/i.test(R))&&Z():/^[^:]+:\d{2,5}$/.test(R)&&Z()}return Ya(()=>{F&&clearTimeout(F)}),(R,c)=>(o(),n("div",Or,[e("div",Er,[c[10]||(c[10]=e("h4",{class:"text-sm font-semibold text-gray-700 dark:text-gray-300"},"代理设置 (可选)",-1)),e("label",Nr,[b(e("input",{"onUpdate:modelValue":c[0]||(c[0]=p=>T.value.enabled=p),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[ze,T.value.enabled]]),c[9]||(c[9]=e("span",{class:"ml-2 text-sm text-gray-700 dark:text-gray-300"},"启用代理",-1))])]),T.value.enabled?(o(),n("div",qr,[c[22]||(c[22]=Nt('
配置代理以访问受限的网络资源。支持 SOCKS5 和 HTTP 代理。
请确保代理服务器稳定可用,否则会影响账户的正常使用。
配置代理以访问受限的网络资源。支持 SOCKS5 和 HTTP 代理。
请确保代理服务器稳定可用,否则会影响账户的正常使用。
自定义您的站点品牌名称
上传自定义图标或输入图标URL
控制登录按钮在首页的显示
启用后,所有 /api/v1/messages 和 /claude/v1/messages 端点将强制验证 Claude Code CLI 客户端
此设置与 API Key 级别的客户端限制是 OR 逻辑:全局启用或 API Key 设置中启用,都会执行 Claude Code 验证。
启用后,系统会将原始会话 ID 绑定到首次使用的账户,确保上下文的一致性
工作原理:系统会提取请求中的原始 session ID (来自 metadata.user_id), 并将其与首次调度的账户绑定。后续使用相同 session ID 的请求将自动路由到同一账户。
新会话识别:如果绑定会话历史中没有该sessionId但请求中 messages.length > 1, 系统会认为这是一个污染的会话并拒绝请求。
启用后,同一账户的用户消息请求将串行执行,并在请求之间添加延迟,防止触发上游限流
工作原理:系统检测请求中最后一条消息的 role 是否为 user。用户消息请求需要排队串行执行,而工具调用结果、助手消息续传等不受此限制。
当 API Key 并发请求超限时进入队列等待,而非直接拒绝
工作原理:当 API Key 的并发请求超过 concurrencyLimit 时,超限请求会进入队列等待而非直接返回 429。适合 Claude Code Agent 并行工具调用场景。
配置未登录用户可见的统计数据
自定义您的站点品牌名称
上传自定义图标或输入图标URL
控制登录按钮在首页的显示
启用后,所有 /api/v1/messages 和 /claude/v1/messages 端点将强制验证 Claude Code CLI 客户端
此设置与 API Key 级别的客户端限制是 OR 逻辑:全局启用或 API Key 设置中启用,都会执行 Claude Code 验证。
启用后,系统会将原始会话 ID 绑定到首次使用的账户,确保上下文的一致性
工作原理:系统会提取请求中的原始 session ID (来自 metadata.user_id), 并将其与首次调度的账户绑定。后续使用相同 session ID 的请求将自动路由到同一账户。
新会话识别:如果绑定会话历史中没有该sessionId但请求中 messages.length > 1, 系统会认为这是一个污染的会话并拒绝请求。
启用后,同一账户的用户消息请求将串行执行,并在请求之间添加延迟,防止触发上游限流
工作原理:系统检测请求中最后一条消息的 role 是否为 user。用户消息请求需要排队串行执行,而工具调用结果、助手消息续传等不受此限制。
当 API Key 并发请求超限时进入队列等待,而非直接拒绝
工作原理:当 API Key 的并发请求超过 concurrencyLimit 时,超限请求会进入队列等待而非直接返回 429。适合 Claude Code Agent 并行工具调用场景。
Claude Code 需要 Node.js 环境才能运行。
方法一:官网下载(推荐)
https://nodejs.org/.msi 文件 方法二:使用包管理器
如果你安装了 Chocolatey 或 Scoop,可以使用命令行安装:
安装完成后,打开 PowerShell 或 CMD,输入以下命令:
如果显示版本号,说明安装成功了!
打开 PowerShell 或 CMD,运行以下命令:
这个命令会从 npm 官方仓库下载并安装最新版本的 Claude Code。
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
查看已设置的环境变量:
💡 设置后需要重新打开 PowerShell 窗口才能生效。
',3))])])]),t[35]||(t[35]=m('如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:C:\\Users\\你的用户名\\.claude\\config.json
💡 如果该文件不存在,请手动创建。
设置完环境变量后,可以通过以下命令验证是否设置成功:
在 PowerShell 中验证:
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;在 Windows 中可直接编辑 C:\\Users\\你的用户名\\.factory\\config.json。
现在你可以开始使用 Claude Code 了!
这通常是权限问题,尝试以下解决方法:
npm config set prefix %APPDATA%\\npm如果遇到执行策略限制,运行:
设置永久环境变量后需要:
echo $env:ANTHROPIC_BASE_URLClaude Code 需要 Node.js 环境才能运行。
方法一:使用 Homebrew(推荐)
如果你已经安装了 Homebrew,使用它安装 Node.js 会更方便:
方法二:官网下载
https://nodejs.org/.pkg 文件 sudo安装完成后,打开 Terminal,输入以下命令:
如果显示版本号,说明安装成功了!
打开 Terminal,运行以下命令:
如果遇到权限问题,可以使用 sudo:
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:~/.claude/config.json
💡 如果该文件不存在,请手动创建。
在 Terminal 中验证:
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;你可以在 Finder 中按 ⌘ + Shift + G 并输入路径,或运行 open ~/.factory 快速打开配置目录。
现在你可以开始使用 Claude Code 了!
尝试以下解决方法:
sudo npm install -g @anthropic-ai/claude-codenpm config set prefix ~/.npm-global如果系统阻止运行 Claude Code:
sudo spctl --master-disable检查以下几点:
echo $ANTHROPIC_BASE_URLClaude Code 需要 Node.js 环境才能运行。
方法一:使用官方仓库(推荐)
方法二:使用系统包管理器
虽然版本可能不是最新的,但对于基本使用已经足够:
sudo安装完成后,打开终端,输入以下命令:
如果显示版本号,说明安装成功了!
打开终端,运行以下命令:
如果遇到权限问题,可以使用 sudo:
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
在终端中验证:
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:~/.claude/config.json
💡 如果该文件不存在,请手动创建。
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;在 Linux 或 WSL2 中,可直接编辑 /home/你的用户名/.factory/config.json 或在终端运行 xdg-open ~/.factory 打开目录。
现在你可以开始使用 Claude Code 了!
尝试以下解决方法:
sudo npm install -g @anthropic-ai/claude-codenpm config set prefix ~/.npm-globalexport PATH=~/.npm-global/bin:$PATH某些 Linux 发行版需要安装额外依赖:
检查以下几点:
source ~/.bashrcecho $ANTHROPIC_BASE_URLClaude Code 需要 Node.js 环境才能运行。
方法一:官网下载(推荐)
https://nodejs.org/.msi 文件 方法二:使用包管理器
如果你安装了 Chocolatey 或 Scoop,可以使用命令行安装:
安装完成后,打开 PowerShell 或 CMD,输入以下命令:
如果显示版本号,说明安装成功了!
打开 PowerShell 或 CMD,运行以下命令:
这个命令会从 npm 官方仓库下载并安装最新版本的 Claude Code。
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
查看已设置的环境变量:
💡 设置后需要重新打开 PowerShell 窗口才能生效。
',3))])])]),t[35]||(t[35]=m('如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:C:\\Users\\你的用户名\\.claude\\config.json
💡 如果该文件不存在,请手动创建。
设置完环境变量后,可以通过以下命令验证是否设置成功:
在 PowerShell 中验证:
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;在 Windows 中可直接编辑 C:\\Users\\你的用户名\\.factory\\config.json。
现在你可以开始使用 Claude Code 了!
这通常是权限问题,尝试以下解决方法:
npm config set prefix %APPDATA%\\npm如果遇到执行策略限制,运行:
设置永久环境变量后需要:
echo $env:ANTHROPIC_BASE_URLClaude Code 需要 Node.js 环境才能运行。
方法一:使用 Homebrew(推荐)
如果你已经安装了 Homebrew,使用它安装 Node.js 会更方便:
方法二:官网下载
https://nodejs.org/.pkg 文件 sudo安装完成后,打开 Terminal,输入以下命令:
如果显示版本号,说明安装成功了!
打开 Terminal,运行以下命令:
如果遇到权限问题,可以使用 sudo:
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:~/.claude/config.json
💡 如果该文件不存在,请手动创建。
在 Terminal 中验证:
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;你可以在 Finder 中按 ⌘ + Shift + G 并输入路径,或运行 open ~/.factory 快速打开配置目录。
现在你可以开始使用 Claude Code 了!
尝试以下解决方法:
sudo npm install -g @anthropic-ai/claude-codenpm config set prefix ~/.npm-global如果系统阻止运行 Claude Code:
sudo spctl --master-disable检查以下几点:
echo $ANTHROPIC_BASE_URLClaude Code 需要 Node.js 环境才能运行。
方法一:使用官方仓库(推荐)
方法二:使用系统包管理器
虽然版本可能不是最新的,但对于基本使用已经足够:
sudo安装完成后,打开终端,输入以下命令:
如果显示版本号,说明安装成功了!
打开终端,运行以下命令:
如果遇到权限问题,可以使用 sudo:
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
在终端中验证:
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:~/.claude/config.json
💡 如果该文件不存在,请手动创建。
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;在 Linux 或 WSL2 中,可直接编辑 /home/你的用户名/.factory/config.json 或在终端运行 xdg-open ~/.factory 打开目录。
现在你可以开始使用 Claude Code 了!
尝试以下解决方法:
sudo npm install -g @anthropic-ai/claude-codenpm config set prefix ~/.npm-globalexport PATH=~/.npm-global/bin:$PATH某些 Linux 发行版需要安装额外依赖:
检查以下几点:
source ~/.bashrcecho $ANTHROPIC_BASE_URLDaily usage trends would be displayed here
(Chart integration can be added with Chart.js, D3.js, or similar library)
Daily usage trends would be displayed here
(Chart integration can be added with Chart.js, D3.js, or similar library)
Sign in to your account to manage your API keys
Sign in to your account to manage your API keys
=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n m&&(m=_),h=(d*h+y)/++d):(v(),i.lineTo(y,_),g=k,d=0,p=m=_),b=_}v()}function pi(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?cl:ll}function hl(i){return i.stepped?la:i.tension||i.cubicInterpolationMode==="monotone"?ca:At}function dl(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Wn(i,t.options),i.stroke(n)}function ul(i,t,e,s){const{segments:n,options:o}=t,a=pi(t);for(const r of n)Wn(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const fl=typeof Path2D=="function";function gl(i,t,e,s){fl&&!t.options.segment?dl(i,t,e,s):ul(i,t,e,s)}class bt extends ot{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;ta(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=pa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,a=Pn(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=hl(s);let c,h;for(c=0,h=a.length;c ${c} ${c} 配置代理以访问受限的网络资源。支持 SOCKS5 和 HTTP 代理。 请确保代理服务器稳定可用,否则会影响账户的正常使用。 配置代理以访问受限的网络资源。支持 SOCKS5 和 HTTP 代理。 请确保代理服务器稳定可用,否则会影响账户的正常使用。 自定义您的站点品牌名称 上传自定义图标或输入图标URL 控制登录按钮在首页的显示 启用后,所有 c.box.fullSize),!0),s=Xt(Ut(t,"left"),!0),n=Xt(Ut(t,"right")),o=Xt(Ut(t,"top"),!0),a=Xt(Ut(t,"bottom")),r=ds(t,"x"),l=ds(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ut(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function us(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Ln(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function er(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!T(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Ln(a,o.getPadding());const r=Math.max(0,t.outerWidth-us(a,i,"left","right")),l=Math.max(0,t.outerHeight-us(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function ir(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function sr(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function Jt(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);Ln(u,J(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=Za(l.concat(c),d);Jt(r.fullSize,f,d,g),Jt(l,f,d,g),Jt(c,f,d,g)&&Jt(l,f,d,g),ir(f),fs(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,fs(r.rightAndBottom,f,d,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},I(r.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Rn{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class nr extends Rn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Te="$chartjs",or={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},gs=i=>i===null||i==="";function ar(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Te]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",gs(n)){const o=Ji(i,"width");o!==void 0&&(i.width=o)}if(gs(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Ji(i,"height");o!==void 0&&(i.height=o)}return i}const In=ra?{passive:!0}:!1;function rr(i,t,e){i&&i.addEventListener(t,e,In)}function lr(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,In)}function cr(i,t){const e=or[i.type]||i.type,{x:s,y:n}=Ct(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function We(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function hr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||We(r.addedNodes,s),a=a&&!We(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function dr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||We(r.removedNodes,s),a=a&&!We(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const he=new Map;let ps=0;function En(){const i=window.devicePixelRatio;i!==ps&&(ps=i,he.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function ur(i,t){he.size||window.addEventListener("resize",En),he.set(i,t)}function fr(i){he.delete(i),he.size||window.removeEventListener("resize",En)}function gr(i,t,e){const s=i.canvas,n=s&&Ii(s);if(!n)return;const o=hn((r,l)=>{const c=n.clientWidth;e(r,l),ci==="left"?"right":i==="right"?"left":i,ms=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,bs=(i,t)=>Math.min(t||i,i);function xs(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o({width:a[P]||0,height:r[P]||0});return{first:w(0),last:w(e-1),widest:w(k),highest:w(S),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return fo(this._alignToPixels?wt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&te.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},n=Dn(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&$e(e,n),t.controller.draw(),n&&Ye(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return gt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=qa.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=vt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);re(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ht.remove(this),t=0,e=this.data.datasets.length;ti.height-s/2?"bottom":"center"}function cc(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function hc(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),cc(c,i,t,e)&&(c="center"),c}function Ns(i,t,e){const s=e.yAlign||t.yAlign||lc(i,e);return{xAlign:e.xAlign||t.xAlign||hc(i,t,e,s),yAlign:s}}function dc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function uc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Hs(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Tt(a);let g=dc(t,r);const p=uc(t,l,c);return l==="center"?r==="left"?g+=c:r==="right"&&(g-=c):r==="left"?g-=Math.max(h,u)+n:r==="right"&&(g+=Math.max(d,f)+n),{x:Y(g,0,s.width-t.width),y:Y(p,0,s.height-t.height)}}function Se(i,t,e){const s=J(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function js(i){return at([],dt(i))}function fc(i,t,e){return vt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function $s(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Gn={beforeTitle:ct,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?Gn[t].call(e,s):n}class xi extends ot{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new Cn(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=fc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=Q(s,"beforeTitle",this,t),o=Q(s,"title",this,t),a=Q(s,"afterTitle",this,t);let r=[];return r=at(r,dt(n)),r=at(r,dt(o)),r=at(r,dt(a)),r}getBeforeBody(t,e){return js(Q(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return I(t,o=>{const a={before:[],lines:[],after:[]},r=$s(s,o);at(a.before,dt(Q(r,"beforeLabel",this,o))),at(a.lines,Q(r,"label",this,o)),at(a.after,dt(Q(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return js(Q(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=Q(s,"beforeFooter",this,t),o=Q(s,"footer",this,t),a=Q(s,"afterFooter",this,t);let r=[];return r=at(r,dt(n)),r=at(r,dt(o)),r=at(r,dt(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;ln?{start:t-e,end:t}:{start:t,end:t+e}}function kc(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?R/o:0;for(let l=0;l{const n=z(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?kc(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=F/(this._pointLabels.length||1),s=this.options.startAngle||0;return G(t*e+st(s))}getDistanceFromCenterForValue(t){if(O(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t+p)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return z(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=ft(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=ft(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class ki extends ue{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=we(e,this.min),this._tableRange=we(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;ai.height-s/2?"bottom":"center"}function cc(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function hc(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),cc(c,i,t,e)&&(c="center"),c}function Ns(i,t,e){const s=e.yAlign||t.yAlign||lc(i,e);return{xAlign:e.xAlign||t.xAlign||hc(i,t,e,s),yAlign:s}}function dc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function uc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Hs(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Tt(a);let g=dc(t,r);const p=uc(t,l,c);return l==="center"?r==="left"?g+=c:r==="right"&&(g-=c):r==="left"?g-=Math.max(h,u)+n:r==="right"&&(g+=Math.max(d,f)+n),{x:Y(g,0,s.width-t.width),y:Y(p,0,s.height-t.height)}}function Se(i,t,e){const s=J(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function js(i){return at([],dt(i))}function fc(i,t,e){return vt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function $s(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Gn={beforeTitle:ct,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?Gn[t].call(e,s):n}class xi extends ot{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new Cn(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=fc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=Q(s,"beforeTitle",this,t),o=Q(s,"title",this,t),a=Q(s,"afterTitle",this,t);let r=[];return r=at(r,dt(n)),r=at(r,dt(o)),r=at(r,dt(a)),r}getBeforeBody(t,e){return js(Q(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return I(t,o=>{const a={before:[],lines:[],after:[]},r=$s(s,o);at(a.before,dt(Q(r,"beforeLabel",this,o))),at(a.lines,Q(r,"label",this,o)),at(a.after,dt(Q(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return js(Q(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=Q(s,"beforeFooter",this,t),o=Q(s,"footer",this,t),a=Q(s,"afterFooter",this,t);let r=[];return r=at(r,dt(n)),r=at(r,dt(o)),r=at(r,dt(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;ln?{start:t-e,end:t}:{start:t,end:t+e}}function kc(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?R/o:0;for(let l=0;l{const n=z(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?kc(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=F/(this._pointLabels.length||1),s=this.options.startAngle||0;return G(t*e+st(s))}getDistanceFromCenterForValue(t){if(O(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t+p)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return z(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=ft(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=ft(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class ki extends ue{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=we(e,this.min),this._tableRange=we(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a
");return i.innerHTML=`
+ ${s}
`:""}
+
");return i.innerHTML=`
- ${s}
`:""}
- 0)return;if(dn){let t=dn;for(dn=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;fn;){let t=fn;for(fn=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function hi(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function pi(e){let t,n=e.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),gr(s),dc(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}e.deps=t,e.depsTail=n}function Bs(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(gi(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function gi(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===bn)||(e.globalVersion=bn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Bs(e))))return;e.flags|=2;const t=e.dep,n=ae,s=Be;ae=e,Be=!0;try{hi(e);const r=e.fn(e._value);(t.version===0||wt(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{ae=n,Be=s,pi(e),e.flags&=-3}}function gr(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)gr(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function dc(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Be=!0;const mi=[];function ct(){mi.push(Be),Be=!1}function at(){const e=mi.pop();Be=e===void 0?!0:e}function Fr(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=ae;ae=void 0;try{t()}finally{ae=n}}}let bn=0;class hc{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class us{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!ae||!Be||ae===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==ae)n=this.activeLink=new hc(ae,this),ae.deps?(n.prevDep=ae.depsTail,ae.depsTail.nextDep=n,ae.depsTail=n):ae.deps=ae.depsTail=n,vi(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=ae.depsTail,n.nextDep=void 0,ae.depsTail.nextDep=n,ae.depsTail=n,ae.deps===n&&(ae.deps=s)}return n}trigger(t){this.version++,bn++,this.notify(t)}notify(t){hr();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{pr()}}}function vi(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)vi(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Qn=new WeakMap,Mt=Symbol(""),Ks=Symbol(""),wn=Symbol("");function ye(e,t,n){if(Be&&ae){let s=Qn.get(e);s||Qn.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new us),r.map=s,r.key=n),r.track()}}function rt(e,t,n,s,r,o){const i=Qn.get(e);if(!i){bn++;return}const l=c=>{c&&c.trigger()};if(hr(),t==="clear")i.forEach(l);else{const c=j(e),u=c&&ur(n);if(c&&n==="length"){const a=Number(s);i.forEach((f,d)=>{(d==="length"||d===wn||!Ke(d)&&d>=a)&&l(f)})}else switch((n!==void 0||i.has(void 0))&&l(i.get(n)),u&&l(i.get(wn)),t){case"add":c?u&&l(i.get("length")):(l(i.get(Mt)),Gt(e)&&l(i.get(Ks)));break;case"delete":c||(l(i.get(Mt)),Gt(e)&&l(i.get(Ks)));break;case"set":Gt(e)&&l(i.get(Mt));break}}pr()}function pc(e,t){const n=Qn.get(e);return n&&n.get(t)}function Vt(e){const t=z(e);return t===e?t:(ye(t,"iterate",wn),$e(e)?t:t.map(pe))}function fs(e){return ye(e=z(e),"iterate",wn),e}const gc={__proto__:null,[Symbol.iterator](){return Ts(this,Symbol.iterator,pe)},concat(...e){return Vt(this).concat(...e.map(t=>j(t)?Vt(t):t))},entries(){return Ts(this,"entries",e=>(e[1]=pe(e[1]),e))},every(e,t){return tt(this,"every",e,t,void 0,arguments)},filter(e,t){return tt(this,"filter",e,t,n=>n.map(pe),arguments)},find(e,t){return tt(this,"find",e,t,pe,arguments)},findIndex(e,t){return tt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return tt(this,"findLast",e,t,pe,arguments)},findLastIndex(e,t){return tt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return tt(this,"forEach",e,t,void 0,arguments)},includes(...e){return As(this,"includes",e)},indexOf(...e){return As(this,"indexOf",e)},join(e){return Vt(this).join(e)},lastIndexOf(...e){return As(this,"lastIndexOf",e)},map(e,t){return tt(this,"map",e,t,void 0,arguments)},pop(){return rn(this,"pop")},push(...e){return rn(this,"push",e)},reduce(e,...t){return jr(this,"reduce",e,t)},reduceRight(e,...t){return jr(this,"reduceRight",e,t)},shift(){return rn(this,"shift")},some(e,t){return tt(this,"some",e,t,void 0,arguments)},splice(...e){return rn(this,"splice",e)},toReversed(){return Vt(this).toReversed()},toSorted(e){return Vt(this).toSorted(e)},toSpliced(...e){return Vt(this).toSpliced(...e)},unshift(...e){return rn(this,"unshift",e)},values(){return Ts(this,"values",pe)}};function Ts(e,t,n){const s=fs(e),r=s[t]();return s!==e&&!$e(e)&&(r._next=r.next,r.next=()=>{const o=r._next();return o.value&&(o.value=n(o.value)),o}),r}const mc=Array.prototype;function tt(e,t,n,s,r,o){const i=fs(e),l=i!==e&&!$e(e),c=i[t];if(c!==mc[t]){const f=c.apply(e,o);return l?pe(f):f}let u=n;i!==e&&(l?u=function(f,d){return n.call(this,pe(f),d,e)}:n.length>2&&(u=function(f,d){return n.call(this,f,d,e)}));const a=c.call(i,u,s);return l&&r?r(a):a}function jr(e,t,n,s){const r=fs(e);let o=n;return r!==e&&($e(e)?n.length>3&&(o=function(i,l,c){return n.call(this,i,l,c,e)}):o=function(i,l,c){return n.call(this,i,pe(l),c,e)}),r[t](o,...s)}function As(e,t,n){const s=z(e);ye(s,"iterate",wn);const r=s[t](...n);return(r===-1||r===!1)&&In(n[0])?(n[0]=z(n[0]),s[t](...n)):r}function rn(e,t,n=[]){ct(),hr();const s=z(e)[t].apply(e,n);return pr(),at(),s}const vc=lr("__proto__,__v_isRef,__isVue"),yi=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ke));function yc(e){Ke(e)||(e=String(e));const t=z(this);return ye(t,"has",e),t.hasOwnProperty(e)}class _i{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?Rc:Ei:o?Si:wi).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=j(t);if(!r){let c;if(i&&(c=gc[n]))return c;if(n==="hasOwnProperty")return yc}const l=Reflect.get(t,n,fe(t)?t:s);return(Ke(n)?yi.has(n):vc(n))||(r||ye(t,"get",n),o)?l:fe(l)?i&&ur(n)?l:l.value:se(l)?r?ds(l):An(l):l}}class bi extends _i{constructor(t=!1){super(!1,t)}set(t,n,s,r){let o=t[n];if(!this._isShallow){const c=St(o);if(!$e(s)&&!St(s)&&(o=z(o),s=z(s)),!j(t)&&fe(o)&&!fe(s))return c?!1:(o.value=s,!0)}const i=j(t)&&ur(n)?Number(n)0)return;if(un){let t=un;for(un=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;cn;){let t=cn;for(cn=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function ci(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function ui(e){let t,n=e.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),ur(s),sc(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}e.deps=t,e.depsTail=n}function $s(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ai(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ai(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===vn)||(e.globalVersion=vn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!$s(e))))return;e.flags|=2;const t=e.dep,n=ce,s=Be;ce=e,Be=!0;try{ci(e);const r=e.fn(e._value);(t.version===0||wt(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{ce=n,Be=s,ui(e),e.flags&=-3}}function ur(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)ur(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function sc(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Be=!0;const fi=[];function ct(){fi.push(Be),Be=!1}function ut(){const e=fi.pop();Be=e===void 0?!0:e}function Nr(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=ce;ce=void 0;try{t()}finally{ce=n}}}let vn=0;class rc{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ls{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!ce||!Be||ce===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==ce)n=this.activeLink=new rc(ce,this),ce.deps?(n.prevDep=ce.depsTail,ce.depsTail.nextDep=n,ce.depsTail=n):ce.deps=ce.depsTail=n,di(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=ce.depsTail,n.nextDep=void 0,ce.depsTail.nextDep=n,ce.depsTail=n,ce.deps===n&&(ce.deps=s)}return n}trigger(t){this.version++,vn++,this.notify(t)}notify(t){lr();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{cr()}}}function di(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)di(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Gn=new WeakMap,Mt=Symbol(""),Ds=Symbol(""),yn=Symbol("");function ve(e,t,n){if(Be&&ce){let s=Gn.get(e);s||Gn.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new ls),r.map=s,r.key=n),r.track()}}function rt(e,t,n,s,r,o){const i=Gn.get(e);if(!i){vn++;return}const l=c=>{c&&c.trigger()};if(lr(),t==="clear")i.forEach(l);else{const c=j(e),a=c&&rr(n);if(c&&n==="length"){const u=Number(s);i.forEach((f,h)=>{(h==="length"||h===yn||!Ke(h)&&h>=u)&&l(f)})}else switch((n!==void 0||i.has(void 0))&&l(i.get(n)),a&&l(i.get(yn)),t){case"add":c?a&&l(i.get("length")):(l(i.get(Mt)),Wt(e)&&l(i.get(Ds)));break;case"delete":c||(l(i.get(Mt)),Wt(e)&&l(i.get(Ds)));break;case"set":Wt(e)&&l(i.get(Mt));break}}cr()}function oc(e,t){const n=Gn.get(e);return n&&n.get(t)}function Vt(e){const t=J(e);return t===e?t:(ve(t,"iterate",yn),$e(e)?t:t.map(pe))}function cs(e){return ve(e=J(e),"iterate",yn),e}const ic={__proto__:null,[Symbol.iterator](){return Es(this,Symbol.iterator,pe)},concat(...e){return Vt(this).concat(...e.map(t=>j(t)?Vt(t):t))},entries(){return Es(this,"entries",e=>(e[1]=pe(e[1]),e))},every(e,t){return tt(this,"every",e,t,void 0,arguments)},filter(e,t){return tt(this,"filter",e,t,n=>n.map(pe),arguments)},find(e,t){return tt(this,"find",e,t,pe,arguments)},findIndex(e,t){return tt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return tt(this,"findLast",e,t,pe,arguments)},findLastIndex(e,t){return tt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return tt(this,"forEach",e,t,void 0,arguments)},includes(...e){return xs(this,"includes",e)},indexOf(...e){return xs(this,"indexOf",e)},join(e){return Vt(this).join(e)},lastIndexOf(...e){return xs(this,"lastIndexOf",e)},map(e,t){return tt(this,"map",e,t,void 0,arguments)},pop(){return tn(this,"pop")},push(...e){return tn(this,"push",e)},reduce(e,...t){return Lr(this,"reduce",e,t)},reduceRight(e,...t){return Lr(this,"reduceRight",e,t)},shift(){return tn(this,"shift")},some(e,t){return tt(this,"some",e,t,void 0,arguments)},splice(...e){return tn(this,"splice",e)},toReversed(){return Vt(this).toReversed()},toSorted(e){return Vt(this).toSorted(e)},toSpliced(...e){return Vt(this).toSpliced(...e)},unshift(...e){return tn(this,"unshift",e)},values(){return Es(this,"values",pe)}};function Es(e,t,n){const s=cs(e),r=s[t]();return s!==e&&!$e(e)&&(r._next=r.next,r.next=()=>{const o=r._next();return o.value&&(o.value=n(o.value)),o}),r}const lc=Array.prototype;function tt(e,t,n,s,r,o){const i=cs(e),l=i!==e&&!$e(e),c=i[t];if(c!==lc[t]){const f=c.apply(e,o);return l?pe(f):f}let a=n;i!==e&&(l?a=function(f,h){return n.call(this,pe(f),h,e)}:n.length>2&&(a=function(f,h){return n.call(this,f,h,e)}));const u=c.call(i,a,s);return l&&r?r(u):u}function Lr(e,t,n,s){const r=cs(e);let o=n;return r!==e&&($e(e)?n.length>3&&(o=function(i,l,c){return n.call(this,i,l,c,e)}):o=function(i,l,c){return n.call(this,i,pe(l),c,e)}),r[t](o,...s)}function xs(e,t,n){const s=J(e);ve(s,"iterate",yn);const r=s[t](...n);return(r===-1||r===!1)&&dr(n[0])?(n[0]=J(n[0]),s[t](...n)):r}function tn(e,t,n=[]){ct(),lr();const s=J(e)[t].apply(e,n);return cr(),ut(),s}const cc=tr("__proto__,__v_isRef,__isVue"),hi=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ke));function uc(e){Ke(e)||(e=String(e));const t=J(this);return ve(t,"has",e),t.hasOwnProperty(e)}class pi{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return o;if(n==="__v_raw")return s===(r?o?_c:yi:o?vi:mi).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=j(t);if(!r){let c;if(i&&(c=ic[n]))return c;if(n==="hasOwnProperty")return uc}const l=Reflect.get(t,n,fe(t)?t:s);return(Ke(n)?hi.has(n):cc(n))||(r||ve(t,"get",n),o)?l:fe(l)?i&&rr(n)?l:l.value:se(l)?r?us(l):On(l):l}}class gi extends pi{constructor(t=!1){super(!1,t)}set(t,n,s,r){let o=t[n];if(!this._isShallow){const c=St(o);if(!$e(s)&&!St(s)&&(o=J(o),s=J(s)),!j(t)&&fe(o)&&!fe(s))return c?!1:(o.value=s,!0)}const i=j(t)&&rr(n)?Number(n)站点名称
站点图标
管理入口
仅允许 Claude Code 客户端